@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
|
@@ -39,7 +39,7 @@ export class StreamTransport implements ExternalTransport {
|
|
|
39
39
|
private readonly _inboundHandlers = new Set<( env: InboundEnvelope ) => void>()
|
|
40
40
|
private readonly _statusHandlers = new Set<( s: TransportStatus ) => void>()
|
|
41
41
|
|
|
42
|
-
constructor( willId: string = 'stream'
|
|
42
|
+
constructor( willId: string = 'stream'){
|
|
43
43
|
this.willId = willId
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -71,7 +71,7 @@ export class StreamTransport implements ExternalTransport {
|
|
|
71
71
|
* `'reply'`) or `'*'` for all. Returns an unsubscribe function.
|
|
72
72
|
*/
|
|
73
73
|
on( channel: StreamChannel, listener: OutboundListener ): () => void {
|
|
74
|
-
if( channel === '*'
|
|
74
|
+
if( channel === '*') return this.subscribe( listener )
|
|
75
75
|
let set = this._outboundByCh.get( channel )
|
|
76
76
|
if( !set ){ set = new Set(); this._outboundByCh.set( channel, set ) }
|
|
77
77
|
set.add( listener )
|
|
@@ -88,12 +88,12 @@ export class TransportController {
|
|
|
88
88
|
* the SAME path discrete ack events take — so applyInbound() reconciles both
|
|
89
89
|
* idempotently. 'none' = fire-and-forget (chunks, replies: no outbox entry to mark).
|
|
90
90
|
*/
|
|
91
|
-
private _emit( instance: WillInstance, env: OutboundEnvelope, reconcileAs: 'delivery' | 'result' | 'none'
|
|
91
|
+
private _emit( instance: WillInstance, env: OutboundEnvelope, reconcileAs: 'delivery' | 'result' | 'none'): void {
|
|
92
92
|
const transport = instance.transport
|
|
93
93
|
if( !transport ) return
|
|
94
94
|
|
|
95
95
|
// Buffer state-affecting outbound until acked, so a reconnect can re-emit it.
|
|
96
|
-
if( reconcileAs !== 'none'
|
|
96
|
+
if( reconcileAs !== 'none'){
|
|
97
97
|
const pending = this._pendingFor( instance.config.id )
|
|
98
98
|
pending.set( env.correlationId, env )
|
|
99
99
|
// Bound the buffer — drop the oldest un-acked envelope past the cap (FIFO).
|
|
@@ -105,7 +105,7 @@ export class TransportController {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const pending = transport.emit( env )
|
|
108
|
-
if( reconcileAs === 'none'
|
|
108
|
+
if( reconcileAs === 'none'){ void pending; return }
|
|
109
109
|
|
|
110
110
|
void pending.then( ack => {
|
|
111
111
|
if( !ack.acked ) return
|
|
@@ -120,9 +120,9 @@ export class TransportController {
|
|
|
120
120
|
|
|
121
121
|
/** Coerce an emit-callback ack payload into a confirmExecution result, or null. */
|
|
122
122
|
private _asResult( payload: unknown ): { success: boolean; description: string; metrics?: Record<string, number> } | null {
|
|
123
|
-
if( payload && typeof payload === 'object' && typeof ( payload as { success?: unknown } ).success === 'boolean'
|
|
123
|
+
if( payload && typeof payload === 'object' && typeof ( payload as { success?: unknown } ).success === 'boolean'){
|
|
124
124
|
const p = payload as { success: boolean; description?: unknown; metrics?: Record<string, number> }
|
|
125
|
-
return { success: p.success, description: String( p.description ?? ''
|
|
125
|
+
return { success: p.success, description: String( p.description ?? ''), ...( p.metrics ? { metrics: p.metrics } : {} ) }
|
|
126
126
|
}
|
|
127
127
|
return null
|
|
128
128
|
}
|
|
@@ -142,7 +142,7 @@ export class TransportController {
|
|
|
142
142
|
seq,
|
|
143
143
|
wallTime: wallClock(),
|
|
144
144
|
entry,
|
|
145
|
-
}, 'none'
|
|
145
|
+
}, 'none')
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
@@ -159,7 +159,7 @@ export class TransportController {
|
|
|
159
159
|
seq,
|
|
160
160
|
wallTime: wallClock(),
|
|
161
161
|
report,
|
|
162
|
-
}, 'none'
|
|
162
|
+
}, 'none')
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
/**
|
|
@@ -185,7 +185,7 @@ export class TransportController {
|
|
|
185
185
|
entityId,
|
|
186
186
|
threadId,
|
|
187
187
|
bubbles,
|
|
188
|
-
}, 'none'
|
|
188
|
+
}, 'none')
|
|
189
189
|
} )
|
|
190
190
|
|
|
191
191
|
// Outbound chunk fast-path (2.2): stream each filtered reply token off-tick.
|
|
@@ -200,13 +200,13 @@ export class TransportController {
|
|
|
200
200
|
entityId,
|
|
201
201
|
threadId,
|
|
202
202
|
content,
|
|
203
|
-
}, 'none'
|
|
203
|
+
}, 'none')
|
|
204
204
|
} )
|
|
205
205
|
this._chunkUnsub.set( instance.config.id, chunkUnsub )
|
|
206
206
|
|
|
207
207
|
// Outbound activity projection (2.5): forward all plan/activity events
|
|
208
208
|
// ('*' wildcard = no entity filter). Observability only — fire-and-forget.
|
|
209
|
-
const activityUnsub = instance.cognition.planningEngine.addActivityListener(
|
|
209
|
+
const activityUnsub = instance.cognition.planningEngine.addActivityListener('*', event => {
|
|
210
210
|
this._emit( instance, {
|
|
211
211
|
channel: 'activity',
|
|
212
212
|
willId: instance.config.id,
|
|
@@ -216,13 +216,13 @@ export class TransportController {
|
|
|
216
216
|
entityId: event.requestingEntityId ?? '',
|
|
217
217
|
eventType: event.type,
|
|
218
218
|
payload: { ...event },
|
|
219
|
-
}, 'none'
|
|
219
|
+
}, 'none')
|
|
220
220
|
} )
|
|
221
221
|
this._activityUnsub.set( instance.config.id, activityUnsub )
|
|
222
222
|
|
|
223
223
|
// Reconnect: re-emit un-acked messages/invocations when the link returns.
|
|
224
224
|
const statusUnsub = transport.onStatus( status => {
|
|
225
|
-
if( status === 'connected'
|
|
225
|
+
if( status === 'connected') this._reemitPending( instance )
|
|
226
226
|
} )
|
|
227
227
|
this._statusUnsub.set( instance.config.id, statusUnsub )
|
|
228
228
|
|
|
@@ -236,7 +236,7 @@ export class TransportController {
|
|
|
236
236
|
|
|
237
237
|
logger.info(`[transport] reconnect — re-emitting ${pending.size} un-acked envelope(s) for ${instance.config.id}`)
|
|
238
238
|
for( const env of [ ...pending.values() ] )
|
|
239
|
-
this._emit( instance, env, env.channel === 'effector_invocation' ? 'result' : 'delivery'
|
|
239
|
+
this._emit( instance, env, env.channel === 'effector_invocation' ? 'result' : 'delivery')
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
/**
|
|
@@ -258,7 +258,7 @@ export class TransportController {
|
|
|
258
258
|
seq: this._nextSeq( instance.config.id ),
|
|
259
259
|
wallTime: wallClock(),
|
|
260
260
|
invocation,
|
|
261
|
-
}, 'result'
|
|
261
|
+
}, 'result')
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
/**
|
|
@@ -279,7 +279,7 @@ export class TransportController {
|
|
|
279
279
|
seq: this._nextSeq( instance.config.id ),
|
|
280
280
|
wallTime: wallClock(),
|
|
281
281
|
message,
|
|
282
|
-
}, 'delivery'
|
|
282
|
+
}, 'delivery')
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
/** Tear down the transport and discard any un-applied inbound. */
|