dsh-miloco-bridge 0.1.5 → 0.1.6
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 +17 -6
- package/docs/ARCHITECTURE.md +23 -1
- package/docs/INSTALL.md +10 -4
- package/docs/VERIFICATION.md +23 -5
- package/docs/images/miloco-overview.png +0 -0
- package/docs/images/miloco-settings.png +0 -0
- package/docs/images/miloco-setup.png +0 -0
- package/lib/client.js +436 -29
- package/lib/miloco-client.js +13 -5
- package/lib/settings-api.js +136 -1
- package/lib/tools.js +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
## 截图
|
|
13
13
|
|
|
14
|
-
| Agent 预设 | 家庭概览页 | Miloco 配置 |
|
|
15
|
-
|
|
16
|
-
|  |  |  |
|
|
14
|
+
| Agent 预设 | 家庭概览页 | 初始化页 | Miloco 配置 |
|
|
15
|
+
|---|---|---|---|
|
|
16
|
+
|  |  |  |  |
|
|
17
17
|
|
|
18
18
|
> 截图使用演示数据;真实账号、内网地址与 token 用量已脱敏。
|
|
19
|
+
> 初始化页是「还没连上 Miloco」或「连上了但还没绑定米家账号」时看到的独立引导页,
|
|
20
|
+
> 与配好之后的家庭概览不是同一套版式。
|
|
19
21
|
|
|
20
22
|
## 它解决什么问题
|
|
21
23
|
|
|
@@ -25,6 +27,9 @@
|
|
|
25
27
|
- **推送闭环**:Miloco 的感知事件、规则触发、任务到期可以主动推送到 DSH 会话。
|
|
26
28
|
- **家庭概览**:侧栏「Miloco 家庭助手」打开家庭概览(账号、设备、摄像头、规则/任务、
|
|
27
29
|
感知与 token 用量)、设备/房间、最近事件、推送记录与连接状态。
|
|
30
|
+
- **初始化引导**:没连上 Miloco、或连上了但还没绑定米家账号时,页面是一张独立的
|
|
31
|
+
居中引导页(三步清单 + 绑定入口),不是配好之后的仪表盘;
|
|
32
|
+
绑定可以直接跳到 Miloco 自己的页面,也可以在本页粘贴小米回调页的授权内容完成。
|
|
28
33
|
- **家庭工作区**:家庭工作区默认置顶显示,可在配置里修改目录、被误删后 30 秒内自动恢复;
|
|
29
34
|
关闭「启用置顶工作区」后不再注册工作区,其中的会话归到「未分组」。
|
|
30
35
|
- **推送归档**:推送默认进入专用归档会话 `miloco-archive`,也可在配置里改为任意指定会话;
|
|
@@ -54,7 +59,7 @@ dsh plugin --profile web add github:exa160/dsh-miloco-bridge
|
|
|
54
59
|
|
|
55
60
|
```bash
|
|
56
61
|
# 发布包
|
|
57
|
-
dsh plugin --profile web add file:dist/dsh-miloco-bridge-0.1.
|
|
62
|
+
dsh plugin --profile web add file:dist/dsh-miloco-bridge-0.1.6.tgz
|
|
58
63
|
|
|
59
64
|
# 本地开发(link)
|
|
60
65
|
./install.sh --profile web
|
|
@@ -73,12 +78,16 @@ systemctl --user restart dsh-web.service
|
|
|
73
78
|
|
|
74
79
|
## 快速开始
|
|
75
80
|
|
|
76
|
-
1. 打开 DSH WebUI → 侧栏「Miloco
|
|
81
|
+
1. 打开 DSH WebUI → 侧栏「Miloco 家庭助手」。
|
|
82
|
+
- 还没配置时看到的是初始化页:按三步走(部署或连接 Miloco → 绑定米家账号 → 启用推送)。
|
|
83
|
+
- 点「开始配置」可打开配置弹窗;点「在 Miloco 中绑定 ↗」直接去 Miloco 自己的页面绑定账号。
|
|
77
84
|
2. 没有 Miloco:点「一键部署 Miloco」;已有实例:点「连接已有的 Miloco」。
|
|
78
85
|
3. 新建会话时选择 **「Miloco 家庭助手」**,或用概览页的「新建家庭会话」。
|
|
79
86
|
4. 在配置弹窗里选择运行模式(只读 / 管家)、推送会话、可选模型与感知等级,并可修改家庭工作区目录。
|
|
80
87
|
5. 想收 Miloco 主动推送时,确认 Miloco 的 `agent.platform=dsh`,并使用同一枚 Bearer token。
|
|
81
88
|
|
|
89
|
+
> 隐私:插件只与本机 Miloco 通信,不上传账号、令牌或家庭数据;绑定建议优先用 Miloco 自己的流程。
|
|
90
|
+
|
|
82
91
|
## 权限与风险
|
|
83
92
|
|
|
84
93
|
- 写入 `$DSH_HOME`(配置、状态、可选部署源码)和 `$MILOCO_HOME`(adapter)。
|
|
@@ -86,6 +95,8 @@ systemctl --user restart dsh-web.service
|
|
|
86
95
|
- 「一键部署」会运行上游 Miloco 安装器,可能安装 Python 依赖并占用磁盘。
|
|
87
96
|
- **默认只读**:写工具不注册;切换到管家模式后才会暴露设备控制、规则/任务创建等能力。
|
|
88
97
|
- 插件不包含遥测,不内置任何账号或 token;推送入口无令牌时 fail closed。
|
|
98
|
+
- 绑定米家账号时,插件只把一次性授权码转交给本机 Miloco:不落日志、不回显浏览器,
|
|
99
|
+
也不会把账号、令牌或家庭数据上传到任何第三方。
|
|
89
100
|
|
|
90
101
|
## 兼容性
|
|
91
102
|
|
|
@@ -108,7 +119,7 @@ systemctl --user restart dsh-web.service
|
|
|
108
119
|
## 开发
|
|
109
120
|
|
|
110
121
|
```bash
|
|
111
|
-
npm test #
|
|
122
|
+
npm test # 157 项测试
|
|
112
123
|
npm run selftest # 离线自检
|
|
113
124
|
npm run verify:readonly # 真实 Miloco 只读接口
|
|
114
125
|
npm run pack:bundle # 生成 dist/*.tgz
|
package/docs/ARCHITECTURE.md
CHANGED
|
@@ -98,6 +98,26 @@ adapter/dsh_adapter.py Miloco 侧 agent_platform adapter
|
|
|
98
98
|
(账号、设备、摄像头、规则/任务、感知源、token 用量)、设备与房间分组、最近事件、
|
|
99
99
|
最近推送记录、归档会话是否存在。每个远端接口独立结算,单个接口不可达不会涂黑整页。
|
|
100
100
|
|
|
101
|
+
`/home/overview` 另带一个 `setup` 段,描述“装好没有”:连接是否可达、账号是否绑定、
|
|
102
|
+
推送令牌是否就绪、Miloco 自己的页面地址。页面按它分成四种互斥形态:
|
|
103
|
+
|
|
104
|
+
| 形态 | 触发条件 | 版式 |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| 加载中 | 还没有第一次响应 | 整页居中的转圈提示(不渲染仪表盘头部) |
|
|
107
|
+
| 读取失败 | 整个请求失败 | 整页居中的错误说明 + 「重试」/「打开配置」 |
|
|
108
|
+
| 初始化 | 连不上 Miloco,或连上了但账号未绑定 | 整页居中的三步清单 + 绑定入口 |
|
|
109
|
+
| 仪表盘 | 连得上且账号已绑定 | 家庭概览、设备房间、事件与推送 |
|
|
110
|
+
|
|
111
|
+
未配置与已配置**不共用一套版式**:没有账号时仪表盘本来就是空的,不如给一页独立的
|
|
112
|
+
初始化引导。绑定账号有两条路,按推荐顺序排:
|
|
113
|
+
|
|
114
|
+
1. 「在 Miloco 中绑定 ↗」——打开 Miloco 自己的页面,用它现成的绑定向导(推荐);
|
|
115
|
+
2. 「在本页绑定」——插件代走一遍:`POST /miot/bind` 拿小米授权链接,用户在小米页
|
|
116
|
+
授权后把回调页给出的整段内容粘回来,插件解出 `code`/`state` 再交给 Miloco。
|
|
117
|
+
|
|
118
|
+
插件只与本机 Miloco 通信,不上传账号、令牌或家庭数据;授权码是一次性凭据,
|
|
119
|
+
只转发给 Miloco,不落日志、不回显给浏览器。
|
|
120
|
+
|
|
101
121
|
## 5. 设置 API
|
|
102
122
|
|
|
103
123
|
前缀:`/dsh-miloco-bridge/api`
|
|
@@ -113,7 +133,9 @@ adapter/dsh_adapter.py Miloco 侧 agent_platform adapter
|
|
|
113
133
|
| POST | `/connect` | 写连接与推送令牌,立即生效 |
|
|
114
134
|
| GET | `/home` | 家庭工作区快照(路径、标题、dirSource、归档会话 id、enabled) |
|
|
115
135
|
| POST | `/home` | 修改家庭工作区目录或置顶开关(写 overlay,注册/注销工作区) |
|
|
116
|
-
| GET | `/home/overview` |
|
|
136
|
+
| GET | `/home/overview` | 家庭概览聚合(状态、版本、概览统计、设备、事件、推送记录)+ `setup` 段(连接/账号/推送是否就绪) |
|
|
137
|
+
| POST | `/miot/bind` | 取小米授权链接(`{oauthUrl, state}`),供初始化页绑定账号 |
|
|
138
|
+
| POST | `/miot/authorize` | 提交回调页给出的授权内容,解出 `code`/`state` 交给 Miloco 完成绑定 |
|
|
117
139
|
|
|
118
140
|
写操作要求同源;令牌不会回显给浏览器。
|
|
119
141
|
|
package/docs/INSTALL.md
CHANGED
|
@@ -33,14 +33,14 @@ npm 新包可能处于审核期;若 `dsh plugin add dsh-miloco-bridge` 暂时
|
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
35
|
npm run pack:bundle
|
|
36
|
-
# dist/dsh-miloco-bridge-0.1.
|
|
37
|
-
dsh plugin --profile web add "file:/path/to/dist/dsh-miloco-bridge-0.1.
|
|
36
|
+
# dist/dsh-miloco-bridge-0.1.6.tgz
|
|
37
|
+
dsh plugin --profile web add "file:/path/to/dist/dsh-miloco-bridge-0.1.6.tgz"
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
或:
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
./install.sh --profile web --bundle dist/dsh-miloco-bridge-0.1.
|
|
43
|
+
./install.sh --profile web --bundle dist/dsh-miloco-bridge-0.1.6.tgz
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
### 1.3 手动配置
|
|
@@ -103,6 +103,12 @@ install.sh
|
|
|
103
103
|
- 安装本插件的 adapter,生成/复用推送令牌,写入 overlay。
|
|
104
104
|
5. 部署完成后按面板提示绑定米家账号、开启摄像头感知。
|
|
105
105
|
|
|
106
|
+
> 部署期间侧栏「Miloco 家庭助手」页面显示的是**初始化引导页**(不是家庭概览):
|
|
107
|
+
> 它会列出「部署或连接 Miloco / 绑定米家账号 / 接收 Miloco 推送」三步的完成状态,
|
|
108
|
+
> 账号没绑时页面上直接给出绑定入口——「在 Miloco 中绑定 ↗」跳到 Miloco 自己的页面,
|
|
109
|
+
> 或「在本页绑定」粘贴小米回调页给出的授权内容。
|
|
110
|
+
> 详见 [VERIFICATION.md](VERIFICATION.md#25-绑定米家账号可选路径)。
|
|
111
|
+
|
|
106
112
|
> **MILOCO_HOME 必须可写**:默认 `~/.miloco`,部署前会显式检查并给出中文错误。
|
|
107
113
|
> release 部署不再创建源码目录;`deploy.sourceDir` 仅用于旧源码部署或卸载清理。
|
|
108
114
|
|
|
@@ -283,7 +289,7 @@ systemctl --user restart dsh-web.service
|
|
|
283
289
|
|
|
284
290
|
```bash
|
|
285
291
|
npm run pack:bundle
|
|
286
|
-
dsh plugin --profile web add "file:dist/dsh-miloco-bridge-0.1.
|
|
292
|
+
dsh plugin --profile web add "file:dist/dsh-miloco-bridge-0.1.6.tgz"
|
|
287
293
|
systemctl --user restart dsh-web.service
|
|
288
294
|
```
|
|
289
295
|
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -116,8 +116,14 @@ curl -s -X POST http://127.0.0.1:3086/miloco/webhook \
|
|
|
116
116
|
### 2.4 浏览器 UI
|
|
117
117
|
|
|
118
118
|
1. 打开日志里的 `http://127.0.0.1:3086/?token=…`;
|
|
119
|
-
2. 侧栏 **Miloco
|
|
120
|
-
|
|
119
|
+
2. 侧栏 **Miloco 家庭助手**。页面按当前状态给四种互斥的形态:
|
|
120
|
+
- **加载中**:整页居中的转圈提示,没有仪表盘头部(不会看到悬在顶上的「新建家庭会话 / 配置」);
|
|
121
|
+
- **读取失败**:整页居中的错误说明,带「重试」与「打开配置」;
|
|
122
|
+
- **初始化页**:连不上 Miloco、或连上了但账号未绑定时出现——三步清单
|
|
123
|
+
(部署或连接 Miloco / 绑定米家账号 / 接收 Miloco 推送),带完成状态,
|
|
124
|
+
并提供「在 Miloco 中绑定 ↗」与「在本页绑定」两个入口,底部是隐私说明;
|
|
125
|
+
- **家庭概览**:连得上且账号已绑定时的仪表盘。
|
|
126
|
+
3. 点右上角「配置」,应看到:
|
|
121
127
|
- 第一格:运行状态,后端地址是可点击链接,含「卸载 Miloco」入口;
|
|
122
128
|
- 家庭工作区:目录输入框 +「启用置顶工作区」开关(默认开启;关闭后家庭会话归到「未分组」);
|
|
123
129
|
- 家庭概览(账号、设备、摄像头、规则/任务、感知、token)在侧栏「Miloco 家庭助手」页面上;
|
|
@@ -126,7 +132,19 @@ curl -s -X POST http://127.0.0.1:3086/miloco/webhook \
|
|
|
126
132
|
- 推送目标:会话输入框(可下拉)、模型下拉只有「跟随该对话自己选的模型」;
|
|
127
133
|
- 推理强度只在所选模型确实提供 efforts 时显示;没有选项时整行隐藏;
|
|
128
134
|
- 「感知等级」可选择全部 / 低及以上 / 中及以上 / 仅高优先级;
|
|
129
|
-
4.
|
|
135
|
+
4. 窄窗口下标题「家庭助手」与「新建家庭会话 / 配置」仍在同一行(标题先让位,不会换行);
|
|
136
|
+
5. 新建会话的预设菜单里应出现 **Miloco 家庭助手**。
|
|
137
|
+
|
|
138
|
+
### 2.5 绑定米家账号(可选路径)
|
|
139
|
+
|
|
140
|
+
初始化页的「在本页绑定」走的是 Miloco 自己的三步 OAuth:
|
|
141
|
+
|
|
142
|
+
1. `POST /dsh-miloco-bridge/api/miot/bind` → 返回 `{ oauthUrl, state }`;
|
|
143
|
+
2. 浏览器打开 `oauthUrl`,在小米页授权后,回调页会给出整段 base64 内容;
|
|
144
|
+
3. 粘贴回页面 → `POST /dsh-miloco-bridge/api/miot/authorize`(插件解出 `code`/`state` 转发给 Miloco)。
|
|
145
|
+
|
|
146
|
+
验证点:授权链接能打开;粘贴非法内容时接口返回 400 且不向 Miloco 转发;
|
|
147
|
+
非法授权码返回 Miloco 的错误信息;授权码不落日志、不回显浏览器。
|
|
130
148
|
|
|
131
149
|
本次实现已按上述步骤实测通过(DSH `0.2.2-rc.5`)。
|
|
132
150
|
|
|
@@ -231,7 +249,7 @@ dsh-miloco-bridge: push delivery failed ... # 仅在失败时
|
|
|
231
249
|
|
|
232
250
|
```bash
|
|
233
251
|
npm run pack:bundle
|
|
234
|
-
tar -tzf dist/dsh-miloco-bridge-0.1.
|
|
252
|
+
tar -tzf dist/dsh-miloco-bridge-0.1.6.tgz | head -30
|
|
235
253
|
```
|
|
236
254
|
|
|
237
255
|
预期包含:`package/lib/*`、`package/skills/*/SKILL.md`、`package/adapter/dsh_adapter.py`、
|
|
@@ -241,7 +259,7 @@ tar -tzf dist/dsh-miloco-bridge-0.1.5.tgz | head -30
|
|
|
241
259
|
|
|
242
260
|
```bash
|
|
243
261
|
DSH_HOME=/tmp/dsh-miloco-bundle-verify \
|
|
244
|
-
dsh plugin --profile web add "file:$PWD/dist/dsh-miloco-bridge-0.1.
|
|
262
|
+
dsh plugin --profile web add "file:$PWD/dist/dsh-miloco-bridge-0.1.6.tgz"
|
|
245
263
|
```
|
|
246
264
|
|
|
247
265
|
---
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -260,11 +260,17 @@ window.__ModuleLoader__.load({
|
|
|
260
260
|
scrolls itself instead of growing past the viewport. */
|
|
261
261
|
max-height: 100%; overflow-y: auto; overscroll-behavior: contain;
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
.dsh-miloco-dash-
|
|
266
|
-
.dsh-miloco-dash-
|
|
263
|
+
/* The header keeps the title and its two actions on one line, however narrow
|
|
264
|
+
the panel gets: the title gives up space first, the actions never wrap. */
|
|
265
|
+
.dsh-miloco-dash-head { display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
|
|
266
|
+
.dsh-miloco-dash-head-main { flex: 1 1 auto; min-width: 0; }
|
|
267
|
+
.dsh-miloco-dash-title {
|
|
268
|
+
font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: .01em;
|
|
269
|
+
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
|
|
270
|
+
}
|
|
271
|
+
.dsh-miloco-dash-actions { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
|
|
267
272
|
.dsh-miloco-dash-actions button {
|
|
273
|
+
white-space: nowrap; flex: none;
|
|
268
274
|
height: 30px; padding: 0 13px; border-radius: var(--dsw-radius-md, 8px);
|
|
269
275
|
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
270
276
|
background: transparent; color: inherit; font: inherit; font-size: 12.5px; cursor: pointer;
|
|
@@ -361,13 +367,18 @@ window.__ModuleLoader__.load({
|
|
|
361
367
|
padding: 24px; background: rgba(0, 0, 0, .38);
|
|
362
368
|
}
|
|
363
369
|
.dsh-miloco-dash-config {
|
|
364
|
-
|
|
370
|
+
display: flex; flex-direction: column;
|
|
371
|
+
width: min(920px, 94vw); max-height: 88vh; overflow: hidden; border-radius: 14px;
|
|
365
372
|
border: .5px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
366
373
|
background: var(--dsw-alias-bg-module-platform, var(--dsw-alias-bg-l1, #fff));
|
|
367
374
|
box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
|
|
368
375
|
}
|
|
376
|
+
.dsh-miloco-dash-config-body {
|
|
377
|
+
flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
|
|
378
|
+
}
|
|
369
379
|
.dsh-miloco-dash-config-head {
|
|
370
|
-
position: sticky; top: 0; z-index: 1;
|
|
380
|
+
position: sticky; top: 0; z-index: 1; flex: none;
|
|
381
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
371
382
|
gap: 12px; padding: 12px 18px; border-bottom: .5px solid var(--dsw-alias-border-l1, rgba(128,128,128,.14));
|
|
372
383
|
background: inherit;
|
|
373
384
|
}
|
|
@@ -377,9 +388,125 @@ window.__ModuleLoader__.load({
|
|
|
377
388
|
font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer;
|
|
378
389
|
}
|
|
379
390
|
@media (hover: hover) { .dsh-miloco-dash-config-close:hover { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.12)); } }
|
|
380
|
-
.dsh-miloco-dash-config > .dsh-miloco-bridge-settings { max-width: none; padding: 16px 18px 22px; }
|
|
391
|
+
.dsh-miloco-dash-config-body > .dsh-miloco-bridge-settings { max-width: none; padding: 16px 18px 22px; }
|
|
381
392
|
.dsh-miloco-dash-empty { padding: 18px 2px 20px; color: var(--dsw-alias-label-tertiary, rgba(128,128,128,.72)); font-size: 12.5px; }
|
|
382
393
|
.dsh-miloco-dash-loading { padding: 28px 2px; color: var(--dsw-alias-label-tertiary, rgba(128,128,128,.72)); font-size: 12.5px; }
|
|
394
|
+
|
|
395
|
+
/* ---- 独立状态页:加载中 / 未配置 / 读取失败(整页居中,不复用仪表盘布局) ---- */
|
|
396
|
+
.dsh-miloco-dash-state {
|
|
397
|
+
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
398
|
+
gap: 14px; min-height: 100%; max-height: 100%; box-sizing: border-box;
|
|
399
|
+
overflow-y: auto; overscroll-behavior: contain;
|
|
400
|
+
padding: 40px 24px 48px;
|
|
401
|
+
color: var(--dsw-alias-label-primary, inherit); text-align: center;
|
|
402
|
+
font-size: var(--dsh-content-font-size-secondary, 13px); line-height: 1.6;
|
|
403
|
+
}
|
|
404
|
+
.dsh-miloco-dash-state-card {
|
|
405
|
+
width: min(520px, 100%); padding: 26px 26px 24px; border-radius: 16px;
|
|
406
|
+
border: .5px solid var(--dsw-alias-border-l1, rgba(128,128,128,.14));
|
|
407
|
+
background: var(--dsw-alias-bg-l1, rgba(128,128,128,.02));
|
|
408
|
+
}
|
|
409
|
+
.dsh-miloco-dash-state-mark {
|
|
410
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
411
|
+
width: 44px; height: 44px; margin-bottom: 14px; border-radius: 14px;
|
|
412
|
+
border: .5px solid var(--dsw-alias-border-l1, rgba(128,128,128,.14));
|
|
413
|
+
background: var(--dsw-alias-bg-l2, rgba(128,128,128,.05));
|
|
414
|
+
color: var(--dsw-alias-label-secondary, rgba(128,128,128,.95));
|
|
415
|
+
}
|
|
416
|
+
.dsh-miloco-dash-state-title { font-size: 18px; font-weight: 600; line-height: 26px; }
|
|
417
|
+
.dsh-miloco-dash-state-sub {
|
|
418
|
+
margin-top: 8px; color: var(--dsw-alias-label-secondary, rgba(128,128,128,.95));
|
|
419
|
+
font-size: 13px; line-height: 1.75;
|
|
420
|
+
}
|
|
421
|
+
.dsh-miloco-dash-state-error {
|
|
422
|
+
margin-top: 8px; color: var(--dsw-alias-state-error-primary, #c85a50);
|
|
423
|
+
font-size: 12.5px; line-height: 1.7; overflow-wrap: anywhere;
|
|
424
|
+
}
|
|
425
|
+
.dsh-miloco-dash-steps {
|
|
426
|
+
list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px;
|
|
427
|
+
text-align: left;
|
|
428
|
+
}
|
|
429
|
+
.dsh-miloco-dash-step { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
|
|
430
|
+
.dsh-miloco-dash-step-mark {
|
|
431
|
+
flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
|
|
432
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
433
|
+
border: .5px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
434
|
+
font-size: 11px; line-height: 1; color: var(--dsw-alias-label-tertiary, rgba(128,128,128,.72));
|
|
435
|
+
}
|
|
436
|
+
.dsh-miloco-dash-step.done .dsh-miloco-dash-step-mark {
|
|
437
|
+
border-color: var(--dsw-alias-state-success-primary, #3c9a5a);
|
|
438
|
+
color: var(--dsw-alias-state-success-primary, #3c9a5a);
|
|
439
|
+
}
|
|
440
|
+
.dsh-miloco-dash-step-text { flex: 1 1 240px; min-width: 0; }
|
|
441
|
+
.dsh-miloco-dash-step-text strong { display: block; font-size: 13px; font-weight: 600; }
|
|
442
|
+
.dsh-miloco-dash-step-text span {
|
|
443
|
+
display: block; margin-top: 2px; color: var(--dsw-alias-label-tertiary, rgba(128,128,128,.72));
|
|
444
|
+
font-size: 12px; line-height: 1.65; overflow-wrap: anywhere;
|
|
445
|
+
}
|
|
446
|
+
.dsh-miloco-dash-state-actions {
|
|
447
|
+
margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
|
|
448
|
+
}
|
|
449
|
+
.dsh-miloco-dash-state-actions button {
|
|
450
|
+
height: 32px; padding: 0 16px; border-radius: var(--dsw-radius-md, 8px);
|
|
451
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
452
|
+
background: transparent; color: inherit; font: inherit; font-size: 12.5px; cursor: pointer;
|
|
453
|
+
transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
|
|
454
|
+
}
|
|
455
|
+
@media (hover: hover) {
|
|
456
|
+
.dsh-miloco-dash-state-actions button:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.12)); }
|
|
457
|
+
}
|
|
458
|
+
.dsh-miloco-dash-state-actions button.primary {
|
|
459
|
+
background: var(--dsw-alias-brand-primary, #4a7edc); border-color: transparent; color: #fff; font-weight: 500;
|
|
460
|
+
}
|
|
461
|
+
.dsh-miloco-dash-state-actions button:disabled { opacity: .45; cursor: default; }
|
|
462
|
+
.dsh-miloco-dash-note {
|
|
463
|
+
max-width: 520px; color: var(--dsw-alias-label-tertiary, rgba(128,128,128,.72));
|
|
464
|
+
font-size: 11.5px; line-height: 1.75; text-align: left;
|
|
465
|
+
}
|
|
466
|
+
.dsh-miloco-dash-bind {
|
|
467
|
+
flex: 1 1 100%; margin-top: 2px; padding: 10px 12px; border-radius: 10px;
|
|
468
|
+
border: .5px solid var(--dsw-alias-border-l1, rgba(128,128,128,.14));
|
|
469
|
+
background: var(--dsw-alias-bg-l2, rgba(128,128,128,.04));
|
|
470
|
+
}
|
|
471
|
+
.dsh-miloco-dash-bind-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
|
472
|
+
.dsh-miloco-dash-extlink {
|
|
473
|
+
color: var(--dsw-alias-brand-primary, #4a7edc); text-decoration: none; font-size: 12.5px;
|
|
474
|
+
}
|
|
475
|
+
@media (hover: hover) { .dsh-miloco-dash-extlink:hover { text-decoration: underline; } }
|
|
476
|
+
.dsh-miloco-dash-bind-steps {
|
|
477
|
+
margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px;
|
|
478
|
+
font-size: 12px; color: var(--dsw-alias-label-secondary, rgba(128,128,128,.95));
|
|
479
|
+
}
|
|
480
|
+
.dsh-miloco-dash-bind-steps li { display: flex; flex-direction: column; gap: 4px; }
|
|
481
|
+
.dsh-miloco-dash-bind-btn {
|
|
482
|
+
align-self: flex-start; height: 28px; padding: 0 12px; border-radius: var(--dsw-radius-md, 8px);
|
|
483
|
+
border: 1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
484
|
+
background: transparent; color: inherit; font: inherit; font-size: 12px; cursor: pointer;
|
|
485
|
+
}
|
|
486
|
+
@media (hover: hover) {
|
|
487
|
+
.dsh-miloco-dash-bind-btn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, rgba(128,128,128,.12)); }
|
|
488
|
+
}
|
|
489
|
+
.dsh-miloco-dash-bind-btn:disabled { opacity: .45; cursor: default; }
|
|
490
|
+
.dsh-miloco-dash-bind-input {
|
|
491
|
+
width: 100%; box-sizing: border-box; min-height: 58px; resize: vertical; padding: 6px 8px;
|
|
492
|
+
border-radius: 7px; border: .5px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
493
|
+
background: var(--dsw-alias-bg-base, transparent); color: inherit; font: inherit; font-size: 12px;
|
|
494
|
+
}
|
|
495
|
+
.dsh-miloco-dash-bind-hint {
|
|
496
|
+
color: var(--dsw-alias-label-tertiary, rgba(128,128,128,.72)); font-size: 11.5px; line-height: 1.6;
|
|
497
|
+
}
|
|
498
|
+
.dsh-miloco-dash-bind-ok {
|
|
499
|
+
margin-top: 8px; color: var(--dsw-alias-state-success-primary, #3c9a5a); font-size: 12px;
|
|
500
|
+
}
|
|
501
|
+
.dsh-miloco-dash-spinner {
|
|
502
|
+
width: 20px; height: 20px; border-radius: 50%;
|
|
503
|
+
border: 2px solid var(--dsw-alias-border-l2, rgba(128,128,128,.24));
|
|
504
|
+
border-top-color: var(--dsw-alias-brand-primary, #4a7edc);
|
|
505
|
+
animation: dsh-miloco-spin .9s linear infinite;
|
|
506
|
+
}
|
|
507
|
+
@media (prefers-reduced-motion: reduce) {
|
|
508
|
+
.dsh-miloco-dash-spinner { animation: none; }
|
|
509
|
+
}
|
|
383
510
|
.dsh-miloco-dash-error {
|
|
384
511
|
display: flex; align-items: center; justify-content: space-between; gap: 8px;
|
|
385
512
|
margin: 12px 0 0; padding: 8px 10px; border-radius: var(--dsw-radius-md, 8px);
|
|
@@ -1704,6 +1831,263 @@ window.__ModuleLoader__.load({
|
|
|
1704
1831
|
h('path', { d: 'M6 9.5 12 15.5 18 9.5' }))
|
|
1705
1832
|
}
|
|
1706
1833
|
|
|
1834
|
+
/**
|
|
1835
|
+
* Decide which view the household page shows.
|
|
1836
|
+
*
|
|
1837
|
+
* The dashboard is only for a working installation: an unconfigured one
|
|
1838
|
+
* gets its own centred onboarding page, a failed request gets its own
|
|
1839
|
+
* error page, and the very first render is a bare loading state. All
|
|
1840
|
+
* three are separate pages — none of them reuses the dashboard layout.
|
|
1841
|
+
*
|
|
1842
|
+
* @param {any} overview - The last `/home/overview` payload, or null.
|
|
1843
|
+
* @param {any} error - The last request error, or null.
|
|
1844
|
+
* @returns {{kind: 'loading'|'error'|'setup'|'dashboard', error?: string}} The page kind.
|
|
1845
|
+
*/
|
|
1846
|
+
function milocoPanelState(overview, error) {
|
|
1847
|
+
if (!overview && !error) return { kind: 'loading' }
|
|
1848
|
+
if (error && !overview) {
|
|
1849
|
+
return { kind: 'error', error: String(error) || '读取失败' }
|
|
1850
|
+
}
|
|
1851
|
+
const status = overview?.status ?? null
|
|
1852
|
+
const setup = overview?.setup ?? null
|
|
1853
|
+
// Older hosts answer without the `setup` block: fall back to the
|
|
1854
|
+
// reachability and the account state the overview already reports.
|
|
1855
|
+
const reachable = setup
|
|
1856
|
+
? Boolean(setup.connection?.reachable)
|
|
1857
|
+
: Boolean(status?.ok)
|
|
1858
|
+
const bound = setup
|
|
1859
|
+
? Boolean(setup.account?.bound ?? setup.accountBound)
|
|
1860
|
+
: Boolean(status?.accountBound)
|
|
1861
|
+
// A reachable backend without a bound account is still "not set up":
|
|
1862
|
+
// the household overview would be empty without a household.
|
|
1863
|
+
if (!reachable || !bound) return { kind: 'setup' }
|
|
1864
|
+
return { kind: 'dashboard' }
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
/**
|
|
1868
|
+
* The centred loading state.
|
|
1869
|
+
* @param {any} [modal] - The configuration modal, rendered inside the page.
|
|
1870
|
+
* @returns {any} The element.
|
|
1871
|
+
*/
|
|
1872
|
+
function milocoLoadingPage(modal) {
|
|
1873
|
+
return h('div', { className: 'dsh-miloco-dash-state' },
|
|
1874
|
+
h('div', { className: 'dsh-miloco-dash-spinner', 'aria-hidden': 'true' }),
|
|
1875
|
+
h('div', { className: 'dsh-miloco-dash-state-sub' }, '正在读取家庭概览…'),
|
|
1876
|
+
modal ?? null)
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* The centred error state.
|
|
1881
|
+
* @param {string} error - The failure reason.
|
|
1882
|
+
* @param {() => void} onRetry - Reload the overview.
|
|
1883
|
+
* @param {() => void} onConfig - Open the configuration modal.
|
|
1884
|
+
* @param {any} [modal] - The configuration modal, rendered inside the page.
|
|
1885
|
+
* @returns {any} The element.
|
|
1886
|
+
*/
|
|
1887
|
+
function milocoErrorPage(error, onRetry, onConfig, modal) {
|
|
1888
|
+
return h('div', { className: 'dsh-miloco-dash-state' },
|
|
1889
|
+
h('div', { className: 'dsh-miloco-dash-state-card' },
|
|
1890
|
+
h('div', { className: 'dsh-miloco-dash-state-mark' }, MilocoPanelIcon({ size: 22 })),
|
|
1891
|
+
h('div', { className: 'dsh-miloco-dash-state-title' }, '家庭助手暂时读不到数据'),
|
|
1892
|
+
h('div', { className: 'dsh-miloco-dash-state-error' }, error),
|
|
1893
|
+
h('div', { className: 'dsh-miloco-dash-state-actions' },
|
|
1894
|
+
h('button', { type: 'button', className: 'primary', onClick: onRetry }, '重试'),
|
|
1895
|
+
h('button', { type: 'button', onClick: onConfig }, '打开配置'))),
|
|
1896
|
+
modal ?? null)
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/**
|
|
1900
|
+
* The centred onboarding page for an installation that cannot reach
|
|
1901
|
+
* Miloco yet. It lists the three setup steps and their state instead of
|
|
1902
|
+
* pretending to be a configured household.
|
|
1903
|
+
* @param {any} overview - The `/home/overview` payload.
|
|
1904
|
+
* @param {() => void} onConfig - Open the configuration modal.
|
|
1905
|
+
* @param {() => void} onReload - Re-read the overview.
|
|
1906
|
+
* @param {any} [modal] - The configuration modal, rendered inside the page.
|
|
1907
|
+
* @returns {any} The element.
|
|
1908
|
+
*/
|
|
1909
|
+
function milocoSetupPage(overview, onConfig, onReload, modal) {
|
|
1910
|
+
const setup = overview?.setup ?? null
|
|
1911
|
+
const status = overview?.status ?? null
|
|
1912
|
+
const push = overview?.push ?? null
|
|
1913
|
+
const connection = setup?.connection ?? {}
|
|
1914
|
+
const account = setup?.account ?? {}
|
|
1915
|
+
const reachable = setup
|
|
1916
|
+
? Boolean(connection.reachable)
|
|
1917
|
+
: Boolean(status?.ok)
|
|
1918
|
+
const bound = setup
|
|
1919
|
+
? Boolean(account.bound ?? setup.accountBound)
|
|
1920
|
+
: Boolean(status?.accountBound)
|
|
1921
|
+
const milocoUrl = String(setup?.milocoUrl ?? connection.baseUrl ?? '').trim()
|
|
1922
|
+
const steps = [
|
|
1923
|
+
{
|
|
1924
|
+
id: 'connection',
|
|
1925
|
+
done: reachable,
|
|
1926
|
+
title: '部署或连接 Miloco',
|
|
1927
|
+
hint: connection.baseUrl
|
|
1928
|
+
? `当前地址:${connection.baseUrl}`
|
|
1929
|
+
: '还没有填写连接地址',
|
|
1930
|
+
},
|
|
1931
|
+
{
|
|
1932
|
+
id: 'account',
|
|
1933
|
+
done: bound,
|
|
1934
|
+
title: '绑定米家账号',
|
|
1935
|
+
hint: bound
|
|
1936
|
+
? `已绑定${account.nickname ? `:${account.nickname}` : ''}`
|
|
1937
|
+
: '在 Miloco 里登录米家账号,才能看到家里的设备',
|
|
1938
|
+
},
|
|
1939
|
+
{
|
|
1940
|
+
id: 'push',
|
|
1941
|
+
done: Boolean(setup?.pushTokenSet ?? push?.tokenSet),
|
|
1942
|
+
title: '接收 Miloco 推送',
|
|
1943
|
+
hint: '生成推送令牌后,Miloco 的主动事件会进入 DSH',
|
|
1944
|
+
},
|
|
1945
|
+
]
|
|
1946
|
+
return h('div', { className: 'dsh-miloco-dash-state' },
|
|
1947
|
+
h('div', { className: 'dsh-miloco-dash-state-card' },
|
|
1948
|
+
h('div', { className: 'dsh-miloco-dash-state-mark' }, MilocoPanelIcon({ size: 22 })),
|
|
1949
|
+
h('div', { className: 'dsh-miloco-dash-state-title' }, '家庭助手还没有初始化'),
|
|
1950
|
+
h('div', { className: 'dsh-miloco-dash-state-sub' },
|
|
1951
|
+
reachable
|
|
1952
|
+
? 'Miloco 已经连上,但还没有绑定米家账号。绑定之后,这一页会变成家庭概览:'
|
|
1953
|
+
+ '设备、房间、感知事件与推送记录。'
|
|
1954
|
+
: '家庭助手需要一个能连上的 Miloco 后端。完成下面三步之后,'
|
|
1955
|
+
+ '这一页会变成家庭概览:设备、房间、感知事件与推送记录。'),
|
|
1956
|
+
h('ul', { className: 'dsh-miloco-dash-steps' }, steps.map((step, index) => h('li', {
|
|
1957
|
+
key: step.title,
|
|
1958
|
+
className: `dsh-miloco-dash-step${step.done ? ' done' : ''}`,
|
|
1959
|
+
},
|
|
1960
|
+
h('span', { className: 'dsh-miloco-dash-step-mark', 'aria-hidden': 'true' },
|
|
1961
|
+
step.done ? '✓' : String(index + 1)),
|
|
1962
|
+
h('span', { className: 'dsh-miloco-dash-step-text' },
|
|
1963
|
+
h('strong', null, step.title),
|
|
1964
|
+
h('span', null, step.hint)),
|
|
1965
|
+
// The account step carries the binding actions: the recommended way
|
|
1966
|
+
// is Miloco's own page, the in-page flow is the fallback.
|
|
1967
|
+
step.id === 'account' && reachable && !bound
|
|
1968
|
+
? h(MilocoBindBox, { milocoUrl, onBound: onReload })
|
|
1969
|
+
: null))),
|
|
1970
|
+
setup?.error
|
|
1971
|
+
? h('div', { className: 'dsh-miloco-dash-state-error' }, setup.error)
|
|
1972
|
+
: null,
|
|
1973
|
+
h('div', { className: 'dsh-miloco-dash-state-actions' },
|
|
1974
|
+
h('button', { type: 'button', className: 'primary', onClick: onConfig }, '开始配置'),
|
|
1975
|
+
h('button', { type: 'button', onClick: onReload }, '重新检测'))),
|
|
1976
|
+
h('div', { className: 'dsh-miloco-dash-note' },
|
|
1977
|
+
'隐私说明:本插件只与本机 Miloco 通信,不会把账号、令牌或家庭数据上传到任何第三方;'
|
|
1978
|
+
+ '绑定建议优先在 Miloco 自己的页面完成。'),
|
|
1979
|
+
modal ?? null)
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* The account binding actions of the onboarding page.
|
|
1984
|
+
*
|
|
1985
|
+
* Two ways, in the order the user should prefer them:
|
|
1986
|
+
* 1. open Miloco's own page (its account dialog does the whole flow);
|
|
1987
|
+
* 2. do it here — fetch the Xiaomi authorization link, let the user paste
|
|
1988
|
+
* the payload the callback page shows, then hand it to Miloco.
|
|
1989
|
+
*
|
|
1990
|
+
* @param {{milocoUrl?: string, onBound?: () => void}} props - Component props.
|
|
1991
|
+
* @returns {any} The element.
|
|
1992
|
+
*/
|
|
1993
|
+
function MilocoBindBox(props) {
|
|
1994
|
+
const milocoUrl = String(props?.milocoUrl ?? '').trim()
|
|
1995
|
+
const onBound = props?.onBound
|
|
1996
|
+
const [open, setOpen] = React.useState(false)
|
|
1997
|
+
const [oauthUrl, setOauthUrl] = React.useState('')
|
|
1998
|
+
const [payload, setPayload] = React.useState('')
|
|
1999
|
+
const [busy, setBusy] = React.useState(false)
|
|
2000
|
+
const [error, setError] = React.useState('')
|
|
2001
|
+
const [done, setDone] = React.useState('')
|
|
2002
|
+
|
|
2003
|
+
const fetchLink = () => {
|
|
2004
|
+
setBusy(true)
|
|
2005
|
+
setError('')
|
|
2006
|
+
call('/miot/bind', { method: 'POST' })
|
|
2007
|
+
.then((payload_) => {
|
|
2008
|
+
setOauthUrl(String(payload_?.oauthUrl ?? ''))
|
|
2009
|
+
if (!payload_?.oauthUrl) setError('Miloco 没有返回授权链接')
|
|
2010
|
+
})
|
|
2011
|
+
.catch((cause) => setError(cause instanceof Error ? cause.message : String(cause)))
|
|
2012
|
+
.finally(() => setBusy(false))
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
const submit = () => {
|
|
2016
|
+
if (!payload.trim()) {
|
|
2017
|
+
setError('请先粘贴小米回调页给出的内容')
|
|
2018
|
+
return
|
|
2019
|
+
}
|
|
2020
|
+
setBusy(true)
|
|
2021
|
+
setError('')
|
|
2022
|
+
call('/miot/authorize', {
|
|
2023
|
+
method: 'POST',
|
|
2024
|
+
headers: { 'content-type': 'application/json' },
|
|
2025
|
+
body: JSON.stringify({ payload }),
|
|
2026
|
+
})
|
|
2027
|
+
.then(() => {
|
|
2028
|
+
setDone('绑定成功,正在刷新…(若设备为空,请在 Miloco 里选择家庭)')
|
|
2029
|
+
setPayload('')
|
|
2030
|
+
onBound?.()
|
|
2031
|
+
})
|
|
2032
|
+
.catch((cause) => setError(cause instanceof Error ? cause.message : String(cause)))
|
|
2033
|
+
.finally(() => setBusy(false))
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
return h('div', { className: 'dsh-miloco-dash-bind' },
|
|
2037
|
+
h('div', { className: 'dsh-miloco-dash-bind-row' },
|
|
2038
|
+
milocoUrl
|
|
2039
|
+
? h('a', {
|
|
2040
|
+
className: 'dsh-miloco-dash-extlink',
|
|
2041
|
+
href: milocoUrl,
|
|
2042
|
+
target: '_blank',
|
|
2043
|
+
rel: 'noopener noreferrer',
|
|
2044
|
+
}, '在 Miloco 中绑定 ↗')
|
|
2045
|
+
: null,
|
|
2046
|
+
h('button', {
|
|
2047
|
+
type: 'button',
|
|
2048
|
+
className: 'dsh-miloco-dash-link',
|
|
2049
|
+
onClick: () => setOpen(!open),
|
|
2050
|
+
}, open ? '收起本页绑定' : '或在本页绑定')),
|
|
2051
|
+
open
|
|
2052
|
+
? h('div', null,
|
|
2053
|
+
h('ol', { className: 'dsh-miloco-dash-bind-steps' },
|
|
2054
|
+
h('li', null,
|
|
2055
|
+
h('button', {
|
|
2056
|
+
type: 'button',
|
|
2057
|
+
className: 'dsh-miloco-dash-bind-btn',
|
|
2058
|
+
disabled: busy,
|
|
2059
|
+
onClick: fetchLink,
|
|
2060
|
+
}, busy && !oauthUrl ? '获取中…' : '① 获取小米授权链接'),
|
|
2061
|
+
oauthUrl
|
|
2062
|
+
? h('a', {
|
|
2063
|
+
className: 'dsh-miloco-dash-extlink',
|
|
2064
|
+
href: oauthUrl,
|
|
2065
|
+
target: '_blank',
|
|
2066
|
+
rel: 'noopener noreferrer',
|
|
2067
|
+
}, '打开小米授权页 ↗')
|
|
2068
|
+
: null),
|
|
2069
|
+
h('li', null,
|
|
2070
|
+
h('div', null, '② 粘贴小米回调页给出的整段内容'),
|
|
2071
|
+
h('div', { className: 'dsh-miloco-dash-bind-hint' },
|
|
2072
|
+
'① 只点一次:重新获取授权链接会让刚才复制的内容失效。'),
|
|
2073
|
+
h('textarea', {
|
|
2074
|
+
className: 'dsh-miloco-dash-bind-input',
|
|
2075
|
+
value: payload,
|
|
2076
|
+
placeholder: '回调页上的授权内容',
|
|
2077
|
+
onChange: (event) => setPayload(event.target.value),
|
|
2078
|
+
})),
|
|
2079
|
+
h('li', null,
|
|
2080
|
+
h('button', {
|
|
2081
|
+
type: 'button',
|
|
2082
|
+
className: 'dsh-miloco-dash-bind-btn',
|
|
2083
|
+
disabled: busy,
|
|
2084
|
+
onClick: submit,
|
|
2085
|
+
}, busy ? '绑定中…' : '③ 完成绑定'))),
|
|
2086
|
+
done ? h('div', { className: 'dsh-miloco-dash-bind-ok' }, done) : null,
|
|
2087
|
+
error ? h('div', { className: 'dsh-miloco-dash-state-error' }, error) : null)
|
|
2088
|
+
: null)
|
|
2089
|
+
}
|
|
2090
|
+
|
|
1707
2091
|
/**
|
|
1708
2092
|
* Build the 「Miloco 家庭助手」 main panel bound to one plugin context.
|
|
1709
2093
|
* The panel is a read-only household overview: workspace path and state,
|
|
@@ -1803,6 +2187,8 @@ window.__ModuleLoader__.load({
|
|
|
1803
2187
|
const pushes = overview?.pushes ?? null
|
|
1804
2188
|
const push = overview?.push ?? null
|
|
1805
2189
|
const stats = overview?.overview ?? null
|
|
2190
|
+
// 页面形态:加载中 / 读取失败 / 未配置 / 仪表盘,四种互斥。
|
|
2191
|
+
const view = milocoPanelState(overview, error)
|
|
1806
2192
|
|
|
1807
2193
|
const startSession = () => {
|
|
1808
2194
|
if (!home?.workspaceId) return
|
|
@@ -1858,10 +2244,43 @@ window.__ModuleLoader__.load({
|
|
|
1858
2244
|
}, '新建家庭会话'),
|
|
1859
2245
|
h('button', { type: 'button', onClick: () => setConfigOpen(true) }, '配置')))
|
|
1860
2246
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
2247
|
+
// 配置弹层:仪表盘、初始化页、错误页共用同一个弹层。
|
|
2248
|
+
const configModal = configOpen
|
|
2249
|
+
? h('div', {
|
|
2250
|
+
className: 'dsh-miloco-dash-config-backdrop',
|
|
2251
|
+
onClick: (event) => {
|
|
2252
|
+
if (event.target === event.currentTarget) setConfigOpen(false)
|
|
2253
|
+
},
|
|
2254
|
+
},
|
|
2255
|
+
h('div', { className: 'dsh-miloco-dash-config' },
|
|
2256
|
+
h('div', { className: 'dsh-miloco-dash-config-head' },
|
|
2257
|
+
h('h3', null, 'Miloco 配置'),
|
|
2258
|
+
h('button', {
|
|
2259
|
+
type: 'button',
|
|
2260
|
+
className: 'dsh-miloco-dash-config-close',
|
|
2261
|
+
onClick: () => setConfigOpen(false),
|
|
2262
|
+
'aria-label': '关闭配置',
|
|
2263
|
+
}, '×')),
|
|
2264
|
+
h('div', { className: 'dsh-miloco-dash-config-body' }, h(MilocoSettingsTab))))
|
|
2265
|
+
: null
|
|
2266
|
+
|
|
2267
|
+
// ---------------------------------------------------------------- 加载中
|
|
2268
|
+
// 加载中不渲染仪表盘头部:按钮此时还没有意义,页面只留一个居中的
|
|
2269
|
+
// 进度提示,避免「标题 + 按钮悬在顶上」的半成品样子。
|
|
2270
|
+
if (view.kind === 'loading') {
|
|
2271
|
+
return milocoLoadingPage(configModal)
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
// 整体请求失败(插件未加载、版本不匹配、服务端异常)时给一页独立的
|
|
2275
|
+
// 错误说明,而不是把空仪表盘铺在页面上。
|
|
2276
|
+
if (view.kind === 'error') {
|
|
2277
|
+
return milocoErrorPage(view.error, load, () => setConfigOpen(true), configModal)
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
// 没连上 Miloco 时,页面是一张独立的初始化引导,而不是「配好了」的
|
|
2281
|
+
// 仪表盘:两者信息量完全不同,不能共用一套布局。
|
|
2282
|
+
if (view.kind === 'setup') {
|
|
2283
|
+
return milocoSetupPage(overview, () => setConfigOpen(true), load, configModal)
|
|
1865
2284
|
}
|
|
1866
2285
|
|
|
1867
2286
|
return h('div', { className: 'dsh-miloco-dash' },
|
|
@@ -1996,24 +2415,7 @@ window.__ModuleLoader__.load({
|
|
|
1996
2415
|
: h('div', { className: 'dsh-miloco-dash-empty' }, '还没有推送记录'))
|
|
1997
2416
|
: sectionError(pushes?.error || '读取推送失败'))),
|
|
1998
2417
|
|
|
1999
|
-
|
|
2000
|
-
? h('div', {
|
|
2001
|
-
className: 'dsh-miloco-dash-config-backdrop',
|
|
2002
|
-
onClick: (event) => {
|
|
2003
|
-
if (event.target === event.currentTarget) setConfigOpen(false)
|
|
2004
|
-
},
|
|
2005
|
-
},
|
|
2006
|
-
h('div', { className: 'dsh-miloco-dash-config' },
|
|
2007
|
-
h('div', { className: 'dsh-miloco-dash-config-head' },
|
|
2008
|
-
h('h3', null, 'Miloco 配置'),
|
|
2009
|
-
h('button', {
|
|
2010
|
-
type: 'button',
|
|
2011
|
-
className: 'dsh-miloco-dash-config-close',
|
|
2012
|
-
onClick: () => setConfigOpen(false),
|
|
2013
|
-
'aria-label': '关闭配置',
|
|
2014
|
-
}, '×')),
|
|
2015
|
-
h(MilocoSettingsTab)))
|
|
2016
|
-
: null)
|
|
2418
|
+
configModal)
|
|
2017
2419
|
}
|
|
2018
2420
|
|
|
2019
2421
|
return MilocoHomePanel
|
|
@@ -2161,6 +2563,11 @@ window.__ModuleLoader__.load({
|
|
|
2161
2563
|
exports.inject = inject
|
|
2162
2564
|
exports.MilocoSettingsTab = MilocoSettingsTab
|
|
2163
2565
|
exports.MilocoPanelIcon = MilocoPanelIcon
|
|
2566
|
+
exports.milocoPanelState = milocoPanelState
|
|
2567
|
+
exports.milocoLoadingPage = milocoLoadingPage
|
|
2568
|
+
exports.milocoErrorPage = milocoErrorPage
|
|
2569
|
+
exports.milocoSetupPage = milocoSetupPage
|
|
2570
|
+
exports.MilocoBindBox = MilocoBindBox
|
|
2164
2571
|
exports.MilocoPushNodeView = MilocoPushNodeView
|
|
2165
2572
|
exports.createMilocoHomePanel = createMilocoHomePanel
|
|
2166
2573
|
exports.formatMessageClock = formatMessageClock
|
package/lib/miloco-client.js
CHANGED
|
@@ -70,9 +70,9 @@ export async function readMilocoConfig(home) {
|
|
|
70
70
|
*
|
|
71
71
|
* @param {{baseUrl?: string, token?: string, timeoutMs?: number, home?: string, overlay?: any}} options - Client options.
|
|
72
72
|
* @returns {{
|
|
73
|
-
* request: (method: string, path: string, opts?: {query?: Record<string, any>, body?: any, signal?: AbortSignal}) => Promise<any>,
|
|
74
|
-
* get: (path: string, opts?: {query?: Record<string, any>, signal?: AbortSignal}) => Promise<any>,
|
|
75
|
-
* post: (path: string, body?: any, opts?: {query?: Record<string, any>, signal?: AbortSignal}) => Promise<any>,
|
|
73
|
+
* request: (method: string, path: string, opts?: {query?: Record<string, any>, body?: any, signal?: AbortSignal, timeoutMs?: number}) => Promise<any>,
|
|
74
|
+
* get: (path: string, opts?: {query?: Record<string, any>, signal?: AbortSignal, timeoutMs?: number}) => Promise<any>,
|
|
75
|
+
* post: (path: string, body?: any, opts?: {query?: Record<string, any>, signal?: AbortSignal, timeoutMs?: number}) => Promise<any>,
|
|
76
76
|
* put: (path: string, body?: any, opts?: {query?: Record<string, any>, signal?: AbortSignal}) => Promise<any>,
|
|
77
77
|
* delete: (path: string, opts?: {query?: Record<string, any>, signal?: AbortSignal}) => Promise<any>,
|
|
78
78
|
* postMultipart: (path: string, opts?: any) => Promise<any>,
|
|
@@ -122,7 +122,7 @@ export function createMilocoClient(options = {}) {
|
|
|
122
122
|
* Perform one backend request and unwrap the response envelope.
|
|
123
123
|
* @param {string} method - HTTP method.
|
|
124
124
|
* @param {string} path - API path starting with `/api`.
|
|
125
|
-
* @param {{query?: Record<string, any>, body?: any, signal?: AbortSignal}} [opts] - Request options.
|
|
125
|
+
* @param {{query?: Record<string, any>, body?: any, signal?: AbortSignal, timeoutMs?: number}} [opts] - Request options. `timeoutMs` overrides the client-wide timeout for this call only.
|
|
126
126
|
* @returns {Promise<any>} The envelope's `data` field.
|
|
127
127
|
*/
|
|
128
128
|
async function request(method, path, opts = {}) {
|
|
@@ -140,7 +140,8 @@ export function createMilocoClient(options = {}) {
|
|
|
140
140
|
body = JSON.stringify(opts.body)
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
const
|
|
143
|
+
const effectiveTimeoutMs = Number.isFinite(opts.timeoutMs) && opts.timeoutMs > 0 ? opts.timeoutMs : timeoutMs
|
|
144
|
+
const timeout = AbortSignal.timeout(effectiveTimeoutMs)
|
|
144
145
|
const signals = [timeout]
|
|
145
146
|
if (opts.signal) signals.push(opts.signal)
|
|
146
147
|
const signal = signals.length === 1 ? signals[0] : AbortSignal.any(signals)
|
|
@@ -150,6 +151,13 @@ export function createMilocoClient(options = {}) {
|
|
|
150
151
|
response = await fetch(url, { method, headers, body, signal })
|
|
151
152
|
} catch (error) {
|
|
152
153
|
if (opts.signal?.aborted) throw error
|
|
154
|
+
if (timeout.aborted) {
|
|
155
|
+
throw new MilocoError(
|
|
156
|
+
`Miloco 后端响应超时(${Math.round(effectiveTimeoutMs / 1000)}s):${method} ${path}。`
|
|
157
|
+
+ '后端可能仍在长时间推理(如感知请求),可稍后重试,或在插件配置中调大 timeoutMs。',
|
|
158
|
+
{ path },
|
|
159
|
+
)
|
|
160
|
+
}
|
|
153
161
|
throw new MilocoError(
|
|
154
162
|
`无法连接 Miloco 后端 ${baseUrl}:${error instanceof Error ? error.message : String(error)}。`
|
|
155
163
|
+ '请确认 Miloco 已启动,或到「设置 → 插件 → Miloco」部署/连接一个实例。',
|
package/lib/settings-api.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* GET /dsh-miloco-bridge/api/home household workspace snapshot
|
|
10
10
|
* POST /dsh-miloco-bridge/api/home move the household directory
|
|
11
11
|
* GET /dsh-miloco-bridge/api/home/overview household dashboard aggregate
|
|
12
|
+
* POST /dsh-miloco-bridge/api/miot/bind start the MiOT account binding (oauth url)
|
|
13
|
+
* POST /dsh-miloco-bridge/api/miot/authorize finish the MiOT account binding (code + state)
|
|
12
14
|
* GET /dsh-miloco-bridge/api/sessions live DSH conversations
|
|
13
15
|
* POST /dsh-miloco-bridge/api/target push destination (mode + session + model)
|
|
14
16
|
* POST /dsh-miloco-bridge/api/mode readonly / full
|
|
@@ -159,6 +161,44 @@ async function readCatalog(ctx) {
|
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Decode the payload the Xiaomi callback page hands out.
|
|
166
|
+
*
|
|
167
|
+
* The callback page shows one base64 blob that encodes `{"code":…,"state":…}`.
|
|
168
|
+
* Miloco's own web UI decodes it in the browser; the plugin accepts the same
|
|
169
|
+
* blob (plain JSON is accepted too) so the household page can finish the
|
|
170
|
+
* binding without asking the user to split two values by hand.
|
|
171
|
+
*
|
|
172
|
+
* The authorization code is a one-time credential: it is never logged and
|
|
173
|
+
* never echoed back to the browser.
|
|
174
|
+
*
|
|
175
|
+
* @param {string} raw - The pasted payload.
|
|
176
|
+
* @returns {{code: string, state: string} | null} The decoded pair, or null.
|
|
177
|
+
*/
|
|
178
|
+
export function decodeAuthPayload(raw) {
|
|
179
|
+
const text = String(raw ?? '').trim()
|
|
180
|
+
if (!text) return null
|
|
181
|
+
const candidates = [text]
|
|
182
|
+
const normalized = text.replace(/-/g, '+').replace(/_/g, '/')
|
|
183
|
+
const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4)
|
|
184
|
+
if (padded !== text) candidates.push(padded)
|
|
185
|
+
for (const candidate of candidates) {
|
|
186
|
+
try {
|
|
187
|
+
const parsed = JSON.parse(Buffer.from(candidate, 'base64').toString('utf8'))
|
|
188
|
+
if (parsed && typeof parsed.code === 'string' && typeof parsed.state === 'string') {
|
|
189
|
+
return { code: parsed.code.trim(), state: parsed.state.trim() }
|
|
190
|
+
}
|
|
191
|
+
} catch { /* not this shape; try the next one */ }
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
const parsed = JSON.parse(text)
|
|
195
|
+
if (parsed && typeof parsed.code === 'string' && typeof parsed.state === 'string') {
|
|
196
|
+
return { code: parsed.code.trim(), state: parsed.state.trim() }
|
|
197
|
+
}
|
|
198
|
+
} catch { /* not JSON either */ }
|
|
199
|
+
return null
|
|
200
|
+
}
|
|
201
|
+
|
|
162
202
|
/**
|
|
163
203
|
* Group device rows by room for the household overview.
|
|
164
204
|
* @param {any[]} rows - Raw `/api/miot/device_list` rows.
|
|
@@ -577,12 +617,13 @@ export function registerSettingsApi(options) {
|
|
|
577
617
|
const attempt = promise => promise
|
|
578
618
|
.then(data => ({ ok: true, data }))
|
|
579
619
|
.catch(error => ({ ok: false, error: error instanceof Error ? error.message : String(error) }))
|
|
580
|
-
const [status, version, devices, events, user, engine, cameras, rules, tasks, usage] = await Promise.all([
|
|
620
|
+
const [status, version, devices, events, user, login, engine, cameras, rules, tasks, usage] = await Promise.all([
|
|
581
621
|
attempt(client.get('/api/admin/status', { signal: short })),
|
|
582
622
|
attempt(client.get('/api/admin/version', { signal: short })),
|
|
583
623
|
attempt(client.get('/api/miot/device_list', { signal: short })),
|
|
584
624
|
attempt(client.get('/api/events', { query: { limit: 10 }, signal: short })),
|
|
585
625
|
attempt(client.get('/api/miot/user_info', { signal: short })),
|
|
626
|
+
attempt(client.get('/api/miot/login_status', { signal: short })),
|
|
586
627
|
attempt(client.get('/api/perception/engine/status', { signal: short })),
|
|
587
628
|
attempt(client.get('/api/miot/camera_list', { signal: short })),
|
|
588
629
|
attempt(client.get('/api/rules', { signal: short })),
|
|
@@ -610,8 +651,41 @@ export function registerSettingsApi(options) {
|
|
|
610
651
|
const resolved = await ctx.sessionController.resolveAgent(ARCHIVE_SESSION_ID)
|
|
611
652
|
archiveExists = Boolean(resolved && typeof resolved === 'object' && resolved.agent)
|
|
612
653
|
} catch { /* treat as absent */ }
|
|
654
|
+
// The setup block tells the household page whether the plugin is wired up
|
|
655
|
+
// at all. An unconfigured installation must not render the same dense
|
|
656
|
+
// dashboard as a working one: the page switches to its own centred
|
|
657
|
+
// onboarding view instead.
|
|
658
|
+
const endpoint = await client.endpoint()
|
|
659
|
+
const accountBound = Boolean(user.ok && user.data?.uid)
|
|
660
|
+
const pushTokenSet = Boolean(
|
|
661
|
+
String(current.push.token ?? '') || String(config.push?.token ?? ''),
|
|
662
|
+
)
|
|
613
663
|
sendJson(res, 200, {
|
|
614
664
|
ok: true,
|
|
665
|
+
setup: {
|
|
666
|
+
connection: {
|
|
667
|
+
baseUrl: endpoint.baseUrl,
|
|
668
|
+
source: endpoint.source,
|
|
669
|
+
tokenSet: Boolean(endpoint.token),
|
|
670
|
+
// Miloco answered `/api/admin/status`: the bridge can talk to it.
|
|
671
|
+
reachable: status.ok,
|
|
672
|
+
},
|
|
673
|
+
account: {
|
|
674
|
+
bound: accountBound,
|
|
675
|
+
uid: user.ok ? (user.data?.uid ?? null) : null,
|
|
676
|
+
nickname: user.ok ? (user.data?.nickname ?? '') : '',
|
|
677
|
+
loggedIn: Boolean(login.ok && login.data?.is_logged_in),
|
|
678
|
+
},
|
|
679
|
+
accountBound,
|
|
680
|
+
pushTokenSet,
|
|
681
|
+
// Ready = the household page can show real data. A reachable backend
|
|
682
|
+
// without a bound account still shows the onboarding page: the
|
|
683
|
+
// dashboard would be empty without a household.
|
|
684
|
+
ready: status.ok && accountBound,
|
|
685
|
+
// Miloco's own web UI: the recommended place to bind the account.
|
|
686
|
+
milocoUrl: endpoint.baseUrl,
|
|
687
|
+
...(status.ok ? {} : { error: status.error }),
|
|
688
|
+
},
|
|
615
689
|
home: {
|
|
616
690
|
...homeState,
|
|
617
691
|
archive: { sessionId: ARCHIVE_SESSION_ID, exists: archiveExists },
|
|
@@ -676,6 +750,67 @@ export function registerSettingsApi(options) {
|
|
|
676
750
|
})
|
|
677
751
|
})
|
|
678
752
|
|
|
753
|
+
route(`${SETTINGS_PREFIX}/miot/bind`, async (req, res) => {
|
|
754
|
+
if (req.method !== 'POST') {
|
|
755
|
+
sendJson(res, 405, { ok: false, error: 'method not allowed' })
|
|
756
|
+
return
|
|
757
|
+
}
|
|
758
|
+
const body = await mutateBody(req, res)
|
|
759
|
+
if (body === null) return
|
|
760
|
+
try {
|
|
761
|
+
// Miloco answers with the Xiaomi OAuth URL; the user opens it, approves,
|
|
762
|
+
// and comes back with the payload the callback page shows.
|
|
763
|
+
const result = await client.post('/api/miot/bind')
|
|
764
|
+
const oauthUrl = String(result?.oauth_url ?? result?.oauthUrl ?? '').trim()
|
|
765
|
+
if (!oauthUrl) {
|
|
766
|
+
sendJson(res, 502, { ok: false, error: 'Miloco 没有返回授权链接' })
|
|
767
|
+
return
|
|
768
|
+
}
|
|
769
|
+
let state = ''
|
|
770
|
+
try {
|
|
771
|
+
state = new URL(oauthUrl).searchParams.get('state') ?? ''
|
|
772
|
+
} catch { /* the URL is not parseable; the user pastes the whole payload anyway */ }
|
|
773
|
+
sendJson(res, 200, { ok: true, oauthUrl, state })
|
|
774
|
+
} catch (error) {
|
|
775
|
+
sendJson(res, 502, {
|
|
776
|
+
ok: false,
|
|
777
|
+
error: error instanceof Error ? error.message : String(error),
|
|
778
|
+
})
|
|
779
|
+
}
|
|
780
|
+
})
|
|
781
|
+
|
|
782
|
+
route(`${SETTINGS_PREFIX}/miot/authorize`, async (req, res) => {
|
|
783
|
+
if (req.method !== 'POST') {
|
|
784
|
+
sendJson(res, 405, { ok: false, error: 'method not allowed' })
|
|
785
|
+
return
|
|
786
|
+
}
|
|
787
|
+
const body = await mutateBody(req, res)
|
|
788
|
+
if (body === null) return
|
|
789
|
+
const payload = decodeAuthPayload(body.payload ?? body.code ?? '')
|
|
790
|
+
if (!payload) {
|
|
791
|
+
sendJson(res, 400, { ok: false, error: '看不懂这段授权内容,请粘贴小米回调页给出的整段内容' })
|
|
792
|
+
return
|
|
793
|
+
}
|
|
794
|
+
try {
|
|
795
|
+
// The authorization code is a one-time credential: it is forwarded to
|
|
796
|
+
// Miloco and never logged or echoed back.
|
|
797
|
+
const result = await client.post('/api/miot/authorize', {
|
|
798
|
+
code: payload.code,
|
|
799
|
+
state: payload.state,
|
|
800
|
+
})
|
|
801
|
+
sendJson(res, 200, {
|
|
802
|
+
ok: true,
|
|
803
|
+
accountChanged: Boolean(result?.account_changed),
|
|
804
|
+
scopePreserved: Boolean(result?.scope_preserved),
|
|
805
|
+
})
|
|
806
|
+
} catch (error) {
|
|
807
|
+
sendJson(res, 502, {
|
|
808
|
+
ok: false,
|
|
809
|
+
error: error instanceof Error ? error.message : String(error),
|
|
810
|
+
})
|
|
811
|
+
}
|
|
812
|
+
})
|
|
813
|
+
|
|
679
814
|
route(`${SETTINGS_PREFIX}/sessions`, async (req, res) => {
|
|
680
815
|
if (req.method !== 'GET') {
|
|
681
816
|
sendJson(res, 405, { ok: false, error: 'method not allowed' })
|
package/lib/tools.js
CHANGED
|
@@ -292,11 +292,18 @@ export function createMilocoTools(options) {
|
|
|
292
292
|
|
|
293
293
|
// ---------------------------------------------------------------- 感知
|
|
294
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Perceive runs camera capture + multimodal LLM inference on the Miloco
|
|
297
|
+
* backend and measured 58–78 s end to end; the client-wide 30 s default
|
|
298
|
+
* would abort every call. Override it per-request with headroom.
|
|
299
|
+
*/
|
|
300
|
+
const PERCEIVE_TIMEOUT_MS = 180_000
|
|
301
|
+
|
|
295
302
|
tools.push(defineMilocoTool({
|
|
296
303
|
name: 'miloco_perceive',
|
|
297
304
|
description: '用摄像头看画面、听现场声音,并用多模态大模型回答问题。sources 传摄像头 did 列表,query 用自然语言提问'
|
|
298
305
|
+ '(例如"客厅现在有人吗""刚才进门的人穿的什么衣服")。只能回答画面/声音层面的问题;温度、电量一类数值要用 miloco_device_status。'
|
|
299
|
-
+ '
|
|
306
|
+
+ '需要该摄像头已开启感知。注意:该调用需要抓帧并做大模型推理,通常要 1–2 分钟,属正常耗时,超时前请勿重复调用。',
|
|
300
307
|
parameters: {
|
|
301
308
|
sources: {
|
|
302
309
|
type: 'array',
|
|
@@ -310,7 +317,11 @@ export function createMilocoTools(options) {
|
|
|
310
317
|
const sources = Array.isArray(args.sources) ? args.sources.filter(s => typeof s === 'string' && s) : []
|
|
311
318
|
if (sources.length === 0) throw new Error('缺少参数 sources:至少给一个摄像头 did')
|
|
312
319
|
const query = requireString(args, 'query')
|
|
313
|
-
return call('POST', '/api/perception/perceive', {
|
|
320
|
+
return call('POST', '/api/perception/perceive', {
|
|
321
|
+
body: { sources, query },
|
|
322
|
+
signal: exec?.signal,
|
|
323
|
+
timeoutMs: PERCEIVE_TIMEOUT_MS,
|
|
324
|
+
})
|
|
314
325
|
},
|
|
315
326
|
}))
|
|
316
327
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-miloco-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Unofficial DSH bridge for Xiaomi Miloco: an isolated Agent preset for Miloco tools, native tools/skills, Web settings, perception-priority filtering, and Miloco -> DSH push.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|