pi-metrics 0.7.0 → 0.7.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/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/SKILL.md +1 -1
- package/locales/index.json +2 -2
- package/package.json +2 -2
- package/src/notice.ts +3 -3
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Session metrics for the [Pi coding agent](https://github.com/earendil-works/pi):
|
|
|
9
9
|
- While the agent is working, the spinner shows the **total elapsed time since you sent the message** (for example `⏱ 47s`). It keeps counting across turns instead of resetting per turn.
|
|
10
10
|
- **Display timing** decides when metric lines appear:
|
|
11
11
|
- `on-stop` (default): the transcript stays quiet during the run. When the agent fully settles (`agent_settled` — including auto-retries, compaction continuations, or Esc interruption), one summary line reports the total elapsed time, blended TPS, TTFT, summed in/out tokens, stalls, and blended cost.
|
|
12
|
-
- `live`: one line per turn, right when the turn ends (the line already carries the turn duration, so no separate elapsed notice is emitted). A multi-turn run also gets a final `⏱
|
|
12
|
+
- `live`: one line per turn, right when the turn ends (the line already carries the turn duration, so no separate elapsed notice is emitted). A multi-turn run also gets a final `⏱ <duration>` line.
|
|
13
13
|
- Telemetry for every turn is persisted as `tps` custom session entries in both modes, and restored after session resume or `/tree` navigation.
|
|
14
14
|
- Metrics are exposed through session entries and notifications. Use `/config:metrics` to open the TUI settings menu, or `/config:metrics enable|disable|live|on-stop|reset` to change a setting directly.
|
|
15
15
|
|
|
@@ -34,10 +34,10 @@ Use `/config:metrics` for the interactive menu (each selection is saved and the
|
|
|
34
34
|
## How the summary line is computed
|
|
35
35
|
|
|
36
36
|
```
|
|
37
|
-
⏱
|
|
37
|
+
⏱ 2m 14.3s · TPS 62.4 tok/s · TTFT 1.2s · in 48.2K · out 12.7K · $0.42/M
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
-
|
|
40
|
+
- The leading **`⏱`** value measures from the moment you submit the message to `agent_settled` — the same clock the spinner has been showing, so the number matches what you watched.
|
|
41
41
|
- **TPS** is weighted by output tokens (total output ÷ summed generation time), so a short turn cannot skew the run average.
|
|
42
42
|
- **TTFT** is the first measurable value in the run: how long until the first token appeared.
|
|
43
43
|
- **in/out** are summed over all turns; **stall** appears only when a stall was detected.
|
package/README.zh-CN.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- 工作期间 spinner 显示**从发出消息起的全程耗时**(如 `⏱ 47s`),跨轮次持续累加,不再每轮回零。
|
|
10
10
|
- **显示时机**决定指标行什么时候出现:
|
|
11
11
|
- `on-stop`(默认):运行过程中对话区保持干净;AI 完全停止(`agent_settled`,覆盖自动重试、compaction 续跑以及 Esc 中断)后只出一行汇总:总耗时、混合 TPS、TTFT、in/out 合计、stall 和综合费率。
|
|
12
|
-
- `live`:每轮结束时立刻出一行(该行已包含本轮耗时,不再单独发耗时提示);整段超过一轮时再补一行 `⏱
|
|
12
|
+
- `live`:每轮结束时立刻出一行(该行已包含本轮耗时,不再单独发耗时提示);整段超过一轮时再补一行 `⏱ <耗时>`。
|
|
13
13
|
- 两种模式都会把每轮遥测写进 `tps` custom session entry,恢复 session 或 `/tree` 后照常恢复显示。
|
|
14
14
|
- Metrics 通过 session entry 和通知提供。使用 `/config:metrics` 打开 TUI 配置菜单,或用 `/config:metrics enable|disable|live|on-stop|reset` 直接改一项。
|
|
15
15
|
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
## 汇总行是怎么算的
|
|
35
35
|
|
|
36
36
|
```
|
|
37
|
-
⏱
|
|
37
|
+
⏱ 2m 14.3s · TPS 62.4 tok/s · TTFT 1.2s · in 48.2K · out 12.7K · $0.42/M
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
-
|
|
40
|
+
- 开头的 **`⏱`** 数值从你发出消息算到 `agent_settled`,与 spinner 一直在显示的是同一个时钟,数字对得上。
|
|
41
41
|
- **TPS** 按输出 token 加权(总输出量 ÷ 生成时间之和),单轮输出很少也不会把整段均值带偏。
|
|
42
42
|
- **TTFT** 取本段第一个可测值,也就是「多久看到第一个字」。
|
|
43
43
|
- **in/out** 是各轮求和;**stall** 只在检测到停顿且时长大于 0 时出现。
|
package/SKILL.md
CHANGED
|
@@ -18,4 +18,4 @@ description: "启用与排查 pi-metrics 的耗时、TPS、TTFT、token 和成
|
|
|
18
18
|
|
|
19
19
|
## 验证
|
|
20
20
|
|
|
21
|
-
在 TUI 中完成一次真实模型回合:两种模式都应看到 working spinner 计时;`on-stop` 模式在停下后只出现一行汇总,`live` 模式每轮一行、多轮时另有一条 `⏱
|
|
21
|
+
在 TUI 中完成一次真实模型回合:两种模式都应看到 working spinner 计时;`on-stop` 模式在停下后只出现一行汇总,`live` 模式每轮一行、多轮时另有一条 `⏱ <耗时>`(只有图标和数值,不带「总耗时」字样)。RPC/print 模式不会启动 UI 定时器或通知;provider 未返回 usage 时部分指标不可用。真实模型回合属于 E2E,执行前遵守当前任务授权边界;未运行时明确报告 `NOT_RUN`。
|
package/locales/index.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-metrics",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Pi metrics extension: elapsed-time HUD and resilient TPS telemetry",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@earendil-works/pi-tui": ">=0.80.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"pi-extensions-i18n": "^0.
|
|
65
|
+
"pi-extensions-i18n": "^0.8.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@earendil-works/pi-ai": "0.85.1",
|
package/src/notice.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* 所有 notifyWithSource 调用共用同一份标签与颜色,避免两个入口不一致。
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type
|
|
6
|
+
import { NOTICE_TAG_COLOR, type NoticeColor, type NoticeSource } from "pi-extensions-i18n";
|
|
7
7
|
|
|
8
8
|
/** 本扩展的提示标签;短且唯一,便于在会话里定位来源。 */
|
|
9
9
|
export const NOTICE_TAG = "metrics";
|
|
10
|
-
/**
|
|
11
|
-
export const NOTICE_COLOR: NoticeColor =
|
|
10
|
+
/** 提示标签颜色:所有扩展统一用弱化色,来源靠 tag 文本区分,不靠颜色。 */
|
|
11
|
+
export const NOTICE_COLOR: NoticeColor = NOTICE_TAG_COLOR;
|
|
12
12
|
/** 本扩展的提示来源。 */
|
|
13
13
|
export const NOTICE_SOURCE: NoticeSource = { tag: NOTICE_TAG, color: NOTICE_COLOR };
|