dsh-miloco-bridge 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -10
- package/cordis.patch.yml +1 -3
- package/{doc → docs}/ARCHITECTURE.md +2 -2
- package/{doc → docs}/INSTALL.md +8 -5
- package/{doc → docs}/SKILL-REWRITES.md +3 -3
- package/{doc → docs}/TOOLS.md +13 -10
- package/{doc → docs}/VERIFICATION.md +22 -6
- package/docs/images/agent-presets.png +0 -0
- package/docs/images/miloco-settings.png +0 -0
- package/lib/client.js +672 -119
- package/lib/settings-api.js +86 -1
- package/lib/tools.js +307 -40
- package/package.json +2 -2
- package/skills/miloco-create-task/SKILL.md +63 -14
- package/doc/images/agent-presets.png +0 -0
- package/doc/images/miloco-settings.png +0 -0
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: miloco-create-task
|
|
3
|
-
description:
|
|
3
|
+
description: 把一句家庭需求装配成可长期运转的任务:先建任务占位行,再按需挂规则、定时提醒、累计统计或限时生命周期,并在创建后自检。适用于“每天提醒我…”“当…就…”“记录他每天…”“先试一周”。
|
|
4
4
|
whenToUse: 用户提出持续性的提醒、自动化、习惯记录或有时限的家庭任务时。
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# 创建家庭任务
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## 任务由多个构件组成
|
|
10
|
+
|
|
11
|
+
新版 Miloco 的 `POST /api/tasks` 只创建任务占位行(`task_id` + `description`),
|
|
12
|
+
规则、定时、统计都要另外挂到同一个 `task_id` 上。
|
|
10
13
|
|
|
11
14
|
| 构件 | 回答的问题 | 工具 |
|
|
12
15
|
|---|---|---|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
16
|
+
| task | 任务叫什么、活多久 | `miloco_task_create` |
|
|
17
|
+
| rule | 当 X 时做 Y | `miloco_rule_create` |
|
|
18
|
+
| schedule | 什么时候提醒 | `miloco_cron_create` |
|
|
19
|
+
| record | 累计什么、达到什么算完成 | `miloco_task_record_init` |
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
不要再用旧参数 `kind=rule/schedule/record` 调 `miloco_task_create`,后端不接受。
|
|
19
22
|
|
|
20
23
|
## 前置检查
|
|
21
24
|
|
|
@@ -24,19 +27,65 @@ whenToUse: 用户提出持续性的提醒、自动化、习惯记录或有时限
|
|
|
24
27
|
3. `miloco_task_list` + `miloco_rule_list` + `miloco_cron_list`:先查重,已有就调整而不是重复建。
|
|
25
28
|
4. `miloco_device_list` + `miloco_device_spec`:动作必须落到真实 did 与真实 iid。
|
|
26
29
|
|
|
27
|
-
##
|
|
30
|
+
## 装配顺序
|
|
31
|
+
|
|
32
|
+
### 1. 先建任务
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
miloco_task_create(
|
|
36
|
+
task_id="living_room_tidy", # 只能用小写字母、数字、下划线,≤32 位
|
|
37
|
+
description="整理客厅杂物,保持通道畅通" # ≤200 字
|
|
38
|
+
)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
限时任务再加 `lifecycle="temporary"` 与带时区的 `expires_at`。
|
|
42
|
+
|
|
43
|
+
### 2. 按需挂构件
|
|
44
|
+
|
|
45
|
+
**定时提醒**:`miloco_cron_create` 必须带 `task_id`。
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
miloco_cron_create(
|
|
49
|
+
name="每天整理客厅",
|
|
50
|
+
kind="cron",
|
|
51
|
+
cron_expr="0 20 * * *",
|
|
52
|
+
message="花十分钟整理客厅茶几和沙发旁的杂物",
|
|
53
|
+
task_id="living_room_tidy"
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**条件规则**:`miloco_rule_create` 的 `condition` 必须给感知设备 did 列表和自然语言条件;
|
|
58
|
+
`event` 模式用 `actions`(设备直控)或 `action_descriptions`(Agent 回调)。
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
miloco_rule_create(
|
|
62
|
+
name="客厅有人开灯",
|
|
63
|
+
task_id="living_room_presence",
|
|
64
|
+
condition={ perceive_device_ids=["camera_did"], query="客厅有人活动" },
|
|
65
|
+
mode="event",
|
|
66
|
+
actions=[{ did="light_did", iid="prop.2.1", value=true }]
|
|
67
|
+
)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**累计统计**:`miloco_task_record_init` 的 `kind` 只能是 `progress / duration / event`。
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
miloco_task_record_init(
|
|
74
|
+
task_id="drink_water",
|
|
75
|
+
kind="progress",
|
|
76
|
+
content={ target=8, unit="杯", window="day" }
|
|
77
|
+
)
|
|
78
|
+
```
|
|
28
79
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
4. **lifecycle**:`miloco_task_create(kind="lifecycle", content=…)`,写明开始/结束条件或期限。
|
|
33
|
-
5. 用 `task_id` 把 schedule 关联到长期任务。
|
|
80
|
+
- `progress`:`target`、`unit`、`window`(`day/week/month/longterm`)必填
|
|
81
|
+
- `duration`:`target_minutes` 可选
|
|
82
|
+
- `event`:`content` 可为空
|
|
34
83
|
|
|
35
84
|
## 自检
|
|
36
85
|
|
|
37
86
|
创建后重新读取:
|
|
38
87
|
|
|
39
|
-
- `
|
|
88
|
+
- `miloco_task_list` / `miloco_rule_list` / `miloco_cron_list`
|
|
40
89
|
- 确认名称、触发条件、动作、启用状态、关联 task_id 都符合预期
|
|
41
90
|
- 失败时报告后端原文,不要声称“已创建”
|
|
42
91
|
|
|
Binary file
|
|
Binary file
|