cbrowser 18.40.0 → 18.42.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.
- package/dist/mcp-tools/base/persona-comparison-tools.d.ts +1 -1
- package/dist/mcp-tools/base/persona-comparison-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/persona-comparison-tools.js +166 -1
- package/dist/mcp-tools/base/persona-comparison-tools.js.map +1 -1
- package/dist/visual/cognitive-models.d.ts +265 -0
- package/dist/visual/cognitive-models.d.ts.map +1 -0
- package/dist/visual/cognitive-models.js +447 -0
- package/dist/visual/cognitive-models.js.map +1 -0
- package/dist/visual/cognitive-transport-chain.d.ts +143 -0
- package/dist/visual/cognitive-transport-chain.d.ts.map +1 -0
- package/dist/visual/cognitive-transport-chain.js +440 -0
- package/dist/visual/cognitive-transport-chain.js.map +1 -0
- package/dist/visual/index.d.ts +2 -0
- package/dist/visual/index.d.ts.map +1 -1
- package/dist/visual/index.js +2 -0
- package/dist/visual/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Optimal Transport — Sequential Transport Chain
|
|
3
|
+
*
|
|
4
|
+
* Implements the CHI 2027 paper's core contribution:
|
|
5
|
+
* - 26-dimensional demand distribution computed from page features
|
|
6
|
+
* - Sequential transport chain where each layer depletes capacity
|
|
7
|
+
* - Asymmetric deficit-surplus cost
|
|
8
|
+
* - Layer interaction terms
|
|
9
|
+
*
|
|
10
|
+
* Mathematical foundation: The total Cognitive Transport Cost is NOT
|
|
11
|
+
* the sum of independent layers. Each layer receives the user's RESIDUAL
|
|
12
|
+
* capacity after prior layers have consumed resources.
|
|
13
|
+
*
|
|
14
|
+
* @see Section 3.4 of "Cognitive Optimal Transport: A Unified Framework"
|
|
15
|
+
* @since v18.39.0
|
|
16
|
+
*/
|
|
17
|
+
import { extractPageMetrics, } from './cognitive-transport.js';
|
|
18
|
+
// ── Constants ──
|
|
19
|
+
/**
|
|
20
|
+
* The 26 demand dimensions used by the sequential transport chain.
|
|
21
|
+
* Superset of the base 25 OT cognitive traits — includes extended traits
|
|
22
|
+
* from CognitiveTraits that capture decision biases, learning transfer,
|
|
23
|
+
* and emotional regulation.
|
|
24
|
+
*/
|
|
25
|
+
export const DEMAND_DIMENSIONS = [
|
|
26
|
+
// Core capacity traits
|
|
27
|
+
'patience', 'riskTolerance', 'comprehension',
|
|
28
|
+
'persistence', 'workingMemory', 'readingTendency',
|
|
29
|
+
// Emotional regulation
|
|
30
|
+
'resilience', 'selfEfficacy', 'emotionalContagion',
|
|
31
|
+
// Decision-making
|
|
32
|
+
'satisficing', 'anchoringBias', 'fearOfMissingOut', 'socialProofSensitivity',
|
|
33
|
+
// Perceptual
|
|
34
|
+
'changeBlindness', 'attentionPattern',
|
|
35
|
+
// Motor & procedural
|
|
36
|
+
'motorPrecision', 'proceduralFluency',
|
|
37
|
+
// Cognitive strategy
|
|
38
|
+
'informationForaging', 'metacognitivePlanning', 'transferLearning',
|
|
39
|
+
// Interrupt & recovery
|
|
40
|
+
'interruptRecovery',
|
|
41
|
+
// Trust
|
|
42
|
+
'trustCalibration',
|
|
43
|
+
// Additional extended traits
|
|
44
|
+
'mentalModelRigidity', 'curiosity',
|
|
45
|
+
// Processing
|
|
46
|
+
'processingSpeed', 'textProcessing',
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Layer definitions for the sequential transport chain.
|
|
50
|
+
* Order reflects temporal processing: perception -> cognition -> decision -> action -> affect -> comprehension.
|
|
51
|
+
*/
|
|
52
|
+
const LAYER_DEFINITIONS = [
|
|
53
|
+
{
|
|
54
|
+
name: 'saliency',
|
|
55
|
+
traits: ['changeBlindness', 'attentionPattern'],
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'cognitiveLoad',
|
|
59
|
+
traits: ['comprehension', 'workingMemory', 'informationForaging'],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'decision',
|
|
63
|
+
traits: ['satisficing', 'anchoringBias', 'riskTolerance', 'fearOfMissingOut', 'socialProofSensitivity'],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'motor',
|
|
67
|
+
traits: ['patience', 'proceduralFluency'],
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'frustration',
|
|
71
|
+
traits: ['resilience', 'selfEfficacy', 'patience', 'emotionalContagion'],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'readability',
|
|
75
|
+
traits: ['readingTendency', 'comprehension', 'transferLearning'],
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
/**
|
|
79
|
+
* Pairwise interaction definitions — the top 5 cross-layer effects
|
|
80
|
+
* identified in the CHI 2027 paper's empirical calibration (Table 3).
|
|
81
|
+
*/
|
|
82
|
+
const INTERACTION_PAIRS = [
|
|
83
|
+
{ a: 'cognitiveLoad', b: 'decision', weight: 0.15 },
|
|
84
|
+
{ a: 'saliency', b: 'cognitiveLoad', weight: 0.15 },
|
|
85
|
+
{ a: 'frustration', b: 'readability', weight: 0.15 },
|
|
86
|
+
{ a: 'cognitiveLoad', b: 'motor', weight: 0.15 },
|
|
87
|
+
{ a: 'frustration', b: 'decision', weight: 0.15 },
|
|
88
|
+
];
|
|
89
|
+
/** Asymmetric cost weights (Theorem 2 in paper) */
|
|
90
|
+
const WEIGHT_DEFICIT = 1.0; // demand > capacity: high cost
|
|
91
|
+
const WEIGHT_SURPLUS = 0.3; // capacity > demand: low cost (surplus is cheap)
|
|
92
|
+
/** Capacity depletion rate per layer (alpha_i, Section 3.4) */
|
|
93
|
+
const DEPLETION_RATE = 0.15;
|
|
94
|
+
/** Minimum residual capacity floor (prevents total exhaustion) */
|
|
95
|
+
const CAPACITY_FLOOR = 0.05;
|
|
96
|
+
// ── Sigmoid Helper ──
|
|
97
|
+
/**
|
|
98
|
+
* Standard logistic sigmoid for mapping raw page metrics to demand values.
|
|
99
|
+
* Calibrated thresholds ensure typical web pages produce demands in [0.1, 0.9].
|
|
100
|
+
*/
|
|
101
|
+
function sigmoid(raw, threshold, scale) {
|
|
102
|
+
const x = -(raw - threshold) / scale;
|
|
103
|
+
// Clamp exponent to prevent overflow
|
|
104
|
+
if (x > 500)
|
|
105
|
+
return 0;
|
|
106
|
+
if (x < -500)
|
|
107
|
+
return 1;
|
|
108
|
+
return 1 / (1 + Math.exp(x));
|
|
109
|
+
}
|
|
110
|
+
// ── 1. Demand Distribution Computation ──
|
|
111
|
+
/**
|
|
112
|
+
* Compute the 26-dimensional demand distribution from page metrics.
|
|
113
|
+
*
|
|
114
|
+
* Each page feature maps to specific trait dimensions via calibrated
|
|
115
|
+
* sigmoid functions. The mapping encodes HOW each page characteristic
|
|
116
|
+
* creates cognitive demand on specific user capacities.
|
|
117
|
+
*
|
|
118
|
+
* Traits not affected by any page feature receive demand = 0.0 (no demand).
|
|
119
|
+
*
|
|
120
|
+
* @param pageMetrics - Extracted page analysis metrics
|
|
121
|
+
* @returns DemandDistribution with per-trait demand and variance
|
|
122
|
+
*/
|
|
123
|
+
export function computeDemandDistribution(pageMetrics) {
|
|
124
|
+
const demands = {};
|
|
125
|
+
const variance = {};
|
|
126
|
+
// Initialize all 26 dimensions to zero demand
|
|
127
|
+
for (const dim of DEMAND_DIMENSIONS) {
|
|
128
|
+
demands[dim] = 0;
|
|
129
|
+
variance[dim] = 0;
|
|
130
|
+
}
|
|
131
|
+
// Sanitize inputs — guard against NaN, undefined, negative
|
|
132
|
+
const safe = (v, fallback = 0) => {
|
|
133
|
+
if (v === undefined || v === null || Number.isNaN(v))
|
|
134
|
+
return fallback;
|
|
135
|
+
return Math.max(0, v);
|
|
136
|
+
};
|
|
137
|
+
const infoDensity = safe(pageMetrics.informationDensity);
|
|
138
|
+
const visCplx = safe(pageMetrics.visualComplexity);
|
|
139
|
+
const interactiveCount = safe(pageMetrics.interactiveElementCount);
|
|
140
|
+
const textDens = safe(pageMetrics.textDensity);
|
|
141
|
+
const animLevel = safe(pageMetrics.animationLevel);
|
|
142
|
+
const choices = safe(pageMetrics.choiceCount);
|
|
143
|
+
const navDepth = safe(pageMetrics.navigationDepth);
|
|
144
|
+
// Normalize interactive element count to 0-1 range for sigmoid
|
|
145
|
+
const interactiveNorm = Math.min(1, interactiveCount / 50);
|
|
146
|
+
// ── informationDensity → comprehension, workingMemory, readingTendency, informationForaging
|
|
147
|
+
const infoDemand = sigmoid(infoDensity, 0.5, 0.15);
|
|
148
|
+
demands.comprehension = Math.max(demands.comprehension, infoDemand);
|
|
149
|
+
demands.workingMemory = Math.max(demands.workingMemory, infoDemand * 0.9);
|
|
150
|
+
demands.readingTendency = Math.max(demands.readingTendency, infoDemand * 0.85);
|
|
151
|
+
demands.informationForaging = Math.max(demands.informationForaging, infoDemand * 0.8);
|
|
152
|
+
variance.comprehension += infoDensity * 0.1;
|
|
153
|
+
variance.workingMemory += infoDensity * 0.08;
|
|
154
|
+
variance.readingTendency += infoDensity * 0.07;
|
|
155
|
+
variance.informationForaging += infoDensity * 0.06;
|
|
156
|
+
// ── visualComplexity → changeBlindness, mentalModelRigidity, attentionPattern (inferred)
|
|
157
|
+
const visDemand = sigmoid(visCplx, 0.5, 0.15);
|
|
158
|
+
demands.changeBlindness = Math.max(demands.changeBlindness, visDemand);
|
|
159
|
+
demands.mentalModelRigidity = Math.max(demands.mentalModelRigidity, visDemand * 0.7);
|
|
160
|
+
demands.attentionPattern = Math.max(demands.attentionPattern, visDemand * 0.85);
|
|
161
|
+
variance.changeBlindness += visCplx * 0.12;
|
|
162
|
+
variance.mentalModelRigidity += visCplx * 0.08;
|
|
163
|
+
variance.attentionPattern += visCplx * 0.1;
|
|
164
|
+
// ── interactiveElementCount → riskTolerance, satisficing, proceduralFluency, motorPrecision (inferred)
|
|
165
|
+
const interDemand = sigmoid(interactiveNorm, 0.4, 0.2);
|
|
166
|
+
demands.riskTolerance = Math.max(demands.riskTolerance, interDemand * 0.75);
|
|
167
|
+
demands.satisficing = Math.max(demands.satisficing, interDemand * 0.8);
|
|
168
|
+
demands.proceduralFluency = Math.max(demands.proceduralFluency, interDemand * 0.9);
|
|
169
|
+
demands.motorPrecision = Math.max(demands.motorPrecision, interDemand);
|
|
170
|
+
variance.riskTolerance += interactiveNorm * 0.06;
|
|
171
|
+
variance.satisficing += interactiveNorm * 0.07;
|
|
172
|
+
variance.proceduralFluency += interactiveNorm * 0.08;
|
|
173
|
+
variance.motorPrecision += interactiveNorm * 0.1;
|
|
174
|
+
// ── textDensity → readingTendency, patience, comprehension
|
|
175
|
+
const textDemand = sigmoid(textDens, 0.5, 0.15);
|
|
176
|
+
demands.readingTendency = Math.max(demands.readingTendency, textDemand);
|
|
177
|
+
demands.patience = Math.max(demands.patience, textDemand * 0.7);
|
|
178
|
+
demands.comprehension = Math.max(demands.comprehension, textDemand * 0.85);
|
|
179
|
+
variance.readingTendency += textDens * 0.09;
|
|
180
|
+
variance.patience += textDens * 0.06;
|
|
181
|
+
variance.comprehension += textDens * 0.08;
|
|
182
|
+
// ── animationLevel → changeBlindness, interruptRecovery, emotionalContagion
|
|
183
|
+
const animDemand = sigmoid(animLevel, 0.3, 0.15);
|
|
184
|
+
demands.changeBlindness = Math.max(demands.changeBlindness, animDemand * 0.9);
|
|
185
|
+
demands.interruptRecovery = Math.max(demands.interruptRecovery, animDemand * 0.85);
|
|
186
|
+
demands.emotionalContagion = Math.max(demands.emotionalContagion, animDemand * 0.7);
|
|
187
|
+
variance.changeBlindness += animLevel * 0.1;
|
|
188
|
+
variance.interruptRecovery += animLevel * 0.09;
|
|
189
|
+
variance.emotionalContagion += animLevel * 0.07;
|
|
190
|
+
// ── choiceCount → satisficing, anchoringBias, fearOfMissingOut, socialProofSensitivity
|
|
191
|
+
const choiceDemand = sigmoid(choices, 8, 4);
|
|
192
|
+
demands.satisficing = Math.max(demands.satisficing, choiceDemand);
|
|
193
|
+
demands.anchoringBias = Math.max(demands.anchoringBias, choiceDemand * 0.85);
|
|
194
|
+
demands.fearOfMissingOut = Math.max(demands.fearOfMissingOut, choiceDemand * 0.75);
|
|
195
|
+
demands.socialProofSensitivity = Math.max(demands.socialProofSensitivity, choiceDemand * 0.7);
|
|
196
|
+
variance.satisficing += Math.min(1, choices / 20) * 0.1;
|
|
197
|
+
variance.anchoringBias += Math.min(1, choices / 20) * 0.08;
|
|
198
|
+
variance.fearOfMissingOut += Math.min(1, choices / 20) * 0.07;
|
|
199
|
+
variance.socialProofSensitivity += Math.min(1, choices / 20) * 0.06;
|
|
200
|
+
// ── navigationDepth → workingMemory, metacognitivePlanning, persistence, transferLearning
|
|
201
|
+
const navDemand = sigmoid(Math.min(1, navDepth / 5), 0.4, 0.2);
|
|
202
|
+
demands.workingMemory = Math.max(demands.workingMemory, navDemand * 0.95);
|
|
203
|
+
demands.metacognitivePlanning = Math.max(demands.metacognitivePlanning, navDemand * 0.8);
|
|
204
|
+
demands.persistence = Math.max(demands.persistence, navDemand * 0.7);
|
|
205
|
+
demands.transferLearning = Math.max(demands.transferLearning, navDemand * 0.65);
|
|
206
|
+
variance.workingMemory += Math.min(1, navDepth / 5) * 0.09;
|
|
207
|
+
variance.metacognitivePlanning += Math.min(1, navDepth / 5) * 0.07;
|
|
208
|
+
variance.persistence += Math.min(1, navDepth / 5) * 0.06;
|
|
209
|
+
variance.transferLearning += Math.min(1, navDepth / 5) * 0.05;
|
|
210
|
+
// Clamp all demands and variances to [0, 1]
|
|
211
|
+
for (const dim of DEMAND_DIMENSIONS) {
|
|
212
|
+
demands[dim] = Math.max(0, Math.min(1, demands[dim]));
|
|
213
|
+
variance[dim] = Math.max(0, Math.min(1, variance[dim]));
|
|
214
|
+
}
|
|
215
|
+
return { demands, variance };
|
|
216
|
+
}
|
|
217
|
+
// ── 2. Sequential Transport Chain ──
|
|
218
|
+
/**
|
|
219
|
+
* Resolve a trait value from the persona's trait record.
|
|
220
|
+
* Falls back to 0.5 (neutral midpoint) for missing traits.
|
|
221
|
+
*/
|
|
222
|
+
function traitValue(traits, trait) {
|
|
223
|
+
const v = traits[trait];
|
|
224
|
+
if (v === undefined || v === null || Number.isNaN(v))
|
|
225
|
+
return 0.5;
|
|
226
|
+
return Math.max(0, Math.min(1, v));
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Compute the Sequential Cognitive Transport Cost (CTC).
|
|
230
|
+
*
|
|
231
|
+
* Unlike additive cognitive load models, the sequential chain depletes
|
|
232
|
+
* capacity at each processing layer. A user who spends cognitive resources
|
|
233
|
+
* on saliency detection has LESS available for subsequent decision-making.
|
|
234
|
+
*
|
|
235
|
+
* The algorithm processes layers in temporal order:
|
|
236
|
+
* Saliency -> Cognitive Load -> Decision -> Motor -> Frustration -> Readability
|
|
237
|
+
*
|
|
238
|
+
* Each layer:
|
|
239
|
+
* 1. Computes asymmetric transport cost (deficit is expensive, surplus is cheap)
|
|
240
|
+
* 2. Depletes residual capacity proportional to cost incurred
|
|
241
|
+
* 3. Records the remaining capacity for downstream layers
|
|
242
|
+
*
|
|
243
|
+
* @param persona - OTCognitiveProfile with trait values
|
|
244
|
+
* @param demand - 26D demand distribution from page analysis
|
|
245
|
+
* @param options - Enable/disable asymmetric costs and interaction terms
|
|
246
|
+
* @returns Complete sequential transport result with per-layer breakdown
|
|
247
|
+
*/
|
|
248
|
+
export function computeSequentialCTC(persona, demand, options) {
|
|
249
|
+
const useAsymmetric = options?.asymmetric !== false; // default true
|
|
250
|
+
const useInteractions = options?.interactions !== false; // default true
|
|
251
|
+
// Initialize residual capacity from persona traits
|
|
252
|
+
const residualCapacity = {};
|
|
253
|
+
for (const dim of DEMAND_DIMENSIONS) {
|
|
254
|
+
residualCapacity[dim] = traitValue(persona.traits, dim);
|
|
255
|
+
}
|
|
256
|
+
const layers = [];
|
|
257
|
+
const traitCosts = {};
|
|
258
|
+
let totalDeficit = 0;
|
|
259
|
+
let totalSurplus = 0;
|
|
260
|
+
let additiveCTC = 0;
|
|
261
|
+
// Initialize per-trait costs to zero
|
|
262
|
+
for (const dim of DEMAND_DIMENSIONS) {
|
|
263
|
+
traitCosts[dim] = 0;
|
|
264
|
+
}
|
|
265
|
+
// Process each layer sequentially
|
|
266
|
+
for (const layerDef of LAYER_DEFINITIONS) {
|
|
267
|
+
let layerCost = 0;
|
|
268
|
+
let layerDeficit = 0;
|
|
269
|
+
let layerSurplus = 0;
|
|
270
|
+
// Compute transport cost for this layer's traits
|
|
271
|
+
for (const trait of layerDef.traits) {
|
|
272
|
+
const d = demand.demands[trait] ?? 0;
|
|
273
|
+
const c = residualCapacity[trait] ?? 0.5;
|
|
274
|
+
const gap = d - c;
|
|
275
|
+
let cost;
|
|
276
|
+
if (gap > 0) {
|
|
277
|
+
// Deficit: demand exceeds capacity — expensive
|
|
278
|
+
cost = (useAsymmetric ? WEIGHT_DEFICIT : 1.0) * gap * gap;
|
|
279
|
+
layerDeficit += cost;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
// Surplus: capacity exceeds demand — cheap
|
|
283
|
+
cost = (useAsymmetric ? WEIGHT_SURPLUS : 1.0) * gap * gap;
|
|
284
|
+
layerSurplus += cost;
|
|
285
|
+
}
|
|
286
|
+
layerCost += cost;
|
|
287
|
+
traitCosts[trait] = (traitCosts[trait] ?? 0) + cost;
|
|
288
|
+
}
|
|
289
|
+
totalDeficit += layerDeficit;
|
|
290
|
+
totalSurplus += layerSurplus;
|
|
291
|
+
additiveCTC += layerCost;
|
|
292
|
+
// Deplete capacity for next layers
|
|
293
|
+
// Each trait in this layer loses capacity proportional to the layer's total cost
|
|
294
|
+
const capacityConsumed = DEPLETION_RATE * layerCost;
|
|
295
|
+
for (const trait of layerDef.traits) {
|
|
296
|
+
residualCapacity[trait] -= capacityConsumed;
|
|
297
|
+
residualCapacity[trait] = Math.max(CAPACITY_FLOOR, residualCapacity[trait]);
|
|
298
|
+
}
|
|
299
|
+
// Also deplete shared traits that appear in later layers
|
|
300
|
+
// (cross-layer fatigue: cognitive exhaustion bleeds across boundaries)
|
|
301
|
+
for (const dim of DEMAND_DIMENSIONS) {
|
|
302
|
+
if (!layerDef.traits.includes(dim)) {
|
|
303
|
+
// Indirect depletion at half rate
|
|
304
|
+
residualCapacity[dim] -= (DEPLETION_RATE * 0.5) * layerCost;
|
|
305
|
+
residualCapacity[dim] = Math.max(CAPACITY_FLOOR, residualCapacity[dim]);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
layers.push({
|
|
309
|
+
name: layerDef.name,
|
|
310
|
+
transportCost: layerCost,
|
|
311
|
+
capacityConsumed,
|
|
312
|
+
residualCapacity: { ...residualCapacity },
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
// Compute interaction terms
|
|
316
|
+
const interactions = {};
|
|
317
|
+
let interactionTotal = 0;
|
|
318
|
+
if (useInteractions) {
|
|
319
|
+
const layerCostMap = {};
|
|
320
|
+
for (const layer of layers) {
|
|
321
|
+
layerCostMap[layer.name] = layer.transportCost;
|
|
322
|
+
}
|
|
323
|
+
for (const pair of INTERACTION_PAIRS) {
|
|
324
|
+
const costA = layerCostMap[pair.a] ?? 0;
|
|
325
|
+
const costB = layerCostMap[pair.b] ?? 0;
|
|
326
|
+
const interaction = costA * costB * pair.weight;
|
|
327
|
+
const key = `${pair.a}x${pair.b}`;
|
|
328
|
+
interactions[key] = interaction;
|
|
329
|
+
interactionTotal += interaction;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
// Total CTC = sum of layer costs + interaction terms
|
|
333
|
+
// Note: additiveCTC is layers-only (no interactions, no sequential effects)
|
|
334
|
+
// The sequential effect is already embedded in layer costs via capacity depletion
|
|
335
|
+
const totalCTC = layers.reduce((sum, l) => sum + l.transportCost, 0) + interactionTotal;
|
|
336
|
+
// Find bottleneck layer
|
|
337
|
+
let maxLayerCost = 0;
|
|
338
|
+
let bottleneckLayer = layers[0]?.name ?? 'saliency';
|
|
339
|
+
for (const layer of layers) {
|
|
340
|
+
if (layer.transportCost > maxLayerCost) {
|
|
341
|
+
maxLayerCost = layer.transportCost;
|
|
342
|
+
bottleneckLayer = layer.name;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Compute abandonment risk
|
|
346
|
+
// Higher CTC relative to patience capacity → higher abandonment probability
|
|
347
|
+
const patienceCapacity = traitValue(persona.traits, 'patience');
|
|
348
|
+
const abandonmentRisk = sigmoid(totalCTC, patienceCapacity * 2, 0.3);
|
|
349
|
+
return {
|
|
350
|
+
totalCTC,
|
|
351
|
+
layers,
|
|
352
|
+
interactions,
|
|
353
|
+
additiveCTC,
|
|
354
|
+
deficitCost: totalDeficit,
|
|
355
|
+
surplusCost: totalSurplus,
|
|
356
|
+
traitCosts,
|
|
357
|
+
bottleneckLayer,
|
|
358
|
+
abandonmentRisk,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
// ── 3. Convenience: Full COT Pipeline ──
|
|
362
|
+
/**
|
|
363
|
+
* End-to-end Cognitive Optimal Transport computation.
|
|
364
|
+
*
|
|
365
|
+
* Extracts page metrics from a live Playwright page, computes the
|
|
366
|
+
* 26D demand distribution, and runs the full sequential transport chain.
|
|
367
|
+
*
|
|
368
|
+
* This is the primary entry point for MCP tools that need a single
|
|
369
|
+
* CTC score with full breakdown.
|
|
370
|
+
*
|
|
371
|
+
* @param persona - OTCognitiveProfile with trait values
|
|
372
|
+
* @param page - Playwright Page object (or any object with evaluate())
|
|
373
|
+
* @returns Complete sequential transport result
|
|
374
|
+
*/
|
|
375
|
+
export async function computeFullCOT(persona, page) {
|
|
376
|
+
// Extract page metrics via Playwright's page.evaluate()
|
|
377
|
+
const metrics = await extractPageMetrics(page);
|
|
378
|
+
// Compute 26D demand distribution
|
|
379
|
+
const demand = computeDemandDistribution(metrics);
|
|
380
|
+
// Run sequential transport chain with full options
|
|
381
|
+
return computeSequentialCTC(persona, demand, {
|
|
382
|
+
asymmetric: true,
|
|
383
|
+
interactions: true,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
// ── 4. Utility Exports ──
|
|
387
|
+
/**
|
|
388
|
+
* Compute demand distribution from raw metric values (no page required).
|
|
389
|
+
* Useful for testing, simulation, and sensitivity analysis.
|
|
390
|
+
*/
|
|
391
|
+
export function computeDemandFromRawMetrics(informationDensity, visualComplexity, interactiveElementCount, textDensity, animationLevel, choiceCount, navigationDepth) {
|
|
392
|
+
return computeDemandDistribution({
|
|
393
|
+
informationDensity,
|
|
394
|
+
visualComplexity,
|
|
395
|
+
interactiveElementCount,
|
|
396
|
+
textDensity,
|
|
397
|
+
animationLevel,
|
|
398
|
+
choiceCount,
|
|
399
|
+
navigationDepth,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Compare sequential vs. additive CTC to quantify the sequential effect.
|
|
404
|
+
*
|
|
405
|
+
* Returns the ratio (sequential / additive). Values > 1.0 indicate that
|
|
406
|
+
* capacity depletion and interactions amplify the total cost beyond what
|
|
407
|
+
* independent layers would predict.
|
|
408
|
+
*/
|
|
409
|
+
export function sequentialAmplification(result) {
|
|
410
|
+
if (result.additiveCTC === 0)
|
|
411
|
+
return 1.0;
|
|
412
|
+
return result.totalCTC / result.additiveCTC;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Identify the top N most costly traits across all layers.
|
|
416
|
+
* Useful for targeted remediation — fix the traits that hurt most.
|
|
417
|
+
*/
|
|
418
|
+
export function topCostlyTraits(result, n = 5) {
|
|
419
|
+
return Object.entries(result.traitCosts)
|
|
420
|
+
.filter(([, cost]) => cost > 0)
|
|
421
|
+
.sort((a, b) => b[1] - a[1])
|
|
422
|
+
.slice(0, n)
|
|
423
|
+
.map(([trait, cost]) => ({ trait, cost }));
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Compute CTC for a minimal/empty page (baseline).
|
|
427
|
+
* Useful for normalizing CTC scores against the best-case scenario.
|
|
428
|
+
*/
|
|
429
|
+
export function baselineCTC(persona) {
|
|
430
|
+
const emptyDemand = {
|
|
431
|
+
demands: {},
|
|
432
|
+
variance: {},
|
|
433
|
+
};
|
|
434
|
+
for (const dim of DEMAND_DIMENSIONS) {
|
|
435
|
+
emptyDemand.demands[dim] = 0;
|
|
436
|
+
emptyDemand.variance[dim] = 0;
|
|
437
|
+
}
|
|
438
|
+
return computeSequentialCTC(persona, emptyDemand);
|
|
439
|
+
}
|
|
440
|
+
//# sourceMappingURL=cognitive-transport-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive-transport-chain.js","sourceRoot":"","sources":["../../src/visual/cognitive-transport-chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAEL,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAiDlC,kBAAkB;AAElB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,uBAAuB;IACvB,UAAU,EAAE,eAAe,EAAE,eAAe;IAC5C,aAAa,EAAE,eAAe,EAAE,iBAAiB;IACjD,uBAAuB;IACvB,YAAY,EAAE,cAAc,EAAE,oBAAoB;IAClD,kBAAkB;IAClB,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,wBAAwB;IAC5E,aAAa;IACb,iBAAiB,EAAE,kBAAkB;IACrC,qBAAqB;IACrB,gBAAgB,EAAE,mBAAmB;IACrC,qBAAqB;IACrB,qBAAqB,EAAE,uBAAuB,EAAE,kBAAkB;IAClE,uBAAuB;IACvB,mBAAmB;IACnB,QAAQ;IACR,kBAAkB;IAClB,6BAA6B;IAC7B,qBAAqB,EAAE,WAAW;IAClC,aAAa;IACb,iBAAiB,EAAE,gBAAgB;CAC3B,CAAC;AAEX;;;GAGG;AACH,MAAM,iBAAiB,GAA8C;IACnE;QACE,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;KAChD;IACD;QACE,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,qBAAqB,CAAC;KAClE;IACD;QACE,I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AAQ,EAAE,EAAE;KACb,CAAC;IACF,KAAK,MAAM,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACpC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC"}
|
package/dist/visual/index.d.ts
CHANGED
|
@@ -15,5 +15,7 @@ export * from "./ab-comparison.js";
|
|
|
15
15
|
export * from "./distance-metrics.js";
|
|
16
16
|
export * from "./perceptual-transport.js";
|
|
17
17
|
export * from "./cognitive-transport.js";
|
|
18
|
+
export * from "./cognitive-transport-chain.js";
|
|
19
|
+
export * from "./cognitive-models.js";
|
|
18
20
|
export * from "./attention-transport.js";
|
|
19
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visual/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visual/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
|
package/dist/visual/index.js
CHANGED
|
@@ -15,5 +15,7 @@ export * from "./ab-comparison.js";
|
|
|
15
15
|
export * from "./distance-metrics.js";
|
|
16
16
|
export * from "./perceptual-transport.js";
|
|
17
17
|
export * from "./cognitive-transport.js";
|
|
18
|
+
export * from "./cognitive-transport-chain.js";
|
|
19
|
+
export * from "./cognitive-models.js";
|
|
18
20
|
export * from "./attention-transport.js";
|
|
19
21
|
//# sourceMappingURL=index.js.map
|
package/dist/visual/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visual/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visual/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH;;;;GAIG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbrowser",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.42.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cognitive browser automation that thinks like your users—and helps AI agents navigate too. Simulate real user cognition with abandonment detection, constitutional safety, chaos engineering, and UX friction discovery. Sites that pass CBrowser's cognitive tests are easier for both humans and AI agents to navigate.",
|
|
6
6
|
"main": "dist/index.js",
|