@mindot/will 0.1.1 → 0.3.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 +71 -4
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +26221 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +52 -7760
- package/dist/index.js +374 -86
- package/dist/index.js.map +1 -1
- package/dist/mcp/effectors.d.ts +55 -0
- package/dist/mcp/effectors.js +76 -0
- package/dist/mcp/effectors.js.map +1 -0
- package/dist/will-B5eKs3Wv.d.ts +7903 -0
- package/package.json +38 -30
- package/src/cli.ts +75 -0
- package/src/cognition/agency/engines/action.selector.ts +3 -0
- package/src/cognition/agency/engines/affordance.synthesizer.ts +26 -12
- package/src/cognition/agency/engines/deliberation.engine.ts +7 -2
- package/src/cognition/agency/engines/motor.schema.executor.ts +2 -0
- package/src/cognition/agency/schemas/external.ts +27 -10
- package/src/cognition/agency/schemas/repertoire.ts +12 -0
- package/src/cognition/agency/types.ts +51 -2
- package/src/cognition/faculties/executive.engine/commands.ts +47 -11
- package/src/cognition/faculties/executive.engine/context.ts +28 -0
- package/src/cognition/faculties/executive.engine/facet.supervisor.ts +15 -1
- package/src/cognition/faculties/executive.engine/facet.ts +32 -6
- package/src/cognition/faculties/executive.engine/prompt.factory.ts +11 -1
- package/src/cognition/faculties/executive.engine/types.ts +24 -2
- package/src/cognition/index.ts +1 -1
- package/src/core/abstracts.ts +39 -12
- package/src/host/boot.ts +127 -0
- package/src/host/utterances.ts +53 -0
- package/src/index.ts +6 -0
- package/src/mcp/effectors.ts +159 -0
- package/src/mcp/server.ts +144 -0
- package/src/sdk/will.ts +269 -44
- package/src/serve/server.ts +154 -0
- package/src/stem/index.ts +16 -0
- package/src/stem/mind.ts +11 -4
- package/src/stem/tracts/effector.controller.ts +1 -0
- package/src/types.ts +2 -0
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ Regulatory → Perceptual → Affective → Memory → Executive → Meta-cognit
|
|
|
19
19
|
|
|
20
20
|
The mind is not re-derived from a prompt each run. It **accretes**: traits develop from experience, beliefs consolidate, skills proceduralise, and a coherent self carries across restarts as a portable, eval-verified artifact.
|
|
21
21
|
|
|
22
|
+
Embed it four ways — [**SDK facade**](#the-will-sdk-facade--recommended) (Node/TS) · [**Claude Desktop via MCP**](#the-mcp-server--a-persistent-mind-in-claude-desktop--claude-code) · [**MCP tools as its abilities**](#employing-mcp-tools--the-mind-gets-abilities) · [**HTTP sidecar / Docker**](#the-http-sidecar--will-serve-any-language-or-docker) (any language). [Pick a surface →](#use-it-in-your-project)
|
|
23
|
+
|
|
22
24
|
---
|
|
23
25
|
|
|
24
26
|
## What makes it different
|
|
@@ -82,7 +84,16 @@ ticks — or earlier when physiology demands it.
|
|
|
82
84
|
|
|
83
85
|
## Use it in your project
|
|
84
86
|
|
|
85
|
-
Runs anywhere **Node 18+ or Bun** runs (the engine is Node-compatible; Bun is the primary target).
|
|
87
|
+
Runs anywhere **Node 18+ or Bun** runs (the engine is Node-compatible; Bun is the primary target). **Four surfaces**, one paradigm — you *perceive* things to a mind and *observe what it projects*; it may act, speak, or stay silent, and it persists across restarts via its [PMA artifact](#pma--the-persistent-mind-artifact):
|
|
88
|
+
|
|
89
|
+
| Surface | You are… | Start with |
|
|
90
|
+
|---|---|---|
|
|
91
|
+
| [**SDK facade**](#the-will-sdk-facade--recommended) | a Node/TypeScript app embedding a mind | `import { Will } from '@mindot/will'` |
|
|
92
|
+
| [**MCP host**](#the-mcp-server--a-persistent-mind-in-claude-desktop--claude-code) | Claude Desktop / Claude Code / an IDE | `npx -y @mindot/will mcp` |
|
|
93
|
+
| [**MCP tools as abilities**](#employing-mcp-tools--the-mind-gets-abilities) | giving the mind tools it *chooses* to use | `import { connectMcpEffectors } from '@mindot/will/mcp'` |
|
|
94
|
+
| [**HTTP sidecar**](#the-http-sidecar--will-serve-any-language-or-docker) | Python, Go, a game server — any language, or Docker | `npx -y @mindot/will serve` |
|
|
95
|
+
|
|
96
|
+
(Power users can drop below all four to the [`WillStem` contract](#the-willstem-contract--full-control).)
|
|
86
97
|
|
|
87
98
|
### The `Will` SDK facade — recommended
|
|
88
99
|
|
|
@@ -114,6 +125,61 @@ const revived = await Will.wake(pma, { name: 'Aria' })
|
|
|
114
125
|
|
|
115
126
|
`will.state()` returns a compact read of the mind (energy, mood, goals, beliefs, self-narrative). Drop to `will.stem` for the full `WillStem` contract at any time. Runnable: [`examples/effectors.ts`](examples/effectors.ts).
|
|
116
127
|
|
|
128
|
+
### The MCP server — a persistent mind in Claude Desktop / Claude Code
|
|
129
|
+
|
|
130
|
+
Host a Will over the [Model Context Protocol](https://modelcontextprotocol.io) — any MCP client can then live alongside a persistent mind that **remembers across sessions** (it hibernates to a Persistent Mind Artifact on shutdown and wakes as the same self on the next boot):
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"mcpServers": {
|
|
135
|
+
"will": {
|
|
136
|
+
"command": "npx",
|
|
137
|
+
"args": ["-y", "@mindot/will", "mcp"],
|
|
138
|
+
"env": {
|
|
139
|
+
"WILL_NAME": "Aria",
|
|
140
|
+
"WILL_IDENTITY": "I am Aria, a calm, precise research assistant."
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The surface keeps the paradigm: `perceive` delivers a stimulus (it returns when *delivered*, not answered), `next_utterance` awaits the mind's next words (**silence is a valid outcome**, reported — never an error), `state` reads its inner life, and `save` checkpoints it without stopping it. There is deliberately no `ask()`-shaped tool. Config via env: `WILL_TIER` (basic|standard|full), `WILL_LLM` (mock|anthropic — defaults to the zero-key mock unless `ANTHROPIC_API_KEY` is set), `WILL_TICK_MS`, `WILL_PMA_PATH`.
|
|
148
|
+
|
|
149
|
+
### Employing MCP tools — the mind gets abilities
|
|
150
|
+
|
|
151
|
+
The other direction from hosting: any MCP server's tools can become the Will's own *abilities*. Each tool registers as a learnable affordance (its description is the ability's meaning, surfaced to the mind's deliberation), the **Will decides when to enact one** — nothing dispatches tools at it — and outcomes feed its reafference loop, so it gets *skilled* at the tools it uses. Arguments come from conscious intent: the executive supplies them in an action's `args`.
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
import { connectMcpEffectors } from '@mindot/will/mcp'
|
|
155
|
+
|
|
156
|
+
const { names } = await connectMcpEffectors(will, {
|
|
157
|
+
command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
|
|
158
|
+
})
|
|
159
|
+
// the Will can now choose to read/write files — when IT wants to
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The hosted server composes with this: set `WILL_MCP_SERVERS` (a JSON array of `{command,args}` or `{url}` entries) and the mind you host in Claude Desktop itself employs those servers' tools.
|
|
163
|
+
|
|
164
|
+
### The HTTP sidecar — `will serve` (any language, or Docker)
|
|
165
|
+
|
|
166
|
+
Not on Node? Host the mind as a sidecar and speak to it over HTTP from Python, Go, a game server — anything:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npx -y @mindot/will serve # http://127.0.0.1:7777, or: docker build -t will . && docker run -p 7777:7777 -v will-data:/data will
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
curl -X POST localhost:7777/perceive -H 'content-type: application/json' \
|
|
174
|
+
-d '{"text":"Hello there.","from":"sam","speaker":"Sam"}' # 202 — delivered, not answered
|
|
175
|
+
curl 'localhost:7777/next-utterance?within_ms=8000&from=sam' # its next words, or {"silence":true}
|
|
176
|
+
curl localhost:7777/state # its inner life
|
|
177
|
+
curl -N localhost:7777/utterances # SSE: utterance / emotion / action projections
|
|
178
|
+
curl -X POST localhost:7777/save # checkpoint without stopping
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Same paradigm, same env config, same persistence as the MCP host: the mind hibernates to its PMA artifact on shutdown and wakes as the same self on the next start (in Docker, mount `/data` to keep it across container restarts). There is deliberately no `/ask` route.
|
|
182
|
+
|
|
117
183
|
### The `WillStem` contract — full control
|
|
118
184
|
|
|
119
185
|
The lower-level engine surface the facade wraps (explicit tick listeners, the outbox drain, the effector ack loop, PMA distill/load) — for hosts that manage many Wills, custom transports, or replay. The rest of this section walks it end to end.
|
|
@@ -677,7 +743,7 @@ src/
|
|
|
677
743
|
bun run build # tsup → dist/index.js + dist/index.d.ts
|
|
678
744
|
bun run dev:build # tsup --watch (auto-rebuilds on save)
|
|
679
745
|
bun run typecheck # tsc --noEmit
|
|
680
|
-
bun test # unit tests (Vitest
|
|
746
|
+
bun test # unit tests (Bun runner — what CI runs); `bun run test` = Vitest
|
|
681
747
|
```
|
|
682
748
|
|
|
683
749
|
The build uses [tsup](https://tsup.egoist.dev) (esbuild). All `#`-prefixed internal path aliases (`#core`, `#cognition`, `#stem`, …) are resolved at build time. The LLM and vector layers are in-house — no Mastra / ai-sdk runtime dependency.
|
|
@@ -738,8 +804,9 @@ The provider layer is an in-house `fetch` client (`src/llm/index.ts`) with a glo
|
|
|
738
804
|
```bash
|
|
739
805
|
bun dev # Start the standalone runner (hot-reloads via Bun)
|
|
740
806
|
bun run typecheck # tsc --noEmit
|
|
741
|
-
bun test # Unit tests (
|
|
742
|
-
bun test
|
|
807
|
+
bun test # Unit tests (Bun runner — what CI runs)
|
|
808
|
+
bun run test # Same suite under Vitest
|
|
809
|
+
bun test:watch # Watch mode (Vitest)
|
|
743
810
|
```
|
|
744
811
|
|
|
745
812
|
Debug prompts are written to `data/wills/<id>/debug/` on every executive call — inspect the full prompt + raw LLM output at each tick.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|