feat(connect-local): add Pi extension for local agent bridge

Monorepo Pi package with outbound WebSocket, pairing/reconnect flow,
presence reporting, and single-flight task.dispatch handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Chengdong Zhang
2026-07-23 20:55:36 +08:00
commit 94721227c0
10 changed files with 575 additions and 0 deletions

32
README.md Normal file
View File

@@ -0,0 +1,32 @@
# Connect Local Pi Extension
Install with official Pi:
```bash
pi install git:git@github.com:your-org/agentic-chat-core.git#packages/connect-local
```
Prerequisite: [Pi coding agent](https://www.npmjs.com/package/@earendil-works/pi-coding-agent) installed globally or in your environment.
## Commands
- `/connect <pairing-token> [project-name]` — pair this interactive session with the cloud platform
- `/disconnect` — close the bridge and clear stored reconnect credentials
- `/connected` — show whether the bridge socket is connected
Obtain a pairing token from Slack: `/pi local new`.
## Configuration
- `PI_PLATFORM_LOCAL_AGENT_WS_URL` — WebSocket URL (default `ws://127.0.0.1:3000/api/local-agent/ws`)
- Reconnect credentials are stored under `~/.pi-platform/connect-local/` (outside your repo)
## Development
From monorepo root:
```bash
npm run build -w packages/shared
npm run build -w packages/connect-local
npm run test -w packages/connect-local
```