@vtstech/pi-status 1.0.4-1 → 1.0.5

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/package.json +3 -3
  2. package/status.js +19 -0
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@vtstech/pi-status",
3
- "version": "1.0.4-1",
3
+ "version": "1.0.5",
4
4
  "description": "System monitor / status bar extension for Pi Coding Agent",
5
5
  "main": "status.js",
6
- "keywords": ["pi-package", "pi-extensions"],
6
+ "keywords": ["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.0.4-1"
17
+ "@vtstech/pi-shared": "1.0.5"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@mariozechner/pi-coding-agent": ">=0.66"
package/status.js CHANGED
@@ -1,5 +1,7 @@
1
1
  // .build-npm/status/status.temp.ts
2
2
  import os from "node:os";
3
+ import * as fs from "node:fs";
4
+ import * as path from "node:path";
3
5
  import { execSync } from "node:child_process";
4
6
  import { getOllamaBaseUrl } from "@vtstech/pi-shared/ollama";
5
7
  import { fmtBytes, fmtDur } from "@vtstech/pi-shared/format";
@@ -159,6 +161,23 @@ function status_temp_default(pi) {
159
161
  } else {
160
162
  footerCtxPct = "";
161
163
  }
164
+ const modelId = currentCtx.model?.id || "";
165
+ if (modelId && !footerCtxPct) {
166
+ try {
167
+ const modelsJson = JSON.parse(fs.readFileSync(
168
+ path.join(os.homedir(), ".pi", "agent", "models.json"),
169
+ "utf-8"
170
+ ));
171
+ for (const prov of Object.values(modelsJson.providers || {})) {
172
+ const match = (prov.models || []).find((m) => m.id === modelId);
173
+ if (match?.contextLength) {
174
+ footerCtxPct = `${(match.contextLength / 1e3).toFixed(0)}k ctx`;
175
+ break;
176
+ }
177
+ }
178
+ } catch {
179
+ }
180
+ }
162
181
  }
163
182
  refreshBlockedCount();
164
183
  }