cbrowser 16.7.0 β 16.7.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.
- package/README.md +3 -3
- package/docs/GETTING-STARTED.md +226 -0
- package/docs/MCP-INTEGRATION.md +295 -0
- package/docs/PERSONA-QUESTIONNAIRE.md +322 -0
- package/docs/README.md +74 -0
- package/examples/persona-questionnaire.ts +219 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
| Capability | Status | Why It Matters |
|
|
22
22
|
|------------|--------|----------------|
|
|
23
23
|
| **Natural Language Tests** | β Best-in-class | Write tests in plain English. 10-step E2E flows run 100% stable. |
|
|
24
|
-
| **Cognitive User Simulation** | π¬ Novel |
|
|
24
|
+
| **Cognitive User Simulation** | π¬ Novel | 25 research-backed traits model real human behaviorβnot just clicks. |
|
|
25
25
|
| **Empathy Accessibility Audits** | π¬ Novel | Simulate users with tremors, low vision, ADHD. No competitor offers this. |
|
|
26
26
|
| **Self-Healing Selectors** | β
Production-ready | ARIA-first with 0.8+ confidence gating. Handles DOM changes automatically. |
|
|
27
27
|
| **Constitutional AI Safety** | π¬ Novel | Risk-classified actions prevent autonomous agents from doing damage. |
|
|
28
|
-
| **
|
|
28
|
+
| **48 MCP Tools** | β
Production-ready | Full Claude integrationβlocal and remote servers. |
|
|
29
29
|
|
|
30
30
|
---
|
|
31
31
|
|
|
@@ -271,7 +271,7 @@ Deploy your own: see [Remote MCP Server Guide](docs/REMOTE-MCP-SERVER.md)
|
|
|
271
271
|
}
|
|
272
272
|
```
|
|
273
273
|
|
|
274
|
-
###
|
|
274
|
+
### 48 MCP Tools
|
|
275
275
|
|
|
276
276
|
| Category | Tools |
|
|
277
277
|
|----------|-------|
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# Getting Started with CBrowser
|
|
2
|
+
|
|
3
|
+
CBrowser (Cognitive Browser) is the browser automation that thinks like your users. This guide will get you up and running quickly.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install cbrowser
|
|
9
|
+
npx playwright install chromium
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Your First Commands
|
|
13
|
+
|
|
14
|
+
### Navigate to a Page
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx cbrowser navigate "https://example.com"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Click with Self-Healing Selectors
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cbrowser smart-click "Add to Cart"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
CBrowser uses AI to find elements by description, not brittle CSS selectors. If the DOM changes, the self-healing system adapts automatically.
|
|
27
|
+
|
|
28
|
+
### Natural Language Assertions
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx cbrowser assert "page contains 'Order Confirmed'"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Take a Screenshot
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx cbrowser screenshot --path order-confirmation.png
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Cognitive User Simulation
|
|
41
|
+
|
|
42
|
+
This is what makes CBrowser unique. Instead of just clicking buttons, it simulates how real users think:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx cbrowser cognitive-journey \
|
|
46
|
+
--persona first-timer \
|
|
47
|
+
--start "https://example.com" \
|
|
48
|
+
--goal "complete checkout"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The simulation tracks:
|
|
52
|
+
- **Patience** - Will they wait for slow pages?
|
|
53
|
+
- **Confusion** - Are they getting lost?
|
|
54
|
+
- **Frustration** - Are errors piling up?
|
|
55
|
+
- **Abandonment** - When will they give up?
|
|
56
|
+
|
|
57
|
+
### Output Example
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
=== Cognitive Journey: first-timer ===
|
|
61
|
+
Goal: complete checkout
|
|
62
|
+
Start: https://example.com
|
|
63
|
+
|
|
64
|
+
Step 1: Looking for product catalog
|
|
65
|
+
Action: click "Shop Now"
|
|
66
|
+
Patience: 95% | Confusion: 5%
|
|
67
|
+
|
|
68
|
+
Step 2: Found products, browsing
|
|
69
|
+
Action: click first product
|
|
70
|
+
Patience: 90% | Confusion: 10%
|
|
71
|
+
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
Step 8: ABANDONED
|
|
75
|
+
Reason: Patience depleted (8%)
|
|
76
|
+
Thought: "This password form is too confusing..."
|
|
77
|
+
Friction points:
|
|
78
|
+
- Password requirements unclear (step 6)
|
|
79
|
+
- Form validation error not visible (step 7)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Built-in Personas
|
|
83
|
+
|
|
84
|
+
| Persona | Description |
|
|
85
|
+
|---------|-------------|
|
|
86
|
+
| `power-user` | Tech-savvy, expects efficiency |
|
|
87
|
+
| `first-timer` | New user, explores carefully |
|
|
88
|
+
| `mobile-user` | Smartphone, touch interface |
|
|
89
|
+
| `elderly-user` | Patient, careful, vision/motor considerations |
|
|
90
|
+
| `impatient-user` | Quick to abandon on friction |
|
|
91
|
+
| `screen-reader-user` | Uses assistive technology |
|
|
92
|
+
|
|
93
|
+
## Create Custom Personas
|
|
94
|
+
|
|
95
|
+
Use the questionnaire system to create research-backed custom personas:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Interactive questionnaire
|
|
99
|
+
npx cbrowser persona-questionnaire start --name "anxious-newbie"
|
|
100
|
+
|
|
101
|
+
# The system asks behavioral questions and derives trait values
|
|
102
|
+
# with proper research-backed correlations
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Natural Language Tests
|
|
106
|
+
|
|
107
|
+
Write tests in plain English:
|
|
108
|
+
|
|
109
|
+
```txt
|
|
110
|
+
# checkout-test.txt
|
|
111
|
+
go to https://example.com/products
|
|
112
|
+
click "Add to Cart" button
|
|
113
|
+
verify page contains "1 item in cart"
|
|
114
|
+
click checkout
|
|
115
|
+
fill email with "test@example.com"
|
|
116
|
+
click "Place Order"
|
|
117
|
+
verify url contains "/confirmation"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Run them:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npx cbrowser test-suite checkout-test.txt --html
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Visual Testing
|
|
127
|
+
|
|
128
|
+
### Capture Baseline
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
npx cbrowser ai-visual capture "https://example.com" --name homepage
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Test Against Baseline
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npx cbrowser ai-visual test "https://staging.example.com" homepage --html
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Cross-Browser Comparison
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npx cbrowser cross-browser "https://example.com" --html
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Responsive Testing
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx cbrowser responsive "https://example.com" --html
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Constitutional AI Safety
|
|
153
|
+
|
|
154
|
+
CBrowser classifies every action by risk level:
|
|
155
|
+
|
|
156
|
+
| Zone | Examples | Behavior |
|
|
157
|
+
|------|----------|----------|
|
|
158
|
+
| Green | Navigate, read, screenshot | Auto-execute |
|
|
159
|
+
| Yellow | Click buttons, fill forms | Log and proceed |
|
|
160
|
+
| Red | Submit, delete, purchase | Requires verification |
|
|
161
|
+
| Black | Bypass auth, inject scripts | Never executes |
|
|
162
|
+
|
|
163
|
+
This prevents AI agents from accidentally submitting forms, deleting data, or making purchases.
|
|
164
|
+
|
|
165
|
+
## API Key for Cognitive Features
|
|
166
|
+
|
|
167
|
+
Some features require an Anthropic API key:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npx cbrowser config set-api-key
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## MCP Integration
|
|
174
|
+
|
|
175
|
+
### Claude Desktop
|
|
176
|
+
|
|
177
|
+
Add to `claude_desktop_config.json`:
|
|
178
|
+
|
|
179
|
+
```json
|
|
180
|
+
{
|
|
181
|
+
"mcpServers": {
|
|
182
|
+
"cbrowser": {
|
|
183
|
+
"command": "npx",
|
|
184
|
+
"args": ["cbrowser", "mcp-server"]
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### claude.ai (Remote)
|
|
191
|
+
|
|
192
|
+
Use the public demo server:
|
|
193
|
+
```
|
|
194
|
+
https://cbrowser-mcp-demo.wyldfyre.ai/mcp
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Or deploy your own: see [MCP Integration](./MCP-INTEGRATION.md).
|
|
198
|
+
|
|
199
|
+
## Next Steps
|
|
200
|
+
|
|
201
|
+
- [Cognitive Simulation](./COGNITIVE-SIMULATION.md) - Deep dive into user simulation
|
|
202
|
+
- [Persona Questionnaire](./PERSONA-QUESTIONNAIRE.md) - Create custom personas
|
|
203
|
+
- [Natural Language Tests](./NATURAL-LANGUAGE-TESTS.md) - Write tests in English
|
|
204
|
+
- [Visual Testing](./VISUAL-TESTING.md) - Screenshot-based regression testing
|
|
205
|
+
- [MCP Integration](./MCP-INTEGRATION.md) - Full Claude integration guide
|
|
206
|
+
|
|
207
|
+
## Quick Reference
|
|
208
|
+
|
|
209
|
+
| Command | Description |
|
|
210
|
+
|---------|-------------|
|
|
211
|
+
| `npx cbrowser navigate <url>` | Navigate to URL |
|
|
212
|
+
| `npx cbrowser click <selector>` | Click element |
|
|
213
|
+
| `npx cbrowser smart-click <text>` | AI-powered click |
|
|
214
|
+
| `npx cbrowser fill <selector> <value>` | Fill input |
|
|
215
|
+
| `npx cbrowser screenshot` | Capture screenshot |
|
|
216
|
+
| `npx cbrowser assert <assertion>` | Verify condition |
|
|
217
|
+
| `npx cbrowser cognitive-journey` | Run user simulation |
|
|
218
|
+
| `npx cbrowser test-suite <file>` | Run NL tests |
|
|
219
|
+
| `npx cbrowser ai-visual capture` | Capture baseline |
|
|
220
|
+
| `npx cbrowser ai-visual test` | Run visual test |
|
|
221
|
+
| `npx cbrowser cross-browser` | Cross-browser test |
|
|
222
|
+
| `npx cbrowser responsive` | Responsive test |
|
|
223
|
+
| `npx cbrowser agent-ready-audit` | Audit for AI agents |
|
|
224
|
+
| `npx cbrowser empathy-audit` | Disability simulation |
|
|
225
|
+
| `npx cbrowser persona-questionnaire` | Create custom persona |
|
|
226
|
+
| `npx cbrowser status` | Check environment |
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# MCP Server Integration
|
|
2
|
+
|
|
3
|
+
CBrowser provides full Model Context Protocol (MCP) integration for Claude Desktop and claude.ai.
|
|
4
|
+
|
|
5
|
+
## Quick Setup
|
|
6
|
+
|
|
7
|
+
### Local MCP (Claude Desktop)
|
|
8
|
+
|
|
9
|
+
Add to your `claude_desktop_config.json`:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"cbrowser": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["cbrowser", "mcp-server"]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Remote MCP (claude.ai)
|
|
23
|
+
|
|
24
|
+
**Public Demo Server** (rate-limited, for evaluation):
|
|
25
|
+
```
|
|
26
|
+
URL: https://cbrowser-mcp-demo.wyldfyre.ai/mcp
|
|
27
|
+
Rate limit: 5 requests/minute, burst of 10
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Deploy Your Own:**
|
|
31
|
+
```bash
|
|
32
|
+
# Default (no auth)
|
|
33
|
+
npx cbrowser mcp-remote
|
|
34
|
+
|
|
35
|
+
# With API key
|
|
36
|
+
MCP_API_KEY=your-secret npx cbrowser mcp-remote
|
|
37
|
+
|
|
38
|
+
# With Auth0 OAuth
|
|
39
|
+
AUTH0_DOMAIN=your-tenant.auth0.com \
|
|
40
|
+
AUTH0_AUDIENCE=https://your-server/ \
|
|
41
|
+
npx cbrowser mcp-remote
|
|
42
|
+
|
|
43
|
+
# Custom port
|
|
44
|
+
PORT=8080 npx cbrowser mcp-remote
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## All 48 MCP Tools
|
|
48
|
+
|
|
49
|
+
### Navigation (5 tools)
|
|
50
|
+
|
|
51
|
+
| Tool | Description |
|
|
52
|
+
|------|-------------|
|
|
53
|
+
| `navigate` | Navigate to URL with intelligent wait detection |
|
|
54
|
+
| `screenshot` | Capture page screenshot |
|
|
55
|
+
| `extract` | Extract structured data (links, headings, forms, images, text) |
|
|
56
|
+
| `cloudflare_detect` | Detect Cloudflare protection |
|
|
57
|
+
| `cloudflare_wait` | Wait for Cloudflare challenge completion |
|
|
58
|
+
|
|
59
|
+
### Interaction (4 tools)
|
|
60
|
+
|
|
61
|
+
| Tool | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `click` | Click element by selector or description |
|
|
64
|
+
| `smart_click` | Self-healing click with retry and selector recovery |
|
|
65
|
+
| `fill` | Fill form input with value |
|
|
66
|
+
| `scroll` | Scroll page or element |
|
|
67
|
+
|
|
68
|
+
### Testing (3 tools)
|
|
69
|
+
|
|
70
|
+
| Tool | Description |
|
|
71
|
+
|------|-------------|
|
|
72
|
+
| `nl_test_file` | Run natural language test suite from file |
|
|
73
|
+
| `nl_test_inline` | Run natural language tests from inline content |
|
|
74
|
+
| `repair_test` | AI-powered test repair for broken tests |
|
|
75
|
+
| `detect_flaky_tests` | Identify unreliable tests by running multiple times |
|
|
76
|
+
|
|
77
|
+
### Visual Testing (6 tools)
|
|
78
|
+
|
|
79
|
+
| Tool | Description |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| `visual_baseline` | Capture visual baseline for URL |
|
|
82
|
+
| `visual_regression` | Compare current page against baseline |
|
|
83
|
+
| `cross_browser_test` | Test across Chrome, Firefox, Safari |
|
|
84
|
+
| `cross_browser_diff` | Quick metrics comparison across browsers |
|
|
85
|
+
| `responsive_test` | Test across viewport sizes |
|
|
86
|
+
| `ab_comparison` | Compare two URLs visually |
|
|
87
|
+
|
|
88
|
+
### Cognitive Simulation (3 tools)
|
|
89
|
+
|
|
90
|
+
| Tool | Description |
|
|
91
|
+
|------|-------------|
|
|
92
|
+
| `cognitive_journey_init` | Initialize cognitive user simulation |
|
|
93
|
+
| `cognitive_journey_update_state` | Update mental state during journey |
|
|
94
|
+
| `compare_personas` | Compare experience across personas |
|
|
95
|
+
|
|
96
|
+
### Persona Questionnaire (3 tools) - *New in v16.6.0*
|
|
97
|
+
|
|
98
|
+
| Tool | Description |
|
|
99
|
+
|------|-------------|
|
|
100
|
+
| `persona_questionnaire_get` | Generate questionnaire questions for custom persona |
|
|
101
|
+
| `persona_questionnaire_build` | Build trait profile from questionnaire answers |
|
|
102
|
+
| `persona_trait_lookup` | Look up behaviors for specific trait value |
|
|
103
|
+
|
|
104
|
+
### Analysis (5 tools)
|
|
105
|
+
|
|
106
|
+
| Tool | Description |
|
|
107
|
+
|------|-------------|
|
|
108
|
+
| `hunt_bugs` | Autonomous bug hunting and issue discovery |
|
|
109
|
+
| `chaos_test` | Inject failures and test resilience |
|
|
110
|
+
| `agent_ready_audit` | Analyze site for AI-agent friendliness |
|
|
111
|
+
| `competitive_benchmark` | Compare UX across competitor sites |
|
|
112
|
+
| `empathy_audit` | Simulate users with disabilities |
|
|
113
|
+
|
|
114
|
+
### Performance (3 tools)
|
|
115
|
+
|
|
116
|
+
| Tool | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `perf_baseline` | Capture performance baseline |
|
|
119
|
+
| `perf_regression` | Detect performance regression |
|
|
120
|
+
| `list_baselines` | List all saved baselines |
|
|
121
|
+
|
|
122
|
+
### Stealth (5 tools)
|
|
123
|
+
|
|
124
|
+
| Tool | Description |
|
|
125
|
+
|------|-------------|
|
|
126
|
+
| `stealth_enable` | Enable stealth mode |
|
|
127
|
+
| `stealth_disable` | Disable stealth mode |
|
|
128
|
+
| `stealth_status` | Check current stealth status |
|
|
129
|
+
| `stealth_check` | Check for bot detection |
|
|
130
|
+
| `stealth_diagnose` | Diagnose detection issues |
|
|
131
|
+
|
|
132
|
+
### Utility (4 tools)
|
|
133
|
+
|
|
134
|
+
| Tool | Description |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `save_session` | Save browser session (cookies, storage) |
|
|
137
|
+
| `load_session` | Load saved session |
|
|
138
|
+
| `list_sessions` | List saved sessions |
|
|
139
|
+
| `delete_session` | Delete saved session |
|
|
140
|
+
|
|
141
|
+
### Persona (4 tools)
|
|
142
|
+
|
|
143
|
+
| Tool | Description |
|
|
144
|
+
|------|-------------|
|
|
145
|
+
| `list_cognitive_personas` | List all available personas |
|
|
146
|
+
| `find_element_by_intent` | AI-powered semantic element finding |
|
|
147
|
+
| `dismiss_overlay` | Dismiss modal overlays (cookies, popups) |
|
|
148
|
+
| `status` | Get CBrowser environment status |
|
|
149
|
+
|
|
150
|
+
## Tool Usage Examples
|
|
151
|
+
|
|
152
|
+
### Cognitive Journey with Custom Persona
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
// Step 1: Get questionnaire
|
|
156
|
+
persona_questionnaire_get({ comprehensive: false })
|
|
157
|
+
|
|
158
|
+
// Step 2: Build traits from answers
|
|
159
|
+
persona_questionnaire_build({
|
|
160
|
+
answers: { patience: 0.25, curiosity: 0.75 },
|
|
161
|
+
name: "anxious-explorer"
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
// Step 3: Run journey with custom persona
|
|
165
|
+
cognitive_journey_init({
|
|
166
|
+
persona: "anxious-explorer",
|
|
167
|
+
startUrl: "https://example.com",
|
|
168
|
+
goal: "complete checkout"
|
|
169
|
+
})
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Agent-Ready Audit
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
agent_ready_audit({ url: "https://example.com" })
|
|
176
|
+
|
|
177
|
+
// Returns:
|
|
178
|
+
// - Overall score (0-100)
|
|
179
|
+
// - Grade (A-F)
|
|
180
|
+
// - Findability, stability, accessibility scores
|
|
181
|
+
// - Issues with remediation suggestions
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Visual Regression
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
// Capture baseline
|
|
188
|
+
visual_baseline({ url: "https://example.com", name: "homepage" })
|
|
189
|
+
|
|
190
|
+
// Later, compare against baseline
|
|
191
|
+
visual_regression({ url: "https://staging.example.com", baselineName: "homepage" })
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Competitive Benchmark
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
competitive_benchmark({
|
|
198
|
+
sites: [
|
|
199
|
+
"https://yoursite.com",
|
|
200
|
+
"https://competitor-a.com",
|
|
201
|
+
"https://competitor-b.com"
|
|
202
|
+
],
|
|
203
|
+
goal: "sign up for free trial",
|
|
204
|
+
persona: "first-timer"
|
|
205
|
+
})
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Authentication Methods
|
|
209
|
+
|
|
210
|
+
### API Key Authentication
|
|
211
|
+
|
|
212
|
+
For Claude Code CLI and scripts:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Bearer token
|
|
216
|
+
curl -H "Authorization: Bearer your-api-key" https://your-server/mcp
|
|
217
|
+
|
|
218
|
+
# X-API-Key header
|
|
219
|
+
curl -H "X-API-Key: your-api-key" https://your-server/mcp
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Configure multiple keys:
|
|
223
|
+
```bash
|
|
224
|
+
MCP_API_KEYS=key1,key2,key3 npx cbrowser mcp-remote
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Auth0 OAuth
|
|
228
|
+
|
|
229
|
+
For claude.ai web interface:
|
|
230
|
+
|
|
231
|
+
1. Set up Auth0 tenant
|
|
232
|
+
2. Configure environment:
|
|
233
|
+
```bash
|
|
234
|
+
AUTH0_DOMAIN=your-tenant.auth0.com
|
|
235
|
+
AUTH0_AUDIENCE=https://your-server/
|
|
236
|
+
```
|
|
237
|
+
3. In claude.ai: Settings > Integrations > Custom Connectors
|
|
238
|
+
4. Add connector URL and complete OAuth flow
|
|
239
|
+
|
|
240
|
+
Features:
|
|
241
|
+
- OAuth 2.1 with PKCE
|
|
242
|
+
- JWT and opaque token validation
|
|
243
|
+
- 30-minute token caching
|
|
244
|
+
- Protected Resource Metadata via `/.well-known/oauth-protected-resource`
|
|
245
|
+
|
|
246
|
+
### Dual Authentication
|
|
247
|
+
|
|
248
|
+
Both OAuth and API keys can be enabled simultaneously for maximum flexibility.
|
|
249
|
+
|
|
250
|
+
## Server Endpoints
|
|
251
|
+
|
|
252
|
+
| Endpoint | Description | Auth |
|
|
253
|
+
|----------|-------------|------|
|
|
254
|
+
| `/mcp` | MCP protocol endpoint | Required if configured |
|
|
255
|
+
| `/health` | Health check | Always open |
|
|
256
|
+
| `/info` | Server info | Always open |
|
|
257
|
+
| `/.well-known/oauth-protected-resource` | OAuth metadata | If Auth0 configured |
|
|
258
|
+
|
|
259
|
+
## Docker Deployment
|
|
260
|
+
|
|
261
|
+
```yaml
|
|
262
|
+
# docker-compose.yml
|
|
263
|
+
version: "3.8"
|
|
264
|
+
services:
|
|
265
|
+
cbrowser-mcp:
|
|
266
|
+
image: ghcr.io/alexandriashai/cbrowser:latest
|
|
267
|
+
command: ["mcp-remote"]
|
|
268
|
+
ports:
|
|
269
|
+
- "3000:3000"
|
|
270
|
+
environment:
|
|
271
|
+
- MCP_API_KEY=${MCP_API_KEY}
|
|
272
|
+
- PORT=3000
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Troubleshooting
|
|
276
|
+
|
|
277
|
+
### Connection Issues
|
|
278
|
+
|
|
279
|
+
1. Verify server is running: `curl http://localhost:3000/health`
|
|
280
|
+
2. Check authentication: `curl -H "Authorization: Bearer key" http://localhost:3000/info`
|
|
281
|
+
3. Verify MCP endpoint: `curl -X POST http://localhost:3000/mcp`
|
|
282
|
+
|
|
283
|
+
### Claude Desktop Not Detecting Tools
|
|
284
|
+
|
|
285
|
+
1. Restart Claude Desktop after config changes
|
|
286
|
+
2. Verify config path: `~/.config/claude/claude_desktop_config.json`
|
|
287
|
+
3. Check npx is in PATH
|
|
288
|
+
4. Verify cbrowser is installed: `npx cbrowser --version`
|
|
289
|
+
|
|
290
|
+
### Rate Limiting on Demo Server
|
|
291
|
+
|
|
292
|
+
The demo server is rate-limited for evaluation. For production use:
|
|
293
|
+
1. Deploy your own server
|
|
294
|
+
2. Use API key authentication
|
|
295
|
+
3. Configure appropriate rate limits
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Persona Questionnaire System
|
|
2
|
+
|
|
3
|
+
**Introduced in v16.6.0**
|
|
4
|
+
|
|
5
|
+
The Persona Questionnaire system provides research-backed trait mapping for creating custom cognitive personas. Instead of defaulting traits to 0.5 (neutral baseline), this system uses behavioral questions to derive differentiated trait profiles.
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
When creating custom personas, AI-generated profiles often defaulted many traits to 0.5. This creates "average" personas that don't accurately represent real user diversity.
|
|
10
|
+
|
|
11
|
+
## The Solution
|
|
12
|
+
|
|
13
|
+
The questionnaire system:
|
|
14
|
+
1. Maps behavioral answers to trait values (0-1 scale)
|
|
15
|
+
2. Uses 5 distinct behavioral levels per trait (0, 0.25, 0.5, 0.75, 1.0)
|
|
16
|
+
3. Applies research-backed correlations between traits
|
|
17
|
+
4. Provides behavioral descriptions based on academic research
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
### CLI Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Interactive 8-question questionnaire
|
|
25
|
+
npx cbrowser persona-questionnaire start
|
|
26
|
+
|
|
27
|
+
# Comprehensive 25-trait questionnaire
|
|
28
|
+
npx cbrowser persona-questionnaire start --comprehensive --name "my-persona"
|
|
29
|
+
|
|
30
|
+
# Look up trait behavior at specific value
|
|
31
|
+
npx cbrowser persona-questionnaire lookup --trait patience --value 0.25
|
|
32
|
+
|
|
33
|
+
# List all available traits
|
|
34
|
+
npx cbrowser persona-questionnaire list-traits
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Programmatic Usage
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import {
|
|
41
|
+
generatePersonaQuestionnaire,
|
|
42
|
+
buildTraitsFromAnswers,
|
|
43
|
+
getTraitBehaviors,
|
|
44
|
+
getTraitLabel,
|
|
45
|
+
} from 'cbrowser';
|
|
46
|
+
|
|
47
|
+
// Generate questionnaire
|
|
48
|
+
const questionnaire = generatePersonaQuestionnaire({ comprehensive: false });
|
|
49
|
+
|
|
50
|
+
// Build traits from answers
|
|
51
|
+
const traits = buildTraitsFromAnswers({
|
|
52
|
+
patience: 0.25,
|
|
53
|
+
riskTolerance: 0.75,
|
|
54
|
+
curiosity: 1.0,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Look up specific trait behavior
|
|
58
|
+
const behaviors = getTraitBehaviors('patience', 0.25);
|
|
59
|
+
console.log(behaviors.label); // "Low"
|
|
60
|
+
console.log(behaviors.behaviors); // ["Gets frustrated quickly", ...]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### MCP Tools
|
|
64
|
+
|
|
65
|
+
Three MCP tools are available:
|
|
66
|
+
|
|
67
|
+
| Tool | Description |
|
|
68
|
+
|------|-------------|
|
|
69
|
+
| `persona_questionnaire_get` | Generate questionnaire questions |
|
|
70
|
+
| `persona_questionnaire_build` | Build trait profile from answers |
|
|
71
|
+
| `persona_trait_lookup` | Look up behaviors for trait value |
|
|
72
|
+
|
|
73
|
+
## The 25 Cognitive Traits
|
|
74
|
+
|
|
75
|
+
| Trait | Research Basis | What It Models |
|
|
76
|
+
|-------|---------------|----------------|
|
|
77
|
+
| **patience** | UX research | Time before abandoning on friction |
|
|
78
|
+
| **riskTolerance** | Prospect theory | Willingness to try unfamiliar actions |
|
|
79
|
+
| **comprehension** | Cognitive load theory | UI pattern understanding |
|
|
80
|
+
| **persistence** | Motivation research | Retry behavior after failures |
|
|
81
|
+
| **curiosity** | Exploration theory | Feature discovery tendency |
|
|
82
|
+
| **workingMemory** | Cognitive psychology | Multi-step task handling |
|
|
83
|
+
| **readingTendency** | Eye-tracking studies | Text consumption behavior |
|
|
84
|
+
| **resilience** | Positive psychology | Bounce-back from errors |
|
|
85
|
+
| **selfEfficacy** | Bandura (1977) | Belief in problem-solving ability |
|
|
86
|
+
| **satisficing** | Simon (1956) | Accept "good enough" vs optimize |
|
|
87
|
+
| **trustCalibration** | Fogg (2003) | Trust in unfamiliar interfaces |
|
|
88
|
+
| **interruptRecovery** | Mark et al. (2005) | Resume after distractions |
|
|
89
|
+
| **decisionFatigue** | Baumeister | Decision quality over time |
|
|
90
|
+
| **internalAttribution** | Attribution theory | Self-blame for failures |
|
|
91
|
+
| **externalAttribution** | Attribution theory | System-blame for failures |
|
|
92
|
+
| **techSavviness** | Digital literacy | Familiarity with UI patterns |
|
|
93
|
+
| **attentionSpan** | Attention research | Focus duration |
|
|
94
|
+
| **impulsivity** | Behavioral psychology | Quick vs deliberate actions |
|
|
95
|
+
| **errorRecovery** | Human factors | Speed of correcting mistakes |
|
|
96
|
+
| **visualProcessing** | Cognitive science | Image vs text preference |
|
|
97
|
+
| **spatialMemory** | Navigation research | UI layout recall |
|
|
98
|
+
| **patternRecognition** | Expertise research | UI element identification |
|
|
99
|
+
| **riskPerception** | Risk psychology | Danger assessment |
|
|
100
|
+
| **socialProof** | Cialdini (1984) | Influence of others' actions |
|
|
101
|
+
| **authorityTrust** | Trust research | Trust in official sources |
|
|
102
|
+
|
|
103
|
+
## Trait Reference Matrix
|
|
104
|
+
|
|
105
|
+
Each trait has 5 behavioral levels with specific descriptions:
|
|
106
|
+
|
|
107
|
+
### Example: Patience Trait
|
|
108
|
+
|
|
109
|
+
| Value | Label | Behaviors |
|
|
110
|
+
|-------|-------|-----------|
|
|
111
|
+
| 0 | Very Low | Abandons at first sign of friction, expects instant results |
|
|
112
|
+
| 0.25 | Low | Gets frustrated quickly, skips slow-loading content |
|
|
113
|
+
| 0.5 | Moderate | Waits reasonable time, tolerates some friction |
|
|
114
|
+
| 0.75 | High | Patient with delays, reads loading messages |
|
|
115
|
+
| 1.0 | Very High | Extremely patient, waits through any delay |
|
|
116
|
+
|
|
117
|
+
### Example: Self-Efficacy Trait
|
|
118
|
+
|
|
119
|
+
| Value | Label | Behaviors |
|
|
120
|
+
|-------|-------|-----------|
|
|
121
|
+
| 0 | Very Low | "I can't do this", gives up immediately on challenge |
|
|
122
|
+
| 0.25 | Low | Doubts ability, abandons 40% faster than average |
|
|
123
|
+
| 0.5 | Moderate | Normal confidence, persists through minor challenges |
|
|
124
|
+
| 0.75 | High | Confident problem-solver, sees obstacles as puzzles |
|
|
125
|
+
| 1.0 | Very High | "I'll figure this out", never attributes failure to self |
|
|
126
|
+
|
|
127
|
+
## Trait Correlations
|
|
128
|
+
|
|
129
|
+
The system automatically applies research-backed correlations:
|
|
130
|
+
|
|
131
|
+
| Primary Trait | Correlated Trait | Relationship |
|
|
132
|
+
|---------------|------------------|--------------|
|
|
133
|
+
| Low selfEfficacy | High internalAttribution | Self-blame for failures |
|
|
134
|
+
| Low selfEfficacy | Low resilience | Slower bounce-back |
|
|
135
|
+
| Low patience | Low resilience | Less tolerance for errors |
|
|
136
|
+
| High curiosity | Higher exploration | More feature discovery |
|
|
137
|
+
| Low trustCalibration | Longer evaluation time | Scrutinizes CTAs |
|
|
138
|
+
|
|
139
|
+
## Questionnaire Formats
|
|
140
|
+
|
|
141
|
+
### Quick Questionnaire (8 traits)
|
|
142
|
+
|
|
143
|
+
Core traits for basic persona differentiation:
|
|
144
|
+
- patience, riskTolerance, comprehension, persistence
|
|
145
|
+
- curiosity, workingMemory, readingTendency, resilience
|
|
146
|
+
|
|
147
|
+
### Comprehensive Questionnaire (25 traits)
|
|
148
|
+
|
|
149
|
+
All cognitive traits for detailed behavioral modeling.
|
|
150
|
+
|
|
151
|
+
### Custom Selection
|
|
152
|
+
|
|
153
|
+
Request specific traits:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
const questionnaire = generatePersonaQuestionnaire({
|
|
157
|
+
traits: ['patience', 'selfEfficacy', 'trustCalibration'],
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## AskUserQuestion Integration
|
|
162
|
+
|
|
163
|
+
For Claude sessions, use the `formatForAskUserQuestion` function:
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
import { formatForAskUserQuestion, generatePersonaQuestionnaire } from 'cbrowser';
|
|
167
|
+
|
|
168
|
+
const questionnaire = generatePersonaQuestionnaire({ comprehensive: false });
|
|
169
|
+
const askUserFormat = formatForAskUserQuestion(questionnaire.questions);
|
|
170
|
+
|
|
171
|
+
// Returns format compatible with Claude's AskUserQuestion tool:
|
|
172
|
+
// {
|
|
173
|
+
// questions: [
|
|
174
|
+
// {
|
|
175
|
+
// question: "How does this user handle waiting?",
|
|
176
|
+
// header: "patience",
|
|
177
|
+
// options: [
|
|
178
|
+
// { label: "Very impatient", description: "Abandons at first delay" },
|
|
179
|
+
// ...
|
|
180
|
+
// ],
|
|
181
|
+
// multiSelect: false
|
|
182
|
+
// },
|
|
183
|
+
// ...
|
|
184
|
+
// ]
|
|
185
|
+
// }
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## CLI Interactive Mode
|
|
189
|
+
|
|
190
|
+
The CLI provides an interactive questionnaire experience:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
$ npx cbrowser persona-questionnaire start --name "anxious-newbie"
|
|
194
|
+
|
|
195
|
+
=== CBrowser Persona Questionnaire ===
|
|
196
|
+
Creating persona: anxious-newbie (8 core traits)
|
|
197
|
+
|
|
198
|
+
[1/8] Patience
|
|
199
|
+
How does this user handle waiting for pages or actions?
|
|
200
|
+
1. Very impatient - abandons at first delay
|
|
201
|
+
2. Somewhat impatient - frustrated by normal load times
|
|
202
|
+
3. Average - tolerates reasonable waits
|
|
203
|
+
4. Patient - waits through delays calmly
|
|
204
|
+
5. Very patient - unlimited patience
|
|
205
|
+
> 2
|
|
206
|
+
|
|
207
|
+
[2/8] Risk Tolerance
|
|
208
|
+
How willing is this user to try unfamiliar features?
|
|
209
|
+
...
|
|
210
|
+
|
|
211
|
+
=== Persona Created ===
|
|
212
|
+
Saved to: ~/.cbrowser/personas/anxious-newbie.json
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Using Custom Personas
|
|
216
|
+
|
|
217
|
+
After creating a persona via questionnaire:
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
import { runCognitiveJourney } from 'cbrowser';
|
|
221
|
+
|
|
222
|
+
const result = await runCognitiveJourney({
|
|
223
|
+
persona: 'anxious-newbie', // Uses saved persona
|
|
224
|
+
startUrl: 'https://example.com',
|
|
225
|
+
goal: 'complete signup',
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Or with inline traits:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
const customTraits = buildTraitsFromAnswers({
|
|
233
|
+
patience: 0.25,
|
|
234
|
+
selfEfficacy: 0.25,
|
|
235
|
+
trustCalibration: 0.25,
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
const result = await runCognitiveJourney({
|
|
239
|
+
persona: 'custom',
|
|
240
|
+
customTraits,
|
|
241
|
+
startUrl: 'https://example.com',
|
|
242
|
+
goal: 'complete signup',
|
|
243
|
+
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Research Citations
|
|
247
|
+
|
|
248
|
+
The trait system is grounded in academic research:
|
|
249
|
+
|
|
250
|
+
- **Bandura, A. (1977)** - Self-Efficacy: Toward a Unifying Theory of Behavioral Change
|
|
251
|
+
- **Kahneman, D. & Tversky, A.** - Prospect Theory and Decision Making
|
|
252
|
+
- **Simon, H. (1956)** - Satisficing and Administrative Behavior
|
|
253
|
+
- **Fogg, B.J. (2003)** - Persuasive Technology and Trust
|
|
254
|
+
- **Mark, G. et al. (2005)** - No Task Left Behind: Interrupt Recovery
|
|
255
|
+
- **Baumeister, R.** - Ego Depletion and Decision Fatigue
|
|
256
|
+
- **Nielsen, J.** - Usability Engineering and User Behavior
|
|
257
|
+
- **Cialdini, R. (1984)** - Influence: The Psychology of Persuasion
|
|
258
|
+
|
|
259
|
+
## API Reference
|
|
260
|
+
|
|
261
|
+
### generatePersonaQuestionnaire(options)
|
|
262
|
+
|
|
263
|
+
Generate questionnaire questions.
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
interface QuestionnaireOptions {
|
|
267
|
+
comprehensive?: boolean; // All 25 traits (default: false = 8 traits)
|
|
268
|
+
traits?: string[]; // Specific traits to include
|
|
269
|
+
includeResearch?: boolean; // Include research citations
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const questionnaire = generatePersonaQuestionnaire(options);
|
|
273
|
+
// Returns: { questions: Question[], estimatedMinutes: number }
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### buildTraitsFromAnswers(answers)
|
|
277
|
+
|
|
278
|
+
Build complete trait profile from questionnaire answers.
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
const traits = buildTraitsFromAnswers({
|
|
282
|
+
patience: 0.25,
|
|
283
|
+
curiosity: 0.75,
|
|
284
|
+
});
|
|
285
|
+
// Returns: CognitiveTraits with correlations applied
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### getTraitBehaviors(trait, value)
|
|
289
|
+
|
|
290
|
+
Get behavioral description for a trait value.
|
|
291
|
+
|
|
292
|
+
```typescript
|
|
293
|
+
const behaviors = getTraitBehaviors('patience', 0.25);
|
|
294
|
+
// Returns: { label: string, description: string, behaviors: string[] }
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### getTraitLabel(trait, value)
|
|
298
|
+
|
|
299
|
+
Get short label for trait value.
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const label = getTraitLabel('patience', 0.25);
|
|
303
|
+
// Returns: "Low"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### getTraitReference(trait)
|
|
307
|
+
|
|
308
|
+
Get full research reference for a trait.
|
|
309
|
+
|
|
310
|
+
```typescript
|
|
311
|
+
const ref = getTraitReference('selfEfficacy');
|
|
312
|
+
// Returns: { researchBasis: string, citations: string[], levels: Level[] }
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### formatForAskUserQuestion(questions)
|
|
316
|
+
|
|
317
|
+
Format questions for Claude's AskUserQuestion tool.
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
const formatted = formatForAskUserQuestion(questions);
|
|
321
|
+
// Returns: { questions: AskUserQuestion[] }
|
|
322
|
+
```
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# CBrowser Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the CBrowser documentation. This directory contains comprehensive guides for all CBrowser features.
|
|
4
|
+
|
|
5
|
+
## Quick Links
|
|
6
|
+
|
|
7
|
+
| Guide | Description |
|
|
8
|
+
|-------|-------------|
|
|
9
|
+
| [Getting Started](./GETTING-STARTED.md) | Installation, first commands, basic usage |
|
|
10
|
+
| [Cognitive Simulation](./COGNITIVE-SIMULATION.md) | User simulation, personas, trait system |
|
|
11
|
+
| [Persona Questionnaire](./PERSONA-QUESTIONNAIRE.md) | Research-backed custom persona creation |
|
|
12
|
+
| [Visual Testing](./VISUAL-TESTING.md) | AI visual regression, cross-browser, responsive |
|
|
13
|
+
| [MCP Integration](./MCP-INTEGRATION.md) | Claude Desktop and remote MCP server setup |
|
|
14
|
+
| [Natural Language Tests](./NATURAL-LANGUAGE-TESTS.md) | Writing tests in plain English |
|
|
15
|
+
| [Constitutional Safety](./CONSTITUTIONAL-SAFETY.md) | Risk classification and safety zones |
|
|
16
|
+
| [CLI Reference](./CLI-REFERENCE.md) | Complete command-line reference |
|
|
17
|
+
| [API Reference](./API-REFERENCE.md) | TypeScript API documentation |
|
|
18
|
+
|
|
19
|
+
## Feature Guides
|
|
20
|
+
|
|
21
|
+
### Core Features
|
|
22
|
+
- [Self-Healing Selectors](./SELF-HEALING-SELECTORS.md) - ARIA-first selector strategy
|
|
23
|
+
- [Agent-Ready Audit](./AGENT-READY-AUDIT.md) - AI-agent friendliness analysis
|
|
24
|
+
- [Competitive Benchmark](./COMPETITIVE-BENCHMARK.md) - UX comparison across sites
|
|
25
|
+
- [Empathy Audit](./EMPATHY-AUDIT.md) - Disability simulation testing
|
|
26
|
+
|
|
27
|
+
### Testing Features
|
|
28
|
+
- [Test Suites](./TEST-SUITES.md) - Natural language test execution
|
|
29
|
+
- [Test Repair](./TEST-REPAIR.md) - AI-powered test fixing
|
|
30
|
+
- [Flaky Detection](./FLAKY-DETECTION.md) - Identify unreliable tests
|
|
31
|
+
- [Coverage Mapping](./COVERAGE-MAPPING.md) - Find untested pages
|
|
32
|
+
|
|
33
|
+
### Visual Features
|
|
34
|
+
- [Visual Baselines](./VISUAL-BASELINES.md) - Capture and compare screenshots
|
|
35
|
+
- [Cross-Browser Testing](./CROSS-BROWSER-TESTING.md) - Chrome, Firefox, Safari comparison
|
|
36
|
+
- [Responsive Testing](./RESPONSIVE-TESTING.md) - Mobile, tablet, desktop viewports
|
|
37
|
+
- [A/B Comparison](./AB-COMPARISON.md) - Compare two URLs visually
|
|
38
|
+
|
|
39
|
+
### Advanced Features
|
|
40
|
+
- [Chaos Testing](./CHAOS-TESTING.md) - Inject failures, test resilience
|
|
41
|
+
- [Bug Hunting](./BUG-HUNTING.md) - Autonomous issue discovery
|
|
42
|
+
- [Performance Testing](./PERFORMANCE-TESTING.md) - Regression detection
|
|
43
|
+
- [Session Management](./SESSION-MANAGEMENT.md) - Save and restore browser state
|
|
44
|
+
|
|
45
|
+
## MCP Tools Reference
|
|
46
|
+
|
|
47
|
+
CBrowser provides 48 MCP tools organized by category:
|
|
48
|
+
|
|
49
|
+
| Category | Tools | Description |
|
|
50
|
+
|----------|-------|-------------|
|
|
51
|
+
| **Navigation** | 5 | Navigate, screenshot, extract, cloudflare detection |
|
|
52
|
+
| **Interaction** | 4 | Click, smart click, fill, scroll |
|
|
53
|
+
| **Testing** | 3 | Test suites, repair, flaky detection |
|
|
54
|
+
| **Visual** | 6 | Baselines, regression, cross-browser, responsive, A/B |
|
|
55
|
+
| **Cognitive** | 3 | Journey init, state update, persona comparison |
|
|
56
|
+
| **Persona** | 3 | Questionnaire, build, trait lookup |
|
|
57
|
+
| **Analysis** | 5 | Bug hunt, chaos, agent audit, benchmark, empathy |
|
|
58
|
+
| **Stealth** | 5 | Enable, disable, status, check, diagnose |
|
|
59
|
+
|
|
60
|
+
See [MCP Integration](./MCP-INTEGRATION.md) for complete tool documentation.
|
|
61
|
+
|
|
62
|
+
## Version History
|
|
63
|
+
|
|
64
|
+
See [CHANGELOG.md](../CHANGELOG.md) for detailed release notes.
|
|
65
|
+
|
|
66
|
+
### Current Version: 16.7.0
|
|
67
|
+
|
|
68
|
+
Key features:
|
|
69
|
+
- 48 MCP tools for Claude integration
|
|
70
|
+
- Research-backed persona questionnaire system
|
|
71
|
+
- 25 cognitive traits with behavioral mappings
|
|
72
|
+
- Accessibility empathy testing
|
|
73
|
+
- Competitive UX benchmarking
|
|
74
|
+
- Agent-ready site auditing
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persona Questionnaire Example
|
|
3
|
+
*
|
|
4
|
+
* This example demonstrates the research-backed persona questionnaire system
|
|
5
|
+
* introduced in v16.6.0. The questionnaire maps behavioral answers to cognitive
|
|
6
|
+
* trait values (0-1 scale) with proper correlation adjustments.
|
|
7
|
+
*
|
|
8
|
+
* The questionnaire works across:
|
|
9
|
+
* - Claude sessions (via AskUserQuestion tool)
|
|
10
|
+
* - CLI (interactive terminal prompts)
|
|
11
|
+
* - Remote and Local MCP servers
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
generatePersonaQuestionnaire,
|
|
16
|
+
buildTraitsFromAnswers,
|
|
17
|
+
getTraitBehaviors,
|
|
18
|
+
getTraitLabel,
|
|
19
|
+
getTraitReference,
|
|
20
|
+
formatForAskUserQuestion,
|
|
21
|
+
TRAIT_REFERENCE_MATRIX,
|
|
22
|
+
} from 'cbrowser';
|
|
23
|
+
|
|
24
|
+
// Example 1: Generate the questionnaire for Claude's AskUserQuestion tool
|
|
25
|
+
function claudeQuestionnaireExample() {
|
|
26
|
+
console.log('\n=== Claude AskUserQuestion Format ===\n');
|
|
27
|
+
|
|
28
|
+
// Generate a quick 8-trait questionnaire
|
|
29
|
+
const questionnaire = generatePersonaQuestionnaire({ comprehensive: false });
|
|
30
|
+
|
|
31
|
+
console.log(`Generated ${questionnaire.questions.length} questions:`);
|
|
32
|
+
|
|
33
|
+
for (const q of questionnaire.questions) {
|
|
34
|
+
console.log(`\nTrait: ${q.trait}`);
|
|
35
|
+
console.log(`Question: ${q.question}`);
|
|
36
|
+
console.log('Options:');
|
|
37
|
+
for (const opt of q.options) {
|
|
38
|
+
console.log(` [${opt.value}] ${opt.label}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Format for AskUserQuestion tool
|
|
43
|
+
const askUserFormat = formatForAskUserQuestion(questionnaire.questions.slice(0, 4));
|
|
44
|
+
console.log('\n=== AskUserQuestion Format (first 4 questions) ===');
|
|
45
|
+
console.log(JSON.stringify(askUserFormat, null, 2));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Example 2: Build traits from questionnaire answers
|
|
49
|
+
function buildTraitsExample() {
|
|
50
|
+
console.log('\n=== Building Traits from Answers ===\n');
|
|
51
|
+
|
|
52
|
+
// Simulate answers from questionnaire
|
|
53
|
+
const answers: Record<string, number> = {
|
|
54
|
+
patience: 0.25, // Gets frustrated quickly
|
|
55
|
+
riskTolerance: 0.75, // Willing to try new things
|
|
56
|
+
comprehension: 0.5, // Average
|
|
57
|
+
persistence: 0.75, // Keeps trying
|
|
58
|
+
curiosity: 1.0, // Very curious, explores everything
|
|
59
|
+
workingMemory: 0.5, // Average
|
|
60
|
+
readingTendency: 0.25, // Skims, doesn't read carefully
|
|
61
|
+
resilience: 0.5, // Average bounce-back
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Build full trait profile with correlations applied
|
|
65
|
+
const traits = buildTraitsFromAnswers(answers);
|
|
66
|
+
|
|
67
|
+
console.log('Input answers:', answers);
|
|
68
|
+
console.log('\nDerived trait profile (with correlations):');
|
|
69
|
+
|
|
70
|
+
for (const [trait, value] of Object.entries(traits)) {
|
|
71
|
+
const label = getTraitLabel(trait, value);
|
|
72
|
+
console.log(` ${trait}: ${value.toFixed(2)} (${label})`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Example 3: Lookup trait behaviors
|
|
77
|
+
function traitBehaviorLookup() {
|
|
78
|
+
console.log('\n=== Trait Behavior Lookup ===\n');
|
|
79
|
+
|
|
80
|
+
const trait = 'patience';
|
|
81
|
+
const value = 0.25;
|
|
82
|
+
|
|
83
|
+
const behaviors = getTraitBehaviors(trait, value);
|
|
84
|
+
const reference = getTraitReference(trait);
|
|
85
|
+
|
|
86
|
+
console.log(`Trait: ${trait}`);
|
|
87
|
+
console.log(`Value: ${value}`);
|
|
88
|
+
console.log(`Label: ${behaviors.label}`);
|
|
89
|
+
console.log(`Description: ${behaviors.description}`);
|
|
90
|
+
console.log(`\nBehaviors:`);
|
|
91
|
+
for (const behavior of behaviors.behaviors) {
|
|
92
|
+
console.log(` - ${behavior}`);
|
|
93
|
+
}
|
|
94
|
+
console.log(`\nResearch basis: ${reference?.researchBasis || 'None'}`);
|
|
95
|
+
console.log(`Citations: ${reference?.citations?.join(', ') || 'None'}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Example 4: List all available traits
|
|
99
|
+
function listAllTraits() {
|
|
100
|
+
console.log('\n=== All 25 Cognitive Traits ===\n');
|
|
101
|
+
|
|
102
|
+
const traits = Object.keys(TRAIT_REFERENCE_MATRIX);
|
|
103
|
+
|
|
104
|
+
console.log(`Total traits: ${traits.length}\n`);
|
|
105
|
+
|
|
106
|
+
for (const trait of traits) {
|
|
107
|
+
const ref = getTraitReference(trait);
|
|
108
|
+
console.log(`${trait}:`);
|
|
109
|
+
console.log(` Research: ${ref?.researchBasis || 'General'}`);
|
|
110
|
+
console.log(` Range: 0 (${getTraitLabel(trait, 0)}) to 1 (${getTraitLabel(trait, 1)})`);
|
|
111
|
+
console.log('');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Example 5: Comprehensive questionnaire (all 25 traits)
|
|
116
|
+
function comprehensiveQuestionnaireExample() {
|
|
117
|
+
console.log('\n=== Comprehensive Questionnaire ===\n');
|
|
118
|
+
|
|
119
|
+
const questionnaire = generatePersonaQuestionnaire({
|
|
120
|
+
comprehensive: true,
|
|
121
|
+
includeResearch: true,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
console.log(`Comprehensive questionnaire: ${questionnaire.questions.length} questions`);
|
|
125
|
+
console.log(`Estimated time: ${questionnaire.estimatedMinutes} minutes\n`);
|
|
126
|
+
|
|
127
|
+
// Show first 3 questions with research citations
|
|
128
|
+
for (const q of questionnaire.questions.slice(0, 3)) {
|
|
129
|
+
console.log(`[${q.trait}] ${q.question}`);
|
|
130
|
+
if (q.researchBasis) {
|
|
131
|
+
console.log(` Research: ${q.researchBasis}`);
|
|
132
|
+
}
|
|
133
|
+
console.log('');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Example 6: Custom trait selection
|
|
138
|
+
function customTraitSelection() {
|
|
139
|
+
console.log('\n=== Custom Trait Selection ===\n');
|
|
140
|
+
|
|
141
|
+
// Only get questions for specific traits
|
|
142
|
+
const questionnaire = generatePersonaQuestionnaire({
|
|
143
|
+
traits: ['patience', 'riskTolerance', 'selfEfficacy', 'trustCalibration'],
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
console.log(`Custom questionnaire: ${questionnaire.questions.length} questions\n`);
|
|
147
|
+
|
|
148
|
+
for (const q of questionnaire.questions) {
|
|
149
|
+
console.log(`${q.trait}: ${q.question}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Example 7: Trait correlation demonstration
|
|
154
|
+
function correlationExample() {
|
|
155
|
+
console.log('\n=== Trait Correlations ===\n');
|
|
156
|
+
|
|
157
|
+
// Low self-efficacy should correlate with higher internal attribution
|
|
158
|
+
const lowEfficacyAnswers: Record<string, number> = {
|
|
159
|
+
selfEfficacy: 0.25, // "I probably can't figure this out"
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const derived = buildTraitsFromAnswers(lowEfficacyAnswers);
|
|
163
|
+
|
|
164
|
+
console.log('Input: selfEfficacy = 0.25 (Low)');
|
|
165
|
+
console.log('\nCorrelated traits automatically adjusted:');
|
|
166
|
+
console.log(` internalAttribution: ${derived.internalAttribution?.toFixed(2)} (blames self for failures)`);
|
|
167
|
+
console.log(` resilience: ${derived.resilience?.toFixed(2)} (lower bounce-back ability)`);
|
|
168
|
+
console.log('\nResearch: Bandura (1977) - Self-efficacy affects attribution patterns');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Example 8: Integration with cognitive journey
|
|
172
|
+
async function journeyIntegrationExample() {
|
|
173
|
+
console.log('\n=== Integration with Cognitive Journey ===\n');
|
|
174
|
+
|
|
175
|
+
// Build traits from questionnaire answers
|
|
176
|
+
const answers: Record<string, number> = {
|
|
177
|
+
patience: 0.25,
|
|
178
|
+
riskTolerance: 0.5,
|
|
179
|
+
comprehension: 0.75,
|
|
180
|
+
selfEfficacy: 0.5,
|
|
181
|
+
curiosity: 0.75,
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const traits = buildTraitsFromAnswers(answers);
|
|
185
|
+
|
|
186
|
+
console.log('Generated trait profile for cognitive journey:');
|
|
187
|
+
console.log(JSON.stringify(traits, null, 2));
|
|
188
|
+
|
|
189
|
+
console.log('\nUse with runCognitiveJourney:');
|
|
190
|
+
console.log(`
|
|
191
|
+
const result = await runCognitiveJourney({
|
|
192
|
+
persona: 'custom',
|
|
193
|
+
startUrl: 'https://example.com',
|
|
194
|
+
goal: 'complete signup',
|
|
195
|
+
customTraits: ${JSON.stringify(traits, null, 2)},
|
|
196
|
+
});
|
|
197
|
+
`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Run examples
|
|
201
|
+
async function main() {
|
|
202
|
+
console.log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
|
|
203
|
+
console.log('β CBrowser Persona Questionnaire Examples (v16.6.0) β');
|
|
204
|
+
console.log('β Research-backed trait mapping for cognitive user simulation β');
|
|
205
|
+
console.log('ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');
|
|
206
|
+
|
|
207
|
+
claudeQuestionnaireExample();
|
|
208
|
+
buildTraitsExample();
|
|
209
|
+
traitBehaviorLookup();
|
|
210
|
+
// listAllTraits(); // Uncomment for full trait list
|
|
211
|
+
comprehensiveQuestionnaireExample();
|
|
212
|
+
customTraitSelection();
|
|
213
|
+
correlationExample();
|
|
214
|
+
await journeyIntegrationExample();
|
|
215
|
+
|
|
216
|
+
console.log('\n=== Example Complete ===');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbrowser",
|
|
3
|
-
"version": "16.7.
|
|
3
|
+
"version": "16.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cognitive browser automation that thinks like your users. Simulate real user cognition with abandonment detection, constitutional safety, chaos engineering, and UX friction discovery.",
|
|
6
6
|
"main": "dist/index.js",
|