pi-sdk-web 0.1.5 → 0.1.7
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/dist/server.js +13 -2
- package/package.json +1 -1
- package/static/app.js +4 -2
- package/static/style.css +1 -1
package/dist/server.js
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* - Client msgs: prompt/abort/get_stats/bash/cycle_model/set_model/... -> session methods
|
|
10
10
|
*/
|
|
11
11
|
import { execFileSync } from "node:child_process";
|
|
12
|
-
import { existsSync } from "node:fs";
|
|
12
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
13
13
|
import { readFile } from "node:fs/promises";
|
|
14
14
|
import { createServer } from "node:http";
|
|
15
|
-
import { dirname, resolve } from "node:path";
|
|
15
|
+
import { dirname, join, resolve } from "node:path";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
17
|
import { ModelRegistry, VERSION, } from "@earendil-works/pi-coding-agent";
|
|
18
18
|
import { WebSocket, WebSocketServer } from "ws";
|
|
@@ -23,6 +23,16 @@ const DEFAULT_PORT = 4080;
|
|
|
23
23
|
const PACKAGE_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..");
|
|
24
24
|
const STATIC_DIR = [resolve(PACKAGE_DIR, "static"), resolve(PACKAGE_DIR, "..", "static")].find((p) => existsSync(p)) ??
|
|
25
25
|
resolve(PACKAGE_DIR, "..", "static");
|
|
26
|
+
// Our own package version (pi-sdk-web), shown in the header next to Pi's version
|
|
27
|
+
const PI_WEB_VERSION = (() => {
|
|
28
|
+
try {
|
|
29
|
+
const pkg = JSON.parse(readFileSync(join(PACKAGE_DIR, "package.json"), "utf8"));
|
|
30
|
+
return pkg.version ?? "dev";
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return "dev";
|
|
34
|
+
}
|
|
35
|
+
})();
|
|
26
36
|
// Events after which footer stats should be refreshed (TUI does this too)
|
|
27
37
|
const STATS_REFRESH_EVENTS = new Set([
|
|
28
38
|
"agent_settled",
|
|
@@ -204,6 +214,7 @@ export class PiWebServer {
|
|
|
204
214
|
autoCompactionEnabled: this.session.autoCompactionEnabled,
|
|
205
215
|
messageCount: this.session.messages.length,
|
|
206
216
|
version: VERSION,
|
|
217
|
+
piWebVersion: PI_WEB_VERSION,
|
|
207
218
|
cwd: this.formatCwd(this.session.sessionManager.getCwd()),
|
|
208
219
|
gitBranch: this.getGitBranch(this.session.sessionManager.getCwd()),
|
|
209
220
|
commands: this.getCommands(),
|
package/package.json
CHANGED
package/static/app.js
CHANGED
|
@@ -191,9 +191,11 @@ class PiWebClient {
|
|
|
191
191
|
document.title = `pi-web - ${state.sessionName || state.sessionId}`;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
// Header version
|
|
194
|
+
// Header version: pi v<pi version> · pi-web v<pi-sdk-web version>
|
|
195
195
|
if (this.versionEl && state.version) {
|
|
196
|
-
|
|
196
|
+
const parts = [`v${state.version}`];
|
|
197
|
+
if (state.piWebVersion) parts.push(`pi-web v${state.piWebVersion}`);
|
|
198
|
+
this.versionEl.textContent = parts.join(' · ');
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
// Loaded resources
|