pi-web README

项目的 README,来自 github.com/agegr/pi-web。合并为一个 markdown 文件:README.md。

Pi Web

中文文档 | 日本語 | Русский

Local browser UI for the pi coding agent. Pi Web uses the same local configuration and session files as pi, so you can browse and resume conversations, run agent turns, configure models and resources, and inspect project files from a browser.

Try the interactive demo → The real Pi Web UI runs entirely in your browser, with sample sessions, files and models. There is nothing to install; replies are pre-written and no model is called.

Pi Web displaying a pi session with structured Markdown, tool calls, and project navigation

Features

Quick Start

Pi Web requires Node.js 22.19.0 or newer. Check your version with node --version, then run:

npx @agegr/pi-web@latest

The CLI opens a browser after the server is ready. If it does not, open http://127.0.0.1:30141. Pi Web listens only on 127.0.0.1 by default.

If no model provider is configured yet, open the Models panel to sign in or add an API key.

To install the pi-web command globally:

npm install -g @agegr/pi-web@latest
pi-web

Commands:

pi-web version          # print the installed version
pi-web status           # list running servers
pi-web stop [--port N]  # stop a running server
pi-web open [--port N]  # open a running server in the browser
pi-web update [--check] # update a global npm install

To update, run pi-web stop, then pi-web update (or run the same install command again). To uninstall, run npm uninstall -g @agegr/pi-web.

Configuration

For port and hostname, command-line options override the corresponding environment variables. Either --no-open or PI_WEB_NO_OPEN=1 disables automatic browser opening. Run pi-web --help (or -h) to print startup options and exit without starting the server. Unknown options exit with an error.

Option or environment variable Purpose Default
--help, -h Print startup options and exit —
--port <port>, -p <port>, or PORT Server port 30141
--hostname <host>, -H <host>, or PI_WEB_HOSTNAME Bind hostname 127.0.0.1
--no-open or PI_WEB_NO_OPEN=1 Do not open a browser automatically Browser opens
PI_WEB_APP_NAME PWA manifest name and short_name; surrounding whitespace is trimmed, empty values use the default Pi Web
PI_WEB_SKIP_VERSION_CHECK=1 Disable Pi Web update checks Unset
PI_WEB_ALLOWED_HOSTS Additional exact proxy or custom hostnames, comma-separated Unset
PI_WEB_FRAME_ANCESTORS Other origins allowed to embed Pi Web in an iframe, comma-separated CSP sources such as https://portal.example or http://localhost:* Same origin only
PI_WEB_PASSWORD Enable browser password login; API clients may use Basic Auth with username pi Authentication disabled
PI_WEB_IDLE_TIMEOUT_MS Session idle timeout in milliseconds, up to 2147483647; 0 disables idle shutdown; invalid or out-of-range values use the default 600000 (10 min)
PI_WEB_SHUTDOWN_DEADLINE_MS How long extensions get to handle session_shutdown before a closing session is disposed anyway, in milliseconds up to 2147483647; 0, invalid or out-of-range values use the default 5000 (5 s)
PI_CODEMODE_MAX_WORKERS pi's limit on codemode scripts running at once, shared by every session and subagent in the server; pi's own default is 2, and pi-web sets 8 when the variable is unset or empty. Each script may use up to 256 MB 8

Set PI_WEB_APP_NAME before starting the server (for example, PI_WEB_APP_NAME='Work Pi' pi-web). After changing it, restart the server to serve the new manifest; no rebuild is required. Updates to the name of an already installed PWA are managed by the browser and are not guaranteed to appear immediately. This does not change the page title or icons.

For example:

pi-web --help
pi-web -p 8080 -H 0.0.0.0 --no-open

Remote Access

Binding to a non-loopback address exposes an agent that can execute high-privilege actions. On a trusted LAN, require a long random password:

PI_WEB_PASSWORD='a-long-random-password' pi-web --hostname 0.0.0.0

Password authentication does not encrypt the connection. Do not expose Pi Web over plain HTTP to the internet; use HTTPS through a trusted reverse proxy or a trusted VPN. If a reverse proxy sends an external hostname, add that exact name to PI_WEB_ALLOWED_HOSTS. This allow-list does not change the address Pi Web binds to.

With many chats, terminals or file previews active at once, plain HTTP limits the browser to six connections and requests start to wait; see Serving Pi Web over HTTP/2.

Docker

Each release publishes an image to ghcr.io/agegr/pi-web. See Running Pi Web in Docker for it, the Compose example and which volumes to keep.

HTTP Proxy

Server-side model and API requests honor the standard HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables.

On macOS or Linux:

HTTP_PROXY=http://127.0.0.1:7890 \
HTTPS_PROXY=http://127.0.0.1:7890 \
NO_PROXY=localhost,127.0.0.1 \
npx @agegr/pi-web@latest

On Windows PowerShell:

$env:HTTP_PROXY = "http://127.0.0.1:7890"
$env:HTTPS_PROXY = "http://127.0.0.1:7890"
$env:NO_PROXY = "localhost,127.0.0.1"
npx @agegr/pi-web@latest

Notes

Development

npm install
npm run dev

The development server runs at http://127.0.0.1:30141. Run the common checks with:

npm test
node_modules/.bin/tsc --noEmit
npm run lint

Do not run next build or npm run build during normal development. It writes to .next/ and can interfere with the development server; leave builds for release work.

Before starting on a feature, read Contributing for what is in scope and the pull request checklist.

Contributor guides: Internationalization and Release process.

Repository Layout

app/             Next.js UI and API routes
components/      React UI components
hooks/           Client state and interaction hooks
lib/             Session, agent, model, file, Git, and security logic
public/          Static assets and PWA files
bin/             npm CLI entrypoint and launch option parsing
docs/            Focused user and contributor guides
demo/            Static browser demo published to GitHub Pages (see demo/README.md)

See AGENTS.md for the architecture notes, API routes and topic notes.

License

MIT

pi-web (agegr/pi-web)

正在搜索数据库…

这是什么?这是 pi 编程代理的本地浏览器界面:可以浏览和恢复对话、运行代理任务、配置模型、查看项目文件——使用的数据与 pi CLI 完全相同。
那这是一个桌面应用,还是在浏览器里运行?它以一个小型本地 Web 服务器的形式运行,通过 pi-web 命令启动,然后在你的浏览器里使用。它和 pi 共用配置文件和会话文件,所以 CLI 和这个界面始终保持同步。
我怎么把它跑起来?先用 npm install -g @agegr/pi-web 全局安装,然后运行 pi-web——服务器会在 30141 端口启动,并自动打开你的浏览器。想更新的话,重新运行同一条安装命令即可。
在它正常工作之前,我需要先装点什么吗?需要 Node.js 22.19.0 或更新的版本。如果还没有配置任何模型提供商,可以在 Pi Web 界面里的 Models 面板登录或添加 API 密钥。
我能从别的电脑打开它,还是只能在本地使用?默认情况下它只监听 127.0.0.1。远程使用是可行的,但密码登录并不会加密流量,所以 README 建议通过反向代理或 VPN 使用 HTTPS,切勿通过纯 HTTP 对外暴露。
我的会话和项目文件存在哪里?所有内容都保留在你的电脑上:它从 ~/.pi/agent 读取 pi 的数据,文件浏览器也只能看到你在 Pi Web 中选择的工作目录——它并不是一个通用的文件系统浏览器。
我可以对过去的对话做些什么?会话工作区可以按项目分组浏览、恢复、重命名、导出和删除对话,并显示运行状态、上下文占用、费用和压缩详情。你可以用两种方式分支:从较早的消息开启一个独立会话,或者用 Edit from here 在当前会话内创建分支。
它能处理我的 Git worktree 吗?可以——你可以在侧边栏切换检出目录,同一仓库的会话仍会归在一起,还能查看项目文件的 Git 差异。
它可以预览哪些文件类型?源代码、Markdown、图片、音频、PDF 和 DOCX,并且会自动刷新。你还可以在界面中浏览和上传项目文件。
界面支持哪些语言?支持英文、简体中文和繁体中文。首次使用时会跟随你的浏览器语言,顶栏里有一个语言切换按钮。
作者
agegr
大小
15.4 MB
星标
8.5K
时长
8个月
提交 · 90 天