@blackbelt-technology/pi-dashboard-extension 0.5.3 → 0.6.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.
Files changed (258) hide show
  1. package/.pi/skills/browser/LICENSE +201 -0
  2. package/.pi/skills/browser/SKILL.md +105 -0
  3. package/.pi/skills/browser/UPSTREAM.md +46 -0
  4. package/.pi/skills/browser/references/electron.md +351 -0
  5. package/.pi/skills/browser/references/web.md +2789 -0
  6. package/.pi/skills/browser/scripts/detect-dashboard.sh +55 -0
  7. package/.pi/skills/doctor/AGENTS.md +27 -0
  8. package/.pi/skills/doctor/SKILL.md +89 -0
  9. package/.pi/skills/doctor/_lib/checks.ts +177 -0
  10. package/.pi/skills/doctor/_lib/derive-tokens.ts +43 -0
  11. package/.pi/skills/doctor/_lib/front-matter.ts +122 -0
  12. package/.pi/skills/doctor/_lib/index.ts +14 -0
  13. package/.pi/skills/doctor/_lib/knowledge-hash.ts +74 -0
  14. package/.pi/skills/doctor/_lib/provenance.ts +50 -0
  15. package/.pi/skills/doctor/_lib/regenerate.ts +100 -0
  16. package/.pi/skills/doctor/_lib/router.ts +155 -0
  17. package/.pi/skills/doctor/_lib/server-tier.ts +62 -0
  18. package/.pi/skills/doctor/modules/build-reload.knowledge.hash +1 -0
  19. package/.pi/skills/doctor/modules/build-reload.md +51 -0
  20. package/.pi/skills/doctor/modules/env-node.knowledge.hash +1 -0
  21. package/.pi/skills/doctor/modules/env-node.md +49 -0
  22. package/.pi/skills/doctor/modules/install-topology.knowledge.hash +1 -0
  23. package/.pi/skills/doctor/modules/install-topology.md +53 -0
  24. package/.pi/skills/doctor/modules/model-resolution.knowledge.hash +1 -0
  25. package/.pi/skills/doctor/modules/model-resolution.md +53 -0
  26. package/.pi/skills/doctor/modules/peers.knowledge.hash +1 -0
  27. package/.pi/skills/doctor/modules/peers.md +57 -0
  28. package/.pi/skills/doctor/modules/pi-resolution.knowledge.hash +1 -0
  29. package/.pi/skills/doctor/modules/pi-resolution.md +60 -0
  30. package/.pi/skills/doctor/modules/plugins-bridges.knowledge.hash +1 -0
  31. package/.pi/skills/doctor/modules/plugins-bridges.md +56 -0
  32. package/.pi/skills/pi-dashboard/SKILL.md +68 -0
  33. package/.pi/skills/pi-dashboard/commands/README.md +45 -0
  34. package/.pi/skills/pi-dashboard/commands/dashboard-flow-abort.md +10 -0
  35. package/.pi/skills/pi-dashboard/commands/dashboard-flow-auto.md +10 -0
  36. package/.pi/skills/pi-dashboard/commands/dashboard-git-branches.md +6 -0
  37. package/.pi/skills/pi-dashboard/commands/dashboard-git-init.md +8 -0
  38. package/.pi/skills/pi-dashboard/commands/dashboard-git-stash-pop.md +8 -0
  39. package/.pi/skills/pi-dashboard/commands/dashboard-list-models.md +10 -0
  40. package/.pi/skills/pi-dashboard/commands/dashboard-peer-list.md +6 -0
  41. package/.pi/skills/pi-dashboard/commands/dashboard-peer-scan.md +6 -0
  42. package/.pi/skills/pi-dashboard/commands/dashboard-pin-list.md +5 -0
  43. package/.pi/skills/pi-dashboard/commands/dashboard-proposal-archive.md +6 -0
  44. package/.pi/skills/pi-dashboard/commands/dashboard-proposal-attach.md +10 -0
  45. package/.pi/skills/pi-dashboard/commands/dashboard-proposal-detach.md +10 -0
  46. package/.pi/skills/pi-dashboard/commands/dashboard-server-config.md +5 -0
  47. package/.pi/skills/pi-dashboard/commands/dashboard-server-health.md +6 -0
  48. package/.pi/skills/pi-dashboard/commands/dashboard-server-tunnel-off.md +6 -0
  49. package/.pi/skills/pi-dashboard/commands/dashboard-server-tunnel-on.md +6 -0
  50. package/.pi/skills/pi-dashboard/commands/dashboard-server-tunnel-status.md +6 -0
  51. package/.pi/skills/pi-dashboard/commands/dashboard-session-abort-all.md +14 -0
  52. package/.pi/skills/pi-dashboard/commands/dashboard-session-abort.md +10 -0
  53. package/.pi/skills/pi-dashboard/commands/dashboard-session-diff.md +11 -0
  54. package/.pi/skills/pi-dashboard/commands/dashboard-session-fork.md +10 -0
  55. package/.pi/skills/pi-dashboard/commands/dashboard-session-hide.md +10 -0
  56. package/.pi/skills/pi-dashboard/commands/dashboard-session-info.md +11 -0
  57. package/.pi/skills/pi-dashboard/commands/dashboard-session-kill.md +10 -0
  58. package/.pi/skills/pi-dashboard/commands/dashboard-session-list-active.md +8 -0
  59. package/.pi/skills/pi-dashboard/commands/dashboard-session-list-here.md +8 -0
  60. package/.pi/skills/pi-dashboard/commands/dashboard-session-list.md +6 -0
  61. package/.pi/skills/pi-dashboard/commands/dashboard-session-model.md +10 -0
  62. package/.pi/skills/pi-dashboard/commands/dashboard-session-rename.md +10 -0
  63. package/.pi/skills/pi-dashboard/commands/dashboard-session-resume.md +10 -0
  64. package/.pi/skills/pi-dashboard/commands/dashboard-session-spawn.md +10 -0
  65. package/.pi/skills/pi-dashboard/commands/dashboard-session-tell.md +10 -0
  66. package/.pi/skills/pi-dashboard/commands/dashboard-session-thinking.md +10 -0
  67. package/.pi/skills/pi-dashboard/commands/dashboard-session-unhide.md +10 -0
  68. package/.pi/skills/pi-dashboard/references/api-reference.md +30 -0
  69. package/.pi/skills/pi-dashboard/references/recipes.md +38 -0
  70. package/.pi/skills/pi-dashboard/references/slash-commands.md +71 -0
  71. package/.pi/skills/pi-dashboard/scripts/dashboard-api.sh +6 -0
  72. package/.pi/skills/pi-dashboard/scripts/dashboard-bus.ts +217 -0
  73. package/.pi/skills/project-init/SKILL.md +279 -0
  74. package/.pi/skills/project-init/dox-doctrine.md +104 -0
  75. package/.pi/skills/project-init/profiles/coding/AGENTS.md.tmpl +111 -0
  76. package/.pi/skills/project-init/profiles/coding/profile.json +5 -0
  77. package/.pi/skills/project-init/profiles/coding/prompts/plan-change.md +5 -0
  78. package/.pi/skills/project-init/profiles/coding/prompts/tdd-loop.md +6 -0
  79. package/.pi/skills/project-init/profiles/coding/settings.json.tmpl +9 -0
  80. package/.pi/skills/project-init/profiles/docs/AGENTS.md.tmpl +37 -0
  81. package/.pi/skills/project-init/profiles/docs/profile.json +4 -0
  82. package/.pi/skills/project-init/profiles/docs/prompts/draft-page.md +5 -0
  83. package/.pi/skills/project-init/profiles/docs/settings.json.tmpl +9 -0
  84. package/package.json +12 -4
  85. package/src/AGENTS.md +56 -0
  86. package/src/__tests__/abort-latch.test.ts +97 -0
  87. package/src/__tests__/agent-settled.test.ts +82 -0
  88. package/src/__tests__/artifact-roots.test.ts +83 -0
  89. package/src/__tests__/ask-user-attachments.test.ts +106 -0
  90. package/src/__tests__/ask-user-tool.test.ts +90 -27
  91. package/src/__tests__/auto-session-namer.test.ts +339 -0
  92. package/src/__tests__/bridge-default-model-apply.test.ts +242 -0
  93. package/src/__tests__/bridge-default-model-gate.test.ts +50 -0
  94. package/src/__tests__/bridge-followup-chat-order.test.ts +215 -0
  95. package/src/__tests__/bridge-followup-multi-entry.test.ts +202 -0
  96. package/src/__tests__/bridge-followup-mutation.test.ts +217 -0
  97. package/src/__tests__/bridge-followup-queue-drain.test.ts +266 -0
  98. package/src/__tests__/bridge-hasui-flip.test.ts +109 -0
  99. package/src/__tests__/bridge-no-queue-mutation.test.ts +112 -0
  100. package/src/__tests__/bridge-plugin-emit-event.test.ts +44 -0
  101. package/src/__tests__/bridge-queue-update-forward.test.ts +77 -0
  102. package/src/__tests__/bridge-shadow-queue-gate.test.ts +299 -0
  103. package/src/__tests__/bridge-shutdown-reset.test.ts +159 -0
  104. package/src/__tests__/bridge-slash-command-routing.test.ts +127 -31
  105. package/src/__tests__/bridge-stop-after-turn.test.ts +72 -0
  106. package/src/__tests__/bridge-system-followup.test.ts +163 -0
  107. package/src/__tests__/bridge-thinking-level-select.test.ts +68 -0
  108. package/src/__tests__/browser-skill-registered.test.ts +84 -0
  109. package/src/__tests__/build-provider-catalogue.test.ts +35 -1
  110. package/src/__tests__/command-handler.test.ts +427 -29
  111. package/src/__tests__/commit-draft.test.ts +100 -0
  112. package/src/__tests__/connection-dropped-frames.test.ts +78 -0
  113. package/src/__tests__/custom-provider-apikey-roundtrip.test.ts +128 -0
  114. package/src/__tests__/cwd-missing-probe.test.ts +82 -0
  115. package/src/__tests__/dashboard-commands-shipped.test.ts +53 -0
  116. package/src/__tests__/dashboard-context-injector.test.ts +190 -0
  117. package/src/__tests__/doctor/checks.test.ts +121 -0
  118. package/src/__tests__/doctor/modules.test.ts +64 -0
  119. package/src/__tests__/doctor/provenance-hash.test.ts +94 -0
  120. package/src/__tests__/doctor/router.test.ts +143 -0
  121. package/src/__tests__/empty-actionable-guard-config.test.ts +32 -0
  122. package/src/__tests__/empty-actionable-guard.test.ts +73 -0
  123. package/src/__tests__/enrich-model-metadata.test.ts +21 -0
  124. package/src/__tests__/extension-slash-command-detection.test.ts +37 -1
  125. package/src/__tests__/filter-enabled-models.test.ts +151 -0
  126. package/src/__tests__/fixtures/turn-actionability-fixtures.ts +69 -0
  127. package/src/__tests__/git-info-status.test.ts +73 -0
  128. package/src/__tests__/git-poll.test.ts +69 -0
  129. package/src/__tests__/markdown-image-inliner.test.ts +37 -0
  130. package/src/__tests__/model-resolve.test.ts +379 -0
  131. package/src/__tests__/pi-version-tracker.test.ts +109 -0
  132. package/src/__tests__/process-scanner.test.ts +112 -22
  133. package/src/__tests__/project-init-detect-stack.test.ts +61 -0
  134. package/src/__tests__/project-init-dox-kb-config.test.ts +53 -0
  135. package/src/__tests__/project-init-profiles.test.ts +84 -0
  136. package/src/__tests__/project-init-scaffold.test.ts +139 -0
  137. package/src/__tests__/project-init-seed-doctrine.test.ts +100 -0
  138. package/src/__tests__/project-trust.test.ts +92 -0
  139. package/src/__tests__/prompt-expander.test.ts +191 -1
  140. package/src/__tests__/provider-register-reload.test.ts +36 -6
  141. package/src/__tests__/provider-register-thinking-levels.test.ts +51 -0
  142. package/src/__tests__/retry-tracker.test.ts +75 -70
  143. package/src/__tests__/role-manager.test.ts +585 -0
  144. package/src/__tests__/role-model-tools-registry-readiness.test.ts +114 -0
  145. package/src/__tests__/role-model-tools.test.ts +229 -0
  146. package/src/__tests__/search-files-completeness.test.ts +111 -0
  147. package/src/__tests__/search-files-ranking.test.ts +168 -0
  148. package/src/__tests__/server-auto-start.test.ts +121 -4
  149. package/src/__tests__/server-launcher-launch.test.ts +24 -6
  150. package/src/__tests__/server-launcher.test.ts +19 -2
  151. package/src/__tests__/session-sync.test.ts +36 -0
  152. package/src/__tests__/source-detector.test.ts +15 -0
  153. package/src/__tests__/subagent-frame-buffer.test.ts +239 -0
  154. package/src/__tests__/tool-result-image-inliner.test.ts +206 -0
  155. package/src/__tests__/tui-prompt-adapter.test.ts +70 -64
  156. package/src/__tests__/turn-actionability.test.ts +86 -0
  157. package/src/__tests__/vcs-info.test.ts +145 -4
  158. package/src/__tests__/visibility-intent.test.ts +43 -0
  159. package/src/abort-latch.ts +55 -0
  160. package/src/abort-latch.ts.AGENTS.md +3 -0
  161. package/src/agent-settled.ts +72 -0
  162. package/src/agent-settled.ts.AGENTS.md +3 -0
  163. package/src/artifact-roots.ts +73 -0
  164. package/src/artifact-roots.ts.AGENTS.md +3 -0
  165. package/src/ask-user-attachments.ts +121 -0
  166. package/src/ask-user-attachments.ts.AGENTS.md +3 -0
  167. package/src/ask-user-tool.ts +56 -58
  168. package/src/ask-user-tool.ts.AGENTS.md +3 -0
  169. package/src/auto-session-namer.ts +334 -0
  170. package/src/auto-session-namer.ts.AGENTS.md +3 -0
  171. package/src/bridge-context.ts +86 -8
  172. package/src/bridge-context.ts.AGENTS.md +3 -0
  173. package/src/bridge-default-model-gate.ts +48 -0
  174. package/src/bridge-default-model-gate.ts.AGENTS.md +3 -0
  175. package/src/bridge.ts +1373 -213
  176. package/src/bridge.ts.AGENTS.md +3 -0
  177. package/src/canvas-tool.ts +107 -0
  178. package/src/command-handler.ts +527 -42
  179. package/src/command-handler.ts.AGENTS.md +3 -0
  180. package/src/commit-draft-agent.ts +114 -0
  181. package/src/commit-draft-agent.ts.AGENTS.md +3 -0
  182. package/src/commit-draft.ts +136 -0
  183. package/src/commit-draft.ts.AGENTS.md +3 -0
  184. package/src/connection.ts +32 -1
  185. package/src/connection.ts.AGENTS.md +3 -0
  186. package/src/dashboard-context-injector.ts +124 -0
  187. package/src/dashboard-context-injector.ts.AGENTS.md +3 -0
  188. package/src/dashboard-default-adapter.ts +5 -0
  189. package/src/dashboard-default-adapter.ts.AGENTS.md +3 -0
  190. package/src/dev-build.ts.AGENTS.md +3 -0
  191. package/src/empty-actionable-guard-config.ts +32 -0
  192. package/src/empty-actionable-guard-config.ts.AGENTS.md +3 -0
  193. package/src/empty-actionable-guard.ts +90 -0
  194. package/src/empty-actionable-guard.ts.AGENTS.md +3 -0
  195. package/src/event-forwarder.ts.AGENTS.md +3 -0
  196. package/src/flow-event-wiring.ts +4 -14
  197. package/src/flow-event-wiring.ts.AGENTS.md +3 -0
  198. package/src/git-link-builder.ts.AGENTS.md +3 -0
  199. package/src/git-poll.ts +38 -0
  200. package/src/git-poll.ts.AGENTS.md +3 -0
  201. package/src/hasui-flip.ts +56 -0
  202. package/src/hasui-flip.ts.AGENTS.md +3 -0
  203. package/src/markdown-image-inliner.ts +45 -2
  204. package/src/markdown-image-inliner.ts.AGENTS.md +3 -0
  205. package/src/model-tracker.ts +145 -19
  206. package/src/model-tracker.ts.AGENTS.md +3 -0
  207. package/src/multiselect-decode.ts.AGENTS.md +3 -0
  208. package/src/multiselect-list.ts.AGENTS.md +3 -0
  209. package/src/multiselect-polyfill.ts.AGENTS.md +3 -0
  210. package/src/process-metrics.ts.AGENTS.md +3 -0
  211. package/src/process-scanner.ts +114 -103
  212. package/src/process-scanner.ts.AGENTS.md +3 -0
  213. package/src/project-init/AGENTS.md +12 -0
  214. package/src/project-init/detect-stack.ts +146 -0
  215. package/src/project-init/dox-kb-config.ts +47 -0
  216. package/src/project-init/profiles.ts +135 -0
  217. package/src/project-init/scaffold.ts +192 -0
  218. package/src/project-init/seed-doctrine.ts +95 -0
  219. package/src/project-trust.ts +63 -0
  220. package/src/project-trust.ts.AGENTS.md +3 -0
  221. package/src/prompt-bus.ts +25 -1
  222. package/src/prompt-bus.ts.AGENTS.md +3 -0
  223. package/src/prompt-expander.ts +238 -37
  224. package/src/prompt-expander.ts.AGENTS.md +3 -0
  225. package/src/provider-register.ts +323 -54
  226. package/src/provider-register.ts.AGENTS.md +3 -0
  227. package/src/retry-tracker.ts +64 -39
  228. package/src/retry-tracker.ts.AGENTS.md +3 -0
  229. package/src/role-manager.ts +436 -0
  230. package/src/role-manager.ts.AGENTS.md +3 -0
  231. package/src/role-model-tools.ts +301 -0
  232. package/src/role-model-tools.ts.AGENTS.md +3 -0
  233. package/src/server-auto-start.ts +59 -23
  234. package/src/server-auto-start.ts.AGENTS.md +3 -0
  235. package/src/server-launcher.ts +56 -16
  236. package/src/server-launcher.ts.AGENTS.md +3 -0
  237. package/src/session-sync.ts +111 -15
  238. package/src/session-sync.ts.AGENTS.md +3 -0
  239. package/src/slash-dispatch.ts +32 -15
  240. package/src/slash-dispatch.ts.AGENTS.md +3 -0
  241. package/src/source-detector.ts +13 -5
  242. package/src/source-detector.ts.AGENTS.md +3 -0
  243. package/src/subagent-frame-buffer.ts +220 -0
  244. package/src/subagent-frame-buffer.ts.AGENTS.md +3 -0
  245. package/src/tool-result-image-inliner.ts +204 -0
  246. package/src/tool-result-image-inliner.ts.AGENTS.md +3 -0
  247. package/src/tui-prompt-adapter.ts +123 -0
  248. package/src/tui-prompt-adapter.ts.AGENTS.md +3 -0
  249. package/src/turn-actionability.ts +117 -0
  250. package/src/turn-actionability.ts.AGENTS.md +3 -0
  251. package/src/ui-modules.ts.AGENTS.md +3 -0
  252. package/src/vcs-info.ts +91 -129
  253. package/src/vcs-info.ts.AGENTS.md +3 -0
  254. package/src/visibility-intent.ts +34 -0
  255. package/src/visibility-intent.ts.AGENTS.md +3 -0
  256. package/src/__tests__/usage-limit-orderer.test.ts +0 -105
  257. package/src/__tests__/vcs-info-jj.test.ts +0 -145
  258. package/src/usage-limit-orderer.ts +0 -76
@@ -0,0 +1,351 @@
1
+ <!--
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).
5
+ Frontmatter stripped — this is a reference doc, not a standalone skill.
6
+ License: Apache-2.0 (see ../LICENSE).
7
+ See ../UPSTREAM.md for refresh procedure.
8
+ -->
9
+
10
+
11
+ # Electron App Automation
12
+
13
+ Automate any Electron desktop app using agent-browser. Electron apps are built on Chromium and expose a Chrome DevTools Protocol (CDP) port that agent-browser can connect to, enabling the same snapshot-interact workflow used for web pages.
14
+
15
+ ## Core Workflow
16
+
17
+ 1. **Launch** the Electron app with remote debugging enabled
18
+ 2. **Connect** agent-browser to the CDP port
19
+ 3. **Snapshot** to discover interactive elements
20
+ 4. **Interact** using element refs
21
+ 5. **Re-snapshot** after navigation or state changes
22
+
23
+ ```bash
24
+ # Launch an Electron app with remote debugging
25
+ open -a "Slack" --args --remote-debugging-port=9222
26
+
27
+ # Connect agent-browser to the app
28
+ agent-browser connect 9222
29
+
30
+ # Standard workflow from here
31
+ agent-browser snapshot -i
32
+ agent-browser click @e5
33
+ agent-browser screenshot slack-desktop.png
34
+ ```
35
+
36
+ ## Launching Electron Apps with CDP
37
+
38
+ Every Electron app supports the `--remote-debugging-port` flag since it's built into Chromium.
39
+
40
+ ### macOS
41
+
42
+ ```bash
43
+ # Slack
44
+ open -a "Slack" --args --remote-debugging-port=9222
45
+
46
+ # VS Code
47
+ open -a "Visual Studio Code" --args --remote-debugging-port=9223
48
+
49
+ # Discord
50
+ open -a "Discord" --args --remote-debugging-port=9224
51
+
52
+ # Figma
53
+ open -a "Figma" --args --remote-debugging-port=9225
54
+
55
+ # Notion
56
+ open -a "Notion" --args --remote-debugging-port=9226
57
+
58
+ # Spotify
59
+ open -a "Spotify" --args --remote-debugging-port=9227
60
+ ```
61
+
62
+ ### Linux
63
+
64
+ ```bash
65
+ slack --remote-debugging-port=9222
66
+ code --remote-debugging-port=9223
67
+ discord --remote-debugging-port=9224
68
+ ```
69
+
70
+ ### Windows
71
+
72
+ ```bash
73
+ "C:\Users\%USERNAME%\AppData\Local\slack\slack.exe" --remote-debugging-port=9222
74
+ "C:\Users\%USERNAME%\AppData\Local\Programs\Microsoft VS Code\Code.exe" --remote-debugging-port=9223
75
+ ```
76
+
77
+ **Important:** If the app is already running, quit it first, then relaunch with the flag. The `--remote-debugging-port` flag must be present at launch time.
78
+
79
+ ## Connecting
80
+
81
+ ```bash
82
+ # Connect to a specific port
83
+ agent-browser connect 9222
84
+
85
+ # Or use --cdp on each command
86
+ agent-browser --cdp 9222 snapshot -i
87
+
88
+ # Auto-discover a running Chromium-based app
89
+ agent-browser --auto-connect snapshot -i
90
+ ```
91
+
92
+ After `connect`, all subsequent commands target the connected app without needing `--cdp`.
93
+
94
+ ## Tab Management
95
+
96
+ Electron apps often have multiple windows or webviews. Use tab commands to list and switch between them:
97
+
98
+ ```bash
99
+ # List all available targets (windows, webviews, etc.)
100
+ agent-browser tab
101
+
102
+ # Switch to a specific tab by index
103
+ agent-browser tab 2
104
+
105
+ # Switch by URL pattern
106
+ agent-browser tab --url "*settings*"
107
+ ```
108
+
109
+ ## Webview Support
110
+
111
+ Electron `<webview>` elements are automatically discovered and can be controlled like regular pages. Webviews appear as separate targets in the tab list with `type: "webview"`:
112
+
113
+ ```bash
114
+ # Connect to running Electron app
115
+ agent-browser connect 9222
116
+
117
+ # List targets -- webviews appear alongside pages
118
+ agent-browser tab
119
+ # Example output:
120
+ # 0: [page] Slack - Main Window https://app.slack.com/
121
+ # 1: [webview] Embedded Content https://example.com/widget
122
+
123
+ # Switch to a webview
124
+ agent-browser tab 1
125
+
126
+ # Interact with the webview normally
127
+ agent-browser snapshot -i
128
+ agent-browser click @e3
129
+ agent-browser screenshot webview.png
130
+ ```
131
+
132
+ **Note:** Webview support works via raw CDP connection.
133
+
134
+ ## Common Patterns
135
+
136
+ ### Inspect and Navigate an App
137
+
138
+ ```bash
139
+ open -a "Slack" --args --remote-debugging-port=9222
140
+ sleep 3 # Wait for app to start
141
+ agent-browser connect 9222
142
+ agent-browser snapshot -i
143
+ # Read the snapshot output to identify UI elements
144
+ agent-browser click @e10 # Navigate to a section
145
+ agent-browser snapshot -i # Re-snapshot after navigation
146
+ ```
147
+
148
+ ### Take Screenshots of Desktop Apps
149
+
150
+ ```bash
151
+ agent-browser connect 9222
152
+ agent-browser screenshot app-state.png
153
+ agent-browser screenshot --full full-app.png
154
+ agent-browser screenshot --annotate annotated-app.png
155
+ ```
156
+
157
+ ### Extract Data from a Desktop App
158
+
159
+ ```bash
160
+ agent-browser connect 9222
161
+ agent-browser snapshot -i
162
+ agent-browser get text @e5
163
+ agent-browser snapshot --json > app-state.json
164
+ ```
165
+
166
+ ### Fill Forms in Desktop Apps
167
+
168
+ ```bash
169
+ agent-browser connect 9222
170
+ agent-browser snapshot -i
171
+ agent-browser fill @e3 "search query"
172
+ agent-browser press Enter
173
+ agent-browser wait 1000
174
+ agent-browser snapshot -i
175
+ ```
176
+
177
+ ### Run Multiple Apps Simultaneously
178
+
179
+ Use named sessions to control multiple Electron apps at the same time:
180
+
181
+ ```bash
182
+ # Connect to Slack
183
+ agent-browser --session slack connect 9222
184
+
185
+ # Connect to VS Code
186
+ agent-browser --session vscode connect 9223
187
+
188
+ # Interact with each independently
189
+ agent-browser --session slack snapshot -i
190
+ agent-browser --session vscode snapshot -i
191
+ ```
192
+
193
+ ## Color Scheme
194
+
195
+ The default color scheme when connecting via CDP may be `light`. To preserve dark mode:
196
+
197
+ ```bash
198
+ agent-browser connect 9222
199
+ agent-browser --color-scheme dark snapshot -i
200
+ ```
201
+
202
+ Or set it globally:
203
+
204
+ ```bash
205
+ AGENT_BROWSER_COLOR_SCHEME=dark agent-browser connect 9222
206
+ ```
207
+
208
+ ## Troubleshooting
209
+
210
+ ### "Connection refused" or "Cannot connect"
211
+
212
+ - Make sure the app was launched with `--remote-debugging-port=NNNN`
213
+ - If the app was already running, quit and relaunch with the flag
214
+ - Check that the port isn't in use by another process: `lsof -i :9222`
215
+
216
+ ### App launches but connect fails
217
+
218
+ - Wait a few seconds after launch before connecting (`sleep 3`)
219
+ - Some apps take time to initialize their webview
220
+
221
+ ### Elements not appearing in snapshot
222
+
223
+ - The app may use multiple webviews. Use `agent-browser tab` to list targets and switch to the right one
224
+
225
+ ### Cannot type in input fields
226
+
227
+ - Try `agent-browser keyboard type "text"` to type at the current focus without a selector
228
+ - Some Electron apps use custom input components; use `agent-browser keyboard inserttext "text"` to bypass key events
229
+
230
+ ## Supported Apps
231
+
232
+ Any app built on Electron works, including:
233
+
234
+ - **Communication:** Slack, Discord, Microsoft Teams, Signal, Telegram Desktop
235
+ - **Development:** VS Code, GitHub Desktop, Postman, Insomnia
236
+ - **Design:** Figma, Notion, Obsidian
237
+ - **Media:** Spotify, Tidal
238
+ - **Productivity:** Todoist, Linear, 1Password
239
+
240
+ If an app is built with Electron, it supports `--remote-debugging-port` and can be automated with agent-browser.
241
+
242
+ ---
243
+
244
+ ## Worked example: Pi Dashboard
245
+
246
+ The Pi Dashboard Electron app supports an opt-in CDP debug surface so you can
247
+ drive the *installed shell* — not just a separate Chrome aimed at
248
+ `http://localhost:8000`. The wizard window, doctor window, tray menu, native
249
+ menus, and IPC are all reachable this way.
250
+
251
+ > **Single-instance contract**: enabling CDP requires fully quitting and
252
+ > relaunching the app. Passing `--debug-cdp` to a running instance only
253
+ > logs a warning to the running instance's stderr — Chromium stands up the
254
+ > CDP server during browser-process init, with no API to enable it later.
255
+
256
+ ### 1. Launch with CDP enabled
257
+
258
+ The app accepts either an `--debug-cdp` CLI flag or a `PI_DEBUG_CDP` env var.
259
+ The flag takes precedence; default port is `9222`.
260
+
261
+ **macOS:**
262
+
263
+ ```bash
264
+ # Quit any running instance first.
265
+ osascript -e 'quit app "PI Dashboard"'
266
+
267
+ # Default port 9222
268
+ open -a "PI Dashboard" --args --debug-cdp
269
+
270
+ # Custom port
271
+ open -a "PI Dashboard" --args --debug-cdp=9333
272
+ ```
273
+
274
+ **Linux / Windows (env-var equivalent):**
275
+
276
+ ```bash
277
+ PI_DEBUG_CDP=1 /path/to/pi-dashboard # default port 9222
278
+ PI_DEBUG_CDP=9444 /path/to/pi-dashboard # custom port
279
+ ```
280
+
281
+ **Dev (in this repo):**
282
+
283
+ ```bash
284
+ cd packages/electron && npm run dev:cdp
285
+ ```
286
+
287
+ On activation the app logs a single warning line to its stderr:
288
+
289
+ ```
290
+ [debug-cdp] CDP listening on :9222 — local automation is enabled
291
+ ```
292
+
293
+ If this line is missing, CDP is not active — the agent should halt the
294
+ recipe and tell the user to relaunch with the flag.
295
+
296
+ ### 2. Connect agent-browser
297
+
298
+ ```bash
299
+ agent-browser connect 9222
300
+ ```
301
+
302
+ ### 3. List the Electron windows
303
+
304
+ ```bash
305
+ agent-browser tab
306
+ ```
307
+
308
+ You should see the main dashboard window plus, depending on what the app
309
+ has open, the wizard window and/or doctor window:
310
+
311
+ ```
312
+ 0 PI Dashboard http://localhost:8000/
313
+ 1 PI Dashboard — Welcome file:///.../wizard.html
314
+ 2 PI Dashboard — Diagnostics file:///.../doctor.html
315
+ ```
316
+
317
+ Switch tabs with `agent-browser tab <index>`.
318
+
319
+ ### 4. Capture a screenshot of the main window
320
+
321
+ ```bash
322
+ agent-browser tab 0
323
+ agent-browser screenshot pi-dashboard.png
324
+ ```
325
+
326
+ ### 5. Drive the wizard window
327
+
328
+ ```bash
329
+ agent-browser tab 1
330
+ agent-browser snapshot -i # find the "Launch dashboard" button
331
+ agent-browser click @e3
332
+ agent-browser screenshot wizard-after-launch.png
333
+ ```
334
+
335
+ ### 6. Drive the doctor window
336
+
337
+ ```bash
338
+ agent-browser tab 2
339
+ agent-browser snapshot -i
340
+ agent-browser screenshot doctor.png
341
+ ```
342
+
343
+ ### 7. Cleanup
344
+
345
+ ```bash
346
+ agent-browser close
347
+ ```
348
+
349
+ This disconnects the agent-browser session but does **not** quit the Pi
350
+ Dashboard app — it remains running with CDP still active for the next
351
+ connection. To end CDP entirely, quit the Pi Dashboard app.