pi-ptc-meter 1.0.13 → 1.0.15

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 +52 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,10 @@
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>
7
+
1
8
  # pi-ptc-meter
2
9
 
3
10
  每轮工具调用计量:统计调用次数与耗时,并把数字回灌给模型。
@@ -38,3 +45,48 @@ pi install npm:pi-ptc-meter
38
45
  ## License
39
46
 
40
47
  MIT
48
+
49
+ ---
50
+
51
+ <a id="english"></a>
52
+
53
+ <h1 align="center">🌐 English Version &nbsp;⬇️</h1>
54
+
55
+ Per-turn tool-call metering: counts calls and duration, then feeds the numbers back to the model.
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ pi install npm:pi-ptc-meter
61
+ ```
62
+
63
+ ## Configuration
64
+
65
+ Config file `~/.pi/ptc-meter.json` (optional; invalid JSON falls back):
66
+
67
+ | Key | Default | Description |
68
+ | --- | --- | --- |
69
+ | `threshold` | `39` | Per-turn call threshold (> 0) |
70
+ | `inject` | `true` | Enable the feedback message |
71
+ | `notify` | `false` | Use UI notifications instead |
72
+
73
+ Also: log `~/.pi/ptc-meter.jsonl` (1 MiB truncation, tail-preserving); no environment variables.
74
+
75
+ ## Commands
76
+
77
+ | Command | Purpose |
78
+ | --- | --- |
79
+ | `/ptc [n]` | Last n turns: counts, duration, estimates, median, over-threshold |
80
+
81
+ ## What it does (source facts)
82
+
83
+ - `tool_call`: increments a counter (never intercepts or rewrites).
84
+ - `turn_end`: records calls and duration (no disk write).
85
+ - `agent_end`: writes one log line per run.
86
+ - `before_agent_start`: settles the previous turn and feeds back counts, duration, deviation and the baseline median as a `nextTurn` trailing message.
87
+ - `session_start`: resets module-level counters.
88
+ - The `ptc_meter` system section holds only a byte-stable skeleton.
89
+
90
+ ## License
91
+
92
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-ptc-meter",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
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",