pi-ptc-meter 1.0.19 → 1.0.21

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 +22 -26
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -64,22 +64,24 @@ 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
81
  flowchart TD
80
- A[干活:调用工具] --> B[计步:几次]
81
- B --> C[记下来]
82
- C --> D[下轮开始时报数]
82
+ A[开工前先估:预计几步] --> B[干活:实际跑几步]
83
+ B --> C[收工对比:实际 vs 预计]
84
+ C --> D[下次开工时报出偏差]
83
85
  D --> A
84
86
  ```
85
87
 
@@ -150,32 +152,26 @@ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no enviro
150
152
 
151
153
  ```mermaid
152
154
  flowchart TD
153
- A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
154
- B --> C[agent_end<br/>write one log line]
155
- C --> D[before_agent_start<br/>settle previous turn]
156
- D -->|nextTurn message<br/>calls / duration / deviation / median| A
157
- D -.->|system keeps a static skeleton| S[ptc_meter section]
158
-
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]
159
162
  ```
160
163
 
161
164
  ## How it works (plain words)
162
165
 
163
- **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.
164
167
 
165
168
  ```mermaid
166
169
  flowchart TD
167
- A[work: tool calls] --> B[count: how many]
168
- B --> C[record it]
169
- C --> D[report next turn]
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]
170
173
  D --> A
171
174
  ```
172
- flowchart TD
173
- A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
174
- B --> C[agent_end<br/>write one log line]
175
- C --> D[before_agent_start<br/>settle previous turn]
176
- D -->|nextTurn message<br/>calls / duration / deviation / median| A
177
- D -.->|system keeps a static skeleton| S[ptc_meter section]
178
-
179
175
  ## License
180
176
 
181
177
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ptc-meter",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
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",