useful-pi-extensions 1.11.0 → 1.11.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "useful-pi-extensions",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "A small collection of pi extensions, installed with one command — a labelled status line with context pressure, cache, cost, effort, TTFT and tokens/sec, plus an opt-in context breakdown panel.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -5,7 +5,7 @@ English | [中文](README_CN.md)
|
|
|
5
5
|
[npm](https://www.npmjs.com/package/@reedchan/statusline) · [pi packages gallery](https://pi.dev/packages/@reedchan/statusline) · [repository](https://github.com/reedchan7/useful-pi-extensions)
|
|
6
6
|
|
|
7
7
|
Replaces pi's footer with a labelled two-row one. Every value carries a word, so nothing has to
|
|
8
|
-
be decoded from a symbol or remembered from a legend. `ctrl+
|
|
8
|
+
be decoded from a symbol or remembered from a legend. `ctrl+q` opens an optional context-breakdown
|
|
9
9
|
panel (next section) when you want to see what is occupying the window.
|
|
10
10
|
|
|
11
11
|
```text
|
|
@@ -24,7 +24,7 @@ columns only the meter is left. Every step is a whole value — a number is neve
|
|
|
24
24
|
| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
25
|
| `Context window` + meter + `47%` | Share of the model's context window in use. The fill turns `warning` above 70% and `error` above 90%, the same thresholds pi's shipped footer uses, and the percentage changes color with it |
|
|
26
26
|
| `471k / 1.0M` | Absolute context tokens over the window size. The first thing dropped when the terminal is narrow |
|
|
27
|
-
| Breakdown panel | What occupies the window — opt-in via `ctrl+
|
|
27
|
+
| Breakdown panel | What occupies the window — opt-in via `ctrl+q` or `/breakdown` — one bucket per line under a total. See [Context breakdown](#context-breakdown) |
|
|
28
28
|
| `Input` / `Output` | Session prompt and completion tokens. `Input` counts the prompt tokens that were neither read from nor written to cache, because pi reports those two separately in the same `usage` object |
|
|
29
29
|
| `Cache hit` | The latest turn's cache hit rate, `cacheRead / (input + cacheRead + cacheWrite)` |
|
|
30
30
|
| `Cost` | Session cost, in USD unless a config file names another currency (see below) |
|
|
@@ -46,7 +46,7 @@ The glyphs are that preset's block fill and shaded block track, with a 1/8-cell
|
|
|
46
46
|
|
|
47
47
|
## Context breakdown
|
|
48
48
|
|
|
49
|
-
`ctrl+
|
|
49
|
+
`ctrl+q` or `/breakdown` opens an opt-in panel that answers the question the meter raises: what
|
|
50
50
|
is actually occupying the window. The concise footer stays the default; the choice is remembered
|
|
51
51
|
in `~/.pi/agent/statusline/config.json` (`"detail": true`).
|
|
52
52
|
|
|
@@ -101,9 +101,10 @@ multi-provider). **Deferred tools** have no pi equivalent either — every activ
|
|
|
101
101
|
always on the wire.
|
|
102
102
|
|
|
103
103
|
The panel is ~50 columns wide and fits any terminal by truncating rather than by dropping
|
|
104
|
-
buckets. The toggle lives on `ctrl+
|
|
105
|
-
as Enter
|
|
106
|
-
|
|
104
|
+
buckets. The toggle lives on `ctrl+q`: `ctrl+j` is a bare LF in legacy terminals and reads
|
|
105
|
+
as Enter, and `ctrl+e` is taken by pi's built-in cursor-to-line-end (`tui.editor.cursorLineEnd`);
|
|
106
|
+
`ctrl+q` is unbound in pi's default keymaps. If another extension owns `ctrl+q` on your machine,
|
|
107
|
+
the key is `BREAKDOWN_SHORTCUT` at the top of `index.ts`.
|
|
107
108
|
|
|
108
109
|
Configuration lives at the top of [`render.ts`](render.ts):
|
|
109
110
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[npm](https://www.npmjs.com/package/@reedchan/statusline) · [pi packages 画廊](https://pi.dev/packages/@reedchan/statusline) · [仓库](https://github.com/reedchan7/useful-pi-extensions)
|
|
6
6
|
|
|
7
7
|
替换 pi 的 footer,改成带文字标签的两行。每个值都带一个词,不需要靠符号猜、也不需要记图例。
|
|
8
|
-
需要看窗口里到底装了什么时,`ctrl+
|
|
8
|
+
需要看窗口里到底装了什么时,`ctrl+q` 可打开一个可选的上下文明细面板(见下文)。
|
|
9
9
|
|
|
10
10
|
```text
|
|
11
11
|
Context window █████████▍░░░░░░░░░░ 47% 471k / 1.0M Input 194k · Output 89k | Cache hit 99.9% | Cost $0.23 · Today $1.63
|
|
@@ -23,7 +23,7 @@ LSP Active: typescript
|
|
|
23
23
|
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
24
|
| `Context window` + 仪表 + `47.1%` | 已占模型上下文窗口的比例。填充超过 70% 转 `warning`、超过 90% 转 `error`(与 pi 原生 footer 同一套阈值),百分比同步变色 |
|
|
25
25
|
| `471k / 1.0M` | 上下文已用 token / 窗口大小。终端变窄时**第一个被舍弃** |
|
|
26
|
-
| Breakdown 面板 | 窗口里到底装了什么,总数领队、每桶一行——可选,`ctrl+
|
|
26
|
+
| Breakdown 面板 | 窗口里到底装了什么,总数领队、每桶一行——可选,`ctrl+q` 或 `/breakdown` 打开。见[上下文明细](#上下文明细) |
|
|
27
27
|
| `Input` / `Output` | 会话的输入与输出 token 量。`Input` 指既没命中缓存、也没写入缓存的那部分 prompt token,因为 pi 把这两种情况在同一个 `usage` 对象里分开报 |
|
|
28
28
|
| `Cache hit` | 最近一轮的缓存命中率,`cacheRead / (input + cacheRead + cacheWrite)` |
|
|
29
29
|
| `Cost` | 会话花费,默认美元;配置了其他币种则换算显示(见下) |
|
|
@@ -44,7 +44,7 @@ LSP Active: typescript
|
|
|
44
44
|
|
|
45
45
|
## 上下文明细
|
|
46
46
|
|
|
47
|
-
`ctrl+
|
|
47
|
+
`ctrl+q` 或 `/breakdown` 打开一个可选面板,回答仪表提出的问题:窗口里到底装了什么。
|
|
48
48
|
简洁两行是默认形态;开关状态记在 `~/.pi/agent/statusline/config.json`(`"detail": true`)。
|
|
49
49
|
|
|
50
50
|
```text
|
|
@@ -92,9 +92,10 @@ Claude Code 面板里有、而这里有意不做的:**Custom agents**(pi 没
|
|
|
92
92
|
(特定厂商的订阅额度,pi 是多 provider 的)。**Deferred tools** 在 pi 里也没有对应物——
|
|
93
93
|
激活工具的 schema 永远在线上。
|
|
94
94
|
|
|
95
|
-
面板约 50 列宽,任何终端都放得下;放不下时逐行截断,而不是丢桶。开关键默认 `ctrl+
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
面板约 50 列宽,任何终端都放得下;放不下时逐行截断,而不是丢桶。开关键默认 `ctrl+q`——
|
|
96
|
+
`ctrl+j` 在传统终端里是一个裸 LF,和回车无法区分,`ctrl+e` 又撞上了 pi 内建的
|
|
97
|
+
光标移行尾(`tui.editor.cursorLineEnd`);`ctrl+q` 在 pi 的默认键位里是空着的。如果你的机器上
|
|
98
|
+
`ctrl+q` 已被其他扩展占用,改 `index.ts` 顶部的 `BREAKDOWN_SHORTCUT` 即可。
|
|
98
99
|
|
|
99
100
|
可调项在 [`render.ts`](render.ts) 顶部:
|
|
100
101
|
|
|
@@ -89,10 +89,12 @@ const DEFAULT_RESERVE_TOKENS = 16_384
|
|
|
89
89
|
* The key that toggles the breakdown line; change here if another extension owns it.
|
|
90
90
|
*
|
|
91
91
|
* Ctrl+j was tried first and had to go: legacy terminals send it as a bare LF, which is
|
|
92
|
-
* indistinguishable from Enter, so it typed newlines instead of toggling. ctrl+e
|
|
93
|
-
* pi's
|
|
92
|
+
* indistinguishable from Enter, so it typed newlines instead of toggling. ctrl+e then collided with
|
|
93
|
+
* pi's built-in tui.editor.cursorLineEnd. ctrl+q is free: unbound in both pi-tui's TUI_KEYBINDINGS
|
|
94
|
+
* and pi's app KEYBINDINGS on macOS/Linux (only Windows maps ctrl+q, to followUp), and pi already
|
|
95
|
+
* binds ctrl+s, so the terminal runs with flow control (IXON) off and ctrl+q reaches the app.
|
|
94
96
|
*/
|
|
95
|
-
const BREAKDOWN_SHORTCUT = 'ctrl+
|
|
97
|
+
const BREAKDOWN_SHORTCUT = 'ctrl+q'
|
|
96
98
|
const FETCH_TIMEOUT_MS = 5000
|
|
97
99
|
|
|
98
100
|
function today(): string {
|
|
@@ -599,7 +601,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
599
601
|
)
|
|
600
602
|
|
|
601
603
|
// The breakdown panel sits directly under the meter it explains, before the identity
|
|
602
|
-
// row. The concise footer renders by default; ctrl+
|
|
604
|
+
// row. The concise footer renders by default; ctrl+q or /breakdown opens the panel.
|
|
603
605
|
let breakdown: string[] | null = null
|
|
604
606
|
if (detailVisible) {
|
|
605
607
|
const window =
|
|
@@ -848,9 +850,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
848
850
|
})
|
|
849
851
|
|
|
850
852
|
// The breakdown panel is opt-in: the concise footer stays the default. Both toggles remember
|
|
851
|
-
// the choice in the config file. ctrl+
|
|
852
|
-
// extension
|
|
853
|
-
// is the one place to move it.
|
|
853
|
+
// the choice in the config file. ctrl+q is unbound across pi's default keymaps; if another
|
|
854
|
+
// extension owns it here, BREAKDOWN_SHORTCUT is the one place to move it.
|
|
854
855
|
pi.registerShortcut(BREAKDOWN_SHORTCUT, {
|
|
855
856
|
description: 'Toggle the context breakdown panel in the status line',
|
|
856
857
|
handler: () => {
|