cbrowser 16.10.0 → 16.14.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 (36) 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 +475 -34
  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 +519 -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 +142 -1
  22. package/dist/persona-questionnaire.d.ts.map +1 -1
  23. package/dist/persona-questionnaire.js +581 -34
  24. package/dist/persona-questionnaire.js.map +1 -1
  25. package/dist/types.d.ts +2 -2
  26. package/dist/types.d.ts.map +1 -1
  27. package/dist/values/persona-values.d.ts +5 -0
  28. package/dist/values/persona-values.d.ts.map +1 -1
  29. package/dist/values/persona-values.js +79 -38
  30. package/dist/values/persona-values.js.map +1 -1
  31. package/dist/visual/cross-browser.d.ts.map +1 -1
  32. package/dist/visual/cross-browser.js +10 -1
  33. package/dist/visual/cross-browser.js.map +1 -1
  34. package/docs/personas/Persona-Index.md +126 -0
  35. package/docs/research/Values-Research.md +426 -0
  36. package/package.json +1 -1
@@ -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,36 +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.
1566
1614
  * v16.7.2: Exported for use in createCognitivePersona.
1615
+ * v16.11.0: Updated to use research-based baseline checks
1567
1616
  */
1568
1617
  export function applyTraitCorrelations(traits) {
1569
1618
  // If patience is low, resilience tends to be low (r = 0.4)
1570
- if (traits.patience < 0.3 && traits.resilience === 0.5) {
1619
+ if (traits.patience < 0.3 && isAtBaseline("resilience", traits.resilience)) {
1571
1620
  traits.resilience = 0.3;
1572
1621
  }
1573
1622
  // High comprehension correlates with transfer learning (r = 0.6)
1574
- if (traits.comprehension > 0.7 && traits.transferLearning === 0.5) {
1623
+ if (traits.comprehension > 0.7 && isAtBaseline("transferLearning", traits.transferLearning)) {
1575
1624
  traits.transferLearning = roundTrait(traits.comprehension * 0.8);
1576
1625
  }
1577
1626
  // Low self-efficacy correlates with internal attribution (r = 0.5)
1578
- 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)) {
1579
1628
  traits.attributionStyle = 0.7; // Blame self more
1580
1629
  }
1581
1630
  // High curiosity correlates with FOMO (r = 0.3)
1582
- if (traits.curiosity > 0.7 && traits.fearOfMissingOut === 0.5) {
1583
- traits.fearOfMissingOut = 0.6;
1631
+ if (traits.curiosity > 0.7 && isAtBaseline("fearOfMissingOut", traits.fearOfMissingOut)) {
1632
+ traits.fearOfMissingOut = 0.65;
1584
1633
  }
1585
1634
  // Low working memory correlates with poor procedural fluency (r = 0.7)
1586
- if (traits.workingMemory < 0.3 && traits.proceduralFluency === 0.5) {
1635
+ if (traits.workingMemory < 0.3 && isAtBaseline("proceduralFluency", traits.proceduralFluency)) {
1587
1636
  traits.proceduralFluency = roundTrait(traits.workingMemory * 1.2);
1588
1637
  }
1589
1638
  // High trust correlates with authority sensitivity (r = 0.4)
1590
- if (traits.trustCalibration !== undefined && traits.trustCalibration > 0.7 && traits.authoritySensitivity === 0.5) {
1591
- traits.authoritySensitivity = 0.7;
1639
+ if (traits.trustCalibration !== undefined && traits.trustCalibration > 0.7 && isAtBaseline("authoritySensitivity", traits.authoritySensitivity)) {
1640
+ traits.authoritySensitivity = 0.75;
1592
1641
  }
1593
1642
  }
1594
1643
  // ============================================================================
@@ -1678,4 +1727,502 @@ export function formatForAskUserQuestion(questions) {
1678
1727
  multiSelect: false,
1679
1728
  }));
1680
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 - values derived from cognitive traits",
1819
+ valueStrategy: "trait_based",
1820
+ researchBasis: [
1821
+ "Schwartz, S.H. (2012). Overview of Schwartz Theory of Basic Values.",
1822
+ "Kashdan, T.B., et al. (2018). The five-dimensional curiosity scale.",
1823
+ "Bandura, A. (1997). Self-efficacy: The exercise of control.",
1824
+ "Duckworth, A.L. (2016). Grit: The power of passion and perseverance.",
1825
+ ],
1826
+ defaultValues: {
1827
+ // Baseline values - will be modified by deriveValuesFromTraits()
1828
+ selfDirection: 0.5,
1829
+ stimulation: 0.5,
1830
+ hedonism: 0.5,
1831
+ achievement: 0.5,
1832
+ power: 0.5,
1833
+ security: 0.5,
1834
+ conformity: 0.5,
1835
+ tradition: 0.5,
1836
+ benevolence: 0.5,
1837
+ universalism: 0.5,
1838
+ autonomyNeed: 0.5,
1839
+ competenceNeed: 0.5,
1840
+ relatednessNeed: 0.5,
1841
+ maslowLevel: "esteem",
1842
+ },
1843
+ guidance: "General personas derive values from their cognitive traits. High curiosity → higher stimulation; high risk tolerance → lower security; high social proof sensitivity → higher conformity. Use deriveValuesFromTraits() with the persona's traits.",
1844
+ },
1845
+ ];
1846
+ /**
1847
+ * Keywords for detecting persona category from name or description.
1848
+ */
1849
+ const CATEGORY_KEYWORDS = {
1850
+ cognitive: [
1851
+ "adhd", "attention deficit", "add", "dyslexia", "dyslexic", "autism",
1852
+ "autistic", "asd", "processing speed", "cognitive impairment", "learning disability",
1853
+ "executive function", "working memory impairment", "dyscalculia", "dyspraxia",
1854
+ ],
1855
+ physical: [
1856
+ "motor", "tremor", "mobility", "wheelchair", "dexterity", "paralysis",
1857
+ "parkinson", "cerebral palsy", "amputation", "arthritis", "carpal tunnel",
1858
+ "repetitive strain", "rsi", "limited mobility", "motor impairment",
1859
+ ],
1860
+ sensory: [
1861
+ "color blind", "colorblind", "colour blind", "colourblind", "deaf", "hearing",
1862
+ "hard of hearing", "hoh", "blind", "low vision", "visual impairment",
1863
+ "macular degeneration", "glaucoma", "cataracts", "tinnitus",
1864
+ ],
1865
+ emotional: [
1866
+ "anxious", "anxiety", "anxious-user", "confident", "confident-user",
1867
+ "depressed", "depression", "stressed", "overwhelmed", "fearful",
1868
+ "nervous", "worried", "self-doubt", "low confidence",
1869
+ ],
1870
+ general: [], // No keywords - default fallback
1871
+ };
1872
+ /**
1873
+ * Detect persona category from name and description.
1874
+ * Returns the most specific matching category.
1875
+ */
1876
+ export function detectPersonaCategory(name, description) {
1877
+ const text = `${name} ${description || ""}`.toLowerCase();
1878
+ // Check each category's keywords
1879
+ for (const category of ["cognitive", "physical", "sensory", "emotional"]) {
1880
+ const keywords = CATEGORY_KEYWORDS[category];
1881
+ for (const keyword of keywords) {
1882
+ if (text.includes(keyword)) {
1883
+ return category;
1884
+ }
1885
+ }
1886
+ }
1887
+ return "general";
1888
+ }
1889
+ /**
1890
+ * Get the value preset for a category.
1891
+ */
1892
+ export function getCategoryValuePreset(category) {
1893
+ return CATEGORY_VALUE_PRESETS.find(p => p.category === category) ||
1894
+ CATEGORY_VALUE_PRESETS.find(p => p.category === "general");
1895
+ }
1896
+ /**
1897
+ * Build persona values based on category with research grounding.
1898
+ * Returns values, research citations, and guidance.
1899
+ *
1900
+ * v16.14.0: For trait_based categories (general, emotional), can derive values from traits.
1901
+ */
1902
+ export function buildValuesFromCategory(category, overrides, traits) {
1903
+ const preset = getCategoryValuePreset(category);
1904
+ // For trait_based strategies, derive values from traits if provided
1905
+ if (preset.valueStrategy === "trait_based" && traits && Object.keys(traits).length > 0) {
1906
+ const derived = deriveValuesFromTraits(traits);
1907
+ // Merge: derived values + preset defaults for missing + overrides on top
1908
+ const values = {
1909
+ ...preset.defaultValues,
1910
+ ...derived.values,
1911
+ ...overrides,
1912
+ };
1913
+ return {
1914
+ values,
1915
+ researchBasis: [...preset.researchBasis, ...derived.researchBasis],
1916
+ guidance: preset.guidance,
1917
+ valueStrategy: preset.valueStrategy,
1918
+ derivations: derived.derivations,
1919
+ };
1920
+ }
1921
+ // For other strategies, use preset defaults with overrides
1922
+ const values = {
1923
+ ...preset.defaultValues,
1924
+ ...overrides,
1925
+ };
1926
+ return {
1927
+ values,
1928
+ researchBasis: preset.researchBasis,
1929
+ guidance: preset.guidance,
1930
+ valueStrategy: preset.valueStrategy,
1931
+ };
1932
+ }
1933
+ /**
1934
+ * ADHD-specific value adjustments based on subtype.
1935
+ * More granular than the general cognitive preset.
1936
+ */
1937
+ export const COGNITIVE_SUBTYPES = {
1938
+ "adhd-combined": {
1939
+ values: {
1940
+ stimulation: 0.9,
1941
+ security: 0.25,
1942
+ conformity: 0.25,
1943
+ autonomyNeed: 0.7,
1944
+ },
1945
+ researchBasis: "Barkley (2015): Combined type shows both inattention and hyperactivity-impulsivity",
1946
+ },
1947
+ "adhd-inattentive": {
1948
+ values: {
1949
+ stimulation: 0.7,
1950
+ security: 0.35,
1951
+ conformity: 0.35,
1952
+ autonomyNeed: 0.6,
1953
+ },
1954
+ researchBasis: "Barkley (2015): Inattentive type shows less impulsivity, more daydreaming",
1955
+ },
1956
+ "adhd-hyperactive": {
1957
+ values: {
1958
+ stimulation: 0.95,
1959
+ security: 0.2,
1960
+ conformity: 0.2,
1961
+ autonomyNeed: 0.8,
1962
+ },
1963
+ researchBasis: "Barkley (2015): Hyperactive-impulsive type shows high novelty-seeking",
1964
+ },
1965
+ "autism-spectrum": {
1966
+ values: {
1967
+ stimulation: 0.3, // Often prefers predictable environments
1968
+ security: 0.8, // High need for structure
1969
+ conformity: 0.4, // May not follow social conventions
1970
+ tradition: 0.3, // May question established ways
1971
+ autonomyNeed: 0.6,
1972
+ },
1973
+ researchBasis: "Baron-Cohen (2008): Autism shows preference for systemizing over empathizing",
1974
+ },
1975
+ "dyslexia": {
1976
+ values: {
1977
+ // Dyslexia affects reading, not motivation - mostly neutral with slight adjustments
1978
+ selfDirection: 0.6, // Often develop creative problem-solving
1979
+ stimulation: 0.5,
1980
+ security: 0.5,
1981
+ autonomyNeed: 0.6,
1982
+ },
1983
+ researchBasis: "Shaywitz (2003): Dyslexia is a reading difference, not a personality difference",
1984
+ },
1985
+ };
1986
+ /**
1987
+ * Get cognitive subtype-specific values if available.
1988
+ */
1989
+ export function getCognitiveSubtypeValues(subtypeName) {
1990
+ const normalizedName = subtypeName.toLowerCase().replace(/[_\s]+/g, "-");
1991
+ return COGNITIVE_SUBTYPES[normalizedName];
1992
+ }
1993
+ /**
1994
+ * Trait-to-Value Correlations (v16.14.0)
1995
+ *
1996
+ * Research-backed mappings from cognitive traits to Schwartz values.
1997
+ * Used for general-category personas to derive meaningful values from traits.
1998
+ *
1999
+ * @references
2000
+ * - Kashdan, T.B., et al. (2018). The five-dimensional curiosity scale. JPSP.
2001
+ * - Schwartz, S.H. (2012). An overview of the Schwartz theory of basic values.
2002
+ * - Duckworth, A.L. (2016). Grit: The power of passion and perseverance.
2003
+ * - Bandura, A. (1997). Self-efficacy: The exercise of control.
2004
+ * - Cialdini, R.B. (2001). Influence: Science and practice.
2005
+ */
2006
+ export const TRAIT_VALUE_CORRELATIONS = {
2007
+ curiosity: {
2008
+ affects: [
2009
+ { value: "stimulation", direction: "positive", weight: 0.6 },
2010
+ { value: "selfDirection", direction: "positive", weight: 0.5 },
2011
+ ],
2012
+ researchBasis: "Kashdan (2018): Curiosity correlates with openness to experience",
2013
+ },
2014
+ riskTolerance: {
2015
+ affects: [
2016
+ { value: "security", direction: "negative", weight: 0.7 },
2017
+ { value: "stimulation", direction: "positive", weight: 0.4 },
2018
+ ],
2019
+ researchBasis: "Schwartz (2012): Security opposes stimulation on value circumplex",
2020
+ },
2021
+ patience: {
2022
+ affects: [
2023
+ { value: "stimulation", direction: "negative", weight: 0.4 },
2024
+ { value: "tradition", direction: "positive", weight: 0.3 },
2025
+ ],
2026
+ researchBasis: "Baumeister (1998): Patience relates to delayed gratification",
2027
+ },
2028
+ persistence: {
2029
+ affects: [
2030
+ { value: "achievement", direction: "positive", weight: 0.6 },
2031
+ { value: "competenceNeed", direction: "positive", weight: 0.4 },
2032
+ ],
2033
+ researchBasis: "Duckworth (2016): Grit predicts achievement-oriented behavior",
2034
+ },
2035
+ socialProofSensitivity: {
2036
+ affects: [
2037
+ { value: "conformity", direction: "positive", weight: 0.7 },
2038
+ { value: "selfDirection", direction: "negative", weight: 0.4 },
2039
+ ],
2040
+ researchBasis: "Cialdini (2001): Social proof activates conformity motivation",
2041
+ },
2042
+ trustCalibration: {
2043
+ affects: [
2044
+ { value: "security", direction: "negative", weight: 0.5 }, // High trust = less security-seeking
2045
+ { value: "benevolence", direction: "positive", weight: 0.3 },
2046
+ ],
2047
+ researchBasis: "Rotter (1971): Trust correlates with positive interpersonal expectations",
2048
+ },
2049
+ authoritySensitivity: {
2050
+ affects: [
2051
+ { value: "conformity", direction: "positive", weight: 0.5 },
2052
+ { value: "tradition", direction: "positive", weight: 0.4 },
2053
+ { value: "selfDirection", direction: "negative", weight: 0.3 },
2054
+ ],
2055
+ researchBasis: "Schwartz (2012): Authority acceptance aligns with conservation values",
2056
+ },
2057
+ fearOfMissingOut: {
2058
+ affects: [
2059
+ { value: "stimulation", direction: "positive", weight: 0.6 },
2060
+ { value: "security", direction: "negative", weight: 0.4 },
2061
+ ],
2062
+ researchBasis: "Przybylski (2013): FOMO drives novelty-seeking behavior",
2063
+ },
2064
+ selfEfficacy: {
2065
+ affects: [
2066
+ { value: "achievement", direction: "positive", weight: 0.5 },
2067
+ { value: "autonomyNeed", direction: "positive", weight: 0.6 },
2068
+ { value: "competenceNeed", direction: "positive", weight: 0.5 },
2069
+ ],
2070
+ researchBasis: "Bandura (1997): Self-efficacy predicts autonomous achievement",
2071
+ },
2072
+ resilience: {
2073
+ affects: [
2074
+ { value: "competenceNeed", direction: "positive", weight: 0.5 },
2075
+ { value: "security", direction: "negative", weight: 0.3 }, // Resilient = less security-dependent
2076
+ ],
2077
+ researchBasis: "Masten (2001): Resilience reflects adaptive competence",
2078
+ },
2079
+ comprehension: {
2080
+ affects: [
2081
+ { value: "selfDirection", direction: "positive", weight: 0.4 },
2082
+ { value: "competenceNeed", direction: "positive", weight: 0.3 },
2083
+ ],
2084
+ researchBasis: "Cognitive load research: Comprehension enables autonomous decision-making",
2085
+ },
2086
+ satisficing: {
2087
+ affects: [
2088
+ { value: "achievement", direction: "negative", weight: 0.4 }, // Satisficers are less achievement-driven
2089
+ { value: "stimulation", direction: "negative", weight: 0.3 },
2090
+ ],
2091
+ researchBasis: "Simon (1956): Satisficing vs maximizing decision strategies",
2092
+ },
2093
+ };
2094
+ /**
2095
+ * Derive Schwartz values from cognitive traits. (v16.14.0)
2096
+ *
2097
+ * For general-category personas, values should reflect their cognitive profile.
2098
+ * Uses weighted correlations from psychological research.
2099
+ *
2100
+ * @param traits - Cognitive traits (0-1 scale)
2101
+ * @returns Derived values with research basis
2102
+ */
2103
+ export function deriveValuesFromTraits(traits) {
2104
+ // Start with neutral baseline
2105
+ const derivedValues = {
2106
+ selfDirection: 0.5,
2107
+ stimulation: 0.5,
2108
+ hedonism: 0.5,
2109
+ achievement: 0.5,
2110
+ power: 0.5,
2111
+ security: 0.5,
2112
+ conformity: 0.5,
2113
+ tradition: 0.5,
2114
+ benevolence: 0.5,
2115
+ universalism: 0.5,
2116
+ autonomyNeed: 0.5,
2117
+ competenceNeed: 0.5,
2118
+ relatednessNeed: 0.5,
2119
+ };
2120
+ const derivations = [];
2121
+ const researchBasis = [];
2122
+ // Apply trait correlations
2123
+ for (const [traitName, traitValue] of Object.entries(traits)) {
2124
+ const correlation = TRAIT_VALUE_CORRELATIONS[traitName];
2125
+ if (!correlation || traitValue === undefined)
2126
+ continue;
2127
+ // Trait deviation from neutral (0.5)
2128
+ const traitDeviation = traitValue - 0.5;
2129
+ for (const effect of correlation.affects) {
2130
+ // Calculate contribution: deviation * weight * direction
2131
+ const contribution = traitDeviation * effect.weight * (effect.direction === "positive" ? 1 : -1);
2132
+ // Apply to value (clamped to 0-1)
2133
+ if (derivedValues[effect.value] !== undefined) {
2134
+ const oldValue = derivedValues[effect.value];
2135
+ derivedValues[effect.value] = Math.max(0, Math.min(1, oldValue + contribution));
2136
+ if (Math.abs(contribution) > 0.05) {
2137
+ derivations.push({
2138
+ trait: traitName,
2139
+ affectedValue: effect.value,
2140
+ contribution: Math.round(contribution * 100) / 100,
2141
+ });
2142
+ }
2143
+ }
2144
+ }
2145
+ if (!researchBasis.includes(correlation.researchBasis)) {
2146
+ researchBasis.push(correlation.researchBasis);
2147
+ }
2148
+ }
2149
+ // Round values for cleaner output
2150
+ for (const key of Object.keys(derivedValues)) {
2151
+ derivedValues[key] = Math.round(derivedValues[key] * 100) / 100;
2152
+ }
2153
+ return {
2154
+ values: derivedValues,
2155
+ derivations,
2156
+ researchBasis,
2157
+ };
2158
+ }
2159
+ /**
2160
+ * Validate that category-appropriate values are being assigned.
2161
+ * Returns warnings if values violate category guidelines.
2162
+ */
2163
+ export function validateCategoryValues(category, values) {
2164
+ const warnings = [];
2165
+ const preset = getCategoryValuePreset(category);
2166
+ if (category === "sensory") {
2167
+ // Sensory should have mostly neutral values
2168
+ const nonNeutralCount = Object.entries(values)
2169
+ .filter(([key, val]) => key !== "maslowLevel" && typeof val === "number" && Math.abs(val - 0.5) > 0.15)
2170
+ .length;
2171
+ if (nonNeutralCount > 2) {
2172
+ warnings.push(`SENSORY personas should have mostly neutral values (0.5). ` +
2173
+ `Found ${nonNeutralCount} values significantly different from 0.5. ` +
2174
+ `Sensory differences affect perception, not motivation.`);
2175
+ }
2176
+ }
2177
+ if (category === "physical") {
2178
+ // Physical should have elevated security and autonomy, but not extreme values elsewhere
2179
+ if (values.security !== undefined && values.security < 0.6) {
2180
+ warnings.push(`PHYSICAL disabilities typically increase security needs (predictable UI). ` +
2181
+ `Consider security >= 0.6.`);
2182
+ }
2183
+ if (values.autonomyNeed !== undefined && values.autonomyNeed < 0.6) {
2184
+ warnings.push(`PHYSICAL disabilities typically increase autonomy needs (control over pace). ` +
2185
+ `Consider autonomyNeed >= 0.6.`);
2186
+ }
2187
+ }
2188
+ if (category === "cognitive") {
2189
+ // Cognitive should have specific, non-neutral values
2190
+ if (values.stimulation !== undefined && Math.abs(values.stimulation - 0.5) < 0.1) {
2191
+ warnings.push(`COGNITIVE disabilities typically affect stimulation/novelty-seeking. ` +
2192
+ `Consider specific values based on the condition (e.g., ADHD = high stimulation).`);
2193
+ }
2194
+ }
2195
+ return warnings;
2196
+ }
2197
+ /**
2198
+ * Category question for the persona questionnaire.
2199
+ * Ask this first to determine appropriate value guidance.
2200
+ */
2201
+ export const CATEGORY_QUESTION = {
2202
+ question: "What type of persona are you creating?",
2203
+ header: "Persona Type",
2204
+ options: [
2205
+ {
2206
+ label: "General User",
2207
+ description: "No specific disability - typical user with varied characteristics",
2208
+ category: "general",
2209
+ },
2210
+ {
2211
+ label: "Cognitive Disability",
2212
+ description: "ADHD, autism, dyslexia, processing differences (affects attention/thinking)",
2213
+ category: "cognitive",
2214
+ },
2215
+ {
2216
+ label: "Physical Disability",
2217
+ description: "Motor tremor, mobility, dexterity impairments (affects physical interaction)",
2218
+ category: "physical",
2219
+ },
2220
+ {
2221
+ label: "Sensory Difference",
2222
+ description: "Color blindness, hearing, vision differences (affects perception only)",
2223
+ category: "sensory",
2224
+ },
2225
+ // Note: "Other" option always available via AskUserQuestion
2226
+ ],
2227
+ };
1681
2228
  //# sourceMappingURL=persona-questionnaire.js.map