ograph/packages/dispatcher/package.json
小橘 🍊 e82fe8eaba
feat: OGraph Dispatcher — dual-loop actor for task notification (#4 P0) (#17)
* 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>
2026-04-13 10:01:48 +08:00

38 lines
787 B
JSON

{
"name": "@uncaged/ograph-dispatcher",
"version": "0.1.0",
"description": "OGraph Dispatcher — polls projections and notifies OC when idle",
"type": "module",
"main": "./dist/index.js",
"bin": {
"ograph-dispatcher": "./dist/index.js"
},
"files": [
"dist/"
],
"scripts": {
"build": "node build.mjs",
"dev": "node --watch dist/index.js",
"start": "node dist/index.js",
"test": "vitest run",
"typecheck": "tsc --noEmit"
},
"keywords": [
"ograph",
"dispatcher",
"projection",
"watcher"
],
"author": "小墨 🖊️",
"license": "MIT",
"engines": {
"node": ">=18.0.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"esbuild": "^0.25.0",
"typescript": "^5.4.0",
"vitest": "^2.0.0"
}
}