pi-web-ui 0.34.2 → 0.35.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.
@@ -1230,11 +1230,11 @@ export const TERMINAL_TOOL_NAMES = [
1230
1230
  /** System-prompt guidance teaching the model WHEN to prefer the terminal tools
1231
1231
  * over one-shot bash. Without it models almost never pick them — bash returns
1232
1232
  * complete output in a single call, so it always wins on convenience. */
1233
- export const TERMINAL_TOOLS_GUIDANCE = `Persistent interactive terminal tools are available (terminal_create / terminal_list / terminal_close / terminal_input / terminal_key / terminal_read / terminal_wait). The one-shot bash tool stays the DEFAULT for ordinary commands - it runs once and returns the full output. Switch to the terminal tools only when:
1234
- - The program is interactive or TUI-based (REPLs like python/node, vim/htop, installers asking y/n, anything waiting on stdin).
1235
- - You start a long-running server or watcher and want to keep watching its output (terminal_read with waitMs), send keys to it later (e.g. interrupt via terminal_key with Ctrl+c), or block until a backgrounded command finishes without polling (terminal_wait).
1236
- - The user explicitly asks you to work in the visible terminal panel.
1237
- Liveness watchdog: terminals you touched (create/input/key) are monitored - if one goes silent with no new output while you are working (default 15s), an automatic system reminder is injected into the conversation. Treat it as a prompt to check that terminal (terminal_read), respond to an input prompt (terminal_input / terminal_key), or close it (terminal_close) if it is no longer needed.
1233
+ export const TERMINAL_TOOLS_GUIDANCE = `Persistent interactive terminal tools are available (terminal_create / terminal_list / terminal_close / terminal_input / terminal_key / terminal_read / terminal_wait). The one-shot bash tool stays the DEFAULT for ordinary commands - it runs once and returns the full output. Switch to the terminal tools only when:
1234
+ - The program is interactive or TUI-based (REPLs like python/node, vim/htop, installers asking y/n, anything waiting on stdin).
1235
+ - You start a long-running server or watcher and want to keep watching its output (terminal_read with waitMs), send keys to it later (e.g. interrupt via terminal_key with Ctrl+c), or block until a backgrounded command finishes without polling (terminal_wait).
1236
+ - The user explicitly asks you to work in the visible terminal panel.
1237
+ Liveness watchdog: terminals you touched (create/input/key) are monitored - if one goes silent with no new output while you are working (default 15s), an automatic system reminder is injected into the conversation. Treat it as a prompt to check that terminal (terminal_read), respond to an input prompt (terminal_input / terminal_key), or close it (terminal_close) if it is no longer needed.
1238
1238
  Do NOT use them for simple one-shot commands; bash remains cheaper and simpler there.`;
1239
1239
  /** Build the agent-facing persistent terminal tools for one conversation. */
1240
1240
  export function makePersistentTerminalTools(terminals, cwd) {
@@ -1,192 +1,192 @@
1
- /**
2
- * pi-web-ui 的 pi 扩展 —— 提供命令行集成。
3
- *
4
- * 能力:
5
- * /webui 启动本机 pi-web-ui 服务器,打开浏览器访问
6
- * /webui --port 9000 指定端口启动
7
- * /webui --no-browser 启动但不开浏览器
8
- * /webui stop 停止已启动的服务器
9
- * /webui status 查看运行状态 / URL
10
- *
11
- * 实现说明:
12
- * - 不依赖全局 bin(pi install 后 pi-web-ui 命令不一定在 PATH),直接用
13
- * node 调包内 dist/server/index.js,通过环境变量 PORT / PI_WEB_CWD /
14
- * PI_WEB_DATA_DIR 控制。
15
- * - 工作目录默认用当前 pi 会话的 ctx.cwd;可用 --cwd / path 覆盖。
16
- * - 服务器作为子进程后台运行,/webui 不阻塞 pi。
17
- * - 每个 pi 会话管理一个子进程;session_shutdown 时清理,避免孤儿进程。
18
- */
19
-
20
- import { spawn } from "node:child_process";
21
- import { existsSync } from "node:fs";
22
- import { dirname, join, resolve } from "node:path";
23
- import { fileURLToPath } from "node:url";
24
- import net from "node:net";
25
- import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
26
-
27
- // 本文件位于 <pkg>/extensions/webui.ts → 包根在上一级
28
- const PKG_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
29
- const SERVER_ENTRY = join(PKG_ROOT, "dist", "server", "index.js");
30
- const NODE = process.execPath;
31
-
32
- /** 每个会话的服务器子进程 + 元数据 */
33
- interface RunningServer {
34
- proc: ReturnType<typeof spawn>;
35
- port: number;
36
- cwd: string;
37
- url: string;
38
- }
39
-
40
- // 会话 → 运行实例(模块级 Map;每会话一个会话对象,无需清理全局)
41
- const running = new Map<string, RunningServer>();
42
-
43
- /** 找一个空闲端口 */
44
- function findFreePort(from = 8787): Promise<number> {
45
- return new Promise((resolve_, reject) => {
46
- const srv = net.createServer();
47
- srv.listen(from, () => {
48
- const port = (srv.address() as net.AddressInfo).port;
49
- srv.close(() => resolve_(port));
50
- });
51
- srv.on("error", () => {
52
- // 端口被占则顺延
53
- findFreePort(from + 1).then(resolve_, reject);
54
- });
55
- });
56
- }
57
-
58
- /** 解析 --key value / --flag 参数 */
59
- function parseArgs(args: string): { port?: number; cwd?: string; noBrowser: boolean } {
60
- const out: { port?: number; cwd?: string; noBrowser: boolean } = { noBrowser: false };
61
- const toks = args.split(/\s+/).filter(Boolean);
62
- for (let i = 0; i < toks.length; i++) {
63
- const t = toks[i];
64
- if ((t === "--port" || t === "-p") && toks[i + 1]) {
65
- const n = Number(toks[++i]);
66
- if (Number.isInteger(n) && n > 0 && n < 65536) out.port = n;
67
- } else if ((t === "--cwd") && toks[i + 1]) {
68
- out.cwd = resolve(toks[++i]);
69
- } else if (t === "--no-browser") {
70
- out.noBrowser = true;
71
- }
72
- }
73
- return out;
74
- }
75
-
76
- /** 打开浏览器 */
77
- async function openBrowser(url: string): Promise<void> {
78
- const { platform } = process;
79
- const [cmd, ...rest] =
80
- platform === "darwin"
81
- ? ["open", url]
82
- : platform === "win32"
83
- ? ["cmd", "/c", "start", "", url]
84
- : ["xdg-open", url];
85
- // 无界面环境缺少 xdg-open 等打开器时,ENOENT 以异步 'error' 事件触发,
86
- // try/catch 拦不住会崩掉整个进程 —— 必须挂 error 监听。
87
- spawn(cmd, rest, { stdio: "ignore", detached: true })
88
- .on("error", (err) => {
89
- if ((err as NodeJS.ErrnoException)?.code === "ENOENT") {
90
- console.warn(
91
- `[webui] 未找到浏览器打开器 (${(err as NodeJS.ErrnoException).path || "command not found"}),请用 --no-browser 关闭自动打开`
92
- );
93
- } else {
94
- console.warn("[webui] 打开浏览器失败:", err.message);
95
- }
96
- })
97
- .unref();
98
- }
99
-
100
- export default function (pi: ExtensionAPI): void {
101
- pi.registerCommand("webui", {
102
- description: "启动本机 pi-web-ui Web 界面(/webui [--port N] [--cwd PATH] [--no-browser] | stop | status)",
103
- handler: async (args: string, ctx: ExtensionCommandContext) => {
104
- const sid = ctx.sessionManager.getSessionId();
105
- const opts = parseArgs(args);
106
- const action = (args.split(/\s+/)[0] || "start").toLowerCase();
107
-
108
- // 停止
109
- if (action === "stop" || action === "kill") {
110
- const inst = running.get(sid);
111
- if (!inst) {
112
- ctx.ui.notify("没有正在运行的本机 pi-web-ui 服务器", "info");
113
- return;
114
- }
115
- inst.proc.kill("SIGTERM");
116
- running.delete(sid);
117
- ctx.ui.notify(`已停止 pi-web-ui (${inst.url})`, "info");
118
- return;
119
- }
120
-
121
- // 状态
122
- if (action === "status") {
123
- const inst = running.get(sid);
124
- if (!inst) {
125
- ctx.ui.notify("本机 pi-web-ui 未运行", "info");
126
- return;
127
- }
128
- const alive = inst.proc.exitCode === null;
129
- ctx.ui.notify(
130
- alive ? `pi-web-ui 运行中 → ${inst.url}\n端口 ${inst.port} · cwd ${inst.cwd}` : `已退出(exit=${inst.proc.exitCode})`,
131
- alive ? "info" : "warning",
132
- );
133
- return;
134
- }
135
-
136
- // 默认 start
137
- if (action !== "start" && action !== "run") {
138
- ctx.ui.notify(`未知动作 ${action}(可用 start|stop|status)`, "warning");
139
- return;
140
- }
141
-
142
- // 已运行则提示
143
- const existing = running.get(sid);
144
- if (existing && existing.proc.exitCode === null) {
145
- ctx.ui.notify(`pi-web-ui 已在运行 → ${existing.url}`, "info");
146
- return;
147
- }
148
-
149
- // 检查是否已构建
150
- if (!existsSync(SERVER_ENTRY)) {
151
- ctx.ui.notify(
152
- "缺少 dist/ 产物(当前安装未包含已构建前端)。请运行 `npm run build` 后重试,或用 pi-web-ui 官方 npm 包。",
153
- "warning",
154
- );
155
- return;
156
- }
157
-
158
- const port = opts.port ?? (await findFreePort());
159
- const cwd = opts.cwd ?? ctx.cwd;
160
- const url = `http://localhost:${port}`;
161
-
162
- const env = {
163
- ...process.env,
164
- PORT: String(port),
165
- PI_WEB_CWD: cwd,
166
- ...(process.env.PI_WEB_DATA_DIR ? {} : { PI_WEB_DATA_DIR: join(cwd, ".pi-web") }),
167
- };
168
- const proc = spawn(NODE, [SERVER_ENTRY], { cwd, env, stdio: "ignore", detached: true });
169
- proc.unref();
170
- running.set(sid, { proc, port, cwd, url });
171
-
172
- ctx.ui.notify(`pi-web-ui 启动中 → ${url}\n端口 ${port} · cwd ${cwd}\n(几秒后可用,/webui status 查看)`);
173
-
174
- if (!opts.noBrowser) await openBrowser(url);
175
-
176
- // 进程退出时清理
177
- proc.on("exit", () => {
178
- if (running.get(sid)?.proc === proc) running.delete(sid);
179
- });
180
- },
181
- });
182
-
183
- // 会话结束清理子进程,避免孤儿
184
- pi.on("session_shutdown", async (_event, ctx) => {
185
- const sid = ctx.sessionManager.getSessionId();
186
- const inst = running.get(sid);
187
- if (inst && inst.proc.exitCode === null) {
188
- inst.proc.kill("SIGTERM");
189
- running.delete(sid);
190
- }
191
- });
192
- }
1
+ /**
2
+ * pi-web-ui 的 pi 扩展 —— 提供命令行集成。
3
+ *
4
+ * 能力:
5
+ * /webui 启动本机 pi-web-ui 服务器,打开浏览器访问
6
+ * /webui --port 9000 指定端口启动
7
+ * /webui --no-browser 启动但不开浏览器
8
+ * /webui stop 停止已启动的服务器
9
+ * /webui status 查看运行状态 / URL
10
+ *
11
+ * 实现说明:
12
+ * - 不依赖全局 bin(pi install 后 pi-web-ui 命令不一定在 PATH),直接用
13
+ * node 调包内 dist/server/index.js,通过环境变量 PORT / PI_WEB_CWD /
14
+ * PI_WEB_DATA_DIR 控制。
15
+ * - 工作目录默认用当前 pi 会话的 ctx.cwd;可用 --cwd / path 覆盖。
16
+ * - 服务器作为子进程后台运行,/webui 不阻塞 pi。
17
+ * - 每个 pi 会话管理一个子进程;session_shutdown 时清理,避免孤儿进程。
18
+ */
19
+
20
+ import { spawn } from "node:child_process";
21
+ import { existsSync } from "node:fs";
22
+ import { dirname, join, resolve } from "node:path";
23
+ import { fileURLToPath } from "node:url";
24
+ import net from "node:net";
25
+ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
26
+
27
+ // 本文件位于 <pkg>/extensions/webui.ts → 包根在上一级
28
+ const PKG_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
29
+ const SERVER_ENTRY = join(PKG_ROOT, "dist", "server", "index.js");
30
+ const NODE = process.execPath;
31
+
32
+ /** 每个会话的服务器子进程 + 元数据 */
33
+ interface RunningServer {
34
+ proc: ReturnType<typeof spawn>;
35
+ port: number;
36
+ cwd: string;
37
+ url: string;
38
+ }
39
+
40
+ // 会话 → 运行实例(模块级 Map;每会话一个会话对象,无需清理全局)
41
+ const running = new Map<string, RunningServer>();
42
+
43
+ /** 找一个空闲端口 */
44
+ function findFreePort(from = 8787): Promise<number> {
45
+ return new Promise((resolve_, reject) => {
46
+ const srv = net.createServer();
47
+ srv.listen(from, () => {
48
+ const port = (srv.address() as net.AddressInfo).port;
49
+ srv.close(() => resolve_(port));
50
+ });
51
+ srv.on("error", () => {
52
+ // 端口被占则顺延
53
+ findFreePort(from + 1).then(resolve_, reject);
54
+ });
55
+ });
56
+ }
57
+
58
+ /** 解析 --key value / --flag 参数 */
59
+ function parseArgs(args: string): { port?: number; cwd?: string; noBrowser: boolean } {
60
+ const out: { port?: number; cwd?: string; noBrowser: boolean } = { noBrowser: false };
61
+ const toks = args.split(/\s+/).filter(Boolean);
62
+ for (let i = 0; i < toks.length; i++) {
63
+ const t = toks[i];
64
+ if ((t === "--port" || t === "-p") && toks[i + 1]) {
65
+ const n = Number(toks[++i]);
66
+ if (Number.isInteger(n) && n > 0 && n < 65536) out.port = n;
67
+ } else if ((t === "--cwd") && toks[i + 1]) {
68
+ out.cwd = resolve(toks[++i]);
69
+ } else if (t === "--no-browser") {
70
+ out.noBrowser = true;
71
+ }
72
+ }
73
+ return out;
74
+ }
75
+
76
+ /** 打开浏览器 */
77
+ async function openBrowser(url: string): Promise<void> {
78
+ const { platform } = process;
79
+ const [cmd, ...rest] =
80
+ platform === "darwin"
81
+ ? ["open", url]
82
+ : platform === "win32"
83
+ ? ["cmd", "/c", "start", "", url]
84
+ : ["xdg-open", url];
85
+ // 无界面环境缺少 xdg-open 等打开器时,ENOENT 以异步 'error' 事件触发,
86
+ // try/catch 拦不住会崩掉整个进程 —— 必须挂 error 监听。
87
+ spawn(cmd, rest, { stdio: "ignore", detached: true })
88
+ .on("error", (err) => {
89
+ if ((err as NodeJS.ErrnoException)?.code === "ENOENT") {
90
+ console.warn(
91
+ `[webui] 未找到浏览器打开器 (${(err as NodeJS.ErrnoException).path || "command not found"}),请用 --no-browser 关闭自动打开`
92
+ );
93
+ } else {
94
+ console.warn("[webui] 打开浏览器失败:", err.message);
95
+ }
96
+ })
97
+ .unref();
98
+ }
99
+
100
+ export default function (pi: ExtensionAPI): void {
101
+ pi.registerCommand("webui", {
102
+ description: "启动本机 pi-web-ui Web 界面(/webui [--port N] [--cwd PATH] [--no-browser] | stop | status)",
103
+ handler: async (args: string, ctx: ExtensionCommandContext) => {
104
+ const sid = ctx.sessionManager.getSessionId();
105
+ const opts = parseArgs(args);
106
+ const action = (args.split(/\s+/)[0] || "start").toLowerCase();
107
+
108
+ // 停止
109
+ if (action === "stop" || action === "kill") {
110
+ const inst = running.get(sid);
111
+ if (!inst) {
112
+ ctx.ui.notify("没有正在运行的本机 pi-web-ui 服务器", "info");
113
+ return;
114
+ }
115
+ inst.proc.kill("SIGTERM");
116
+ running.delete(sid);
117
+ ctx.ui.notify(`已停止 pi-web-ui (${inst.url})`, "info");
118
+ return;
119
+ }
120
+
121
+ // 状态
122
+ if (action === "status") {
123
+ const inst = running.get(sid);
124
+ if (!inst) {
125
+ ctx.ui.notify("本机 pi-web-ui 未运行", "info");
126
+ return;
127
+ }
128
+ const alive = inst.proc.exitCode === null;
129
+ ctx.ui.notify(
130
+ alive ? `pi-web-ui 运行中 → ${inst.url}\n端口 ${inst.port} · cwd ${inst.cwd}` : `已退出(exit=${inst.proc.exitCode})`,
131
+ alive ? "info" : "warning",
132
+ );
133
+ return;
134
+ }
135
+
136
+ // 默认 start
137
+ if (action !== "start" && action !== "run") {
138
+ ctx.ui.notify(`未知动作 ${action}(可用 start|stop|status)`, "warning");
139
+ return;
140
+ }
141
+
142
+ // 已运行则提示
143
+ const existing = running.get(sid);
144
+ if (existing && existing.proc.exitCode === null) {
145
+ ctx.ui.notify(`pi-web-ui 已在运行 → ${existing.url}`, "info");
146
+ return;
147
+ }
148
+
149
+ // 检查是否已构建
150
+ if (!existsSync(SERVER_ENTRY)) {
151
+ ctx.ui.notify(
152
+ "缺少 dist/ 产物(当前安装未包含已构建前端)。请运行 `npm run build` 后重试,或用 pi-web-ui 官方 npm 包。",
153
+ "warning",
154
+ );
155
+ return;
156
+ }
157
+
158
+ const port = opts.port ?? (await findFreePort());
159
+ const cwd = opts.cwd ?? ctx.cwd;
160
+ const url = `http://localhost:${port}`;
161
+
162
+ const env = {
163
+ ...process.env,
164
+ PORT: String(port),
165
+ PI_WEB_CWD: cwd,
166
+ ...(process.env.PI_WEB_DATA_DIR ? {} : { PI_WEB_DATA_DIR: join(cwd, ".pi-web") }),
167
+ };
168
+ const proc = spawn(NODE, [SERVER_ENTRY], { cwd, env, stdio: "ignore", detached: true });
169
+ proc.unref();
170
+ running.set(sid, { proc, port, cwd, url });
171
+
172
+ ctx.ui.notify(`pi-web-ui 启动中 → ${url}\n端口 ${port} · cwd ${cwd}\n(几秒后可用,/webui status 查看)`);
173
+
174
+ if (!opts.noBrowser) await openBrowser(url);
175
+
176
+ // 进程退出时清理
177
+ proc.on("exit", () => {
178
+ if (running.get(sid)?.proc === proc) running.delete(sid);
179
+ });
180
+ },
181
+ });
182
+
183
+ // 会话结束清理子进程,避免孤儿
184
+ pi.on("session_shutdown", async (_event, ctx) => {
185
+ const sid = ctx.sessionManager.getSessionId();
186
+ const inst = running.get(sid);
187
+ if (inst && inst.proc.exitCode === null) {
188
+ inst.proc.kill("SIGTERM");
189
+ running.delete(sid);
190
+ }
191
+ });
192
+ }
package/package.json CHANGED
@@ -1,96 +1,96 @@
1
- {
2
- "name": "pi-web-ui",
3
- "version": "0.34.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
- "type": "module",
7
- "bin": {
8
- "pi-web-ui": "bin/pi-web-ui.mjs"
9
- },
10
- "main": "dist/server/index.js",
11
- "files": [
12
- "bin/",
13
- "dist/",
14
- "web/dist/",
15
- "web/public/",
16
- "themes/",
17
- "deploy/",
18
- "extensions/",
19
- "README.md",
20
- "LICENSE"
21
- ],
22
- "keywords": [
23
- "pi",
24
- "pi-package",
25
- "coding-agent",
26
- "ai",
27
- "chat",
28
- "web-ui",
29
- "terminal",
30
- "llm"
31
- ],
32
- "repository": {
33
- "type": "git",
34
- "url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
35
- },
36
- "pi": {
37
- "extensions": [
38
- "./extensions"
39
- ]
40
- },
41
- "engines": {
42
- "node": ">=22.19.0"
43
- },
44
- "scripts": {
45
- "prepublishOnly": "npm run build",
46
- "dev": "concurrently -k -n server,web -c blue,green \"npm:dev:server\" \"npm:dev:web\"",
47
- "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",
48
- "dev:web": "vite --config web/vite.config.ts",
49
- "build": "npm run build:web && npm run build:server",
50
- "build:web": "vite build --config web/vite.config.ts",
51
- "build:server": "tsc -p tsconfig.server.json",
52
- "typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
53
- "test": "vitest run",
54
- "test:unit": "vitest run",
55
- "test:smoke": "node tests/run-smoke.mjs",
56
- "check:protocol": "node scripts/check-protocol-sync.mjs",
57
- "test:freeze": "node tests/freeze-test.mjs",
58
- "start": "node dist/server/index.js"
59
- },
60
- "dependencies": {
61
- "@earendil-works/pi-coding-agent": "^0.84.2",
62
- "@xterm/addon-fit": "^0.11.0",
63
- "@xterm/xterm": "^6.0.0",
64
- "compression": "^1.8.1",
65
- "express": "^4.21.2",
66
- "highlight.js": "^11.10.0",
67
- "node-pty": "^1.1.0",
68
- "react": "^18.3.1",
69
- "react-dom": "^18.3.1",
70
- "react-icons": "^5.7.0",
71
- "react-markdown": "^9.0.1",
72
- "rehype-highlight": "^7.0.1",
73
- "remark-gfm": "^4.0.0",
74
- "typebox": "^1.3.14",
75
- "ws": "^8.18.0"
76
- },
77
- "devDependencies": {
78
- "@types/compression": "^1.8.1",
79
- "@types/express": "^4.17.21",
80
- "@types/node": "^22.10.0",
81
- "@types/react": "^18.3.12",
82
- "@types/react-dom": "^18.3.1",
83
- "@types/ws": "^8.5.13",
84
- "@vitejs/plugin-react": "^4.3.4",
85
- "concurrently": "^9.1.0",
86
- "cross-env": "^10.1.0",
87
- "playwright-core": "^1.62.1",
88
- "tsx": "^4.19.2",
89
- "typescript": "^5.7.2",
90
- "vite": "^6.0.3",
91
- "vitest": "^4.1.11"
92
- },
93
- "allowScripts": {
94
- "node-pty@1.1.0": true
95
- }
96
- }
1
+ {
2
+ "name": "pi-web-ui",
3
+ "version": "0.35.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
+ "type": "module",
7
+ "bin": {
8
+ "pi-web-ui": "bin/pi-web-ui.mjs"
9
+ },
10
+ "main": "dist/server/index.js",
11
+ "files": [
12
+ "bin/",
13
+ "dist/",
14
+ "web/dist/",
15
+ "web/public/",
16
+ "themes/",
17
+ "deploy/",
18
+ "extensions/",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "keywords": [
23
+ "pi",
24
+ "pi-package",
25
+ "coding-agent",
26
+ "ai",
27
+ "chat",
28
+ "web-ui",
29
+ "terminal",
30
+ "llm"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/xing-shuyin/pi-web-ui.git"
35
+ },
36
+ "pi": {
37
+ "extensions": [
38
+ "./extensions"
39
+ ]
40
+ },
41
+ "engines": {
42
+ "node": ">=22.19.0"
43
+ },
44
+ "scripts": {
45
+ "prepublishOnly": "npm run build",
46
+ "dev": "concurrently -k -n server,web -c blue,green \"npm:dev:server\" \"npm:dev:web\"",
47
+ "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",
48
+ "dev:web": "vite --config web/vite.config.ts",
49
+ "build": "npm run build:web && npm run build:server",
50
+ "build:web": "vite build --config web/vite.config.ts",
51
+ "build:server": "tsc -p tsconfig.server.json",
52
+ "typecheck": "tsc -p tsconfig.server.json --noEmit && tsc -p web/tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
53
+ "test": "vitest run",
54
+ "test:unit": "vitest run",
55
+ "test:smoke": "node tests/run-smoke.mjs",
56
+ "check:protocol": "node scripts/check-protocol-sync.mjs",
57
+ "test:freeze": "node tests/freeze-test.mjs",
58
+ "start": "node dist/server/index.js"
59
+ },
60
+ "dependencies": {
61
+ "@earendil-works/pi-coding-agent": "^0.84.2",
62
+ "@xterm/addon-fit": "^0.11.0",
63
+ "@xterm/xterm": "^6.0.0",
64
+ "compression": "^1.8.1",
65
+ "express": "^4.21.2",
66
+ "highlight.js": "^11.10.0",
67
+ "node-pty": "^1.1.0",
68
+ "react": "^18.3.1",
69
+ "react-dom": "^18.3.1",
70
+ "react-icons": "^5.7.0",
71
+ "react-markdown": "^9.0.1",
72
+ "rehype-highlight": "^7.0.1",
73
+ "remark-gfm": "^4.0.0",
74
+ "typebox": "^1.3.14",
75
+ "ws": "^8.18.0"
76
+ },
77
+ "devDependencies": {
78
+ "@types/compression": "^1.8.1",
79
+ "@types/express": "^4.17.21",
80
+ "@types/node": "^22.10.0",
81
+ "@types/react": "^18.3.12",
82
+ "@types/react-dom": "^18.3.1",
83
+ "@types/ws": "^8.5.13",
84
+ "@vitejs/plugin-react": "^4.3.4",
85
+ "concurrently": "^9.1.0",
86
+ "cross-env": "^10.1.0",
87
+ "playwright-core": "^1.62.1",
88
+ "tsx": "^4.19.2",
89
+ "typescript": "^5.7.2",
90
+ "vite": "^6.0.3",
91
+ "vitest": "^4.1.11"
92
+ },
93
+ "allowScripts": {
94
+ "node-pty@1.1.0": true
95
+ }
96
+ }