pi-ptc-meter 1.0.18 → 1.0.20

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.
Files changed (2) hide show
  1. package/README.md +25 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -64,26 +64,27 @@ pi install npm:pi-ptc-meter
64
64
 
65
65
  ```mermaid
66
66
  flowchart TD
67
- A[tool_call] -->|计数 +1| B[turn_end<br/>记录次数与耗时]
68
- B --> C[agent_end<br/>落盘一行日志]
69
- C --> D[before_agent_start<br/>结算上一轮]
70
- D -->|nextTurn 尾部消息<br/>次数 / 耗时 / 偏差 / 中位| A
71
- D -.->|system 只留静态骨架| S[ptc_meter section]
67
+ A[本轮开工前<br/>声明 预计 N 次 / 预计 Ns] --> B[tool_call<br/>计数 +1]
68
+ B --> C[turn_end<br/>记录实际次数与耗时 + 解析预计值]
69
+ C --> D[agent_end<br/>落盘一行日志(含预计)]
70
+ D --> E[before_agent_start<br/>结算上一轮]
71
+ E --> F[对比:实际 vs 预计 → 偏差 %]
72
+ F -->|nextTurn 尾部消息| A
73
+ F -.->|system 只留静态骨架| S[ptc_meter section]
72
74
  ```
73
75
 
74
76
  ## 原理(小白)
75
77
 
76
- 像计步器:这一趟跑了多少步(调用了几次工具),下一趟出发前告诉你「上次 40 步,比平时多」,你自己决定要不要合并行程。
78
+ **像记账对账**:开工前先说「这趟大概 5 步」,收工后对账「实际 7 步,比预计多 40%」,下次开工前把账报给你。
77
79
 
78
80
  ```mermaid
79
- flowchart LR
80
- A[这一轮干活] --> B[计步:用了几次工具]
81
- B --> C[记下来]
82
- C --> D[下一轮开始时报数]
81
+ flowchart TD
82
+ A[开工前先估:预计几步] --> B[干活:实际跑几步]
83
+ B --> C[收工对比:实际 vs 预计]
84
+ C --> D[下次开工时报出偏差]
83
85
  D --> A
84
86
  ```
85
87
 
86
-
87
88
  ## License
88
89
 
89
90
  MIT
@@ -151,21 +152,24 @@ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no enviro
151
152
 
152
153
  ```mermaid
153
154
  flowchart TD
154
- A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
155
- B --> C[agent_end<br/>write one log line]
156
- C --> D[before_agent_start<br/>settle previous turn]
157
- D -->|nextTurn message<br/>calls / duration / deviation / median| A
158
- D -.->|system keeps a static skeleton| S[ptc_meter section]
155
+ A[before the turn<br/>declare: about N calls / Ns] --> B[tool_call<br/>counter +1]
156
+ B --> C[turn_end<br/>record actual calls and duration + parse estimate]
157
+ C --> D[agent_end<br/>write one log line (includes estimate)]
158
+ D --> E[before_agent_start<br/>settle the previous turn]
159
+ E --> F[compare: actual vs estimate -> deviation %]
160
+ F -->|nextTurn message| A
161
+ F -.->|system keeps a static skeleton| S[ptc_meter section]
162
+ ```
159
163
 
160
164
  ## How it works (plain words)
161
165
 
162
- Like a pedometer: counts how many steps (tool calls) this trip took, then tells you before the next trip that last one was 40 steps, above your usual — you decide whether to combine errands.
166
+ **Like a ledger**: you estimate "about 5 steps" before starting, the ledger compares it with the actual 7 (40% over), and reports the gap before the next job.
163
167
 
164
168
  ```mermaid
165
- flowchart LR
166
- A[this turn's work] --> B[count: how many tool calls]
167
- B --> C[record it]
168
- C --> D[report at the start of the next turn]
169
+ flowchart TD
170
+ A[before starting: guess N steps] --> B[work: actually N steps]
171
+ B --> C[at the end: actual vs guess]
172
+ C --> D[report the gap next time]
169
173
  D --> A
170
174
  ```
171
175
  flowchart TD
@@ -174,7 +178,6 @@ flowchart TD
174
178
  C --> D[before_agent_start<br/>settle previous turn]
175
179
  D -->|nextTurn message<br/>calls / duration / deviation / median| A
176
180
  D -.->|system keeps a static skeleton| S[ptc_meter section]
177
- ```
178
181
 
179
182
  ## License
180
183
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ptc-meter",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Measures tool-call batching per turn and feeds the numbers back to the model.",
5
5
  "type": "module",
6
6
  "license": "MIT",