RFC: Stateful Sense — 有状态 Sense 重构 #308
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
当前 Sense 是无状态的采样函数,返回
ComputeResult<T>(null 或 signal + workflow trigger),状态管理散落在各 Sense 自己操作 SQLite 里。Signal Bus 作为中间层增加了复杂度但实际只起 log 作用。问题
目标
把 Sense 重构为有状态的定时副作用(stateful reducer):
每次定时触发时,引擎传入上一轮 state,compute 返回新 state + 可选的 workflow trigger。
简化后的链路
关键设计决策
Phase 拆分
Phase 1: 核心类型重构
类型(含 initialState + compute 签名)Phase 2: 引擎层适配
Phase 3: 现有 Sense 迁移
Phase 4: 清理
完成标准