@marshal/pi-turn-stats 0.1.0 → 0.1.2

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 CHANGED
@@ -1,37 +1,61 @@
1
1
  # @marshal/pi-turn-stats
2
2
 
3
- pi extension: conversation statistics (对话统计). For every exchange, records duration, token usage (input / output / cache read / cache write), and cost.
3
+ pi 扩展:对话统计(Turn Stats)。每次对话交换后,自动记录耗时、token 用量(input / output / cache read / cache write)和费用。
4
4
 
5
- ## Features
5
+ ## 功能特性
6
6
 
7
- - **对话流统计卡片** — after each reply, appends a stats card to the conversation stream (not sent to the LLM context).
8
- - **状态栏实时显示** — bottom status bar shows the previous exchange's duration / output speed / tokens / cost.
9
- - **`/turnstats` 命令** — appends a session-cumulative stats card (total exchanges, turns, tokens, cost).
7
+ - **对话流统计卡片** — 每次回复后,在对话流中追加统计卡片(不会进入 LLM 上下文)。
8
+ - **状态栏实时显示** — 底部状态栏显示上一轮对话的耗时 / 输出速度 / token / 费用。
9
+ - **`/turnstats` 命令** — 追加会话累计统计卡片(总交换次数、总轮次、总 token、总费用)。
10
10
 
11
- ## Installation
11
+ ## 效果截图
12
12
 
13
- Install project-locally (recommended, supports per-project version pinning):
13
+ ![Turn Stats](turn-stats.jpg)
14
+
15
+ ## 安装
16
+
17
+ **推荐方式**:从 npm 安装,国内访问稳定,且可查看安装统计。
14
18
 
15
19
  ```bash
16
- # From the GitHub repo, pinned to a git tag (SSH)
17
- pi install -l git:git@github.com:MarshalW/pi-turn-stats@v0.1.0
20
+ # pi 直接安装 npm
21
+ pi install -l npm:@marshal/pi-turn-stats
18
22
  ```
19
23
 
20
- ## Note
24
+ 或使用标准 npm 安装:
21
25
 
22
- Generated stats are **local-only** — nothing is uploaded anywhere. Reads `turn_end` event usage data and wall-clock timing inside the running pi process.
26
+ ```bash
27
+ npm install @marshal/pi-turn-stats
28
+ ```
23
29
 
24
- ## Development
30
+ > 注意:`pi install -l npm:...` 是 pi 推荐的本地安装方式,会将扩展安装到当前项目;普通 `npm install` 仅下载包,不自动注册为 pi 扩展。
31
+
32
+ **备选方式**:从 GitHub 安装(适合需要源码或自定义修改的场景)。
33
+
34
+ ```bash
35
+ # 从 GitHub 仓库安装,指定 tag(SSH)
36
+ pi install -l git:git@github.com:MarshalW/pi-turn-stats@v0.1.1
37
+ ```
38
+
39
+ > 国内用户建议优先使用 npm 方式,GitHub 访问可能不稳定。
40
+
41
+ ## 说明
42
+
43
+ 生成的统计数据**仅本地存储**,不会上传到任何服务器。读取运行中 pi 进程内的 `turn_end` 事件数据和实际耗时。
44
+
45
+ ## 开发
25
46
 
26
47
  ```bash
27
48
  git clone git@github.com:MarshalW/pi-turn-stats.git
28
49
  cd pi-turn-stats
29
- pi install ./ # local install for testing
50
+ pi install ./ # 本地安装,用于测试
30
51
  ```
31
52
 
32
- ## Release flow
53
+ ## 发布流程
33
54
 
34
55
  ```bash
35
56
  git tag vX.Y.Z && git push origin main --tags
36
- # then on each consumer machine: pi install -l git:...@vX.Y.Z
37
- ```
57
+ # 发布到 npm:npm version patch && npm publish --access public
58
+ # 消费端安装:
59
+ # npm 方式(推荐):pi install -l npm:@marshal/pi-turn-stats
60
+ # git 方式(备选):pi install -l git:git@github.com:MarshalW/pi-turn-stats@vX.Y.Z
61
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marshal/pi-turn-stats",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "pi extension: per-exchange duration, token & cost stats for conversations (stream card + status bar + /turnstats command)",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -9,11 +9,12 @@
9
9
  "license": "MIT",
10
10
  "files": [
11
11
  "extensions",
12
- "README.md"
12
+ "README.md",
13
+ "turn-stats.jpg"
13
14
  ],
14
15
  "pi": {
15
16
  "extensions": [
16
17
  "./extensions/turn-stats.ts"
17
18
  ]
18
19
  }
19
- }
20
+ }
package/turn-stats.jpg ADDED
Binary file