@blackbelt-technology/pi-dashboard-extension 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.pi/skills/browser/SKILL.md +28 -14
- package/.pi/skills/browser/UPSTREAM.md +10 -1
- package/.pi/skills/browser/references/electron.agent.md +57 -0
- package/.pi/skills/browser/references/own-browser.md +299 -0
- package/.pi/skills/browser/references/web.agent.md +323 -0
- package/.pi/skills/browser/scripts/check-panerelay.sh +157 -0
- package/.pi/skills/doctor/SKILL.md +3 -9
- package/.pi/skills/doctor/_lib/checks.ts +14 -68
- package/.pi/skills/doctor/_lib/derive-tokens.ts +1 -0
- package/.pi/skills/doctor/modules/apple-tools.knowledge.hash +1 -0
- package/.pi/skills/doctor/modules/apple-tools.md +51 -0
- package/.pi/skills/doctor/modules/oauth-redirect-base.knowledge.hash +1 -0
- package/.pi/skills/doctor/modules/oauth-redirect-base.md +71 -0
- package/.pi/skills/doctor/modules/pi-resolution.knowledge.hash +1 -1
- package/.pi/skills/doctor/modules/pi-resolution.md +21 -1
- package/.pi/skills/pi-dashboard/references/api-reference.agent.md +69 -0
- package/.pi/skills/project-init/SKILL.md +1 -7
- package/.pi/skills/project-init/dox-doctrine.md +42 -0
- package/.pi/skills/project-init/profiles/docs/profile.json +1 -1
- package/README.md +19 -0
- package/agents/DoxTriage.md +80 -0
- package/package.json +22 -11
- package/src/agent-settled.ts +27 -9
- package/src/auto-session-namer.ts +486 -70
- package/src/autostart-guard.ts +99 -0
- package/src/autostart-lock.ts +258 -0
- package/src/bridge-context.ts +86 -5
- package/src/bridge-ticket-client.ts +105 -0
- package/src/bridge.ts +917 -213
- package/src/command-handler.ts +332 -57
- package/src/connect-target.ts +130 -0
- package/src/connection.ts +371 -7
- package/src/endpoint-resolution.ts +221 -0
- package/src/flow-event-wiring.ts +125 -3
- package/src/followup-buffer.ts +217 -0
- package/src/instance-verification.ts +125 -0
- package/src/local-token-header.ts +44 -0
- package/src/model-refresh.ts +95 -0
- package/src/notify-proxy.ts +33 -0
- package/src/pi-env.d.ts +4 -0
- package/src/pi-retry-settings.ts +91 -0
- package/src/provider-register.ts +86 -21
- package/src/remote-registration-gate.ts +102 -0
- package/src/retry-tracker.ts +265 -86
- package/src/role-manager.ts +20 -0
- package/src/role-model-tools.ts +38 -3
- package/src/server-auto-start.ts +144 -2
- package/src/server-pin-store.ts +92 -0
- package/src/session-move.ts +275 -0
- package/src/session-sync.ts +24 -5
- package/src/subagent-forward-sites.ts +69 -0
- package/src/subagent-frame-buffer.ts +24 -3
- package/src/subagent-frame-strip.ts +109 -0
- package/src/subagent-tick-throttle.ts +250 -0
- package/src/transcript-backfill.ts +151 -0
- package/src/transcript-request-guard.ts +76 -0
- package/src/transport-diagnostics.ts +76 -0
- package/src/turn-actionability.ts +20 -0
- package/src/ui-stale-guard.ts +58 -0
- package/.pi/skills/doctor/AGENTS.md +0 -27
- package/src/AGENTS.md +0 -57
- package/src/__tests__/abort-latch.test.ts +0 -97
- package/src/__tests__/agent-settled.test.ts +0 -82
- package/src/__tests__/artifact-roots.test.ts +0 -83
- package/src/__tests__/ask-user-attachments.test.ts +0 -106
- package/src/__tests__/ask-user-schema-discriminator.test.ts +0 -141
- package/src/__tests__/ask-user-tool.test.ts +0 -571
- package/src/__tests__/auto-session-namer.test.ts +0 -339
- package/src/__tests__/bridge-default-model-apply.test.ts +0 -242
- package/src/__tests__/bridge-default-model-gate.test.ts +0 -50
- package/src/__tests__/bridge-entry-id-pi-070.test.ts +0 -174
- package/src/__tests__/bridge-followup-chat-order.test.ts +0 -215
- package/src/__tests__/bridge-followup-multi-entry.test.ts +0 -202
- package/src/__tests__/bridge-followup-mutation.test.ts +0 -217
- package/src/__tests__/bridge-followup-queue-drain.test.ts +0 -266
- package/src/__tests__/bridge-hasui-flip.test.ts +0 -109
- package/src/__tests__/bridge-no-queue-mutation.test.ts +0 -112
- package/src/__tests__/bridge-plugin-emit-event.test.ts +0 -44
- package/src/__tests__/bridge-queue-update-forward.test.ts +0 -77
- package/src/__tests__/bridge-resume-disconnect.test.ts +0 -333
- package/src/__tests__/bridge-shadow-queue-gate.test.ts +0 -299
- package/src/__tests__/bridge-shutdown-reset.test.ts +0 -159
- package/src/__tests__/bridge-slash-command-routing.test.ts +0 -458
- package/src/__tests__/bridge-stop-after-turn.test.ts +0 -72
- package/src/__tests__/bridge-system-followup.test.ts +0 -163
- package/src/__tests__/bridge-thinking-level-select.test.ts +0 -68
- package/src/__tests__/browser-skill-registered.test.ts +0 -84
- package/src/__tests__/build-provider-catalogue.test.ts +0 -210
- package/src/__tests__/command-handler.test.ts +0 -1180
- package/src/__tests__/commit-draft.test.ts +0 -100
- package/src/__tests__/connection-dropped-frames.test.ts +0 -78
- package/src/__tests__/connection-suppress-auto-start.test.ts +0 -97
- package/src/__tests__/connection.test.ts +0 -344
- package/src/__tests__/credentials-updated.test.ts +0 -26
- package/src/__tests__/custom-provider-apikey-roundtrip.test.ts +0 -128
- package/src/__tests__/cwd-missing-probe.test.ts +0 -82
- package/src/__tests__/dashboard-commands-shipped.test.ts +0 -53
- package/src/__tests__/dashboard-context-injector.test.ts +0 -190
- package/src/__tests__/dashboard-default-adapter.test.ts +0 -77
- package/src/__tests__/dev-build.test.ts +0 -79
- package/src/__tests__/doctor/checks.test.ts +0 -121
- package/src/__tests__/doctor/modules.test.ts +0 -64
- package/src/__tests__/doctor/provenance-hash.test.ts +0 -94
- package/src/__tests__/doctor/router.test.ts +0 -143
- package/src/__tests__/empty-actionable-guard-config.test.ts +0 -32
- package/src/__tests__/empty-actionable-guard.test.ts +0 -73
- package/src/__tests__/enrich-model-metadata.test.ts +0 -222
- package/src/__tests__/event-forwarder.test.ts +0 -119
- package/src/__tests__/extension-slash-command-detection.test.ts +0 -143
- package/src/__tests__/filter-enabled-models.test.ts +0 -151
- package/src/__tests__/fixtures/turn-actionability-fixtures.ts +0 -69
- package/src/__tests__/fork-entryid-timing.test.ts +0 -88
- package/src/__tests__/git-info-status.test.ts +0 -73
- package/src/__tests__/git-link-builder.test.ts +0 -102
- package/src/__tests__/git-poll.test.ts +0 -69
- package/src/__tests__/markdown-image-inliner.test.ts +0 -392
- package/src/__tests__/model-resolve.test.ts +0 -379
- package/src/__tests__/multiselect-dashboard-routing.test.ts +0 -203
- package/src/__tests__/multiselect-list.test.ts +0 -137
- package/src/__tests__/multiselect-polyfill.test.ts +0 -92
- package/src/__tests__/no-session-replacement-calls.test.ts +0 -99
- package/src/__tests__/no-tui-multiselect-arm-regression.test.ts +0 -81
- package/src/__tests__/openspec-activity-detector.test.ts +0 -337
- package/src/__tests__/openspec-cli-shim.test.ts +0 -145
- package/src/__tests__/openspec-poller.test.ts +0 -124
- package/src/__tests__/pi-version-tracker.test.ts +0 -109
- package/src/__tests__/process-metrics.test.ts +0 -47
- package/src/__tests__/process-scanner-kill.test.ts +0 -61
- package/src/__tests__/process-scanner.test.ts +0 -292
- package/src/__tests__/project-init-detect-stack.test.ts +0 -61
- package/src/__tests__/project-init-dox-kb-config.test.ts +0 -53
- package/src/__tests__/project-init-profiles.test.ts +0 -84
- package/src/__tests__/project-init-scaffold.test.ts +0 -139
- package/src/__tests__/project-init-seed-doctrine.test.ts +0 -100
- package/src/__tests__/project-trust.test.ts +0 -92
- package/src/__tests__/prompt-bus-wiring.test.ts +0 -791
- package/src/__tests__/prompt-bus.test.ts +0 -513
- package/src/__tests__/prompt-expander.test.ts +0 -398
- package/src/__tests__/provider-register-native-models.test.ts +0 -182
- package/src/__tests__/provider-register-reload.test.ts +0 -498
- package/src/__tests__/provider-register-thinking-levels.test.ts +0 -104
- package/src/__tests__/retry-tracker.test.ts +0 -152
- package/src/__tests__/role-manager.test.ts +0 -585
- package/src/__tests__/role-model-tools-registry-readiness.test.ts +0 -114
- package/src/__tests__/role-model-tools.test.ts +0 -229
- package/src/__tests__/search-files-completeness.test.ts +0 -111
- package/src/__tests__/search-files-ranking.test.ts +0 -168
- package/src/__tests__/server-auto-start.test.ts +0 -375
- package/src/__tests__/server-launcher-launch.test.ts +0 -96
- package/src/__tests__/server-launcher.test.ts +0 -101
- package/src/__tests__/server-probe.test.ts +0 -25
- package/src/__tests__/session-switch.test.ts +0 -139
- package/src/__tests__/session-sync.test.ts +0 -243
- package/src/__tests__/single-derivation-guard.test.ts +0 -39
- package/src/__tests__/source-detector.test.ts +0 -88
- package/src/__tests__/stats-extractor.test.ts +0 -92
- package/src/__tests__/subagent-frame-buffer.test.ts +0 -239
- package/src/__tests__/tool-result-image-inliner.test.ts +0 -206
- package/src/__tests__/tui-prompt-adapter.test.ts +0 -213
- package/src/__tests__/turn-actionability.test.ts +0 -86
- package/src/__tests__/ui-decorators.test.ts +0 -309
- package/src/__tests__/ui-modules.test.ts +0 -293
- package/src/__tests__/vcs-info.test.ts +0 -265
- package/src/__tests__/visibility-intent.test.ts +0 -43
- package/src/__tests__/watchdog.test.ts +0 -161
- package/src/abort-latch.ts.AGENTS.md +0 -3
- package/src/agent-settled.ts.AGENTS.md +0 -3
- package/src/artifact-roots.ts.AGENTS.md +0 -3
- package/src/ask-user-attachments.ts.AGENTS.md +0 -3
- package/src/ask-user-tool.ts.AGENTS.md +0 -3
- package/src/auto-session-namer.ts.AGENTS.md +0 -3
- package/src/bridge-context.ts.AGENTS.md +0 -3
- package/src/bridge-default-model-gate.ts.AGENTS.md +0 -3
- package/src/bridge.ts.AGENTS.md +0 -3
- package/src/command-handler.ts.AGENTS.md +0 -3
- package/src/commit-draft-agent.ts.AGENTS.md +0 -3
- package/src/commit-draft.ts.AGENTS.md +0 -3
- package/src/connection.ts.AGENTS.md +0 -3
- package/src/dashboard-context-injector.ts.AGENTS.md +0 -3
- package/src/dashboard-default-adapter.ts.AGENTS.md +0 -3
- package/src/dev-build.ts.AGENTS.md +0 -3
- package/src/empty-actionable-guard-config.ts.AGENTS.md +0 -3
- package/src/empty-actionable-guard.ts.AGENTS.md +0 -3
- package/src/event-forwarder.ts.AGENTS.md +0 -3
- package/src/flow-event-wiring.ts.AGENTS.md +0 -3
- package/src/git-link-builder.ts.AGENTS.md +0 -3
- package/src/git-poll.ts.AGENTS.md +0 -3
- package/src/hasui-flip.ts.AGENTS.md +0 -3
- package/src/markdown-image-inliner.ts.AGENTS.md +0 -3
- package/src/model-tracker.ts.AGENTS.md +0 -3
- package/src/multiselect-decode.ts.AGENTS.md +0 -3
- package/src/multiselect-list.ts.AGENTS.md +0 -3
- package/src/multiselect-polyfill.ts.AGENTS.md +0 -3
- package/src/openspec-cli-shim.ts.AGENTS.md +0 -7
- package/src/process-metrics.ts.AGENTS.md +0 -3
- package/src/process-scanner.ts.AGENTS.md +0 -3
- package/src/project-init/AGENTS.md +0 -12
- package/src/project-trust.ts.AGENTS.md +0 -3
- package/src/prompt-bus.ts.AGENTS.md +0 -3
- package/src/prompt-expander.ts.AGENTS.md +0 -3
- package/src/provider-register.ts.AGENTS.md +0 -3
- package/src/retry-tracker.ts.AGENTS.md +0 -3
- package/src/role-manager.ts.AGENTS.md +0 -3
- package/src/role-model-tools.ts.AGENTS.md +0 -3
- package/src/server-auto-start.ts.AGENTS.md +0 -3
- package/src/server-launcher.ts.AGENTS.md +0 -3
- package/src/session-sync.ts.AGENTS.md +0 -3
- package/src/slash-dispatch.ts.AGENTS.md +0 -3
- package/src/source-detector.ts.AGENTS.md +0 -3
- package/src/subagent-frame-buffer.ts.AGENTS.md +0 -3
- package/src/tool-result-image-inliner.ts.AGENTS.md +0 -3
- package/src/tui-prompt-adapter.ts.AGENTS.md +0 -3
- package/src/turn-actionability.ts.AGENTS.md +0 -3
- package/src/ui-modules.ts.AGENTS.md +0 -3
- package/src/vcs-info.ts.AGENTS.md +0 -3
- package/src/visibility-intent.ts.AGENTS.md +0 -3
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: browser
|
|
3
|
-
description:
|
|
4
|
-
Browser automation via the `agent-browser` CLI. Use when the user needs to
|
|
5
|
-
interact with websites or Electron desktop apps — navigating pages, filling
|
|
6
|
-
forms, clicking buttons, taking screenshots, extracting data, testing web
|
|
7
|
-
apps, automating browser actions, visual UI verification, responsive checks,
|
|
8
|
-
hunting console errors, or driving the Pi Dashboard's Electron shell (main
|
|
9
|
-
window, wizard window, doctor window, tray, native menus). Triggers include
|
|
10
|
-
"open a website", "fill out a form", "click a button", "take a screenshot",
|
|
11
|
-
"scrape data", "test this web app", "automate browser", "test responsive",
|
|
12
|
-
"debug blank page", "automate Slack app", "control VS Code", "attach to
|
|
13
|
-
Electron app", "screenshot Pi Dashboard", "drive the wizard window".
|
|
3
|
+
description: 'Browser automation via the `agent-browser` CLI. Use when the user needs to drive websites or Electron desktop apps — navigating, filling forms, clicking, screenshots, extracting data, testing web apps, visual UI checks, the Pi Dashboard''s Electron shell, or the user''s own logged-in browser (SSO/2FA sites). Triggers: "open a website", "take a screenshot", "test this web app", "use my own browser".'
|
|
14
4
|
license: Apache-2.0
|
|
15
|
-
allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)
|
|
5
|
+
allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*), Bash(npx @panerelay/setup:*)
|
|
16
6
|
metadata:
|
|
17
7
|
author: pi-dashboard
|
|
18
|
-
version: "1.
|
|
8
|
+
version: "1.1"
|
|
19
9
|
vendoredFrom: agent-browser
|
|
20
10
|
vendoredVersion: "0.27.0"
|
|
11
|
+
verifiedAgainstCli: "0.33.2"
|
|
21
12
|
---
|
|
22
13
|
|
|
23
14
|
# browser
|
|
@@ -25,7 +16,7 @@ metadata:
|
|
|
25
16
|
Composite skill that gives the agent eyes and hands for any browser-driven
|
|
26
17
|
task — web pages or Electron desktop apps — via the `agent-browser` CLI.
|
|
27
18
|
|
|
28
|
-
|
|
19
|
+
Three recipes:
|
|
29
20
|
|
|
30
21
|
- **Web automation** — generic web pages plus Pi Dashboard-specific helpers
|
|
31
22
|
(dashboard URL detection, responsive testing, console-error hunting).
|
|
@@ -33,6 +24,10 @@ Two recipes:
|
|
|
33
24
|
- **Electron automation** — drive any Chromium-based Electron app, including
|
|
34
25
|
a worked example for the Pi Dashboard's own shell via `--debug-cdp`.
|
|
35
26
|
Reference: [`references/electron.md`](references/electron.md).
|
|
27
|
+
- **The user's own logged-in browser** — reach SSO/2FA-gated sites using the
|
|
28
|
+
user's real cookies via an extension bridge (Panerelay), plus how to list
|
|
29
|
+
and select Chrome profiles.
|
|
30
|
+
Reference: [`references/own-browser.md`](references/own-browser.md).
|
|
36
31
|
|
|
37
32
|
## Step 0a — Preflight: `agent-browser` CLI must be installed
|
|
38
33
|
|
|
@@ -87,6 +82,14 @@ that isn't Pi Dashboard (Slack, VS Code, Figma, …), route to
|
|
|
87
82
|
`references/electron.md` even when `PD_RUNNING=no` — that recipe covers
|
|
88
83
|
launching any Electron app with `--remote-debugging-port`.
|
|
89
84
|
|
|
85
|
+
**Override (login state)**: if the target needs the user's *existing*
|
|
86
|
+
session — "use my browser", "I'm already logged in", SSO/2FA, an internal
|
|
87
|
+
tool the agent cannot sign into — route to `references/own-browser.md`
|
|
88
|
+
regardless of the probe. The default bundled browser starts logged out and
|
|
89
|
+
cannot be made to inherit those logins; `--profile` copies the profile and
|
|
90
|
+
still loses macOS Keychain-encrypted cookies. Prefer the bundled browser
|
|
91
|
+
whenever login state is irrelevant — it is faster and more capable.
|
|
92
|
+
|
|
90
93
|
## Step 1 — Read the matched recipe and execute
|
|
91
94
|
|
|
92
95
|
Read the reference file selected above, then follow its workflow. Both
|
|
@@ -98,6 +101,17 @@ references are self-contained; you do not need to read both.
|
|
|
98
101
|
snapshots of upstream `agent-browser` skill content (`core` and
|
|
99
102
|
`electron`) at CLI version 0.27.0. See [`UPSTREAM.md`](UPSTREAM.md) for
|
|
100
103
|
refresh procedure and [`LICENSE`](LICENSE) for upstream attribution.
|
|
104
|
+
`references/own-browser.md` is **authored, not vendored** — an upstream
|
|
105
|
+
refresh must not overwrite it.
|
|
106
|
+
- **Surfaces share one browser**: the `browser` MCP tool and
|
|
107
|
+
`Bash: agent-browser …` drive the *same* daemon and *same* Chrome, with a
|
|
108
|
+
shared active page. Probing with one mid-task can silently move the page
|
|
109
|
+
out from under the other. Pick one surface per task; use
|
|
110
|
+
`--session <name>` for genuinely isolated browsers.
|
|
111
|
+
- **Known wrapper bug**: the MCP tool's `eval` echoes the JS source instead
|
|
112
|
+
of executing it (and mangles regex escapes) — still present with CLI
|
|
113
|
+
0.33.2, so it is a `pi-agent-browser` wrapper defect, not a CLI one. Use
|
|
114
|
+
`Bash: agent-browser eval …` instead.
|
|
101
115
|
- **No CLI bundled**: agents installing the bridge extension get the
|
|
102
116
|
skill text but not the CLI; install on demand per Step 0a.
|
|
103
117
|
- **User-local override**: if the user's project has its own
|
|
@@ -5,6 +5,11 @@ snapshots of upstream `agent-browser` skill content. The Pi Dashboard
|
|
|
5
5
|
addenda appended to `web.md` and the "Worked example: Pi Dashboard"
|
|
6
6
|
section in `electron.md` are project-specific and not from upstream.
|
|
7
7
|
|
|
8
|
+
**Not vendored — do not overwrite on refresh:**
|
|
9
|
+
`references/own-browser.md` and `scripts/check-panerelay.sh` are authored
|
|
10
|
+
for this repo (the Panerelay / own-logged-in-browser recipe). They have no
|
|
11
|
+
upstream counterpart.
|
|
12
|
+
|
|
8
13
|
| Field | Value |
|
|
9
14
|
|------------------------|--------------------------------------------------------------------|
|
|
10
15
|
| Upstream repo | https://github.com/vercel-labs/agent-browser |
|
|
@@ -38,7 +43,11 @@ diff <(awk 'BEGIN{n=0} /^---$/{n++; next} n>=2{print}' /tmp/electron.md) referen
|
|
|
38
43
|
# Preserve the Pi Dashboard addenda (after the first `---` separator
|
|
39
44
|
# in web.md, and the "Worked example: Pi Dashboard" section in
|
|
40
45
|
# electron.md). Update the LICENSE file if the upstream license text
|
|
41
|
-
# has changed.
|
|
46
|
+
# has changed. Leave own-browser.md and check-panerelay.sh untouched.
|
|
47
|
+
|
|
48
|
+
# 5. Re-verify the authored recipe against the new CLI, then bump
|
|
49
|
+
# `verifiedAgainstCli` in SKILL.md frontmatter:
|
|
50
|
+
# bash scripts/check-panerelay.sh
|
|
42
51
|
```
|
|
43
52
|
|
|
44
53
|
The CLI version is the source of truth for the content; the upstream tag
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# electron.md — index
|
|
2
|
+
|
|
3
|
+
Pull-only condensed map. Source: packages/extension/.pi/skills/browser/references/electron.md. Electron app + CDP workflow → key command/fact.
|
|
4
|
+
|
|
5
|
+
## Core Workflow
|
|
6
|
+
- Loop — launch Electron with remote debugging → `agent-browser connect 9222` → `snapshot -i` → interact via `@eN` refs → re-snapshot after state change.
|
|
7
|
+
- Launch+connect — `open -a "Slack" --args --remote-debugging-port=9222`; `agent-browser connect 9222`.
|
|
8
|
+
|
|
9
|
+
## Launching Electron Apps with CDP
|
|
10
|
+
- Every Electron app supports `--remote-debugging-port` (built into Chromium).
|
|
11
|
+
- macOS — `open -a "<App>" --args --remote-debugging-port=9222`: Slack 9222, VS Code 9223, Discord 9224, Figma 9225, Notion 9226, Spotify 9227.
|
|
12
|
+
- Linux — `slack --remote-debugging-port=9222`, `code --remote-debugging-port=9223`, `discord --remote-debugging-port=9224`.
|
|
13
|
+
- Windows — full exe path: `"C:\Users\%USERNAME%\AppData\Local\slack\slack.exe" --remote-debugging-port=9222`, `...\Programs\Microsoft VS Code\Code.exe` 9223.
|
|
14
|
+
- Quit running instance first — flag must be present at launch time; relaunch with flag.
|
|
15
|
+
|
|
16
|
+
## Connecting
|
|
17
|
+
- `agent-browser connect 9222` — subsequent commands target connected app, no `--cdp` needed.
|
|
18
|
+
- `--cdp 9222` per command; `--auto-connect` discovers a running Chromium-based app.
|
|
19
|
+
|
|
20
|
+
## Tab Management
|
|
21
|
+
- `agent-browser tab` — list all targets (windows, webviews).
|
|
22
|
+
- `tab 2` switch by index; `tab --url "*settings*"` switch by URL pattern.
|
|
23
|
+
|
|
24
|
+
## Webview Support
|
|
25
|
+
- Electron `<webview>` elements auto-discovered as targets with `type: "webview"`.
|
|
26
|
+
- Switch via `agent-browser tab 1`, then interact normally (snapshot, click, screenshot).
|
|
27
|
+
- Works via raw CDP connection.
|
|
28
|
+
|
|
29
|
+
## Common Patterns
|
|
30
|
+
- Inspect+Navigate — launch, `sleep 3`, connect, snapshot, `click @eN`, re-snapshot.
|
|
31
|
+
- Screenshots — `screenshot app-state.png`, `--full`, `--annotate`.
|
|
32
|
+
- Extract data — snapshot -i, `get text @e5`, `snapshot --json > app-state.json`.
|
|
33
|
+
- Fill forms — snapshot, fill, `press Enter`, `wait 1000`.
|
|
34
|
+
- Multiple apps — `--session slack connect 9222` / `--session vscode connect 9223`; interact independently.
|
|
35
|
+
|
|
36
|
+
## Color Scheme
|
|
37
|
+
- CDP default may be `light` — `--color-scheme dark snapshot -i` or `AGENT_BROWSER_COLOR_SCHEME=dark`.
|
|
38
|
+
|
|
39
|
+
## Troubleshooting
|
|
40
|
+
- "Connection refused"/"Cannot connect" — app not launched with flag; was already running (quit + relaunch); port in use — `lsof -i :9222`.
|
|
41
|
+
- App launches but connect fails — `sleep 3` after launch; webview init takes time.
|
|
42
|
+
- Elements missing in snapshot — multiple webviews; `agent-browser tab` to list, switch to right target.
|
|
43
|
+
- Cannot type — `keyboard type "text"` at current focus (no selector) or `keyboard inserttext "text"` to bypass key events (custom input components).
|
|
44
|
+
|
|
45
|
+
## Supported Apps
|
|
46
|
+
- Any Electron app works — Slack, Discord, Teams, Signal, Telegram Desktop; VS Code, GitHub Desktop, Postman, Insomnia; Figma, Notion, Obsidian; Spotify, Tidal; Todoist, Linear, 1Password.
|
|
47
|
+
|
|
48
|
+
## Worked example: Pi Dashboard
|
|
49
|
+
- Opt-in CDP — `--debug-cdp` CLI flag or `PI_DEBUG_CDP` env var; flag takes precedence; default port 9222.
|
|
50
|
+
- Single-instance contract — must fully quit + relaunch; `--debug-cdp` on a running instance only logs a warning to stderr; Chromium stands up CDP server at browser-process init, no API to enable later.
|
|
51
|
+
- macOS — `osascript -e 'quit app "PI Dashboard"'`; `open -a "PI Dashboard" --args --debug-cdp` (default 9222); custom port `--debug-cdp=9333`.
|
|
52
|
+
- Linux/Windows — `PI_DEBUG_CDP=1 /path/to/pi-dashboard` (default 9222); `PI_DEBUG_CDP=9444` custom port.
|
|
53
|
+
- Dev (this repo) — `cd packages/electron && npm run dev:cdp`.
|
|
54
|
+
- Activation proof — stderr line `[debug-cdp] CDP listening on :9222 — local automation is enabled`; line missing = CDP not active → halt recipe, tell user to relaunch with flag.
|
|
55
|
+
- Connect + list windows — `agent-browser connect 9222`; `agent-browser tab` shows main window `http://localhost:8000/`, wizard `file:///.../wizard.html`, doctor `file:///.../doctor.html`; switch with `tab <index>`.
|
|
56
|
+
- Drive windows — `tab 0` + `screenshot pi-dashboard.png` (main); `tab 1` + `snapshot -i` → click "Launch dashboard" (wizard); `tab 2` + `screenshot doctor.png` (doctor).
|
|
57
|
+
- Cleanup — `agent-browser close` disconnects session but does NOT quit the app (CDP stays active for next connection); end CDP entirely by quitting the app.
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
# Driving the user's own logged-in browser
|
|
2
|
+
|
|
3
|
+
Recipe for when the task needs the user's **real browser** — their cookies,
|
|
4
|
+
SSO sessions, work logins, installed extensions — rather than the clean
|
|
5
|
+
Chrome for Testing that `agent-browser` launches by default.
|
|
6
|
+
|
|
7
|
+
Not vendored from upstream. Authored for this repo; see
|
|
8
|
+
[`UPSTREAM.md`](../UPSTREAM.md).
|
|
9
|
+
|
|
10
|
+
## When this recipe applies
|
|
11
|
+
|
|
12
|
+
Use it when the target is behind a login the agent cannot perform: SSO /
|
|
13
|
+
2FA-gated apps, internal tools, a Gmail/Slack/Jira session the user is
|
|
14
|
+
already signed into.
|
|
15
|
+
|
|
16
|
+
Do **not** use it for ordinary automation. The default bundled browser
|
|
17
|
+
(`references/web.md`) is faster, disposable, and has more capability —
|
|
18
|
+
prefer it whenever login state is irrelevant.
|
|
19
|
+
|
|
20
|
+
## Why the obvious approaches fail
|
|
21
|
+
|
|
22
|
+
Try these first only if you want to confirm; all three are dead ends for a
|
|
23
|
+
real daily-driver profile:
|
|
24
|
+
|
|
25
|
+
| Approach | Outcome |
|
|
26
|
+
|---|---|
|
|
27
|
+
| `--remote-debugging-port` / `--cdp <port>` | **Chrome M136+ refuses it on a real user profile** — it would defeat Safe Storage HMAC isolation. |
|
|
28
|
+
| `--auto-connect` | Discovers Chrome via `DevToolsActivePort` files, which exist **only** when Chrome was launched with the debug flag. Normal sessions never create them. |
|
|
29
|
+
| `--profile Default` | Copies the profile to a temp dir. On macOS cookies are Keychain-protected and the copy cannot decrypt them → **you land logged out**. Upstream: [vercel-labs/agent-browser#1319](https://github.com/vercel-labs/agent-browser/issues/1319). |
|
|
30
|
+
|
|
31
|
+
The working path is a **different control plane**: an MV3 browser extension
|
|
32
|
+
plus a native-messaging host. The extension drives tabs through extension
|
|
33
|
+
APIs, so cookies and SSO come for free and no debug port is involved.
|
|
34
|
+
|
|
35
|
+
**Capability trade-off** — the extension path gives up CDP-class powers:
|
|
36
|
+
no `network route` interception, no isolated worlds, no `trace`/`profiler`.
|
|
37
|
+
If the task needs those, it needs the bundled browser.
|
|
38
|
+
|
|
39
|
+
## Strategy selection
|
|
40
|
+
|
|
41
|
+
| Need | Use |
|
|
42
|
+
|---|---|
|
|
43
|
+
| No login required | default bundled browser — `references/web.md` |
|
|
44
|
+
| Login the agent can perform itself | `auth save` + `auth login`, or `--session-name` |
|
|
45
|
+
| Auth captured once, replayed headless | `state save` / `--state <path>` |
|
|
46
|
+
| **Live SSO / 2FA / the user's actual session** | **Panerelay (this recipe)** |
|
|
47
|
+
|
|
48
|
+
## Setup — platform independent
|
|
49
|
+
|
|
50
|
+
Requires `agent-browser >= 0.33.0` (the `--provider <plugin name>`
|
|
51
|
+
interface). Verify first; everything else fails confusingly without it:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
agent-browser --version
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> **Consent gate — do not run the installer autonomously.** Per Step 0a of
|
|
58
|
+
> [`../SKILL.md`](../SKILL.md), installs are the user's explicit choice.
|
|
59
|
+
> This one installs a **native-messaging host** and asks for a browser
|
|
60
|
+
> extension with `debugger` + `nativeMessaging` + `scripting` permissions,
|
|
61
|
+
> so it warrants a deliberate yes. Present the command, state what it
|
|
62
|
+
> installs, and wait. Diagnostics (`doctor`, `check-panerelay.sh`) are
|
|
63
|
+
> read-only and safe to run unprompted.
|
|
64
|
+
|
|
65
|
+
The command to hand the user — **omit `--global-default`** so Panerelay
|
|
66
|
+
stays opt-in per command and never hijacks their other sessions:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx --yes @panerelay/setup --agent-browser
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This writes a native-messaging host, registers a `panerelay` plugin in
|
|
73
|
+
`~/.agent-browser/config.json`, and prints a Chrome Web Store link plus the
|
|
74
|
+
extension ID. Then, in the browser:
|
|
75
|
+
|
|
76
|
+
1. Install the extension from the Web Store link.
|
|
77
|
+
2. Open its **side panel** — the connection registers when the panel opens.
|
|
78
|
+
|
|
79
|
+
Extension installation requires a real user gesture. **The agent cannot do
|
|
80
|
+
this step**; hand it to the user and wait.
|
|
81
|
+
|
|
82
|
+
### Scope it to a dedicated profile (recommended)
|
|
83
|
+
|
|
84
|
+
The extension gets `debugger` + `nativeMessaging` + `scripting` on tabs it
|
|
85
|
+
is authorized for — on an authorized tab it can read and modify page
|
|
86
|
+
content and cookies, and pipe them to a local binary. Confine that blast
|
|
87
|
+
radius by installing it in a profile created for automation, leaving work
|
|
88
|
+
and personal profiles unreachable (they have no extension at all).
|
|
89
|
+
|
|
90
|
+
Weigh this against how new the dependency is before recommending it —
|
|
91
|
+
check `npm view @panerelay/setup` and the repo's age/stars. Say so plainly
|
|
92
|
+
rather than presenting it as a routine install.
|
|
93
|
+
|
|
94
|
+
Create the profile by launching the browser with a **new** profile
|
|
95
|
+
directory name:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# macOS
|
|
99
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
|
|
100
|
+
--profile-directory="AgentAutomation" "https://example.com"
|
|
101
|
+
|
|
102
|
+
# Linux
|
|
103
|
+
google-chrome --profile-directory="AgentAutomation" "https://example.com"
|
|
104
|
+
|
|
105
|
+
# Windows (PowerShell)
|
|
106
|
+
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
|
|
107
|
+
--profile-directory="AgentAutomation" "https://example.com"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Chrome creates the profile on first use. Install the Panerelay extension
|
|
111
|
+
**only in that window**.
|
|
112
|
+
|
|
113
|
+
Then confirm containment — the native-host manifest must list exactly the
|
|
114
|
+
one extension ID, so no other extension can reach the host:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
for D in "$HOME/Library/Application Support/Google/Chrome/NativeMessagingHosts" \
|
|
118
|
+
"$HOME/.config/google-chrome/NativeMessagingHosts"; do
|
|
119
|
+
[ -d "$D" ] || continue
|
|
120
|
+
grep -l panerelay "$D"/*.json 2>/dev/null | while read -r f; do
|
|
121
|
+
echo "manifest: $f"; grep -A2 '"allowed_origins"' "$f"
|
|
122
|
+
done
|
|
123
|
+
done
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Expect exactly one `chrome-extension://<id>/` entry.
|
|
127
|
+
|
|
128
|
+
Manifest locations by OS:
|
|
129
|
+
|
|
130
|
+
| OS | Native-messaging manifest directory |
|
|
131
|
+
|---|---|
|
|
132
|
+
| macOS | `~/Library/Application Support/Google/Chrome/NativeMessagingHosts/` |
|
|
133
|
+
| Linux | `~/.config/google-chrome/NativeMessagingHosts/` |
|
|
134
|
+
| Windows | registry `HKCU\Software\Google\Chrome\NativeMessagingHosts\` |
|
|
135
|
+
|
|
136
|
+
> Verified on macOS. Linux/Windows locations follow Chrome's documented
|
|
137
|
+
> native-messaging convention — confirm with
|
|
138
|
+
> `npx --yes @panerelay/setup doctor` on those platforms, which prints the
|
|
139
|
+
> resolved path it actually installed.
|
|
140
|
+
|
|
141
|
+
## Listing and selecting profiles
|
|
142
|
+
|
|
143
|
+
### List
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
agent-browser profiles
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Self-discovering — it resolves the OS-specific Chrome data directory for
|
|
150
|
+
you, so prefer it over hardcoding paths. Output is `<directory> (<label>)`:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Chrome profiles (/Users/me/Library/Application Support/Google/Chrome):
|
|
154
|
+
|
|
155
|
+
Default (Person 1)
|
|
156
|
+
Profile 21 (someone@work.example)
|
|
157
|
+
AgentAutomation
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The left column is the **profile directory** — that is the token both
|
|
161
|
+
`--profile` and `--profile-directory` expect. The parenthesised label is
|
|
162
|
+
the display name and is *not* a valid selector.
|
|
163
|
+
|
|
164
|
+
### Select
|
|
165
|
+
|
|
166
|
+
Two different selectors, for two different mechanisms:
|
|
167
|
+
|
|
168
|
+
| Goal | Selector |
|
|
169
|
+
|---|---|
|
|
170
|
+
| Bundled browser, copied profile (**loses macOS logins**) | `agent-browser --profile "Profile 21" open <url>` |
|
|
171
|
+
| The user's own browser via Panerelay | *no flag* — the profile is whichever one has the extension installed |
|
|
172
|
+
|
|
173
|
+
With Panerelay there is no per-command profile switch: **the profile is
|
|
174
|
+
selected by where you installed the extension.** To automate a different
|
|
175
|
+
profile, install the extension in that profile too. To *stop* automating
|
|
176
|
+
one, remove the extension from it.
|
|
177
|
+
|
|
178
|
+
Profile names with spaces must be quoted. Launch flags (`--profile`,
|
|
179
|
+
`--headed`, `--cdp`) are daemon-**launch** options — they are ignored with
|
|
180
|
+
only a warning if a daemon is already running. Run `agent-browser close
|
|
181
|
+
--all` first when the flag matters.
|
|
182
|
+
|
|
183
|
+
## Verify the connection
|
|
184
|
+
|
|
185
|
+
Run the bundled check — no network, no npx:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
bash scripts/check-panerelay.sh
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Emits `key=value` lines and, on failure, a single `NEXT=` action:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
AGENT_BROWSER=0.33.2
|
|
195
|
+
VERSION_OK=yes
|
|
196
|
+
PLUGIN=registered
|
|
197
|
+
GLOBAL_DEFAULT=no
|
|
198
|
+
NATIVE_HOST=/Users/me/.panerelay/bin/panerelay-native-host.cjs
|
|
199
|
+
EXTENSION=connected
|
|
200
|
+
TABS=2
|
|
201
|
+
READY=yes
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Add `--deep` to also run `@panerelay/setup doctor` (needs npx + network).
|
|
205
|
+
|
|
206
|
+
### Prove which browser you are actually driving
|
|
207
|
+
|
|
208
|
+
The decisive test, because both paths otherwise look identical. The real
|
|
209
|
+
browser reports its own version; the bundled one reports `HeadlessChrome`
|
|
210
|
+
at whatever version `agent-browser` ships:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
agent-browser --session panerelay-task --provider panerelay eval "navigator.userAgent"
|
|
214
|
+
# "…Chrome/150.0.0.0 Safari/537.36" ← the user's real browser
|
|
215
|
+
|
|
216
|
+
agent-browser eval "navigator.userAgent"
|
|
217
|
+
# "…HeadlessChrome/149.0.0.0 Safari/537.36" ← bundled Chrome for Testing
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
If both report `HeadlessChrome`, the `--provider panerelay` flag did not
|
|
221
|
+
take effect — re-check `PLUGIN=registered`.
|
|
222
|
+
|
|
223
|
+
## Use it
|
|
224
|
+
|
|
225
|
+
Every command takes the same flags; only the transport differs:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
agent-browser --session panerelay-task --provider panerelay tab list
|
|
229
|
+
agent-browser --session panerelay-task --provider panerelay open https://internal.example.com
|
|
230
|
+
agent-browser --session panerelay-task --provider panerelay snapshot -i
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Use a stable `--session` name so the browser attachment persists across
|
|
234
|
+
commands.
|
|
235
|
+
|
|
236
|
+
## Picking a browser when several are registered
|
|
237
|
+
|
|
238
|
+
The extension registers **once per running browser process**. With more than
|
|
239
|
+
one registered and ready, the plugin refuses to guess and fails the call.
|
|
240
|
+
Select explicitly:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
PANERELAY_BROWSER_ID=6f3f7c23-8ad1-4764-8045-e5d6ce4b08f4 \
|
|
244
|
+
agent-browser --session panerelay-task --provider panerelay tab list
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Get the candidate IDs from `check-panerelay.sh`, which prints one
|
|
248
|
+
`BROWSER_ID=` line per registration. There is no way to tell them apart by
|
|
249
|
+
ID alone — try each; the right one lists your real tabs. The others
|
|
250
|
+
typically show only `about:blank` (an empty window) or fail with
|
|
251
|
+
`CDP error (Target.createTarget): No current window` (a registration whose
|
|
252
|
+
window is gone). Alternatively set a default in the side panel.
|
|
253
|
+
|
|
254
|
+
> **The error you will actually see is useless.** `agent-browser` collapses
|
|
255
|
+
> every plugin failure to `✗ Plugin 'panerelay' returned success=false` and
|
|
256
|
+
> discards the plugin's message. Recover the real one by speaking the
|
|
257
|
+
> protocol to the native host directly:
|
|
258
|
+
>
|
|
259
|
+
> ```bash
|
|
260
|
+
> echo '{"protocol":"agent-browser.plugin.v1","type":"browser.launch","capability":"browser.provider","request":{"sessionName":"probe"}}' \
|
|
261
|
+
> | node ~/.panerelay/bin/panerelay-native-host.cjs --agent-browser-plugin
|
|
262
|
+
> ```
|
|
263
|
+
>
|
|
264
|
+
> `check-panerelay.sh` does this automatically on probe failure.
|
|
265
|
+
|
|
266
|
+
Note that `@panerelay/setup doctor` reports this state as a healthy
|
|
267
|
+
✅ `Extension — Connected through 3 browser processes`. Connected is not the
|
|
268
|
+
same as unambiguous: doctor can pass while every `--provider panerelay`
|
|
269
|
+
call fails.
|
|
270
|
+
|
|
271
|
+
## Troubleshooting
|
|
272
|
+
|
|
273
|
+
| Symptom | Cause / fix |
|
|
274
|
+
|---|---|
|
|
275
|
+
| `Plugin 'panerelay' returned success=false` (no detail) | Generic wrapper for any plugin error. Query the native host directly (above) or run `check-panerelay.sh` to get the real message. Most often multiple ready browsers. |
|
|
276
|
+
| `Multiple Panerelay browsers are ready` | Several browser processes carry the extension. Set `PANERELAY_BROWSER_ID` — see the section above. |
|
|
277
|
+
| Still fails right after fixing the real cause | The session daemon **sticks to the browser it first resolved**. Re-run under a fresh `--session` name. Do **not** use `close --all` to clear it — it is not session-scoped and closes every session, including unrelated ones. |
|
|
278
|
+
| `CDP error (Target.createTarget): No current window` | That `PANERELAY_BROWSER_ID` names a registration whose window has closed. Pick another. |
|
|
279
|
+
| `Creating a new tab requires all-tabs authorization` | Panerelay defaults to **per-tab** consent. Open the side panel and authorize all tabs, or drive an already-authorized tab. Safe to grant inside a dedicated profile. |
|
|
280
|
+
| `Extension is not currently connected` | Extension not installed in the profile, or its side panel was never opened. Open the panel. |
|
|
281
|
+
| `--provider` rejected / unknown | CLI older than 0.33.0. `--provider <plugin name>` support is required. |
|
|
282
|
+
| Commands hit the wrong browser | The `--provider panerelay` flag was dropped. Confirm with the userAgent test above. |
|
|
283
|
+
| Works in one profile, not another | Expected — the extension is per-profile. Install it where you need it. |
|
|
284
|
+
|
|
285
|
+
## Rollback
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
npx --yes @panerelay/setup uninstall
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Removes the native host and the plugin registration. Then remove the
|
|
292
|
+
extension from the browser profile, and delete the dedicated profile
|
|
293
|
+
directory if one was created for this.
|
|
294
|
+
|
|
295
|
+
## Related
|
|
296
|
+
|
|
297
|
+
- Default bundled-browser workflow: [`web.md`](web.md)
|
|
298
|
+
- Electron apps: [`electron.md`](electron.md)
|
|
299
|
+
- Connectivity test: [`../scripts/check-panerelay.sh`](../scripts/check-panerelay.sh)
|