@vtstech/pi-status 1.1.6 → 1.1.8
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 +2 -3
- package/package.json +2 -2
- package/status.js +21 -19
package/README.md
CHANGED
|
@@ -32,8 +32,7 @@ Slots are updated every 5 seconds (1 second for active tool timing). Render orde
|
|
|
32
32
|
|
|
33
33
|
| Slot | Description | Condition |
|
|
34
34
|
|------|-------------|-----------|
|
|
35
|
-
| **CtxMax** |
|
|
36
|
-
| **RespMax** | Max response/completion tokens with k-notation (e.g., `16k`) | After first provider request |
|
|
35
|
+
| **CtxMax + RespMax** | Combined: native model context window + max response tokens (e.g., `CtxMax:33k RespMax:16.4k`) | Ollama or after first provider request |
|
|
37
36
|
| **Resp** | Agent loop duration (e.g., `2m3s`) | After first agent cycle |
|
|
38
37
|
| **CPU%** | Per-core CPU usage delta | Local Ollama only |
|
|
39
38
|
| **RAM** | Used/total system memory | Local Ollama only |
|
|
@@ -42,7 +41,7 @@ Slots are updated every 5 seconds (1 second for active tool timing). Render orde
|
|
|
42
41
|
| **SEC** | Security mode indicator (`SEC:BASIC`/`SEC:MAX`) + session-scoped blocked count + 3s flash on block event | Always shown |
|
|
43
42
|
| **Active tool** | Live elapsed timer with `>` indicator | While a tool is running |
|
|
44
43
|
| **Prompt** | System prompt size as `chars chr tokens tok` | After first agent start |
|
|
45
|
-
| **Pi version** | `pi:0.66.1` (
|
|
44
|
+
| **Pi version** | `pi:0.66.1` (dim label + green value, always last) | Always shown |
|
|
46
45
|
|
|
47
46
|
All slots are cleared on `session_shutdown`. Metrics that the framework already provides (model name, session tokens, context usage, thinking level) are intentionally omitted to avoid duplication.
|
|
48
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtstech/pi-status",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "System monitor / status bar extension for Pi Coding Agent",
|
|
5
5
|
"main": "status.js",
|
|
6
6
|
"keywords": ["pi-extensions"],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/VTSTech/pi-coding-agent"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@vtstech/pi-shared": "1.1.
|
|
17
|
+
"@vtstech/pi-shared": "1.1.8"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mariozechner/pi-coding-agent": ">=0.66"
|
package/status.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// .build-npm/status/status.temp.ts
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
|
-
import {
|
|
3
|
+
import { exec } from "node:child_process";
|
|
4
|
+
import { promisify } from "node:util";
|
|
4
5
|
import os from "node:os";
|
|
5
6
|
import { getOllamaBaseUrl, fetchModelContextLength, readModelsJson } from "@vtstech/pi-shared/ollama";
|
|
6
7
|
import { fmtBytes, fmtDur } from "@vtstech/pi-shared/format";
|
|
7
8
|
import { debugLog } from "@vtstech/pi-shared/debug";
|
|
8
9
|
import { getSecurityMode } from "@vtstech/pi-shared/security";
|
|
10
|
+
var execAsync = promisify(exec);
|
|
9
11
|
var STATUS_UPDATE_INTERVAL_MS = 5e3;
|
|
10
12
|
var TOOL_TIMER_INTERVAL_MS = 1e3;
|
|
11
13
|
function status_temp_default(pi) {
|
|
@@ -95,7 +97,8 @@ function status_temp_default(pi) {
|
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
}
|
|
98
|
-
} catch {
|
|
100
|
+
} catch (err) {
|
|
101
|
+
debugLog("status", "failed to detect local provider", err);
|
|
99
102
|
}
|
|
100
103
|
return false;
|
|
101
104
|
}
|
|
@@ -112,7 +115,8 @@ function status_temp_default(pi) {
|
|
|
112
115
|
if (ctx != null) {
|
|
113
116
|
footerNativeCtx = ctx >= 1e3 ? `${(ctx / 1e3).toFixed(0)}k` : String(ctx);
|
|
114
117
|
}
|
|
115
|
-
} catch {
|
|
118
|
+
} catch (err) {
|
|
119
|
+
debugLog("status", "failed to fetch native model context", err);
|
|
116
120
|
} finally {
|
|
117
121
|
nativeCtxPromise = null;
|
|
118
122
|
}
|
|
@@ -141,21 +145,16 @@ function status_temp_default(pi) {
|
|
|
141
145
|
"status-swap",
|
|
142
146
|
isLocalProvider && hasSwap && swapUsed > 0 ? `${dim2("Swap")} ${green2(fmtBytes(swapUsed) + "/" + fmtBytes(swapTotal))}` : void 0
|
|
143
147
|
);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
footerNativeCtx ? `${dim2("CtxMax:")}${green2(footerNativeCtx)}` : void 0
|
|
147
|
-
);
|
|
148
|
+
const ctxParts = [];
|
|
149
|
+
if (footerNativeCtx) ctxParts.push(`${dim2("CtxMax:")}${green2(footerNativeCtx)}`);
|
|
148
150
|
if (lastPayload) {
|
|
149
151
|
const rawMax = lastPayload.max_completion_tokens ?? lastPayload.max_tokens;
|
|
150
152
|
if (rawMax !== void 0) {
|
|
151
153
|
const formatted = rawMax >= 1e3 ? `${(rawMax / 1e3).toFixed(rawMax % 1e3 === 0 ? 0 : 1)}k` : String(rawMax);
|
|
152
|
-
|
|
153
|
-
} else {
|
|
154
|
-
ctxUi.setStatus("status-resp-max", void 0);
|
|
154
|
+
ctxParts.push(`${dim2("RespMax:")}${green2(formatted)}`);
|
|
155
155
|
}
|
|
156
|
-
} else {
|
|
157
|
-
ctxUi.setStatus("status-resp-max", void 0);
|
|
158
156
|
}
|
|
157
|
+
ctxUi.setStatus("status-ctx", ctxParts.length > 0 ? ctxParts.join(" ") : void 0);
|
|
159
158
|
ctxUi.setStatus(
|
|
160
159
|
"status-resp",
|
|
161
160
|
lastResponseTime !== null ? `${dim2("Resp")} ${green2(fmtDur(lastResponseTime))}` : void 0
|
|
@@ -181,9 +180,9 @@ function status_temp_default(pi) {
|
|
|
181
180
|
} else {
|
|
182
181
|
ctxUi.setStatus("status-tool", void 0);
|
|
183
182
|
}
|
|
184
|
-
ctxUi.setStatus("
|
|
183
|
+
ctxUi.setStatus("status-prompt", cachedPromptText ?? dim2("Prompt: \u2026"));
|
|
185
184
|
if (versionsText) {
|
|
186
|
-
ctxUi.setStatus("status-versions", dim2(versionsText));
|
|
185
|
+
ctxUi.setStatus("status-versions", `${dim2("pi:")}${green2(versionsText.replace(/^pi:/, ""))}`);
|
|
187
186
|
}
|
|
188
187
|
}
|
|
189
188
|
function updateMetrics() {
|
|
@@ -216,13 +215,16 @@ function status_temp_default(pi) {
|
|
|
216
215
|
ctxTheme = ctx.ui.theme;
|
|
217
216
|
prevCpuInfo = getCpuSnapshot();
|
|
218
217
|
try {
|
|
219
|
-
const
|
|
218
|
+
const { stdout } = await execAsync("pi -v 2>&1", { timeout: 5e3 });
|
|
219
|
+
const out = stdout.trim();
|
|
220
220
|
if (out) versionsText = `pi:${out}`;
|
|
221
|
-
} catch {
|
|
221
|
+
} catch (err) {
|
|
222
|
+
debugLog("status", "failed to fetch Pi version", err);
|
|
222
223
|
}
|
|
223
224
|
updateMetrics();
|
|
224
225
|
if (updateInterval) clearInterval(updateInterval);
|
|
225
226
|
updateInterval = setInterval(updateMetrics, STATUS_UPDATE_INTERVAL_MS);
|
|
227
|
+
updateInterval.unref();
|
|
226
228
|
});
|
|
227
229
|
pi.on("session_shutdown", async (_event, ctx) => {
|
|
228
230
|
if (updateInterval) {
|
|
@@ -240,11 +242,10 @@ function status_temp_default(pi) {
|
|
|
240
242
|
ui.setStatus("status-cpu", void 0);
|
|
241
243
|
ui.setStatus("status-ram", void 0);
|
|
242
244
|
ui.setStatus("status-swap", void 0);
|
|
243
|
-
ui.setStatus("status-
|
|
245
|
+
ui.setStatus("status-ctx", void 0);
|
|
244
246
|
ui.setStatus("status-resp", void 0);
|
|
245
|
-
ui.setStatus("status-resp-max", void 0);
|
|
246
247
|
ui.setStatus("status-params", void 0);
|
|
247
|
-
ui.setStatus("
|
|
248
|
+
ui.setStatus("status-prompt", void 0);
|
|
248
249
|
ui.setStatus("status-sec", void 0);
|
|
249
250
|
ui.setStatus("status-tool", void 0);
|
|
250
251
|
ui.setStatus("status-versions", void 0);
|
|
@@ -313,6 +314,7 @@ function status_temp_default(pi) {
|
|
|
313
314
|
function startToolTimer() {
|
|
314
315
|
if (toolTimerInterval) return;
|
|
315
316
|
toolTimerInterval = setInterval(flushStatus, TOOL_TIMER_INTERVAL_MS);
|
|
317
|
+
toolTimerInterval.unref();
|
|
316
318
|
}
|
|
317
319
|
function stopToolTimer() {
|
|
318
320
|
if (toolTimerInterval) {
|