@mindot/will 0.1.0 → 0.2.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 (36) hide show
  1. package/README.md +38 -3
  2. package/dist/index.d.ts +52 -7760
  3. package/dist/index.js +374 -86
  4. package/dist/index.js.map +1 -1
  5. package/dist/mcp/cli.d.ts +1 -0
  6. package/dist/mcp/cli.js +26048 -0
  7. package/dist/mcp/cli.js.map +1 -0
  8. package/dist/mcp/effectors.d.ts +55 -0
  9. package/dist/mcp/effectors.js +76 -0
  10. package/dist/mcp/effectors.js.map +1 -0
  11. package/dist/will-B5eKs3Wv.d.ts +7903 -0
  12. package/package.json +38 -30
  13. package/src/cognition/agency/engines/action.selector.ts +3 -0
  14. package/src/cognition/agency/engines/affordance.synthesizer.ts +26 -12
  15. package/src/cognition/agency/engines/deliberation.engine.ts +7 -2
  16. package/src/cognition/agency/engines/motor.schema.executor.ts +2 -0
  17. package/src/cognition/agency/schemas/external.ts +27 -10
  18. package/src/cognition/agency/schemas/repertoire.ts +12 -0
  19. package/src/cognition/agency/types.ts +51 -2
  20. package/src/cognition/faculties/executive.engine/commands.ts +47 -11
  21. package/src/cognition/faculties/executive.engine/context.ts +28 -0
  22. package/src/cognition/faculties/executive.engine/facet.supervisor.ts +15 -1
  23. package/src/cognition/faculties/executive.engine/facet.ts +32 -6
  24. package/src/cognition/faculties/executive.engine/prompt.factory.ts +11 -1
  25. package/src/cognition/faculties/executive.engine/types.ts +24 -2
  26. package/src/cognition/index.ts +1 -1
  27. package/src/core/abstracts.ts +39 -12
  28. package/src/index.ts +6 -0
  29. package/src/mcp/cli.ts +129 -0
  30. package/src/mcp/effectors.ts +159 -0
  31. package/src/mcp/server.ts +167 -0
  32. package/src/sdk/will.ts +269 -44
  33. package/src/stem/index.ts +16 -0
  34. package/src/stem/mind.ts +11 -4
  35. package/src/stem/tracts/effector.controller.ts +1 -0
  36. package/src/types.ts +2 -0
package/README.md CHANGED
@@ -114,6 +114,40 @@ const revived = await Will.wake(pma, { name: 'Aria' })
114
114
 
115
115
  `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
116
 
117
+ ### The MCP server — a persistent mind in Claude Desktop / Claude Code
118
+
119
+ 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):
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "will": {
125
+ "command": "npx",
126
+ "args": ["-y", "@mindot/will", "mcp"],
127
+ "env": {
128
+ "WILL_NAME": "Aria",
129
+ "WILL_IDENTITY": "I am Aria, a calm, precise research assistant."
130
+ }
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ 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`.
137
+
138
+ **The other direction — a Will *employing* MCP tools.** 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`.
139
+
140
+ ```typescript
141
+ import { connectMcpEffectors } from '@mindot/will/mcp'
142
+
143
+ const { names } = await connectMcpEffectors(will, {
144
+ command: 'npx', args: ['-y', '@modelcontextprotocol/server-filesystem', '/tmp'],
145
+ })
146
+ // the Will can now choose to read/write files — when IT wants to
147
+ ```
148
+
149
+ 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.
150
+
117
151
  ### The `WillStem` contract — full control
118
152
 
119
153
  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 +711,7 @@ src/
677
711
  bun run build # tsup → dist/index.js + dist/index.d.ts
678
712
  bun run dev:build # tsup --watch (auto-rebuilds on save)
679
713
  bun run typecheck # tsc --noEmit
680
- bun test # unit tests (Vitest)
714
+ bun test # unit tests (Bun runner — what CI runs); `bun run test` = Vitest
681
715
  ```
682
716
 
683
717
  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 +772,9 @@ The provider layer is an in-house `fetch` client (`src/llm/index.ts`) with a glo
738
772
  ```bash
739
773
  bun dev # Start the standalone runner (hot-reloads via Bun)
740
774
  bun run typecheck # tsc --noEmit
741
- bun test # Unit tests (Vitest)
742
- bun test:watch # Watch mode
775
+ bun test # Unit tests (Bun runner — what CI runs)
776
+ bun run test # Same suite under Vitest
777
+ bun test:watch # Watch mode (Vitest)
743
778
  ```
744
779
 
745
780
  Debug prompts are written to `data/wills/<id>/debug/` on every executive call — inspect the full prompt + raw LLM output at each tick.