cbrowser 16.9.4 → 16.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +32 -0
  2. package/dist/analysis/chaos-testing.d.ts.map +1 -1
  3. package/dist/analysis/chaos-testing.js +8 -1
  4. package/dist/analysis/chaos-testing.js.map +1 -1
  5. package/dist/browser.d.ts +8 -0
  6. package/dist/browser.d.ts.map +1 -1
  7. package/dist/browser.js +144 -1
  8. package/dist/browser.js.map +1 -1
  9. package/dist/cli.js +3 -2
  10. package/dist/cli.js.map +1 -1
  11. package/dist/mcp-server-remote.d.ts.map +1 -1
  12. package/dist/mcp-server-remote.js +468 -33
  13. package/dist/mcp-server-remote.js.map +1 -1
  14. package/dist/mcp-server.d.ts.map +1 -1
  15. package/dist/mcp-server.js +513 -33
  16. package/dist/mcp-server.js.map +1 -1
  17. package/dist/performance/metrics.d.ts +2 -2
  18. package/dist/performance/metrics.d.ts.map +1 -1
  19. package/dist/performance/metrics.js +37 -1
  20. package/dist/performance/metrics.js.map +1 -1
  21. package/dist/persona-questionnaire.d.ts +103 -1
  22. package/dist/persona-questionnaire.d.ts.map +1 -1
  23. package/dist/persona-questionnaire.js +396 -35
  24. package/dist/persona-questionnaire.js.map +1 -1
  25. package/dist/personas.d.ts.map +1 -1
  26. package/dist/personas.js +4 -0
  27. package/dist/personas.js.map +1 -1
  28. package/dist/types.d.ts +2 -2
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/values/persona-values.d.ts +5 -0
  31. package/dist/values/persona-values.d.ts.map +1 -1
  32. package/dist/values/persona-values.js +79 -38
  33. package/dist/values/persona-values.js.map +1 -1
  34. package/dist/visual/cross-browser.d.ts.map +1 -1
  35. package/dist/visual/cross-browser.js +10 -1
  36. package/dist/visual/cross-browser.js.map +1 -1
  37. package/docs/personas/Persona-Index.md +126 -0
  38. package/docs/research/Values-Research.md +375 -0
  39. package/package.json +1 -1
@@ -44,9 +44,18 @@ export declare function generatePersonaQuestionnaire(options?: {
44
44
  }): QuestionnaireQuestion[];
45
45
  /**
46
46
  * Build cognitive traits from questionnaire answers.
47
- * Missing answers default to 0.5 (neutral baseline).
47
+ * v16.11.0: Research-based defaults instead of flat 0.5 neutral.
48
+ * Missing answers use "typical adult internet user" baseline from research.
48
49
  */
49
50
  export declare function buildTraitsFromAnswers(answers: Record<string, number>): CognitiveTraits;
51
+ /**
52
+ * Apply research-based correlations between traits.
53
+ * When one trait is set, related traits should adjust unless explicitly set.
54
+ * v16.7.2: Added precision rounding to avoid floating-point artifacts.
55
+ * v16.7.2: Exported for use in createCognitivePersona.
56
+ * v16.11.0: Updated to use research-based baseline checks
57
+ */
58
+ export declare function applyTraitCorrelations(traits: CognitiveTraits): void;
50
59
  /**
51
60
  * Get behavioral description for a specific trait value.
52
61
  */
@@ -71,4 +80,97 @@ export declare function formatForAskUserQuestion(questions: QuestionnaireQuestio
71
80
  }>;
72
81
  multiSelect: boolean;
73
82
  }>;
83
+ /**
84
+ * Persona categories with different value assignment strategies.
85
+ *
86
+ * Research-grounded approach:
87
+ * - COGNITIVE: Disabilities affecting brain function → specific values based on neuroscience
88
+ * - PHYSICAL: Motor/mobility impairments → security/autonomy shifts
89
+ * - SENSORY: Perception-only differences → neutral values (doesn't change motivation)
90
+ * - EMOTIONAL: Trait anxiety/confidence → specific values based on psychology
91
+ * - GENERAL: No disability → research-based population defaults
92
+ */
93
+ export type PersonaCategory = "cognitive" | "physical" | "sensory" | "emotional" | "general";
94
+ /**
95
+ * Category-specific value presets with research citations.
96
+ */
97
+ export interface CategoryValuePreset {
98
+ category: PersonaCategory;
99
+ description: string;
100
+ valueStrategy: "specific" | "security_autonomy_shift" | "neutral" | "trait_based";
101
+ researchBasis: string[];
102
+ defaultValues: {
103
+ selfDirection?: number;
104
+ stimulation?: number;
105
+ hedonism?: number;
106
+ achievement?: number;
107
+ power?: number;
108
+ security?: number;
109
+ conformity?: number;
110
+ tradition?: number;
111
+ benevolence?: number;
112
+ universalism?: number;
113
+ autonomyNeed?: number;
114
+ competenceNeed?: number;
115
+ relatednessNeed?: number;
116
+ maslowLevel?: "physiological" | "safety" | "belonging" | "esteem" | "self-actualization";
117
+ };
118
+ guidance: string;
119
+ }
120
+ /**
121
+ * Research-grounded value presets for each category.
122
+ */
123
+ export declare const CATEGORY_VALUE_PRESETS: CategoryValuePreset[];
124
+ /**
125
+ * Detect persona category from name and description.
126
+ * Returns the most specific matching category.
127
+ */
128
+ export declare function detectPersonaCategory(name: string, description?: string): PersonaCategory;
129
+ /**
130
+ * Get the value preset for a category.
131
+ */
132
+ export declare function getCategoryValuePreset(category: PersonaCategory): CategoryValuePreset;
133
+ /**
134
+ * Build persona values based on category with research grounding.
135
+ * Returns values, research citations, and guidance.
136
+ */
137
+ export declare function buildValuesFromCategory(category: PersonaCategory, overrides?: Partial<CategoryValuePreset["defaultValues"]>): {
138
+ values: CategoryValuePreset["defaultValues"];
139
+ researchBasis: string[];
140
+ guidance: string;
141
+ valueStrategy: CategoryValuePreset["valueStrategy"];
142
+ };
143
+ /**
144
+ * ADHD-specific value adjustments based on subtype.
145
+ * More granular than the general cognitive preset.
146
+ */
147
+ export declare const COGNITIVE_SUBTYPES: Record<string, {
148
+ values: Partial<CategoryValuePreset["defaultValues"]>;
149
+ researchBasis: string;
150
+ }>;
151
+ /**
152
+ * Get cognitive subtype-specific values if available.
153
+ */
154
+ export declare function getCognitiveSubtypeValues(subtypeName: string): {
155
+ values: Partial<CategoryValuePreset["defaultValues"]>;
156
+ researchBasis: string;
157
+ } | undefined;
158
+ /**
159
+ * Validate that category-appropriate values are being assigned.
160
+ * Returns warnings if values violate category guidelines.
161
+ */
162
+ export declare function validateCategoryValues(category: PersonaCategory, values: Partial<CategoryValuePreset["defaultValues"]>): string[];
163
+ /**
164
+ * Category question for the persona questionnaire.
165
+ * Ask this first to determine appropriate value guidance.
166
+ */
167
+ export declare const CATEGORY_QUESTION: {
168
+ question: string;
169
+ header: string;
170
+ options: Array<{
171
+ label: string;
172
+ description: string;
173
+ category: PersonaCategory;
174
+ }>;
175
+ };
74
176
  //# sourceMappingURL=persona-questionnaire.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"persona-questionnaire.d.ts","sourceRoot":"","sources":["../src/persona-questionnaire.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,eAAe,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,cAAc,EAk5ClD,CAAC;AAMF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,eAAe,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,CAAC,EAAE;IACrD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,MAAM,eAAe,CAAC,EAAE,CAAC;CACpC,GAAG,qBAAqB,EAAE,CA0C1B;AAkCD;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,eAAe,CAwCjB;A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,EACzB,SAAS,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,GACxD;IACD,MAAM,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IAC7C,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;CACrD,CAeA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE;IAC9C,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;IACtD,aAAa,EAAE,MAAM,CAAC;CACvB,CAgDA,CAAC;AAEF;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAClB;IAAE,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAG9F;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC,GACpD,MAAM,EAAE,CA8CV;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,eAAe,CAAA;KAAE,CAAC,CAAC;CA2BnF,CAAC"}
@@ -1512,35 +1512,47 @@ function generateQuestionText(trait) {
1512
1512
  }
1513
1513
  /**
1514
1514
  * Build cognitive traits from questionnaire answers.
1515
- * Missing answers default to 0.5 (neutral baseline).
1515
+ * v16.11.0: Research-based defaults instead of flat 0.5 neutral.
1516
+ * Missing answers use "typical adult internet user" baseline from research.
1516
1517
  */
1517
1518
  export function buildTraitsFromAnswers(answers) {
1519
+ // v16.11.0: Research-based defaults instead of flat 0.5
1520
+ // These values represent "typical adult internet user" baseline derived from:
1521
+ // - Baumeister & Tierney (2011): Willpower research
1522
+ // - Kahneman (2011): Thinking, Fast and Slow
1523
+ // - Nielsen Norman Group usability research averages
1524
+ // - Bandura (1997): Self-efficacy studies
1518
1525
  const traits = {
1519
- patience: 0.5,
1520
- riskTolerance: 0.5,
1521
- comprehension: 0.5,
1522
- persistence: 0.5,
1523
- curiosity: 0.5,
1524
- workingMemory: 0.5,
1525
- readingTendency: 0.5,
1526
- resilience: 0.5,
1527
- selfEfficacy: 0.5,
1528
- satisficing: 0.5,
1529
- trustCalibration: 0.5,
1530
- interruptRecovery: 0.5,
1531
- informationForaging: 0.5,
1532
- changeBlindness: 0.3,
1533
- anchoringBias: 0.5,
1534
- timeHorizon: 0.5,
1535
- attributionStyle: 0.5,
1536
- metacognitivePlanning: 0.5,
1537
- proceduralFluency: 0.5,
1538
- transferLearning: 0.5,
1539
- authoritySensitivity: 0.5,
1540
- emotionalContagion: 0.5,
1541
- fearOfMissingOut: 0.5,
1542
- socialProofSensitivity: 0.5,
1543
- mentalModelRigidity: 0.5,
1526
+ // Tier 1: Core traits (from attention/patience research)
1527
+ patience: 0.45, // Research: average user abandons after 3-5 seconds (NNGroup)
1528
+ riskTolerance: 0.40, // Research: loss aversion - people are risk-averse by default
1529
+ comprehension: 0.55, // Research: most adults read at 8th grade level
1530
+ persistence: 0.50, // Neutral - highly variable
1531
+ curiosity: 0.55, // Research: novelty-seeking is common (dopamine system)
1532
+ workingMemory: 0.55, // Research: 4±1 chunks (Miller's law, adjusted for digital)
1533
+ readingTendency: 0.35, // Research: 79% scan, 16% read word-by-word (NNGroup)
1534
+ // Tier 2: Emotional traits (from self-efficacy and resilience research)
1535
+ resilience: 0.45, // Research: digital fatigue lowers bounce-back
1536
+ selfEfficacy: 0.50, // Neutral - domain-dependent
1537
+ satisficing: 0.60, // Research: people prefer "good enough" (Simon, 1956)
1538
+ // Tier 3: Decision-making traits (from behavioral economics)
1539
+ trustCalibration: 0.45, // Research: healthy skepticism is common online
1540
+ interruptRecovery: 0.40, // Research: avg recovery time 23 min (UC Irvine study)
1541
+ informationForaging: 0.55, // Research: users follow information scent (Pirolli)
1542
+ changeBlindness: 0.35, // Research: 40-60% miss major changes (Simons & Levin)
1543
+ anchoringBias: 0.65, // Research: anchoring is one of the strongest biases
1544
+ // Tier 4: Planning traits (from goal-setting research)
1545
+ timeHorizon: 0.45, // Research: present bias is common (Laibson)
1546
+ attributionStyle: 0.50, // Neutral - situational vs dispositional
1547
+ metacognitivePlanning: 0.45, // Research: most people don't plan systematically
1548
+ proceduralFluency: 0.50, // Neutral - domain-dependent
1549
+ transferLearning: 0.45, // Research: transfer is harder than expected
1550
+ // Tier 5: Perception traits (from attention and perception research)
1551
+ authoritySensitivity: 0.55, // Research: authority effect (Milgram studies)
1552
+ emotionalContagion: 0.55, // Research: emotional mirroring is default
1553
+ fearOfMissingOut: 0.50, // Neutral - highly age-dependent
1554
+ socialProofSensitivity: 0.60, // Research: social proof is powerful (Cialdini)
1555
+ mentalModelRigidity: 0.55, // Research: confirmation bias is common
1544
1556
  };
1545
1557
  // Apply answers
1546
1558
  for (const [trait, value] of Object.entries(answers)) {
@@ -1559,35 +1571,73 @@ export function buildTraitsFromAnswers(answers) {
1559
1571
  function roundTrait(value) {
1560
1572
  return Math.round(value * 100) / 100;
1561
1573
  }
1574
+ // v16.11.0: Research-based baseline values for comparison
1575
+ // Used to detect if a trait was "not explicitly set"
1576
+ const BASELINE_TRAITS = {
1577
+ patience: 0.45,
1578
+ riskTolerance: 0.40,
1579
+ comprehension: 0.55,
1580
+ persistence: 0.50,
1581
+ curiosity: 0.55,
1582
+ workingMemory: 0.55,
1583
+ readingTendency: 0.35,
1584
+ resilience: 0.45,
1585
+ selfEfficacy: 0.50,
1586
+ satisficing: 0.60,
1587
+ trustCalibration: 0.45,
1588
+ interruptRecovery: 0.40,
1589
+ informationForaging: 0.55,
1590
+ changeBlindness: 0.35,
1591
+ anchoringBias: 0.65,
1592
+ timeHorizon: 0.45,
1593
+ attributionStyle: 0.50,
1594
+ metacognitivePlanning: 0.45,
1595
+ proceduralFluency: 0.50,
1596
+ transferLearning: 0.45,
1597
+ authoritySensitivity: 0.55,
1598
+ emotionalContagion: 0.55,
1599
+ fearOfMissingOut: 0.50,
1600
+ socialProofSensitivity: 0.60,
1601
+ mentalModelRigidity: 0.55,
1602
+ };
1603
+ /** Check if a trait is at its baseline (wasn't explicitly set) */
1604
+ function isAtBaseline(trait, value) {
1605
+ if (value === undefined)
1606
+ return true;
1607
+ const baseline = BASELINE_TRAITS[trait];
1608
+ return baseline !== undefined && Math.abs(value - baseline) < 0.01;
1609
+ }
1562
1610
  /**
1563
1611
  * Apply research-based correlations between traits.
1564
1612
  * When one trait is set, related traits should adjust unless explicitly set.
1565
1613
  * v16.7.2: Added precision rounding to avoid floating-point artifacts.
1614
+ * v16.7.2: Exported for use in createCognitivePersona.
1615
+ * v16.11.0: Updated to use research-based baseline checks
1566
1616
  */
1567
- function applyTraitCorrelations(traits) {
1617
+ export function applyTraitCorrelations(traits) {
1568
1618
  // If patience is low, resilience tends to be low (r = 0.4)
1569
- if (traits.patience < 0.3 && traits.resilience === 0.5) {
1619
+ if (traits.patience < 0.3 && isAtBaseline("resilience", traits.resilience)) {
1570
1620
  traits.resilience = 0.3;
1571
1621
  }
1572
1622
  // High comprehension correlates with transfer learning (r = 0.6)
1573
- if (traits.comprehension > 0.7 && traits.transferLearning === 0.5) {
1623
+ if (traits.comprehension > 0.7 && isAtBaseline("transferLearning", traits.transferLearning)) {
1574
1624
  traits.transferLearning = roundTrait(traits.comprehension * 0.8);
1575
1625
  }
1576
1626
  // Low self-efficacy correlates with internal attribution (r = 0.5)
1577
- if (traits.selfEfficacy !== undefined && traits.selfEfficacy < 0.3 && traits.attributionStyle === 0.5) {
1627
+ if (traits.selfEfficacy !== undefined && traits.selfEfficacy < 0.3 && isAtBaseline("attributionStyle", traits.attributionStyle)) {
1578
1628
  traits.attributionStyle = 0.7; // Blame self more
1579
1629
  }
1580
1630
  // High curiosity correlates with FOMO (r = 0.3)
1581
- if (traits.curiosity > 0.7 && traits.fearOfMissingOut === 0.5) {
1582
- traits.fearOfMissingOut = 0.6;
1631
+ if (traits.curiosity > 0.7 && isAtBaseline("fearOfMissingOut", traits.fearOfMissingOut)) {
1632
+ traits.fearOfMissingOut = 0.65;
1583
1633
  }
1584
1634
  // Low working memory correlates with poor procedural fluency (r = 0.7)
1585
- if (traits.workingMemory < 0.3 && traits.proceduralFluency === 0.5) {
1635
+ if (traits.workingMemory < 0.3 && isAtBaseline("proceduralFluency", traits.proceduralFluency)) {
1586
1636
  traits.proceduralFluency = roundTrait(traits.workingMemory * 1.2);
1587
1637
  }
1588
1638
  // High trust correlates with authority sensitivity (r = 0.4)
1589
- if (traits.trustCalibration !== undefined && traits.trustCalibration > 0.7 && traits.authoritySensitivity === 0.5) {
1590
- traits.authoritySensitivity = 0.7;
1639
+ if (traits.trustCalibration !== undefined && traits.trustCalibration > 0.7 && isAtBaseline("authoritySensitivity", traits.authoritySensitivity)) {
1640
+ traits.authoritySensitivity = 0.75;
1591
1641
  }
1592
1642
  }
1593
1643
  // ============================================================================
@@ -1677,4 +1727,315 @@ export function formatForAskUserQuestion(questions) {
1677
1727
  multiSelect: false,
1678
1728
  }));
1679
1729
  }
1730
+ /**
1731
+ * Research-grounded value presets for each category.
1732
+ */
1733
+ export const CATEGORY_VALUE_PRESETS = [
1734
+ {
1735
+ category: "cognitive",
1736
+ description: "Disabilities affecting brain function, attention, or processing",
1737
+ valueStrategy: "specific",
1738
+ researchBasis: [
1739
+ "Barkley, R.A. (2015). ADHD: A Handbook for Diagnosis and Treatment. Guilford Press.",
1740
+ "Volkow, N.D., et al. (2011). Motivation deficit in ADHD. Molecular Psychiatry 16.",
1741
+ "Sonuga-Barke, E.J. (2005). Causal models of ADHD. Biological Psychiatry 57(11).",
1742
+ ],
1743
+ defaultValues: {
1744
+ // Cognitive disabilities often show dopamine-related value shifts
1745
+ stimulation: 0.8, // High novelty-seeking (dopamine system)
1746
+ security: 0.3, // Low tolerance for routine
1747
+ conformity: 0.3, // Difficulty with prescribed processes
1748
+ autonomyNeed: 0.7, // Need for self-paced interaction
1749
+ maslowLevel: "esteem",
1750
+ },
1751
+ guidance: "Cognitive disabilities affect dopamine and reward systems. Apply specific values based on the condition (e.g., ADHD = high stimulation, low conformity). These are NOT stereotypes but neurobiologically-grounded tendencies.",
1752
+ },
1753
+ {
1754
+ category: "physical",
1755
+ description: "Motor, mobility, or dexterity impairments",
1756
+ valueStrategy: "security_autonomy_shift",
1757
+ researchBasis: [
1758
+ "Trewin, S. (2000). Configuration agents, control and privacy. ACM ASSETS.",
1759
+ "Wobbrock, J.O., et al. (2011). Ability-Based Design. CACM 54(6).",
1760
+ "Keates, S., et al. (2002). Countering design exclusion. CHI Extended Abstracts.",
1761
+ ],
1762
+ defaultValues: {
1763
+ stimulation: 0.3, // Lower: prefers predictable interfaces
1764
+ security: 0.75, // Higher: needs stable, forgiving UI
1765
+ autonomyNeed: 0.75, // Higher: need for control over interaction pace
1766
+ maslowLevel: "safety",
1767
+ },
1768
+ guidance: "Physical disabilities don't change WHO the person is, but do increase need for predictable, forgiving interfaces. Apply security and autonomy shifts without changing core personality values.",
1769
+ },
1770
+ {
1771
+ category: "sensory",
1772
+ description: "Perception-only differences (color vision, hearing)",
1773
+ valueStrategy: "neutral",
1774
+ researchBasis: [
1775
+ "Sharpe, L.T., et al. (1999). Red, green, and red-green hybrid pigments. Vision Research 39(25).",
1776
+ "Note: Sensory perception does not affect motivational psychology per Schwartz's value theory.",
1777
+ ],
1778
+ defaultValues: {
1779
+ // All neutral - sensory differences don't change motivation
1780
+ selfDirection: 0.5,
1781
+ stimulation: 0.5,
1782
+ hedonism: 0.5,
1783
+ achievement: 0.5,
1784
+ power: 0.5,
1785
+ security: 0.5,
1786
+ conformity: 0.5,
1787
+ tradition: 0.5,
1788
+ benevolence: 0.5,
1789
+ universalism: 0.5,
1790
+ autonomyNeed: 0.5,
1791
+ competenceNeed: 0.5,
1792
+ relatednessNeed: 0.5,
1793
+ maslowLevel: "esteem",
1794
+ },
1795
+ guidance: "Sensory-only differences (color blindness, hearing impairment) affect HOW someone perceives, not WHO they are. Use neutral values (0.5) for all Schwartz values. The disability affects interaction modality, not motivation.",
1796
+ },
1797
+ {
1798
+ category: "emotional",
1799
+ description: "Trait anxiety, depression, or confidence levels",
1800
+ valueStrategy: "trait_based",
1801
+ researchBasis: [
1802
+ "Carver, C.S., & White, T.L. (1994). Behavioral inhibition and activation. JPSP 67(2).",
1803
+ "Gray, J.A., & McNaughton, N. (2000). The Neuropsychology of Anxiety. Oxford.",
1804
+ "Bandura, A. (1997). Self-efficacy: The exercise of control. W.H. Freeman.",
1805
+ ],
1806
+ defaultValues: {
1807
+ // Varies based on specific emotional trait - these are anxiety defaults
1808
+ security: 0.9, // High security-seeking
1809
+ stimulation: 0.2, // Low novelty tolerance
1810
+ conformity: 0.8, // High preference for established norms
1811
+ autonomyNeed: 0.3, // Low preference for independent action
1812
+ maslowLevel: "safety",
1813
+ },
1814
+ guidance: "Emotional traits have well-researched effects on values. Anxiety increases security-seeking; confidence increases self-direction. Apply trait-specific values from personality psychology research.",
1815
+ },
1816
+ {
1817
+ category: "general",
1818
+ description: "No specific disability - population baseline",
1819
+ valueStrategy: "neutral",
1820
+ researchBasis: [
1821
+ "Schwartz, S.H. (2012). Overview of Schwartz Theory of Basic Values.",
1822
+ "Nielsen Norman Group usability research averages.",
1823
+ "Kahneman, D. (2011). Thinking, Fast and Slow.",
1824
+ ],
1825
+ defaultValues: {
1826
+ selfDirection: 0.5,
1827
+ stimulation: 0.5,
1828
+ hedonism: 0.5,
1829
+ achievement: 0.5,
1830
+ power: 0.5,
1831
+ security: 0.5,
1832
+ conformity: 0.5,
1833
+ tradition: 0.5,
1834
+ benevolence: 0.5,
1835
+ universalism: 0.5,
1836
+ autonomyNeed: 0.5,
1837
+ competenceNeed: 0.5,
1838
+ relatednessNeed: 0.5,
1839
+ maslowLevel: "esteem",
1840
+ },
1841
+ guidance: "General personas use neutral baseline values. The persona's specific characteristics will be defined by cognitive traits, not disability-related value shifts.",
1842
+ },
1843
+ ];
1844
+ /**
1845
+ * Keywords for detecting persona category from name or description.
1846
+ */
1847
+ const CATEGORY_KEYWORDS = {
1848
+ cognitive: [
1849
+ "adhd", "attention deficit", "add", "dyslexia", "dyslexic", "autism",
1850
+ "autistic", "asd", "processing speed", "cognitive impairment", "learning disability",
1851
+ "executive function", "working memory impairment", "dyscalculia", "dyspraxia",
1852
+ ],
1853
+ physical: [
1854
+ "motor", "tremor", "mobility", "wheelchair", "dexterity", "paralysis",
1855
+ "parkinson", "cerebral palsy", "amputation", "arthritis", "carpal tunnel",
1856
+ "repetitive strain", "rsi", "limited mobility", "motor impairment",
1857
+ ],
1858
+ sensory: [
1859
+ "color blind", "colorblind", "colour blind", "colourblind", "deaf", "hearing",
1860
+ "hard of hearing", "hoh", "blind", "low vision", "visual impairment",
1861
+ "macular degeneration", "glaucoma", "cataracts", "tinnitus",
1862
+ ],
1863
+ emotional: [
1864
+ "anxious", "anxiety", "anxious-user", "confident", "confident-user",
1865
+ "depressed", "depression", "stressed", "overwhelmed", "fearful",
1866
+ "nervous", "worried", "self-doubt", "low confidence",
1867
+ ],
1868
+ general: [], // No keywords - default fallback
1869
+ };
1870
+ /**
1871
+ * Detect persona category from name and description.
1872
+ * Returns the most specific matching category.
1873
+ */
1874
+ export function detectPersonaCategory(name, description) {
1875
+ const text = `${name} ${description || ""}`.toLowerCase();
1876
+ // Check each category's keywords
1877
+ for (const category of ["cognitive", "physical", "sensory", "emotional"]) {
1878
+ const keywords = CATEGORY_KEYWORDS[category];
1879
+ for (const keyword of keywords) {
1880
+ if (text.includes(keyword)) {
1881
+ return category;
1882
+ }
1883
+ }
1884
+ }
1885
+ return "general";
1886
+ }
1887
+ /**
1888
+ * Get the value preset for a category.
1889
+ */
1890
+ export function getCategoryValuePreset(category) {
1891
+ return CATEGORY_VALUE_PRESETS.find(p => p.category === category) ||
1892
+ CATEGORY_VALUE_PRESETS.find(p => p.category === "general");
1893
+ }
1894
+ /**
1895
+ * Build persona values based on category with research grounding.
1896
+ * Returns values, research citations, and guidance.
1897
+ */
1898
+ export function buildValuesFromCategory(category, overrides) {
1899
+ const preset = getCategoryValuePreset(category);
1900
+ // Merge overrides with defaults
1901
+ const values = {
1902
+ ...preset.defaultValues,
1903
+ ...overrides,
1904
+ };
1905
+ return {
1906
+ values,
1907
+ researchBasis: preset.researchBasis,
1908
+ guidance: preset.guidance,
1909
+ valueStrategy: preset.valueStrategy,
1910
+ };
1911
+ }
1912
+ /**
1913
+ * ADHD-specific value adjustments based on subtype.
1914
+ * More granular than the general cognitive preset.
1915
+ */
1916
+ export const COGNITIVE_SUBTYPES = {
1917
+ "adhd-combined": {
1918
+ values: {
1919
+ stimulation: 0.9,
1920
+ security: 0.25,
1921
+ conformity: 0.25,
1922
+ autonomyNeed: 0.7,
1923
+ },
1924
+ researchBasis: "Barkley (2015): Combined type shows both inattention and hyperactivity-impulsivity",
1925
+ },
1926
+ "adhd-inattentive": {
1927
+ values: {
1928
+ stimulation: 0.7,
1929
+ security: 0.35,
1930
+ conformity: 0.35,
1931
+ autonomyNeed: 0.6,
1932
+ },
1933
+ researchBasis: "Barkley (2015): Inattentive type shows less impulsivity, more daydreaming",
1934
+ },
1935
+ "adhd-hyperactive": {
1936
+ values: {
1937
+ stimulation: 0.95,
1938
+ security: 0.2,
1939
+ conformity: 0.2,
1940
+ autonomyNeed: 0.8,
1941
+ },
1942
+ researchBasis: "Barkley (2015): Hyperactive-impulsive type shows high novelty-seeking",
1943
+ },
1944
+ "autism-spectrum": {
1945
+ values: {
1946
+ stimulation: 0.3, // Often prefers predictable environments
1947
+ security: 0.8, // High need for structure
1948
+ conformity: 0.4, // May not follow social conventions
1949
+ tradition: 0.3, // May question established ways
1950
+ autonomyNeed: 0.6,
1951
+ },
1952
+ researchBasis: "Baron-Cohen (2008): Autism shows preference for systemizing over empathizing",
1953
+ },
1954
+ "dyslexia": {
1955
+ values: {
1956
+ // Dyslexia affects reading, not motivation - mostly neutral with slight adjustments
1957
+ selfDirection: 0.6, // Often develop creative problem-solving
1958
+ stimulation: 0.5,
1959
+ security: 0.5,
1960
+ autonomyNeed: 0.6,
1961
+ },
1962
+ researchBasis: "Shaywitz (2003): Dyslexia is a reading difference, not a personality difference",
1963
+ },
1964
+ };
1965
+ /**
1966
+ * Get cognitive subtype-specific values if available.
1967
+ */
1968
+ export function getCognitiveSubtypeValues(subtypeName) {
1969
+ const normalizedName = subtypeName.toLowerCase().replace(/[_\s]+/g, "-");
1970
+ return COGNITIVE_SUBTYPES[normalizedName];
1971
+ }
1972
+ /**
1973
+ * Validate that category-appropriate values are being assigned.
1974
+ * Returns warnings if values violate category guidelines.
1975
+ */
1976
+ export function validateCategoryValues(category, values) {
1977
+ const warnings = [];
1978
+ const preset = getCategoryValuePreset(category);
1979
+ if (category === "sensory") {
1980
+ // Sensory should have mostly neutral values
1981
+ const nonNeutralCount = Object.entries(values)
1982
+ .filter(([key, val]) => key !== "maslowLevel" && typeof val === "number" && Math.abs(val - 0.5) > 0.15)
1983
+ .length;
1984
+ if (nonNeutralCount > 2) {
1985
+ warnings.push(`SENSORY personas should have mostly neutral values (0.5). ` +
1986
+ `Found ${nonNeutralCount} values significantly different from 0.5. ` +
1987
+ `Sensory differences affect perception, not motivation.`);
1988
+ }
1989
+ }
1990
+ if (category === "physical") {
1991
+ // Physical should have elevated security and autonomy, but not extreme values elsewhere
1992
+ if (values.security !== undefined && values.security < 0.6) {
1993
+ warnings.push(`PHYSICAL disabilities typically increase security needs (predictable UI). ` +
1994
+ `Consider security >= 0.6.`);
1995
+ }
1996
+ if (values.autonomyNeed !== undefined && values.autonomyNeed < 0.6) {
1997
+ warnings.push(`PHYSICAL disabilities typically increase autonomy needs (control over pace). ` +
1998
+ `Consider autonomyNeed >= 0.6.`);
1999
+ }
2000
+ }
2001
+ if (category === "cognitive") {
2002
+ // Cognitive should have specific, non-neutral values
2003
+ if (values.stimulation !== undefined && Math.abs(values.stimulation - 0.5) < 0.1) {
2004
+ warnings.push(`COGNITIVE disabilities typically affect stimulation/novelty-seeking. ` +
2005
+ `Consider specific values based on the condition (e.g., ADHD = high stimulation).`);
2006
+ }
2007
+ }
2008
+ return warnings;
2009
+ }
2010
+ /**
2011
+ * Category question for the persona questionnaire.
2012
+ * Ask this first to determine appropriate value guidance.
2013
+ */
2014
+ export const CATEGORY_QUESTION = {
2015
+ question: "What type of persona are you creating?",
2016
+ header: "Persona Type",
2017
+ options: [
2018
+ {
2019
+ label: "General User",
2020
+ description: "No specific disability - typical user with varied characteristics",
2021
+ category: "general",
2022
+ },
2023
+ {
2024
+ label: "Cognitive Disability",
2025
+ description: "ADHD, autism, dyslexia, processing differences (affects attention/thinking)",
2026
+ category: "cognitive",
2027
+ },
2028
+ {
2029
+ label: "Physical Disability",
2030
+ description: "Motor tremor, mobility, dexterity impairments (affects physical interaction)",
2031
+ category: "physical",
2032
+ },
2033
+ {
2034
+ label: "Sensory Difference",
2035
+ description: "Color blindness, hearing, vision differences (affects perception only)",
2036
+ category: "sensory",
2037
+ },
2038
+ // Note: "Other" option always available via AskUserQuestion
2039
+ ],
2040
+ };
1680
2041
  //# sourceMappingURL=persona-questionnaire.js.map