pi-my-compact-ui 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/LICENSE +21 -0
- package/README.md +140 -0
- package/index.ts +1641 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cybershape
|
|
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,140 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# compact-ui
|
|
4
|
+
|
|
5
|
+
### A quiet, structured home for Pi's reasoning and tool calls
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
Based on [pi-compact-ui](https://www.npmjs.com/package/pi-compact-ui) by [@geoffreychen777](https://www.npmjs.com/~geoffreychen777).
|
|
14
|
+
|
|
15
|
+
## Preview
|
|
16
|
+
|
|
17
|
+
Every entry is listed in stream order, oldest first, one line each. The leading
|
|
18
|
+
glyph is a spinner while the entry is still streaming:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
⠋ tool calling...
|
|
22
|
+
│ ✓ thinking: The parser test is failing… · 1.2K tok
|
|
23
|
+
│ ✓ bash: npm test (3.2s)
|
|
24
|
+
└ ⠋ thinking: The assertion is off by one…
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Expand the group to inspect tool arguments, result previews, and more of the
|
|
28
|
+
reasoning content:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
✓ tools done
|
|
32
|
+
├─ ✓ thinking · 1.2K tok
|
|
33
|
+
│ The validation path now handles expired sessions…
|
|
34
|
+
├─ ✓ read: src/auth.ts (0.1s)
|
|
35
|
+
│ export async function authenticate() { …
|
|
36
|
+
└─ ✓ edit: src/auth.ts (0.2s)
|
|
37
|
+
Updated src/auth.ts
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
- Combines reasoning runs and tool calls into a single visual group, kept in the
|
|
43
|
+
order the model produced them.
|
|
44
|
+
- Keeps every reasoning run as its own row: a spinner while it streams, a
|
|
45
|
+
completion mark once it ends. Runs are never merged together.
|
|
46
|
+
- Removes Pi's native hidden-thinking placeholder components so an empty
|
|
47
|
+
thinking label cannot leave phantom blank rows in the transcript.
|
|
48
|
+
- Supports streaming reasoning, streaming tool output, and parallel tool calls.
|
|
49
|
+
- Displays tool state, argument summaries, elapsed time, and result previews.
|
|
50
|
+
- Shows reasoning-token usage. During streaming it uses an estimate, then
|
|
51
|
+
prefers provider-reported usage when available.
|
|
52
|
+
- Follows Pi's standard `Ctrl+O` expand and collapse behavior.
|
|
53
|
+
- Renders fenced code blocks as subtle theme-aware background panels with
|
|
54
|
+
syntax highlighting and one character of horizontal padding instead of
|
|
55
|
+
decorative top and bottom border rows.
|
|
56
|
+
- Preserves Pi's native execution semantics for `read`, `bash`, `edit`, `write`,
|
|
57
|
+
`find`, `grep`, and `ls`.
|
|
58
|
+
- Gives compaction summaries a distinct, compact presentation.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pi install npm:pi-my-compact-ui
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Reload Pi:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
/reload
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
You can also load a local checkout temporarily:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pi -e ./pi-my-compact-ui/index.ts
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Configuration
|
|
79
|
+
|
|
80
|
+
Open the interactive settings menu:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
/compact-ui-config
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Available settings:
|
|
87
|
+
|
|
88
|
+
| Setting | Default | Purpose |
|
|
89
|
+
|---|---:|---|
|
|
90
|
+
| `expandedToolLines` | `5` | Result-preview lines shown for each expanded tool |
|
|
91
|
+
| `expandedThinkingLines` | `10` | Reasoning-preview lines shown for each expanded reasoning run |
|
|
92
|
+
|
|
93
|
+
The configuration is stored at:
|
|
94
|
+
|
|
95
|
+
```text
|
|
96
|
+
~/.pi/agent/compact-ui.json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Example:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"expandedToolLines": 5,
|
|
104
|
+
"expandedThinkingLines": 10
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Controls
|
|
109
|
+
|
|
110
|
+
| Action | Key |
|
|
111
|
+
|---|---|
|
|
112
|
+
| Expand or collapse reasoning and tool groups | `Ctrl+O` |
|
|
113
|
+
| Move through the settings menu | `Up` / `Down` |
|
|
114
|
+
| Adjust a numeric value | `Left` / `Right`, `-` / `+` |
|
|
115
|
+
| Save a setting | `Enter` |
|
|
116
|
+
| Close the settings menu | `Esc` |
|
|
117
|
+
|
|
118
|
+
## How It Works
|
|
119
|
+
|
|
120
|
+
compact-ui combines Pi's Assistant Message, Thinking, and Tool Execution
|
|
121
|
+
components at the presentation layer. It does not change the original messages
|
|
122
|
+
sent to the model or alter tool results.
|
|
123
|
+
|
|
124
|
+
Its main responsibilities are:
|
|
125
|
+
|
|
126
|
+
1. Capture reasoning blocks from the active assistant message and append each
|
|
127
|
+
run to the active block as its own entry.
|
|
128
|
+
2. Track consecutive and parallel tool calls.
|
|
129
|
+
3. Combine them into a tree component with shared state, in stream order.
|
|
130
|
+
4. Seal the active group when visible assistant text begins, preserving clear
|
|
131
|
+
message boundaries.
|
|
132
|
+
|
|
133
|
+
> [!NOTE]
|
|
134
|
+
> compact-ui overrides the registration of several built-in tools so it can
|
|
135
|
+
> control their presentation. Actual execution is still delegated to Pi's
|
|
136
|
+
> native tool implementations.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
MIT — see [LICENSE](./LICENSE).
|