pi-web-ui 0.89.0 → 0.90.1

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 (43) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/README.md +7 -4
  3. package/README.zh-CN.md +6 -3
  4. package/bin/pi-web-ui.mjs +37 -10
  5. package/deploy/pi-web-ui.service +36 -31
  6. package/dist/server/agent-service.js +651 -112
  7. package/dist/server/auth-cookie.js +23 -0
  8. package/dist/server/client-state.js +13 -0
  9. package/dist/server/composer-drafts.js +20 -2
  10. package/dist/server/dsh/dsh-agent-service.js +14 -8
  11. package/dist/server/file-archives.js +258 -0
  12. package/dist/server/file-transfer-routes.js +113 -0
  13. package/dist/server/files-service.js +22 -3
  14. package/dist/server/index.js +169 -31
  15. package/dist/server/marker-service.js +3 -1
  16. package/dist/server/plugins.js +12 -4
  17. package/dist/server/queue-utils.js +16 -0
  18. package/dist/server/schedule-agent-tool.js +240 -0
  19. package/dist/server/scheduler-tasks.js +9 -0
  20. package/dist/server/settings-service.js +68 -1
  21. package/dist/server/terminals.js +50 -20
  22. package/dist/server/tool-manager.js +11 -1
  23. package/dist/server/update-check.js +10 -6
  24. package/dist/server/webui-context.js +4 -0
  25. package/dist/server/ws-unknown-types.js +44 -0
  26. package/package.json +35 -32
  27. package/web/dist/assets/TerminalPanel-CkxM4Byl.js +3 -0
  28. package/web/dist/assets/index-DJIV4A-t.js +355 -0
  29. package/web/dist/assets/index-DLdcRBs_.css +1 -0
  30. package/web/dist/assets/markdown-CCeVCbci.css +1 -0
  31. package/web/dist/assets/markdown-eUQn_o9D.js +296 -0
  32. package/web/dist/assets/react-CR5VJ85Q.js +9 -0
  33. package/web/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
  34. package/web/dist/assets/xterm-B1njb2Cr.css +1 -0
  35. package/web/dist/assets/xterm-Cf5xxe4g.js +16 -0
  36. package/web/dist/index.html +6 -4
  37. package/web/dist/assets/TerminalPanel-BOUmN3uu.js +0 -6
  38. package/web/dist/assets/TerminalPanel-DOrYoP_4.css +0 -32
  39. package/web/dist/assets/index-3XU67qMh.js +0 -376
  40. package/web/dist/assets/index-B-gdvWtW.css +0 -10
  41. package/web/dist/assets/markdown-D3PKeHAZ.js +0 -311
  42. package/web/dist/assets/react-w24rH0km.js +0 -24
  43. package/web/dist/assets/xterm-B96xOxS9.js +0 -38
package/CHANGELOG.md CHANGED
@@ -8,6 +8,68 @@
8
8
  每个版本的内容按"实际合入该版本发布的提交"归档(以 `package.json` 的 version 变更提交为准),
9
9
  而不是按提交日期聚类——连续快速发布的 patch 版本以此为准最准确。
10
10
 
11
+ ## [Unreleased]
12
+
13
+ ## [0.90.1] — 2026-09-18
14
+
15
+ ### Added
16
+
17
+ - **多标签页对话过户 + 跨页作答 + 残留自动认领** —— 右键 elsewhere 行可把整段对话(含子代理后代、等答复问卷、看门狗剩余计时)过户到本页并切过去;别处的待答问卷可拉到本页作答;关浏览器重开后、无其他在线标签时自动认领最近的有内容残留。
18
+
19
+ ### Changed
20
+
21
+ - **依赖大版本升级**:Express 4→5(通配路由改 `*splat` 具名写法)、React 18→19(JSX 类型改显式导入)、Vite 6→8(分包改 `advancedChunks.groups`、裸 CSS 导入加类型兜底)、mermaid 11→12(vendor 包 `--mermaid-*` 主题钩子入 CSS 白名单),其余小版本同步跟进。
22
+ - **systemd 安装器**(#219)—— 监听 1024 以下端口时自动加 `CAP_NET_BIND_SERVICE`(仍以安装用户运行,不改 root);`PI_WEB_TOKEN` 持久化进 unit 文件(0600 权限);详见 `docs/deployment.md`。
23
+
24
+ ### Fixed
25
+
26
+ - **桌面版自动更新接线导致启动即闪退**(#220)—— `electron-updater` 的 `autoUpdater` 是用 `Object.defineProperty` 懒 getter 导出的,Node 的 ESM 具名导出探测看不到它,`const { autoUpdater } = await import("electron-updater")` 恒为 `undefined`,`wireAutoUpdater` 随即抛 `TypeError`,使 0.90.0 桌面版(macOS 实测,同一份 `dist/desktop/main.js` 也用于 Windows/Linux)装完根本打不开。改为回落到 `default` 再取一次,两者都取不到则降级为“更新不可用”,不再拖垮启动。
27
+
28
+ - **手机端触摸拖动滚动**(#218)—— 触屏拖动内容滚动,兜底 xterm 6.0.0 的触摸滚动回归。
29
+ - **Windows 关机跳过 `pty.kill`**(#215 跟进)—— 根治 ConPTY 关停死锁。
30
+
31
+ <!-- auto-i18n:start -->
32
+ ### i18n
33
+
34
+ - 前端新增 key(3):`takeoverConversation`、`takeoverHasQuestion`、`waitingQuestionBadge`
35
+ - 前端中文变更(1):`elsewhereTip`
36
+ - 前端英文变更(1):`elsewhereTip`
37
+ <!-- auto-i18n:end -->
38
+
39
+ ## [0.90.0] — 2026-09-18
40
+
41
+ ### Added
42
+
43
+ - **手机端顶栏折叠** —— ≤768px 宽度时顶栏只保留 ☰ / 新对话 / 打开项目 / 📁,其余入口一律退进同一个「⋯」溢出菜单(与桌面端实测溢出走同一通道,不是第二套硬藏面板);📁 去文字变纯图标按钮,钉在 ⋯ 右边最右;跨断点实时切换。
44
+ - **顶栏自适应溢出 + 项目选择器 + 定时任务工具** —— 顶栏按实测宽度自动把放不下的入口收进「⋯」菜单(窗口变宽自动回来);顶栏直选打开项目;定时任务可配 AI 工具。
45
+ - **文件管理:压缩解压与文件夹上传**(#190)—— 文件树新增压缩 / 解压缩动作,支持整个文件夹上传(含冲突策略与大小限制提示)。
46
+ - **底栏主机资源监控** —— 底栏实时显示主机处理器与内存使用率,悬浮看明细。
47
+
48
+ ### Changed
49
+
50
+ - **设置面板 macOS 分组风视觉重构 + 内容区对齐精修**。
51
+ - **左栏操作区布局溢出修复 + 精简界面入口**。
52
+ - **布局页按界面顺序分组** —— 顶栏溢出菜单保序保样式,布局偏好里的分组与界面实际顺序一致。
53
+
54
+ ### Fixed
55
+
56
+ - **发送失败给出可见错误提示** —— 发送失败不再静默吞掉,界面上直接提示。
57
+ - **排队消息按索引删除**(#200)—— `removeQueued` 按索引删,文本只做回退匹配,重复文本不再连带误删。
58
+ - **更新面板:过时行按钮优先 + git 扩展名填充**(#202)。
59
+ - **↑ 翻历史可靠进入 prompt 历史**;**提交后按时间戳水位丢弃过期草稿**;**switchSession 限定 sessions 根目录**;**折叠控制展开时保持在左侧**。
60
+ - **在资源管理器中显示 / 默认打开不再压住 GUI 窗口**;**git 扩展更新命令加 `git:` 前缀,更新面板隐藏 SHA 并修复横向滚动**。
61
+ - **Windows ConPTY 关停死锁改走外部看门狗**(#215);**心跳定时器 unref,不再阻塞进程退出**。
62
+ - **无挂载 widget 时跳过刷新**(perf);**未知消息类型节流打日志**;**WS maxPayload 对齐 100MB 上限**。
63
+ - **安全**:TLS 下 `pi_web_token` cookie 加 `Secure` 标记;`shell.openExternal` 前做 URL scheme 白名单校验。
64
+ - **设置重载失败打日志**,不再静默吞错。
65
+
66
+ <!-- auto-i18n:start -->
67
+ ### i18n
68
+
69
+ - 前端新增 key(27):`brandLogo`、`brandName`、`manageProjects`、`projectPickerTitle`、`newProject`、`projectName`、`createAndOpenProject`、`invalidProjectName`、`openProject`、`fileCompress`、`fileExtract`、`fileCompressDownload`、`fileUploadFolder`、`fileChooseFolder`、`fileExtractDestination`、`fileConflictPolicy`、`fileConflictSkip`、`fileConflictOverwrite`、`fileConflictError`、`fileArchiveLimits`、`fileFolderUploadHint`、`fileTransferBusy`、`fileTransferFailed`、`conversationReadEnabledDesc`、`conversationReadOffHint`、`scheduleTaskEnabledDesc`、`scheduleTaskOffHint`
70
+ - 服务端新增 key(9):`sched.not.wired`、`sched.task.bad.schedule`、`sched.task.interval.too.short`、`sched.task.empty.prompt`、`sched.task.no.cwd`、`sched.list.empty`、`sched.cancel.empty.id`、`sched.cancel.not.found`、`sched.cancel.ok`
71
+ <!-- auto-i18n:end -->
72
+
11
73
  ## [0.89.0] — 2026-09-17
12
74
 
13
75
  ### Added
@@ -984,7 +1046,9 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
984
1046
  - 0.35.1(2026-08-27):编辑重问保留附件(#18)+ 全窗口拖放(#19)。
985
1047
  - 0.29.0(2026-08-23):全局搜索弹窗(Ctrl+K)+ 消息列表惰性窗口化。
986
1048
 
987
- [Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.88.0...main
1049
+ [Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.90.0...main
1050
+ [0.90.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.90.0
1051
+ [0.89.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.89.0
988
1052
  [0.88.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.88.0
989
1053
  [0.87.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.2
990
1054
  [0.87.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.1
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  **English** | [简体中文](https://github.com/xing-shuyin/pi-web-ui/blob/main/README.zh-CN.md)
6
6
 
7
- _The polished browser cockpit for the [pi coding agent](https://pi.dev)._
7
+ _Just open your browser — get all your work done._
8
8
 
9
9
  <p>
10
10
  <a href="https://www.npmjs.com/package/pi-web-ui"><img src="https://img.shields.io/npm/v/pi-web-ui?color=cb3837&logo=npm&label=pi-web-ui" alt="npm version"></a>
@@ -16,14 +16,15 @@ _The polished browser cockpit for the [pi coding agent](https://pi.dev)._
16
16
  <a href="https://github.com/xing-shuyin/pi-web-ui/fork"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat" alt="PRs welcome"></a>
17
17
  </p>
18
18
 
19
- Stream conversations, inspect tool calls, manage files, and run your workspace — all from one place.
19
+ Chat, code, review, manage files, use the terminal — all in one browser tab. No IDE, no terminal app, no context-switching.
20
20
 
21
21
  ![Chat with prompt templates](https://raw.githubusercontent.com/xing-shuyin/pi-web-ui/main/assets/chat-prompts.jpeg)
22
22
 
23
23
  </div>
24
24
 
25
- A web chat interface for the [pi coding agent](https://pi.dev). The agent runs
26
- **in-process** via the pi SDK and streams events to the browser over WebSocket:
25
+ A browser cockpit for AI coding agents (pi / DSH) built around one idea:
26
+ **you only need a browser to get everything done.** The agent runs
27
+ server-side and streams events to the browser over WebSocket:
27
28
  thinking blocks, tool calls, file trees, a built-in terminal, model management,
28
29
  theme switching, and a full settings panel — tuned for daily development.
29
30
 
@@ -35,6 +36,8 @@ theme switching, and a full settings panel — tuned for daily development.
35
36
  >
36
37
  > [**dsh-ui-tools**](https://github.com/xing-shuyin/dsh-ui-tools) is the author's companion project for building and extending UI tools in the DSH ecosystem.
37
38
 
39
+ QQ群 1126050727
40
+
38
41
  ## ✨ Highlights
39
42
 
40
43
  | 💬 **Chat that works like you do** | 🖼️ **Files & images** | 🧩 **Extensible by design** | 🔒 **Private by default** |
package/README.zh-CN.md CHANGED
@@ -6,10 +6,11 @@
6
6
  [![Node.js](https://img.shields.io/node/v/pi-web-ui?logo=node.js&logoColor=white)](https://nodejs.org/)
7
7
  [![许可证](https://img.shields.io/github/license/xing-shuyin/pi-web-ui)](LICENSE)
8
8
 
9
- > 一个精致的 pi 浏览器界面:流式对话、查看工具调用、管理文件,
10
- > 在一个工作台里完成开发任务。
9
+ > 你只需要打开浏览器,就能完成所有工作。
10
+ >
11
+ > 聊天、写代码、改文件、用终端、管 Git —— 都在一个浏览器标签页里,不用开 IDE,不用来回切换。
11
12
 
12
- [pi 编码智能体](https://pi.dev) 的 Web 聊天界面 —— 智能体通过 pi SDK 在服务端进程内运行,
13
+ AI 编程智能体(pi / DSH)的浏览器工作台,宗旨只有一句话:**打开浏览器,什么都能干**。智能体在服务端运行,
13
14
  事件经 WebSocket 流式推送到浏览器。支持思考块与工具调用、附件与图片问答、内置终端、
14
15
  模型管理,以及设置面板(自定义系统提示词、技能/插件开关、设置预设一键应用)等功能。
15
16
  需要 Node.js ≥ 22.19 及配置好的 pi 环境。
@@ -21,6 +22,8 @@
21
22
  > [**dsh-ui-tools**](https://github.com/xing-shuyin/dsh-ui-tools) 是作者的配套项目,
22
23
  > 用于在 DSH 生态中构建和扩展 UI 工具。
23
24
 
25
+ QQ群 1126050727
26
+
24
27
  ## 功能特性
25
28
 
26
29
  **对话**
package/bin/pi-web-ui.mjs CHANGED
@@ -126,7 +126,8 @@ server 选项:
126
126
  环境变量(flag 优先,环境变量后备):
127
127
  PI_WEB_PORT / PI_WEB_CWD / PI_WEB_DATA_DIR / PI_WEB_ENGINE / PI_WEB_HOST /
128
128
  PI_CODING_AGENT_DIR。
129
- 鉴权口令 PI_WEB_TOKEN:仅环境变量(不走命令行,避免被 ps 看到),需要时手动加入服务配置。
129
+ 鉴权口令 PI_WEB_TOKEN:仅环境变量(不走命令行);Linux install 会写入 unit,--print 会显示口令。
130
+ 其他平台需手动加入服务配置。
130
131
  `;
131
132
 
132
133
  const HELP_EN = `pi-web-ui v${pkg.version} — web chat for the pi coding agent
@@ -179,7 +180,8 @@ UI plugins (installed into <data-dir>/plugins/; refresh browser to activate whil
179
180
  Environment variables (flag takes precedence, env var as fallback):
180
181
  PI_WEB_PORT / PI_WEB_CWD / PI_WEB_DATA_DIR / PI_WEB_ENGINE / PI_WEB_HOST /
181
182
  PI_CODING_AGENT_DIR
182
- Auth token PI_WEB_TOKEN: env var only (not on command line, to avoid ps exposure)
183
+ Auth token PI_WEB_TOKEN: env var only (not on command line). Linux install persists it; --print reveals it.
184
+ On other platforms, add it to the service config manually.
183
185
  `;
184
186
 
185
187
  const HELP = isZhLang() ? HELP_ZH : HELP_EN;
@@ -993,11 +995,20 @@ ${entries}
993
995
  `;
994
996
  }
995
997
 
998
+ /** systemd quoted strings use C-style escapes; %% prevents specifier expansion. */
999
+ function systemdQuote(value) {
1000
+ return JSON.stringify(String(value)).replace(/%/g, "%%");
1001
+ }
1002
+
996
1003
  /** Build the systemd unit file. */
997
1004
  function buildUnit(cwd, env) {
998
1005
  const envLines = Object.entries(env)
999
- .map(([k, v]) => `Environment=${k}=${v}`)
1006
+ .map(([k, v]) => `Environment=${systemdQuote(`${k}=${v}`)}`)
1000
1007
  .join("\n");
1008
+ const lowPort = Number(env.PI_WEB_PORT) > 0 && Number(env.PI_WEB_PORT) < 1024;
1009
+ const capabilities = lowPort
1010
+ ? "CapabilityBoundingSet=CAP_NET_BIND_SERVICE\nAmbientCapabilities=CAP_NET_BIND_SERVICE\n"
1011
+ : "";
1001
1012
  return `# Generated by: pi-web-ui server install (do not edit by hand — rerun to change)
1002
1013
  [Unit]
1003
1014
  Description=pi-web-ui — web chat for the pi coding agent
@@ -1006,9 +1017,9 @@ After=network.target
1006
1017
  [Service]
1007
1018
  Type=simple
1008
1019
  User=${process.env.SUDO_USER ?? userInfo().username}
1009
- WorkingDirectory=${cwd}
1020
+ WorkingDirectory=${systemdQuote(cwd)}
1010
1021
  ${envLines}
1011
- ExecStart=${JSON.stringify(NODE)} ${JSON.stringify(SERVER_ENTRY)}
1022
+ ${capabilities}ExecStart=${JSON.stringify(NODE)} ${JSON.stringify(SERVER_ENTRY)}
1012
1023
  Restart=always
1013
1024
  RestartSec=5
1014
1025
 
@@ -1113,18 +1124,34 @@ function installLaunchd(opts) {
1113
1124
  console.log(` 提示 : pi-web-ui server shortcut 可在桌面创建「一键启动」图标`);
1114
1125
  }
1115
1126
 
1127
+ /** Elevate only the privileged operation, not the CLI that captures the user's environment.
1128
+ * Unit contents travel through stdin, never argv (which may expose the token via ps). */
1129
+ function runSystemdRoot(command, args, input) {
1130
+ const root = typeof process.getuid === "function" && process.getuid() === 0;
1131
+ const result = spawnSync(root ? command : "sudo", root ? args : ["--", command, ...args], {
1132
+ input,
1133
+ stdio: input === undefined ? "inherit" : ["pipe", "inherit", "inherit"],
1134
+ });
1135
+ if (result.error) fail(`无法执行 ${command}: ${result.error.message}`);
1136
+ if (result.status !== 0) process.exit(result.status ?? 1);
1137
+ }
1138
+
1116
1139
  function installSystemd(opts) {
1117
1140
  const { name, port, cwd, dataDir, engine, host, agentDir } = serviceOptions(opts);
1118
- const content = buildUnit(cwd, serviceEnv(port, cwd, dataDir, engine, host, agentDir, { name }));
1141
+ const env = serviceEnv(port, cwd, dataDir, engine, host, agentDir, { name });
1142
+ if (process.env.PI_WEB_TOKEN !== undefined) env.PI_WEB_TOKEN = process.env.PI_WEB_TOKEN;
1143
+ const content = buildUnit(cwd, env);
1119
1144
  const unitPath = systemdUnitPath(name);
1120
1145
  if (opts.print) {
1121
1146
  console.log(`# ${unitPath}\n${content}`);
1122
1147
  return;
1123
1148
  }
1124
- ensureRootForSystemctl();
1125
- writeFileSync(unitPath, content);
1126
- run("systemctl", ["daemon-reload"]);
1127
- run("systemctl", ["enable", "--now", `${name}.service`]);
1149
+ // Generated units can contain credentials. install also corrects an existing unit's mode.
1150
+ runSystemdRoot("install", ["-m", "600", "/dev/stdin", unitPath], content);
1151
+ runSystemdRoot("systemctl", ["daemon-reload"]);
1152
+ runSystemdRoot("systemctl", ["enable", `${name}.service`]);
1153
+ // enable --now does not restart an already-active unit after configuration changes.
1154
+ runSystemdRoot("systemctl", ["restart", `${name}.service`]);
1128
1155
  console.log(`✅ 已安装并启动 systemd 服务 ${name}.service`);
1129
1156
  console.log(` 端口 : ${port}`);
1130
1157
  console.log(` 目录 : ${cwd}`);
@@ -1,31 +1,36 @@
1
- # pi-web-ui systemd unit — Linux auto-start on boot.
2
- #
3
- # Install (adjust User/WorkingDirectory/Environment to taste):
4
- # sudo npm i -g pi-web-ui
5
- # sudo cp deploy/pi-web-ui.service /etc/systemd/system/
6
- # sudo systemctl daemon-reload
7
- # sudo systemctl enable --now pi-web-ui
8
- # sudo systemctl status pi-web-ui
9
- #
10
- # Logs: journalctl -u pi-web-ui -f
11
-
12
- [Unit]
13
- Description=pi-web-ui — web chat for the pi coding agent
14
- After=network.target
15
-
16
- [Service]
17
- Type=simple
18
- # Run as an unprivileged user (change to your user, e.g. yourname)
19
- User=YOUR_USER
20
- # The workspace the agent operates in (read/edit/bash/write)
21
- WorkingDirectory=/home/YOUR_USER
22
- Environment=PI_WEB_PORT=8787
23
- # Point at your pi config dir if it's not the default ~/.pi/agent
24
- #Environment=PI_CODING_AGENT_DIR=/home/YOUR_USER/.pi/agent
25
- ExecStart=/usr/bin/pi-web-ui
26
- Restart=on-failure
27
- RestartSec=5
28
- # npm global bin may live elsewhere (nvm, etc.) — find with: which pi-web-ui
29
-
30
- [Install]
31
- WantedBy=multi-user.target
1
+ # pi-web-ui systemd unit — Linux auto-start on boot.
2
+ #
3
+ # Install (adjust User/WorkingDirectory/Environment to taste):
4
+ # sudo npm i -g pi-web-ui
5
+ # sudo cp deploy/pi-web-ui.service /etc/systemd/system/
6
+ # sudo systemctl daemon-reload
7
+ # sudo systemctl enable --now pi-web-ui
8
+ # sudo systemctl status pi-web-ui
9
+ #
10
+ # Logs: journalctl -u pi-web-ui -f
11
+
12
+ [Unit]
13
+ Description=pi-web-ui — web chat for the pi coding agent
14
+ After=network.target
15
+
16
+ [Service]
17
+ Type=simple
18
+ # Run as an unprivileged user (change to your user, e.g. yourname)
19
+ User=YOUR_USER
20
+ # The workspace the agent operates in (read/edit/bash/write)
21
+ WorkingDirectory=/home/YOUR_USER
22
+ Environment=PI_WEB_PORT=8787
23
+ # For privileged ports (1-1023, e.g. 80/443), uncomment both lines:
24
+ #CapabilityBoundingSet=CAP_NET_BIND_SERVICE
25
+ #AmbientCapabilities=CAP_NET_BIND_SERVICE
26
+ # Optional authentication; protect this file if you store a token here.
27
+ #Environment="PI_WEB_TOKEN=replace-with-your-token"
28
+ # Point at your pi config dir if it's not the default ~/.pi/agent
29
+ #Environment=PI_CODING_AGENT_DIR=/home/YOUR_USER/.pi/agent
30
+ ExecStart=/usr/bin/pi-web-ui
31
+ Restart=on-failure
32
+ RestartSec=5
33
+ # npm global bin may live elsewhere (nvm, etc.) — find with: which pi-web-ui
34
+
35
+ [Install]
36
+ WantedBy=multi-user.target