prose-qa 0.2.0 → 0.2.3

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 (137) hide show
  1. package/README.md +16 -28
  2. package/dist/agent/bash.d.ts +1 -1
  3. package/dist/agent/bash.d.ts.map +1 -1
  4. package/dist/agent/bash.js +23 -4
  5. package/dist/agent/bash.js.map +1 -1
  6. package/dist/agent/bash.test.js +27 -3
  7. package/dist/agent/bash.test.js.map +1 -1
  8. package/dist/agent/prompt.d.ts.map +1 -1
  9. package/dist/agent/prompt.js +9 -1
  10. package/dist/agent/prompt.js.map +1 -1
  11. package/dist/agent/provider-options.d.ts.map +1 -1
  12. package/dist/agent/provider-options.js +13 -19
  13. package/dist/agent/provider-options.js.map +1 -1
  14. package/dist/agent/provider-options.test.js +12 -2
  15. package/dist/agent/provider-options.test.js.map +1 -1
  16. package/dist/agent/runner.d.ts.map +1 -1
  17. package/dist/agent/runner.js +93 -16
  18. package/dist/agent/runner.js.map +1 -1
  19. package/dist/agent/runner.test.d.ts +2 -0
  20. package/dist/agent/runner.test.d.ts.map +1 -0
  21. package/dist/agent/runner.test.js +83 -0
  22. package/dist/agent/runner.test.js.map +1 -0
  23. package/dist/agent/transcript-persist.d.ts +9 -0
  24. package/dist/agent/transcript-persist.d.ts.map +1 -0
  25. package/dist/agent/transcript-persist.js +6 -0
  26. package/dist/agent/transcript-persist.js.map +1 -0
  27. package/dist/agent/transcript-persist.test.d.ts +2 -0
  28. package/dist/agent/transcript-persist.test.d.ts.map +1 -0
  29. package/dist/agent/transcript-persist.test.js +56 -0
  30. package/dist/agent/transcript-persist.test.js.map +1 -0
  31. package/dist/agent/verdict.d.ts +12 -3
  32. package/dist/agent/verdict.d.ts.map +1 -1
  33. package/dist/agent/verdict.js +81 -0
  34. package/dist/agent/verdict.js.map +1 -1
  35. package/dist/agent/verdict.test.js +157 -1
  36. package/dist/agent/verdict.test.js.map +1 -1
  37. package/dist/cli/help.d.ts.map +1 -1
  38. package/dist/cli/help.js +53 -17
  39. package/dist/cli/help.js.map +1 -1
  40. package/dist/cli/help.test.js +1 -0
  41. package/dist/cli/help.test.js.map +1 -1
  42. package/dist/cli/index.js +18 -1
  43. package/dist/cli/index.js.map +1 -1
  44. package/dist/cli/install-browser.d.ts +3 -0
  45. package/dist/cli/install-browser.d.ts.map +1 -0
  46. package/dist/cli/install-browser.js +42 -0
  47. package/dist/cli/install-browser.js.map +1 -0
  48. package/dist/cli/install-browser.test.d.ts +2 -0
  49. package/dist/cli/install-browser.test.d.ts.map +1 -0
  50. package/dist/cli/install-browser.test.js +19 -0
  51. package/dist/cli/install-browser.test.js.map +1 -0
  52. package/dist/cli/run.d.ts.map +1 -1
  53. package/dist/cli/run.js +20 -15
  54. package/dist/cli/run.js.map +1 -1
  55. package/dist/config/lightpanda.d.ts +8 -0
  56. package/dist/config/lightpanda.d.ts.map +1 -1
  57. package/dist/config/lightpanda.js +41 -4
  58. package/dist/config/lightpanda.js.map +1 -1
  59. package/dist/config/lightpanda.test.js +30 -1
  60. package/dist/config/lightpanda.test.js.map +1 -1
  61. package/dist/config/load.d.ts.map +1 -1
  62. package/dist/config/load.js +14 -6
  63. package/dist/config/load.js.map +1 -1
  64. package/dist/config/load.test.js +29 -0
  65. package/dist/config/load.test.js.map +1 -1
  66. package/dist/mcp/server.d.ts.map +1 -1
  67. package/dist/mcp/server.js +2 -1
  68. package/dist/mcp/server.js.map +1 -1
  69. package/dist/redact/env-secrets.d.ts.map +1 -1
  70. package/dist/redact/env-secrets.js +1 -0
  71. package/dist/redact/env-secrets.js.map +1 -1
  72. package/dist/reporter/index.d.ts.map +1 -1
  73. package/dist/reporter/index.js +10 -4
  74. package/dist/reporter/index.js.map +1 -1
  75. package/dist/reporter/index.test.js +90 -1
  76. package/dist/reporter/index.test.js.map +1 -1
  77. package/dist/reporter/stats.d.ts +10 -0
  78. package/dist/reporter/stats.d.ts.map +1 -0
  79. package/dist/reporter/stats.js +85 -0
  80. package/dist/reporter/stats.js.map +1 -0
  81. package/dist/reporter/stats.test.d.ts +2 -0
  82. package/dist/reporter/stats.test.d.ts.map +1 -0
  83. package/dist/reporter/stats.test.js +157 -0
  84. package/dist/reporter/stats.test.js.map +1 -0
  85. package/dist/skills/loader.d.ts +8 -1
  86. package/dist/skills/loader.d.ts.map +1 -1
  87. package/dist/skills/loader.js +31 -5
  88. package/dist/skills/loader.js.map +1 -1
  89. package/dist/skills/loader.test.d.ts +2 -0
  90. package/dist/skills/loader.test.d.ts.map +1 -0
  91. package/dist/skills/loader.test.js +40 -0
  92. package/dist/skills/loader.test.js.map +1 -0
  93. package/dist/skills/on-demand.d.ts +57 -0
  94. package/dist/skills/on-demand.d.ts.map +1 -0
  95. package/dist/skills/on-demand.js +225 -0
  96. package/dist/skills/on-demand.js.map +1 -0
  97. package/dist/skills/on-demand.test.d.ts +2 -0
  98. package/dist/skills/on-demand.test.d.ts.map +1 -0
  99. package/dist/skills/on-demand.test.js +111 -0
  100. package/dist/skills/on-demand.test.js.map +1 -0
  101. package/dist/types/config.d.ts +15 -4
  102. package/dist/types/config.d.ts.map +1 -1
  103. package/dist/types/verdict.d.ts +32 -1
  104. package/dist/types/verdict.d.ts.map +1 -1
  105. package/dist/types/verdict.js +22 -0
  106. package/dist/types/verdict.js.map +1 -1
  107. package/dist/version.d.ts +3 -0
  108. package/dist/version.d.ts.map +1 -0
  109. package/dist/version.js +6 -0
  110. package/dist/version.js.map +1 -0
  111. package/package.json +6 -4
  112. package/pqa.config.ts +8 -3
  113. package/prompt/SYSTEM.md +2 -1
  114. package/scripts/install-lightpanda.mjs +161 -0
  115. package/scripts/sync-skills.mjs +110 -0
  116. package/skills/agent-browser/SKILL.md +0 -1960
  117. package/skills/agent-browser/bundled/agentcore/SKILL.md +115 -0
  118. package/skills/agent-browser/bundled/dogfood/SKILL.md +220 -0
  119. package/skills/agent-browser/bundled/dogfood/references/issue-taxonomy.md +109 -0
  120. package/skills/agent-browser/bundled/dogfood/templates/dogfood-report-template.md +53 -0
  121. package/skills/agent-browser/bundled/electron/SKILL.md +236 -0
  122. package/skills/agent-browser/bundled/slack/SKILL.md +285 -0
  123. package/skills/agent-browser/bundled/slack/references/slack-tasks.md +348 -0
  124. package/skills/agent-browser/bundled/slack/templates/slack-report-template.md +163 -0
  125. package/skills/agent-browser/bundled/vercel-sandbox/SKILL.md +280 -0
  126. package/skills/agent-browser/manifest.json +42 -0
  127. package/skills/agent-browser/references/authentication.md +303 -0
  128. package/skills/agent-browser/references/commands.md +398 -0
  129. package/skills/agent-browser/references/profiling.md +120 -0
  130. package/skills/agent-browser/references/proxy-support.md +194 -0
  131. package/skills/agent-browser/references/session-management.md +193 -0
  132. package/skills/agent-browser/references/snapshot-refs.md +219 -0
  133. package/skills/agent-browser/references/trust-boundaries.md +89 -0
  134. package/skills/agent-browser/references/video-recording.md +175 -0
  135. package/skills/agent-browser/templates/authenticated-session.sh +105 -0
  136. package/skills/agent-browser/templates/capture-workflow.sh +69 -0
  137. package/skills/agent-browser/templates/form-automation.sh +62 -0
@@ -0,0 +1,236 @@
1
+ ---
2
+ name: electron
3
+ description: Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include "automate Slack app", "control VS Code", "interact with Discord app", "test this Electron app", "connect to desktop app", or any task requiring automation of a native Electron application.
4
+ allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)
5
+ ---
6
+
7
+ # Electron App Automation
8
+
9
+ 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.
10
+
11
+ ## Core Workflow
12
+
13
+ 1. **Launch** the Electron app with remote debugging enabled
14
+ 2. **Connect** agent-browser to the CDP port
15
+ 3. **Snapshot** to discover interactive elements
16
+ 4. **Interact** using element refs
17
+ 5. **Re-snapshot** after navigation or state changes
18
+
19
+ ```bash
20
+ # Launch an Electron app with remote debugging
21
+ open -a "Slack" --args --remote-debugging-port=9222
22
+
23
+ # Connect agent-browser to the app
24
+ agent-browser connect 9222
25
+
26
+ # Standard workflow from here
27
+ agent-browser snapshot -i
28
+ agent-browser click @e5
29
+ agent-browser screenshot slack-desktop.png
30
+ ```
31
+
32
+ ## Launching Electron Apps with CDP
33
+
34
+ Every Electron app supports the `--remote-debugging-port` flag since it's built into Chromium.
35
+
36
+ ### macOS
37
+
38
+ ```bash
39
+ # Slack
40
+ open -a "Slack" --args --remote-debugging-port=9222
41
+
42
+ # VS Code
43
+ open -a "Visual Studio Code" --args --remote-debugging-port=9223
44
+
45
+ # Discord
46
+ open -a "Discord" --args --remote-debugging-port=9224
47
+
48
+ # Figma
49
+ open -a "Figma" --args --remote-debugging-port=9225
50
+
51
+ # Notion
52
+ open -a "Notion" --args --remote-debugging-port=9226
53
+
54
+ # Spotify
55
+ open -a "Spotify" --args --remote-debugging-port=9227
56
+ ```
57
+
58
+ ### Linux
59
+
60
+ ```bash
61
+ slack --remote-debugging-port=9222
62
+ code --remote-debugging-port=9223
63
+ discord --remote-debugging-port=9224
64
+ ```
65
+
66
+ ### Windows
67
+
68
+ ```bash
69
+ "C:\Users\%USERNAME%\AppData\Local\slack\slack.exe" --remote-debugging-port=9222
70
+ "C:\Users\%USERNAME%\AppData\Local\Programs\Microsoft VS Code\Code.exe" --remote-debugging-port=9223
71
+ ```
72
+
73
+ **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.
74
+
75
+ ## Connecting
76
+
77
+ ```bash
78
+ # Connect to a specific port
79
+ agent-browser connect 9222
80
+
81
+ # Or use --cdp on each command
82
+ agent-browser --cdp 9222 snapshot -i
83
+
84
+ # Auto-discover a running Chromium-based app
85
+ agent-browser --auto-connect snapshot -i
86
+ ```
87
+
88
+ After `connect`, all subsequent commands target the connected app without needing `--cdp`.
89
+
90
+ ## Tab Management
91
+
92
+ Electron apps often have multiple windows or webviews. Use tab commands to list and switch between them:
93
+
94
+ ```bash
95
+ # List all available targets (windows, webviews, etc.)
96
+ agent-browser tab
97
+
98
+ # Switch to a specific tab by index
99
+ agent-browser tab 2
100
+
101
+ # Switch by URL pattern
102
+ agent-browser tab --url "*settings*"
103
+ ```
104
+
105
+ ## Webview Support
106
+
107
+ 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"`:
108
+
109
+ ```bash
110
+ # Connect to running Electron app
111
+ agent-browser connect 9222
112
+
113
+ # List targets -- webviews appear alongside pages
114
+ agent-browser tab
115
+ # Example output:
116
+ # 0: [page] Slack - Main Window https://app.slack.com/
117
+ # 1: [webview] Embedded Content https://example.com/widget
118
+
119
+ # Switch to a webview
120
+ agent-browser tab 1
121
+
122
+ # Interact with the webview normally
123
+ agent-browser snapshot -i
124
+ agent-browser click @e3
125
+ agent-browser screenshot webview.png
126
+ ```
127
+
128
+ **Note:** Webview support works via raw CDP connection.
129
+
130
+ ## Common Patterns
131
+
132
+ ### Inspect and Navigate an App
133
+
134
+ ```bash
135
+ open -a "Slack" --args --remote-debugging-port=9222
136
+ sleep 3 # Wait for app to start
137
+ agent-browser connect 9222
138
+ agent-browser snapshot -i
139
+ # Read the snapshot output to identify UI elements
140
+ agent-browser click @e10 # Navigate to a section
141
+ agent-browser snapshot -i # Re-snapshot after navigation
142
+ ```
143
+
144
+ ### Take Screenshots of Desktop Apps
145
+
146
+ ```bash
147
+ agent-browser connect 9222
148
+ agent-browser screenshot app-state.png
149
+ agent-browser screenshot --full full-app.png
150
+ agent-browser screenshot --annotate annotated-app.png
151
+ ```
152
+
153
+ ### Extract Data from a Desktop App
154
+
155
+ ```bash
156
+ agent-browser connect 9222
157
+ agent-browser snapshot -i
158
+ agent-browser get text @e5
159
+ agent-browser snapshot --json > app-state.json
160
+ ```
161
+
162
+ ### Fill Forms in Desktop Apps
163
+
164
+ ```bash
165
+ agent-browser connect 9222
166
+ agent-browser snapshot -i
167
+ agent-browser fill @e3 "search query"
168
+ agent-browser press Enter
169
+ agent-browser wait 1000
170
+ agent-browser snapshot -i
171
+ ```
172
+
173
+ ### Run Multiple Apps Simultaneously
174
+
175
+ Use named sessions to control multiple Electron apps at the same time:
176
+
177
+ ```bash
178
+ # Connect to Slack
179
+ agent-browser --session slack connect 9222
180
+
181
+ # Connect to VS Code
182
+ agent-browser --session vscode connect 9223
183
+
184
+ # Interact with each independently
185
+ agent-browser --session slack snapshot -i
186
+ agent-browser --session vscode snapshot -i
187
+ ```
188
+
189
+ ## Color Scheme
190
+
191
+ The default color scheme when connecting via CDP may be `light`. To preserve dark mode:
192
+
193
+ ```bash
194
+ agent-browser connect 9222
195
+ agent-browser --color-scheme dark snapshot -i
196
+ ```
197
+
198
+ Or set it globally:
199
+
200
+ ```bash
201
+ AGENT_BROWSER_COLOR_SCHEME=dark agent-browser connect 9222
202
+ ```
203
+
204
+ ## Troubleshooting
205
+
206
+ ### "Connection refused" or "Cannot connect"
207
+
208
+ - Make sure the app was launched with `--remote-debugging-port=NNNN`
209
+ - If the app was already running, quit and relaunch with the flag
210
+ - Check that the port isn't in use by another process: `lsof -i :9222`
211
+
212
+ ### App launches but connect fails
213
+
214
+ - Wait a few seconds after launch before connecting (`sleep 3`)
215
+ - Some apps take time to initialize their webview
216
+
217
+ ### Elements not appearing in snapshot
218
+
219
+ - The app may use multiple webviews. Use `agent-browser tab` to list targets and switch to the right one
220
+
221
+ ### Cannot type in input fields
222
+
223
+ - Try `agent-browser keyboard type "text"` to type at the current focus without a selector
224
+ - Some Electron apps use custom input components; use `agent-browser keyboard inserttext "text"` to bypass key events
225
+
226
+ ## Supported Apps
227
+
228
+ Any app built on Electron works, including:
229
+
230
+ - **Communication:** Slack, Discord, Microsoft Teams, Signal, Telegram Desktop
231
+ - **Development:** VS Code, GitHub Desktop, Postman, Insomnia
232
+ - **Design:** Figma, Notion, Obsidian
233
+ - **Media:** Spotify, Tidal
234
+ - **Productivity:** Todoist, Linear, 1Password
235
+
236
+ If an app is built with Electron, it supports `--remote-debugging-port` and can be automated with agent-browser.
@@ -0,0 +1,285 @@
1
+ ---
2
+ name: slack
3
+ description: Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include "check my Slack", "what channels have unreads", "send a message to", "search Slack for", "extract from Slack", "find who said", or any task requiring programmatic Slack interaction.
4
+ allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*)
5
+ ---
6
+
7
+ # Slack Automation
8
+
9
+ Interact with Slack workspaces to check messages, extract data, and automate common tasks.
10
+
11
+ ## Quick Start
12
+
13
+ Connect to an existing Slack browser session or open Slack:
14
+
15
+ ```bash
16
+ # Connect to existing session on port 9222 (typical for already-open Slack)
17
+ agent-browser connect 9222
18
+
19
+ # Or open Slack if not already running
20
+ agent-browser open https://app.slack.com
21
+ ```
22
+
23
+ Then take a snapshot to see what's available:
24
+
25
+ ```bash
26
+ agent-browser snapshot -i
27
+ ```
28
+
29
+ ## Core Workflow
30
+
31
+ 1. **Connect/Navigate**: Open or connect to Slack
32
+ 2. **Snapshot**: Get interactive elements with refs (`@e1`, `@e2`, etc.)
33
+ 3. **Navigate**: Click tabs, expand sections, or navigate to specific channels
34
+ 4. **Extract/Interact**: Read data or perform actions
35
+ 5. **Screenshot**: Capture evidence of findings
36
+
37
+ ```bash
38
+ # Example: Check unread channels
39
+ agent-browser connect 9222
40
+ agent-browser snapshot -i
41
+ # Look for "More unreads" button
42
+ agent-browser click @e21 # Ref for "More unreads" button
43
+ agent-browser screenshot slack-unreads.png
44
+ ```
45
+
46
+ ## Common Tasks
47
+
48
+ ### Checking Unread Messages
49
+
50
+ ```bash
51
+ # Connect to Slack
52
+ agent-browser connect 9222
53
+
54
+ # Take snapshot to locate unreads button
55
+ agent-browser snapshot -i
56
+
57
+ # Look for:
58
+ # - "More unreads" button (usually near top of sidebar)
59
+ # - "Unreads" toggle in Activity tab (shows unread count)
60
+ # - Channel names with badges/bold text indicating unreads
61
+
62
+ # Navigate to Activity tab to see all unreads in one view
63
+ agent-browser click @e14 # Activity tab (ref may vary)
64
+ agent-browser wait 1000
65
+ agent-browser screenshot activity-unreads.png
66
+
67
+ # Or check DMs tab
68
+ agent-browser click @e13 # DMs tab
69
+ agent-browser screenshot dms.png
70
+
71
+ # Or expand "More unreads" in sidebar
72
+ agent-browser click @e21 # More unreads button
73
+ agent-browser wait 500
74
+ agent-browser screenshot expanded-unreads.png
75
+ ```
76
+
77
+ ### Navigating to a Channel
78
+
79
+ ```bash
80
+ # Search for channel in sidebar or by name
81
+ agent-browser snapshot -i
82
+
83
+ # Look for channel name in the list (e.g., "engineering", "product-design")
84
+ # Click on the channel treeitem ref
85
+ agent-browser click @e94 # Example: engineering channel ref
86
+ agent-browser wait --load networkidle
87
+ agent-browser screenshot channel.png
88
+ ```
89
+
90
+ ### Finding Messages/Threads
91
+
92
+ ```bash
93
+ # Use Slack search
94
+ agent-browser snapshot -i
95
+ agent-browser click @e5 # Search button (typical ref)
96
+ agent-browser fill @e_search "keyword"
97
+ agent-browser press Enter
98
+ agent-browser wait --load networkidle
99
+ agent-browser screenshot search-results.png
100
+ ```
101
+
102
+ ### Extracting Channel Information
103
+
104
+ ```bash
105
+ # Get list of all visible channels
106
+ agent-browser snapshot --json > slack-snapshot.json
107
+
108
+ # Parse for channel names and metadata
109
+ # Look for treeitem elements with level=2 (sub-channels under sections)
110
+ ```
111
+
112
+ ### Checking Channel Details
113
+
114
+ ```bash
115
+ # Open a channel
116
+ agent-browser click @e_channel_ref
117
+ agent-browser wait 1000
118
+
119
+ # Get channel info (members, description, etc.)
120
+ agent-browser snapshot -i
121
+ agent-browser screenshot channel-details.png
122
+
123
+ # Scroll through messages
124
+ agent-browser scroll down 500
125
+ agent-browser screenshot channel-messages.png
126
+ ```
127
+
128
+ ### Taking Notes/Capturing State
129
+
130
+ When you need to document findings from Slack:
131
+
132
+ ```bash
133
+ # Take annotated screenshot (shows element numbers)
134
+ agent-browser screenshot --annotate slack-state.png
135
+
136
+ # Take full-page screenshot
137
+ agent-browser screenshot --full slack-full.png
138
+
139
+ # Get current URL for reference
140
+ agent-browser get url
141
+
142
+ # Get page title
143
+ agent-browser get title
144
+ ```
145
+
146
+ ## Sidebar Structure
147
+
148
+ Understanding Slack's sidebar helps you navigate efficiently:
149
+
150
+ ```
151
+ - Threads
152
+ - Huddles
153
+ - Drafts & sent
154
+ - Directories
155
+ - [Section Headers - External connections, Starred, Channels, etc.]
156
+ - [Channels listed as treeitems]
157
+ - Direct Messages
158
+ - [DMs listed]
159
+ - Apps
160
+ - [App shortcuts]
161
+ - [More unreads] button (toggles unread channels list)
162
+ ```
163
+
164
+ Key refs to look for:
165
+ - `@e12` - Home tab (usually)
166
+ - `@e13` - DMs tab
167
+ - `@e14` - Activity tab
168
+ - `@e5` - Search button
169
+ - `@e21` - More unreads button (varies by session)
170
+
171
+ ## Tabs in Slack
172
+
173
+ After clicking on a channel, you'll see tabs:
174
+ - **Messages** - Channel conversation
175
+ - **Files** - Shared files
176
+ - **Pins** - Pinned messages
177
+ - **Add canvas** - Collaborative canvas
178
+ - Other tabs depending on workspace setup
179
+
180
+ Click tab refs to switch views and get different information.
181
+
182
+ ## Extracting Data from Slack
183
+
184
+ ### Get Text Content
185
+
186
+ ```bash
187
+ # Get a message or element's text
188
+ agent-browser get text @e_message_ref
189
+ ```
190
+
191
+ ### Parse Accessibility Tree
192
+
193
+ ```bash
194
+ # Full snapshot as JSON for programmatic parsing
195
+ agent-browser snapshot --json > output.json
196
+
197
+ # Look for:
198
+ # - Channel names (name field in treeitem)
199
+ # - Message content (in listitem/document elements)
200
+ # - User names (button elements with user info)
201
+ # - Timestamps (link elements with time info)
202
+ ```
203
+
204
+ ### Count Unreads
205
+
206
+ ```bash
207
+ # After expanding unreads section:
208
+ agent-browser snapshot -i | grep -c "treeitem"
209
+ # Each treeitem with a channel name in the unreads section is one unread
210
+ ```
211
+
212
+ ## Best Practices
213
+
214
+ - **Connect to existing sessions**: Use `agent-browser connect 9222` if Slack is already open. This is faster than opening a new browser.
215
+ - **Take snapshots before clicking**: Always `snapshot -i` to identify refs before clicking buttons.
216
+ - **Re-snapshot after navigation**: After navigating to a new channel or section, take a fresh snapshot to find new refs.
217
+ - **Use JSON snapshots for parsing**: When you need to extract structured data, use `snapshot --json` for machine-readable output.
218
+ - **Pace interactions**: Add `sleep 1` between rapid interactions to let the UI update.
219
+ - **Check accessibility tree**: The accessibility tree shows what screen readers (and your automation) can see. If an element isn't in the snapshot, it may be hidden or require scrolling.
220
+ - **Scroll in sidebar**: Use `agent-browser scroll down 300 --selector ".p-sidebar"` to scroll within the Slack sidebar if channel list is long.
221
+
222
+ ## Limitations
223
+
224
+ - **Cannot access Slack API**: This uses browser automation, not the Slack API. No OAuth, webhooks, or bot tokens needed.
225
+ - **Session-specific**: Screenshots and snapshots are tied to the current browser session.
226
+ - **Rate limiting**: Slack may rate-limit rapid interactions. Add delays between commands if needed.
227
+ - **Workspace-specific**: You interact with your own workspace -- no cross-workspace automation.
228
+
229
+ ## Debugging
230
+
231
+ ### Check console for errors
232
+
233
+ ```bash
234
+ agent-browser console
235
+ agent-browser errors
236
+ ```
237
+
238
+ ### Get current page state
239
+
240
+ ```bash
241
+ agent-browser get url
242
+ agent-browser get title
243
+ agent-browser screenshot page-state.png
244
+ ```
245
+
246
+ ## Example: Full Unread Check
247
+
248
+ ```bash
249
+ #!/bin/bash
250
+
251
+ # Connect to Slack
252
+ agent-browser connect 9222
253
+
254
+ # Take initial snapshot
255
+ echo "=== Checking Slack unreads ==="
256
+ agent-browser snapshot -i > snapshot.txt
257
+
258
+ # Check Activity tab for unreads
259
+ agent-browser click @e14 # Activity tab
260
+ agent-browser wait 1000
261
+ agent-browser screenshot activity.png
262
+ ACTIVITY_RESULT=$(agent-browser get text @e_main_area)
263
+ echo "Activity: $ACTIVITY_RESULT"
264
+
265
+ # Check DMs
266
+ agent-browser click @e13 # DMs tab
267
+ agent-browser wait 1000
268
+ agent-browser screenshot dms.png
269
+
270
+ # Check unread channels in sidebar
271
+ agent-browser click @e21 # More unreads button
272
+ agent-browser wait 500
273
+ agent-browser snapshot -i > unreads-expanded.txt
274
+ agent-browser screenshot unreads.png
275
+
276
+ # Summary
277
+ echo "=== Summary ==="
278
+ echo "See activity.png, dms.png, and unreads.png for full details"
279
+ ```
280
+
281
+ ## References
282
+
283
+ - **Slack docs**: https://slack.com/help
284
+ - **Web experience**: https://app.slack.com
285
+ - **Keyboard shortcuts**: Type `?` in Slack for shortcut list