@liguoshuai/pi-web-chat 2.1.0 → 2.2.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.
- package/docs/CHANGELOG.md +21 -0
- package/package.json +3 -3
- package/public/app.js +3 -3
package/docs/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.2.0] - 2026-08-30
|
|
11
|
+
|
|
12
|
+
### Fixed & Improved
|
|
13
|
+
- **服务端会话路径解析与遍历安全加固 (Session Path Resolution & Security)**:
|
|
14
|
+
- 修复了 `/api/session`(GET 与 DELETE)在处理会话相对路径时由于错误相对路径基准导致的误拦截(403 Forbidden),增强为相对于 `config.sessionsDir` 的安全解析并保留严格的路径越界校验与符号链接真实路径防穿透防护。
|
|
15
|
+
- 会话扫描增强为多层级安全目录递归遍历(`listAllSessionFiles`),支持更深的会话目录结构与符号链接解析。
|
|
16
|
+
- 为服务端 `sessionMetadataCache` 增加 LRU/最大条目上限限制(5000条),防止长期运行内存泄漏。
|
|
17
|
+
- **服务端网关稳健性与跨平台优化 (Gateway Robustness & Cross-Platform)**:
|
|
18
|
+
- 完善了 WebSocket 握手鉴权响应对请求 `id` 的透传关联,优化了 `PING`/`heartbeat` 的 ID 支持。
|
|
19
|
+
- 规范了 `PROMPT` 消息中的 `message` 字符串与 `images` 数组格式,防止向 Pi 进程传递 `undefined`。
|
|
20
|
+
- 改进了 SSE 客户端异常断开时的错误捕获与失效监听器及时清理。
|
|
21
|
+
- 增强了 `resolvePiBin` 的跨平台检测路径,支持 macOS Homebrew、Linux `~/.local/bin`、`~/.cargo/bin` 等常见环境。
|
|
22
|
+
- **Web 端多端同步与渲染优化 (Web UI & Markdown Rendering)**:
|
|
23
|
+
- 修复了 `remote_user_prompt` 事件未同步呈现多端上传的 `images` 附件的问题。
|
|
24
|
+
- 修复了 Markdown 解析器中 URL 包含查询参数时因多次转义造成的双重转义(Double Escaping)问题,并支持 `mailto:` 链接解析。
|
|
25
|
+
- **协议库与 TypeScript 类型定义完善 (`@liguoshuai/pi-chat-protocol`)**:
|
|
26
|
+
- 新增 `createSetSessionNameMessage`、`createGetEntriesMessage`、`createGetStateMessage`、`createGetAvailableModelsMessage`、`createExtensionUiResponseMessage` 辅助构造方法。
|
|
27
|
+
- 增强了 `SET_SESSION_NAME` 与 `SET_THINKING_LEVEL` 的数据校验与 TypeScript 类型声明。
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
10
31
|
## [2.1.0] - 2026-08-30
|
|
11
32
|
|
|
12
33
|
### Fixed & Improved
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liguoshuai/pi-web-chat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A ChatGPT/Gemini-style web UI for the pi coding agent, powered by pi's RPC mode.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server.js",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"node": ">=18"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@liguoshuai/pi-chat-protocol": "2.
|
|
44
|
-
"@liguoshuai/pi-chat-server": "2.
|
|
43
|
+
"@liguoshuai/pi-chat-protocol": "2.2.0",
|
|
44
|
+
"@liguoshuai/pi-chat-server": "2.2.0",
|
|
45
45
|
"express": "^4.21.2",
|
|
46
46
|
"ws": "^8.18.0"
|
|
47
47
|
},
|
package/public/app.js
CHANGED
|
@@ -456,7 +456,7 @@ function sanitizeUrl(url) {
|
|
|
456
456
|
if (!url) return "#";
|
|
457
457
|
const trimmed = url.trim();
|
|
458
458
|
if (/^(https?:\/\/|mailto:)/i.test(trimmed)) {
|
|
459
|
-
return
|
|
459
|
+
return trimmed.replace(/"/g, """).replace(/'/g, "'");
|
|
460
460
|
}
|
|
461
461
|
return "#";
|
|
462
462
|
}
|
|
@@ -474,7 +474,7 @@ function mdInlineBlock(text) {
|
|
|
474
474
|
// italic (underscore): only match boundary/space so identifier_names are preserved
|
|
475
475
|
s = s.replace(/(^|[\s(\[<,;:])_([^_\s](?:[^_]*?[^_\s])?)_(?=[\s)\]>,;:!?.]|$)/g, "$1<em>$2</em>");
|
|
476
476
|
// links [txt](url) - strictly sanitize URL
|
|
477
|
-
s = s.replace(/\[([^\]]+)\]\((https
|
|
477
|
+
s = s.replace(/\[([^\]]+)\]\(((?:https?:\/\/|mailto:)[^\s)]+)\)/g, (match, txt, url) => {
|
|
478
478
|
const safeUrl = sanitizeUrl(url);
|
|
479
479
|
return `<a href="${safeUrl}" target="_blank" rel="noopener">${txt}</a>`;
|
|
480
480
|
});
|
|
@@ -1780,7 +1780,7 @@ function handlePiMessage(obj) {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
break;
|
|
1782
1782
|
case "remote_user_prompt":
|
|
1783
|
-
appendMessageNode("user", { text: obj.message, isSteer: obj.isSteer });
|
|
1783
|
+
appendMessageNode("user", { text: obj.message, images: obj.images, isSteer: obj.isSteer });
|
|
1784
1784
|
break;
|
|
1785
1785
|
case "agent_start":
|
|
1786
1786
|
state.streaming = true;
|