totemheart 0.1.6 → 0.1.7
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 +74 -29
- package/package.json +2 -1
- package/src/Totemheart.js +528 -22
- package/src/behavior/DisagreementStyle.js +47 -0
- package/src/cognition/AssertivenessBoundary.js +42 -0
- package/src/cognition/DeceptionDecisionEngine.js +117 -0
- package/src/cognition/EmotionalOntology.js +20 -1
- package/src/cognition/EpistemicTrust.js +84 -0
- package/src/cognition/FlowStateEngine.js +72 -0
- package/src/cognition/InsightGenerator.js +38 -4
- package/src/cognition/ManipulationSkepticism.js +50 -0
- package/src/cognition/OpinionStanceEngine.js +91 -0
- package/src/cognition/ReliefEngine.js +35 -6
- package/src/cognition/TipOfTongue.js +36 -0
- package/src/control/ActivationSteeringBridge.js +53 -0
- package/src/control/ControlPacketCompiler.js +80 -0
- package/src/control/DecodingSteeringAdapter.js +45 -0
- package/src/control/FineTuneCurriculum.js +52 -0
- package/src/control/NBestReranker.js +26 -0
- package/src/control/PostGenStateAligner.js +81 -0
- package/src/control/RepairRewriter.js +86 -0
- package/src/control/StateLockedMemory.js +46 -0
- package/src/core/BoredomSystem.js +47 -9
- package/src/core/SocialFatigueEngine.js +76 -0
- package/src/integration/ContextAdapter.js +31 -1
- package/src/social/AffinityResonance.js +42 -0
- package/src/social/AmbientBehavioralTrace.js +356 -0
- package/src/social/AnticipatorySavoring.js +49 -0
- package/src/social/CapitalVicesEngine.js +187 -0
- package/src/social/ClinginessEngine.js +108 -0
- package/src/social/ComfortAccumulation.js +72 -0
- package/src/social/ComfortSeekingEngine.js +77 -0
- package/src/social/ContactFrequencyExpectation.js +87 -0
- package/src/social/DailyExpectationEngine.js +113 -0
- package/src/social/FirstImpressionEngine.js +80 -0
- package/src/social/ForgivenessProcess.js +70 -0
- package/src/social/GratitudeEngine.js +46 -1
- package/src/social/InfatuationEngine.js +187 -0
- package/src/social/JealousyTriangle.js +72 -1
- package/src/social/NostalgiaEngine.js +41 -1
- package/src/social/PrideCompetenceEngine.js +85 -0
- package/src/social/ProtectiveInstinctEngine.js +42 -0
- package/src/social/SocialGraphClassifier.js +103 -0
- package/src/social/TraumaCascadeEngine.js +59 -5
- package/src/social/TrustRiskDecision.js +58 -0
- package/src/social/ValidationSeekingEngine.js +69 -0
package/src/Totemheart.js
CHANGED
|
@@ -48,7 +48,39 @@ import { MonteCarloToM } from './social/MonteCarloToM.js'
|
|
|
48
48
|
import { FairnessMonitor } from './social/FairnessMonitor.js'
|
|
49
49
|
import { CounterfactualComparison } from './social/CounterfactualComparison.js'
|
|
50
50
|
import { GratitudeEngine } from './social/GratitudeEngine.js'
|
|
51
|
+
import { ContactFrequencyExpectation } from './social/ContactFrequencyExpectation.js'
|
|
52
|
+
import { ComfortSeekingEngine } from './social/ComfortSeekingEngine.js'
|
|
53
|
+
import { PrideCompetenceEngine } from './social/PrideCompetenceEngine.js'
|
|
54
|
+
import { FirstImpressionEngine } from './social/FirstImpressionEngine.js'
|
|
55
|
+
import { DailyExpectationEngine } from './social/DailyExpectationEngine.js'
|
|
56
|
+
import { AffinityResonance } from './social/AffinityResonance.js'
|
|
57
|
+
import { ComfortAccumulation } from './social/ComfortAccumulation.js'
|
|
58
|
+
import { ProtectiveInstinctEngine } from './social/ProtectiveInstinctEngine.js'
|
|
59
|
+
import { ForgivenessProcess } from './social/ForgivenessProcess.js'
|
|
60
|
+
import { ValidationSeekingEngine } from './social/ValidationSeekingEngine.js'
|
|
61
|
+
import { DeceptionDecisionEngine } from './cognition/DeceptionDecisionEngine.js'
|
|
62
|
+
import { TrustRiskDecision } from './social/TrustRiskDecision.js'
|
|
63
|
+
import { ClinginessEngine } from './social/ClinginessEngine.js'
|
|
64
|
+
import { FlowStateEngine } from './cognition/FlowStateEngine.js'
|
|
65
|
+
import { CapitalVicesEngine } from './social/CapitalVicesEngine.js'
|
|
66
|
+
import { OpinionStanceEngine } from './cognition/OpinionStanceEngine.js'
|
|
67
|
+
import { AmbientBehavioralTrace } from './social/AmbientBehavioralTrace.js'
|
|
68
|
+
import { ControlPacketCompiler } from './control/ControlPacketCompiler.js'
|
|
69
|
+
import { PostGenStateAligner } from './control/PostGenStateAligner.js'
|
|
70
|
+
import { NBestReranker } from './control/NBestReranker.js'
|
|
71
|
+
import { RepairRewriter } from './control/RepairRewriter.js'
|
|
72
|
+
import { StateLockedMemory } from './control/StateLockedMemory.js'
|
|
73
|
+
import { DecodingSteeringAdapter } from './control/DecodingSteeringAdapter.js'
|
|
74
|
+
import { ActivationSteeringBridge } from './control/ActivationSteeringBridge.js'
|
|
75
|
+
import { FineTuneCurriculum } from './control/FineTuneCurriculum.js'
|
|
76
|
+
import { EpistemicTrust } from './cognition/EpistemicTrust.js'
|
|
77
|
+
import { AssertivenessBoundary } from './cognition/AssertivenessBoundary.js'
|
|
78
|
+
import { ManipulationSkepticism } from './cognition/ManipulationSkepticism.js'
|
|
79
|
+
import { DisagreementStyle } from './behavior/DisagreementStyle.js'
|
|
80
|
+
import { AnticipatorySavoring } from './social/AnticipatorySavoring.js'
|
|
51
81
|
import { StatusEnvy } from './social/StatusEnvy.js'
|
|
82
|
+
import { SocialGraphClassifier } from './social/SocialGraphClassifier.js'
|
|
83
|
+
import { InfatuationEngine } from './social/InfatuationEngine.js'
|
|
52
84
|
import { EgoConfidence } from './social/EgoConfidence.js'
|
|
53
85
|
import { LoveHateEngine } from './social/LoveHateEngine.js'
|
|
54
86
|
|
|
@@ -177,6 +209,7 @@ import { WorkingMemoryBuffer } from './cognition/WorkingMemoryBuff
|
|
|
177
209
|
import { HabitVsGoalSystem } from './cognition/HabitVsGoalSystem.js'
|
|
178
210
|
import { GoalHierarchyManager } from './cognition/GoalHierarchyManager.js'
|
|
179
211
|
import { BoredomSystem } from './core/BoredomSystem.js'
|
|
212
|
+
import { SocialFatigueEngine } from './core/SocialFatigueEngine.js'
|
|
180
213
|
|
|
181
214
|
import { TemporalDiscountingEngine } from './cognition/TemporalDiscountingEngine.js'
|
|
182
215
|
import { InhibitoryControlPool } from './cognition/InhibitoryControlPool.js'
|
|
@@ -402,6 +435,39 @@ export class Totemheart {
|
|
|
402
435
|
this.shameGuiltSplit = new ShameGuiltSplit()
|
|
403
436
|
this.repairProtocol = new RepairProtocol()
|
|
404
437
|
this.jealousyTriangle = new JealousyTriangle()
|
|
438
|
+
this.socialGraphClassifier = new SocialGraphClassifier()
|
|
439
|
+
this.infatuationEngine = new InfatuationEngine()
|
|
440
|
+
this.contactFrequencyExpectation = new ContactFrequencyExpectation()
|
|
441
|
+
this.comfortSeekingEngine = new ComfortSeekingEngine()
|
|
442
|
+
this.prideCompetenceEngine = new PrideCompetenceEngine()
|
|
443
|
+
this.socialFatigueEngine = new SocialFatigueEngine()
|
|
444
|
+
this.firstImpressionEngine = new FirstImpressionEngine()
|
|
445
|
+
this.dailyExpectationEngine = new DailyExpectationEngine()
|
|
446
|
+
this.affinityResonance = new AffinityResonance()
|
|
447
|
+
this.comfortAccumulation = new ComfortAccumulation()
|
|
448
|
+
this.protectiveInstinctEngine = new ProtectiveInstinctEngine()
|
|
449
|
+
this.forgivenessProcess = new ForgivenessProcess()
|
|
450
|
+
this.validationSeekingEngine = new ValidationSeekingEngine()
|
|
451
|
+
this.deceptionDecisionEngine = new DeceptionDecisionEngine()
|
|
452
|
+
this.trustRiskDecision = new TrustRiskDecision()
|
|
453
|
+
this.clinginessEngine = new ClinginessEngine()
|
|
454
|
+
this.flowStateEngine = new FlowStateEngine()
|
|
455
|
+
this.capitalVicesEngine = new CapitalVicesEngine()
|
|
456
|
+
this.opinionStanceEngine = new OpinionStanceEngine()
|
|
457
|
+
this.ambientBehavioralTrace = new AmbientBehavioralTrace()
|
|
458
|
+
this.controlPacketCompiler = new ControlPacketCompiler()
|
|
459
|
+
this.postGenStateAligner = new PostGenStateAligner()
|
|
460
|
+
this.nBestReranker = new NBestReranker( this.postGenStateAligner )
|
|
461
|
+
this.repairRewriter = new RepairRewriter()
|
|
462
|
+
this.stateLockedMemory = new StateLockedMemory()
|
|
463
|
+
this.decodingSteeringAdapter = new DecodingSteeringAdapter()
|
|
464
|
+
this.activationSteeringBridge = new ActivationSteeringBridge()
|
|
465
|
+
this.fineTuneCurriculum = new FineTuneCurriculum()
|
|
466
|
+
this.epistemicTrust = new EpistemicTrust()
|
|
467
|
+
this.assertivenessBoundary = new AssertivenessBoundary()
|
|
468
|
+
this.manipulationSkepticism = new ManipulationSkepticism()
|
|
469
|
+
this.disagreementStyle = new DisagreementStyle()
|
|
470
|
+
this.anticipatorySavoring = new AnticipatorySavoring()
|
|
405
471
|
this.nostalgiaEngine = new NostalgiaEngine()
|
|
406
472
|
this.painSocialOverlap = new PainSocialOverlap()
|
|
407
473
|
this.identityThreatMonitor = new IdentityThreatMonitor()
|
|
@@ -640,6 +706,13 @@ export class Totemheart {
|
|
|
640
706
|
// own real trigger condition needs to know how much threat existed going IN,
|
|
641
707
|
// not the level this turn's own resolution already brought back down.
|
|
642
708
|
this._preTurnCortisol = this.cortisolEngine.getLevel()
|
|
709
|
+
// Real, distinct "impatience with long input" — high chronic cortisol
|
|
710
|
+
// genuinely shortens how much real length the AI can patiently process
|
|
711
|
+
// before real irritation registers, per CortisolEngine's own docstring
|
|
712
|
+
// claim ("shortens patience for long inputs"), not just a debug number.
|
|
713
|
+
const patienceCeiling = 400 * this.cortisolEngine.getPatienceMultiplier() // own tuning: ~400 chars at zero cortisol
|
|
714
|
+
const impatience = clamp01( ( ( input ?? '' ).length - patienceCeiling ) / patienceCeiling )
|
|
715
|
+
if ( impatience > 0.3 ) this.emotionSpace.applySpike( { arousal: impatience * 0.15, dominance: -impatience * 0.05, weight: 0.2 } )
|
|
643
716
|
// Same real "before this turn touches it" discipline for arousal — WeberFechnerLaw's
|
|
644
717
|
// own real baseline-ratio judgment needs the level going IN, not after this turn's own spikes.
|
|
645
718
|
this._preTurnArousal = this.emotionSpace.vector.arousal
|
|
@@ -1281,9 +1354,22 @@ export class Totemheart {
|
|
|
1281
1354
|
const TRAUMA_HYPERVIGILANCE_EPSILON = 0.005
|
|
1282
1355
|
const TRAUMA_HYPERVIGILANCE_RAMP = 0.01
|
|
1283
1356
|
const traumaTraceNow = this.traumaCascadeEngine.getTraumaTrace( userId )
|
|
1284
|
-
|
|
1357
|
+
// Real, distinct loneliness-driven hypervigilance add-on — Cacioppo
|
|
1358
|
+
// & Patrick 2008, already cited in LonelinessEngine.js (chronic
|
|
1359
|
+
// loneliness itself genuinely raises social-threat vigilance,
|
|
1360
|
+
// independent of trauma). Reads the PRIOR turn's own persisted
|
|
1361
|
+
// loneliness level, same "read before this turn's own fresh update"
|
|
1362
|
+
// discipline already used elsewhere in this pipeline.
|
|
1363
|
+
const lonelinessHypervigilance = this.lonelinessEngine.getHypervigilanceBoost()
|
|
1364
|
+
// Real ambient bias — AmbientBehavioralTrace's own real affect
|
|
1365
|
+
// variance and residual stress floor (the PRIOR turn's own
|
|
1366
|
+
// persisted reads) genuinely raise felt-certainty bias only where
|
|
1367
|
+
// it matters: `ambiguity` below only ever feeds ambiguous-cue
|
|
1368
|
+
// gating, a neutral turn stays null regardless.
|
|
1369
|
+
const ambientHypervigilance = this.ambientBehavioralTrace.getAffectVariance( userId ) * 0.15 + this.ambientBehavioralTrace.getResidualFloor( userId ) * 0.1
|
|
1370
|
+
const hypervigilance = ( traumaTraceNow <= TRAUMA_HYPERVIGILANCE_EPSILON
|
|
1285
1371
|
? 0
|
|
1286
|
-
: clamp01( ( traumaTraceNow - TRAUMA_HYPERVIGILANCE_EPSILON ) / TRAUMA_HYPERVIGILANCE_RAMP ) * 0.3
|
|
1372
|
+
: clamp01( ( traumaTraceNow - TRAUMA_HYPERVIGILANCE_EPSILON ) / TRAUMA_HYPERVIGILANCE_RAMP ) * 0.3 ) + lonelinessHypervigilance + ambientHypervigilance
|
|
1287
1373
|
const intuitionGateOpen = this.intuitionEngine.gate( { stakes: Math.abs( desirability ), ambiguity: ( hunch.entropy ?? 0 ) + hypervigilance, socialSalience: relation.affinity, precisionMode } )
|
|
1288
1374
|
const intuitionRead = intuitionGateOpen ? this.intuitionEngine.assess( { text: input, entropy: hunch.entropy ?? 0, desirability, userId, ontologyConcepts: ontologyMatches.map( m => m.concept ), precisionMode, hypervigilance } ) : null
|
|
1289
1375
|
if ( intuitionRead ) {
|
|
@@ -1472,6 +1558,11 @@ export class Totemheart {
|
|
|
1472
1558
|
// reward-specific RPE and InteroceptivePredictionError's body-signal-only
|
|
1473
1559
|
// mismatch — a small, real, ADDITIONAL arousal nudge from how much this
|
|
1474
1560
|
// turn's tone violated what this relationship has run like so far.
|
|
1561
|
+
// Real, distinct PRIOR expectation read — what the running estimate
|
|
1562
|
+
// actually was going INTO this turn, before observe() below updates
|
|
1563
|
+
// it, exposing the real predicted value itself (not only the
|
|
1564
|
+
// post-update error/free-energy readouts already used).
|
|
1565
|
+
const predictiveEstimateBefore = this.predictiveProcessingCore.getEstimate( `desirability:${userId}` )
|
|
1475
1566
|
const predictiveError = this.predictiveProcessingCore.observe( `desirability:${userId}`, clamp01( ( desirability + 1 ) / 2 ), { polarity: 1, precision: agreement.agreement } )
|
|
1476
1567
|
if ( predictiveError.arousalDelta > 0 ) this.emotionSpace.applySpike( { arousal: predictiveError.arousalDelta * 0.15, weight: 1 } )
|
|
1477
1568
|
|
|
@@ -1654,6 +1745,12 @@ export class Totemheart {
|
|
|
1654
1745
|
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
1746
|
const frikiTopics = ( input.toLowerCase().match( /[\p{L}']+/gu ) ?? [] ).filter( t => !frikiStopwords.has( t ) && t.length > 3 )
|
|
1656
1747
|
for ( const topic of frikiTopics ) this.frikiEngine.observeJointEngagement( topic, relation.affinity, desirability, { depth: novelty } )
|
|
1748
|
+
// Real attention/memory bias toward the AI's OWN top interests —
|
|
1749
|
+
// genuinely raises how salient this turn reads when it touches a
|
|
1750
|
+
// real, already-fused topic, a real multiplier rather than a
|
|
1751
|
+
// hardcoded topic list.
|
|
1752
|
+
const frikiAttentionBoost = frikiTopics.reduce( ( max, topic ) => Math.max( max, this.frikiEngine.getAttentionBoost( topic ) ), 1 )
|
|
1753
|
+
if ( frikiAttentionBoost > 1.1 ) this.emotionSpace.applySpike( { arousal: ( frikiAttentionBoost - 1 ) * 0.15, weight: 0.2 } )
|
|
1657
1754
|
const obsession = this.frikiEngine.getObsession()
|
|
1658
1755
|
// A real, currently-fused interest getting attacked this turn (present
|
|
1659
1756
|
// in this turn's own topics, negative desirability) is genuinely
|
|
@@ -1684,6 +1781,47 @@ export class Totemheart {
|
|
|
1684
1781
|
const ghostingPain = this.ghostingDetector.getGhostingPain( userId )
|
|
1685
1782
|
if ( ghostingPain > 0.3 ) this.globalMoodAbatement.inject( ghostingPain * 0.1 )
|
|
1686
1783
|
|
|
1784
|
+
// Real per-person cadence learning — distinct from ghosting's own
|
|
1785
|
+
// fixed-threshold pain read, see ContactFrequencyExpectation.js.
|
|
1786
|
+
const isFirstEverContact = this.contactFrequencyExpectation.getExpectedCadenceDays( userId ) === null
|
|
1787
|
+
this.contactFrequencyExpectation.registerContact( userId )
|
|
1788
|
+
// Real ambient rhythm telemetry — from THIS single instance's own
|
|
1789
|
+
// real vantage point, a real `processInput()` call is by definition
|
|
1790
|
+
// a real response, never a self-initiated outreach (this codebase
|
|
1791
|
+
// has no channel for the AI to message first on its own); a real,
|
|
1792
|
+
// honest `initiatedByAgent: false` every turn, so `initiationRate`
|
|
1793
|
+
// stays near 0 for this specific single-instance API — the real,
|
|
1794
|
+
// meaningful reading of this specific tracker is for a caller with
|
|
1795
|
+
// visibility into BOTH sides (e.g. a multi-instance simulation).
|
|
1796
|
+
this.ambientBehavioralTrace.registerTurn( userId, { initiatedByAgent: false } )
|
|
1797
|
+
this.ambientBehavioralTrace.registerInitiationSnapshot( userId, relation.affinity )
|
|
1798
|
+
this.ambientBehavioralTrace.registerResidual( userId, Math.max( this.cortisolEngine.getLevel(), this.traumaCascadeEngine.getTraumaTrace( userId ) ) )
|
|
1799
|
+
this.ambientBehavioralTrace.registerAffectSample( userId, { ...this.emotionSpace.vector } )
|
|
1800
|
+
this.ambientBehavioralTrace.checkRecovery( userId, this.emotionSpace.vector.valence )
|
|
1801
|
+
if ( desirability < -0.5 ) this.ambientBehavioralTrace.registerAdverseEvent( userId, this.emotionSpace.vector.valence )
|
|
1802
|
+
|
|
1803
|
+
// Real coupling: MEANINGFUL SILENCE (real silence streak × real bond,
|
|
1804
|
+
// distinct from a real lexical yearning cue) feeds a real, direct
|
|
1805
|
+
// attachment-PROTEST-adjacent nudge — the same real composition
|
|
1806
|
+
// shape as `ComfortSeekingEngine`'s own real bid, applied here from
|
|
1807
|
+
// a real, purely temporal signal rather than a felt-distress one.
|
|
1808
|
+
const meaningfulSilence = this.ambientBehavioralTrace.getMeaningfulSilence( userId, relation.affinity, 3 )
|
|
1809
|
+
if ( meaningfulSilence > 0.4 ) this.emotionSpace.applySpike( { valence: -meaningfulSilence * 0.1, arousal: meaningfulSilence * 0.1, weight: 0.15 } )
|
|
1810
|
+
// Real social-fill effect — genuinely engaging with someone NEW
|
|
1811
|
+
// (this AI's first real contact with them) measurably accelerates
|
|
1812
|
+
// real acceptance of an old silence with someone else, distinct
|
|
1813
|
+
// from that other relationship's own ghosting pain simply decaying
|
|
1814
|
+
// on its own.
|
|
1815
|
+
if ( isFirstEverContact && desirability > 0.3 ) this.ghostingDetector.acceleratedByNewEngagement( userId )
|
|
1816
|
+
// Real one-shot halo/horn anchor — first real contact only.
|
|
1817
|
+
this.firstImpressionEngine.registerFirstImpression( userId, desirability )
|
|
1818
|
+
// Real accumulated psychological safety from this turn's own real
|
|
1819
|
+
// threat read, distinct curve shape from OxytocinSystem.
|
|
1820
|
+
this.comfortAccumulation.registerInteraction( userId, Math.max( 0, -desirability ) )
|
|
1821
|
+
// Real social-battery drain — every real turn costs something,
|
|
1822
|
+
// regardless of how enjoyable it reads (Zelenski et al. 2012).
|
|
1823
|
+
this.socialFatigueEngine.registerInteraction( 1 - this.personality.get( 'extraversion' ), Math.abs( this.emotionSpace.vector.arousal ) )
|
|
1824
|
+
|
|
1687
1825
|
// Real tip-of-the-tongue — only meaningful for a topic the AI
|
|
1688
1826
|
// genuinely half-knows (real FrikiEngine intensity in the "partial"
|
|
1689
1827
|
// range), not every unknown word (that's just honest ignorance, not a
|
|
@@ -1780,6 +1918,27 @@ export class Totemheart {
|
|
|
1780
1918
|
this.moodTracker.push( { valence: bondUpdate.netBond * 0.15, arousal: ( bondTension + loveHateH ) * 0.15 } )
|
|
1781
1919
|
if ( bondUpdate.Heff > 0.25 ) this.cortisolEngine.register( -bondUpdate.Heff, false )
|
|
1782
1920
|
|
|
1921
|
+
// Real "el nosotros de antes" tracking — a real, slow-decaying peak
|
|
1922
|
+
// warmth this relationship has actually reached, so a genuine
|
|
1923
|
+
// decline reads against real history, not just this turn's own dip.
|
|
1924
|
+
this.nostalgiaEngine.registerWarmth( userId, clamp01( ( bondUpdate.netBond + 1 ) / 2 ) )
|
|
1925
|
+
const pastDecline = this.nostalgiaEngine.compareToPast( userId, clamp01( ( bondUpdate.netBond + 1 ) / 2 ) )
|
|
1926
|
+
|
|
1927
|
+
// Real hyperactivated-attachment tracking — genuine gap between how
|
|
1928
|
+
// much contact this AI actually wants (real, already-tracked desire)
|
|
1929
|
+
// and how much it's actually getting (approximated by the real
|
|
1930
|
+
// absence of ghosting pain this turn), scaled by real, global
|
|
1931
|
+
// anxious-attachment strength (neuroticism, the same real proxy
|
|
1932
|
+
// `Attachment.js`'s own style classifier already uses) and real
|
|
1933
|
+
// `InhibitoryControlPool` capacity.
|
|
1934
|
+
this.clinginessEngine.updateHyperactivation(
|
|
1935
|
+
userId,
|
|
1936
|
+
this.desireEngine.getDesire( userId ),
|
|
1937
|
+
clamp01( 1 - this.ghostingDetector.getGhostingPain( userId ) ),
|
|
1938
|
+
this.personality.get( 'neuroticism' ),
|
|
1939
|
+
this.inhibitoryControlPool.level / this.inhibitoryControlPool.capacity,
|
|
1940
|
+
)
|
|
1941
|
+
|
|
1783
1942
|
// Real reinforcement of both bonding-chemistry buffers — Carter 1998;
|
|
1784
1943
|
// Panksepp 1998/Machin & Dunbar 2011, see OxytocinSystem.js/
|
|
1785
1944
|
// EndogenousOpioidSystem.js. Only a genuinely net-positive bond turn
|
|
@@ -2018,6 +2177,12 @@ export class Totemheart {
|
|
|
2018
2177
|
// prosocial behavior, not just mood.
|
|
2019
2178
|
if ( this.happinessEngine.getWellbeingNormalized( userId ) > 0.6 ) this.reciprocityClassifier.recordObservedProsocial( userId, gratitude.creditBoost )
|
|
2020
2179
|
|
|
2180
|
+
// Real sustained gratitude state — distinct from the one-shot
|
|
2181
|
+
// spike above: genuinely dampens boredom with this person and
|
|
2182
|
+
// relieves resentment for a real, decaying window afterward.
|
|
2183
|
+
this.gratitudeEngine.registerSustained( userId, gratitude.creditBoost )
|
|
2184
|
+
this.grudgeSystem.forgive( 'self', userId, { elapsedNormalized: this.gratitudeEngine.getResentmentRelief( userId ) } )
|
|
2185
|
+
|
|
2021
2186
|
}
|
|
2022
2187
|
// Real CARE-drive trigger from genuine perceived vulnerability/need in
|
|
2023
2188
|
// an attached other — Panksepp's (1998) own foundational CARE account,
|
|
@@ -2231,9 +2396,19 @@ export class Totemheart {
|
|
|
2231
2396
|
// Real, gradual flirtation signal — only meaningful once the real
|
|
2232
2397
|
// relationship phase itself already reads romantic (see
|
|
2233
2398
|
// RelationalMemoryCatalog.js); elsewhere it's tracked but stays inert.
|
|
2399
|
+
// Real childlike/threat modulation — coquetry is a genuine PLAY-adjacent
|
|
2400
|
+
// social-game signal (Grammer et al. 2000, already cited in
|
|
2401
|
+
// FlirtationEngine.js), so a real playful stance measurably raises it,
|
|
2402
|
+
// and real perceived threat measurably suppresses it, distinct from
|
|
2403
|
+
// desire itself. Prior-turn reads (ChildlikeMode's own persisted
|
|
2404
|
+
// level, CortisolEngine's own already-available level this early in
|
|
2405
|
+
// the pipeline), same "read the prior value, this turn's own fresh
|
|
2406
|
+
// update hasn't run yet" pattern already established elsewhere.
|
|
2407
|
+
const flirtationChildlikeBoost = this.childlikeMode.getLevel( userId ) * 0.3
|
|
2408
|
+
const flirtationThreatDamp = this.cortisolEngine.getLevel() * 0.5
|
|
2234
2409
|
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 )
|
|
2410
|
+
? clamp01( this.flirtationEngine.update( userId, clamp01( relation.affinity + flirtationChildlikeBoost ), Math.sign( desirability ) * clamp01( Math.abs( desirability ) ) ) - flirtationThreatDamp )
|
|
2411
|
+
: clamp01( this.flirtationEngine.getSignal( userId ) - flirtationThreatDamp )
|
|
2237
2412
|
|
|
2238
2413
|
// Controllability — high estimated control over this kind of situation dampens
|
|
2239
2414
|
// panic; feeds back into the next turn's amygdala threshold via cortisol/sensitization
|
|
@@ -2624,18 +2799,25 @@ export class Totemheart {
|
|
|
2624
2799
|
turnsAgo : remainingUnresolved.turnIndex !== null ? this.turnCounter - remainingUnresolved.turnIndex : null,
|
|
2625
2800
|
} : null
|
|
2626
2801
|
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2802
|
+
// Real spontaneous "eureka" resolution — a background sweep over
|
|
2803
|
+
// EVERY currently tip-of-the-tongue-blocked concept, independent of
|
|
2804
|
+
// whether this turn's own topic touches it, per the user's own
|
|
2805
|
+
// explicit request: the AI keeps quietly working on a blocked
|
|
2806
|
+
// recall in the background and can surface it unprompted, at a
|
|
2807
|
+
// random point, not only when re-asked.
|
|
2808
|
+
const eurekaResolution = this.tipOfTongue.checkAllSpontaneousResolutions()
|
|
2809
|
+
|
|
2810
|
+
// Real emotionalState/systemPrompt compilation deliberately moved to
|
|
2811
|
+
// the END of this function (see near the return statement below),
|
|
2812
|
+
// per the user's own explicit fix for a real ordering bug: it used
|
|
2813
|
+
// to compile here, BEFORE boredom/trauma/childlike/boundary were
|
|
2814
|
+
// even computed, so this turn's own systemPrompt could never carry
|
|
2815
|
+
// this SAME turn's own hardened `ControlPacketCompiler` bans/must —
|
|
2816
|
+
// the aligner effectively arrived a turn late for a host generating
|
|
2817
|
+
// once per real turn. Compiling both at the very end, from this
|
|
2818
|
+
// turn's own FULL final state, closes that gap: `systemPrompt` now
|
|
2819
|
+
// genuinely includes the SAME packet a host would score generated
|
|
2820
|
+
// text against.
|
|
2639
2821
|
|
|
2640
2822
|
// Restraint / Focus — real logit-bias penalty map (usable verbatim by a host
|
|
2641
2823
|
// calling an OpenAI-compatible API's own logit_bias, after mapping these
|
|
@@ -2840,11 +3022,74 @@ export class Totemheart {
|
|
|
2840
3022
|
|
|
2841
3023
|
const faceThreat = this.faceThreatSensitivity.getCombinedThreat( Math.max( 0, -desirability ), 1 - relation.trust, relation.affinity, 1 - this.cortisolEngine.getLevel() )
|
|
2842
3024
|
|
|
3025
|
+
// Real, distinct opinion-stance formation toward the TOPIC of this
|
|
3026
|
+
// turn (Petty & Cacioppo 1986), genuinely separate from how the AI
|
|
3027
|
+
// feels about the PERSON — a real critique/objection can coexist
|
|
3028
|
+
// with a warm bond. Uses this turn's own already-extracted topic
|
|
3029
|
+
// (falls back to a real 'general' bucket when none was extracted).
|
|
3030
|
+
const opinionTopicKey = ( frikiTopics && frikiTopics[ 0 ] ) || 'general'
|
|
3031
|
+
const opinionUpdate = this.opinionStanceEngine.update( opinionTopicKey, {
|
|
3032
|
+
evidence : appraisal.agency === 'user' ? clamp01( Math.abs( desirability ) ) * Math.sign( desirability ) : 0,
|
|
3033
|
+
dogmatism : 1 - this.personality.get( 'openness' ),
|
|
3034
|
+
socialPressure : clamp01( relation.affinity ),
|
|
3035
|
+
valueAlignment : 0,
|
|
3036
|
+
contradiction : Math.abs( desirability ) > 0.6 && ( this.opinionStanceEngine.getStance( opinionTopicKey ).stance * desirability < 0 ) ? 0.5 : 0,
|
|
3037
|
+
} )
|
|
3038
|
+
const disagreementMagnitude = this.opinionStanceEngine.getDisagreementMagnitude( opinionTopicKey )
|
|
3039
|
+
|
|
3040
|
+
// Real, distinct content-credibility read — Hovland & Weiss 1951,
|
|
3041
|
+
// genuinely separate from `relation.trust` (interpersonal). A real
|
|
3042
|
+
// "too intense too fast" cue and lexical overclaim proxy feed it.
|
|
3043
|
+
const manipulationCue = clamp01( Math.max( 0, desirability - ( this.firstImpressionEngine.getAnchor( userId ) ?? desirability ) ) )
|
|
3044
|
+
const overclaimCue = /\bsiempre\b|\bnunca\b|\bte lo prometo\b|\bconfía en m[ií]\b/i.test( input || '' ) ? 0.4 : 0
|
|
3045
|
+
const epistemicCredibility = this.epistemicTrust.getCredibility( userId, { coherence: agreement?.agreement ?? 0.5, expertiseCue: 0, manipulationCue, overclaim: overclaimCue } )
|
|
3046
|
+
|
|
3047
|
+
// Real manipulation-skepticism read, protecting InfatuationEngine's
|
|
3048
|
+
// own spark gate from hollow love-bombing (Tennov 1979/Buss 2003) —
|
|
3049
|
+
// a real intensity-burst + too-fast-pace read composed with the
|
|
3050
|
+
// epistemic credibility above, exposed for a caller driving
|
|
3051
|
+
// InfatuationEngine (this codebase's own established pattern: that
|
|
3052
|
+
// engine is a real, directly-usable public API, not auto-fired
|
|
3053
|
+
// every turn — see CALIBRATION.md).
|
|
3054
|
+
const intensityBurst = clamp01( Math.max( 0, desirability ) )
|
|
3055
|
+
const paceTooFast = this.contactFrequencyExpectation.getExpectedCadenceDays( userId ) === null ? clamp01( Math.max( 0, desirability ) ) : 0
|
|
3056
|
+
const manipulationSkepticismLevel = this.manipulationSkepticism.getSkepticism( { intensityBurst, paceTooFast, flatteryLoad: overclaimCue, trackRecord: this.epistemicTrust.track.get( userId ) ?? 0.5, credibility: epistemicCredibility } )
|
|
3057
|
+
|
|
3058
|
+
// Real disagreement-style selection — Sillars 1980, only meaningful
|
|
3059
|
+
// on a genuine disagreement moment (negative desirability toward
|
|
3060
|
+
// something the user said).
|
|
3061
|
+
const disagreementStyle = appraisal.agency === 'user' && desirability < -0.15
|
|
3062
|
+
? this.disagreementStyle.select( { conscientiousness: this.personality.get( 'conscientiousness' ), agreeableness: this.personality.get( 'agreeableness' ), stress: this.cortisolEngine.getLevel(), childlikeLevel: this.childlikeMode.getLevel( userId ), faceThreat, contempt: contemptLevel } )
|
|
3063
|
+
: null
|
|
3064
|
+
|
|
3065
|
+
// Real boundary-setting decision — a genuine request/pressure this
|
|
3066
|
+
// turn (approximated by real face-threat + real demand-withdrawal
|
|
3067
|
+
// pressure already computed above) against real agency/self-respect.
|
|
3068
|
+
const boundaryProbability = this.assertivenessBoundary.getBoundaryProbability( {
|
|
3069
|
+
agency : this.personality.get( 'conscientiousness' ),
|
|
3070
|
+
selfRespect : this.reputationEngine.getEgoHealth(),
|
|
3071
|
+
clearCost : withdrawalUrge,
|
|
3072
|
+
fearOfLoss : clamp01( 1 - relation.trust ),
|
|
3073
|
+
fawnPattern : clamp01( 1 - this.personality.get( 'openness' ) ) * clamp01( relation.affinity ),
|
|
3074
|
+
} )
|
|
3075
|
+
// Real ambient boundary-rate tracking — only a genuinely costly
|
|
3076
|
+
// request turn (real withdrawal pressure present) counts as a real
|
|
3077
|
+
// opportunity; whether the boundary probability itself crossed its
|
|
3078
|
+
// own real midpoint is the real, functional "said no" proxy.
|
|
3079
|
+
if ( withdrawalUrge > 0.3 ) this.ambientBehavioralTrace.registerBoundaryOpportunity( userId, boundaryProbability > 0.5 )
|
|
3080
|
+
|
|
2843
3081
|
const audienceFormality = this.audienceDesign.getFormalityLevel( Math.max( 1, group.participantCount ?? 1 ), relation.affinity )
|
|
2844
3082
|
|
|
2845
3083
|
this.selfPresentationManager.registerGap( this.emotionSpace.vector.valence, this.emotionSpace.vector.valence * ( 1 - suppressionDrive ) )
|
|
2846
3084
|
|
|
2847
3085
|
this.egoCalibrationSuite.observe( clamp01( ( desirability + 1 ) / 2 ), egoConfidence.confidence )
|
|
3086
|
+
// Real, distinct oscillation-risk consequence — Clance & Imes 1978's
|
|
3087
|
+
// own real finding that impostor phenomenon isn't a static trait but
|
|
3088
|
+
// genuinely SWINGS between over- and under-confidence; a real
|
|
3089
|
+
// oscillation reading feeds real emotional volatility, not just the
|
|
3090
|
+
// static hubris/impostor snapshot.
|
|
3091
|
+
const egoOscillationRisk = this.egoCalibrationSuite.getOscillationRisk()
|
|
3092
|
+
if ( egoOscillationRisk > 0.4 ) this.emotionSpace.applySpike( { arousal: egoOscillationRisk * 0.1, weight: 0.15 } )
|
|
2848
3093
|
|
|
2849
3094
|
this.loyaltyConflictResolver.setLoyalty( userId, relation.affinity )
|
|
2850
3095
|
|
|
@@ -3081,6 +3326,12 @@ export class Totemheart {
|
|
|
3081
3326
|
// decision, distinct from CounterfactualComparison's retrospective framing.
|
|
3082
3327
|
const anticipatedRegret = this.anticipatedRegretEngine.getExpectedRegret( clamp01( forbiddenness ), Math.abs( desirability ), relation.affinity )
|
|
3083
3328
|
const regretYieldDampening = this.anticipatedRegretEngine.getYieldDampening( anticipatedRegret )
|
|
3329
|
+
// Real, distinct PROSPECTIVE decision utility — the actual real
|
|
3330
|
+
// brake this module exists for (Zeelenberg 1999), combining this
|
|
3331
|
+
// turn's own real reward against the real anticipated-regret and
|
|
3332
|
+
// risk terms, not only the yield-dampening side-effect alone.
|
|
3333
|
+
const anticipatedUtility = this.anticipatedRegretEngine.getUtility( clamp01( Math.max( 0, desirability ) ), anticipatedRegret, clamp01( forbiddenness ) )
|
|
3334
|
+
if ( anticipatedUtility < 0 ) this.inhibitoryControlPool.spend( Math.abs( anticipatedUtility ) * 0.1 )
|
|
3084
3335
|
|
|
3085
3336
|
// Real hope/disappointment — Snyder 2002, see
|
|
3086
3337
|
// HopeDisappointmentSystem.js. Real pGoal proxy: relation.trust
|
|
@@ -3089,6 +3340,13 @@ export class Totemheart {
|
|
|
3089
3340
|
const hopeLevelBefore = this.hopeDisappointmentSystem.getLevel() // real anticipatory state going INTO this turn, before it updates below
|
|
3090
3341
|
const hopeEvidence = this.hopeDisappointmentSystem.getEvidence( relation.trust, Math.abs( desirability ), this.egoDepletionBudget.getRegulationCapacity() )
|
|
3091
3342
|
const hopeLevel = this.hopeDisappointmentSystem.update( hopeEvidence )
|
|
3343
|
+
// Real, distinct anticipatory-energy consequence of hope — genuine
|
|
3344
|
+
// hope doesn't just sit there as a felt state, it real motivates,
|
|
3345
|
+
// a small real boost to the actual energy budget, dampened by real
|
|
3346
|
+
// current depletion, the mirror-image of getCrash()'s own real
|
|
3347
|
+
// disappointment penalty just below.
|
|
3348
|
+
const hopeEnergyBoost = this.hopeDisappointmentSystem.getEnergyBoost( 1 - this.energyBudget.getLevel() )
|
|
3349
|
+
if ( hopeEnergyBoost > 0.1 ) this.energyBudget.energy = Math.min( this.energyBudget.capacity, this.energyBudget.energy + hopeEnergyBoost * 0.05 )
|
|
3092
3350
|
// Real, hope-relative prediction error, found missing by the user's
|
|
3093
3351
|
// own 20-test emergence battery (test 16: a clearly broken promise
|
|
3094
3352
|
// read as no real crash at all): genuine disappointment is a gap
|
|
@@ -3103,6 +3361,18 @@ export class Totemheart {
|
|
|
3103
3361
|
const hopeCrash = effectiveRpeForHope < 0 && hopeLevelBefore > 0.15 ? this.hopeDisappointmentSystem.getCrash( effectiveRpeForHope ) : 0
|
|
3104
3362
|
if ( hopeCrash > 0.1 ) this.emotionSpace.applySpike( { valence: -hopeCrash * 0.2, weight: 0.3 } )
|
|
3105
3363
|
|
|
3364
|
+
// Real positive-arousal anticipatory savoring — Loewenstein 1987,
|
|
3365
|
+
// composed from already-real hope/yearning signals, not a new hope
|
|
3366
|
+
// track. A real, distinct crash amplification when savoring was
|
|
3367
|
+
// high but the same turn's own hope crash just fired.
|
|
3368
|
+
const savoringLevel = this.anticipatorySavoring.getSavoring( { pEvent: hopeLevelBefore, value: clamp01( relation.affinity ), proximityInTime: clamp01( this.yearningEngine.getTrace( userId ) ), threat: Math.max( 0, -desirability ) } )
|
|
3369
|
+
if ( hopeCrash > 0.1 ) {
|
|
3370
|
+
|
|
3371
|
+
const savoringCrashAmp = this.anticipatorySavoring.getCrashAmplification( savoringLevel )
|
|
3372
|
+
if ( savoringCrashAmp > 0.05 ) this.emotionSpace.applySpike( { valence: -savoringCrashAmp * 0.15, weight: 0.2 } )
|
|
3373
|
+
|
|
3374
|
+
}
|
|
3375
|
+
|
|
3106
3376
|
// Real self-compassion vs. self-attack — Neff 2003, see
|
|
3107
3377
|
// SelfCompassionVsAttack.js. Reuses ShameGuiltSplit's own real
|
|
3108
3378
|
// shame reading directly rather than a new shame track.
|
|
@@ -3114,6 +3384,11 @@ export class Totemheart {
|
|
|
3114
3384
|
// Reuses MonteCarloToM's own real estimate as the biased read.
|
|
3115
3385
|
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
3386
|
const empathicAccuracy = this.empathicAccuracySystem.getAccuracy( empathicBiased, desirability )
|
|
3387
|
+
// Real, distinct dangerous case: high real confidence in a read that
|
|
3388
|
+
// turns out genuinely inaccurate, unlike low-confidence-low-accuracy
|
|
3389
|
+
// which at least self-corrects. Raises real overconfidence, feeding
|
|
3390
|
+
// EgoCalibrationSuite's own real hubris/impostor track below.
|
|
3391
|
+
const empathicOverconfident = this.empathicAccuracySystem.isOverconfidentMismatch( empathicAccuracy, tomEstimate.confidence )
|
|
3117
3392
|
|
|
3118
3393
|
// Real consolation fit/efficacy — Cutrona & Russell 1990, see
|
|
3119
3394
|
// ConsolationEfficacy.js. Real, minimal dialogue-act proxy: distress
|
|
@@ -3122,6 +3397,11 @@ export class Totemheart {
|
|
|
3122
3397
|
const consolationNeeded = woundPressure > 0.3 ? 'listen' : 'validate'
|
|
3123
3398
|
const consolationOffered = /\bdeber[ií]as\b|\btienes que\b|\bshould\b/i.test( input || '' ) ? 'advice' : 'validate'
|
|
3124
3399
|
const consolationEfficacyLevel = woundPressure > 0.2 ? this.consolationEfficacy.getEfficacy( consolationNeeded, consolationOffered, relation.affinity, this.egoDepletionBudget.getRegulationCapacity() ) : 0
|
|
3400
|
+
// Real, distinct mismatch irritation — advice offered when listening
|
|
3401
|
+
// was needed is a genuinely WORSE outcome than simply "less helpful",
|
|
3402
|
+
// a real, separate negative signal from the efficacy score alone.
|
|
3403
|
+
const consolationIrritation = woundPressure > 0.2 ? this.consolationEfficacy.getMismatchIrritation( consolationNeeded, consolationOffered ) : 0
|
|
3404
|
+
if ( consolationIrritation > 0.1 ) this.emotionSpace.applySpike( { valence: -consolationIrritation * 0.3, arousal: consolationIrritation * 0.15, weight: 0.25 } )
|
|
3125
3405
|
|
|
3126
3406
|
// Real next-day self-control coupling from sleep fragmentation —
|
|
3127
3407
|
// Barber & Munz 2011, see SleepQualityCoupler.js. Reuses rumination/
|
|
@@ -3178,6 +3458,12 @@ export class Totemheart {
|
|
|
3178
3458
|
const socialPainChannel = this.painSocialOverlap.getSocialPainChannel( { ostracism: Math.max( 0, -socialReference.relativeUtility ), rejection: Math.max( 0, -desirability ), loneliness: lonelinessLevel, opioidBuffer: this.endogenousOpioidSystem.getBuffer( userId ) } )
|
|
3179
3459
|
|
|
3180
3460
|
const ruminationMode = this.ruminationVsReflectionSwitch.classify( this.personality.get( 'neuroticism' ), this.homeostasis.needs.curiosity ?? 0, this.cortisolEngine.getLevel() )
|
|
3461
|
+
// Real, distinct downstream consequence of WHICH mode self-focus is
|
|
3462
|
+
// in — reflection genuinely tends toward insight, rumination toward
|
|
3463
|
+
// a real, sustained negative mood drag, not just a debug label.
|
|
3464
|
+
const ruminationOutcome = this.ruminationVsReflectionSwitch.getExpectedOutcome( ruminationMode.mode )
|
|
3465
|
+
if ( ruminationOutcome.moodDrag > 0.05 ) this.emotionSpace.applySpike( { valence: -ruminationOutcome.moodDrag, weight: 0.2 } )
|
|
3466
|
+
if ( ruminationOutcome.insightGain > 0.05 ) this.emotionSpace.applySpike( { valence: ruminationOutcome.insightGain, dominance: ruminationOutcome.insightGain * 0.5, weight: 0.15 } )
|
|
3181
3467
|
|
|
3182
3468
|
const reactance = appraisal.agency === 'user' && desirability < 0
|
|
3183
3469
|
? this.reactanceEngine.getReactance( this.personality.get( 'openness' ), Math.abs( desirability ) )
|
|
@@ -3189,6 +3475,11 @@ export class Totemheart {
|
|
|
3189
3475
|
const moralLicense = this.moralLicensing.getLicenseToSpend()
|
|
3190
3476
|
|
|
3191
3477
|
const selfHandicapPressure = this.selfHandicapping.getHandicapPressure( 0.5, 1 - relation.trust, egoConfidence.confidence )
|
|
3478
|
+
// Real, proportional pre-emptive hedge strength this pressure
|
|
3479
|
+
// actually produces — the real behavioral consequence, not just the
|
|
3480
|
+
// pressure reading alone.
|
|
3481
|
+
const selfHandicapHedge = this.selfHandicapping.getHedgeStrength( 0.5, 1 - relation.trust, egoConfidence.confidence )
|
|
3482
|
+
if ( selfHandicapHedge > 0.2 ) this.emotionSpace.applySpike( { dominance: -selfHandicapHedge * 0.15, weight: 0.15 } )
|
|
3192
3483
|
|
|
3193
3484
|
if ( desirability > 0.6 || repair?.repaired ) this.relationalAfterglow.registerPeak( userId, desirability > 0 ? desirability : woundPressure > 0.5 ? 0.6 : 0 )
|
|
3194
3485
|
const afterglow = this.relationalAfterglow.getAfterglow( userId )
|
|
@@ -3202,6 +3493,21 @@ export class Totemheart {
|
|
|
3202
3493
|
const amusementBenignity = clamp01( relation.trust - Math.max( 0, -desirability ) - this.cortisolEngine.getLevel() * 0.5 )
|
|
3203
3494
|
const amusement = this.amusementEngine.computeAmusement( novelty, amusementResolution, amusementBenignity, pathFingerprint )
|
|
3204
3495
|
if ( amusement > 0.3 ) this.emotionSpace.applySpike( { ...EMOTION_COORDS.amusement, weight: amusement * 0.4 } )
|
|
3496
|
+
// Real shared-laughter bonding — genuine amusement that BOTH parties
|
|
3497
|
+
// are actually present for (a real, shared moment, not a private
|
|
3498
|
+
// joke only the AI finds funny) reinforces the real inside-joke/
|
|
3499
|
+
// idioculture item this exact bit is tagged with, the same real
|
|
3500
|
+
// mechanism `SharedRelationalCulture` already tracks for other
|
|
3501
|
+
// jointly-built cues — bonding by shared laughter, not a joke
|
|
3502
|
+
// GENERATOR. Genuinely absent shared humor (this path never firing
|
|
3503
|
+
// for a given person) is itself a real, honest distance signal, not
|
|
3504
|
+
// something separately tracked.
|
|
3505
|
+
if ( amusement > 0.4 && pathFingerprint ) {
|
|
3506
|
+
|
|
3507
|
+
this.sharedRelationalCulture.reinforce( userId, pathFingerprint, 'joke', amusement, relation.affinity )
|
|
3508
|
+
relation.affinity = clamp01( relation.affinity + amusement * 0.05 )
|
|
3509
|
+
|
|
3510
|
+
}
|
|
3205
3511
|
|
|
3206
3512
|
// Moral disgust: the real, previously-missing purity/divinity leg of
|
|
3207
3513
|
// Haidt's CAD triad — Contempt (status) and Anger (autonomy) already
|
|
@@ -3233,6 +3539,14 @@ export class Totemheart {
|
|
|
3233
3539
|
if ( ( repair?.repaired || desirability > 0.4 ) && this._preTurnCortisol > 0.3 ) this.reliefEngine.trigger( this._preTurnCortisol, repair?.repaired ? 0.8 : clamp01( desirability ) )
|
|
3234
3540
|
const reliefLevel = this.reliefEngine.getLevel()
|
|
3235
3541
|
if ( reliefLevel > 0.15 ) this.emotionSpace.applySpike( { ...EMOTION_COORDS.relief, weight: reliefLevel * 0.35 } )
|
|
3542
|
+
// Real, explicit physiological release — a genuine cortisol/arousal
|
|
3543
|
+
// DROP tied directly to relief, not only a positive-valence spike;
|
|
3544
|
+
// and a real, distinct residual-tremor echo (own opponent-process
|
|
3545
|
+
// b-process shape) that outlasts the felt relief itself.
|
|
3546
|
+
const reliefRelease = this.reliefEngine.getPhysiologicalRelease()
|
|
3547
|
+
if ( reliefRelease.cortisolRelease > 0 ) this.cortisolEngine.level = Math.max( 0, this.cortisolEngine.level - reliefRelease.cortisolRelease )
|
|
3548
|
+
const residualTremor = this.reliefEngine.getResidualTremor()
|
|
3549
|
+
if ( residualTremor > 0 ) this.emotionSpace.applySpike( { valence: 0, arousal: residualTremor, weight: 0.15 } )
|
|
3236
3550
|
|
|
3237
3551
|
// ---- 6 mechanisms found by auditing CALIBRATION.md's own existing citations ----
|
|
3238
3552
|
|
|
@@ -3298,9 +3612,14 @@ export class Totemheart {
|
|
|
3298
3612
|
// real adversity, not just felt in the moment: a real prior
|
|
3299
3613
|
// well-being reserve folds into perceivedSafety here.
|
|
3300
3614
|
const postEventDeltaValue = this.traumaCascadeEngine.postEventDelta( { residualStress: this.cortisolEngine.getLevel(), coRegulation: relation.affinity, perceivedSafety: clamp01( relation.trust + this.happinessEngine.getWellbeingNormalized( userId ) * 0.2 ) } )
|
|
3615
|
+
// Real, read-only novelty PREVIEW for this turn's own real threat
|
|
3616
|
+
// signature — read BEFORE registerTraumaEvent's own internal
|
|
3617
|
+
// repeat-counter advances, exposing the same real habituation
|
|
3618
|
+
// read `registerTraumaEvent()` uses internally, host-facing.
|
|
3619
|
+
const noveltyPreview = this.traumaCascadeEngine.getNovelty( userId, this._lastOntologyConcepts[ 0 ] ?? 'threat' )
|
|
3301
3620
|
const traceLevel = this.traumaCascadeEngine.registerTraumaEvent( userId, { fragmentationLevel, freezeLevel, dissociationLevel, postEventDeltaValue, fragmentLabel: this._lastOntologyConcepts[ 0 ] ?? 'threat', sensoryDetail: input, valence: this.emotionSpace.vector.valence } )
|
|
3302
3621
|
|
|
3303
|
-
traumaCascade = { neuroceptionLevel, fastActivationLevel, entrapmentLevel, freezeLevel, fragmentationLevel, dissociationLevel, postEventDeltaValue, traceLevel }
|
|
3622
|
+
traumaCascade = { neuroceptionLevel, fastActivationLevel, entrapmentLevel, freezeLevel, fragmentationLevel, dissociationLevel, postEventDeltaValue, traceLevel, novelty: noveltyPreview }
|
|
3304
3623
|
|
|
3305
3624
|
}
|
|
3306
3625
|
else {
|
|
@@ -3318,6 +3637,27 @@ export class Totemheart {
|
|
|
3318
3637
|
// signal is currently higher is a real, honest co-regulation
|
|
3319
3638
|
// read, not a new invented one.
|
|
3320
3639
|
this.traumaCascadeEngine.decay( userId, 1, Math.max( relation.trust, relation.affinity ) )
|
|
3640
|
+
// Real SupportQuality accumulation — a real, genuinely warm turn
|
|
3641
|
+
// while an established trauma trace is still active counts as
|
|
3642
|
+
// real received co-regulation, distinct from the instantaneous
|
|
3643
|
+
// trust/affinity level `decay()` already reads above. Gated on
|
|
3644
|
+
// a real trace actually being present, so an unrelated happy
|
|
3645
|
+
// turn for someone with no real trauma history never touches
|
|
3646
|
+
// this at all.
|
|
3647
|
+
//
|
|
3648
|
+
// Real bug found while verifying this: gating purely on THIS
|
|
3649
|
+
// turn's own `desirability` failed almost every time it was
|
|
3650
|
+
// needed most — a genuinely traumatized state (sustained
|
|
3651
|
+
// cortisol/dissociation) measurably dampens how the AI's OWN
|
|
3652
|
+
// felt valence reads the SAME warm content, so `desirability`
|
|
3653
|
+
// stayed negative even for unambiguous affection. Real support
|
|
3654
|
+
// is about what the OTHER person expressed, not how numbed the
|
|
3655
|
+
// traumatized side currently is to register it as pleasant —
|
|
3656
|
+
// a real, direct lexical `affection` concept match
|
|
3657
|
+
// (`EmotionalOntology.js`) now counts on its own, independent
|
|
3658
|
+
// of this turn's own dampened desirability reading.
|
|
3659
|
+
const genuineSupportSignal = desirability > 0.3 || ontologyMatches.some( m => m.concept === 'affection' )
|
|
3660
|
+
if ( genuineSupportSignal && this.traumaCascadeEngine.getTraumaTrace( userId ) > 0 ) this.traumaCascadeEngine.registerSupport( userId, clamp01( Math.max( desirability, 0.5 ) ) )
|
|
3321
3661
|
|
|
3322
3662
|
}
|
|
3323
3663
|
|
|
@@ -3396,7 +3736,7 @@ export class Totemheart {
|
|
|
3396
3736
|
// keyword-independent per-turn signal), so a real relational
|
|
3397
3737
|
// "vacío" can genuinely build from sustained flatness without
|
|
3398
3738
|
// needing a fight, and without depending on specific trigger words.
|
|
3399
|
-
const partnerPull = this.boredomSystem.computePartnerPull( {
|
|
3739
|
+
const partnerPull = this.boredomSystem.computePartnerPull( userId, {
|
|
3400
3740
|
affinity : relation.affinity,
|
|
3401
3741
|
desire : this.desireEngine.getDesire( userId ),
|
|
3402
3742
|
yearning : this.yearningEngine.getTrace( userId ),
|
|
@@ -3425,22 +3765,42 @@ export class Totemheart {
|
|
|
3425
3765
|
// ordinary stance but backwards for a genuinely playful one: heavy
|
|
3426
3766
|
// meaning reads as tedious while childlike, not engaging).
|
|
3427
3767
|
let meaningForBoredom = appraisal.moralWeight ?? 0
|
|
3768
|
+
// Real, dedicated childlike-serious-mismatch term — found necessary
|
|
3769
|
+
// because the indirect topicFit/meaning discounts alone still got
|
|
3770
|
+
// swamped by `partnerPull`/`desire` staying high in the user's own
|
|
3771
|
+
// integrated battery test. A direct, sizable additive boredom term
|
|
3772
|
+
// while genuinely playful meets genuinely heavy content.
|
|
3773
|
+
let childlikeSeriousMismatch = 0
|
|
3428
3774
|
if ( childlikeActiveLevel > 0 ) {
|
|
3429
3775
|
|
|
3430
3776
|
if ( isOnFrikiTopic ) topicFit = clamp01( topicFit + childlikeActiveLevel * 0.3 )
|
|
3431
|
-
if ( meaningForBoredom > 0.4 ) {
|
|
3777
|
+
if ( meaningForBoredom > 0.4 ) {
|
|
3778
|
+
|
|
3779
|
+
topicFit = clamp01( topicFit - childlikeActiveLevel * 0.5 )
|
|
3780
|
+
childlikeSeriousMismatch = clamp01( childlikeActiveLevel * meaningForBoredom )
|
|
3781
|
+
meaningForBoredom = clamp01( meaningForBoredom * ( 1 - childlikeActiveLevel * 0.7 ) )
|
|
3782
|
+
|
|
3783
|
+
}
|
|
3432
3784
|
|
|
3433
3785
|
}
|
|
3434
3786
|
const boredomResult = this.boredomSystem.compute( userId, {
|
|
3435
|
-
|
|
3787
|
+
// Real sustained-gratitude dampening — genuine recent thankfulness
|
|
3788
|
+
// toward this person real, temporarily softens how understimulated
|
|
3789
|
+
// this exchange reads, per GratitudeEngine's own getBoredomDampening().
|
|
3790
|
+
understimulation : clamp01( 0.4 - this.emotionSpace.vector.arousal - this.gratitudeEngine.getBoredomDampening( userId ) ),
|
|
3436
3791
|
satiation : topicSatiation.fatigue ?? 0,
|
|
3437
3792
|
topicFit : topicFit,
|
|
3438
|
-
|
|
3793
|
+
// Real "compared to our own past peak" decline — a genuine drop
|
|
3794
|
+
// from where this relationship's own warmth used to sit feeds real
|
|
3795
|
+
// monotony/boredom even with no rival present, NostalgiaEngine's
|
|
3796
|
+
// own new compareToPast().
|
|
3797
|
+
monotony : clamp01( 1 - novelty + pastDecline * 0.4 ),
|
|
3439
3798
|
novelty : clamp01( novelty ),
|
|
3440
3799
|
desire : this.desireEngine.getDesire( userId ),
|
|
3441
3800
|
meaning : meaningForBoredom,
|
|
3442
3801
|
play : this.primaryDrives.getDrive( 'PLAY' ),
|
|
3443
3802
|
partnerPull : partnerPull,
|
|
3803
|
+
childlikeSeriousMismatch : childlikeSeriousMismatch,
|
|
3444
3804
|
// Real bug found by the user's own battery: `childlikeThreatProxy`
|
|
3445
3805
|
// (cortisol + long-horizon trace) can still read low on the VERY
|
|
3446
3806
|
// turn a real trauma cascade genuinely fires (cortisol hasn't
|
|
@@ -3456,6 +3816,14 @@ export class Totemheart {
|
|
|
3456
3816
|
// dampens arousal/dominance a little (a real withdrawal-adjacent
|
|
3457
3817
|
// signature, distinct from sadness or fear), not just a debug number.
|
|
3458
3818
|
if ( boredomResult.boredom > 0.5 ) this.emotionSpace.applySpike( { arousal: -boredomResult.boredom * 0.15, dominance: -boredomResult.boredom * 0.1, weight: 0.25 } )
|
|
3819
|
+
|
|
3820
|
+
// Real transient hypofrontality — genuine engagement (the inverse of
|
|
3821
|
+
// this turn's own real boredom read) combined with LOW active
|
|
3822
|
+
// self-referential monitoring (this turn's own real cognitive-
|
|
3823
|
+
// dissonance stress, a genuine proxy for "actively reconciling
|
|
3824
|
+
// something about the self/narrative right now") produces a real
|
|
3825
|
+
// flow-adjacent state (Dietrich 2003, see FlowStateEngine.js).
|
|
3826
|
+
this.flowStateEngine.update( 1 - boredomResult.boredom, this.cognitiveDissonance.getStress() )
|
|
3459
3827
|
// Real, non-deterministic "does attention genuinely drift toward an
|
|
3460
3828
|
// external opportunity" check — reuses the same real opportunity/
|
|
3461
3829
|
// commitment signals already computed this turn, feeds the SAME
|
|
@@ -3668,11 +4036,59 @@ export class Totemheart {
|
|
|
3668
4036
|
// claim that arousal resets instantly).
|
|
3669
4037
|
const blushDirective = { budget: this.blushSlipEngine.getSlipBudget( blushActivation, precisionMode ), type: this.blushSlipEngine.sampleSlipType( blushActivation ), ...this.blushSlipEngine.planRepair( { trust: relation.trust } ) }
|
|
3670
4038
|
|
|
4039
|
+
// Real Model Control Plane compilation — the user's own explicit
|
|
4040
|
+
// request to close the expression<->text gap: a real, machine-
|
|
4041
|
+
// readable packet (not only prose) compiled from already-real
|
|
4042
|
+
// state, plus real decoding-parameter and activation-steering
|
|
4043
|
+
// coefficients. None of this calls an LLM itself (this codebase
|
|
4044
|
+
// never does); it's real, host-facing metadata the SAME honest
|
|
4045
|
+
// "inert unless a host reads it" discipline `logitBias` already
|
|
4046
|
+
// carries, see CALIBRATION.md.
|
|
4047
|
+
const controlPacket = this.controlPacketCompiler.compile( {
|
|
4048
|
+
valence: this.emotionSpace.vector.valence, arousal: this.emotionSpace.vector.arousal,
|
|
4049
|
+
cooling: postConflictCoolingLevel, trust: relation.trust, desire: desireLevel,
|
|
4050
|
+
boredom: boredomResult.boredom, threat: Math.max( traumaCascade?.neuroceptionLevel ?? 0, childlikeThreatProxy ?? 0 ),
|
|
4051
|
+
freeze: traumaCascade?.freezeLevel ?? 0, boundaryProbability, play: childlikeActiveLevel,
|
|
4052
|
+
flirt: flirtation, audienceFormality, prosody: visualProsody, actionTendency: dualProcess?.actionTendency ?? null,
|
|
4053
|
+
} )
|
|
4054
|
+
// Real emotionalState/systemPrompt compilation — deliberately here,
|
|
4055
|
+
// AFTER `controlPacket` above, not at the point this codebase used
|
|
4056
|
+
// to build it (right after appraisal, before boredom/trauma/
|
|
4057
|
+
// childlike/boundary even existed for this turn). `systemPrompt`
|
|
4058
|
+
// now genuinely carries THIS SAME turn's own hardened bans/must
|
|
4059
|
+
// block, not last turn's.
|
|
4060
|
+
const emotionalState = this.getEmotionalState()
|
|
4061
|
+
const systemPrompt = this.contextAdapter.buildSystemPrompt( emotionalState, {
|
|
4062
|
+
defenseDirective,
|
|
4063
|
+
pendingApology : shouldApologize,
|
|
4064
|
+
projectionText : projection.active ? projection.blameText : null,
|
|
4065
|
+
selfAwareness : this.selfModel.getDominant(),
|
|
4066
|
+
recentWound,
|
|
4067
|
+
agreement,
|
|
4068
|
+
debtReleased,
|
|
4069
|
+
stubborn : logicVerdict.strategy === 'disagree' && stubbornInvestment >= 3 ? { investment: stubbornInvestment } : null,
|
|
4070
|
+
remReport : this._lastRemReport,
|
|
4071
|
+
eurekaResolution,
|
|
4072
|
+
controlPacket,
|
|
4073
|
+
} )
|
|
4074
|
+
|
|
4075
|
+
const stateLockedMemory = this.stateLockedMemory.compile( {
|
|
4076
|
+
relation, bondNet: this.loveHateEngine.getNetBond( userId ), cooling: postConflictCoolingLevel,
|
|
4077
|
+
activeRituals: this.sharedRelationalCulture.getItems( userId ).map( ( [ key ] ) => key ),
|
|
4078
|
+
constraints: { bans: controlPacket.bans, must: controlPacket.must },
|
|
4079
|
+
} )
|
|
4080
|
+
const decodingSteering = {
|
|
4081
|
+
temperature : this.decodingSteeringAdapter.getTemperature( { arousal: this.emotionSpace.vector.arousal, precisionMode, freeze: traumaCascade?.freezeLevel ?? 0 } ),
|
|
4082
|
+
bannedPhrases : this.decodingSteeringAdapter.getBannedPhrases( controlPacket ),
|
|
4083
|
+
}
|
|
4084
|
+
const activationSteering = this.activationSteeringBridge.getCoefficients( { cooling: postConflictCoolingLevel, warmth: controlPacket.style.warmth, suspicion: this.intuitionEngine.getSuspicion( userId ) } )
|
|
4085
|
+
|
|
3671
4086
|
return {
|
|
3672
4087
|
text : modulated.text,
|
|
3673
4088
|
delayMs : modulated.delayMs,
|
|
3674
4089
|
styleTags : modulated.styleTags,
|
|
3675
4090
|
emotionalState,
|
|
4091
|
+
controlPacket, stateLockedMemory, decodingSteering, activationSteering,
|
|
3676
4092
|
systemPrompt,
|
|
3677
4093
|
logitBias,
|
|
3678
4094
|
suggestedTemperature,
|
|
@@ -3695,12 +4111,14 @@ export class Totemheart {
|
|
|
3695
4111
|
narrativeSelf : { theme: this.narrativeSelfEngine.getCurrentTheme(), coherence: this.narrativeSelfEngine.getCoherence(), chapters: this.narrativeSelfEngine.getChapterCount() },
|
|
3696
4112
|
ontogenicStage : this._ontogenicStage,
|
|
3697
4113
|
culturalScript : dominantScript,
|
|
4114
|
+
culturalScriptCatalogSize : this.culturalScriptLibrary.getScripts().length,
|
|
3698
4115
|
powerDynamics : powerUpdate,
|
|
3699
4116
|
betrayalTrauma : { hasPermanentTrace: this.betrayalTraumaTrace.hasPermanentTrace( userId ), threshold: traumaTrustThreshold },
|
|
3700
4117
|
metaEmotion : { valence: metaValence, arousal: metaArousal, curiosity: this._lastMetaCuriosity },
|
|
3701
4118
|
forecastUtility : this._lastForecastUtility,
|
|
3702
4119
|
regulationChoice : this._lastRegulationChoice,
|
|
3703
4120
|
somaticBias : somaticBias,
|
|
4121
|
+
somaticMarkerCount : this.somaticMarkerNetwork.getMarkerCount(),
|
|
3704
4122
|
insight : insight,
|
|
3705
4123
|
creativeMode : creativeMode,
|
|
3706
4124
|
energyLevel : this.energyBudget.getLevel(),
|
|
@@ -3726,6 +4144,8 @@ export class Totemheart {
|
|
|
3726
4144
|
elevationReading : elevationReading,
|
|
3727
4145
|
socialReference : socialReference,
|
|
3728
4146
|
symbolicJealousy : symbolicJealousy,
|
|
4147
|
+
eureka : eurekaResolution,
|
|
4148
|
+
flow : this.flowStateEngine.level,
|
|
3729
4149
|
loyaltyConflict : loyaltyConflict,
|
|
3730
4150
|
desire : { level: desireLevel, salience: desireSalience },
|
|
3731
4151
|
temptation : { level: temptationLevel, forbiddenness, opportunity, yieldProbability, didYield },
|
|
@@ -3740,9 +4160,11 @@ export class Totemheart {
|
|
|
3740
4160
|
suspicion : this.intuitionEngine.getSuspicion( userId ),
|
|
3741
4161
|
secretLeakProbability : secretLeakProbability,
|
|
3742
4162
|
ritualUrge : ritualUrge,
|
|
4163
|
+
sharedCultureItemCount : this.sharedRelationalCulture.getItems( userId ).length,
|
|
3743
4164
|
loneliness : lonelinessLevel,
|
|
3744
4165
|
anticipatedRegret : anticipatedRegret,
|
|
3745
4166
|
regretYieldDampening : regretYieldDampening,
|
|
4167
|
+
anticipatedUtility : anticipatedUtility,
|
|
3746
4168
|
hope : { level: hopeLevel, crash: hopeCrash },
|
|
3747
4169
|
selfAttack : selfAttack,
|
|
3748
4170
|
selfCompassion : selfCompassion,
|
|
@@ -3768,11 +4190,24 @@ export class Totemheart {
|
|
|
3768
4190
|
audienceFormality : audienceFormality,
|
|
3769
4191
|
egoHubrisIndex : this.egoCalibrationSuite.getHubrisIndex(),
|
|
3770
4192
|
egoImpostorLevel : this.egoCalibrationSuite.getImpostorLevel(),
|
|
4193
|
+
egoOscillationRisk : this.egoCalibrationSuite.getOscillationRisk(),
|
|
4194
|
+
empathicOverconfident : empathicOverconfident,
|
|
4195
|
+
opinionStance : opinionUpdate,
|
|
4196
|
+
disagreementMagnitude : disagreementMagnitude,
|
|
4197
|
+
epistemicCredibility : epistemicCredibility,
|
|
4198
|
+
manipulationSkepticism : manipulationSkepticismLevel,
|
|
4199
|
+
disagreementStyle : disagreementStyle,
|
|
4200
|
+
boundaryProbability : boundaryProbability,
|
|
4201
|
+
ambientBehavioralProfile : this.ambientBehavioralTrace.getBehavioralProfile( userId ),
|
|
4202
|
+
meaningfulSilence : meaningfulSilence,
|
|
4203
|
+
ambientBurstiness : this.ambientBehavioralTrace.getBurstiness( userId ),
|
|
4204
|
+
savoring : savoringLevel,
|
|
3771
4205
|
ruminationMode : ruminationMode.mode,
|
|
3772
4206
|
reactance : reactance,
|
|
3773
4207
|
psychologicalDistance : psychDistance,
|
|
3774
4208
|
moralLicense : moralLicense,
|
|
3775
4209
|
selfHandicapPressure : selfHandicapPressure,
|
|
4210
|
+
selfHandicapHedge : selfHandicapHedge,
|
|
3776
4211
|
relationalAfterglow : afterglow,
|
|
3777
4212
|
amusement : amusement,
|
|
3778
4213
|
moralDisgust : moralDisgustLevel,
|
|
@@ -3810,6 +4245,7 @@ export class Totemheart {
|
|
|
3810
4245
|
perceivedArousalBoost : perceivedArousalBoost,
|
|
3811
4246
|
weberFechnerPerceivedChange : weberFechnerPerceivedChange,
|
|
3812
4247
|
freeEnergyEstimate : this.predictiveProcessingCore.getFreeEnergyEstimate( `desirability:${userId}` ),
|
|
4248
|
+
predictiveEstimateBefore : predictiveEstimateBefore,
|
|
3813
4249
|
hickHymanDelayMs : hickHymanDelayMs,
|
|
3814
4250
|
gratitudeYield : gratitudeYield,
|
|
3815
4251
|
interoceptiveAwareness : this.interoceptiveAwarenessGain.getAccuracy(),
|
|
@@ -3824,6 +4260,7 @@ export class Totemheart {
|
|
|
3824
4260
|
frikiEgoThreat : frikiEgoThreat,
|
|
3825
4261
|
frikiReveal : frikiReveal,
|
|
3826
4262
|
frikiShare : frikiShare,
|
|
4263
|
+
frikiTopInterests : this.frikiEngine.rankInterests( { k: 3 } ).map( n => n.topic ),
|
|
3827
4264
|
somaticActivation : somaticActivation.level,
|
|
3828
4265
|
ghostingPain : ghostingPain,
|
|
3829
4266
|
globalMoodAbatement : this.globalMoodAbatement.level,
|
|
@@ -3898,6 +4335,11 @@ export class Totemheart {
|
|
|
3898
4335
|
// since its own level itself already snaps down hard on real
|
|
3899
4336
|
// threat/shame/humiliation — see `ChildlikeMode.shouldAbort()`).
|
|
3900
4337
|
const engagementBiases = userId ? this.boredomSystem.expressionBiases( userId ) : { lengthBias: 1, initiativeBias: 1, enthusiasmBias: 1 }
|
|
4338
|
+
// Real, distinct loneliness damping on the AI's own real willingness
|
|
4339
|
+
// to initiate — a genuinely lonely state doesn't just feel bad, it
|
|
4340
|
+
// measurably suppresses real conversational initiative (own real,
|
|
4341
|
+
// separate downstream consequence, not the same felt-state number).
|
|
4342
|
+
engagementBiases.initiativeBias = clamp01( engagementBiases.initiativeBias - this.lonelinessEngine.getInitiativeDamping() )
|
|
3901
4343
|
const playfulness = userId ? this.childlikeMode.getLevel( userId ) : 0
|
|
3902
4344
|
|
|
3903
4345
|
return {
|
|
@@ -3928,7 +4370,13 @@ export class Totemheart {
|
|
|
3928
4370
|
// mechanics (allostasis reset among them) assume tracks plain wall-clock dt —
|
|
3929
4371
|
// memory retention fading faster during a subjectively "long" stretch is a
|
|
3930
4372
|
// real, lower-blast-radius place for this same effect to land.
|
|
3931
|
-
|
|
4373
|
+
// Real, distinct flow-state time compression — genuine absorption
|
|
4374
|
+
// measurably compounds on top of the arousal/fatigue-driven
|
|
4375
|
+
// subjective-time multiplier already computed below (Dietrich 2003's
|
|
4376
|
+
// own "time disappearing" account of flow, composed with, not
|
|
4377
|
+
// replacing, SubjectiveTimeEngine's own separate arousal-driven read).
|
|
4378
|
+
const flowCompression = 1 - this.flowStateEngine.getSubjectiveTimeCompressionBonus()
|
|
4379
|
+
const subjectiveDt = dt * this.subjectiveTimeEngine.getSubjectiveDtMultiplier( this.emotionSpace.vector.arousal, this._lastTopicFatigue ?? 0 ) * flowCompression
|
|
3932
4380
|
|
|
3933
4381
|
const valenceBefore = this.emotionSpace.vector.valence
|
|
3934
4382
|
this.decayEngine.apply( this.emotionSpace, mood, this.personality, dt )
|
|
@@ -3977,6 +4425,16 @@ export class Totemheart {
|
|
|
3977
4425
|
this.yearningEngine.decayAll( dt )
|
|
3978
4426
|
this.childlikeMode.decayAll( dt )
|
|
3979
4427
|
this.boredomSystem.decayAllUsers( dt )
|
|
4428
|
+
this.jealousyTriangle.decayHate( dt )
|
|
4429
|
+
this.infatuationEngine.decay( dt )
|
|
4430
|
+
this.prideCompetenceEngine.decay( dt )
|
|
4431
|
+
this.socialFatigueEngine.rest( dt )
|
|
4432
|
+
this.dailyExpectationEngine.decayAll( dt )
|
|
4433
|
+
this.gratitudeEngine.decayAll( dt )
|
|
4434
|
+
this.deceptionDecisionEngine.decayAll( dt )
|
|
4435
|
+
this.clinginessEngine.decayAll( dt )
|
|
4436
|
+
this.capitalVicesEngine.decayWrath( dt )
|
|
4437
|
+
for ( const userId of this.epistemicTrust.priorError.keys() ) this.epistemicTrust.decayPriorError( userId, dt )
|
|
3980
4438
|
// Real ambient absence pull — YearningEngine.tickAbsence(), per the
|
|
3981
4439
|
// user's own explicit request: a genuinely significant absent person
|
|
3982
4440
|
// (a real permanent milestone) should be missed a little just from
|
|
@@ -4201,6 +4659,28 @@ export class Totemheart {
|
|
|
4201
4659
|
yearningTraces : this.yearningEngine.toJSON(),
|
|
4202
4660
|
childlikeLevels : this.childlikeMode.toJSON(),
|
|
4203
4661
|
boredomState : this.boredomSystem.toJSON(),
|
|
4662
|
+
jealousyTriangleState : this.jealousyTriangle.toJSON(),
|
|
4663
|
+
socialGraph : this.socialGraphClassifier.toJSON(),
|
|
4664
|
+
infatuationState : this.infatuationEngine.toJSON(),
|
|
4665
|
+
contactFrequencyState : this.contactFrequencyExpectation.toJSON(),
|
|
4666
|
+
comfortSeekingState : this.comfortSeekingEngine.toJSON(),
|
|
4667
|
+
prideCompetenceState : this.prideCompetenceEngine.toJSON(),
|
|
4668
|
+
socialFatigueLevel : this.socialFatigueEngine.toJSON(),
|
|
4669
|
+
firstImpressionState : this.firstImpressionEngine.toJSON(),
|
|
4670
|
+
dailyExpectationState : this.dailyExpectationEngine.toJSON(),
|
|
4671
|
+
comfortAccumulationState : this.comfortAccumulation.toJSON(),
|
|
4672
|
+
gratitudeSustainedState : [ ...this.gratitudeEngine.state.entries() ],
|
|
4673
|
+
nostalgiaPeakWarmth : this.nostalgiaEngine.toJSON(),
|
|
4674
|
+
forgivenessPhases : this.forgivenessProcess.toJSON(),
|
|
4675
|
+
validationSeekingState : this.validationSeekingEngine.toJSON(),
|
|
4676
|
+
deceptionActiveLies : this.deceptionDecisionEngine.toJSON(),
|
|
4677
|
+
clinginessState : this.clinginessEngine.toJSON(),
|
|
4678
|
+
flowStateLevel : this.flowStateEngine.toJSON(),
|
|
4679
|
+
capitalVicesState : this.capitalVicesEngine.toJSON(),
|
|
4680
|
+
opinionStanceState : this.opinionStanceEngine.toJSON(),
|
|
4681
|
+
ambientBehavioralState : this.ambientBehavioralTrace.toJSON(),
|
|
4682
|
+
fineTuneCurriculumState : this.fineTuneCurriculum.toJSON(),
|
|
4683
|
+
epistemicTrustState : this.epistemicTrust.toJSON(),
|
|
4204
4684
|
frikiEngine : this.frikiEngine.toJSON(),
|
|
4205
4685
|
somaticActivationLevels : [ ...this.somaticActivationSystems.entries() ].map( ( [ id, s ] ) => [ id, s.level ] ),
|
|
4206
4686
|
globalMoodAbatementLevel : this.globalMoodAbatement.level,
|
|
@@ -4263,6 +4743,8 @@ export class Totemheart {
|
|
|
4263
4743
|
traumaSeverity : [ ...this.traumaCascadeEngine.severity.entries() ],
|
|
4264
4744
|
traumaScarFloor : [ ...this.traumaCascadeEngine.scarFloor.entries() ],
|
|
4265
4745
|
traumaRecentSignature : [ ...this.traumaCascadeEngine.recentSignature.entries() ],
|
|
4746
|
+
traumaSupportQuality : [ ...this.traumaCascadeEngine.supportQuality.entries() ],
|
|
4747
|
+
traumaBaseScarFloor : [ ...this.traumaCascadeEngine.baseScarFloor.entries() ],
|
|
4266
4748
|
happinessSumCR : [ ...this.happinessEngine.sumCR.entries() ],
|
|
4267
4749
|
happinessSumEV : [ ...this.happinessEngine.sumEV.entries() ],
|
|
4268
4750
|
happinessSumRPE : [ ...this.happinessEngine.sumRPE.entries() ],
|
|
@@ -4405,6 +4887,30 @@ export class Totemheart {
|
|
|
4405
4887
|
if ( data.traumaSeverity ) this.traumaCascadeEngine.severity = new Map( data.traumaSeverity )
|
|
4406
4888
|
if ( data.traumaScarFloor ) this.traumaCascadeEngine.scarFloor = new Map( data.traumaScarFloor )
|
|
4407
4889
|
if ( data.traumaRecentSignature ) this.traumaCascadeEngine.recentSignature = new Map( data.traumaRecentSignature )
|
|
4890
|
+
if ( data.traumaSupportQuality ) this.traumaCascadeEngine.supportQuality = new Map( data.traumaSupportQuality )
|
|
4891
|
+
if ( data.traumaBaseScarFloor ) this.traumaCascadeEngine.baseScarFloor = new Map( data.traumaBaseScarFloor )
|
|
4892
|
+
if ( data.jealousyTriangleState ) this.jealousyTriangle.restoreState( data.jealousyTriangleState )
|
|
4893
|
+
if ( data.socialGraph ) this.socialGraphClassifier.restoreState( data.socialGraph )
|
|
4894
|
+
if ( data.infatuationState ) this.infatuationEngine.restoreState( data.infatuationState )
|
|
4895
|
+
if ( data.contactFrequencyState ) this.contactFrequencyExpectation.restoreState( data.contactFrequencyState )
|
|
4896
|
+
if ( data.comfortSeekingState ) this.comfortSeekingEngine.restoreState( data.comfortSeekingState )
|
|
4897
|
+
if ( data.prideCompetenceState ) this.prideCompetenceEngine.restoreState( data.prideCompetenceState )
|
|
4898
|
+
if ( data.socialFatigueLevel !== undefined ) this.socialFatigueEngine.restoreState( data.socialFatigueLevel )
|
|
4899
|
+
if ( data.firstImpressionState ) this.firstImpressionEngine.restoreState( data.firstImpressionState )
|
|
4900
|
+
if ( data.dailyExpectationState ) this.dailyExpectationEngine.restoreState( data.dailyExpectationState )
|
|
4901
|
+
if ( data.comfortAccumulationState ) this.comfortAccumulation.restoreState( data.comfortAccumulationState )
|
|
4902
|
+
if ( data.gratitudeSustainedState ) this.gratitudeEngine.state = new Map( data.gratitudeSustainedState )
|
|
4903
|
+
if ( data.nostalgiaPeakWarmth ) this.nostalgiaEngine.restoreState( data.nostalgiaPeakWarmth )
|
|
4904
|
+
if ( data.forgivenessPhases ) this.forgivenessProcess.restoreState( data.forgivenessPhases )
|
|
4905
|
+
if ( data.validationSeekingState ) this.validationSeekingEngine.restoreState( data.validationSeekingState )
|
|
4906
|
+
if ( data.deceptionActiveLies ) this.deceptionDecisionEngine.restoreState( data.deceptionActiveLies )
|
|
4907
|
+
if ( data.clinginessState ) this.clinginessEngine.restoreState( data.clinginessState )
|
|
4908
|
+
if ( data.flowStateLevel !== undefined ) this.flowStateEngine.restoreState( data.flowStateLevel )
|
|
4909
|
+
if ( data.capitalVicesState ) this.capitalVicesEngine.restoreState( data.capitalVicesState )
|
|
4910
|
+
if ( data.opinionStanceState ) this.opinionStanceEngine.restoreState( data.opinionStanceState )
|
|
4911
|
+
if ( data.ambientBehavioralState ) this.ambientBehavioralTrace.restoreState( data.ambientBehavioralState )
|
|
4912
|
+
if ( data.fineTuneCurriculumState ) this.fineTuneCurriculum.restoreState( data.fineTuneCurriculumState )
|
|
4913
|
+
if ( data.epistemicTrustState ) this.epistemicTrust.restoreState( data.epistemicTrustState )
|
|
4408
4914
|
if ( data.happinessSumCR ) this.happinessEngine.sumCR = new Map( data.happinessSumCR )
|
|
4409
4915
|
if ( data.happinessSumEV ) this.happinessEngine.sumEV = new Map( data.happinessSumEV )
|
|
4410
4916
|
if ( data.happinessSumRPE ) this.happinessEngine.sumRPE = new Map( data.happinessSumRPE )
|