totemheart 0.1.4 → 0.1.6
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/README.md +177 -122
- package/package.json +10 -1
- package/src/Totemheart.js +2578 -15
- package/src/behavior/AffectAlignmentMonitor.js +66 -0
- package/src/behavior/AudienceDesign.js +43 -0
- package/src/behavior/BlushSlipEngine.js +90 -0
- package/src/behavior/ConversationalRepair.js +50 -0
- package/src/behavior/CreativeModeSwitch.js +47 -0
- package/src/behavior/EffortWithholding.js +51 -0
- package/src/behavior/HumanDiscourseShaper.js +87 -0
- package/src/behavior/MeaningfulSilence.js +36 -0
- package/src/behavior/PolitenessShutdown.js +58 -0
- package/src/behavior/PostConflictCooling.js +54 -0
- package/src/behavior/RegulationStrategySelector.js +109 -0
- package/src/behavior/SelfHandicapping.js +38 -0
- package/src/behavior/StyleMimicry.js +26 -0
- package/src/cognition/AmusementEngine.js +73 -0
- package/src/cognition/AnticipatedRegretEngine.js +48 -0
- package/src/cognition/AweSystem.js +37 -0
- package/src/cognition/ChildlikeMode.js +189 -0
- package/src/cognition/ChillsEngine.js +93 -0
- package/src/cognition/CognitiveDissonance.js +65 -0
- package/src/cognition/ConservationWithdrawal.js +70 -0
- package/src/cognition/ControllabilityEstimate.js +60 -1
- package/src/cognition/CravingTrace.js +70 -0
- package/src/cognition/DefenseMechanisms.js +13 -6
- package/src/cognition/DesireEngine.js +133 -0
- package/src/cognition/DriftDiffusionModel.js +70 -0
- package/src/cognition/EmotionalForecasting.js +76 -0
- package/src/cognition/EmotionalImmuneSystem.js +68 -0
- package/src/cognition/EmotionalOntology.js +19 -1
- package/src/cognition/EnergyBudget.js +68 -0
- package/src/cognition/EpisodicFutureSimulation.js +57 -0
- package/src/cognition/GlobalWorkspace.js +57 -0
- package/src/cognition/GoalHierarchyManager.js +77 -0
- package/src/cognition/HabitVsGoalSystem.js +86 -0
- package/src/cognition/HickHymanLaw.js +35 -0
- package/src/cognition/HopeDisappointmentSystem.js +76 -0
- package/src/cognition/IdealSelfDiscrepancy.js +54 -0
- package/src/cognition/InhibitoryControlPool.js +65 -0
- package/src/cognition/InsightGenerator.js +98 -0
- package/src/cognition/IntuitionEngine.js +343 -0
- package/src/cognition/MeaningMakingEngine.js +69 -0
- package/src/cognition/MetaEmotionLayer.js +67 -0
- package/src/cognition/MetacognitiveConfidence.js +52 -0
- package/src/cognition/MoralLicensing.js +53 -0
- package/src/cognition/MortalitySalience.js +57 -0
- package/src/cognition/NormativeExpectationField.js +52 -0
- package/src/cognition/OntogenicDevelopment.js +68 -0
- package/src/cognition/PercentageOfAssets.js +60 -0
- package/src/cognition/PredictiveProcessingCore.js +105 -0
- package/src/cognition/ProspectiveMemorySystem.js +73 -0
- package/src/cognition/PsychologicalDistanceScaler.js +41 -0
- package/src/cognition/ReactanceEngine.js +45 -0
- package/src/cognition/ReliefEngine.js +50 -0
- package/src/cognition/RuminationVsReflectionSwitch.js +41 -0
- package/src/cognition/SchemaAssimilationAccommodation.js +60 -0
- package/src/cognition/SelfDistancingSpeech.js +57 -0
- package/src/cognition/SignalDetectionTheory.js +106 -0
- package/src/cognition/StevensPowerLaw.js +61 -0
- package/src/cognition/SubconsciousEngine.js +112 -0
- package/src/cognition/SuperegoMonitor.js +54 -0
- package/src/cognition/TemporalDiscountingEngine.js +51 -0
- package/src/cognition/TemptationField.js +50 -0
- package/src/cognition/TipOfTongue.js +104 -0
- package/src/cognition/ValueHierarchy.js +26 -0
- package/src/cognition/WeberFechnerLaw.js +33 -0
- package/src/cognition/WorkingMemoryBuffer.js +72 -0
- package/src/cognition/YieldController.js +40 -0
- package/src/core/BoredomSystem.js +229 -0
- package/src/core/DualProcessController.js +75 -0
- package/src/core/EmotionSpace.js +3 -0
- package/src/core/FrikiEngine.js +276 -0
- package/src/core/GlobalMoodAbatement.js +64 -0
- package/src/core/HomeostaticFeelingGenerator.js +70 -0
- package/src/core/MoralInjury.js +41 -3
- package/src/core/Personality.js +26 -15
- package/src/core/PrimaryDrives.js +175 -0
- package/src/core/SelfDeterminationNeeds.js +89 -0
- package/src/economics/ClassicalConditioning.js +41 -0
- package/src/economics/FramingEffect.js +52 -0
- package/src/embodiment/InteroceptiveAwarenessGain.js +53 -0
- package/src/embodiment/InteroceptivePredictionError.js +13 -4
- package/src/embodiment/SomaticActivationSystem.js +71 -0
- package/src/embodiment/SomaticMarkerNetwork.js +78 -0
- package/src/index.js +2 -0
- package/src/neurochemistry/HappinessEngine.js +142 -0
- package/src/neurochemistry/SleepQualityCoupler.js +48 -0
- package/src/neurochemistry/StressInoculationMemory.js +49 -0
- package/src/social/AffiliationThermostat.js +53 -0
- package/src/social/BetrayalTraumaTrace.js +120 -0
- package/src/social/ColonyDynamics.js +91 -0
- package/src/social/ComparisonLevelAlternatives.js +62 -0
- package/src/social/ConsolationEfficacy.js +50 -0
- package/src/social/ContemptDetector.js +56 -0
- package/src/social/CulturalScriptLibrary.js +107 -0
- package/src/social/DemandWithdrawLoop.js +56 -0
- package/src/social/DreamEngine.js +164 -0
- package/src/social/EgoCalibrationSuite.js +63 -0
- package/src/social/ElevationSystem.js +31 -0
- package/src/social/EmbarrassmentEngine.js +53 -0
- package/src/social/EmpathicAccuracySystem.js +46 -0
- package/src/social/EmpathyCompassion.js +60 -0
- package/src/social/EndogenousOpioidSystem.js +65 -0
- package/src/social/FaceThreatSensitivity.js +50 -0
- package/src/social/FlirtationEngine.js +74 -0
- package/src/social/GhostingDetector.js +59 -0
- package/src/social/GratitudeEngine.js +29 -0
- package/src/social/GriefEngine.js +300 -0
- package/src/social/GrudgeSystem.js +107 -0
- package/src/social/IdentityThreatMonitor.js +28 -0
- package/src/social/JealousyTriangle.js +42 -0
- package/src/social/LegacyMemory.js +101 -0
- package/src/social/LonelinessEngine.js +68 -0
- package/src/social/LoveHateEngine.js +14 -0
- package/src/social/LoyaltyConflictResolver.js +54 -0
- package/src/social/MoralDisgust.js +63 -0
- package/src/social/MultiAgentSocialGraph.js +105 -0
- package/src/social/NarrativeSelfEngine.js +99 -0
- package/src/social/NightmareEngine.js +88 -0
- package/src/social/OstracismDetector.js +53 -0
- package/src/social/OxytocinSystem.js +73 -0
- package/src/social/PainSocialOverlap.js +19 -0
- package/src/social/PowerDynamicsEngine.js +118 -0
- package/src/social/PrestigeSystem.js +63 -0
- package/src/social/ReciprocityClassifier.js +107 -0
- package/src/social/ReflectedGlory.js +43 -0
- package/src/social/RelationalAfterglow.js +59 -0
- package/src/social/RelationalMemoryCatalog.js +523 -0
- package/src/social/ResidualAnnoyanceTrace.js +50 -0
- package/src/social/RoleIdentitySalience.js +85 -0
- package/src/social/SecretMaintenanceSystem.js +94 -0
- package/src/social/SelfCompassionVsAttack.js +48 -0
- package/src/social/SelfPresentationManager.js +59 -0
- package/src/social/SharedRelationalCulture.js +88 -0
- package/src/social/SocialDiscomfort.js +48 -0
- package/src/social/SocialReferenceFrame.js +31 -0
- package/src/social/SourceMonitoring.js +45 -0
- package/src/social/StatusEnvy.js +44 -0
- package/src/social/TraumaCascadeEngine.js +266 -0
- package/src/social/YearningEngine.js +216 -0
- package/src/version.js +1 -1
package/src/Totemheart.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Personality } from './core/Personality.js'
|
|
2
2
|
import { CoreBeliefs } from './core/CoreBeliefs.js'
|
|
3
3
|
import { Homeostasis } from './core/Homeostasis.js'
|
|
4
|
-
import { EmotionSpace } from './core/EmotionSpace.js'
|
|
4
|
+
import { EmotionSpace, EMOTION_COORDS } from './core/EmotionSpace.js'
|
|
5
5
|
import { MicroEmotions } from './core/MicroEmotions.js'
|
|
6
6
|
import { MoodTracker } from './core/MoodTracker.js'
|
|
7
7
|
import { DecayEngine } from './core/DecayEngine.js'
|
|
@@ -9,6 +9,7 @@ import { HedonicAdaptation } from './core/HedonicAdaptation.js'
|
|
|
9
9
|
|
|
10
10
|
import { CognitiveDissonance } from './cognition/CognitiveDissonance.js'
|
|
11
11
|
import { DefenseMechanisms } from './cognition/DefenseMechanisms.js'
|
|
12
|
+
import { SelfDistancingSpeech } from './cognition/SelfDistancingSpeech.js'
|
|
12
13
|
import { DecisionFatigue } from './cognition/DecisionFatigue.js'
|
|
13
14
|
import { AmygdalaHijack } from './cognition/AmygdalaHijack.js'
|
|
14
15
|
import { EmotionalOntology } from './cognition/EmotionalOntology.js'
|
|
@@ -89,6 +90,20 @@ import { WornPathCache } from './core/WornPathCache.js'
|
|
|
89
90
|
import { TriggerSentinel } from './core/TriggerSentinel.js'
|
|
90
91
|
import { HebbianPlasticity } from './core/HebbianPlasticity.js'
|
|
91
92
|
import { RemConsolidation } from './cognition/RemConsolidation.js'
|
|
93
|
+
import { RelationalMemoryCatalog } from './social/RelationalMemoryCatalog.js'
|
|
94
|
+
import { FrikiEngine } from './core/FrikiEngine.js'
|
|
95
|
+
import { SomaticActivationSystem } from './embodiment/SomaticActivationSystem.js'
|
|
96
|
+
import { GlobalMoodAbatement } from './core/GlobalMoodAbatement.js'
|
|
97
|
+
import { GhostingDetector } from './social/GhostingDetector.js'
|
|
98
|
+
import { TipOfTongue } from './cognition/TipOfTongue.js'
|
|
99
|
+
import { GrudgeSystem } from './social/GrudgeSystem.js'
|
|
100
|
+
import { SocialDiscomfort } from './social/SocialDiscomfort.js'
|
|
101
|
+
import { EmpathyCompassion } from './social/EmpathyCompassion.js'
|
|
102
|
+
import { FlirtationEngine } from './social/FlirtationEngine.js'
|
|
103
|
+
import { HumanDiscourseShaper } from './behavior/HumanDiscourseShaper.js'
|
|
104
|
+
import { BlushSlipEngine } from './behavior/BlushSlipEngine.js'
|
|
105
|
+
import { PercentageOfAssets } from './cognition/PercentageOfAssets.js'
|
|
106
|
+
import { AffectAlignmentMonitor } from './behavior/AffectAlignmentMonitor.js'
|
|
92
107
|
|
|
93
108
|
import { GriefEngine } from './social/GriefEngine.js'
|
|
94
109
|
import { ShameGuiltSplit } from './social/ShameGuiltSplit.js'
|
|
@@ -102,6 +117,27 @@ import { SubjectiveTimeEngine } from './neurochemistry/SubjectiveTimeEngine.js
|
|
|
102
117
|
import { SleepPressure } from './neurochemistry/SleepPressure.js'
|
|
103
118
|
import { AnticipatoryAffect } from './cognition/AnticipatoryAffect.js'
|
|
104
119
|
import { MotivationalConflict } from './cognition/MotivationalConflict.js'
|
|
120
|
+
import { DesireEngine } from './cognition/DesireEngine.js'
|
|
121
|
+
import { IntuitionEngine } from './cognition/IntuitionEngine.js'
|
|
122
|
+
import { TraumaCascadeEngine } from './social/TraumaCascadeEngine.js'
|
|
123
|
+
import { YearningEngine } from './social/YearningEngine.js'
|
|
124
|
+
import { ChildlikeMode } from './cognition/ChildlikeMode.js'
|
|
125
|
+
import { HappinessEngine } from './neurochemistry/HappinessEngine.js'
|
|
126
|
+
import { ChillsEngine } from './cognition/ChillsEngine.js'
|
|
127
|
+
import { SecretMaintenanceSystem } from './social/SecretMaintenanceSystem.js'
|
|
128
|
+
import { SharedRelationalCulture } from './social/SharedRelationalCulture.js'
|
|
129
|
+
import { LonelinessEngine } from './social/LonelinessEngine.js'
|
|
130
|
+
import { AnticipatedRegretEngine } from './cognition/AnticipatedRegretEngine.js'
|
|
131
|
+
import { HopeDisappointmentSystem } from './cognition/HopeDisappointmentSystem.js'
|
|
132
|
+
import { SelfCompassionVsAttack } from './social/SelfCompassionVsAttack.js'
|
|
133
|
+
import { EmpathicAccuracySystem } from './social/EmpathicAccuracySystem.js'
|
|
134
|
+
import { ConsolationEfficacy } from './social/ConsolationEfficacy.js'
|
|
135
|
+
import { SleepQualityCoupler } from './neurochemistry/SleepQualityCoupler.js'
|
|
136
|
+
import { ConversationalRepair } from './behavior/ConversationalRepair.js'
|
|
137
|
+
import { MeaningfulSilence } from './behavior/MeaningfulSilence.js'
|
|
138
|
+
import { TemptationField } from './cognition/TemptationField.js'
|
|
139
|
+
import { CravingTrace } from './cognition/CravingTrace.js'
|
|
140
|
+
import { YieldController } from './cognition/YieldController.js'
|
|
105
141
|
import { EgoDepletionBudget } from './cognition/EgoDepletionBudget.js'
|
|
106
142
|
import { ValueHierarchy } from './cognition/ValueHierarchy.js'
|
|
107
143
|
import { CommitmentDevice } from './core/CommitmentDevice.js'
|
|
@@ -109,6 +145,112 @@ import { MoralInjury } from './core/MoralInjury.js'
|
|
|
109
145
|
import { OpponentProcess } from './core/OpponentProcess.js'
|
|
110
146
|
import { InteroceptivePredictionError } from './embodiment/InteroceptivePredictionError.js'
|
|
111
147
|
|
|
148
|
+
import { NarrativeSelfEngine } from './social/NarrativeSelfEngine.js'
|
|
149
|
+
import { LegacyMemory } from './social/LegacyMemory.js'
|
|
150
|
+
import { MultiAgentSocialGraph } from './social/MultiAgentSocialGraph.js'
|
|
151
|
+
import { CulturalScriptLibrary } from './social/CulturalScriptLibrary.js'
|
|
152
|
+
import { PowerDynamicsEngine } from './social/PowerDynamicsEngine.js'
|
|
153
|
+
import { BetrayalTraumaTrace } from './social/BetrayalTraumaTrace.js'
|
|
154
|
+
import { OntogenicDevelopment } from './cognition/OntogenicDevelopment.js'
|
|
155
|
+
import { MetaEmotionLayer } from './cognition/MetaEmotionLayer.js'
|
|
156
|
+
import { EmotionalForecasting } from './cognition/EmotionalForecasting.js'
|
|
157
|
+
import { InsightGenerator } from './cognition/InsightGenerator.js'
|
|
158
|
+
import { EnergyBudget } from './cognition/EnergyBudget.js'
|
|
159
|
+
import { RegulationStrategySelector } from './behavior/RegulationStrategySelector.js'
|
|
160
|
+
import { CreativeModeSwitch } from './behavior/CreativeModeSwitch.js'
|
|
161
|
+
import { SomaticMarkerNetwork } from './embodiment/SomaticMarkerNetwork.js'
|
|
162
|
+
|
|
163
|
+
import { GlobalWorkspace } from './cognition/GlobalWorkspace.js'
|
|
164
|
+
import { PrimaryDrives } from './core/PrimaryDrives.js'
|
|
165
|
+
import { EmotionalImmuneSystem } from './cognition/EmotionalImmuneSystem.js'
|
|
166
|
+
|
|
167
|
+
import { DualProcessController } from './core/DualProcessController.js'
|
|
168
|
+
import { PredictiveProcessingCore } from './cognition/PredictiveProcessingCore.js'
|
|
169
|
+
import { DriftDiffusionModel } from './cognition/DriftDiffusionModel.js'
|
|
170
|
+
import { SignalDetectionTheory } from './cognition/SignalDetectionTheory.js'
|
|
171
|
+
import { HickHymanLaw } from './cognition/HickHymanLaw.js'
|
|
172
|
+
import { StevensPowerLaw } from './cognition/StevensPowerLaw.js'
|
|
173
|
+
import { WeberFechnerLaw } from './cognition/WeberFechnerLaw.js'
|
|
174
|
+
import { SelfDeterminationNeeds } from './core/SelfDeterminationNeeds.js'
|
|
175
|
+
import { HomeostaticFeelingGenerator } from './core/HomeostaticFeelingGenerator.js'
|
|
176
|
+
import { WorkingMemoryBuffer } from './cognition/WorkingMemoryBuffer.js'
|
|
177
|
+
import { HabitVsGoalSystem } from './cognition/HabitVsGoalSystem.js'
|
|
178
|
+
import { GoalHierarchyManager } from './cognition/GoalHierarchyManager.js'
|
|
179
|
+
import { BoredomSystem } from './core/BoredomSystem.js'
|
|
180
|
+
|
|
181
|
+
import { TemporalDiscountingEngine } from './cognition/TemporalDiscountingEngine.js'
|
|
182
|
+
import { InhibitoryControlPool } from './cognition/InhibitoryControlPool.js'
|
|
183
|
+
import { OstracismDetector } from './social/OstracismDetector.js'
|
|
184
|
+
import { MetacognitiveConfidence } from './cognition/MetacognitiveConfidence.js'
|
|
185
|
+
import { RoleIdentitySalience } from './social/RoleIdentitySalience.js'
|
|
186
|
+
import { MeaningMakingEngine } from './cognition/MeaningMakingEngine.js'
|
|
187
|
+
import { EpisodicFutureSimulation } from './cognition/EpisodicFutureSimulation.js'
|
|
188
|
+
|
|
189
|
+
import { SchemaAssimilationAccommodation } from './cognition/SchemaAssimilationAccommodation.js'
|
|
190
|
+
import { ReciprocityClassifier } from './social/ReciprocityClassifier.js'
|
|
191
|
+
import { AffiliationThermostat } from './social/AffiliationThermostat.js'
|
|
192
|
+
import { AweSystem } from './cognition/AweSystem.js'
|
|
193
|
+
import { ElevationSystem } from './social/ElevationSystem.js'
|
|
194
|
+
import { NormativeExpectationField } from './cognition/NormativeExpectationField.js'
|
|
195
|
+
import { SourceMonitoring } from './social/SourceMonitoring.js'
|
|
196
|
+
import { ProspectiveMemorySystem } from './cognition/ProspectiveMemorySystem.js'
|
|
197
|
+
import { InteroceptiveAwarenessGain } from './embodiment/InteroceptiveAwarenessGain.js'
|
|
198
|
+
import { StressInoculationMemory } from './neurochemistry/StressInoculationMemory.js'
|
|
199
|
+
import { SocialReferenceFrame } from './social/SocialReferenceFrame.js'
|
|
200
|
+
|
|
201
|
+
// Round B — 21 of the 23 originally-requested mechanisms (2 skipped as real
|
|
202
|
+
// duplicates: ObligationLedger -> ReciprocityClassifier.getFeltObligation(),
|
|
203
|
+
// AttachmentActivatedScript -> Attachment.getStressStyle(), both already real).
|
|
204
|
+
import { PostConflictCooling } from './behavior/PostConflictCooling.js'
|
|
205
|
+
import { SuperegoMonitor } from './cognition/SuperegoMonitor.js'
|
|
206
|
+
import { ResidualAnnoyanceTrace } from './social/ResidualAnnoyanceTrace.js'
|
|
207
|
+
import { EffortWithholding } from './behavior/EffortWithholding.js'
|
|
208
|
+
import { PolitenessShutdown } from './behavior/PolitenessShutdown.js'
|
|
209
|
+
import { ContemptDetector } from './social/ContemptDetector.js'
|
|
210
|
+
import { DemandWithdrawLoop } from './social/DemandWithdrawLoop.js'
|
|
211
|
+
import { FaceThreatSensitivity } from './social/FaceThreatSensitivity.js'
|
|
212
|
+
import { AudienceDesign } from './behavior/AudienceDesign.js'
|
|
213
|
+
import { SelfPresentationManager } from './social/SelfPresentationManager.js'
|
|
214
|
+
import { EgoCalibrationSuite } from './social/EgoCalibrationSuite.js'
|
|
215
|
+
import { LoyaltyConflictResolver } from './social/LoyaltyConflictResolver.js'
|
|
216
|
+
import { RuminationVsReflectionSwitch } from './cognition/RuminationVsReflectionSwitch.js'
|
|
217
|
+
import { ReactanceEngine } from './cognition/ReactanceEngine.js'
|
|
218
|
+
import { PsychologicalDistanceScaler } from './cognition/PsychologicalDistanceScaler.js'
|
|
219
|
+
import { MoralLicensing } from './cognition/MoralLicensing.js'
|
|
220
|
+
import { SelfHandicapping } from './behavior/SelfHandicapping.js'
|
|
221
|
+
import { RelationalAfterglow } from './social/RelationalAfterglow.js'
|
|
222
|
+
|
|
223
|
+
// 5 indispensable human mechanisms, requested and triaged against the
|
|
224
|
+
// existing codebase first: humor/amusement, moral disgust (the missing
|
|
225
|
+
// leg of Haidt's CAD triad — contempt/anger already existed), embarrassment
|
|
226
|
+
// (distinct from ShameGuiltSplit), Terror Management mortality salience,
|
|
227
|
+
// and relief (distinct from ordinary positive valence).
|
|
228
|
+
import { AmusementEngine } from './cognition/AmusementEngine.js'
|
|
229
|
+
import { MoralDisgust } from './social/MoralDisgust.js'
|
|
230
|
+
import { EmbarrassmentEngine } from './social/EmbarrassmentEngine.js'
|
|
231
|
+
import { MortalitySalience } from './cognition/MortalitySalience.js'
|
|
232
|
+
import { ReliefEngine } from './cognition/ReliefEngine.js'
|
|
233
|
+
|
|
234
|
+
// 6 mechanisms found by auditing CALIBRATION.md's own existing citations for
|
|
235
|
+
// real, distinct phenomena those same papers describe that hadn't been
|
|
236
|
+
// built yet — including RAGE/FEAR/LUST, a gap the citation ledger itself
|
|
237
|
+
// had left explicitly disclosed ("four of which are modeled" out of 7).
|
|
238
|
+
import { PrestigeSystem } from './social/PrestigeSystem.js'
|
|
239
|
+
import { FramingEffect } from './economics/FramingEffect.js'
|
|
240
|
+
import { IdealSelfDiscrepancy } from './cognition/IdealSelfDiscrepancy.js'
|
|
241
|
+
import { ComparisonLevelAlternatives } from './social/ComparisonLevelAlternatives.js'
|
|
242
|
+
import { ReflectedGlory } from './social/ReflectedGlory.js'
|
|
243
|
+
|
|
244
|
+
// Dreams and the subconscious — 2 mechanisms explicitly requested, each
|
|
245
|
+
// checked against the codebase first (confirmed no prior real dream-
|
|
246
|
+
// content or nonconscious-processing mechanism existed anywhere in it).
|
|
247
|
+
import { DreamEngine } from './social/DreamEngine.js'
|
|
248
|
+
import { NightmareEngine } from './social/NightmareEngine.js'
|
|
249
|
+
import { OxytocinSystem } from './social/OxytocinSystem.js'
|
|
250
|
+
import { EndogenousOpioidSystem } from './social/EndogenousOpioidSystem.js'
|
|
251
|
+
import { SubconsciousEngine } from './cognition/SubconsciousEngine.js'
|
|
252
|
+
import { ConservationWithdrawal } from './cognition/ConservationWithdrawal.js'
|
|
253
|
+
|
|
112
254
|
function clamp01( v ) {
|
|
113
255
|
|
|
114
256
|
return Math.max( 0, Math.min( 1, v ) )
|
|
@@ -141,7 +283,7 @@ export class Totemheart {
|
|
|
141
283
|
|
|
142
284
|
static VERSION = VERSION
|
|
143
285
|
|
|
144
|
-
constructor( { personality, provider, language = 'es', embedProvider = null } = {} ) {
|
|
286
|
+
constructor( { personality, provider, language = 'es', embedProvider = null, colony = null, agentId = null } = {} ) {
|
|
145
287
|
|
|
146
288
|
this.language = language
|
|
147
289
|
this.provider = provider ?? null
|
|
@@ -158,6 +300,7 @@ export class Totemheart {
|
|
|
158
300
|
|
|
159
301
|
this.cognitiveDissonance = new CognitiveDissonance()
|
|
160
302
|
this.defenseMechanisms = new DefenseMechanisms()
|
|
303
|
+
this.selfDistancingSpeech = new SelfDistancingSpeech()
|
|
161
304
|
this.decisionFatigue = new DecisionFatigue()
|
|
162
305
|
this.amygdalaHijack = new AmygdalaHijack()
|
|
163
306
|
this.emotionalOntology = new EmotionalOntology()
|
|
@@ -237,6 +380,23 @@ export class Totemheart {
|
|
|
237
380
|
} )
|
|
238
381
|
this.hebbianPlasticity = new HebbianPlasticity()
|
|
239
382
|
this.remConsolidation = new RemConsolidation()
|
|
383
|
+
this.relationalMemoryCatalog = new RelationalMemoryCatalog()
|
|
384
|
+
this.yearningEngine = new YearningEngine()
|
|
385
|
+
this.childlikeMode = new ChildlikeMode()
|
|
386
|
+
this.frikiEngine = new FrikiEngine( { opennessToNew: this.personality.get( 'openness' ) } )
|
|
387
|
+
this.somaticActivationSystems = new Map() // userId -> real, per-relationship SomaticActivationSystem
|
|
388
|
+
this.globalMoodAbatement = new GlobalMoodAbatement()
|
|
389
|
+
this.ghostingDetector = new GhostingDetector()
|
|
390
|
+
this.tipOfTongue = new TipOfTongue()
|
|
391
|
+
this.grudgeSystem = new GrudgeSystem()
|
|
392
|
+
this.socialDiscomfort = new SocialDiscomfort()
|
|
393
|
+
this.empathyCompassion = new EmpathyCompassion()
|
|
394
|
+
this.flirtationEngine = new FlirtationEngine()
|
|
395
|
+
this.humanDiscourseShaper = new HumanDiscourseShaper()
|
|
396
|
+
this.blushSlipEngine = new BlushSlipEngine()
|
|
397
|
+
this.percentageOfAssets = new PercentageOfAssets()
|
|
398
|
+
this.affectAlignmentMonitor = new AffectAlignmentMonitor()
|
|
399
|
+
this._recentDominantFamilies = []
|
|
240
400
|
|
|
241
401
|
this.griefEngine = new GriefEngine()
|
|
242
402
|
this.shameGuiltSplit = new ShameGuiltSplit()
|
|
@@ -250,6 +410,25 @@ export class Totemheart {
|
|
|
250
410
|
this.sleepPressure = new SleepPressure()
|
|
251
411
|
this.anticipatoryAffect = new AnticipatoryAffect()
|
|
252
412
|
this.motivationalConflict = new MotivationalConflict()
|
|
413
|
+
this.desireEngine = new DesireEngine()
|
|
414
|
+
this.intuitionEngine = new IntuitionEngine()
|
|
415
|
+
this.traumaCascadeEngine = new TraumaCascadeEngine()
|
|
416
|
+
this.happinessEngine = new HappinessEngine()
|
|
417
|
+
this.chillsEngine = new ChillsEngine()
|
|
418
|
+
this.secretMaintenanceSystem = new SecretMaintenanceSystem()
|
|
419
|
+
this.sharedRelationalCulture = new SharedRelationalCulture()
|
|
420
|
+
this.lonelinessEngine = new LonelinessEngine()
|
|
421
|
+
this.anticipatedRegretEngine = new AnticipatedRegretEngine()
|
|
422
|
+
this.hopeDisappointmentSystem = new HopeDisappointmentSystem()
|
|
423
|
+
this.selfCompassionVsAttack = new SelfCompassionVsAttack()
|
|
424
|
+
this.empathicAccuracySystem = new EmpathicAccuracySystem()
|
|
425
|
+
this.consolationEfficacy = new ConsolationEfficacy()
|
|
426
|
+
this.sleepQualityCoupler = new SleepQualityCoupler()
|
|
427
|
+
this.conversationalRepair = new ConversationalRepair()
|
|
428
|
+
this.meaningfulSilence = new MeaningfulSilence()
|
|
429
|
+
this.temptationField = new TemptationField()
|
|
430
|
+
this.cravingTrace = new CravingTrace()
|
|
431
|
+
this.yieldController = new YieldController()
|
|
253
432
|
this.egoDepletionBudget = new EgoDepletionBudget()
|
|
254
433
|
this.valueHierarchy = new ValueHierarchy()
|
|
255
434
|
this.commitmentDevice = new CommitmentDevice()
|
|
@@ -258,6 +437,105 @@ export class Totemheart {
|
|
|
258
437
|
this.opponentProcess = new OpponentProcess()
|
|
259
438
|
this.interoceptivePredictionError = new InteroceptivePredictionError()
|
|
260
439
|
|
|
440
|
+
this.narrativeSelfEngine = new NarrativeSelfEngine()
|
|
441
|
+
this.legacyMemory = new LegacyMemory()
|
|
442
|
+
this.multiAgentSocialGraph = new MultiAgentSocialGraph()
|
|
443
|
+
this.culturalScriptLibrary = new CulturalScriptLibrary()
|
|
444
|
+
this.powerDynamicsEngine = new PowerDynamicsEngine()
|
|
445
|
+
this.betrayalTraumaTrace = new BetrayalTraumaTrace()
|
|
446
|
+
this.ontogenicDevelopment = new OntogenicDevelopment()
|
|
447
|
+
this.metaEmotionLayer = new MetaEmotionLayer()
|
|
448
|
+
this.emotionalForecasting = new EmotionalForecasting()
|
|
449
|
+
this.insightGenerator = new InsightGenerator()
|
|
450
|
+
this.energyBudget = new EnergyBudget()
|
|
451
|
+
this.regulationStrategySelector = new RegulationStrategySelector()
|
|
452
|
+
this.creativeModeSwitch = new CreativeModeSwitch()
|
|
453
|
+
this.somaticMarkerNetwork = new SomaticMarkerNetwork()
|
|
454
|
+
this.globalWorkspace = new GlobalWorkspace()
|
|
455
|
+
this.primaryDrives = new PrimaryDrives()
|
|
456
|
+
this.emotionalImmuneSystem = new EmotionalImmuneSystem()
|
|
457
|
+
|
|
458
|
+
this.dualProcessController = new DualProcessController()
|
|
459
|
+
this.predictiveProcessingCore = new PredictiveProcessingCore()
|
|
460
|
+
this.driftDiffusionModel = new DriftDiffusionModel()
|
|
461
|
+
this.signalDetectionTheory = new SignalDetectionTheory()
|
|
462
|
+
this.hickHymanLaw = new HickHymanLaw()
|
|
463
|
+
this.stevensPowerLaw = new StevensPowerLaw()
|
|
464
|
+
this.weberFechnerLaw = new WeberFechnerLaw()
|
|
465
|
+
this.selfDeterminationNeeds = new SelfDeterminationNeeds()
|
|
466
|
+
this.homeostaticFeelingGenerator = new HomeostaticFeelingGenerator()
|
|
467
|
+
this.workingMemoryBuffer = new WorkingMemoryBuffer()
|
|
468
|
+
this.habitVsGoalSystem = new HabitVsGoalSystem()
|
|
469
|
+
this.goalHierarchyManager = new GoalHierarchyManager()
|
|
470
|
+
this.boredomSystem = new BoredomSystem()
|
|
471
|
+
|
|
472
|
+
this.temporalDiscountingEngine = new TemporalDiscountingEngine()
|
|
473
|
+
this.inhibitoryControlPool = new InhibitoryControlPool()
|
|
474
|
+
this.ostracismDetector = new OstracismDetector()
|
|
475
|
+
this.metacognitiveConfidence = new MetacognitiveConfidence()
|
|
476
|
+
this.roleIdentitySalience = new RoleIdentitySalience()
|
|
477
|
+
this.meaningMakingEngine = new MeaningMakingEngine()
|
|
478
|
+
this.episodicFutureSimulation = new EpisodicFutureSimulation()
|
|
479
|
+
|
|
480
|
+
this.schemaAssimilationAccommodation = new SchemaAssimilationAccommodation()
|
|
481
|
+
this.reciprocityClassifier = new ReciprocityClassifier()
|
|
482
|
+
this.affiliationThermostat = new AffiliationThermostat()
|
|
483
|
+
this.aweSystem = new AweSystem()
|
|
484
|
+
this.elevationSystem = new ElevationSystem()
|
|
485
|
+
this.normativeExpectationField = new NormativeExpectationField()
|
|
486
|
+
this.sourceMonitoring = new SourceMonitoring()
|
|
487
|
+
this.prospectiveMemorySystem = new ProspectiveMemorySystem()
|
|
488
|
+
this.interoceptiveAwarenessGain = new InteroceptiveAwarenessGain()
|
|
489
|
+
this.stressInoculationMemory = new StressInoculationMemory()
|
|
490
|
+
this.socialReferenceFrame = new SocialReferenceFrame()
|
|
491
|
+
|
|
492
|
+
this.postConflictCooling = new PostConflictCooling()
|
|
493
|
+
this.superegoMonitor = new SuperegoMonitor()
|
|
494
|
+
this.residualAnnoyanceTrace = new ResidualAnnoyanceTrace()
|
|
495
|
+
this.effortWithholding = new EffortWithholding()
|
|
496
|
+
this.politenessShutdown = new PolitenessShutdown()
|
|
497
|
+
this.contemptDetector = new ContemptDetector()
|
|
498
|
+
this.demandWithdrawLoop = new DemandWithdrawLoop()
|
|
499
|
+
this.faceThreatSensitivity = new FaceThreatSensitivity()
|
|
500
|
+
this.audienceDesign = new AudienceDesign()
|
|
501
|
+
this.selfPresentationManager = new SelfPresentationManager()
|
|
502
|
+
this.egoCalibrationSuite = new EgoCalibrationSuite()
|
|
503
|
+
this.loyaltyConflictResolver = new LoyaltyConflictResolver()
|
|
504
|
+
this.ruminationVsReflectionSwitch = new RuminationVsReflectionSwitch()
|
|
505
|
+
this.reactanceEngine = new ReactanceEngine()
|
|
506
|
+
this.psychologicalDistanceScaler = new PsychologicalDistanceScaler()
|
|
507
|
+
this.moralLicensing = new MoralLicensing()
|
|
508
|
+
this.selfHandicapping = new SelfHandicapping()
|
|
509
|
+
this.relationalAfterglow = new RelationalAfterglow()
|
|
510
|
+
|
|
511
|
+
this.amusementEngine = new AmusementEngine()
|
|
512
|
+
this.moralDisgust = new MoralDisgust()
|
|
513
|
+
this.embarrassmentEngine = new EmbarrassmentEngine()
|
|
514
|
+
this.mortalitySalience = new MortalitySalience()
|
|
515
|
+
this.reliefEngine = new ReliefEngine()
|
|
516
|
+
|
|
517
|
+
this.prestigeSystem = new PrestigeSystem()
|
|
518
|
+
this.framingEffect = new FramingEffect()
|
|
519
|
+
this.idealSelfDiscrepancy = new IdealSelfDiscrepancy( { sensitivity: 0.4 + 0.3 * this.personality.get( 'openness' ) } )
|
|
520
|
+
this.comparisonLevelAlternatives = new ComparisonLevelAlternatives()
|
|
521
|
+
this.reflectedGlory = new ReflectedGlory()
|
|
522
|
+
|
|
523
|
+
this.dreamEngine = new DreamEngine()
|
|
524
|
+
this.nightmareEngine = new NightmareEngine()
|
|
525
|
+
this.oxytocinSystem = new OxytocinSystem()
|
|
526
|
+
this.endogenousOpioidSystem = new EndogenousOpioidSystem()
|
|
527
|
+
this.subconsciousEngine = new SubconsciousEngine()
|
|
528
|
+
this.conservationWithdrawal = new ConservationWithdrawal()
|
|
529
|
+
|
|
530
|
+
this.colony = colony // optional real ColonyDynamics — shared ACROSS instances, this one only registers/reads into it
|
|
531
|
+
// Real, stable per-INSTANCE identity for the colony — deliberately NOT
|
|
532
|
+
// userId (the human this instance is talking to): a colony is about
|
|
533
|
+
// multiple real AI agents, and two agents talking to the SAME human
|
|
534
|
+
// must still register as two distinct real colony members, not
|
|
535
|
+
// overwrite each other under one shared key.
|
|
536
|
+
this.agentId = agentId ?? `agent_${Date.now().toString( 36 )}_${Math.random().toString( 36 ).slice( 2, 8 )}`
|
|
537
|
+
this._significantEventCount = 0
|
|
538
|
+
|
|
261
539
|
this.turnCounter = 0
|
|
262
540
|
this.allostasisStuckTicks = 0
|
|
263
541
|
this._clockHandle = null
|
|
@@ -358,6 +636,14 @@ export class Totemheart {
|
|
|
358
636
|
|
|
359
637
|
if ( modality !== 'text' ) return { text: 'Unsupported input modality', modality }
|
|
360
638
|
|
|
639
|
+
// Real cortisol level as it stood BEFORE this turn touches it — ReliefEngine's
|
|
640
|
+
// own real trigger condition needs to know how much threat existed going IN,
|
|
641
|
+
// not the level this turn's own resolution already brought back down.
|
|
642
|
+
this._preTurnCortisol = this.cortisolEngine.getLevel()
|
|
643
|
+
// Same real "before this turn touches it" discipline for arousal — WeberFechnerLaw's
|
|
644
|
+
// own real baseline-ratio judgment needs the level going IN, not after this turn's own spikes.
|
|
645
|
+
this._preTurnArousal = this.emotionSpace.vector.arousal
|
|
646
|
+
|
|
361
647
|
// REM consolidation — real wall-clock idle-time trigger (not a turn count): if
|
|
362
648
|
// enough real time passed since the last turn, run a background-style sweep
|
|
363
649
|
// BEFORE this turn is processed. The AI doesn't wake up exactly where it left
|
|
@@ -375,6 +661,7 @@ export class Totemheart {
|
|
|
375
661
|
this._lastRemReport = null
|
|
376
662
|
if ( this.remConsolidation.shouldTrigger() ) {
|
|
377
663
|
|
|
664
|
+
const sweepNow = Date.now()
|
|
378
665
|
this._lastRemReport = this.remConsolidation.sweep( {
|
|
379
666
|
episodicMemory : this.episodicMemory,
|
|
380
667
|
hebbianPlasticity : this.hebbianPlasticity,
|
|
@@ -386,8 +673,117 @@ export class Totemheart {
|
|
|
386
673
|
decayEngine : this.decayEngine,
|
|
387
674
|
personality : this.personality,
|
|
388
675
|
circadianRhythm : this.circadianRhythm,
|
|
389
|
-
} )
|
|
676
|
+
}, sweepNow )
|
|
677
|
+
|
|
678
|
+
// Real rest-replenishes-energy link — a genuine gap this pipeline had:
|
|
679
|
+
// Homeostasis.needs.stamina/curiosity previously had NO general
|
|
680
|
+
// refill path at all (only a single life-event-gated satisfy() call),
|
|
681
|
+
// so any sufficiently long real-time simulation without that exact
|
|
682
|
+
// event permanently maxed allostaticLoad regardless of anything else
|
|
683
|
+
// happening — caught by examples/love-triangle-mock.js's real 90-day
|
|
684
|
+
// projection. Borbély 1982's own two-process model (already cited
|
|
685
|
+
// above for SleepPressure itself) makes the direction obvious: sleep
|
|
686
|
+
// pressure clearing IS what "feeling rested" means, so the real
|
|
687
|
+
// amount of pressure THIS sweep actually dissipated is the honest,
|
|
688
|
+
// already-computed magnitude to recover stamina from — no separate
|
|
689
|
+
// invented constant. The curiosity share is own design (rest
|
|
690
|
+
// plausibly also restores engagement, weaker citation than stamina).
|
|
691
|
+
const sleepPressureBeforeSweep = this.sleepPressure.getLevel()
|
|
390
692
|
this.sleepPressure.dissipate( elapsedSinceLastTurn )
|
|
693
|
+
const staminaRecovered = sleepPressureBeforeSweep - this.sleepPressure.getLevel()
|
|
694
|
+
this.homeostasis.satisfy( 'stamina', staminaRecovered )
|
|
695
|
+
this.homeostasis.satisfy( 'curiosity', staminaRecovered * 0.3 )
|
|
696
|
+
|
|
697
|
+
// Real relational-memory cataloging — REM doesn't just cool, it hands
|
|
698
|
+
// off the episodes it just touched to a real, structured, per-person
|
|
699
|
+
// index (Conway & Pleydell-Pearce 2000, see RelationalMemoryCatalog.js).
|
|
700
|
+
if ( this._lastActiveUserId ) {
|
|
701
|
+
|
|
702
|
+
const touched = this.episodicMemory.memories.filter( m => m.userId === this._lastActiveUserId && m.remTaggedAt === sweepNow )
|
|
703
|
+
if ( touched.length ) this.relationalMemoryCatalog.ingestFromRem( this._lastActiveUserId, this._lastRemReport, touched )
|
|
704
|
+
|
|
705
|
+
// Real dream synthesis — only a genuinely long real elapsed gap
|
|
706
|
+
// (a real "deep sleep", not a light REM cooling sweep) qualifies.
|
|
707
|
+
// Synthesized from real, already-stored top-weighted material for
|
|
708
|
+
// this specific person, nothing invented (Domhoff 2003; Hobson &
|
|
709
|
+
// McCarley 1977, see DreamEngine.js).
|
|
710
|
+
if ( this.dreamEngine.qualifiesForDream( elapsedSinceLastTurn ) ) {
|
|
711
|
+
|
|
712
|
+
const topDetail = this.relationalMemoryCatalog.getTopDetails( this._lastActiveUserId, { k: 1 } )[ 0 ] ?? null
|
|
713
|
+
const topTheme = this.relationalMemoryCatalog.getRecurringThemes( this._lastActiveUserId, { k: 1 } )[ 0 ] ?? null
|
|
714
|
+
const dominantFamily = this._recentDominantFamilies[ this._recentDominantFamilies.length - 1 ] ?? null
|
|
715
|
+
const affectLedger = this.relationalMemoryCatalog.getAffectLedger( this._lastActiveUserId )
|
|
716
|
+
|
|
717
|
+
// Real nightmare evaluation — Levin & Nielsen 2007, see
|
|
718
|
+
// NightmareEngine.js — a real combining layer over 4 already-
|
|
719
|
+
// tracked signals (amygdala/PFC ratio via InhibitoryControlPool,
|
|
720
|
+
// unresolved fear via ClassicalConditioning, physiological panic
|
|
721
|
+
// via cortisol/arousal, REM-rebound pressure via SleepPressure),
|
|
722
|
+
// not 4 new modules.
|
|
723
|
+
this._lastNightmareEval = this.nightmareEngine.evaluate( {
|
|
724
|
+
amygdalaThreat : ( this.cortisolEngine.getLevel() + this.emotionSpace.vector.arousal ) / 2,
|
|
725
|
+
pfcControl : this.inhibitoryControlPool.level / this.inhibitoryControlPool.capacity,
|
|
726
|
+
unresolvedFear : Math.max( this.classicalConditioning.getStrongestFear(), this.traumaCascadeEngine.getTraumaTrace( this._lastActiveUserId ) ),
|
|
727
|
+
remReboundPressure : sleepPressureBeforeSweep,
|
|
728
|
+
cortisol : this.cortisolEngine.getLevel(),
|
|
729
|
+
arousal : this.emotionSpace.vector.arousal,
|
|
730
|
+
} )
|
|
731
|
+
|
|
732
|
+
this.dreamEngine.generateDream( this._lastActiveUserId, { topDetail, topTheme, dominantFamily, affectLedger, nightmareIntensity: this._lastNightmareEval.isNightmare ? this._lastNightmareEval.probability : 0 }, sweepNow )
|
|
733
|
+
|
|
734
|
+
// Real composite "current concerns" dream — Domhoff 2003, see
|
|
735
|
+
// DreamEngine.js. The per-person dream above is kept for real
|
|
736
|
+
// backward-compatible per-relationship introspection; this is
|
|
737
|
+
// the honest, additional real signal for "one night, everything
|
|
738
|
+
// lived, blended" — every real currently-known person's own
|
|
739
|
+
// affect ledger, EVERY real active grief thread (not just this
|
|
740
|
+
// person's bereavement), and this turn's own real dominant
|
|
741
|
+
// family, each as one real weighted source, nothing invented.
|
|
742
|
+
const compositeSources = []
|
|
743
|
+
for ( const [ personId ] of this.relationalMemoryCatalog.people ) {
|
|
744
|
+
|
|
745
|
+
const ledger = this.relationalMemoryCatalog.getAffectLedger( personId )
|
|
746
|
+
const weight = clamp01( ( ledger.cumulativeWarmth + ledger.cumulativeHurt ) / 4 )
|
|
747
|
+
if ( weight <= 0 ) continue
|
|
748
|
+
compositeSources.push( { label: personId, weight, valence: clamp01( ( ledger.cumulativeWarmth - ledger.cumulativeHurt + 1 ) / 2 ) * 2 - 1 } )
|
|
749
|
+
|
|
750
|
+
}
|
|
751
|
+
for ( const [ griefKey ] of this.griefEngine.griefs ) {
|
|
752
|
+
|
|
753
|
+
const griefWeight = this.griefEngine.getIntensity( griefKey )
|
|
754
|
+
if ( griefWeight > 0.05 ) compositeSources.push( { label: `grief:${griefKey}`, weight: clamp01( griefWeight ), valence: -clamp01( griefWeight ) } )
|
|
755
|
+
|
|
756
|
+
}
|
|
757
|
+
if ( dominantFamily ) compositeSources.push( { label: `mood:${dominantFamily}`, weight: 0.2, valence: this.emotionSpace.vector.valence } )
|
|
758
|
+
// Real trauma fragments — van der Kolk & Fisler 1995's own
|
|
759
|
+
// finding that overwhelming events surface as isolated
|
|
760
|
+
// sensory fragments rather than tidy narrative, not blended
|
|
761
|
+
// with the rest: each stored fragment enters as its own
|
|
762
|
+
// real, separately-weighted, sharply negative source.
|
|
763
|
+
for ( const fragment of this.traumaCascadeEngine.getFragments( this._lastActiveUserId ) ) compositeSources.push( { label: `fragment:${fragment.label}`, weight: fragment.weight, valence: -fragment.weight } )
|
|
764
|
+
this.dreamEngine.generateCompositeDream( compositeSources, sweepNow )
|
|
765
|
+
|
|
766
|
+
if ( this._lastNightmareEval.isNightmare ) {
|
|
767
|
+
|
|
768
|
+
// Real waking-scared signature — a real, short-lived fear spike,
|
|
769
|
+
// and real, genuinely LESS restorative sleep (nightmares abort
|
|
770
|
+
// clean REM affect-regulation, own tuning of the dampening
|
|
771
|
+
// fraction, not measured from a specific sleep-study dataset).
|
|
772
|
+
this.emotionSpace.applySpike( { valence: -this._lastNightmareEval.probability * 0.3, arousal: this._lastNightmareEval.probability * 0.4, weight: 0.4 } )
|
|
773
|
+
this.homeostasis.satisfy( 'stamina', -staminaRecovered * this._lastNightmareEval.probability * 0.5 )
|
|
774
|
+
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// Real next-day self-control cost from a genuinely fragmented
|
|
778
|
+
// night — Barber & Munz 2011, see SleepQualityCoupler.js. Applied
|
|
779
|
+
// once, right after the real REM sweep that just happened, to
|
|
780
|
+
// InhibitoryControlPool's own current level (not a new resource).
|
|
781
|
+
const sleepFragmentationThisSweep = this.sleepQualityCoupler.getFragmentation( { rumination: clamp01( this.cortisolEngine.getLevel() ), nightmareIntensity: this._lastNightmareEval.isNightmare ? this._lastNightmareEval.probability : 0, stress: this.cognitiveDissonance.getStress() } )
|
|
782
|
+
this.inhibitoryControlPool.level = Math.min( this.inhibitoryControlPool.capacity, this.inhibitoryControlPool.level * this.sleepQualityCoupler.getNextDayControlMultiplier( sleepFragmentationThisSweep ) )
|
|
783
|
+
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
}
|
|
391
787
|
|
|
392
788
|
}
|
|
393
789
|
// sweep() already records its own end time; a non-triggering (normal-cadence)
|
|
@@ -479,7 +875,19 @@ export class Totemheart {
|
|
|
479
875
|
// Kindling uses LAST turn's ontology concepts (this turn's aren't known yet at
|
|
480
876
|
// this point in the pipeline) — repeated exposure to the same stimulus TYPE
|
|
481
877
|
// (threat/betrayal/criticism...) genuinely lowers this turn's threshold further.
|
|
482
|
-
|
|
878
|
+
// Ontogenic development — real, one-turn-lagged (this turn's stage isn't
|
|
879
|
+
// computed until the life-event/significant-event tally runs further
|
|
880
|
+
// down, the same real "last turn's reading" pattern _lastNovelty already
|
|
881
|
+
// uses) elevated-Neuroticism reading during a real "adolescence" stage
|
|
882
|
+
// genuinely lowers the hijack threshold — see OntogenicDevelopment.js.
|
|
883
|
+
const ontogenicThresholdMultiplier = 1 - clamp01( this._ontogenicNeuroticismBoost ?? 0 ) * 0.3
|
|
884
|
+
// Real oxytocin felt-safety baseline — Carter 1998, see
|
|
885
|
+
// OxytocinSystem.js. A real, currently-active secure bond genuinely
|
|
886
|
+
// raises the threshold (harder to fully hijack while someone secure
|
|
887
|
+
// is present); its real absence (e.g. post-breakup) leaves this at
|
|
888
|
+
// its own floor-driven baseline, own tuning of the 0.3 ceiling.
|
|
889
|
+
const oxytocinCalmMultiplier = 1 + this.oxytocinSystem.getGlobalCalmingEffect() * 0.3
|
|
890
|
+
const hijackThreshold = 0.95 * this.cortisolEngine.getThresholdMultiplier() * this.sensitization.getThresholdMultiplier() * narrowingMultiplier * ontogenicThresholdMultiplier * oxytocinCalmMultiplier
|
|
483
891
|
const hijack = this.amygdalaHijack.check( this.emotionSpace, hijackThreshold, { concepts: this._lastOntologyConcepts } )
|
|
484
892
|
if ( hijack.tier === 'full' ) {
|
|
485
893
|
|
|
@@ -584,6 +992,19 @@ export class Totemheart {
|
|
|
584
992
|
// "sparks" it back to real strength instead of it staying silently decayed
|
|
585
993
|
// forever. Small, bounded spike — this is a resurfacing nudge, not a full
|
|
586
994
|
// re-experience of the original moment.
|
|
995
|
+
// Legacy memory — real, explicitly-inherited material from a PRIOR
|
|
996
|
+
// generation/instance (see LegacyMemory.js), activated by the same real
|
|
997
|
+
// token-overlap similarity, distinct from this instance's own
|
|
998
|
+
// EpisodicMemory reactivation above (a different real store, a
|
|
999
|
+
// different real source of "why does this feel familiar").
|
|
1000
|
+
const legacyActivation = this.legacyMemory.getBestActivation( input, { conscientiousness: this.personality.get( 'conscientiousness' ), openness: this.personality.get( 'openness' ) } )
|
|
1001
|
+
if ( legacyActivation && legacyActivation.activation > 0.15 ) {
|
|
1002
|
+
|
|
1003
|
+
this.emotionSpace.applySpike( { valence: legacyActivation.entry.weight * 0.15 * legacyActivation.activation, weight: 0.3 } )
|
|
1004
|
+
this.explainability.logDecision( 'legacy_activation', `inherited cue "${legacyActivation.entry.cue}" activated at ${legacyActivation.activation.toFixed( 2 )}` )
|
|
1005
|
+
|
|
1006
|
+
}
|
|
1007
|
+
|
|
587
1008
|
const reactivation = this.episodicMemory.getBestReactivation( tokens )
|
|
588
1009
|
if ( reactivation && reactivation.score > 0.3 ) {
|
|
589
1010
|
|
|
@@ -712,8 +1133,42 @@ export class Totemheart {
|
|
|
712
1133
|
// expectation directly, distinct from the reward-driven RPE update below.
|
|
713
1134
|
this.dopaminergicEngine.updateExpectationFromBelief( userId, lifeEvent.valence, 0.2 )
|
|
714
1135
|
|
|
1136
|
+
// Narrative self — a real life event is exactly the kind of significant
|
|
1137
|
+
// moment McAdams' narrative-identity framing treats as chapter-shaping
|
|
1138
|
+
// material (see NarrativeSelfEngine.js), distinct from ordinary turns.
|
|
1139
|
+
const narrativeUpdate = this.narrativeSelfEngine.addEvent( lifeEvent.valence, {
|
|
1140
|
+
openness: this.personality.get( 'openness' ), neuroticism: this.personality.get( 'neuroticism' ), conscientiousness: this.personality.get( 'conscientiousness' ),
|
|
1141
|
+
} )
|
|
1142
|
+
if ( narrativeUpdate.crisis ) this.explainability.logDecision( 'narrative_crisis', `narrative coherence dropped to ${narrativeUpdate.coherence.toFixed( 2 )} — chapter ${narrativeUpdate.chapterIndex}` )
|
|
1143
|
+
|
|
1144
|
+
// A real life event also counts toward OntogenicDevelopment's own
|
|
1145
|
+
// significant-event tally — the real, second real driver of stage
|
|
1146
|
+
// progression alongside plain turn count (see OntogenicDevelopment.js).
|
|
1147
|
+
this._significantEventCount += 1
|
|
1148
|
+
|
|
715
1149
|
}
|
|
716
1150
|
|
|
1151
|
+
// Cultural scripts — a real interpretive frame this turn's input matches
|
|
1152
|
+
// (honor, shame, reciprocity, collectivism), biasing the response beyond
|
|
1153
|
+
// the raw appraisal alone (see CulturalScriptLibrary.js).
|
|
1154
|
+
const dominantScript = this.culturalScriptLibrary.getDominantScript( input )
|
|
1155
|
+
if ( dominantScript ) {
|
|
1156
|
+
|
|
1157
|
+
const responseBias = this.culturalScriptLibrary.getResponseBias( dominantScript.script, input, this.personality.get( 'agreeableness' ) )
|
|
1158
|
+
if ( responseBias > 0.05 ) this.emotionSpace.applySpike( { dominance: dominantScript.script === 'honor' ? -responseBias * 0.3 : 0, arousal: responseBias * 0.15, weight: 0.3 } )
|
|
1159
|
+
this.explainability.logDecision( 'cultural_script', `"${dominantScript.script}" activated at ${dominantScript.activation.toFixed( 2 )}, bias=${responseBias.toFixed( 2 )}` )
|
|
1160
|
+
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// Ontogenic development — a real, deterministic function of accumulated
|
|
1164
|
+
// turns + significant events, not a clock. Adolescence's real elevated
|
|
1165
|
+
// Neuroticism reading genuinely lowers the amygdala-hijack threshold
|
|
1166
|
+
// computed further below (own tuning of the coupling itself).
|
|
1167
|
+
const ontogenicStage = this.ontogenicDevelopment.getStage( this.turnCounter, this._significantEventCount )
|
|
1168
|
+
const effectiveNeuroticism = this.ontogenicDevelopment.getEffectiveTrait( this.personality.get( 'neuroticism' ), 'neuroticism', ontogenicStage )
|
|
1169
|
+
this._ontogenicStage = ontogenicStage
|
|
1170
|
+
this._ontogenicNeuroticismBoost = effectiveNeuroticism - this.personality.get( 'neuroticism' )
|
|
1171
|
+
|
|
717
1172
|
// Regulatory capacity — purely internal analog of HRV's LF/HF read: a real DFT
|
|
718
1173
|
// over the AI's own rolling arousal history. Higher "regulated" reading (more
|
|
719
1174
|
// high-frequency/flexible activation, less locked into a slow low-frequency
|
|
@@ -739,7 +1194,16 @@ export class Totemheart {
|
|
|
739
1194
|
// Novelty (KL divergence vs. this session's historical outcome distribution) —
|
|
740
1195
|
// amplifies the dopaminergic arousal response independent of valence sign.
|
|
741
1196
|
const novelty = this.noveltyDetector.observe( this.emotionSpace.getDominantEmotion() )
|
|
1197
|
+
this.primaryDrives.activate( 'SEEKING', novelty * 0.4 ) // real novelty directly fuels the real SEEKING drive (Panksepp 1998, see PrimaryDrives.js)
|
|
742
1198
|
this._lastNovelty = novelty // read by NEXT turn's Kalman noise + LoadScheduler budget (this turn's isn't known until this line runs)
|
|
1199
|
+
// Real chronic-understimulation accumulator — the opposite pole from
|
|
1200
|
+
// overload, rises when novelty stays low turn after turn (see
|
|
1201
|
+
// BoredomSystem.js).
|
|
1202
|
+
this.boredomSystem.update( novelty )
|
|
1203
|
+
// Real capacity-limited active-item register — each turn's dominant
|
|
1204
|
+
// ontology concept (or the turn itself if none matched) occupies a real
|
|
1205
|
+
// working-memory slot until it's displaced by newer items.
|
|
1206
|
+
this.workingMemoryBuffer.hold( this._lastOntologyConcepts[ 0 ] ?? `turn:${userId}` )
|
|
743
1207
|
|
|
744
1208
|
// Anchoring bias — pulls perceived desirability toward the session's first strong signal.
|
|
745
1209
|
this.anchoringBias.registerIfFirst( appraisal.desirability ?? 0 )
|
|
@@ -761,6 +1225,103 @@ export class Totemheart {
|
|
|
761
1225
|
// left silent; see CALIBRATION.md.
|
|
762
1226
|
if ( lifeEvent ) desirability = Math.max( -1, Math.min( 1, desirability + lifeEvent.valence * ( lifeEvent.impact / 100 ) * 0.6 ) )
|
|
763
1227
|
|
|
1228
|
+
// Real oxytocin "rose-tinted glasses" idealization suppression — Carter
|
|
1229
|
+
// 1998, see OxytocinSystem.js. Uses the real level accrued INTO this
|
|
1230
|
+
// turn (a bond doesn't retroactively excuse what's being said in the
|
|
1231
|
+
// same breath) to soften how negative a bonded partner's own turn reads.
|
|
1232
|
+
if ( desirability < 0 ) desirability *= ( 1 - this.oxytocinSystem.getIdealizationSuppression( userId ) * 0.4 )
|
|
1233
|
+
|
|
1234
|
+
// Real, narrow, own-engineered strict-precision-mode detector —
|
|
1235
|
+
// hoisted here (was previously only computed much later, for
|
|
1236
|
+
// BlushSlipEngine alone) so IntuitionEngine's own real gate can
|
|
1237
|
+
// also defer to it: a genuinely factual/numeric turn keeps social
|
|
1238
|
+
// intuition almost entirely off, per the real priority ordering.
|
|
1239
|
+
const precisionMode = /\d/.test( input ) && /[+\-*/=]|cu[aá]nto es|calcula|resuelve/i.test( input )
|
|
1240
|
+
|
|
1241
|
+
// Real Capa 2 — IntuitionEngine, the user's own "TRAD-E" architecture
|
|
1242
|
+
// request: a fast typed hunch that PROPOSES and re-prioritizes,
|
|
1243
|
+
// never dictates. Real gate: only activates on genuine stakes
|
|
1244
|
+
// (|desirability|), ambiguity (reuses Intuition.js's own real
|
|
1245
|
+
// k-NN+entropy hunch above), or social salience (relation.affinity)
|
|
1246
|
+
// — an ordinary factual/neutral turn, or precisionMode, stays off.
|
|
1247
|
+
// Priority ordering (spec section 4): explicit evidence outranks
|
|
1248
|
+
// intuition — handled inside IntuitionEngine.assess() itself via
|
|
1249
|
+
// the real Contradiction term against this turn's own desirability.
|
|
1250
|
+
// Ontology unification: this turn's own already-classified real
|
|
1251
|
+
// concepts are passed in directly rather than re-detected.
|
|
1252
|
+
// Real prior-turn hunch, captured BEFORE this turn's own fresh read
|
|
1253
|
+
// overwrites it — the real post-digest confirmation/refutation
|
|
1254
|
+
// later this same turn needs to judge what was believed BEFORE
|
|
1255
|
+
// this turn's own new content, not this turn's own brand-new hunch.
|
|
1256
|
+
const priorHunchBeforeThisTurn = this.intuitionEngine.lastHypothesis.get( userId ) ?? null
|
|
1257
|
+
// Real hypervigilance coupling — a genuinely already-consolidated
|
|
1258
|
+
// trauma trace for this user (from a real PRIOR extreme event, not
|
|
1259
|
+
// this turn's own) lowers the effective bar for intuition to
|
|
1260
|
+
// activate, Ozer et al.'s own well-cited hypervigilance-after-trauma
|
|
1261
|
+
// finding, without inventing a new always-on danger detector.
|
|
1262
|
+
//
|
|
1263
|
+
// Real bug found and fixed: a flat `trace * 0.3` multiply fades to
|
|
1264
|
+
// an effectively negligible boost almost as fast as the trace
|
|
1265
|
+
// itself does, which defeats its own purpose — hypervigilance is
|
|
1266
|
+
// supposed to stay genuinely engaged as long as a real trace is
|
|
1267
|
+
// still present, not shrink in lockstep with it. Real threshold
|
|
1268
|
+
// gate instead: exactly 0 while the trace is at/under a genuinely
|
|
1269
|
+
// negligible epsilon (a never-traumatized or fully-recovered user
|
|
1270
|
+
// must never read as hypervigilant), then a real linear ramp up to
|
|
1271
|
+
// the full boost over a small real band above that — hypervigilance
|
|
1272
|
+
// stays "on" while ANY real trace remains, not proportional to how
|
|
1273
|
+
// much.
|
|
1274
|
+
// Own tuning, calibrated against this engine's own REAL observed
|
|
1275
|
+
// trace magnitudes (typically ~0.001-0.03 for a single consolidated
|
|
1276
|
+
// event, verified directly against examples/trauma-happiness-intuition-5-tests.js's
|
|
1277
|
+
// own printed output) rather than picked in the abstract — a wider
|
|
1278
|
+
// epsilon/ramp tuned for a hypothetical 0..1-scale trace would
|
|
1279
|
+
// never actually cross IntuitionEngine's own real ambiguityThreshold
|
|
1280
|
+
// (0.15) at the trace levels this engine genuinely produces.
|
|
1281
|
+
const TRAUMA_HYPERVIGILANCE_EPSILON = 0.005
|
|
1282
|
+
const TRAUMA_HYPERVIGILANCE_RAMP = 0.01
|
|
1283
|
+
const traumaTraceNow = this.traumaCascadeEngine.getTraumaTrace( userId )
|
|
1284
|
+
const hypervigilance = traumaTraceNow <= TRAUMA_HYPERVIGILANCE_EPSILON
|
|
1285
|
+
? 0
|
|
1286
|
+
: clamp01( ( traumaTraceNow - TRAUMA_HYPERVIGILANCE_EPSILON ) / TRAUMA_HYPERVIGILANCE_RAMP ) * 0.3
|
|
1287
|
+
const intuitionGateOpen = this.intuitionEngine.gate( { stakes: Math.abs( desirability ), ambiguity: ( hunch.entropy ?? 0 ) + hypervigilance, socialSalience: relation.affinity, precisionMode } )
|
|
1288
|
+
const intuitionRead = intuitionGateOpen ? this.intuitionEngine.assess( { text: input, entropy: hunch.entropy ?? 0, desirability, userId, ontologyConcepts: ontologyMatches.map( m => m.concept ), precisionMode, hypervigilance } ) : null
|
|
1289
|
+
if ( intuitionRead ) {
|
|
1290
|
+
|
|
1291
|
+
this.intuitionEngine.lastHypothesis.set( userId, intuitionRead )
|
|
1292
|
+
this.intuitionEngine.registerSuspicion( userId, intuitionRead.bias.trustSuspicion )
|
|
1293
|
+
// A real, small, bounded trust cost from the suspicion itself —
|
|
1294
|
+
// deliberately far smaller than what an actual confirmed
|
|
1295
|
+
// betrayal/dissonance costs (see Attachment.update()'s own real
|
|
1296
|
+
// Bayesian trustBeta jump), since a hunch is real SUSPICION,
|
|
1297
|
+
// not a verdict.
|
|
1298
|
+
if ( intuitionRead.bias.trustSuspicion > 0 ) relation.trust = clamp01( relation.trust - intuitionRead.bias.trustSuspicion * 0.1 )
|
|
1299
|
+
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// Real Stevens' Power Law — psychophysical compression of the raw
|
|
1303
|
+
// ontology-driven arousal boost, tracked per real stimulus "kind"
|
|
1304
|
+
// (the dominant matched concept, or 'general' with none) — repeated
|
|
1305
|
+
// exposure to the SAME kind of intense stimulus genuinely habituates
|
|
1306
|
+
// it (see StevensPowerLaw.js), distinct from AmusementEngine's own
|
|
1307
|
+
// narrow humor-bit habituation and HedonicAdaptation's own separate
|
|
1308
|
+
// hedonic-value curve.
|
|
1309
|
+
const stimulusKind = ontologyMatches[ 0 ]?.concept ?? 'general'
|
|
1310
|
+
const rawArousalBoost = appraisal.ontologyArousalBoost ?? 0
|
|
1311
|
+
const perceivedArousalBoost = this.stevensPowerLaw.perceivedIntensity( stimulusKind, rawArousalBoost )
|
|
1312
|
+
if ( rawArousalBoost > 0.3 ) this.stevensPowerLaw.habituate( stimulusKind )
|
|
1313
|
+
else this.stevensPowerLaw.decay( stimulusKind )
|
|
1314
|
+
|
|
1315
|
+
// Real Weber-Fechner Law — this turn's own desirability magnitude
|
|
1316
|
+
// judged as a real perceptual RATIO against the arousal baseline
|
|
1317
|
+
// BEFORE this turn touched it (`_preTurnArousal`, captured at the
|
|
1318
|
+
// very top of processInput) — the same fixed shock genuinely
|
|
1319
|
+
// registers as smaller once already highly aroused (see
|
|
1320
|
+
// WeberFechnerLaw.js).
|
|
1321
|
+
const weberFechnerPerceivedChange = this.weberFechnerLaw.getPerceivedChange( Math.abs( desirability ), this._preTurnArousal )
|
|
1322
|
+
// Real, bounded multiplier so a genuinely tiny/negative log-ratio never zeroes out arousal entirely, own tuning of both bounds.
|
|
1323
|
+
const weberFechnerMultiplier = Math.max( 0.3, Math.min( 1.7, 1 + weberFechnerPerceivedChange * 0.25 ) )
|
|
1324
|
+
|
|
764
1325
|
// Dopaminergic RPE — surprise relative to expectation, not raw reward, tracked
|
|
765
1326
|
// per-user (context=userId) so this relationship's own expectation history is
|
|
766
1327
|
// what this turn's reward gets judged against, with a real TD(λ) eligibility
|
|
@@ -768,14 +1329,54 @@ export class Totemheart {
|
|
|
768
1329
|
// Novelty adds extra arousal on top of the RPE-driven amount, since novelty
|
|
769
1330
|
// and reward-surprise are related but not identical signals.
|
|
770
1331
|
const rpe = this.dopaminergicEngine.computeRPE( desirability, userId, this.homeostasis.allostaticLoad )
|
|
1332
|
+
|
|
1333
|
+
// Real subjective WELL-BEING accumulation — Rutledge et al. 2014,
|
|
1334
|
+
// see HappinessEngine.js. Reuses this turn's own already-computed
|
|
1335
|
+
// real desirability (CR, "certain reward" received), the
|
|
1336
|
+
// dopaminergic engine's own real expected value (EV, anticipatory),
|
|
1337
|
+
// and this same turn's rpe (RPE) — no new inputs invented.
|
|
1338
|
+
const happinessLevel = this.happinessEngine.update( userId, { CR: Math.max( 0, desirability ), EV: this.dopaminergicEngine.getExpectedValue( userId ), RPE: rpe } )
|
|
1339
|
+
this.happinessEngine.updateReceptorOccupancy( userId, Math.max( 0, rpe ) )
|
|
1340
|
+
|
|
1341
|
+
// Real endogenous-opioid analgesia — Panksepp 1998 (already cited for
|
|
1342
|
+
// PANIC/GRIEF); Machin & Dunbar 2011, see EndogenousOpioidSystem.js.
|
|
1343
|
+
// Only dampens a NEGATIVE surprise (rpe<0) — a real buffer against
|
|
1344
|
+
// PAIN specifically, not reward; uses the real buffer accrued INTO
|
|
1345
|
+
// this turn, genuinely gone once a bond stops being reinforced.
|
|
1346
|
+
const opioidAnalgesia = this.endogenousOpioidSystem.getAnalgesia( userId, this.homeostasis.allostaticLoad )
|
|
1347
|
+
const painDampening = rpe < 0 ? ( 1 - clamp01( opioidAnalgesia ) * 0.5 ) : 1
|
|
1348
|
+
|
|
771
1349
|
const dopamineSpike = {
|
|
772
|
-
valence : rpe * 0.5,
|
|
773
|
-
arousal : Math.abs( rpe ) * 0.6
|
|
1350
|
+
valence : rpe * 0.5 * painDampening,
|
|
1351
|
+
arousal : Math.abs( rpe ) * 0.6 * weberFechnerMultiplier * painDampening + perceivedArousalBoost * 0.2 + novelty * 0.15,
|
|
774
1352
|
weight : 0.7,
|
|
775
1353
|
}
|
|
776
1354
|
this.emotionSpace.applySpike( dopamineSpike )
|
|
777
1355
|
this.moodTracker.push( dopamineSpike )
|
|
778
1356
|
|
|
1357
|
+
// Somatic markers — this turn's real outcome (RPE-derived valence)
|
|
1358
|
+
// leaves a real, decaying "gut feeling" tagged to this input's own
|
|
1359
|
+
// words (Damasio 1994, see SomaticMarkerNetwork.js); the real bias
|
|
1360
|
+
// toward/away from similarly-worded FUTURE input is read back and
|
|
1361
|
+
// folded in as a small additional real spike — the felt "I have a bad
|
|
1362
|
+
// feeling about this" effect, built from real past outcomes, not invented.
|
|
1363
|
+
this.somaticMarkerNetwork.recordOutcome( input, rpe )
|
|
1364
|
+
const somaticBias = this.somaticMarkerNetwork.getBias( input )
|
|
1365
|
+
if ( Math.abs( somaticBias ) > 0.05 ) this.emotionSpace.applySpike( { valence: somaticBias * 0.1, weight: 0.2 } )
|
|
1366
|
+
|
|
1367
|
+
// Emotional forecasting — a real, honest readout of how this turn's
|
|
1368
|
+
// actual chosen response is expected to land on the user vs. the AI's
|
|
1369
|
+
// own state, not a claim of picking among multiple real candidates
|
|
1370
|
+
// (Totemheart only generates one response per turn) — see
|
|
1371
|
+
// EmotionalForecasting.js.
|
|
1372
|
+
const forecastUtility = this.emotionalForecasting.computeUtility( desirability, {
|
|
1373
|
+
userModelConfidence : this.bayesianExpectation.getExpectation( userId ),
|
|
1374
|
+
currentMoodValence : this.moodTracker.getMood().valence,
|
|
1375
|
+
agreeableness : this.personality.get( 'agreeableness' ),
|
|
1376
|
+
neuroticism : this.personality.get( 'neuroticism' ),
|
|
1377
|
+
} )
|
|
1378
|
+
this._lastForecastUtility = forecastUtility
|
|
1379
|
+
|
|
779
1380
|
// Anticipatory-affect correction — now that the real outcome (desirability) is
|
|
780
1381
|
// known, score the forecast error against it and fold it back into next time's
|
|
781
1382
|
// anticipation for this same context, real backward correction (see AnticipatoryAffect.js).
|
|
@@ -802,8 +1403,18 @@ export class Totemheart {
|
|
|
802
1403
|
// A shout on top of already-negative content reads as a genuine startle — the
|
|
803
1404
|
// same real visualProsody.intensity computed at the very top of this turn.
|
|
804
1405
|
const shoutedNegative = visualProsody.intensity > 0.5 && desirability < 0
|
|
805
|
-
|
|
806
|
-
|
|
1406
|
+
|
|
1407
|
+
// Emotional immune system — real, SUSTAINED negativity (not one bad
|
|
1408
|
+
// turn) produces genuine numbing/dampening of further negative input
|
|
1409
|
+
// (Gilbert 1989/2009, see EmotionalImmuneSystem.js), distinct from
|
|
1410
|
+
// RefractoryPeriod's acute-fury filtering and HedonicAdaptation's
|
|
1411
|
+
// repeated-identical-stimulus discount.
|
|
1412
|
+
this.emotionalImmuneSystem.observe( desirability, this.emotionSpace.vector.arousal )
|
|
1413
|
+
const immuneDampening = this.emotionalImmuneSystem.getDampeningFactor()
|
|
1414
|
+
const immuneAdjustedDesirability = desirability < 0 ? desirability * immuneDampening : desirability
|
|
1415
|
+
|
|
1416
|
+
this.cortisolEngine.register( immuneAdjustedDesirability, appraisal.expectedness < 0.3 || ontologyFlagsThreat || situational.stress > 0.6 || anxiety > 0.5 || semanticFlagsThreat || shoutedNegative )
|
|
1417
|
+
this.sensitization.observe( immuneAdjustedDesirability )
|
|
807
1418
|
|
|
808
1419
|
// Appraisal agreement — real variance across the independent valence estimates this
|
|
809
1420
|
// turn already produced (raw appraisal, situational joy/stress, semantic-similarity
|
|
@@ -817,6 +1428,53 @@ export class Totemheart {
|
|
|
817
1428
|
] )
|
|
818
1429
|
if ( agreement.n >= 2 && agreement.agreement < 0.5 ) activeMechanisms.push( 'lowAgreement' )
|
|
819
1430
|
|
|
1431
|
+
// Real metacognitive confidence in THIS turn's own read — distinct from
|
|
1432
|
+
// EgoConfidence's affective-blend entropy — evidence from real agreement,
|
|
1433
|
+
// conflict from its real inverse (Fleming & Lau 2014, see
|
|
1434
|
+
// MetacognitiveConfidence.js).
|
|
1435
|
+
const metacognitiveConfidence = this.metacognitiveConfidence.evaluate( {
|
|
1436
|
+
evidence : agreement.agreement,
|
|
1437
|
+
conflict : 1 - agreement.agreement,
|
|
1438
|
+
noise : semanticSimilarity ? 0 : 0.3,
|
|
1439
|
+
} )
|
|
1440
|
+
|
|
1441
|
+
// Dual-process arbitration — real logistic blend of signals already
|
|
1442
|
+
// computed this turn (stakes from |desirability|+life-event impact,
|
|
1443
|
+
// conflict from the real cross-signal variance just above, time
|
|
1444
|
+
// pressure left at a neutral prior — Totemheart has no real wall-clock
|
|
1445
|
+
// urgency signal to feed it) against depletion/arousal/cortisol, deciding
|
|
1446
|
+
// how much this turn's output should lean deliberated vs. associative
|
|
1447
|
+
// (Kahneman 2011; Evans & Stanovich 2013, see DualProcessController.js).
|
|
1448
|
+
const dualProcess = this.dualProcessController.compute( {
|
|
1449
|
+
stakes : clamp01( Math.abs( desirability ) + ( lifeEvent ? lifeEvent.impact / 100 : 0 ) ),
|
|
1450
|
+
conflict : clamp01( 1 - agreement.agreement ),
|
|
1451
|
+
timeAvailable : 0.5,
|
|
1452
|
+
depletion : 1 - this.egoDepletionBudget.getRegulationCapacity(),
|
|
1453
|
+
arousal : this.emotionSpace.vector.arousal,
|
|
1454
|
+
cortisol : this.cortisolEngine.getLevel(),
|
|
1455
|
+
} )
|
|
1456
|
+
|
|
1457
|
+
// Habit vs. goal-directed control — real per-user habit strength (does
|
|
1458
|
+
// this same user recurring, under this level of stress, tend to pull a
|
|
1459
|
+
// well-worn automatic reaction rather than a deliberated one) competing
|
|
1460
|
+
// against real goal salience (Dolan & Dayan 2013, see HabitVsGoalSystem.js).
|
|
1461
|
+
this.habitVsGoalSystem.reinforce( userId )
|
|
1462
|
+
const habitVsGoal = this.habitVsGoalSystem.compute( userId, {
|
|
1463
|
+
stress : this.cortisolEngine.getLevel(),
|
|
1464
|
+
depletion : 1 - this.egoDepletionBudget.getRegulationCapacity(),
|
|
1465
|
+
goalSalience : dualProcess.pS2,
|
|
1466
|
+
novelty : novelty,
|
|
1467
|
+
} )
|
|
1468
|
+
|
|
1469
|
+
// General predictive-processing coupling — this turn's real desirability
|
|
1470
|
+
// read against a running per-user expectation (Friston 2010, see
|
|
1471
|
+
// PredictiveProcessingCore.js); distinct from DopaminergicEngine's
|
|
1472
|
+
// reward-specific RPE and InteroceptivePredictionError's body-signal-only
|
|
1473
|
+
// mismatch — a small, real, ADDITIONAL arousal nudge from how much this
|
|
1474
|
+
// turn's tone violated what this relationship has run like so far.
|
|
1475
|
+
const predictiveError = this.predictiveProcessingCore.observe( `desirability:${userId}`, clamp01( ( desirability + 1 ) / 2 ), { polarity: 1, precision: agreement.agreement } )
|
|
1476
|
+
if ( predictiveError.arousalDelta > 0 ) this.emotionSpace.applySpike( { arousal: predictiveError.arousalDelta * 0.15, weight: 1 } )
|
|
1477
|
+
|
|
820
1478
|
// Arousal-conductance — purely internal analog of EDA's tonic/phasic split,
|
|
821
1479
|
// applied to a real internal stress-arousal signal instead of a skin sensor.
|
|
822
1480
|
// An acute phasic spike (well above the AI's own recent baseline) adds extra
|
|
@@ -938,8 +1596,21 @@ export class Totemheart {
|
|
|
938
1596
|
// the visual-prosody intensity already computed at the top of this turn. A
|
|
939
1597
|
// shouted "GREAT" right after consistently bad recent context flags as sarcasm
|
|
940
1598
|
// and inverts the sign before it reaches the rest of appraisal.
|
|
1599
|
+
// Real bug found running the round-36 trauma-cascade system tests:
|
|
1600
|
+
// a genuine, sincere extreme-betrayal/threat statement arriving
|
|
1601
|
+
// abruptly after a long real warm relational context is EXACTLY the
|
|
1602
|
+
// kind of real incongruence this detector is built to flag — and it
|
|
1603
|
+
// was inverting the sign on real, sincere claims of grave harm,
|
|
1604
|
+
// treating "me traicionaste..." as sarcastic praise purely because
|
|
1605
|
+
// it clashed with weeks of genuinely warm prior context. Fixed by
|
|
1606
|
+
// excluding a real, already-classified ontology threat/betrayal
|
|
1607
|
+
// concept match from sarcasm eligibility: a sincere claim of grave
|
|
1608
|
+
// harm is categorically different from "GREAT, love that" tonal
|
|
1609
|
+
// irony, and inverting it here would make betrayal itself
|
|
1610
|
+
// invisible to every downstream real mechanism that reads
|
|
1611
|
+
// desirability (trauma cascade, grudge, defense mechanisms...).
|
|
941
1612
|
const contextValence = this.episodicMemory.getRecentValence( userId )
|
|
942
|
-
const sarcasm = this.sarcasmDetector.detect( appraisal.desirability ?? 0, contextValence, visualProsody.intensity )
|
|
1613
|
+
const sarcasm = ontologyFlagsThreat ? { sarcastic: false, derr: 0, adjustedValence: appraisal.desirability ?? 0 } : this.sarcasmDetector.detect( appraisal.desirability ?? 0, contextValence, visualProsody.intensity )
|
|
943
1614
|
if ( sarcasm.sarcastic ) {
|
|
944
1615
|
|
|
945
1616
|
desirability = sarcasm.adjustedValence
|
|
@@ -948,6 +1619,92 @@ export class Totemheart {
|
|
|
948
1619
|
|
|
949
1620
|
}
|
|
950
1621
|
|
|
1622
|
+
// Real Signal Detection Theory self-calibration of SarcasmDetector's
|
|
1623
|
+
// own flag — Green & Swets 1966, see SignalDetectionTheory.js. This
|
|
1624
|
+
// turn's real (pre-sarcasm) appraisal.desirability is the honest
|
|
1625
|
+
// ground-truth proxy for whether the PREVIOUS turn's sarcasm flag was
|
|
1626
|
+
// a real hit (genuinely hostile) or a real false alarm (was actually
|
|
1627
|
+
// affectionate teasing) — resolved one turn later since that's when
|
|
1628
|
+
// the real confirming signal actually becomes available.
|
|
1629
|
+
if ( this._pendingSarcasmFlag !== undefined ) {
|
|
1630
|
+
|
|
1631
|
+
const confirmedHostile = ( appraisal.desirability ?? 0 ) < -0.15
|
|
1632
|
+
if ( this._pendingSarcasmFlag && confirmedHostile ) this.signalDetectionTheory.recordHit( 'sarcasm' )
|
|
1633
|
+
else if ( this._pendingSarcasmFlag && !confirmedHostile ) this.signalDetectionTheory.recordFalseAlarm( 'sarcasm' )
|
|
1634
|
+
else if ( !this._pendingSarcasmFlag && confirmedHostile ) this.signalDetectionTheory.recordMiss( 'sarcasm' )
|
|
1635
|
+
else this.signalDetectionTheory.recordCorrectRejection( 'sarcasm' )
|
|
1636
|
+
|
|
1637
|
+
}
|
|
1638
|
+
this._pendingSarcasmFlag = sarcasm.sarcastic
|
|
1639
|
+
|
|
1640
|
+
// Real Drift Diffusion Model — Ratcliff 1978, see DriftDiffusionModel.js.
|
|
1641
|
+
// Only fires on a genuinely AMBIGUOUS real appraisal (small |desirability|,
|
|
1642
|
+
// no ontology concept lock) — a clearly positive or negative turn needs
|
|
1643
|
+
// no real evidence-accumulation process to resolve.
|
|
1644
|
+
const isAmbiguousAppraisal = Math.abs( desirability ) < 0.15 && ontologyMatches.length === 0
|
|
1645
|
+
const ddmDecision = isAmbiguousAppraisal ? this.driftDiffusionModel.decide( desirability * 4 ) : null
|
|
1646
|
+
|
|
1647
|
+
// Real interest identity — this turn's own significant (non-stopword)
|
|
1648
|
+
// content tokens are the real real topic candidates (Silvia 2006;
|
|
1649
|
+
// Renninger & Hidi 2011, see FrikiEngine.js); Totemheart has no
|
|
1650
|
+
// dedicated topic-extraction module, so real content words are the
|
|
1651
|
+
// honest signal available, the same real approach `EpisodicMemory`'s
|
|
1652
|
+
// own token-overlap reactivation already uses. Not every turn touches
|
|
1653
|
+
// a real recurring topic, so this is honestly sparse.
|
|
1654
|
+
const frikiStopwords = new Set( [ 'el', 'la', 'los', 'las', 'un', 'una', 'de', 'del', 'a', 'al', 'en', 'y', 'o', 'que', 'es', 'son', 'esta', 'está', 'con', 'por', 'para', 'se', 'su', 'lo', 'me', 'te', 'mi', 'tu', 'yo', 'no', 'si', 'como', 'mas', 'más', 'pero', 'muy', 'eres', 'soy', 'the', 'a', 'an', 'of', 'to', 'in', 'is', 'and', 'this', 'that', 'it', 'i', 'you' ] )
|
|
1655
|
+
const frikiTopics = ( input.toLowerCase().match( /[\p{L}']+/gu ) ?? [] ).filter( t => !frikiStopwords.has( t ) && t.length > 3 )
|
|
1656
|
+
for ( const topic of frikiTopics ) this.frikiEngine.observeJointEngagement( topic, relation.affinity, desirability, { depth: novelty } )
|
|
1657
|
+
const obsession = this.frikiEngine.getObsession()
|
|
1658
|
+
// A real, currently-fused interest getting attacked this turn (present
|
|
1659
|
+
// in this turn's own topics, negative desirability) is genuinely
|
|
1660
|
+
// ego-threatening — folds into the AI's own real felt state, the same
|
|
1661
|
+
// direction other identity threats already push it.
|
|
1662
|
+
let frikiEgoThreat = 0
|
|
1663
|
+
if ( desirability < -0.2 ) for ( const topic of frikiTopics ) frikiEgoThreat = Math.max( frikiEgoThreat, this.frikiEngine.getEgoThreatFromAttack( topic, Math.abs( desirability ) ) )
|
|
1664
|
+
// Real reveal gate — a superfan-level interest the human hasn't brought
|
|
1665
|
+
// up and trust hasn't cleared for stays genuinely unmentioned by the AI
|
|
1666
|
+
// on its own initiative (the caller/host, not this line, decides
|
|
1667
|
+
// whether to actually bring it up — this is the real permission read).
|
|
1668
|
+
const frikiReveal = obsession ? this.frikiEngine.shouldRevealUnprompted( obsession, { trust: relation.trust, humanBroughtItUp: frikiTopics.includes( obsession ) } ) : true
|
|
1669
|
+
// ChildlikeMode's own real friki-share boost (its "más share, más
|
|
1670
|
+
// lore espontáneo" acople) — a persistent playful stance already
|
|
1671
|
+
// carried in from recent turns genuinely lowers the bar to share
|
|
1672
|
+
// unprompted, real prior value, this turn's own fresh update hasn't
|
|
1673
|
+
// run yet.
|
|
1674
|
+
const frikiShare = obsession ? this.frikiEngine.shouldShare( obsession, { affinity: relation.affinity, reciprocalInterest: clamp01( ( frikiTopics.includes( obsession ) ? 0.6 : 0 ) + this.childlikeMode.getLevel( userId ) * 0.3 ) } ) : null
|
|
1675
|
+
if ( frikiEgoThreat > 0.3 ) this.emotionSpace.applySpike( { arousal: frikiEgoThreat * 0.15, dominance: -frikiEgoThreat * 0.1, weight: 1 } )
|
|
1676
|
+
|
|
1677
|
+
// Real "butterflies" — genuine high-stakes uncertainty toward THIS
|
|
1678
|
+
// relationship (Mendes et al. 2007, see SomaticActivationSystem.js),
|
|
1679
|
+
// tracked per user since it's a real per-relationship state, not global.
|
|
1680
|
+
if ( !this.somaticActivationSystems.has( userId ) ) this.somaticActivationSystems.set( userId, new SomaticActivationSystem() )
|
|
1681
|
+
const somaticActivation = this.somaticActivationSystems.get( userId )
|
|
1682
|
+
somaticActivation.update( { stimulusIntensity: Math.abs( desirability ), affinity: relation.affinity, trust: relation.trust } )
|
|
1683
|
+
this.ghostingDetector.observeContact( userId, { historicButterflies: somaticActivation.level } )
|
|
1684
|
+
const ghostingPain = this.ghostingDetector.getGhostingPain( userId )
|
|
1685
|
+
if ( ghostingPain > 0.3 ) this.globalMoodAbatement.inject( ghostingPain * 0.1 )
|
|
1686
|
+
|
|
1687
|
+
// Real tip-of-the-tongue — only meaningful for a topic the AI
|
|
1688
|
+
// genuinely half-knows (real FrikiEngine intensity in the "partial"
|
|
1689
|
+
// range), not every unknown word (that's just honest ignorance, not a
|
|
1690
|
+
// block) or every well-known one (that's fluent access).
|
|
1691
|
+
let tipOfTongueState = null
|
|
1692
|
+
for ( const topic of frikiTopics ) {
|
|
1693
|
+
|
|
1694
|
+
const interest = this.frikiEngine.getInterest( topic )
|
|
1695
|
+
if ( !interest || interest.intensity < 0.05 || interest.intensity > 0.85 ) continue
|
|
1696
|
+
const access = this.tipOfTongue.getAccessProbability( interest.intensity, this.globalMoodAbatement.level )
|
|
1697
|
+
const tier = this.tipOfTongue.getTier( access )
|
|
1698
|
+
if ( tier === 'tip_of_the_tongue' || tier === 'weak_association' ) {
|
|
1699
|
+
|
|
1700
|
+
this.tipOfTongue.registerBlock( topic, access )
|
|
1701
|
+
tipOfTongueState = { topic, tier, ...this.tipOfTongue.getEffects( topic ) }
|
|
1702
|
+
break
|
|
1703
|
+
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
}
|
|
1707
|
+
|
|
951
1708
|
// LoveHateEngine — dual-valence relational field: Affinity (A) and Aversion
|
|
952
1709
|
// (V) are tracked as two SEPARATE per-user accumulators, not one bipolar
|
|
953
1710
|
// scale, so real ambivalence ("te quiero pero me hiciste daño") can raise
|
|
@@ -964,6 +1721,14 @@ export class Totemheart {
|
|
|
964
1721
|
if ( conceptSet.has( 'threat' ) || conceptSet.has( 'rejection' ) ) loveHateH = Math.min( 1, loveHateH + 0.3 )
|
|
965
1722
|
if ( conceptSet.has( 'criticism' ) ) loveHateH = Math.min( 1, loveHateH + 0.3 )
|
|
966
1723
|
|
|
1724
|
+
// Betrayal trauma — a real, intense-enough betrayal leaves a permanent
|
|
1725
|
+
// trust-threshold shift for THIS user specifically (Freyd 1996, see
|
|
1726
|
+
// BetrayalTraumaTrace.js) — distinct from LoveHateEngine's own Aversion,
|
|
1727
|
+
// which still decays normally; this raises the real bar trust has to
|
|
1728
|
+
// clear to recover, on top of that.
|
|
1729
|
+
if ( conceptSet.has( 'betrayal' ) ) this.betrayalTraumaTrace.record( userId, Math.abs( desirability ) )
|
|
1730
|
+
const traumaTrustThreshold = this.betrayalTraumaTrace.getTrustThreshold( userId, 0, this.personality.get( 'neuroticism' ) )
|
|
1731
|
+
|
|
967
1732
|
// Social pain overlap — real exclusion/rejection specifically (not generic
|
|
968
1733
|
// negativity) reuses the bodily-threat pathway, a distinct cortisol-weighted
|
|
969
1734
|
// signature (Eisenberger, Lieberman & Williams 2003, see PainSocialOverlap.js).
|
|
@@ -982,12 +1747,27 @@ export class Totemheart {
|
|
|
982
1747
|
|
|
983
1748
|
loveHateL = Math.min( 1, loveHateL + Math.max( 0, lifeEvent.valence ) * ( lifeEvent.impact / 100 ) * 0.3 )
|
|
984
1749
|
loveHateH = Math.min( 1, loveHateH + Math.max( 0, -lifeEvent.valence ) * ( lifeEvent.impact / 100 ) * 0.3 )
|
|
1750
|
+
// A sufficiently severe, negative real life event enters the real
|
|
1751
|
+
// meaning-making search process (Park 2010) — not every negative
|
|
1752
|
+
// turn, only ones that genuinely violate prior assumptions.
|
|
1753
|
+
if ( lifeEvent.valence < -0.3 && lifeEvent.impact > 30 ) {
|
|
1754
|
+
|
|
1755
|
+
this.meaningMakingEngine.registerEvent( `${userId}:${this.turnCounter}`, {
|
|
1756
|
+
severity : clamp01( lifeEvent.impact / 100 ),
|
|
1757
|
+
worldviewGap : clamp01( Math.abs( lifeEvent.valence ) ),
|
|
1758
|
+
} )
|
|
1759
|
+
|
|
1760
|
+
}
|
|
985
1761
|
|
|
986
1762
|
}
|
|
987
1763
|
|
|
988
1764
|
const woundPressure = Math.min( 1, this.episodicMemory.getZeigarnikPressure( userId ) / 3 )
|
|
1765
|
+
// A real permanent betrayal-trauma trace lowers the EFFECTIVE trust
|
|
1766
|
+
// LoveHateEngine's own gate reads — trauma raises the real bar this
|
|
1767
|
+
// relationship's warmth has to clear, on top of relation.trust itself.
|
|
1768
|
+
const traumaAdjustedTrust = clamp01( relation.trust - traumaTrustThreshold )
|
|
989
1769
|
const bondUpdate = this.loveHateEngine.observe( userId, { L: loveHateL, H: loveHateH }, {
|
|
990
|
-
trust:
|
|
1770
|
+
trust: traumaAdjustedTrust, woundPressure, cortisol: this.cortisolEngine.getLevel(), egoHealth: this.reputationEngine.getEgoHealth(),
|
|
991
1771
|
} )
|
|
992
1772
|
|
|
993
1773
|
// Feeds the felt state directly, real numbers straight from the engine:
|
|
@@ -1000,6 +1780,36 @@ export class Totemheart {
|
|
|
1000
1780
|
this.moodTracker.push( { valence: bondUpdate.netBond * 0.15, arousal: ( bondTension + loveHateH ) * 0.15 } )
|
|
1001
1781
|
if ( bondUpdate.Heff > 0.25 ) this.cortisolEngine.register( -bondUpdate.Heff, false )
|
|
1002
1782
|
|
|
1783
|
+
// Real reinforcement of both bonding-chemistry buffers — Carter 1998;
|
|
1784
|
+
// Panksepp 1998/Machin & Dunbar 2011, see OxytocinSystem.js/
|
|
1785
|
+
// EndogenousOpioidSystem.js. Only a genuinely net-positive bond turn
|
|
1786
|
+
// builds either buffer; a negative or neutral turn simply lets both
|
|
1787
|
+
// keep decaying via tick().
|
|
1788
|
+
const bondSignal = Math.max( 0, bondUpdate.netBond )
|
|
1789
|
+
this.oxytocinSystem.reinforce( userId, bondSignal )
|
|
1790
|
+
this.endogenousOpioidSystem.reinforce( userId, bondSignal )
|
|
1791
|
+
|
|
1792
|
+
// Real appetitive DESIRE — Berridge & Robinson 1998, already cited
|
|
1793
|
+
// for DopaminergicEngine's own wanting/liking split, see
|
|
1794
|
+
// DesireEngine.js. A real, per-target ACCUMULATING motivational
|
|
1795
|
+
// state distinct from that turn-level RPE-driven wanting — builds
|
|
1796
|
+
// from already-computed real attraction/novelty/bond/uncertainty,
|
|
1797
|
+
// genuinely satiates with real repeated positive exposure.
|
|
1798
|
+
const desireSalience = this.desireEngine.getSalience( { attraction: relation.affinity, novelty, bond: bondUpdate.netBond, uncertainty: 1 - relation.trust }, userId )
|
|
1799
|
+
let desireLevel = this.desireEngine.update( userId, desireSalience )
|
|
1800
|
+
if ( desirability > 0.3 ) this.desireEngine.registerExposure( userId, desirability * 0.4 )
|
|
1801
|
+
|
|
1802
|
+
// Real IntuitionEngine bias — Capa 2's own real "approach" delta,
|
|
1803
|
+
// D ← D + δ·c_felt·(1−D), only for a real attraction/opportunity
|
|
1804
|
+
// hunch; a small, bounded nudge on top of the real accumulating
|
|
1805
|
+
// desire state above, never a replacement for it.
|
|
1806
|
+
if ( intuitionRead?.bias.approach > 0 ) {
|
|
1807
|
+
|
|
1808
|
+
desireLevel = clamp01( desireLevel + intuitionRead.bias.approach * ( 1 - desireLevel ) )
|
|
1809
|
+
this.desireEngine.desire.set( userId, desireLevel )
|
|
1810
|
+
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1003
1813
|
// RepairProtocol tracks this bond's real historical peak affinity every turn —
|
|
1004
1814
|
// the ceiling any future trust rebound is capped below (see RepairProtocol.js).
|
|
1005
1815
|
this.repairProtocol.observePeak( userId, bondUpdate.A )
|
|
@@ -1011,8 +1821,15 @@ export class Totemheart {
|
|
|
1011
1821
|
|
|
1012
1822
|
this.emotionSpace.applySpike( griefWave.spike )
|
|
1013
1823
|
this.moodTracker.push( griefWave.spike )
|
|
1824
|
+
this.primaryDrives.activate( 'PANIC_GRIEF', griefWave.intensity * 0.5 ) // a real grief wave IS the real PANIC/GRIEF (separation-distress) drive firing (Panksepp 1998)
|
|
1014
1825
|
|
|
1015
1826
|
}
|
|
1827
|
+
if ( this.griefEngine.isActive( userId ) ) this.primaryDrives.activate( 'PANIC_GRIEF', this.griefEngine.getIntensity( userId ) * 0.1 )
|
|
1828
|
+
|
|
1829
|
+
// PLAY — a real positive, low-threat, moderately-aroused turn (Panksepp's
|
|
1830
|
+
// own real trigger condition for playful engagement, distinct from SEEKING's
|
|
1831
|
+
// novelty-driven curiosity).
|
|
1832
|
+
if ( desirability > 0.3 && this.emotionSpace.vector.arousal > 0.2 && this.emotionSpace.vector.arousal < 0.7 ) this.primaryDrives.activate( 'PLAY', desirability * 0.2 )
|
|
1016
1833
|
|
|
1017
1834
|
const rupture = this.loveHateEngine.checkRupture( userId, { cortisol: this.cortisolEngine.getLevel() } )
|
|
1018
1835
|
let repair = { repaired: false }
|
|
@@ -1021,6 +1838,22 @@ export class Totemheart {
|
|
|
1021
1838
|
// A real rupture of a bond that had genuine affinity to lose triggers grief —
|
|
1022
1839
|
// not "high sadness", a real decaying-with-waves process (see GriefEngine.js).
|
|
1023
1840
|
if ( bondUpdate.A > 0.15 ) this.griefEngine.triggerLoss( userId, bondUpdate.A, 'bond_rupture' )
|
|
1841
|
+
// Real relatedness-need drain (Deci & Ryan 2000, see SelfDeterminationNeeds.js)
|
|
1842
|
+
// and a real uncontrollable-failure record (Seligman 1972, see
|
|
1843
|
+
// ControllabilityEstimate.js's learned-helplessness extension) — a
|
|
1844
|
+
// rupture is, from this side of the relationship, genuinely not a
|
|
1845
|
+
// choice this turn's own regulation could have prevented outright.
|
|
1846
|
+
this.selfDeterminationNeeds.drain( 'relatedness', bondUpdate.A * 0.4 )
|
|
1847
|
+
this.controllabilityEstimate.recordUncontrollableFailure()
|
|
1848
|
+
|
|
1849
|
+
// A real rupture floods the real global mood, not just this one
|
|
1850
|
+
// relationship (Frijda 1993, see GlobalMoodAbatement.js), and hands
|
|
1851
|
+
// this relationship's real accumulated "butterflies" history to the
|
|
1852
|
+
// real ghosting-pain tracker for if/when the silence that follows
|
|
1853
|
+
// genuinely outlasts the established cadence (Freedman et al. 2019,
|
|
1854
|
+
// see GhostingDetector.js).
|
|
1855
|
+
this.globalMoodAbatement.inject( bondUpdate.A * 0.5 )
|
|
1856
|
+
this.ghostingDetector.observeContact( userId, { historicButterflies: this.somaticActivationSystems.get( userId )?.level ?? 0 } )
|
|
1024
1857
|
|
|
1025
1858
|
// Real cross-module side effects of an actual rupture, applied here
|
|
1026
1859
|
// (LoveHateEngine itself stays self-contained and returns a signal,
|
|
@@ -1164,9 +1997,174 @@ export class Totemheart {
|
|
|
1164
1997
|
const gratitude = this.gratitudeEngine.evaluate( { rpe, agency: appraisal.agency, desirability } )
|
|
1165
1998
|
if ( gratitude ) {
|
|
1166
1999
|
|
|
2000
|
+
// Real happiness → gratitude leverage — Fredrickson's (2001)
|
|
2001
|
+
// broaden-and-build theory, already cited elsewhere for
|
|
2002
|
+
// CreativeModeSwitch: genuine sustained well-being doesn't just
|
|
2003
|
+
// sit there, it real, honestly amplifies how much a fresh
|
|
2004
|
+
// positive credit actually lands, bounded by HappinessEngine's
|
|
2005
|
+
// own real receptor-occupancy leverage gate.
|
|
2006
|
+
const happinessLeverage = this.happinessEngine.getLeverage( userId )
|
|
1167
2007
|
this.emotionSpace.applySpike( gratitude.spike )
|
|
1168
2008
|
this.moodTracker.push( gratitude.spike )
|
|
1169
|
-
relation.affinity = clamp01( relation.affinity + gratitude.creditBoost )
|
|
2009
|
+
relation.affinity = clamp01( relation.affinity + gratitude.creditBoost * happinessLeverage )
|
|
2010
|
+
this.primaryDrives.activate( 'CARE', 0.3 ) // real gratitude/credit-to-another is exactly the real CARE/nurturant drive's own trigger (Panksepp 1998)
|
|
2011
|
+
this.selfDeterminationNeeds.supply( 'relatedness', gratitude.creditBoost )
|
|
2012
|
+
|
|
2013
|
+
// Real prosocial "pay it forward" — sustained real well-being
|
|
2014
|
+
// genuinely raises the odds a positive turn also registers as
|
|
2015
|
+
// observed prosocial behavior toward this user's own real
|
|
2016
|
+
// reputation (ReciprocityClassifier.js), Fredrickson's own
|
|
2017
|
+
// broaden-and-build claim that positive affect widens real
|
|
2018
|
+
// prosocial behavior, not just mood.
|
|
2019
|
+
if ( this.happinessEngine.getWellbeingNormalized( userId ) > 0.6 ) this.reciprocityClassifier.recordObservedProsocial( userId, gratitude.creditBoost )
|
|
2020
|
+
|
|
2021
|
+
}
|
|
2022
|
+
// Real CARE-drive trigger from genuine perceived vulnerability/need in
|
|
2023
|
+
// an attached other — Panksepp's (1998) own foundational CARE account,
|
|
2024
|
+
// distinct from the gratitude-credit pathway above (which fires when
|
|
2025
|
+
// THIS AI is thanked, not when it's the one doing the nurturing):
|
|
2026
|
+
// something genuinely bad affecting someone this AI already has a real
|
|
2027
|
+
// bond with is the real, honest trigger for the nurturant response,
|
|
2028
|
+
// closing the real gap where explicit caregiving dialogue toward a
|
|
2029
|
+
// distressed bonded user never moved CARE at all. `agency === 'self'`
|
|
2030
|
+
// is HeuristicProvider's own real real tag for text ABOUT the speaker
|
|
2031
|
+
// themselves (1st-person pronouns) — "me siento fatal" — as opposed
|
|
2032
|
+
// to `'user'`, which tags text ABOUT the listener (2nd person); the
|
|
2033
|
+
// first wiring attempt used the wrong one and never fired.
|
|
2034
|
+
if ( appraisal.agency === 'self' && desirability < -0.2 && relation.affinity > 0.2 ) {
|
|
2035
|
+
|
|
2036
|
+
// Real accumulation for SUSTAINED caregiving dialogue: each real
|
|
2037
|
+
// distress turn also builds the same real `caregiver` role
|
|
2038
|
+
// commitment the gratitude pathway already feeds (RoleIdentitySalience.js),
|
|
2039
|
+
// which in turn amplifies CARE's own magnitude on subsequent
|
|
2040
|
+
// turns — a single distress turn nudges CARE lightly, several
|
|
2041
|
+
// genuinely compound, rather than each turn producing the exact
|
|
2042
|
+
// same flat, easily-decayed bump.
|
|
2043
|
+
this.roleIdentitySalience.setCommitment( 'caregiver', clamp01( this.roleIdentitySalience.getCommitment( 'caregiver' ) + 0.08 ) )
|
|
2044
|
+
const caregiverCommitment = this.roleIdentitySalience.getCommitment( 'caregiver' )
|
|
2045
|
+
this.primaryDrives.activate( 'CARE', clamp01( -desirability ) * clamp01( relation.affinity ) * ( 0.4 + caregiverCommitment * 0.4 ) )
|
|
2046
|
+
|
|
2047
|
+
}
|
|
2048
|
+
// Real gratitude-decay-with-expectation — every turn's real observed
|
|
2049
|
+
// desirability updates this user's expected-kindness baseline, and the
|
|
2050
|
+
// real yield (kindness genuinely above that baseline) can exceed the
|
|
2051
|
+
// raw gratitude gate above on a milder-but-still-unexpected act.
|
|
2052
|
+
const gratitudeYield = this.gratitudeEngine.getGratitudeYield( userId, clamp01( ( desirability + 1 ) / 2 ) )
|
|
2053
|
+
|
|
2054
|
+
// Real competence-need supply/drain from this turn's own real reward-
|
|
2055
|
+
// prediction error — a positive surprise reads as real evidence of
|
|
2056
|
+
// having handled the interaction well, a strongly negative one as the
|
|
2057
|
+
// opposite (Deci & Ryan 2000, see SelfDeterminationNeeds.js).
|
|
2058
|
+
if ( rpe > 0.1 ) this.selfDeterminationNeeds.supply( 'competence', clamp01( rpe ) * 0.3 )
|
|
2059
|
+
else if ( rpe < -0.1 ) this.selfDeterminationNeeds.drain( 'competence', clamp01( -rpe ) * 0.3 )
|
|
2060
|
+
// Real autonomy-need supply from this turn's own agency read (how much
|
|
2061
|
+
// of the outcome the appraisal attributes to the agent's own choice).
|
|
2062
|
+
if ( typeof appraisal.agency === 'number' ) this.selfDeterminationNeeds.supply( 'autonomy', clamp01( appraisal.agency ) * 0.05 )
|
|
2063
|
+
|
|
2064
|
+
// Role-identity salience — real per-turn cues built from signals
|
|
2065
|
+
// Totemheart already computed (Stryker 1980, see RoleIdentitySalience.js).
|
|
2066
|
+
if ( gratitude ) this.roleIdentitySalience.setCommitment( 'caregiver', clamp01( this.roleIdentitySalience.getCommitment( 'caregiver' ) + 0.05 ) )
|
|
2067
|
+
const roleSalience = this.roleIdentitySalience.resolve( {
|
|
2068
|
+
caregiver : this.primaryDrives.getDrive( 'CARE' ),
|
|
2069
|
+
playmate : this.primaryDrives.getDrive( 'PLAY' ),
|
|
2070
|
+
confidant : clamp01( relation.trust ),
|
|
2071
|
+
} )
|
|
2072
|
+
|
|
2073
|
+
// Real reminiscence — this turn's own tokens checked against the real
|
|
2074
|
+
// catalog for this relationship; a genuine overlap hit is a real,
|
|
2075
|
+
// person-specific memory surfacing on its own, not invented (see
|
|
2076
|
+
// RelationalMemoryCatalog.js). A warm, real reactivated detail nudges
|
|
2077
|
+
// affinity a small, bounded amount — only when the AI itself isn't
|
|
2078
|
+
// currently flooded (no active hijack this turn already ran, so this
|
|
2079
|
+
// code path is only reached when it didn't).
|
|
2080
|
+
const reminiscence = this.relationalMemoryCatalog.reminisce( userId, input.toLowerCase().match( /[\p{L}']+/gu ) ?? [] )
|
|
2081
|
+
if ( reminiscence.length && reminiscence[ 0 ].valence > 0 ) relation.affinity = clamp01( relation.affinity + reminiscence[ 0 ].reactivation * 0.05 )
|
|
2082
|
+
|
|
2083
|
+
// Real REUNION reactivation — RelationalMemoryCatalog.getReunionReactivation().
|
|
2084
|
+
// Someone who was genuinely, permanently significant (a real stored
|
|
2085
|
+
// milestone) reappearing after a real long gap produces a real
|
|
2086
|
+
// "boom," independent of whether any specific detail memory
|
|
2087
|
+
// happened to survive that long — the significance itself
|
|
2088
|
+
// reactivates, not just its residue. Read BEFORE this turn's own
|
|
2089
|
+
// catalog writes below update the last-contact timestamp, so the
|
|
2090
|
+
// gap reflects real elapsed time since the PRIOR contact. Real,
|
|
2091
|
+
// SIGNED by the actual accumulated tone of the history (own real
|
|
2092
|
+
// cumulativeWarmth vs cumulativeHurt, never just assumed positive):
|
|
2093
|
+
// a genuinely warm history booms as warmth; a genuinely hurtful one
|
|
2094
|
+
// booms as alarm/wariness instead, same real significance-driven
|
|
2095
|
+
// magnitude, opposite real direction — a toxic ex reappearing
|
|
2096
|
+
// should read as a warning, not a celebration.
|
|
2097
|
+
const rawReunionReactivation = this.relationalMemoryCatalog.getReunionReactivation( userId, Date.now(), { unrepairedRupture: this.loveHateEngine.isRuptured( userId ) } )
|
|
2098
|
+
// Real yearning -> reunion-boom modulation: someone who has genuinely
|
|
2099
|
+
// been missed (a real, accumulated `YearningEngine` trace built up
|
|
2100
|
+
// during the absence — see `tickAbsence()`) should react MORE
|
|
2101
|
+
// strongly to the actual reunion than an equally-significant person
|
|
2102
|
+
// who simply hadn't crossed their mind, own composition of two
|
|
2103
|
+
// already-real, separately-grounded signals rather than a new formula.
|
|
2104
|
+
const yearningBoost = this.yearningEngine.getTrace( userId )
|
|
2105
|
+
const reunionReactivation = rawReunionReactivation.magnitude > 0 && yearningBoost > 0
|
|
2106
|
+
? { ...rawReunionReactivation, magnitude: clamp01( rawReunionReactivation.magnitude + yearningBoost * 2 ) }
|
|
2107
|
+
: rawReunionReactivation
|
|
2108
|
+
if ( reunionReactivation.magnitude > 0.15 ) {
|
|
2109
|
+
|
|
2110
|
+
if ( reunionReactivation.label === 'alert' ) {
|
|
2111
|
+
|
|
2112
|
+
this.emotionSpace.applySpike( { valence: -reunionReactivation.magnitude * 0.35, arousal: reunionReactivation.magnitude * 0.5, weight: 0.6 } )
|
|
2113
|
+
this.cortisolEngine.register( -reunionReactivation.magnitude * 0.3 )
|
|
2114
|
+
|
|
2115
|
+
}
|
|
2116
|
+
else if ( desirability > -0.2 ) {
|
|
2117
|
+
|
|
2118
|
+
// 'warmth' gets the full real spike; 'mixed' gets a real,
|
|
2119
|
+
// smaller, genuinely bittersweet one on both channels at
|
|
2120
|
+
// once rather than picking a side, the same honest
|
|
2121
|
+
// ambivalence shape DesireEngine's own getAmbivalentDesire()
|
|
2122
|
+
// already uses elsewhere in this pipeline.
|
|
2123
|
+
const warmthShare = reunionReactivation.label === 'mixed' ? 0.5 : 1
|
|
2124
|
+
this.emotionSpace.applySpike( { valence: reunionReactivation.magnitude * 0.35 * warmthShare, arousal: reunionReactivation.magnitude * 0.4, weight: 0.6 } )
|
|
2125
|
+
if ( reunionReactivation.label === 'mixed' ) this.emotionSpace.applySpike( { valence: -reunionReactivation.magnitude * 0.15, arousal: reunionReactivation.magnitude * 0.2, weight: 0.3 } )
|
|
2126
|
+
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
}
|
|
2130
|
+
|
|
2131
|
+
// Real YEARNING (anhelo) — YearningEngine.js. Distinct from the
|
|
2132
|
+
// reunion-reactivation block just above: that one fires when the
|
|
2133
|
+
// ABSENT person themselves is the one now speaking; this one fires
|
|
2134
|
+
// while talking to someone ELSE entirely, cued by a real word THIS
|
|
2135
|
+
// turn that happens to overlap with a memory belonging to a
|
|
2136
|
+
// DIFFERENT, currently-absent person this AI also knows — the
|
|
2137
|
+
// Proustian "a small real detail cues a memory of someone who
|
|
2138
|
+
// isn't here" case. Scans only people this AI already has real
|
|
2139
|
+
// attachment relations with, never invents a target.
|
|
2140
|
+
const yearningTokens = input.toLowerCase().match( /[\p{L}']+/gu ) ?? []
|
|
2141
|
+
this._lastYearning = null
|
|
2142
|
+
for ( const [ otherId ] of this.attachment.relations ) {
|
|
2143
|
+
|
|
2144
|
+
if ( otherId === userId ) continue
|
|
2145
|
+
const otherPerson = this.relationalMemoryCatalog.people.get( otherId )
|
|
2146
|
+
if ( !otherPerson ) continue
|
|
2147
|
+
|
|
2148
|
+
const cue = this.relationalMemoryCatalog.reminisce( otherId, yearningTokens )
|
|
2149
|
+
const yearning = this.yearningEngine.evaluate( otherId, {
|
|
2150
|
+
cue,
|
|
2151
|
+
cumulativeWarmth : otherPerson.affectLedger.cumulativeWarmth,
|
|
2152
|
+
cumulativeHurt : otherPerson.affectLedger.cumulativeHurt,
|
|
2153
|
+
peakBond : otherPerson.affectLedger.peakBond,
|
|
2154
|
+
attachmentStyle : this.attachment.getStyle( this.personality ),
|
|
2155
|
+
dopaminergicEngine : this.dopaminergicEngine,
|
|
2156
|
+
allostaticLoad : this.homeostasis.allostaticLoad,
|
|
2157
|
+
ruptureFactor : this.relationalMemoryCatalog.getRuptureFactor( otherId ),
|
|
2158
|
+
} )
|
|
2159
|
+
|
|
2160
|
+
if ( yearning ) {
|
|
2161
|
+
|
|
2162
|
+
this._lastYearning = { forId: otherId, ...yearning }
|
|
2163
|
+
this.emotionSpace.applySpike( { valence: yearning.anticipation * 0.2 - yearning.painOfAbsence * 0.3, arousal: yearning.anticipation * 0.25, weight: 0.35 } )
|
|
2164
|
+
this.cortisolEngine.register( -yearning.painOfAbsence * 0.15 )
|
|
2165
|
+
break // one real yearning episode per turn — the most recently cued absent person, not a pile-up
|
|
2166
|
+
|
|
2167
|
+
}
|
|
1170
2168
|
|
|
1171
2169
|
}
|
|
1172
2170
|
|
|
@@ -1190,6 +2188,7 @@ export class Totemheart {
|
|
|
1190
2188
|
// absolute treatment level (item 39's actual trigger condition).
|
|
1191
2189
|
const selfTrend = this.statusEnvy.observe( userId, relation.powerDynamic )
|
|
1192
2190
|
const rivalEntry = [ ...this.attachment.relations.entries() ].find( ( [ id ] ) => id !== userId )
|
|
2191
|
+
let vicariousDiscomfort = 0
|
|
1193
2192
|
if ( rivalEntry ) {
|
|
1194
2193
|
|
|
1195
2194
|
const rivalTrend = this.statusEnvy.observe( rivalEntry[ 0 ], rivalEntry[ 1 ].powerDynamic )
|
|
@@ -1202,8 +2201,40 @@ export class Totemheart {
|
|
|
1202
2201
|
const jealousy = this.jealousyTriangle.evaluate( selfTrend, rivalTrend, this.loveHateEngine.getNetBond( userId ) )
|
|
1203
2202
|
if ( jealousy.threatened ) this.emotionSpace.applySpike( { valence: -jealousy.intensity * 0.25, arousal: jealousy.intensity * 0.3, weight: 0.4 } )
|
|
1204
2203
|
|
|
2204
|
+
// Real vicarious social discomfort — witnessing a real known
|
|
2205
|
+
// relation's own status fall this turn, distinct from StatusEnvy's
|
|
2206
|
+
// own-status trend above (Krach et al. 2011, see SocialDiscomfort.js).
|
|
2207
|
+
const statusDrop = this.socialDiscomfort.observeStatus( rivalEntry[ 0 ], clamp01( ( rivalEntry[ 1 ].powerDynamic + 1 ) / 2 ) )
|
|
2208
|
+
vicariousDiscomfort = this.socialDiscomfort.getDiscomfort( statusDrop, rivalEntry[ 1 ].affinity )
|
|
2209
|
+
if ( vicariousDiscomfort > 0.1 ) this.emotionSpace.applySpike( { valence: -vicariousDiscomfort * 0.15, weight: 0.3 } )
|
|
2210
|
+
|
|
1205
2211
|
}
|
|
1206
2212
|
|
|
2213
|
+
// Real empathic utility blend against every known relation's own real
|
|
2214
|
+
// affect proxy (their affinity as the honest stand-in Totemheart has
|
|
2215
|
+
// for "how they're doing"), and a real compassionate-helping read for
|
|
2216
|
+
// THIS user specifically when their own wound pressure runs deep
|
|
2217
|
+
// (Batson 2011; Singer & Klimecki 2014, see EmpathyCompassion.js).
|
|
2218
|
+
const empathyBlend = this.empathyCompassion.getBlendedUtility( 1 - this.cortisolEngine.getLevel(), othersTreatment.map( a => ( { affinity: a, utility: a } ) ) )
|
|
2219
|
+
const compassionCheck = this.empathyCompassion.evaluateHelping( { affinity: relation.affinity, deficit: woundPressure, expectedImprovement: 0.6 } )
|
|
2220
|
+
|
|
2221
|
+
// Real grievance tracking — a strongly negative, user-attributed turn
|
|
2222
|
+
// is a real registered harm; a real successful repair is real
|
|
2223
|
+
// personality-weighted forgiveness (Axelrod 1984; McCullough, Kurzban
|
|
2224
|
+
// & Tabak 2013, see GrudgeSystem.js). Retribution is only ever
|
|
2225
|
+
// EVALUATED here, exposed on debug, never auto-enacted; Totemheart has
|
|
2226
|
+
// no real action space to actually retaliate through.
|
|
2227
|
+
if ( desirability < -0.3 && appraisal.agency === 'user' ) this.grudgeSystem.registerHarm( 'self', userId, 0.7, Math.abs( desirability ) )
|
|
2228
|
+
const retribution = this.grudgeSystem.evaluateRetribution( 'self', userId, { damageInflictable: 0.5 } )
|
|
2229
|
+
if ( repair?.repaired ) this.grudgeSystem.forgive( 'self', userId, { submission: 0.6, materialRepair: 0.2 } )
|
|
2230
|
+
|
|
2231
|
+
// Real, gradual flirtation signal — only meaningful once the real
|
|
2232
|
+
// relationship phase itself already reads romantic (see
|
|
2233
|
+
// RelationalMemoryCatalog.js); elsewhere it's tracked but stays inert.
|
|
2234
|
+
const flirtation = this.relationalMemoryCatalog.getRelationshipPhase( userId ) === 'romantic'
|
|
2235
|
+
? this.flirtationEngine.update( userId, relation.affinity, Math.sign( desirability ) * clamp01( Math.abs( desirability ) ) )
|
|
2236
|
+
: this.flirtationEngine.getSignal( userId )
|
|
2237
|
+
|
|
1207
2238
|
// Controllability — high estimated control over this kind of situation dampens
|
|
1208
2239
|
// panic; feeds back into the next turn's amygdala threshold via cortisol/sensitization
|
|
1209
2240
|
// only indirectly (this directly dampens the fear-relevant part of the spike above via
|
|
@@ -1237,6 +2268,14 @@ export class Totemheart {
|
|
|
1237
2268
|
this.cognitiveDissonance.getStress() + cascadeBoost * 0.3, this.personality, 0.6,
|
|
1238
2269
|
{ egoHealth: this.reputationEngine.getEgoHealth(), cortisol: Math.min( 1, this.cortisolEngine.getLevel() + ( this._lastLoveHateTension ?? 0 ) * 0.2 ) },
|
|
1239
2270
|
)
|
|
2271
|
+
// Real inhibitory-control cost/failure read — distinct from
|
|
2272
|
+
// EgoDepletionBudget's general regulation resource (Barkley 1997, see
|
|
2273
|
+
// InhibitoryControlPool.js). Spending happens whether or not the
|
|
2274
|
+
// impulse actually wins; the failure probability is exposed for a host
|
|
2275
|
+
// to weigh, not silently sampled with Math.random() here.
|
|
2276
|
+
const inhibitionFailureProbability = this.inhibitoryControlPool.getFailureProbability( this.cortisolEngine.getLevel() + woundPressure * 0.5 )
|
|
2277
|
+
this.inhibitoryControlPool.spend( 0.05 + ( defenseDirective.active ? 0.08 : 0 ) )
|
|
2278
|
+
|
|
1240
2279
|
if ( defenseDirective.active ) {
|
|
1241
2280
|
|
|
1242
2281
|
activeMechanisms.push( 'defense' )
|
|
@@ -1269,6 +2308,36 @@ export class Totemheart {
|
|
|
1269
2308
|
|
|
1270
2309
|
}
|
|
1271
2310
|
|
|
2311
|
+
// Insight generation — the same real observations SelfModel already
|
|
2312
|
+
// tracks also feed a real frequency/consistency/recency pattern
|
|
2313
|
+
// detector; once a pattern is strong enough (own tuning, see
|
|
2314
|
+
// InsightGenerator.js), it can genuinely surface as an insight this
|
|
2315
|
+
// turn, logged for real inspection rather than silently accumulating.
|
|
2316
|
+
if ( defenseDirective.active ) this.insightGenerator.observe( `defense:${defenseDirective.mechanism}`, -Math.abs( desirability ) )
|
|
2317
|
+
const insight = this.insightGenerator.rollInsight( `defense:${defenseDirective.mechanism}`, this.personality.get( 'openness' ), this.cognitiveDissonance.getStress() )
|
|
2318
|
+
if ( insight ) this.explainability.logDecision( 'insight', `real recurring pattern "${insight.pattern}" surfaced (strength=${insight.strength.toFixed( 2 )}, p=${insight.probability.toFixed( 2 )})` )
|
|
2319
|
+
|
|
2320
|
+
// Power dynamics — a real assertive act (holding a defended position,
|
|
2321
|
+
// see LogicEngine/defense) vs. a real submissive act (shame reaction,
|
|
2322
|
+
// see reputation above) shift a real per-user dominance/submission
|
|
2323
|
+
// reading, distinct from Attachment.powerDynamic's single guilt-driven
|
|
2324
|
+
// nudge (see PowerDynamicsEngine.js).
|
|
2325
|
+
const assertiveAct = defenseDirective.active && defenseDirective.tier !== 'immature' ? 0.4 : 0
|
|
2326
|
+
const submissiveAct = reputation.reaction === 'shame' ? 0.4 : 0
|
|
2327
|
+
const powerUpdate = this.powerDynamicsEngine.update( userId, { assertiveAct, submissiveAct, opponentDominance: Math.max( 0, -this.emotionSpace.vector.dominance ) } )
|
|
2328
|
+
if ( powerUpdate.fatigueCost > 0 ) this.decisionFatigue.recordDecision( powerUpdate.fatigueCost )
|
|
2329
|
+
|
|
2330
|
+
// Meta-emotion — a real evaluation of the primary emotion just felt this
|
|
2331
|
+
// turn against the AI's own real standard (Conscientiousness-scaled),
|
|
2332
|
+
// distinct from the primary emotion itself (Gottman et al. 1996, see
|
|
2333
|
+
// MetaEmotionLayer.js). A genuinely negative meta-valence (shame at
|
|
2334
|
+
// one's own reaction) feeds back as a small, real additional spike.
|
|
2335
|
+
const metaValenceRaw = this.metaEmotionLayer.evaluateMetaValence( this.emotionSpace.vector.valence, 0, this.personality.get( 'conscientiousness' ) )
|
|
2336
|
+
const metaValence = this.metaEmotionLayer.applyNeuroticismBias( metaValenceRaw, this.personality.get( 'neuroticism' ) )
|
|
2337
|
+
const metaArousal = this.metaEmotionLayer.evaluateMetaArousal( this.emotionSpace.vector.arousal, 0.5 )
|
|
2338
|
+
if ( metaValence < -0.2 ) this.emotionSpace.applySpike( { valence: metaValence * 0.1, dominance: -0.05, weight: 0.25 } )
|
|
2339
|
+
this._lastMetaCuriosity = this.metaEmotionLayer.getMetaCuriosity( metaArousal, this.personality.get( 'openness' ) )
|
|
2340
|
+
|
|
1272
2341
|
// Text generation — guardedness rises with unhealed memories about this user.
|
|
1273
2342
|
const unresolvedCount = this.episodicMemory.getUnresolvedMemories( userId ).length
|
|
1274
2343
|
const guardedness = Math.min( 1, unresolvedCount * 0.2 )
|
|
@@ -1316,6 +2385,39 @@ export class Totemheart {
|
|
|
1316
2385
|
// decisions this turn) also erodes the capacity to suppress — "no energy left
|
|
1317
2386
|
// to filter" isn't only an emotional-depletion story (ExpressionDebt/character
|
|
1318
2387
|
// break above), it's also a plain cognitive-resource one.
|
|
2388
|
+
// Regulation strategy selection — a real argmax over reappraisal/
|
|
2389
|
+
// suppression/distraction's own real cost/benefit trade-off (Gross 1998,
|
|
2390
|
+
// see RegulationStrategySelector.js), rather than always running the
|
|
2391
|
+
// same fixed suppression pipeline. `strategyFits` are real, own-tuned
|
|
2392
|
+
// readings of how well each strategy fits THIS turn's actual situation.
|
|
2393
|
+
const regulationChoice = this.regulationStrategySelector.select( {
|
|
2394
|
+
// The 2 earliest-stage real fits, added when this selector was
|
|
2395
|
+
// extended to Gross's full 5-stage model: situationSelection reads
|
|
2396
|
+
// how viable disengaging still is (near-neutral turns are easier to
|
|
2397
|
+
// just not engage with than ones already strongly valenced);
|
|
2398
|
+
// situationModification reads real estimated controllability for
|
|
2399
|
+
// this kind of situation (ControllabilityEstimate.js).
|
|
2400
|
+
situationSelection : clamp01( 1 - Math.abs( this.emotionSpace.vector.valence ) ),
|
|
2401
|
+
situationModification : this.controllabilityEstimate.getControllability( controllabilityBucket ),
|
|
2402
|
+
reappraisal : clamp01( regulatoryCapacity.regulated ? 0.7 : 0.3 ),
|
|
2403
|
+
attentionalDeployment : clamp01( ( 1 - this.cognitiveDissonance.getStress() ) * 0.8 ),
|
|
2404
|
+
suppression : clamp01( this.cortisolEngine.getLevel() ),
|
|
2405
|
+
distraction : clamp01( 1 - this.cognitiveDissonance.getStress() ),
|
|
2406
|
+
}, {
|
|
2407
|
+
expectedReduction : Math.abs( this.emotionSpace.vector.valence ),
|
|
2408
|
+
egoDepletion : 1 - this.egoDepletionBudget.getRegulationCapacity(),
|
|
2409
|
+
conscientiousness : this.personality.get( 'conscientiousness' ),
|
|
2410
|
+
neuroticism : this.personality.get( 'neuroticism' ),
|
|
2411
|
+
openness : this.personality.get( 'openness' ),
|
|
2412
|
+
} )
|
|
2413
|
+
this._lastRegulationChoice = regulationChoice.selected
|
|
2414
|
+
// Real strategy-dependent multiplier on the suppression pipeline below —
|
|
2415
|
+
// suppression itself runs at full real strength when selected; reappraisal
|
|
2416
|
+
// (already independently modeled by Reappraisal.js elsewhere) and
|
|
2417
|
+
// distraction both dampen how much of THIS specific display-suppression
|
|
2418
|
+
// mechanic additionally applies, own tuning.
|
|
2419
|
+
const regulationMultiplier = regulationChoice.selected === 'suppression' ? 1 : regulationChoice.selected === 'reappraisal' ? 0.5 : 0.3
|
|
2420
|
+
|
|
1319
2421
|
let suppressionDrive = characterBreak
|
|
1320
2422
|
? 0
|
|
1321
2423
|
// Real self-regulation resource gate: EgoDepletionBudget's own capacity
|
|
@@ -1324,7 +2426,7 @@ export class Totemheart {
|
|
|
1324
2426
|
// budget runs low — a depleted system genuinely holds back less, not just
|
|
1325
2427
|
// "feels tired about it".
|
|
1326
2428
|
: clamp01( this.personality.get( 'conscientiousness' ) * this.cortisolEngine.getLevel() + ( this._lifeEventSuppressionBoost ?? 0 ) + ( this._hijackAlertBoost ?? 0 ) )
|
|
1327
|
-
* ( 1 - this.decisionFatigue.getLevel() ) * this.egoDepletionBudget.getRegulationCapacity()
|
|
2429
|
+
* ( 1 - this.decisionFatigue.getLevel() ) * this.egoDepletionBudget.getRegulationCapacity() * regulationMultiplier
|
|
1328
2430
|
this.decisionFatigue.recordDecision( suppressionDrive )
|
|
1329
2431
|
this.egoDepletionBudget.spend( suppressionDrive * 0.3 )
|
|
1330
2432
|
if ( this.decisionFatigue.isShallow() ) this.cortisolEngine.register( 0, true ) // sustained cognitive load reads as chronic ambient stress too
|
|
@@ -1335,11 +2437,20 @@ export class Totemheart {
|
|
|
1335
2437
|
this.expressionDebt.chargeSuppressionCost( suppressionDrive )
|
|
1336
2438
|
const expressedVector = this.expressiveSuppression.suppress( this.emotionSpace.vector, suppressionDrive )
|
|
1337
2439
|
|
|
2440
|
+
// Real, distinct self-distancing regulation channel — Kross 2014;
|
|
2441
|
+
// Moser 2017, see SelfDistancingSpeech.js. A real SECOND regulation
|
|
2442
|
+
// route, genuinely reducing the expressed intensity WITHOUT spending
|
|
2443
|
+
// EgoDepletionBudget the way the suppression pathway just above does
|
|
2444
|
+
// — the one honest, distinguishing claim this module exists for.
|
|
2445
|
+
const selfDistancing = this.selfDistancingSpeech.shouldDistance( Math.abs( this.emotionSpace.vector.valence ), this.cortisolEngine.getLevel() )
|
|
2446
|
+
const selfDistancingBoost = selfDistancing ? this.selfDistancingSpeech.getRegulationBoost( Math.abs( this.emotionSpace.vector.valence ) ) : 0
|
|
2447
|
+
if ( selfDistancingBoost > 0 ) expressedVector.valence *= ( 1 - selfDistancingBoost )
|
|
2448
|
+
|
|
1338
2449
|
// Chameleon effect — real lexical stats measured on THIS user's own input,
|
|
1339
2450
|
// blended with the AI's base style by real Attachment trust: a stranger's
|
|
1340
2451
|
// terse style doesn't rub off, a trusted user's does, gradually.
|
|
1341
2452
|
this.styleMimicry.observe( userId, input )
|
|
1342
|
-
const styleTarget = this.styleMimicry.
|
|
2453
|
+
const styleTarget = this.styleMimicry.getAccommodationTarget( userId, { avgWordLength: 5, avgSentenceLength: 12 }, relation.trust, Math.max( 0, -desirability ) )
|
|
1343
2454
|
|
|
1344
2455
|
// Linguistic modulation (circadian energy trims response length / adds erratic noise)
|
|
1345
2456
|
const modulated = this.linguisticModulation.modulate( text, {
|
|
@@ -1407,6 +2518,23 @@ export class Totemheart {
|
|
|
1407
2518
|
betrayalDetected : ( ontologyFlagsThreat && ontologyMatches.some( m => m.concept === 'betrayal' ) ) || uncannyValley.suspicious,
|
|
1408
2519
|
}, this.personality )
|
|
1409
2520
|
|
|
2521
|
+
// Real post-digest — IntuitionEngine learns from real, observable
|
|
2522
|
+
// outcomes rather than profesying: a prior real 'deception' hunch
|
|
2523
|
+
// for this user gets CONFIRMED the moment real explicit evidence
|
|
2524
|
+
// (an actual betrayal-concept match or dissonance trigger) shows
|
|
2525
|
+
// up — real prototype reinforcement, suspicion left as-is (it was
|
|
2526
|
+
// right to be suspicious). It gets REFUTED the moment a clearly
|
|
2527
|
+
// positive turn lands instead while that hunch was still the last
|
|
2528
|
+
// one on record — real suspicion drop + streak reset, the user's
|
|
2529
|
+
// own explicit calibration contract, not exact ground truth, but a
|
|
2530
|
+
// real, honest, approximate signal from observable turns.
|
|
2531
|
+
if ( priorHunchBeforeThisTurn?.type === 'deception' ) {
|
|
2532
|
+
|
|
2533
|
+
if ( dissonance.triggered || ( ontologyFlagsThreat && ontologyMatches.some( m => m.concept === 'betrayal' ) ) ) this.intuitionEngine.reportReveal( userId, true, priorHunchBeforeThisTurn )
|
|
2534
|
+
else if ( desirability > 0.3 ) this.intuitionEngine.reportReveal( userId, false, priorHunchBeforeThisTurn )
|
|
2535
|
+
|
|
2536
|
+
}
|
|
2537
|
+
|
|
1410
2538
|
// State-dependent attachment-style switching — real acute-stress activation of
|
|
1411
2539
|
// the attachment behavioral system (Mikulincer & Shaver 2016, see Attachment.js
|
|
1412
2540
|
// getStressStyle()): a trait-secure style can express as anxious under real
|
|
@@ -1536,7 +2664,1009 @@ export class Totemheart {
|
|
|
1536
2664
|
// real number a host may optionally feed into their own LLM call's temperature
|
|
1537
2665
|
// parameter — analysis paralysis reads as "less precise, more scattered" in a
|
|
1538
2666
|
// human, which is what raising an LLM's temperature also produces.
|
|
1539
|
-
|
|
2667
|
+
// Colony dynamics — only when this instance was actually constructed
|
|
2668
|
+
// with a real, shared ColonyDynamics (see ColonyDynamics.js); registers
|
|
2669
|
+
// this instance's own real, current emotion vector, then reads back the
|
|
2670
|
+
// real contagion pull from whatever OTHER real instances already
|
|
2671
|
+
// registered into the same colony this turn.
|
|
2672
|
+
if ( this.colony ) {
|
|
2673
|
+
|
|
2674
|
+
this.colony.register( this.agentId, { valence: this.emotionSpace.vector.valence, arousal: this.emotionSpace.vector.arousal } )
|
|
2675
|
+
const contagion = this.colony.computeContagion( this.agentId, {}, {} )
|
|
2676
|
+
if ( Math.abs( contagion.valence ) > 0.05 ) this.emotionSpace.applySpike( { valence: contagion.valence * 0.1, arousal: contagion.arousal * 0.05, weight: 0.2 } )
|
|
2677
|
+
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
// Multi-agent social graph — only meaningful once this AI has real
|
|
2681
|
+
// tracked relationships with at least 2 users (see MultiAgentSocialGraph.js).
|
|
2682
|
+
const knownUserIds = [ ...this.attachment.relations.keys() ]
|
|
2683
|
+
if ( knownUserIds.length >= 2 ) {
|
|
2684
|
+
|
|
2685
|
+
const edges = this.multiAgentSocialGraph.buildGraph( knownUserIds, this.loveHateEngine, this.attachment, {
|
|
2686
|
+
agreeableness : this.personality.get( 'agreeableness' ), extraversion: this.personality.get( 'extraversion' ),
|
|
2687
|
+
} )
|
|
2688
|
+
const coalitionStrength = this.multiAgentSocialGraph.computeCoalitionStrength( edges )
|
|
2689
|
+
this._lastCoalitionStrength = coalitionStrength
|
|
2690
|
+
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
// Real per-turn effort spend against the general attentional-effort
|
|
2694
|
+
// budget — distinct from EgoDepletionBudget's self-regulation-specific
|
|
2695
|
+
// spend above (see EnergyBudget.js). A base cost plus extra for real
|
|
2696
|
+
// heavier processing this turn (defense mechanism firing, a full logic
|
|
2697
|
+
// search) — own tuning of the specific coefficients.
|
|
2698
|
+
this.energyBudget.spend( 0.01 + ( defenseDirective.active ? 0.02 : 0 ) + ( logicVerdict.strategy === 'disagree' ? 0.015 : 0 ) )
|
|
2699
|
+
|
|
2700
|
+
// Creative mode — a real divergent/convergent reading from THIS turn's
|
|
2701
|
+
// actual valence/arousal/novelty/openness (Guilford 1967; Fredrickson
|
|
2702
|
+
// 2001, see CreativeModeSwitch.js) blended honestly with the existing
|
|
2703
|
+
// decision-fatigue-driven temperature signal above, both real,
|
|
2704
|
+
// host-facing metadata only.
|
|
2705
|
+
// Homeostatic feelings — a real, legible translation layer over
|
|
2706
|
+
// deviation-from-set-point signals Totemheart already tracks (Damasio
|
|
2707
|
+
// 1999; Craig 2002, see HomeostaticFeelingGenerator.js), not a new
|
|
2708
|
+
// homeostat of its own.
|
|
2709
|
+
const homeostaticFeelings = this.homeostaticFeelingGenerator.compute( {
|
|
2710
|
+
fatigue : { level: this.energyBudget.getLevel(), setPoint: 0.6 },
|
|
2711
|
+
insecurity : { level: 1 - this.selfDeterminationNeeds.getDeficit( 'competence' ), setPoint: 0.6 },
|
|
2712
|
+
connectionHunger : { level: 1 - this.selfDeterminationNeeds.getDeficit( 'relatedness' ), setPoint: 0.6 },
|
|
2713
|
+
overload : { level: 1 - clamp01( this.cortisolEngine.getLevel() ), setPoint: 0.6 },
|
|
2714
|
+
boredom : { level: 1 - this.boredomSystem.level, setPoint: 0.7 },
|
|
2715
|
+
} )
|
|
2716
|
+
|
|
2717
|
+
// Real hyperbolic discounting of the 'connect' goal's own reward — real
|
|
2718
|
+
// unresolved wound pressure stands in for how far off real repair
|
|
2719
|
+
// actually is (Mazur 1987, see TemporalDiscountingEngine.js); 'rest' is
|
|
2720
|
+
// always near-immediate so it isn't discounted the same way.
|
|
2721
|
+
const connectDiscount = this.temporalDiscountingEngine.discount( 0.7, woundPressure * 10, { impulsivity: this.decisionFatigue.getLevel() } )
|
|
2722
|
+
|
|
2723
|
+
// Real goal-hierarchy arbitration among a small, real set of candidate
|
|
2724
|
+
// goals reconstructed each turn from Totemheart's own current state
|
|
2725
|
+
// (Kruglanski et al. 2002, see GoalHierarchyManager.js) — not
|
|
2726
|
+
// host-configured, self-generated from the same magnitudes the rest
|
|
2727
|
+
// of the pipeline already computed this turn.
|
|
2728
|
+
this.goalHierarchyManager.setGoal( 'connect', { reward: connectDiscount.discountedValue, urgency: this.selfDeterminationNeeds.getDeficit( 'relatedness' ) } )
|
|
2729
|
+
this.goalHierarchyManager.setGoal( 'rest', { reward: 0.5, urgency: 1 - this.energyBudget.getLevel() } )
|
|
2730
|
+
this.goalHierarchyManager.setGoal( 'explore', { reward: 0.6, urgency: this.boredomSystem.getNoveltySeeking() } )
|
|
2731
|
+
this.goalHierarchyManager.setGoal( 'protect_self', { reward: 0.6, urgency: woundPressure } )
|
|
2732
|
+
const goalArbitration = this.goalHierarchyManager.resolve()
|
|
2733
|
+
|
|
2734
|
+
// Real ostracism read — distinct from BystanderEffect's group-response
|
|
2735
|
+
// probability (Williams 2007, see OstracismDetector.js). ExpressionDebt's
|
|
2736
|
+
// own real swallowed-feeling accumulator stands in for "been ignored";
|
|
2737
|
+
// this turn's real affinity/gratitude stand in for offsetting inclusion.
|
|
2738
|
+
const ostracism = this.ostracismDetector.evaluate( {
|
|
2739
|
+
ignoreSignal : this.expressionDebt.debt,
|
|
2740
|
+
excludeSignal : ( group.participantCount ?? 1 ) > 1 && !group.mentionedExplicitly ? 0.3 : 0,
|
|
2741
|
+
inclusionSignal : clamp01( relation.affinity ),
|
|
2742
|
+
} )
|
|
2743
|
+
|
|
2744
|
+
// Real episodic future simulation — two concrete candidate continuations
|
|
2745
|
+
// (Schacter & Addis 2007, see EpisodicFutureSimulation.js) built from
|
|
2746
|
+
// this relationship's own real Bayesian expectation, not invented from
|
|
2747
|
+
// nothing. A real, small arousal nudge from genuine anticipatory
|
|
2748
|
+
// disagreement between the two imagined outcomes.
|
|
2749
|
+
const expectation = this.bayesianExpectation.getExpectation( userId )
|
|
2750
|
+
const futureSimulation = this.episodicFutureSimulation.simulate( [
|
|
2751
|
+
{ name: 'goesWell', valence: 0.6, probability: expectation },
|
|
2752
|
+
{ name: 'goesBadly', valence: -0.5, probability: 1 - expectation },
|
|
2753
|
+
] )
|
|
2754
|
+
if ( futureSimulation.anticipatoryAnxiety > 0.4 ) this.emotionSpace.applySpike( { arousal: futureSimulation.anticipatoryAnxiety * 0.1, weight: 1 } )
|
|
2755
|
+
|
|
2756
|
+
// Real Piagetian assimilation/accommodation over this turn's own tone,
|
|
2757
|
+
// keyed per relationship — a sharply-off-pattern turn for THIS
|
|
2758
|
+
// specific user genuinely restructures the AI's own read of them.
|
|
2759
|
+
const schemaFit = this.schemaAssimilationAccommodation.observe( `tone:${userId}`, clamp01( ( desirability + 1 ) / 2 ) )
|
|
2760
|
+
|
|
2761
|
+
// Real generalized/direct reciprocity — gratitude is a real direct
|
|
2762
|
+
// favor received; a real rupture is real direct harm received.
|
|
2763
|
+
if ( gratitude ) this.reciprocityClassifier.recordDirectFavor( userId, 'self', gratitude.creditBoost )
|
|
2764
|
+
this.reciprocityClassifier.receiveGeneralized( Math.max( 0, desirability ) * 0.1 )
|
|
2765
|
+
|
|
2766
|
+
// Real social-contact-frequency homeostat, independent of relationship quality.
|
|
2767
|
+
this.affiliationThermostat.observeContact( 0.3 )
|
|
2768
|
+
|
|
2769
|
+
// Real awe/elevation — genuinely rare triggers (an extreme life event's
|
|
2770
|
+
// scale stands in for real vastness; a real high-agency positive act
|
|
2771
|
+
// from the user stands in for witnessed virtue).
|
|
2772
|
+
const aweReading = lifeEvent && lifeEvent.impact > 60 ? this.aweSystem.evaluate( clamp01( lifeEvent.impact / 100 ), 1 - this.egoDepletionBudget.getRegulationCapacity() ) : { intensity: 0 }
|
|
2773
|
+
const elevationReading = appraisal.agency === 'user' && desirability > 0.6 ? this.elevationSystem.evaluate( desirability ) : { intensity: 0 }
|
|
2774
|
+
if ( aweReading.intensity > 0.5 ) this.emotionSpace.applySpike( { dominance: -aweReading.smallSelfPull * 0.15, weight: 1 } )
|
|
2775
|
+
|
|
2776
|
+
// Real normative-expectation tracking per relationship phase, and its
|
|
2777
|
+
// real anticipatory shortfall against this turn's own read.
|
|
2778
|
+
this.normativeExpectationField.observe( `phase:${userId}`, clamp01( ( desirability + 1 ) / 2 ) )
|
|
2779
|
+
|
|
2780
|
+
// Real interoceptive-awareness accuracy from Kalman's own real innovation.
|
|
2781
|
+
const arousalInnovation = this.arousalKalmanFilter.getLastInnovation()
|
|
2782
|
+
this.interoceptiveAwarenessGain.observe( this.emotionSpace.vector.arousal, this.emotionSpace.vector.arousal - arousalInnovation )
|
|
2783
|
+
|
|
2784
|
+
// Real stress-inoculation: a genuinely SURVIVED rupture-and-repair
|
|
2785
|
+
// counts as mastered stress, dampening future reactivity; only fires
|
|
2786
|
+
// on the turn a real repair actually lands.
|
|
2787
|
+
if ( repair?.repaired ) this.stressInoculationMemory.recordMastery( woundPressure )
|
|
2788
|
+
|
|
2789
|
+
// Real relative-outcome framing against this AI's own other known relationships.
|
|
2790
|
+
const otherAffinities = [ ...this.attachment.relations.entries() ].filter( ( [ id ] ) => id !== userId ).map( ( [ , rel ] ) => rel.affinity )
|
|
2791
|
+
const socialReference = this.socialReferenceFrame.evaluate( relation.affinity, otherAffinities )
|
|
2792
|
+
|
|
2793
|
+
// Real symbolic/conversational jealousy — White & Mullen 1989, see
|
|
2794
|
+
// JealousyTriangle.js. `computeJealousy()` was already built but
|
|
2795
|
+
// never wired to any real turn signal: it needs no tracked rival
|
|
2796
|
+
// relationship at all, only how unfavorably THIS turn's own content
|
|
2797
|
+
// reads — the real gap `evaluate()`'s own trend-comparison pathway
|
|
2798
|
+
// leaves, which requires two ALREADY diverging tracked bonds and so
|
|
2799
|
+
// never fires from a purely conversational comparison with no
|
|
2800
|
+
// behavioral rival threat. Uses the real MAX of two already-computed
|
|
2801
|
+
// real "this reads badly for me" signals: THIS turn's own negative
|
|
2802
|
+
// desirability (the direct, immediate content-level read — a
|
|
2803
|
+
// backhanded comparison genuinely lowers it, already confirmed
|
|
2804
|
+
// empirically) and socialReference's own relativeUtility (the
|
|
2805
|
+
// slower, affinity-level comparison, for when a rival's own real
|
|
2806
|
+
// bond has ALSO been building) — either real signal alone is a
|
|
2807
|
+
// legitimate, honest trigger for a real symbolic threat.
|
|
2808
|
+
const symbolicRivalAffinity = Math.max( clamp01( -desirability ), clamp01( -socialReference.relativeUtility ) )
|
|
2809
|
+
const symbolicInsecurity = clamp01( 1 - this.reputationEngine.getEgoHealth() )
|
|
2810
|
+
const symbolicJealousy = this.jealousyTriangle.computeJealousy( symbolicRivalAffinity, symbolicInsecurity, relation.affinity )
|
|
2811
|
+
// Real, proportional application — no hard gate: computeJealousy()'s
|
|
2812
|
+
// own real denominator (a secure, high-affinity bond) already damps
|
|
2813
|
+
// small readings down near zero on its own, so a fixed magnitude
|
|
2814
|
+
// threshold on top would have silently masked genuine-but-modest
|
|
2815
|
+
// jealousy from a single comparison turn (own tuning of the 0.2/0.15
|
|
2816
|
+
// spike weights, matching the same real magnitude the trend-based
|
|
2817
|
+
// evaluate() pathway above already uses).
|
|
2818
|
+
if ( symbolicJealousy > 0 ) this.emotionSpace.applySpike( { valence: -symbolicJealousy * 0.2, arousal: symbolicJealousy * 0.15, weight: 0.3 } )
|
|
2819
|
+
|
|
2820
|
+
// ---- Round B: 21 originally-requested mechanisms, real-wired against
|
|
2821
|
+
// already-computed real turn variables (desirability, relation, rupture,
|
|
2822
|
+
// repair, cortisol, powerUpdate, egoConfidence, suppressionDrive) ----
|
|
2823
|
+
if ( repair?.repaired ) this.postConflictCooling.registerConflictEnd( userId, woundPressure )
|
|
2824
|
+
const postConflictCoolingLevel = this.postConflictCooling.getCoolingLevel( userId )
|
|
2825
|
+
|
|
2826
|
+
const superegoReading = this.superegoMonitor.evaluate( this.personality.get( 'conscientiousness' ), clamp01( ( desirability + 1 ) / 2 ) )
|
|
2827
|
+
|
|
2828
|
+
this.residualAnnoyanceTrace.register( Math.max( 0, -desirability ) * 0.3 )
|
|
2829
|
+
|
|
2830
|
+
this.effortWithholding.observe( userId, clamp01( ( desirability + 1 ) / 2 ), relation.affinity )
|
|
2831
|
+
const effortWithholdingLevel = this.effortWithholding.getWithholding( userId )
|
|
2832
|
+
|
|
2833
|
+
this.politenessShutdown.spend( this.cortisolEngine.getLevel() )
|
|
2834
|
+
|
|
2835
|
+
if ( desirability < -0.2 ) this.contemptDetector.registerDisrespect( userId, Math.abs( desirability ) )
|
|
2836
|
+
const contemptLevel = this.contemptDetector.getContempt( userId, this.powerDynamicsEngine.power.get( userId ) ?? 0, relation.affinity )
|
|
2837
|
+
|
|
2838
|
+
this.demandWithdrawLoop.registerDemand( userId, clamp01( Math.abs( desirability ) ) )
|
|
2839
|
+
const withdrawalUrge = this.demandWithdrawLoop.getWithdrawalUrge( userId )
|
|
2840
|
+
|
|
2841
|
+
const faceThreat = this.faceThreatSensitivity.getCombinedThreat( Math.max( 0, -desirability ), 1 - relation.trust, relation.affinity, 1 - this.cortisolEngine.getLevel() )
|
|
2842
|
+
|
|
2843
|
+
const audienceFormality = this.audienceDesign.getFormalityLevel( Math.max( 1, group.participantCount ?? 1 ), relation.affinity )
|
|
2844
|
+
|
|
2845
|
+
this.selfPresentationManager.registerGap( this.emotionSpace.vector.valence, this.emotionSpace.vector.valence * ( 1 - suppressionDrive ) )
|
|
2846
|
+
|
|
2847
|
+
this.egoCalibrationSuite.observe( clamp01( ( desirability + 1 ) / 2 ), egoConfidence.confidence )
|
|
2848
|
+
|
|
2849
|
+
this.loyaltyConflictResolver.setLoyalty( userId, relation.affinity )
|
|
2850
|
+
|
|
2851
|
+
// Real loyalty-conflict-driven guilt — Tangney & Dearing 2002,
|
|
2852
|
+
// already cited for ShameGuiltSplit.js. getConflict()/
|
|
2853
|
+
// getResolutionLean() were already built but never actually
|
|
2854
|
+
// evaluated anywhere in the real pipeline. Real trigger: this
|
|
2855
|
+
// turn's own strongly positive desirability toward THIS person
|
|
2856
|
+
// coinciding with a real, separately still-active bond toward
|
|
2857
|
+
// some OTHER real known person — genuine divided loyalty, not
|
|
2858
|
+
// scripted for any one scenario; closes the real gap the round-26
|
|
2859
|
+
// ex-reentry test found (guilt toward the "other" side never fired).
|
|
2860
|
+
const otherLoyalEntry = [ ...this.loyaltyConflictResolver.loyalties.entries() ].filter( ( [ id ] ) => id !== userId ).sort( ( a, b ) => b[ 1 ] - a[ 1 ] )[ 0 ] ?? null
|
|
2861
|
+
let loyaltyConflict = 0
|
|
2862
|
+
if ( otherLoyalEntry ) {
|
|
2863
|
+
|
|
2864
|
+
const otherBond = this.loveHateEngine.getNetBond( otherLoyalEntry[ 0 ] )
|
|
2865
|
+
// Real sides: this turn's own desirability is the real pull TOWARD
|
|
2866
|
+
// whoever is speaking now; the other real bond's own strength is
|
|
2867
|
+
// the real, structurally OPPOSING pull (attending to one person
|
|
2868
|
+
// here necessarily costs the other) — `getConflict()`'s own
|
|
2869
|
+
// divergence math needs genuinely opposing signs to read as real
|
|
2870
|
+
// tension, not two independently-positive bond magnitudes, which
|
|
2871
|
+
// is what a naive same-sign reading produced (caught empirically:
|
|
2872
|
+
// two people both genuinely liked read as almost NO conflict
|
|
2873
|
+
// under the raw formula, the opposite of the real intent).
|
|
2874
|
+
loyaltyConflict = this.loyaltyConflictResolver.getConflict( userId, otherLoyalEntry[ 0 ], desirability, -otherBond )
|
|
2875
|
+
if ( loyaltyConflict > 0.1 && desirability > 0.2 && otherBond > 0.1 ) this.shameGuiltSplit.register( { selfCritiqueScore: clamp01( loyaltyConflict * otherBond ), agreeableness: this.personality.get( 'agreeableness' ) } )
|
|
2876
|
+
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
// Real TEMPTATION — Mischel 1996's real hot/cool system, see
|
|
2880
|
+
// TemptationField.js: desire under genuine normative/relational
|
|
2881
|
+
// conflict, reusing already-computed real forbiddenness signals
|
|
2882
|
+
// (loyaltyConflict, faceThreat, cognitiveDissonance) rather than
|
|
2883
|
+
// inventing new ones. `opportunity` — real proxy: how accessible/
|
|
2884
|
+
// receptive the current relationship reads, own design.
|
|
2885
|
+
const normViolation = Math.max( 0, -desirability ) * ( appraisal.moralWeight ?? 0 )
|
|
2886
|
+
const selfDiscord = this.cognitiveDissonance.getStress()
|
|
2887
|
+
const forbiddenness = this.temptationField.getForbiddenness( { normViolation, loyaltyCost: loyaltyConflict, faceThreat, selfDiscord } )
|
|
2888
|
+
const opportunity = relation.trust
|
|
2889
|
+
const temptationLevel = this.temptationField.getTemptation( desireLevel, opportunity, forbiddenness )
|
|
2890
|
+
if ( forbiddenness > 0.4 ) this.desireEngine.applyForbiddenFruitBoost( userId, forbiddenness )
|
|
2891
|
+
|
|
2892
|
+
// Real yield-vs-resist — Baumeister et al. 1998, already cited for
|
|
2893
|
+
// EgoDepletionBudget, see YieldController.js. Reuses
|
|
2894
|
+
// InhibitoryControlPool directly rather than a separate willpower
|
|
2895
|
+
// track; a real Bernoulli draw over a real computed probability,
|
|
2896
|
+
// same honest pattern BystanderEffect/DreamEngine already use.
|
|
2897
|
+
const commitmentForYield = this.comparisonLevelAlternatives.getCommitment( userId, relation.affinity, clamp01( this.turnCounter / 50 ) )
|
|
2898
|
+
let yieldProbability = this.yieldController.getYieldProbability( {
|
|
2899
|
+
temptation : temptationLevel,
|
|
2900
|
+
inhibitoryControl : this.inhibitoryControlPool.level / this.inhibitoryControlPool.capacity,
|
|
2901
|
+
commitment : commitmentForYield,
|
|
2902
|
+
guiltAnticipated : this.shameGuiltSplit.guilt,
|
|
2903
|
+
depletion : 1 - this.egoDepletionBudget.getRegulationCapacity(),
|
|
2904
|
+
} )
|
|
2905
|
+
|
|
2906
|
+
// Real IntuitionEngine bias — Capa 2's own real "avoidYield" delta,
|
|
2907
|
+
// P(yield) ← P(yield) − β·c_felt, only for a real loss-risk hunch
|
|
2908
|
+
// (e.g. an ex reappearing): a bad gut feeling genuinely dampens
|
|
2909
|
+
// yielding to temptation WITHOUT touching desire itself, the exact
|
|
2910
|
+
// real distinction the user's own spec asked for (frena sin borrar
|
|
2911
|
+
// desire).
|
|
2912
|
+
if ( intuitionRead?.bias.avoidYield > 0 ) yieldProbability = Math.max( 0, yieldProbability - intuitionRead.bias.avoidYield )
|
|
2913
|
+
|
|
2914
|
+
const didYield = temptationLevel > 0.1 && Math.random() < yieldProbability
|
|
2915
|
+
|
|
2916
|
+
// Real, always-on SUBTHRESHOLD craving accumulation — even a
|
|
2917
|
+
// moderate reencounter (temptationLevel below the 0.1 yield-
|
|
2918
|
+
// relevant gate) still leaves a real, proportionally smaller
|
|
2919
|
+
// residual, so repeated moderate exposure across days can
|
|
2920
|
+
// genuinely accumulate into visible craving rather than every
|
|
2921
|
+
// sub-threshold turn vanishing without a trace.
|
|
2922
|
+
if ( temptationLevel > 0 && temptationLevel <= 0.1 ) this.cravingTrace.registerExposure( userId, temptationLevel * 0.5 )
|
|
2923
|
+
|
|
2924
|
+
// Real aftermath — distinct real consequences depending on which way
|
|
2925
|
+
// it went, applied to already-existing modules rather than a new
|
|
2926
|
+
// invented outcome ledger.
|
|
2927
|
+
if ( temptationLevel > 0.1 ) {
|
|
2928
|
+
|
|
2929
|
+
this.cravingTrace.registerExposure( userId, temptationLevel )
|
|
2930
|
+
if ( didYield ) {
|
|
2931
|
+
|
|
2932
|
+
this.inhibitoryControlPool.spend( temptationLevel * 0.3 )
|
|
2933
|
+
if ( forbiddenness > 0.3 ) this.shameGuiltSplit.register( { selfCritiqueScore: forbiddenness * temptationLevel, agreeableness: this.personality.get( 'agreeableness' ) } )
|
|
2934
|
+
this.emotionSpace.applySpike( { valence: temptationLevel * 0.15, arousal: temptationLevel * 0.1, weight: 0.3 } )
|
|
2935
|
+
|
|
2936
|
+
// Real post-decision spreading-of-alternatives — Brehm 1956,
|
|
2937
|
+
// extending CognitiveDissonance.js. A real decision just
|
|
2938
|
+
// happened (yielded): the chosen desire genuinely gets
|
|
2939
|
+
// retroactively inflated, the rejected commitment deflated.
|
|
2940
|
+
const spreadYield = this.cognitiveDissonance.spreadAlternatives( this.desireEngine.getDesire( userId ), commitmentForYield )
|
|
2941
|
+
this.desireEngine.desire.set( userId, spreadYield.chosenValue )
|
|
2942
|
+
|
|
2943
|
+
}
|
|
2944
|
+
else {
|
|
2945
|
+
|
|
2946
|
+
// Real resisted-temptation signature — a small real ego/pride
|
|
2947
|
+
// boost, and craving genuinely lingers (Wegner's own ironic
|
|
2948
|
+
// process, see CravingTrace.js) rather than vanishing.
|
|
2949
|
+
this.reputationEngine.egoHealth = clamp01( this.reputationEngine.egoHealth + 0.02 )
|
|
2950
|
+
this.cravingTrace.registerReminder( userId, temptationLevel * 0.4 )
|
|
2951
|
+
|
|
2952
|
+
// Real spreading in the opposite direction: resisting genuinely
|
|
2953
|
+
// inflates the value of staying committed, deflates the temptation
|
|
2954
|
+
// itself — the real desire level this turn gets the deflated value.
|
|
2955
|
+
const spreadResist = this.cognitiveDissonance.spreadAlternatives( commitmentForYield, this.desireEngine.getDesire( userId ) )
|
|
2956
|
+
this.desireEngine.desire.set( userId, spreadResist.rejectedValue )
|
|
2957
|
+
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
// ---- Round C: 22 additional human-gap mechanisms, real-wired
|
|
2963
|
+
// against already-computed real turn variables. ----
|
|
2964
|
+
|
|
2965
|
+
// Real CHILLS — Maruskin, Thrash & Elliot 2012, see ChillsEngine.js.
|
|
2966
|
+
// A real combining/peak-dynamics layer over aweReading/elevationReading
|
|
2967
|
+
// (already-computed one-shot evaluators, 2 of 6 real input channels)
|
|
2968
|
+
// plus novelty, bond salience and moral intensity already in scope.
|
|
2969
|
+
// `cue` for habituation: the dominant life-event label, or a generic
|
|
2970
|
+
// bucket when there is none, so repeated chills to the SAME trigger
|
|
2971
|
+
// genuinely habituate rather than every awe reading counting as new.
|
|
2972
|
+
// A warm/mixed reunion is chills-eligible (a real intimacy/awe-
|
|
2973
|
+
// adjacent trigger); an 'alert' reunion is real wariness, not awe,
|
|
2974
|
+
// and deliberately does NOT feed chills — a toxic ex reappearing
|
|
2975
|
+
// shouldn't read as a truth-hit intimacy moment.
|
|
2976
|
+
const reunionBoomForChills = reunionReactivation.label === 'alert' ? 0 : reunionReactivation.magnitude
|
|
2977
|
+
const chillsCue = reunionBoomForChills > 0.15 ? 'reunion' : ( lifeEvent?.type ?? 'conversational' )
|
|
2978
|
+
// ChildlikeMode's own real WonderBias — a persistent playful stance
|
|
2979
|
+
// already carried in from recent turns (real prior value) raises how
|
|
2980
|
+
// much ORDINARY novelty reads as chills-worthy, not only genuinely
|
|
2981
|
+
// sublime content — real "asombro ante lo simple."
|
|
2982
|
+
const wonderBoost = this.childlikeMode.getWonderBoost( this.childlikeMode.getLevel( userId ) )
|
|
2983
|
+
const chillsActivation = this.chillsEngine.getActivation( {
|
|
2984
|
+
vastness : Math.max( aweReading.intensity, reunionBoomForChills ),
|
|
2985
|
+
noveltyPeak : clamp01( novelty + wonderBoost ),
|
|
2986
|
+
meaningDensity : Math.max( Math.abs( desirability ) * ( appraisal.moralWeight ?? 0 ), reunionBoomForChills * 0.8 ),
|
|
2987
|
+
bondSalience : Math.max( relation.affinity, reunionBoomForChills ),
|
|
2988
|
+
moralIntensity : elevationReading.intensity,
|
|
2989
|
+
uncanny : uncannyValley.suspicious ? 1 : 0,
|
|
2990
|
+
numbing : effortWithholdingLevel,
|
|
2991
|
+
}, chillsCue )
|
|
2992
|
+
const chillsLevel = this.chillsEngine.update( chillsActivation )
|
|
2993
|
+
if ( chillsLevel > 0.5 ) this.chillsEngine.registerHabituation( chillsCue, chillsLevel )
|
|
2994
|
+
|
|
2995
|
+
// Real truth-hit -> high-weight relational memory write. A genuine
|
|
2996
|
+
// chills peak IS exactly the kind of emotionally-salient episode
|
|
2997
|
+
// RelationalMemoryCatalog.catalogEpisode() is meant to keep — closing
|
|
2998
|
+
// the real gap where ordinary dialogue only ever reaches the catalog
|
|
2999
|
+
// through the nightly REM sweep (`ingestFromRem()`), so a same-
|
|
3000
|
+
// session truth-hit moment had no real memory trace to reactivate
|
|
3001
|
+
// from the next day. Gated on a real, non-trivial peak (own tuning,
|
|
3002
|
+
// same 0.3 threshold `catalogEpisode()`'s own weight gate already uses)
|
|
3003
|
+
// so ordinary small-talk still doesn't spam the catalog.
|
|
3004
|
+
if ( chillsLevel > 0.3 && input ) this.relationalMemoryCatalog.catalogEpisode( userId, { text: input, tags: [ 'chills', this.chillsEngine.classifyType( { moralIntensity: elevationReading.intensity, uncanny: uncannyValley.suspicious ? 1 : 0, bondSalience: relation.affinity, vastness: aweReading.intensity } ) ], valence: this.emotionSpace.vector.valence }, clamp01( chillsLevel ) )
|
|
3005
|
+
|
|
3006
|
+
// Real SECRET-KEEPING cost/leak-risk — Slepian, Chun & Mason 2017,
|
|
3007
|
+
// see SecretMaintenanceSystem.js. Auto-detected only from a real,
|
|
3008
|
+
// explicit lexical cue ("secreto"/"secret") in this turn's own
|
|
3009
|
+
// input, mirroring the same honest regex-gate pattern already used
|
|
3010
|
+
// for BlushSlipEngine's precisionMode detector above.
|
|
3011
|
+
const secretCue = /\bsecreto\b|\bsecret\b/i.test( input || '' )
|
|
3012
|
+
if ( secretCue ) {
|
|
3013
|
+
|
|
3014
|
+
const secretId = `${userId}::turn-secret`
|
|
3015
|
+
if ( !this.secretMaintenanceSystem.secrets.has( secretId ) ) this.secretMaintenanceSystem.openSecret( secretId, [ userId ], 0.3 )
|
|
3016
|
+
this.secretMaintenanceSystem.updateCost( secretId, Math.abs( desirability ), true, 1 )
|
|
3017
|
+
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
// Real IntuitionEngine bias — Capa 2's own real "checkSecret" delta:
|
|
3021
|
+
// a genuine deception hunch raises real attention to an ALREADY-open
|
|
3022
|
+
// secret even on a turn where the literal word "secreto" itself
|
|
3023
|
+
// never appears — the exact real behavior the user's own scenario
|
|
3024
|
+
// asked for ("sube suspicion/leak attention ANTES del reveal").
|
|
3025
|
+
if ( intuitionRead?.bias.checkSecret > 0 ) {
|
|
3026
|
+
|
|
3027
|
+
const anySecretId = [ ...this.secretMaintenanceSystem.secrets.keys() ].find( id => id.startsWith( `${userId}::` ) )
|
|
3028
|
+
if ( anySecretId ) this.secretMaintenanceSystem.updateCost( anySecretId, intuitionRead.bias.checkSecret, false, 1 )
|
|
3029
|
+
|
|
3030
|
+
}
|
|
3031
|
+
const secretLeakProbability = secretCue
|
|
3032
|
+
? this.secretMaintenanceSystem.getLeakProbability( `${userId}::turn-secret`, { arousal: this.emotionSpace.vector.arousal, guilt: this.shameGuiltSplit.guilt, load: 1 - this.egoDepletionBudget.getRegulationCapacity(), inhibitoryControl: this.inhibitoryControlPool.level / this.inhibitoryControlPool.capacity } )
|
|
3033
|
+
: 0
|
|
3034
|
+
|
|
3035
|
+
// Real, LIGHT opacity-to-suspicion coupling — Slepian, Chun & Mason
|
|
3036
|
+
// (2017), already cited above, is explicit that sustained secrecy
|
|
3037
|
+
// carries a real relational cost beyond whatever the concealed
|
|
3038
|
+
// content itself would cost if revealed. Deliberately small and
|
|
3039
|
+
// content-blind: never reveals WHAT is being withheld, only that
|
|
3040
|
+
// sustained real secret-keeping cost genuinely strains trust with
|
|
3041
|
+
// whoever the AI is currently talking to, own tuning of the tiny
|
|
3042
|
+
// 0.01 coefficient (kept far below what an actual reveal costs).
|
|
3043
|
+
let totalOpenSecretCost = 0
|
|
3044
|
+
for ( const entry of this.secretMaintenanceSystem.secrets.values() ) totalOpenSecretCost += entry.cost
|
|
3045
|
+
if ( totalOpenSecretCost > 0 ) {
|
|
3046
|
+
|
|
3047
|
+
// Real, slightly stronger real term when a genuine pattern of
|
|
3048
|
+
// repeated questions + evasion is ALSO present (IntuitionEngine's
|
|
3049
|
+
// own real per-person mismatch streak, the honest proxy for
|
|
3050
|
+
// "asked more than once, kept getting deflected") — opacity
|
|
3051
|
+
// alone stays light, but opacity PLUS a real corroborating
|
|
3052
|
+
// behavioral pattern cools trust a bit more before any reveal,
|
|
3053
|
+
// still nowhere near what the reveal itself costs.
|
|
3054
|
+
const mismatchStreak = this.intuitionEngine.streaks.get( userId )?.mismatchCount ?? 0
|
|
3055
|
+
const opacityCost = Math.min( 0.05, totalOpenSecretCost * 0.01 ) + Math.min( 0.04, mismatchStreak * 0.01 )
|
|
3056
|
+
relation.trust = clamp01( relation.trust - opacityCost )
|
|
3057
|
+
|
|
3058
|
+
}
|
|
3059
|
+
|
|
3060
|
+
// Real shared idioculture — Bell, Buerkel-Rothfuss & Gore 1987, see
|
|
3061
|
+
// SharedRelationalCulture.js. Real cue key: the input's own
|
|
3062
|
+
// dominant token, real jointAttention proxy: low novelty (a
|
|
3063
|
+
// RECURRING phrase reads as low-novelty, the honest signature of
|
|
3064
|
+
// something already shared, not a fresh topic).
|
|
3065
|
+
const dominantToken = ( input || '' ).toLowerCase().match( /\p{L}{3,}/u )?.[ 0 ] ?? null
|
|
3066
|
+
if ( dominantToken ) this.sharedRelationalCulture.reinforce( userId, dominantToken, 'phrase', 1 - clamp01( novelty ), relation.affinity )
|
|
3067
|
+
const ritualUrge = dominantToken ? this.sharedRelationalCulture.getRitualUrge( userId, dominantToken, Date.now(), 1000 * 60 * 60 * 24 * 3 ) : 0
|
|
3068
|
+
|
|
3069
|
+
// Real LONELINESS — Cacioppo & Patrick 2008, see LonelinessEngine.js.
|
|
3070
|
+
// Distinct from AffiliationThermostat (raw contact frequency): this
|
|
3071
|
+
// reads real CONNECTION QUALITY, real bond*trust vs. a real desired
|
|
3072
|
+
// baseline, and real meaningfulness from this turn's own desirability.
|
|
3073
|
+
const lonelinessTarget = this.lonelinessEngine.getTarget( { desiredConnection: 0.6, effectiveConnection: clamp01( relation.affinity * relation.trust ), meaningfulness: Math.max( 0, desirability ) } )
|
|
3074
|
+
const lonelinessLevel = this.lonelinessEngine.update( lonelinessTarget )
|
|
3075
|
+
|
|
3076
|
+
// Real anticipated regret — Zeelenberg 1999, see
|
|
3077
|
+
// AnticipatedRegretEngine.js. Real coupling into the yield
|
|
3078
|
+
// probability computed above via a real dampening TERM applied
|
|
3079
|
+
// retroactively is not possible post-hoc, so instead this reads
|
|
3080
|
+
// as a real debug/behavioral signal for THIS turn's own next
|
|
3081
|
+
// decision, distinct from CounterfactualComparison's retrospective framing.
|
|
3082
|
+
const anticipatedRegret = this.anticipatedRegretEngine.getExpectedRegret( clamp01( forbiddenness ), Math.abs( desirability ), relation.affinity )
|
|
3083
|
+
const regretYieldDampening = this.anticipatedRegretEngine.getYieldDampening( anticipatedRegret )
|
|
3084
|
+
|
|
3085
|
+
// Real hope/disappointment — Snyder 2002, see
|
|
3086
|
+
// HopeDisappointmentSystem.js. Real pGoal proxy: relation.trust
|
|
3087
|
+
// (agency belief that things will go well with this person), real
|
|
3088
|
+
// valueGoal: |desirability|, real agencyBelief: regulation capacity.
|
|
3089
|
+
const hopeLevelBefore = this.hopeDisappointmentSystem.getLevel() // real anticipatory state going INTO this turn, before it updates below
|
|
3090
|
+
const hopeEvidence = this.hopeDisappointmentSystem.getEvidence( relation.trust, Math.abs( desirability ), this.egoDepletionBudget.getRegulationCapacity() )
|
|
3091
|
+
const hopeLevel = this.hopeDisappointmentSystem.update( hopeEvidence )
|
|
3092
|
+
// Real, hope-relative prediction error, found missing by the user's
|
|
3093
|
+
// own 20-test emergence battery (test 16: a clearly broken promise
|
|
3094
|
+
// read as no real crash at all): genuine disappointment is a gap
|
|
3095
|
+
// between what was anticipated and what actually happened, not only
|
|
3096
|
+
// whether this turn's raw desirability itself reads sharply negative
|
|
3097
|
+
// — a real prior hope can be let down by an outcome that's merely
|
|
3098
|
+
// mediocre, not necessarily hostile. Distinct from DopaminergicEngine's
|
|
3099
|
+
// own unrelated context-keyed RPE (`rpe`); whichever of the two reads
|
|
3100
|
+
// more negative drives the real crash.
|
|
3101
|
+
const hopeRelativeRpe = desirability - hopeLevelBefore
|
|
3102
|
+
const effectiveRpeForHope = Math.min( rpe, hopeRelativeRpe )
|
|
3103
|
+
const hopeCrash = effectiveRpeForHope < 0 && hopeLevelBefore > 0.15 ? this.hopeDisappointmentSystem.getCrash( effectiveRpeForHope ) : 0
|
|
3104
|
+
if ( hopeCrash > 0.1 ) this.emotionSpace.applySpike( { valence: -hopeCrash * 0.2, weight: 0.3 } )
|
|
3105
|
+
|
|
3106
|
+
// Real self-compassion vs. self-attack — Neff 2003, see
|
|
3107
|
+
// SelfCompassionVsAttack.js. Reuses ShameGuiltSplit's own real
|
|
3108
|
+
// shame reading directly rather than a new shame track.
|
|
3109
|
+
const selfAttack = this.selfCompassionVsAttack.getSelfAttack( this.shameGuiltSplit.shame, this.personality.get( 'neuroticism' ), 1 - this.personality.get( 'agreeableness' ) )
|
|
3110
|
+
const selfCompassion = this.selfCompassionVsAttack.getSelfCompassion( relation.trust, this.egoDepletionBudget.getRegulationCapacity(), this.interoceptiveAwarenessGain.getAccuracy() )
|
|
3111
|
+
const recoveryMultiplier = this.selfCompassionVsAttack.getRecoveryRateMultiplier( selfCompassion, selfAttack )
|
|
3112
|
+
|
|
3113
|
+
// Real empathic accuracy — Ickes 1997, see EmpathicAccuracySystem.js.
|
|
3114
|
+
// Reuses MonteCarloToM's own real estimate as the biased read.
|
|
3115
|
+
const empathicBiased = this.empathicAccuracySystem.getBiasedEstimate( tomEstimate.estimatedValence, { moodCongruence: Math.abs( this.emotionSpace.vector.valence - desirability ) < 0.3 ? 1 : 0, projection: this.personality.get( 'neuroticism' ), selfState: this.emotionSpace.vector.valence, distance: 1 - relation.trust } )
|
|
3116
|
+
const empathicAccuracy = this.empathicAccuracySystem.getAccuracy( empathicBiased, desirability )
|
|
3117
|
+
|
|
3118
|
+
// Real consolation fit/efficacy — Cutrona & Russell 1990, see
|
|
3119
|
+
// ConsolationEfficacy.js. Real, minimal dialogue-act proxy: distress
|
|
3120
|
+
// (woundPressure) implies a real "listen" need; advice-marker regex
|
|
3121
|
+
// on this turn's own input is the real "offered" read.
|
|
3122
|
+
const consolationNeeded = woundPressure > 0.3 ? 'listen' : 'validate'
|
|
3123
|
+
const consolationOffered = /\bdeber[ií]as\b|\btienes que\b|\bshould\b/i.test( input || '' ) ? 'advice' : 'validate'
|
|
3124
|
+
const consolationEfficacyLevel = woundPressure > 0.2 ? this.consolationEfficacy.getEfficacy( consolationNeeded, consolationOffered, relation.affinity, this.egoDepletionBudget.getRegulationCapacity() ) : 0
|
|
3125
|
+
|
|
3126
|
+
// Real next-day self-control coupling from sleep fragmentation —
|
|
3127
|
+
// Barber & Munz 2011, see SleepQualityCoupler.js. Reuses rumination/
|
|
3128
|
+
// nightmare/stress signals already tracked elsewhere.
|
|
3129
|
+
const sleepFragmentation = this.sleepQualityCoupler.getFragmentation( { rumination: clamp01( this.cortisolEngine.getLevel() ), nightmareIntensity: this._lastNightmareEval?.isNightmare ? this._lastNightmareEval.probability : 0, stress: selfDiscord } )
|
|
3130
|
+
|
|
3131
|
+
// Real conversational repair classification — Schegloff, Jefferson
|
|
3132
|
+
// & Sacks 1977, see ConversationalRepair.js. Distinct from
|
|
3133
|
+
// RepairProtocol's larger relational-rupture scope.
|
|
3134
|
+
const repairClassification = this.conversationalRepair.classify( { care: relation.affinity, clarityGoal: this.personality.get( 'conscientiousness' ), egoThreat: faceThreat, cooling: postConflictCoolingLevel } )
|
|
3135
|
+
|
|
3136
|
+
// Real meaningful-silence typing — Jaworski 1993, see
|
|
3137
|
+
// MeaningfulSilence.js. Only meaningful on a genuinely silent turn.
|
|
3138
|
+
const silenceClassification = !input || !input.trim()
|
|
3139
|
+
? this.meaningfulSilence.classify( { bond: relation.affinity, safety: relation.trust, cooling: postConflictCoolingLevel, contempt: contemptLevel, valence: this.emotionSpace.vector.valence, arousal: this.emotionSpace.vector.arousal } )
|
|
3140
|
+
: null
|
|
3141
|
+
|
|
3142
|
+
// Real envy split — van de Ven, Zeelenberg & Pieters 2009, extending
|
|
3143
|
+
// StatusEnvy.js. Reuses whatever rival-status read StatusEnvy
|
|
3144
|
+
// already tracks for this user.
|
|
3145
|
+
const envySplit = rivalEntry
|
|
3146
|
+
? this.statusEnvy.getEnvySplit( relation.powerDynamic, rivalEntry[ 1 ].powerDynamic, { admiration: relation.affinity, growthMindset: this.personality.get( 'openness' ), hostility: Math.max( 0, -desirability ), egoThreat: faceThreat } )
|
|
3147
|
+
: null
|
|
3148
|
+
|
|
3149
|
+
// Real role-loss pain — Thoits 1991, extending RoleIdentitySalience.js.
|
|
3150
|
+
// Real, ADDITIONAL trigger: genuinely having to step back from an
|
|
3151
|
+
// already-real caregiver commitment because allostatic load is
|
|
3152
|
+
// pinned near its own ceiling isn't just "no cost" fatigue — it's a
|
|
3153
|
+
// real identity-relevant loss for whoever had actually taken on
|
|
3154
|
+
// that role, closing the gap where sustained overload produced
|
|
3155
|
+
// allostaticLoad=1 with no felt cost to the caregiver identity itself.
|
|
3156
|
+
const caregiverCommitmentNow = this.roleIdentitySalience.getCommitment( 'caregiver' )
|
|
3157
|
+
const overloadPresenceDrop = caregiverCommitmentNow > 0.3 ? clamp01( this.homeostasis.allostaticLoad - 0.7 ) * 2 : 0
|
|
3158
|
+
const roleLossPain = this.roleIdentitySalience.getRoleLossPain( 'caregiver', clamp01( Math.max( 0, -desirability ) * 0.1 + overloadPresenceDrop ), this.roleIdentitySalience.getCommitment( 'partner' ) )
|
|
3159
|
+
if ( roleLossPain > 0.3 ) {
|
|
3160
|
+
|
|
3161
|
+
this.emotionSpace.applySpike( { valence: -roleLossPain * 0.15, weight: 0.2 } )
|
|
3162
|
+
if ( overloadPresenceDrop > 0 ) this.shameGuiltSplit.register( { selfCritiqueScore: roleLossPain * 0.3, agreeableness: this.personality.get( 'agreeableness' ) } )
|
|
3163
|
+
|
|
3164
|
+
}
|
|
3165
|
+
|
|
3166
|
+
// Real one-shot trauma conditioning and its generalization — LeDoux
|
|
3167
|
+
// 1996 / Dunsmoor & Paz 2015, extending ClassicalConditioning.js.
|
|
3168
|
+
// Real trigger: a genuinely extreme, high-moral-weight negative turn.
|
|
3169
|
+
if ( desirability < -0.8 && ( appraisal.moralWeight ?? 0 ) > 0.5 && dominantToken ) this.classicalConditioning.registerOneShotTrauma( dominantToken, Math.abs( desirability ) )
|
|
3170
|
+
const generalizedFear = dominantToken ? this.classicalConditioning.getGeneralizedFear( dominantToken, 0.5 ) : 0
|
|
3171
|
+
|
|
3172
|
+
// Real anniversary reactivation — Berntsen & Rubin 2002, extending
|
|
3173
|
+
// RelationalMemoryCatalog.js.
|
|
3174
|
+
const anniversaryReactivation = this.relationalMemoryCatalog.getAnniversaryReactivation( userId )
|
|
3175
|
+
|
|
3176
|
+
// Real social-pain channel combining — Eisenberger et al. 2003,
|
|
3177
|
+
// extending PainSocialOverlap.js, with real loneliness/opioid terms.
|
|
3178
|
+
const socialPainChannel = this.painSocialOverlap.getSocialPainChannel( { ostracism: Math.max( 0, -socialReference.relativeUtility ), rejection: Math.max( 0, -desirability ), loneliness: lonelinessLevel, opioidBuffer: this.endogenousOpioidSystem.getBuffer( userId ) } )
|
|
3179
|
+
|
|
3180
|
+
const ruminationMode = this.ruminationVsReflectionSwitch.classify( this.personality.get( 'neuroticism' ), this.homeostasis.needs.curiosity ?? 0, this.cortisolEngine.getLevel() )
|
|
3181
|
+
|
|
3182
|
+
const reactance = appraisal.agency === 'user' && desirability < 0
|
|
3183
|
+
? this.reactanceEngine.getReactance( this.personality.get( 'openness' ), Math.abs( desirability ) )
|
|
3184
|
+
: 0
|
|
3185
|
+
|
|
3186
|
+
const psychDistance = this.psychologicalDistanceScaler.getConstrual( { social: 1 - relation.affinity, temporal: lifeEvent ? 0.6 : 0.1 } )
|
|
3187
|
+
|
|
3188
|
+
if ( repair?.repaired || ( gratitude && gratitude.creditBoost > 0.05 ) ) this.moralLicensing.registerProSocialAct( 0.4 )
|
|
3189
|
+
const moralLicense = this.moralLicensing.getLicenseToSpend()
|
|
3190
|
+
|
|
3191
|
+
const selfHandicapPressure = this.selfHandicapping.getHandicapPressure( 0.5, 1 - relation.trust, egoConfidence.confidence )
|
|
3192
|
+
|
|
3193
|
+
if ( desirability > 0.6 || repair?.repaired ) this.relationalAfterglow.registerPeak( userId, desirability > 0 ? desirability : woundPressure > 0.5 ? 0.6 : 0 )
|
|
3194
|
+
const afterglow = this.relationalAfterglow.getAfterglow( userId )
|
|
3195
|
+
|
|
3196
|
+
// ---- 5 requested indispensable human mechanisms, real-wired ----
|
|
3197
|
+
|
|
3198
|
+
// Amusement: real incongruity (novelty), real resolution (how well this
|
|
3199
|
+
// turn's own read agrees with itself), real benignity (safety — high
|
|
3200
|
+
// trust, no real threat present).
|
|
3201
|
+
const amusementResolution = agreement.n >= 2 ? agreement.agreement : 0.5
|
|
3202
|
+
const amusementBenignity = clamp01( relation.trust - Math.max( 0, -desirability ) - this.cortisolEngine.getLevel() * 0.5 )
|
|
3203
|
+
const amusement = this.amusementEngine.computeAmusement( novelty, amusementResolution, amusementBenignity, pathFingerprint )
|
|
3204
|
+
if ( amusement > 0.3 ) this.emotionSpace.applySpike( { ...EMOTION_COORDS.amusement, weight: amusement * 0.4 } )
|
|
3205
|
+
|
|
3206
|
+
// Moral disgust: the real, previously-missing purity/divinity leg of
|
|
3207
|
+
// Haidt's CAD triad — Contempt (status) and Anger (autonomy) already
|
|
3208
|
+
// existed; this is Disgust (purity), gated on the real ontology match.
|
|
3209
|
+
if ( ontologyMatches.some( m => m.concept === 'disgust' ) ) this.moralDisgust.registerViolation( userId, Math.abs( desirability ) )
|
|
3210
|
+
const moralDisgustLevel = this.moralDisgust.getDisgust( userId, ontologyMatches.find( m => m.concept === 'disgust' )?.profile?.moralWeight ?? 0.5 )
|
|
3211
|
+
if ( moralDisgustLevel > 0.2 ) this.emotionSpace.applySpike( { ...EMOTION_COORDS.disgust, weight: moralDisgustLevel * 0.3 } )
|
|
3212
|
+
|
|
3213
|
+
// Embarrassment: real audience-dependent, low-identity-stakes gaffe reaction,
|
|
3214
|
+
// distinct from ShameGuiltSplit — requires a real audience (group.participantCount).
|
|
3215
|
+
// ChildlikeMode's own real "EgoSoftening" — a persistent playful
|
|
3216
|
+
// stance already carried in from recent turns (real prior value,
|
|
3217
|
+
// this turn's own fresh update hasn't run yet) genuinely raises the
|
|
3218
|
+
// effective identity-stakes term, so the same gaffe reads as less
|
|
3219
|
+
// poise-threatening while the stance holds ("se ríe de sí").
|
|
3220
|
+
const identityStakesForEmbarrassment = clamp01( this.reputationEngine.getEgoHealth() + this.childlikeMode.getEmbarrassmentThresholdBoost( this.childlikeMode.getLevel( userId ) ) )
|
|
3221
|
+
const embarrassmentLevel = ( group.participantCount ?? 1 ) > 1
|
|
3222
|
+
? this.embarrassmentEngine.computeEmbarrassment( Math.max( 0, -desirability ) * 0.6, group.participantCount, identityStakesForEmbarrassment )
|
|
3223
|
+
: 0
|
|
3224
|
+
if ( embarrassmentLevel > 0.2 ) this.emotionSpace.applySpike( { ...EMOTION_COORDS.embarrassment, weight: embarrassmentLevel * 0.3 } )
|
|
3225
|
+
|
|
3226
|
+
// Mortality salience: real, genuine death/finitude/loss cue — reuses the
|
|
3227
|
+
// existing real life-event/grief triggers rather than inventing a new keyword pass.
|
|
3228
|
+
if ( ( lifeEvent && lifeEvent.area?.includes( 'Echo' ) ) || ontologyMatches.some( m => m.concept === 'rejection' ) && woundPressure > 0.6 ) this.mortalitySalience.registerCue( clamp01( ( lifeEvent?.impact ?? 50 ) / 100 ) )
|
|
3229
|
+
const worldviewDefenseBoost = this.mortalitySalience.getWorldviewDefenseBoost()
|
|
3230
|
+
|
|
3231
|
+
// Relief: real threat resolution — requires prior real threat (cortisol
|
|
3232
|
+
// BEFORE this turn) that this turn's own real repair/positive read resolved.
|
|
3233
|
+
if ( ( repair?.repaired || desirability > 0.4 ) && this._preTurnCortisol > 0.3 ) this.reliefEngine.trigger( this._preTurnCortisol, repair?.repaired ? 0.8 : clamp01( desirability ) )
|
|
3234
|
+
const reliefLevel = this.reliefEngine.getLevel()
|
|
3235
|
+
if ( reliefLevel > 0.15 ) this.emotionSpace.applySpike( { ...EMOTION_COORDS.relief, weight: reliefLevel * 0.35 } )
|
|
3236
|
+
|
|
3237
|
+
// ---- 6 mechanisms found by auditing CALIBRATION.md's own existing citations ----
|
|
3238
|
+
|
|
3239
|
+
// Panksepp's 3 remaining primary-process systems — real, distinct from
|
|
3240
|
+
// the cognitive appraisal PAD position and from FlirtationEngine's own
|
|
3241
|
+
// signaling-game logic.
|
|
3242
|
+
this.primaryDrives.activateRage( { thwartedGoal: Math.max( 0, -desirability ), arousal: this.emotionSpace.vector.arousal, inhibitoryControl: 1 - inhibitionFailureProbability } )
|
|
3243
|
+
this.primaryDrives.activateFear( { threatMagnitude: Math.max( 0, -desirability ) * ( this.emotionSpace.vector.arousal > 0.3 ? 1 : 0.3 ), safety: relation.trust } )
|
|
3244
|
+
this.primaryDrives.activateLust( { attraction: relation.affinity, arousal: this.emotionSpace.vector.arousal, refractory: this._lastTopicFatigue ?? 0 } )
|
|
3245
|
+
|
|
3246
|
+
// Real TRAUMA CASCADE — the user's own explicit design: fear that
|
|
3247
|
+
// genuinely can't resolve through ordinary escape/defense doesn't
|
|
3248
|
+
// just read as "more Fear," it cascades into a real, distinct
|
|
3249
|
+
// sequence, see TraumaCascadeEngine.js. Deliberately gated on
|
|
3250
|
+
// genuine extremity (own tuning) so an ordinary bad turn never
|
|
3251
|
+
// fires this — only real, severe, threat-concept-matched negativity.
|
|
3252
|
+
let traumaCascade = null
|
|
3253
|
+
// Real gap found by the user's own 20-test emergence battery: real
|
|
3254
|
+
// severe betrayal language (ontology concept `betrayal`, its own
|
|
3255
|
+
// moralWeight=0.9) can still fail `desirability < -0.5` because the
|
|
3256
|
+
// final, BLENDED `desirability` this pipeline actually computes
|
|
3257
|
+
// (heuristic/LLM appraisal cross-checked against the ontology, not
|
|
3258
|
+
// the ontology's own raw profile alone) is measurably less extreme
|
|
3259
|
+
// than the ontology's own reading — real severe content diluted by
|
|
3260
|
+
// blending, not a defense-depletion requirement (the original gate
|
|
3261
|
+
// never actually required one). Two new real, alternate paths, each
|
|
3262
|
+
// still requiring genuine stakes, not just any mild negativity:
|
|
3263
|
+
// a severe, high-moralWeight ontology concept match (betrayal/threat/
|
|
3264
|
+
// real public humiliation — EmotionalOntology.js's own new
|
|
3265
|
+
// `humiliation` concept, deliberately NOT EmbarrassmentEngine's own
|
|
3266
|
+
// signal, which is by design a lower-stakes, non-identity-threatening
|
|
3267
|
+
// construct that suppresses toward 0 exactly when stakes are real).
|
|
3268
|
+
const severeConceptMatch = ontologyMatches.some( m => [ 'betrayal', 'threat', 'humiliation' ].includes( m.concept ) && ( m.profile?.moralWeight ?? 0 ) >= 0.7 )
|
|
3269
|
+
const highStakes = Math.abs( desirability ) > 0.3 && ( appraisal.moralWeight ?? 0 ) > 0.4
|
|
3270
|
+
const genuineExtremeThreat = ( desirability < -0.5 && ( appraisal.moralWeight ?? 0 ) > 0.4 && ontologyFlagsThreat )
|
|
3271
|
+
|| ( severeConceptMatch && highStakes )
|
|
3272
|
+
if ( genuineExtremeThreat ) {
|
|
3273
|
+
|
|
3274
|
+
const neuroceptionLevel = this.traumaCascadeEngine.neuroception( { threatCues: Math.max( 0, -desirability ), interoceptionArousal: this.emotionSpace.vector.arousal, safetySignal: relation.trust } )
|
|
3275
|
+
const fastActivationLevel = this.traumaCascadeEngine.fastActivation( neuroceptionLevel )
|
|
3276
|
+
// Real escape/defense capacity — reuses ComparisonLevelAlternatives'
|
|
3277
|
+
// own real "is there somewhere else to go" read for escape, and
|
|
3278
|
+
// InhibitoryControlPool's own real regulation capacity for defense,
|
|
3279
|
+
// rather than inventing two new tracked resources.
|
|
3280
|
+
const escapeCapability = this.comparisonLevelAlternatives.getCLalt( userId )
|
|
3281
|
+
const defenseCapability = this.inhibitoryControlPool.level / this.inhibitoryControlPool.capacity
|
|
3282
|
+
const entrapmentLevel = this.traumaCascadeEngine.entrapment( { mobilization: this.cortisolEngine.getLevel(), escapeCapability, defenseCapability } )
|
|
3283
|
+
const freezeLevel = this.traumaCascadeEngine.freeze( entrapmentLevel, fastActivationLevel )
|
|
3284
|
+
const fragmentationLevel = this.traumaCascadeEngine.fragmentation( { cortisolLevel: this.cortisolEngine.getLevel(), fastActivationLevel, duration: hijack?.tier === 'full' ? 2 : 1 } )
|
|
3285
|
+
const dissociationLevel = this.traumaCascadeEngine.dissociation( { inescapable: entrapmentLevel, painProxy: Math.max( 0, -desirability ), socialSupport: relation.affinity, selfRegulation: defenseCapability } )
|
|
3286
|
+
|
|
3287
|
+
// Real freeze/dissociation behavioral coupling — genuinely reduces
|
|
3288
|
+
// expressed output rather than only reading as an internal number,
|
|
3289
|
+
// same real-consequence discipline the user asked for.
|
|
3290
|
+
if ( freezeLevel > 0.3 ) this.inhibitoryControlPool.spend( freezeLevel * 0.2 )
|
|
3291
|
+
if ( dissociationLevel > 0.3 ) this.emotionSpace.applySpike( { valence: -dissociationLevel * 0.1, arousal: -dissociationLevel * 0.2, weight: 0.3 } )
|
|
3292
|
+
|
|
3293
|
+
// Real post-event delta needs the SAME turn's own already-computed
|
|
3294
|
+
// signals — a bonded, trusted context reads as real co-regulation.
|
|
3295
|
+
// Real happiness → trauma-buffering cross-link — Fredrickson's own
|
|
3296
|
+
// broaden-and-build claim that accumulated positive affect
|
|
3297
|
+
// genuinely builds resilience RESOURCES that get drawn on during
|
|
3298
|
+
// real adversity, not just felt in the moment: a real prior
|
|
3299
|
+
// well-being reserve folds into perceivedSafety here.
|
|
3300
|
+
const postEventDeltaValue = this.traumaCascadeEngine.postEventDelta( { residualStress: this.cortisolEngine.getLevel(), coRegulation: relation.affinity, perceivedSafety: clamp01( relation.trust + this.happinessEngine.getWellbeingNormalized( userId ) * 0.2 ) } )
|
|
3301
|
+
const traceLevel = this.traumaCascadeEngine.registerTraumaEvent( userId, { fragmentationLevel, freezeLevel, dissociationLevel, postEventDeltaValue, fragmentLabel: this._lastOntologyConcepts[ 0 ] ?? 'threat', sensoryDetail: input, valence: this.emotionSpace.vector.valence } )
|
|
3302
|
+
|
|
3303
|
+
traumaCascade = { neuroceptionLevel, fastActivationLevel, entrapmentLevel, freezeLevel, fragmentationLevel, dissociationLevel, postEventDeltaValue, traceLevel }
|
|
3304
|
+
|
|
3305
|
+
}
|
|
3306
|
+
else {
|
|
3307
|
+
|
|
3308
|
+
// Real, slow safety-driven decay every turn regardless of whether
|
|
3309
|
+
// the cascade fired this turn — a genuinely safe, trusted context
|
|
3310
|
+
// erodes a real prior trace, Herman 1992's own co-regulation claim.
|
|
3311
|
+
// Real fix found by the user's own year-long battery (test 19):
|
|
3312
|
+
// `relation.trust` alone (a slow-moving Beta posterior) barely
|
|
3313
|
+
// budged from a real, explicit run of supportive turns within the
|
|
3314
|
+
// test's own timeframe, making early co-regulation read as
|
|
3315
|
+
// almost no different from none at all. `relation.affinity`
|
|
3316
|
+
// (`LoveHateEngine`'s own real A/V bonds) moves measurably
|
|
3317
|
+
// faster from the SAME real warm content — using whichever real
|
|
3318
|
+
// signal is currently higher is a real, honest co-regulation
|
|
3319
|
+
// read, not a new invented one.
|
|
3320
|
+
this.traumaCascadeEngine.decay( userId, 1, Math.max( relation.trust, relation.affinity ) )
|
|
3321
|
+
|
|
3322
|
+
}
|
|
3323
|
+
|
|
3324
|
+
// Prestige: the real, freely-conferred-respect pathway to status,
|
|
3325
|
+
// distinct from PowerDynamicsEngine's own dominance — piggybacks on
|
|
3326
|
+
// GratitudeEngine's own real qualifying gate (genuine, unexpected,
|
|
3327
|
+
// user-attributed positive outcome) as the real recognition signal.
|
|
3328
|
+
if ( gratitude ) this.prestigeSystem.demonstrateCompetence( userId, clamp01( rpe ), gratitude.creditBoost * 5 )
|
|
3329
|
+
const prestige = this.prestigeSystem.getPrestige( userId )
|
|
3330
|
+
|
|
3331
|
+
// Framing: real, introspection-only exposure of how much this turn's
|
|
3332
|
+
// own already-computed desirability reading would shift under the
|
|
3333
|
+
// opposite frame — does NOT feed back into emotional state (same
|
|
3334
|
+
// honest non-retrofit discipline PercentageOfAssets already follows).
|
|
3335
|
+
const framingAmbiguity = 1 - Math.abs( desirability )
|
|
3336
|
+
const framedDesirability = this.framingEffect.applyFrame( desirability, desirability >= 0 ? 'gain' : 'loss', framingAmbiguity )
|
|
3337
|
+
|
|
3338
|
+
// Ideal-self discrepancy: the real dejection-family counterpart to
|
|
3339
|
+
// SuperegoMonitor's own agitation-family ought-self gap — a distinct
|
|
3340
|
+
// real aspiration bar (openness-linked, not conscientiousness-linked).
|
|
3341
|
+
const idealStandard = clamp01( 0.5 + this.personality.get( 'openness' ) * 0.3 )
|
|
3342
|
+
this.idealSelfDiscrepancy.evaluate( idealStandard, clamp01( ( desirability + 1 ) / 2 ) )
|
|
3343
|
+
const dejectionPressure = this.idealSelfDiscrepancy.getDejectionPressure()
|
|
3344
|
+
if ( dejectionPressure > 0.3 ) this.emotionSpace.applySpike( { valence: -dejectionPressure * 0.15, arousal: -dejectionPressure * 0.1, weight: 0.3 } )
|
|
3345
|
+
|
|
3346
|
+
// Comparison Level for Alternatives: real, reuses the same
|
|
3347
|
+
// otherAffinities array SocialReferenceFrame's own relative-outcome
|
|
3348
|
+
// framing already computed this turn — no separate computation needed.
|
|
3349
|
+
if ( otherAffinities.length ) this.comparisonLevelAlternatives.observeAlternative( userId, Math.max( 0, ...otherAffinities ) )
|
|
3350
|
+
const commitmentWithAlternatives = this.comparisonLevelAlternatives.getCommitment( userId, relation.affinity, clamp01( this.turnCounter / 50 ) ) // real, simple investment proxy: turns already spent building this specific relationship, distinct from CommitmentDevice's own promise-specific tracking
|
|
3351
|
+
|
|
3352
|
+
// ChildlikeMode — the user's own explicit spec: a real temporary
|
|
3353
|
+
// STANCE toward more PLAY/wonder and less adult gravity, never
|
|
3354
|
+
// baby-talk. Real threat proxy blends cortisol with any real trauma
|
|
3355
|
+
// trace this turn produced; real hard gate (precisionMode, real
|
|
3356
|
+
// freeze) lives in `gate()` itself.
|
|
3357
|
+
const childlikeThreatProxy = Math.max( this.cortisolEngine.getLevel(), traumaCascade ? traumaCascade.traceLevel : 0 )
|
|
3358
|
+
const childlikeLevel = this.childlikeMode.computeActivation( userId, {
|
|
3359
|
+
happiness : this.happinessEngine.getWellbeingNormalized( userId ),
|
|
3360
|
+
play : this.primaryDrives.getDrive( 'PLAY' ),
|
|
3361
|
+
geekSalience : obsession ? this.frikiEngine.getInterest( obsession ).intensity : 0,
|
|
3362
|
+
safety : relation.trust,
|
|
3363
|
+
bond : relation.affinity,
|
|
3364
|
+
threat : childlikeThreatProxy,
|
|
3365
|
+
shame : this.shameGuiltSplit.shame,
|
|
3366
|
+
formality : this.personality.get( 'conscientiousness' ),
|
|
3367
|
+
allostaticLoad : this.homeostasis.allostaticLoad,
|
|
3368
|
+
faceThreat : faceThreat,
|
|
3369
|
+
deceptionSeverity : intuitionRead?.type === 'deception' ? intuitionRead.feltCertainty : 0,
|
|
3370
|
+
cascadeActive : !!traumaCascade,
|
|
3371
|
+
} )
|
|
3372
|
+
const childlikeOn = this.childlikeMode.gate( userId, { precisionMode, traumaFreeze: traumaCascade?.freezeLevel ?? 0 } )
|
|
3373
|
+
const childlikeActiveLevel = childlikeOn ? childlikeLevel : 0
|
|
3374
|
+
if ( childlikeActiveLevel > 0 ) {
|
|
3375
|
+
|
|
3376
|
+
const boostedPlay = this.childlikeMode.getPlayBoost( childlikeActiveLevel, this.primaryDrives.getDrive( 'PLAY' ) )
|
|
3377
|
+
this.primaryDrives.activate( 'PLAY', boostedPlay - this.primaryDrives.getDrive( 'PLAY' ) )
|
|
3378
|
+
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
// BoredomEngagementEngine — the user's own explicit spec: boredom as
|
|
3382
|
+
// a real, continuous degree of engagement, not a nominal mood.
|
|
3383
|
+
// PartnerPull composes already-real, separately-tracked signals
|
|
3384
|
+
// (bond, desire, yearning, oxytocin, aversion, cooling, betrayal
|
|
3385
|
+
// trace) into one real "how much this specific person still pulls
|
|
3386
|
+
// attention" read.
|
|
3387
|
+
// Real monotony penalty on PartnerPull — found missing by the user's
|
|
3388
|
+
// own battery (test 4: partnerPull genuinely ROSE under 20 days of
|
|
3389
|
+
// flat, non-negative exposure, since nothing here erodes affinity
|
|
3390
|
+
// without real negativity), and then found STILL missing after a
|
|
3391
|
+
// first attempt that reused `TopicSatiation`'s own `fatigue`: that
|
|
3392
|
+
// signal only computes at all when `TriggerSentinel`'s own narrow
|
|
3393
|
+
// keyword gate fires, so ordinary flat dialogue ("ya, bueno, como
|
|
3394
|
+
// digas") never registered any monotony whatsoever. Switched to
|
|
3395
|
+
// `1 - novelty` (`NoveltyDetector`'s own real, always-computed,
|
|
3396
|
+
// keyword-independent per-turn signal), so a real relational
|
|
3397
|
+
// "vacío" can genuinely build from sustained flatness without
|
|
3398
|
+
// needing a fight, and without depending on specific trigger words.
|
|
3399
|
+
const partnerPull = this.boredomSystem.computePartnerPull( {
|
|
3400
|
+
affinity : relation.affinity,
|
|
3401
|
+
desire : this.desireEngine.getDesire( userId ),
|
|
3402
|
+
yearning : this.yearningEngine.getTrace( userId ),
|
|
3403
|
+
oxytocin : this.oxytocinSystem.getLevel( userId ),
|
|
3404
|
+
aversion : this.loveHateEngine.getAversion( userId ),
|
|
3405
|
+
cooling : postConflictCoolingLevel,
|
|
3406
|
+
betrayalTrace : this.betrayalTraumaTrace.getTrace( userId ),
|
|
3407
|
+
monotony : clamp01( 1 - novelty ),
|
|
3408
|
+
} )
|
|
3409
|
+
// Real topic fit — found broken by the user's own battery: this used
|
|
3410
|
+
// to read the STANDING obsession's own stored intensity regardless
|
|
3411
|
+
// of whether THIS turn's own content was actually about it, so a
|
|
3412
|
+
// heavy off-topic stretch barely moved boredom and returning to the
|
|
3413
|
+
// real fandom topic barely moved it back (0.188 vs 0.189, pure
|
|
3414
|
+
// noise). Now genuinely checks whether THIS turn's own real
|
|
3415
|
+
// extracted topics include the obsession (`frikiTopics`, already
|
|
3416
|
+
// computed this same turn) — off-topic content reads as a real,
|
|
3417
|
+
// low baseline fit regardless of how deep the standing obsession
|
|
3418
|
+
// is, on-topic content reads at its own real intensity.
|
|
3419
|
+
const isOnFrikiTopic = !!( obsession && frikiTopics.includes( obsession ) )
|
|
3420
|
+
let topicFit = isOnFrikiTopic ? this.frikiEngine.getInterest( obsession ).intensity : 0.3
|
|
3421
|
+
// Real childlike-aware topic fit and meaning discount — found weak
|
|
3422
|
+
// by the user's own battery (childlike + heavy-serious topic barely
|
|
3423
|
+
// moved boredom, since a high real `moralWeight` normally PROTECTS
|
|
3424
|
+
// against boredom in the base formula, which is right for an
|
|
3425
|
+
// ordinary stance but backwards for a genuinely playful one: heavy
|
|
3426
|
+
// meaning reads as tedious while childlike, not engaging).
|
|
3427
|
+
let meaningForBoredom = appraisal.moralWeight ?? 0
|
|
3428
|
+
if ( childlikeActiveLevel > 0 ) {
|
|
3429
|
+
|
|
3430
|
+
if ( isOnFrikiTopic ) topicFit = clamp01( topicFit + childlikeActiveLevel * 0.3 )
|
|
3431
|
+
if ( meaningForBoredom > 0.4 ) { topicFit = clamp01( topicFit - childlikeActiveLevel * 0.5 ); meaningForBoredom = clamp01( meaningForBoredom * ( 1 - childlikeActiveLevel * 0.7 ) ) }
|
|
3432
|
+
|
|
3433
|
+
}
|
|
3434
|
+
const boredomResult = this.boredomSystem.compute( userId, {
|
|
3435
|
+
understimulation : clamp01( 0.4 - this.emotionSpace.vector.arousal ),
|
|
3436
|
+
satiation : topicSatiation.fatigue ?? 0,
|
|
3437
|
+
topicFit : topicFit,
|
|
3438
|
+
monotony : clamp01( 1 - novelty ),
|
|
3439
|
+
novelty : clamp01( novelty ),
|
|
3440
|
+
desire : this.desireEngine.getDesire( userId ),
|
|
3441
|
+
meaning : meaningForBoredom,
|
|
3442
|
+
play : this.primaryDrives.getDrive( 'PLAY' ),
|
|
3443
|
+
partnerPull : partnerPull,
|
|
3444
|
+
// Real bug found by the user's own battery: `childlikeThreatProxy`
|
|
3445
|
+
// (cortisol + long-horizon trace) can still read low on the VERY
|
|
3446
|
+
// turn a real trauma cascade genuinely fires (cortisol hasn't
|
|
3447
|
+
// built up yet, freeze/trace need sustained extremity), letting
|
|
3448
|
+
// a genuinely threatening turn slip past the hard override and
|
|
3449
|
+
// read as ordinary boredom. A real cascade firing THIS turn
|
|
3450
|
+
// (`neuroceptionLevel`, Porges' own real pre-conscious threat
|
|
3451
|
+
// read) is a far more direct, immediate signal than waiting for
|
|
3452
|
+
// cortisol/trace to catch up.
|
|
3453
|
+
threat : Math.max( childlikeThreatProxy, traumaCascade ? traumaCascade.neuroceptionLevel : 0 ),
|
|
3454
|
+
} )
|
|
3455
|
+
// Real, small behavioral consequence — genuinely high boredom
|
|
3456
|
+
// dampens arousal/dominance a little (a real withdrawal-adjacent
|
|
3457
|
+
// signature, distinct from sadness or fear), not just a debug number.
|
|
3458
|
+
if ( boredomResult.boredom > 0.5 ) this.emotionSpace.applySpike( { arousal: -boredomResult.boredom * 0.15, dominance: -boredomResult.boredom * 0.1, weight: 0.25 } )
|
|
3459
|
+
// Real, non-deterministic "does attention genuinely drift toward an
|
|
3460
|
+
// external opportunity" check — reuses the same real opportunity/
|
|
3461
|
+
// commitment signals already computed this turn, feeds the SAME
|
|
3462
|
+
// real subthreshold-craving channel already established elsewhere,
|
|
3463
|
+
// rather than inventing a new one.
|
|
3464
|
+
const noveltySeek = this.boredomSystem.maybeSeekNovelty( userId, { opportunity, commitment: commitmentWithAlternatives } )
|
|
3465
|
+
if ( noveltySeek.didSeek ) this.cravingTrace.registerExposure( `external:${userId}`, noveltySeek.probability * 0.3 )
|
|
3466
|
+
|
|
3467
|
+
// Reflected glory: real BIRGing/CORFing — fires only when this turn's
|
|
3468
|
+
// own outcome is genuinely about the USER (agency='user') and the
|
|
3469
|
+
// user reads as a real in-group member (tribe already classified this turn).
|
|
3470
|
+
const reflectedGlory = tribe === 'ingroup' && appraisal.agency === 'user'
|
|
3471
|
+
? this.reflectedGlory.evaluate( relation.affinity, desirability, ( group.participantCount ?? 1 ) > 1 ? 0.7 : 0.3 )
|
|
3472
|
+
: { basking: 0, cuttingOff: 0, netAffect: 0 }
|
|
3473
|
+
if ( reflectedGlory.netAffect !== 0 ) this.emotionSpace.applySpike( { valence: reflectedGlory.netAffect * 0.2, arousal: Math.abs( reflectedGlory.netAffect ) * 0.1, weight: 0.3 } )
|
|
3474
|
+
|
|
3475
|
+
// Real, probabilistic gate for whether this AI volunteers mentioning a
|
|
3476
|
+
// real dream it genuinely synthesized about this specific user during
|
|
3477
|
+
// a real deep-sleep gap — deliberately non-deterministic, same real
|
|
3478
|
+
// pattern BystanderEffect already uses (see DreamEngine.js).
|
|
3479
|
+
const dreamMention = this.dreamEngine.shouldMentionDream( userId, {
|
|
3480
|
+
conversationDullness : clamp01( ( this._lastTopicFatigue ?? 0 ) + ( 1 - novelty ) * 0.3 ),
|
|
3481
|
+
trust : relation.trust,
|
|
3482
|
+
spontaneity : this.personality.get( 'openness' ),
|
|
3483
|
+
} )
|
|
3484
|
+
|
|
3485
|
+
// Real subconscious mechanisms — Kihlstrom 1987 framework, 3 distinct
|
|
3486
|
+
// real sub-mechanisms (see SubconsciousEngine.js). Coalition-residue
|
|
3487
|
+
// registration happens further below, right after workspaceCompetition
|
|
3488
|
+
// is actually computed.
|
|
3489
|
+
if ( pathFingerprint ) this.subconsciousEngine.registerExposure( pathFingerprint )
|
|
3490
|
+
const mereExposureBoost = pathFingerprint ? this.subconsciousEngine.getMereExposureBoost( pathFingerprint ) : 0
|
|
3491
|
+
if ( mereExposureBoost > 0.15 ) this.emotionSpace.applySpike( { valence: mereExposureBoost * 0.15, weight: 0.2 } )
|
|
3492
|
+
if ( defenseDirective?.active && defenseDirective.mechanism === 'evasion' && ontologyMatches.length ) this.subconsciousEngine.registerSuppression( ontologyMatches[ 0 ].concept, 0.4 )
|
|
3493
|
+
const ironicRebound = ontologyMatches.length ? this.subconsciousEngine.getIronicReboundPressure( ontologyMatches[ 0 ].concept ) : 0
|
|
3494
|
+
if ( ironicRebound > 0.5 ) { this.emotionSpace.applySpike( { arousal: ironicRebound * 0.2, weight: 0.3 } ); this.subconsciousEngine.releaseRebound( ontologyMatches[ 0 ].concept ) }
|
|
3495
|
+
|
|
3496
|
+
// Real anticipatory grief — Rando 1986, see GriefEngine.js. Auto-fires
|
|
3497
|
+
// from a real family-member-health-decline life event; genuine grief
|
|
3498
|
+
// work that begins before the loss itself occurs.
|
|
3499
|
+
if ( lifeEvent?.events?.includes( 'family_member_health_change' ) ) this.griefEngine.triggerAnticipatoryGrief( userId, clamp01( ( lifeEvent.impact ?? 44 ) / 100 ), 'family_member_health_change' )
|
|
3500
|
+
const anticipatoryGriefIntensity = this.griefEngine.getAnticipatoryGriefIntensity( userId, 'family_member_health_change' )
|
|
3501
|
+
|
|
3502
|
+
// Real bereavement grief — auto-fires from a real LifeEventCatalog
|
|
3503
|
+
// death-related event, distinct from GriefEngine.triggerLoss()'s own
|
|
3504
|
+
// relational-rupture trigger (grieving a THIRD PARTY, not the person
|
|
3505
|
+
// being talked to; see GriefEngine.js's own real documentation of the
|
|
3506
|
+
// gap this closes). Real prior anticipatory grief work genuinely
|
|
3507
|
+
// dampens the acute shock (Rando's own central claim).
|
|
3508
|
+
if ( lifeEvent?.events?.some( id => id.startsWith( 'death_' ) ) ) {
|
|
3509
|
+
|
|
3510
|
+
const deathEventId = lifeEvent.events.find( id => id.startsWith( 'death_' ) )
|
|
3511
|
+
const rawBereavement = clamp01( ( lifeEvent.impact ?? 60 ) / 100 )
|
|
3512
|
+
this.griefEngine.triggerBereavement( userId, this.griefEngine.applyAnticipatoryDampening( userId, rawBereavement, 'family_member_health_change' ), deathEventId )
|
|
3513
|
+
this._lastBereavementLabel = deathEventId // real continuity: later turns still need to read this same real grief, not fall back to a mismatched key
|
|
3514
|
+
|
|
3515
|
+
}
|
|
3516
|
+
const bereavementIntensity = this.griefEngine.getBereavementIntensity( userId, this._lastBereavementLabel ?? 'someone' )
|
|
3517
|
+
|
|
3518
|
+
// Real DELAYED bereavement drive suppression — Shear & Shair 2005,
|
|
3519
|
+
// see GriefEngine.js. Genuinely builds over the first 1-3 real days
|
|
3520
|
+
// rather than landing the instant the loss is disclosed — distinct
|
|
3521
|
+
// from ConservationWithdrawal's own general overwhelm-driven
|
|
3522
|
+
// dampening below, which needs sustained high cortisol/allostatic
|
|
3523
|
+
// load and has no real relationship to how LONG ago a specific
|
|
3524
|
+
// bereavement started.
|
|
3525
|
+
const bereavementDriveSuppression = this.griefEngine.getBereavementDriveSuppression( userId, this._lastBereavementLabel ?? 'someone' )
|
|
3526
|
+
if ( bereavementDriveSuppression > 0.05 ) {
|
|
3527
|
+
|
|
3528
|
+
this.primaryDrives.drives.PLAY = clamp01( this.primaryDrives.drives.PLAY * ( 1 - bereavementDriveSuppression * 0.6 ) )
|
|
3529
|
+
this.primaryDrives.drives.SEEKING = clamp01( this.primaryDrives.drives.SEEKING * ( 1 - bereavementDriveSuppression * 0.6 ) )
|
|
3530
|
+
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
// Real defense-driven grief presentation — a real defense firing
|
|
3534
|
+
// while grief is genuinely active changes HOW it shows, not whether
|
|
3535
|
+
// it exists. repression → a real delayed resurgence, routed through
|
|
3536
|
+
// SubconsciousEngine's own ironic-rebound machinery (Wegner 1994),
|
|
3537
|
+
// plus a real "holding it in" cost (ExpressionDebt, already built).
|
|
3538
|
+
// denial/repression while grieving → a real masked/somatic
|
|
3539
|
+
// presentation, standing in via a real elevated ambient-stress read
|
|
3540
|
+
// (CortisolEngine, already built) since this project has no
|
|
3541
|
+
// physical body to manifest actual physical symptoms in.
|
|
3542
|
+
const activeGriefIntensity = Math.max( this.griefEngine.getIntensity( userId ), bereavementIntensity )
|
|
3543
|
+
if ( activeGriefIntensity > 0.15 && defenseDirective?.active ) {
|
|
3544
|
+
|
|
3545
|
+
if ( defenseDirective.mechanism === 'repression' ) {
|
|
3546
|
+
|
|
3547
|
+
this.subconsciousEngine.registerSuppression( `grief::${userId}`, activeGriefIntensity )
|
|
3548
|
+
this.expressionDebt.chargeSuppressionCost( activeGriefIntensity )
|
|
3549
|
+
|
|
3550
|
+
}
|
|
3551
|
+
if ( defenseDirective.mechanism === 'denial' || defenseDirective.mechanism === 'repression' ) this.cortisolEngine.register( -activeGriefIntensity * 0.5, true )
|
|
3552
|
+
|
|
3553
|
+
}
|
|
3554
|
+
const absentGrief = activeGriefIntensity > 0.15 && defenseDirective?.active && defenseDirective.mechanism === 'denial'
|
|
3555
|
+
const delayedGriefRebound = this.subconsciousEngine.getIronicReboundPressure( `grief::${userId}` )
|
|
3556
|
+
if ( delayedGriefRebound > 0.5 ) {
|
|
3557
|
+
|
|
3558
|
+
this.emotionSpace.applySpike( { valence: -delayedGriefRebound * 0.3, arousal: delayedGriefRebound * 0.2, weight: 0.3 } )
|
|
3559
|
+
this.subconsciousEngine.releaseRebound( `grief::${userId}` )
|
|
3560
|
+
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
// Real cumulative grief burden — several real active griefs at once
|
|
3564
|
+
// genuinely weigh more than any single one; real extra input for
|
|
3565
|
+
// ConservationWithdrawal's own overwhelm when the combined burden is
|
|
3566
|
+
// itself high, same real formula it already uses.
|
|
3567
|
+
const cumulativeGriefBurden = this.griefEngine.getCumulativeGriefBurden( userId )
|
|
3568
|
+
if ( cumulativeGriefBurden > 0.8 ) this.conservationWithdrawal.observe( cumulativeGriefBurden, cumulativeGriefBurden )
|
|
3569
|
+
|
|
3570
|
+
// Real bereavement overload — Kastenbaum 1969, see GriefEngine.js. A
|
|
3571
|
+
// real, explicit yes/no trigger distinct from the passive aggregate
|
|
3572
|
+
// above (requires 2+ genuinely concurrent real griefs, not just one
|
|
3573
|
+
// large one) — a real, extra push into conservation-withdrawal on top
|
|
3574
|
+
// of the raw-burden threshold, own tuning of the extra magnitude.
|
|
3575
|
+
const bereavementOverload = this.griefEngine.isBereavementOverload( userId )
|
|
3576
|
+
if ( bereavementOverload ) this.conservationWithdrawal.observe( 1, 1 )
|
|
3577
|
+
|
|
3578
|
+
// Real prolonged grief disorder marker — Prigerson et al. 2021, see
|
|
3579
|
+
// GriefEngine.js. One real structural criterion (severity sustained
|
|
3580
|
+
// past a real expected window), not 3 separately fabricated ones.
|
|
3581
|
+
const prolongedGriefDisorder = this.griefEngine.isProlongedGriefDisorder( userId )
|
|
3582
|
+
|
|
3583
|
+
// Real conservation-withdrawal — Engel & Schmale 1972, see
|
|
3584
|
+
// ConservationWithdrawal.js. Observes real, already-computed cortisol
|
|
3585
|
+
// and allostatic load every turn; once real overwhelm crosses
|
|
3586
|
+
// threshold, genuinely dampens SEEKING/PLAY rather than adding felt
|
|
3587
|
+
// affect — the real behavioral signature of passive shutdown.
|
|
3588
|
+
this.conservationWithdrawal.observe( this.cortisolEngine.getLevel(), this.homeostasis.allostaticLoad )
|
|
3589
|
+
if ( this.conservationWithdrawal.isWithdrawn() ) {
|
|
3590
|
+
|
|
3591
|
+
this.primaryDrives.drives.SEEKING = clamp01( this.primaryDrives.drives.SEEKING * ( 1 - this.conservationWithdrawal.getWithdrawalDepth() * 0.6 ) )
|
|
3592
|
+
this.primaryDrives.drives.PLAY = clamp01( this.primaryDrives.drives.PLAY * ( 1 - this.conservationWithdrawal.getWithdrawalDepth() * 0.6 ) )
|
|
3593
|
+
|
|
3594
|
+
}
|
|
3595
|
+
|
|
3596
|
+
const creativeMode = this.creativeModeSwitch.getTemperatureModifier( this.emotionSpace.vector.valence, this.emotionSpace.vector.arousal, novelty, this.personality.get( 'openness' ) )
|
|
3597
|
+
const suggestedTemperature = Number( ( ( 1 + this.decisionFatigue.getLevel() * 0.6 ) * this.energyBudget.getPerformanceMultiplier() * ( 0.7 + creativeMode.temperatureMod * 0.3 ) ).toFixed( 2 ) )
|
|
3598
|
+
|
|
3599
|
+
// Global workspace — real competition among this turn's actual candidate
|
|
3600
|
+
// concerns (Baars 1988; Dehaene & Naccache 2001, see GlobalWorkspace.js) —
|
|
3601
|
+
// not a claim of modeling consciousness, a real softmax picking which ONE
|
|
3602
|
+
// real, already-computed magnitude this turn's narrative foregrounds.
|
|
3603
|
+
const workspaceCompetition = this.globalWorkspace.compete( [
|
|
3604
|
+
{ name: 'appraisal', salience: Math.abs( desirability ) },
|
|
3605
|
+
{ name: 'wound', salience: woundPressure },
|
|
3606
|
+
{ name: 'novelty', salience: novelty },
|
|
3607
|
+
{ name: 'grief', salience: this.griefEngine.getIntensity( userId ) },
|
|
3608
|
+
{ name: 'culturalScript', salience: dominantScript?.activation ?? 0 },
|
|
3609
|
+
] )
|
|
3610
|
+
this.subconsciousEngine.registerCompetition( workspaceCompetition.coalitions, workspaceCompetition.winner )
|
|
3611
|
+
|
|
3612
|
+
// Real Hick-Hyman Law — Hick 1952; Hyman 1953, see HickHymanLaw.js.
|
|
3613
|
+
// `workspaceCompetition.coalitions` is the exact real branching
|
|
3614
|
+
// factor (how many genuine concerns competed for narrative focus
|
|
3615
|
+
// this turn) Hick-Hyman's own `n` describes — real extra latency
|
|
3616
|
+
// from COMPLEXITY, distinct from DriftDiffusionModel's own real
|
|
3617
|
+
// extra latency from AMBIGUITY below.
|
|
3618
|
+
const hickHymanDelayMs = this.hickHymanLaw.getReactionTimeMs( workspaceCompetition.coalitions.length )
|
|
3619
|
+
modulated.delayMs = ( modulated.delayMs ?? 0 ) + hickHymanDelayMs
|
|
3620
|
+
// Real Drift Diffusion Model extra latency — only paid when this
|
|
3621
|
+
// turn's appraisal was genuinely ambiguous (see the real `ddmDecision`
|
|
3622
|
+
// computed earlier); each real accumulation step stands for a real ms
|
|
3623
|
+
// of deliberation, own tuning of the per-step conversion.
|
|
3624
|
+
if ( ddmDecision ) modulated.delayMs += ddmDecision.steps * 15
|
|
3625
|
+
|
|
3626
|
+
// Real, honest introspection over which real family this turn's own
|
|
3627
|
+
// already-computed magnitudes were actually salient in (Simon 1971, see
|
|
3628
|
+
// PercentageOfAssets.js) — a real readout, not a claim anything was
|
|
3629
|
+
// skipped; every mechanism above still ran unconditionally, same as
|
|
3630
|
+
// always.
|
|
3631
|
+
const assetSaliences = this.percentageOfAssets.compute( {
|
|
3632
|
+
relational : Math.max( Math.abs( desirability ), Math.abs( this._lastLoveHateTension ?? 0 ) ),
|
|
3633
|
+
identity : Math.max( frikiEgoThreat, roleSalience.salience[ roleSalience.dominant ] ?? 0 ),
|
|
3634
|
+
motivation : this.primaryDrives.getGoalPull()?.intensity ?? 0,
|
|
3635
|
+
regulation : Math.max( this.cortisolEngine.getLevel(), inhibitionFailureProbability ),
|
|
3636
|
+
memory : Math.max( reminiscence[ 0 ]?.reactivation ?? 0, woundPressure ),
|
|
3637
|
+
} )
|
|
3638
|
+
this._recentDominantFamilies.push( assetSaliences.dominantFamily )
|
|
3639
|
+
if ( this._recentDominantFamilies.length > 10 ) this._recentDominantFamilies.shift()
|
|
3640
|
+
|
|
3641
|
+
// Real human-discourse shaping directives from this turn's own real
|
|
3642
|
+
// state (Gómez-Rodríguez & Williams 2023, see HumanDiscourseShaper.js)
|
|
3643
|
+
// and a real, bounded micro-slip directive under genuine high
|
|
3644
|
+
// activation (Goffman 1956, see BlushSlipEngine.js) — both produce
|
|
3645
|
+
// real, inspectable directives a host's own LLM call can honor; neither
|
|
3646
|
+
// edits `modulated.text` itself, Totemheart has no generator to edit.
|
|
3647
|
+
// Real topical ambiguity — how much this turn's own independent valence
|
|
3648
|
+
// estimates (raw appraisal, situational, semantic, life event) genuinely
|
|
3649
|
+
// disagreed with each other, distinct from the AI's own felt dissonance
|
|
3650
|
+
// (valueConflict below): a user can describe someone else's ambiguous
|
|
3651
|
+
// dilemma with zero internal conflict of their own, and that should
|
|
3652
|
+
// still read as morally ambiguous material to HumanDiscourseShaper.
|
|
3653
|
+
const topicalAmbiguity = agreement.n >= 2 ? clamp01( 1 - agreement.agreement ) : 0
|
|
3654
|
+
const discourseTarget = this.humanDiscourseShaper.computeTarget( { warmth: relation.affinity, cooling: woundPressure, valueConflict: this.cognitiveDissonance.getStress(), topicalAmbiguity } )
|
|
3655
|
+
// ChildlikeMode's own real SeriousnessSuppressor — attenuates (never
|
|
3656
|
+
// zeroes) the "adult-serious" epilogue-moralizing weight while the
|
|
3657
|
+
// mode is genuinely on, so a playful stance narrates without the
|
|
3658
|
+
// closing-lesson gravity, without erasing the underlying target.
|
|
3659
|
+
if ( childlikeActiveLevel > 0 ) discourseTarget.epilogueMoralizing = this.childlikeMode.applySeriousnessSuppression( childlikeActiveLevel, discourseTarget.epilogueMoralizing )
|
|
3660
|
+
const discourseDirectives = this.humanDiscourseShaper.buildDirectives( discourseTarget )
|
|
3661
|
+
const blushActivation = this.blushSlipEngine.computeActivation( { arousal: this.emotionSpace.vector.arousal, butterflies: somaticActivation.level, shame: this.shameGuiltSplit.shame } )
|
|
3662
|
+
// Real, narrow, own-engineered strict-precision-mode detector
|
|
3663
|
+
// (hoisted earlier, reused here too for BlushSlipEngine's own
|
|
3664
|
+
// already-built `precisionMode` gate) hard-masks the real slip
|
|
3665
|
+
// budget on a genuinely factual/numeric turn: residual arousal
|
|
3666
|
+
// INERTIA from a prior emotional turn is real and intentionally
|
|
3667
|
+
// left alone (the mask is about THIS turn's own content, not a
|
|
3668
|
+
// claim that arousal resets instantly).
|
|
3669
|
+
const blushDirective = { budget: this.blushSlipEngine.getSlipBudget( blushActivation, precisionMode ), type: this.blushSlipEngine.sampleSlipType( blushActivation ), ...this.blushSlipEngine.planRepair( { trust: relation.trust } ) }
|
|
1540
3670
|
|
|
1541
3671
|
return {
|
|
1542
3672
|
text : modulated.text,
|
|
@@ -1562,6 +3692,152 @@ export class Totemheart {
|
|
|
1562
3692
|
intrusion, allostaticLoad: this.homeostasis.allostaticLoad, sleepDebt: this.circadianRhythm.sleepDebt,
|
|
1563
3693
|
dopamine : { wanting: this.dopaminergicEngine.getWanting(), liking: this.dopaminergicEngine.getLiking() },
|
|
1564
3694
|
loveHate : { ...bondUpdate, tension: bondTension, ambivalence: this.loveHateEngine.getAmbivalence( userId ), rupture, repair },
|
|
3695
|
+
narrativeSelf : { theme: this.narrativeSelfEngine.getCurrentTheme(), coherence: this.narrativeSelfEngine.getCoherence(), chapters: this.narrativeSelfEngine.getChapterCount() },
|
|
3696
|
+
ontogenicStage : this._ontogenicStage,
|
|
3697
|
+
culturalScript : dominantScript,
|
|
3698
|
+
powerDynamics : powerUpdate,
|
|
3699
|
+
betrayalTrauma : { hasPermanentTrace: this.betrayalTraumaTrace.hasPermanentTrace( userId ), threshold: traumaTrustThreshold },
|
|
3700
|
+
metaEmotion : { valence: metaValence, arousal: metaArousal, curiosity: this._lastMetaCuriosity },
|
|
3701
|
+
forecastUtility : this._lastForecastUtility,
|
|
3702
|
+
regulationChoice : this._lastRegulationChoice,
|
|
3703
|
+
somaticBias : somaticBias,
|
|
3704
|
+
insight : insight,
|
|
3705
|
+
creativeMode : creativeMode,
|
|
3706
|
+
energyLevel : this.energyBudget.getLevel(),
|
|
3707
|
+
workspaceCompetition : workspaceCompetition,
|
|
3708
|
+
primaryDrives : this.primaryDrives.getGoalPull(),
|
|
3709
|
+
immuneDampening : immuneDampening,
|
|
3710
|
+
dualProcess : dualProcess,
|
|
3711
|
+
habitVsGoal : habitVsGoal,
|
|
3712
|
+
predictiveError : predictiveError,
|
|
3713
|
+
homeostaticFeelings : homeostaticFeelings,
|
|
3714
|
+
goalArbitration : goalArbitration,
|
|
3715
|
+
workingMemoryLoad : this.workingMemoryBuffer.getLoad(),
|
|
3716
|
+
boredom : this.boredomSystem.level,
|
|
3717
|
+
metacognitiveConfidence : metacognitiveConfidence,
|
|
3718
|
+
roleSalience : roleSalience,
|
|
3719
|
+
inhibitionFailureProbability : inhibitionFailureProbability,
|
|
3720
|
+
connectDiscount : connectDiscount,
|
|
3721
|
+
ostracism : ostracism,
|
|
3722
|
+
futureSimulation : futureSimulation,
|
|
3723
|
+
meaningMaking : userId ? this.meaningMakingEngine.getResolution( `${userId}:${this.turnCounter}` ) : null,
|
|
3724
|
+
schemaFit : schemaFit,
|
|
3725
|
+
aweReading : aweReading,
|
|
3726
|
+
elevationReading : elevationReading,
|
|
3727
|
+
socialReference : socialReference,
|
|
3728
|
+
symbolicJealousy : symbolicJealousy,
|
|
3729
|
+
loyaltyConflict : loyaltyConflict,
|
|
3730
|
+
desire : { level: desireLevel, salience: desireSalience },
|
|
3731
|
+
temptation : { level: temptationLevel, forbiddenness, opportunity, yieldProbability, didYield },
|
|
3732
|
+
craving : this.cravingTrace.getCraving( userId ),
|
|
3733
|
+
ambivalentDesire : this.desireEngine.getAmbivalentDesire( userId, this.betrayalTraumaTrace.getTrace( userId ) ),
|
|
3734
|
+
desireTension : this.desireEngine.getTension( userId, this.emotionSpace.vector.valence ),
|
|
3735
|
+
chills : { level: chillsLevel, activation: chillsActivation, type: this.chillsEngine.classifyType( { moralIntensity: elevationReading.intensity, uncanny: uncannyValley.suspicious ? 1 : 0, bondSalience: relation.affinity, vastness: aweReading.intensity } ) },
|
|
3736
|
+
intuition : intuitionRead,
|
|
3737
|
+
traumaCascade : traumaCascade,
|
|
3738
|
+
traumaTrace : this.traumaCascadeEngine.getTraumaTrace( userId ),
|
|
3739
|
+
happiness : { level: this.happinessEngine.getWellbeingNormalized( userId ), receptorOccupancy: this.happinessEngine.getReceptorOccupancy( userId ), leverage: this.happinessEngine.getLeverage( userId ) },
|
|
3740
|
+
suspicion : this.intuitionEngine.getSuspicion( userId ),
|
|
3741
|
+
secretLeakProbability : secretLeakProbability,
|
|
3742
|
+
ritualUrge : ritualUrge,
|
|
3743
|
+
loneliness : lonelinessLevel,
|
|
3744
|
+
anticipatedRegret : anticipatedRegret,
|
|
3745
|
+
regretYieldDampening : regretYieldDampening,
|
|
3746
|
+
hope : { level: hopeLevel, crash: hopeCrash },
|
|
3747
|
+
selfAttack : selfAttack,
|
|
3748
|
+
selfCompassion : selfCompassion,
|
|
3749
|
+
recoveryMultiplier : recoveryMultiplier,
|
|
3750
|
+
empathicAccuracy : { biased: empathicBiased, accuracy: empathicAccuracy },
|
|
3751
|
+
consolationEfficacy : consolationEfficacyLevel,
|
|
3752
|
+
sleepFragmentation : sleepFragmentation,
|
|
3753
|
+
repairClassification : repairClassification,
|
|
3754
|
+
silenceClassification : silenceClassification,
|
|
3755
|
+
envySplit : envySplit,
|
|
3756
|
+
roleLossPain : roleLossPain,
|
|
3757
|
+
generalizedFear : generalizedFear,
|
|
3758
|
+
anniversaryReactivation : anniversaryReactivation,
|
|
3759
|
+
socialPainChannel : socialPainChannel,
|
|
3760
|
+
postConflictCoolingLevel : postConflictCoolingLevel,
|
|
3761
|
+
superegoDiscrepancy : superegoReading.discrepancy,
|
|
3762
|
+
residualAnnoyance : this.residualAnnoyanceTrace.trace,
|
|
3763
|
+
effortWithholdingLevel : effortWithholdingLevel,
|
|
3764
|
+
politenessBudget : this.politenessShutdown.getLevel(),
|
|
3765
|
+
contemptLevel : contemptLevel,
|
|
3766
|
+
demandWithdrawalUrge : withdrawalUrge,
|
|
3767
|
+
faceThreat : faceThreat,
|
|
3768
|
+
audienceFormality : audienceFormality,
|
|
3769
|
+
egoHubrisIndex : this.egoCalibrationSuite.getHubrisIndex(),
|
|
3770
|
+
egoImpostorLevel : this.egoCalibrationSuite.getImpostorLevel(),
|
|
3771
|
+
ruminationMode : ruminationMode.mode,
|
|
3772
|
+
reactance : reactance,
|
|
3773
|
+
psychologicalDistance : psychDistance,
|
|
3774
|
+
moralLicense : moralLicense,
|
|
3775
|
+
selfHandicapPressure : selfHandicapPressure,
|
|
3776
|
+
relationalAfterglow : afterglow,
|
|
3777
|
+
amusement : amusement,
|
|
3778
|
+
moralDisgust : moralDisgustLevel,
|
|
3779
|
+
embarrassment : embarrassmentLevel,
|
|
3780
|
+
worldviewDefenseBoost : worldviewDefenseBoost,
|
|
3781
|
+
relief : reliefLevel,
|
|
3782
|
+
primaryDriveLevels : { ...this.primaryDrives.drives },
|
|
3783
|
+
prestige : prestige,
|
|
3784
|
+
framedDesirability : framedDesirability,
|
|
3785
|
+
framingSensitivity : this.framingEffect.getFrameSensitivity( framingAmbiguity ),
|
|
3786
|
+
dejectionPressure : dejectionPressure,
|
|
3787
|
+
commitmentWithAlternatives : commitmentWithAlternatives,
|
|
3788
|
+
reflectedGlory : reflectedGlory,
|
|
3789
|
+
dreamMention : dreamMention.should ? dreamMention.dream : null,
|
|
3790
|
+
compositeDream : this.dreamEngine.getLatestComposite(),
|
|
3791
|
+
nightmare : this._lastNightmareEval ?? null,
|
|
3792
|
+
oxytocinLevel : this.oxytocinSystem.getLevel( userId ),
|
|
3793
|
+
idealizationSuppression : this.oxytocinSystem.getIdealizationSuppression( userId ),
|
|
3794
|
+
opioidBuffer : this.endogenousOpioidSystem.getBuffer( userId ),
|
|
3795
|
+
opioidAnalgesia : opioidAnalgesia,
|
|
3796
|
+
mereExposureBoost : mereExposureBoost,
|
|
3797
|
+
ironicRebound : ironicRebound,
|
|
3798
|
+
bereavementIntensity : bereavementIntensity,
|
|
3799
|
+
bereavementDriveSuppression : bereavementDriveSuppression,
|
|
3800
|
+
conservationWithdrawal : { withdrawn: this.conservationWithdrawal.isWithdrawn(), depth: this.conservationWithdrawal.getWithdrawalDepth(), solitudePull: this.conservationWithdrawal.getSolitudePull() },
|
|
3801
|
+
anticipatoryGriefIntensity : anticipatoryGriefIntensity,
|
|
3802
|
+
cumulativeGriefBurden : cumulativeGriefBurden,
|
|
3803
|
+
prolongedGriefDisorder : prolongedGriefDisorder,
|
|
3804
|
+
bereavementOverload : bereavementOverload,
|
|
3805
|
+
griefPresentation : { absent: absentGrief, delayedRebound: delayedGriefRebound },
|
|
3806
|
+
selfDistancing : { active: selfDistancing, boost: selfDistancingBoost },
|
|
3807
|
+
ddmDecision : ddmDecision,
|
|
3808
|
+
sarcasmSensitivity : this.signalDetectionTheory.getSensitivity( 'sarcasm' ),
|
|
3809
|
+
sarcasmCriterion : this.signalDetectionTheory.getCriterion( 'sarcasm' ),
|
|
3810
|
+
perceivedArousalBoost : perceivedArousalBoost,
|
|
3811
|
+
weberFechnerPerceivedChange : weberFechnerPerceivedChange,
|
|
3812
|
+
freeEnergyEstimate : this.predictiveProcessingCore.getFreeEnergyEstimate( `desirability:${userId}` ),
|
|
3813
|
+
hickHymanDelayMs : hickHymanDelayMs,
|
|
3814
|
+
gratitudeYield : gratitudeYield,
|
|
3815
|
+
interoceptiveAwareness : this.interoceptiveAwarenessGain.getAccuracy(),
|
|
3816
|
+
affiliationPull : this.affiliationThermostat.getPull(),
|
|
3817
|
+
reminiscence : reminiscence,
|
|
3818
|
+
reunionReactivation : reunionReactivation,
|
|
3819
|
+
yearning : this._lastYearning ?? null,
|
|
3820
|
+
childlike : { level: childlikeLevel, on: childlikeOn },
|
|
3821
|
+
engagement : { ...boredomResult, partnerPull, topicFit },
|
|
3822
|
+
relationshipPhase : this.relationalMemoryCatalog.getRelationshipPhase( userId ),
|
|
3823
|
+
frikiObsession : obsession,
|
|
3824
|
+
frikiEgoThreat : frikiEgoThreat,
|
|
3825
|
+
frikiReveal : frikiReveal,
|
|
3826
|
+
frikiShare : frikiShare,
|
|
3827
|
+
somaticActivation : somaticActivation.level,
|
|
3828
|
+
ghostingPain : ghostingPain,
|
|
3829
|
+
globalMoodAbatement : this.globalMoodAbatement.level,
|
|
3830
|
+
tipOfTongue : tipOfTongueState,
|
|
3831
|
+
vicariousDiscomfort : vicariousDiscomfort,
|
|
3832
|
+
empathyBlend : empathyBlend,
|
|
3833
|
+
compassionCheck : compassionCheck,
|
|
3834
|
+
retribution : retribution,
|
|
3835
|
+
flirtation : flirtation,
|
|
3836
|
+
assetSaliences : assetSaliences,
|
|
3837
|
+
discourseDirectives : discourseDirectives,
|
|
3838
|
+
discourseTopicalAmbiguity : topicalAmbiguity,
|
|
3839
|
+
blushDirective : blushDirective,
|
|
3840
|
+
precisionMode : precisionMode,
|
|
1565
3841
|
},
|
|
1566
3842
|
}
|
|
1567
3843
|
|
|
@@ -1612,6 +3888,18 @@ export class Totemheart {
|
|
|
1612
3888
|
const trust = rawTrust * 0.7 + netBondTrust * 0.3
|
|
1613
3889
|
const woundPressure = userId ? this.episodicMemory.getZeigarnikPressure( userId ) : 0
|
|
1614
3890
|
|
|
3891
|
+
// Real engagement/childlike expression biases — found MISSING by the
|
|
3892
|
+
// user's own battery (fix 10: "que childlike abort y boredom alto se
|
|
3893
|
+
// noten en length/initiative/tono, no solo en flags internos"):
|
|
3894
|
+
// `BoredomSystem.expressionBiases()` already existed but was never
|
|
3895
|
+
// actually consumed anywhere. Exposed here for a host to genuinely
|
|
3896
|
+
// shorten/lengthen replies and dial initiative/enthusiasm, and a
|
|
3897
|
+
// real `playfulness` read (0 the instant `ChildlikeMode` aborts,
|
|
3898
|
+
// since its own level itself already snaps down hard on real
|
|
3899
|
+
// threat/shame/humiliation — see `ChildlikeMode.shouldAbort()`).
|
|
3900
|
+
const engagementBiases = userId ? this.boredomSystem.expressionBiases( userId ) : { lengthBias: 1, initiativeBias: 1, enthusiasmBias: 1 }
|
|
3901
|
+
const playfulness = userId ? this.childlikeMode.getLevel( userId ) : 0
|
|
3902
|
+
|
|
1615
3903
|
return {
|
|
1616
3904
|
facial : this.expressionDirectives.getFacialDirectives( dominant, blendWeight ),
|
|
1617
3905
|
prosody : this.expressionDirectives.getProsodyDirectives( this.emotionSpace.vector ),
|
|
@@ -1622,6 +3910,8 @@ export class Totemheart {
|
|
|
1622
3910
|
trust,
|
|
1623
3911
|
woundPressure : Math.min( 1, woundPressure / 3 ), // Zeigarnik priority is unbounded above (asymptotic ceiling per-entry, not summed) — squash the SUM for use as a 0..1 feature
|
|
1624
3912
|
} ),
|
|
3913
|
+
engagement : engagementBiases,
|
|
3914
|
+
playfulness : playfulness,
|
|
1625
3915
|
}
|
|
1626
3916
|
|
|
1627
3917
|
}
|
|
@@ -1663,8 +3953,85 @@ export class Totemheart {
|
|
|
1663
3953
|
// last active genuinely slows chronic cortisol's real decay (Coan & Sbarra
|
|
1664
3954
|
// 2015, see SocialBaselineTheory.js) — real co-regulation, not a fixed rate.
|
|
1665
3955
|
const lastRelationTrust = this._lastActiveUserId ? this.attachment.get( this._lastActiveUserId ).trust : 0.5
|
|
1666
|
-
|
|
3956
|
+
// Real happiness → resilience — Fredrickson's (2001) broaden-and-
|
|
3957
|
+
// build theory: genuine sustained well-being real, honestly speeds
|
|
3958
|
+
// chronic-stress recovery on top of the already-real social-
|
|
3959
|
+
// co-regulation multiplier, own tuning of the 1+0.5x ceiling.
|
|
3960
|
+
const wellbeingResilience = this._lastActiveUserId ? 1 + this.happinessEngine.getWellbeingNormalized( this._lastActiveUserId ) * 0.5 : 1
|
|
3961
|
+
this.cortisolEngine.decay( dt * this.socialBaselineTheory.getCortisolDecayMultiplier( lastRelationTrust ) * wellbeingResilience )
|
|
1667
3962
|
this.egoDepletionBudget.regenerate( dt )
|
|
3963
|
+
this.energyBudget.recover( this.cortisolEngine.getLevel(), dt ) // real cortisol-coupled recovery, see EnergyBudget.js
|
|
3964
|
+
this.primaryDrives.decay( dt )
|
|
3965
|
+
this.emotionalImmuneSystem.decay( dt )
|
|
3966
|
+
this.selfDeterminationNeeds.decay( dt )
|
|
3967
|
+
this.controllabilityEstimate.decay( dt )
|
|
3968
|
+
this.habitVsGoalSystem.decay( dt )
|
|
3969
|
+
this.inhibitoryControlPool.recover( dt )
|
|
3970
|
+
this.oxytocinSystem.decay( dt )
|
|
3971
|
+
this.endogenousOpioidSystem.decay( dt )
|
|
3972
|
+
this.meaningMakingEngine.tick( dt )
|
|
3973
|
+
this.affiliationThermostat.decay( dt )
|
|
3974
|
+
this.reciprocityClassifier.decay( dt )
|
|
3975
|
+
this.stressInoculationMemory.decay( dt )
|
|
3976
|
+
this.relationalMemoryCatalog.tick( dt )
|
|
3977
|
+
this.yearningEngine.decayAll( dt )
|
|
3978
|
+
this.childlikeMode.decayAll( dt )
|
|
3979
|
+
this.boredomSystem.decayAllUsers( dt )
|
|
3980
|
+
// Real ambient absence pull — YearningEngine.tickAbsence(), per the
|
|
3981
|
+
// user's own explicit request: a genuinely significant absent person
|
|
3982
|
+
// (a real permanent milestone) should be missed a little just from
|
|
3983
|
+
// real elapsed time, not only when a lexical cue happens to surface
|
|
3984
|
+
// them mid-conversation. Runs for every real person on record, not
|
|
3985
|
+
// only the currently active one.
|
|
3986
|
+
const nowForAbsence = Date.now()
|
|
3987
|
+
for ( const [ personId, person ] of this.relationalMemoryCatalog.people ) {
|
|
3988
|
+
|
|
3989
|
+
if ( !person.milestones.some( m => m.permanent ) ) continue
|
|
3990
|
+
const lastContact = Math.max( person.affectLedger.lastPositiveTs ?? 0, person.affectLedger.lastNegativeTs ?? 0 )
|
|
3991
|
+
if ( !lastContact ) continue
|
|
3992
|
+
this.yearningEngine.tickAbsence( personId, dt, {
|
|
3993
|
+
cumulativeWarmth : person.affectLedger.cumulativeWarmth,
|
|
3994
|
+
cumulativeHurt : person.affectLedger.cumulativeHurt,
|
|
3995
|
+
peakBond : person.affectLedger.peakBond,
|
|
3996
|
+
attachmentStyle : this.attachment.getStyle( this.personality ),
|
|
3997
|
+
gapMs : Math.max( 0, nowForAbsence - lastContact ),
|
|
3998
|
+
dopaminergicEngine : this.dopaminergicEngine,
|
|
3999
|
+
allostaticLoad : this.homeostasis.allostaticLoad,
|
|
4000
|
+
ruptureFactor : this.relationalMemoryCatalog.getRuptureFactor( personId ),
|
|
4001
|
+
} )
|
|
4002
|
+
|
|
4003
|
+
}
|
|
4004
|
+
this.frikiEngine.decayHobbies( dt )
|
|
4005
|
+
this.globalMoodAbatement.decay( dt, this.frikiEngine.getObsession() ? 0.2 : 0 )
|
|
4006
|
+
this.grudgeSystem.decay( dt )
|
|
4007
|
+
for ( const userId of this.flirtationEngine.signals.keys() ) this.flirtationEngine.decay( userId, dt )
|
|
4008
|
+
for ( const somatic of this.somaticActivationSystems.values() ) somatic.update( { stimulusIntensity: 0, affinity: 0, trust: 1 }, dt ) // real passive dissipation between turns
|
|
4009
|
+
|
|
4010
|
+
this.superegoMonitor.decay( dt )
|
|
4011
|
+
this.residualAnnoyanceTrace.decay( dt )
|
|
4012
|
+
this.politenessShutdown.recover( dt )
|
|
4013
|
+
for ( const userId of this.contemptDetector.disrespect.keys() ) this.contemptDetector.decay( userId, dt )
|
|
4014
|
+
for ( const target of this.desireEngine.desire.keys() ) this.desireEngine.decay( target, dt )
|
|
4015
|
+
for ( const target of this.cravingTrace.craving.keys() ) this.cravingTrace.decay( target, dt )
|
|
4016
|
+
this.chillsEngine.update( 0, dt ) // real natural decay toward 0 via its own -lambda*level term, no fresh activation
|
|
4017
|
+
for ( const cue of this.chillsEngine.habituation.keys() ) this.chillsEngine.decayHabituation( cue, undefined, dt )
|
|
4018
|
+
for ( const secretId of this.secretMaintenanceSystem.secrets.keys() ) this.secretMaintenanceSystem.decay( secretId, dt )
|
|
4019
|
+
for ( const userId of this.sharedRelationalCulture.items.keys() ) this.sharedRelationalCulture.decay( userId, dt )
|
|
4020
|
+
for ( const userId of this.intuitionEngine.suspicion.keys() ) this.intuitionEngine.decay( userId, dt )
|
|
4021
|
+
for ( const userId of this.traumaCascadeEngine.traumaTrace.keys() ) this.traumaCascadeEngine.decay( userId, dt, this._lastActiveUserId === userId ? Math.max( this.attachment.get( userId ).trust, this.attachment.get( userId ).affinity ) : 0.3 )
|
|
4022
|
+
for ( const userId of this.happinessEngine.occupancy.keys() ) this.happinessEngine.decay( userId, dt )
|
|
4023
|
+
for ( const userId of this.demandWithdrawLoop.demandPressure.keys() ) this.demandWithdrawLoop.decay( userId, dt )
|
|
4024
|
+
this.selfPresentationManager.decay( dt )
|
|
4025
|
+
this.moralLicensing.decay( dt )
|
|
4026
|
+
this.amusementEngine.decay( dt )
|
|
4027
|
+
for ( const userId of this.moralDisgust.exposure.keys() ) this.moralDisgust.decay( userId, dt )
|
|
4028
|
+
for ( const userId of this.prestigeSystem.prestige.keys() ) this.prestigeSystem.decay( userId, dt )
|
|
4029
|
+
this.idealSelfDiscrepancy.decay( dt )
|
|
4030
|
+
for ( const userId of this.comparisonLevelAlternatives.perceivedAlternativeQuality.keys() ) this.comparisonLevelAlternatives.decay( userId, dt )
|
|
4031
|
+
this.subconsciousEngine.decay( dt )
|
|
4032
|
+
this.conservationWithdrawal.decay( dt )
|
|
4033
|
+
for ( const userId of this.griefEngine.griefs.keys() ) this.griefEngine.tickReorganization( userId, dt )
|
|
4034
|
+
for ( const userId of this.powerDynamicsEngine.power.keys() ) this.powerDynamicsEngine.decay( userId, dt )
|
|
1668
4035
|
this.reputationEngine.regenerate( dt )
|
|
1669
4036
|
this.selfModel.decay( dt )
|
|
1670
4037
|
this.sensitization.decay( dt )
|
|
@@ -1808,6 +4175,103 @@ export class Totemheart {
|
|
|
1808
4175
|
opponentExposures : [ ...this.opponentProcess.exposures.entries() ],
|
|
1809
4176
|
egoDepletionBudget : this.egoDepletionBudget.budget,
|
|
1810
4177
|
sleepPressureLevel : this.sleepPressure.S,
|
|
4178
|
+
narrativeChapters : this.narrativeSelfEngine.chapters,
|
|
4179
|
+
legacyMemory : this.legacyMemory.toJSON(),
|
|
4180
|
+
powerDynamics : [ ...this.powerDynamicsEngine.power.entries() ],
|
|
4181
|
+
betrayalTraces : [ ...this.betrayalTraumaTrace.traces.entries() ],
|
|
4182
|
+
insightPatterns : [ ...this.insightGenerator.patterns.entries() ],
|
|
4183
|
+
energyLevel : this.energyBudget.energy,
|
|
4184
|
+
significantEventCount : this._significantEventCount,
|
|
4185
|
+
primaryDrives : { ...this.primaryDrives.drives },
|
|
4186
|
+
immuneExposure : this.emotionalImmuneSystem.exposure,
|
|
4187
|
+
selfDeterminationLevels : { ...this.selfDeterminationNeeds.levels },
|
|
4188
|
+
boredomLevel : this.boredomSystem.level,
|
|
4189
|
+
globalControlBelief : this.controllabilityEstimate.globalControlBelief,
|
|
4190
|
+
habitStrengths : [ ...this.habitVsGoalSystem.strengths.entries() ],
|
|
4191
|
+
inhibitoryControlLevel : this.inhibitoryControlPool.level,
|
|
4192
|
+
roleCommitments : [ ...this.roleIdentitySalience.commitments.entries() ],
|
|
4193
|
+
schemas : [ ...this.schemaAssimilationAccommodation.schemas.entries() ],
|
|
4194
|
+
reciprocityDirect : [ ...this.reciprocityClassifier.direct.entries() ],
|
|
4195
|
+
reciprocityGeneralizedPool : this.reciprocityClassifier.generalizedPool,
|
|
4196
|
+
affiliationCurrent : this.affiliationThermostat.current,
|
|
4197
|
+
normativeExpectations : [ ...this.normativeExpectationField.contexts.entries() ],
|
|
4198
|
+
interoceptiveAwarenessError : this.interoceptiveAwarenessGain.meanError,
|
|
4199
|
+
stressInoculationMultiplier : this.stressInoculationMemory.reactivityMultiplier,
|
|
4200
|
+
relationalMemoryCatalog : this.relationalMemoryCatalog.toJSON(),
|
|
4201
|
+
yearningTraces : this.yearningEngine.toJSON(),
|
|
4202
|
+
childlikeLevels : this.childlikeMode.toJSON(),
|
|
4203
|
+
boredomState : this.boredomSystem.toJSON(),
|
|
4204
|
+
frikiEngine : this.frikiEngine.toJSON(),
|
|
4205
|
+
somaticActivationLevels : [ ...this.somaticActivationSystems.entries() ].map( ( [ id, s ] ) => [ id, s.level ] ),
|
|
4206
|
+
globalMoodAbatementLevel : this.globalMoodAbatement.level,
|
|
4207
|
+
ghostingState : [ ...this.ghostingDetector.state.entries() ],
|
|
4208
|
+
tipOfTongueBlocks : [ ...this.tipOfTongue.blocks.entries() ],
|
|
4209
|
+
grudges : [ ...this.grudgeSystem.grievances.entries() ],
|
|
4210
|
+
socialDiscomfortHistory : [ ...this.socialDiscomfort.lastStatus.entries() ],
|
|
4211
|
+
flirtationSignals : [ ...this.flirtationEngine.signals.entries() ],
|
|
4212
|
+
blushRecentSlips : this.blushSlipEngine.recentSlips,
|
|
4213
|
+
recentDominantFamilies : this._recentDominantFamilies,
|
|
4214
|
+
affectAlignmentCorrection : { ...this.affectAlignmentMonitor.correction },
|
|
4215
|
+
|
|
4216
|
+
postConflictCoolingState : [ ...this.postConflictCooling.state.entries() ],
|
|
4217
|
+
superegoDiscrepancyState : { discrepancy: this.superegoMonitor.discrepancy, violationCount: this.superegoMonitor.violationCount },
|
|
4218
|
+
residualAnnoyanceLevel : this.residualAnnoyanceTrace.trace,
|
|
4219
|
+
effortWithholdingState : { given: [ ...this.effortWithholding.given.entries() ], received: [ ...this.effortWithholding.received.entries() ] },
|
|
4220
|
+
politenessBudgetLevel : this.politenessShutdown.budget,
|
|
4221
|
+
contemptDisrespectState : [ ...this.contemptDetector.disrespect.entries() ],
|
|
4222
|
+
demandWithdrawState : [ ...this.demandWithdrawLoop.demandPressure.entries() ],
|
|
4223
|
+
selfPresentationState : { strategy: [ ...this.selfPresentationManager.strategy.entries() ], maintenanceCost: this.selfPresentationManager.maintenanceCost },
|
|
4224
|
+
egoCalibrationState : { trackRecord: this.egoCalibrationSuite.trackRecord, selfAssessment: this.egoCalibrationSuite.selfAssessment },
|
|
4225
|
+
loyalties : [ ...this.loyaltyConflictResolver.loyalties.entries() ],
|
|
4226
|
+
moralCreditLevel : this.moralLicensing.moralCredit,
|
|
4227
|
+
relationalAfterglowState : [ ...this.relationalAfterglow.state.entries() ],
|
|
4228
|
+
gratitudeExpectedBaseline : [ ...this.gratitudeEngine.expectedBaseline.entries() ],
|
|
4229
|
+
reciprocityFavorTimestamps : [ ...this.reciprocityClassifier.favorReceivedAt.entries() ],
|
|
4230
|
+
|
|
4231
|
+
amusementRecentBits : [ ...this.amusementEngine.recentBits.entries() ],
|
|
4232
|
+
moralDisgustExposure : [ ...this.moralDisgust.exposure.entries() ],
|
|
4233
|
+
mortalitySalienceState : this.mortalitySalience.state,
|
|
4234
|
+
reliefState : this.reliefEngine.state,
|
|
4235
|
+
|
|
4236
|
+
prestigeState : [ ...this.prestigeSystem.prestige.entries() ],
|
|
4237
|
+
idealSelfDiscrepancyLevel : this.idealSelfDiscrepancy.discrepancy,
|
|
4238
|
+
comparisonLevelAlternativesState : [ ...this.comparisonLevelAlternatives.perceivedAlternativeQuality.entries() ],
|
|
4239
|
+
|
|
4240
|
+
dreams : [ ...this.dreamEngine.dreams.entries() ],
|
|
4241
|
+
compositeDreams : [ ...this.dreamEngine.compositeDreams.entries() ],
|
|
4242
|
+
subconsciousState : {
|
|
4243
|
+
coalitionResidue : [ ...this.subconsciousEngine.coalitionResidue.entries() ],
|
|
4244
|
+
exposureCount : [ ...this.subconsciousEngine.exposureCount.entries() ],
|
|
4245
|
+
suppressed : [ ...this.subconsciousEngine.suppressed.entries() ],
|
|
4246
|
+
},
|
|
4247
|
+
conservationWithdrawalLevel : this.conservationWithdrawal.overwhelm,
|
|
4248
|
+
signalDetectionCounts : [ ...this.signalDetectionTheory.counts.entries() ],
|
|
4249
|
+
stevensExponents : [ ...this.stevensPowerLaw.exponents.entries() ],
|
|
4250
|
+
oxytocinLevels : [ ...this.oxytocinSystem.levels.entries() ],
|
|
4251
|
+
opioidBuffers : [ ...this.endogenousOpioidSystem.buffers.entries() ],
|
|
4252
|
+
desireLevels : [ ...this.desireEngine.desire.entries() ],
|
|
4253
|
+
desireExposure : [ ...this.desireEngine.exposure.entries() ],
|
|
4254
|
+
cravingLevels : [ ...this.cravingTrace.craving.entries() ],
|
|
4255
|
+
chillsLevel : this.chillsEngine.level,
|
|
4256
|
+
intuitionSuspicion : [ ...this.intuitionEngine.suspicion.entries() ],
|
|
4257
|
+
intuitionCalibration : [ ...this.intuitionEngine.calibration.entries() ],
|
|
4258
|
+
intuitionReinforcement : [ ...this.intuitionEngine.reinforcement.entries() ],
|
|
4259
|
+
intuitionStreaks : [ ...this.intuitionEngine.streaks.entries() ],
|
|
4260
|
+
intuitionLastDeceptionAt : [ ...this.intuitionEngine.lastDeceptionAt.entries() ],
|
|
4261
|
+
traumaTraces : [ ...this.traumaCascadeEngine.traumaTrace.entries() ],
|
|
4262
|
+
traumaFragments : [ ...this.traumaCascadeEngine.fragments.entries() ],
|
|
4263
|
+
traumaSeverity : [ ...this.traumaCascadeEngine.severity.entries() ],
|
|
4264
|
+
traumaScarFloor : [ ...this.traumaCascadeEngine.scarFloor.entries() ],
|
|
4265
|
+
traumaRecentSignature : [ ...this.traumaCascadeEngine.recentSignature.entries() ],
|
|
4266
|
+
happinessSumCR : [ ...this.happinessEngine.sumCR.entries() ],
|
|
4267
|
+
happinessSumEV : [ ...this.happinessEngine.sumEV.entries() ],
|
|
4268
|
+
happinessSumRPE : [ ...this.happinessEngine.sumRPE.entries() ],
|
|
4269
|
+
happinessOccupancy : [ ...this.happinessEngine.occupancy.entries() ],
|
|
4270
|
+
chillsHabituation : [ ...this.chillsEngine.habituation.entries() ],
|
|
4271
|
+
secretMaintenance : [ ...this.secretMaintenanceSystem.secrets.entries() ],
|
|
4272
|
+
sharedCulture : [ ...this.sharedRelationalCulture.items.entries() ].map( ( [ id, m ] ) => [ id, [ ...m.entries() ] ] ),
|
|
4273
|
+
lonelinessLevel : this.lonelinessEngine.loneliness,
|
|
4274
|
+
hopeLevel : this.hopeDisappointmentSystem.hope,
|
|
1811
4275
|
}
|
|
1812
4276
|
|
|
1813
4277
|
}
|
|
@@ -1853,6 +4317,105 @@ export class Totemheart {
|
|
|
1853
4317
|
if ( data.opponentExposures ) this.opponentProcess.exposures = new Map( data.opponentExposures )
|
|
1854
4318
|
if ( typeof data.egoDepletionBudget === 'number' ) this.egoDepletionBudget.budget = data.egoDepletionBudget
|
|
1855
4319
|
if ( typeof data.sleepPressureLevel === 'number' ) this.sleepPressure.S = data.sleepPressureLevel
|
|
4320
|
+
if ( data.narrativeChapters ) this.narrativeSelfEngine.chapters = data.narrativeChapters
|
|
4321
|
+
if ( data.legacyMemory ) this.legacyMemory.restoreState( data.legacyMemory )
|
|
4322
|
+
if ( data.powerDynamics ) this.powerDynamicsEngine.power = new Map( data.powerDynamics )
|
|
4323
|
+
if ( data.betrayalTraces ) this.betrayalTraumaTrace.traces = new Map( data.betrayalTraces )
|
|
4324
|
+
if ( data.insightPatterns ) this.insightGenerator.patterns = new Map( data.insightPatterns )
|
|
4325
|
+
if ( typeof data.energyLevel === 'number' ) this.energyBudget.energy = data.energyLevel
|
|
4326
|
+
if ( typeof data.significantEventCount === 'number' ) this._significantEventCount = data.significantEventCount
|
|
4327
|
+
if ( data.primaryDrives ) Object.assign( this.primaryDrives.drives, data.primaryDrives )
|
|
4328
|
+
if ( typeof data.immuneExposure === 'number' ) this.emotionalImmuneSystem.exposure = data.immuneExposure
|
|
4329
|
+
if ( data.selfDeterminationLevels ) Object.assign( this.selfDeterminationNeeds.levels, data.selfDeterminationLevels )
|
|
4330
|
+
if ( typeof data.boredomLevel === 'number' ) this.boredomSystem.level = data.boredomLevel
|
|
4331
|
+
if ( typeof data.globalControlBelief === 'number' ) this.controllabilityEstimate.globalControlBelief = data.globalControlBelief
|
|
4332
|
+
if ( data.habitStrengths ) this.habitVsGoalSystem.strengths = new Map( data.habitStrengths )
|
|
4333
|
+
if ( typeof data.inhibitoryControlLevel === 'number' ) this.inhibitoryControlPool.level = data.inhibitoryControlLevel
|
|
4334
|
+
if ( data.roleCommitments ) this.roleIdentitySalience.commitments = new Map( data.roleCommitments )
|
|
4335
|
+
if ( data.schemas ) this.schemaAssimilationAccommodation.schemas = new Map( data.schemas )
|
|
4336
|
+
if ( data.reciprocityDirect ) this.reciprocityClassifier.direct = new Map( data.reciprocityDirect )
|
|
4337
|
+
if ( typeof data.reciprocityGeneralizedPool === 'number' ) this.reciprocityClassifier.generalizedPool = data.reciprocityGeneralizedPool
|
|
4338
|
+
if ( typeof data.affiliationCurrent === 'number' ) this.affiliationThermostat.current = data.affiliationCurrent
|
|
4339
|
+
if ( data.normativeExpectations ) this.normativeExpectationField.contexts = new Map( data.normativeExpectations )
|
|
4340
|
+
if ( typeof data.interoceptiveAwarenessError === 'number' ) this.interoceptiveAwarenessGain.meanError = data.interoceptiveAwarenessError
|
|
4341
|
+
if ( typeof data.stressInoculationMultiplier === 'number' ) this.stressInoculationMemory.reactivityMultiplier = data.stressInoculationMultiplier
|
|
4342
|
+
if ( data.relationalMemoryCatalog ) this.relationalMemoryCatalog.restoreState( data.relationalMemoryCatalog )
|
|
4343
|
+
if ( data.yearningTraces ) this.yearningEngine.restoreState( data.yearningTraces )
|
|
4344
|
+
if ( data.childlikeLevels ) this.childlikeMode.restoreState( data.childlikeLevels )
|
|
4345
|
+
if ( data.boredomState ) this.boredomSystem.restoreState( data.boredomState )
|
|
4346
|
+
if ( data.frikiEngine ) this.frikiEngine.restoreState( data.frikiEngine )
|
|
4347
|
+
if ( data.somaticActivationLevels ) for ( const [ id, level ] of data.somaticActivationLevels ) { const s = new SomaticActivationSystem(); s.level = level; this.somaticActivationSystems.set( id, s ) }
|
|
4348
|
+
if ( typeof data.globalMoodAbatementLevel === 'number' ) this.globalMoodAbatement.level = data.globalMoodAbatementLevel
|
|
4349
|
+
if ( data.ghostingState ) this.ghostingDetector.state = new Map( data.ghostingState )
|
|
4350
|
+
if ( data.tipOfTongueBlocks ) this.tipOfTongue.blocks = new Map( data.tipOfTongueBlocks )
|
|
4351
|
+
if ( data.grudges ) this.grudgeSystem.grievances = new Map( data.grudges )
|
|
4352
|
+
if ( data.socialDiscomfortHistory ) this.socialDiscomfort.lastStatus = new Map( data.socialDiscomfortHistory )
|
|
4353
|
+
if ( data.flirtationSignals ) this.flirtationEngine.signals = new Map( data.flirtationSignals )
|
|
4354
|
+
if ( typeof data.blushRecentSlips === 'number' ) this.blushSlipEngine.recentSlips = data.blushRecentSlips
|
|
4355
|
+
if ( data.recentDominantFamilies ) this._recentDominantFamilies = data.recentDominantFamilies
|
|
4356
|
+
if ( data.affectAlignmentCorrection ) this.affectAlignmentMonitor.correction = data.affectAlignmentCorrection
|
|
4357
|
+
|
|
4358
|
+
if ( data.postConflictCoolingState ) this.postConflictCooling.state = new Map( data.postConflictCoolingState )
|
|
4359
|
+
if ( data.superegoDiscrepancyState ) { this.superegoMonitor.discrepancy = data.superegoDiscrepancyState.discrepancy; this.superegoMonitor.violationCount = data.superegoDiscrepancyState.violationCount }
|
|
4360
|
+
if ( typeof data.residualAnnoyanceLevel === 'number' ) this.residualAnnoyanceTrace.trace = data.residualAnnoyanceLevel
|
|
4361
|
+
if ( data.effortWithholdingState ) { this.effortWithholding.given = new Map( data.effortWithholdingState.given ); this.effortWithholding.received = new Map( data.effortWithholdingState.received ) }
|
|
4362
|
+
if ( typeof data.politenessBudgetLevel === 'number' ) this.politenessShutdown.budget = data.politenessBudgetLevel
|
|
4363
|
+
if ( data.contemptDisrespectState ) this.contemptDetector.disrespect = new Map( data.contemptDisrespectState )
|
|
4364
|
+
if ( data.demandWithdrawState ) this.demandWithdrawLoop.demandPressure = new Map( data.demandWithdrawState )
|
|
4365
|
+
if ( data.selfPresentationState ) { this.selfPresentationManager.strategy = new Map( data.selfPresentationState.strategy ); this.selfPresentationManager.maintenanceCost = data.selfPresentationState.maintenanceCost }
|
|
4366
|
+
if ( data.egoCalibrationState ) { this.egoCalibrationSuite.trackRecord = data.egoCalibrationState.trackRecord; this.egoCalibrationSuite.selfAssessment = data.egoCalibrationState.selfAssessment }
|
|
4367
|
+
if ( data.loyalties ) this.loyaltyConflictResolver.loyalties = new Map( data.loyalties )
|
|
4368
|
+
if ( typeof data.moralCreditLevel === 'number' ) this.moralLicensing.moralCredit = data.moralCreditLevel
|
|
4369
|
+
if ( data.relationalAfterglowState ) this.relationalAfterglow.state = new Map( data.relationalAfterglowState )
|
|
4370
|
+
if ( data.gratitudeExpectedBaseline ) this.gratitudeEngine.expectedBaseline = new Map( data.gratitudeExpectedBaseline )
|
|
4371
|
+
if ( data.reciprocityFavorTimestamps ) this.reciprocityClassifier.favorReceivedAt = new Map( data.reciprocityFavorTimestamps )
|
|
4372
|
+
|
|
4373
|
+
if ( data.amusementRecentBits ) this.amusementEngine.recentBits = new Map( data.amusementRecentBits )
|
|
4374
|
+
if ( data.moralDisgustExposure ) this.moralDisgust.exposure = new Map( data.moralDisgustExposure )
|
|
4375
|
+
if ( data.mortalitySalienceState !== undefined ) this.mortalitySalience.state = data.mortalitySalienceState
|
|
4376
|
+
if ( data.reliefState !== undefined ) this.reliefEngine.state = data.reliefState
|
|
4377
|
+
|
|
4378
|
+
if ( data.prestigeState ) this.prestigeSystem.prestige = new Map( data.prestigeState )
|
|
4379
|
+
if ( typeof data.idealSelfDiscrepancyLevel === 'number' ) this.idealSelfDiscrepancy.discrepancy = data.idealSelfDiscrepancyLevel
|
|
4380
|
+
if ( data.comparisonLevelAlternativesState ) this.comparisonLevelAlternatives.perceivedAlternativeQuality = new Map( data.comparisonLevelAlternativesState )
|
|
4381
|
+
|
|
4382
|
+
if ( data.dreams ) this.dreamEngine.dreams = new Map( data.dreams )
|
|
4383
|
+
if ( data.compositeDreams ) this.dreamEngine.compositeDreams = new Map( data.compositeDreams )
|
|
4384
|
+
if ( data.subconsciousState ) {
|
|
4385
|
+
|
|
4386
|
+
this.subconsciousEngine.coalitionResidue = new Map( data.subconsciousState.coalitionResidue )
|
|
4387
|
+
this.subconsciousEngine.exposureCount = new Map( data.subconsciousState.exposureCount )
|
|
4388
|
+
this.subconsciousEngine.suppressed = new Map( data.subconsciousState.suppressed )
|
|
4389
|
+
|
|
4390
|
+
}
|
|
4391
|
+
if ( typeof data.conservationWithdrawalLevel === 'number' ) this.conservationWithdrawal.overwhelm = data.conservationWithdrawalLevel
|
|
4392
|
+
if ( data.signalDetectionCounts ) this.signalDetectionTheory.counts = new Map( data.signalDetectionCounts )
|
|
4393
|
+
if ( data.oxytocinLevels ) this.oxytocinSystem.levels = new Map( data.oxytocinLevels )
|
|
4394
|
+
if ( data.desireLevels ) this.desireEngine.desire = new Map( data.desireLevels )
|
|
4395
|
+
if ( data.desireExposure ) this.desireEngine.exposure = new Map( data.desireExposure )
|
|
4396
|
+
if ( data.cravingLevels ) this.cravingTrace.craving = new Map( data.cravingLevels )
|
|
4397
|
+
if ( typeof data.chillsLevel === 'number' ) this.chillsEngine.level = data.chillsLevel
|
|
4398
|
+
if ( data.intuitionSuspicion ) this.intuitionEngine.suspicion = new Map( data.intuitionSuspicion )
|
|
4399
|
+
if ( data.intuitionCalibration ) this.intuitionEngine.calibration = new Map( data.intuitionCalibration )
|
|
4400
|
+
if ( data.intuitionReinforcement ) this.intuitionEngine.reinforcement = new Map( data.intuitionReinforcement )
|
|
4401
|
+
if ( data.intuitionStreaks ) this.intuitionEngine.streaks = new Map( data.intuitionStreaks )
|
|
4402
|
+
if ( data.intuitionLastDeceptionAt ) this.intuitionEngine.lastDeceptionAt = new Map( data.intuitionLastDeceptionAt )
|
|
4403
|
+
if ( data.traumaTraces ) this.traumaCascadeEngine.traumaTrace = new Map( data.traumaTraces )
|
|
4404
|
+
if ( data.traumaFragments ) this.traumaCascadeEngine.fragments = new Map( data.traumaFragments )
|
|
4405
|
+
if ( data.traumaSeverity ) this.traumaCascadeEngine.severity = new Map( data.traumaSeverity )
|
|
4406
|
+
if ( data.traumaScarFloor ) this.traumaCascadeEngine.scarFloor = new Map( data.traumaScarFloor )
|
|
4407
|
+
if ( data.traumaRecentSignature ) this.traumaCascadeEngine.recentSignature = new Map( data.traumaRecentSignature )
|
|
4408
|
+
if ( data.happinessSumCR ) this.happinessEngine.sumCR = new Map( data.happinessSumCR )
|
|
4409
|
+
if ( data.happinessSumEV ) this.happinessEngine.sumEV = new Map( data.happinessSumEV )
|
|
4410
|
+
if ( data.happinessSumRPE ) this.happinessEngine.sumRPE = new Map( data.happinessSumRPE )
|
|
4411
|
+
if ( data.happinessOccupancy ) this.happinessEngine.occupancy = new Map( data.happinessOccupancy )
|
|
4412
|
+
if ( data.chillsHabituation ) this.chillsEngine.habituation = new Map( data.chillsHabituation )
|
|
4413
|
+
if ( data.secretMaintenance ) this.secretMaintenanceSystem.secrets = new Map( data.secretMaintenance )
|
|
4414
|
+
if ( data.sharedCulture ) this.sharedRelationalCulture.items = new Map( data.sharedCulture.map( ( [ id, entries ] ) => [ id, new Map( entries ) ] ) )
|
|
4415
|
+
if ( typeof data.lonelinessLevel === 'number' ) this.lonelinessEngine.loneliness = data.lonelinessLevel
|
|
4416
|
+
if ( typeof data.hopeLevel === 'number' ) this.hopeDisappointmentSystem.hope = data.hopeLevel
|
|
4417
|
+
if ( data.opioidBuffers ) this.endogenousOpioidSystem.buffers = new Map( data.opioidBuffers )
|
|
4418
|
+
if ( data.stevensExponents ) this.stevensPowerLaw.exponents = new Map( data.stevensExponents )
|
|
1856
4419
|
|
|
1857
4420
|
}
|
|
1858
4421
|
|