feat: add improved pi agent with observatory, dashboard, and pledge-now-pay-later

This commit is contained in:
Azreen Jamal
2026-03-01 23:41:24 +08:00
parent ae242436c9
commit f832b913d5
99 changed files with 20949 additions and 74 deletions

3
.pi/observatory/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
events.jsonl
summary.json
report.md

0
.pi/observatory/.gitkeep Normal file
View File

View File

@@ -8,7 +8,15 @@ allowed-tools: Bash
## Purpose
Automate browsers using `playwright-cli` — a token-efficient CLI for Playwright. Runs headless by default, supports parallel sessions via named sessions (`-s=`), and doesn't load tool schemas into context.
Automate browsers using `playwright-cli` (via `@playwright/cli`) — a token-efficient CLI for Playwright. Runs headless by default, supports parallel sessions via named sessions (`-s=`), and doesn't load tool schemas into context.
## Prerequisites
Ensure the package is installed in the project:
```bash
bun add -d @playwright/cli
bunx playwright install chromium
```
## Key Details
@@ -28,17 +36,17 @@ Automate browsers using `playwright-cli` — a token-efficient CLI for Playwrigh
# "scrape pricing from competitor.com" → -s=competitor-pricing
# "UI test the login page" → -s=login-ui-test
playwright-cli -s=mystore-checkout open https://mystore.com --persistent
playwright-cli -s=mystore-checkout snapshot
playwright-cli -s=mystore-checkout click e12
bunx playwright-cli -s=mystore-checkout open https://mystore.com --persistent
bunx playwright-cli -s=mystore-checkout snapshot
bunx playwright-cli -s=mystore-checkout click e12
```
Managing sessions:
```bash
playwright-cli list # list all sessions
playwright-cli close-all # close all sessions
playwright-cli -s=<name> close # close specific session
playwright-cli -s=<name> delete-data # wipe session profile
bunx playwright-cli list # list all sessions
bunx playwright-cli close-all # close all sessions
bunx playwright-cli -s=<name> close # close specific session
bunx playwright-cli -s=<name> delete-data # wipe session profile
```
## Quick Reference
@@ -61,35 +69,35 @@ Config: open --headed, open --browser=chrome, resize <w> <h>
1. Derive a session name from the user's prompt and open with `--persistent` to preserve cookies/state. Always set the viewport via env var at launch:
```bash
PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 playwright-cli -s=<session-name> open <url> --persistent
PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 bunx playwright-cli -s=<session-name> open <url> --persistent
# or headed:
PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 playwright-cli -s=<session-name> open <url> --persistent --headed
PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 bunx playwright-cli -s=<session-name> open <url> --persistent --headed
# or with vision (screenshots returned as image responses in context):
PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 PLAYWRIGHT_MCP_CAPS=vision playwright-cli -s=<session-name> open <url> --persistent
PLAYWRIGHT_MCP_VIEWPORT_SIZE=1440x900 PLAYWRIGHT_MCP_CAPS=vision bunx playwright-cli -s=<session-name> open <url> --persistent
```
3. Get element references via snapshot:
```bash
playwright-cli snapshot
bunx playwright-cli snapshot
```
4. Interact using refs from snapshot:
```bash
playwright-cli click <ref>
playwright-cli fill <ref> "text"
playwright-cli type "text"
playwright-cli press Enter
bunx playwright-cli click <ref>
bunx playwright-cli fill <ref> "text"
bunx playwright-cli type "text"
bunx playwright-cli press Enter
```
5. Capture results:
```bash
playwright-cli screenshot
playwright-cli screenshot --filename=output.png
bunx playwright-cli screenshot
bunx playwright-cli screenshot --filename=output.png
```
6. **Always close the session when done.** This is not optional — close the named session after finishing your task:
```bash
playwright-cli -s=<session-name> close
bunx playwright-cli -s=<session-name> close
```
## Configuration
@@ -109,6 +117,4 @@ If a `playwright-cli.json` exists in the working directory, use it automatically
## Full Help
Run `playwright-cli --help` or `playwright-cli --help <command>` for detailed command usage.
See [docs/playwright-cli.md](docs/playwright-cli.md) for full documentation.
Run `bunx playwright-cli --help` or `bunx playwright-cli --help <command>` for detailed command usage.