mirror of
https://github.com/zgs225/pi2d.git
synced 2026-11-25 09:51:43 +08:00
0ef019f58da3b11893c3432e1020679572d84e59
- Pair through the public POST /api/v1/pair and persist the device scopes; keep the allow-listed next deep link. Rename the manual field to pairing code. - Authenticate the WebSocket with the raw device token (strip Bearer) and recover from a 401 by clearing the connection once. - Fix chat payloads: setModel/setThinking, attention/diff responses, subagent dispatch items, queue ids/mode, task output and WS resume since. - Render exactly one assistant message per turn: one-to-one snapshot/history merge plus a stale-delta guard after message_end (fixes PONGONG). - Fix dialogs (content above the overlay), unknown-session deep links (error + retry, no silent fallback), device list/revoke, status identity and live pairing code, reconnect banner and Playwright selectors.
pi2d — pi2 web console daemon
The always-on web side of pi2.nvim. It is a router + supervisor, not an agent runtime:
browser ──HTTP/WS──▶ pi2d ──JSONL unix socket──▶ one nvim per workspace (pi2.nvim)
└── one pi --mode rpc per active session
Hard rules (see docs/protocol.md):
pi2dnever spawnspi, never reads session JSONL, never owns session state.- A workspace maps to exactly one managed nvim instance.
- All mutations are commands relayed to the plugin; the plugin (inside nvim) is the single source of truth.
- The web client keeps a render cache only; a
snapshotfrom the plugin replaces it wholesale.
Quick start
pnpm install
pnpm test
pnpm dev # starts on 127.0.0.1:7676
The plugin starts the daemon lazily when it is not running; you normally do not start it by hand.
Layout
| Path | Purpose |
|---|---|
src/protocol/ |
wire types, event/command vocabulary, error codes, canonical reducer |
src/daemon/ |
HTTP/WS/SSE, auth, static assets, routing, event relay |
src/instances/ |
discovery, lazy spawn, single-instance enforcement, crash handling |
src/workspaces/ |
workspace registry, disk discovery, aliases/trust |
src/cli/ |
pi2d (daemon) and pi2 (attach/status/doctor) |
fixtures/ |
golden event streams + expected session state (shared with pi2.nvim tests) |
docs/protocol.md |
the wire contract (browser ↔ daemon ↔ plugin) |
Description
[mirror of github.com/zgs225/pi2d] pi2 web console daemon
2.1 MiB
0 Stars
1 Watchers
0 Forks
Languages
TypeScript
76.4%
JavaScript
15.2%
CSS
5.5%
Shell
2.8%