pi-web-ui 0.48.1 → 0.48.3

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.
@@ -1332,28 +1332,17 @@ export class ClientSession {
1332
1332
  this.webUi.resolveDialog(id, value);
1333
1333
  }
1334
1334
  /**
1335
- * Whether the pi agent config looks ready: the agent dir exists and
1336
- * auth.json has at least one provider credential. Cached for 2s.
1335
+ * Whether the pi agent has at least one usable model. ModelRuntime's
1336
+ * available snapshot already accounts for models.json, auth.json, env-var
1337
+ * credentials, OAuth, and runtime API-key overrides. Cached for 2s because
1338
+ * this is called while building frequent snapshots.
1337
1339
  */
1338
1340
  isPiConfigured() {
1339
1341
  const now = Date.now();
1340
1342
  const cached = this.piCheckCache;
1341
1343
  if (cached && now - cached.at < 2000)
1342
1344
  return cached.configured;
1343
- let configured = false;
1344
- try {
1345
- const authPath = join(this.agentDir, "auth.json");
1346
- if (existsSync(authPath)) {
1347
- const data = JSON.parse(readFileSync(authPath, "utf8"));
1348
- configured =
1349
- typeof data === "object" &&
1350
- data !== null &&
1351
- Object.keys(data).length > 0;
1352
- }
1353
- }
1354
- catch {
1355
- configured = false;
1356
- }
1345
+ const configured = (this.sharedModelRuntime?.getAvailableSnapshot().length ?? 0) > 0;
1357
1346
  this.piCheckCache = { at: now, configured };
1358
1347
  return configured;
1359
1348
  }
@@ -769,6 +769,7 @@ export class ModelAdminService {
769
769
  // auth.json is optional; models.json can still use its own apiKey.
770
770
  }
771
771
  await this.host.modelRuntime().refresh();
772
+ this.host.invalidatePiConfig();
772
773
  await this.listModelsConfig();
773
774
  await this.host.pushModels();
774
775
  this.host.emit({
@@ -801,6 +802,7 @@ export class ModelAdminService {
801
802
  delete providers[providerId];
802
803
  writeFileSync(this.modelsConfigPath(), JSON.stringify({ providers }, null, 2) + "\n");
803
804
  await this.host.modelRuntime().refresh();
805
+ this.host.invalidatePiConfig();
804
806
  await this.listModelsConfig();
805
807
  await this.host.pushModels();
806
808
  this.host.emit({
@@ -115,12 +115,14 @@ export class WebUIContext {
115
115
  });
116
116
  }
117
117
  // -- notifications --------------------------------------------------------
118
- notify(message, type) {
118
+ // Instance arrows so these survive the SDK's wrapUIPromptContext `{ ...ui }`
119
+ // (object spread copies own properties only, not class prototype methods).
120
+ notify = (message, type) => {
119
121
  this.emit({ type: "notice", level: type ?? "info", text: message });
120
- }
122
+ };
121
123
  // -- footer status (pi-lens "LSP Inactive", pi-cache-optimizer cache stats) --
122
124
  statuses = new Map();
123
- setStatus(key, text) {
125
+ setStatus = (key, text) => {
124
126
  if (text === undefined || text === "") {
125
127
  this.statuses.delete(key);
126
128
  }
@@ -133,7 +135,7 @@ export class WebUIContext {
133
135
  this.statuses.set(key, clean);
134
136
  }
135
137
  this.pushStatuses();
136
- }
138
+ };
137
139
  pushStatuses() {
138
140
  this.emit({
139
141
  type: "statuses",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-web-ui",
3
- "version": "0.48.1",
3
+ "version": "0.48.3",
4
4
  "description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -68,10 +68,11 @@
68
68
  "publish:electron": "electron-builder build --publish always"
69
69
  },
70
70
  "dependencies": {
71
- "@earendil-works/pi-coding-agent": "^0.84.2",
71
+ "@earendil-works/pi-coding-agent": "^0.84.4",
72
72
  "@xterm/addon-fit": "^0.11.0",
73
73
  "@xterm/xterm": "^6.0.0",
74
74
  "compression": "^1.8.1",
75
+ "electron-updater": "^6.0.0",
75
76
  "express": "^4.21.2",
76
77
  "highlight.js": "^11.10.0",
77
78
  "node-pty": "^1.1.0",
@@ -100,8 +101,7 @@
100
101
  "vite": "^6.0.3",
101
102
  "vitest": "^4.1.11",
102
103
  "electron": "^41.0.0",
103
- "electron-builder": "^25.0.0",
104
- "electron-updater": "^6.0.0"
104
+ "electron-builder": "^25.0.0"
105
105
  },
106
106
  "allowScripts": {
107
107
  "node-pty@1.1.0": true,