@honor-claw/yoyo 1.2.0-beta.11 → 1.2.0-beta.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honor-claw/yoyo",
3
- "version": "1.2.0-beta.11",
3
+ "version": "1.2.0-beta.13",
4
4
  "description": "OpenClaw Honor Yoyo connection plugin",
5
5
  "keywords": [
6
6
  "ai",
@@ -47,6 +47,7 @@ alarm.create
47
47
  │ - realRepeatType = 5(指定日期) 时,必须设置 specialTimeMillis │
48
48
  │ - realRepeatType = 9(大小周) 时,必须设置 bigWeek │
49
49
  │ - 校验时间格式是否为 THH:mm:ss │
50
+ | - 指代日期(如:明天、后天)的具体日期推理 → specialTimeMillis(时间戳)|
50
51
  └─────────────────────────────────────────────────────────────┘
51
52
 
52
53
  ┌─────────────────────────────────────────────────────────────┐
@@ -73,6 +74,7 @@ alarm.create
73
74
  | **创建指定日期闹钟** | 2026年3月20日早上八点的闹钟 | `time`, `realRepeatType: 5`, `specialTimeMillis` | - |
74
75
  | **创建节假日跳过闹钟** | 工作日闹钟,跳过节假日 | `time`, `realRepeatType: 1`, `skipHoliday: true` | - |
75
76
  | **创建大小周闹钟** | 大小周工作日上午九点的闹钟 | `time`, `realRepeatType: 9`, `bigWeek` | - |
77
+ | **创建指代日期闹钟** | 明天早上九点的闹钟 | `time`, `specialTimeMillis` | - |
76
78
 
77
79
  ## 参数定义
78
80
 
@@ -471,6 +473,41 @@ cmd /c 'openclaw nodes invoke --node <ID> --command alarm.create --params "{\"ti
471
473
  openclaw nodes invoke --node <ID> --command alarm.create --params '{"time":"T08:30:00","realRepeatType":10,"daysOfWeek":0,"specialTimeMillis":0,"skipHoliday":false}'
472
474
  ```
473
475
 
476
+ ---
477
+
478
+ ### 示例 12: 创建指代日期闹钟
479
+
480
+ **用户输入**: "创建明天早上八点的闹钟"
481
+ **处理逻辑**:
482
+ 1. 获取当前的日期,以“2026年4月15日12:09:57”为例,当前日期为 2026-04-15 12:09:57 对应时间戳: 1776226197000
483
+ 2. 根据用户输入推理闹钟时间为 2026-04-16 08:00:00,将时间转换为时间戳: 1776297600000
484
+ 3. `realRepeatType` 为 5,即为指定日期闹钟
485
+
486
+ **JSON 参数**:
487
+
488
+ ```json
489
+ {
490
+ "time": "T08:00:00",
491
+ "realRepeatType": 5,
492
+ "daysOfWeek": 0,
493
+ "specialTimeMillis": 1776297600000,
494
+ "skipHoliday": false
495
+ }
496
+ ```
497
+
498
+ **Windows (Cmd) 执行命令**:
499
+
500
+ ```bash
501
+ cmd /c 'openclaw nodes invoke --node <ID> --command alarm.create --params "{\"time\":\"T08:00:00\",\"realRepeatType\":5,\"daysOfWeek\":0,\"specialTimeMillis\":1776297600000,\"skipHoliday\":false}"'
502
+
503
+ ```
504
+
505
+ **Linux (Bash) 执行命令**:
506
+
507
+ ```bash
508
+ openclaw nodes invoke --node <ID> --command alarm.create --params '{"time":"T08:00:00","realRepeatType":5,"daysOfWeek":0,"specialTimeMillis":1776297600000,"skipHoliday":false}'
509
+ ```
510
+
474
511
  ## 错误处理
475
512
 
476
513
  如果工具执行错误(300),可能原因如下:
@@ -40,6 +40,31 @@ function getRegistryStringValueAsync(
40
40
  });
41
41
  }
42
42
 
43
+ /**
44
+ * 异步检查注册表键是否存在
45
+ * 使用 winreg 的 values() 方法,键不存在时会报错
46
+ */
47
+ function registryKeyExistsAsync(hive: number, keyPath: string): Promise<boolean> {
48
+ return new Promise((resolve) => {
49
+ try {
50
+ const regKey = new Registry({
51
+ hive,
52
+ key: keyPath,
53
+ });
54
+
55
+ regKey.values((err: Error | null) => {
56
+ if (err) {
57
+ resolve(false);
58
+ } else {
59
+ resolve(true);
60
+ }
61
+ });
62
+ } catch {
63
+ resolve(false);
64
+ }
65
+ });
66
+ }
67
+
43
68
  export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
44
69
  private cache: DeviceInfoCache = {
45
70
  deviceId: "",
@@ -111,11 +136,17 @@ export class WindowsDeviceInfoProvider implements DeviceInfoProvider {
111
136
  systemManufacturer2,
112
137
  ];
113
138
 
114
- const manufacturer = manufacturerSources.find((m) => m && m.trim()) || "";
115
- if (manufacturer.toLowerCase().includes("honor")) {
139
+ const manufacturer = manufacturerSources.find((m) => m && m.toLowerCase().includes("honor"));
140
+ if (manufacturer) {
116
141
  this.cache.deviceBrand = "HONOR";
117
142
  } else {
118
- this.cache.deviceBrand = "";
143
+ // 最后兜底:检查 HKLM:\SOFTWARE\HONOR 注册表键是否存在
144
+ const honorKeyExists = await registryKeyExistsAsync(Registry.HKLM, "\\SOFTWARE\\HONOR");
145
+ if (honorKeyExists) {
146
+ this.cache.deviceBrand = "HONOR";
147
+ } else {
148
+ this.cache.deviceBrand = "";
149
+ }
119
150
  }
120
151
  } catch {
121
152
  // 初始化失败,使用默认值