@honor-claw/yoyo 2026.6.9-beta.2 → 2026.6.9-beta.20

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.
Files changed (237) hide show
  1. package/dist/apis/claw-cloud.mjs +0 -19
  2. package/dist/capabilities/admin/impl.mjs +44 -24
  3. package/dist/capabilities/admin/manager.mjs +21 -19
  4. package/dist/capabilities/node/directory.mjs +10 -0
  5. package/dist/capabilities/node/index.mjs +1 -0
  6. package/dist/capabilities/node/invoke.mjs +27 -22
  7. package/dist/capabilities/node/list.mjs +22 -12
  8. package/dist/capabilities/routing/index.mjs +1 -0
  9. package/dist/capabilities/routing/restart.mjs +17 -0
  10. package/dist/channel/directory.mjs +5 -8
  11. package/dist/channel/messaging.mjs +15 -15
  12. package/dist/{commands → cli}/debug/clean-tools.mjs +1 -1
  13. package/dist/{commands → cli}/debug/impl.mjs +1 -1
  14. package/dist/{commands → cli}/env/impl.mjs +1 -1
  15. package/dist/{commands → cli}/index.mjs +6 -7
  16. package/dist/{commands → cli}/login/impl.mjs +2 -2
  17. package/dist/cli/logout/impl.mjs +29 -0
  18. package/dist/cloud-channel/authorization/refresh-manager.mjs +4 -4
  19. package/dist/cloud-channel/dispatcher/impl.mjs +13 -19
  20. package/dist/cloud-channel/handlers/context/handler.mjs +74 -73
  21. package/dist/cloud-channel/transport/cloud-socket.mjs +43 -69
  22. package/dist/command/diagnose.mjs +9 -0
  23. package/dist/command/doctor.mjs +9 -0
  24. package/dist/command/help.mjs +30 -0
  25. package/dist/command/index.mjs +33 -0
  26. package/dist/command/parser.mjs +19 -0
  27. package/dist/command/status.mjs +9 -0
  28. package/dist/core/hooks/gateway-lifecycle.mjs +9 -11
  29. package/dist/core/hooks/tool-trace.mjs +24 -18
  30. package/dist/core/prompt/builder.mjs +8 -13
  31. package/dist/diagnose/chat-id-resolver.mjs +42 -0
  32. package/dist/diagnose/collector.mjs +29 -0
  33. package/dist/diagnose/collectors/account.mjs +32 -0
  34. package/dist/diagnose/collectors/configuration.mjs +17 -0
  35. package/dist/diagnose/collectors/connection.mjs +7 -0
  36. package/dist/diagnose/collectors/environment.mjs +18 -0
  37. package/dist/diagnose/connection/tracker.mjs +59 -0
  38. package/dist/diagnose/index.mjs +7 -0
  39. package/dist/diagnose/report/diagnose.mjs +72 -0
  40. package/dist/diagnose/report/doctor/device-check.mjs +72 -0
  41. package/dist/diagnose/report/doctor/impl.mjs +95 -0
  42. package/dist/diagnose/report/doctor/index.mjs +1 -0
  43. package/dist/diagnose/report/formatter.mjs +30 -0
  44. package/dist/diagnose/report/index.mjs +5 -0
  45. package/dist/diagnose/report/status.mjs +55 -0
  46. package/dist/diagnose/report/trace.mjs +116 -0
  47. package/dist/gateway/client/admin.mjs +3 -0
  48. package/dist/gateway/client/node.mjs +5 -23
  49. package/dist/gateway/client/protocol.mjs +4 -4
  50. package/dist/gateway/session/manager.mjs +58 -76
  51. package/dist/honor-auth/browser/flow.mjs +1 -1
  52. package/dist/honor-auth/browser/result-page.mjs +125 -75
  53. package/dist/honor-auth/login/impl.mjs +24 -23
  54. package/dist/honor-auth/logout.mjs +6 -6
  55. package/dist/honor-auth/vault/impl.mjs +39 -21
  56. package/dist/honor-auth/vault/token-expiry.mjs +1 -1
  57. package/dist/index.mjs +11 -10
  58. package/dist/messaging/dispatchers/command/impl.mjs +10 -15
  59. package/dist/messaging/dispatchers/stream/controller.mjs +51 -32
  60. package/dist/messaging/dispatchers/stream/error.mjs +47 -25
  61. package/dist/messaging/dispatchers/stream/hooks.mjs +9 -9
  62. package/dist/messaging/dispatchers/stream/index.mjs +1 -0
  63. package/dist/messaging/dispatchers/stream/session.mjs +70 -68
  64. package/dist/messaging/dispatchers/stream/tool/sanitize.mjs +1 -20
  65. package/dist/messaging/guard/constants.mjs +10 -0
  66. package/dist/messaging/guard/content.mjs +31 -0
  67. package/dist/messaging/guard/index.mjs +2 -0
  68. package/dist/messaging/guard/reasoning.mjs +21 -0
  69. package/dist/messaging/guard/snapshot.mjs +6 -0
  70. package/dist/messaging/guard/state.mjs +9 -0
  71. package/dist/messaging/guard/tokens.mjs +28 -0
  72. package/dist/messaging/inbound/agent.mjs +22 -20
  73. package/dist/messaging/inbound/command.mjs +26 -23
  74. package/dist/messaging/inbound/context.mjs +27 -21
  75. package/dist/messaging/inbound/dispatch.mjs +33 -30
  76. package/dist/messaging/inbound/interrupt.mjs +1 -1
  77. package/dist/messaging/inbound/new-session.mjs +1 -1
  78. package/dist/messaging/index.mjs +1 -1
  79. package/dist/messaging/send/text.mjs +22 -13
  80. package/dist/messaging/target/address.mjs +24 -13
  81. package/dist/messaging/target/index.mjs +1 -1
  82. package/dist/messaging/target/outbound.mjs +9 -9
  83. package/dist/messaging/trace/fingerprint.mjs +19 -0
  84. package/dist/messaging/trace/index.mjs +5 -0
  85. package/dist/messaging/trace/lifecycle.mjs +49 -0
  86. package/dist/messaging/trace/query.mjs +25 -0
  87. package/dist/messaging/trace/storage.mjs +59 -0
  88. package/dist/messaging/trace/tool-context.mjs +30 -0
  89. package/dist/messaging/trace/tool.mjs +112 -0
  90. package/dist/modules/configs/channel.mjs +12 -3
  91. package/dist/modules/configs/plugin-init.mjs +36 -44
  92. package/dist/modules/configs/plugin.mjs +4 -7
  93. package/dist/modules/configs/provider.mjs +58 -58
  94. package/dist/modules/device/helpers.mjs +1 -3
  95. package/dist/modules/secure-token/crypto-utils.mjs +1 -1
  96. package/dist/modules/secure-token/token-record.mjs +5 -1
  97. package/dist/modules/secure-token/token-vault.mjs +1 -1
  98. package/dist/provisioning/toolset/ack.mjs +20 -19
  99. package/dist/provisioning/toolset/archive.mjs +1 -2
  100. package/dist/provisioning/toolset/consts.mjs +2 -2
  101. package/dist/provisioning/toolset/copy.mjs +31 -0
  102. package/dist/provisioning/toolset/link.mjs +35 -35
  103. package/dist/provisioning/toolset/normalize.mjs +8 -10
  104. package/dist/provisioning/toolset/skill-refresh-marker.mjs +1 -1
  105. package/dist/tools/index.mjs +5 -5
  106. package/dist/tools/nodes-status/mapper.mjs +10 -14
  107. package/dist/tools/nodes-status/tool.mjs +1 -6
  108. package/dist/tools/plugin-restart/tool.mjs +44 -0
  109. package/dist/types.mjs +6 -0
  110. package/dist/utils/home-dir.mjs +18 -20
  111. package/dist/utils/normalize.mjs +6 -0
  112. package/dist/utils/object.mjs +8 -0
  113. package/dist/utils/version.mjs +23 -15
  114. package/openclaw.plugin.json +1 -1
  115. package/package.json +1 -1
  116. package/skills/yoyo-phone-control/SKILL.md +5 -14
  117. package/skills/yoyo-phone-control/configs/sub-skills.json +1 -15
  118. package/skills/yoyo-phone-control/mcptools/airplane_mode.json +67 -0
  119. package/skills/yoyo-phone-control/mcptools/autoscreen_onnotice.json +63 -0
  120. package/skills/yoyo-phone-control/mcptools/battery.json +66 -0
  121. package/skills/yoyo-phone-control/mcptools/bluetooth.json +78 -0
  122. package/skills/yoyo-phone-control/mcptools/brightness.json +150 -0
  123. package/skills/yoyo-phone-control/mcptools/call.json +107 -0
  124. package/skills/yoyo-phone-control/mcptools/camera.json +146 -0
  125. package/skills/yoyo-phone-control/mcptools/cancel_countdown_timer.json +71 -0
  126. package/skills/yoyo-phone-control/mcptools/capture_screenshot.json +69 -0
  127. package/skills/yoyo-phone-control/mcptools/check_alarm.json +90 -0
  128. package/skills/yoyo-phone-control/mcptools/check_countdown_timer.json +55 -0
  129. package/skills/yoyo-phone-control/mcptools/check_schedule.json +76 -0
  130. package/skills/yoyo-phone-control/mcptools/check_todo.json +72 -0
  131. package/skills/yoyo-phone-control/mcptools/clean_dirty.json +61 -0
  132. package/skills/yoyo-phone-control/mcptools/close_alarm.json +91 -0
  133. package/skills/yoyo-phone-control/mcptools/close_app.json +90 -0
  134. package/skills/yoyo-phone-control/mcptools/close_countdown_timer.json +70 -0
  135. package/skills/yoyo-phone-control/mcptools/create_alarm.json +93 -0
  136. package/skills/yoyo-phone-control/mcptools/create_countdown_timer.json +77 -0
  137. package/skills/yoyo-phone-control/mcptools/create_schedule.json +86 -0
  138. package/skills/yoyo-phone-control/mcptools/create_todo.json +73 -0
  139. package/skills/yoyo-phone-control/mcptools/dark_mode.json +63 -0
  140. package/skills/yoyo-phone-control/mcptools/delete_alarm.json +99 -0
  141. package/skills/yoyo-phone-control/mcptools/delete_schedule.json +107 -0
  142. package/skills/yoyo-phone-control/mcptools/delete_todo.json +35 -0
  143. package/skills/yoyo-phone-control/mcptools/desktop.json +240 -0
  144. package/skills/yoyo-phone-control/mcptools/device_operation.json +122 -0
  145. package/skills/yoyo-phone-control/mcptools/express_logistics_query.json +51 -0
  146. package/skills/yoyo-phone-control/mcptools/eyecomfort.json +76 -0
  147. package/skills/yoyo-phone-control/mcptools/flashlight.json +65 -0
  148. package/skills/yoyo-phone-control/mcptools/get_user_location.json +62 -0
  149. package/skills/yoyo-phone-control/mcptools/gui_task_pause.json +67 -0
  150. package/skills/yoyo-phone-control/mcptools/hotspot.json +66 -0
  151. package/skills/yoyo-phone-control/mcptools/hover_button.json +71 -0
  152. package/skills/yoyo-phone-control/mcptools/local_user_file_search.json +120 -0
  153. package/skills/yoyo-phone-control/mcptools/location_service.json +79 -0
  154. package/skills/yoyo-phone-control/mcptools/mobile_data.json +78 -0
  155. package/skills/yoyo-phone-control/mcptools/modify_schedule.json +107 -0
  156. package/skills/yoyo-phone-control/mcptools/modify_todo.json +35 -0
  157. package/skills/yoyo-phone-control/mcptools/musicFeedbackAction.json +46 -0
  158. package/skills/yoyo-phone-control/mcptools/nfc.json +68 -0
  159. package/skills/yoyo-phone-control/mcptools/no_disturb.json +59 -0
  160. package/skills/yoyo-phone-control/mcptools/onehanded_mode.json +84 -0
  161. package/skills/yoyo-phone-control/mcptools/open_alarm.json +91 -0
  162. package/skills/yoyo-phone-control/mcptools/open_app.json +92 -0
  163. package/skills/yoyo-phone-control/mcptools/open_countdown_timer.json +43 -0
  164. package/skills/yoyo-phone-control/mcptools/open_payment_code.json +83 -0
  165. package/skills/yoyo-phone-control/mcptools/open_transport_code.json +53 -0
  166. package/skills/yoyo-phone-control/mcptools/operateMusic.json +76 -0
  167. package/skills/yoyo-phone-control/mcptools/operateRhythm.json +59 -0
  168. package/skills/yoyo-phone-control/mcptools/operateVideo.json +64 -0
  169. package/skills/yoyo-phone-control/mcptools/pause_countdown_timer.json +71 -0
  170. package/skills/yoyo-phone-control/mcptools/playMusic.json +125 -0
  171. package/skills/yoyo-phone-control/mcptools/playNews.json +35 -0
  172. package/skills/yoyo-phone-control/mcptools/playVideo.json +109 -0
  173. package/skills/yoyo-phone-control/mcptools/play_record.json +56 -0
  174. package/skills/yoyo-phone-control/mcptools/quiet_mode.json +67 -0
  175. package/skills/yoyo-phone-control/mcptools/recognitionMusic.json +54 -0
  176. package/skills/yoyo-phone-control/mcptools/record.json +88 -0
  177. package/skills/yoyo-phone-control/mcptools/redial_recall.json +88 -0
  178. package/skills/yoyo-phone-control/mcptools/restart_countdown_timer.json +71 -0
  179. package/skills/yoyo-phone-control/mcptools/resume_countdown_timer.json +71 -0
  180. package/skills/yoyo-phone-control/mcptools/ringing_mode.json +63 -0
  181. package/skills/yoyo-phone-control/mcptools/scan_code.json +51 -0
  182. package/skills/yoyo-phone-control/mcptools/screen_recorder.json +76 -0
  183. package/skills/yoyo-phone-control/mcptools/search_contact.json +59 -0
  184. package/skills/yoyo-phone-control/mcptools/search_message.json +59 -0
  185. package/skills/yoyo-phone-control/mcptools/search_record.json +72 -0
  186. package/skills/yoyo-phone-control/mcptools/send_message.json +103 -0
  187. package/skills/yoyo-phone-control/mcptools/setMusicPlayMode.json +56 -0
  188. package/skills/yoyo-phone-control/mcptools/status_bar_show.json +91 -0
  189. package/skills/yoyo-phone-control/mcptools/switchMusic.json +66 -0
  190. package/skills/yoyo-phone-control/mcptools/uninstall_app.json +88 -0
  191. package/skills/yoyo-phone-control/mcptools/usb_shared_network.json +62 -0
  192. package/skills/yoyo-phone-control/mcptools/vibration_mode.json +86 -0
  193. package/skills/yoyo-phone-control/mcptools/volume.json +103 -0
  194. package/skills/yoyo-phone-control/mcptools/wlan.json +105 -0
  195. package/skills/yoyo-phone-control/references/gui-task-create.md +11 -3
  196. package/skills/yoyo-phone-control/references/{local_user_data_qa.md → local-user-data-qa.md} +33 -49
  197. package/skills/yoyo-phone-control/references/{local_user_file_search.md → local-user-file-search.md} +27 -27
  198. package/skills/yoyo-phone-control/references/task-result-query.md +1 -1
  199. package/skills/yoyo-update/SKILL.md +55 -11
  200. package/dist/capabilities/cloud-invoke/index.mjs +0 -1
  201. package/dist/capabilities/cloud-invoke/invoke.mjs +0 -43
  202. package/dist/commands/logout/impl.mjs +0 -18
  203. package/dist/commands/status/index.mjs +0 -64
  204. package/dist/core/prompt/cloud-tool.mjs +0 -7
  205. package/dist/messaging/dispatchers/stream/tool/index.mjs +0 -4
  206. package/dist/messaging/dispatchers/stream/tool/trace-store.mjs +0 -120
  207. package/dist/modules/status/channel.mjs +0 -1
  208. package/dist/modules/status/events.mjs +0 -6
  209. package/dist/modules/status/global.mjs +0 -32
  210. package/dist/modules/status/index.mjs +0 -6
  211. package/dist/modules/status/storage.mjs +0 -52
  212. package/dist/modules/status/tracker.mjs +0 -155
  213. package/dist/modules/status/types.mjs +0 -36
  214. package/dist/provisioning/toolset/copy-fallback.mjs +0 -42
  215. package/dist/tools/cloud-invoke/tool.mjs +0 -48
  216. package/dist/utils/array.mjs +0 -6
  217. package/skills/yoyo-phone-control/references/alarm-create.md +0 -356
  218. package/skills/yoyo-phone-control/references/alarm-delete.md +0 -301
  219. package/skills/yoyo-phone-control/references/alarm-disable.md +0 -309
  220. package/skills/yoyo-phone-control/references/alarm-enable.md +0 -309
  221. package/skills/yoyo-phone-control/references/alarm-query.md +0 -411
  222. package/skills/yoyo-phone-control/references/alarm-update.md +0 -386
  223. package/skills/yoyo-phone-control/references/file-upload.md +0 -283
  224. package/skills/yoyo-phone-control/references/local-search.md +0 -221
  225. package/skills/yoyo-phone-control/references/schedule-create.md +0 -483
  226. package/skills/yoyo-phone-control/references/schedule-delete.md +0 -507
  227. package/skills/yoyo-phone-control/references/schedule-search.md +0 -591
  228. package/skills/yoyo-phone-control/references/schedule-update.md +0 -556
  229. package/skills/yoyo-smart-home/SKILL.md +0 -78
  230. package/skills/yoyo-smart-home/mcptools/device_control.json +0 -136
  231. package/skills/yoyo-smart-home/mcptools/device_query.json +0 -114
  232. package/skills/yoyo-smart-home/mcptools/skill_exit.json +0 -6
  233. /package/dist/{commands → cli}/debug/index.mjs +0 -0
  234. /package/dist/{commands → cli}/env/index.mjs +0 -0
  235. /package/dist/{commands → cli}/login/index.mjs +0 -0
  236. /package/dist/{commands → cli}/logout/index.mjs +0 -0
  237. /package/dist/tools/{cloud-invoke → plugin-restart}/index.mjs +0 -0
@@ -69,25 +69,6 @@ var o = class {
69
69
  timeout: r?.timeoutMs ?? 3e4
70
70
  });
71
71
  }
72
- async invokeCloudTool(e, n, r) {
73
- let i = {
74
- "x-trace-id": t(),
75
- "x-jwt-token": n.token
76
- }, a = {
77
- pluginService: { serviceId: r.serviceId },
78
- pluginParams: r.pluginParams,
79
- device: {
80
- deviceId: e.deviceId,
81
- role: "yoyoclaw",
82
- port: e.port
83
- }
84
- };
85
- return this.httpClient.post("/icsplugin/execute", {
86
- headers: i,
87
- body: a,
88
- timeout: r?.timeoutMs ?? 3e4
89
- });
90
- }
91
72
  async exchangeToken(e, r) {
92
73
  let i = t(), o = {
93
74
  "Content-Type": "application/json",
@@ -1,8 +1,9 @@
1
- import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
- import { AdminClientManager as t } from "./manager.mjs";
1
+ import { toErrorMessage as e } from "../../utils/error.mjs";
2
+ import { clawLogger as t } from "../../utils/claw-logger.mjs";
3
+ import { AdminClientManager as n } from "./manager.mjs";
3
4
  //#region src/capabilities/admin/impl.ts
4
- var n = e("capabilities"), r = null, i = class {
5
- manager = new t();
5
+ var r = t("capabilities"), i = null, a = class {
6
+ manager = new n();
6
7
  constructor() {
7
8
  this.manager.init();
8
9
  }
@@ -17,15 +18,15 @@ var n = e("capabilities"), r = null, i = class {
17
18
  }
18
19
  async pairApprove(e) {
19
20
  let t = this.manager.getClient();
20
- if (!t) return n.warn("admin client not available for auto pair"), !1;
21
+ if (!t) return r.warn("admin client not available for auto pair"), !1;
21
22
  try {
22
- let r = await t.devicePairApprove(e);
23
- return r.ok ? (n.info("auto pair approve completed", { ok: !0 }), !0) : (n.warn("auto pair approve rejected", {
23
+ let n = await t.devicePairApprove(e);
24
+ return n.ok ? (r.info("auto pair approve completed", { ok: !0 }), !0) : (r.warn("auto pair approve rejected", {
24
25
  ok: !1,
25
- errorCode: r.error?.code
26
+ errorCode: n.error?.code
26
27
  }), !1);
27
28
  } catch (t) {
28
- return n.error("auto pair approve failed, ignore...", t, { requestId: e }), !1;
29
+ return r.error("auto pair approve failed, ignore...", t, { requestId: e }), !1;
29
30
  }
30
31
  }
31
32
  async setAgentFile(e, t, n) {
@@ -63,37 +64,56 @@ var n = e("capabilities"), r = null, i = class {
63
64
  };
64
65
  }
65
66
  async getModelList() {
66
- let e = this.manager.getClient();
67
- if (!e) return {
67
+ let t = this.manager.getClient();
68
+ if (!t) return {
68
69
  ok: !1,
69
70
  error: "Admin gateway client not ready"
70
71
  };
71
72
  try {
72
73
  return {
73
74
  ok: !0,
74
- data: { models: (await e.getModelList())?.models ?? [] }
75
+ data: { models: (await t.getModelList())?.models ?? [] }
75
76
  };
76
- } catch (e) {
77
- let t = e instanceof Error ? e.message : String(e);
78
- return n.error("fetchModelsList failed", e), {
77
+ } catch (t) {
78
+ let n = e(t);
79
+ return r.error("fetchModelsList failed", t), {
79
80
  ok: !1,
80
- error: `fetchModelsList error: ${t}`
81
+ error: `fetchModelsList error: ${n}`
82
+ };
83
+ }
84
+ }
85
+ async restart(t) {
86
+ let n = this.manager.getClient();
87
+ if (!n) return {
88
+ ok: !1,
89
+ error: "Admin gateway client not ready"
90
+ };
91
+ try {
92
+ return await n.restartGateway(t), r.info("plugin restart command dispatched via admin RPC", { reason: t }), {
93
+ ok: !0,
94
+ data: { dispatched: !0 }
95
+ };
96
+ } catch (t) {
97
+ let n = e(t);
98
+ return r.error("gateway restart RPC failed", t), {
99
+ ok: !1,
100
+ error: `gateway restart failed: ${n}`
81
101
  };
82
102
  }
83
103
  }
84
104
  };
85
- function a() {
86
- return r === null && (r = new i()), r;
87
- }
88
105
  function o() {
89
- return a();
106
+ return i === null && (i = new a()), i;
90
107
  }
91
108
  function s() {
92
- let e = a().ensureConnected();
93
- return n.info("admin gateway connection started", { ready: e }), e;
109
+ return o();
94
110
  }
95
111
  function c() {
96
- a().destroy(), n.info("admin gateway connection stopped");
112
+ let e = o().ensureConnected();
113
+ return r.info("admin gateway connection started", { ready: e }), e;
114
+ }
115
+ function l() {
116
+ o().destroy(), r.info("admin gateway connection stopped");
97
117
  }
98
118
  //#endregion
99
- export { s as startAdminConnection, c as stopAdminConnection, o as useAdminCapability };
119
+ export { c as startAdminConnection, l as stopAdminConnection, s as useAdminCapability };
@@ -1,48 +1,50 @@
1
1
  import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
- import { getGatewayAuthConfig as t } from "../../modules/configs/gateway.mjs";
2
+ import { markAdminAuthenticated as t, markAdminAuthenticating as n, markAdminClosed as r, markAdminError as i, markAdminReconnecting as a } from "../../diagnose/connection/tracker.mjs";
3
+ import { getGatewayAuthConfig as o } from "../../modules/configs/gateway.mjs";
3
4
  import "../../modules/configs/index.mjs";
4
- import n from "../../gateway/client/admin.mjs";
5
- import { StatusEventTypeE as r } from "../../modules/status/events.mjs";
6
- import { emitStatusEvent as i } from "../../modules/status/global.mjs";
5
+ import s from "../../gateway/client/admin.mjs";
7
6
  //#region src/capabilities/admin/manager.ts
8
- var a = e("capabilities"), o = class {
7
+ var c = e("capabilities"), l = class {
9
8
  client = null;
10
9
  ready = !1;
11
10
  pendingReadyRequests = /* @__PURE__ */ new Map();
12
11
  requestIdCounter = 0;
13
12
  init() {
14
13
  if (this.client !== null) return;
15
- let e = t(), o = typeof e?.token == "string" ? e.token : "", s = typeof e?.password == "string" ? e.password : "";
16
- this.client = new n({
17
- token: o,
18
- password: s,
14
+ let e = o(), l = typeof e?.token == "string" ? e.token : "", u = typeof e?.password == "string" ? e.password : "";
15
+ n(), this.client = new s({
16
+ token: l,
17
+ password: u,
19
18
  onAuthenticated: () => {
20
- a.info("admin gateway client authenticated"), this.ready = !0, this.resolveAllPending(!0);
19
+ c.info("admin gateway client authenticated"), t(), this.ready = !0, this.resolveAllPending(!0);
21
20
  },
22
21
  onClose: (e) => {
23
- a.info("admin gateway client closed", { reason: e }), this.ready = !1;
22
+ c.info("admin gateway client closed", { reason: e }), r(e), this.ready = !1;
23
+ },
24
+ onReconnecting: (e, t) => {
25
+ c.info("admin gateway client reconnecting", {
26
+ reason: e,
27
+ retryCount: t
28
+ }), a(e, t), this.ready = !1;
24
29
  },
25
30
  onReconnectFailed: () => {
26
- a.error("admin gateway client reconnect failed, notifying status tracker"), i({
27
- type: r.ADMIN_CLIENT_RECONNECT_FAILED,
28
- data: {}
29
- });
31
+ c.error("admin gateway client reconnect failed"), i("网关管理通道连接重试超限");
30
32
  }
31
33
  });
32
34
  }
33
35
  destroy() {
34
- this.client &&= (this.client.stop(), null), this.ready = !1, this.cancelAllPending(), a.info("admin client destroyed");
36
+ this.client &&= (this.client.stop(), null), this.ready = !1, this.cancelAllPending(), c.info("admin client destroyed");
35
37
  }
36
38
  getClient() {
37
39
  return this.ready && this.client?.isAuthenticated() ? this.client : null;
38
40
  }
39
41
  ensureConnected() {
40
- return this.client === null && (a.info("admin gateway client is null, initializing"), this.init()), this.ready || (a.info("admin gateway client not ready, connecting"), this.client?.connect()), this.client !== null && this.ready;
42
+ return this.client === null && (c.info("admin gateway client is null, initializing"), this.init()), this.ready || (c.info("admin gateway client not ready, connecting"), this.client?.connect()), this.client !== null && this.ready;
41
43
  }
42
44
  waitForReady(e = 5e3) {
43
45
  return this.client !== null && this.ready ? Promise.resolve(!0) : new Promise((t) => {
44
46
  let n = `req_${++this.requestIdCounter}`, r = setTimeout(() => {
45
- this.pendingReadyRequests.delete(n), this.pendingReadyRequests.size === 0 && a.warn("admin gateway client waitForReady timeout, all requests rejected"), t(!1);
47
+ this.pendingReadyRequests.delete(n), this.pendingReadyRequests.size === 0 && c.warn("admin gateway client waitForReady timeout, all requests rejected"), t(!1);
46
48
  }, e);
47
49
  this.pendingReadyRequests.set(n, {
48
50
  resolve: t,
@@ -60,4 +62,4 @@ var a = e("capabilities"), o = class {
60
62
  }
61
63
  };
62
64
  //#endregion
63
- export { o as AdminClientManager };
65
+ export { l as AdminClientManager };
@@ -0,0 +1,10 @@
1
+ import { listNodeDevices as e } from "./list.mjs";
2
+ //#region src/capabilities/node/directory.ts
3
+ async function t() {
4
+ return (await e()).devices;
5
+ }
6
+ async function n(t) {
7
+ return (await e({ deviceIdList: [t] })).devices.find((e) => e.deviceId === t);
8
+ }
9
+ //#endregion
10
+ export { n as getDeviceWithStatus, t as listDevicesWithStatus };
@@ -1,3 +1,4 @@
1
1
  import "./list.mjs";
2
+ import "./directory.mjs";
2
3
  import "./invoke.mjs";
3
4
  import "./types.mjs";
@@ -2,10 +2,12 @@ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
2
  import { buildEndpoint as t } from "../../cloud-channel/protocol/target.mjs";
3
3
  import { resolveEnabledYoyoAccountId as n } from "../../modules/configs/channel.mjs";
4
4
  import { ClawClient as r } from "../../connection/registry.mjs";
5
+ import { getToolCallContext as i } from "../../messaging/trace/tool-context.mjs";
6
+ import "../../messaging/trace/index.mjs";
5
7
  //#region src/capabilities/node/invoke.ts
6
- var i = e("capabilities");
7
- async function a(e) {
8
- let i = {
8
+ var a = e("capabilities");
9
+ async function o(e) {
10
+ let a = i(e.toolCallId) ?? void 0, o = {
9
11
  to: t("node", e.nodeId),
10
12
  msgType: "nodeInvokeRequest",
11
13
  data: { node: {
@@ -13,28 +15,31 @@ async function a(e) {
13
15
  nodeId: e.nodeId,
14
16
  name: e.name,
15
17
  ...e.params ? { params: { arguments: JSON.stringify(e.params) } } : {}
16
- } }
17
- }, a = n();
18
- return r.forAccount(a).request(i, {
18
+ } },
19
+ ...a ? { traceInfo: a } : {}
20
+ }, c = n();
21
+ return r.forAccount(c).request(o, {
19
22
  timeoutMs: e.timeoutMs,
20
- matchResult: o
23
+ matchResult: s(e.toolCallId)
21
24
  });
22
25
  }
23
- function o(e) {
24
- if (e.payload.msgType !== "nodeInvokeResult") return { matched: !1 };
25
- let t = e.data?.node;
26
- return !t || typeof t.runStatus != "number" || !t.nodeId || !t.toolCallId ? (i.warn("nodeInvokeResult missing required fields", { node: t }), {
27
- matched: !0,
28
- error: "missing required fields in invoke result"
29
- }) : {
30
- matched: !0,
31
- result: {
32
- nodeId: t.nodeId,
33
- toolCallId: t.toolCallId,
34
- runStatus: t.runStatus,
35
- result: t.result
36
- }
26
+ function s(e) {
27
+ return (t) => {
28
+ if (t.payload.msgType !== "nodeInvokeResult") return { matched: !1 };
29
+ let n = t.data?.node;
30
+ return !n || n.toolCallId !== e ? { matched: !1 } : typeof n.runStatus != "number" || !n.nodeId ? (a.warn("nodeInvokeResult missing required fields", { node: n }), {
31
+ matched: !0,
32
+ error: "missing required fields in invoke result"
33
+ }) : {
34
+ matched: !0,
35
+ result: {
36
+ nodeId: n.nodeId,
37
+ toolCallId: e,
38
+ runStatus: n.runStatus,
39
+ result: n.result
40
+ }
41
+ };
37
42
  };
38
43
  }
39
44
  //#endregion
40
- export { a as invokeNodeTool };
45
+ export { o as invokeNodeTool };
@@ -8,32 +8,42 @@ import "../../modules/device/index.mjs";
8
8
  import "../../honor-auth/vault/index.mjs";
9
9
  import "../../apis/index.mjs";
10
10
  import { ToolError as o } from "../../tools/error.mjs";
11
+ import { DeviceStatus as s } from "../../types.mjs";
11
12
  //#region src/capabilities/node/list.ts
12
- var s = t("capabilities");
13
- async function c(t) {
14
- let c = await n.fromUser().current();
15
- if (!c?.token || !c.userId) throw s.error("node device list skipped: no current user"), new o("unauthorized", "missing current user token");
16
- let l;
13
+ var c = t("capabilities");
14
+ function l(e) {
15
+ return {
16
+ deviceId: e.deviceId,
17
+ ...e.deviceName ? { deviceName: e.deviceName } : {},
18
+ deviceType: e.deviceType ?? "unknown",
19
+ deviceModel: e.deviceModel ?? "",
20
+ online: e.status === s.Online
21
+ };
22
+ }
23
+ async function u(t) {
24
+ let s = await n.fromUser().current();
25
+ if (!s?.token || !s.userId) throw c.error("node device list skipped: no current user"), new o("unauthorized", "missing current user token");
26
+ let u;
17
27
  try {
18
- l = await a();
28
+ u = await a();
19
29
  } catch (e) {
20
- throw s.error("node device list failed to get device info", e), new o("device_info", "failed to get device info", { cause: e });
30
+ throw c.error("node device list failed to get device info", e), new o("device_info", "failed to get device info", { cause: e });
21
31
  }
22
32
  try {
23
- let e = await i().getDeviceList(l, c, { deviceIdList: t?.deviceIdList });
33
+ let e = await i().getDeviceList(u, s, { deviceIdList: t?.deviceIdList });
24
34
  if (!r(e)) {
25
35
  let t = e.data?.code, n = e.data?.cnMessage;
26
- throw s.error("node device list response not ok", null, {
36
+ throw c.error("node device list response not ok", null, {
27
37
  status: e.status,
28
38
  code: t,
29
39
  cnMessage: n
30
40
  }), new o("api_failed", `code=${t} message=${n}`);
31
41
  }
32
42
  let n = e.data.data?.deviceList;
33
- return { devices: Array.isArray(n) ? n : [] };
43
+ return { devices: Array.isArray(n) ? n.map(l) : [] };
34
44
  } catch (t) {
35
- throw t instanceof o ? t : (s.error("node device list failed", t), new o("network_error", e(t), { cause: t }));
45
+ throw t instanceof o ? t : (c.error("node device list failed", t), new o("network_error", e(t), { cause: t }));
36
46
  }
37
47
  }
38
48
  //#endregion
39
- export { c as listNodeDevices };
49
+ export { u as listNodeDevices };
@@ -1,3 +1,4 @@
1
1
  import "./route.mjs";
2
2
  import "./list.mjs";
3
3
  import "./model-switch.mjs";
4
+ import "./restart.mjs";
@@ -0,0 +1,17 @@
1
+ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
+ import { useAdminCapability as t } from "../admin/impl.mjs";
3
+ import "../admin/index.mjs";
4
+ //#region src/capabilities/routing/restart.ts
5
+ var n = e("routing");
6
+ async function r(e) {
7
+ let r = await t().restart(e);
8
+ return n.info("plugin restart command dispatched", {
9
+ ok: r.ok,
10
+ reason: e
11
+ }), r.ok ? { ok: !0 } : {
12
+ ok: !1,
13
+ error: r.error
14
+ };
15
+ }
16
+ //#endregion
17
+ export { r as restartGateway };
@@ -3,13 +3,13 @@ import "../capabilities/node/index.mjs";
3
3
  //#region src/channel/directory.ts
4
4
  async function t(t) {
5
5
  try {
6
- return i((await e()).devices.filter((e) => r(e)).map((e) => n(e)), t);
6
+ return r((await e()).devices.map((e) => n(e)), t);
7
7
  } catch {
8
8
  return [];
9
9
  }
10
10
  }
11
11
  function n(e) {
12
- let t = e.deviceId.trim(), n = e.deviceName?.trim() || t;
12
+ let t = e.deviceId, n = e.deviceName || t;
13
13
  return {
14
14
  kind: "user",
15
15
  id: `device:${t}`,
@@ -18,10 +18,7 @@ function n(e) {
18
18
  raw: { deviceId: t }
19
19
  };
20
20
  }
21
- function r(e) {
22
- return typeof e.deviceId == "string" && e.deviceId.trim().length > 0;
23
- }
24
- function i(e, t) {
21
+ function r(e, t) {
25
22
  let n = t.query?.trim().toLowerCase(), r = n ? e.filter((e) => [
26
23
  e.id,
27
24
  e.name,
@@ -29,10 +26,10 @@ function i(e, t) {
29
26
  ].filter((e) => typeof e == "string").some((e) => e.toLowerCase().includes(n))) : e;
30
27
  return typeof t.limit == "number" && t.limit >= 0 ? r.slice(0, t.limit) : r;
31
28
  }
32
- var a = {
29
+ var i = {
33
30
  self: async () => null,
34
31
  listPeers: async (e) => t(e),
35
32
  listGroups: async () => []
36
33
  };
37
34
  //#endregion
38
- export { a as yoyoDirectory };
35
+ export { i as yoyoDirectory };
@@ -1,33 +1,33 @@
1
1
  import { YOYO_CHANNEL_ID as e } from "../consts.mjs";
2
- import { buildChatTo as t, buildFrom as n, readChatIdFromTo as r, readDeviceIdFromTo as i } from "../messaging/target/address.mjs";
3
- import { buildChatId as a, looksLikeChatId as o } from "../messaging/target/chat-id.mjs";
2
+ import { buildChatId as t, looksLikeChatId as n } from "../messaging/target/chat-id.mjs";
3
+ import { buildChatTo as r, buildFrom as i, readChatIdFromTo as a, readDeviceIdFromTo as o } from "../messaging/target/address.mjs";
4
4
  import { resolveOutboundTarget as s } from "../messaging/target/outbound.mjs";
5
5
  import { buildChannelOutboundSessionRoute as c, stripChannelTargetPrefix as l } from "openclaw/plugin-sdk/channel-core";
6
6
  //#region src/channel/messaging.ts
7
7
  function u(t) {
8
8
  let n = l(t, e).trim();
9
- return d(t, n) ? n : void 0;
9
+ return d(n) ? n : void 0;
10
10
  }
11
- function d(e, t = e) {
12
- let n = t.trim(), a = r(n);
13
- if (a !== void 0) return a.length > 0 && o(a);
14
- let s = i(n);
15
- return s !== void 0 && s.trim().length > 0;
11
+ function d(e) {
12
+ let t = a(e);
13
+ if (t !== void 0) return t.length > 0 && n(t);
14
+ let r = o(e);
15
+ return r !== void 0 && r.length > 0;
16
16
  }
17
- async function f(r, i, o) {
18
- let s = await a(i, o);
17
+ async function f(n, a, o) {
18
+ let s = await t(a, o);
19
19
  return c({
20
- cfg: r.cfg,
21
- agentId: r.agentId,
20
+ cfg: n.cfg,
21
+ agentId: n.agentId,
22
22
  channel: e,
23
- accountId: i,
23
+ accountId: a,
24
24
  peer: {
25
25
  kind: "direct",
26
26
  id: s
27
27
  },
28
28
  chatType: "direct",
29
- from: n(s),
30
- to: t(s)
29
+ from: i(s),
30
+ to: r(s)
31
31
  });
32
32
  }
33
33
  async function p(e) {
@@ -1,7 +1,7 @@
1
1
  import { toErrorMessage as e } from "../../utils/error.mjs";
2
2
  import { cleanDeviceToolSetArtifacts as t } from "../../provisioning/toolset/cleanup.mjs";
3
3
  import "../../provisioning/toolset/index.mjs";
4
- //#region src/commands/debug/clean-tools.ts
4
+ //#region src/cli/debug/clean-tools.ts
5
5
  function n(n) {
6
6
  n.command("clean-tools").description("Wipe cached device toolset data (tools archive, device-toolsets.json, toolset-md5.json) and restore SKILL.md placeholder").action(async () => {
7
7
  try {
@@ -1,5 +1,5 @@
1
1
  import { registerCleanToolsCommand as e } from "./clean-tools.mjs";
2
- //#region src/commands/debug/impl.ts
2
+ //#region src/cli/debug/impl.ts
3
3
  function t(t, n) {
4
4
  e(n.command("debug").description("Internal debugging helpers for the yoyo plugin"));
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import { withCommandRuntime as e } from "../../core/runtime.mjs";
2
2
  import { getEnvAndGray as t, resetEnv as n, updateEnv as r, updateGrayTag as i } from "../../modules/configs/plugin.mjs";
3
3
  import "../../modules/configs/index.mjs";
4
- //#region src/commands/env/impl.ts
4
+ //#region src/cli/env/impl.ts
5
5
  var a = {
6
6
  env: "environment variable",
7
7
  manual: "manual config"
@@ -7,13 +7,12 @@ import { registerLoginCommand as r } from "./login/impl.mjs";
7
7
  import "./login/index.mjs";
8
8
  import { registerLogoutCommand as i } from "./logout/impl.mjs";
9
9
  import "./logout/index.mjs";
10
- import { registerStatusCommand as a } from "./status/index.mjs";
11
- //#region src/commands/index.ts
12
- function o(o) {
13
- o.registerCli((s) => {
14
- let c = s.program.command("honor").description("Commands for honor yoyoclaw");
15
- r(o, c), a(o, c), i(o, c), t(o, c), e() && n(o, c);
10
+ //#region src/cli/index.ts
11
+ function a(a) {
12
+ a.registerCli((o) => {
13
+ let s = o.program.command("honor").description("Commands for Honor yoyoclaw");
14
+ r(a, s), i(a, s), e() && (n(a, s), t(a, s));
16
15
  }, { commands: ["honor"] });
17
16
  }
18
17
  //#endregion
19
- export { o as registerCommands };
18
+ export { a as registerCliCommands };
@@ -5,10 +5,10 @@ import { patchYoyoChannelConfig as i, resolveEnabledYoyoAccountId as a, setAllYo
5
5
  import "../../modules/configs/index.mjs";
6
6
  import { performLogin as c } from "../../honor-auth/login/impl.mjs";
7
7
  import "../../honor-auth/index.mjs";
8
- //#region src/commands/login/impl.ts
8
+ //#region src/cli/login/impl.ts
9
9
  var l = t("login-cli");
10
10
  function u(t, u) {
11
- u.command("login").description("login to yoyoclaw and register devices").option("-u, --uid <userId>", "login with a specific user ID").option("--token <token>", "login with a specific token").action(async (u) => e(t.runtime, async () => {
11
+ u.command("login").description("login to Honor and register devices").option("-u, --uid <userId>", "login with a specific user ID").option("--token <token>", "login with a specific token").action(async (u) => e(t.runtime, async () => {
12
12
  let { token: e } = u;
13
13
  l.debug("login CLI command called");
14
14
  let t = a(), d = await c({ token: e });
@@ -0,0 +1,29 @@
1
+ import { withCommandRuntime as e } from "../../core/runtime.mjs";
2
+ import { toErrorMessage as t } from "../../utils/error.mjs";
3
+ import { clawLogger as n } from "../../utils/claw-logger.mjs";
4
+ import { loadConfig as r, saveConfig as i } from "../../modules/configs/config-store.mjs";
5
+ import { removeYoyoChannelAccount as a, resolveEnabledYoyoAccountId as o } from "../../modules/configs/channel.mjs";
6
+ import "../../modules/configs/index.mjs";
7
+ import { performLogout as s } from "../../honor-auth/logout.mjs";
8
+ //#region src/cli/logout/impl.ts
9
+ var c = n("logout-cli");
10
+ function l(n, l) {
11
+ l.command("logout").description("Logout and clear user configuration").action(async () => e(n.runtime, async () => {
12
+ c.info("logout CLI command called");
13
+ let e = o();
14
+ try {
15
+ await s(e);
16
+ try {
17
+ await i(a(r(), e));
18
+ } catch (t) {
19
+ c.error("failed to remove channel account after logout", t, { userId: e });
20
+ }
21
+ console.log("✅ Logout successful, gateway will automatically stop the account connection");
22
+ } catch (e) {
23
+ let n = t(e);
24
+ console.error("🚫 Logout failed:", n);
25
+ }
26
+ }));
27
+ }
28
+ //#endregion
29
+ export { l as registerLogoutCommand };
@@ -34,14 +34,14 @@ var r = e("cloud-auth"), i = class {
34
34
  }
35
35
  async applyNewToken(e) {
36
36
  let t = e?.accessToken;
37
- if (typeof t != "string" || !t.trim()) return r.warn("updateAuthorization missing valid access token"), !1;
37
+ if (typeof t != "string" || t.length === 0) return r.warn("updateAuthorization missing valid access token"), !1;
38
38
  try {
39
- let n = Date.now(), i = t.trim(), a = await this.account.update({
40
- accessToken: i,
39
+ let n = Date.now(), i = await this.account.update({
40
+ accessToken: t,
41
41
  expire: e?.expire,
42
42
  grantedAt: n
43
43
  });
44
- return r.info("cached new token to vault", { accountKey: a.userId }), !0;
44
+ return r.info("cached new token to vault", { accountKey: i.userId }), !0;
45
45
  } catch (e) {
46
46
  return r.error("failed to cache new token", e), !1;
47
47
  }
@@ -21,13 +21,10 @@ function s(e) {
21
21
  send: u,
22
22
  async request(e, t) {
23
23
  let { matchResult: r, timeoutMs: i } = t, s = n();
24
- if (!await u({
25
- ...e,
26
- traceInfo: { traceId: s }
27
- })) throw Error("send failed");
24
+ if (!await u(e)) throw Error("send failed");
28
25
  return new Promise((e, t) => {
29
26
  let n = setTimeout(() => {
30
- l.has(s) && (l.delete(s), o.warn("request timeout", { traceId: s }), t(/* @__PURE__ */ Error("request timeout")));
27
+ l.has(s) && (l.delete(s), o.warn("request timeout", { requestId: s }), t(/* @__PURE__ */ Error("request timeout")));
31
28
  }, a(i));
32
29
  l.set(s, {
33
30
  timeout: n,
@@ -38,25 +35,22 @@ function s(e) {
38
35
  });
39
36
  },
40
37
  consume(e) {
41
- let t = e.payload.traceInfo?.traceId;
42
- if (!t) return;
43
- let n = l.get(t);
44
- if (n) {
38
+ for (let [t, n] of l) {
39
+ let r;
45
40
  try {
46
- let r = n.matchResult(e);
47
- if (r.matched) {
48
- if (l.delete(t), clearTimeout(n.timeout), "error" in r) {
49
- n.reject(r.error);
50
- return;
51
- }
52
- n.resolve(r.result);
53
- return;
54
- }
41
+ r = n.matchResult(e);
55
42
  } catch (e) {
56
43
  o.error("match request result failed", e);
44
+ continue;
45
+ }
46
+ if (r?.matched) {
47
+ if (l.delete(t), clearTimeout(n.timeout), "error" in r) {
48
+ n.reject(r.error);
49
+ return;
50
+ }
51
+ n.resolve(r.result);
57
52
  return;
58
53
  }
59
- o.warn("response shape not matched, keep pending", { traceId: t });
60
54
  }
61
55
  },
62
56
  destroy() {