cbrowser 9.10.0 → 10.0.2
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.
|
@@ -91,7 +91,78 @@ async function journeyWithCallbacks() {
|
|
|
91
91
|
console.log('\nJourney finished');
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
// Example 4:
|
|
94
|
+
// Example 4: Decision Fatigue Metrics (v9.9.0)
|
|
95
|
+
async function decisionFatigueExample() {
|
|
96
|
+
console.log('\n=== Decision Fatigue Metrics (v9.9.0) ===\n');
|
|
97
|
+
|
|
98
|
+
const result = await runCognitiveJourney({
|
|
99
|
+
persona: 'first-timer',
|
|
100
|
+
startUrl: 'https://example.com/signup',
|
|
101
|
+
goal: 'complete registration with all options',
|
|
102
|
+
verbose: true,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// v9.9.0 decision fatigue metrics
|
|
106
|
+
console.log('Decision Fatigue Analysis:');
|
|
107
|
+
console.log(` Decisions made: ${result.summary.decisionsMade}`);
|
|
108
|
+
console.log(` Final fatigue: ${(result.summary.finalDecisionFatigue * 100).toFixed(0)}%`);
|
|
109
|
+
|
|
110
|
+
if (result.summary.wasChoosingDefaults) {
|
|
111
|
+
console.log(' ⚠️ User started choosing defaults due to fatigue');
|
|
112
|
+
console.log(' Recommendation: Reduce number of choices or use smart defaults');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Example 5: Dual-Process Theory (v10.0.0)
|
|
117
|
+
async function dualProcessExample() {
|
|
118
|
+
console.log('\n=== Dual-Process Theory (v10.0.0) ===\n');
|
|
119
|
+
|
|
120
|
+
// Power users start in System 1 (automatic, fast)
|
|
121
|
+
// They switch to System 2 (deliberate) when confused
|
|
122
|
+
const result = await runCognitiveJourney({
|
|
123
|
+
persona: 'power-user',
|
|
124
|
+
startUrl: 'https://example.com/settings',
|
|
125
|
+
goal: 'configure advanced notification preferences',
|
|
126
|
+
verbose: true,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (result.cognitiveMode) {
|
|
130
|
+
console.log('Cognitive Mode Analysis:');
|
|
131
|
+
console.log(` Started in: System ${result.cognitiveMode.system === 1 ? '1 (Automatic)' : '2 (Deliberate)'}`);
|
|
132
|
+
console.log(` Time in System 1: ${result.cognitiveMode.timeInSystem1}ms`);
|
|
133
|
+
console.log(` Time in System 2: ${result.cognitiveMode.timeInSystem2}ms`);
|
|
134
|
+
console.log(` System 1 errors: ${result.cognitiveMode.system1Errors}`);
|
|
135
|
+
|
|
136
|
+
const pctSystem1 = (result.cognitiveMode.timeInSystem1 /
|
|
137
|
+
(result.cognitiveMode.timeInSystem1 + result.cognitiveMode.timeInSystem2) * 100).toFixed(0);
|
|
138
|
+
console.log(` Efficiency: ${pctSystem1}% automatic thinking`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Example 6: Fitts' Law Motor Timing (v9.9.0)
|
|
143
|
+
async function fittsLawExample() {
|
|
144
|
+
console.log('\n=== Fitts\' Law Motor Timing (v9.9.0) ===\n');
|
|
145
|
+
|
|
146
|
+
// Elderly users have age modifier affecting mouse movement
|
|
147
|
+
const result = await runCognitiveJourney({
|
|
148
|
+
persona: 'elderly-user',
|
|
149
|
+
startUrl: 'https://example.com',
|
|
150
|
+
goal: 'click the small help icon in the corner',
|
|
151
|
+
verbose: true,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// Find steps with click actions to see Fitts' Law in action
|
|
155
|
+
const clickSteps = result.steps.filter(s => s.action?.startsWith('click'));
|
|
156
|
+
for (const step of clickSteps) {
|
|
157
|
+
console.log(`Step ${step.stepNumber}: ${step.action}`);
|
|
158
|
+
if (step.mouseMovementTime) {
|
|
159
|
+
console.log(` Mouse movement time: ${step.mouseMovementTime}ms`);
|
|
160
|
+
console.log(` (Includes age modifier for elderly persona)`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Example 7: Compare cognitive traits across personas
|
|
95
166
|
async function comparePersonas() {
|
|
96
167
|
console.log('\n=== Comparing Personas ===\n');
|
|
97
168
|
|
|
@@ -136,6 +207,9 @@ async function main() {
|
|
|
136
207
|
await basicJourney();
|
|
137
208
|
// await customTraitsJourney();
|
|
138
209
|
// await journeyWithCallbacks();
|
|
210
|
+
// await decisionFatigueExample(); // v9.9.0
|
|
211
|
+
// await dualProcessExample(); // v10.0.0
|
|
212
|
+
// await fittsLawExample(); // v9.9.0
|
|
139
213
|
// await comparePersonas();
|
|
140
214
|
} catch (error) {
|
|
141
215
|
console.error('Error:', error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbrowser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.2",
|
|
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",
|