pi-ptc-meter 1.0.15 → 1.0.17
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 +54 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,6 +9,24 @@
|
|
|
9
9
|
|
|
10
10
|
每轮工具调用计量:统计调用次数与耗时,并把数字回灌给模型。
|
|
11
11
|
|
|
12
|
+
## 快速事实
|
|
13
|
+
|
|
14
|
+
| 项 | 说明 |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| 配置文件 | ~/.pi/ptc-meter.json(可省略) |
|
|
17
|
+
| 命令行 | /ptc [n](默认 20) |
|
|
18
|
+
| 调用方式 | **全自动**:计数与回灌无需触发;命令只查看 |
|
|
19
|
+
|
|
20
|
+
完整配置(全部键与默认值):
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"threshold": 39,
|
|
25
|
+
"inject": true,
|
|
26
|
+
"notify": false
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
12
30
|
## 安装
|
|
13
31
|
|
|
14
32
|
```bash
|
|
@@ -42,6 +60,15 @@ pi install npm:pi-ptc-meter
|
|
|
42
60
|
- `session_start`:模块级计量归零。
|
|
43
61
|
- system 内 section `ptc_meter` 只含逐字不变的骨架。
|
|
44
62
|
|
|
63
|
+
```mermaid
|
|
64
|
+
flowchart TD
|
|
65
|
+
A[tool_call] -->|计数 +1| B[turn_end<br/>记录次数与耗时]
|
|
66
|
+
B --> C[agent_end<br/>落盘一行日志]
|
|
67
|
+
C --> D[before_agent_start<br/>结算上一轮]
|
|
68
|
+
D -->|nextTurn 尾部消息<br/>次数 / 耗时 / 偏差 / 中位| A
|
|
69
|
+
D -.->|system 只留静态骨架| S[ptc_meter section]
|
|
70
|
+
```
|
|
71
|
+
|
|
45
72
|
## License
|
|
46
73
|
|
|
47
74
|
MIT
|
|
@@ -54,6 +81,24 @@ MIT
|
|
|
54
81
|
|
|
55
82
|
Per-turn tool-call metering: counts calls and duration, then feeds the numbers back to the model.
|
|
56
83
|
|
|
84
|
+
## At a glance
|
|
85
|
+
|
|
86
|
+
| Item | Description |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| Config file | ~/.pi/ptc-meter.json (optional) |
|
|
89
|
+
| Commands | /ptc [n] (default 20) |
|
|
90
|
+
| Automation | **Fully automatic**: metering and feedback need no trigger; the command only reads |
|
|
91
|
+
|
|
92
|
+
Full config (all keys and defaults):
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"threshold": 39,
|
|
97
|
+
"inject": true,
|
|
98
|
+
"notify": false
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
57
102
|
## Install
|
|
58
103
|
|
|
59
104
|
```bash
|
|
@@ -87,6 +132,15 @@ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no enviro
|
|
|
87
132
|
- `session_start`: resets module-level counters.
|
|
88
133
|
- The `ptc_meter` system section holds only a byte-stable skeleton.
|
|
89
134
|
|
|
135
|
+
```mermaid
|
|
136
|
+
flowchart TD
|
|
137
|
+
A[tool_call] -->|counter +1| B[turn_end<br/>record calls and duration]
|
|
138
|
+
B --> C[agent_end<br/>write one log line]
|
|
139
|
+
C --> D[before_agent_start<br/>settle previous turn]
|
|
140
|
+
D -->|nextTurn message<br/>calls / duration / deviation / median| A
|
|
141
|
+
D -.->|system keeps a static skeleton| S[ptc_meter section]
|
|
142
|
+
```
|
|
143
|
+
|
|
90
144
|
## License
|
|
91
145
|
|
|
92
146
|
MIT
|