@vtstech/pi-status 1.1.7 → 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/package.json +2 -2
- package/status.js +13 -5
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
|
}
|
|
@@ -211,13 +215,16 @@ function status_temp_default(pi) {
|
|
|
211
215
|
ctxTheme = ctx.ui.theme;
|
|
212
216
|
prevCpuInfo = getCpuSnapshot();
|
|
213
217
|
try {
|
|
214
|
-
const
|
|
218
|
+
const { stdout } = await execAsync("pi -v 2>&1", { timeout: 5e3 });
|
|
219
|
+
const out = stdout.trim();
|
|
215
220
|
if (out) versionsText = `pi:${out}`;
|
|
216
|
-
} catch {
|
|
221
|
+
} catch (err) {
|
|
222
|
+
debugLog("status", "failed to fetch Pi version", err);
|
|
217
223
|
}
|
|
218
224
|
updateMetrics();
|
|
219
225
|
if (updateInterval) clearInterval(updateInterval);
|
|
220
226
|
updateInterval = setInterval(updateMetrics, STATUS_UPDATE_INTERVAL_MS);
|
|
227
|
+
updateInterval.unref();
|
|
221
228
|
});
|
|
222
229
|
pi.on("session_shutdown", async (_event, ctx) => {
|
|
223
230
|
if (updateInterval) {
|
|
@@ -307,6 +314,7 @@ function status_temp_default(pi) {
|
|
|
307
314
|
function startToolTimer() {
|
|
308
315
|
if (toolTimerInterval) return;
|
|
309
316
|
toolTimerInterval = setInterval(flushStatus, TOOL_TIMER_INTERVAL_MS);
|
|
317
|
+
toolTimerInterval.unref();
|
|
310
318
|
}
|
|
311
319
|
function stopToolTimer() {
|
|
312
320
|
if (toolTimerInterval) {
|