pi-ptc-meter 1.0.14 → 1.0.16
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 +26 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="#zh"><img alt="中文" src="https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E4%B8%AD%E6%96%87-2F81F7?style=for-the-badge"></a>
|
|
3
|
+
<a href="#english"><img alt="English" src="https://img.shields.io/badge/English-EN-FF6B35?style=for-the-badge"></a>
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
<a id="zh"></a>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
# pi-ptc-meter
|
|
4
9
|
|
|
5
10
|
每轮工具调用计量:统计调用次数与耗时,并把数字回灌给模型。
|
|
6
11
|
|
|
@@ -37,6 +42,15 @@ pi install npm:pi-ptc-meter
|
|
|
37
42
|
- `session_start`:模块级计量归零。
|
|
38
43
|
- system 内 section `ptc_meter` 只含逐字不变的骨架。
|
|
39
44
|
|
|
45
|
+
```mermaid
|
|
46
|
+
flowchart TD
|
|
47
|
+
A[tool_call] -->|计数 +1| B[turn_end<br/>记录次数与耗时]
|
|
48
|
+
B --> C[agent_end<br/>落盘一行日志]
|
|
49
|
+
C --> D[before_agent_start<br/>结算上一轮]
|
|
50
|
+
D -->|nextTurn 尾部消息<br/>次数 / 耗时 / 偏差 / 中位| A
|
|
51
|
+
D -.->|system 只留静态骨架| S[ptc_meter section]
|
|
52
|
+
```
|
|
53
|
+
|
|
40
54
|
## License
|
|
41
55
|
|
|
42
56
|
MIT
|
|
@@ -45,8 +59,7 @@ MIT
|
|
|
45
59
|
|
|
46
60
|
<a id="english"></a>
|
|
47
61
|
|
|
48
|
-
<
|
|
49
|
-
<summary><b>English</b></summary>
|
|
62
|
+
<h1 align="center">🌐 English Version ⬇️</h1>
|
|
50
63
|
|
|
51
64
|
Per-turn tool-call metering: counts calls and duration, then feeds the numbers back to the model.
|
|
52
65
|
|
|
@@ -83,8 +96,15 @@ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no enviro
|
|
|
83
96
|
- `session_start`: resets module-level counters.
|
|
84
97
|
- The `ptc_meter` system section holds only a byte-stable skeleton.
|
|
85
98
|
|
|
99
|
+
```mermaid
|
|
100
|
+
flowchart TD
|
|
101
|
+
A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
|
|
102
|
+
B --> C[agent_end<br/>write one log line]
|
|
103
|
+
C --> D[before_agent_start<br/>settle previous turn]
|
|
104
|
+
D -->|nextTurn message<br/>calls / duration / deviation / median| A
|
|
105
|
+
D -.->|system keeps a static skeleton| S[ptc_meter section]
|
|
106
|
+
```
|
|
107
|
+
|
|
86
108
|
## License
|
|
87
109
|
|
|
88
110
|
MIT
|
|
89
|
-
|
|
90
|
-
</details>
|