@vtstech/pi-diag 1.0.8 → 1.1.0

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/diag.js +14 -13
  2. package/package.json +2 -2
package/diag.js CHANGED
@@ -12,18 +12,19 @@ import {
12
12
  msHuman,
13
13
  pct
14
14
  } from "@vtstech/pi-shared/format";
15
- import { MODELS_JSON_PATH, getOllamaBaseUrl, BUILTIN_PROVIDERS } from "@vtstech/pi-shared/ollama";
15
+ import { MODELS_JSON_PATH, getOllamaBaseUrl, BUILTIN_PROVIDERS, readModelsJson, EXTENSION_VERSION } from "@vtstech/pi-shared/ollama";
16
16
  import {
17
17
  BLOCKED_COMMANDS,
18
18
  BLOCKED_URL_PATTERNS,
19
19
  validatePath,
20
20
  isSafeUrl,
21
21
  sanitizeCommand,
22
- readRecentAuditEntries
22
+ readRecentAuditEntries,
23
+ AUDIT_LOG_PATH
23
24
  } from "@vtstech/pi-shared/security";
24
25
  function diag_temp_default(pi) {
25
26
  const branding = [
26
- ` \u26A1 Pi Diagnostics v1.0.8`,
27
+ ` \u26A1 Pi Diagnostics v${EXTENSION_VERSION}`,
27
28
  ` Written by VTSTech`,
28
29
  ` GitHub: https://github.com/VTSTech`,
29
30
  ` Website: www.vts-tech.org`
@@ -182,12 +183,10 @@ function diag_temp_default(pi) {
182
183
  }
183
184
  lines.push(section("MODELS.JSON"));
184
185
  const agentDir = path.join(os.homedir(), ".pi", "agent");
185
- const modelsJsonPath = MODELS_JSON_PATH;
186
186
  let configuredModels = [];
187
- let modelsJson = null;
188
- if (fs.existsSync(modelsJsonPath)) {
187
+ const modelsJson = readModelsJson();
188
+ if (modelsJson && Object.keys(modelsJson.providers || {}).length > 0) {
189
189
  try {
190
- modelsJson = JSON.parse(fs.readFileSync(modelsJsonPath, "utf-8"));
191
190
  const providers = modelsJson.providers || {};
192
191
  lines.push(info(`Providers configured: ${Object.keys(providers).length}`));
193
192
  for (const [providerName, providerConfig] of Object.entries(providers)) {
@@ -225,7 +224,7 @@ function diag_temp_default(pi) {
225
224
  lines.push(fail(`models.json parse error: ${e.message}`));
226
225
  }
227
226
  } else {
228
- lines.push(fail(`models.json not found at ${modelsJsonPath}`));
227
+ lines.push(fail(`models.json not found at ${MODELS_JSON_PATH}`));
229
228
  lines.push(info(" \u2192 Run /ollama-sync to create it"));
230
229
  }
231
230
  lines.push(section("SETTINGS"));
@@ -370,9 +369,8 @@ function diag_temp_default(pi) {
370
369
  }
371
370
  lines.push(info("Audit log status:"));
372
371
  const auditEntries = readRecentAuditEntries(50);
373
- const auditLogPath = path.join(os.homedir(), ".pi", "agent", "audit.log");
374
- if (fs.existsSync(auditLogPath)) {
375
- lines.push(ok(`Audit log exists: ${auditLogPath}`));
372
+ if (fs.existsSync(AUDIT_LOG_PATH)) {
373
+ lines.push(ok(`Audit log exists: ${AUDIT_LOG_PATH}`));
376
374
  if (auditEntries.length > 0) {
377
375
  lines.push(info(` Recent entries: ${auditEntries.length} (last 50)`));
378
376
  const recentSample = auditEntries.slice(-3);
@@ -385,7 +383,7 @@ function diag_temp_default(pi) {
385
383
  lines.push(info(" No audit entries found (log is empty or unparseable)"));
386
384
  }
387
385
  } else {
388
- lines.push(warn(`Audit log not found at ${auditLogPath}`));
386
+ lines.push(warn(`Audit log not found at ${AUDIT_LOG_PATH}`));
389
387
  lines.push(info(" \u2192 Audit logging will begin when security events occur"));
390
388
  }
391
389
  lines.push(section("CURRENT SESSION"));
@@ -464,7 +462,10 @@ function diag_temp_default(pi) {
464
462
  promptGuidelines: [
465
463
  "When the user asks for a diagnostic, health check, or system test, call self_diagnostic."
466
464
  ],
467
- parameters: {},
465
+ parameters: {
466
+ type: "object",
467
+ properties: {}
468
+ },
468
469
  execute: async (_toolCallId, _params, _signal, _onUpdate, ctx) => {
469
470
  try {
470
471
  const report = await runDiagnostics(ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtstech/pi-diag",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "Diagnostics extension for Pi Coding Agent",
5
5
  "main": "diag.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.0.8"
17
+ "@vtstech/pi-shared": "1.1.0"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@mariozechner/pi-coding-agent": ">=0.66"