feat(gateway): automation rule engine and reminder scheduler

- engine: 5-field cron parser (*/n, ranges, lists) firing at most once
  per minute; device-state triggers with edge detection; manual trigger
  via POST /automation/rules/:id/trigger; actions run through the AI
  pipeline so rules can call any tool (IoT control, search, ...)
- reminders: due-scan scheduler delivering via WebSocket broadcast,
  optional LLM-polished reminder text with plain-title fallback;
  Reminder gains Done flag with ListDue/MarkDone
- tests: cron matching and validation, once-per-minute dedup, device
  edge triggering, manual trigger, reminder delivery
This commit is contained in:
Aska committed 2026-08-21 12:54:11 +08:00
1 parent 9f30cdd086
commit d80710d85a
7 files changed
+679 -2

No files matched your search

+6
View File
@@ -86,6 +86,11 @@ type BridgeConfigManager interface {
DeleteAdapter(name string) error
}
// AutomationEngine fires automation rules immediately.
type AutomationEngine interface {
Trigger(ctx context.Context, id string) error
}
// ChatStorer persists chat sessions and messages.
type ChatStorer interface {
CreateSession(ctx context.Context, id, userID, title string) (*store.Session, error)
@@ -110,6 +115,7 @@ type Dependencies struct {
ChatStore ChatStorer
ModelConfig *ModelConfigStore
Automation *AutomationStore
AutomationEng AutomationEngine
Reminders *ReminderStore
PluginList []map[string]string
}