@vtstech/pi-status 1.1.9 → 1.2.1
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 +3 -3
- package/status.js +10 -8
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vtstech/pi-status",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "System monitor / status bar extension for Pi Coding Agent",
|
|
5
5
|
"main": "status.js",
|
|
6
|
-
"keywords": ["pi-extensions"],
|
|
6
|
+
"keywords": ["pi-package", "pi", "pi-coding-agent", "pi-extensions"],
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"access": "public",
|
|
9
9
|
"type": "module",
|
|
@@ -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.2.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@mariozechner/pi-coding-agent": ">=0.66"
|
package/status.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as fs from "node:fs";
|
|
|
3
3
|
import { exec } from "node:child_process";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
5
|
import os from "node:os";
|
|
6
|
-
import { getOllamaBaseUrl, fetchModelContextLength, readModelsJson } from "@vtstech/pi-shared/ollama";
|
|
6
|
+
import { getOllamaBaseUrl, fetchModelContextLength, readModelsJson, isLocalProvider } from "@vtstech/pi-shared/ollama";
|
|
7
7
|
import { fmtBytes, fmtDur } from "@vtstech/pi-shared/format";
|
|
8
8
|
import { debugLog } from "@vtstech/pi-shared/debug";
|
|
9
9
|
import { getSecurityMode } from "@vtstech/pi-shared/security";
|
|
@@ -29,7 +29,7 @@ function status_temp_default(pi) {
|
|
|
29
29
|
let footerModel = "";
|
|
30
30
|
let footerNativeCtx = "";
|
|
31
31
|
let nativeCtxModel = "";
|
|
32
|
-
let
|
|
32
|
+
let isLocal = true;
|
|
33
33
|
let versionsText = "";
|
|
34
34
|
let cachedPromptText = null;
|
|
35
35
|
let securityFlashTool = "";
|
|
@@ -86,13 +86,13 @@ function status_temp_default(pi) {
|
|
|
86
86
|
function detectLocalProvider(modelsJson) {
|
|
87
87
|
try {
|
|
88
88
|
const ctxUrl = currentCtx?.provider?.baseUrl || currentCtx?.provider?.url || "";
|
|
89
|
-
if (ctxUrl) return
|
|
89
|
+
if (ctxUrl) return isLocalProvider(ctxUrl);
|
|
90
90
|
const modelId = footerModel || "";
|
|
91
91
|
if (modelsJson && modelId) {
|
|
92
92
|
for (const provider of Object.values(modelsJson.providers || {})) {
|
|
93
93
|
const url = provider.baseUrl || "";
|
|
94
94
|
if ((provider.models || []).some((m) => m.id === modelId)) {
|
|
95
|
-
return
|
|
95
|
+
return isLocalProvider(url);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -138,11 +138,11 @@ function status_temp_default(pi) {
|
|
|
138
138
|
const theme = ctxTheme;
|
|
139
139
|
const dim2 = (s) => theme?.fg?.("dim", s) ?? s;
|
|
140
140
|
const green2 = (s) => theme?.fg?.("success", s) ?? s;
|
|
141
|
-
ctxUi.setStatus("status-cpu",
|
|
142
|
-
ctxUi.setStatus("status-ram",
|
|
141
|
+
ctxUi.setStatus("status-cpu", isLocal ? `${dim2("CPU")} ${green2(cpuUsage.toFixed(0) + "%")}` : void 0);
|
|
142
|
+
ctxUi.setStatus("status-ram", isLocal ? `${dim2("RAM")} ${green2(fmtBytes(memUsed) + "/" + fmtBytes(memTotal))}` : void 0);
|
|
143
143
|
ctxUi.setStatus(
|
|
144
144
|
"status-swap",
|
|
145
|
-
|
|
145
|
+
isLocal && hasSwap && swapUsed > 0 ? `${dim2("Swap")} ${green2(fmtBytes(swapUsed) + "/" + fmtBytes(swapTotal))}` : void 0
|
|
146
146
|
);
|
|
147
147
|
const ctxParts = [];
|
|
148
148
|
if (footerNativeCtx) ctxParts.push(`${dim2("CtxMax:")}${green2(footerNativeCtx)}`);
|
|
@@ -170,6 +170,8 @@ function status_temp_default(pi) {
|
|
|
170
170
|
ctxUi.setStatus("status-sec", `${dim2("SEC:")}${green2(String(blockedCount))} ${dim2("(" + secMode.toUpperCase() + ")")} ${dim2("(blocked: " + securityFlashTool + ")")}`);
|
|
171
171
|
} else if (blockedCount > 0) {
|
|
172
172
|
ctxUi.setStatus("status-sec", `${dim2("SEC:")}${green2(String(blockedCount))} ${dim2("(" + secMode.toUpperCase() + ")")}`);
|
|
173
|
+
} else if (secMode === "off") {
|
|
174
|
+
ctxUi.setStatus("status-sec", `${dim2("SEC:")}${green2("OFF")}`);
|
|
173
175
|
} else {
|
|
174
176
|
ctxUi.setStatus("status-sec", `${dim2("SEC:")}${green2(secMode.toUpperCase())}`);
|
|
175
177
|
}
|
|
@@ -198,7 +200,7 @@ function status_temp_default(pi) {
|
|
|
198
200
|
hasSwap = false;
|
|
199
201
|
}
|
|
200
202
|
const modelsJson = readModelsJson();
|
|
201
|
-
|
|
203
|
+
isLocal = modelsJson ? detectLocalProvider(modelsJson) : false;
|
|
202
204
|
if (currentCtx) {
|
|
203
205
|
footerModel = currentCtx.model?.id || "";
|
|
204
206
|
const modelId = currentCtx.model?.id || "";
|