@mindot/will 0.8.0 → 0.10.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/README.md +15 -11
- package/dist/index.d.ts +188 -141
- package/dist/index.js +6985 -3337
- package/dist/index.js.map +1 -1
- package/dist/surface/channels/discord.d.ts +177 -0
- package/dist/surface/channels/discord.js +394 -0
- package/dist/surface/channels/discord.js.map +1 -0
- package/dist/{channels → surface/channels}/whatsapp.d.ts +2 -2
- package/dist/{channels → surface/channels}/whatsapp.js +11 -5
- package/dist/surface/channels/whatsapp.js.map +1 -0
- package/dist/{cli.js → surface/cli.js} +5382 -1573
- package/dist/surface/cli.js.map +1 -0
- package/dist/{mcp → surface/mcp}/effectors.d.ts +1 -1
- package/dist/{mcp → surface/mcp}/effectors.js +10 -4
- package/dist/surface/mcp/effectors.js.map +1 -0
- package/dist/{will-cS6k4uiJ.d.ts → will-evj9_vrd.d.ts} +6658 -5078
- package/package.json +11 -12
- package/src/cognition/agency/consequence.ts +356 -1
- package/src/cognition/agency/conversation.aim.ts +292 -0
- package/src/cognition/agency/engines/action.selector.ts +142 -5
- package/src/cognition/agency/engines/affordance.synthesizer.ts +200 -7
- package/src/cognition/agency/engines/deliberation.engine.ts +76 -3
- package/src/cognition/agency/engines/motor.schema.executor.ts +509 -32
- package/src/cognition/agency/engines/reafference.engine.ts +160 -4
- package/src/cognition/agency/execution.primitives.ts +17 -4
- package/src/cognition/agency/proactive.communicator.ts +19 -3
- package/src/cognition/agency/reconcile.learning.ts +5 -4
- package/src/cognition/agency/restart.ts +66 -0
- package/src/cognition/agency/schemas/innate.ts +96 -1
- package/src/cognition/agency/schemas/repertoire.ts +19 -1
- package/src/cognition/agency/selection.scoring.ts +49 -0
- package/src/cognition/agency/settlement.ts +203 -0
- package/src/cognition/agency/types.ts +73 -1
- package/src/cognition/cache/composition.ts +232 -0
- package/src/cognition/cache/deliberation.cache.ts +219 -0
- package/src/cognition/cache/fingerprint.ts +120 -0
- package/src/cognition/cache/types.ts +105 -0
- package/src/cognition/config.mirror.entities.ts +108 -1
- package/src/cognition/event.schemas.ts +22 -8
- package/src/cognition/faculties/affective.blender.ts +21 -4
- package/src/cognition/faculties/autobiographical.narrator.ts +5 -10
- package/src/cognition/faculties/circadian.oscillator.ts +36 -7
- package/src/cognition/faculties/episodic.consolidator.ts +59 -3
- package/src/cognition/faculties/executive.engine/action.record.ts +129 -0
- package/src/cognition/faculties/executive.engine/commands.ts +189 -14
- package/src/cognition/faculties/executive.engine/context.ts +106 -46
- package/src/cognition/faculties/executive.engine/deliberate.reasoning.ts +1 -1
- package/src/cognition/faculties/executive.engine/engine.ts +714 -136
- package/src/cognition/faculties/executive.engine/escalation.buffer.ts +230 -45
- package/src/cognition/faculties/executive.engine/facet.supervisor.ts +320 -65
- package/src/cognition/faculties/executive.engine/facet.ts +81 -26
- package/src/cognition/faculties/executive.engine/gating.ts +14 -14
- package/src/cognition/faculties/executive.engine/parser.ts +120 -38
- package/src/cognition/faculties/executive.engine/prompt.factory.ts +331 -38
- package/src/cognition/faculties/executive.engine/types.ts +84 -12
- package/src/cognition/faculties/exteroception.ts +99 -98
- package/src/cognition/faculties/goal.manager.ts +144 -16
- package/src/cognition/faculties/known.entity.tracker.ts +287 -29
- package/src/cognition/faculties/moral.evaluator.ts +8 -3
- package/src/cognition/faculties/persona.consolidator.ts +141 -0
- package/src/cognition/faculties/planning.engine/engine.ts +4 -4
- package/src/cognition/faculties/planning.engine/plan.frontier.ts +1 -1
- package/src/cognition/faculties/reputation.tracker.ts +66 -2
- package/src/cognition/faculties/self.model.updater.ts +19 -12
- package/src/cognition/faculties/semantic.engine/integrator.ts +1 -1
- package/src/cognition/faculties/social.perception.ts +47 -3
- package/src/cognition/faculties/threat.evaluator.ts +7 -0
- package/src/cognition/faculties/working.memory.ts +16 -21
- package/src/cognition/identity.entity.ts +205 -0
- package/src/cognition/index.ts +7 -0
- package/src/cognition/instruction.handler.ts +1 -1
- package/src/cognition/memory/vector.adapter.ts +12 -3
- package/src/cognition/memory/vector.embedder.ts +45 -4
- package/src/cognition/percept.entity.ts +122 -0
- package/src/cognition/persona.prior.ts +6 -0
- package/src/cognition/sense.boundary.ts +176 -0
- package/src/cognition/senses/audition.engine/engine.ts +492 -53
- package/src/cognition/senses/base.sense.engine.ts +105 -7
- package/src/cognition/senses/index.ts +83 -13
- package/src/cognition/senses/provenance.ts +128 -0
- package/src/cognition/senses/somatosensation.engine.ts +117 -9
- package/src/cognition/social.identity.ts +296 -0
- package/src/cognition/utilities/token.tracker.ts +94 -10
- package/src/core/orchestrator.ts +51 -0
- package/src/index.ts +39 -5
- package/src/llm/gate.ts +48 -0
- package/src/llm/index.ts +127 -33
- package/src/llm/routing.ts +6 -0
- package/src/llm/summarizer.ts +1 -1
- package/src/llm/wire.contracts.ts +57 -0
- package/src/pma/index.ts +68 -54
- package/src/stem/assembly.audit.ts +1 -0
- package/src/stem/guards/identity.coherence.ts +1 -1
- package/src/stem/index.ts +171 -23
- package/src/stem/mind.ts +198 -57
- package/src/stem/policy/arbiter.ts +10 -0
- package/src/stem/profiles/built-in.ts +7 -0
- package/src/{profiles → stem/profiles}/companion.ts +1 -1
- package/src/{profiles → stem/profiles}/company-brain.ts +1 -1
- package/src/{profiles → stem/profiles}/customer-service.ts +1 -1
- package/src/{profiles → stem/profiles}/game-npc.ts +1 -1
- package/src/{profiles → stem/profiles}/index.ts +1 -1
- package/src/{profiles → stem/profiles}/smart-home.ts +1 -1
- package/src/stem/tracts/effector/escalation.lifecycle.ts +239 -0
- package/src/stem/tracts/effector/policy.enforcement.ts +261 -0
- package/src/stem/tracts/effector/types.ts +110 -0
- package/src/stem/tracts/effector.controller.ts +112 -401
- package/src/stem/tracts/outbox.controller.ts +30 -17
- package/src/stem/tracts/outbox.writer.ts +40 -2
- package/src/stem/tracts/sensory.controller.ts +6 -6
- package/src/stem/tracts/session.logger.ts +6 -1
- package/src/stem/tracts/transport/types.ts +20 -1
- package/src/stem/tracts/transport.controller.ts +33 -9
- package/src/surface/channels/discord.ts +609 -0
- package/src/{channels → surface/channels}/roster.ts +1 -1
- package/src/surface/channels/types.ts +136 -0
- package/src/{channels → surface/channels}/whatsapp.ts +22 -10
- package/src/{cli.ts → surface/cli.ts} +14 -9
- package/src/{host → surface/host}/boot.ts +3 -3
- package/src/{host → surface/host}/utterances.ts +2 -2
- package/src/{mcp → surface/mcp}/effectors.ts +19 -6
- package/src/{mcp → surface/mcp}/server.ts +19 -5
- package/src/{sdk → surface/sdk}/will.ts +194 -33
- package/src/{serve → surface/serve}/server.ts +11 -4
- package/src/types.ts +24 -3
- package/dist/channels/discord.d.ts +0 -69
- package/dist/channels/discord.js +0 -193
- package/dist/channels/discord.js.map +0 -1
- package/dist/channels/whatsapp.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/mcp/effectors.js.map +0 -1
- package/src/channels/discord.ts +0 -214
- package/src/channels/types.ts +0 -46
- package/src/cognition/faculties/executive.engine/messages.ts +0 -102
- package/src/extensions/livestream.ext.ts +0 -570
- package/src/extensions/time.ext.ts +0 -339
- package/src/profiles/built-in.ts +0 -7
- package/src/runners/coherence.runner.ts +0 -49
- package/src/runners/outreach.runner.ts +0 -155
- package/src/runners/social.runner.ts +0 -179
- package/src/runners/thin-shim.runner.ts +0 -205
- /package/dist/{cli.d.ts → surface/cli.d.ts} +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────
|
|
2
|
+
// src/stem/tracts/effector/types.ts — the efference crossing, shared shapes
|
|
3
|
+
// ─────────────────────────────────────────────────────────────
|
|
4
|
+
//
|
|
5
|
+
// SIGNAL_BOUNDARY P1a. `effector.controller.ts` had seven jobs; these are the
|
|
6
|
+
// shapes its three real seams pass between them:
|
|
7
|
+
//
|
|
8
|
+
// policy enforcement arbiter · verdicts · refusals
|
|
9
|
+
// escalation lifecycle hold · resolve · expire
|
|
10
|
+
// agency↔host buffer · drain · ack (the controller itself)
|
|
11
|
+
//
|
|
12
|
+
// The seams were verified before the cut, not assumed: no method touched both
|
|
13
|
+
// the policy fields (`_arbiter`, `_pendingRefusals`) and the escalation fields
|
|
14
|
+
// (`_newEscalations`, `_activeEscalations`, `_pendingResolutions`) except
|
|
15
|
+
// `_applyVerdict`, which is the ROUTER — deny goes one way, escalate the other.
|
|
16
|
+
// A router across a seam is the seam working, not a tangle.
|
|
17
|
+
|
|
18
|
+
import type { DenialFinality, PolicyCounterfactual } from '#stem/policy/arbiter'
|
|
19
|
+
import type { WillInstance } from '#stem/index'
|
|
20
|
+
|
|
21
|
+
/** A denial awaiting application as a refusal ack at the next tick boundary. */
|
|
22
|
+
export interface PendingRefusal {
|
|
23
|
+
intentId: string
|
|
24
|
+
schema: string
|
|
25
|
+
reasonCode: string
|
|
26
|
+
finality: DenialFinality
|
|
27
|
+
/** ENVELOPE_NARROWING P0 — what WOULD have been allowed, carried through to
|
|
28
|
+
* the outcome the mind learns from. Absent on refusals that have no bound to
|
|
29
|
+
* report (a flat ban, a fault, an unanswered escalation). */
|
|
30
|
+
counterfactual?: PolicyCounterfactual
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** An escalation the Will has raised: the intent is held, the ask is voiced once,
|
|
34
|
+
* and the original payload is kept so an approval can dispatch it to the world. */
|
|
35
|
+
export interface Escalation {
|
|
36
|
+
intentId: string
|
|
37
|
+
schema: string
|
|
38
|
+
reasonCode: string
|
|
39
|
+
/** The withheld invocation payload — replayed to the host on approval. */
|
|
40
|
+
payload: Record<string, unknown>
|
|
41
|
+
expiresAt: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A host's answer to an escalation, applied at the next tick boundary. */
|
|
45
|
+
export interface PendingResolution {
|
|
46
|
+
intentId: string
|
|
47
|
+
approved: boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** What a host says came back. */
|
|
51
|
+
export interface EffectorAck {
|
|
52
|
+
success: boolean
|
|
53
|
+
/**
|
|
54
|
+
* How the act WENT. The fate of the attempt — landed, refused, failed — which
|
|
55
|
+
* is what the mind learns competence from. Not what the act revealed.
|
|
56
|
+
*/
|
|
57
|
+
description: string
|
|
58
|
+
/**
|
|
59
|
+
* What the act REVEALED: new information about the world, as distinct from how
|
|
60
|
+
* the act went (SIGNAL_BOUNDARY P2).
|
|
61
|
+
*
|
|
62
|
+
* Present ⇒ this ack is ALSO afference. It arrives as a reafferent percept
|
|
63
|
+
* carrying `sourceIntentId`, so the mind perceives it, remembers it and can
|
|
64
|
+
* recall it — rather than only learning from it. `lookup`, `list_warnings`,
|
|
65
|
+
* `snapshot` carry one; `kick`, `warn`, a refusal do not.
|
|
66
|
+
*
|
|
67
|
+
* WHY THE HOST DECIDES, AND WHY THIS IS NOT INFERRED FROM `description`.
|
|
68
|
+
* An ack is not *always* new world information, and nothing inside the mind
|
|
69
|
+
* can tell "the kick landed" from "there are 47 people here" — both are
|
|
70
|
+
* strings that came back from an act. Only the host knows which it wrote.
|
|
71
|
+
* Same contract as `provenance`: asserted at the boundary, never guessed.
|
|
72
|
+
*
|
|
73
|
+
* Forcing every ack through the sense door would be the over-unification this
|
|
74
|
+
* epoch warns about — a mind perceiving "the kick landed" as a fresh event in
|
|
75
|
+
* the world, every time it kicks.
|
|
76
|
+
*
|
|
77
|
+
* ANY SHAPE, AND CARRIED WHOLE. A host with a member record, a channel
|
|
78
|
+
* snapshot, a list of warnings sends the record — not a paragraph about it.
|
|
79
|
+
* Making a host flatten its own data to prose is a quieter kind of cutting:
|
|
80
|
+
* it destroys the structure rather than the tail. Nothing here is truncated
|
|
81
|
+
* at any point on the way in; what the host sent is what the mind gets.
|
|
82
|
+
*/
|
|
83
|
+
observation?: unknown
|
|
84
|
+
metrics?: Record<string, number>
|
|
85
|
+
/** POLICY_REAFFERENCE P2 — set when the ack is a policy refusal, so the
|
|
86
|
+
* ReafferenceEngine routes it to availability rather than competence. */
|
|
87
|
+
refused?: boolean
|
|
88
|
+
finality?: DenialFinality
|
|
89
|
+
/** ENVELOPE_NARROWING P0 — the bound that was exceeded, if the arbiter said. */
|
|
90
|
+
counterfactual?: PolicyCounterfactual
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The translation seam, as the other two see it.
|
|
95
|
+
*
|
|
96
|
+
* Both collaborators need to put an invocation on the wire, and policy also
|
|
97
|
+
* needs to reconcile a refusal as an ack. Injected as plain functions rather
|
|
98
|
+
* than a controller reference: it keeps the dependency one-way at the type
|
|
99
|
+
* level, and it is what lets the controller wire a cycle (policy raises an
|
|
100
|
+
* escalation, an escalation queues a refusal) without either class importing
|
|
101
|
+
* the other.
|
|
102
|
+
*/
|
|
103
|
+
export interface EffectorOps {
|
|
104
|
+
buffer( instance: WillInstance, payload: Record<string, unknown> ): void
|
|
105
|
+
confirmExecution( instance: WillInstance, invocationId: string, result: EffectorAck ): void
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** How long an escalated intent is held awaiting a resolution before it degrades
|
|
109
|
+
* to a refusal — 2× the host-ack timeout, so a human has real time to answer. */
|
|
110
|
+
export const ESCALATION_TTL_TICKS = 30
|