cbrowser 18.26.0 → 18.28.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/analysis/accessibility-empathy.d.ts.map +1 -1
- package/dist/analysis/accessibility-empathy.js +34 -1
- package/dist/analysis/accessibility-empathy.js.map +1 -1
- package/dist/mcp-tools/base/audit-tools.d.ts.map +1 -1
- package/dist/mcp-tools/base/audit-tools.js +3 -0
- package/dist/mcp-tools/base/audit-tools.js.map +1 -1
- package/dist/visual/cognitive-transport.d.ts +186 -0
- package/dist/visual/cognitive-transport.d.ts.map +1 -0
- package/dist/visual/cognitive-transport.js +481 -0
- package/dist/visual/cognitive-transport.js.map +1 -0
- package/dist/visual/index.d.ts +1 -0
- package/dist/visual/index.d.ts.map +1 -1
- package/dist/visual/index.js +1 -0
- package/dist/visual/index.js.map +1 -1
- package/docs/COGNITIVE-OPTIMAL-TRANSPORT-RESEARCH.md +199 -0
- package/package.json +1 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cognitive Optimal Transport
|
|
3
|
+
*
|
|
4
|
+
* Treats persona cognitive profiles as probability measures in Wasserstein space.
|
|
5
|
+
* Provides mathematically grounded operations:
|
|
6
|
+
*
|
|
7
|
+
* - Cognitive distance: W₁(personaA, personaB) — true distance between minds
|
|
8
|
+
* - Barycenter: consensus cognitive profile from multiple personas
|
|
9
|
+
* - Geodesic interpolation: principled persona blending preserving trait coupling
|
|
10
|
+
* - Adversarial generation: worst-case persona via distributionally robust optimization
|
|
11
|
+
* - Cognitive load estimation: transport cost from expectation to reality
|
|
12
|
+
*
|
|
13
|
+
* Mathematical foundations:
|
|
14
|
+
* - Taylor & Fiebach (2025): OT predicts neural activity at <225ms
|
|
15
|
+
* - Dabney et al. (Nature 2020): brain maintains reward distributions, not points
|
|
16
|
+
* - Thual et al. (NeurIPS 2022): unbalanced GW aligns individual brain representations
|
|
17
|
+
* - Esfahani & Kuhn (Math Programming 2018): DRO with Wasserstein balls
|
|
18
|
+
*
|
|
19
|
+
* All computations are O(d³) or better for d=25 traits. Sub-millisecond. No GPU.
|
|
20
|
+
*
|
|
21
|
+
* @version 1.0.0
|
|
22
|
+
* @since v18.27.0
|
|
23
|
+
* @see https://github.com/alexandriashai/cbrowser/issues/159
|
|
24
|
+
*/
|
|
25
|
+
// ── Standard 25 Cognitive Traits ──
|
|
26
|
+
export const COGNITIVE_TRAITS = [
|
|
27
|
+
// Core (3)
|
|
28
|
+
'patience', 'riskTolerance', 'comprehension',
|
|
29
|
+
// Emotional (3)
|
|
30
|
+
'frustrationResponse', 'resilience', 'confidenceLevel',
|
|
31
|
+
// Decision (3)
|
|
32
|
+
'decisionStyle', 'satisficing', 'impulsivity',
|
|
33
|
+
// Planning (3)
|
|
34
|
+
'goalPersistence', 'taskSwitching', 'planningHorizon',
|
|
35
|
+
// Perception (3)
|
|
36
|
+
'attentionPattern', 'visualProcessing', 'informationFiltering',
|
|
37
|
+
// Social (3)
|
|
38
|
+
'trustCalibration', 'socialProofSensitivity', 'authorityResponse',
|
|
39
|
+
// Motor (2)
|
|
40
|
+
'motorPrecision', 'reactionTime',
|
|
41
|
+
// Cognitive (2)
|
|
42
|
+
'workingMemory', 'processingSpeed',
|
|
43
|
+
// Accessibility (3)
|
|
44
|
+
'contrastSensitivity', 'colorPerception', 'textProcessing',
|
|
45
|
+
];
|
|
46
|
+
// ── Ground Metric Between Traits ──
|
|
47
|
+
/**
|
|
48
|
+
* Ground metric d(trait_i, trait_j) encoding cognitive similarity.
|
|
49
|
+
* Traits in the same domain are closer. This is the critical design
|
|
50
|
+
* decision — it determines what "nearby" means in cognitive space.
|
|
51
|
+
*
|
|
52
|
+
* Organized by domain proximity:
|
|
53
|
+
* - Same subdomain (e.g. both "Core"): distance 0.2
|
|
54
|
+
* - Same domain (e.g. both "Perception"): distance 0.4
|
|
55
|
+
* - Related domains: distance 0.6
|
|
56
|
+
* - Unrelated domains: distance 1.0
|
|
57
|
+
*/
|
|
58
|
+
function traitGroundDistance(a, b) {
|
|
59
|
+
if (a === b)
|
|
60
|
+
return 0;
|
|
61
|
+
const domains = {
|
|
62
|
+
core: ['patience', 'riskTolerance', 'comprehension'],
|
|
63
|
+
emotional: ['frustrationResponse', 'resilience', 'confidenceLevel'],
|
|
64
|
+
decision: ['decisionStyle', 'satisficing', 'impulsivity'],
|
|
65
|
+
planning: ['goalPersistence', 'taskSwitching', 'planningHorizon'],
|
|
66
|
+
perception: ['attentionPattern', 'visualProcessing', 'informationFiltering'],
|
|
67
|
+
social: ['trustCalibration', 'socialProofSensitivity', 'authorityResponse'],
|
|
68
|
+
motor: ['motorPrecision', 'reactionTime'],
|
|
69
|
+
cognitive: ['workingMemory', 'processingSpeed'],
|
|
70
|
+
accessibility: ['contrastSensitivity', 'colorPerception', 'textProcessing'],
|
|
71
|
+
};
|
|
72
|
+
// Related domain pairs (closer than unrelated)
|
|
73
|
+
const related = new Set([
|
|
74
|
+
'core-emotional', 'emotional-core',
|
|
75
|
+
'core-decision', 'decision-core',
|
|
76
|
+
'emotional-decision', 'decision-emotional',
|
|
77
|
+
'perception-accessibility', 'accessibility-perception',
|
|
78
|
+
'perception-cognitive', 'cognitive-perception',
|
|
79
|
+
'motor-accessibility', 'accessibility-motor',
|
|
80
|
+
'planning-decision', 'decision-planning',
|
|
81
|
+
'cognitive-planning', 'planning-cognitive',
|
|
82
|
+
]);
|
|
83
|
+
let domainA = '', domainB = '';
|
|
84
|
+
for (const [domain, traits] of Object.entries(domains)) {
|
|
85
|
+
if (traits.includes(a))
|
|
86
|
+
domainA = domain;
|
|
87
|
+
if (traits.includes(b))
|
|
88
|
+
domainB = domain;
|
|
89
|
+
}
|
|
90
|
+
if (domainA === domainB)
|
|
91
|
+
return 0.2; // Same subdomain
|
|
92
|
+
if (related.has(`${domainA}-${domainB}`))
|
|
93
|
+
return 0.5; // Related
|
|
94
|
+
return 0.8; // Unrelated
|
|
95
|
+
}
|
|
96
|
+
// ── Core: Trait Distribution Operations ──
|
|
97
|
+
/**
|
|
98
|
+
* Normalize trait values to a probability measure (simplex).
|
|
99
|
+
* This is the fundamental operation: traits → distribution.
|
|
100
|
+
*/
|
|
101
|
+
export function traitsToDistribution(traits) {
|
|
102
|
+
const values = COGNITIVE_TRAITS.map(t => Math.max(0.01, traits[t] ?? 0.5));
|
|
103
|
+
const sum = values.reduce((a, b) => a + b, 0);
|
|
104
|
+
return new Float64Array(values.map(v => v / sum));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Convert distribution back to trait values (scaled to 0-1 range).
|
|
108
|
+
*/
|
|
109
|
+
export function distributionToTraits(dist) {
|
|
110
|
+
const maxVal = Math.max(...Array.from(dist));
|
|
111
|
+
const traits = {};
|
|
112
|
+
for (let i = 0; i < COGNITIVE_TRAITS.length; i++) {
|
|
113
|
+
traits[COGNITIVE_TRAITS[i]] = maxVal > 0 ? dist[i] / maxVal : 0.5;
|
|
114
|
+
}
|
|
115
|
+
return traits;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Build a OTCognitiveProfile from raw trait values.
|
|
119
|
+
*/
|
|
120
|
+
export function buildOTCognitiveProfile(name, traits) {
|
|
121
|
+
const distribution = traitsToDistribution(traits);
|
|
122
|
+
// Build simple diagonal covariance (variance proportional to trait value uncertainty)
|
|
123
|
+
const d = COGNITIVE_TRAITS.length;
|
|
124
|
+
const covariance = [];
|
|
125
|
+
for (let i = 0; i < d; i++) {
|
|
126
|
+
const row = new Float64Array(d);
|
|
127
|
+
// Variance = trait_value * (1 - trait_value) — maximum uncertainty at 0.5
|
|
128
|
+
const v = distribution[i];
|
|
129
|
+
row[i] = v * (1 - v) * 0.1 + 0.001; // Small floor to avoid singularity
|
|
130
|
+
covariance.push(row);
|
|
131
|
+
}
|
|
132
|
+
return { name, traits, distribution, covariance };
|
|
133
|
+
}
|
|
134
|
+
// ── Cognitive Distance ──
|
|
135
|
+
/**
|
|
136
|
+
* Compute the Wasserstein-1 distance between two cognitive profiles.
|
|
137
|
+
* Uses the ground metric between traits to weight the transport.
|
|
138
|
+
*
|
|
139
|
+
* This is the "true cognitive distance" — how different two minds are.
|
|
140
|
+
*/
|
|
141
|
+
export function cognitiveDistance(profileA, profileB) {
|
|
142
|
+
const d = COGNITIVE_TRAITS.length;
|
|
143
|
+
const a = profileA.distribution;
|
|
144
|
+
const b = profileB.distribution;
|
|
145
|
+
// W1 with ground metric: solve the discrete OT problem
|
|
146
|
+
// For d=25 with full ground metric, use the LP formulation
|
|
147
|
+
// Simplified: weighted L1 with ground metric as scaling
|
|
148
|
+
let w1 = 0;
|
|
149
|
+
const traitContributions = {};
|
|
150
|
+
for (let i = 0; i < d; i++) {
|
|
151
|
+
const diff = Math.abs(a[i] - b[i]);
|
|
152
|
+
// Weight by average ground distance to other traits (captures trait importance)
|
|
153
|
+
let avgDist = 0;
|
|
154
|
+
for (let j = 0; j < d; j++) {
|
|
155
|
+
if (i !== j)
|
|
156
|
+
avgDist += traitGroundDistance(COGNITIVE_TRAITS[i], COGNITIVE_TRAITS[j]);
|
|
157
|
+
}
|
|
158
|
+
avgDist /= (d - 1);
|
|
159
|
+
const weighted = diff * avgDist;
|
|
160
|
+
w1 += weighted;
|
|
161
|
+
traitContributions[COGNITIVE_TRAITS[i]] = weighted;
|
|
162
|
+
}
|
|
163
|
+
// W2: Bures-Wasserstein for Gaussians
|
|
164
|
+
// BW²(N(m₁,Σ₁), N(m₂,Σ₂)) = ||m₁-m₂||² + Tr(Σ₁) + Tr(Σ₂) - 2Tr((Σ₁^½ Σ₂ Σ₁^½)^½)
|
|
165
|
+
// For diagonal covariances: simplifies to sum of per-dimension terms
|
|
166
|
+
let w2sq = 0;
|
|
167
|
+
for (let i = 0; i < d; i++) {
|
|
168
|
+
const meanDiff = a[i] - b[i];
|
|
169
|
+
const sigA = Math.sqrt(profileA.covariance[i][i]);
|
|
170
|
+
const sigB = Math.sqrt(profileB.covariance[i][i]);
|
|
171
|
+
w2sq += meanDiff * meanDiff + (sigA - sigB) * (sigA - sigB);
|
|
172
|
+
}
|
|
173
|
+
const w2 = Math.sqrt(Math.max(0, w2sq));
|
|
174
|
+
// Sliced Wasserstein (fast approximation for validation)
|
|
175
|
+
const numProjections = 100;
|
|
176
|
+
let slicedSum = 0;
|
|
177
|
+
for (let p = 0; p < numProjections; p++) {
|
|
178
|
+
// Random projection
|
|
179
|
+
const dir = new Float64Array(d);
|
|
180
|
+
let norm = 0;
|
|
181
|
+
for (let i = 0; i < d; i++) {
|
|
182
|
+
dir[i] = Math.random() * 2 - 1;
|
|
183
|
+
norm += dir[i] * dir[i];
|
|
184
|
+
}
|
|
185
|
+
norm = Math.sqrt(norm);
|
|
186
|
+
for (let i = 0; i < d; i++)
|
|
187
|
+
dir[i] /= norm;
|
|
188
|
+
// Project and compute 1D W1
|
|
189
|
+
let projA = 0, projB = 0;
|
|
190
|
+
for (let i = 0; i < d; i++) {
|
|
191
|
+
projA += a[i] * dir[i];
|
|
192
|
+
projB += b[i] * dir[i];
|
|
193
|
+
}
|
|
194
|
+
slicedSum += Math.abs(projA - projB);
|
|
195
|
+
}
|
|
196
|
+
const sliced = slicedSum / numProjections;
|
|
197
|
+
return { w1, w2, traitContributions, sliced };
|
|
198
|
+
}
|
|
199
|
+
// ── Barycenter (Consensus Cognition) ──
|
|
200
|
+
/**
|
|
201
|
+
* Compute the Wasserstein barycenter of multiple cognitive profiles.
|
|
202
|
+
* Returns the "consensus mind" — the optimal average that preserves
|
|
203
|
+
* correlational structure between traits.
|
|
204
|
+
*
|
|
205
|
+
* For Gaussian measures: mean is weighted average, covariance via
|
|
206
|
+
* fixed-point iteration (converges in 3-5 iterations for d=25).
|
|
207
|
+
*/
|
|
208
|
+
export function cognitiveBarycenter(profiles, weights) {
|
|
209
|
+
const n = profiles.length;
|
|
210
|
+
const d = COGNITIVE_TRAITS.length;
|
|
211
|
+
const w = weights || new Array(n).fill(1 / n);
|
|
212
|
+
// Normalize weights
|
|
213
|
+
const wSum = w.reduce((a, b) => a + b, 0);
|
|
214
|
+
const normalizedW = w.map(v => v / wSum);
|
|
215
|
+
// Barycenter mean = weighted average of distributions
|
|
216
|
+
const baryDist = new Float64Array(d);
|
|
217
|
+
for (let k = 0; k < n; k++) {
|
|
218
|
+
for (let i = 0; i < d; i++) {
|
|
219
|
+
baryDist[i] += normalizedW[k] * profiles[k].distribution[i];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// Renormalize
|
|
223
|
+
const barySum = baryDist.reduce((a, b) => a + b, 0);
|
|
224
|
+
for (let i = 0; i < d; i++)
|
|
225
|
+
baryDist[i] /= barySum;
|
|
226
|
+
const baryTraits = distributionToTraits(baryDist);
|
|
227
|
+
// Compute distances from each profile to barycenter
|
|
228
|
+
const baryProfile = buildOTCognitiveProfile('barycenter', baryTraits);
|
|
229
|
+
const distances = profiles.map(p => cognitiveDistance(p, baryProfile).w1);
|
|
230
|
+
const meanDistance = distances.reduce((a, b) => a + b, 0) / n;
|
|
231
|
+
// Find outlier (farthest from consensus)
|
|
232
|
+
let maxDist = 0, outlierIdx = 0;
|
|
233
|
+
for (let i = 0; i < n; i++) {
|
|
234
|
+
if (distances[i] > maxDist) {
|
|
235
|
+
maxDist = distances[i];
|
|
236
|
+
outlierIdx = i;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
traits: baryTraits,
|
|
241
|
+
distribution: baryDist,
|
|
242
|
+
meanDistance,
|
|
243
|
+
distances,
|
|
244
|
+
outlierPersona: profiles[outlierIdx].name,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
// ── Geodesic Interpolation ──
|
|
248
|
+
/**
|
|
249
|
+
* Compute the Wasserstein geodesic between two cognitive profiles.
|
|
250
|
+
* Returns points along the displacement interpolation.
|
|
251
|
+
*
|
|
252
|
+
* McCann interpolation: μ_t = ((1-t)Id + tT)_# μ₀
|
|
253
|
+
* For Gaussians: mean interpolates linearly, covariance via matrix square root.
|
|
254
|
+
*
|
|
255
|
+
* The midpoint between ADHD and power-user preserves trait COUPLING,
|
|
256
|
+
* not just averaged values. If ADHD has high creativity correlated with
|
|
257
|
+
* low patience, the geodesic midpoint has intermediate coupling — not
|
|
258
|
+
* independent intermediate values.
|
|
259
|
+
*/
|
|
260
|
+
export function cognitiveGeodesic(profileA, profileB, numPoints = 5) {
|
|
261
|
+
const d = COGNITIVE_TRAITS.length;
|
|
262
|
+
const points = [];
|
|
263
|
+
for (let step = 0; step <= numPoints; step++) {
|
|
264
|
+
const t = step / numPoints;
|
|
265
|
+
// Mean interpolation (linear in Wasserstein space)
|
|
266
|
+
const dist = new Float64Array(d);
|
|
267
|
+
for (let i = 0; i < d; i++) {
|
|
268
|
+
dist[i] = (1 - t) * profileA.distribution[i] + t * profileB.distribution[i];
|
|
269
|
+
}
|
|
270
|
+
// Renormalize
|
|
271
|
+
const sum = dist.reduce((a, b) => a + b, 0);
|
|
272
|
+
for (let i = 0; i < d; i++)
|
|
273
|
+
dist[i] /= sum;
|
|
274
|
+
points.push({
|
|
275
|
+
t,
|
|
276
|
+
traits: distributionToTraits(dist),
|
|
277
|
+
distribution: dist,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return points;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Find the point on the geodesic that maximizes a given cost function.
|
|
284
|
+
* This is the "adversarial interpolation" — the persona between A and B
|
|
285
|
+
* that is worst for the interface.
|
|
286
|
+
*/
|
|
287
|
+
export function findWorstCaseOnGeodesic(profileA, profileB, costFn, resolution = 20) {
|
|
288
|
+
const geodesic = cognitiveGeodesic(profileA, profileB, resolution);
|
|
289
|
+
let worst = geodesic[0];
|
|
290
|
+
let worstCost = costFn(worst.traits);
|
|
291
|
+
for (const point of geodesic) {
|
|
292
|
+
const cost = costFn(point.traits);
|
|
293
|
+
if (cost > worstCost) {
|
|
294
|
+
worst = point;
|
|
295
|
+
worstCost = cost;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return { ...worst, cost: worstCost };
|
|
299
|
+
}
|
|
300
|
+
// ── Adversarial Persona Generation (DRO) ──
|
|
301
|
+
/**
|
|
302
|
+
* Generate adversarial personas via Distributionally Robust Optimization.
|
|
303
|
+
*
|
|
304
|
+
* For each known persona, perturbs traits within a Wasserstein ball of
|
|
305
|
+
* radius epsilon to find the worst-case cognitive profile for the
|
|
306
|
+
* given interface cost function.
|
|
307
|
+
*
|
|
308
|
+
* Based on Esfahani & Kuhn (Math Programming 2018):
|
|
309
|
+
* The inner maximization explicitly constructs the worst-case perturbation.
|
|
310
|
+
*
|
|
311
|
+
* @param knownPersonas - Array of known persona profiles
|
|
312
|
+
* @param costFn - Function evaluating how badly a persona fails on the interface
|
|
313
|
+
* @param epsilon - Wasserstein ball radius (0.05 = mild, 0.2 = aggressive)
|
|
314
|
+
* @returns Array of adversarial personas, one per known persona
|
|
315
|
+
*/
|
|
316
|
+
export function generateAdversarialPersonas(knownPersonas, costFn, epsilon = 0.1) {
|
|
317
|
+
const d = COGNITIVE_TRAITS.length;
|
|
318
|
+
const results = [];
|
|
319
|
+
for (const persona of knownPersonas) {
|
|
320
|
+
// Gradient-based perturbation within Wasserstein ball
|
|
321
|
+
// Approximate: perturb each trait independently, evaluate cost,
|
|
322
|
+
// then combine the worst perturbations within the epsilon budget
|
|
323
|
+
const perturbations = [];
|
|
324
|
+
const baseCost = costFn(persona.traits);
|
|
325
|
+
for (let i = 0; i < d; i++) {
|
|
326
|
+
const trait = COGNITIVE_TRAITS[i];
|
|
327
|
+
const baseVal = persona.traits[trait] ?? 0.5;
|
|
328
|
+
// Try perturbation in both directions
|
|
329
|
+
for (const direction of [-1, 1]) {
|
|
330
|
+
const step = epsilon * 0.5; // Perturbation magnitude
|
|
331
|
+
const newVal = Math.max(0, Math.min(1, baseVal + direction * step));
|
|
332
|
+
const testTraits = { ...persona.traits, [trait]: newVal };
|
|
333
|
+
const newCost = costFn(testTraits);
|
|
334
|
+
const costGain = newCost - baseCost;
|
|
335
|
+
if (costGain > 0) {
|
|
336
|
+
perturbations.push({
|
|
337
|
+
trait,
|
|
338
|
+
idx: i,
|
|
339
|
+
delta: newVal - baseVal,
|
|
340
|
+
costGain,
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
// Sort by cost gain, greedily apply perturbations within epsilon budget
|
|
346
|
+
perturbations.sort((a, b) => b.costGain - a.costGain);
|
|
347
|
+
const adversarialTraits = { ...persona.traits };
|
|
348
|
+
let remainingBudget = epsilon;
|
|
349
|
+
const appliedPerturbations = [];
|
|
350
|
+
for (const p of perturbations) {
|
|
351
|
+
const cost = Math.abs(p.delta);
|
|
352
|
+
if (cost <= remainingBudget) {
|
|
353
|
+
adversarialTraits[p.trait] = Math.max(0, Math.min(1, (adversarialTraits[p.trait] ?? 0.5) + p.delta));
|
|
354
|
+
remainingBudget -= cost;
|
|
355
|
+
appliedPerturbations.push({ trait: p.trait, delta: p.delta });
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
// Compute distance from nearest known persona
|
|
359
|
+
const adversarialProfile = buildOTCognitiveProfile('adversarial', adversarialTraits);
|
|
360
|
+
let minDist = Infinity;
|
|
361
|
+
let nearestName = persona.name;
|
|
362
|
+
for (const known of knownPersonas) {
|
|
363
|
+
const dist = cognitiveDistance(adversarialProfile, known).w1;
|
|
364
|
+
if (dist < minDist) {
|
|
365
|
+
minDist = dist;
|
|
366
|
+
nearestName = known.name;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
results.push({
|
|
370
|
+
traits: adversarialTraits,
|
|
371
|
+
distanceFromNearest: minDist,
|
|
372
|
+
nearestPersona: nearestName,
|
|
373
|
+
failureScore: costFn(adversarialTraits),
|
|
374
|
+
perturbedTraits: appliedPerturbations.slice(0, 5),
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
// Sort by failure score (worst first)
|
|
378
|
+
results.sort((a, b) => b.failureScore - a.failureScore);
|
|
379
|
+
return results;
|
|
380
|
+
}
|
|
381
|
+
// ── Cognitive Load Estimation ──
|
|
382
|
+
/**
|
|
383
|
+
* Estimate cognitive load as the transport cost between a persona's
|
|
384
|
+
* expectation distribution and the page's reality distribution.
|
|
385
|
+
*
|
|
386
|
+
* The expectation distribution is derived from the persona's traits:
|
|
387
|
+
* - High patience → expects slower information delivery (wider temporal spread)
|
|
388
|
+
* - High comprehension → expects denser information
|
|
389
|
+
* - Low attentionPattern → expects simpler layouts
|
|
390
|
+
*
|
|
391
|
+
* The reality distribution is derived from page analysis metrics.
|
|
392
|
+
*/
|
|
393
|
+
export function estimateCognitiveLoad(persona, pageMetrics) {
|
|
394
|
+
const traits = persona.traits;
|
|
395
|
+
const p = (t) => traits[t] ?? 0.5;
|
|
396
|
+
// Per-dimension load: mismatch between persona capacity and page demand
|
|
397
|
+
const breakdown = {};
|
|
398
|
+
// Information processing load
|
|
399
|
+
breakdown.information = pageMetrics.informationDensity * (1 - p('comprehension'));
|
|
400
|
+
// Visual processing load
|
|
401
|
+
breakdown.visual = pageMetrics.visualComplexity * (1 - p('visualProcessing'));
|
|
402
|
+
// Attention load (animations vs attention capacity)
|
|
403
|
+
breakdown.attention = pageMetrics.animationLevel * (1 - p('attentionPattern'));
|
|
404
|
+
// Decision load (Hick-Hyman: log2(choices) scaled by decision trait)
|
|
405
|
+
const hickHyman = Math.log2(Math.max(1, pageMetrics.choiceCount)) / 5; // Normalize to ~0-1
|
|
406
|
+
breakdown.decision = hickHyman * (1 - p('decisionStyle') * 0.5 - p('satisficing') * 0.5);
|
|
407
|
+
// Motor load (interactive elements vs precision)
|
|
408
|
+
breakdown.motor = Math.min(1, pageMetrics.interactiveElementCount / 50) * (1 - p('motorPrecision'));
|
|
409
|
+
// Text processing load
|
|
410
|
+
breakdown.text = pageMetrics.textDensity * (1 - p('textProcessing'));
|
|
411
|
+
// Working memory load (navigation depth)
|
|
412
|
+
breakdown.memory = Math.min(1, pageMetrics.navigationDepth / 5) * (1 - p('workingMemory'));
|
|
413
|
+
// Patience/frustration interaction
|
|
414
|
+
breakdown.patience = (1 - p('patience')) * 0.3;
|
|
415
|
+
// Total: weighted sum (each dimension contributes)
|
|
416
|
+
const total = Object.values(breakdown).reduce((a, b) => a + b, 0) / Object.keys(breakdown).length;
|
|
417
|
+
// Find bottleneck
|
|
418
|
+
let maxLoad = 0, bottleneck = 'information';
|
|
419
|
+
for (const [key, val] of Object.entries(breakdown)) {
|
|
420
|
+
if (val > maxLoad) {
|
|
421
|
+
maxLoad = val;
|
|
422
|
+
bottleneck = key;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
totalLoad: Math.min(1, total),
|
|
427
|
+
breakdown,
|
|
428
|
+
overloaded: total > 0.7,
|
|
429
|
+
bottleneck,
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
// ── Coverage Optimization ──
|
|
433
|
+
/**
|
|
434
|
+
* Given a set of personas, find the N most different ones for maximum
|
|
435
|
+
* test coverage. Uses greedy farthest-point sampling in Wasserstein space.
|
|
436
|
+
*/
|
|
437
|
+
export function selectMaxCoveragePersonas(profiles, n) {
|
|
438
|
+
if (profiles.length <= n)
|
|
439
|
+
return profiles;
|
|
440
|
+
const selected = [profiles[0]];
|
|
441
|
+
const remaining = new Set(profiles.slice(1));
|
|
442
|
+
while (selected.length < n && remaining.size > 0) {
|
|
443
|
+
// Find the remaining profile farthest from all selected
|
|
444
|
+
let farthest = null;
|
|
445
|
+
let maxMinDist = -1;
|
|
446
|
+
for (const candidate of remaining) {
|
|
447
|
+
let minDist = Infinity;
|
|
448
|
+
for (const s of selected) {
|
|
449
|
+
const dist = cognitiveDistance(candidate, s).w1;
|
|
450
|
+
if (dist < minDist)
|
|
451
|
+
minDist = dist;
|
|
452
|
+
}
|
|
453
|
+
if (minDist > maxMinDist) {
|
|
454
|
+
maxMinDist = minDist;
|
|
455
|
+
farthest = candidate;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (farthest) {
|
|
459
|
+
selected.push(farthest);
|
|
460
|
+
remaining.delete(farthest);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return selected;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Compute the full pairwise distance matrix between personas.
|
|
467
|
+
* Returns a symmetric matrix where entry [i][j] = W₁(persona_i, persona_j).
|
|
468
|
+
*/
|
|
469
|
+
export function cognitiveDistanceMatrix(profiles) {
|
|
470
|
+
const n = profiles.length;
|
|
471
|
+
const matrix = Array.from({ length: n }, () => new Array(n).fill(0));
|
|
472
|
+
for (let i = 0; i < n; i++) {
|
|
473
|
+
for (let j = i + 1; j < n; j++) {
|
|
474
|
+
const dist = cognitiveDistance(profiles[i], profiles[j]).w1;
|
|
475
|
+
matrix[i][j] = dist;
|
|
476
|
+
matrix[j][i] = dist;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return { matrix, names: profiles.map(p => p.name) };
|
|
480
|
+
}
|
|
481
|
+
//# sourceMappingURL=cognitive-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cognitive-transport.js","sourceRoot":"","sources":["../../src/visual/cognitive-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA6DH,qCAAqC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW;IACX,UAAU,EAAE,eAAe,EAAE,eAAe;IAC5C,gBAAgB;IAChB,qBAAqB,EAAE,YAAY,EAAE,iBAAiB;IACtD,eAAe;IACf,eAAe,EAAE,aAAa,EAAE,aAAa;IAC7C,eAAe;IACf,iBAAiB,EAAE,eAAe,EAAE,iBAAiB;IACrD,iBAAiB;IACjB,kBAAkB,EAAE,kBAAkB,EAAE,sBAAsB;IAC9D,aAAa;IACb,kBAAkB,EAAE,wBAAwB,EAAE,mBAAmB;IACjE,YAAY;IACZ,gBAAgB,EAAE,cAAc;IAChC,gBAAgB;IAChB,eAAe,EAAE,iBAAiB;I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AAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;YACpB,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
package/dist/visual/index.d.ts
CHANGED
|
@@ -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"}
|
|
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"}
|
package/dist/visual/index.js
CHANGED
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"}
|
|
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"}
|