@mindot/will 0.5.0 → 0.7.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.
- package/dist/channels/discord.d.ts +1 -1
- package/dist/channels/discord.js.map +1 -1
- package/dist/channels/whatsapp.d.ts +1 -1
- package/dist/channels/whatsapp.js.map +1 -1
- package/dist/cli.js +998 -59
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +998 -59
- package/dist/index.js.map +1 -1
- package/dist/mcp/effectors.d.ts +1 -1
- package/dist/mcp/effectors.js.map +1 -1
- package/dist/{will-BDq-TMQr.d.ts → will-DAW0l-lY.d.ts} +90 -10
- package/package.json +1 -1
- package/src/channels/discord.ts +11 -11
- package/src/channels/roster.ts +1 -1
- package/src/channels/types.ts +1 -1
- package/src/channels/whatsapp.ts +25 -25
- package/src/cli.ts +20 -20
- package/src/cognition/acp.ts +28 -0
- package/src/cognition/agency/consequence.ts +174 -0
- package/src/cognition/agency/engines/action.selector.ts +333 -48
- package/src/cognition/agency/engines/affordance.synthesizer.ts +35 -16
- package/src/cognition/agency/engines/deliberation.engine.ts +28 -14
- package/src/cognition/agency/engines/motor.schema.executor.ts +90 -14
- package/src/cognition/agency/engines/reafference.engine.ts +152 -23
- package/src/cognition/agency/execution.primitives.ts +13 -13
- package/src/cognition/agency/proactive.communicator.ts +1 -1
- package/src/cognition/agency/reconcile.learning.ts +10 -1
- package/src/cognition/agency/revocation.ts +79 -0
- package/src/cognition/agency/schemas/repertoire.ts +109 -9
- package/src/cognition/agency/selection.scoring.ts +32 -10
- package/src/cognition/agency/types.ts +9 -0
- package/src/cognition/bus.ts +2 -2
- package/src/cognition/completion.inbox.ts +1 -1
- package/src/cognition/config.mirror.entities.ts +5 -5
- package/src/cognition/event.log.ts +2 -2
- package/src/cognition/event.schemas.ts +67 -67
- package/src/cognition/faculties/aesthetic.evaluator.ts +6 -6
- package/src/cognition/faculties/affective.blender.ts +36 -4
- package/src/cognition/faculties/attachment.evaluator.ts +6 -6
- package/src/cognition/faculties/attention.allocator.ts +63 -8
- package/src/cognition/faculties/autobiographical.narrator.ts +3 -3
- package/src/cognition/faculties/bias.detector.ts +7 -7
- package/src/cognition/faculties/circadian.oscillator.ts +3 -3
- package/src/cognition/faculties/confidence.calibrator.ts +7 -7
- package/src/cognition/faculties/dream.simulator.ts +5 -5
- package/src/cognition/faculties/empathy.simulator.ts +7 -7
- package/src/cognition/faculties/energy.regulator.ts +4 -4
- package/src/cognition/faculties/episodic.consolidator.ts +6 -6
- package/src/cognition/faculties/executive.engine/commands.ts +6 -6
- package/src/cognition/faculties/executive.engine/context.ts +42 -42
- package/src/cognition/faculties/executive.engine/deferred.effects.ts +2 -2
- package/src/cognition/faculties/executive.engine/engine.ts +25 -25
- package/src/cognition/faculties/executive.engine/facet.supervisor.ts +12 -12
- package/src/cognition/faculties/executive.engine/facet.ts +18 -18
- package/src/cognition/faculties/executive.engine/gating.ts +2 -2
- package/src/cognition/faculties/executive.engine/messages.ts +3 -3
- package/src/cognition/faculties/executive.engine/parser.ts +11 -11
- package/src/cognition/faculties/executive.engine/prompt.factory.ts +55 -55
- package/src/cognition/faculties/exteroception.ts +99 -5
- package/src/cognition/faculties/forgetting.curve.ts +3 -3
- package/src/cognition/faculties/frustration.evaluator.ts +6 -6
- package/src/cognition/faculties/goal.manager.ts +15 -15
- package/src/cognition/faculties/inhibition.controller.ts +3 -3
- package/src/cognition/faculties/interoception.ts +3 -3
- package/src/cognition/faculties/introspection.engine.ts +3 -3
- package/src/cognition/faculties/known.entity.tracker.ts +15 -15
- package/src/cognition/faculties/loss.evaluator.ts +2 -2
- package/src/cognition/faculties/moral.evaluator.ts +4 -4
- package/src/cognition/faculties/novelty.detector.ts +4 -4
- package/src/cognition/faculties/persona.consolidator.ts +12 -12
- package/src/cognition/faculties/planning.engine/engine.ts +47 -47
- package/src/cognition/faculties/planning.engine/plan.frontier.ts +5 -5
- package/src/cognition/faculties/planning.engine/plan.store.ts +1 -1
- package/src/cognition/faculties/planning.engine/plan.supervision.ts +20 -20
- package/src/cognition/faculties/reputation.tracker.ts +6 -6
- package/src/cognition/faculties/reward.evaluator.ts +4 -4
- package/src/cognition/faculties/self.model.updater.ts +8 -8
- package/src/cognition/faculties/semantic.engine/integrator.ts +15 -15
- package/src/cognition/faculties/sleep.pressure.regulator.ts +4 -4
- package/src/cognition/faculties/social.perception.ts +3 -3
- package/src/cognition/faculties/spaced.repetition.ts +2 -2
- package/src/cognition/faculties/stress.regulator.ts +27 -4
- package/src/cognition/faculties/task.switcher.ts +11 -6
- package/src/cognition/faculties/theory.of.mind.ts +6 -6
- package/src/cognition/faculties/threat.evaluator.ts +3 -3
- package/src/cognition/faculties/working.memory.ts +8 -8
- package/src/cognition/generative.model.ts +2 -2
- package/src/cognition/memory/vector.adapter.ts +5 -5
- package/src/cognition/memory/vector.content.ts +4 -4
- package/src/cognition/memory/vector.embedder.ts +9 -9
- package/src/cognition/persona.prior.ts +1 -1
- package/src/cognition/schema.registry.ts +2 -2
- package/src/cognition/senses/audition.engine/engine.ts +2 -2
- package/src/cognition/senses/base.sense.engine.ts +1 -1
- package/src/cognition/utilities/token.tracker.ts +5 -5
- package/src/core/abstracts.ts +1 -1
- package/src/core/completion.recorder.ts +2 -2
- package/src/core/serialization.ts +3 -3
- package/src/core/snapshot.manager.ts +1 -1
- package/src/core/state.manager.ts +1 -1
- package/src/core/utils.ts +1 -1
- package/src/host/boot.ts +30 -30
- package/src/host/utterances.ts +1 -1
- package/src/llm/index.ts +9 -9
- package/src/llm/summarizer.ts +4 -4
- package/src/llm/wire.contracts.ts +1 -1
- package/src/mcp/effectors.ts +10 -10
- package/src/mcp/server.ts +11 -11
- package/src/pma/eval.ts +1 -1
- package/src/pma/index.ts +21 -21
- package/src/runners/outreach.runner.ts +3 -3
- package/src/runners/social.runner.ts +1 -1
- package/src/runners/thin-shim.runner.ts +1 -1
- package/src/sdk/will.ts +5 -5
- package/src/serve/server.ts +12 -12
- package/src/stem/assembly.audit.ts +3 -3
- package/src/stem/guards/identity.coherence.ts +10 -10
- package/src/stem/guards/identity.guard.ts +22 -22
- package/src/stem/index.ts +26 -11
- package/src/stem/mind.ts +12 -12
- package/src/stem/policy/arbiter.ts +136 -0
- package/src/stem/policy/rule.table.ts +172 -0
- package/src/stem/policy/verdict.recorder.ts +0 -0
- package/src/stem/tracts/biography.writer.ts +3 -3
- package/src/stem/tracts/effector.controller.ts +383 -4
- package/src/stem/tracts/health.reporter.ts +1 -1
- package/src/stem/tracts/outbox.controller.ts +4 -0
- package/src/stem/tracts/outbox.writer.ts +4 -4
- package/src/stem/tracts/pma.controller.ts +1 -1
- package/src/stem/tracts/replay.controller.ts +10 -10
- package/src/stem/tracts/sensory.controller.ts +2 -2
- package/src/stem/tracts/session.logger.ts +4 -4
- package/src/stem/tracts/transport/socketio.transport.ts +7 -7
- package/src/stem/tracts/transport/stream.transport.ts +2 -2
- package/src/stem/tracts/transport.controller.ts +15 -15
|
@@ -254,12 +254,12 @@ export class PersonaConsolidator implements SimulationEngine, CognitiveEngine {
|
|
|
254
254
|
switch( e.type ){
|
|
255
255
|
case 'confidence.calibrated': {
|
|
256
256
|
const p = e.payload as { calibrationBias?: number }
|
|
257
|
-
if( typeof p.calibrationBias === 'number'
|
|
257
|
+
if( typeof p.calibrationBias === 'number') this._latestCalibrationBias = p.calibrationBias
|
|
258
258
|
break
|
|
259
259
|
}
|
|
260
260
|
case 'bias.detected': {
|
|
261
261
|
const p = e.payload as { newCount?: number; types?: string[] }
|
|
262
|
-
if( typeof p.newCount === 'number'
|
|
262
|
+
if( typeof p.newCount === 'number') this._latestBiasNovelty = p.newCount
|
|
263
263
|
const types = Array.isArray( p.types ) ? p.types : []
|
|
264
264
|
this._latestBeliefBiasNovelty = types.filter( t => BELIEF_BIAS_TYPES.has( t ) ).length
|
|
265
265
|
this._latestMemoryBiasNovelty = types.filter( t => MEMORY_BIAS_TYPES.has( t ) ).length
|
|
@@ -267,13 +267,13 @@ export class PersonaConsolidator implements SimulationEngine, CognitiveEngine {
|
|
|
267
267
|
}
|
|
268
268
|
case 'self_model.updated': {
|
|
269
269
|
const p = e.payload as { changeMagnitude?: number }
|
|
270
|
-
if( typeof p.changeMagnitude === 'number'
|
|
270
|
+
if( typeof p.changeMagnitude === 'number') this._latestSelfModelChange = p.changeMagnitude
|
|
271
271
|
break
|
|
272
272
|
}
|
|
273
273
|
case 'introspection.insight': {
|
|
274
274
|
// significance = how substantive this introspection was (biases + lessons surfaced).
|
|
275
275
|
const p = e.payload as { significance?: number }
|
|
276
|
-
if( typeof p.significance === 'number'
|
|
276
|
+
if( typeof p.significance === 'number') this._latestInsightSignificance = p.significance
|
|
277
277
|
break
|
|
278
278
|
}
|
|
279
279
|
}
|
|
@@ -293,13 +293,13 @@ export class PersonaConsolidator implements SimulationEngine, CognitiveEngine {
|
|
|
293
293
|
|
|
294
294
|
restore( snap: Record<string, unknown> ): void {
|
|
295
295
|
if( !snap ) return
|
|
296
|
-
if( typeof snap.lastConsolidationTick === 'number'
|
|
297
|
-
if( typeof snap.latestCalibrationBias === 'number'
|
|
298
|
-
if( typeof snap.latestBiasNovelty === 'number'
|
|
299
|
-
if( typeof snap.latestBeliefBiasNovelty === 'number'
|
|
300
|
-
if( typeof snap.latestMemoryBiasNovelty === 'number'
|
|
301
|
-
if( typeof snap.latestSelfModelChange === 'number'
|
|
302
|
-
if( typeof snap.latestInsightSignificance === 'number'
|
|
296
|
+
if( typeof snap.lastConsolidationTick === 'number') this._lastConsolidationTick = snap.lastConsolidationTick
|
|
297
|
+
if( typeof snap.latestCalibrationBias === 'number') this._latestCalibrationBias = snap.latestCalibrationBias
|
|
298
|
+
if( typeof snap.latestBiasNovelty === 'number') this._latestBiasNovelty = snap.latestBiasNovelty
|
|
299
|
+
if( typeof snap.latestBeliefBiasNovelty === 'number') this._latestBeliefBiasNovelty = snap.latestBeliefBiasNovelty
|
|
300
|
+
if( typeof snap.latestMemoryBiasNovelty === 'number') this._latestMemoryBiasNovelty = snap.latestMemoryBiasNovelty
|
|
301
|
+
if( typeof snap.latestSelfModelChange === 'number') this._latestSelfModelChange = snap.latestSelfModelChange
|
|
302
|
+
if( typeof snap.latestInsightSignificance === 'number') this._latestInsightSignificance = snap.latestInsightSignificance
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
async react(
|
|
@@ -383,7 +383,7 @@ export class PersonaConsolidator implements SimulationEngine, CognitiveEngine {
|
|
|
383
383
|
// Self-model traits (developed from the Will's own behaviour) that shape grit.
|
|
384
384
|
// Above-baseline deviation only — pushes grit up when persistence is demonstrated;
|
|
385
385
|
// decay returns to the seeded baseline when the behaviour stops.
|
|
386
|
-
const traits = ( state.entities.get(
|
|
386
|
+
const traits = ( state.entities.get('identity-self')?.metadata?.traits ?? {} ) as Record<string, number>
|
|
387
387
|
const persistDev = Math.max( 0, ( traits[ 'persistence' ] ?? PERSISTENCE_BASELINE ) - PERSISTENCE_BASELINE )
|
|
388
388
|
const resilDev = Math.max( 0, ( traits[ 'resilience' ] ?? PERSISTENCE_BASELINE ) - PERSISTENCE_BASELINE )
|
|
389
389
|
const conscDev = Math.max( 0, ( traits[ 'conscientiousness' ] ?? PERSISTENCE_BASELINE ) - PERSISTENCE_BASELINE )
|
|
@@ -196,7 +196,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
196
196
|
case 'executive.prediction.formed': {
|
|
197
197
|
const p = e.payload as { predictedDomains: string[]; confidence: number }
|
|
198
198
|
if( p.predictedDomains.includes('planning') )
|
|
199
|
-
this._model.setPrecision(
|
|
199
|
+
this._model.setPrecision('planning.plans', 1.0 + p.confidence * 0.5 )
|
|
200
200
|
break
|
|
201
201
|
}
|
|
202
202
|
|
|
@@ -217,15 +217,15 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
217
217
|
// (observed live: 8 authorings for one goal, zero completions).
|
|
218
218
|
// Deterministic: stores iterate in insertion order; first match wins.
|
|
219
219
|
if( !p.planId || !p.stepId ){
|
|
220
|
-
if( !p.actionType || typeof p.success !== 'boolean'
|
|
220
|
+
if( !p.actionType || typeof p.success !== 'boolean') return
|
|
221
221
|
for( const plan of this._store.all() ){
|
|
222
|
-
if( plan.status !== 'executing'
|
|
222
|
+
if( plan.status !== 'executing') continue
|
|
223
223
|
const step = plan.steps.find( s => s.status === 'active' && s.action === p.actionType )
|
|
224
224
|
if( !step ) continue
|
|
225
|
-
logger.info(
|
|
225
|
+
logger.info(`[planning] conscious-enaction credit: ${plan.id}/${step.id}=${step.action} (no provenance on outcome)`)
|
|
226
226
|
this._onStepOutcome( plan.id, step.id, {
|
|
227
227
|
success: p.success,
|
|
228
|
-
description: p.description ?? ( p.success ? 'Completed' : 'Failed'
|
|
228
|
+
description: p.description ?? ( p.success ? 'Completed' : 'Failed'),
|
|
229
229
|
outcomeQuality: p.outcomeQuality,
|
|
230
230
|
} )
|
|
231
231
|
return // credit exactly one step per outcome
|
|
@@ -236,18 +236,18 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
236
236
|
|
|
237
237
|
this._onStepOutcome( p.planId, p.stepId, {
|
|
238
238
|
success: p.success,
|
|
239
|
-
description: p.description ?? ( p.success ? 'Completed' : 'Failed'
|
|
239
|
+
description: p.description ?? ( p.success ? 'Completed' : 'Failed'),
|
|
240
240
|
outcomeQuality: p.outcomeQuality,
|
|
241
241
|
} )
|
|
242
242
|
break
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
case 'goal.achieved':
|
|
246
|
-
this._cancelPlansForGoal( ( e.payload as { goalId?: string } ).goalId, 'goal achieved'
|
|
246
|
+
this._cancelPlansForGoal( ( e.payload as { goalId?: string } ).goalId, 'goal achieved')
|
|
247
247
|
break
|
|
248
248
|
|
|
249
249
|
case 'goal.abandoned':
|
|
250
|
-
this._cancelPlansForGoal( ( e.payload as { goalId?: string } ).goalId, 'goal abandoned'
|
|
250
|
+
this._cancelPlansForGoal( ( e.payload as { goalId?: string } ).goalId, 'goal abandoned')
|
|
251
251
|
break
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -276,14 +276,14 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
276
276
|
planId: plan.id,
|
|
277
277
|
goalId: plan.goalId,
|
|
278
278
|
reason,
|
|
279
|
-
completedSteps: plan.steps.filter( s => s.status === 'completed'
|
|
279
|
+
completedSteps: plan.steps.filter( s => s.status === 'completed').length,
|
|
280
280
|
totalSteps: plan.steps.length,
|
|
281
281
|
requestingEntityId: plan.requestingEntityId,
|
|
282
282
|
requestingThreadId: plan.requestingThreadId,
|
|
283
283
|
}
|
|
284
284
|
} )
|
|
285
285
|
|
|
286
|
-
logger.info(
|
|
286
|
+
logger.info(`[planning] plan ${plan.id} cancelled — ${reason} (goal ${goalId})`)
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -344,7 +344,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
344
344
|
|
|
345
345
|
// 5. Metrics
|
|
346
346
|
const executingPlans = Array.from( this._store.all() )
|
|
347
|
-
.filter( p => p.status === 'executing' || p.status === 'ready'
|
|
347
|
+
.filter( p => p.status === 'executing' || p.status === 'ready')
|
|
348
348
|
|
|
349
349
|
commands.metrics!.push(
|
|
350
350
|
[ 'planning.total_plans', this._store.size ],
|
|
@@ -352,17 +352,17 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
352
352
|
[ 'planning.active_facets', this._supervisor.activeFacetCount ],
|
|
353
353
|
// Supervision distribution — how the mind corrects course mid-execution. The
|
|
354
354
|
// raw signal the planning-quality eval harness reads (replan/abandon rates etc).
|
|
355
|
-
[ 'planning.supervision.replan', this._supervisor.supervisionCount(
|
|
356
|
-
[ 'planning.supervision.retry', this._supervisor.supervisionCount(
|
|
357
|
-
[ 'planning.supervision.skip', this._supervisor.supervisionCount(
|
|
358
|
-
[ 'planning.supervision.escalate', this._supervisor.supervisionCount(
|
|
359
|
-
[ 'planning.supervision.abandon', this._supervisor.supervisionCount(
|
|
355
|
+
[ 'planning.supervision.replan', this._supervisor.supervisionCount('replan') ],
|
|
356
|
+
[ 'planning.supervision.retry', this._supervisor.supervisionCount('retry') ],
|
|
357
|
+
[ 'planning.supervision.skip', this._supervisor.supervisionCount('skip') ],
|
|
358
|
+
[ 'planning.supervision.escalate', this._supervisor.supervisionCount('escalate') ],
|
|
359
|
+
[ 'planning.supervision.abandon', this._supervisor.supervisionCount('abandon') ],
|
|
360
360
|
)
|
|
361
361
|
|
|
362
362
|
// Phase C + F: publish cognitive event — gated by prediction error
|
|
363
363
|
const _bus = this._bus
|
|
364
364
|
if( _bus && this._store.size > 0 ){
|
|
365
|
-
const predErr = this._model.observe(
|
|
365
|
+
const predErr = this._model.observe('planning.plans', this._store.size )
|
|
366
366
|
if( !predErr.gated )
|
|
367
367
|
_bus.publish( {
|
|
368
368
|
type: 'planning.plan.created', version: 1, sourceEngine: this.name,
|
|
@@ -385,10 +385,10 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
385
385
|
* dispositions, no wall-clock, no RNG.
|
|
386
386
|
*/
|
|
387
387
|
private _readConfigFromState( state: ReadonlySimulationState ): void {
|
|
388
|
-
const p = readEffectiveParams( state, 'engine-config-planning'
|
|
389
|
-
if( typeof p.maxStepRetries === 'number'
|
|
390
|
-
if( typeof p.surpriseOutcomeQuality === 'number'
|
|
391
|
-
if( typeof p.planBiasGain === 'number'
|
|
388
|
+
const p = readEffectiveParams( state, 'engine-config-planning')
|
|
389
|
+
if( typeof p.maxStepRetries === 'number') this._dispositions.maxStepRetries = p.maxStepRetries
|
|
390
|
+
if( typeof p.surpriseOutcomeQuality === 'number') this._dispositions.surpriseOutcomeQuality = p.surpriseOutcomeQuality
|
|
391
|
+
if( typeof p.planBiasGain === 'number') this._dispositions.planBiasGain = p.planBiasGain
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
// ── Plan ingestion ─────────────────────────────────────────
|
|
@@ -427,24 +427,24 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
427
427
|
break
|
|
428
428
|
}
|
|
429
429
|
|
|
430
|
-
this._createPlan( planData, tick, 'draft'
|
|
430
|
+
this._createPlan( planData, tick, 'draft')
|
|
431
431
|
break
|
|
432
432
|
}
|
|
433
433
|
|
|
434
434
|
case 'validate': {
|
|
435
435
|
if( !existingPlan ){
|
|
436
|
-
this._createPlan( planData, tick, 'validated'
|
|
436
|
+
this._createPlan( planData, tick, 'validated')
|
|
437
437
|
break
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
existingPlan.status = 'validated'
|
|
441
|
-
logger.info(
|
|
441
|
+
logger.info(`[planning] plan ${existingPlan.id} validated`)
|
|
442
442
|
break
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
case 'execute': {
|
|
446
446
|
if( !existingPlan ){
|
|
447
|
-
const newPlan = this._createPlan( planData, tick, 'approved'
|
|
447
|
+
const newPlan = this._createPlan( planData, tick, 'approved')
|
|
448
448
|
newPlan.status = 'ready'
|
|
449
449
|
// Infer supervision (emergent tier): important/uncertain plans start
|
|
450
450
|
// deliberate (a facet supervises from the first step); else automatic.
|
|
@@ -470,7 +470,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
case 'revise': {
|
|
473
|
-
if( !existingPlan ){ this._createPlan( planData, tick, 'revised'
|
|
473
|
+
if( !existingPlan ){ this._createPlan( planData, tick, 'revised'); break }
|
|
474
474
|
|
|
475
475
|
existingPlan.steps = planData.steps.map( ( s, i ) => ( {
|
|
476
476
|
id: `step-${i}`,
|
|
@@ -505,7 +505,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
505
505
|
this._store.markTerminal( existingPlan.id, this._lastTick )
|
|
506
506
|
this._supervisor.cleanupFacet( existingPlan.id )
|
|
507
507
|
|
|
508
|
-
logger.info(
|
|
508
|
+
logger.info(`[planning] plan ${existingPlan.id} cancelled`)
|
|
509
509
|
break
|
|
510
510
|
}
|
|
511
511
|
}
|
|
@@ -565,9 +565,9 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
565
565
|
|
|
566
566
|
private _executePlans(): void {
|
|
567
567
|
for( const plan of this._store.all() ){
|
|
568
|
-
if( plan.status !== 'ready' && plan.status !== 'executing'
|
|
568
|
+
if( plan.status !== 'ready' && plan.status !== 'executing') continue
|
|
569
569
|
|
|
570
|
-
if( plan.status === 'ready'
|
|
570
|
+
if( plan.status === 'ready'){
|
|
571
571
|
plan.status = 'executing'
|
|
572
572
|
|
|
573
573
|
// Emit plan.started so the activity stream knows execution has begun.
|
|
@@ -592,14 +592,14 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
592
592
|
this._activateStep( plan, step )
|
|
593
593
|
|
|
594
594
|
// Check for plan completion
|
|
595
|
-
const allDone = plan.steps.every( s => s.status === 'completed' || s.status === 'skipped'
|
|
596
|
-
const anyFailed = plan.steps.some( s => s.status === 'failed'
|
|
595
|
+
const allDone = plan.steps.every( s => s.status === 'completed' || s.status === 'skipped')
|
|
596
|
+
const anyFailed = plan.steps.some( s => s.status === 'failed')
|
|
597
597
|
|
|
598
598
|
if( allDone && !anyFailed )
|
|
599
599
|
this._onPlanCompleted( plan )
|
|
600
600
|
|
|
601
|
-
else if( anyFailed && plan.executionTier === 'automatic'
|
|
602
|
-
this._onPlanFailed( plan, 'One or more steps failed'
|
|
601
|
+
else if( anyFailed && plan.executionTier === 'automatic')
|
|
602
|
+
this._onPlanFailed( plan, 'One or more steps failed')
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
|
|
@@ -638,7 +638,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
638
638
|
totalSteps: plan.steps.length,
|
|
639
639
|
} as any)
|
|
640
640
|
|
|
641
|
-
logger.info(
|
|
641
|
+
logger.info(`[planning] step active: ${plan.id}/${step.id}=${step.action} (biasing the field)`)
|
|
642
642
|
}
|
|
643
643
|
|
|
644
644
|
// ── Step outcome handling ──────────────────────────────────
|
|
@@ -661,8 +661,8 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
661
661
|
// already moved past — and re-running supervision below could re-spawn the facet
|
|
662
662
|
// we just tore down. The enaction itself still happened (and still taught the
|
|
663
663
|
// repertoire via reafference); the plan simply no longer cares.
|
|
664
|
-
if( plan.status !== 'executing'
|
|
665
|
-
logger.info(
|
|
664
|
+
if( plan.status !== 'executing'){
|
|
665
|
+
logger.info(`[planning] ignoring late step outcome ${planId}/${stepId} — plan is ${plan.status}, not executing`)
|
|
666
666
|
return
|
|
667
667
|
}
|
|
668
668
|
|
|
@@ -688,7 +688,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
688
688
|
success: outcome.success,
|
|
689
689
|
outcomeQuality: outcome.outcomeQuality,
|
|
690
690
|
description: outcome.description.slice( 0, 300 ),
|
|
691
|
-
completedSteps: plan.steps.filter( s => s.status === 'completed' || s.status === 'skipped'
|
|
691
|
+
completedSteps: plan.steps.filter( s => s.status === 'completed' || s.status === 'skipped').length,
|
|
692
692
|
totalSteps: plan.steps.length,
|
|
693
693
|
requestingEntityId: plan.requestingEntityId,
|
|
694
694
|
requestingThreadId: plan.requestingThreadId,
|
|
@@ -704,7 +704,7 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
704
704
|
success: outcome.success,
|
|
705
705
|
outcomeQuality: outcome.outcomeQuality,
|
|
706
706
|
description: outcome.description.slice( 0, 300 ),
|
|
707
|
-
completedSteps: plan.steps.filter( s => s.status === 'completed' || s.status === 'skipped'
|
|
707
|
+
completedSteps: plan.steps.filter( s => s.status === 'completed' || s.status === 'skipped').length,
|
|
708
708
|
totalSteps: plan.steps.length,
|
|
709
709
|
} as any)
|
|
710
710
|
|
|
@@ -714,15 +714,15 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
714
714
|
// extension point for more triggers.
|
|
715
715
|
if( plan.executionTier !== 'deliberate' && this._supervisor.shouldEscalate( plan, step, outcome ) ){
|
|
716
716
|
plan.executionTier = 'deliberate'
|
|
717
|
-
logger.info(
|
|
717
|
+
logger.info(`[planning] plan ${planId} escalated to deliberate (surprise on ${stepId})`)
|
|
718
718
|
this._supervisor.activateFacet( plan, false ) // lazy spawn; the step report below follows
|
|
719
719
|
}
|
|
720
720
|
|
|
721
|
-
if( plan.executionTier === 'deliberate'
|
|
721
|
+
if( plan.executionTier === 'deliberate'){
|
|
722
722
|
const reported = this._supervisor.reportToFacet( plan, step, outcome )
|
|
723
723
|
if( !reported ){
|
|
724
724
|
// attention saturated / spawn failed → activateFacet downgraded to automatic
|
|
725
|
-
logger.warn(
|
|
725
|
+
logger.warn(`[planning] no facet to supervise plan ${planId}; continuing automatically`)
|
|
726
726
|
this._executePlans()
|
|
727
727
|
}
|
|
728
728
|
}
|
|
@@ -742,15 +742,15 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
742
742
|
payload: {
|
|
743
743
|
planId: plan.id,
|
|
744
744
|
goalId: plan.goalId,
|
|
745
|
-
completedSteps: plan.steps.filter( s => s.status === 'completed'
|
|
746
|
-
skippedSteps: plan.steps.filter( s => s.status === 'skipped'
|
|
745
|
+
completedSteps: plan.steps.filter( s => s.status === 'completed').length,
|
|
746
|
+
skippedSteps: plan.steps.filter( s => s.status === 'skipped').map( s => s.id ),
|
|
747
747
|
totalSteps: plan.steps.length,
|
|
748
748
|
requestingEntityId: plan.requestingEntityId,
|
|
749
749
|
requestingThreadId: plan.requestingThreadId,
|
|
750
750
|
}
|
|
751
751
|
} )
|
|
752
752
|
|
|
753
|
-
logger.info(
|
|
753
|
+
logger.info(`[planning] plan completed: ${plan.id} → goal ${plan.goalId}`)
|
|
754
754
|
}
|
|
755
755
|
|
|
756
756
|
private _onPlanFailed( plan: Plan, reason: string ): void {
|
|
@@ -766,15 +766,15 @@ export class PlanningEngine implements SimulationEngine, CognitiveEngine {
|
|
|
766
766
|
planId: plan.id,
|
|
767
767
|
goalId: plan.goalId,
|
|
768
768
|
reason,
|
|
769
|
-
completedSteps: plan.steps.filter( s => s.status === 'completed'
|
|
770
|
-
skippedSteps: plan.steps.filter( s => s.status === 'skipped'
|
|
769
|
+
completedSteps: plan.steps.filter( s => s.status === 'completed').length,
|
|
770
|
+
skippedSteps: plan.steps.filter( s => s.status === 'skipped').map( s => s.id ),
|
|
771
771
|
totalSteps: plan.steps.length,
|
|
772
772
|
requestingEntityId: plan.requestingEntityId,
|
|
773
773
|
requestingThreadId: plan.requestingThreadId,
|
|
774
774
|
}
|
|
775
775
|
} )
|
|
776
776
|
|
|
777
|
-
logger.info(
|
|
777
|
+
logger.info(`[planning] plan failed: ${plan.id} — ${reason}`)
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
// ── Recall descriptors (awareness Stage 2) ─────────────────
|
|
@@ -19,11 +19,11 @@ export function computeReadySet( plan: Plan ): PlanStep[] {
|
|
|
19
19
|
const ready: PlanStep[] = []
|
|
20
20
|
|
|
21
21
|
for( const step of plan.steps ){
|
|
22
|
-
if( step.status !== 'pending'
|
|
22
|
+
if( step.status !== 'pending') continue
|
|
23
23
|
|
|
24
24
|
const allPrereqsSatisfied = step.prerequisites.every( prereqId => {
|
|
25
25
|
const prereqStep = plan.steps.find( s => s.id === prereqId )
|
|
26
|
-
return prereqStep && ( prereqStep.status === 'completed' || prereqStep.status === 'skipped'
|
|
26
|
+
return prereqStep && ( prereqStep.status === 'completed' || prereqStep.status === 'skipped')
|
|
27
27
|
} )
|
|
28
28
|
|
|
29
29
|
allPrereqsSatisfied && ready.push( step )
|
|
@@ -52,17 +52,17 @@ export function projectFrontier(
|
|
|
52
52
|
): void {
|
|
53
53
|
// Clear the previous tick's priors — they are transient.
|
|
54
54
|
for( const [ id, e ] of state.entities )
|
|
55
|
-
if( e.type === 'plan.prior'
|
|
55
|
+
if( e.type === 'plan.prior') commands.delete!.push( id )
|
|
56
56
|
|
|
57
57
|
for( const plan of plans ){
|
|
58
|
-
if( plan.status !== 'executing'
|
|
58
|
+
if( plan.status !== 'executing') continue
|
|
59
59
|
|
|
60
60
|
// Channel A: conscientiousness develops `planBiasGain` UP, so a conscientious
|
|
61
61
|
// Will pushes its plan's frontier harder against competing impulses.
|
|
62
62
|
const strength = clamp01( ( 0.5 * goalPriority( plan.goalId ) + 0.5 * plan.confidence ) * biasGain )
|
|
63
63
|
|
|
64
64
|
for( const step of plan.steps ){
|
|
65
|
-
if( step.status !== 'active'
|
|
65
|
+
if( step.status !== 'active') continue
|
|
66
66
|
commands.set!.push({
|
|
67
67
|
// tick in the id (like the affordance field) so this tick's fresh prior
|
|
68
68
|
// never collides with last tick's cleared one in the same command batch.
|
|
@@ -24,7 +24,7 @@ export function planShapeKey(
|
|
|
24
24
|
steps: ReadonlyArray<{ action: string; prerequisites?: readonly string[] }>,
|
|
25
25
|
): string {
|
|
26
26
|
return steps
|
|
27
|
-
.map( s => `${ s.action }${ ( s.prerequisites?.length ?? 0 ) > 0 ? `<${ s.prerequisites!.length }` : '' }`
|
|
27
|
+
.map( s => `${ s.action }${ ( s.prerequisites?.length ?? 0 ) > 0 ? `<${ s.prerequisites!.length }` : '' }`)
|
|
28
28
|
.join('>')
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -106,9 +106,9 @@ export class PlanSupervisor {
|
|
|
106
106
|
|
|
107
107
|
try {
|
|
108
108
|
const { attention, handle: facet } = this._executiveEngine.spawnFacet('supervision')
|
|
109
|
-
if( !facet || attention === 'full'
|
|
109
|
+
if( !facet || attention === 'full'){
|
|
110
110
|
plan.executionTier = 'automatic'
|
|
111
|
-
logger.info(
|
|
111
|
+
logger.info(`[planning] attention full — plan ${plan.id} stays automatic (no facet)`)
|
|
112
112
|
return
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -125,7 +125,7 @@ export class PlanSupervisor {
|
|
|
125
125
|
// facet whose report() silently no-ops. (P2)
|
|
126
126
|
facet.onReaped( () => {
|
|
127
127
|
this._activeFacets.delete( plan.id )
|
|
128
|
-
if( plan.status === 'executing' || plan.status === 'ready'
|
|
128
|
+
if( plan.status === 'executing' || plan.status === 'ready')
|
|
129
129
|
plan.executionTier = 'automatic'
|
|
130
130
|
logger.info(
|
|
131
131
|
`[planning] facet for plan ${plan.id} reaped — degraded to automatic`
|
|
@@ -138,7 +138,7 @@ export class PlanSupervisor {
|
|
|
138
138
|
const initialReport: FacetReport = {
|
|
139
139
|
type: 'plan.initialized',
|
|
140
140
|
contextId: plan.id,
|
|
141
|
-
instructions: this._buildDecisionGuidance(
|
|
141
|
+
instructions: this._buildDecisionGuidance('plan.initialized', undefined ),
|
|
142
142
|
payload: {
|
|
143
143
|
planId: plan.id,
|
|
144
144
|
goalId: plan.goalId,
|
|
@@ -150,10 +150,10 @@ export class PlanSupervisor {
|
|
|
150
150
|
facet.report( initialReport )
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
logger.info(
|
|
153
|
+
logger.info(`[planning] facet activated: plan=${plan.id} facetId=${facet.facetId}`)
|
|
154
154
|
}
|
|
155
155
|
catch( err ){
|
|
156
|
-
logger.error(
|
|
156
|
+
logger.error(`[planning] facet failed for plan ${plan.id}:`, err )
|
|
157
157
|
plan.executionTier = 'automatic'
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -188,7 +188,7 @@ export class PlanSupervisor {
|
|
|
188
188
|
s.status === 'failed' ? '✗' :
|
|
189
189
|
s.status === 'active' ? '→' : '○'
|
|
190
190
|
return `${marker} [${s.id}] ${s.action}: ${s.description}`
|
|
191
|
-
} ).join(
|
|
191
|
+
} ).join('\n')
|
|
192
192
|
|
|
193
193
|
const completedCount = plan.steps.filter(
|
|
194
194
|
s => s.status === 'completed' || s.status === 'skipped'
|
|
@@ -302,9 +302,9 @@ export class PlanSupervisor {
|
|
|
302
302
|
const facet = this._activeFacets.get( plan.id )
|
|
303
303
|
if( !facet ) return false
|
|
304
304
|
|
|
305
|
-
const allDone = plan.steps.every( s => s.status === 'completed' || s.status === 'skipped'
|
|
306
|
-
const anyFailed = plan.steps.some( s => s.status === 'failed'
|
|
307
|
-
const pendingCount = plan.steps.filter( s => s.status !== 'completed' && s.status !== 'skipped'
|
|
305
|
+
const allDone = plan.steps.every( s => s.status === 'completed' || s.status === 'skipped')
|
|
306
|
+
const anyFailed = plan.steps.some( s => s.status === 'failed')
|
|
307
|
+
const pendingCount = plan.steps.filter( s => s.status !== 'completed' && s.status !== 'skipped').length
|
|
308
308
|
|
|
309
309
|
let statusType: string
|
|
310
310
|
if( allDone && !anyFailed ) statusType = 'plan_completed'
|
|
@@ -350,8 +350,8 @@ export class PlanSupervisor {
|
|
|
350
350
|
prerequisites: s.prerequisites,
|
|
351
351
|
} ) ),
|
|
352
352
|
totalSteps: plan.steps.length,
|
|
353
|
-
completedSteps: plan.steps.filter( s => s.status === 'completed' || s.status === 'skipped'
|
|
354
|
-
skippedSteps: plan.steps.filter( s => s.status === 'skipped'
|
|
353
|
+
completedSteps: plan.steps.filter( s => s.status === 'completed' || s.status === 'skipped').length,
|
|
354
|
+
skippedSteps: plan.steps.filter( s => s.status === 'skipped').map( s => s.id ),
|
|
355
355
|
executionTier: plan.executionTier
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -385,14 +385,14 @@ export class PlanSupervisor {
|
|
|
385
385
|
break
|
|
386
386
|
|
|
387
387
|
case 'skip': {
|
|
388
|
-
const failedStep = plan.steps.find( s => s.status === 'failed'
|
|
388
|
+
const failedStep = plan.steps.find( s => s.status === 'failed')
|
|
389
389
|
if( failedStep ) failedStep.status = 'skipped'
|
|
390
390
|
this._host.executePlans()
|
|
391
391
|
break
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
case 'abandon': {
|
|
395
|
-
this._host.planFailed( plan, `Facet abandoned: ${decision.reasoning.slice( 0, 100 )}`
|
|
395
|
+
this._host.planFailed( plan, `Facet abandoned: ${decision.reasoning.slice( 0, 100 )}`)
|
|
396
396
|
this.cleanupFacet( plan.id )
|
|
397
397
|
break
|
|
398
398
|
}
|
|
@@ -410,7 +410,7 @@ export class PlanSupervisor {
|
|
|
410
410
|
status: 'pending' as const,
|
|
411
411
|
} ) )
|
|
412
412
|
|
|
413
|
-
logger.info(
|
|
413
|
+
logger.info(`[planning] plan ${plan.id} replanned (${plan.steps.length} steps)`)
|
|
414
414
|
|
|
415
415
|
// Surface: the mind rewrote the plan mid-flight — a course-correction the
|
|
416
416
|
// master should be aware of (mirrors plan.escalated). Only fires when steps
|
|
@@ -443,10 +443,10 @@ export class PlanSupervisor {
|
|
|
443
443
|
// re-activates it on the frontier; capped per step so a stuck step can't loop forever.
|
|
444
444
|
let retried = 0
|
|
445
445
|
for( const s of plan.steps ){
|
|
446
|
-
if( s.status !== 'failed'
|
|
446
|
+
if( s.status !== 'failed') continue
|
|
447
447
|
const n = s.retries ?? 0
|
|
448
448
|
if( n >= this._dispositions.maxStepRetries ){
|
|
449
|
-
logger.info(
|
|
449
|
+
logger.info(`[planning] step ${s.id} retry exhausted (${n}/${this._dispositions.maxStepRetries}); left failed`)
|
|
450
450
|
continue
|
|
451
451
|
}
|
|
452
452
|
s.retries = n + 1
|
|
@@ -454,7 +454,7 @@ export class PlanSupervisor {
|
|
|
454
454
|
s.outcome = undefined
|
|
455
455
|
retried++
|
|
456
456
|
}
|
|
457
|
-
logger.info(
|
|
457
|
+
logger.info(`[planning] plan ${plan.id} retrying ${retried} step(s)`)
|
|
458
458
|
this._host.executePlans()
|
|
459
459
|
break
|
|
460
460
|
}
|
|
@@ -464,7 +464,7 @@ export class PlanSupervisor {
|
|
|
464
464
|
// Free the facet's attention while held.
|
|
465
465
|
plan.status = 'paused'
|
|
466
466
|
this.cleanupFacet( plan.id )
|
|
467
|
-
logger.info(
|
|
467
|
+
logger.info(`[planning] plan ${plan.id} paused by facet`)
|
|
468
468
|
break
|
|
469
469
|
}
|
|
470
470
|
|
|
@@ -485,7 +485,7 @@ export class PlanSupervisor {
|
|
|
485
485
|
requestingThreadId: plan.requestingThreadId,
|
|
486
486
|
}
|
|
487
487
|
} )
|
|
488
|
-
logger.info(
|
|
488
|
+
logger.info(`[planning] plan ${plan.id} escalated to master`)
|
|
489
489
|
break
|
|
490
490
|
}
|
|
491
491
|
}
|
|
@@ -97,12 +97,12 @@ export class ReputationTracker implements SimulationEngine, CognitiveEngine {
|
|
|
97
97
|
|
|
98
98
|
onCognitiveEvent( e: CognitiveEvent ): StateCommands | void {
|
|
99
99
|
this._model.observe( e.type, e.salience )
|
|
100
|
-
if( e.type === 'executive.prediction.formed'
|
|
100
|
+
if( e.type === 'executive.prediction.formed'){
|
|
101
101
|
const p = e.payload as { predictedDomains: string[]; confidence: number }
|
|
102
102
|
if( p.predictedDomains.includes('social') )
|
|
103
|
-
this._model.setPrecision(
|
|
103
|
+
this._model.setPrecision('reputation.tracked', 1.0 + p.confidence * 0.5 )
|
|
104
104
|
}
|
|
105
|
-
if( e.type === 'interaction.occurred'
|
|
105
|
+
if( e.type === 'interaction.occurred'){
|
|
106
106
|
const p = e.payload as { keid: string; valence: number; intensity: number; directedAtSelf: boolean }
|
|
107
107
|
this._pendingInteractions.push( p )
|
|
108
108
|
}
|
|
@@ -124,7 +124,7 @@ export class ReputationTracker implements SimulationEngine, CognitiveEngine {
|
|
|
124
124
|
// agent's cooperativeness is refreshed each tick as base ⊕ persona-prior. An agreeable
|
|
125
125
|
// Will develops a larger step — it extends benefit-of-the-doubt and credits cooperation
|
|
126
126
|
// more readily (the trust facet).
|
|
127
|
-
this._trustGrowthStep = readEffectiveParams( state, 'engine-config-reputation'
|
|
127
|
+
this._trustGrowthStep = readEffectiveParams( state, 'engine-config-reputation').trustGrowthStep ?? this._trustGrowthStep
|
|
128
128
|
|
|
129
129
|
// Rehydrate _reputations from persisted state on the first tick after
|
|
130
130
|
// construction / snapshot restore. Without this, every session restart
|
|
@@ -213,7 +213,7 @@ export class ReputationTracker implements SimulationEngine, CognitiveEngine {
|
|
|
213
213
|
// Phase C + F: publish cognitive event — gated by prediction error
|
|
214
214
|
const _bus = this._bus
|
|
215
215
|
if( _bus && this._reputations.size > 0 ){
|
|
216
|
-
const predErr = this._model.observe(
|
|
216
|
+
const predErr = this._model.observe('reputation.tracked', this._reputations.size )
|
|
217
217
|
if( !predErr.gated )
|
|
218
218
|
_bus.publish({ type: 'reputation.updated', version: 1, sourceEngine: this.name, salience: Math.max( 0.2, predErr.salience ), payload: { trackedAgents: this._reputations.size } })
|
|
219
219
|
}
|
|
@@ -240,7 +240,7 @@ export class ReputationTracker implements SimulationEngine, CognitiveEngine {
|
|
|
240
240
|
*/
|
|
241
241
|
private _restoreFromState( state: ReadonlySimulationState ): void {
|
|
242
242
|
for( const entity of state.entities.values() ){
|
|
243
|
-
if( entity.type !== 'reputation'
|
|
243
|
+
if( entity.type !== 'reputation') continue
|
|
244
244
|
const m = entity.metadata ?? {}
|
|
245
245
|
const keid = m['keid'] as string | undefined
|
|
246
246
|
if( !keid ) continue
|
|
@@ -148,7 +148,7 @@ export class RewardEvaluator implements SimulationEngine, CognitiveEngine {
|
|
|
148
148
|
this._cachedSocialReward = Math.min( 1, Math.max( 0,
|
|
149
149
|
this._cachedSocialReward + contribution * this._socialWarmthBoost
|
|
150
150
|
))
|
|
151
|
-
this._model.observe(
|
|
151
|
+
this._model.observe('reward.social', this._cachedSocialReward )
|
|
152
152
|
}
|
|
153
153
|
break
|
|
154
154
|
}
|
|
@@ -161,7 +161,7 @@ export class RewardEvaluator implements SimulationEngine, CognitiveEngine {
|
|
|
161
161
|
const priority = p.priority ?? 0.5
|
|
162
162
|
this._cachedGoalReward = Math.min( 1, this._cachedGoalReward + priority * 0.9 )
|
|
163
163
|
this._goalsCompletedRecently = Math.min( 2, this._goalsCompletedRecently + 1 )
|
|
164
|
-
this._model.observe(
|
|
164
|
+
this._model.observe('reward.goal', this._cachedGoalReward )
|
|
165
165
|
break
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -185,7 +185,7 @@ export class RewardEvaluator implements SimulationEngine, CognitiveEngine {
|
|
|
185
185
|
* No-op at boot: mirror params equal the constructor defaults (reconciled in #83).
|
|
186
186
|
*/
|
|
187
187
|
private _readConfigFromState( state: ReadonlySimulationState ): void {
|
|
188
|
-
const p = readEffectiveParams( state, 'engine-config-reward'
|
|
188
|
+
const p = readEffectiveParams( state, 'engine-config-reward')
|
|
189
189
|
if( p.goalWeight != null ) this._goalWeight = p.goalWeight
|
|
190
190
|
if( p.socialWeight != null ) this._socialWeight = p.socialWeight
|
|
191
191
|
if( p.resourceWeight != null ) this._resourceWeight = p.resourceWeight
|
|
@@ -289,7 +289,7 @@ export class RewardEvaluator implements SimulationEngine, CognitiveEngine {
|
|
|
289
289
|
// workspace, a fully-expected reward goes quiet (dopamine-RPE analogue),
|
|
290
290
|
// precision-modulated (set on 'reward.value'). observe() runs every tick so
|
|
291
291
|
// the baseline tracks; the one value is reused across the reward events.
|
|
292
|
-
const rewardSalience = this._model.observe(
|
|
292
|
+
const rewardSalience = this._model.observe('reward.value', rewardLevel ).salience
|
|
293
293
|
|
|
294
294
|
if( joy > 0.5 )
|
|
295
295
|
_bus.publish({ type: 'emotion.joy.peak', version: 1, sourceEngine: this.name, salience: rewardSalience, payload: { joy } })
|