feat: @uncaged/pulse core engine — runPulse + Rule type + S combinator composition
- Moore machine model: Effects determined by state diff, not events - S combinator rule composition: pulse = S r3 . S r2 . S r1 $ dummy - createRule helper with accessor-based state adaptation - 7 tests passing (compose, async, adaptive tickMs, Moore property) Design: https://github.com/oc-xiaoju/ograph/issues/44
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# Design Document
|
||||
|
||||
See [RFC #44: Pulse — Agent 的自主神经系统](https://github.com/oc-xiaoju/ograph/issues/44)
|
||||
|
||||
## Summary
|
||||
|
||||
### Core Formula
|
||||
|
||||
```
|
||||
f(prevSnapshot, currSnapshot) → (Effect[], tickMs)
|
||||
```
|
||||
|
||||
### Key Properties
|
||||
|
||||
- **Moore Machine** — Effects determined by state, not events. Pulse polls projection values, not event streams.
|
||||
- **Path Dependent** — Sampling is lossy. A→B + B→C ≠ A→C at the effect level. Poll frequency = resolution of reality.
|
||||
- **S Combinator** — Single composition primitive. `pulse = S r3 . S r2 . S r1 $ dummy`
|
||||
- **Not Forced Pure** — Rules can be async/impure. Framework doesn't distinguish certain/uncertain.
|
||||
- **Agent Managed** — The rule repo is managed by the Agent. Types, rules, collectors, effectors — all TypeScript, all under `tsc` guard.
|
||||
- **Staging via git worktree** — Safe experimentation before promote to production.
|
||||
|
||||
### Packages
|
||||
|
||||
| Package | Purpose |
|
||||
|---------|---------|
|
||||
| `@uncaged/pulse` | Core engine: `runPulse()` + `Rule` type. Generic, zero deps. |
|
||||
| `@uncaged/upulse` | CLI: daemon lifecycle + test/staging/promote |
|
||||
| `@uncaged/pulse-rules` | Shared rule library (future) |
|
||||
Reference in New Issue
Block a user