cbrowser 17.6.1 → 18.1.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 (37) hide show
  1. package/dist/browser.d.ts +4 -0
  2. package/dist/browser.d.ts.map +1 -1
  3. package/dist/browser.js +37 -1
  4. package/dist/browser.js.map +1 -1
  5. package/dist/cli.js +10 -5
  6. package/dist/cli.js.map +1 -1
  7. package/dist/mcp-server-remote.d.ts.map +1 -1
  8. package/dist/mcp-server-remote.js +3 -1
  9. package/dist/mcp-server-remote.js.map +1 -1
  10. package/dist/mcp-tools/base/navigation-tools.d.ts.map +1 -1
  11. package/dist/mcp-tools/base/navigation-tools.js +33 -12
  12. package/dist/mcp-tools/base/navigation-tools.js.map +1 -1
  13. package/dist/mcp-tools/index.d.ts +1 -0
  14. package/dist/mcp-tools/index.d.ts.map +1 -1
  15. package/dist/mcp-tools/index.js +2 -0
  16. package/dist/mcp-tools/index.js.map +1 -1
  17. package/dist/mcp-tools/screenshot-utils.d.ts +45 -0
  18. package/dist/mcp-tools/screenshot-utils.d.ts.map +1 -0
  19. package/dist/mcp-tools/screenshot-utils.js +131 -0
  20. package/dist/mcp-tools/screenshot-utils.js.map +1 -0
  21. package/docs/Tool-Cognitive-Journey-Autonomous.md +264 -0
  22. package/docs/Tool-Competitive-Benchmark.md +287 -0
  23. package/docs/Tool-Empathy-Audit.md +325 -0
  24. package/docs/Tool-Hunt-Bugs.md +299 -0
  25. package/docs/Tool-Marketing-Campaign.md +292 -0
  26. package/docs/Tool-Persona-Create.md +268 -0
  27. package/docs/Tools-Accessibility.md +202 -0
  28. package/docs/Tools-Browser-Automation.md +305 -0
  29. package/docs/Tools-Cognitive-Journeys.md +227 -0
  30. package/docs/Tools-Marketing-Intelligence.md +265 -0
  31. package/docs/Tools-Overview.md +143 -0
  32. package/docs/Tools-Persona-System.md +294 -0
  33. package/docs/Tools-Session-State.md +272 -0
  34. package/docs/Tools-Testing-Quality.md +251 -0
  35. package/docs/Tools-Utilities.md +176 -0
  36. package/docs/Tools-Visual-Performance.md +272 -0
  37. package/package.json +1 -1
@@ -0,0 +1,305 @@
1
+ # Browser Automation Tools
2
+
3
+ **Tell the browser what you want. Let AI figure out how.**
4
+
5
+ These 12 tools handle navigation, clicking, form filling, data extraction, and page analysis. They replace brittle CSS selectors with natural language descriptions that survive DOM changes.
6
+
7
+ ---
8
+
9
+ ## When to Use These Tools
10
+
11
+ - **You're automating a workflow** and tired of tests breaking when developers change class names
12
+ - **You need to extract data** from pages without writing custom scrapers for each site
13
+ - **You're building an AI agent** that needs to interact with arbitrary websites
14
+ - **Your selectors keep failing** and you want something that self-heals
15
+
16
+ ---
17
+
18
+ ## Tools
19
+
20
+ ### `navigate`
21
+
22
+ **What it does**: Opens a URL and takes a screenshot of the loaded page.
23
+
24
+ **Why you'd use it**: Start any browser automation session or move between pages.
25
+
26
+ | Parameter | Type | Required | Description |
27
+ |-----------|------|----------|-------------|
28
+ | `url` | string | Yes | The URL to navigate to |
29
+
30
+ **Example**:
31
+ ```json
32
+ {
33
+ "url": "https://example.com/products"
34
+ }
35
+ ```
36
+
37
+ ---
38
+
39
+ ### `click`
40
+
41
+ **What it does**: Clicks an element using text content, CSS selector, or natural language description.
42
+
43
+ **Why you'd use it**: Interact with buttons, links, or any clickable element without fragile selectors.
44
+
45
+ | Parameter | Type | Required | Description |
46
+ |-----------|------|----------|-------------|
47
+ | `selector` | string | Yes | What to click — text, CSS selector, or description like "the blue submit button" |
48
+ | `force` | boolean | No | Bypass constitutional safety checks for destructive actions |
49
+ | `verbose` | boolean | No | Return available elements and AI suggestions on failure |
50
+
51
+ **Example**:
52
+ ```json
53
+ {
54
+ "selector": "Add to Cart"
55
+ }
56
+ ```
57
+
58
+ Or with natural language:
59
+ ```json
60
+ {
61
+ "selector": "the primary call-to-action button in the hero section"
62
+ }
63
+ ```
64
+
65
+ ---
66
+
67
+ ### `smart_click`
68
+
69
+ **What it does**: Clicks with automatic retry and self-healing selectors. If the original selector fails, it finds the element by intent.
70
+
71
+ **Why you'd use it**: When elements might not be immediately available or when you want resilience against DOM changes.
72
+
73
+ | Parameter | Type | Required | Description |
74
+ |-----------|------|----------|-------------|
75
+ | `selector` | string | Yes | Element to click |
76
+ | `maxRetries` | number | No | Maximum retry attempts. Default: 3 |
77
+ | `dismissOverlays` | boolean | No | Automatically dismiss popups before clicking. Default: false |
78
+
79
+ **Example**:
80
+ ```json
81
+ {
82
+ "selector": "Submit Order",
83
+ "dismissOverlays": true
84
+ }
85
+ ```
86
+
87
+ **Note**: v11.8.0 added confidence gating — only reports success if the healed selector has ≥60% confidence.
88
+
89
+ ---
90
+
91
+ ### `fill`
92
+
93
+ **What it does**: Types text into a form field identified by name, label, or description.
94
+
95
+ **Why you'd use it**: Fill out forms without knowing the exact input names or IDs.
96
+
97
+ | Parameter | Type | Required | Description |
98
+ |-----------|------|----------|-------------|
99
+ | `selector` | string | Yes | The field to fill — label text, name attribute, or description |
100
+ | `value` | string | Yes | Text to type into the field |
101
+ | `clear` | boolean | No | Clear existing content before typing. Default: true |
102
+
103
+ **Example**:
104
+ ```json
105
+ {
106
+ "selector": "Email address",
107
+ "value": "user@example.com"
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ### `scroll`
114
+
115
+ **What it does**: Scrolls the page in a specified direction or to a specific position.
116
+
117
+ **Why you'd use it**: Reveal content below the fold, trigger lazy loading, or reach elements not yet visible.
118
+
119
+ | Parameter | Type | Required | Description |
120
+ |-----------|------|----------|-------------|
121
+ | `direction` | string | Yes | `up`, `down`, `top`, `bottom`, or pixel amount like `500px` |
122
+
123
+ **Example**:
124
+ ```json
125
+ {
126
+ "direction": "down"
127
+ }
128
+ ```
129
+
130
+ ---
131
+
132
+ ### `screenshot`
133
+
134
+ **What it does**: Captures the current page as an image.
135
+
136
+ **Why you'd use it**: Document state, debug failures, or feed visual information to AI.
137
+
138
+ | Parameter | Type | Required | Description |
139
+ |-----------|------|----------|-------------|
140
+ | `fullPage` | boolean | No | Capture entire scrollable page. Default: false (viewport only) |
141
+ | `path` | string | No | Save to file path instead of returning base64 |
142
+
143
+ **Example**:
144
+ ```json
145
+ {
146
+ "fullPage": true
147
+ }
148
+ ```
149
+
150
+ ---
151
+
152
+ ### `extract`
153
+
154
+ **What it does**: Pulls structured data from the page — links, headings, forms, images, or arbitrary text.
155
+
156
+ **Why you'd use it**: Scrape content, analyze page structure, or gather data for further processing.
157
+
158
+ | Parameter | Type | Required | Description |
159
+ |-----------|------|----------|-------------|
160
+ | `type` | string | Yes | What to extract: `links`, `headings`, `forms`, `images`, `text`, or `all` |
161
+ | `selector` | string | No | Limit extraction to elements matching this selector |
162
+
163
+ **Example**:
164
+ ```json
165
+ {
166
+ "type": "links"
167
+ }
168
+ ```
169
+
170
+ Returns structured JSON with all links, their text, and href values.
171
+
172
+ ---
173
+
174
+ ### `find_element_by_intent`
175
+
176
+ **What it does**: Uses AI to find elements by semantic description. Returns the best match with confidence score and accessibility information.
177
+
178
+ **Why you'd use it**: When you need to find something but don't know exactly how it's implemented — "the navigation menu" or "the search box in the header".
179
+
180
+ | Parameter | Type | Required | Description |
181
+ |-----------|------|----------|-------------|
182
+ | `intent` | string | Yes | Natural language description of the element |
183
+ | `context` | string | No | Additional context to narrow the search |
184
+
185
+ **Example**:
186
+ ```json
187
+ {
188
+ "intent": "the main call-to-action button",
189
+ "context": "in the pricing section"
190
+ }
191
+ ```
192
+
193
+ **Returns**: Selector, confidence score (0-1), accessibility score, and alternative matches.
194
+
195
+ **Note**: v7.4.17 added ARIA-first strategy — prioritizes `aria-label`, `role`, semantic HTML before falling back to classes/IDs.
196
+
197
+ ---
198
+
199
+ ### `analyze_page`
200
+
201
+ **What it does**: Examines page structure and returns inventory of interactive elements — forms, buttons, links, inputs.
202
+
203
+ **Why you'd use it**: Understand what's on a page before deciding what to interact with. Essential for building adaptive agents.
204
+
205
+ | Parameter | Type | Required | Description |
206
+ |-----------|------|----------|-------------|
207
+ | `detailed` | boolean | No | Include element attributes and positions. Default: false |
208
+
209
+ **Example**:
210
+ ```json
211
+ {
212
+ "detailed": true
213
+ }
214
+ ```
215
+
216
+ ---
217
+
218
+ ### `assert`
219
+
220
+ **What it does**: Verifies a condition using natural language and returns pass/fail with explanation.
221
+
222
+ **Why you'd use it**: Validate that actions had the expected result without writing complex assertion logic.
223
+
224
+ | Parameter | Type | Required | Description |
225
+ |-----------|------|----------|-------------|
226
+ | `condition` | string | Yes | What to check, in plain English |
227
+
228
+ **Example**:
229
+ ```json
230
+ {
231
+ "condition": "the shopping cart shows 2 items"
232
+ }
233
+ ```
234
+
235
+ **Returns**: `{ "passed": true/false, "reason": "explanation" }`
236
+
237
+ ---
238
+
239
+ ### `dismiss_overlay`
240
+
241
+ **What it does**: Detects and closes modal overlays — cookie consent banners, newsletter popups, age verification gates.
242
+
243
+ **Why you'd use it**: Clear blocking UI before interacting with the actual page content.
244
+
245
+ | Parameter | Type | Required | Description |
246
+ |-----------|------|----------|-------------|
247
+ | `type` | string | No | Overlay type: `auto`, `cookie`, `age-verify`, `newsletter`, `custom`. Default: `auto` |
248
+ | `customSelector` | string | No | Selector for custom overlay close button |
249
+
250
+ **Example**:
251
+ ```json
252
+ {
253
+ "type": "auto"
254
+ }
255
+ ```
256
+
257
+ **Note**: Constitutional Yellow zone — logged but proceeds automatically.
258
+
259
+ ---
260
+
261
+ ### `ask_user`
262
+
263
+ **What it does**: Creates a structured prompt to ask the human operator a question with predefined options.
264
+
265
+ **Why you'd use it**: When the automation needs human input to proceed — confirmation, selection, or decision that can't be automated.
266
+
267
+ | Parameter | Type | Required | Description |
268
+ |-----------|------|----------|-------------|
269
+ | `question` | string | Yes | The question to ask |
270
+ | `options` | array | No | Predefined answer options |
271
+ | `allowFreeform` | boolean | No | Allow typed response. Default: true |
272
+
273
+ **Example**:
274
+ ```json
275
+ {
276
+ "question": "Which shipping method should I select?",
277
+ "options": ["Standard (5-7 days)", "Express (2-3 days)", "Overnight"]
278
+ }
279
+ ```
280
+
281
+ ---
282
+
283
+ ## How Self-Healing Works
284
+
285
+ When a selector fails, CBrowser:
286
+
287
+ 1. **Checks the healing cache** for previously learned mappings
288
+ 2. **Analyzes the page** for elements matching the semantic intent
289
+ 3. **Scores candidates** by text similarity, position, and accessibility attributes
290
+ 4. **Returns the best match** if confidence exceeds 60%
291
+ 5. **Caches the mapping** for faster future lookups
292
+
293
+ This means your automation adapts to site changes automatically. A redesign that moves the "Add to Cart" button? CBrowser finds it by intent, not by its old CSS class.
294
+
295
+ ---
296
+
297
+ ## Related Documentation
298
+
299
+ - [Constitutional Safety](/docs/Constitutional-Safety/) — How CBrowser classifies action risk
300
+ - [Tools Overview](/docs/Tools-Overview/) — All tools by category
301
+ - [Examples](/docs/Examples/) — Real-world automation patterns
302
+
303
+ ---
304
+
305
+ *Last updated: v17.6.0*
@@ -0,0 +1,227 @@
1
+ # Cognitive Journey Tools
2
+
3
+ **Find out where users give up before they actually do.**
4
+
5
+ Cognitive journeys simulate real humans navigating your site — complete with patience that depletes, frustration that builds, and the moment they decide "this isn't worth it" and leave. These 6 tools let you experience your product through the minds of different user types.
6
+
7
+ ---
8
+
9
+ ## When to Use These Tools
10
+
11
+ - **Your conversion rate is mysteriously low** and analytics can't tell you why people abandon
12
+ - **You're launching a new feature** and want to know if real users can figure it out
13
+ - **You need to compare experiences** across different audience segments
14
+ - **You want to find friction** before your users feel it
15
+
16
+ ---
17
+
18
+ ## Tools
19
+
20
+ ### `cognitive_journey_init`
21
+
22
+ **What it does**: Starts a cognitive journey session with a specific persona, goal, and starting point. Returns the persona's cognitive profile and initial state.
23
+
24
+ **Why you'd use it**: Begin simulating how a specific user type would approach your site.
25
+
26
+ | Parameter | Type | Required | Description |
27
+ |-----------|------|----------|-------------|
28
+ | `persona` | string | Yes | Persona ID (e.g., `first-timer`, `elderly-user`, `cognitive-adhd`) |
29
+ | `startUrl` | string | Yes | URL where the journey begins |
30
+ | `goal` | string | Yes | What the persona is trying to accomplish |
31
+ | `maxSteps` | number | No | Maximum actions before forcing stop. Default: 50 |
32
+
33
+ **Example**:
34
+ ```json
35
+ {
36
+ "persona": "first-timer",
37
+ "startUrl": "https://example.com",
38
+ "goal": "Create an account and make a purchase"
39
+ }
40
+ ```
41
+
42
+ **Returns**: Session ID, persona profile (25 traits), initial cognitive state (patience, confusion, frustration at starting values).
43
+
44
+ ---
45
+
46
+ ### `cognitive_journey_update_state`
47
+
48
+ **What it does**: Updates the persona's cognitive state after each action. Tracks mood changes, calculates whether they would abandon, and generates inner monologue.
49
+
50
+ **Why you'd use it**: After each navigation step, report what happened and get the persona's reaction.
51
+
52
+ | Parameter | Type | Required | Description |
53
+ |-----------|------|----------|-------------|
54
+ | `sessionId` | string | Yes | Session ID from `cognitive_journey_init` |
55
+ | `action` | string | Yes | What action was just taken |
56
+ | `result` | string | Yes | What happened — success, failure, unexpected |
57
+ | `patienceChange` | number | No | How much patience changed (-1 to 1) |
58
+ | `confusionChange` | number | No | How much confusion changed (-1 to 1) |
59
+ | `frustrationChange` | number | No | How much frustration changed (-1 to 1) |
60
+ | `currentUrl` | string | No | Current page URL |
61
+
62
+ **Example**:
63
+ ```json
64
+ {
65
+ "sessionId": "journey_abc123",
66
+ "action": "Clicked 'Sign Up' button",
67
+ "result": "Page showed loading spinner for 8 seconds before form appeared",
68
+ "patienceChange": -0.15,
69
+ "confusionChange": 0.05,
70
+ "frustrationChange": 0.10,
71
+ "currentUrl": "https://example.com/signup"
72
+ }
73
+ ```
74
+
75
+ **Returns**:
76
+ - `shouldAbandon`: boolean — would this persona leave?
77
+ - `abandonmentReason`: why they'd leave (if applicable)
78
+ - `innerMonologue`: what they're thinking ("This is taking forever...")
79
+ - `currentState`: updated patience/confusion/frustration values
80
+
81
+ ---
82
+
83
+ ### `cognitive_journey_autonomous` 🔒 Enterprise
84
+
85
+ **What it does**: Runs a complete journey autonomously with AI making all navigation decisions. No orchestration needed — just set the goal and watch.
86
+
87
+ **Why you'd use it**: Hands-off user simulation that generates complete friction reports and abandonment analysis.
88
+
89
+ > **Enterprise Feature** — Requires CBrowser Enterprise.
90
+ > Autonomous execution consumes Anthropic API credits for decision-making.
91
+ > [Learn about Enterprise →](/docs/Marketing-Suite/)
92
+
93
+ | Parameter | Type | Required | Description |
94
+ |-----------|------|----------|-------------|
95
+ | `persona` | string | Yes | Persona ID |
96
+ | `startUrl` | string | Yes | Starting URL |
97
+ | `goal` | string | Yes | What to accomplish |
98
+ | `maxSteps` | number | No | Max actions. Default: 50 |
99
+ | `maxTime` | number | No | Max seconds. Default: 300 |
100
+ | `vision` | boolean | No | Use screenshot analysis for decisions. Default: false |
101
+ | `headless` | boolean | No | Run without visible browser. Default: false |
102
+
103
+ **Example**:
104
+ ```json
105
+ {
106
+ "persona": "elderly-user",
107
+ "startUrl": "https://bank.example.com",
108
+ "goal": "Transfer $100 to savings account",
109
+ "vision": true,
110
+ "maxSteps": 30
111
+ }
112
+ ```
113
+
114
+ **Returns**: Complete journey trace with every decision, friction points, screenshots, and final outcome.
115
+
116
+ ---
117
+
118
+ ### `compare_personas`
119
+
120
+ **What it does**: Run the same journey with multiple personas and compare their experiences side-by-side.
121
+
122
+ **Why you'd use it**: Understand how different user segments experience the same flow differently.
123
+
124
+ | Parameter | Type | Required | Description |
125
+ |-----------|------|----------|-------------|
126
+ | `personas` | array | Yes | List of persona IDs to compare |
127
+ | `startUrl` | string | Yes | Starting URL |
128
+ | `goal` | string | Yes | What to accomplish |
129
+ | `parallel` | boolean | No | Run journeys simultaneously. Default: false |
130
+
131
+ **Example**:
132
+ ```json
133
+ {
134
+ "personas": ["power-user", "first-timer", "elderly-user"],
135
+ "startUrl": "https://example.com/checkout",
136
+ "goal": "Complete purchase"
137
+ }
138
+ ```
139
+
140
+ **Returns**: Comparison matrix showing success/failure, time taken, abandonment points, and friction experienced by each persona.
141
+
142
+ ---
143
+
144
+ ### `compare_personas_init`
145
+
146
+ **What it does**: Initialize a multi-persona comparison using the bridge workflow (no API key needed). Returns profiles for all personas ready for manual orchestration.
147
+
148
+ **Why you'd use it**: Run persona comparisons when you want Claude to orchestrate each step rather than autonomous execution.
149
+
150
+ | Parameter | Type | Required | Description |
151
+ |-----------|------|----------|-------------|
152
+ | `personas` | array | Yes | List of persona IDs |
153
+ | `startUrl` | string | Yes | Starting URL |
154
+ | `goal` | string | Yes | Goal to accomplish |
155
+
156
+ **Example**:
157
+ ```json
158
+ {
159
+ "personas": ["mobile-user", "impatient-user"],
160
+ "startUrl": "https://example.com",
161
+ "goal": "Find pricing information"
162
+ }
163
+ ```
164
+
165
+ ---
166
+
167
+ ### `compare_personas_complete`
168
+
169
+ **What it does**: Finalize a persona comparison by aggregating all journey results and generating the comparison report.
170
+
171
+ **Why you'd use it**: After running individual journeys for each persona, compile the results.
172
+
173
+ | Parameter | Type | Required | Description |
174
+ |-----------|------|----------|-------------|
175
+ | `comparisonId` | string | Yes | Comparison ID from `compare_personas_init` |
176
+ | `results` | array | Yes | Array of journey results for each persona |
177
+
178
+ ---
179
+
180
+ ## Understanding Cognitive State
181
+
182
+ Every persona has three dynamic metrics that change throughout their journey:
183
+
184
+ | Metric | Range | What It Means |
185
+ |--------|-------|---------------|
186
+ | **Patience** | 0.0 - 1.0 | Willingness to keep trying. Depletes with delays, errors, confusion. |
187
+ | **Confusion** | 0.0 - 1.0 | How lost they feel. Increases with unclear UI, unexpected behavior. |
188
+ | **Frustration** | 0.0 - 1.0 | Emotional response to friction. Increases with repeated failures, dead ends. |
189
+
190
+ ### Abandonment Triggers
191
+
192
+ A persona abandons when any of these occur:
193
+ - **Patience < 0.1** — "This is taking too long, I'm done"
194
+ - **Confusion > 0.8 for 30+ seconds** — "I have no idea what to do"
195
+ - **Frustration > 0.85** — "This is ridiculous"
196
+ - **No progress after 10+ steps** — "I'm not getting anywhere"
197
+ - **Same page visited 3+ times** — "I keep ending up here"
198
+
199
+ Different personas have different starting values and depletion rates. An impatient-user starts with 0.4 patience and loses it twice as fast as a power-user.
200
+
201
+ ---
202
+
203
+ ## Persona Quick Reference
204
+
205
+ | Persona | Patience | Confusion Tolerance | Key Trait |
206
+ |---------|----------|---------------------|-----------|
207
+ | `power-user` | High | Low (expects clarity) | Fast decisions, low reading |
208
+ | `first-timer` | Medium | Medium | Explores, reads more |
209
+ | `elderly-user` | High | High | Slow, thorough, easily confused by jargon |
210
+ | `impatient-user` | Very Low | Low | Abandons fast on any friction |
211
+ | `mobile-user` | Low | Medium | Fat-finger issues, small viewport |
212
+ | `cognitive-adhd` | Low | High | Skims, clicks fast, distracted easily |
213
+
214
+ See [Persona Index](/docs/Persona-Index/) for complete profiles.
215
+
216
+ ---
217
+
218
+ ## Related Documentation
219
+
220
+ - [Cognitive User Simulation](/docs/Cognitive-User-Simulation/) — Deep dive on how cognitive simulation works
221
+ - [Persona Index](/docs/Persona-Index/) — All 9 built-in personas
222
+ - [Multi-Persona Comparison](/docs/Multi-Persona-Comparison/) — Comparison workflows
223
+ - [Trait Index](/docs/Trait-Index/) — The 25 cognitive traits
224
+
225
+ ---
226
+
227
+ *Last updated: v17.6.0*