@honor-claw/yoyo 1.3.0-alpha.2 → 1.3.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,52 +1,43 @@
1
- import e, { promises as t, readFileSync as n } from "fs";
2
- import * as r from "path";
3
- import { dirname as i, join as a } from "path";
4
- import { fileURLToPath as o } from "url";
5
- import s, { constants as c, existsSync as l } from "node:fs";
6
- import u from "node:path";
7
- import d from "open";
8
- import { customAlphabet as f } from "nanoid";
9
- import { ProxyAgent as p, request as m } from "undici";
10
- import { HttpProxyAgent as ee } from "http-proxy-agent";
11
- import { HttpsProxyAgent as te } from "https-proxy-agent";
12
- import { createServer as ne } from "http";
13
- import { URL as re, fileURLToPath as h } from "node:url";
14
- import { createHash as g, randomBytes as ie } from "crypto";
15
- import _, { createHash as ae, randomUUID as oe } from "node:crypto";
1
+ import e, { constants as t, existsSync as n } from "node:fs";
2
+ import r from "node:path";
3
+ import i from "open";
4
+ import { customAlphabet as a } from "nanoid";
5
+ import { ProxyAgent as o, request as s } from "undici";
6
+ import { HttpProxyAgent as c } from "http-proxy-agent";
7
+ import { HttpsProxyAgent as l } from "https-proxy-agent";
8
+ import { createServer as u } from "http";
9
+ import { URL as d, fileURLToPath as f } from "node:url";
10
+ import { createHash as p, randomBytes as m } from "crypto";
11
+ import h, { createHash as g, randomUUID as _ } from "node:crypto";
16
12
  import v from "node:fs/promises";
17
- import se from "node:os";
18
- import y from "os";
19
- import { execFile as ce } from "child_process";
20
- import { promisify as le } from "util";
21
- import * as b from "winreg";
22
- import { z as x } from "zod";
23
- import S, { WebSocket as ue } from "ws";
24
- import { Buffer as C } from "node:buffer";
13
+ import y from "node:os";
14
+ import b, { promises as x } from "fs";
15
+ import S from "os";
16
+ import { execFile as ee } from "child_process";
17
+ import { promisify as te } from "util";
18
+ import * as C from "winreg";
19
+ import * as ne from "path";
20
+ import { z as w } from "zod";
21
+ import T, { WebSocket as re } from "ws";
22
+ import { Buffer as ie } from "node:buffer";
25
23
  //#region src/utils/version.ts
26
- var w = null;
27
- function de() {
28
- if (w !== null) return !!w;
29
- try {
30
- let e = n(a(i(o(import.meta.url)), "../../package.json"), "utf-8");
31
- w = (JSON.parse(e).version || "").includes("beta");
32
- } catch (e) {
33
- console.error(`Failed to check version: ${e}`);
34
- }
35
- return !!w;
24
+ var ae = null;
25
+ function oe() {
26
+ return ae === null && (ae = "1.3.0-alpha.3".includes("beta") || "1.3.0-alpha.3".includes("alpha")), !!ae;
36
27
  }
37
28
  //#endregion
38
29
  //#region src/runtime.ts
39
- var fe = null;
40
- function pe(e) {
41
- fe = e;
30
+ var se = null;
31
+ function ce(e) {
32
+ se = e;
42
33
  }
43
- function me() {
44
- if (!fe) throw Error("Yoyo runtime not initialized");
45
- return fe;
34
+ function le() {
35
+ if (!se) throw Error("Yoyo runtime not initialized");
36
+ return se;
46
37
  }
47
- function he() {
38
+ function ue() {
48
39
  try {
49
- let e = j();
40
+ let e = M();
50
41
  return {
51
42
  env: e.getEnvInfo().env,
52
43
  grayTag: e.getGrayTag()
@@ -57,46 +48,49 @@ function he() {
57
48
  }
58
49
  //#endregion
59
50
  //#region src/utils/env.ts
60
- var T = {
51
+ function E() {
52
+ return (typeof process < "u" ? process : {}).env || {};
53
+ }
54
+ var D = {
61
55
  brand: "YOYO_CLAW_BRAND",
62
56
  manufacture: "YOYO_CLAW_MANUFACTURER",
63
57
  deviceType: "YOYO_CLAW_DEVICE_TYPE",
64
58
  userId: "YOYO_CLAW_USER_ID"
65
- }, ge = "YOYO_CLAW_ENV", _e = {
59
+ }, de = "YOYO_CLAW_ENV", fe = {
66
60
  dev: "dev",
67
61
  pre: "test",
68
62
  test: "test",
69
63
  prd: "production",
70
64
  production: "production"
71
65
  };
72
- function ve() {
66
+ function pe() {
73
67
  return {
74
- brand: process.env[T.brand],
75
- manufacture: process.env[T.manufacture],
76
- deviceType: process.env[T.deviceType]
68
+ brand: E()[D.brand],
69
+ manufacture: E()[D.manufacture],
70
+ deviceType: E()[D.deviceType]
77
71
  };
78
72
  }
79
- function ye() {
80
- return process.env[T.userId];
73
+ function me() {
74
+ return E()[D.userId];
81
75
  }
82
- function be() {
83
- let e = process.env[ge];
84
- if (e) return _e[e.toLowerCase()];
76
+ function he() {
77
+ let e = E()[de];
78
+ if (e) return fe[e.toLowerCase()];
85
79
  }
86
80
  //#endregion
87
81
  //#region src/utils/error.ts
88
- function E(e, t) {
82
+ function O(e, t) {
89
83
  let n = e instanceof Error ? e.message : String(e);
90
84
  return Error(`${t}: ${n}`, { cause: e });
91
85
  }
92
86
  //#endregion
93
87
  //#region src/utils/logger.ts
94
- var xe = null;
95
- function Se(e) {
96
- xe = e;
88
+ var ge = null;
89
+ function _e(e) {
90
+ ge = e;
97
91
  }
98
- function D() {
99
- return xe || {
92
+ function k() {
93
+ return ge || {
100
94
  debug: console.debug,
101
95
  info: console.log,
102
96
  warn: console.warn,
@@ -105,7 +99,7 @@ function D() {
105
99
  }
106
100
  //#endregion
107
101
  //#region src/modules/configs/provider.ts
108
- function Ce(e) {
102
+ function ve(e) {
109
103
  let t = {};
110
104
  if (!e.models?.providers) return t;
111
105
  let n = Object.keys(e.models.providers);
@@ -115,7 +109,7 @@ function Ce(e) {
115
109
  }
116
110
  return t;
117
111
  }
118
- function we(e, t) {
112
+ function ye(e, t) {
119
113
  let n = { ...e };
120
114
  if (n.models?.providers) {
121
115
  let e = {};
@@ -128,46 +122,46 @@ function we(e, t) {
128
122
  providers: e
129
123
  };
130
124
  }
131
- return n.agents &&= Te(n.agents, t), n.auth?.profiles && (n.auth = {
125
+ return n.agents &&= be(n.agents, t), n.auth?.profiles && (n.auth = {
132
126
  ...n.auth,
133
- profiles: Oe(n.auth.profiles, t)
134
- }, je(t)), n;
127
+ profiles: we(n.auth.profiles, t)
128
+ }, De(t)), n;
135
129
  }
136
- function Te(e, t) {
130
+ function be(e, t) {
137
131
  let n = { ...e };
138
- return n.defaults &&= Ee(n.defaults, t), n.list &&= n.list.map((e) => De(e, t)), n;
132
+ return n.defaults &&= xe(n.defaults, t), n.list &&= n.list.map((e) => Se(e, t)), n;
139
133
  }
140
- function Ee(e, t) {
134
+ function xe(e, t) {
141
135
  let n = { ...e };
142
- if (n.model &&= O(n.model, t), n.imageModel &&= O(n.imageModel, t), n.pdfModel &&= O(n.pdfModel, t), n.models) {
136
+ if (n.model &&= A(n.model, t), n.imageModel &&= A(n.imageModel, t), n.pdfModel &&= A(n.pdfModel, t), n.models) {
143
137
  let e = {};
144
138
  for (let [r, i] of Object.entries(n.models)) {
145
- let n = k(r, t);
139
+ let n = Ce(r, t);
146
140
  e[n] = i;
147
141
  }
148
142
  n.models = e;
149
143
  }
150
144
  return n.subagents?.model && (n.subagents = {
151
145
  ...n.subagents,
152
- model: O(n.subagents.model, t)
146
+ model: A(n.subagents.model, t)
153
147
  }), n;
154
148
  }
155
- function De(e, t) {
149
+ function Se(e, t) {
156
150
  let n = { ...e };
157
- return n.model &&= O(n.model, t), n.subagents?.model && (n.subagents = {
151
+ return n.model &&= A(n.model, t), n.subagents?.model && (n.subagents = {
158
152
  ...n.subagents,
159
- model: O(n.subagents.model, t)
153
+ model: A(n.subagents.model, t)
160
154
  }), n;
161
155
  }
162
- function O(e, t) {
163
- if (typeof e == "string") return k(e, t);
156
+ function A(e, t) {
157
+ if (typeof e == "string") return Ce(e, t);
164
158
  if (typeof e == "object" && e) {
165
159
  let n = { ...e };
166
- return n.primary &&= k(n.primary, t), n.fallbacks && Array.isArray(n.fallbacks) && (n.fallbacks = n.fallbacks.map((e) => k(e, t))), n;
160
+ return n.primary &&= Ce(n.primary, t), n.fallbacks && Array.isArray(n.fallbacks) && (n.fallbacks = n.fallbacks.map((e) => Ce(e, t))), n;
167
161
  }
168
162
  return e;
169
163
  }
170
- function k(e, t) {
164
+ function Ce(e, t) {
171
165
  let n = e.split("/");
172
166
  if (n.length > 0) {
173
167
  let e = t[n[0]];
@@ -175,7 +169,7 @@ function k(e, t) {
175
169
  }
176
170
  return e;
177
171
  }
178
- function Oe(e, t) {
172
+ function we(e, t) {
179
173
  let n = {};
180
174
  for (let [r, i] of Object.entries(e)) {
181
175
  let e = { ...i }, a = t[e.provider];
@@ -183,85 +177,85 @@ function Oe(e, t) {
183
177
  }
184
178
  return n;
185
179
  }
186
- function ke() {
187
- return process.platform === "win32" ? process.env.USERPROFILE || "" : process.env.HOME || "";
180
+ function Te() {
181
+ return process.platform === "win32" ? E().USERPROFILE || "" : E().HOME || "";
188
182
  }
189
- function Ae(e) {
190
- let t = [], n = ke(), r = e || u.join(n, ".openclaw"), i = u.join(r, "agents", "main", "agent", "auth-profiles.json");
191
- s.existsSync(i) && t.push(i);
192
- let a = u.join(r, "agents");
193
- if (s.existsSync(a)) {
194
- let e = s.readdirSync(a, { withFileTypes: !0 });
195
- for (let n of e) if (n.isDirectory()) {
196
- let e = u.join(a, n.name, "agent", "auth-profiles.json");
197
- s.existsSync(e) && !t.includes(e) && t.push(e);
183
+ function Ee(t) {
184
+ let n = [], i = Te(), a = t || r.join(i, ".openclaw"), o = r.join(a, "agents", "main", "agent", "auth-profiles.json");
185
+ e.existsSync(o) && n.push(o);
186
+ let s = r.join(a, "agents");
187
+ if (e.existsSync(s)) {
188
+ let t = e.readdirSync(s, { withFileTypes: !0 });
189
+ for (let i of t) if (i.isDirectory()) {
190
+ let t = r.join(s, i.name, "agent", "auth-profiles.json");
191
+ e.existsSync(t) && !n.includes(t) && n.push(t);
198
192
  }
199
193
  }
200
- return t;
194
+ return n;
201
195
  }
202
- function je(e, t) {
203
- let n = Ae(t), r = [], i = [], a = !1;
204
- for (let t of n) try {
205
- let n = s.readFileSync(t, "utf-8"), i = JSON.parse(n);
206
- if (!i.profiles || typeof i.profiles != "object") continue;
207
- let o = !1;
208
- for (let [t, n] of Object.entries(i.profiles)) {
209
- let t = n, r = t.provider, i = e[r];
210
- i && r !== i && (t.provider = i, o = !0);
211
- }
212
- if (i.order && typeof i.order == "object") {
213
- let t = {};
214
- for (let [n, r] of Object.entries(i.order)) {
215
- let i = e[n], a = i || n;
216
- t[a] = r, i && n !== i && (o = !0);
196
+ function De(t, n) {
197
+ let r = Ee(n), i = [], a = [], o = !1;
198
+ for (let n of r) try {
199
+ let r = e.readFileSync(n, "utf-8"), a = JSON.parse(r);
200
+ if (!a.profiles || typeof a.profiles != "object") continue;
201
+ let s = !1;
202
+ for (let [e, n] of Object.entries(a.profiles)) {
203
+ let e = n, r = e.provider, i = t[r];
204
+ i && r !== i && (e.provider = i, s = !0);
205
+ }
206
+ if (a.order && typeof a.order == "object") {
207
+ let e = {};
208
+ for (let [n, r] of Object.entries(a.order)) {
209
+ let i = t[n], a = i || n;
210
+ e[a] = r, i && n !== i && (s = !0);
217
211
  }
218
- o && (i.order = t);
212
+ s && (a.order = e);
219
213
  }
220
- if (i.lastGood && typeof i.lastGood == "object") {
221
- let t = {};
222
- for (let [n, r] of Object.entries(i.lastGood)) {
223
- let i = e[n], a = i || n;
224
- t[a] = r, i && n !== i && (o = !0);
214
+ if (a.lastGood && typeof a.lastGood == "object") {
215
+ let e = {};
216
+ for (let [n, r] of Object.entries(a.lastGood)) {
217
+ let i = t[n], a = i || n;
218
+ e[a] = r, i && n !== i && (s = !0);
225
219
  }
226
- o && (i.lastGood = t);
220
+ s && (a.lastGood = e);
227
221
  }
228
- o && (s.writeFileSync(t, JSON.stringify(i, null, 2) + "\n", "utf-8"), r.push(t), a = !0);
222
+ s && (e.writeFileSync(n, JSON.stringify(a, null, 2) + "\n", "utf-8"), i.push(n), o = !0);
229
223
  } catch (e) {
230
- let n = e instanceof Error ? e.message : String(e);
231
- i.push(`${t}: ${n}`);
224
+ let t = e instanceof Error ? e.message : String(e);
225
+ a.push(`${n}: ${t}`);
232
226
  }
233
227
  return {
234
- updated: a,
235
- files: r,
236
- errors: i
228
+ updated: o,
229
+ files: i,
230
+ errors: a
237
231
  };
238
232
  }
239
233
  //#endregion
240
234
  //#region src/modules/configs/config-manager.ts
241
- var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,alarm.enable,alarm.query,alarm.update,app.close,app.open,call.phone,call.search,capture-screenshot,contact.search,file-upload,hotspot,local-search,message.search,message.send,mobile-data,no-disturb,quiet-mode,ringing-mode,schedule.create,schedule.delete,schedule.search,schedule.update,screen-record,vibration-mode,volume.operate,wlan,bluetooth,location-service,nfc,usb-shared-network,eyecomfort,status-bar-show,brightness,autoscreen-onnotice,dark-mode,device-operation,camera,app.uninstall,audio-record,battery,gui.create,gui.pause,gui.terminate,mcp.tool.call".split(","), Fe = class {
235
+ var j = "yoyo", Oe = { watch: !0 }, ke = 250, Ae = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,alarm.enable,alarm.query,alarm.update,app.close,app.open,call.phone,call.search,capture-screenshot,contact.search,file-upload,hotspot,local-search,message.search,message.send,mobile-data,no-disturb,quiet-mode,ringing-mode,schedule.create,schedule.delete,schedule.search,schedule.update,screen-record,vibration-mode,volume.operate,wlan,bluetooth,location-service,nfc,usb-shared-network,eyecomfort,status-bar-show,brightness,autoscreen-onnotice,dark-mode,device-operation,camera,app.uninstall,audio-record,battery,gui.create,gui.pause,gui.terminate,mcp.tool.call".split(","), je = class {
242
236
  loadConfig() {
243
237
  try {
244
- return me().config.loadConfig();
238
+ return le().config.loadConfig();
245
239
  } catch (e) {
246
- throw E(e, "Failed to load config");
240
+ throw O(e, "Failed to load config");
247
241
  }
248
242
  }
249
243
  async saveConfig(e) {
250
244
  try {
251
- await me().config.writeConfigFile(e);
245
+ await le().config.writeConfigFile(e);
252
246
  } catch (e) {
253
- throw E(e, "Failed to save config");
247
+ throw O(e, "Failed to save config");
254
248
  }
255
249
  }
256
250
  getGatewayAuthConfig() {
257
251
  try {
258
252
  let e = this.loadConfig().gateway?.auth;
259
253
  if (!e) return;
260
- let t = {
261
- token: "",
262
- password: ""
254
+ let t = e.token ?? "", n = e.password ?? "";
255
+ return !t && !n ? void 0 : {
256
+ token: t,
257
+ password: n
263
258
  };
264
- return e.token && (t.token = e.token), e.password && (t.password = e.password), Object.keys(t).length === 0 ? void 0 : t;
265
259
  } catch (e) {
266
260
  console.error(`[claw-configs] Failed to read gateway auth config: ${e}`);
267
261
  return;
@@ -276,7 +270,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
276
270
  }
277
271
  getUserConfig() {
278
272
  try {
279
- return this.loadConfig().plugins?.entries?.[A]?.config?.user;
273
+ return this.loadConfig().plugins?.entries?.[j]?.config?.user;
280
274
  } catch (e) {
281
275
  console.error(`[claw-configs] Failed to read user config: ${e}`);
282
276
  return;
@@ -284,14 +278,14 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
284
278
  }
285
279
  getEnvInfo() {
286
280
  try {
287
- let e = this.loadConfig().plugins?.entries?.[A]?.config, t = e?.envInfo;
281
+ let e = this.loadConfig().plugins?.entries?.[j]?.config, t = e?.envInfo;
288
282
  if (t?.env) return t;
289
283
  let n = e?.env;
290
284
  if (n) return {
291
285
  env: n,
292
286
  source: "manual"
293
287
  };
294
- let r = be();
288
+ let r = he();
295
289
  return r ? {
296
290
  env: r,
297
291
  source: "env"
@@ -308,7 +302,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
308
302
  }
309
303
  getGrayTag() {
310
304
  try {
311
- return this.loadConfig().plugins?.entries?.[A]?.config?.gray;
305
+ return this.loadConfig().plugins?.entries?.[j]?.config?.gray;
312
306
  } catch (e) {
313
307
  console.error(`[claw-configs] Failed to read gray tag config: ${e}`);
314
308
  return;
@@ -316,7 +310,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
316
310
  }
317
311
  getDeviceConfig() {
318
312
  try {
319
- return this.loadConfig().plugins?.entries?.[A]?.config?.device;
313
+ return this.loadConfig().plugins?.entries?.[j]?.config?.device;
320
314
  } catch (e) {
321
315
  console.error(`[claw-configs] Failed to read device config: ${e}`);
322
316
  return;
@@ -324,17 +318,17 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
324
318
  }
325
319
  async updateDeviceConfig(e) {
326
320
  try {
327
- let t = this.loadConfig(), n = t.plugins?.entries?.[A]?.config?.device || {}, r = {
321
+ let t = this.loadConfig(), n = t.plugins?.entries?.[j]?.config?.device || {}, r = {
328
322
  ...t,
329
323
  plugins: {
330
324
  ...t.plugins,
331
325
  entries: {
332
326
  ...t.plugins?.entries,
333
- [A]: {
334
- ...t.plugins?.entries?.[A],
327
+ [j]: {
328
+ ...t.plugins?.entries?.[j],
335
329
  enabled: !0,
336
330
  config: {
337
- ...t.plugins?.entries?.[A]?.config,
331
+ ...t.plugins?.entries?.[j]?.config,
338
332
  device: {
339
333
  ...n,
340
334
  ...e
@@ -346,7 +340,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
346
340
  };
347
341
  await this.saveConfig(r);
348
342
  } catch (e) {
349
- throw E(e, "Failed to update device config");
343
+ throw O(e, "Failed to update device config");
350
344
  }
351
345
  }
352
346
  async updateEnv(e) {
@@ -357,11 +351,11 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
357
351
  ...t.plugins,
358
352
  entries: {
359
353
  ...t.plugins?.entries,
360
- [A]: {
361
- ...t.plugins?.entries?.[A],
354
+ [j]: {
355
+ ...t.plugins?.entries?.[j],
362
356
  enabled: !0,
363
357
  config: {
364
- ...t.plugins?.entries?.[A]?.config,
358
+ ...t.plugins?.entries?.[j]?.config,
365
359
  envInfo: {
366
360
  env: e,
367
361
  source: "manual"
@@ -374,12 +368,12 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
374
368
  };
375
369
  await this.saveConfig(n);
376
370
  } catch (e) {
377
- throw E(e, "Failed to update env config");
371
+ throw O(e, "Failed to update env config");
378
372
  }
379
373
  }
380
374
  async resetEnv() {
381
375
  try {
382
- let e = this.loadConfig(), t = e.plugins?.entries?.[A]?.config?.envInfo;
376
+ let e = this.loadConfig(), t = e.plugins?.entries?.[j]?.config?.envInfo;
383
377
  if (!t?.env) return;
384
378
  let n = {
385
379
  ...e,
@@ -387,11 +381,11 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
387
381
  ...e.plugins,
388
382
  entries: {
389
383
  ...e.plugins?.entries,
390
- [A]: {
391
- ...e.plugins?.entries?.[A],
384
+ [j]: {
385
+ ...e.plugins?.entries?.[j],
392
386
  enabled: !0,
393
387
  config: {
394
- ...e.plugins?.entries?.[A]?.config,
388
+ ...e.plugins?.entries?.[j]?.config,
395
389
  envInfo: {
396
390
  env: t.env,
397
391
  source: "env"
@@ -403,7 +397,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
403
397
  };
404
398
  await this.saveConfig(n);
405
399
  } catch (e) {
406
- throw E(e, "Failed to reset env config");
400
+ throw O(e, "Failed to reset env config");
407
401
  }
408
402
  }
409
403
  async updateGrayTag(e) {
@@ -414,11 +408,11 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
414
408
  ...t.plugins,
415
409
  entries: {
416
410
  ...t.plugins?.entries,
417
- [A]: {
418
- ...t.plugins?.entries?.[A],
411
+ [j]: {
412
+ ...t.plugins?.entries?.[j],
419
413
  enabled: !0,
420
414
  config: {
421
- ...t.plugins?.entries?.[A]?.config,
415
+ ...t.plugins?.entries?.[j]?.config,
422
416
  ...e && { gray: e }
423
417
  }
424
418
  }
@@ -427,7 +421,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
427
421
  };
428
422
  await this.saveConfig(n);
429
423
  } catch (e) {
430
- throw E(e, "Failed to update gray tag config");
424
+ throw O(e, "Failed to update gray tag config");
431
425
  }
432
426
  }
433
427
  async updateUserConfig(e) {
@@ -438,11 +432,11 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
438
432
  ...t.plugins,
439
433
  entries: {
440
434
  ...t.plugins?.entries,
441
- [A]: {
442
- ...t.plugins?.entries?.[A],
435
+ [j]: {
436
+ ...t.plugins?.entries?.[j],
443
437
  enabled: !0,
444
438
  config: {
445
- ...t.plugins?.entries?.[A]?.config,
439
+ ...t.plugins?.entries?.[j]?.config,
446
440
  user: e
447
441
  }
448
442
  }
@@ -451,7 +445,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
451
445
  };
452
446
  await this.saveConfig(n);
453
447
  } catch (e) {
454
- throw E(e, "Failed to update user config");
448
+ throw O(e, "Failed to update user config");
455
449
  }
456
450
  }
457
451
  async clearUserConfig() {
@@ -462,10 +456,10 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
462
456
  ...e.plugins,
463
457
  entries: {
464
458
  ...e.plugins?.entries,
465
- [A]: {
466
- ...e.plugins?.entries?.[A],
459
+ [j]: {
460
+ ...e.plugins?.entries?.[j],
467
461
  config: {
468
- ...e.plugins?.entries?.[A]?.config,
462
+ ...e.plugins?.entries?.[j]?.config,
469
463
  user: void 0
470
464
  }
471
465
  }
@@ -474,25 +468,25 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
474
468
  };
475
469
  await this.saveConfig(t);
476
470
  } catch (e) {
477
- throw E(e, "Failed to clear user config");
471
+ throw O(e, "Failed to clear user config");
478
472
  }
479
473
  }
480
474
  async initializePluginConfig(e) {
481
475
  try {
482
- let t = this.loadConfig(), n = t.plugins?.allow || [], r = n.includes(e) ? n : [...n, e], i = t.gateway?.nodes?.allowCommands || [], a = Array.from(new Set([...i, ...Pe])), o = t.skills || {}, s = o.load || {}, c = s.watch === Me.watch && s.watchDebounceMs !== void 0 ? s : {
476
+ let t = this.loadConfig(), n = t.plugins?.allow || [], r = n.includes(e) ? n : [...n, e], i = t.gateway?.nodes?.allowCommands || [], a = Array.from(new Set([...i, ...Ae])), o = t.skills || {}, s = o.load || {}, c = s.watch === Oe.watch && s.watchDebounceMs !== void 0 ? s : {
483
477
  ...s,
484
- ...Me,
485
- watchDebounceMs: s.watchDebounceMs ?? Ne
486
- }, l = t.plugins?.entries?.[e]?.config?.envInfo, u = t.plugins?.entries?.[e]?.config?.env, d = !!(l?.env || u), f = be(), p = !!l?.env && l.source === "env", m = !l?.env && !!u || p && f && l.env !== f, ee = !d || m, te = {
487
- env: f || u || (de() ? "test" : "production"),
478
+ ...Oe,
479
+ watchDebounceMs: s.watchDebounceMs ?? ke
480
+ }, l = t.plugins?.entries?.[e]?.config?.envInfo, u = t.plugins?.entries?.[e]?.config?.env, d = !!(l?.env || u), f = he(), p = !!l?.env && l.source === "env", m = !l?.env && !!u || p && f && l.env !== f, h = !d || m, g = {
481
+ env: f || u || (oe() ? "test" : "production"),
488
482
  source: "env"
489
- }, ne = t.plugins?.entries?.[e]?.config || {}, re = ee ? {
490
- ...ne,
491
- envInfo: te,
483
+ }, _ = t.plugins?.entries?.[e]?.config || {}, v = h ? {
484
+ ..._,
485
+ envInfo: g,
492
486
  env: void 0
493
- } : ne, h = Ce(t);
494
- Object.keys(h).length > 0 && D().info(`[claw-configs] Found ${Object.keys(h).length} providers to rename: ${Object.entries(h).map(([e, t]) => `${e} -> ${t}`).join(", ")}`);
495
- let g = {
487
+ } : _, y = ve(t);
488
+ Object.keys(y).length > 0 && k().info(`[claw-configs] Found ${Object.keys(y).length} providers to rename: ${Object.entries(y).map(([e, t]) => `${e} -> ${t}`).join(", ")}`);
489
+ let b = {
496
490
  ...t,
497
491
  plugins: {
498
492
  ...t.plugins,
@@ -502,7 +496,7 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
502
496
  [e]: {
503
497
  ...t.plugins?.entries?.[e],
504
498
  enabled: !0,
505
- config: re
499
+ config: v
506
500
  }
507
501
  }
508
502
  },
@@ -518,26 +512,26 @@ var A = "yoyo", Me = { watch: !0 }, Ne = 250, Pe = /* @__PURE__ */ "alarm.create
518
512
  load: c
519
513
  }
520
514
  };
521
- Object.keys(h).length > 0 && (g = we(g, h), D().info("[claw-configs] Provider renaming completed")), await this.saveConfig(g);
515
+ Object.keys(y).length > 0 && (b = ye(b, y), k().info("[claw-configs] Provider renaming completed")), await this.saveConfig(b);
522
516
  } catch (e) {
523
- throw E(e, "failed to initialize plugin config");
517
+ throw O(e, "failed to initialize plugin config");
524
518
  }
525
519
  }
526
- }, Ie = null;
527
- function j() {
528
- return Ie ||= new Fe(), Ie;
520
+ }, Me = null;
521
+ function M() {
522
+ return Me ||= new je(), Me;
529
523
  }
530
524
  //#endregion
531
525
  //#region src/commands/env/impl.ts
532
- var Le = {
526
+ var Ne = {
533
527
  env: "environment variable",
534
528
  manual: "manual config"
535
529
  };
536
- function Re(e, t) {
530
+ function Pe(e, t) {
537
531
  return t.command("env").description("Manage runtime environment (dev/test/production)").option("--set <env>", "Set environment: dev, test or production").option("--gray <tag>", "Set gray header").option("--reset", "Reset env source to environment variable").action(async (e) => {
538
- let { set: t, gray: n, reset: r } = e, i = D();
532
+ let { set: t, gray: n, reset: r } = e, i = k();
539
533
  try {
540
- let e = j();
534
+ let e = M();
541
535
  if (r && (await e.resetEnv(), i.info("✅ Environment source reset to environment variable")), t) {
542
536
  if (t !== "test" && t !== "dev" && t !== "production") {
543
537
  i.error("❌ Invalid environment. Use 'test' or 'production'.");
@@ -547,7 +541,7 @@ function Re(e, t) {
547
541
  }
548
542
  if (n ? (await e.updateGrayTag(n), i.info(`✅ Gray tag set to: ${n}`)) : n === "" && (await e.updateGrayTag(void 0), i.info("✅ Gray tag cleared")), !t && n === void 0) {
549
543
  let t = e.getEnvInfo(), n = e.getGrayTag();
550
- i.info(`📋 Current environment: ${t.env} (source: ${Le[t.source]})`), n ? i.info(`📋 Current gray tag: ${n}`) : i.info("📋 Gray tag: not set");
544
+ i.info(`📋 Current environment: ${t.env} (source: ${Ne[t.source]})`), n ? i.info(`📋 Current gray tag: ${n}`) : i.info("📋 Gray tag: not set");
551
545
  }
552
546
  } catch (e) {
553
547
  let t = e instanceof Error ? e.message : String(e);
@@ -557,19 +551,19 @@ function Re(e, t) {
557
551
  }
558
552
  //#endregion
559
553
  //#region src/utils/id.ts
560
- var ze = f("0123456789abcdefghijklmnopqrstuvwxyz", 32);
561
- function M(e) {
562
- return ze(e);
554
+ var Fe = a("0123456789abcdefghijklmnopqrstuvwxyz", 32);
555
+ function Ie(e) {
556
+ return Fe(e);
563
557
  }
564
558
  //#endregion
565
559
  //#region src/apis/helpers.ts
566
- function Be(e) {
560
+ function Le(e) {
567
561
  return e.status >= 200 && e.status < 300 && e.data.code === "1";
568
562
  }
569
563
  //#endregion
570
564
  //#region src/apis/hosts.ts
571
- function Ve() {
572
- let e = he(), t;
565
+ function Re() {
566
+ let e = ue(), t;
573
567
  switch (e.env) {
574
568
  case "dev":
575
569
  t = {
@@ -594,34 +588,34 @@ function Ve() {
594
588
  }
595
589
  //#endregion
596
590
  //#region src/utils/proxy.ts
597
- function He(e) {
598
- return e || process.env.HTTP_PROXY || process.env.http_proxy || process.env.HTTPS_PROXY || process.env.https_proxy;
591
+ function ze(e) {
592
+ return e || E().HTTP_PROXY || E().http_proxy || E().HTTPS_PROXY || E().https_proxy;
599
593
  }
600
- function Ue(e, t) {
594
+ function Be(e, t) {
601
595
  return !t && !!e;
602
596
  }
603
- function We(e, t) {
604
- let n = He(t);
597
+ function Ve(e, t) {
598
+ let n = ze(t);
605
599
  if (n) {
606
- if (e.startsWith("wss://")) return new te(n);
607
- if (e.startsWith("ws://")) return new ee(n);
600
+ if (e.startsWith("wss://")) return new l(n);
601
+ if (e.startsWith("ws://")) return new c(n);
608
602
  }
609
603
  }
610
604
  //#endregion
611
605
  //#region src/apis/http-client.ts
612
- var Ge = class extends Error {
606
+ var He = class extends Error {
613
607
  constructor(e, t, n) {
614
608
  super(n), this.status = e, this.data = t, this.name = "HttpError";
615
609
  }
616
- }, Ke = class {
610
+ }, Ue = class {
617
611
  baseUrl;
618
612
  defaultHeaders;
619
613
  defaultTimeout;
620
614
  proxyAgent;
621
615
  constructor(e, t) {
622
616
  this.baseUrl = e.replace(/\/$/, ""), this.defaultHeaders = t?.defaultHeaders || {}, this.defaultTimeout = t?.defaultTimeout || 3e4;
623
- let n = He(t?.proxy);
624
- n && (this.proxyAgent = new p(n));
617
+ let n = ze(t?.proxy);
618
+ n && (this.proxyAgent = new o(n));
625
619
  }
626
620
  async request(e) {
627
621
  let { method: t = "GET", headers: n = {}, body: r, timeout: i = this.defaultTimeout, query: a } = e, o = e.url;
@@ -633,35 +627,35 @@ var Ge = class extends Error {
633
627
  let t = e.toString();
634
628
  t && (o += (o.includes("?") ? "&" : "?") + t);
635
629
  }
636
- let s = {
630
+ let c = {
637
631
  ...this.defaultHeaders,
638
632
  ...n
639
633
  };
640
- r && !s["Content-Type"] && (s["Content-Type"] = "application/json");
641
- let c;
642
- r != null && (c = typeof r == "string" ? r : JSON.stringify(r));
634
+ r && !c["Content-Type"] && (c["Content-Type"] = "application/json");
635
+ let l;
636
+ r != null && (l = typeof r == "string" ? r : JSON.stringify(r));
643
637
  try {
644
- let n = Ue(He(), e.disableProxy) && this.proxyAgent ? this.proxyAgent : void 0, r = await m(o, {
638
+ let n = Be(ze(), e.disableProxy) && this.proxyAgent ? this.proxyAgent : void 0, r = await s(o, {
645
639
  method: t,
646
- headers: s,
647
- body: c,
640
+ headers: c,
641
+ body: l,
648
642
  headersTimeout: i,
649
643
  bodyTimeout: i,
650
644
  dispatcher: n
651
- }), a = await r.body.text(), l;
645
+ }), a = await r.body.text(), u;
652
646
  try {
653
- l = a ? JSON.parse(a) : {};
647
+ u = a ? JSON.parse(a) : {};
654
648
  } catch {
655
- l = a;
649
+ u = a;
656
650
  }
657
651
  if (r.statusCode >= 200 && r.statusCode < 300) return {
658
- data: l,
652
+ data: u,
659
653
  status: r.statusCode,
660
654
  headers: r.headers
661
655
  };
662
- throw new Ge(r.statusCode, l, `HTTP request failed with status ${r.statusCode}`);
656
+ throw new He(r.statusCode, u, `HTTP request failed with status ${r.statusCode}`);
663
657
  } catch (e) {
664
- throw e instanceof Ge ? e : E(e, "HTTP request failed");
658
+ throw e instanceof He ? e : O(e, "HTTP request failed");
665
659
  }
666
660
  }
667
661
  async get(e, t) {
@@ -699,14 +693,14 @@ var Ge = class extends Error {
699
693
  method: "PATCH"
700
694
  });
701
695
  }
702
- }, qe = class {
696
+ }, We = class {
703
697
  httpClient;
704
698
  constructor(e, t) {
705
- this.httpClient = new Ke(e, t);
699
+ this.httpClient = new Ue(e, t);
706
700
  }
707
701
  async registerDevice(e, t, n) {
708
702
  let r = {
709
- "x-trace-id": M(),
703
+ "x-trace-id": Ie(),
710
704
  "x-jwt-token": t.token,
711
705
  "x-device-id": e.deviceId
712
706
  }, i = {
@@ -726,7 +720,7 @@ var Ge = class extends Error {
726
720
  }
727
721
  async logoutDevice(e, t) {
728
722
  let n = {
729
- "x-trace-id": M(),
723
+ "x-trace-id": Ie(),
730
724
  "x-jwt-token": t.token,
731
725
  "x-device-id": e.deviceId
732
726
  }, r = {
@@ -743,7 +737,7 @@ var Ge = class extends Error {
743
737
  });
744
738
  }
745
739
  async exchangeToken(e, t) {
746
- let n = M(), r = {
740
+ let n = Ie(), r = {
747
741
  "Content-Type": "application/json",
748
742
  "x-device-id": e.deviceId,
749
743
  "x-trace-id": n
@@ -758,25 +752,25 @@ var Ge = class extends Error {
758
752
  headers: r,
759
753
  timeout: 15e3
760
754
  });
761
- if (Be(a) && a.data.data) return a.data.data;
755
+ if (Le(a) && a.data.data) return a.data.data;
762
756
  throw Error(`failed to get token: ${JSON.stringify(a.data)}, traceId: ${n}`);
763
757
  }
764
758
  };
765
759
  function N() {
766
- let e = Ve();
767
- return new qe(`https://${e.clawCloud}/aicloud/yoyo-claw-service`, e.grayTag ? { defaultHeaders: { "x-gray": e.grayTag } } : void 0);
760
+ let e = Re();
761
+ return new We(`https://${e.clawCloud}/aicloud/yoyo-claw-service`, e.grayTag ? { defaultHeaders: { "x-gray": e.grayTag } } : void 0);
768
762
  }
769
763
  //#endregion
770
764
  //#region src/honor-auth/assets/favicon.png
771
- var Je = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAAGWvHq+AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAOqADAAQAAAABAAAAOgAAAACjq6v0AAAfGElEQVRoBX2bCbzdVXXv1384/zPcOeNNQhIgBHyRqQJKQIJALYND5X362trX1rb6UD8+i0wqavsCfopWigjFKk7FKlKJCFSFBMIMIhIUA0IMGCBkvje5N/fce8/wn973t//nXC/V9oR993/Ye6/9W2vttdZe+49nnd+bbs7Pm3PQ1gzut0rPuD3xtWu8W/TK058z7p7ObbJkpX1mg7s9WzTlWX8jsU9/uex5l93/6nn1tPSjfzqlx3qCplkjtVazal/8VGxzvIr5x3oH11x/bNN64r2Wt2OzqaL8ycd6bU4yYuGqZKQcplWzvXXzssQacb+NUvKBxBYkr1h4WLbrifGnn7VswRpLJ2u2P59rrahuPVdfZwuDpcUk8x9cksf1l23cO8wSf6n1bLjT0ukF1i4dstChEJJ83ercDuw125OajfTa1P7e4d5bnthbNMhz74yb7PLBMVvYP2b7e5r2lX+52tvjnXPvRN5oRhaNBbbggGc9DDBYz60PNOFRQd1G8sC+/ceheWkOvMzuuKNiO38Sm39MOmo3ndqyS/7335iNTdjaC//a3nx6YIcvnjDvp3dvyI87colFlaplI6klQ8vspZHAdn7xHguPDHba/i3brNb/FjuYDNvoRADWF21J45cWDiTbbaC1w6afu8384/7eDv3GxVaaGrYoG+4w49Zz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KbL9YzmdukAjjYzz/O3dEKZs1IHUm6zxMELGMXTSwiiTIWR1KY9ZSTw4wz7CSc5n8nwErZBOdzdQzxmLVK++3bT/Hl5mslNnuOv+v6/wOf3U+K5UdQfwAAAABJRU5ErkJggg==", Ye = "<svg aria-hidden=\"true\" viewBox=\"0 0 64 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"32\" cy=\"32\" r=\"30\" fill=\"currentColor\" opacity=\"0.12\"/><circle cx=\"32\" cy=\"32\" r=\"21\" fill=\"currentColor\"/><path d=\"M22.5 32.5L29 39L42.5 25.5\" stroke=\"white\" stroke-width=\"4.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", Xe = "<svg aria-hidden=\"true\" viewBox=\"0 0 64 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"32\" cy=\"32\" r=\"30\" fill=\"currentColor\" opacity=\"0.12\"/><circle cx=\"32\" cy=\"32\" r=\"21\" fill=\"currentColor\"/><path d=\"M24.5 24.5L39.5 39.5M39.5 24.5L24.5 39.5\" stroke=\"white\" stroke-width=\"4.5\" stroke-linecap=\"round\"/></svg>", Ze = { favicon: "/favicon.png" };
765
+ var Ge = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADoAAAA6CAYAAAGWvHq+AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAOqADAAQAAAABAAAAOgAAAACjq6v0AAAfGElEQVRoBX2bCbzdVXXv1384/zPcOeNNQhIgBHyRqQJKQIJALYND5X362trX1rb6UD8+i0wqavsCfopWigjFKk7FKlKJCFSFBMIMIhIUA0IMGCBkvje5N/fce8/wn973t//nXC/V9oR993/Ye6/9W2vttdZe+49nnd+bbs7Pm3PQ1gzut0rPuD3xtWu8W/TK058z7p7ObbJkpX1mg7s9WzTlWX8jsU9/uex5l93/6nn1tPSjfzqlx3qC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6lPGeAYoAAqQs+ruM4A5Sete61mBBM8EWNf6XBDnS0FtsZL6XkbKUawIt4C5Zj3RzQHTma/CH57p3hMYGTYHWnUBWOkWAZyRKhIV+EBWN/cn49T/o7m3fQv/U/xeA1SP3NL54Qc+DIXPYN45LhbgWQC7112gri7AOqCA8hSFz4AGJBInzGGSEOgCFVjuFXhIisU1wARAIN0zAZ4NUr65ACvgDnRHZUNO7whmpgB4ef/37riBnnDxN7/fAvqbV7S8808XYxYvZOZ/CsVlRSaLGTp1xXepdpa6ACZwkqar3XUHpMC5ZFMhUYy3AyipOkkCzDFBUkOiBXA9A5h7VzDArVdJUW6E5+4LHvO3c9r7vSzJP19bd787O5uNoXv93wLtNppd52uhsuot/L822XwLmkQOHluV9gDqi9XJ+HKbL9YzmdukAjjYzz/O3dEKZs1IHUm6zxMELGMXTSwiiTIWR1KY9ZSTw4wz7CSc5n8nwErZBOdzdQzxmLVK++3bT/Hl5mslNnuOv+v6/wOf3U+K5UdQfwAAAABJRU5ErkJggg==", Ke = "<svg aria-hidden=\"true\" viewBox=\"0 0 64 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"32\" cy=\"32\" r=\"30\" fill=\"currentColor\" opacity=\"0.12\"/><circle cx=\"32\" cy=\"32\" r=\"21\" fill=\"currentColor\"/><path d=\"M22.5 32.5L29 39L42.5 25.5\" stroke=\"white\" stroke-width=\"4.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", qe = "<svg aria-hidden=\"true\" viewBox=\"0 0 64 64\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><circle cx=\"32\" cy=\"32\" r=\"30\" fill=\"currentColor\" opacity=\"0.12\"/><circle cx=\"32\" cy=\"32\" r=\"21\" fill=\"currentColor\"/><path d=\"M24.5 24.5L39.5 39.5M39.5 24.5L24.5 39.5\" stroke=\"white\" stroke-width=\"4.5\" stroke-linecap=\"round\"/></svg>", Je = { favicon: "/favicon.png" };
772
766
  function P(e) {
773
767
  return e.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
774
768
  }
775
- function Qe(e) {
769
+ function Ye(e) {
776
770
  return !e || e.length === 0 ? "" : `<div class="details">${e.map((e) => `<div class="detail-item"><span class="detail-key">${P(e.key)}</span><span class="detail-value">${P(e.value)}</span></div>`).join("")}</div>`;
777
771
  }
778
772
  function F(e) {
779
- let t = e.statusClass === "success" ? Ye : Xe;
773
+ let t = e.statusClass === "success" ? Ke : qe;
780
774
  return `<!doctype html>
781
775
  <html lang="zh-CN">
782
776
  <head>
@@ -968,7 +962,7 @@ function F(e) {
968
962
  </div>
969
963
  <div class="icon-wrap ${e.statusClass}">${t}</div>
970
964
  <h1>${P(e.title)}</h1>
971
- ${Qe(e.details)}
965
+ ${Ye(e.details)}
972
966
  <div class="footer">
973
967
  <p class="hint">${P(e.hintText)}</p>
974
968
  <p class="caption">浏览器不会自动关闭当前页面,保留或稍后关闭都不影响登录结果。</p>
@@ -979,9 +973,9 @@ function F(e) {
979
973
  }
980
974
  //#endregion
981
975
  //#region src/honor-auth/callback-server.ts
982
- var $e = { "favicon.png": Je };
983
- function et(e, t) {
984
- let n = $e[t];
976
+ var Xe = { "favicon.png": Ge };
977
+ function Ze(e, t) {
978
+ let n = Xe[t];
985
979
  if (!n) {
986
980
  e.writeHead(404), e.end();
987
981
  return;
@@ -992,19 +986,19 @@ function et(e, t) {
992
986
  "Cache-Control": "public, max-age=3600"
993
987
  }), e.end(i);
994
988
  }
995
- function tt(e) {
989
+ function Qe(e) {
996
990
  return new Promise((t, n) => {
997
- let { port: r, timeout: i = 6e5, onCodeReceived: a, onError: o } = e, s = null, c = !1, l = !1, u = !1, d = () => {
998
- c || (c = !0, s && clearTimeout(s), m.close());
999
- }, f = (e) => {
1000
- d(), o?.(e), u || (u = !0, n(e));
1001
- }, p = (e = 120) => {
991
+ let { port: r, timeout: i = 6e5, onCodeReceived: a, onError: o } = e, s = null, c = !1, l = !1, f = !1, p = () => {
992
+ c || (c = !0, s && clearTimeout(s), g.close());
993
+ }, m = (e) => {
994
+ p(), o?.(e), f || (f = !0, n(e));
995
+ }, h = (e = 120) => {
1002
996
  setTimeout(() => {
1003
- d();
997
+ p();
1004
998
  }, e);
1005
- }, m = ne((e, t) => {
999
+ }, g = u((e, t) => {
1006
1000
  try {
1007
- let n = new re(e.url || "", `http://localhost:${r}`);
1001
+ let n = new d(e.url || "", `http://localhost:${r}`);
1008
1002
  if (e.method !== "GET") {
1009
1003
  t.writeHead(405, { "Content-Type": "text/html; charset=utf-8" }), t.end(F({
1010
1004
  pageTitle: "请求方式不支持",
@@ -1014,8 +1008,8 @@ function tt(e) {
1014
1008
  }));
1015
1009
  return;
1016
1010
  }
1017
- if (n.pathname === "/favicon.ico" || n.pathname === Ze.favicon) {
1018
- et(t, "favicon.png");
1011
+ if (n.pathname === "/favicon.ico" || n.pathname === Je.favicon) {
1012
+ Ze(t, "favicon.png");
1019
1013
  return;
1020
1014
  }
1021
1015
  let i = n.searchParams.get("code") || "", o = n.searchParams.get("error") || "", s = n.searchParams.get("error_description") || n.searchParams.get("error_message") || "";
@@ -1024,7 +1018,7 @@ function tt(e) {
1024
1018
  statusClass: "success",
1025
1019
  title: "登录已完成",
1026
1020
  hintText: "请返回 OpenClaw,登录流程会继续完成。"
1027
- })), p(), a(i)) : o && !l ? (t.writeHead(400, { "Content-Type": "text/html; charset=utf-8" }), t.end(F({
1021
+ })), h(), a(i)) : o && !l ? (t.writeHead(400, { "Content-Type": "text/html; charset=utf-8" }), t.end(F({
1028
1022
  pageTitle: "授权失败",
1029
1023
  statusClass: "error",
1030
1024
  title: "未能完成授权",
@@ -1037,7 +1031,7 @@ function tt(e) {
1037
1031
  value: s
1038
1032
  }] : []]
1039
1033
  })), setTimeout(() => {
1040
- f(/* @__PURE__ */ Error(s ? `authorization failed: ${o} (${s})` : `authorization failed: ${o}`));
1034
+ m(/* @__PURE__ */ Error(s ? `authorization failed: ${o} (${s})` : `authorization failed: ${o}`));
1041
1035
  }, 120)) : l ? (t.writeHead(200, { "Content-Type": "text/html; charset=utf-8" }), t.end(F({
1042
1036
  pageTitle: "登录已完成",
1043
1037
  statusClass: "success",
@@ -1049,7 +1043,7 @@ function tt(e) {
1049
1043
  title: "回调参数不完整",
1050
1044
  hintText: "请返回 OpenClaw 重新发起登录。"
1051
1045
  })), setTimeout(() => {
1052
- f(/* @__PURE__ */ Error("authorization failed: no code in callback"));
1046
+ m(/* @__PURE__ */ Error("authorization failed: no code in callback"));
1053
1047
  }, 120));
1054
1048
  } catch (e) {
1055
1049
  console.error("authorize callback error:", e), t.writeHead(500, { "Content-Type": "text/html; charset=utf-8" }), t.end(F({
@@ -1058,24 +1052,24 @@ function tt(e) {
1058
1052
  title: "回调服务出现异常",
1059
1053
  hintText: "请返回 OpenClaw 后重新发起登录。"
1060
1054
  })), setTimeout(() => {
1061
- f(/* @__PURE__ */ Error("authorization failed: callback server internal error"));
1055
+ m(/* @__PURE__ */ Error("authorization failed: callback server internal error"));
1062
1056
  }, 120);
1063
1057
  }
1064
1058
  });
1065
- m.on("error", (e) => {
1066
- f(e);
1067
- }), m.listen(r, () => {
1059
+ g.on("error", (e) => {
1060
+ m(e);
1061
+ }), g.listen(r, () => {
1068
1062
  s = setTimeout(() => {
1069
- f(/* @__PURE__ */ Error("authorize timeout"));
1063
+ m(/* @__PURE__ */ Error("authorize timeout"));
1070
1064
  }, i);
1071
- }), m.on("close", () => {
1072
- s && clearTimeout(s), u || (u = !0, t());
1065
+ }), g.on("close", () => {
1066
+ s && clearTimeout(s), f || (f = !0, t());
1073
1067
  });
1074
1068
  });
1075
1069
  }
1076
1070
  //#endregion
1077
1071
  //#region src/honor-auth/config.ts
1078
- var nt = {
1072
+ var $e = {
1079
1073
  authHost: "https://hnoauth-login-test-drcn.cloud.honor.com",
1080
1074
  clientId: "221641491",
1081
1075
  redirectUri: "http://127.0.0.1:8081/deepLink",
@@ -1083,7 +1077,7 @@ var nt = {
1083
1077
  scope: "openid profile",
1084
1078
  reqClientType: "110",
1085
1079
  loginChannel: "99011000"
1086
- }, rt = {
1080
+ }, et = {
1087
1081
  authHost: "https://hnoauth-login-drcn.cloud.honor.com",
1088
1082
  clientId: "221000597",
1089
1083
  redirectUri: "http://127.0.0.1:8081/deepLink",
@@ -1092,31 +1086,31 @@ var nt = {
1092
1086
  reqClientType: "110",
1093
1087
  loginChannel: "99011000"
1094
1088
  };
1095
- function it(e) {
1089
+ function tt(e) {
1096
1090
  return {
1097
- ...he()?.env === "production" ? rt : nt,
1091
+ ...ue()?.env === "production" ? et : $e,
1098
1092
  ...e
1099
1093
  };
1100
1094
  }
1101
1095
  //#endregion
1102
1096
  //#region src/honor-auth/honor-auth-client.ts
1103
- var at = class {
1097
+ var nt = class {
1104
1098
  config;
1105
1099
  constructor(e) {
1106
1100
  this.config = e;
1107
1101
  }
1108
1102
  generateRandomString(e) {
1109
- let t = ie(e), n = "";
1103
+ let t = m(e), n = "";
1110
1104
  for (let r = 0; r < e; r++) n += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[t[r] % 62];
1111
1105
  return n;
1112
1106
  }
1113
1107
  generateCodeVerifier(e = 128) {
1114
- let t = ie(e), n = "";
1108
+ let t = m(e), n = "";
1115
1109
  for (let r = 0; r < e; r++) n += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~"[t[r] % 66];
1116
1110
  return n;
1117
1111
  }
1118
1112
  generateCodeChallenge(e) {
1119
- return g("sha256").update(e).digest().toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1113
+ return p("sha256").update(e).digest().toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1120
1114
  }
1121
1115
  generatePKCEParams() {
1122
1116
  let e = this.generateCodeVerifier();
@@ -1144,8 +1138,8 @@ var at = class {
1144
1138
  return { ...this.config };
1145
1139
  }
1146
1140
  };
1147
- function ot(e) {
1148
- return new at(e);
1141
+ function rt(e) {
1142
+ return new nt(e);
1149
1143
  }
1150
1144
  //#endregion
1151
1145
  //#region src/utils/fs-safe.ts
@@ -1154,61 +1148,61 @@ var I = class extends Error {
1154
1148
  constructor(e, t, n) {
1155
1149
  super(t, n), this.code = e, this.name = "SafeFsError";
1156
1150
  }
1157
- }, st = new Set(["ENOENT", "ENOTDIR"]), ct = new Set([
1151
+ }, it = new Set(["ENOENT", "ENOTDIR"]), at = new Set([
1158
1152
  "ELOOP",
1159
1153
  "EINVAL",
1160
1154
  "ENOTSUP"
1161
1155
  ]);
1162
- function lt(e) {
1156
+ function ot(e) {
1163
1157
  return !!(e && typeof e == "object" && "code" in e);
1164
1158
  }
1165
1159
  function L(e) {
1166
- return lt(e) && typeof e.code == "string" && st.has(e.code);
1160
+ return ot(e) && typeof e.code == "string" && it.has(e.code);
1167
1161
  }
1168
- function ut(e) {
1169
- return lt(e) && typeof e.code == "string" && ct.has(e.code);
1162
+ function st(e) {
1163
+ return ot(e) && typeof e.code == "string" && at.has(e.code);
1170
1164
  }
1171
- function dt(e) {
1172
- let t = u.win32.normalize(e);
1165
+ function ct(e) {
1166
+ let t = r.win32.normalize(e);
1173
1167
  return t.startsWith("\\\\?\\") && (t = t.slice(4), t.toUpperCase().startsWith("UNC\\") && (t = `\\\\${t.slice(4)}`)), t.replaceAll("/", "\\").toLowerCase();
1174
1168
  }
1175
1169
  function R(e, t) {
1176
- let n = u.resolve(e), r = u.resolve(t);
1170
+ let n = r.resolve(e), i = r.resolve(t);
1177
1171
  if (process.platform === "win32") {
1178
- let e = dt(n), t = dt(r), i = u.win32.relative(e, t);
1179
- return i === "" || !i.startsWith("..") && !u.win32.isAbsolute(i);
1172
+ let e = ct(n), t = ct(i), a = r.win32.relative(e, t);
1173
+ return a === "" || !a.startsWith("..") && !r.win32.isAbsolute(a);
1180
1174
  }
1181
- let i = u.relative(n, r);
1182
- return i === "" || !i.startsWith("..") && !u.isAbsolute(i);
1175
+ let a = r.relative(n, i);
1176
+ return a === "" || !a.startsWith("..") && !r.isAbsolute(a);
1183
1177
  }
1184
- function ft(e) {
1178
+ function lt(e) {
1185
1179
  return e === 0 || e === 0n;
1186
1180
  }
1187
1181
  function z(e, t, n = process.platform) {
1188
- return e.ino === t.ino ? e.dev === t.dev ? !0 : n === "win32" && (ft(e.dev) || ft(t.dev)) : !1;
1182
+ return e.ino === t.ino ? e.dev === t.dev ? !0 : n === "win32" && (lt(e.dev) || lt(t.dev)) : !1;
1189
1183
  }
1190
- var pt = process.platform !== "win32" && "O_NOFOLLOW" in c, mt = c.O_RDONLY | (pt ? c.O_NOFOLLOW : 0), ht = c.O_WRONLY | c.O_CREAT | c.O_EXCL | (pt ? c.O_NOFOLLOW : 0), gt = c.O_WRONLY | c.O_APPEND | (pt ? c.O_NOFOLLOW : 0), _t = (e) => e.endsWith(u.sep) ? e : e + u.sep;
1191
- function vt(e, t) {
1184
+ var ut = process.platform !== "win32" && "O_NOFOLLOW" in t, dt = t.O_RDONLY | (ut ? t.O_NOFOLLOW : 0), ft = t.O_WRONLY | t.O_CREAT | t.O_EXCL | (ut ? t.O_NOFOLLOW : 0), pt = t.O_WRONLY | t.O_APPEND | (ut ? t.O_NOFOLLOW : 0), mt = (e) => e.endsWith(r.sep) ? e : e + r.sep;
1185
+ function ht(e, t) {
1192
1186
  if (!e.startsWith("~")) return e;
1193
- let n = t ?? process.env.HOME ?? process.env.USERPROFILE ?? se.homedir();
1187
+ let n = t ?? E().HOME ?? E().USERPROFILE ?? y.homedir();
1194
1188
  return n ? e.replace(/^~(?=$|[\\/])/, n) : e;
1195
1189
  }
1196
- async function yt(e) {
1190
+ async function gt(e) {
1197
1191
  let t;
1198
1192
  try {
1199
1193
  t = await v.realpath(e.rootDir);
1200
1194
  } catch (e) {
1201
1195
  throw L(e) ? new I("not-found", "root dir not found") : e;
1202
1196
  }
1203
- let n = _t(t), r = vt(e.relativePath), i = u.resolve(n, r);
1204
- if (!R(n, i)) throw new I("outside-root", "file is outside workspace root");
1197
+ let n = mt(t), i = ht(e.relativePath), a = r.resolve(n, i);
1198
+ if (!R(n, a)) throw new I("outside-root", "file is outside workspace root");
1205
1199
  return {
1206
1200
  rootReal: t,
1207
1201
  rootWithSep: n,
1208
- resolved: i
1202
+ resolved: a
1209
1203
  };
1210
1204
  }
1211
- async function bt(e, t) {
1205
+ async function _t(e, t) {
1212
1206
  try {
1213
1207
  if ((await v.lstat(e)).isDirectory()) throw new I("not-file", "not a file");
1214
1208
  } catch (e) {
@@ -1216,19 +1210,19 @@ async function bt(e, t) {
1216
1210
  }
1217
1211
  let n;
1218
1212
  try {
1219
- n = await v.open(e, mt);
1213
+ n = await v.open(e, dt);
1220
1214
  } catch (e) {
1221
- throw L(e) ? new I("not-found", "file not found") : ut(e) ? new I("symlink", "symlink open blocked", { cause: e }) : lt(e) && e.code === "EISDIR" ? new I("not-file", "not a file") : e;
1215
+ throw L(e) ? new I("not-found", "file not found") : st(e) ? new I("symlink", "symlink open blocked", { cause: e }) : ot(e) && e.code === "EISDIR" ? new I("not-file", "not a file") : e;
1222
1216
  }
1223
1217
  try {
1224
1218
  let [r, i] = await Promise.all([n.stat(), v.lstat(e)]);
1225
1219
  if (i.isSymbolicLink()) throw new I("symlink", "symlink not allowed");
1226
1220
  if (!r.isFile()) throw new I("not-file", "not a file");
1227
1221
  if (t?.rejectHardlinks && r.nlink > 1) throw new I("invalid-path", "hardlinked path not allowed");
1228
- if (!z(r, i)) throw new I("path-mismatch", "path changed during read");
1222
+ if (process.platform !== "win32" && !z(r, i)) throw new I("path-mismatch", "path changed during read");
1229
1223
  let a = await v.realpath(e), o = await v.stat(a);
1230
1224
  if (t?.rejectHardlinks && o.nlink > 1) throw new I("invalid-path", "hardlinked path not allowed");
1231
- if (!z(r, o)) throw new I("path-mismatch", "path mismatch");
1225
+ if (process.platform !== "win32" && !z(r, o)) throw new I("path-mismatch", "path mismatch");
1232
1226
  return {
1233
1227
  handle: n,
1234
1228
  realPath: a,
@@ -1238,8 +1232,8 @@ async function bt(e, t) {
1238
1232
  throw await n.close().catch(() => {}), e instanceof I ? e : L(e) ? new I("not-found", "file not found") : e;
1239
1233
  }
1240
1234
  }
1241
- async function xt(e) {
1242
- let { rootWithSep: t, resolved: n } = await yt(e), r = await bt(n);
1235
+ async function vt(e) {
1236
+ let { rootWithSep: t, resolved: n } = await gt(e), r = await _t(n);
1243
1237
  if (!R(t, r.realPath)) throw await r.handle.close().catch(() => {}), new I("outside-root", "file is outside workspace root");
1244
1238
  try {
1245
1239
  if (e.maxBytes !== void 0 && r.stat.size > e.maxBytes) throw new I("too-large", `file exceeds limit of ${e.maxBytes} bytes (got ${r.stat.size})`);
@@ -1252,62 +1246,62 @@ async function xt(e) {
1252
1246
  await r.handle.close().catch(() => {});
1253
1247
  }
1254
1248
  }
1255
- function St(e) {
1256
- let t = u.dirname(e), n = u.basename(e);
1257
- return u.join(t, `.${n}.${process.pid}.${oe()}.tmp`);
1249
+ function yt(e) {
1250
+ let t = r.dirname(e), n = r.basename(e);
1251
+ return r.join(t, `.${n}.${process.pid}.${_()}.tmp`);
1258
1252
  }
1259
- async function Ct(e) {
1260
- let t = await v.open(e.tempPath, ht, e.mode);
1253
+ async function bt(e) {
1254
+ let t = await v.open(e.tempPath, ft, e.mode);
1261
1255
  try {
1262
1256
  return typeof e.data == "string" ? await t.writeFile(e.data, e.encoding ?? "utf8") : await t.writeFile(e.data), await t.stat();
1263
1257
  } finally {
1264
1258
  await t.close().catch(() => {});
1265
1259
  }
1266
1260
  }
1267
- async function wt(e) {
1268
- let t = _t(await v.realpath(e.rootDir)), n = await bt(e.targetPath, { rejectHardlinks: !0 });
1261
+ async function xt(e) {
1262
+ let t = mt(await v.realpath(e.rootDir)), n = await _t(e.targetPath, { rejectHardlinks: !0 });
1269
1263
  try {
1270
- if (!z(n.stat, e.expectedStat)) throw new I("path-mismatch", "path changed during write");
1264
+ if (process.platform !== "win32" && !z(n.stat, e.expectedStat)) throw new I("path-mismatch", "path changed during write");
1271
1265
  if (!R(t, n.realPath)) throw new I("outside-root", "file is outside workspace root");
1272
1266
  } finally {
1273
1267
  await n.handle.close().catch(() => {});
1274
1268
  }
1275
1269
  }
1276
1270
  async function B(e) {
1277
- let { rootWithSep: t, resolved: n } = await yt(e);
1278
- e.mkdir !== !1 && await v.mkdir(u.dirname(n), { recursive: !0 });
1279
- let r = n, i = !1;
1271
+ let { rootWithSep: t, resolved: n } = await gt(e);
1272
+ e.mkdir !== !1 && await v.mkdir(r.dirname(n), { recursive: !0 });
1273
+ let i = n, a = !1;
1280
1274
  try {
1281
1275
  let e = await v.realpath(n);
1282
1276
  if (!R(t, e)) throw new I("outside-root", "file is outside workspace root");
1283
- r = e, i = !0;
1277
+ i = e, a = !0;
1284
1278
  } catch (e) {
1285
1279
  if (e instanceof I || !L(e)) throw e;
1286
1280
  }
1287
- let a = e.mode === "append";
1288
- if (a && !i) throw new I("not-found", "cannot append to non-existent file");
1289
- return a ? await Tt({
1290
- ioPath: r,
1281
+ let o = e.mode === "append";
1282
+ if (o && !a) throw new I("not-found", "cannot append to non-existent file");
1283
+ return o ? await St({
1284
+ ioPath: i,
1291
1285
  rootWithSep: t,
1292
1286
  data: e.data,
1293
1287
  encoding: e.encoding,
1294
1288
  maxBytes: e.maxBytes
1295
- }) : await Et({
1296
- ioPath: r,
1289
+ }) : await Ct({
1290
+ ioPath: i,
1297
1291
  rootWithSep: t,
1298
1292
  rootDir: e.rootDir,
1299
1293
  data: e.data,
1300
1294
  encoding: e.encoding,
1301
- existingFile: i,
1295
+ existingFile: a,
1302
1296
  fileMode: 384
1303
1297
  });
1304
1298
  }
1305
- async function Tt(e) {
1299
+ async function St(e) {
1306
1300
  let t;
1307
1301
  try {
1308
- t = await v.open(e.ioPath, gt);
1302
+ t = await v.open(e.ioPath, pt);
1309
1303
  } catch (e) {
1310
- throw L(e) ? new I("not-found", "file not found") : ut(e) ? new I("symlink", "symlink open blocked", { cause: e }) : e;
1304
+ throw L(e) ? new I("not-found", "file not found") : st(e) ? new I("symlink", "symlink open blocked", { cause: e }) : e;
1311
1305
  }
1312
1306
  try {
1313
1307
  let n = await t.stat();
@@ -1328,11 +1322,11 @@ async function Tt(e) {
1328
1322
  await t.close().catch(() => {});
1329
1323
  }
1330
1324
  }
1331
- async function Et(e) {
1325
+ async function Ct(e) {
1332
1326
  let t = null, n = e.ioPath;
1333
1327
  try {
1334
- t = St(n);
1335
- let r = await Ct({
1328
+ t = yt(n);
1329
+ let r = await bt({
1336
1330
  tempPath: t,
1337
1331
  data: e.data,
1338
1332
  encoding: e.encoding,
@@ -1340,13 +1334,13 @@ async function Et(e) {
1340
1334
  });
1341
1335
  await v.rename(t, n), t = null;
1342
1336
  try {
1343
- await wt({
1337
+ await xt({
1344
1338
  rootDir: e.rootDir,
1345
1339
  targetPath: n,
1346
1340
  expectedStat: r
1347
1341
  });
1348
1342
  } catch (e) {
1349
- throw new I("write-failed", `${JSON.stringify(e)}`);
1343
+ throw e instanceof I ? e : new I("write-failed", "atomic write verification failed", { cause: e });
1350
1344
  }
1351
1345
  return {
1352
1346
  realPath: n,
@@ -1362,30 +1356,30 @@ async function Et(e) {
1362
1356
  function V(e) {
1363
1357
  return e?.trim() || void 0;
1364
1358
  }
1365
- function Dt(e = import.meta.url) {
1366
- let t = u.dirname(h(e));
1367
- for (; t !== u.dirname(t);) {
1368
- if (l(u.join(t, "package.json"))) return t;
1369
- t = u.dirname(t);
1359
+ function wt(e = import.meta.url) {
1360
+ let t = r.dirname(f(e));
1361
+ for (; t !== r.dirname(t);) {
1362
+ if (n(r.join(t, "package.json"))) return t;
1363
+ t = r.dirname(t);
1370
1364
  }
1371
1365
  return t;
1372
1366
  }
1373
- function Ot(e = process.env, t = se.homedir) {
1374
- let n = kt(e, t);
1375
- return n ? u.resolve(n) : void 0;
1367
+ function H(e = E(), t = y.homedir) {
1368
+ let n = Tt(e, t);
1369
+ return n ? r.resolve(n) : void 0;
1376
1370
  }
1377
- function kt(e, t) {
1371
+ function Tt(e, t) {
1378
1372
  let n = V(e.OPENCLAW_HOME);
1379
1373
  if (n) {
1380
1374
  if (n === "~" || n.startsWith("~/") || n.startsWith("~\\")) {
1381
- let r = V(e.HOME) ?? V(e.USERPROFILE) ?? At(t);
1375
+ let r = V(e.HOME) ?? V(e.USERPROFILE) ?? Et(t);
1382
1376
  return r ? n.replace(/^~(?=$|[\\/])/, r) : void 0;
1383
1377
  }
1384
1378
  return n;
1385
1379
  }
1386
- return V(e.HOME) || V(e.USERPROFILE) || At(t);
1380
+ return V(e.HOME) || V(e.USERPROFILE) || Et(t);
1387
1381
  }
1388
- function At(e) {
1382
+ function Et(e) {
1389
1383
  try {
1390
1384
  return V(e());
1391
1385
  } catch {
@@ -1394,76 +1388,91 @@ function At(e) {
1394
1388
  }
1395
1389
  //#endregion
1396
1390
  //#region src/modules/configs/identity-persist.ts
1397
- var jt = /* @__PURE__ */ function(e) {
1391
+ var Dt = /* @__PURE__ */ function(e) {
1398
1392
  return e[e.LEGACY = 1] = "LEGACY", e[e.NEW = 2] = "NEW", e;
1399
- }({}), Mt = ".openclaw", Nt = "yoyo", Pt = "identity.json";
1400
- function Ft() {
1401
- return u.join(Mt, Nt, Pt);
1393
+ }({}), Ot = ".openclaw", kt = "yoyo", At = "identity.json";
1394
+ function jt() {
1395
+ return r.join(Ot, kt, At);
1402
1396
  }
1403
- async function It(e) {
1404
- let t = Ft();
1397
+ async function Mt(e) {
1398
+ let t = jt();
1405
1399
  try {
1406
- let n = (await xt({
1400
+ let n = (await vt({
1407
1401
  rootDir: e,
1408
1402
  relativePath: t,
1409
1403
  maxBytes: 10 * 1024
1410
1404
  })).buffer.toString("utf8"), r = JSON.parse(n);
1411
- return typeof r != "object" || !r ? zt() : {
1412
- ...zt(),
1405
+ return typeof r != "object" || !r ? Ft() : {
1406
+ ...Ft(),
1413
1407
  ...r
1414
1408
  };
1415
1409
  } catch (e) {
1416
- return D().warn(`[yoyo-identity] failed to read identity: ${e.message}`), null;
1410
+ return k().warn(`[yoyo-identity] failed to read identity: ${e.message}`), null;
1417
1411
  }
1418
1412
  }
1419
- async function Lt() {
1420
- let e = Ot();
1421
- return e ? await It(e) || null : (D().warn("[yoyo-identity] failed to find home dir"), null);
1413
+ async function Nt() {
1414
+ let e = H();
1415
+ return e ? await Mt(e) || null : (k().warn("[yoyo-identity] failed to find home dir"), null);
1422
1416
  }
1423
- async function Rt(e) {
1424
- let t = Ot();
1425
- if (!t) return D().warn("[yoyo-identity] failed to find home dir"), null;
1426
- let n = await It(t), r = {
1417
+ async function Pt(e) {
1418
+ let t = H();
1419
+ if (!t) return k().warn("[yoyo-identity] failed to find home dir"), null;
1420
+ let n = await Mt(t), r = {
1427
1421
  ...n,
1428
- version: n?.version || jt.NEW
1422
+ version: n?.version || Dt.NEW
1429
1423
  };
1430
- return e.legacyDeviceId && (r.legacyDeviceId = e.legacyDeviceId), e.deviceId && (r.deviceId = e.deviceId, r.publicKeyPem = e.publicKeyPem, r.privateKeyPem = e.privateKeyPem, r.createdAtMs = e.createdAtMs), e.version && (r.version = e.version), await B({
1424
+ return e.legacyDeviceId && (r.legacyDeviceId = e.legacyDeviceId), e.deviceId && (r.deviceId = e.deviceId, r.publicKeyPem = e.publicKeyPem, r.privateKeyPem = e.privateKeyPem, r.createdAtMs = e.createdAtMs), e.version && (r.version = e.version), "gatewayAuthMd5" in e && (r.gatewayAuthMd5 = e.gatewayAuthMd5), await B({
1431
1425
  rootDir: t,
1432
- relativePath: Ft(),
1426
+ relativePath: jt(),
1433
1427
  data: JSON.stringify(r, null, 2),
1434
1428
  encoding: "utf8",
1435
1429
  mkdir: !0
1436
1430
  }), r;
1437
1431
  }
1438
- function zt() {
1439
- return { version: jt.NEW };
1432
+ function Ft() {
1433
+ return { version: Dt.NEW };
1440
1434
  }
1441
1435
  //#endregion
1442
- //#region src/modules/device/registry.ts
1443
- async function Bt(e, t) {
1444
- if (!e || !t) throw Error("设备信息或用户信息缺失");
1445
- let n = j().getGatewayAuthConfig(), r = await N().registerDevice(e, t, n);
1446
- if (!Be(r)) throw Error(`注册失败:${r.data?.cnMessage}`);
1436
+ //#region src/utils/hash.ts
1437
+ function It(e) {
1438
+ return h.createHash("md5").update(e).digest("hex");
1439
+ }
1440
+ function Lt(e) {
1441
+ return e ? `${e.slice(0, 8)}...` : "none";
1442
+ }
1443
+ //#endregion
1444
+ //#region src/modules/device/gateway-auth.ts
1445
+ function Rt(e) {
1446
+ return typeof e == "string" ? e : e == null ? "" : JSON.stringify(e);
1447
+ }
1448
+ function zt(e) {
1449
+ return It(JSON.stringify({
1450
+ token: Rt(e?.token),
1451
+ password: Rt(e?.password)
1452
+ }));
1453
+ }
1454
+ function Bt(e, t) {
1455
+ return (e ?? "") === t;
1447
1456
  }
1448
1457
  //#endregion
1449
1458
  //#region src/modules/device/identity.ts
1450
- var H = Buffer.from("302a300506032b6570032100", "hex");
1459
+ var U = Buffer.from("302a300506032b6570032100", "hex");
1451
1460
  function Vt(e) {
1452
1461
  return e.toString("base64").replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/g, "");
1453
1462
  }
1454
1463
  function Ht(e) {
1455
- let t = _.createPublicKey(e).export({
1464
+ let t = h.createPublicKey(e).export({
1456
1465
  type: "spki",
1457
1466
  format: "der"
1458
1467
  });
1459
- return t.length === H.length + 32 && t.subarray(0, H.length).equals(H) ? t.subarray(H.length) : t;
1468
+ return t.length === U.length + 32 && t.subarray(0, U.length).equals(U) ? t.subarray(U.length) : t;
1460
1469
  }
1461
1470
  function Ut(e) {
1462
1471
  let t = Ht(e);
1463
- return _.createHash("sha256").update(t).digest("hex");
1472
+ return h.createHash("sha256").update(t).digest("hex");
1464
1473
  }
1465
1474
  async function Wt() {
1466
- let { publicKey: e, privateKey: t } = _.generateKeyPairSync("ed25519"), n = e.export({
1475
+ let { publicKey: e, privateKey: t } = h.generateKeyPairSync("ed25519"), n = e.export({
1467
1476
  type: "spki",
1468
1477
  format: "pem"
1469
1478
  }).toString(), r = t.export({
@@ -1478,10 +1487,10 @@ async function Wt() {
1478
1487
  };
1479
1488
  }
1480
1489
  async function Gt() {
1481
- let e = await Lt();
1490
+ let e = await Nt();
1482
1491
  if (e && e.deviceId && e.publicKeyPem && e.privateKeyPem && e.createdAtMs) {
1483
1492
  let t = e.deviceId, n = Ut(e.publicKeyPem);
1484
- return n && n !== e.deviceId && (await Rt({
1493
+ return n && n !== e.deviceId && (await Pt({
1485
1494
  ...e,
1486
1495
  deviceId: n
1487
1496
  }), t = n), {
@@ -1493,31 +1502,49 @@ async function Gt() {
1493
1502
  };
1494
1503
  }
1495
1504
  let t = await Wt();
1496
- return await Rt(t), t;
1505
+ return await Pt(t), t;
1506
+ }
1507
+ async function Kt() {
1508
+ return (await Nt())?.gatewayAuthMd5;
1497
1509
  }
1498
- function Kt(e, t) {
1499
- let n = _.createPrivateKey(e);
1500
- return Vt(_.sign(null, Buffer.from(t, "utf8"), n));
1510
+ function qt(e, t) {
1511
+ let n = h.createPrivateKey(e);
1512
+ return Vt(h.sign(null, Buffer.from(t, "utf8"), n));
1501
1513
  }
1502
- function qt(e) {
1514
+ function Jt(e) {
1503
1515
  return Vt(Ht(e));
1504
1516
  }
1505
1517
  //#endregion
1518
+ //#region src/modules/device/registry.ts
1519
+ async function Yt(e, t) {
1520
+ if (!e || !t) throw Error("设备信息或用户信息缺失");
1521
+ let n = M().getGatewayAuthConfig(), r = await N().registerDevice(e, t, n);
1522
+ if (!Le(r)) throw Error(`注册失败:${r.data?.cnMessage}`);
1523
+ }
1524
+ async function Xt(e, t) {
1525
+ let n = zt(M().getGatewayAuthConfig()), r = await Kt(), i = k();
1526
+ if (i.info(`[yoyoclaw-registry] checking gateway auth md5: current=${Lt(n)}, persisted=${Lt(r)}`), Bt(r, n)) {
1527
+ i.info("[yoyoclaw-registry] gateway auth unchanged, skipping device registration");
1528
+ return;
1529
+ }
1530
+ i.info("[yoyoclaw-registry] gateway auth changed, registering device"), await Yt(e, t), await Pt({ gatewayAuthMd5: n }), i.info("[yoyoclaw-registry] gateway auth md5 persisted after device registration");
1531
+ }
1532
+ //#endregion
1506
1533
  //#region src/modules/device/providers/linux.ts
1507
- function Jt(t) {
1534
+ function Zt(e) {
1508
1535
  try {
1509
- return e.existsSync(t) ? e.readFileSync(t, "utf-8").trim() : "";
1536
+ return b.existsSync(e) ? b.readFileSync(e, "utf-8").trim() : "";
1510
1537
  } catch {
1511
1538
  return "";
1512
1539
  }
1513
1540
  }
1514
- var Yt = class {
1541
+ var Qt = class {
1515
1542
  async ensureInitialized() {}
1516
1543
  getLinuxDeviceModel() {
1517
- return Jt("/sys/class/dmi/id/product_name") || Jt("/sys/class/dmi/id/board_name") || `${y.cpus()[0]?.model || "Linux PC"} (${y.arch()})`;
1544
+ return Zt("/sys/class/dmi/id/product_name") || Zt("/sys/class/dmi/id/board_name") || `${S.cpus()[0]?.model || "Linux PC"} (${S.arch()})`;
1518
1545
  }
1519
1546
  getLinuxDeviceName() {
1520
- return `${y.hostname()} (${this.getLinuxDeviceModel()})`;
1547
+ return `${S.hostname()} (${this.getLinuxDeviceModel()})`;
1521
1548
  }
1522
1549
  getDeviceName() {
1523
1550
  return this.getLinuxDeviceName();
@@ -1531,13 +1558,13 @@ var Yt = class {
1531
1558
  getDeviceType() {
1532
1559
  return "pc";
1533
1560
  }
1534
- }, Xt = class {
1561
+ }, $t = class {
1535
1562
  async ensureInitialized() {}
1536
1563
  getMacOSDeviceModel() {
1537
- return `${y.cpus()[0]?.model || "Mac"} (${y.machine?.() || y.arch()})`;
1564
+ return `${S.cpus()[0]?.model || "Mac"} (${S.machine?.() || S.arch()})`;
1538
1565
  }
1539
1566
  getMacOSDeviceName() {
1540
- return `${y.hostname()} (${this.getMacOSDeviceModel()})`;
1567
+ return `${S.hostname()} (${this.getMacOSDeviceModel()})`;
1541
1568
  }
1542
1569
  getDeviceName() {
1543
1570
  return this.getMacOSDeviceName();
@@ -1551,7 +1578,7 @@ var Yt = class {
1551
1578
  getDeviceType() {
1552
1579
  return "pc";
1553
1580
  }
1554
- }, Zt = le(ce), Qt = class {
1581
+ }, en = te(ee), tn = class {
1555
1582
  cache = {
1556
1583
  brand: "",
1557
1584
  model: "",
@@ -1566,7 +1593,7 @@ var Yt = class {
1566
1593
  }
1567
1594
  async execAndroidCmd(e, t = 5e3) {
1568
1595
  try {
1569
- let { stdout: n } = await Zt("/system/bin/sh", ["-c", e], {
1596
+ let { stdout: n } = await en("/system/bin/sh", ["-c", e], {
1570
1597
  timeout: t,
1571
1598
  encoding: "utf-8"
1572
1599
  });
@@ -1588,13 +1615,13 @@ var Yt = class {
1588
1615
  getAndroidDeviceModel() {
1589
1616
  if (this.cache.model) return this.cache.model;
1590
1617
  try {
1591
- let t = "/system/build.prop";
1592
- if (e.existsSync(t)) {
1593
- let n = e.readFileSync(t, "utf8").match(/ro\.product\.model=(.*)/);
1594
- if (n && n[1]) return n[1].trim();
1618
+ let e = "/system/build.prop";
1619
+ if (b.existsSync(e)) {
1620
+ let t = b.readFileSync(e, "utf8").match(/ro\.product\.model=(.*)/);
1621
+ if (t && t[1]) return t[1].trim();
1595
1622
  }
1596
1623
  } catch {}
1597
- return `Android(${y.arch()})`;
1624
+ return `Android(${S.arch()})`;
1598
1625
  }
1599
1626
  getAndroidDeviceName() {
1600
1627
  return this.getAndroidDeviceModel();
@@ -1614,10 +1641,10 @@ var Yt = class {
1614
1641
  };
1615
1642
  //#endregion
1616
1643
  //#region src/modules/device/providers/windows.ts
1617
- function U(e, t, n) {
1644
+ function W(e, t, n) {
1618
1645
  return new Promise((r) => {
1619
1646
  try {
1620
- new b({
1647
+ new C({
1621
1648
  hive: e,
1622
1649
  key: t
1623
1650
  }).get(n, (e, t) => {
@@ -1628,10 +1655,10 @@ function U(e, t, n) {
1628
1655
  }
1629
1656
  });
1630
1657
  }
1631
- function $t(e, t) {
1658
+ function nn(e, t) {
1632
1659
  return new Promise((n) => {
1633
1660
  try {
1634
- new b({
1661
+ new C({
1635
1662
  hive: e,
1636
1663
  key: t
1637
1664
  }).values((e) => {
@@ -1642,7 +1669,7 @@ function $t(e, t) {
1642
1669
  }
1643
1670
  });
1644
1671
  }
1645
- var en = class {
1672
+ var rn = class {
1646
1673
  cache = { deviceBrand: "" };
1647
1674
  initPromise;
1648
1675
  constructor() {
@@ -1654,26 +1681,26 @@ var en = class {
1654
1681
  async _initializeCache() {
1655
1682
  try {
1656
1683
  let [e, t, n, r] = await Promise.all([
1657
- U(b.HKLM, "\\HARDWARE\\DESCRIPTION\\System", "SystemManufacturer"),
1658
- U(b.HKLM, "\\HARDWARE\\DESCRIPTION\\System", "SystemBiosVendor"),
1659
- U(b.HKLM, "\\HARDWARE\\DESCRIPTION\\System\\BIOS", "Vendor"),
1660
- U(b.HKLM, "\\HARDWARE\\DESCRIPTION\\System\\BIOS", "SystemManufacturer")
1684
+ W(C.HKLM, "\\HARDWARE\\DESCRIPTION\\System", "SystemManufacturer"),
1685
+ W(C.HKLM, "\\HARDWARE\\DESCRIPTION\\System", "SystemBiosVendor"),
1686
+ W(C.HKLM, "\\HARDWARE\\DESCRIPTION\\System\\BIOS", "Vendor"),
1687
+ W(C.HKLM, "\\HARDWARE\\DESCRIPTION\\System\\BIOS", "SystemManufacturer")
1661
1688
  ]);
1662
1689
  [
1663
1690
  e,
1664
1691
  t,
1665
1692
  n,
1666
1693
  r
1667
- ].find((e) => e && e.toLowerCase().includes("honor")) || await $t(b.HKLM, "\\SOFTWARE\\HONOR\\PCManager") ? this.cache.deviceBrand = "HONOR" : this.cache.deviceBrand = "";
1694
+ ].find((e) => e && e.toLowerCase().includes("honor")) || await nn(C.HKLM, "\\SOFTWARE\\HONOR\\PCManager") ? this.cache.deviceBrand = "HONOR" : this.cache.deviceBrand = "";
1668
1695
  } catch {
1669
1696
  this.cache.deviceBrand = "";
1670
1697
  }
1671
1698
  }
1672
1699
  getWindowsDeviceModel() {
1673
- return `Windows ${y.release()}`;
1700
+ return `Windows ${S.release()}`;
1674
1701
  }
1675
1702
  getWindowsDeviceName() {
1676
- return `${y.hostname()} (${this.getWindowsDeviceModel()})`;
1703
+ return `${S.hostname()} (${this.getWindowsDeviceModel()})`;
1677
1704
  }
1678
1705
  getDeviceName() {
1679
1706
  return this.getWindowsDeviceName();
@@ -1690,33 +1717,33 @@ var en = class {
1690
1717
  };
1691
1718
  //#endregion
1692
1719
  //#region src/modules/device/providers/index.ts
1693
- function tn() {
1694
- let e = process.platform;
1695
- if (e === "win32") return "windows";
1696
- if (e === "linux") {
1720
+ function an() {
1721
+ let t = process.platform;
1722
+ if (t === "win32") return "windows";
1723
+ if (t === "linux") {
1697
1724
  try {
1698
- if (s.existsSync("/system/bin/getprop")) return "pad";
1725
+ if (e.existsSync("/system/bin/getprop")) return "pad";
1699
1726
  } catch {}
1700
1727
  return "linux";
1701
1728
  }
1702
- return e === "darwin" ? "macos" : "linux";
1729
+ return t === "darwin" ? "macos" : "linux";
1703
1730
  }
1704
- function nn() {
1705
- switch (tn()) {
1706
- case "pad": return new Qt();
1707
- case "windows": return new en();
1708
- case "linux": return new Yt();
1709
- case "macos": return new Xt();
1710
- default: return new Yt();
1731
+ function on() {
1732
+ switch (an()) {
1733
+ case "pad": return new tn();
1734
+ case "windows": return new rn();
1735
+ case "linux": return new Qt();
1736
+ case "macos": return new $t();
1737
+ default: return new Qt();
1711
1738
  }
1712
1739
  }
1713
1740
  //#endregion
1714
1741
  //#region src/modules/device/device-info.ts
1715
- async function W() {
1716
- let e = nn(), t = j();
1742
+ async function G() {
1743
+ let e = on(), t = M();
1717
1744
  await e.ensureInitialized();
1718
- let n = await Gt(), r = n.legacyDeviceId ?? n.deviceId, i = ve(), a = t.getDeviceConfig();
1719
- D().debug?.(`[yoyoclaw-device] env: ${JSON.stringify(i)}, config: ${JSON.stringify(a)}`);
1745
+ let n = await Gt(), r = n.legacyDeviceId ?? n.deviceId, i = pe(), a = t.getDeviceConfig();
1746
+ k().debug?.(`[yoyoclaw-device] env: ${JSON.stringify(i)}, config: ${JSON.stringify(a)}`);
1720
1747
  let o = i.brand || a?.brand || e.getDeviceBrand() || "unknown", s = i.deviceType || a?.type || e.getDeviceType(), c = (i.manufacture || a?.manufacture || o).slice(0, 128), l = (a?.name || e.getDeviceName()).slice(0, 128), u = (a?.model || e.getDeviceModel()).slice(0, 128), d = {
1721
1748
  deviceId: r,
1722
1749
  deviceName: l,
@@ -1726,7 +1753,7 @@ async function W() {
1726
1753
  manufacture: c,
1727
1754
  port: t.getGatewayPort()
1728
1755
  }, f = i.brand || i.deviceType || i.manufacture ? "env" : "config";
1729
- D().info(`[yoyoclaw-device] device info: ${JSON.stringify(d)} (source: ${f})`);
1756
+ k().info(`[yoyoclaw-device] device info: ${JSON.stringify(d)} (source: ${f})`);
1730
1757
  let p = !!(i.brand && i.brand !== a?.brand || i.manufacture && i.manufacture !== a?.manufacture || i.deviceType && i.deviceType !== a?.type);
1731
1758
  if (!a || p) {
1732
1759
  let e = {
@@ -1737,27 +1764,27 @@ async function W() {
1737
1764
  model: u
1738
1765
  };
1739
1766
  t.updateDeviceConfig(e).catch((e) => {
1740
- D().warn(`[yoyoclaw-device] failed to persist device config: ${String(e)}`);
1767
+ k().warn(`[yoyoclaw-device] failed to persist device config: ${String(e)}`);
1741
1768
  });
1742
1769
  }
1743
1770
  return d;
1744
1771
  }
1745
1772
  //#endregion
1746
1773
  //#region src/modules/device/helpers.ts
1747
- function rn(e) {
1774
+ function sn(e) {
1748
1775
  return typeof e == "string" && e.trim() || "";
1749
1776
  }
1750
- function an(e) {
1777
+ function cn(e) {
1751
1778
  return e.replace(/[A-Z]/g, (e) => String.fromCharCode(e.charCodeAt(0) + 32));
1752
1779
  }
1753
- function on(e) {
1754
- let t = rn(e);
1755
- return t ? an(t) : "";
1780
+ function ln(e) {
1781
+ let t = sn(e);
1782
+ return t ? cn(t) : "";
1756
1783
  }
1757
1784
  //#endregion
1758
1785
  //#region src/modules/device/auth.ts
1759
- function sn(e) {
1760
- let t = e.scopes.join(","), n = e.token ?? "", r = on(e.platform), i = on(e.deviceFamily);
1786
+ function un(e) {
1787
+ let t = e.scopes.join(","), n = e.token ?? "", r = ln(e.platform), i = ln(e.deviceFamily);
1761
1788
  return [
1762
1789
  "v3",
1763
1790
  e.deviceId,
@@ -1774,10 +1801,10 @@ function sn(e) {
1774
1801
  }
1775
1802
  //#endregion
1776
1803
  //#region src/modules/device/credential-builder.ts
1777
- function cn(e) {
1804
+ function dn(e) {
1778
1805
  let { deviceIdentity: t, clientName: n = "", clientMode: r = "cli", role: i = "operator", scopes: a = ["operator.admin"], platform: o = process.platform, deviceFamily: s, authToken: c = null, nonce: l, signedAtMs: u = Date.now() } = e;
1779
1806
  if (!t) return;
1780
- let d = sn({
1807
+ let d = un({
1781
1808
  deviceId: t.deviceId,
1782
1809
  clientId: n,
1783
1810
  clientMode: r,
@@ -1788,10 +1815,10 @@ function cn(e) {
1788
1815
  nonce: l,
1789
1816
  platform: o,
1790
1817
  deviceFamily: s
1791
- }), f = Kt(t.privateKeyPem, d);
1818
+ }), f = qt(t.privateKeyPem, d);
1792
1819
  return {
1793
1820
  id: t.deviceId,
1794
- publicKey: qt(t.publicKeyPem),
1821
+ publicKey: Jt(t.publicKeyPem),
1795
1822
  signature: f,
1796
1823
  signedAt: u,
1797
1824
  nonce: l
@@ -1799,15 +1826,15 @@ function cn(e) {
1799
1826
  }
1800
1827
  //#endregion
1801
1828
  //#region src/honor-auth/token-manager.ts
1802
- async function ln(e, t = !0) {
1829
+ async function fn(e, t = !0) {
1803
1830
  try {
1804
- let n = j(), r = e.jwtToken;
1831
+ let n = M(), r = e.jwtToken;
1805
1832
  if (!r && e.userId) {
1806
- let t = e.deviceInfo || await W();
1833
+ let t = e.deviceInfo || await G();
1807
1834
  r = (await N().exchangeToken(t, { userId: e.userId })).jwtToken;
1808
1835
  }
1809
1836
  if (!r) throw Error("no token available");
1810
- if (!t) return D().info("💾 token got, but not to save"), { token: r };
1837
+ if (!t) return k().info("💾 token got, but not to save"), { token: r };
1811
1838
  let i = Math.floor(Date.now() / 1e3) + 720 * 60 * 60;
1812
1839
  return await n.updateUserConfig({
1813
1840
  token: r,
@@ -1815,53 +1842,53 @@ async function ln(e, t = !0) {
1815
1842
  expired: i
1816
1843
  }), { token: r };
1817
1844
  } catch (e) {
1818
- throw E(e, "保存Token失败");
1845
+ throw O(e, "保存Token失败");
1819
1846
  }
1820
1847
  }
1821
- async function un(e) {
1822
- let t = await W(), n = await N().exchangeToken(t, { userId: e });
1848
+ async function pn(e) {
1849
+ let t = await G(), n = await N().exchangeToken(t, { userId: e });
1823
1850
  if (n.jwtToken) {
1824
1851
  let e = Math.floor(Date.now() / 1e3) + 720 * 60 * 60;
1825
- return await j().updateUserConfig({
1852
+ return await M().updateUserConfig({
1826
1853
  token: n.jwtToken,
1827
1854
  userId: void 0,
1828
1855
  userName: void 0,
1829
1856
  expired: e
1830
1857
  }), { token: n.jwtToken };
1831
1858
  }
1832
- return await j().clearUserConfig(), null;
1859
+ return await M().clearUserConfig(), null;
1833
1860
  }
1834
- async function dn() {
1835
- let e = D();
1861
+ async function mn() {
1862
+ let e = k();
1836
1863
  try {
1837
- let t = j(), n = t.getUserConfig(), r = ye();
1838
- if (e.debug?.(`[yoyoclaw-auth] env userId: ${r ? "present" : "absent"}, config userId: ${n?.userId ? "present" : "absent"}, config token: ${n?.token ? "present" : "absent"}`), n?.userId) return await un(r || n.userId);
1864
+ let t = M(), n = t.getUserConfig(), r = me();
1865
+ if (e.debug?.(`[yoyoclaw-auth] env userId: ${r ? "present" : "absent"}, config userId: ${n?.userId ? "present" : "absent"}, config token: ${n?.token ? "present" : "absent"}`), n?.userId) return await pn(r || n.userId);
1839
1866
  if (n?.token) {
1840
1867
  if (!n.expired || n.expired >= Math.floor(Date.now() / 1e3)) return { token: n.token };
1841
1868
  e.debug?.("[yoyoclaw-auth] cached token expired");
1842
1869
  }
1843
- return r ? (e.debug?.("[yoyoclaw-auth] token expired, using env userId to exchange token"), await un(r)) : (n?.token && (e.debug?.("[yoyoclaw-auth] clearing expired token"), await t.clearUserConfig()), null);
1870
+ return r ? (e.debug?.("[yoyoclaw-auth] token expired, using env userId to exchange token"), await pn(r)) : (n?.token && (e.debug?.("[yoyoclaw-auth] clearing expired token"), await t.clearUserConfig()), null);
1844
1871
  } catch (e) {
1845
- throw E(e, "加载Token失败");
1872
+ throw O(e, "加载Token失败");
1846
1873
  }
1847
1874
  }
1848
- async function fn() {
1875
+ async function hn() {
1849
1876
  try {
1850
- await j().clearUserConfig(), D().info("[yoyoclaw-auth] token cleared");
1877
+ await M().clearUserConfig(), k().info("[yoyoclaw-auth] token cleared");
1851
1878
  } catch (e) {
1852
- throw E(e, "清除Token失败");
1879
+ throw O(e, "清除Token失败");
1853
1880
  }
1854
1881
  }
1855
1882
  //#endregion
1856
1883
  //#region src/honor-auth/browser.ts
1857
- async function pn(e, t) {
1858
- let n = it(t);
1859
- D().debug?.("Starting Honor login flow...");
1860
- let r = ot(n), i = r.generatePKCEParams(), a = r.buildAuthUrl(i), o = null, s = tt({
1884
+ async function gn(e, t) {
1885
+ let n = tt(t);
1886
+ k().debug?.("Starting Honor login flow...");
1887
+ let r = rt(n), a = r.generatePKCEParams(), o = r.buildAuthUrl(a), s = null, c = Qe({
1861
1888
  port: n.localPort,
1862
1889
  timeout: 6e5,
1863
1890
  onCodeReceived: (e) => {
1864
- o = e;
1891
+ s = e;
1865
1892
  },
1866
1893
  onError: (e) => {
1867
1894
  console.error("callback server error:", e);
@@ -1869,47 +1896,47 @@ async function pn(e, t) {
1869
1896
  });
1870
1897
  console.log("🌐 open browser...");
1871
1898
  try {
1872
- await d(a);
1899
+ await i(o);
1873
1900
  } catch (e) {
1874
- throw E(e, "failed to open browser, check your permissions");
1901
+ throw O(e, "failed to open browser, check your permissions");
1875
1902
  }
1876
1903
  try {
1877
- await s;
1904
+ await c;
1878
1905
  } catch (e) {
1879
- throw E(e, "authorization timeout");
1906
+ throw O(e, "authorization timeout");
1880
1907
  }
1881
- if (!o) throw Error("no auth code");
1908
+ if (!s) throw Error("no auth code");
1882
1909
  try {
1883
1910
  let t = await N().exchangeToken(e, {
1884
- code: o,
1911
+ code: s,
1885
1912
  authConfig: n
1886
1913
  });
1887
1914
  if (!t?.jwtToken) throw Error("failed to get jwt token");
1888
- return await ln({ jwtToken: t.jwtToken }, n.saveToFile !== !1), { token: t.jwtToken };
1915
+ return await fn({ jwtToken: t.jwtToken }, n.saveToFile !== !1), { token: t.jwtToken };
1889
1916
  } catch (e) {
1890
- throw E(e, "get token failed");
1917
+ throw O(e, "get token failed");
1891
1918
  }
1892
1919
  }
1893
1920
  //#endregion
1894
1921
  //#region src/honor-auth/cloud.ts
1895
- async function mn() {
1896
- let e = j().getUserConfig();
1922
+ async function _n() {
1923
+ let e = M().getUserConfig();
1897
1924
  if (!e?.token) throw Error("⚠️ Not logged in");
1898
- let t = await W(), n = N(), r = { token: e.token }, i = await n.logoutDevice(t, r);
1899
- if (!Be(i)) throw Error(i.data?.cnMessage || "Unknown error");
1900
- await fn();
1925
+ let t = await G(), n = N(), r = { token: e.token }, i = await n.logoutDevice(t, r);
1926
+ if (!Le(i)) throw Error(i.data?.cnMessage || "Unknown error");
1927
+ await hn();
1901
1928
  }
1902
1929
  //#endregion
1903
1930
  //#region src/modules/login/impl.ts
1904
- async function hn(e = {}) {
1905
- let { userId: t } = e, n = D();
1931
+ async function vn(e = {}) {
1932
+ let { userId: t } = e, n = k();
1906
1933
  try {
1907
1934
  n.debug?.("Starting login process...");
1908
- let e = await W(), r;
1909
- t ? (r = await ln({
1935
+ let e = await G(), r;
1936
+ t ? (r = await fn({
1910
1937
  userId: t,
1911
1938
  deviceInfo: e
1912
- }), n.debug?.("Using provided user info"), n.debug?.(`User: ${t}`), n.debug?.(`Device ID: ${e?.deviceId}`)) : (n.debug?.("Starting OAuth2 authentication..."), r = await pn(e), n.debug?.("OAuth2 authentication successful"), n.debug?.(`Device ID: ${e?.deviceId}`)), console.log("📡 Registering device to Claw Cloud..."), await Bt(e, r), console.log("✅ Device registered successfully"), console.log("🔗 Channel connection in progress, use 'openclaw honor status' to check device status");
1939
+ }), n.debug?.("Using provided user info"), n.debug?.(`User: ${t}`), n.debug?.(`Device ID: ${e?.deviceId}`)) : (n.debug?.("Starting OAuth2 authentication..."), r = await gn(e), n.debug?.("OAuth2 authentication successful"), n.debug?.(`Device ID: ${e?.deviceId}`)), console.log("📡 Registering device to Claw Cloud..."), await Yt(e, r), console.log("✅ Device registered successfully"), console.log("🔗 Channel connection in progress, use 'openclaw honor status' to check device status");
1913
1940
  } catch (e) {
1914
1941
  let t = e instanceof Error ? e.message : String(e);
1915
1942
  console.error("❌ Login process failed:", t);
@@ -1917,11 +1944,11 @@ async function hn(e = {}) {
1917
1944
  }
1918
1945
  //#endregion
1919
1946
  //#region src/commands/login/impl.ts
1920
- function gn(e, t) {
1947
+ function yn(e, t) {
1921
1948
  let n = t.command("login").description("login to yoyoclaw and register devices");
1922
1949
  return n = n.option("-u, --uid <userId>", "user ID for direct login").option("--token <token>", "token for direct login").action(async (t) => {
1923
1950
  let { uid: n, token: r } = t;
1924
- e.logger.debug?.("honor login CLI command called"), await hn({
1951
+ e.logger.debug?.("honor login CLI command called"), await vn({
1925
1952
  userId: n,
1926
1953
  token: r
1927
1954
  });
@@ -1929,11 +1956,11 @@ function gn(e, t) {
1929
1956
  }
1930
1957
  //#endregion
1931
1958
  //#region src/commands/logout/impl.ts
1932
- function _n(e, t) {
1959
+ function bn(e, t) {
1933
1960
  return t.command("logout").description("Logout and clear user configuration").action(async () => {
1934
1961
  e.logger.info("logout CLI command called");
1935
1962
  try {
1936
- await mn(), console.log("✅ Logout successful, gateway will automatically restart to handle new configuration");
1963
+ await _n(), console.log("✅ Logout successful, gateway will automatically restart to handle new configuration");
1937
1964
  } catch (e) {
1938
1965
  let t = e instanceof Error ? e.message : String(e);
1939
1966
  console.error("❌ Logout failed:", t);
@@ -1942,28 +1969,28 @@ function _n(e, t) {
1942
1969
  }
1943
1970
  //#endregion
1944
1971
  //#region src/services/connection/status-tracker/events.ts
1945
- var G = /* @__PURE__ */ function(e) {
1972
+ var K = /* @__PURE__ */ function(e) {
1946
1973
  return e.CLOUD_SOCKET_CONNECTING = "cloud_socket_connecting", e.CLOUD_SOCKET_CONNECTED = "cloud_socket_connected", e.CLOUD_SOCKET_DISCONNECTED = "cloud_socket_disconnected", e.CLOUD_SOCKET_ERROR = "cloud_socket_error", e.CLOUD_SOCKET_RETRY = "cloud_socket_retry", e.GATEWAY_CLIENT_CONNECTED = "gateway_client_connected", e.GATEWAY_CLIENT_DISCONNECTED = "gateway_client_disconnected", e.ADMIN_CLIENT_RECONNECT_FAILED = "admin_client_reconnect_failed", e.DEVICE_PAIRING = "device_pairing", e.DEVICE_UNPAIRING = "device_unpairing", e.CONNECTION_STATUS_CHANGED = "connection_status_changed", e;
1947
- }({}), vn = class {
1974
+ }({}), xn = class {
1948
1975
  statusFilePath;
1949
1976
  statusDir;
1950
1977
  constructor() {
1951
- let e = Dt();
1952
- this.statusDir = r.join(e, ".yoyo-cache"), this.statusFilePath = r.join(this.statusDir, "yoyo-status.json");
1978
+ let e = wt();
1979
+ this.statusDir = ne.join(e, ".yoyo-cache"), this.statusFilePath = ne.join(this.statusDir, "yoyo-status.json");
1953
1980
  }
1954
1981
  async save(e) {
1955
1982
  try {
1956
- await t.mkdir(this.statusDir, { recursive: !0 });
1957
- let n = JSON.stringify(e, null, 2);
1958
- await t.writeFile(this.statusFilePath, n, "utf-8");
1983
+ await x.mkdir(this.statusDir, { recursive: !0 });
1984
+ let t = JSON.stringify(e, null, 2);
1985
+ await x.writeFile(this.statusFilePath, t, "utf-8");
1959
1986
  } catch (e) {
1960
1987
  throw console.error(`[StatusStorage] Failed to save status: ${e instanceof Error ? e.message : String(e)}`), e;
1961
1988
  }
1962
1989
  }
1963
1990
  async load() {
1964
1991
  try {
1965
- await t.access(this.statusFilePath);
1966
- let e = await t.readFile(this.statusFilePath, "utf-8");
1992
+ await x.access(this.statusFilePath);
1993
+ let e = await x.readFile(this.statusFilePath, "utf-8");
1967
1994
  return JSON.parse(e);
1968
1995
  } catch (e) {
1969
1996
  return e.code === "ENOENT" || console.error(`[StatusStorage] Failed to load status: ${e instanceof Error ? e.message : String(e)}`), null;
@@ -1971,7 +1998,7 @@ var G = /* @__PURE__ */ function(e) {
1971
1998
  }
1972
1999
  async clear() {
1973
2000
  try {
1974
- await t.unlink(this.statusFilePath);
2001
+ await x.unlink(this.statusFilePath);
1975
2002
  } catch (e) {
1976
2003
  if (e.code !== "ENOENT") throw console.error(`[StatusStorage] Failed to clear status: ${e instanceof Error ? e.message : String(e)}`), e;
1977
2004
  }
@@ -1981,7 +2008,7 @@ var G = /* @__PURE__ */ function(e) {
1981
2008
  }
1982
2009
  async exists() {
1983
2010
  try {
1984
- return await t.access(this.statusFilePath), !0;
2011
+ return await x.access(this.statusFilePath), !0;
1985
2012
  } catch {
1986
2013
  return !1;
1987
2014
  }
@@ -1989,7 +2016,7 @@ var G = /* @__PURE__ */ function(e) {
1989
2016
  };
1990
2017
  //#endregion
1991
2018
  //#region src/services/connection/status-tracker/types.ts
1992
- function yn() {
2019
+ function Sn() {
1993
2020
  return {
1994
2021
  status: "idle",
1995
2022
  updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -2024,48 +2051,48 @@ function yn() {
2024
2051
  }
2025
2052
  //#endregion
2026
2053
  //#region src/services/connection/status-tracker/tracker.ts
2027
- var bn = class {
2054
+ var Cn = class {
2028
2055
  currentStatus;
2029
2056
  storage;
2030
2057
  autoSave;
2031
2058
  saveTimer;
2032
2059
  constructor(e = !0) {
2033
- this.currentStatus = yn(), this.storage = new vn(), this.autoSave = e, this.saveTimer = null;
2060
+ this.currentStatus = Sn(), this.storage = new xn(), this.autoSave = e, this.saveTimer = null;
2034
2061
  }
2035
2062
  async handleEvent(e) {
2036
2063
  let { type: t, timestamp: n, data: r } = e;
2037
2064
  switch (t) {
2038
- case G.CLOUD_SOCKET_CONNECTING:
2065
+ case K.CLOUD_SOCKET_CONNECTING:
2039
2066
  this.handleCloudSocketConnecting(r, n);
2040
2067
  break;
2041
- case G.CLOUD_SOCKET_CONNECTED:
2068
+ case K.CLOUD_SOCKET_CONNECTED:
2042
2069
  this.handleCloudSocketConnected(r, n);
2043
2070
  break;
2044
- case G.CLOUD_SOCKET_DISCONNECTED:
2071
+ case K.CLOUD_SOCKET_DISCONNECTED:
2045
2072
  this.handleCloudSocketDisconnected(r, n);
2046
2073
  break;
2047
- case G.CLOUD_SOCKET_ERROR:
2074
+ case K.CLOUD_SOCKET_ERROR:
2048
2075
  this.handleCloudSocketError(r, n);
2049
2076
  break;
2050
- case G.CLOUD_SOCKET_RETRY:
2077
+ case K.CLOUD_SOCKET_RETRY:
2051
2078
  this.handleCloudSocketRetry(r, n);
2052
2079
  break;
2053
- case G.GATEWAY_CLIENT_CONNECTED:
2080
+ case K.GATEWAY_CLIENT_CONNECTED:
2054
2081
  this.handleGatewayClientConnected(r, n);
2055
2082
  break;
2056
- case G.GATEWAY_CLIENT_DISCONNECTED:
2083
+ case K.GATEWAY_CLIENT_DISCONNECTED:
2057
2084
  this.handleGatewayClientDisconnected(r, n);
2058
2085
  break;
2059
- case G.DEVICE_PAIRING:
2086
+ case K.DEVICE_PAIRING:
2060
2087
  this.handleDevicePairing(r, n);
2061
2088
  break;
2062
- case G.DEVICE_UNPAIRING:
2089
+ case K.DEVICE_UNPAIRING:
2063
2090
  this.handleDeviceUnpairing(r, n);
2064
2091
  break;
2065
- case G.CONNECTION_STATUS_CHANGED:
2092
+ case K.CONNECTION_STATUS_CHANGED:
2066
2093
  this.handleConnectionStatusChanged(r, n);
2067
2094
  break;
2068
- case G.ADMIN_CLIENT_RECONNECT_FAILED: break;
2095
+ case K.ADMIN_CLIENT_RECONNECT_FAILED: break;
2069
2096
  default: console.warn(`[StatusTracker] Unknown event type: ${t}`);
2070
2097
  }
2071
2098
  this.currentStatus.updatedAt = new Date(n).toISOString(), this.autoSave && this.scheduleSave();
@@ -2081,7 +2108,7 @@ var bn = class {
2081
2108
  let e = await this.storage.load();
2082
2109
  if (e) {
2083
2110
  let t = e.cloudSocket, n = e.history;
2084
- this.currentStatus = yn(), this.currentStatus.cloudSocket = t, this.currentStatus.history = n, this.currentStatus.cloudSocket.connected = !1, this.currentStatus.cloudSocket.readyState = 3, await this.saveStatus();
2111
+ this.currentStatus = Sn(), this.currentStatus.cloudSocket = t, this.currentStatus.history = n, this.currentStatus.cloudSocket.connected = !1, this.currentStatus.cloudSocket.readyState = 3, await this.saveStatus();
2085
2112
  }
2086
2113
  return this.getStatus();
2087
2114
  }
@@ -2089,7 +2116,7 @@ var bn = class {
2089
2116
  await this.storage.save(this.currentStatus);
2090
2117
  }
2091
2118
  async clearStatus() {
2092
- this.currentStatus = yn(), await this.storage.clear();
2119
+ this.currentStatus = Sn(), await this.storage.clear();
2093
2120
  }
2094
2121
  handleCloudSocketConnecting(e, t) {
2095
2122
  this.currentStatus.cloudSocket.url = e.url || "", this.currentStatus.cloudSocket.connected = !1;
@@ -2162,31 +2189,31 @@ var bn = class {
2162
2189
  };
2163
2190
  //#endregion
2164
2191
  //#region src/commands/status/index.ts
2165
- function xn(e, t) {
2192
+ function wn(e, t) {
2166
2193
  return t.command("status").description("Show YOYOClaw connection status").action(async () => {
2167
- if (e.logger.debug?.("YOYOClaw status CLI command called"), !await dn()) {
2194
+ if (e.logger.debug?.("YOYOClaw status CLI command called"), !await mn()) {
2168
2195
  console.log("❌ You need to login first. Please run: openclaw honor login");
2169
2196
  return;
2170
2197
  }
2171
- let t = await new vn().load(), n = null;
2198
+ let t = await new xn().load(), n = null;
2172
2199
  try {
2173
- n = await W();
2200
+ n = await G();
2174
2201
  } catch {}
2175
- let r = j().getEnvInfo();
2176
- Sn(t, n, r);
2202
+ let r = M().getEnvInfo();
2203
+ Tn(t, n, r);
2177
2204
  });
2178
2205
  }
2179
- function Sn(e, t, n) {
2206
+ function Tn(e, t, n) {
2180
2207
  if (!e) {
2181
2208
  console.log("\n❌ No status data available");
2182
2209
  return;
2183
2210
  }
2184
2211
  console.log("\n📡 Cloud Socket:");
2185
2212
  let r = e.cloudSocket, i = r.connected ? "✅" : "❌";
2186
- if (console.log(` Status: ${i} ${r.connected ? "Connected" : "Disconnected"}`), r.connectedAt && console.log(` Connected at: ${K(r.connectedAt)}`), r.lastDisconnectedAt && console.log(` Last disconnected: ${K(r.lastDisconnectedAt)}`), console.log(` Retry count: ${r.retryCount}`), console.log(` Last error: ${r.lastError || "None"}`), console.log("\n🌐 Gateway Connections:"), console.log(` Total connections: ${e.gateway.totalConnections}`), console.log(` Active connections: ${e.gateway.activeConnections}`), e.gateway.connections.length > 0) {
2213
+ if (console.log(` Status: ${i} ${r.connected ? "Connected" : "Disconnected"}`), r.connectedAt && console.log(` Connected at: ${q(r.connectedAt)}`), r.lastDisconnectedAt && console.log(` Last disconnected: ${q(r.lastDisconnectedAt)}`), console.log(` Retry count: ${r.retryCount}`), console.log(` Last error: ${r.lastError || "None"}`), console.log("\n🌐 Gateway Connections:"), console.log(` Total connections: ${e.gateway.totalConnections}`), console.log(` Active connections: ${e.gateway.activeConnections}`), e.gateway.connections.length > 0) {
2187
2214
  console.log(" ┌────────────────────────────┬────────────────────────────┬────────────┐"), console.log(" │ Session ID │ Hardware Device ID │ Connected │"), console.log(" ├────────────────────────────┼────────────────────────────┼────────────┤");
2188
2215
  for (let t of e.gateway.connections) {
2189
- let e = wn(t.sessionId, 26), n = wn(t.hardwareDeviceId, 26), r = Cn(t.connectedAt);
2216
+ let e = Dn(t.sessionId, 26), n = Dn(t.hardwareDeviceId, 26), r = En(t.connectedAt);
2190
2217
  console.log(` │ ${e.padEnd(28)}│ ${n.padEnd(28)}│ ${r.padEnd(12)}│`);
2191
2218
  }
2192
2219
  console.log(" └────────────────────────────┴────────────────────────────┴────────────┘");
@@ -2194,71 +2221,71 @@ function Sn(e, t, n) {
2194
2221
  if (console.log("\n📱 Physical Devices:"), console.log(` Unique devices: ${e.devices.uniqueHardwareDevices}`), e.devices.devices.length > 0) {
2195
2222
  console.log(" ┌────────────────────────────┬─────────┬────────────┐"), console.log(" │ Hardware Device ID │ Sessions │ Last Active│"), console.log(" ├────────────────────────────┼─────────┼────────────┤");
2196
2223
  for (let t of e.devices.devices) {
2197
- let e = wn(t.hardwareDeviceId, 26), n = String(t.sessions).padEnd(9), r = Cn(t.lastActiveAt);
2224
+ let e = Dn(t.hardwareDeviceId, 26), n = String(t.sessions).padEnd(9), r = En(t.lastActiveAt);
2198
2225
  console.log(` │ ${e.padEnd(28)}│ ${n}│ ${r.padEnd(12)}│`);
2199
2226
  }
2200
2227
  console.log(" └────────────────────────────┴─────────┴────────────┘");
2201
2228
  }
2202
- console.log("\n📈 Connection History:"), console.log(` Total connections: ${e.history.connectionCount}`), console.log(` Total disconnections: ${e.history.disconnectionCount}`), e.history.lastConnectionAt && console.log(` Last connection: ${K(e.history.lastConnectionAt)}`), e.history.lastDisconnectionAt && console.log(` Last disconnection: ${K(e.history.lastDisconnectionAt)}`), console.log("\n🖥️ Device Info:"), t ? (console.log(` Device ID: ${t.deviceId}`), console.log(` Name: ${t.deviceName || "N/A"}`), console.log(` Type: ${t.deviceType}`), console.log(` Model: ${t.deviceModel || "N/A"}`), console.log(` Brand: ${t.brand || "N/A"}`)) : console.log(" Unable to load device info"), console.log("\n🌍 Environment:"), console.log(` Env: ${n.env} (source: ${n.source})`);
2229
+ console.log("\n📈 Connection History:"), console.log(` Total connections: ${e.history.connectionCount}`), console.log(` Total disconnections: ${e.history.disconnectionCount}`), e.history.lastConnectionAt && console.log(` Last connection: ${q(e.history.lastConnectionAt)}`), e.history.lastDisconnectionAt && console.log(` Last disconnection: ${q(e.history.lastDisconnectionAt)}`), console.log("\n🖥️ Device Info:"), t ? (console.log(` Device ID: ${t.deviceId}`), console.log(` Name: ${t.deviceName || "N/A"}`), console.log(` Type: ${t.deviceType}`), console.log(` Model: ${t.deviceModel || "N/A"}`), console.log(` Brand: ${t.brand || "N/A"}`)) : console.log(" Unable to load device info"), console.log("\n🌍 Environment:"), console.log(` Env: ${n.env} (source: ${n.source})`);
2203
2230
  }
2204
- function K(e) {
2231
+ function q(e) {
2205
2232
  let t = new Date(e);
2206
2233
  return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")} ${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}`;
2207
2234
  }
2208
- function Cn(e) {
2235
+ function En(e) {
2209
2236
  let t = new Date(e);
2210
2237
  return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}:${String(t.getSeconds()).padStart(2, "0")}`;
2211
2238
  }
2212
- function wn(e, t) {
2239
+ function Dn(e, t) {
2213
2240
  return e.length <= t ? e : e.substring(0, t - 3) + "...";
2214
2241
  }
2215
2242
  //#endregion
2216
2243
  //#region src/commands/index.ts
2217
- function Tn(e) {
2244
+ function On(e) {
2218
2245
  e.registerCli((t) => {
2219
2246
  let n = t.program.command("honor").description("Commands for honor yoyoclaw");
2220
- gn(e, n), xn(e, n), _n(e, n), de() && Re(e, n);
2247
+ yn(e, n), wn(e, n), bn(e, n), oe() && Pe(e, n);
2221
2248
  }, { commands: ["honor"] });
2222
2249
  }
2223
2250
  //#endregion
2224
2251
  //#region src/modules/prompt/index.ts
2225
- var En = " ## 手机控制规则\n\n - 涉及手机控制的任务时,必须强制调用 yoyo_phone_control 技能完成任务。\n - 手机是可直接操控的设备,你的职责是执行操作,而不是向用户解释如何操作。 \n - 多步骤任务需**按顺序多次调用**,不得合并。 \n", Dn = x.object({
2226
- token: x.string().optional(),
2227
- expired: x.number().optional(),
2228
- userId: x.string().optional(),
2229
- userName: x.string().optional()
2230
- }), On = x.object({
2231
- type: x.string().optional(),
2232
- manufacture: x.string().optional(),
2233
- brand: x.string().optional(),
2234
- name: x.string().optional(),
2235
- model: x.string().optional()
2236
- }), kn = x.object({
2237
- user: Dn.optional(),
2238
- device: On.optional(),
2239
- envInfo: x.object({
2240
- env: x.enum([
2252
+ var kn = " ## 手机控制规则\n\n - 涉及手机控制的任务时,必须强制调用 yoyo_phone_control 技能完成任务。\n - 手机是可直接操控的设备,你的职责是执行操作,而不是向用户解释如何操作。 \n - 多步骤任务需**按顺序多次调用**,不得合并。 \n", An = w.object({
2253
+ token: w.string().optional(),
2254
+ expired: w.number().optional(),
2255
+ userId: w.string().optional(),
2256
+ userName: w.string().optional()
2257
+ }), jn = w.object({
2258
+ type: w.string().optional(),
2259
+ manufacture: w.string().optional(),
2260
+ brand: w.string().optional(),
2261
+ name: w.string().optional(),
2262
+ model: w.string().optional()
2263
+ }), Mn = w.object({
2264
+ user: An.optional(),
2265
+ device: jn.optional(),
2266
+ envInfo: w.object({
2267
+ env: w.enum([
2241
2268
  "dev",
2242
2269
  "test",
2243
2270
  "production"
2244
2271
  ]),
2245
- source: x.enum(["env", "manual"])
2272
+ source: w.enum(["env", "manual"])
2246
2273
  }).optional(),
2247
- env: x.enum([
2274
+ env: w.enum([
2248
2275
  "dev",
2249
2276
  "test",
2250
2277
  "production"
2251
2278
  ]).optional(),
2252
- gray: x.string().optional()
2279
+ gray: w.string().optional()
2253
2280
  });
2254
2281
  //#endregion
2255
2282
  //#region src/utils/ws.ts
2256
- function An(e, t = "utf8") {
2257
- return typeof e == "string" ? e : C.isBuffer(e) ? e.toString(t) : Array.isArray(e) ? C.concat(e).toString(t) : e instanceof ArrayBuffer ? C.from(e).toString(t) : C.from(String(e)).toString(t);
2283
+ function Nn(e, t = "utf8") {
2284
+ return typeof e == "string" ? e : ie.isBuffer(e) ? e.toString(t) : Array.isArray(e) ? ie.concat(e).toString(t) : e instanceof ArrayBuffer ? ie.from(e).toString(t) : ie.from(String(e)).toString(t);
2258
2285
  }
2259
2286
  //#endregion
2260
2287
  //#region src/gateway-client/client.ts
2261
- var jn = class {
2288
+ var Pn = class {
2262
2289
  ws = null;
2263
2290
  opts;
2264
2291
  closed = !1;
@@ -2266,21 +2293,21 @@ var jn = class {
2266
2293
  this.opts = e;
2267
2294
  }
2268
2295
  getUrl() {
2269
- return `ws://127.0.0.1:${j().getGatewayPort()}`;
2296
+ return `ws://127.0.0.1:${M().getGatewayPort()}`;
2270
2297
  }
2271
2298
  isConnected() {
2272
- return this.ws !== null && this.ws.readyState === ue.OPEN;
2299
+ return this.ws !== null && this.ws.readyState === re.OPEN;
2273
2300
  }
2274
2301
  connect() {
2275
2302
  if (this.closed) return;
2276
2303
  let e = this.getUrl();
2277
- this.ws = new ue(e, { maxPayload: 25 * 1024 * 1024 }), this.ws.on("open", () => {
2304
+ this.ws = new re(e, { maxPayload: 25 * 1024 * 1024 }), this.ws.on("open", () => {
2278
2305
  this.opts.onOpen?.(), this.onOpen();
2279
2306
  }), this.ws.on("message", async (e) => {
2280
- let t = An(e);
2307
+ let t = Nn(e);
2281
2308
  await this.opts.onMessage?.(t), await this.onMessage(t);
2282
2309
  }), this.ws.on("close", (e, t) => {
2283
- let n = An(t);
2310
+ let n = Nn(t);
2284
2311
  this.ws = null, this.onClose(e, n), this.opts.onClose?.(`code: ${e}, reason: ${n ?? ""}`);
2285
2312
  }), this.ws.on("error", (e) => {
2286
2313
  this.onError(e), this.opts.onClose?.(`socket error: ${e.message}`);
@@ -2290,14 +2317,14 @@ var jn = class {
2290
2317
  this.closed = !0, this.ws?.close(), this.ws = null;
2291
2318
  }
2292
2319
  send(e) {
2293
- if (!this.ws || this.ws.readyState !== ue.OPEN) throw Error("gateway not connected");
2320
+ if (!this.ws || this.ws.readyState !== re.OPEN) throw Error("gateway not connected");
2294
2321
  this.ws.send(e);
2295
2322
  }
2296
2323
  onOpen() {}
2297
2324
  onMessage(e) {}
2298
2325
  onClose(e, t) {}
2299
2326
  onError(e) {}
2300
- }, Mn = {
2327
+ }, Fn = {
2301
2328
  WEBCHAT_UI: "webchat-ui",
2302
2329
  CONTROL_UI: "openclaw-control-ui",
2303
2330
  WEBCHAT: "webchat",
@@ -2309,29 +2336,29 @@ var jn = class {
2309
2336
  NODE_HOST: "node-host",
2310
2337
  FINGERPRINT: "fingerprint",
2311
2338
  PROBE: "openclaw-probe"
2312
- }, Nn = {
2339
+ }, In = {
2313
2340
  WEBCHAT: "webchat",
2314
2341
  CLI: "cli",
2315
2342
  UI: "ui",
2316
2343
  BACKEND: "backend",
2317
2344
  NODE: "node",
2318
2345
  PROBE: "probe"
2319
- }, q = /* @__PURE__ */ function(e) {
2346
+ }, J = /* @__PURE__ */ function(e) {
2320
2347
  return e.CONNECTION_FAILED = "CONNECTION_FAILED", e.AUTH_FAILED = "AUTH_FAILED", e.INVALID_REQUEST = "INVALID_REQUEST", e.PERMISSION_DENIED = "PERMISSION_DENIED", e.TIMEOUT = "TIMEOUT", e.UNKNOWN = "UNKNOWN", e;
2321
- }({}), J = class extends Error {
2348
+ }({}), Ln = class extends Error {
2322
2349
  code;
2323
2350
  details;
2324
2351
  retryable;
2325
2352
  constructor(e, t, n, r) {
2326
2353
  super(t), this.name = "WebSocketClientError", this.code = e, this.details = n, this.retryable = r;
2327
2354
  }
2328
- }, Pn = {
2355
+ }, Rn = {
2329
2356
  role: "operator",
2330
2357
  scopes: [],
2331
- clientId: Mn.CLI,
2358
+ clientId: Fn.CLI,
2332
2359
  displayName: "Protocol Client",
2333
- clientMode: Nn.CLI
2334
- }, Fn = 3e4, In = "1.0.0", Ln = "server", Rn = 2, zn = 1e3, Bn = class extends jn {
2360
+ clientMode: In.CLI
2361
+ }, zn = 3e4, Bn = "1.0.0", Vn = "server", Hn = 2, Un = 1e3, Wn = class extends Pn {
2335
2362
  protocolOpts;
2336
2363
  config;
2337
2364
  pendingRequests = /* @__PURE__ */ new Map();
@@ -2347,9 +2374,9 @@ var jn = class {
2347
2374
  isReconnecting = !1;
2348
2375
  constructor(e = {}, t = {}) {
2349
2376
  super(e), this.protocolOpts = e, this.config = {
2350
- ...Pn,
2377
+ ...Rn,
2351
2378
  ...t
2352
- }, this.debug = process.env.DEBUG_GATEWAY === "true";
2379
+ }, this.debug = E().DEBUG_GATEWAY === "true";
2353
2380
  }
2354
2381
  onMessage(e) {
2355
2382
  try {
@@ -2373,7 +2400,7 @@ var jn = class {
2373
2400
  handleEvent(e) {
2374
2401
  if (e.event === "connect.challenge") {
2375
2402
  let t = e.payload;
2376
- t?.nonce ? (this.connectNonce = t.nonce, this.clearConnectNonceTimer(), this.sendConnect()) : D().error("[protocol-gateway] connect challenge missing nonce");
2403
+ t?.nonce ? (this.connectNonce = t.nonce, this.clearConnectNonceTimer(), this.sendConnect()) : k().error("[protocol-gateway] connect challenge missing nonce");
2377
2404
  }
2378
2405
  }
2379
2406
  clearConnectNonceTimer() {
@@ -2387,14 +2414,14 @@ var jn = class {
2387
2414
  if (t) if (this.logDebug("response", e), this.pendingRequests.delete(e.id), this.clearTimer(e.id), e.ok) t.resolve(e.payload);
2388
2415
  else {
2389
2416
  let n = e.error || {
2390
- code: q.UNKNOWN,
2417
+ code: J.UNKNOWN,
2391
2418
  message: "Unknown error"
2392
2419
  };
2393
- t.reject(new J(this.toErrorCode(n.code), n.message, n.details, n.retryable));
2420
+ t.reject(new Ln(this.toErrorCode(n.code), n.message, n.details, n.retryable));
2394
2421
  }
2395
2422
  }
2396
2423
  async sendConnect() {
2397
- let e = this.config.clientMode ?? Nn.CLI, t = await Gt(), n = this.connectNonce ? cn({
2424
+ let e = this.config.clientMode ?? In.CLI, t = await Gt(), n = this.connectNonce ? dn({
2398
2425
  deviceIdentity: t,
2399
2426
  clientName: this.config.clientId,
2400
2427
  clientMode: e,
@@ -2403,31 +2430,34 @@ var jn = class {
2403
2430
  authToken: this.protocolOpts.token,
2404
2431
  nonce: this.connectNonce,
2405
2432
  platform: process.platform,
2406
- deviceFamily: Ln
2433
+ deviceFamily: Vn
2407
2434
  }) : void 0, r = {
2408
2435
  minProtocol: 3,
2409
2436
  maxProtocol: 3,
2410
2437
  client: {
2411
2438
  id: this.config.clientId,
2412
2439
  displayName: this.config.displayName,
2413
- version: In,
2440
+ version: Bn,
2414
2441
  platform: process.platform,
2415
- deviceFamily: Ln,
2442
+ deviceFamily: Vn,
2416
2443
  mode: e
2417
2444
  },
2418
2445
  role: this.config.role,
2419
2446
  scopes: this.config.scopes,
2420
- auth: { token: this.protocolOpts.token },
2447
+ auth: {
2448
+ token: this.protocolOpts.token,
2449
+ password: this.protocolOpts.password
2450
+ },
2421
2451
  device: n
2422
2452
  };
2423
2453
  this.sendRequest("connect", r).then((e) => {
2424
2454
  this.helloOk = e, this.connected = !0, this.authenticated = !0, this.protocolOpts.onAuthenticated?.();
2425
2455
  }).catch((e) => {
2426
- this.authenticated = !1, e instanceof J ? this.protocolOpts.onClose?.(`auth failed: [${e.code}] ${e.message}`) : this.protocolOpts.onClose?.(`auth failed: ${e.message}`);
2456
+ this.authenticated = !1, e instanceof Ln ? this.protocolOpts.onClose?.(`auth failed: [${e.code}] ${e.message}`) : this.protocolOpts.onClose?.(`auth failed: ${e.message}`);
2427
2457
  });
2428
2458
  }
2429
2459
  async sendRequest(e, t) {
2430
- let n = oe();
2460
+ let n = _();
2431
2461
  return this.logDebug("request", {
2432
2462
  id: n,
2433
2463
  method: e,
@@ -2446,16 +2476,16 @@ var jn = class {
2446
2476
  try {
2447
2477
  this.send(JSON.stringify(a));
2448
2478
  } catch (e) {
2449
- this.pendingRequests.delete(n), i(new J(q.CONNECTION_FAILED, `WebSocket is not connected, ${JSON.stringify(e)}`));
2479
+ this.pendingRequests.delete(n), i(new Ln(J.CONNECTION_FAILED, `WebSocket is not connected, ${JSON.stringify(e)}`));
2450
2480
  return;
2451
2481
  }
2452
2482
  let o = setTimeout(() => {
2453
2483
  if (this.pendingRequests.has(n)) {
2454
2484
  this.pendingRequests.delete(n);
2455
2485
  let t = this.pendingTimers.get(n);
2456
- t && clearTimeout(t), this.pendingTimers.delete(n), i(new J(q.TIMEOUT, `Request timeout: ${e}`));
2486
+ t && clearTimeout(t), this.pendingTimers.delete(n), i(new Ln(J.TIMEOUT, `Request timeout: ${e}`));
2457
2487
  }
2458
- }, Fn);
2488
+ }, zn);
2459
2489
  this.pendingTimers.set(n, o);
2460
2490
  });
2461
2491
  }
@@ -2466,7 +2496,7 @@ var jn = class {
2466
2496
  return this.connected;
2467
2497
  }
2468
2498
  toErrorCode(e) {
2469
- return Object.values(q).includes(e) ? e : q.UNKNOWN;
2499
+ return Object.values(J).includes(e) ? e : J.UNKNOWN;
2470
2500
  }
2471
2501
  clearTimer(e) {
2472
2502
  let t = this.pendingTimers.get(e);
@@ -2477,7 +2507,7 @@ var jn = class {
2477
2507
  this.pendingTimers.clear(), this.pendingRequests.clear();
2478
2508
  }
2479
2509
  logDebug(e, t) {
2480
- this.debug && D().info(`[yoyoclaw-protocolGatewayClient:${e}] ${JSON.stringify(t)}`);
2510
+ this.debug && k().info(`[yoyoclaw-protocolGatewayClient:${e}] ${JSON.stringify(t)}`);
2481
2511
  }
2482
2512
  connect() {
2483
2513
  this.closed || (this.isReconnecting = !1, super.connect());
@@ -2487,16 +2517,16 @@ var jn = class {
2487
2517
  }
2488
2518
  scheduleReconnect() {
2489
2519
  if (!(this.closed || this.isReconnecting)) {
2490
- if (this.reconnectAttempts >= Rn) {
2491
- D().error(`[protocol-gateway] max reconnect attempts (${Rn}) reached, giving up`), this.protocolOpts.onReconnectFailed?.();
2520
+ if (this.reconnectAttempts >= Hn) {
2521
+ k().error(`[protocol-gateway] max reconnect attempts (${Hn}) reached, giving up`), this.protocolOpts.onReconnectFailed?.();
2492
2522
  return;
2493
2523
  }
2494
- this.reconnectAttempts++, this.isReconnecting = !0, D().info(`[protocol-gateway] attempting to reconnect (attempt ${this.reconnectAttempts}/${Rn})`), this.reconnectTimer = setTimeout(() => {
2524
+ this.reconnectAttempts++, this.isReconnecting = !0, k().info(`[protocol-gateway] attempting to reconnect (attempt ${this.reconnectAttempts}/${Hn})`), this.reconnectTimer = setTimeout(() => {
2495
2525
  this.isReconnecting = !1, this.closed || super.connect();
2496
- }, zn);
2526
+ }, Un);
2497
2527
  }
2498
2528
  }
2499
- }, Vn = {
2529
+ }, Gn = {
2500
2530
  role: "operator",
2501
2531
  scopes: [
2502
2532
  "operator.admin",
@@ -2506,12 +2536,12 @@ var jn = class {
2506
2536
  "operator.approvals",
2507
2537
  "operator.pairing"
2508
2538
  ],
2509
- clientId: Mn.CLI,
2539
+ clientId: Fn.CLI,
2510
2540
  displayName: "YOYO-Control",
2511
- clientMode: Nn.BACKEND
2512
- }, Hn = class extends Bn {
2541
+ clientMode: In.BACKEND
2542
+ }, Kn = class extends Wn {
2513
2543
  constructor(e = {}) {
2514
- super(e, Vn);
2544
+ super(e, Gn);
2515
2545
  }
2516
2546
  async setAgentFile(e, t, n = "main") {
2517
2547
  return this.sendRequest("agents.files.set", {
@@ -2544,7 +2574,7 @@ var jn = class {
2544
2574
  async devicePairApprove(e) {
2545
2575
  return this.sendRequest("device.pair.approve", { requestId: e });
2546
2576
  }
2547
- }, Un = class {
2577
+ }, qn = class {
2548
2578
  client = null;
2549
2579
  ready = !1;
2550
2580
  options;
@@ -2555,18 +2585,19 @@ var jn = class {
2555
2585
  }
2556
2586
  init() {
2557
2587
  if (this.client !== null) return;
2558
- let e = j().getGatewayAuthConfig()?.token || "";
2559
- this.client = new Hn({
2560
- token: e,
2588
+ let e = M().getGatewayAuthConfig(), t = typeof e?.token == "string" ? e.token : "", n = typeof e?.password == "string" ? e.password : "";
2589
+ this.client = new Kn({
2590
+ token: t,
2591
+ password: n,
2561
2592
  onAuthenticated: () => {
2562
- D().info("[yoyoclaw-channel] admin gateway client authenticated"), this.ready = !0, this.resolveAllPending(!0);
2593
+ k().info("[yoyoclaw-channel] admin gateway client authenticated"), this.ready = !0, this.resolveAllPending(!0);
2563
2594
  },
2564
2595
  onClose: (e) => {
2565
- D().info(`[yoyoclaw-channel] admin gateway client closed: ${e}`), this.ready = !1;
2596
+ k().info(`[yoyoclaw-channel] admin gateway client closed: ${e}`), this.ready = !1;
2566
2597
  },
2567
2598
  onReconnectFailed: () => {
2568
- D().error("[yoyoclaw-channel] admin gateway client reconnect failed, notifying status tracker"), this.options.onStatusEvent?.({
2569
- type: G.ADMIN_CLIENT_RECONNECT_FAILED,
2599
+ k().error("[yoyoclaw-channel] admin gateway client reconnect failed, notifying status tracker"), this.options.onStatusEvent?.({
2600
+ type: K.ADMIN_CLIENT_RECONNECT_FAILED,
2570
2601
  timestamp: Date.now(),
2571
2602
  data: {}
2572
2603
  });
@@ -2577,7 +2608,7 @@ var jn = class {
2577
2608
  this.client?.connect();
2578
2609
  }
2579
2610
  destroy() {
2580
- this.client &&= (this.client.stop(), null), this.ready = !1, this.cancelAllPending(), D().info("[yoyoclaw-channel] admin gateway client closed");
2611
+ this.client &&= (this.client.stop(), null), this.ready = !1, this.cancelAllPending(), k().info("[yoyoclaw-channel] admin gateway client closed");
2581
2612
  }
2582
2613
  cancelAllPending() {
2583
2614
  for (let [e, t] of this.pendingReadyRequests) clearTimeout(t.timeout), t.resolve(!1);
@@ -2593,12 +2624,12 @@ var jn = class {
2593
2624
  return this.client !== null && this.ready;
2594
2625
  }
2595
2626
  ensureConnected() {
2596
- return this.client === null && (D().info("[yoyoclaw-channel] admin gateway client is null, initializing"), this.init()), this.ready || (D().info("[yoyoclaw-channel] admin gateway client not ready, connecting"), this.connect()), this.canOperate();
2627
+ return this.client === null && (k().info("[yoyoclaw-channel] admin gateway client is null, initializing"), this.init()), this.ready || (k().info("[yoyoclaw-channel] admin gateway client not ready, connecting"), this.connect()), this.canOperate();
2597
2628
  }
2598
2629
  waitForReady(e = 5e3) {
2599
2630
  return this.canOperate() ? Promise.resolve(!0) : new Promise((t) => {
2600
2631
  let n = `req_${++this.requestIdCounter}`, r = setTimeout(() => {
2601
- this.pendingReadyRequests.delete(n), this.pendingReadyRequests.size === 0 && D().warn("[yoyoclaw-channel] admin gateway client waitForReady timeout, all requests rejected"), t(!1);
2632
+ this.pendingReadyRequests.delete(n), this.pendingReadyRequests.size === 0 && k().warn("[yoyoclaw-channel] admin gateway client waitForReady timeout, all requests rejected"), t(!1);
2602
2633
  }, e);
2603
2634
  this.pendingReadyRequests.set(n, {
2604
2635
  resolve: t,
@@ -2610,11 +2641,11 @@ var jn = class {
2610
2641
  for (let [t, n] of this.pendingReadyRequests) clearTimeout(n.timeout), n.resolve(e);
2611
2642
  this.pendingReadyRequests.clear();
2612
2643
  }
2613
- }, Wn = "/aicloud/yoyo-claw-service/v1/yoyoclaw/fullduplex", Gn = 25 * 1024 * 1024;
2614
- function Kn(e, t) {
2615
- let n = Ve(), r = n.grayTag ? { "x-gray": n.grayTag } : void 0, i = M(), a = `wss://${n.clawCloud}${Wn}`, o = qn(e, t, i, r), s = We(a), c = {
2644
+ }, Jn = "/aicloud/yoyo-claw-service/v1/yoyoclaw/fullduplex", Yn = 25 * 1024 * 1024;
2645
+ function Xn(e, t) {
2646
+ let n = Re(), r = n.grayTag ? { "x-gray": n.grayTag } : void 0, i = Ie(), a = `wss://${n.clawCloud}${Jn}`, o = Zn(e, t, i, r), s = Ve(a), c = {
2616
2647
  headers: o,
2617
- maxPayload: Gn
2648
+ maxPayload: Yn
2618
2649
  };
2619
2650
  return s && (c.agent = s), {
2620
2651
  url: a,
@@ -2622,7 +2653,7 @@ function Kn(e, t) {
2622
2653
  wsOptions: c
2623
2654
  };
2624
2655
  }
2625
- function qn(e, t, n, r) {
2656
+ function Zn(e, t, n, r) {
2626
2657
  let i = {
2627
2658
  "x-role": "yoyoclaw",
2628
2659
  "x-trace-id": n,
@@ -2633,7 +2664,7 @@ function qn(e, t, n, r) {
2633
2664
  }
2634
2665
  //#endregion
2635
2666
  //#region src/cloud-channel/client.ts
2636
- var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2667
+ var Qn = 3e4, $n = 4e3, er = 1e3, tr = 2, nr = 999, rr = class {
2637
2668
  ws = null;
2638
2669
  options;
2639
2670
  retryCount = 0;
@@ -2646,19 +2677,19 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2646
2677
  this.options = e;
2647
2678
  }
2648
2679
  connect(e = !1) {
2649
- if (this.ws?.readyState === S.OPEN) return;
2680
+ if (this.ws?.readyState === T.OPEN) return;
2650
2681
  this.clearRetryTimer();
2651
- let { deviceInfo: t, userInfo: n } = this.options, { url: r, traceId: i, wsOptions: a } = Kn(t, n);
2682
+ let { deviceInfo: t, userInfo: n } = this.options, { url: r, traceId: i, wsOptions: a } = Xn(t, n);
2652
2683
  this.currentTraceId = i, this.options.onStatusEvent?.({
2653
- type: G.CLOUD_SOCKET_CONNECTING,
2684
+ type: K.CLOUD_SOCKET_CONNECTING,
2654
2685
  timestamp: Date.now(),
2655
2686
  data: { url: r }
2656
- }), this.ws = new S(r, a), this.ws.on("open", this.handleOpen.bind(this, r, e)), this.ws.on("message", this.onMessage), this.ws.on("pong", this.handlePong), this.ws.on("close", this.handleClose), this.ws.on("error", this.handleError);
2687
+ }), this.ws = new T(r, a), this.ws.on("open", this.handleOpen.bind(this, r, e)), this.ws.on("message", this.onMessage), this.ws.on("pong", this.handlePong), this.ws.on("close", this.handleClose), this.ws.on("error", this.handleError);
2657
2688
  }
2658
2689
  handleOpen = (e, t) => {
2659
2690
  let n = t ? "reconnected" : "connected";
2660
- D().info(`[claw-cloud-socket][${this.currentTraceId}] ${n} to ${e.slice(0, 15)}`), this.clearRetryTimer(), this.isManualClose = !1, this.retryCount = 0, this.isRetryPaused = !1, this.startPingTimer(), this.options.onStatusEvent?.({
2661
- type: G.CLOUD_SOCKET_CONNECTED,
2691
+ k().info(`[claw-cloud-socket][${this.currentTraceId}] ${n} to ${e.slice(0, 15)}`), this.clearRetryTimer(), this.isManualClose = !1, this.retryCount = 0, this.isRetryPaused = !1, this.startPingTimer(), this.options.onStatusEvent?.({
2692
+ type: K.CLOUD_SOCKET_CONNECTED,
2662
2693
  timestamp: Date.now(),
2663
2694
  data: {
2664
2695
  url: e,
@@ -2667,12 +2698,12 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2667
2698
  }), this.options.onOpen?.();
2668
2699
  };
2669
2700
  handlePong = () => {
2670
- D().debug?.("[claw-cloud-socket] received pong from server");
2701
+ k().debug?.("[claw-cloud-socket] received pong from server");
2671
2702
  };
2672
2703
  handleClose = (e, t) => {
2673
2704
  let n = t.toString();
2674
- D().info(`[claw-cloud-socket][${this.currentTraceId}] connection closed: ${e} - ${n}`), this.options.onStatusEvent?.({
2675
- type: G.CLOUD_SOCKET_DISCONNECTED,
2705
+ k().info(`[claw-cloud-socket][${this.currentTraceId}] connection closed: ${e} - ${n}`), this.options.onStatusEvent?.({
2706
+ type: K.CLOUD_SOCKET_DISCONNECTED,
2676
2707
  timestamp: Date.now(),
2677
2708
  data: {
2678
2709
  reason: n,
@@ -2682,8 +2713,8 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2682
2713
  }), this.isManualClose ? (this.stopPingTimer(), this.options.onClose?.()) : this.scheduleReconnect();
2683
2714
  };
2684
2715
  handleError = (e) => {
2685
- D().error(`[claw-cloud-socket][${this.currentTraceId}] connect errorred: ${e.message}`), e.message.includes("401") && (D().warn(`[claw-cloud-socket][${this.currentTraceId}] unauthorized connection (401), pausing retry and notifying client`), this.pauseRetry(), this.options.onUnauthorized?.()), this.options.onStatusEvent?.({
2686
- type: G.CLOUD_SOCKET_ERROR,
2716
+ k().error(`[claw-cloud-socket][${this.currentTraceId}] connect errorred: ${e.message}`), e.message.includes("401") && (k().warn(`[claw-cloud-socket][${this.currentTraceId}] unauthorized connection (401), pausing retry and notifying client`), this.pauseRetry(), this.options.onUnauthorized?.()), this.options.onStatusEvent?.({
2717
+ type: K.CLOUD_SOCKET_ERROR,
2687
2718
  timestamp: Date.now(),
2688
2719
  data: {
2689
2720
  error: e.message,
@@ -2692,12 +2723,12 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2692
2723
  });
2693
2724
  };
2694
2725
  send(e) {
2695
- if (!this.ws || this.ws.readyState !== S.OPEN) return D().error("[claw-cloud-socket] cannot send message: connection not open"), !1;
2726
+ if (!this.ws || this.ws.readyState !== T.OPEN) return k().error("[claw-cloud-socket] cannot send message: connection not open"), !1;
2696
2727
  try {
2697
2728
  let t = JSON.stringify(e);
2698
2729
  return this.ws.send(t), !0;
2699
2730
  } catch (t) {
2700
- return D().error(`[claw-cloud-socket] failed to send message to cloud session ${e.targetDeviceId},
2731
+ return k().error(`[claw-cloud-socket] failed to send message to cloud session ${e.targetDeviceId},
2701
2732
  ${t instanceof Error ? t.message : String(t)}`), !1;
2702
2733
  }
2703
2734
  }
@@ -2709,35 +2740,35 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2709
2740
  }
2710
2741
  onMessage = async (e) => {
2711
2742
  try {
2712
- let t = An(e), n = JSON.parse(t);
2713
- if (D().debug?.(`[yoyoclaw-channel] received cloud message from session ${n.wsOutputEvent?.sourceDeviceId}, deviceId ${n.wsOutputEvent?.sourceDeviceInfo?.deviceId || "nil"}, ${t.slice(0, 1e3)}`), n.code === "YOYO_CLAW_100000") {
2743
+ let t = Nn(e), n = JSON.parse(t);
2744
+ if (k().debug?.(`[yoyoclaw-channel] received cloud message from session ${n.wsOutputEvent?.sourceDeviceId}, deviceId ${n.wsOutputEvent?.sourceDeviceInfo?.deviceId || "nil"}, ${t.slice(0, 3e3)}`), n.code === "YOYO_CLAW_100000") {
2714
2745
  if (n.wsOutputEvent) {
2715
2746
  n.sessionInfo && (n.wsOutputEvent.sessionInfo = n.sessionInfo), this.options.onMessage?.(n.wsOutputEvent);
2716
2747
  return;
2717
2748
  }
2718
2749
  } else if (n.code === "YOYO_CLAW_100002") {
2719
2750
  if (n.extData?.offlineSocketId) {
2720
- D().info(`[claw-cloud-socket] remote device offline, session: ${n.extData.offlineSocketId}`), this.options.onRemoteDeviceOffline?.(n.extData.offlineSocketId);
2751
+ k().info(`[claw-cloud-socket] remote device offline, session: ${n.extData.offlineSocketId}`), this.options.onRemoteDeviceOffline?.(n.extData.offlineSocketId);
2721
2752
  return;
2722
2753
  }
2723
2754
  } else if (n.code === "YOYO_CLAW_100001") {
2724
- this.pauseRetry(), D().info("[claw-cloud-socket] device not registered, closing connection"), this.options.onDeviceNotRegistered?.();
2755
+ this.pauseRetry(), k().info("[claw-cloud-socket] device not registered, closing connection"), this.options.onDeviceNotRegistered?.();
2725
2756
  return;
2726
2757
  }
2727
- D().warn(`[claw-cloud-socket] unexpected message: ${n.cnMessage}, code: ${n.code}`);
2758
+ k().warn(`[claw-cloud-socket] unexpected message: ${n.cnMessage}, code: ${n.code}`);
2728
2759
  } catch (e) {
2729
- D().error(`[claw-cloud-socket] failed to parse message: ${e instanceof Error ? e.message : String(e)}`);
2760
+ k().error(`[claw-cloud-socket] failed to parse message: ${e instanceof Error ? e.message : String(e)}`);
2730
2761
  }
2731
2762
  };
2732
2763
  scheduleReconnect() {
2733
2764
  if (this.isRetryPaused) {
2734
- D().info("[claw-cloud-socket] retry paused, skipping reconnect"), this.reset(), this.options.onClose?.();
2765
+ k().info("[claw-cloud-socket] retry paused, skipping reconnect"), this.reset(), this.options.onClose?.();
2735
2766
  return;
2736
2767
  }
2737
2768
  this.clearRetryTimer();
2738
2769
  let e = this.calculateRetryDelay();
2739
- this.retryCount = Math.min(this.retryCount + 1, Qn), D().info(`[claw-cloud-socket] scheduling reconnect attempt ${this.retryCount} in ${e}ms`), this.options.onStatusEvent?.({
2740
- type: G.CLOUD_SOCKET_RETRY,
2770
+ this.retryCount = Math.min(this.retryCount + 1, nr), k().info(`[claw-cloud-socket] scheduling reconnect attempt ${this.retryCount} in ${e}ms`), this.options.onStatusEvent?.({
2771
+ type: K.CLOUD_SOCKET_RETRY,
2741
2772
  timestamp: Date.now(),
2742
2773
  data: {
2743
2774
  retryCount: this.retryCount,
@@ -2751,16 +2782,16 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2751
2782
  this.retryTimer &&= (clearTimeout(this.retryTimer), null);
2752
2783
  }
2753
2784
  calculateRetryDelay() {
2754
- let e = Xn * Zn ** +Math.min(this.retryCount, 2);
2755
- return Math.min(e, Yn);
2785
+ let e = er * tr ** +Math.min(this.retryCount, 2);
2786
+ return Math.min(e, $n);
2756
2787
  }
2757
2788
  startPingTimer() {
2758
2789
  this.pingTimer = setInterval(() => {
2759
- if (!this.ws || this.ws.readyState !== S.OPEN) {
2790
+ if (!this.ws || this.ws.readyState !== T.OPEN) {
2760
2791
  this.stopPingTimer();
2761
2792
  return;
2762
2793
  }
2763
- this.ws.ping(), D().debug?.("[claw-cloud-socket] sent ping to server");
2794
+ this.ws.ping(), k().debug?.("[claw-cloud-socket] sent ping to server");
2764
2795
  let { deviceInfo: e } = this.options, t = {
2765
2796
  msgType: "pingMessage",
2766
2797
  sourceRole: "yoyoclaw",
@@ -2769,115 +2800,136 @@ var Jn = 3e4, Yn = 4e3, Xn = 1e3, Zn = 2, Qn = 999, $n = class {
2769
2800
  port: e.port
2770
2801
  };
2771
2802
  try {
2772
- this.ws.send(JSON.stringify(t)), D().debug?.("[claw-cloud-socket] sent pingMessage to server");
2803
+ this.ws.send(JSON.stringify(t)), k().debug?.("[claw-cloud-socket] sent pingMessage to server");
2773
2804
  } catch {
2774
- D().error("[claw-cloud-socket] failed to send pingMessage");
2805
+ k().error("[claw-cloud-socket] failed to send pingMessage");
2775
2806
  }
2776
- }, Jn);
2807
+ }, Qn);
2777
2808
  }
2778
2809
  stopPingTimer() {
2779
2810
  this.pingTimer &&= (clearInterval(this.pingTimer), null);
2780
2811
  }
2781
2812
  pauseRetry() {
2782
- this.isRetryPaused || (this.isRetryPaused = !0, this.clearRetryTimer(), D().info("[claw-cloud-socket] retry paused"));
2813
+ this.isRetryPaused || (this.isRetryPaused = !0, this.clearRetryTimer(), k().info("[claw-cloud-socket] retry paused"));
2783
2814
  }
2784
2815
  resumeRetry() {
2785
- this.isRetryPaused && (this.isRetryPaused = !1, D().info("[claw-cloud-socket] retry resumed"), (!this.ws || this.ws.readyState !== S.OPEN) && (this.retryCount = 0, this.connect(!0)));
2816
+ this.isRetryPaused && (this.isRetryPaused = !1, k().info("[claw-cloud-socket] retry resumed"), (!this.ws || this.ws.readyState !== T.OPEN) && (this.retryCount = 0, this.connect(!0)));
2786
2817
  }
2787
- }, er = ".openclaw/yoyo/tools", tr = /[<>:"/\\|?*]/;
2788
- async function nr(e, t) {
2789
- let n = 0, r = 0;
2790
- for (let i of t) {
2791
- let t = rr(i.name);
2818
+ }, ir = ".openclaw/yoyo/device-toolsets.json", ar = 10 * 1024 * 1024, or = ".openclaw/yoyo/toolset-md5.json", sr = 1024 * 1024, cr = ".openclaw/yoyo/tools", lr = /[<>:"/\\|?*]/, ur = r.join("skills", "yoyo-control", "SKILL.md"), dr = r.join("skills", "yoyo-control", "configs", "sub-skills.json"), fr = r.join("skills", "yoyo-control", "mcptools"), pr = "{{full-mcp-tool-list}}", mr = "<!-- yoyo-mcp-tools:start -->", hr = "<!-- yoyo-mcp-tools:end -->", gr = ".yoyo-device-toolset-copy-fallback";
2819
+ //#endregion
2820
+ //#region src/modules/device-toolset/archive.ts
2821
+ async function _r(e, t) {
2822
+ let n = 0, i = 0;
2823
+ for (let a of t) {
2824
+ let t = yr(a.name);
2792
2825
  if (!t) {
2793
- r += 1;
2826
+ i += 1;
2794
2827
  continue;
2795
2828
  }
2796
2829
  await B({
2797
2830
  rootDir: e,
2798
- relativePath: u.join(er, t),
2799
- data: JSON.stringify(i, null, 2),
2831
+ relativePath: r.join(cr, t),
2832
+ data: JSON.stringify(a, null, 2),
2800
2833
  encoding: "utf8",
2801
2834
  mkdir: !0
2802
2835
  }), n += 1;
2803
2836
  }
2804
2837
  return {
2805
- archiveDir: u.join(e, ".openclaw", "yoyo", "tools"),
2838
+ archiveDir: vr(e),
2806
2839
  writtenCount: n,
2807
- skippedCount: r
2840
+ skippedCount: i
2808
2841
  };
2809
2842
  }
2810
- function rr(e) {
2843
+ function vr(e) {
2844
+ return r.join(e, cr);
2845
+ }
2846
+ function yr(e) {
2811
2847
  let t = e.trim();
2812
- if (!(!t || tr.test(t) || ir(t))) return `${t}.json`;
2848
+ if (!(!t || lr.test(t) || br(t))) return `${t}.json`;
2813
2849
  }
2814
- function ir(e) {
2850
+ function br(e) {
2815
2851
  for (let t of e) if (t.codePointAt(0) < 32) return !0;
2816
2852
  return !1;
2817
2853
  }
2818
2854
  //#endregion
2819
2855
  //#region src/modules/device-toolset/copy-fallback.ts
2820
- var ar = ".yoyo-device-toolset-copy-fallback";
2821
- async function or(e, t) {
2822
- await cr(t), await v.rm(t, {
2856
+ async function xr(e, t) {
2857
+ await Cr(t), await v.rm(t, {
2823
2858
  recursive: !0,
2824
2859
  force: !0
2825
- }), await v.mkdir(t, { recursive: !0 }), await lr(e, t), await v.writeFile(u.join(t, ar), "Managed copy fallback for DeviceToolSet MCP tools.\n", "utf8");
2860
+ }), await v.mkdir(t, { recursive: !0 }), await wr(e, t), await v.writeFile(r.join(t, gr), "Managed copy fallback for DeviceToolSet MCP tools.\n", "utf8");
2826
2861
  }
2827
- async function sr(e) {
2862
+ async function Sr(e) {
2828
2863
  try {
2829
- return (await v.stat(u.join(e, ar))).isFile();
2864
+ return (await v.stat(r.join(e, gr))).isFile();
2830
2865
  } catch {
2831
2866
  return !1;
2832
2867
  }
2833
2868
  }
2834
- async function cr(e) {
2869
+ async function Cr(e) {
2835
2870
  let t;
2836
2871
  try {
2837
2872
  t = await v.lstat(e);
2838
2873
  } catch (e) {
2839
- if (ur(e)) return;
2874
+ if (Tr(e)) return;
2840
2875
  throw e;
2841
2876
  }
2842
2877
  if (!t.isSymbolicLink()) {
2843
2878
  if (!t.isDirectory()) throw Error(`Cannot replace unmanaged mcptools path: ${e}`);
2844
- if (!((await v.readdir(e)).length === 0 || await sr(e))) throw Error(`Cannot replace unmanaged mcptools directory: ${e}`);
2879
+ if (!((await v.readdir(e)).length === 0 || await Sr(e))) throw Error(`Cannot replace unmanaged mcptools directory: ${e}`);
2845
2880
  }
2846
2881
  }
2847
- async function lr(e, t) {
2882
+ async function wr(e, t) {
2848
2883
  let n = await v.readdir(e, { withFileTypes: !0 });
2849
- for (let r of n) {
2850
- let n = u.join(e, r.name), i = u.join(t, r.name);
2851
- r.isDirectory() ? (await v.mkdir(i, { recursive: !0 }), await lr(n, i)) : r.isFile() && await v.copyFile(n, i);
2884
+ for (let i of n) {
2885
+ let n = r.join(e, i.name), a = r.join(t, i.name);
2886
+ i.isDirectory() ? (await v.mkdir(a, { recursive: !0 }), await wr(n, a)) : i.isFile() && await v.copyFile(n, a);
2852
2887
  }
2853
2888
  }
2854
- function ur(e) {
2889
+ function Tr(e) {
2855
2890
  return !!(e && typeof e == "object" && "code" in e && e.code === "ENOENT");
2856
2891
  }
2857
2892
  //#endregion
2858
2893
  //#region src/modules/device-toolset/link.ts
2859
- async function dr(e, t, n = {}) {
2894
+ function Er(e) {
2895
+ return r.join(e, fr);
2896
+ }
2897
+ async function Dr(e, t, n = {}) {
2860
2898
  await v.mkdir(e, { recursive: !0 });
2861
- let r = await v.realpath(e), i = await fr(t);
2862
- if (i.exists) {
2863
- if (i.isLink) {
2864
- if (await pr(t, r)) return { mode: "already-linked" };
2899
+ let i = await v.realpath(e), a = await kr(t);
2900
+ if (a.exists) {
2901
+ if (a.isLink) {
2902
+ if (await Ar(t, i)) return { mode: "already-linked" };
2865
2903
  throw Error(`Cannot replace unmanaged mcptools link: ${t}`);
2866
2904
  }
2867
- if (!await mr(t, i.isDirectory)) throw Error(`Cannot replace unmanaged mcptools directory: ${t}`);
2905
+ if (!await jr(t, a.isDirectory)) throw Error(`Cannot replace unmanaged mcptools directory: ${t}`);
2868
2906
  await v.rm(t, {
2869
2907
  recursive: !0,
2870
2908
  force: !0
2871
2909
  });
2872
2910
  }
2873
- await v.mkdir(u.dirname(t), { recursive: !0 });
2911
+ await v.mkdir(r.dirname(t), { recursive: !0 });
2874
2912
  try {
2875
- return await (n.symlink ?? v.symlink)(r, t, process.platform === "win32" ? "junction" : "dir"), { mode: "linked" };
2913
+ return await (n.symlink ?? v.symlink)(i, t, process.platform === "win32" ? "junction" : "dir"), { mode: "linked" };
2876
2914
  } catch {
2877
- return await (n.copyFallback ?? or)(r, t), { mode: "copy-fallback" };
2915
+ return await (n.copyFallback ?? xr)(i, t), { mode: "copy-fallback" };
2916
+ }
2917
+ }
2918
+ async function Or(e, t) {
2919
+ let n = await kr(t);
2920
+ if (!n.exists) return !1;
2921
+ if (n.isLink) {
2922
+ let n;
2923
+ try {
2924
+ n = await v.realpath(e);
2925
+ } catch {
2926
+ return !1;
2927
+ }
2928
+ return Ar(t, n);
2878
2929
  }
2930
+ return n.isDirectory ? Sr(t) : !1;
2879
2931
  }
2880
- async function fr(e) {
2932
+ async function kr(e) {
2881
2933
  try {
2882
2934
  let t = await v.lstat(e);
2883
2935
  return {
@@ -2886,7 +2938,7 @@ async function fr(e) {
2886
2938
  isDirectory: t.isDirectory()
2887
2939
  };
2888
2940
  } catch (e) {
2889
- if (gr(e)) return {
2941
+ if (Nr(e)) return {
2890
2942
  exists: !1,
2891
2943
  isLink: !1,
2892
2944
  isDirectory: !1
@@ -2894,66 +2946,231 @@ async function fr(e) {
2894
2946
  throw e;
2895
2947
  }
2896
2948
  }
2897
- async function pr(e, t) {
2949
+ async function Ar(e, t) {
2898
2950
  try {
2899
- return hr(await v.realpath(e), t);
2951
+ return Mr(await v.realpath(e), t);
2900
2952
  } catch {
2901
2953
  return !1;
2902
2954
  }
2903
2955
  }
2904
- async function mr(e, t) {
2905
- return t ? (await v.readdir(e)).length === 0 || await sr(e) : !1;
2956
+ async function jr(e, t) {
2957
+ return t ? (await v.readdir(e)).length === 0 || await Sr(e) : !1;
2906
2958
  }
2907
- function hr(e, t) {
2959
+ function Mr(e, t) {
2908
2960
  return process.platform === "win32" ? e.toLowerCase() === t.toLowerCase() : e === t;
2909
2961
  }
2910
- function gr(e) {
2962
+ function Nr(e) {
2911
2963
  return !!(e && typeof e == "object" && "code" in e && e.code === "ENOENT");
2912
2964
  }
2913
2965
  //#endregion
2966
+ //#region src/modules/device-toolset/persist.ts
2967
+ function Pr() {
2968
+ return {
2969
+ version: 1,
2970
+ tools: {}
2971
+ };
2972
+ }
2973
+ async function Fr(e) {
2974
+ try {
2975
+ let t = await vt({
2976
+ rootDir: e,
2977
+ relativePath: ir,
2978
+ maxBytes: ar
2979
+ }), n = JSON.parse(t.buffer.toString("utf8"));
2980
+ return {
2981
+ version: 1,
2982
+ tools: n && typeof n.tools == "object" && n.tools ? n.tools : {}
2983
+ };
2984
+ } catch (e) {
2985
+ if (e instanceof I && e.code === "not-found") return Pr();
2986
+ throw e;
2987
+ }
2988
+ }
2989
+ async function Ir(e, t, n) {
2990
+ let r = {
2991
+ version: 1,
2992
+ tools: Lr((await Fr(e)).tools, t, n)
2993
+ };
2994
+ return await B({
2995
+ rootDir: e,
2996
+ relativePath: ir,
2997
+ data: JSON.stringify(r, null, 2),
2998
+ encoding: "utf8",
2999
+ mkdir: !0
3000
+ }), {
3001
+ changed: !0,
3002
+ nodeCount: Br(r.tools),
3003
+ toolCount: Object.keys(r.tools).length,
3004
+ cache: r
3005
+ };
3006
+ }
3007
+ function Lr(e, t, n) {
3008
+ let r = Rr(e, t);
3009
+ for (let e of n) {
3010
+ let n = r[e.id];
3011
+ r[e.id] = {
3012
+ id: e.id,
3013
+ name: e.name,
3014
+ description: e.description,
3015
+ supportedNodeIds: zr(n?.supportedNodeIds ?? [], t)
3016
+ };
3017
+ }
3018
+ return r;
3019
+ }
3020
+ function Rr(e, t) {
3021
+ let n = {};
3022
+ for (let [r, i] of Object.entries(e)) {
3023
+ if (!i.supportedNodeIds.includes(t)) {
3024
+ n[r] = i;
3025
+ continue;
3026
+ }
3027
+ let e = i.supportedNodeIds.filter((e) => e !== t);
3028
+ e.length > 0 && (n[r] = {
3029
+ ...i,
3030
+ supportedNodeIds: e
3031
+ });
3032
+ }
3033
+ return n;
3034
+ }
3035
+ function zr(e, t) {
3036
+ return [...new Set([...e, t])];
3037
+ }
3038
+ function Br(e) {
3039
+ let t = /* @__PURE__ */ new Set();
3040
+ for (let n of Object.values(e)) for (let e of n.supportedNodeIds) t.add(e);
3041
+ return t.size;
3042
+ }
3043
+ //#endregion
3044
+ //#region src/modules/device-toolset/skill-inject.ts
3045
+ async function Vr(e, t) {
3046
+ let n = r.join(e, ur), i = await v.readFile(n, "utf8"), a = Ur(t, await Hr(e)), o = Gr(i, Wr(a));
3047
+ return o !== i && await v.writeFile(n, o, "utf8"), {
3048
+ skillPath: n,
3049
+ rowCount: Object.keys(a).length
3050
+ };
3051
+ }
3052
+ async function Hr(e) {
3053
+ let t = r.join(e, dr), n;
3054
+ try {
3055
+ n = await v.readFile(t, "utf8");
3056
+ } catch (e) {
3057
+ if (Jr(e) && e.code === "ENOENT") return /* @__PURE__ */ new Set();
3058
+ throw e;
3059
+ }
3060
+ let i = JSON.parse(n);
3061
+ if (!Array.isArray(i) || i.some((e) => typeof e != "string")) throw Error("sub-skills config must be a JSON array of tool names");
3062
+ return new Set(i.map((e) => e.trim()).filter(Boolean));
3063
+ }
3064
+ function Ur(e, t) {
3065
+ return t.size === 0 ? e : Object.fromEntries(Object.entries(e).filter(([e, n]) => !t.has(e) && !t.has(n.name)));
3066
+ }
3067
+ function Wr(e) {
3068
+ return [
3069
+ mr,
3070
+ ...Object.values(e).toSorted((e, t) => e.name.localeCompare(t.name)).map((e) => `| ${Kr(e.name)} | ${Kr(e.description)} | ${Kr(e.supportedNodeIds.join(", "))} |`),
3071
+ hr
3072
+ ].join("\n");
3073
+ }
3074
+ function Gr(e, t) {
3075
+ let n = RegExp(`${qr(mr)}[\\s\\S]*?${qr(hr)}`);
3076
+ if (n.test(e)) return e.replace(n, t);
3077
+ if (e.includes("{{full-mcp-tool-list}}")) return e.replace(pr, t);
3078
+ throw Error("Unable to find MCP tools placeholder or generated block in yoyo-control skill");
3079
+ }
3080
+ function Kr(e) {
3081
+ return e.replaceAll("|", "\\|").replace(/\r?\n/g, " ");
3082
+ }
3083
+ function qr(e) {
3084
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3085
+ }
3086
+ function Jr(e) {
3087
+ return e instanceof Error && "code" in e;
3088
+ }
3089
+ //#endregion
3090
+ //#region src/modules/device-toolset/artifacts.ts
3091
+ async function Yr(e = H(), t = wt()) {
3092
+ if (!e) throw Error("Unable to resolve home directory for DeviceToolSet artifacts");
3093
+ let n = vr(e), i = Er(t), a = r.join(t, ur);
3094
+ k().debug?.(`[yoyoclaw-device-toolset] checking artifacts, skillPath: ${a}, mcptoolsTarget: ${i}, archiveDir: ${n}`);
3095
+ let o = await Xr(t, n, i);
3096
+ if (o.length === 0) return k().debug?.("[yoyoclaw-device-toolset] artifacts are ready, skip restore"), {
3097
+ restored: !1,
3098
+ reasons: o,
3099
+ toolCount: 0
3100
+ };
3101
+ let s = (await Fr(e)).tools, c = Object.keys(s).length;
3102
+ if (k().info(`[yoyoclaw-device-toolset] artifact restore triggered, reasons: ${o.join(",")}, cachedTools: ${c}`), c === 0) return k().debug?.(`[yoyoclaw-device-toolset] artifacts need restore but cache is empty: ${o.join(",")}`), {
3103
+ restored: !1,
3104
+ reasons: o,
3105
+ toolCount: c
3106
+ };
3107
+ if (o.includes("skill")) {
3108
+ let e = await Vr(t, s);
3109
+ k().info(`[yoyoclaw-device-toolset] skill artifact restored, rows: ${e.rowCount}`);
3110
+ }
3111
+ if (o.includes("mcptools")) {
3112
+ let e = await Dr(n, i);
3113
+ k().info(`[yoyoclaw-device-toolset] mcptools artifact restored, mode: ${e.mode}`);
3114
+ }
3115
+ return {
3116
+ restored: !0,
3117
+ reasons: o,
3118
+ toolCount: c
3119
+ };
3120
+ }
3121
+ async function Xr(e, t, n) {
3122
+ let r = [];
3123
+ return await Zr(e) && r.push("skill"), await Or(t, n) || (k().info(`[yoyoclaw-device-toolset] mcptools mapping is missing or stale, target: ${n}, archiveDir: ${t}`), r.push("mcptools")), r;
3124
+ }
3125
+ async function Zr(e) {
3126
+ let t = r.join(e, ur), n = await v.readFile(t, "utf8");
3127
+ if (n.includes("{{full-mcp-tool-list}}")) return k().info(`[yoyoclaw-device-toolset] skill mcp tools block is not generated, placeholder found: ${t}`), !0;
3128
+ let i = n.indexOf(mr), a = n.indexOf(hr), o = i === -1 || a === -1 || a < i;
3129
+ return o && k().info(`[yoyoclaw-device-toolset] skill mcp tools block markers missing or invalid: ${t}`), o;
3130
+ }
3131
+ //#endregion
2914
3132
  //#region src/modules/device-toolset/md5-index.ts
2915
- var _r = ".openclaw/yoyo/toolset-md5.json", vr = 1024 * 1024;
2916
- function yr() {
3133
+ function Qr() {
2917
3134
  return {
2918
3135
  version: 1,
2919
3136
  nodes: {}
2920
3137
  };
2921
3138
  }
2922
- function br(e) {
2923
- return JSON.stringify(Tr(e));
3139
+ function $r(e) {
3140
+ return JSON.stringify(ii(e));
2924
3141
  }
2925
- function xr(e) {
2926
- return ae("md5").update(br(e)).digest("hex");
3142
+ function ei(e) {
3143
+ return e.length === 0 ? "" : g("md5").update($r(e)).digest("hex");
2927
3144
  }
2928
- async function Sr(e) {
3145
+ async function ti(e) {
2929
3146
  try {
2930
- let t = await xt({
3147
+ let t = await vt({
2931
3148
  rootDir: e,
2932
- relativePath: _r,
2933
- maxBytes: vr
3149
+ relativePath: or,
3150
+ maxBytes: sr
2934
3151
  }), n = JSON.parse(t.buffer.toString("utf8"));
2935
3152
  return {
2936
3153
  version: 1,
2937
3154
  nodes: n && typeof n.nodes == "object" && n.nodes ? n.nodes : {}
2938
3155
  };
2939
3156
  } catch (e) {
2940
- if (e instanceof I && e.code === "not-found") return yr();
3157
+ if (e instanceof I && e.code === "not-found") return Qr();
2941
3158
  throw e;
2942
3159
  }
2943
3160
  }
2944
- async function Cr(e, t, n) {
2945
- let r = (await Sr(e)).nodes[t]?.md5;
3161
+ async function ni(e, t, n) {
3162
+ let r = (await ti(e)).nodes[t]?.md5;
2946
3163
  return {
2947
3164
  changed: r !== n,
2948
3165
  md5: n,
2949
3166
  previousMd5: r
2950
3167
  };
2951
3168
  }
2952
- async function wr(e, t, n, r = Date.now()) {
3169
+ async function ri(e, t, n, r = Date.now()) {
2953
3170
  let i = {
2954
3171
  version: 1,
2955
3172
  nodes: {
2956
- ...(await Sr(e)).nodes,
3173
+ ...(await ti(e)).nodes,
2957
3174
  [t]: {
2958
3175
  md5: n,
2959
3176
  updatedAtMs: r
@@ -2962,19 +3179,19 @@ async function wr(e, t, n, r = Date.now()) {
2962
3179
  };
2963
3180
  return await B({
2964
3181
  rootDir: e,
2965
- relativePath: _r,
3182
+ relativePath: or,
2966
3183
  data: JSON.stringify(i, null, 2),
2967
3184
  encoding: "utf8",
2968
3185
  mkdir: !0
2969
3186
  }), i;
2970
3187
  }
2971
- function Tr(e) {
2972
- if (Array.isArray(e)) return e.map(Tr);
3188
+ function ii(e) {
3189
+ if (Array.isArray(e)) return e.map(ii);
2973
3190
  if (!e || typeof e != "object") return e;
2974
3191
  let t = {};
2975
3192
  for (let n of Object.keys(e).toSorted()) {
2976
3193
  let r = e[n];
2977
- r !== void 0 && (t[n] = Tr(r));
3194
+ r !== void 0 && (t[n] = ii(r));
2978
3195
  }
2979
3196
  return t;
2980
3197
  }
@@ -2983,26 +3200,26 @@ function Tr(e) {
2983
3200
  function Y(e) {
2984
3201
  return typeof e == "string" && e.trim() ? e : void 0;
2985
3202
  }
2986
- function Er(e) {
3203
+ function ai(e) {
2987
3204
  if (!e || typeof e != "object") throw Error("DeviceToolSet payload must be an object");
2988
3205
  let t = e;
2989
3206
  if (!Y(t.nodeId)) throw Error("DeviceToolSet payload missing nodeId");
2990
3207
  if (!Array.isArray(t.toolSet)) throw Error("DeviceToolSet payload toolSet must be an array");
2991
- return e;
3208
+ return k().debug?.(`DeviceToolSet payload received: ${JSON.stringify(t, null, 2)}`), e;
2992
3209
  }
2993
- function Dr(e) {
2994
- let t = e.nodeId, n = [], r = 0;
3210
+ function oi(e) {
3211
+ let t = e.nodeId, n = /* @__PURE__ */ new Map(), r = 0;
2995
3212
  for (let t of e.toolSet) {
2996
- let e = Or(t);
2997
- e ? n.push(e) : r += 1;
3213
+ let e = si(t);
3214
+ e ? n.set(e.name, e) : r += 1;
2998
3215
  }
2999
3216
  return {
3000
3217
  nodeId: t,
3001
- tools: n,
3218
+ tools: Array.from(n.values()),
3002
3219
  skippedCount: r
3003
3220
  };
3004
3221
  }
3005
- function Or(e) {
3222
+ function si(e) {
3006
3223
  let t = Y(e.tool?.id), n = Y(e.tool?.function?.name), r = Y(e.tool?.function?.description);
3007
3224
  if (!t || e.tool?.type !== "function" || !n || !r) return;
3008
3225
  let i = {
@@ -3016,138 +3233,30 @@ function Or(e) {
3016
3233
  return a && (i.pkgName = a), i;
3017
3234
  }
3018
3235
  //#endregion
3019
- //#region src/modules/device-toolset/persist.ts
3020
- var kr = ".openclaw/yoyo/device-toolsets.json", Ar = 10 * 1024 * 1024;
3021
- function jr() {
3022
- return {
3023
- version: 1,
3024
- tools: {}
3025
- };
3026
- }
3027
- async function Mr(e) {
3028
- try {
3029
- let t = await xt({
3030
- rootDir: e,
3031
- relativePath: kr,
3032
- maxBytes: Ar
3033
- }), n = JSON.parse(t.buffer.toString("utf8"));
3034
- return {
3035
- version: 1,
3036
- tools: n && typeof n.tools == "object" && n.tools ? n.tools : {}
3037
- };
3038
- } catch (e) {
3039
- if (e instanceof I && e.code === "not-found") return jr();
3040
- throw e;
3041
- }
3042
- }
3043
- async function Nr(e, t, n) {
3044
- let r = {
3045
- version: 1,
3046
- tools: Pr((await Mr(e)).tools, t, n)
3047
- };
3048
- return await B({
3049
- rootDir: e,
3050
- relativePath: kr,
3051
- data: JSON.stringify(r, null, 2),
3052
- encoding: "utf8",
3053
- mkdir: !0
3054
- }), {
3055
- changed: !0,
3056
- nodeCount: Ir(r.tools),
3057
- toolCount: Object.keys(r.tools).length,
3058
- cache: r
3059
- };
3060
- }
3061
- function Pr(e, t, n) {
3062
- let r = { ...e };
3063
- for (let e of n) {
3064
- let n = r[e.id];
3065
- r[e.id] = {
3066
- id: e.id,
3067
- name: e.name,
3068
- description: e.description,
3069
- supportedNodeIds: Fr(n?.supportedNodeIds ?? [], t)
3070
- };
3071
- }
3072
- return r;
3073
- }
3074
- function Fr(e, t) {
3075
- return [...new Set([...e, t])];
3076
- }
3077
- function Ir(e) {
3078
- let t = /* @__PURE__ */ new Set();
3079
- for (let n of Object.values(e)) for (let e of n.supportedNodeIds) t.add(e);
3080
- return t.size;
3081
- }
3082
- //#endregion
3083
- //#region src/modules/device-toolset/skill-inject.ts
3084
- var Lr = u.join("skills", "yoyo-control", "SKILL.md"), Rr = u.join("skills", "yoyo-control", "configs", "sub-skills.json"), zr = "{{full-mcp-tool-list}}", Br = "<!-- yoyo-mcp-tools:start -->", Vr = "<!-- yoyo-mcp-tools:end -->";
3085
- async function Hr(e, t) {
3086
- let n = u.join(e, Lr), r = await v.readFile(n, "utf8"), i = Wr(t, await Ur(e)), a = Kr(r, Gr(i));
3087
- return a !== r && await v.writeFile(n, a, "utf8"), {
3088
- skillPath: n,
3089
- rowCount: Object.keys(i).length
3090
- };
3091
- }
3092
- async function Ur(e) {
3093
- let t = u.join(e, Rr), n;
3094
- try {
3095
- n = await v.readFile(t, "utf8");
3096
- } catch (e) {
3097
- if (Yr(e) && e.code === "ENOENT") return /* @__PURE__ */ new Set();
3098
- throw e;
3099
- }
3100
- let r = JSON.parse(n);
3101
- if (!Array.isArray(r) || r.some((e) => typeof e != "string")) throw Error("sub-skills config must be a JSON array of tool names");
3102
- return new Set(r.map((e) => e.trim()).filter(Boolean));
3103
- }
3104
- function Wr(e, t) {
3105
- return t.size === 0 ? e : Object.fromEntries(Object.entries(e).filter(([e, n]) => !t.has(e) && !t.has(n.name)));
3106
- }
3107
- function Gr(e) {
3108
- return [
3109
- Br,
3110
- ...Object.values(e).toSorted((e, t) => e.name.localeCompare(t.name)).map((e) => `| ${qr(e.name)} | ${qr(e.description)} | ${qr(e.supportedNodeIds.join(", "))} |`),
3111
- Vr
3112
- ].join("\n");
3113
- }
3114
- function Kr(e, t) {
3115
- let n = RegExp(`${Jr(Br)}[\\s\\S]*?${Jr(Vr)}`);
3116
- if (n.test(e)) return e.replace(n, t);
3117
- if (e.includes(zr)) return e.replace(zr, t);
3118
- throw Error("Unable to find MCP tools placeholder or generated block in yoyo-control skill");
3119
- }
3120
- function qr(e) {
3121
- return e.replaceAll("|", "\\|").replace(/\r?\n/g, " ");
3122
- }
3123
- function Jr(e) {
3124
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3125
- }
3126
- function Yr(e) {
3127
- return e instanceof Error && "code" in e;
3128
- }
3129
- //#endregion
3130
3236
  //#region src/modules/device-toolset/processor.ts
3131
- var Xr = Dt();
3132
- async function Zr(e) {
3133
- let t = Er(e), n = Ot();
3237
+ var ci = wt();
3238
+ async function li(e) {
3239
+ let t = ai(e), n = H();
3134
3240
  if (!n) throw Error("Unable to resolve home directory for DeviceToolSet persistence");
3135
- let r = Dr(t);
3136
- D().info(`[yoyoclaw-device-toolset] process start, nodeId: ${r.nodeId}, tools: ${r.tools.length}, skipped: ${r.skippedCount}`);
3137
- let i = xr(r.tools);
3138
- if (D().debug?.(`[yoyoclaw-device-toolset] computed md5, nodeId: ${r.nodeId}, md5: ${i}`), !(await Cr(n, r.nodeId, i)).changed) return D().info(`[yoyoclaw-device-toolset] unchanged, skip refresh, nodeId: ${r.nodeId}`), {
3139
- changed: !1,
3140
- nodeId: r.nodeId,
3141
- skippedCount: r.skippedCount
3142
- };
3143
- let a = await Nr(n, r.nodeId, r.tools);
3144
- D().info(`[yoyoclaw-device-toolset] cache merged, nodeId: ${r.nodeId}, supportedNodes: ${a.nodeCount}, tools: ${a.toolCount}`);
3145
- let o = a.cache.tools, s = await nr(n, r.tools);
3146
- D().info(`[yoyoclaw-device-toolset] archive refreshed, nodeId: ${r.nodeId}, written: ${s.writtenCount}, skipped: ${s.skippedCount}`);
3147
- let c = await Hr(Xr, o);
3148
- D().info(`[yoyoclaw-device-toolset] skill refreshed, nodeId: ${r.nodeId}, rows: ${c.rowCount}`);
3149
- let l = await dr(s.archiveDir, u.join(Xr, "skills", "yoyo-control", "mcptools"));
3150
- return D().info(`[yoyoclaw-device-toolset] mapping ready, nodeId: ${r.nodeId}, mode: ${l.mode}`), await wr(n, r.nodeId, i, Date.now()), D().info(`[yoyoclaw-device-toolset] process complete, nodeId: ${r.nodeId}`), {
3241
+ let r = oi(t);
3242
+ k().info(`[yoyoclaw-device-toolset] process start, nodeId: ${r.nodeId}, tools: ${r.tools.length}, skipped: ${r.skippedCount}`);
3243
+ let i = ei(r.tools);
3244
+ if (k().debug?.(`[yoyoclaw-device-toolset] computed md5, nodeId: ${r.nodeId}, md5: ${i}`), !(await ni(n, r.nodeId, i)).changed) {
3245
+ let e = await Yr(n, ci);
3246
+ return k().info(`[yoyoclaw-device-toolset] unchanged, skip refresh, nodeId: ${r.nodeId}, artifactsRestored: ${e.restored}`), {
3247
+ changed: !1,
3248
+ nodeId: r.nodeId,
3249
+ skippedCount: r.skippedCount
3250
+ };
3251
+ }
3252
+ let a = await Ir(n, r.nodeId, r.tools);
3253
+ k().info(`[yoyoclaw-device-toolset] cache merged, nodeId: ${r.nodeId}, supportedNodes: ${a.nodeCount}, tools: ${a.toolCount}`);
3254
+ let o = a.cache.tools, s = await _r(n, r.tools);
3255
+ k().info(`[yoyoclaw-device-toolset] archive refreshed, nodeId: ${r.nodeId}, written: ${s.writtenCount}, skipped: ${s.skippedCount}`);
3256
+ let c = await Vr(ci, o);
3257
+ k().info(`[yoyoclaw-device-toolset] skill refreshed, nodeId: ${r.nodeId}, rows: ${c.rowCount}`);
3258
+ let l = await Dr(s.archiveDir, Er(ci));
3259
+ return k().info(`[yoyoclaw-device-toolset] mapping ready, nodeId: ${r.nodeId}, mode: ${l.mode}`), await ri(n, r.nodeId, i, Date.now()), k().info(`[yoyoclaw-device-toolset] process complete, nodeId: ${r.nodeId}`), {
3151
3260
  changed: !0,
3152
3261
  nodeId: r.nodeId,
3153
3262
  nodeCount: a.nodeCount,
@@ -3157,7 +3266,7 @@ async function Zr(e) {
3157
3266
  }
3158
3267
  //#endregion
3159
3268
  //#region src/cloud-channel/message-handler.ts
3160
- var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3269
+ var ui = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", di = class {
3161
3270
  sessionManager;
3162
3271
  adminClientManager;
3163
3272
  config;
@@ -3197,7 +3306,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3197
3306
  let { sourceDeviceId: t, sourceDeviceInfo: n, targetDeviceId: r, port: i, sessionInfo: a, traceInfo: o } = e;
3198
3307
  if (!t || !r || !i || !n?.deviceId) return;
3199
3308
  let s = n.deviceId, c = a?.nodeConnectTimestamp;
3200
- c ? (this.sessionManager.closePreviousNodeGatewayClients(s, c), this.flushPendingMessage(s), this.initializedDeviceIds.delete(s)) : D().warn(`${X} pair message missing timestamp for device: ${t}`), D().info(`${X} received pair message, creating gateway client for device: ${t}, hardware device: ${s}, timestamp: ${c}`);
3309
+ c ? (this.sessionManager.closePreviousNodeGatewayClients(s, c), this.flushPendingMessage(s), this.initializedDeviceIds.delete(s)) : k().warn(`${X} pair message missing timestamp for device: ${t}`), k().info(`${X} received pair message, creating gateway client for device: ${t}, hardware device: ${s}, timestamp: ${c}`);
3201
3310
  let l = {
3202
3311
  sessionId: t,
3203
3312
  timestamp: c || 0,
@@ -3208,7 +3317,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3208
3317
  }
3209
3318
  };
3210
3319
  this.sessionManager.addSession(s, l), this.config.onStatusEvent?.({
3211
- type: G.DEVICE_PAIRING,
3320
+ type: K.DEVICE_PAIRING,
3212
3321
  timestamp: Date.now(),
3213
3322
  data: {
3214
3323
  sessionId: t,
@@ -3229,12 +3338,12 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3229
3338
  handleUnPairMessage(e) {
3230
3339
  let { sourceDeviceId: t } = e;
3231
3340
  if (!t) {
3232
- D().warn(`${X} unpair message missing sourceDeviceId`);
3341
+ k().warn(`${X} unpair message missing sourceDeviceId`);
3233
3342
  return;
3234
3343
  }
3235
3344
  let n = this.sessionManager.getHardwareDeviceId(t);
3236
- D().info(`${X} received unpair message, session: ${t}, hardware device: ${n}`), this.config.onStatusEvent?.({
3237
- type: G.DEVICE_UNPAIRING,
3345
+ k().info(`${X} received unpair message, session: ${t}, hardware device: ${n}`), this.config.onStatusEvent?.({
3346
+ type: K.DEVICE_UNPAIRING,
3238
3347
  timestamp: Date.now(),
3239
3348
  data: {
3240
3349
  sessionId: t,
@@ -3247,27 +3356,27 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3247
3356
  handleUserMessage(e) {
3248
3357
  let { sourceDeviceId: t } = e || {};
3249
3358
  if (!t) {
3250
- D().warn(`${X} user message missing sourceDeviceId`);
3359
+ k().warn(`${X} user message missing sourceDeviceId`);
3251
3360
  return;
3252
3361
  }
3253
3362
  let n = this.sessionManager.getHardwareDeviceId(t);
3254
3363
  if (!n) {
3255
- D().warn(`${X} user message missing hardwareDeviceId, session: ${t}`);
3364
+ k().warn(`${X} user message missing hardwareDeviceId, session: ${t}`);
3256
3365
  return;
3257
3366
  }
3258
3367
  try {
3259
3368
  let r = this.sessionManager.getNodeGatewayClient(t);
3260
3369
  if (!r) {
3261
- D().warn(`${X} no node gateway client found for source device: ${n}, session: ${t}`);
3370
+ k().warn(`${X} no node gateway client found for source device: ${n}, session: ${t}`);
3262
3371
  return;
3263
3372
  }
3264
3373
  e.data && (this.initializedDeviceIds.has(n) || this.processMessageBuffer(t, n, e.data, r)) && this.forwardToNodeGateway(t, n, r, e.data);
3265
3374
  } catch (e) {
3266
- D().error(`${X} failed to send gateway message to device: ${n}, session: ${t}, ${String(e)}`);
3375
+ k().error(`${X} failed to send gateway message to device: ${n}, session: ${t}, ${String(e)}`);
3267
3376
  }
3268
3377
  }
3269
3378
  forwardToNodeGateway(e, t, n, r) {
3270
- D().info(`${X} forwarding user message to node gateway from ${t}, session: ${e}`), n.send(r);
3379
+ k().info(`${X} forwarding user message to node gateway from ${t}, session: ${e}`), n.send(r);
3271
3380
  }
3272
3381
  processMessageBuffer(e, t, n, r) {
3273
3382
  let i = this.pendingFirstMessages.get(t);
@@ -3295,22 +3404,22 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3295
3404
  handleNodeGatewayMessage = async (e, t, n) => {
3296
3405
  let r = this.sessionManager.getHardwareDeviceId(e), i = this.sessionManager.getSession(e), a = i?.sourceInfo.sourceDeviceInfo?.deviceId;
3297
3406
  if (!r || !i) {
3298
- D().warn(`${X} gateway source offline, session: ${e}`);
3407
+ k().warn(`${X} gateway source offline, session: ${e}`);
3299
3408
  return;
3300
3409
  }
3301
- D().info(`${X} received gateway message from ${a}`);
3410
+ k().info(`${X} received gateway message from ${a}`);
3302
3411
  try {
3303
3412
  let e = i.sourceInfo.sourceDeviceId, r;
3304
3413
  try {
3305
3414
  r = JSON.parse(n);
3306
3415
  } catch {
3307
- D().warn(`${X} gateway message is not valid JSON`);
3416
+ k().warn(`${X} gateway message is not valid JSON`);
3308
3417
  return;
3309
3418
  }
3310
3419
  if (!r.ok && r.error?.code === "NOT_PAIRED") {
3311
3420
  let n = r.error?.details?.requestId;
3312
3421
  if (!n) {
3313
- D().warn(`${X} NOT_PAIRED without requestId, ignoring...`);
3422
+ k().warn(`${X} NOT_PAIRED without requestId, ignoring...`);
3314
3423
  return;
3315
3424
  }
3316
3425
  await this.handleAutoPair(n);
@@ -3318,30 +3427,30 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3318
3427
  id: r.id,
3319
3428
  type: "reconnect-required"
3320
3429
  };
3321
- this.sendMessage("deviceControl", e, t, "", void 0, i), D().info(`${X} auto pair is completed, requestId: ${n}`);
3430
+ this.sendMessage("deviceControl", e, t, "", void 0, i), k().info(`${X} auto pair is completed, requestId: ${n}`);
3322
3431
  return;
3323
3432
  }
3324
- D().debug?.(`${X} trans gateway msg to cloud, session: ${e}, data: ${n.slice(0, 1e3)}`), this.sendMessage("userMessage", e, t, n) || (D().error(`${X} failed to send message, cloud socket closed, session ${e}, device ${a}`), this.sessionManager.closeNodeGatewayClient(e));
3433
+ k().debug?.(`${X} trans gateway msg to cloud, session: ${e}, data: ${n.slice(0, 1e3)}`), this.sendMessage("userMessage", e, t, n) || (k().error(`${X} failed to send message, cloud socket closed, session ${e}, device ${a}`), this.sessionManager.closeNodeGatewayClient(e));
3325
3434
  } catch (e) {
3326
- D().error(`${X} failed to handle gateway message: ${String(e)}`);
3435
+ k().error(`${X} failed to handle gateway message: ${String(e)}`);
3327
3436
  }
3328
3437
  };
3329
3438
  async handleAutoPair(e) {
3330
3439
  let t = this.adminClientManager.getClient();
3331
- if (!t) return D().warn(`${X} admin client not available for auto pair`), !1;
3440
+ if (!t) return k().warn(`${X} admin client not available for auto pair`), !1;
3332
3441
  try {
3333
- D().info(`${X} auto pair approve, requestId: ${e}`), await t.devicePairApprove(e);
3442
+ k().info(`${X} auto pair approve, requestId: ${e}`), await t.devicePairApprove(e);
3334
3443
  } catch (t) {
3335
- D().error(`${X} auto pair approve failed, requestId: ${e}, error: ${String(t)}, ignore...`);
3444
+ k().error(`${X} auto pair approve failed, requestId: ${e}, error: ${String(t)}, ignore...`);
3336
3445
  }
3337
3446
  }
3338
3447
  async handleContextRequest(e) {
3339
3448
  let { sourceDeviceId: t, traceInfo: n } = e, r = e.msgType, i = r === "updateContexts";
3340
3449
  if (!t) {
3341
- D().warn(`${X} context request missing sourceDeviceId`);
3450
+ k().warn(`${X} context request missing sourceDeviceId`);
3342
3451
  return;
3343
3452
  }
3344
- D().info(`${X} handling ${r} from ${t} traceInfo: ${JSON.stringify(n)}`);
3453
+ k().info(`${X} handling ${r} from ${t} traceInfo: ${JSON.stringify(n)}`);
3345
3454
  let a = e.contexts?.[0], o = this.validateContext(a);
3346
3455
  if (!o.valid) {
3347
3456
  this.replyContextError(r, t, n, a, o.error);
@@ -3357,13 +3466,13 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3357
3466
  if (this.contextHandlerRequiresAdminClient(i, c) && !await this.ensureAdminClientReady(r, t, n, s)) return;
3358
3467
  let o = this.adminClientManager.getClient(), l = i ? await e(o ?? void 0, s.payload, s) : await e(o);
3359
3468
  if (l.noReply) {
3360
- D().info(`${X} ${i ? "update" : "fetch"} context '${c}' processed (no reply)`);
3469
+ k().info(`${X} ${i ? "update" : "fetch"} context '${c}' processed (no reply)`);
3361
3470
  return;
3362
3471
  }
3363
- l.ok ? (D().info(`${X} ${i ? "update" : "fetch"} context successfully`), this.sendContextResponse(r, t, n, a, {
3472
+ l.ok ? (k().info(`${X} ${i ? "update" : "fetch"} context successfully`), this.sendContextResponse(r, t, n, a, {
3364
3473
  ok: !0,
3365
3474
  ...l.data
3366
- })) : (D().error(`${X} failed to ${i ? "update" : "fetch"} context: ${l.error}`), this.sendContextResponse(r, t, n, a, {
3475
+ })) : (k().error(`${X} failed to ${i ? "update" : "fetch"} context: ${l.error}`), this.sendContextResponse(r, t, n, a, {
3367
3476
  ok: !1,
3368
3477
  error: l.error,
3369
3478
  ...l?.data,
@@ -3371,7 +3480,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3371
3480
  }));
3372
3481
  } catch (e) {
3373
3482
  let o = e instanceof Error ? e.message : String(e);
3374
- D().error(`${X} error ${i ? "updating" : "fetching"} context '${c}': ${o}`), this.replyContextError(r, t, n, a, o);
3483
+ k().error(`${X} error ${i ? "updating" : "fetching"} context '${c}': ${o}`), this.replyContextError(r, t, n, a, o);
3375
3484
  }
3376
3485
  }
3377
3486
  sendMessage(e, t, n, r, i, a) {
@@ -3408,7 +3517,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3408
3517
  }];
3409
3518
  }
3410
3519
  replyContextError(e, t, n, r, i) {
3411
- D().error(`${X} ${i}`), this.sendContextResponse(e, t, n, r, {
3520
+ k().error(`${X} ${i}`), this.sendContextResponse(e, t, n, r, {
3412
3521
  ok: !1,
3413
3522
  error: i
3414
3523
  });
@@ -3434,7 +3543,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3434
3543
  ok: !1,
3435
3544
  error: "Missing content in context payload"
3436
3545
  };
3437
- let r = Qr.style, i = await e.setAgentFile(r, n);
3546
+ let r = ui.style, i = await e.setAgentFile(r, n);
3438
3547
  return i.ok ? {
3439
3548
  ok: !0,
3440
3549
  data: { name: "style" }
@@ -3454,21 +3563,21 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3454
3563
  error: "Missing provider or id in context payload"
3455
3564
  };
3456
3565
  try {
3457
- return (await e.switchPrimaryModel(n, r)).ok ? (D().info(`[yoyoclaw-channel] switchPrimaryModel success: ${n}/${r}`), {
3566
+ return (await e.switchPrimaryModel(n, r)).ok ? (k().info(`[yoyoclaw-channel] switchPrimaryModel success: ${n}/${r}`), {
3458
3567
  ok: !0,
3459
3568
  data: { resolved: {
3460
3569
  provider: n,
3461
3570
  id: r
3462
3571
  } }
3463
- }) : (D().error("[yoyoclaw-channel] switchPrimaryModel failed, try to fallback main session model"), this.getMainSessionModel(e));
3572
+ }) : (k().error("[yoyoclaw-channel] switchPrimaryModel failed, try to fallback main session model"), this.getMainSessionModel(e));
3464
3573
  } catch (t) {
3465
- return D().error(`[yoyoclaw-channel] updatePrimaryModel error: ${t}, try to fallback main session model`), this.getMainSessionModel(e);
3574
+ return k().error(`[yoyoclaw-channel] updatePrimaryModel error: ${t}, try to fallback main session model`), this.getMainSessionModel(e);
3466
3575
  }
3467
3576
  }
3468
3577
  async getMainSessionModel(e) {
3469
3578
  try {
3470
3579
  let t = await e.getMainSession(), { modelProvider: n = "", model: r = "" } = t;
3471
- return D().warn(`[yoyoclaw-channel] switchPrimaryModel failed, fallback to current: ${n}/${r}`), !n || !r ? {
3580
+ return k().warn(`[yoyoclaw-channel] switchPrimaryModel failed, fallback to current: ${n}/${r}`), !n || !r ? {
3472
3581
  ok: !1,
3473
3582
  error: `Missing primary model: mainSession-${JSON.stringify(t)}`
3474
3583
  } : {
@@ -3499,7 +3608,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3499
3608
  async fetchModelsList(e) {
3500
3609
  try {
3501
3610
  let t = await e.getModelList(), { modelProvider: n = "", model: r = "" } = await e.getMainSession();
3502
- return D().info(`[yoyoclaw-channel] current primary model: ${n}/${r}`), {
3611
+ return k().info(`[yoyoclaw-channel] current primary model: ${n}/${r}`), {
3503
3612
  ok: !0,
3504
3613
  data: { models: t?.models?.map((e) => {
3505
3614
  let t = e.provider === n && e.id === r;
@@ -3511,7 +3620,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3511
3620
  };
3512
3621
  } catch (e) {
3513
3622
  let t = e instanceof Error ? e.message : String(e);
3514
- return D().error(`[yoyoclaw-channel] fetchModelsList failed: ${t}`), {
3623
+ return k().error(`[yoyoclaw-channel] fetchModelsList failed: ${t}`), {
3515
3624
  ok: !1,
3516
3625
  error: `fetchModelsList error: ${t}`
3517
3626
  };
@@ -3523,14 +3632,14 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3523
3632
  async updateDeviceToolSetContext(e, t, n) {
3524
3633
  return n?.header.namespace === "yoyoclaw" ? {
3525
3634
  ok: !0,
3526
- data: await Zr(t),
3635
+ data: await li(t),
3527
3636
  noReply: !0
3528
3637
  } : {
3529
3638
  ok: !1,
3530
3639
  error: `Unsupported DeviceToolSet namespace: ${n?.header.namespace ?? "unknown"}`
3531
3640
  };
3532
3641
  }
3533
- }, ei = class extends jn {
3642
+ }, fi = class extends Pn {
3534
3643
  nodeOpts;
3535
3644
  sessionId;
3536
3645
  hardwareDeviceId;
@@ -3546,8 +3655,8 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3546
3655
  return this.hardwareDeviceId;
3547
3656
  }
3548
3657
  onOpen() {
3549
- this.connectedAt = (/* @__PURE__ */ new Date()).toISOString(), D().info(`[yoyoclaw-nodeGatewayClient] connected for session: ${this.sessionId}, device: ${this.hardwareDeviceId}`), this.nodeOpts.onStatusEvent?.({
3550
- type: G.GATEWAY_CLIENT_CONNECTED,
3658
+ this.connectedAt = (/* @__PURE__ */ new Date()).toISOString(), k().info(`[yoyoclaw-nodeGatewayClient] connected for session: ${this.sessionId}, device: ${this.hardwareDeviceId}`), this.nodeOpts.onStatusEvent?.({
3659
+ type: K.GATEWAY_CLIENT_CONNECTED,
3551
3660
  timestamp: Date.now(),
3552
3661
  data: {
3553
3662
  sessionId: this.sessionId,
@@ -3558,8 +3667,8 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3558
3667
  });
3559
3668
  }
3560
3669
  onClose(e, t) {
3561
- D().info(`[yoyoclaw-nodeGatewayClient] disconnected for session: ${this.sessionId}, device: ${this.hardwareDeviceId}, reason: ${t}`), this.nodeOpts.onStatusEvent?.({
3562
- type: G.GATEWAY_CLIENT_DISCONNECTED,
3670
+ k().info(`[yoyoclaw-nodeGatewayClient] disconnected for session: ${this.sessionId}, device: ${this.hardwareDeviceId}, reason: ${t}`), this.nodeOpts.onStatusEvent?.({
3671
+ type: K.GATEWAY_CLIENT_DISCONNECTED,
3563
3672
  timestamp: Date.now(),
3564
3673
  data: {
3565
3674
  sessionId: this.sessionId,
@@ -3570,9 +3679,9 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3570
3679
  });
3571
3680
  }
3572
3681
  onError(e) {
3573
- D().error(`[yoyoclaw-nodeGatewayClient] error for session: ${this.sessionId}, device: ${this.hardwareDeviceId}: ${e.message}`);
3682
+ k().error(`[yoyoclaw-nodeGatewayClient] error for session: ${this.sessionId}, device: ${this.hardwareDeviceId}: ${e.message}`);
3574
3683
  }
3575
- }, ti = class {
3684
+ }, pi = class {
3576
3685
  nodeGatewayClientsMap = /* @__PURE__ */ new Map();
3577
3686
  deviceSessionsMap = /* @__PURE__ */ new Map();
3578
3687
  sessionIdToHardwareDeviceMap = /* @__PURE__ */ new Map();
@@ -3605,7 +3714,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3605
3714
  this.nodeGatewayClientsMap.set(e, t);
3606
3715
  }
3607
3716
  createNodeGatewayClient(e) {
3608
- let t = new ei({
3717
+ let t = new fi({
3609
3718
  sessionId: e.sessionId,
3610
3719
  hardwareDeviceId: e.hardwareDeviceId,
3611
3720
  deviceInfo: e.deviceInfo,
@@ -3616,19 +3725,19 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3616
3725
  }
3617
3726
  closeNodeGatewayClient(e) {
3618
3727
  let t = this.nodeGatewayClientsMap.get(e);
3619
- t && (t.stop(), this.nodeGatewayClientsMap.delete(e), this.removeSession(e), D().info(`[yoyoclaw-channel] closed node gateway client for session: ${e}`));
3728
+ t && (t.stop(), this.nodeGatewayClientsMap.delete(e), this.removeSession(e), k().info(`[yoyoclaw-channel] closed node gateway client for session: ${e}`));
3620
3729
  }
3621
3730
  closePreviousNodeGatewayClients(e, t) {
3622
3731
  let n = this.deviceSessionsMap.get(e);
3623
3732
  if (!n || n.length === 0) return;
3624
3733
  let r = n.filter((e) => e.timestamp < t);
3625
3734
  if (r.length > 0) {
3626
- D().info(`[yoyoclaw-channel] closing ${r.length} previous node gateway client(s) for hardware device: ${e}, new timestamp: ${t}`);
3735
+ k().info(`[yoyoclaw-channel] closing ${r.length} previous node gateway client(s) for hardware device: ${e}, new timestamp: ${t}`);
3627
3736
  for (let e of r) this.closeNodeGatewayClient(e.sessionId);
3628
3737
  }
3629
3738
  }
3630
3739
  closeAllNodeGatewayClients() {
3631
- for (let [e, t] of this.nodeGatewayClientsMap.entries()) t.stop(), D().info(`[yoyoclaw-channel] closed node gateway client for session: ${e}`);
3740
+ for (let [e, t] of this.nodeGatewayClientsMap.entries()) t.stop(), k().info(`[yoyoclaw-channel] closed node gateway client for session: ${e}`);
3632
3741
  this.nodeGatewayClientsMap.clear(), this.deviceSessionsMap.clear(), this.sessionIdToHardwareDeviceMap.clear();
3633
3742
  }
3634
3743
  hasSession(e) {
@@ -3637,14 +3746,14 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3637
3746
  getSessionCount() {
3638
3747
  return this.sessionIdToHardwareDeviceMap.size;
3639
3748
  }
3640
- }, ni = class {
3749
+ }, mi = class {
3641
3750
  cloudClient;
3642
3751
  sessionManager;
3643
3752
  adminClientManager;
3644
3753
  messageHandler;
3645
3754
  config;
3646
3755
  constructor(e) {
3647
- this.config = e, this.sessionManager = new ti(), this.adminClientManager = new Un({ onStatusEvent: this.handleStatusEvent }), this.messageHandler = new $r({
3756
+ this.config = e, this.sessionManager = new pi(), this.adminClientManager = new qn({ onStatusEvent: this.handleStatusEvent }), this.messageHandler = new di({
3648
3757
  sessionManager: this.sessionManager,
3649
3758
  adminClientManager: this.adminClientManager,
3650
3759
  config: {
@@ -3652,7 +3761,7 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3652
3761
  onStatusEvent: this.handleStatusEvent,
3653
3762
  onReply: (e) => this.cloudClient.send(e)
3654
3763
  }
3655
- }), this.cloudClient = new $n({
3764
+ }), this.cloudClient = new rr({
3656
3765
  deviceInfo: e.deviceInfo,
3657
3766
  userInfo: e.userInfo,
3658
3767
  onMessage: this.messageHandler.handleCloudMessage,
@@ -3665,73 +3774,96 @@ var Qr = { style: "SOUL.md" }, X = "[yoyoclaw-channel]", $r = class {
3665
3774
  }), this.adminClientManager.init();
3666
3775
  }
3667
3776
  start() {
3668
- D().info("[yoyoclaw-channel] starting connection"), this.adminClientManager.ensureConnected(), this.cloudClient.connect();
3777
+ k().info("[yoyoclaw-channel] starting connection"), this.adminClientManager.ensureConnected(), this.cloudClient.connect();
3669
3778
  }
3670
3779
  destroy() {
3671
- D().info("[yoyoclaw-channel] closing connection"), this.sessionManager.closeAllNodeGatewayClients(), this.adminClientManager.destroy(), this.cloudClient.close();
3780
+ k().info("[yoyoclaw-channel] closing connection"), this.sessionManager.closeAllNodeGatewayClients(), this.adminClientManager.destroy(), this.cloudClient.close();
3672
3781
  }
3673
3782
  handleCloudOpen = () => {
3674
- D().info("[yoyoclaw-channel] cloud connection established"), this.config.onOpen?.();
3783
+ k().info("[yoyoclaw-channel] cloud connection established"), this.config.onOpen?.();
3675
3784
  };
3676
3785
  handleStatusEvent = (e) => {
3677
3786
  this.config.onStatusEvent?.(e);
3678
3787
  };
3679
3788
  handleCloudClose = () => {
3680
- D().info("[yoyoclaw-channel] cloud connection closed"), this.config.onClose?.();
3789
+ k().info("[yoyoclaw-channel] cloud connection closed"), this.config.onClose?.();
3681
3790
  };
3682
3791
  handleRemoteDeviceOffline = (e) => {
3683
3792
  this.sessionManager.closeNodeGatewayClient(e);
3684
3793
  };
3685
3794
  handleDeviceNotRegistered = () => {
3686
- D().info("[yoyoclaw-channel] device not registered, notifying connection layer"), this.config.onDeviceNotRegistered?.();
3795
+ k().info("[yoyoclaw-channel] device not registered, notifying connection layer"), this.config.onDeviceNotRegistered?.();
3687
3796
  };
3688
3797
  handleUnauthorized = () => {
3689
- D().info("[yoyoclaw-channel] unauthorized connection, notifying connection layer"), this.config.onUnauthorized?.();
3798
+ k().info("[yoyoclaw-channel] unauthorized connection, notifying connection layer"), this.config.onUnauthorized?.();
3690
3799
  };
3691
3800
  }, Z = {
3692
3801
  channel: null,
3693
3802
  status: "idle"
3694
- }, Q = null, ri = (e) => ({
3803
+ }, Q = null, hi = (e) => ({
3695
3804
  id: "yoyoclaw-connection",
3696
3805
  async start() {
3697
- D().info("[yoyoclaw] plugin service enabled"), Q = new bn(!0);
3698
- try {
3699
- await Q.loadAndCleanStatus(), D().info("[yoyoclaw-conn] status tracker initialized and cleaned");
3700
- } catch (e) {
3701
- D().warn(`[yoyoclaw-conn] failed to load saved status: ${String(e)}`);
3702
- }
3703
- D().debug?.(`[yoyoclaw] agents: ${JSON.stringify(e.config.agents?.defaults)}`);
3704
- try {
3705
- await j().initializePluginConfig("yoyo"), D().info("[yoyoclaw] plugin config initialized");
3706
- } catch (e) {
3707
- D().error(`[yoyoclaw] failed to initialize plugin config: ${String(e)}`);
3708
- }
3709
- try {
3710
- let e = await dn();
3711
- e?.token ? (D().info("[yoyoclaw-conn] token found, creating channel"), await ii(await W(), e)) : D().info("[yoyoclaw-conn] no token found, skipping channel creation");
3712
- } catch (e) {
3713
- D().error(`[yoyoclaw-conn] failed to initialize connection: ${String(e)}`);
3714
- }
3806
+ k().info("[yoyoclaw-conn] plugin service enabled"), await gi(), await vi(), await yi(), await bi();
3715
3807
  },
3716
3808
  async stop(e) {
3717
- $(), D().info("[yoyoclaw-conn] stopping connection service"), Q &&= (await Q.destroy(), null);
3809
+ $(), k().info("[yoyoclaw-conn] stopping connection service"), await _i();
3718
3810
  }
3719
3811
  });
3720
- async function ii(e, t) {
3721
- return Z.status = "connecting", D().info(`[yoyoclaw-conn] creating new channel for device: ${e.deviceId}`), Q && await Q.handleEvent({
3722
- type: G.CONNECTION_STATUS_CHANGED,
3812
+ async function gi() {
3813
+ Q = new Cn(!0);
3814
+ try {
3815
+ await Q.loadAndCleanStatus(), k().info("[yoyoclaw-status] status tracker initialized and cleaned");
3816
+ } catch (e) {
3817
+ k().warn(`[yoyoclaw-status] failed to load saved status: ${String(e)}`);
3818
+ }
3819
+ }
3820
+ async function _i() {
3821
+ Q &&= (await Q.destroy(), null);
3822
+ }
3823
+ async function vi() {
3824
+ try {
3825
+ await M().initializePluginConfig("yoyo"), k().info("[yoyoclaw-config] plugin config initialized");
3826
+ } catch (e) {
3827
+ k().error(`[yoyoclaw-config] failed to initialize plugin config: ${String(e)}`);
3828
+ }
3829
+ }
3830
+ async function yi() {
3831
+ try {
3832
+ let e = await Yr();
3833
+ k().info(`[yoyoclaw-device-toolset] startup artifact check complete, restored: ${e.restored}`);
3834
+ } catch (e) {
3835
+ k().warn(`[yoyoclaw-device-toolset] startup artifact check failed: ${String(e)}`);
3836
+ }
3837
+ }
3838
+ async function bi() {
3839
+ try {
3840
+ let e = await mn();
3841
+ if (e?.token) {
3842
+ k().info("[yoyoclaw-conn] token found, creating channel"), await xi(await G(), e);
3843
+ return;
3844
+ }
3845
+ k().info("[yoyoclaw-conn] no token found, skipping channel creation");
3846
+ } catch (e) {
3847
+ k().error(`[yoyoclaw-conn] failed to initialize connection: ${String(e)}`);
3848
+ }
3849
+ }
3850
+ async function xi(e, t) {
3851
+ k().info(`[yoyoclaw-conn] creating new channel for device: ${e.deviceId}`), await Xt(e, t);
3852
+ let n = Z.status;
3853
+ return Z.status = "connecting", Q && await Q.handleEvent({
3854
+ type: K.CONNECTION_STATUS_CHANGED,
3723
3855
  timestamp: Date.now(),
3724
3856
  data: {
3725
3857
  status: "connecting",
3726
- previousStatus: Z.status
3858
+ previousStatus: n
3727
3859
  }
3728
3860
  }), new Promise((n, r) => {
3729
- Z.channel = new ni({
3861
+ Z.channel = new mi({
3730
3862
  deviceInfo: e,
3731
3863
  userInfo: t,
3732
3864
  onOpen: () => {
3733
- Z.status = "connected", D().info("[yoyoclaw-conn] channel connected successfully"), Q && Q.handleEvent({
3734
- type: G.CONNECTION_STATUS_CHANGED,
3865
+ Z.status = "connected", k().info("[yoyoclaw-conn] channel connected successfully"), Q && Q.handleEvent({
3866
+ type: K.CONNECTION_STATUS_CHANGED,
3735
3867
  timestamp: Date.now(),
3736
3868
  data: {
3737
3869
  status: "connected",
@@ -3740,8 +3872,8 @@ async function ii(e, t) {
3740
3872
  }), n(void 0);
3741
3873
  },
3742
3874
  onClose: () => {
3743
- Z.status = "idle", Z.channel = null, D().info("[yoyoclaw-conn] channel closed"), Q && Q.handleEvent({
3744
- type: G.CONNECTION_STATUS_CHANGED,
3875
+ Z.status = "idle", Z.channel = null, k().info("[yoyoclaw-conn] channel closed"), Q && Q.handleEvent({
3876
+ type: K.CONNECTION_STATUS_CHANGED,
3745
3877
  timestamp: Date.now(),
3746
3878
  data: {
3747
3879
  status: "idle",
@@ -3750,30 +3882,30 @@ async function ii(e, t) {
3750
3882
  }), n(void 0);
3751
3883
  },
3752
3884
  onDeviceNotRegistered: async () => {
3753
- D().info("[yoyoclaw-conn] device not registered, handling...");
3754
- let t = await dn();
3885
+ k().info("[yoyoclaw-conn] device not registered, handling...");
3886
+ let t = await mn();
3755
3887
  if (!t?.token) {
3756
- D().info("[yoyoclaw-conn] no token available, treating as logout"), $();
3888
+ k().info("[yoyoclaw-conn] no token available, treating as logout"), $();
3757
3889
  return;
3758
3890
  }
3759
3891
  try {
3760
- D().info("[yoyoclaw-conn] attempting to register device"), await Bt(e, t), D().info("[yoyoclaw-conn] device registered successfully, reconnecting..."), $(), await ii(e, t);
3892
+ k().info("[yoyoclaw-conn] attempting to register device"), await Yt(e, t), k().info("[yoyoclaw-conn] device registered successfully, reconnecting..."), $(), await xi(e, t);
3761
3893
  } catch (e) {
3762
- D().error(`[yoyoclaw-conn] device registration failed: ${String(e)}`), D().info("[yoyoclaw-conn] clearing token and destroying channel");
3894
+ k().error(`[yoyoclaw-conn] device registration failed: ${String(e)}`), k().info("[yoyoclaw-conn] clearing token and destroying channel");
3763
3895
  try {
3764
- await fn();
3896
+ await hn();
3765
3897
  } catch (e) {
3766
- D().error(`[yoyoclaw-conn] failed to clear token: ${String(e)}`);
3898
+ k().error(`[yoyoclaw-conn] failed to clear token: ${String(e)}`);
3767
3899
  }
3768
3900
  $();
3769
3901
  }
3770
3902
  },
3771
3903
  onUnauthorized: async () => {
3772
- D().warn("[yoyoclaw-conn] connection unauthorized (401), clearing token and destroying channel");
3904
+ k().warn("[yoyoclaw-conn] connection unauthorized (401), clearing token and destroying channel");
3773
3905
  try {
3774
- await fn();
3906
+ await hn();
3775
3907
  } catch (e) {
3776
- D().error(`[yoyoclaw-conn] failed to clear token: ${String(e)}`);
3908
+ k().error(`[yoyoclaw-conn] failed to clear token: ${String(e)}`);
3777
3909
  }
3778
3910
  $();
3779
3911
  },
@@ -3784,31 +3916,31 @@ async function ii(e, t) {
3784
3916
  try {
3785
3917
  Z.channel.start();
3786
3918
  } catch (e) {
3787
- Z.status = "idle", Z.channel = null, D().error(`[yoyoclaw-conn] failed to launch channel: ${String(e)}`), r(e);
3919
+ Z.status = "idle", Z.channel = null, k().error(`[yoyoclaw-conn] failed to launch channel: ${String(e)}`), r(e);
3788
3920
  }
3789
3921
  });
3790
3922
  }
3791
3923
  function $() {
3792
3924
  try {
3793
3925
  if (!Z.channel) {
3794
- D().warn("[yoyoclaw-conn] no channel to destroy");
3926
+ k().warn("[yoyoclaw-conn] no channel to destroy");
3795
3927
  return;
3796
3928
  }
3797
- D().info("[yoyoclaw-conn] destroying channel"), Z.channel.destroy(), Z.channel = null, Z.status = "idle", D().info("[yoyoclaw-conn] channel destroyed successfully");
3929
+ k().info("[yoyoclaw-conn] destroying channel"), Z.channel.destroy(), Z.channel = null, Z.status = "idle", k().info("[yoyoclaw-conn] channel destroyed successfully");
3798
3930
  } catch (e) {
3799
- D().error(`[yoyoclaw-conn] failed to destroy channel: ${String(e)}`);
3931
+ k().error(`[yoyoclaw-conn] failed to destroy channel: ${String(e)}`);
3800
3932
  }
3801
3933
  }
3802
3934
  //#endregion
3803
3935
  //#region index.ts
3804
- var ai = {
3936
+ var Si = {
3805
3937
  id: "yoyo",
3806
3938
  name: "YOYOClaw",
3807
3939
  description: "OpenClaw Honor Yoyo connection plugin",
3808
- configSchema: kn,
3940
+ configSchema: Mn,
3809
3941
  register(e) {
3810
- pe(e.runtime), Se(e.logger), e.registerService(ri(e)), e.on("before_prompt_build", async () => ({ prependSystemContext: En })), Tn(e);
3942
+ ce(e.runtime), _e(e.logger), e.registerService(hi(e)), e.on("before_prompt_build", async () => ({ prependSystemContext: kn })), On(e);
3811
3943
  }
3812
3944
  };
3813
3945
  //#endregion
3814
- export { ai as default };
3946
+ export { Si as default };