@honor-claw/yoyo 2026.6.9-alpha.2 → 2026.6.9-alpha.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 (210) hide show
  1. package/dist/apis/claw-cloud.mjs +27 -5
  2. package/dist/capabilities/admin/impl.mjs +19 -63
  3. package/dist/capabilities/admin/index.mjs +1 -0
  4. package/dist/capabilities/admin/manager.mjs +2 -2
  5. package/dist/capabilities/cloud-invoke/index.mjs +1 -0
  6. package/dist/capabilities/cloud-invoke/invoke.mjs +48 -0
  7. package/dist/capabilities/node/index.mjs +2 -0
  8. package/dist/capabilities/node/invoke.mjs +40 -0
  9. package/dist/capabilities/node/list.mjs +27 -13
  10. package/dist/capabilities/node/types.mjs +6 -0
  11. package/dist/capabilities/routing/index.mjs +3 -0
  12. package/dist/capabilities/routing/list.mjs +27 -0
  13. package/dist/capabilities/routing/model-switch.mjs +36 -0
  14. package/dist/capabilities/routing/primary.mjs +36 -0
  15. package/dist/capabilities/routing/route.mjs +18 -0
  16. package/dist/channel/accounts.mjs +1 -1
  17. package/dist/channel/consts.mjs +1 -1
  18. package/dist/channel/directory.mjs +5 -2
  19. package/dist/channel/lifecycle.mjs +32 -25
  20. package/dist/channel/messaging.mjs +12 -19
  21. package/dist/channel/security.mjs +2 -6
  22. package/dist/channel/setup-wizard.mjs +2 -4
  23. package/dist/channel/status.mjs +29 -42
  24. package/dist/cloud-channel/authorization/refresh-manager.mjs +16 -15
  25. package/dist/cloud-channel/channel.mjs +35 -25
  26. package/dist/cloud-channel/dispatcher/helpers.mjs +19 -0
  27. package/dist/cloud-channel/dispatcher/impl.mjs +75 -0
  28. package/dist/cloud-channel/dispatcher/index.mjs +1 -0
  29. package/dist/cloud-channel/handlers/auth.mjs +1 -1
  30. package/dist/cloud-channel/handlers/context/handler.mjs +112 -57
  31. package/dist/cloud-channel/handlers/user-message.mjs +1 -1
  32. package/dist/cloud-channel/log-summary.mjs +2 -2
  33. package/dist/cloud-channel/protocol/semantics.mjs +4 -0
  34. package/dist/cloud-channel/transport/cloud-socket.mjs +27 -20
  35. package/dist/cloud-channel/transport/event-bus.mjs +5 -5
  36. package/dist/cloud-channel/transport/index.mjs +3 -0
  37. package/dist/cloud-channel/transport/message-handler.mjs +4 -3
  38. package/dist/cloud-channel/utils.mjs +19 -17
  39. package/dist/commands/debug/clean-tools.mjs +22 -0
  40. package/dist/commands/debug/impl.mjs +7 -0
  41. package/dist/commands/debug/index.mjs +1 -0
  42. package/dist/commands/env/impl.mjs +14 -17
  43. package/dist/commands/index.mjs +11 -9
  44. package/dist/commands/login/impl.mjs +15 -15
  45. package/dist/commands/logout/impl.mjs +10 -9
  46. package/dist/commands/status/index.mjs +23 -22
  47. package/dist/connection/client.mjs +70 -7
  48. package/dist/connection/index.mjs +1 -2
  49. package/dist/connection/monitor.mjs +18 -26
  50. package/dist/connection/registry.mjs +22 -0
  51. package/dist/core/hooks/entry.mjs +7 -6
  52. package/dist/core/hooks/gateway-lifecycle.mjs +23 -0
  53. package/dist/core/hooks/skill-refresh.mjs +9 -10
  54. package/dist/core/hooks/tool-trace.mjs +22 -44
  55. package/dist/core/prompt/skill.mjs +6 -7
  56. package/dist/core/runtime.mjs +25 -5
  57. package/dist/core/services/admin.mjs +18 -0
  58. package/dist/core/services/entry.mjs +7 -0
  59. package/dist/gateway/client/admin.mjs +0 -12
  60. package/dist/gateway/client/client.mjs +2 -2
  61. package/dist/gateway/client/node.mjs +1 -1
  62. package/dist/gateway/client/protocol.mjs +5 -5
  63. package/dist/gateway/session/forwarding.mjs +1 -1
  64. package/dist/gateway/session/manager.mjs +47 -46
  65. package/dist/honor-auth/browser/flow.mjs +3 -4
  66. package/dist/honor-auth/login/impl.mjs +13 -29
  67. package/dist/honor-auth/logout.mjs +11 -11
  68. package/dist/honor-auth/vault/impl.mjs +75 -83
  69. package/dist/honor-auth/vault/legacy-migration.mjs +33 -36
  70. package/dist/honor-auth/vault/vault.mjs +7 -10
  71. package/dist/index.mjs +11 -10
  72. package/dist/messaging/dispatchers/command/impl.mjs +54 -0
  73. package/dist/messaging/dispatchers/command/index.mjs +1 -0
  74. package/dist/messaging/dispatchers/stream/controller.mjs +135 -0
  75. package/dist/messaging/{stream → dispatchers/stream}/error.mjs +1 -1
  76. package/dist/messaging/dispatchers/stream/factory.mjs +17 -0
  77. package/dist/messaging/dispatchers/stream/hooks.mjs +48 -0
  78. package/dist/messaging/dispatchers/stream/index.mjs +4 -0
  79. package/dist/messaging/dispatchers/stream/registry.mjs +13 -0
  80. package/dist/messaging/{stream → dispatchers/stream}/resolvers.mjs +1 -1
  81. package/dist/messaging/{stream → dispatchers/stream}/session.mjs +41 -26
  82. package/dist/messaging/dispatchers/stream/tool/error.mjs +26 -0
  83. package/dist/messaging/dispatchers/stream/tool/event-builder.mjs +18 -0
  84. package/dist/messaging/{stream → dispatchers/stream}/tool/index.mjs +2 -2
  85. package/dist/messaging/{stream → dispatchers/stream}/tool/sanitize.mjs +1 -1
  86. package/dist/messaging/{stream → dispatchers/stream}/tool/trace-store.mjs +17 -62
  87. package/dist/messaging/dispose.mjs +1 -1
  88. package/dist/messaging/inbound/abort/core.mjs +1 -1
  89. package/dist/messaging/inbound/abort/detect.mjs +5 -5
  90. package/dist/messaging/inbound/abort/index.mjs +1 -1
  91. package/dist/messaging/inbound/agent.mjs +8 -5
  92. package/dist/messaging/inbound/command.mjs +40 -0
  93. package/dist/messaging/inbound/context.mjs +24 -26
  94. package/dist/messaging/inbound/dispatch.mjs +35 -21
  95. package/dist/messaging/inbound/interrupt.mjs +22 -21
  96. package/dist/messaging/inbound/new-session.mjs +21 -18
  97. package/dist/messaging/inbound/user-message.mjs +25 -20
  98. package/dist/messaging/index.mjs +1 -0
  99. package/dist/messaging/send/frame.mjs +22 -18
  100. package/dist/messaging/send/text.mjs +6 -5
  101. package/dist/messaging/session/defaults.mjs +41 -0
  102. package/dist/messaging/session/index.mjs +1 -0
  103. package/dist/messaging/target/chat-id-store.mjs +69 -0
  104. package/dist/messaging/target/chat-id.mjs +16 -16
  105. package/dist/messaging/target/index.mjs +3 -0
  106. package/dist/messaging/target/outbound.mjs +2 -2
  107. package/dist/modules/configs/agent-defaults.mjs +25 -0
  108. package/dist/modules/configs/channel.mjs +31 -19
  109. package/dist/modules/configs/config-store.mjs +18 -15
  110. package/dist/modules/configs/device.mjs +18 -0
  111. package/dist/modules/configs/gateway.mjs +1 -1
  112. package/dist/modules/configs/identity-persist.mjs +1 -1
  113. package/dist/modules/configs/index.mjs +3 -2
  114. package/dist/modules/configs/plugin-init.mjs +42 -27
  115. package/dist/modules/configs/plugin.mjs +2 -21
  116. package/dist/modules/configs/state-flags.mjs +1 -1
  117. package/dist/modules/device/device-info.mjs +28 -36
  118. package/dist/modules/device/index.mjs +1 -1
  119. package/dist/modules/status/channel.mjs +1 -17
  120. package/dist/modules/status/storage.mjs +17 -15
  121. package/dist/modules/status/tracker.mjs +1 -1
  122. package/dist/provisioning/registration/register.mjs +50 -28
  123. package/dist/provisioning/toolset/ack.mjs +10 -15
  124. package/dist/provisioning/toolset/artifacts.mjs +37 -36
  125. package/dist/provisioning/toolset/cleanup.mjs +55 -0
  126. package/dist/provisioning/toolset/consts.mjs +2 -2
  127. package/dist/provisioning/toolset/index.mjs +1 -0
  128. package/dist/provisioning/toolset/processor.mjs +3 -3
  129. package/dist/provisioning/toolset/skill-inject.mjs +14 -14
  130. package/dist/provisioning/toolset/skill-refresh-marker.mjs +30 -25
  131. package/dist/tools/cloud-invoke/index.mjs +1 -0
  132. package/dist/tools/cloud-invoke/tool.mjs +48 -0
  133. package/dist/tools/error.mjs +9 -0
  134. package/dist/tools/index.mjs +12 -0
  135. package/dist/tools/node-invoke/index.mjs +1 -0
  136. package/dist/tools/node-invoke/status-mapper.mjs +23 -0
  137. package/dist/tools/node-invoke/tool.mjs +45 -0
  138. package/dist/tools/nodes-status/index.mjs +2 -0
  139. package/dist/tools/nodes-status/mapper.mjs +19 -0
  140. package/dist/tools/nodes-status/tool.mjs +44 -0
  141. package/dist/utils/claw-logger.mjs +67 -41
  142. package/dist/utils/fs-safe.mjs +70 -42
  143. package/openclaw.plugin.json +3 -0
  144. package/package.json +3 -2
  145. package/skills/yoyo-phone-control/SKILL.md +80 -152
  146. package/skills/yoyo-phone-control/configs/sub-skills.json +4 -64
  147. package/skills/yoyo-phone-control/references/file-upload.md +286 -362
  148. package/skills/yoyo-phone-control/references/gui-task-create.md +90 -66
  149. package/skills/yoyo-phone-control/references/gui-task-pause.md +11 -74
  150. package/skills/yoyo-phone-control/references/gui-task-terminate.md +11 -74
  151. package/skills/yoyo-phone-control/references/local-search.md +11 -94
  152. package/skills/yoyo-phone-control/references/local_user_data_qa.md +363 -0
  153. package/skills/yoyo-phone-control/references/local_user_file_search.md +360 -0
  154. package/skills/yoyo-phone-control/references/task-result-query.md +6 -16
  155. package/dist/cloud-channel/transport/outbound-port.mjs +0 -38
  156. package/dist/connection/manager.mjs +0 -92
  157. package/dist/core/service/index.mjs +0 -27
  158. package/dist/messaging/stream/dispatcher.mjs +0 -74
  159. package/dist/messaging/stream/tool/callbacks.mjs +0 -36
  160. package/dist/messaging/stream/tool/output.mjs +0 -38
  161. package/dist/utils/base64-json.mjs +0 -14
  162. package/skills/yoyo-phone-control/references/airplane-mode.md +0 -197
  163. package/skills/yoyo-phone-control/references/alarm-create.md +0 -519
  164. package/skills/yoyo-phone-control/references/alarm-delete.md +0 -370
  165. package/skills/yoyo-phone-control/references/alarm-disable.md +0 -372
  166. package/skills/yoyo-phone-control/references/alarm-enable.md +0 -372
  167. package/skills/yoyo-phone-control/references/alarm-query.md +0 -565
  168. package/skills/yoyo-phone-control/references/alarm-update.md +0 -461
  169. package/skills/yoyo-phone-control/references/app-close.md +0 -333
  170. package/skills/yoyo-phone-control/references/app-open.md +0 -334
  171. package/skills/yoyo-phone-control/references/app-uninstall.md +0 -229
  172. package/skills/yoyo-phone-control/references/app_name_to_pkgName.md +0 -238
  173. package/skills/yoyo-phone-control/references/audio-record.md +0 -211
  174. package/skills/yoyo-phone-control/references/autoscreen-onnotice.md +0 -196
  175. package/skills/yoyo-phone-control/references/battery.md +0 -252
  176. package/skills/yoyo-phone-control/references/bluetooth.md +0 -338
  177. package/skills/yoyo-phone-control/references/brightness.md +0 -224
  178. package/skills/yoyo-phone-control/references/call-phone.md +0 -187
  179. package/skills/yoyo-phone-control/references/call-search.md +0 -207
  180. package/skills/yoyo-phone-control/references/camera.md +0 -217
  181. package/skills/yoyo-phone-control/references/capture-screenshot.md +0 -211
  182. package/skills/yoyo-phone-control/references/clean-dirty.md +0 -163
  183. package/skills/yoyo-phone-control/references/contact-search.md +0 -240
  184. package/skills/yoyo-phone-control/references/countdown-timer.md +0 -393
  185. package/skills/yoyo-phone-control/references/dark-mode.md +0 -200
  186. package/skills/yoyo-phone-control/references/desktop.md +0 -196
  187. package/skills/yoyo-phone-control/references/device-operation.md +0 -226
  188. package/skills/yoyo-phone-control/references/express-logistics-search.md +0 -172
  189. package/skills/yoyo-phone-control/references/eyecomfort.md +0 -226
  190. package/skills/yoyo-phone-control/references/flashlight.md +0 -183
  191. package/skills/yoyo-phone-control/references/hotspot.md +0 -183
  192. package/skills/yoyo-phone-control/references/location-service.md +0 -184
  193. package/skills/yoyo-phone-control/references/message-search.md +0 -375
  194. package/skills/yoyo-phone-control/references/message-send.md +0 -251
  195. package/skills/yoyo-phone-control/references/mobile-data.md +0 -257
  196. package/skills/yoyo-phone-control/references/nfc.md +0 -196
  197. package/skills/yoyo-phone-control/references/no-disturb.md +0 -334
  198. package/skills/yoyo-phone-control/references/quiet-mode.md +0 -237
  199. package/skills/yoyo-phone-control/references/ringing-mode.md +0 -232
  200. package/skills/yoyo-phone-control/references/scan-code.md +0 -161
  201. package/skills/yoyo-phone-control/references/schedule-create.md +0 -541
  202. package/skills/yoyo-phone-control/references/schedule-delete.md +0 -582
  203. package/skills/yoyo-phone-control/references/schedule-search.md +0 -673
  204. package/skills/yoyo-phone-control/references/schedule-update.md +0 -630
  205. package/skills/yoyo-phone-control/references/screen-record.md +0 -236
  206. package/skills/yoyo-phone-control/references/status-bar-show.md +0 -211
  207. package/skills/yoyo-phone-control/references/usb-shared-network.md +0 -198
  208. package/skills/yoyo-phone-control/references/vibration-mode.md +0 -239
  209. package/skills/yoyo-phone-control/references/volume-operate.md +0 -284
  210. package/skills/yoyo-phone-control/references/wlan.md +0 -410
@@ -57,13 +57,34 @@ var o = class {
57
57
  "x-jwt-token": n.token,
58
58
  "x-device-id": e.deviceId,
59
59
  "x-udid": e.deviceId
60
+ }, a = {
61
+ businessTag: "YOYO_CLAW",
62
+ role: "node",
63
+ ignoreBizExtInfo: !0,
64
+ ...r?.deviceIdList?.length ? { deviceIdList: r.deviceIdList } : {}
60
65
  };
61
66
  return this.httpClient.post("/v1/user/devicelist", {
62
67
  headers: i,
63
- body: {
64
- businessTag: "YOYO_CLAW",
65
- role: "node"
66
- },
68
+ body: a,
69
+ timeout: r?.timeoutMs ?? 3e4
70
+ });
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,
67
88
  timeout: r?.timeoutMs ?? 3e4
68
89
  });
69
90
  }
@@ -89,7 +110,8 @@ var o = class {
89
110
  timeout: 15e3
90
111
  });
91
112
  if (n(c) && c.data.data) return c.data.data;
92
- throw Error(`failed to get token: ${JSON.stringify(c.data)}, traceId: ${i}`);
113
+ let l = c.data.cnMessage || "unknown error";
114
+ throw Error(`${l} (code: ${c.data.code}, traceId: ${i})`);
93
115
  }
94
116
  };
95
117
  function s() {
@@ -1,13 +1,13 @@
1
1
  import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
2
  import { AdminClientManager as t } from "./manager.mjs";
3
3
  //#region src/capabilities/admin/impl.ts
4
- var n = e("admin"), r = class {
4
+ var n = e("capabilities"), r = null, i = class {
5
5
  manager = new t();
6
6
  constructor() {
7
7
  this.manager.init();
8
8
  }
9
- start() {
10
- this.manager.ensureConnected();
9
+ ensureConnected() {
10
+ return this.manager.ensureConnected();
11
11
  }
12
12
  destroy() {
13
13
  this.manager.destroy();
@@ -47,31 +47,6 @@ var n = e("admin"), r = class {
47
47
  error: `update context failed, ${JSON.stringify(i.error)}`
48
48
  };
49
49
  }
50
- async switchPrimaryModel(e, t) {
51
- let r = this.manager.getClient();
52
- if (!r) return {
53
- ok: !1,
54
- error: "Admin gateway client not ready"
55
- };
56
- if (!e || !t) return {
57
- ok: !1,
58
- error: "Missing provider or id in context payload"
59
- };
60
- try {
61
- return (await r.switchPrimaryModel(e, t)).ok ? (n.info("switchPrimaryModel success", {
62
- provider: e,
63
- id: t
64
- }), {
65
- ok: !0,
66
- data: { resolved: {
67
- provider: e,
68
- id: t
69
- } }
70
- }) : (n.error("switchPrimaryModel failed, try to fallback main session model"), this.getMainSessionModel());
71
- } catch (e) {
72
- return n.error("updatePrimaryModel error, try to fallback main session model", e), this.getMainSessionModel();
73
- }
74
- }
75
50
  async getSkillsStatus() {
76
51
  let e = this.manager.getClient();
77
52
  return e ? {
@@ -94,13 +69,9 @@ var n = e("admin"), r = class {
94
69
  error: "Admin gateway client not ready"
95
70
  };
96
71
  try {
97
- let t = await e.getModelList(), { modelProvider: r = "", model: i = "" } = await e.getMainSession();
98
- return n.info("current primary model", {
99
- provider: r,
100
- id: i
101
- }), {
72
+ return {
102
73
  ok: !0,
103
- data: { models: t?.models?.map((e) => Object.assign({}, e, { primary: e.provider === r && e.id === i })) ?? [] }
74
+ data: { models: (await e.getModelList())?.models ?? [] }
104
75
  };
105
76
  } catch (e) {
106
77
  let t = e instanceof Error ? e.message : String(e);
@@ -110,34 +81,19 @@ var n = e("admin"), r = class {
110
81
  };
111
82
  }
112
83
  }
113
- async getMainSessionModel() {
114
- let e = this.manager.getClient();
115
- if (!e) return {
116
- ok: !1,
117
- error: "Admin gateway client not ready"
118
- };
119
- try {
120
- let t = await e.getMainSession(), { modelProvider: r = "", model: i = "" } = t;
121
- return n.warn("switchPrimaryModel failed, fallback to current", {
122
- provider: r,
123
- id: i
124
- }), !r || !i ? {
125
- ok: !1,
126
- error: `Missing primary model: mainSession-${JSON.stringify(t)}`
127
- } : {
128
- ok: !1,
129
- data: { resolved: {
130
- provider: r,
131
- id: i
132
- } }
133
- };
134
- } catch (e) {
135
- return {
136
- ok: !1,
137
- error: `getMainSessionModel error: ${e instanceof Error ? e.message : String(e)}`
138
- };
139
- }
140
- }
141
84
  };
85
+ function a() {
86
+ return r === null && (r = new i()), r;
87
+ }
88
+ function o() {
89
+ return a();
90
+ }
91
+ function s() {
92
+ let e = a().ensureConnected();
93
+ return n.info("admin gateway connection started", { ready: e }), e;
94
+ }
95
+ function c() {
96
+ a().destroy(), n.info("admin gateway connection stopped");
97
+ }
142
98
  //#endregion
143
- export { r as AdminCapabilityImpl };
99
+ export { s as startAdminConnection, c as stopAdminConnection, o as useAdminCapability };
@@ -0,0 +1 @@
1
+ import "./impl.mjs";
@@ -5,7 +5,7 @@ import n from "../../gateway/client/admin.mjs";
5
5
  import { StatusEventTypeE as r } from "../../modules/status/events.mjs";
6
6
  import { emitStatusEvent as i } from "../../modules/status/global.mjs";
7
7
  //#region src/capabilities/admin/manager.ts
8
- var a = e("admin"), o = class {
8
+ var a = e("capabilities"), o = class {
9
9
  client = null;
10
10
  ready = !1;
11
11
  pendingReadyRequests = /* @__PURE__ */ new Map();
@@ -34,7 +34,7 @@ var a = e("admin"), o = class {
34
34
  this.client &&= (this.client.stop(), null), this.ready = !1, this.cancelAllPending(), a.info("admin client destroyed");
35
35
  }
36
36
  getClient() {
37
- return this.client;
37
+ return this.ready && this.client?.isAuthenticated() ? this.client : null;
38
38
  }
39
39
  ensureConnected() {
40
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;
@@ -0,0 +1 @@
1
+ import "./invoke.mjs";
@@ -0,0 +1,48 @@
1
+ import { toErrorMessage as e } from "../../utils/error.mjs";
2
+ import { clawLogger as t } from "../../utils/claw-logger.mjs";
3
+ import { HonorAccount as n } from "../../honor-auth/vault/impl.mjs";
4
+ import { createClawCloudClient as r } from "../../apis/claw-cloud.mjs";
5
+ import { loadDeviceInfo as i } from "../../modules/device/device-info.mjs";
6
+ import "../../modules/device/index.mjs";
7
+ import "../../honor-auth/vault/index.mjs";
8
+ import "../../apis/index.mjs";
9
+ import { ToolError as a } from "../../tools/error.mjs";
10
+ //#region src/capabilities/cloud-invoke/invoke.ts
11
+ var o = t("capabilities");
12
+ async function s(t) {
13
+ let s = await n.fromUser().current();
14
+ if (!s?.token || !s.userId) throw o.error("cloud invoke skipped: no current user"), new a("unauthorized", "missing current user token");
15
+ let c;
16
+ try {
17
+ c = await i();
18
+ } catch (e) {
19
+ throw o.error("cloud invoke failed to get device info", e), new a("ctx missing", "failed to get device info", { cause: e });
20
+ }
21
+ try {
22
+ let e = await r().invokeCloudTool(c, s, {
23
+ serviceId: t.toolId,
24
+ pluginParams: t.params ?? {},
25
+ ...t.timeoutMs === void 0 ? {} : { timeoutMs: t.timeoutMs }
26
+ }), n = e.data, i = e.status >= 200 && e.status < 300, l = n?.code === "0";
27
+ if (!i || !l) throw o.error("cloud invoke response not ok", null, {
28
+ status: e.status,
29
+ code: n?.code,
30
+ cnMessage: n?.cnMessage,
31
+ cpErrorCode: n?.data?.cpErrorCode
32
+ }), new a("api_failed", `code=${n?.code ?? "-"} cpErrorCode=${n?.data?.cpErrorCode ?? "-"} message=${n?.cnMessage ?? "-"}`);
33
+ let u = n.data;
34
+ if (!u) throw o.error("cloud invoke response missing data", null, {
35
+ status: e.status,
36
+ code: n.code
37
+ }), new a("api_failed", `code=${n.code} message=${n.cnMessage} data missing`);
38
+ return {
39
+ pluginResponse: u,
40
+ code: e.data.code,
41
+ cnMessage: e.data.cnMessage
42
+ };
43
+ } catch (t) {
44
+ throw t instanceof a ? t : (o.error("cloud invoke failed", t), new a("network_error", e(t), { cause: t }));
45
+ }
46
+ }
47
+ //#endregion
48
+ export { s as invokeCloudToolService };
@@ -1 +1,3 @@
1
1
  import "./list.mjs";
2
+ import "./invoke.mjs";
3
+ import "./types.mjs";
@@ -0,0 +1,40 @@
1
+ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
+ import { buildEndpoint as t } from "../../cloud-channel/protocol/target.mjs";
3
+ import { resolveEnabledYoyoAccountId as n } from "../../modules/configs/channel.mjs";
4
+ import { ClawClient as r } from "../../connection/registry.mjs";
5
+ //#region src/capabilities/node/invoke.ts
6
+ var i = e("capabilities");
7
+ async function a(e) {
8
+ let i = {
9
+ to: t("node", e.nodeId),
10
+ msgType: "nodeInvokeRequest",
11
+ data: { node: {
12
+ toolCallId: e.toolCallId,
13
+ nodeId: e.nodeId,
14
+ name: e.name,
15
+ params: e.params
16
+ } }
17
+ }, a = n();
18
+ return r.forAccount(a).request(i, {
19
+ timeoutMs: e.timeoutMs,
20
+ matchResult: o
21
+ });
22
+ }
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
+ }
37
+ };
38
+ }
39
+ //#endregion
40
+ export { a as invokeNodeTool };
@@ -1,25 +1,39 @@
1
1
  import { toErrorMessage as e } from "../../utils/error.mjs";
2
2
  import { clawLogger as t } from "../../utils/claw-logger.mjs";
3
- import { getCurrentUser as n } from "../../honor-auth/vault/impl.mjs";
3
+ import { HonorAccount as n } from "../../honor-auth/vault/impl.mjs";
4
4
  import { isOKResponse as r } from "../../apis/helpers.mjs";
5
5
  import { createClawCloudClient as i } from "../../apis/claw-cloud.mjs";
6
- import "../../apis/index.mjs";
7
- import { getDeviceInfo as a } from "../../modules/device/device-info.mjs";
6
+ import { loadDeviceInfo as a } from "../../modules/device/device-info.mjs";
8
7
  import "../../modules/device/index.mjs";
9
8
  import "../../honor-auth/vault/index.mjs";
9
+ import "../../apis/index.mjs";
10
+ import { ToolError as o } from "../../tools/error.mjs";
10
11
  //#region src/capabilities/node/list.ts
11
- var o = t("capabilities/node");
12
- async function s() {
13
- let t = await n();
14
- if (!t?.token || !t.userId) return o.debug("node device list skipped: no current user"), null;
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;
17
+ try {
18
+ l = await a();
19
+ } 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 });
21
+ }
15
22
  try {
16
- let e = await a(), n = await i().getDeviceList(e, t);
17
- if (!r(n)) return o.warn("node device list response not ok", { status: n.status }), { devices: [] };
18
- let s = n.data.data?.deviceList;
19
- return { devices: Array.isArray(s) ? s : [] };
23
+ let e = await i().getDeviceList(l, c, { deviceIdList: t?.deviceIdList });
24
+ if (!r(e)) {
25
+ let t = e.data?.code, n = e.data?.cnMessage;
26
+ throw s.error("node device list response not ok", null, {
27
+ status: e.status,
28
+ code: t,
29
+ cnMessage: n
30
+ }), new o("api_failed", `code=${t} message=${n}`);
31
+ }
32
+ let n = e.data.data?.deviceList;
33
+ return { devices: Array.isArray(n) ? n : [] };
20
34
  } catch (t) {
21
- return o.warn("node device list failed", { error: e(t) }), null;
35
+ throw t instanceof o ? t : (s.error("node device list failed", t), new o("network_error", e(t), { cause: t }));
22
36
  }
23
37
  }
24
38
  //#endregion
25
- export { s as listNodeDevices };
39
+ export { c as listNodeDevices };
@@ -0,0 +1,6 @@
1
+ //#region src/capabilities/node/types.ts
2
+ var e = /* @__PURE__ */ function(e) {
3
+ return e[e.Processing = 0] = "Processing", e[e.ProcessingAlt = 100] = "ProcessingAlt", e[e.Suspended = 101] = "Suspended", e[e.Success = 200] = "Success", e[e.InternalError = 300] = "InternalError", e[e.CompensationFailed = 400] = "CompensationFailed", e;
4
+ }({});
5
+ //#endregion
6
+ export { e as NodeInvokeRunStatusE };
@@ -0,0 +1,3 @@
1
+ import "./route.mjs";
2
+ import "./list.mjs";
3
+ import "./model-switch.mjs";
@@ -0,0 +1,27 @@
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
+ import { resolvePrimaryModel as n } from "./primary.mjs";
5
+ import { getRuntimeConfig as r } from "openclaw/plugin-sdk/config-runtime";
6
+ //#region src/capabilities/routing/list.ts
7
+ var i = e("routing");
8
+ async function a(e, a) {
9
+ let o = await t().getModelList();
10
+ if (!o.ok || !o.data?.models) return {
11
+ ok: !1,
12
+ error: o.error ?? "no models"
13
+ };
14
+ let s = await n(r(), e, a);
15
+ return i.info("resolved primary for model list", {
16
+ provider: s.provider,
17
+ id: s.id
18
+ }), {
19
+ ok: !0,
20
+ data: {
21
+ models: o.data.models.map((e) => Object.assign({}, e, { primary: s.provider !== "" && e.provider === s.provider && e.id === s.id })),
22
+ primary: s
23
+ }
24
+ };
25
+ }
26
+ //#endregion
27
+ export { a as getModelsListWithPrimary };
@@ -0,0 +1,36 @@
1
+ import { clawLogger as e } from "../../utils/claw-logger.mjs";
2
+ import { uuid as t } from "../../utils/id.mjs";
3
+ import { buildChatId as n } from "../../messaging/target/chat-id.mjs";
4
+ import { resolvePrimaryModel as r } from "./primary.mjs";
5
+ import { dispatchInboundContext as i } from "../../messaging/inbound/user-message.mjs";
6
+ import "../../messaging/index.mjs";
7
+ import { getRuntimeConfig as a } from "openclaw/plugin-sdk/config-runtime";
8
+ //#region src/capabilities/routing/model-switch.ts
9
+ var o = e("routing");
10
+ async function s(e) {
11
+ let s = await n(e.accountId, e.deviceId);
12
+ await i({
13
+ messageId: t(),
14
+ senderId: e.deviceId,
15
+ chatId: s,
16
+ accountId: e.accountId,
17
+ traceId: e.traceId,
18
+ content: `/model ${e.provider}/${e.model}`,
19
+ resources: [],
20
+ silent: !0
21
+ });
22
+ let c = await r(a(), e.accountId, e.deviceId);
23
+ return o.info("model switch completed", {
24
+ requested: {
25
+ provider: e.provider,
26
+ model: e.model
27
+ },
28
+ resolved: c
29
+ }), {
30
+ ok: !0,
31
+ provider: c.provider,
32
+ model: c.id
33
+ };
34
+ }
35
+ //#endregion
36
+ export { s as switchModel };
@@ -0,0 +1,36 @@
1
+ import { canHandleAgentSessionEntry as e, getYoyoRuntime as t } from "../../core/runtime.mjs";
2
+ import { resolveYoyoRoute as n } from "./route.mjs";
3
+ import { buildChatId as r } from "../../messaging/target/chat-id.mjs";
4
+ import "../../messaging/target/index.mjs";
5
+ import { resolveDefaultModelForAgent as i } from "openclaw/plugin-sdk/agent-runtime";
6
+ //#region src/capabilities/routing/primary.ts
7
+ function a(n, r) {
8
+ if (e()) return t().agent.session.getSessionEntry({
9
+ agentId: n,
10
+ sessionKey: r
11
+ });
12
+ }
13
+ async function o(e, t, o) {
14
+ let s = n({
15
+ accountId: t,
16
+ chatId: await r(t, o)
17
+ }), c = a(s.agentId, s.sessionKey);
18
+ if (c?.providerOverride && c?.modelOverride) return {
19
+ provider: c.providerOverride,
20
+ id: c.modelOverride
21
+ };
22
+ if (c?.modelProvider && c?.model) return {
23
+ provider: c.modelProvider,
24
+ id: c.model
25
+ };
26
+ let l = i({
27
+ cfg: e,
28
+ agentId: s.agentId
29
+ });
30
+ return {
31
+ provider: l.provider,
32
+ id: l.model
33
+ };
34
+ }
35
+ //#endregion
36
+ export { o as resolvePrimaryModel };
@@ -0,0 +1,18 @@
1
+ import { YOYO_CHANNEL_ID as e } from "../../consts.mjs";
2
+ import { getYoyoRuntime as t } from "../../core/runtime.mjs";
3
+ import { getRuntimeConfig as n } from "openclaw/plugin-sdk/config-runtime";
4
+ //#region src/capabilities/routing/route.ts
5
+ function r(r) {
6
+ let i = t(), a = n();
7
+ return i.channel.routing.resolveAgentRoute({
8
+ cfg: a,
9
+ channel: e,
10
+ accountId: r.accountId,
11
+ peer: {
12
+ kind: "direct",
13
+ id: r.chatId
14
+ }
15
+ });
16
+ }
17
+ //#endregion
18
+ export { r as resolveYoyoRoute };
@@ -18,7 +18,7 @@ function r(e, t) {
18
18
  let o = r.accounts?.[a];
19
19
  return {
20
20
  accountId: a,
21
- enabled: o?.enabled !== !1,
21
+ enabled: r.enabled !== !1 && o?.enabled !== !1,
22
22
  configured: o !== void 0
23
23
  };
24
24
  }
@@ -1,4 +1,4 @@
1
1
  //#region src/channel/consts.ts
2
- var e = "YOYO控虾", t = "Honor/yoyo", n = "/channels/yoyo", r = "yoyo", i = "Connect OpenClaw to Honor YOYO Assistant.";
2
+ var e = "YOYO控虾", t = "HONOR/yoyo (YOYO控虾)", n = "/channels/yoyo", r = "yoyo", i = "Connect OpenClaw to Honor YOYO Assistant.";
3
3
  //#endregion
4
4
  export { i as YOYO_CHANNEL_BLURB, r as YOYO_CHANNEL_DOCS_LABEL, n as YOYO_CHANNEL_DOCS_PATH, e as YOYO_CHANNEL_LABEL, t as YOYO_CHANNEL_SELECTION_LABEL };
@@ -2,8 +2,11 @@ import { listNodeDevices as e } from "../capabilities/node/list.mjs";
2
2
  import "../capabilities/node/index.mjs";
3
3
  //#region src/channel/directory.ts
4
4
  async function t(t) {
5
- let a = await e();
6
- return a ? i(a.devices.filter((e) => r(e)).map((e) => n(e)), t) : [];
5
+ try {
6
+ return i((await e()).devices.filter((e) => r(e)).map((e) => n(e)), t);
7
+ } catch {
8
+ return [];
9
+ }
7
10
  }
8
11
  function n(e) {
9
12
  let t = e.deviceId.trim(), n = e.deviceName?.trim() || t;
@@ -1,37 +1,44 @@
1
1
  import { clawLogger as e } from "../utils/claw-logger.mjs";
2
2
  import { disposeAccountMessaging as t } from "../messaging/dispose.mjs";
3
+ import { loadConfig as n, saveConfig as r } from "../modules/configs/config-store.mjs";
4
+ import { resolveEnabledYoyoAccountId as i, setYoyoChannelAccountEnabled as a } from "../modules/configs/channel.mjs";
5
+ import "../modules/configs/index.mjs";
6
+ import { HonorAccount as o } from "../honor-auth/vault/impl.mjs";
7
+ import "../honor-auth/vault/index.mjs";
3
8
  import "../messaging/index.mjs";
4
- import { setChannelAccountStatus as n } from "../modules/status/channel.mjs";
5
- import "../modules/status/index.mjs";
6
- import { monitorAccount as r } from "../connection/monitor.mjs";
9
+ import { monitorAccount as s } from "../connection/monitor.mjs";
7
10
  import "../connection/index.mjs";
8
11
  //#region src/channel/lifecycle.ts
9
- var i = e("channel/lifecycle"), a = {
12
+ var c = e("channel"), l = {
10
13
  async startAccount(e) {
11
14
  let t = e.accountId;
12
- i.info("start account channel", { accountId: t });
13
- try {
14
- await r({
15
- userId: t,
16
- abortSignal: e.abortSignal
17
- });
18
- } catch (e) {
19
- throw await n(t, {
20
- running: !1,
21
- connected: !1,
22
- lastStartAt: null,
23
- lastError: "account not ready"
24
- }), e;
25
- }
15
+ c.report("start account channel", { accountId: t }), await u(e), await s({
16
+ accountId: t,
17
+ abortSignal: e.abortSignal
18
+ });
26
19
  },
27
20
  async stopAccount(e) {
28
- let r = e.accountId;
29
- await t(r), await n(r, {
30
- running: !1,
31
- connected: !1,
32
- lastStopAt: Date.now()
33
- }), i.info("stop account channel", { accountId: r });
21
+ let n = e.accountId;
22
+ await t(n), c.report("account channel stopped", { accountId: n });
34
23
  }
35
24
  };
25
+ async function u(e) {
26
+ let { accountId: t } = e, s = i();
27
+ if (t === s && (await o.fromUser(t).current())?.token) return;
28
+ let l = t === s ? "no credential" : "not the fallback account";
29
+ try {
30
+ await r(a(n(), t, !1), {
31
+ mode: "none",
32
+ reason: `account not connectable: ${l}`
33
+ });
34
+ } catch (e) {
35
+ c.error("failed to disable account in config", e, { accountId: t });
36
+ }
37
+ throw c.warn("account not connectable, disabled", {
38
+ accountId: t,
39
+ expected: s,
40
+ reason: l
41
+ }), Error(`yoyo account not connectable: ${t} (${l})`);
42
+ }
36
43
  //#endregion
37
- export { a as yoyoChannelGateway };
44
+ export { l as yoyoChannelGateway };
@@ -1,6 +1,6 @@
1
1
  import { YOYO_CHANNEL_ID as e } from "../consts.mjs";
2
2
  import { buildChatTo as t, buildFrom as n, readChatIdFromTo as r, readDeviceIdFromTo as i } from "../messaging/target/address.mjs";
3
- import { buildChatId as a, parseChatId as o } from "../messaging/target/chat-id.mjs";
3
+ import { buildChatId as a, looksLikeChatId as o } from "../messaging/target/chat-id.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
@@ -10,19 +10,12 @@ function u(t) {
10
10
  }
11
11
  function d(e, t = e) {
12
12
  let n = t.trim(), a = r(n);
13
- if (a !== void 0) return a.length > 0 && f(a);
14
- let o = i(n);
15
- return o !== void 0 && o.trim().length > 0;
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;
16
16
  }
17
- function f(e) {
18
- try {
19
- return o(e), !0;
20
- } catch {
21
- return !1;
22
- }
23
- }
24
- function p(r, i, o) {
25
- let s = a(i, o);
17
+ async function f(r, i, o) {
18
+ let s = await a(i, o);
26
19
  return c({
27
20
  cfg: r.cfg,
28
21
  agentId: r.agentId,
@@ -37,15 +30,15 @@ function p(r, i, o) {
37
30
  to: t(s)
38
31
  });
39
32
  }
40
- function m(e) {
33
+ async function p(e) {
41
34
  try {
42
- let t = s(e.resolvedTarget?.to ?? e.target, e.accountId ?? void 0);
43
- return p(e, t.accountId, t.deviceId);
35
+ let t = await s(e.resolvedTarget?.to ?? e.target, e.accountId ?? void 0);
36
+ return await f(e, t.accountId, t.deviceId);
44
37
  } catch {
45
38
  return null;
46
39
  }
47
40
  }
48
- var h = {
41
+ var m = {
49
42
  targetPrefixes: [e],
50
43
  normalizeTarget: u,
51
44
  inferTargetChatType: () => "direct",
@@ -53,7 +46,7 @@ var h = {
53
46
  looksLikeId: d,
54
47
  hint: "<chat:<chatId> | device:<deviceId>>"
55
48
  },
56
- resolveOutboundSessionRoute: m
49
+ resolveOutboundSessionRoute: p
57
50
  };
58
51
  //#endregion
59
- export { h as yoyoMessaging };
52
+ export { m as yoyoMessaging };
@@ -1,8 +1,4 @@
1
- import { ClawClient as e } from "../connection/client.mjs";
2
- import { getCurrentUser as t } from "../honor-auth/vault/impl.mjs";
3
- import "../honor-auth/vault/index.mjs";
4
- import "../connection/index.mjs";
5
1
  //#region src/channel/security.ts
6
- var n = { collectWarnings: async ({ account: n }) => n.configured === !1 ? ["YOYO channel has not been configured. Run `openclaw configure (channel/yoyo)`."] : n.enabled === !1 ? ["YOYO channel is disabled. Run `openclaw configure (channel/yoyo)` to enable it."] : e.connected() ? (await t())?.token ? [] : ["YOYO channel is enabled but the Honor account is not logged in."] : ["YOYO channel WebSocket is not connected."] };
2
+ var e = { collectWarnings: async ({ account: e }) => e.configured === !1 ? ["YOYO channel has not been configured. Run `openclaw configure (channel/yoyo)`."] : e.enabled === !1 ? ["YOYO channel is disabled. Run `openclaw configure (channel/yoyo)` to enable it."] : [] };
7
3
  //#endregion
8
- export { n as yoyoChannelSecurity };
4
+ export { e as yoyoChannelSecurity };
@@ -8,12 +8,10 @@ import "../honor-auth/index.mjs";
8
8
  var s = {
9
9
  channel: e,
10
10
  async getStatus(n) {
11
- let r = a(n.cfg) !== t;
12
11
  return {
13
12
  channel: e,
14
- configured: r,
15
- statusLines: [r ? "Honor account is logged in. Selecting yoyo can switch to another account" : "Honor account is not logged in. Selecting yoyo will start Honor login."],
16
- selectionHint: r ? "Ready" : "Login Required"
13
+ configured: a(n.cfg) !== t,
14
+ statusLines: []
17
15
  };
18
16
  },
19
17
  configure: async (e) => {