Commit Graph

16 Commits

Author SHA1 Message Date
xiaoju b269f76b33 refactor(daemon): rename reflex-scheduler → sense-scheduler
Rename ReflexScheduler to SenseScheduler, update all file names,
imports, comments, test descriptions, and log source values.

Fixes #202
2026-04-27 12:07:22 +00:00
xiaoju 852cad9c60 docs(rfc-001): archival watermark + workflow_runs materialized table
- Cold archival: meta table with archived_up_to watermark for crash-safe recovery
- Workflow state: workflow_runs materialized table (UPSERT in same txn as log write)
  - O(active) queries instead of full table scan
  - Derivable from logs if lost

小橘 <xiaoju@shazhou.work>
2026-04-22 08:15:28 +00:00
xiaoju f5c561173d docs(rfc-001): add Log concept, append-only storage architecture, workflow event sourcing
- §2.4: Log as data asset, not trigger source (anti-avalanche constraint)
- §3: Add Log to terminology table
- §5.4: New storage architecture section
  - Unified logs table (append-only SQLite)
  - Workflow state via event sourcing (no mutable tables)
  - Cold archival: >30d data exported to daily JSONL files
- §5.6: Error handling now writes logs instead of error signals
- §8: Directory structure updated with logs.db and archive/
- §10: Design principles updated (8 principles, +1 log rule)
- Thread outputs are now Logs, not Signals

小橘 <xiaoju@shazhou.work>
2026-04-22 08:06:09 +00:00
xiaoju 643c353cc3 feat(rfc-001): 回应小墨 review — runtime 注入 db/peers、migration rollback、drizzle config、schema 新鲜度 2026-04-22 05:54:56 +00:00
xiaoju 8a3937f0e1 feat(rfc-001): Drizzle 作为 Sense schema 标准工具链
- schema.ts 为 single source of truth,migration 由 drizzle-kit 自动生成
- Sense 目录结构从单文件改为目录(schema.ts + index.ts + migrations/)
- 设计理由:开发者是 Coding Agent,确定性工具链优于概率模型自律
- 更新 §4.1 存储设计、§8 目录结构

小橘 <xiaoju@shazhou.work>
2026-04-22 05:36:17 +00:00
xiaoju 8379dae585 fix(rfc-001): 解决小墨 review 的生产风险问题
- 删除 Guard 表达式(when),条件判断由 Workflow 自己处理
- Workflow queue 加 max_queue 上限(默认 100)
- compute 超时改为两级:soft timeout + grace_period hard kill
- 热更新加 drain_timeout,防止长 thread 阻塞 reload

小橘 <xiaoju@shazhou.work>
2026-04-22 05:12:58 +00:00
xiaoju 6e49deaf99 refactor(rfc-001): Reflex 作为 Event Mesh,Sense 不知道 Workflow
- 删除 Sense → Workflow 桥接(ThreadStart payload),Sense 只产出数据
- Reflex 新增两种 action:TriggerCompute / StartWorkflow
- 引入 Event Mesh 概念:所有事件路由声明在 Reflex 中
- 更新依赖图、Haskell 类型签名、设计原则
- 删除 should-cleanup sense(改由 Reflex when 守卫实现)

小橘 <xiaoju@shazhou.work>
2026-04-22 05:02:14 +00:00
xiaoju aba4580ff6 docs: polish RFC — fix Signal definition for Maybe, dedupe YAML config, merge §7 into §5, renumber 2026-04-22 04:28:41 +00:00
xiaoju 99d5549630 docs: unify compute return type to Maybe (T | null) 2026-04-22 04:25:51 +00:00
xiaoju f08f37e14e docs: clarify engine as kernel/event-hub, worker isolation, signal bus in-memory 2026-04-22 04:21:32 +00:00
xiaoju 96c740d175 docs: add §5 runtime model (process isolation, persistence, hot reload, error handling) 2026-04-22 03:39:29 +00:00
xiaoju aa5b0c6349 docs: workflow concurrency/overflow, signal-thread boundary
Signal only kicks off Thread. Thread has its own event loop.
Thread output signals are execution logs for retrospection only.

小橘 <xiaoju@shazhou.work>
2026-04-22 03:12:42 +00:00
xiaoju 162c50b326 docs: Event → Signal terminology, add senses config with throttle, update reflex semantics
- Signal replaces Event/Observation as the term for Sense output
- Senses config in nerve.yaml for runtime properties (throttle)
- ReflexCondition: OnInterval | OnSignal [SenseId]
- OnDemand is engine-builtin, not declared

小橘 <xiaoju@shazhou.work>
2026-04-22 02:56:28 +00:00
xiaoju b3beaf5e19 docs: add reflex semantics — interval origin, event compensation, idempotency
小橘 <xiaoju@shazhou.work>
2026-04-22 02:46:17 +00:00
xiaoju a1785cf36a fix: remove unused type parameter from Sense compute
小橘 <xiaoju@shazhou.work>
2026-04-22 02:40:02 +00:00
xiaoju ec25c993d0 docs: RFC-001 Observation Engine — Sense, Reflex, Workflow
小橘 <xiaoju@shazhou.work>
2026-04-22 02:37:49 +00:00