pi-web-ui 0.48.2 → 0.49.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.
@@ -179,9 +179,7 @@ const here = dirname(fileURLToPath(import.meta.url)); // <pkg>/dist/server or <p
179
179
  // Resolve the package root robustly: dev runs from <repo>/server (tsx), prod
180
180
  // from <pkg>/dist/server — the ancestor that actually has package.json wins.
181
181
  function resolvePkgRoot() {
182
- // PI_WEB_PKG_ROOT: Electron 桌面版打包后,server 子进程从 extraResources 目录
183
- //(process.resourcesPath)加载 web/dist 和 themes。通过这个 env var 告诉
184
- // server 去哪里找 pkgRoot,避免 resolvePkgRoot 的候选路径找不到 package.json。
182
+ // 可选:显式指定 pkgRoot(如部署在自定义目录时),否则按候选路径探测。
185
183
  if (process.env.PI_WEB_PKG_ROOT)
186
184
  return process.env.PI_WEB_PKG_ROOT;
187
185
  const candidates = [
@@ -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,110 +1,100 @@
1
- {
2
- "name": "pi-web-ui",
3
- "version": "0.48.2",
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
- "license": "MIT",
6
- "author": {
7
- "name": "xingshuyin",
8
- "email": "xingshuyin@users.noreply.github.com"
9
- },
10
- "type": "module",
11
- "bin": {
12
- "pi-web-ui": "bin/pi-web-ui.mjs"
13
- },
14
- "main": "electron/main.mjs",
15
- "files": [
16
- "bin/",
17
- "dist/",
18
- "web/dist/",
19
- "web/public/",
20
- "themes/",
21
- "deploy/",
22
- "extensions/",
23
- "README.md",
24
- "LICENSE"
25
- ],
26
- "keywords": [
27
- "pi",
28
- "pi-package",
29
- "coding-agent",
30
- "ai",
31
- "chat",
32
- "web-ui",
33
- "terminal",
34
- "llm"
35
- ],
36
- "repository": {
37
- "type": "git",
38
- "url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
39
- },
40
- "pi": {
41
- "extensions": [
42
- "./extensions"
43
- ]
44
- },
45
- "engines": {
46
- "node": ">=22.19.0"
47
- },
48
- "scripts": {
49
- "prepublishOnly": "npm run build",
50
- "dev": "concurrently -k -n server,web -c blue,green \"npm:dev:server\" \"npm:dev:web\"",
51
- "dev:server": "cross-env PORT=8788 PI_WEB_ALLOW_ORIGINS=http://localhost:5173,http://127.0.0.1:5173 node --watch --import tsx server/index.ts",
52
- "dev:web": "vite --config web/vite.config.ts",
53
- "build": "npm run build:web && npm run build:server",
54
- "build:web": "vite build --config web/vite.config.ts",
55
- "build:server": "tsc -p tsconfig.server.json",
56
- "typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
57
- "test": "vitest run",
58
- "test:unit": "vitest run",
59
- "test:smoke": "node tests/run-smoke.mjs",
60
- "check:protocol": "node scripts/check-protocol-sync.mjs",
61
- "test:freeze": "node tests/freeze-test.mjs",
62
- "start": "node dist/server/index.js",
63
- "start:electron": "electron .",
64
- "build:electron": "electron-builder build",
65
- "build:electron:mac": "electron-builder build --mac",
66
- "build:electron:win": "electron-builder build --win",
67
- "build:electron:linux": "electron-builder build --linux",
68
- "publish:electron": "electron-builder build --publish always"
69
- },
70
- "dependencies": {
71
- "@earendil-works/pi-coding-agent": "^0.84.2",
72
- "@xterm/addon-fit": "^0.11.0",
73
- "@xterm/xterm": "^6.0.0",
74
- "compression": "^1.8.1",
75
- "express": "^4.21.2",
76
- "highlight.js": "^11.10.0",
77
- "node-pty": "^1.1.0",
78
- "react": "^18.3.1",
79
- "react-dom": "^18.3.1",
80
- "react-icons": "^5.7.0",
81
- "react-markdown": "^9.0.1",
82
- "rehype-highlight": "^7.0.1",
83
- "remark-gfm": "^4.0.0",
84
- "typebox": "^1.3.14",
85
- "ws": "^8.18.0"
86
- },
87
- "devDependencies": {
88
- "@types/compression": "^1.8.1",
89
- "@types/express": "^4.17.21",
90
- "@types/node": "^22.10.0",
91
- "@types/react": "^18.3.12",
92
- "@types/react-dom": "^18.3.1",
93
- "@types/ws": "^8.5.13",
94
- "@vitejs/plugin-react": "^4.3.4",
95
- "concurrently": "^9.1.0",
96
- "cross-env": "^10.1.0",
97
- "playwright-core": "^1.62.1",
98
- "tsx": "^4.19.2",
99
- "typescript": "^5.7.2",
100
- "vite": "^6.0.3",
101
- "vitest": "^4.1.11",
102
- "electron": "^41.0.0",
103
- "electron-builder": "^25.0.0",
104
- "electron-updater": "^6.0.0"
105
- },
106
- "allowScripts": {
107
- "node-pty@1.1.0": true,
108
- "electron@41.10.7": true
109
- }
110
- }
1
+ {
2
+ "name": "pi-web-ui",
3
+ "version": "0.49.0",
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
+ "license": "MIT",
6
+ "author": {
7
+ "name": "xingshuyin",
8
+ "email": "xingshuyin@users.noreply.github.com"
9
+ },
10
+ "type": "module",
11
+ "bin": {
12
+ "pi-web-ui": "bin/pi-web-ui.mjs"
13
+ },
14
+ "main": "bin/pi-web-ui.mjs",
15
+ "files": [
16
+ "bin/",
17
+ "dist/",
18
+ "web/dist/",
19
+ "web/public/",
20
+ "themes/",
21
+ "deploy/",
22
+ "extensions/",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "keywords": [
27
+ "pi",
28
+ "pi-package",
29
+ "coding-agent",
30
+ "ai",
31
+ "chat",
32
+ "web-ui",
33
+ "terminal",
34
+ "llm"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
39
+ },
40
+ "pi": {
41
+ "extensions": [
42
+ "./extensions"
43
+ ]
44
+ },
45
+ "engines": {
46
+ "node": ">=22.19.0"
47
+ },
48
+ "scripts": {
49
+ "prepublishOnly": "npm run build",
50
+ "dev": "concurrently -k -n server,web -c blue,green \"npm:dev:server\" \"npm:dev:web\"",
51
+ "dev:server": "cross-env PORT=8788 PI_WEB_ALLOW_ORIGINS=http://localhost:5173,http://127.0.0.1:5173 node --watch --import tsx server/index.ts",
52
+ "dev:web": "vite --config web/vite.config.ts",
53
+ "build": "npm run build:web && npm run build:server",
54
+ "build:web": "vite build --config web/vite.config.ts",
55
+ "build:server": "tsc -p tsconfig.server.json",
56
+ "typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
57
+ "test": "vitest run",
58
+ "test:unit": "vitest run",
59
+ "test:smoke": "node tests/run-smoke.mjs",
60
+ "check:protocol": "node scripts/check-protocol-sync.mjs",
61
+ "test:freeze": "node tests/freeze-test.mjs",
62
+ "start": "node dist/server/index.js"
63
+ },
64
+ "dependencies": {
65
+ "@earendil-works/pi-coding-agent": "^0.84.4",
66
+ "@xterm/addon-fit": "^0.11.0",
67
+ "@xterm/xterm": "^6.0.0",
68
+ "compression": "^1.8.1",
69
+ "express": "^4.21.2",
70
+ "highlight.js": "^11.10.0",
71
+ "node-pty": "^1.1.0",
72
+ "react": "^18.3.1",
73
+ "react-dom": "^18.3.1",
74
+ "react-icons": "^5.7.0",
75
+ "react-markdown": "^9.0.1",
76
+ "rehype-highlight": "^7.0.1",
77
+ "remark-gfm": "^4.0.0",
78
+ "typebox": "^1.3.14",
79
+ "ws": "^8.18.0"
80
+ },
81
+ "devDependencies": {
82
+ "@types/compression": "^1.8.1",
83
+ "@types/express": "^4.17.21",
84
+ "@types/node": "^22.10.0",
85
+ "@types/react": "^18.3.12",
86
+ "@types/react-dom": "^18.3.1",
87
+ "@types/ws": "^8.5.13",
88
+ "@vitejs/plugin-react": "^4.3.4",
89
+ "concurrently": "^9.1.0",
90
+ "cross-env": "^10.1.0",
91
+ "playwright-core": "^1.62.1",
92
+ "tsx": "^4.19.2",
93
+ "typescript": "^5.7.2",
94
+ "vite": "^6.0.3",
95
+ "vitest": "^4.1.11"
96
+ },
97
+ "allowScripts": {
98
+ "node-pty@1.1.0": true
99
+ }
100
+ }