pi-ptc-meter 1.0.17 → 1.0.18
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,19 @@ flowchart TD
|
|
|
69
71
|
D -.->|system 只留静态骨架| S[ptc_meter section]
|
|
70
72
|
```
|
|
71
73
|
|
|
74
|
+
## 原理(小白)
|
|
75
|
+
|
|
76
|
+
像计步器:这一趟跑了多少步(调用了几次工具),下一趟出发前告诉你「上次 40 步,比平时多」,你自己决定要不要合并行程。
|
|
77
|
+
|
|
78
|
+
```mermaid
|
|
79
|
+
flowchart LR
|
|
80
|
+
A[这一轮干活] --> B[计步:用了几次工具]
|
|
81
|
+
B --> C[记下来]
|
|
82
|
+
C --> D[下一轮开始时报数]
|
|
83
|
+
D --> A
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
72
87
|
## License
|
|
73
88
|
|
|
74
89
|
MIT
|
|
@@ -132,7 +147,27 @@ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no enviro
|
|
|
132
147
|
- `session_start`: resets module-level counters.
|
|
133
148
|
- The `ptc_meter` system section holds only a byte-stable skeleton.
|
|
134
149
|
|
|
150
|
+
## How it works (technical)
|
|
151
|
+
|
|
135
152
|
```mermaid
|
|
153
|
+
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]
|
|
159
|
+
|
|
160
|
+
## How it works (plain words)
|
|
161
|
+
|
|
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.
|
|
163
|
+
|
|
164
|
+
```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
|
+
D --> A
|
|
170
|
+
```
|
|
136
171
|
flowchart TD
|
|
137
172
|
A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
|
|
138
173
|
B --> C[agent_end<br/>write one log line]
|