@mindot/will 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +32 -12
  2. package/dist/channels/discord.d.ts +2 -11
  3. package/dist/channels/discord.js.map +1 -1
  4. package/dist/channels/whatsapp.d.ts +72 -0
  5. package/dist/channels/whatsapp.js +252 -0
  6. package/dist/channels/whatsapp.js.map +1 -0
  7. package/dist/cli.js +837 -91
  8. package/dist/cli.js.map +1 -1
  9. package/dist/index.d.ts +2 -2
  10. package/dist/index.js +620 -79
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp/effectors.d.ts +1 -1
  13. package/dist/mcp/effectors.js.map +1 -1
  14. package/dist/types-E9-HV-SW.d.ts +11 -0
  15. package/dist/{will-D-slky1N.d.ts → will-Bikuk4s2.d.ts} +56 -12
  16. package/package.json +12 -3
  17. package/src/channels/discord.ts +11 -11
  18. package/src/channels/roster.ts +1 -1
  19. package/src/channels/types.ts +1 -1
  20. package/src/channels/whatsapp.ts +318 -0
  21. package/src/cli.ts +46 -23
  22. package/src/cognition/acp.ts +28 -0
  23. package/src/cognition/agency/consequence.ts +174 -0
  24. package/src/cognition/agency/engines/action.selector.ts +301 -48
  25. package/src/cognition/agency/engines/affordance.synthesizer.ts +26 -16
  26. package/src/cognition/agency/engines/deliberation.engine.ts +28 -14
  27. package/src/cognition/agency/engines/motor.schema.executor.ts +86 -14
  28. package/src/cognition/agency/engines/reafference.engine.ts +122 -18
  29. package/src/cognition/agency/execution.primitives.ts +13 -13
  30. package/src/cognition/agency/proactive.communicator.ts +1 -1
  31. package/src/cognition/agency/reconcile.learning.ts +1 -1
  32. package/src/cognition/agency/revocation.ts +79 -0
  33. package/src/cognition/agency/schemas/repertoire.ts +2 -2
  34. package/src/cognition/agency/selection.scoring.ts +25 -9
  35. package/src/cognition/bus.ts +2 -2
  36. package/src/cognition/completion.inbox.ts +1 -1
  37. package/src/cognition/config.mirror.entities.ts +5 -5
  38. package/src/cognition/event.log.ts +2 -2
  39. package/src/cognition/event.schemas.ts +67 -67
  40. package/src/cognition/faculties/aesthetic.evaluator.ts +6 -6
  41. package/src/cognition/faculties/affective.blender.ts +36 -4
  42. package/src/cognition/faculties/attachment.evaluator.ts +6 -6
  43. package/src/cognition/faculties/attention.allocator.ts +63 -8
  44. package/src/cognition/faculties/autobiographical.narrator.ts +3 -3
  45. package/src/cognition/faculties/bias.detector.ts +7 -7
  46. package/src/cognition/faculties/circadian.oscillator.ts +3 -3
  47. package/src/cognition/faculties/confidence.calibrator.ts +7 -7
  48. package/src/cognition/faculties/dream.simulator.ts +5 -5
  49. package/src/cognition/faculties/empathy.simulator.ts +7 -7
  50. package/src/cognition/faculties/energy.regulator.ts +4 -4
  51. package/src/cognition/faculties/episodic.consolidator.ts +6 -6
  52. package/src/cognition/faculties/executive.engine/commands.ts +6 -6
  53. package/src/cognition/faculties/executive.engine/context.ts +42 -42
  54. package/src/cognition/faculties/executive.engine/deferred.effects.ts +2 -2
  55. package/src/cognition/faculties/executive.engine/engine.ts +27 -26
  56. package/src/cognition/faculties/executive.engine/facet.supervisor.ts +12 -12
  57. package/src/cognition/faculties/executive.engine/facet.ts +18 -18
  58. package/src/cognition/faculties/executive.engine/gating.ts +2 -2
  59. package/src/cognition/faculties/executive.engine/messages.ts +3 -3
  60. package/src/cognition/faculties/executive.engine/parser.ts +11 -11
  61. package/src/cognition/faculties/executive.engine/prompt.factory.ts +55 -55
  62. package/src/cognition/faculties/exteroception.ts +99 -5
  63. package/src/cognition/faculties/forgetting.curve.ts +3 -3
  64. package/src/cognition/faculties/frustration.evaluator.ts +6 -6
  65. package/src/cognition/faculties/goal.manager.ts +15 -15
  66. package/src/cognition/faculties/inhibition.controller.ts +3 -3
  67. package/src/cognition/faculties/interoception.ts +3 -3
  68. package/src/cognition/faculties/introspection.engine.ts +3 -3
  69. package/src/cognition/faculties/known.entity.tracker.ts +15 -15
  70. package/src/cognition/faculties/loss.evaluator.ts +2 -2
  71. package/src/cognition/faculties/moral.evaluator.ts +4 -4
  72. package/src/cognition/faculties/novelty.detector.ts +4 -4
  73. package/src/cognition/faculties/persona.consolidator.ts +12 -12
  74. package/src/cognition/faculties/planning.engine/engine.ts +47 -47
  75. package/src/cognition/faculties/planning.engine/plan.frontier.ts +5 -5
  76. package/src/cognition/faculties/planning.engine/plan.store.ts +1 -1
  77. package/src/cognition/faculties/planning.engine/plan.supervision.ts +20 -20
  78. package/src/cognition/faculties/reputation.tracker.ts +6 -6
  79. package/src/cognition/faculties/reward.evaluator.ts +4 -4
  80. package/src/cognition/faculties/self.model.updater.ts +8 -8
  81. package/src/cognition/faculties/semantic.engine/integrator.ts +15 -15
  82. package/src/cognition/faculties/sleep.pressure.regulator.ts +4 -4
  83. package/src/cognition/faculties/social.perception.ts +3 -3
  84. package/src/cognition/faculties/spaced.repetition.ts +2 -2
  85. package/src/cognition/faculties/stress.regulator.ts +27 -4
  86. package/src/cognition/faculties/task.switcher.ts +11 -6
  87. package/src/cognition/faculties/theory.of.mind.ts +6 -6
  88. package/src/cognition/faculties/threat.evaluator.ts +3 -3
  89. package/src/cognition/faculties/working.memory.ts +8 -8
  90. package/src/cognition/generative.model.ts +2 -2
  91. package/src/cognition/memory/vector.adapter.ts +5 -5
  92. package/src/cognition/memory/vector.content.ts +4 -4
  93. package/src/cognition/memory/vector.embedder.ts +9 -9
  94. package/src/cognition/persona.prior.ts +1 -1
  95. package/src/cognition/schema.registry.ts +2 -2
  96. package/src/cognition/senses/audition.engine/engine.ts +2 -2
  97. package/src/cognition/senses/base.sense.engine.ts +1 -1
  98. package/src/cognition/utilities/token.tracker.ts +11 -5
  99. package/src/core/abstracts.ts +1 -1
  100. package/src/core/completion.recorder.ts +2 -2
  101. package/src/core/serialization.ts +3 -3
  102. package/src/core/snapshot.manager.ts +1 -1
  103. package/src/core/state.manager.ts +1 -1
  104. package/src/core/utils.ts +1 -1
  105. package/src/host/boot.ts +59 -37
  106. package/src/host/utterances.ts +1 -1
  107. package/src/llm/index.ts +84 -34
  108. package/src/llm/summarizer.ts +4 -4
  109. package/src/llm/wire.contracts.ts +1 -1
  110. package/src/mcp/effectors.ts +10 -10
  111. package/src/mcp/server.ts +11 -11
  112. package/src/pma/eval.ts +1 -1
  113. package/src/pma/index.ts +21 -21
  114. package/src/runners/outreach.runner.ts +3 -3
  115. package/src/runners/social.runner.ts +1 -1
  116. package/src/runners/thin-shim.runner.ts +1 -1
  117. package/src/sdk/will.ts +20 -11
  118. package/src/serve/server.ts +12 -12
  119. package/src/stem/assembly.audit.ts +3 -3
  120. package/src/stem/guards/identity.coherence.ts +13 -12
  121. package/src/stem/guards/identity.guard.ts +22 -22
  122. package/src/stem/index.ts +11 -11
  123. package/src/stem/mind.ts +12 -12
  124. package/src/stem/tracts/biography.writer.ts +3 -3
  125. package/src/stem/tracts/effector.controller.ts +4 -4
  126. package/src/stem/tracts/health.reporter.ts +1 -1
  127. package/src/stem/tracts/outbox.controller.ts +4 -0
  128. package/src/stem/tracts/outbox.writer.ts +4 -4
  129. package/src/stem/tracts/pma.controller.ts +1 -1
  130. package/src/stem/tracts/replay.controller.ts +10 -10
  131. package/src/stem/tracts/sensory.controller.ts +2 -2
  132. package/src/stem/tracts/session.logger.ts +4 -4
  133. package/src/stem/tracts/transport/socketio.transport.ts +7 -7
  134. package/src/stem/tracts/transport/stream.transport.ts +2 -2
  135. package/src/stem/tracts/transport.controller.ts +15 -15
@@ -28,7 +28,7 @@ globalSchemaRegistry.register({
28
28
  type: 'stress.zone.transition', version: 1,
29
29
  validate( p ){
30
30
  if( !isObj(p) ) return 'payload must be object'
31
- return hasNum( p, 'zone' ) ?? hasNum( p, 'load' )
31
+ return hasNum( p, 'zone') ?? hasNum( p, 'load')
32
32
  },
33
33
  })
34
34
 
@@ -36,7 +36,7 @@ globalSchemaRegistry.register({
36
36
  type: 'energy.level.critical', version: 1,
37
37
  validate( p ){
38
38
  if( !isObj(p) ) return 'payload must be object'
39
- return hasNum( p, 'level' )
39
+ return hasNum( p, 'level')
40
40
  },
41
41
  })
42
42
 
@@ -44,7 +44,7 @@ globalSchemaRegistry.register({
44
44
  type: 'sleep.pressure.critical', version: 1,
45
45
  validate( p ){
46
46
  if( !isObj(p) ) return 'payload must be object'
47
- return hasNum( p, 'pressure' )
47
+ return hasNum( p, 'pressure')
48
48
  },
49
49
  })
50
50
 
@@ -52,7 +52,7 @@ globalSchemaRegistry.register({
52
52
  type: 'circadian.alertness.shifted', version: 1,
53
53
  validate( p ){
54
54
  if( !isObj(p) ) return 'payload must be object'
55
- return hasNum( p, 'alertness' )
55
+ return hasNum( p, 'alertness')
56
56
  },
57
57
  })
58
58
 
@@ -60,7 +60,7 @@ globalSchemaRegistry.register({
60
60
  type: 'modulation.degradation.elevated', version: 1,
61
61
  validate( p ){
62
62
  if( !isObj(p) ) return 'payload must be object'
63
- return hasNum( p, 'attentionDegradation' )
63
+ return hasNum( p, 'attentionDegradation')
64
64
  },
65
65
  })
66
66
 
@@ -70,7 +70,7 @@ globalSchemaRegistry.register({
70
70
  type: 'perception.novelty.spike', version: 1,
71
71
  validate( p ){
72
72
  if( !isObj(p) ) return 'payload must be object'
73
- return hasNum( p, 'novelty' )
73
+ return hasNum( p, 'novelty')
74
74
  },
75
75
  })
76
76
 
@@ -78,7 +78,7 @@ globalSchemaRegistry.register({
78
78
  type: 'percept.batch.ingested', version: 1,
79
79
  validate( p ){
80
80
  if( !isObj(p) ) return 'payload must be object'
81
- return hasNum( p, 'count' )
81
+ return hasNum( p, 'count')
82
82
  },
83
83
  })
84
84
 
@@ -86,7 +86,7 @@ globalSchemaRegistry.register({
86
86
  type: 'social.agents.present', version: 1,
87
87
  validate( p ){
88
88
  if( !isObj(p) ) return 'payload must be object'
89
- return hasNum( p, 'activeAgents' )
89
+ return hasNum( p, 'activeAgents')
90
90
  },
91
91
  })
92
92
 
@@ -94,7 +94,7 @@ globalSchemaRegistry.register({
94
94
  type: 'interoception.state.updated', version: 1,
95
95
  validate( p ){
96
96
  if( !isObj(p) ) return 'payload must be object'
97
- return hasNum( p, 'comfort' )
97
+ return hasNum( p, 'comfort')
98
98
  },
99
99
  })
100
100
 
@@ -102,7 +102,7 @@ globalSchemaRegistry.register({
102
102
  type: 'working_memory.capacity.reached', version: 1,
103
103
  validate( p ){
104
104
  if( !isObj(p) ) return 'payload must be object'
105
- return hasNum( p, 'capacity' ) ?? hasNum( p, 'items' )
105
+ return hasNum( p, 'capacity') ?? hasNum( p, 'items')
106
106
  },
107
107
  })
108
108
 
@@ -112,7 +112,7 @@ globalSchemaRegistry.register({
112
112
  type: 'emotion.fear.elevated', version: 1,
113
113
  validate( p ){
114
114
  if( !isObj(p) ) return 'payload must be object'
115
- return hasNum( p, 'fear' )
115
+ return hasNum( p, 'fear')
116
116
  },
117
117
  })
118
118
 
@@ -120,7 +120,7 @@ globalSchemaRegistry.register({
120
120
  type: 'emotion.joy.peak', version: 1,
121
121
  validate( p ){
122
122
  if( !isObj(p) ) return 'payload must be object'
123
- return hasNum( p, 'joy' )
123
+ return hasNum( p, 'joy')
124
124
  },
125
125
  })
126
126
 
@@ -128,7 +128,7 @@ globalSchemaRegistry.register({
128
128
  type: 'emotion.awe.experienced', version: 1,
129
129
  validate( p ){
130
130
  if( !isObj(p) ) return 'payload must be object'
131
- return hasNum( p, 'awe' )
131
+ return hasNum( p, 'awe')
132
132
  },
133
133
  })
134
134
 
@@ -136,7 +136,7 @@ globalSchemaRegistry.register({
136
136
  type: 'emotion.frustration.elevated', version: 1,
137
137
  validate( p ){
138
138
  if( !isObj(p) ) return 'payload must be object'
139
- return hasNum( p, 'frustration' )
139
+ return hasNum( p, 'frustration')
140
140
  },
141
141
  })
142
142
 
@@ -144,7 +144,7 @@ globalSchemaRegistry.register({
144
144
  type: 'emotion.guilt.elevated', version: 1,
145
145
  validate( p ){
146
146
  if( !isObj(p) ) return 'payload must be object'
147
- return hasNum( p, 'guilt' )
147
+ return hasNum( p, 'guilt')
148
148
  },
149
149
  })
150
150
 
@@ -152,7 +152,7 @@ globalSchemaRegistry.register({
152
152
  type: 'emotion.love.significant', version: 1,
153
153
  validate( p ){
154
154
  if( !isObj(p) ) return 'payload must be object'
155
- return hasNum( p, 'love' )
155
+ return hasNum( p, 'love')
156
156
  },
157
157
  })
158
158
 
@@ -160,7 +160,7 @@ globalSchemaRegistry.register({
160
160
  type: 'emotion.sadness.elevated', version: 1,
161
161
  validate( p ){
162
162
  if( !isObj(p) ) return 'payload must be object'
163
- return hasNum( p, 'sadness' )
163
+ return hasNum( p, 'sadness')
164
164
  },
165
165
  })
166
166
 
@@ -168,7 +168,7 @@ globalSchemaRegistry.register({
168
168
  type: 'affect.state.shifted', version: 1,
169
169
  validate( p ){
170
170
  if( !isObj(p) ) return 'payload must be object'
171
- return hasNum( p, 'valence' ) ?? hasNum( p, 'arousal' )
171
+ return hasNum( p, 'valence') ?? hasNum( p, 'arousal')
172
172
  },
173
173
  })
174
174
 
@@ -178,7 +178,7 @@ globalSchemaRegistry.register({
178
178
  type: 'goal.state.changed', version: 1,
179
179
  validate( p ){
180
180
  if( !isObj(p) ) return 'payload must be object'
181
- return hasNum( p, 'activeCount' )
181
+ return hasNum( p, 'activeCount')
182
182
  },
183
183
  })
184
184
 
@@ -186,8 +186,8 @@ globalSchemaRegistry.register({
186
186
  type: 'decision.committed', version: 1,
187
187
  validate( p ){
188
188
  if( !isObj(p) ) return 'payload must be object'
189
- if( typeof p['actionType'] !== 'string' ) return "missing string field 'actionType'"
190
- return hasNum( p, 'confidence' )
189
+ if( typeof p['actionType'] !== 'string') return "missing string field 'actionType'"
190
+ return hasNum( p, 'confidence')
191
191
  },
192
192
  })
193
193
 
@@ -204,7 +204,7 @@ globalSchemaRegistry.register({
204
204
  type: 'planning.plan.created', version: 1,
205
205
  validate( p ){
206
206
  if( !isObj(p) ) return 'payload must be object'
207
- return hasNum( p, 'totalPlans' )
207
+ return hasNum( p, 'totalPlans')
208
208
  },
209
209
  })
210
210
 
@@ -212,7 +212,7 @@ globalSchemaRegistry.register({
212
212
  type: 'task.focus.changed', version: 1,
213
213
  validate( p ){
214
214
  if( !isObj(p) ) return 'payload must be object'
215
- return hasNum( p, 'focusTicks' )
215
+ return hasNum( p, 'focusTicks')
216
216
  },
217
217
  })
218
218
 
@@ -221,7 +221,7 @@ globalSchemaRegistry.register({
221
221
  type: 'action.executed', version: 1,
222
222
  validate( p ){
223
223
  if( !isObj(p) ) return 'payload must be object'
224
- return hasNum( p, 'count' )
224
+ return hasNum( p, 'count')
225
225
  },
226
226
  })
227
227
 
@@ -231,7 +231,7 @@ globalSchemaRegistry.register({
231
231
  type: 'episode.consolidated', version: 1,
232
232
  validate( p ){
233
233
  if( !isObj(p) ) return 'payload must be object'
234
- return hasNum( p, 'total' )
234
+ return hasNum( p, 'total')
235
235
  },
236
236
  })
237
237
 
@@ -239,7 +239,7 @@ globalSchemaRegistry.register({
239
239
  type: 'belief.updated', version: 1,
240
240
  validate( p ){
241
241
  if( !isObj(p) ) return 'payload must be object'
242
- return hasNum( p, 'total' )
242
+ return hasNum( p, 'total')
243
243
  },
244
244
  })
245
245
 
@@ -247,7 +247,7 @@ globalSchemaRegistry.register({
247
247
  type: 'memory.decay.applied', version: 1,
248
248
  validate( p ){
249
249
  if( !isObj(p) ) return 'payload must be object'
250
- return hasNum( p, 'decayed' )
250
+ return hasNum( p, 'decayed')
251
251
  },
252
252
  })
253
253
 
@@ -255,7 +255,7 @@ globalSchemaRegistry.register({
255
255
  type: 'dream.active', version: 1,
256
256
  validate( p ){
257
257
  if( !isObj(p) ) return 'payload must be object'
258
- return hasNum( p, 'reactivated' )
258
+ return hasNum( p, 'reactivated')
259
259
  },
260
260
  })
261
261
 
@@ -263,7 +263,7 @@ globalSchemaRegistry.register({
263
263
  type: 'narrative.updated', version: 1,
264
264
  validate( p ){
265
265
  if( !isObj(p) ) return 'payload must be object'
266
- return hasNum( p, 'version' )
266
+ return hasNum( p, 'version')
267
267
  },
268
268
  })
269
269
 
@@ -273,7 +273,7 @@ globalSchemaRegistry.register({
273
273
  type: 'self_model.updated', version: 1,
274
274
  validate( p ){
275
275
  if( !isObj(p) ) return 'payload must be object'
276
- return hasNum( p, 'version' )
276
+ return hasNum( p, 'version')
277
277
  },
278
278
  })
279
279
 
@@ -281,7 +281,7 @@ globalSchemaRegistry.register({
281
281
  type: 'confidence.calibrated', version: 1,
282
282
  validate( p ){
283
283
  if( !isObj(p) ) return 'payload must be object'
284
- return hasNum( p, 'calibrationBias' )
284
+ return hasNum( p, 'calibrationBias')
285
285
  },
286
286
  })
287
287
 
@@ -289,7 +289,7 @@ globalSchemaRegistry.register({
289
289
  type: 'bias.detected', version: 1,
290
290
  validate( p ){
291
291
  if( !isObj(p) ) return 'payload must be object'
292
- return hasNum( p, 'count' )
292
+ return hasNum( p, 'count')
293
293
  },
294
294
  })
295
295
 
@@ -297,7 +297,7 @@ globalSchemaRegistry.register({
297
297
  type: 'introspection.insight', version: 1,
298
298
  validate( p ){
299
299
  if( !isObj(p) ) return 'payload must be object'
300
- return hasNum( p, 'total' )
300
+ return hasNum( p, 'total')
301
301
  },
302
302
  })
303
303
 
@@ -305,7 +305,7 @@ globalSchemaRegistry.register({
305
305
  type: 'theory_of_mind.model.updated', version: 1,
306
306
  validate( p ){
307
307
  if( !isObj(p) ) return 'payload must be object'
308
- return hasNum( p, 'modelsActive' )
308
+ return hasNum( p, 'modelsActive')
309
309
  },
310
310
  })
311
311
 
@@ -313,7 +313,7 @@ globalSchemaRegistry.register({
313
313
  type: 'empathy.resonance', version: 1,
314
314
  validate( p ){
315
315
  if( !isObj(p) ) return 'payload must be object'
316
- return hasNum( p, 'activeModels' )
316
+ return hasNum( p, 'activeModels')
317
317
  },
318
318
  })
319
319
 
@@ -321,7 +321,7 @@ globalSchemaRegistry.register({
321
321
  type: 'reputation.updated', version: 1,
322
322
  validate( p ){
323
323
  if( !isObj(p) ) return 'payload must be object'
324
- return hasNum( p, 'trackedAgents' )
324
+ return hasNum( p, 'trackedAgents')
325
325
  },
326
326
  })
327
327
 
@@ -331,7 +331,7 @@ globalSchemaRegistry.register({
331
331
  type: 'executive.active', version: 1,
332
332
  validate( p ){
333
333
  if( !isObj(p) ) return 'payload must be object'
334
- return hasNum( p, 'tick' )
334
+ return hasNum( p, 'tick')
335
335
  },
336
336
  })
337
337
 
@@ -339,7 +339,7 @@ globalSchemaRegistry.register({
339
339
  type: 'communication.session.active', version: 1,
340
340
  validate( p ){
341
341
  if( !isObj(p) ) return 'payload must be object'
342
- return hasNum( p, 'sessionCount' )
342
+ return hasNum( p, 'sessionCount')
343
343
  },
344
344
  })
345
345
 
@@ -347,7 +347,7 @@ globalSchemaRegistry.register({
347
347
  type: 'llm.cost.tick', version: 1,
348
348
  validate( p ){
349
349
  if( !isObj(p) ) return 'payload must be object'
350
- return hasNum( p, 'costThisTick' )
350
+ return hasNum( p, 'costThisTick')
351
351
  },
352
352
  })
353
353
 
@@ -366,7 +366,7 @@ globalSchemaRegistry.register({
366
366
  type: 'energy.state.changed', version: 1,
367
367
  validate( p ){
368
368
  if( !isObj(p) ) return 'payload must be object'
369
- return hasNum( p, 'level' ) ?? hasNum( p, 'zoneCode' )
369
+ return hasNum( p, 'level') ?? hasNum( p, 'zoneCode')
370
370
  },
371
371
  })
372
372
 
@@ -374,7 +374,7 @@ globalSchemaRegistry.register({
374
374
  type: 'sleep.state.changed', version: 1,
375
375
  validate( p ){
376
376
  if( !isObj(p) ) return 'payload must be object'
377
- return hasNum( p, 'pressure' ) ?? hasNum( p, 'intensity' )
377
+ return hasNum( p, 'pressure') ?? hasNum( p, 'intensity')
378
378
  },
379
379
  })
380
380
 
@@ -382,7 +382,7 @@ globalSchemaRegistry.register({
382
382
  type: 'stress.state.changed', version: 1,
383
383
  validate( p ){
384
384
  if( !isObj(p) ) return 'payload must be object'
385
- return hasNum( p, 'load' ) ?? hasNum( p, 'zoneCode' )
385
+ return hasNum( p, 'load') ?? hasNum( p, 'zoneCode')
386
386
  },
387
387
  })
388
388
 
@@ -390,7 +390,7 @@ globalSchemaRegistry.register({
390
390
  type: 'circadian.state.changed', version: 1,
391
391
  validate( p ){
392
392
  if( !isObj(p) ) return 'payload must be object'
393
- return hasNum( p, 'alertness' )
393
+ return hasNum( p, 'alertness')
394
394
  },
395
395
  })
396
396
 
@@ -398,7 +398,7 @@ globalSchemaRegistry.register({
398
398
  type: 'attention.state.changed', version: 1,
399
399
  validate( p ){
400
400
  if( !isObj(p) ) return 'payload must be object'
401
- return hasNum( p, 'usage' )
401
+ return hasNum( p, 'usage')
402
402
  },
403
403
  })
404
404
 
@@ -406,7 +406,7 @@ globalSchemaRegistry.register({
406
406
  type: 'attention.regulate', version: 1,
407
407
  validate( p ){
408
408
  if( !isObj(p) ) return 'payload must be object'
409
- return hasNum( p, 'effortTarget' )
409
+ return hasNum( p, 'effortTarget')
410
410
  },
411
411
  })
412
412
 
@@ -414,7 +414,7 @@ globalSchemaRegistry.register({
414
414
  type: 'affect.state.changed', version: 1,
415
415
  validate( p ){
416
416
  if( !isObj(p) ) return 'payload must be object'
417
- return hasNum( p, 'valence' ) ?? hasNum( p, 'arousal' )
417
+ return hasNum( p, 'valence') ?? hasNum( p, 'arousal')
418
418
  },
419
419
  })
420
420
 
@@ -422,7 +422,7 @@ globalSchemaRegistry.register({
422
422
  type: 'interoception.state.changed', version: 1,
423
423
  validate( p ){
424
424
  if( !isObj(p) ) return 'payload must be object'
425
- return hasNum( p, 'comfort' )
425
+ return hasNum( p, 'comfort')
426
426
  },
427
427
  })
428
428
 
@@ -430,7 +430,7 @@ globalSchemaRegistry.register({
430
430
  type: 'novelty.state.changed', version: 1,
431
431
  validate( p ){
432
432
  if( !isObj(p) ) return 'payload must be object'
433
- return hasNum( p, 'novelty' )
433
+ return hasNum( p, 'novelty')
434
434
  },
435
435
  })
436
436
 
@@ -456,7 +456,7 @@ globalSchemaRegistry.register({
456
456
  type: 'executive.interpretation.formed', version: 1,
457
457
  validate( p ){
458
458
  if( !isObj(p) ) return 'payload must be object'
459
- return hasNum( p, 'confidence' )
459
+ return hasNum( p, 'confidence')
460
460
  },
461
461
  })
462
462
 
@@ -464,7 +464,7 @@ globalSchemaRegistry.register({
464
464
  type: 'executive.goal.proposed', version: 1,
465
465
  validate( p ){
466
466
  if( !isObj(p) ) return 'payload must be object'
467
- return hasNum( p, 'count' )
467
+ return hasNum( p, 'count')
468
468
  },
469
469
  })
470
470
 
@@ -472,7 +472,7 @@ globalSchemaRegistry.register({
472
472
  type: 'executive.self.reflection', version: 1,
473
473
  validate( p ){
474
474
  if( !isObj(p) ) return 'payload must be object'
475
- return hasNum( p, 'confidence' )
475
+ return hasNum( p, 'confidence')
476
476
  },
477
477
  })
478
478
 
@@ -480,7 +480,7 @@ globalSchemaRegistry.register({
480
480
  type: 'executive.decision.rationale', version: 1,
481
481
  validate( p ){
482
482
  if( !isObj(p) ) return 'payload must be object'
483
- return hasNum( p, 'confidence' )
483
+ return hasNum( p, 'confidence')
484
484
  },
485
485
  })
486
486
 
@@ -488,7 +488,7 @@ globalSchemaRegistry.register({
488
488
  type: 'executive.prediction.formed', version: 1,
489
489
  validate( p ){
490
490
  if( !isObj(p) ) return 'payload must be object'
491
- return hasNum( p, 'confidence' )
491
+ return hasNum( p, 'confidence')
492
492
  },
493
493
  })
494
494
 
@@ -500,8 +500,8 @@ globalSchemaRegistry.register({
500
500
  type: 'goal.blocked', version: 1,
501
501
  validate( p ){
502
502
  if( !isObj(p) ) return 'payload must be object'
503
- if( typeof p['goalId'] !== 'string' ) return "missing string field 'goalId'"
504
- return hasNum( p, 'ticksStuck' ) ?? hasNum( p, 'priority' )
503
+ if( typeof p['goalId'] !== 'string') return "missing string field 'goalId'"
504
+ return hasNum( p, 'ticksStuck') ?? hasNum( p, 'priority')
505
505
  },
506
506
  })
507
507
 
@@ -509,8 +509,8 @@ globalSchemaRegistry.register({
509
509
  type: 'goal.achieved', version: 1,
510
510
  validate( p ){
511
511
  if( !isObj(p) ) return 'payload must be object'
512
- if( typeof p['goalId'] !== 'string' ) return "missing string field 'goalId'"
513
- return hasNum( p, 'priority' ) ?? hasNum( p, 'timeToComplete' )
512
+ if( typeof p['goalId'] !== 'string') return "missing string field 'goalId'"
513
+ return hasNum( p, 'priority') ?? hasNum( p, 'timeToComplete')
514
514
  },
515
515
  })
516
516
 
@@ -518,7 +518,7 @@ globalSchemaRegistry.register({
518
518
  type: 'goal.abandoned', version: 1,
519
519
  validate( p ){
520
520
  if( !isObj(p) ) return 'payload must be object'
521
- if( typeof p['goalId'] !== 'string' ) return "missing string field 'goalId'"
521
+ if( typeof p['goalId'] !== 'string') return "missing string field 'goalId'"
522
522
  return null
523
523
  },
524
524
  })
@@ -527,9 +527,9 @@ globalSchemaRegistry.register({
527
527
  type: 'action.outcome', version: 1,
528
528
  validate( p ){
529
529
  if( !isObj(p) ) return 'payload must be object'
530
- if( typeof p['actionType'] !== 'string' ) return "missing string field 'actionType'"
531
- if( typeof p['domain'] !== 'string' ) return "missing string field 'domain'"
532
- return hasNum( p, 'outcomeQuality' )
530
+ if( typeof p['actionType'] !== 'string') return "missing string field 'actionType'"
531
+ if( typeof p['domain'] !== 'string') return "missing string field 'domain'"
532
+ return hasNum( p, 'outcomeQuality')
533
533
  },
534
534
  })
535
535
 
@@ -537,7 +537,7 @@ globalSchemaRegistry.register({
537
537
  type: 'sleep.begun', version: 1,
538
538
  validate( p ){
539
539
  if( !isObj(p) ) return 'payload must be object'
540
- return hasNum( p, 'pressure' )
540
+ return hasNum( p, 'pressure')
541
541
  },
542
542
  })
543
543
 
@@ -545,7 +545,7 @@ globalSchemaRegistry.register({
545
545
  type: 'sleep.ended', version: 1,
546
546
  validate( p ){
547
547
  if( !isObj(p) ) return 'payload must be object'
548
- return hasNum( p, 'tick' )
548
+ return hasNum( p, 'tick')
549
549
  },
550
550
  })
551
551
 
@@ -553,8 +553,8 @@ globalSchemaRegistry.register({
553
553
  type: 'interaction.occurred', version: 1,
554
554
  validate( p ){
555
555
  if( !isObj(p) ) return 'payload must be object'
556
- if( typeof p['keid'] !== 'string' ) return "missing string field 'keid'"
557
- return hasNum( p, 'valence' ) ?? hasNum( p, 'intensity' )
556
+ if( typeof p['keid'] !== 'string') return "missing string field 'keid'"
557
+ return hasNum( p, 'valence') ?? hasNum( p, 'intensity')
558
558
  },
559
559
  })
560
560
 
@@ -562,7 +562,7 @@ globalSchemaRegistry.register({
562
562
  type: 'percept.category.updated', version: 1,
563
563
  validate( p ){
564
564
  if( !isObj(p) ) return 'payload must be object'
565
- if( typeof p['category'] !== 'string' ) return "missing string field 'category'"
566
- return hasNum( p, 'count' )
565
+ if( typeof p['category'] !== 'string') return "missing string field 'category'"
566
+ return hasNum( p, 'count')
567
567
  },
568
568
  })
@@ -113,19 +113,19 @@ export class AestheticEvaluator implements SimulationEngine, CognitiveEngine {
113
113
 
114
114
  onCognitiveEvent( e: CognitiveEvent ): StateCommands | void {
115
115
  this._model.observe( e.type, e.salience )
116
- if( e.type === 'executive.prediction.formed' ){
116
+ if( e.type === 'executive.prediction.formed'){
117
117
  const p = e.payload as { predictedDomains: string[]; confidence: number }
118
118
  if( p.predictedDomains.includes('aesthetic') )
119
- this._model.setPrecision( 'emotion.awe', 1.0 + p.confidence * 0.5 )
119
+ this._model.setPrecision('emotion.awe', 1.0 + p.confidence * 0.5 )
120
120
  }
121
- if( e.type === 'percept.category.updated' ){
121
+ if( e.type === 'percept.category.updated'){
122
122
  const p = e.payload as { category: string; count: number }
123
123
  this._categoryBuffer.set(
124
124
  p.category,
125
125
  ( this._categoryBuffer.get( p.category ) ?? 0 ) + p.count
126
126
  )
127
127
  }
128
- if( e.type === 'novelty.state.changed' || e.type === 'perception.novelty.spike' ){
128
+ if( e.type === 'novelty.state.changed' || e.type === 'perception.novelty.spike'){
129
129
  const p = e.payload as { novelty: number }
130
130
  this._cachedNovelty = p.novelty
131
131
  }
@@ -146,7 +146,7 @@ export class AestheticEvaluator implements SimulationEngine, CognitiveEngine {
146
146
  // Channel A (openness → aesthetic sensitivity): the awe threshold is read live as
147
147
  // base ⊕ persona-prior. An open Will develops a lower threshold and so is moved to
148
148
  // awe by beauty/novelty more readily. (The seed entity already existed but was ignored.)
149
- const aweThreshold = readEffectiveParams( state, 'engine-config-aesthetic' ).aweThreshold ?? this._aweThreshold
149
+ const aweThreshold = readEffectiveParams( state, 'engine-config-aesthetic').aweThreshold ?? this._aweThreshold
150
150
 
151
151
  // Consume category buffer for this tick
152
152
  const categories = new Map( this._categoryBuffer )
@@ -250,7 +250,7 @@ export class AestheticEvaluator implements SimulationEngine, CognitiveEngine {
250
250
  // Phase C: publish cognitive event
251
251
  const _bus = this._bus
252
252
  if( _bus && awe > 0.4 ){
253
- const predErr = this._model.observe( 'emotion.awe', awe )
253
+ const predErr = this._model.observe('emotion.awe', awe )
254
254
  if( !predErr.gated )
255
255
  _bus.publish({ type: 'emotion.awe.experienced', version: 1, sourceEngine: this.name, salience: Math.min(1, awe * 2), payload: { awe } })
256
256
  }
@@ -36,6 +36,12 @@ import type { CognitiveEngine, SimulationEngine, EngineResult } from '#cognition
36
36
  import type { CognitiveEventSchema } from '#cognition/schema.registry'
37
37
  import type { CognitiveEvent, CognitiveBus } from '#cognition/bus'
38
38
  import { GenerativeModel } from '#cognition/generative.model'
39
+ import { ACP_SELF_PRECISION } from '#cognition/acp'
40
+
41
+ // ACP-P2 (ACTION_CONDITIONED_PREDICTION §3): acting is arousing — the
42
+ // directional prior nudged into the arousal prediction on our own enaction.
43
+ const ACP_AROUSAL_UPLIFT = 0.1
44
+ const ACP_CONFIDENCE = 0.4
39
45
 
40
46
  /**
41
47
  * Numeric encoding for dominant emotion metric.
@@ -188,6 +194,8 @@ export class AffectiveBlender implements SimulationEngine, CognitiveEngine {
188
194
  private _emotionHistory: Map<string, number[]> = new Map()
189
195
 
190
196
  private _moodBaseline: number = 0.5
197
+ /** ACP-P2: self-caused arousal attenuation armed; react() restores after one observe. */
198
+ private _acpOneShot = false
191
199
  private _energyLevel: number = 100
192
200
  private _comfort: number = 0.5
193
201
  private _sleepPressure: number = 0
@@ -230,6 +238,8 @@ export class AffectiveBlender implements SimulationEngine, CognitiveEngine {
230
238
  'stress.state.changed',
231
239
  'executive.prediction.formed',
232
240
  'interaction.occurred', // 2.1: social stimuli drive immediate arousal/valence shifts
241
+ // ACP-P2: our own enactions — the arousal they cause is expected, not surprising
242
+ 'agency.enacted', 'agency.communicate', 'agency.invocation',
233
243
  ]
234
244
  }
235
245
  publishes(): CognitiveEventSchema[] { return [] }
@@ -237,6 +247,20 @@ export class AffectiveBlender implements SimulationEngine, CognitiveEngine {
237
247
  onCognitiveEvent( e: CognitiveEvent ): StateCommands | void {
238
248
  this._model.observe( e.type, e.salience )
239
249
  switch( e.type ){
250
+ case 'agency.enacted':
251
+ case 'agency.communicate':
252
+ case 'agency.invocation': {
253
+ // ACP-P2: we just acted — the arousal swing that follows is our own
254
+ // doing. Directional prior (acting is arousing) + self-caused
255
+ // precision on the ONE stream whose error is consumed (it weights the
256
+ // `affect.state.changed` publish); react() restores after one observe
257
+ // so a genuine world jolt next tick lands at full weight.
258
+ const arousal = this._model.predict('affect.arousal')
259
+ this._model.anticipate('affect.arousal', Math.min( 1, arousal + ACP_AROUSAL_UPLIFT ), ACP_CONFIDENCE )
260
+ this._model.setPrecision('affect.arousal', ACP_SELF_PRECISION )
261
+ this._acpOneShot = true
262
+ break
263
+ }
240
264
  case 'circadian.state.changed':
241
265
  this._moodBaseline = (e.payload as Record<string,number>)['moodBaseline'] ?? this._moodBaseline
242
266
  break
@@ -331,8 +355,8 @@ export class AffectiveBlender implements SimulationEngine, CognitiveEngine {
331
355
  // dampens by resonance × closeness, so it folds in with a modest weight. Before
332
356
  // inertia so the contagion smooths naturally rather than being applied cold.
333
357
  const empathicPAD: PADState = {
334
- valence: Math.max( -1, Math.min( 1, socialPAD.valence + ( state.metrics.get( 'empathy.vicarious_valence' ) ?? 0 ) * EMPATHY_CONTAGION_WEIGHT )),
335
- arousal: Math.max( 0, Math.min( 1, socialPAD.arousal + ( state.metrics.get( 'empathy.vicarious_arousal' ) ?? 0 ) * EMPATHY_CONTAGION_WEIGHT )),
358
+ valence: Math.max( -1, Math.min( 1, socialPAD.valence + ( state.metrics.get('empathy.vicarious_valence') ?? 0 ) * EMPATHY_CONTAGION_WEIGHT )),
359
+ arousal: Math.max( 0, Math.min( 1, socialPAD.arousal + ( state.metrics.get('empathy.vicarious_arousal') ?? 0 ) * EMPATHY_CONTAGION_WEIGHT )),
336
360
  dominance: socialPAD.dominance,
337
361
  }
338
362
 
@@ -397,8 +421,16 @@ export class AffectiveBlender implements SimulationEngine, CognitiveEngine {
397
421
  if( _bus )
398
422
  _bus.publish({ type: 'affect.state.shifted', version: 1, sourceEngine: this.name, salience: Math.min(1, Math.abs(modulatedPAD.valence) + modulatedPAD.arousal * 0.5), payload: { valence: modulatedPAD.valence, arousal: modulatedPAD.arousal, dominantEmotion: dominant } })
399
423
  // Phase D: rich state-change event
400
- if( _bus )
401
- _bus.publish({ type: 'affect.state.changed', version: 1, sourceEngine: this.name, salience: this._model.observe( 'affect.arousal', modulatedPAD.arousal ).salience, payload: { valence: modulatedPAD.valence, arousal: modulatedPAD.arousal, dominance: modulatedPAD.dominance } })
424
+ if( _bus ){
425
+ const arousalErr = this._model.observe('affect.arousal', modulatedPAD.arousal )
426
+ // ACP-P2: the self-caused observe has happened — restore full precision
427
+ // now so the world's own jolts are never dampened by our lingering act.
428
+ if( this._acpOneShot ){
429
+ this._model.setPrecision('affect.arousal', 1.0 )
430
+ this._acpOneShot = false
431
+ }
432
+ _bus.publish({ type: 'affect.state.changed', version: 1, sourceEngine: this.name, salience: arousalErr.salience, payload: { valence: modulatedPAD.valence, arousal: modulatedPAD.arousal, dominance: modulatedPAD.dominance } })
433
+ }
402
434
  return { events: events.length > 0 ? events : undefined, commands }
403
435
  }
404
436