@yoooclaw/phone-notifications 1.6.2 → 1.7.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @yoooclaw/phone-notifications
2
2
 
3
- OpenClaw 手机通知同步插件:接收手机通知并写入本地 JSON 文件系统,供 Agent 查询和消费。
3
+ OpenClaw / QClaw 手机通知同步插件:接收手机通知并写入本地 JSON 文件系统,供 Agent 查询和消费。
4
4
 
5
5
  ## 工作方式
6
6
 
@@ -36,11 +36,18 @@ OpenClaw 手机通知同步插件:接收手机通知并写入本地 JSON 文
36
36
  ## 前置要求
37
37
 
38
38
  - **Node.js >= 22.12.0**
39
- - **OpenClaw >= 2026.0.0**
39
+ - **OpenClaw >= 2026.0.0**,或兼容其插件 ABI 的 QClaw 宿主
40
+
41
+ ## 宿主兼容性
42
+
43
+ - **OpenClaw**:可直接使用全局 `openclaw` CLI 安装、更新、验证和执行插件命令。
44
+ - **QClaw**:插件 ABI 与 OpenClaw 兼容,但宿主目录、配置入口和 CLI 管理方式不同。QClaw 桌面应用通常不提供全局 `openclaw` 命令,而是由应用内置 wrapper 调用 OpenClaw runtime。
45
+ - 一键安装脚本会自动探测宿主状态目录,优先读取 `~/.qclaw/qclaw.json`;如果你的变体产品使用 `~/.qclow/qclaw.json`,脚本和插件也会兼容。
46
+ - QClaw 下**不支持**本脚本自动执行 `gateway restart` / Tailscale 配置。安装完成后如插件未自动生效,请重启 QClaw 桌面应用。
40
47
 
41
48
  ## 安装
42
49
 
43
- ### 通过 OpenClaw 安装(推荐)
50
+ ### 通过 OpenClaw CLI 安装(OpenClaw)
44
51
 
45
52
  ```bash
46
53
  openclaw plugin install @yoooclaw/phone-notifications
@@ -52,14 +59,20 @@ openclaw plugin install @yoooclaw/phone-notifications
52
59
  openclaw plugin update @yoooclaw/phone-notifications
53
60
  ```
54
61
 
55
- ### 通过一键脚本安装(备选)
62
+ ### 通过一键脚本安装(推荐给 QClaw,备选给 OpenClaw)
56
63
 
57
- 适用于无法使用 npm 源的环境,脚本从 CDN 获取插件包并自动注册。
64
+ 适用于无法使用 npm 源的环境,或宿主不是标准 OpenClaw CLI 的场景。脚本从 CDN 获取插件包并自动注册。
58
65
 
59
66
  ```bash
60
67
  curl -fsSL https://cdn.yoootek.com/openclaw-plugin/install.sh | bash
61
68
  ```
62
69
 
70
+ 脚本会自动探测宿主:
71
+
72
+ - OpenClaw:默认使用 `~/.openclaw`
73
+ - QClaw:优先读取 `~/.qclaw/qclaw.json`
74
+ - 兼容变体:如存在 `~/.qclow/qclaw.json` 也会识别
75
+
63
76
  <details>
64
77
  <summary>脚本安装选项</summary>
65
78
 
@@ -69,12 +82,12 @@ curl -fsSL https://cdn.yoootek.com/openclaw-plugin/install.sh | bash
69
82
  curl -fsSL https://cdn.yoootek.com/openclaw-plugin/install.sh | bash -s -- --version 1.2.3
70
83
  ```
71
84
 
72
- #### 带 Token 安装
85
+ #### 带 API Key 安装
73
86
 
74
- 安装时同时写入灯控鉴权 Token(写入 `~/.openclaw/credentials.json`):
87
+ 安装时同时写入灯控鉴权 API Key(写入 `<stateDir>/credentials.json`):
75
88
 
76
89
  ```bash
77
- curl -fsSL https://cdn.yoootek.com/openclaw-plugin/install.sh | bash -s -- --token eyJhbGciOi...
90
+ curl -fsSL https://cdn.yoootek.com/openclaw-plugin/install.sh | bash -s -- --api-key ock_xxx
78
91
  ```
79
92
 
80
93
  #### 使用本地包安装
@@ -89,27 +102,37 @@ bash install.sh --tgz-url ./yoooclaw-phone-notifications-1.2.3.tgz
89
102
  |---|---|---|
90
103
  | `--version <ver>` | 指定版本号 | 自动获取最新版本 |
91
104
  | `--tgz-url <url\|path>` | 直接指定插件包地址(跳过版本检测) | - |
92
- | `--target-dir <path>` | 安装目录 | `~/.openclaw/extensions/phone-notifications` |
93
- | `--token <token>` | 灯控鉴权 Token | - |
105
+ | `--target-dir <path>` | 安装目录 | `<stateDir>/extensions/phone-notifications` |
106
+ | `--state-dir <path>` | 宿主状态目录 | 自动探测 |
107
+ | `--config-path <path>` | 宿主配置文件路径 | `<stateDir>/openclaw.json` |
108
+ | `--host-cli <cmd>` | 宿主 CLI 命令名 | `openclaw` |
109
+ | `--api-key <apiKey>` | 灯控鉴权 API Key | - |
110
+ | `--token <token>` | 兼容旧参数,等价于 `--api-key` | - |
94
111
  | `--retention-days <n>` | 通知数据保留天数 | 30 |
95
112
 
96
113
  #### 脚本做了什么
97
114
 
98
115
  1. 从 CDN 下载最新版本的插件 tgz 包(或使用你指定的版本/地址)
99
116
  2. 解压并验证包完整性(检查 `package.json`、入口文件可加载)
100
- 3. 备份旧版本(如有),原子替换到 `~/.openclaw/extensions/phone-notifications`
101
- 4. 写入 `~/.openclaw/openclaw.json` 配置:
117
+ 3. 自动探测宿主状态目录和配置文件路径
118
+ 4. 备份旧版本(如有),原子替换到 `<stateDir>/extensions/phone-notifications`
119
+ 5. 写入 `<configPath>` 配置:
102
120
  - `plugins.allow` — 将插件加入白名单
103
121
  - `plugins.entries` — 启用插件,合并用户配置
104
122
  - `plugins.installs` — 记录安装来源和版本
105
123
  - 清理该插件旧的 `plugins.load.paths` / 旧安装记录,避免继续命中之前通过 `openclaw plugins install` 或 `--link` 保留的副本
106
- 5. 如传入 `--token`,写入 `~/.openclaw/credentials.json`
107
- 6. 安装失败时自动回滚到旧版本
124
+ 6. 如传入 `--api-key` / `--token`,写入 `<stateDir>/credentials.json`
125
+ 7. OpenClaw 下尝试执行 `gateway restart`;QClaw 下不会主动重启宿主进程
126
+ 8. 安装失败时自动回滚到旧版本
108
127
 
109
128
  </details>
110
129
 
111
130
  ### 验证安装
112
131
 
132
+ #### OpenClaw
133
+
134
+ 以下命令适用于带全局 `openclaw` CLI 的标准 OpenClaw 宿主:
135
+
113
136
  ```bash
114
137
  openclaw ntf --help
115
138
  ```
@@ -128,8 +151,16 @@ openclaw phone-notifications --help
128
151
  openclaw phone-notifications -v
129
152
  ```
130
153
 
154
+ #### QClaw
155
+
156
+ - QClaw 通常**没有**全局 `openclaw` 命令。
157
+ - 插件安装完成后,如未自动生效,请先重启 QClaw 桌面应用。
158
+ - 如需执行 OpenClaw CLI 子命令,请使用 QClaw 自带的 wrapper;命令语义与本文档中的 `openclaw ...` 子命令保持一致,但入口由 QClaw 提供。
159
+
131
160
  ## 配置
132
161
 
162
+ 以下命令以 OpenClaw 为例。QClaw 下请通过其自带 wrapper 执行同样的 OpenClaw 子命令。
163
+
133
164
  安装脚本会自动写入必要的插件注册配置。如需手动调整:
134
165
 
135
166
  ```bash
@@ -203,13 +234,15 @@ Content-Type: application/json
203
234
 
204
235
  ## CLI 命令
205
236
 
237
+ 以下示例均以 OpenClaw 全局 CLI 为例。QClaw 下请将 `openclaw` 替换为 QClaw 提供的 OpenClaw wrapper。
238
+
206
239
  插件注册了 `openclaw ntf` 命令组,并提供 `openclaw phone-notifications` 作为无冲突别名,供 Agent 直接消费。所有命令输出 JSON。
207
240
 
208
241
  ### 认证管理
209
242
 
210
243
  ```bash
211
- # 设置用户 Token(灯效下发等接口需要)
212
- openclaw ntf auth set-token "eyJhbGciOi..."
244
+ # 设置用户 API Key(灯效下发等接口需要)
245
+ openclaw ntf auth set-api-key "ock_xxx"
213
246
 
214
247
  # 查看当前认证状态
215
248
  openclaw ntf auth show
@@ -218,6 +251,8 @@ openclaw ntf auth show
218
251
  openclaw ntf auth clear
219
252
  ```
220
253
 
254
+ 兼容旧命令:`openclaw ntf auth set-token <token>`,效果等同于 `set-api-key`。
255
+
221
256
  ### 通知查询
222
257
 
223
258
  ```bash
@@ -286,7 +321,7 @@ openclaw ntf monitor delete boss-alert --yes
286
321
  ### 灯效控制
287
322
 
288
323
  ```bash
289
- # 直接发送灯效指令到硬件设备(需要先 set-token
324
+ # 直接发送灯效指令到硬件设备(需要先 set-api-key
290
325
  openclaw ntf light send \
291
326
  --segments '[{"mode":"wave","duration_s":4,"brightness":192,"color":{"r":255,"g":0,"b":0}}]'
292
327
 
@@ -336,13 +371,13 @@ src/
336
371
  └── cli/
337
372
  ├── index.ts # CLI 注册汇总入口
338
373
  ├── helpers.ts # 共享工具(路径解析、日期处理、JSON 输出)
339
- ├── auth.ts # openclaw ntf auth
340
- ├── ntf-search.ts # openclaw ntf search
341
- ├── ntf-stats.ts # openclaw ntf stats
342
- ├── ntf-sync.ts # openclaw ntf sync
343
- ├── ntf-monitor.ts # openclaw ntf monitor
344
- ├── light-rules.ts # openclaw ntf light rules
345
- └── light-send.ts # openclaw ntf light send
374
+ ├── auth.ts # auth 子命令
375
+ ├── ntf-search.ts # search 子命令
376
+ ├── ntf-stats.ts # stats 子命令
377
+ ├── ntf-sync.ts # sync 子命令
378
+ ├── ntf-monitor.ts # monitor 子命令
379
+ ├── light-rules.ts # light rules 子命令
380
+ └── light-send.ts # light send 子命令
346
381
  ```
347
382
 
348
383
  ## License