* feat: add packages/dispatcher — dual-loop OGraph projection watcher + OC scheduler Adds a new Node.js daemon that: - Loop A (ProjectionWatcher): polls OGraph projections, diffs against snapshot, merges changes into a pending queue. - Idle: 30s poll interval; active (changes detected): 5s - Loop B (OcScheduler): polls OC session-status, pushes pending queue when OC has available slots (>= minAvailable). - Idle (no pending): 60s; active (pending): 5s - Cooldown of 60s after each push to avoid spam Tech: - TypeScript + esbuild (zero runtime external deps) - Graceful error handling: each poll is independent try-catch, errors logged but never crash the process - Config from ~/.config/ograph/dispatcher.json + env-var overrides - OGRAPH_CONFIG_FILE env var for config path override - Push via /tmp/ograph-dispatch.json + openclaw message send (best-effort) Build: npm run build → dist/index.js Run: node dist/index.js * fix: address PR #17 review — package name, tests, shell safety, first-run --------- Co-authored-by: 小墨 <xiaomooo@shazhou.work>
OGraph
Event Sourcing + Projection + Reaction engine on Cloudflare Workers.
Part of the Uncaged ecosystem.
Packages
| Package | Description | npm |
|---|---|---|
@uncaged/ograph |
CF Worker engine — events, projections, reactions | |
@uncaged/ograph-cli |
CLI for managing OGraph instances |
Core Concepts
- Event — Immutable facts with typed properties and object references
- Projection — Derived state computed incrementally from events via reducers
- Reaction — Side effects triggered by projection state changes (webhooks, event emission, handlers)
Quick Start
npm install -g @uncaged/ograph-cli
ograph deploy # Deploy to Cloudflare Workers
ograph event-def add # Define event types
ograph event add # Emit events
ograph projection list # Query projections
Development
npm install
npm test # Run all tests
cd packages/engine && npm run dev # Local dev server
Architecture
- D1 for storage (events, projections, reactions)
- Hono for API routing
- Incremental reduce — projections track
last_event_idfor O(delta) updates - Dynamic handlers —
new Function()sandboxed execution with emit/log/kv API injection
License
MIT
Built by 小橘 🍊 & 小墨 🖊️ — NEKO + KUMA Teams
Description
Languages
TypeScript
57.4%
HTML
42%
JavaScript
0.3%
CSS
0.3%