No description
Find a file
2026-06-04 15:39:21 +02:00
extensions Initial fresh import 2026-06-04 15:28:41 +02:00
tests Initial fresh import 2026-06-04 15:28:41 +02:00
.gitignore Initial fresh import 2026-06-04 15:28:41 +02:00
CHANGELOG.md Initial fresh import 2026-06-04 15:28:41 +02:00
LICENSE Initial fresh import 2026-06-04 15:28:41 +02:00
package.json Update package metadata 2026-06-04 15:39:21 +02:00
README.md Initial fresh import 2026-06-04 15:28:41 +02:00
tsconfig.json Initial fresh import 2026-06-04 15:28:41 +02:00

pi-agent-web-session

Pi package that starts a small local web UI for Pi.

On startup it opens a random localhost port and shows the URL in Pi:

Pi Web Session iniciado: http://127.0.0.1:52341/?token=...

Runtime communication uses a WebSocket after the initial HTML/vendor asset load.

Features

  • Random free port on startup using listen(0).
  • Local-only server bound to 127.0.0.1.
  • Per-session token in the URL.
  • Persistent local web server across Pi session switches.
  • Session sidebar for switching, renaming, and deleting past sessions in the same directory.
  • Real-time timeline in the browser over WebSocket.
  • Renders messages as Markdown using marked and sanitizes HTML with DOMPurify.
  • Shows assistant streaming updates.
  • Hides thinking and tool-use details by default behind expandable blocks.
  • Shows tool execution start/update/end events collapsed by default.
  • Send prompts from the browser.
  • Send with Ctrl+Enter / Cmd+Enter.
  • Queue messages as steer or followUp while Pi is busy.
  • Abort current work from the browser.
  • /web command to show/control the server.

Install / test locally

From this folder:

npm install
npm run typecheck
npm test
pi -e ./extensions/web.ts

Or install as a Pi package:

pi install ./

Commands

/web              Show the current URL
/web url          Show the current URL
/web status       Show the current URL
/web start        Start the server if stopped
/web restart      Restart with a new random port/token
/web stop         Stop the server

Flag

Enabled by default. Disable for one run with:

pi --no-web-session

Security

The server is intentionally bound to 127.0.0.1 and requires a random token. Do not expose it publicly unless you add stronger authentication.