ShtukbaseStandard
包页面→ /automations.md

pages/automations.md

57 行, 2.2 KB. 以页面形式查看.

  1. ---
  2. type: Collection
  3. title: "自动化"
  4. icon: "⏰"
  5. description: "会自行发生的事:一个事件、对它的响应动作,以及每小时和每天的次数限制。"
  6. itemType: Automation
  7. items: {mode: path, path: /automations, recursive: false}
  8. writeTo: /automations
  9. properties:
  10. trigger: {kind: text, label: "何时(事件)"}
  11. reaction: {kind: text, label: "做什么"}
  12. limits: {kind: text, label: "限额"}
  13. mode:
  14. kind: select
  15. label: "模式"
  16. options:
  17. - {name: manual, label: "手动", color: gray}
  18. - {name: auto, label: "自动", color: green}
  19. node: {kind: text, label: "运行位置(机器)"}
  20. views:
  21. - id: automations--table
  22. name: "全部自动化"
  23. layout: table
  24. fields: {}
  25. sorting:
  26. - {propertyId: title, direction: ascending}
  27. properties:
  28. - {name: title, visible: true, width: 320}
  29. - {name: trigger, visible: true}
  30. - {name: mode, visible: true}
  31. - {name: node, visible: true}
  32. ---
  33. 自动化(automation)由一个事件及其反应组成:`trigger` 触发时,`reaction` 运行。它不是规范:规范规定必须具备什么,而自动化是在事件发生后达到该状态的一种方式。
  34. ```yaml
  35. trigger: {kind: clock, at: "03:00"} # 或 every: 15m、cron: "0 3 * * *"
  36. reaction: {action: /actions/nightly-check} # 或 {agent: /agents/worker}
  37. limits: {perHour: 1, perDay: 1}
  38. mode: manual # auto:由执行者运行
  39. ```
  40. 事件类型(`trigger.kind`):
  41. | 类型 | 还需提供 |
  42. |---|---|
  43. | `clock`(或 `schedule`) | `at`、`every` 或 `cron` |
  44. | `change` | `within`:要监视变化的文件夹 |
  45. | `phase` | `contour` 和 `phase`:某条记录进入了该阶段 |
  46. | `sensor` | `sensor`:传感器页面 |
  47. | `run-finished` | `automation`:哪个自动化的运行已结束 |
  48. | `manual`(或 `hand`) | 无:由人运行 |
  49. | `answer` | 无:人对运行中提问的回答 |
  50. `mode: manual` 是给人或智能体的指令:执行者不会自行运行它。`mode: auto` 由执行者(例如 Shtukbase 节点)自行运行,但频率不超过 `limits` 所允许的限额。
  51. 规范 [ACT-R02](/norms/rules/automations/ACT-R02.md) 保证自动化写明何时触发、做什么以及执行多少次。