@gfgghgftgffg/amox-high-level 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/LICENSE +22 -0
- package/MAINTENANCE.md +44 -0
- package/README.md +224 -2
- package/README.zh-CN.md +225 -0
- package/core.ts +715 -0
- package/index.ts +1115 -0
- package/package.json +66 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 z472421519
|
|
4
|
+
Copyright (c) 2026 gfgghgftgffg
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/MAINTENANCE.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Maintenance
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
`amox-high-level` is a self-maintained derivative of [z472421519/pi-high-level](https://github.com/z472421519/pi-high-level). The original project is MIT licensed and remains the source of the base design and implementation.
|
|
6
|
+
|
|
7
|
+
This package adds:
|
|
8
|
+
|
|
9
|
+
- summary modes: manual, auto, minimum characters, minimum lines
|
|
10
|
+
- thinking-level selection for summary requests
|
|
11
|
+
- history browsing that opens even when empty
|
|
12
|
+
- a clickable pi-starline status menu with a native fallback
|
|
13
|
+
- inline prompt editing and config migration from `auto.enabled`
|
|
14
|
+
|
|
15
|
+
It intentionally keeps the display-only card model: cards never enter later model context.
|
|
16
|
+
|
|
17
|
+
## Upstream review
|
|
18
|
+
|
|
19
|
+
Upstream is reviewed manually. There is no automatic porting or release selection for this package. When reviewing an upstream change:
|
|
20
|
+
|
|
21
|
+
- keep the `/hl`, `/hl-status`, `/hl-history`, and `/hl-settings` command surface
|
|
22
|
+
- keep the `pi-high-level.json` config path for existing installations
|
|
23
|
+
- keep `fallbackMenu` opt-out behavior when pi-starline is absent
|
|
24
|
+
- keep the answer-token reserve beyond the thinking budget
|
|
25
|
+
- do not introduce Pi-wide settings or write global Pi configuration
|
|
26
|
+
|
|
27
|
+
来源记录不代表当前 CI/发布结果或现行审批要求。更新前应对比 manifest 中当前固定版本/revision 与目标源码。
|
|
28
|
+
|
|
29
|
+
## Verification
|
|
30
|
+
|
|
31
|
+
From the package directory:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm run typecheck
|
|
35
|
+
npm test
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
From the repository root:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm run check
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The package has no model tools, so it has no tool-contract snapshot and is excluded from tool-character comparisons.
|
package/README.md
CHANGED
|
@@ -1,3 +1,225 @@
|
|
|
1
|
-
#
|
|
1
|
+
# amox-high-level
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
High-level summary cards for Pi: turn a long reply into a compact card you can revisit, without adding it to the next turn's context.
|
|
6
|
+
|
|
7
|
+
This project is a maintained derivative of [z472421519/pi-high-level](https://github.com/z472421519/pi-high-level). The original design and implementation are by z472421519; this version adds summary modes, thinking-level selection, history browsing, and a pi-starline status menu.
|
|
8
|
+
|
|
9
|
+
## Why
|
|
10
|
+
|
|
11
|
+
Long answers are useful once and noisy afterwards. `amox-high-level` records a short summary next to the reply you choose, then keeps that card out of later model context. You get a readable recap without paying for it on every turn.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- Display-only summary cards stored in the current session.
|
|
16
|
+
- Four summary modes: manual, auto, minimum characters, minimum lines.
|
|
17
|
+
- Separate thinking level for summary requests.
|
|
18
|
+
- Inline custom prompt with `{{question}}` and `{{answer}}` placeholders.
|
|
19
|
+
- Session history with open-original and regenerate actions.
|
|
20
|
+
- A clickable `HL` pill in pi-starline for status and actions.
|
|
21
|
+
- Native Pi menus as a fallback when pi-starline is unavailable.
|
|
22
|
+
- All settings live in one extension config file; no Pi-wide settings are changed.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
Requires Pi 1.6.0 or newer and at least one authenticated model. pi-starline is optional.
|
|
27
|
+
|
|
28
|
+
From npm:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi install npm:@gfgghgftgffg/amox-high-level
|
|
32
|
+
pi update --extensions
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
From the monorepo checkout:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/gfgghgftgffg/amox_pi_extensions_lean.git
|
|
39
|
+
cd amox_pi_extensions_lean
|
|
40
|
+
node scripts/install-extension.mjs amox-high-level
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See [MAINTENANCE.md](MAINTENANCE.md) for the maintenance boundary.
|
|
44
|
+
|
|
45
|
+
Run `/reload` after installing into an open session.
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
Mark the reply you want summarized with `+hl`:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
Refactor the parser and explain the trade-offs +hl
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The marker is removed before the prompt is sent. When the reply finishes, Pi stores a high-level card in the session.
|
|
56
|
+
|
|
57
|
+
You can also summarize the latest reply after the fact:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
/hl
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Existing cards are available through:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
/hl-history
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Use `/hl-status` for the current state and actions, or `/hl-settings` to change the mode, model, thinking level, thresholds, timeout, and prompt.
|
|
70
|
+
|
|
71
|
+
### Example
|
|
72
|
+
|
|
73
|
+
Input:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
We need to cut cold-start latency in the image pipeline. Compare the two caching
|
|
77
|
+
approaches and recommend one, with the main trade-off. +hl
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The reply may be long. The card is short:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
- Moved the decoded-image cache from disk to an in-process LRU.
|
|
84
|
+
- Cold starts now skip repeated decode work; memory grows with the active set.
|
|
85
|
+
- Trade-off: faster warm starts for a bounded increase in RSS.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Open `/hl-history` to read the full card, return to the original reply, or regenerate the summary with the current settings.
|
|
89
|
+
|
|
90
|
+
## Commands
|
|
91
|
+
|
|
92
|
+
| Command | Effect |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `/hl` | Summarize the latest reply, or open its existing card in history |
|
|
95
|
+
| `/hl-status` | Show summary state and open the action menu |
|
|
96
|
+
| `/hl-history` | Browse cards in this session, including cards on other branches |
|
|
97
|
+
| `/hl-settings` | Choose the mode, model, thinking level, thresholds, timeout, prompt, and fallback menu |
|
|
98
|
+
|
|
99
|
+
`+hl` works in three ways:
|
|
100
|
+
|
|
101
|
+
- `your prompt +hl`: summarize the reply to that prompt.
|
|
102
|
+
- `+hl` alone while Pi is busy: arm or disarm the active reply.
|
|
103
|
+
- `+hl` alone while idle: summarize the latest reply.
|
|
104
|
+
|
|
105
|
+
Replies shorter than 160 characters and fewer than 4 non-empty lines are skipped.
|
|
106
|
+
|
|
107
|
+
## Summary modes
|
|
108
|
+
|
|
109
|
+
| Mode | Behavior |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| `manual` | Summarize only when you use `/hl` or `+hl` |
|
|
112
|
+
| `auto` | Summarize a completed reply when either threshold is met |
|
|
113
|
+
| `minChars` | Summarize only when the character threshold is met |
|
|
114
|
+
| `minLines` | Summarize only when the line threshold is met |
|
|
115
|
+
|
|
116
|
+
Character thresholds start at 200; line thresholds start at 4.
|
|
117
|
+
|
|
118
|
+
## Thinking level
|
|
119
|
+
|
|
120
|
+
Summary requests use their own thinking level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`.
|
|
121
|
+
|
|
122
|
+
Some providers count reasoning tokens against the output cap. This extension reserves 320 answer tokens beyond the thinking budget (`minimal` 1,024, `low` 2,048, `medium` 8,192, `high` 16,384), then clamps to the model's maximum. `xhigh` and `max` use the `high` budget; unsupported levels are clamped to the nearest supported level. These budgets are internal to the extension.
|
|
123
|
+
|
|
124
|
+
## Settings
|
|
125
|
+
|
|
126
|
+
All settings share `~/.pi/agent/pi-high-level.json`. Set `PI_CODING_AGENT_DIR` to use a different Pi agent directory.
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"model": "auto",
|
|
131
|
+
"thinking": "minimal",
|
|
132
|
+
"mode": "manual",
|
|
133
|
+
"timeoutMs": 18000,
|
|
134
|
+
"auto": {
|
|
135
|
+
"minChars": 1200,
|
|
136
|
+
"minLines": 28
|
|
137
|
+
},
|
|
138
|
+
"prompt": "Write three concise bullets.\n\n{{answer}}",
|
|
139
|
+
"fallbackMenu": true
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- `model`: omitted or `current` uses the session model; `auto` prefers an authenticated Haiku, Flash, Mini, Nano, or Instant model; `provider/id` selects an exact model.
|
|
144
|
+
- `thinking`: reasoning level for summary requests.
|
|
145
|
+
- `mode`: one of `manual`, `auto`, `minChars`, `minLines`.
|
|
146
|
+
- `timeoutMs`: clamped to 3–120 seconds.
|
|
147
|
+
- `auto.minChars` / `auto.minLines`: thresholds used by the selected mode.
|
|
148
|
+
- `prompt`: optional inline replacement for the built-in instructions.
|
|
149
|
+
- `fallbackMenu`: use Pi's native select menus when pi-starline is unavailable. Defaults to `true`.
|
|
150
|
+
|
|
151
|
+
Configs written with the old `auto.enabled` field are migrated to `mode` automatically.
|
|
152
|
+
|
|
153
|
+
CLI flags override the saved model, mode, and thinking level for one launch:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pi --hl-model auto --hl-auto 1200c --hl-thinking low
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## History
|
|
160
|
+
|
|
161
|
+
`/hl-history` lists cards from the current session only, including cards on other branches. The picker opens even when there are no cards, showing an empty list.
|
|
162
|
+
|
|
163
|
+
Selecting a card offers:
|
|
164
|
+
|
|
165
|
+
- **Open original**: navigate back to the assistant reply before its card. This moves the session position; new prompts continue from there.
|
|
166
|
+
- **Regenerate**: summarize that reply again with the current settings.
|
|
167
|
+
|
|
168
|
+
Cards support Ctrl+O expansion. In fullscreen mode, a left click also expands or collapses a card.
|
|
169
|
+
|
|
170
|
+
## pi-starline menu
|
|
171
|
+
|
|
172
|
+
With pi-starline installed, the `HL` status pill opens a bubble with the current state and actions:
|
|
173
|
+
|
|
174
|
+
- Summarize latest reply
|
|
175
|
+
- History
|
|
176
|
+
- Settings
|
|
177
|
+
|
|
178
|
+
Without pi-starline, the same actions are available through Pi's native menus. Set `fallbackMenu` to `false` to disable the native fallback; commands then show information only.
|
|
179
|
+
|
|
180
|
+
## Custom prompt
|
|
181
|
+
|
|
182
|
+
The built-in instructions are:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
Summarize the assistant's final answer at a high level.
|
|
186
|
+
Write 3 to 5 concise lines or bullets in the answer's language.
|
|
187
|
+
Focus on the conclusion, key decision/trade-off, and concrete change or next step.
|
|
188
|
+
Do not repeat intermediate steps, code blocks, or long file lists.
|
|
189
|
+
Do not add a title or preamble.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
An inline prompt may contain `{{question}}` and `{{answer}}`. Without either placeholder, both XML-style blocks are appended. Question text is clipped to 1,200 characters, answer text to 16,000 characters, and custom instructions to 8,000 characters.
|
|
193
|
+
|
|
194
|
+
## How it works
|
|
195
|
+
|
|
196
|
+
Each summary is one extra provider request. The question and answer go to the configured summary provider, which may charge for the request and apply its own data policy. Only the resulting card is excluded from later model context; the original reply remains part of the session.
|
|
197
|
+
|
|
198
|
+
## Compatibility
|
|
199
|
+
|
|
200
|
+
- Pi 1.6.0 or newer.
|
|
201
|
+
- `registerEntryRenderer`, `navigateTree`, and an authenticated model.
|
|
202
|
+
- Linux, macOS, and Windows terminals supported by Pi.
|
|
203
|
+
- pi-starline 0.13.0 or newer for the status pill; not required.
|
|
204
|
+
|
|
205
|
+
## Development
|
|
206
|
+
|
|
207
|
+
From this package directory:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm run check
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
From the repository root:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm test
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Tests load TypeScript through `jiti` and run on Node 22.19 or newer.
|
|
220
|
+
|
|
221
|
+
## Credits
|
|
222
|
+
|
|
223
|
+
Original project: [z472421519/pi-high-level](https://github.com/z472421519/pi-high-level), MIT License, Copyright (c) 2025 z472421519.
|
|
224
|
+
|
|
225
|
+
Maintained fork and additions: gfgghgftgffg.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# amox-high-level
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
为 Pi 提供高层总结卡片:把长回复压缩成一张可回看的卡片,同时不把摘要带进下一轮上下文。
|
|
6
|
+
|
|
7
|
+
本项目基于 [z472421519/pi-high-level](https://github.com/z472421519/pi-high-level) 维护。原始设计与实现归 z472421519;本版本增加总结模式、思考等级、历史浏览和 pi-starline 状态菜单。
|
|
8
|
+
|
|
9
|
+
## 为什么
|
|
10
|
+
|
|
11
|
+
长回答往往只在当下有用,之后就是噪音。`amox-high-level` 在你指定的回复旁记录一张简短卡片,并让这张卡片不进入后续模型上下文。需要时能回看,不需要时不增加每轮成本。
|
|
12
|
+
|
|
13
|
+
## 功能
|
|
14
|
+
|
|
15
|
+
- 只用于展示的总结卡片,保存在当前 session。
|
|
16
|
+
- 四种总结模式:手动、自动、最小字符数、最小行数。
|
|
17
|
+
- 总结请求可单独选择思考等级。
|
|
18
|
+
- 内联自定义 Prompt,支持 `{{question}}` 和 `{{answer}}`。
|
|
19
|
+
- Session 历史:可打开原始回复或重新生成摘要。
|
|
20
|
+
- pi-starline 中的 `HL` 状态 pill,点击打开状态和操作菜单。
|
|
21
|
+
- 没有 pi-starline 时回退到 Pi 原生菜单。
|
|
22
|
+
- 所有设置集中在扩展自己的配置文件;不修改任何 Pi 全局设置。
|
|
23
|
+
|
|
24
|
+
## 安装
|
|
25
|
+
|
|
26
|
+
需要 Pi 1.6.0 或更新版本,以及至少一个已认证模型。pi-starline 可选。
|
|
27
|
+
|
|
28
|
+
从 npm 安装:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pi install npm:@gfgghgftgffg/amox-high-level
|
|
32
|
+
pi update --extensions
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
从 monorepo 源码安装:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/gfgghgftgffg/amox_pi_extensions_lean.git
|
|
39
|
+
cd amox_pi_extensions_lean
|
|
40
|
+
node scripts/install-extension.mjs amox-high-level
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
维护边界见 [MAINTENANCE.md](MAINTENANCE.md)。
|
|
44
|
+
|
|
45
|
+
安装后执行 `/reload`。
|
|
46
|
+
|
|
47
|
+
## 快速开始
|
|
48
|
+
|
|
49
|
+
在需要总结的提示末尾加上 `+hl`:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
Refactor the parser and explain the trade-offs +hl
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
标记会在发送前移除。回复完成后,Pi 会在当前 session 中保存一张高层总结卡片。
|
|
56
|
+
|
|
57
|
+
也可以在回复结束后手动总结最新一条:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
/hl
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
浏览已有卡片:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
/hl-history
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`/hl-status` 查看当前状态和操作;`/hl-settings` 修改模式、模型、思考等级、阈值、超时和 Prompt。
|
|
70
|
+
|
|
71
|
+
### 示例(English example)
|
|
72
|
+
|
|
73
|
+
Input:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
We need to cut cold-start latency in the image pipeline. Compare the two caching
|
|
77
|
+
approaches and recommend one, with the main trade-off. +hl
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
原始回复可能很长,卡片保持简短:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
- Moved the decoded-image cache from disk to an in-process LRU.
|
|
84
|
+
- Cold starts now skip repeated decode work; memory grows with the active set.
|
|
85
|
+
- Trade-off: faster warm starts for a bounded increase in RSS.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
用 `/hl-history` 可以查看完整卡片、回到原始回复,或按当前设置重新生成摘要。
|
|
89
|
+
|
|
90
|
+
## 命令
|
|
91
|
+
|
|
92
|
+
| 命令 | 作用 |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `/hl` | 总结最新回复;已有卡片时在历史中打开它 |
|
|
95
|
+
| `/hl-status` | 查看总结状态并打开操作菜单 |
|
|
96
|
+
| `/hl-history` | 浏览当前 session 的卡片,包括其他分支上的卡片 |
|
|
97
|
+
| `/hl-settings` | 设置模式、模型、思考等级、阈值、超时、Prompt 和回退菜单 |
|
|
98
|
+
|
|
99
|
+
`+hl` 有三种用法:
|
|
100
|
+
|
|
101
|
+
- `你的提示 +hl`:总结这条提示的回复。
|
|
102
|
+
- Pi 运行时单独输入 `+hl`:为当前回复挂载或取消总结。
|
|
103
|
+
- 空闲时单独输入 `+hl`:总结最新回复。
|
|
104
|
+
|
|
105
|
+
少于 160 字符且少于 4 个非空行的回复会跳过。
|
|
106
|
+
|
|
107
|
+
## 总结模式
|
|
108
|
+
|
|
109
|
+
| 模式 | 行为 |
|
|
110
|
+
| --- | --- |
|
|
111
|
+
| `manual` | 只在 `/hl` 或 `+hl` 时总结 |
|
|
112
|
+
| `auto` | 完成后,字符数或行数任一达到阈值即总结 |
|
|
113
|
+
| `minChars` | 只在字符数达到阈值时总结 |
|
|
114
|
+
| `minLines` | 只在行数达到阈值时总结 |
|
|
115
|
+
|
|
116
|
+
字符阈值最低 200,行数阈值最低 4。
|
|
117
|
+
|
|
118
|
+
## 思考等级
|
|
119
|
+
|
|
120
|
+
总结请求可以单独选择 `off`、`minimal`、`low`、`medium`、`high`、`xhigh` 或 `max`。
|
|
121
|
+
|
|
122
|
+
部分 Provider 会把思考 token 计入输出上限。本扩展在思考预算之外额外保留 320 个回答 token(`minimal` 1024、`low` 2048、`medium` 8192、`high` 16384),再按模型上限截断。`xhigh` 和 `max` 使用 `high` 预算;模型不支持的等级会收敛到最近的可用等级。这些预算只属于本扩展。
|
|
123
|
+
|
|
124
|
+
## 设置
|
|
125
|
+
|
|
126
|
+
所有设置存放在 `~/.pi/agent/pi-high-level.json`。可通过 `PI_CODING_AGENT_DIR` 更换 Pi agent 目录。
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"model": "auto",
|
|
131
|
+
"thinking": "minimal",
|
|
132
|
+
"mode": "manual",
|
|
133
|
+
"timeoutMs": 18000,
|
|
134
|
+
"auto": {
|
|
135
|
+
"minChars": 1200,
|
|
136
|
+
"minLines": 28
|
|
137
|
+
},
|
|
138
|
+
"prompt": "用三条要点总结。\n\n{{answer}}",
|
|
139
|
+
"fallbackMenu": true
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- `model`:省略或 `current` 使用会话模型;`auto` 优先选择已认证的 Haiku、Flash、Mini、Nano 或 Instant;`provider/id` 指定模型。
|
|
144
|
+
- `thinking`:总结请求的思考等级。
|
|
145
|
+
- `mode`:`manual`、`auto`、`minChars`、`minLines`。
|
|
146
|
+
- `timeoutMs`:限制在 3–120 秒。
|
|
147
|
+
- `auto.minChars` / `auto.minLines`:当前模式使用的阈值。
|
|
148
|
+
- `prompt`:可选的内联总结指令。
|
|
149
|
+
- `fallbackMenu`:没有 pi-starline 时是否使用 Pi 原生菜单,默认 `true`。
|
|
150
|
+
|
|
151
|
+
旧配置中的 `auto.enabled` 会自动迁移为 `mode`。
|
|
152
|
+
|
|
153
|
+
单次启动可用 flag 覆盖模型、模式和思考等级:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pi --hl-model auto --hl-auto 1200c --hl-thinking low
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## 历史
|
|
160
|
+
|
|
161
|
+
`/hl-history` 只列当前 session 的卡片,包括其他分支上的卡片。即使没有卡片也会打开空列表弹窗。
|
|
162
|
+
|
|
163
|
+
选中卡片后可以:
|
|
164
|
+
|
|
165
|
+
- **Open original**:回到卡片之前的原始 assistant 回复。这会移动 session 当前位置,之后的新提示从该位置继续。
|
|
166
|
+
- **Regenerate**:按当前设置重新总结该回复。
|
|
167
|
+
|
|
168
|
+
卡片支持 `Ctrl+O` 展开;fullscreen 模式下也可以左键点击展开或收起。
|
|
169
|
+
|
|
170
|
+
## pi-starline 菜单
|
|
171
|
+
|
|
172
|
+
安装 pi-starline 时,点击 `HL` 状态 pill 会打开包含当前状态和操作的气泡:
|
|
173
|
+
|
|
174
|
+
- 总结最新回复
|
|
175
|
+
- History
|
|
176
|
+
- Settings
|
|
177
|
+
|
|
178
|
+
没有 pi-starline 时,通过 Pi 原生菜单提供相同操作。把 `fallbackMenu` 设为 `false` 可关闭原生回退菜单;此时相关命令只显示信息。
|
|
179
|
+
|
|
180
|
+
## 自定义 Prompt
|
|
181
|
+
|
|
182
|
+
内置指令为:
|
|
183
|
+
|
|
184
|
+
```text
|
|
185
|
+
Summarize the assistant's final answer at a high level.
|
|
186
|
+
Write 3 to 5 concise lines or bullets in the answer's language.
|
|
187
|
+
Focus on the conclusion, key decision/trade-off, and concrete change or next step.
|
|
188
|
+
Do not repeat intermediate steps, code blocks, or long file lists.
|
|
189
|
+
Do not add a title or preamble.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
内联 Prompt 可写 `{{question}}` 和 `{{answer}}`。两个占位符都没写时,会自动追加对应的 XML 内容块。问题最多 1200 字符,回答最多 16000 字符,自定义指令最多 8000 字符。
|
|
193
|
+
|
|
194
|
+
## 工作方式
|
|
195
|
+
|
|
196
|
+
每次总结都会向所选 Provider 额外发起一次请求。问题和回答会发送给该 Provider,可能产生费用,并适用其数据策略。只有生成的卡片不进入后续主对话上下文;原始回复仍保留在 session 中。
|
|
197
|
+
|
|
198
|
+
## 兼容性
|
|
199
|
+
|
|
200
|
+
- Pi 1.6.0 或更新版本。
|
|
201
|
+
- 需要 `registerEntryRenderer`、`navigateTree` 和已认证模型。
|
|
202
|
+
- 支持 Pi 运行所在的 Linux、macOS 和 Windows 终端。
|
|
203
|
+
- 状态 pill 需要 pi-starline 0.13.0 或更新版本,但非必需。
|
|
204
|
+
|
|
205
|
+
## 开发
|
|
206
|
+
|
|
207
|
+
在本包目录:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm run check
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
在仓库根目录:
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm test
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
测试通过 `jiti` 加载 TypeScript,可在 Node 22.19 或更新版本运行。
|
|
220
|
+
|
|
221
|
+
## 致谢
|
|
222
|
+
|
|
223
|
+
原始项目:[z472421519/pi-high-level](https://github.com/z472421519/pi-high-level),MIT License,Copyright (c) 2025 z472421519。
|
|
224
|
+
|
|
225
|
+
本维护版本与新增功能:gfgghgftgffg。
|