@blackbelt-technology/pi-dashboard-extension 0.11.0 → 0.12.1

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.
Files changed (79) hide show
  1. package/.pi/skills/browser/SKILL.md +34 -16
  2. package/.pi/skills/browser/UPSTREAM.md +7 -6
  3. package/.pi/skills/browser/references/desktop.md +120 -0
  4. package/.pi/skills/browser/references/electron.md +2 -2
  5. package/.pi/skills/browser/references/web.agent.md +342 -166
  6. package/.pi/skills/browser/references/web.md +1003 -528
  7. package/.pi/skills/doctor/SKILL.md +1 -1
  8. package/.pi/skills/doctor/_lib/checks.ts +2 -3
  9. package/.pi/skills/doctor/_lib/derive-tokens.ts +1 -1
  10. package/.pi/skills/doctor/modules/peers.knowledge.hash +1 -1
  11. package/.pi/skills/doctor/modules/peers.md +21 -25
  12. package/.pi/skills/doctor/modules/plugins-bridges.md +5 -4
  13. package/.pi/skills/pi-dashboard/SKILL.md +6 -6
  14. package/.pi/skills/pi-dashboard/commands/dashboard-flow-abort.md +3 -1
  15. package/.pi/skills/pi-dashboard/commands/dashboard-session-spawn.md +2 -2
  16. package/.pi/skills/pi-dashboard/references/api-reference.agent.md +3 -3
  17. package/.pi/skills/pi-dashboard/references/api-reference.md +44 -11
  18. package/.pi/skills/pi-dashboard/references/recipes.md +9 -2
  19. package/.pi/skills/pi-dashboard/references/slash-commands.md +0 -1
  20. package/.pi/skills/pi-dashboard/scripts/dashboard-api.sh +3 -1
  21. package/.pi/skills/pi-dashboard/scripts/dashboard-bus.ts +12 -12
  22. package/.pi/skills/pi-dashboard/scripts/spawn-command.ts +40 -0
  23. package/package.json +16 -9
  24. package/src/bridge-context.ts +6 -0
  25. package/src/bridge-handlers/dispatch.ts +54 -69
  26. package/src/bridge-handlers/forwarders.ts +19 -42
  27. package/src/bridge-handlers/instance.ts +21 -12
  28. package/src/bridge-handlers/lifecycle.ts +84 -40
  29. package/src/bridge-shutdown.ts +44 -0
  30. package/src/bridge.ts +272 -260
  31. package/src/command-handler.ts +26 -31
  32. package/src/connection.ts +123 -31
  33. package/src/credential-guard.ts +300 -0
  34. package/src/custom-entry-forward.ts +27 -18
  35. package/src/default-model-apply.ts +83 -0
  36. package/src/flow-event-wiring.ts +19 -95
  37. package/src/followup-drain.ts +19 -5
  38. package/src/path-gate/decide.ts +68 -5
  39. package/src/path-gate/handler.ts +16 -8
  40. package/src/path-gate/index.ts +2 -2
  41. package/src/path-gate/roots.ts +15 -3
  42. package/src/path-gate/suppression.ts +3 -0
  43. package/src/pi-env.d.ts +8 -1
  44. package/src/pi-retry-settings.ts +11 -2
  45. package/src/plugin-event-forward-registry.ts +90 -14
  46. package/src/preview-path-link.ts +151 -0
  47. package/src/project-init/scaffold.ts +98 -35
  48. package/src/project-trust.ts +24 -15
  49. package/src/provider-model-cache.ts +118 -0
  50. package/src/provider-register.ts +428 -28
  51. package/src/retry-tracker.ts +90 -7
  52. package/src/role-manager.ts +4 -2
  53. package/src/role-model-tools.ts +21 -4
  54. package/src/server-auto-start.ts +68 -2
  55. package/src/server-launcher.ts +26 -8
  56. package/src/session-sync.ts +11 -12
  57. package/src/spawn-new-session.ts +22 -0
  58. package/src/steer-buffer.ts +164 -0
  59. package/src/stream-forward-buffer.ts +64 -15
  60. package/src/sudo-askpass/config-reader.ts +32 -0
  61. package/src/sudo-askpass/controller.ts +405 -0
  62. package/src/sudo-askpass/helper-script.ts +69 -0
  63. package/src/sudo-askpass/in-flight.ts +79 -0
  64. package/src/sudo-askpass/index.ts +11 -0
  65. package/src/sudo-askpass/install.ts +143 -0
  66. package/src/sudo-askpass/password-cache.ts +118 -0
  67. package/src/sudo-askpass/prompt-text.ts +55 -0
  68. package/src/sudo-askpass/protocol.ts +18 -0
  69. package/src/sudo-askpass/sudo-mask-registry.ts +52 -0
  70. package/src/terminal-reload.ts +19 -5
  71. package/src/tool-update-filter-registry.ts +210 -0
  72. package/src/vault-redaction.ts +4 -3
  73. package/.pi/skills/pi-dashboard/commands/dashboard-flow-auto.md +0 -10
  74. package/src/subagent-fanout-admission.ts +0 -234
  75. package/src/subagent-forward-sites.ts +0 -69
  76. package/src/subagent-frame-buffer.ts +0 -245
  77. package/src/subagent-frame-strip.ts +0 -109
  78. package/src/subagent-saturation.ts +0 -196
  79. package/src/subagent-tick-throttle.ts +0 -252
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: browser
3
- description: 'Browser automation via the `agent-browser` CLI. Use when the user needs to drive websites or Electron apps — navigating, forms, clicks, screenshots, data extraction, testing web apps, UI checks, the dashboard Electron shell, or the user''s own logged-in Chrome via the browser relay or Panerelay (SSO/2FA). Triggers: "open a website", "take a screenshot", "test this web app", "use my own browser".'
3
+ description: 'Browser automation via the `agent-browser` CLI: drive websites or Electron apps (forms, clicks, screenshots, scraping, web-app/UI tests, the dashboard Electron shell) or the user''s own logged-in Chrome via browser relay/Panerelay (SSO/2FA); native desktop apps route to agent-desktop. Triggers: "open a website", "take a screenshot", "test this web app", "use my own browser", "control my desktop".'
4
4
  license: Apache-2.0
5
5
  allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*), Bash(npx @panerelay/setup:*), Bash(curl:*), Bash(pi-dashboard:*)
6
6
  metadata:
7
7
  author: pi-dashboard
8
- version: "1.2"
8
+ version: "1.3"
9
9
  vendoredFrom: agent-browser
10
- vendoredVersion: "0.27.0"
11
- verifiedAgainstCli: "0.33.2"
10
+ vendoredVersion: "0.41.2"
11
+ verifiedAgainstCli: "0.41.2"
12
12
  ---
13
13
 
14
14
  # browser
@@ -34,6 +34,12 @@ Three recipes:
34
34
  there is no loopback dashboard. Reference:
35
35
  [`references/own-browser.md`](references/own-browser.md).
36
36
 
37
+ **Native desktop apps** (Finder, Calculator, any non-web UI — "control my
38
+ desktop") are out of scope for `agent-browser`: use `agent-desktop` and read
39
+ [`references/desktop.md`](references/desktop.md) first — install, and the
40
+ macOS Accessibility/Screen Recording trap (permission belongs to
41
+ `pi-dashboard.app`, which must be code-signed).
42
+
37
43
  ## Step 0a — Preflight: `agent-browser` CLI must be installed
38
44
 
39
45
  The skill does **not** bundle the CLI. Verify it through the dashboard tool
@@ -140,24 +146,36 @@ switch `--session`, `--profile`, or provider, and do not run `close --all`.
140
146
 
141
147
  - **Vendoring**: `references/web.md` and `references/electron.md` are
142
148
  snapshots of upstream `agent-browser` skill content (`core` and
143
- `electron`) at CLI version 0.27.0. See [`UPSTREAM.md`](UPSTREAM.md) for
149
+ `electron`) at CLI version 0.41.2. Other upstream skills (`dogfood`,
150
+ `derive-client`, `slack`, `webmcp-gen`, …) are not vendored — load on
151
+ demand with `agent-browser skills list` / `agent-browser skills get <name>`. See [`UPSTREAM.md`](UPSTREAM.md) for
144
152
  refresh procedure and [`LICENSE`](LICENSE) for upstream attribution.
145
- `references/own-browser.md`, `references/dashboard-relay.md`, and
146
- `references/challenge.md` are **authored, not vendored** — an upstream
153
+ `references/own-browser.md`, `references/dashboard-relay.md`,
154
+ `references/challenge.md`, and `references/desktop.md` are **authored, not vendored** — an upstream
147
155
  refresh must not overwrite them.
148
156
  - **Login-state recipes**: `references/dashboard-relay.md` is the preferred
149
157
  path (Pi Dashboard browser relay); `references/own-browser.md` is the legacy
150
158
  Panerelay/native-messaging path for remote sessions with no loopback
151
159
  dashboard.
152
- - **Surfaces share one browser**: the `browser` MCP tool and
153
- `Bash: agent-browser …` drive the *same* daemon and *same* Chrome, with a
154
- shared active page. Probing with one mid-task can silently move the page
155
- out from under the other. Pick one surface per task; use
156
- `--session <name>` for genuinely isolated browsers.
157
- - **Known wrapper bug**: the MCP tool's `eval` echoes the JS source instead
158
- of executing it (and mangles regex escapes) — still present with CLI
159
- 0.33.2, so it is a `pi-agent-browser` wrapper defect, not a CLI one. Use
160
- `Bash: agent-browser eval …` instead.
160
+ - **Three surfaces, one browser**: the `browser` tool (`pi-agent-browser`
161
+ extension), the native MCP server (`agent-browser mcp`, see below) and
162
+ `Bash: agent-browser …` all drive the *same* daemon and *same* Chrome per
163
+ session name, with a shared active page. Probing with one mid-task can
164
+ silently move the page out from under another. Pick one surface per task;
165
+ use `--session <name>` (MCP: `"session"` arg) for isolated browsers.
166
+ - **Known wrapper bug**: the `browser` tool's `eval` echoes the JS source
167
+ instead of executing it (and mangles regex escapes) — still present with
168
+ CLI 0.41.2 / `pi-agent-browser` 0.1.0, a wrapper defect. Use the native MCP
169
+ `agent_browser_eval` or `Bash: agent-browser eval …` instead.
170
+ - **Native MCP server (optional)**: `agent-browser mcp [--tools <profiles>]`
171
+ exposes typed `agent_browser_*` tools over stdio. Profiles: `core`
172
+ (default, small), `network`, `state`, `debug`, `tabs`, `react`, `mobile`,
173
+ `all` (~156 tools). Register in `~/.pi/agent/mcp.json`:
174
+ `{"mcpServers":{"agent-browser":{"type":"stdio","command":"agent-browser","args":["mcp","--tools","core"]}}}`
175
+ (use an absolute `command` path under nvm). Call via
176
+ `mcp({tool:"agent_browser_open", args:{url, session}})`. Each response
177
+ carries ~1 KB `structuredContent` lifecycle JSON — prefer the CLI for long
178
+ loops. One-shot without a stdio session: `agent-browser mcp call <tool> '<json>'`.
161
179
  - **No CLI bundled**: agents installing the bridge extension get the
162
180
  skill text but not the CLI; install on demand per Step 0a.
163
181
  - **User-local override**: if the user's project has its own
@@ -9,18 +9,19 @@ section in `electron.md` are project-specific and not from upstream.
9
9
  `references/own-browser.md` and `scripts/check-panerelay.sh` are authored
10
10
  for this repo (the Panerelay / own-logged-in-browser recipe).
11
11
  `references/challenge.md` is authored for this repo too — the pause / resume
12
- discipline for interactive anti-bot challenges. None of them has an upstream
13
- counterpart.
12
+ discipline for interactive anti-bot challenges. `references/desktop.md` is
13
+ authored too — agent-desktop install + macOS TCC permission recipe. None of
14
+ them has an upstream counterpart.
14
15
 
15
16
  | Field | Value |
16
17
  |------------------------|--------------------------------------------------------------------|
17
18
  | Upstream repo | https://github.com/vercel-labs/agent-browser |
18
- | Upstream tag | `v0.27.0` |
19
- | Upstream commit SHA | `c830d1b67dc18b754e305859f0ae587f858a1447` |
20
- | `agent-browser` CLI | `0.27.0` |
19
+ | Upstream tag | `v0.41.2` |
20
+ | Upstream commit SHA | `d52a5e90c372ec4710c69adc3837ac14bbd852aa` |
21
+ | `agent-browser` CLI | `0.41.2` |
21
22
  | Source-of-truth files | `skills/agent-browser/SKILL.md` (discovery stub) + CLI-served `core` and `electron` skills |
22
23
  | Capture commands | `agent-browser skills get core --full`<br>`agent-browser skills get electron` |
23
- | Refreshed | `2026-05-28` |
24
+ | Refreshed | `2026-11-07` |
24
25
  | License | Apache-2.0 (see [`LICENSE`](LICENSE)) |
25
26
 
26
27
  ## How to refresh
@@ -0,0 +1,120 @@
1
+ # Native desktop control (agent-desktop) — install + macOS permissions
2
+
3
+ > AUTHORED for this repo (not vendored). Covers installing
4
+ > [`agent-desktop`](https://agent-browser.dev/desktop) and getting macOS
5
+ > Accessibility / Screen Recording to actually stick when pi runs under the
6
+ > Pi Dashboard. Web pages stay on `agent-browser` (`web.md`); Electron web
7
+ > contents stay on `electron.md`.
8
+
9
+ `agent-desktop` reads a native app's accessibility tree and returns JSON with
10
+ `@<snapshot>:eN` refs. Loop: snapshot (skeleton) → drill → act on ref → read
11
+ again to verify. No model inside; one JSON envelope per command.
12
+
13
+ ## 1. Install + preflight
14
+
15
+ Ask the user before installing (global npm install = their choice):
16
+
17
+ ```bash
18
+ npm install -g agent-desktop # macOS / Windows / Linux
19
+ agent-desktop status | jq -c '.data.permissions | map_values(.state)'
20
+ agent-desktop skills get desktop # upstream usage guide — load before driving apps
21
+ ```
22
+
23
+ - npm may warn `install-scripts … not yet covered by allowScripts` and skip
24
+ `postinstall`. The npm tarball already ships the native binaries; the CLI
25
+ works without it. Reinstall with `--allow-scripts=agent-desktop` only if a
26
+ binary is actually missing.
27
+ - Target: `{"accessibility":"granted","screen_recording":"granted"}`.
28
+ `automation: "unknown"` is fine.
29
+
30
+ ## 2. macOS: who must hold the permission?
31
+
32
+ TCC (the macOS privacy database) grants by **responsible process**, not by
33
+ the binary that calls the API. Under Pi Dashboard the chain is
34
+
35
+ ```
36
+ pi-dashboard.app → bundled node → pi (nvm node) → bash → agent-desktop
37
+ ```
38
+
39
+ and TCC charges every call to **`pi-dashboard.app`**
40
+ (`com.blackbelt-technology.pi-dashboard`) — even for sessions whose node
41
+ process has been reparented to `launchd` after a dashboard restart. Granting
42
+ Terminal, the bundled `node`, the nvm `node`, or the `agent-desktop` binary
43
+ does **nothing** for dashboard sessions. (Running pi from Terminal/iTerm
44
+ instead → that terminal app is responsible.)
45
+
46
+ So: grant **pi-dashboard** in System Settings → Privacy & Security →
47
+ **Accessibility** AND **Screen Recording**.
48
+
49
+ ```bash
50
+ agent-desktop permissions --guide # opens the right Settings pane
51
+ open "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"
52
+ ```
53
+
54
+ ## 3. Diagnose — read TCC's verdict, don't guess
55
+
56
+ The toggle UI lies (entry present but off, or on but unverifiable). Check the
57
+ database and the daemon log:
58
+
59
+ ```bash
60
+ # What is stored (auth_value 2 = allowed, 0 = denied/off). Readable without FDA.
61
+ sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" \
62
+ "select service,client,auth_value,datetime(last_modified,'unixepoch','localtime')
63
+ from access where client like '%pi-dashboard%' or client like '/%'"
64
+
65
+ # Who TCC thinks is responsible + why it said no
66
+ agent-desktop status >/dev/null 2>&1; sleep 2
67
+ log show --last 10s --info --debug \
68
+ --predicate 'subsystem == "com.apple.TCC" AND process == "tccd"' --style compact \
69
+ | grep -E 'AttributionChain|matchesCodeRequirement|Failed to match|AUTHREQ_RESULT' | cut -c1-400
70
+ ```
71
+
72
+ Read it as:
73
+
74
+ | Log / DB evidence | Meaning | Fix |
75
+ |---|---|---|
76
+ | `responsible_path=/Applications/pi-dashboard.app/...` | dashboard app is the subject | grant pi-dashboard (§2) |
77
+ | `SecStaticCodeCheckValidity … status: -67050` + `Failed to match existing code requirement` | app is **unsigned** (`codesign -dv` → "code object is not signed at all"); stored grant can never verify → always denied | §4 |
78
+ | DB row `kTCCServiceAccessibility … pi-dashboard … 0` | entry exists but toggle is **off** (common after re-adding) | switch it on, recheck |
79
+ | no pi-dashboard row at all | never granted | add with `+` |
80
+
81
+ ## 4. Fix: unsigned pi-dashboard.app
82
+
83
+ Release builds are not yet Developer-ID signed (OpenSpec change
84
+ `macos-notarization`). Until then, ad-hoc sign locally and re-grant:
85
+
86
+ ```bash
87
+ codesign -dv /Applications/pi-dashboard.app 2>&1 | head -2 # "not signed at all"?
88
+ codesign --force --deep --sign - /Applications/pi-dashboard.app
89
+ codesign --verify --deep /Applications/pi-dashboard.app && echo SIGNED_OK
90
+ tccutil reset Accessibility com.blackbelt-technology.pi-dashboard
91
+ tccutil reset ScreenCapture com.blackbelt-technology.pi-dashboard
92
+ ```
93
+
94
+ Then the user: quit + reopen pi-dashboard, enable it in **both** panes,
95
+ confirm. Re-run `agent-desktop status`.
96
+
97
+ - Ask before running — it modifies the installed app.
98
+ - Every dashboard update replaces the bundle → unsigned again → repeat §4.
99
+ - Restarting the app alone never fixes an unsigned-app denial.
100
+
101
+ ## 5. Verify
102
+
103
+ ```bash
104
+ agent-desktop status | jq -c '.data.permissions | map_values(.state)' # both "granted"
105
+ agent-desktop list-windows --app Finder
106
+ agent-desktop snapshot --app Finder --window-id <id> --skeleton -i --compact | jq -c '{ok}'
107
+ ```
108
+
109
+ `AMBIGUOUS_TARGET` = several windows match → pick one with `--window-id`
110
+ (from `list-windows`); not a permission problem.
111
+
112
+ ## Pitfalls
113
+
114
+ - Don't add broad interpreters (nvm `node`) to Accessibility as a "try
115
+ everything" step: it is useless under the dashboard (§2) and lets **any**
116
+ node script control the desktop. Remove leftovers.
117
+ - `agent-desktop` only sees UIs that publish an accessibility tree; no pixel
118
+ matching.
119
+ - Keep one surface per task; for Chromium/Electron web contents hand the
120
+ DevTools port to `agent-browser` (see `electron.md`).
@@ -1,7 +1,7 @@
1
1
  <!--
2
2
  Vendored from agent-browser upstream via `agent-browser skills get electron`
3
- at CLI version 0.27.0 (upstream tag v0.27.0,
4
- commit c830d1b67dc18b754e305859f0ae587f858a1447).
3
+ at CLI version 0.41.2 (upstream tag v0.41.2,
4
+ commit d52a5e90c372ec4710c69adc3837ac14bbd852aa).
5
5
  Frontmatter stripped — this is a reference doc, not a standalone skill.
6
6
  License: Apache-2.0 (see ../LICENSE).
7
7
  See ../UPSTREAM.md for refresh procedure.