@henryqw/pi-herdr-btw 1.0.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/LICENSE +21 -0
- package/README.md +78 -0
- package/extensions/btw.ts +829 -0
- package/internal/config.ts +253 -0
- package/internal/context-store.ts +287 -0
- package/internal/core.ts +393 -0
- package/internal/merge.ts +317 -0
- package/internal/router.ts +42 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oscar Gabriel
|
|
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
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# `@henryqw/pi-herdr-btw`
|
|
2
|
+
|
|
3
|
+
Pi extension inspired by Claude Code `/btw`, based on [oscabriel/pi-herdr-btw](https://github.com/oscabriel/pi-herdr-btw). Opens a tool-enabled side conversation in a focused Herdr pane without changing parent transcript.
|
|
4
|
+
|
|
5
|
+
## Behavior
|
|
6
|
+
|
|
7
|
+
- snapshots parent's current, compaction-aware context
|
|
8
|
+
- inherits cwd and uses shared task-model routing
|
|
9
|
+
- prefills question for review by default
|
|
10
|
+
- leaves parent session unchanged
|
|
11
|
+
- supports `/btw merge` to return side-thread transcript and follow-up prompt
|
|
12
|
+
- routes Herdr commands through `@henryqw/pi-herdr`
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- Pi v0.84.2+
|
|
17
|
+
- Herdr v0.7.4+
|
|
18
|
+
- Pi running in Herdr-managed pane
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pi install npm:@henryqw/pi-task-models
|
|
24
|
+
pi install npm:@henryqw/pi-herdr-btw
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`pi-task-models` loads `/task-models`, which configures shared model profiles used by side-thread launch.
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
/btw open empty side pane
|
|
33
|
+
/btw <question...> open side pane with draft question
|
|
34
|
+
/btw ask <question...> escape hatch for reserved first words
|
|
35
|
+
/btw config [...] show or change launch defaults
|
|
36
|
+
/btw merge <prompt...> merge side thread into parent and continue
|
|
37
|
+
/btw help show grammar
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`ask`, `config`, `merge`, and `help` route only when they are exact first words. Other input is a question.
|
|
41
|
+
|
|
42
|
+
Model and thinking level come from `@henryqw/pi-task-models`. Task `pi-herdr-btw/btw` defaults to profile `fast`. Run `/task-models` to configure its profile, primary route, and optional fallback. Routes follow Pi's current model scope; first authenticated viable route is selected before pane launch.
|
|
43
|
+
|
|
44
|
+
## Merge
|
|
45
|
+
|
|
46
|
+
In side pane, `/btw merge <prompt>` packages user/assistant turns, sends transcript to parent, refocuses parent pane, and closes side pane. Parent appends transcript without triggering a turn, then submits prompt. Bare `/btw merge` opens editor for prompt.
|
|
47
|
+
|
|
48
|
+
Pending delivery waits for parent to settle and for current model authentication to be ready. Requests survive child shutdown until parent consumes them or 24-hour stale cleanup expires them.
|
|
49
|
+
|
|
50
|
+
## Config
|
|
51
|
+
|
|
52
|
+
`/btw config` persists launch behavior in `~/.pi/agent/config/pi-herdr-btw.json`. Model routing stays in shared `pi-task-models.json` config.
|
|
53
|
+
|
|
54
|
+
Settings:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
/btw config
|
|
58
|
+
/btw config auto-submit on|off
|
|
59
|
+
/btw config tools inherit|all|read-only|none
|
|
60
|
+
/btw config split right|down
|
|
61
|
+
/btw config reset
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Caveats
|
|
65
|
+
|
|
66
|
+
Child gets static parent context. It shares working directory, so enabled tools can change parent-visible files. Large parent contexts can exceed child context limits.
|
|
67
|
+
|
|
68
|
+
Launch data uses a private temporary directory and stale entries expire after 24 hours.
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm test --workspace @henryqw/pi-herdr-btw
|
|
74
|
+
npm run typecheck --workspace @henryqw/pi-herdr-btw
|
|
75
|
+
npm run pack:check --workspace @henryqw/pi-herdr-btw
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
MIT
|