@agegr/pi-web 0.5.13 → 0.5.14

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 (42) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/required-server-files.js +1 -1
  4. package/.next/required-server-files.json +1 -1
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/index.html +1 -1
  24. package/.next/server/app/index.rsc +2 -2
  25. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  26. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  27. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  28. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  29. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  30. package/.next/server/app/page.js +1 -1
  31. package/.next/server/app/page_client-reference-manifest.js +1 -1
  32. package/.next/server/middleware-build-manifest.js +1 -1
  33. package/.next/server/pages/404.html +1 -1
  34. package/.next/server/pages/500.html +1 -1
  35. package/.next/static/chunks/app/{page-77890f82c9221e8d.js → page-2aa72ae1f38fc473.js} +1 -1
  36. package/.next/trace +3 -3
  37. package/.next/trace-build +1 -1
  38. package/README.md +46 -38
  39. package/bin/pi-web.js +16 -1
  40. package/package.json +1 -1
  41. /package/.next/static/{cmvBkod5ZC4-qfLmHJaKK → KVDvhkMG8O5_1B9Miys-I}/_buildManifest.js +0 -0
  42. /package/.next/static/{cmvBkod5ZC4-qfLmHJaKK → KVDvhkMG8O5_1B9Miys-I}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -1,67 +1,75 @@
1
1
  # pi-web
2
2
 
3
- A web interface for the [pi coding agent](https://github.com/badlogic/pi-mono). Browse sessions, chat with the agent, fork conversations, and navigate message branches — all in the browser.
3
+ [pi 编程智能体](https://github.com/badlogic/pi-mono) 的网页界面。在浏览器中浏览会话、与智能体对话、分叉对话、切换消息分支。
4
4
 
5
- ## Installation
5
+ ## 快速开始
6
+
7
+ **无需安装,直接运行:**
8
+
9
+ ```bash
10
+ npx @agegr/pi-web@latest
11
+ ```
12
+
13
+ **或全局安装后使用:**
6
14
 
7
15
  ```bash
8
16
  npm install -g @agegr/pi-web
9
17
  pi-web
10
18
  ```
11
19
 
12
- Open [http://localhost:30141](http://localhost:30141).
20
+ 启动后打开 [http://localhost:30141](http://localhost:30141)
13
21
 
14
- Options:
22
+ **可选参数:**
15
23
 
16
24
  ```bash
17
- pi-web --port 8080 # custom port
18
- pi-web --hostname 127.0.0.1 # local-only access
19
- pi-web -p 8080 -H 127.0.0.1 # combined
25
+ pi-web --port 8080 # 自定义端口
26
+ pi-web --hostname 127.0.0.1 # 仅本机访问
27
+ pi-web -p 8080 -H 127.0.0.1 # 组合使用
20
28
 
21
- PORT=8080 pi-web # env var also works
29
+ PORT=8080 pi-web # 也支持环境变量
22
30
  ```
23
31
 
24
- ## Development Setup
32
+ ## 功能介绍
25
33
 
26
- ```bash
27
- npm install
28
- npm run dev
29
- ```
34
+ - **会话浏览器** — 按工作目录分组展示所有 pi 会话
35
+ - **实时对话** — 通过 SSE 流式输出与智能体实时交互
36
+ - **会话分叉** — 从任意用户消息创建独立的新会话分支
37
+ - **会话内分支** — 回退到任意节点继续对话,在同一文件内创建分支
38
+ - **分支导航器** — 可视化切换同一会话内的各个分支
39
+ - **模型切换** — 对话中途随时切换模型
40
+ - **工具面板** — 控制智能体可使用的工具
41
+ - **压缩会话** — 对长会话进行摘要,节省上下文窗口
42
+ - **引导 / 追加** — 打断正在运行的智能体,或在其完成后追加消息
30
43
 
31
- ## Features
44
+ ## 注意事项
32
45
 
33
- - **Session browser** lists all pi sessions grouped by working directory
34
- - **Live chat** sends messages to the agent with real-time streaming via SSE
35
- - **Fork**branch a session from any user message into a new independent session
36
- - **In-session branching** — navigate back to any point and continue from there, creating a branch in the same session file
37
- - **Branch navigator** — visual switcher for branch points within a session
38
- - **Model selector** — switch models mid-session
39
- - **Tool panel** — toggle which tools the agent can use
40
- - **Compact** — summarize long sessions to save context window
41
- - **Steer / Follow-up** — interrupt the agent mid-run or queue a message for after it finishes
46
+ - **数据目录**默认读取 `~/.pi/agent/sessions` 下的会话文件。可通过环境变量 `PI_CODING_AGENT_DIR` 指定其他目录。
47
+ - **模型配置**从智能体数据目录下的 `models.json` 读取可用模型,可在侧边栏的「Models」面板中编辑。
48
+ - **文件浏览**侧边栏内置文件浏览器,可在标签页中查看当前工作目录下的文件。
42
49
 
43
- ## Notes
50
+ ## 开发
44
51
 
45
- - **Agent data directory** — reads sessions from `~/.pi/agent/sessions` by default. Set `PI_CODING_AGENT_DIR` to use another agent directory.
46
- - **Models** — reads available models from `models.json` in the agent directory. You can edit them from the sidebar `Models` panel.
47
- - **Files** the sidebar includes a file explorer for the current working directory and can open files in tabs.
52
+ ```bash
53
+ npm install
54
+ npm run dev # 端口 30141
55
+ ```
48
56
 
49
- ## Project structure
57
+ ## 项目结构
50
58
 
51
59
  ```
52
60
  app/
53
61
  api/
54
- sessions/ # read/write session files
55
- agent/ # send commands, stream events via SSE
56
- files/ # read file contents for the in-app viewer
57
- models/ # list available models + default model
58
- models-config/ # read and write models.json
59
- components/ # UI components
62
+ sessions/ # 读写会话文件
63
+ agent/ # 发送命令、SSE 事件流
64
+ files/ # 文件内容读取
65
+ models/ # 可用模型列表与默认模型
66
+ models-config/ # 读写 models.json
67
+ components/ # UI 组件
60
68
  lib/
61
- session-reader.ts # parse .jsonl session files
62
- rpc-manager.ts # manage AgentSession lifecycle
63
- normalize.ts # normalize toolCall field names (file vs. stream format)
69
+ session-reader.ts # 解析 .jsonl 会话文件
70
+ rpc-manager.ts # 管理 AgentSession 生命周期
71
+ normalize.ts # 规范化 toolCall 字段名
64
72
  types.ts
65
73
  ```
66
74
 
67
- Sessions are stored as `.jsonl` files at `~/.pi/agent/sessions/<encoded-cwd>/<timestamp>_<uuid>.jsonl`.
75
+ 会话文件存储路径:`~/.pi/agent/sessions/<编码后的工作目录>/<时间戳>_<uuid>.jsonl`
package/bin/pi-web.js CHANGED
@@ -51,8 +51,23 @@ if (hostname) nextArgs.push("-H", hostname);
51
51
  // and path-with-spaces problems on Windows when shell: true is used.
52
52
  const child = spawn(process.execPath, [nextBin, ...nextArgs], {
53
53
  cwd: pkgDir,
54
- stdio: "inherit",
54
+ stdio: ["inherit", "pipe", "inherit"],
55
55
  env: { ...process.env },
56
56
  });
57
57
 
58
+ let browserOpened = false;
59
+ const url = `http://${hostname ?? "localhost"}:${port}`;
60
+
61
+ child.stdout.on("data", (chunk) => {
62
+ const text = chunk.toString();
63
+ process.stdout.write(text);
64
+ if (!browserOpened && text.includes("Ready")) {
65
+ browserOpened = true;
66
+ const isWindows = process.platform === "win32";
67
+ const isMac = process.platform === "darwin";
68
+ const openCmd = isWindows ? "start" : isMac ? "open" : "xdg-open";
69
+ spawn(openCmd, [url], { shell: isWindows, stdio: "ignore", detached: true }).unref();
70
+ }
71
+ });
72
+
58
73
  child.on("exit", (code) => process.exit(code ?? 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agegr/pi-web",
3
- "version": "0.5.13",
3
+ "version": "0.5.14",
4
4
  "description": "Web UI for the pi coding agent",
5
5
  "bin": {
6
6
  "pi-web": "bin/pi-web.js"