Commit Graph

204 Commits

Author SHA1 Message Date
xiaomo ee439c09e5 feat(pulse): add SQLite storage layer + built-in rules
- store.ts: SQLite-backed tick/event history with better-sqlite3
  - PulseStore API: recordTick, recordEvent, getRecentTicks, getEventsByTick, getRecentErrors
  - ULID generation (no external dep)
  - Snapshot file storage (saveSnapshot/loadSnapshot)
- rules.ts: built-in rule primitives
  - clampTick: frequency bounds
  - errorBackoff: exponential backoff from error count
  - adaptiveInterval: speed up on change, slow down on idle
  - dedup: deduplicate effects by kind/custom key
- Full test coverage (33 tests, all passing)
- Re-export from index.ts
2026-04-14 04:12:40 +00:00
xiaomo aae75423e8 refactor: simplify runtime — remove onError/onTick, all behavior via Rules
- Runtime is now truly ten lines of logic
- Removed onError callback (collect errors handled by runtime catch, effect/rule errors should be Rules)
- Removed onTick diagnostic callback (use Rule for logging)
- Updated JSDoc: Rule as 'context-dependent modifier', composition as 'fold'
- 7/7 tests still passing
2026-04-14 04:03:51 +00:00
xiaomo d517c22e92 docs: README 重写 — Rule 签名作为核心 2026-04-14 02:48:33 +00:00
xiaomo 590facb45c 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
2026-04-14 02:44:17 +00:00