pi-ptc-meter 1.0.17 → 1.0.19
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 +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ pi install npm:pi-ptc-meter
|
|
|
60
60
|
- `session_start`:模块级计量归零。
|
|
61
61
|
- system 内 section `ptc_meter` 只含逐字不变的骨架。
|
|
62
62
|
|
|
63
|
+
## 原理(专业)
|
|
64
|
+
|
|
63
65
|
```mermaid
|
|
64
66
|
flowchart TD
|
|
65
67
|
A[tool_call] -->|计数 +1| B[turn_end<br/>记录次数与耗时]
|
|
@@ -69,6 +71,18 @@ flowchart TD
|
|
|
69
71
|
D -.->|system 只留静态骨架| S[ptc_meter section]
|
|
70
72
|
```
|
|
71
73
|
|
|
74
|
+
## 原理(小白)
|
|
75
|
+
|
|
76
|
+
**像计步器**:这一趟跑了多少步(调用了几次工具),下一趟出发前告诉你「上次 40 步,比平时多」,你自己决定要不要合并行程。
|
|
77
|
+
|
|
78
|
+
```mermaid
|
|
79
|
+
flowchart TD
|
|
80
|
+
A[干活:调用工具] --> B[计步:几次]
|
|
81
|
+
B --> C[记下来]
|
|
82
|
+
C --> D[下轮开始时报数]
|
|
83
|
+
D --> A
|
|
84
|
+
```
|
|
85
|
+
|
|
72
86
|
## License
|
|
73
87
|
|
|
74
88
|
MIT
|
|
@@ -132,6 +146,8 @@ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no enviro
|
|
|
132
146
|
- `session_start`: resets module-level counters.
|
|
133
147
|
- The `ptc_meter` system section holds only a byte-stable skeleton.
|
|
134
148
|
|
|
149
|
+
## How it works (technical)
|
|
150
|
+
|
|
135
151
|
```mermaid
|
|
136
152
|
flowchart TD
|
|
137
153
|
A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
|
|
@@ -139,8 +155,27 @@ flowchart TD
|
|
|
139
155
|
C --> D[before_agent_start<br/>settle previous turn]
|
|
140
156
|
D -->|nextTurn message<br/>calls / duration / deviation / median| A
|
|
141
157
|
D -.->|system keeps a static skeleton| S[ptc_meter section]
|
|
158
|
+
|
|
142
159
|
```
|
|
143
160
|
|
|
161
|
+
## How it works (plain words)
|
|
162
|
+
|
|
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.
|
|
164
|
+
|
|
165
|
+
```mermaid
|
|
166
|
+
flowchart TD
|
|
167
|
+
A[work: tool calls] --> B[count: how many]
|
|
168
|
+
B --> C[record it]
|
|
169
|
+
C --> D[report next turn]
|
|
170
|
+
D --> A
|
|
171
|
+
```
|
|
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
|
+
|
|
144
179
|
## License
|
|
145
180
|
|
|
146
181
|
MIT
|