@honor-claw/yoyo 2026.6.9-beta.3 → 2026.6.9-beta.5

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 (197) hide show
  1. package/dist/apis/claw-cloud.mjs +0 -19
  2. package/dist/capabilities/admin/impl.mjs +25 -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/list.mjs +22 -12
  7. package/dist/channel/directory.mjs +5 -8
  8. package/dist/channel/messaging.mjs +6 -6
  9. package/dist/{commands → cli}/debug/clean-tools.mjs +1 -1
  10. package/dist/{commands → cli}/debug/impl.mjs +1 -1
  11. package/dist/{commands → cli}/env/impl.mjs +1 -1
  12. package/dist/{commands → cli}/index.mjs +6 -7
  13. package/dist/{commands → cli}/login/impl.mjs +1 -1
  14. package/dist/cli/logout/impl.mjs +19 -0
  15. package/dist/cloud-channel/authorization/refresh-manager.mjs +4 -4
  16. package/dist/cloud-channel/handlers/context/handler.mjs +74 -73
  17. package/dist/cloud-channel/transport/cloud-socket.mjs +41 -70
  18. package/dist/command/context.mjs +20 -0
  19. package/dist/command/diagnose.mjs +10 -0
  20. package/dist/command/doctor.mjs +9 -0
  21. package/dist/command/help.mjs +30 -0
  22. package/dist/command/index.mjs +33 -0
  23. package/dist/command/parser.mjs +19 -0
  24. package/dist/command/status.mjs +9 -0
  25. package/dist/core/hooks/gateway-lifecycle.mjs +9 -11
  26. package/dist/core/prompt/builder.mjs +8 -13
  27. package/dist/diagnose/collector.mjs +29 -0
  28. package/dist/diagnose/collectors/account.mjs +32 -0
  29. package/dist/diagnose/collectors/configuration.mjs +17 -0
  30. package/dist/diagnose/collectors/connection.mjs +7 -0
  31. package/dist/diagnose/collectors/environment.mjs +18 -0
  32. package/dist/diagnose/connection/tracker.mjs +59 -0
  33. package/dist/diagnose/index.mjs +6 -0
  34. package/dist/diagnose/report/diagnose.mjs +67 -0
  35. package/dist/diagnose/report/doctor.mjs +121 -0
  36. package/dist/diagnose/report/formatter.mjs +32 -0
  37. package/dist/diagnose/report/index.mjs +4 -0
  38. package/dist/diagnose/report/status.mjs +68 -0
  39. package/dist/diagnose/report/trace.mjs +69 -0
  40. package/dist/gateway/client/node.mjs +5 -23
  41. package/dist/gateway/client/protocol.mjs +4 -4
  42. package/dist/gateway/session/manager.mjs +58 -76
  43. package/dist/honor-auth/browser/flow.mjs +1 -1
  44. package/dist/honor-auth/login/impl.mjs +24 -23
  45. package/dist/honor-auth/vault/impl.mjs +39 -21
  46. package/dist/honor-auth/vault/token-expiry.mjs +1 -1
  47. package/dist/index.mjs +10 -9
  48. package/dist/messaging/dispatchers/command/impl.mjs +9 -9
  49. package/dist/messaging/dispatchers/stream/controller.mjs +48 -27
  50. package/dist/messaging/dispatchers/stream/error.mjs +34 -25
  51. package/dist/messaging/dispatchers/stream/hooks.mjs +9 -9
  52. package/dist/messaging/dispatchers/stream/index.mjs +1 -0
  53. package/dist/messaging/dispatchers/stream/session.mjs +70 -68
  54. package/dist/messaging/dispatchers/stream/tool/sanitize.mjs +1 -20
  55. package/dist/messaging/guard/constants.mjs +10 -0
  56. package/dist/messaging/guard/content.mjs +31 -0
  57. package/dist/messaging/guard/index.mjs +2 -0
  58. package/dist/messaging/guard/reasoning.mjs +21 -0
  59. package/dist/messaging/guard/snapshot.mjs +6 -0
  60. package/dist/messaging/guard/state.mjs +9 -0
  61. package/dist/messaging/guard/tokens.mjs +28 -0
  62. package/dist/messaging/inbound/agent.mjs +22 -20
  63. package/dist/messaging/inbound/command.mjs +26 -23
  64. package/dist/messaging/inbound/context.mjs +15 -12
  65. package/dist/messaging/inbound/dispatch.mjs +33 -30
  66. package/dist/messaging/send/text.mjs +22 -13
  67. package/dist/messaging/trace/fingerprint.mjs +19 -0
  68. package/dist/messaging/trace/index.mjs +4 -0
  69. package/dist/messaging/trace/lifecycle.mjs +43 -0
  70. package/dist/messaging/trace/query.mjs +25 -0
  71. package/dist/messaging/trace/storage.mjs +57 -0
  72. package/dist/messaging/trace/tool.mjs +112 -0
  73. package/dist/modules/configs/plugin-init.mjs +1 -5
  74. package/dist/modules/configs/plugin.mjs +4 -7
  75. package/dist/modules/configs/provider.mjs +58 -58
  76. package/dist/modules/device/helpers.mjs +1 -3
  77. package/dist/modules/secure-token/crypto-utils.mjs +1 -1
  78. package/dist/modules/secure-token/token-record.mjs +5 -1
  79. package/dist/modules/secure-token/token-vault.mjs +1 -1
  80. package/dist/provisioning/toolset/ack.mjs +20 -19
  81. package/dist/provisioning/toolset/archive.mjs +1 -2
  82. package/dist/provisioning/toolset/consts.mjs +2 -2
  83. package/dist/provisioning/toolset/copy.mjs +31 -0
  84. package/dist/provisioning/toolset/link.mjs +35 -35
  85. package/dist/provisioning/toolset/normalize.mjs +8 -10
  86. package/dist/provisioning/toolset/skill-refresh-marker.mjs +1 -1
  87. package/dist/tools/index.mjs +5 -7
  88. package/dist/tools/nodes-status/mapper.mjs +10 -14
  89. package/dist/tools/nodes-status/tool.mjs +1 -6
  90. package/dist/types.mjs +6 -0
  91. package/dist/utils/home-dir.mjs +18 -20
  92. package/dist/utils/normalize.mjs +6 -0
  93. package/dist/utils/version.mjs +16 -13
  94. package/openclaw.plugin.json +1 -1
  95. package/package.json +1 -1
  96. package/skills/yoyo-phone-control/mcptools/airplane_mode.json +76 -0
  97. package/skills/yoyo-phone-control/mcptools/autoscreen_onnotice.json +72 -0
  98. package/skills/yoyo-phone-control/mcptools/battery.json +66 -0
  99. package/skills/yoyo-phone-control/mcptools/bluetooth.json +87 -0
  100. package/skills/yoyo-phone-control/mcptools/brightness.json +150 -0
  101. package/skills/yoyo-phone-control/mcptools/call.json +112 -0
  102. package/skills/yoyo-phone-control/mcptools/camera.json +147 -0
  103. package/skills/yoyo-phone-control/mcptools/cancel_countdown_timer.json +72 -0
  104. package/skills/yoyo-phone-control/mcptools/capture_screenshot.json +70 -0
  105. package/skills/yoyo-phone-control/mcptools/check_alarm.json +91 -0
  106. package/skills/yoyo-phone-control/mcptools/check_countdown_timer.json +56 -0
  107. package/skills/yoyo-phone-control/mcptools/check_schedule.json +77 -0
  108. package/skills/yoyo-phone-control/mcptools/check_todo.json +73 -0
  109. package/skills/yoyo-phone-control/mcptools/clean_dirty.json +62 -0
  110. package/skills/yoyo-phone-control/mcptools/close_alarm.json +92 -0
  111. package/skills/yoyo-phone-control/mcptools/close_app.json +91 -0
  112. package/skills/yoyo-phone-control/mcptools/close_countdown_timer.json +71 -0
  113. package/skills/yoyo-phone-control/mcptools/create_alarm.json +90 -0
  114. package/skills/yoyo-phone-control/mcptools/create_countdown_timer.json +78 -0
  115. package/skills/yoyo-phone-control/mcptools/create_schedule.json +87 -0
  116. package/skills/yoyo-phone-control/mcptools/create_todo.json +74 -0
  117. package/skills/yoyo-phone-control/mcptools/dark_mode.json +72 -0
  118. package/skills/yoyo-phone-control/mcptools/delete_alarm.json +100 -0
  119. package/skills/yoyo-phone-control/mcptools/delete_schedule.json +108 -0
  120. package/skills/yoyo-phone-control/mcptools/delete_todo.json +35 -0
  121. package/skills/yoyo-phone-control/mcptools/desktop.json +240 -0
  122. package/skills/yoyo-phone-control/mcptools/device_operation.json +123 -0
  123. package/skills/yoyo-phone-control/mcptools/express_logistics_query.json +51 -0
  124. package/skills/yoyo-phone-control/mcptools/eyecomfort.json +85 -0
  125. package/skills/yoyo-phone-control/mcptools/flashlight.json +66 -0
  126. package/skills/yoyo-phone-control/mcptools/get_user_location.json +62 -0
  127. package/skills/yoyo-phone-control/mcptools/gui_task_pause.json +67 -0
  128. package/skills/yoyo-phone-control/mcptools/hotspot.json +75 -0
  129. package/skills/yoyo-phone-control/mcptools/hover_button.json +80 -0
  130. package/skills/yoyo-phone-control/mcptools/local_user_file_search.json +120 -0
  131. package/skills/yoyo-phone-control/mcptools/location_service.json +80 -0
  132. package/skills/yoyo-phone-control/mcptools/mobile_data.json +87 -0
  133. package/skills/yoyo-phone-control/mcptools/modify_schedule.json +108 -0
  134. package/skills/yoyo-phone-control/mcptools/modify_todo.json +35 -0
  135. package/skills/yoyo-phone-control/mcptools/musicFeedbackAction.json +46 -0
  136. package/skills/yoyo-phone-control/mcptools/nfc.json +77 -0
  137. package/skills/yoyo-phone-control/mcptools/no_disturb.json +64 -0
  138. package/skills/yoyo-phone-control/mcptools/onehanded_mode.json +84 -0
  139. package/skills/yoyo-phone-control/mcptools/open_alarm.json +92 -0
  140. package/skills/yoyo-phone-control/mcptools/open_app.json +93 -0
  141. package/skills/yoyo-phone-control/mcptools/open_countdown_timer.json +43 -0
  142. package/skills/yoyo-phone-control/mcptools/open_payment_code.json +83 -0
  143. package/skills/yoyo-phone-control/mcptools/open_transport_code.json +53 -0
  144. package/skills/yoyo-phone-control/mcptools/operateMusic.json +76 -0
  145. package/skills/yoyo-phone-control/mcptools/operateRhythm.json +59 -0
  146. package/skills/yoyo-phone-control/mcptools/operateVideo.json +64 -0
  147. package/skills/yoyo-phone-control/mcptools/pause_countdown_timer.json +72 -0
  148. package/skills/yoyo-phone-control/mcptools/playMusic.json +125 -0
  149. package/skills/yoyo-phone-control/mcptools/playNews.json +35 -0
  150. package/skills/yoyo-phone-control/mcptools/playVideo.json +109 -0
  151. package/skills/yoyo-phone-control/mcptools/play_record.json +56 -0
  152. package/skills/yoyo-phone-control/mcptools/quiet_mode.json +68 -0
  153. package/skills/yoyo-phone-control/mcptools/recognitionMusic.json +54 -0
  154. package/skills/yoyo-phone-control/mcptools/record.json +89 -0
  155. package/skills/yoyo-phone-control/mcptools/redial_recall.json +88 -0
  156. package/skills/yoyo-phone-control/mcptools/restart_countdown_timer.json +72 -0
  157. package/skills/yoyo-phone-control/mcptools/resume_countdown_timer.json +72 -0
  158. package/skills/yoyo-phone-control/mcptools/ringing_mode.json +64 -0
  159. package/skills/yoyo-phone-control/mcptools/scan_code.json +52 -0
  160. package/skills/yoyo-phone-control/mcptools/screen_recorder.json +81 -0
  161. package/skills/yoyo-phone-control/mcptools/search_contact.json +60 -0
  162. package/skills/yoyo-phone-control/mcptools/search_message.json +60 -0
  163. package/skills/yoyo-phone-control/mcptools/search_record.json +72 -0
  164. package/skills/yoyo-phone-control/mcptools/send_message.json +103 -0
  165. package/skills/yoyo-phone-control/mcptools/setMusicPlayMode.json +56 -0
  166. package/skills/yoyo-phone-control/mcptools/status_bar_show.json +100 -0
  167. package/skills/yoyo-phone-control/mcptools/switchMusic.json +66 -0
  168. package/skills/yoyo-phone-control/mcptools/uninstall_app.json +89 -0
  169. package/skills/yoyo-phone-control/mcptools/usb_shared_network.json +71 -0
  170. package/skills/yoyo-phone-control/mcptools/vibration_mode.json +95 -0
  171. package/skills/yoyo-phone-control/mcptools/volume.json +112 -0
  172. package/skills/yoyo-phone-control/mcptools/wlan.json +114 -0
  173. package/dist/capabilities/cloud-invoke/index.mjs +0 -1
  174. package/dist/capabilities/cloud-invoke/invoke.mjs +0 -43
  175. package/dist/commands/logout/impl.mjs +0 -18
  176. package/dist/commands/status/index.mjs +0 -64
  177. package/dist/core/prompt/cloud-tool.mjs +0 -7
  178. package/dist/messaging/dispatchers/stream/tool/index.mjs +0 -4
  179. package/dist/messaging/dispatchers/stream/tool/trace-store.mjs +0 -120
  180. package/dist/modules/status/channel.mjs +0 -1
  181. package/dist/modules/status/events.mjs +0 -6
  182. package/dist/modules/status/global.mjs +0 -32
  183. package/dist/modules/status/index.mjs +0 -6
  184. package/dist/modules/status/storage.mjs +0 -52
  185. package/dist/modules/status/tracker.mjs +0 -155
  186. package/dist/modules/status/types.mjs +0 -36
  187. package/dist/provisioning/toolset/copy-fallback.mjs +0 -42
  188. package/dist/tools/cloud-invoke/index.mjs +0 -1
  189. package/dist/tools/cloud-invoke/tool.mjs +0 -48
  190. package/skills/yoyo-smart-home/SKILL.md +0 -78
  191. package/skills/yoyo-smart-home/mcptools/device_control.json +0 -136
  192. package/skills/yoyo-smart-home/mcptools/device_query.json +0 -114
  193. package/skills/yoyo-smart-home/mcptools/skill_exit.json +0 -6
  194. /package/dist/{commands → cli}/debug/index.mjs +0 -0
  195. /package/dist/{commands → cli}/env/index.mjs +0 -0
  196. /package/dist/{commands → cli}/login/index.mjs +0 -0
  197. /package/dist/{commands → cli}/logout/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,37 @@ 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}`
81
82
  };
82
83
  }
83
84
  }
84
85
  };
85
- function a() {
86
- return r === null && (r = new i()), r;
87
- }
88
86
  function o() {
89
- return a();
87
+ return i === null && (i = new a()), i;
90
88
  }
91
89
  function s() {
92
- let e = a().ensureConnected();
93
- return n.info("admin gateway connection started", { ready: e }), e;
90
+ return o();
94
91
  }
95
92
  function c() {
96
- a().destroy(), n.info("admin gateway connection stopped");
93
+ let e = o().ensureConnected();
94
+ return r.info("admin gateway connection started", { ready: e }), e;
95
+ }
96
+ function l() {
97
+ o().destroy(), r.info("admin gateway connection stopped");
97
98
  }
98
99
  //#endregion
99
- export { s as startAdminConnection, c as stopAdminConnection, o as useAdminCapability };
100
+ 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)?.online ?? !1;
8
+ }
9
+ //#endregion
10
+ export { n as isDeviceReachable, 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";
@@ -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 };
@@ -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 };
@@ -6,13 +6,13 @@ import { buildChannelOutboundSessionRoute as c, stripChannelTargetPrefix as l }
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 = r(e);
13
+ if (t !== void 0) return t.length > 0 && o(t);
14
+ let n = i(e);
15
+ return n !== void 0 && n.length > 0;
16
16
  }
17
17
  async function f(r, i, o) {
18
18
  let s = await a(i, o);
@@ -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), t(a, s), e() && n(a, s);
16
15
  }, { commands: ["honor"] });
17
16
  }
18
17
  //#endregion
19
- export { o as registerCommands };
18
+ export { a as registerCliCommands };
@@ -5,7 +5,7 @@ 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
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 () => {
@@ -0,0 +1,19 @@
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 { performLogout as r } from "../../honor-auth/logout.mjs";
5
+ //#region src/cli/logout/impl.ts
6
+ var i = n("logout-cli");
7
+ function a(n, a) {
8
+ a.command("logout").description("Logout and clear user configuration").action(async () => e(n.runtime, async () => {
9
+ i.info("logout CLI command called");
10
+ try {
11
+ await r(), console.log("✅ Logout successful, gateway will automatically restart to handle new configuration");
12
+ } catch (e) {
13
+ let n = t(e);
14
+ console.error("🚫 Logout failed:", n);
15
+ }
16
+ }));
17
+ }
18
+ //#endregion
19
+ export { a 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
  }