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