@honor-claw/yoyo 1.6.1-beta.4 → 1.6.1-beta.6

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.
@@ -3,14 +3,13 @@ import { getEnvFromProcessEnv as t } from "../../utils/env.mjs";
3
3
  import { wrapError as n } from "../../utils/error.mjs";
4
4
  import { useClawLogger as r } from "../../utils/logger.mjs";
5
5
  import { detectProvidersToRename as i, updateProviderReferences as a } from "./provider.mjs";
6
- import { STATE_FLAG as o, hasPersistedStateFlag as s, markPersistedStateFlag as c } from "./state-flags.mjs";
7
- import { getYoyoRuntime as l } from "../../runtime.mjs";
8
- import { isBetaVersion as u } from "../../utils/version.mjs";
6
+ import { getYoyoRuntime as o } from "../../runtime.mjs";
7
+ import { isBetaVersion as s } from "../../utils/version.mjs";
9
8
  //#region src/modules/configs/config-manager.ts
10
- var d = "yoyo", f = /* @__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,task_result_query".split(","), p = class {
9
+ var c = "yoyo", l = /* @__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,task_result_query".split(","), u = class {
11
10
  loadConfig() {
12
11
  try {
13
- let e = l().config, t = e.current;
12
+ let e = o().config, t = e.current;
14
13
  return typeof t == "function" ? structuredClone(t()) : structuredClone(e.loadConfig());
15
14
  } catch (e) {
16
15
  throw n(e, "Failed to load config");
@@ -18,7 +17,7 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
18
17
  }
19
18
  async saveConfig(e) {
20
19
  try {
21
- let t = l().config, n = t.replaceConfigFile;
20
+ let t = o().config, n = t.replaceConfigFile;
22
21
  if (typeof n == "function") {
23
22
  await n({
24
23
  nextConfig: e,
@@ -54,7 +53,7 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
54
53
  }
55
54
  getUserConfig() {
56
55
  try {
57
- return this.loadConfig().plugins?.entries?.[d]?.config?.user;
56
+ return this.loadConfig().plugins?.entries?.[c]?.config?.user;
58
57
  } catch (e) {
59
58
  console.error(`[claw-configs] Failed to read user config: ${e}`);
60
59
  return;
@@ -62,7 +61,7 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
62
61
  }
63
62
  getEnvInfo() {
64
63
  try {
65
- let e = this.loadConfig().plugins?.entries?.[d]?.config, n = e?.envInfo;
64
+ let e = this.loadConfig().plugins?.entries?.[c]?.config, n = e?.envInfo;
66
65
  if (n?.env) return n;
67
66
  let r = e?.env;
68
67
  if (r) return {
@@ -86,7 +85,7 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
86
85
  }
87
86
  getGrayTag() {
88
87
  try {
89
- return this.loadConfig().plugins?.entries?.[d]?.config?.gray;
88
+ return this.loadConfig().plugins?.entries?.[c]?.config?.gray;
90
89
  } catch (e) {
91
90
  console.error(`[claw-configs] Failed to read gray tag config: ${e}`);
92
91
  return;
@@ -94,7 +93,7 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
94
93
  }
95
94
  getDeviceConfig() {
96
95
  try {
97
- return this.loadConfig().plugins?.entries?.[d]?.config?.device;
96
+ return this.loadConfig().plugins?.entries?.[c]?.config?.device;
98
97
  } catch (e) {
99
98
  console.error(`[claw-configs] Failed to read device config: ${e}`);
100
99
  return;
@@ -102,17 +101,17 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
102
101
  }
103
102
  async updateDeviceConfig(e) {
104
103
  try {
105
- let t = this.loadConfig(), n = t.plugins?.entries?.[d]?.config?.device || {}, r = {
104
+ let t = this.loadConfig(), n = t.plugins?.entries?.[c]?.config?.device || {}, r = {
106
105
  ...t,
107
106
  plugins: {
108
107
  ...t.plugins,
109
108
  entries: {
110
109
  ...t.plugins?.entries,
111
- [d]: {
112
- ...t.plugins?.entries?.[d],
110
+ [c]: {
111
+ ...t.plugins?.entries?.[c],
113
112
  enabled: !0,
114
113
  config: {
115
- ...t.plugins?.entries?.[d]?.config,
114
+ ...t.plugins?.entries?.[c]?.config,
116
115
  device: {
117
116
  ...n,
118
117
  ...e
@@ -135,11 +134,11 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
135
134
  ...t.plugins,
136
135
  entries: {
137
136
  ...t.plugins?.entries,
138
- [d]: {
139
- ...t.plugins?.entries?.[d],
137
+ [c]: {
138
+ ...t.plugins?.entries?.[c],
140
139
  enabled: !0,
141
140
  config: {
142
- ...t.plugins?.entries?.[d]?.config,
141
+ ...t.plugins?.entries?.[c]?.config,
143
142
  envInfo: {
144
143
  env: e,
145
144
  source: "manual"
@@ -157,7 +156,7 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
157
156
  }
158
157
  async resetEnv() {
159
158
  try {
160
- let e = this.loadConfig(), t = e.plugins?.entries?.[d]?.config?.envInfo;
159
+ let e = this.loadConfig(), t = e.plugins?.entries?.[c]?.config?.envInfo;
161
160
  if (!t?.env) return;
162
161
  let n = {
163
162
  ...e,
@@ -165,11 +164,11 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
165
164
  ...e.plugins,
166
165
  entries: {
167
166
  ...e.plugins?.entries,
168
- [d]: {
169
- ...e.plugins?.entries?.[d],
167
+ [c]: {
168
+ ...e.plugins?.entries?.[c],
170
169
  enabled: !0,
171
170
  config: {
172
- ...e.plugins?.entries?.[d]?.config,
171
+ ...e.plugins?.entries?.[c]?.config,
173
172
  envInfo: {
174
173
  env: t.env,
175
174
  source: "env"
@@ -192,11 +191,11 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
192
191
  ...t.plugins,
193
192
  entries: {
194
193
  ...t.plugins?.entries,
195
- [d]: {
196
- ...t.plugins?.entries?.[d],
194
+ [c]: {
195
+ ...t.plugins?.entries?.[c],
197
196
  enabled: !0,
198
197
  config: {
199
- ...t.plugins?.entries?.[d]?.config,
198
+ ...t.plugins?.entries?.[c]?.config,
200
199
  ...e && { gray: e }
201
200
  }
202
201
  }
@@ -216,11 +215,11 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
216
215
  ...t.plugins,
217
216
  entries: {
218
217
  ...t.plugins?.entries,
219
- [d]: {
220
- ...t.plugins?.entries?.[d],
218
+ [c]: {
219
+ ...t.plugins?.entries?.[c],
221
220
  enabled: !0,
222
221
  config: {
223
- ...t.plugins?.entries?.[d]?.config,
222
+ ...t.plugins?.entries?.[c]?.config,
224
223
  user: e
225
224
  }
226
225
  }
@@ -240,10 +239,10 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
240
239
  ...e.plugins,
241
240
  entries: {
242
241
  ...e.plugins?.entries,
243
- [d]: {
244
- ...e.plugins?.entries?.[d],
242
+ [c]: {
243
+ ...e.plugins?.entries?.[c],
245
244
  config: {
246
- ...e.plugins?.entries?.[d]?.config,
245
+ ...e.plugins?.entries?.[c]?.config,
247
246
  user: void 0
248
247
  }
249
248
  }
@@ -255,28 +254,28 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
255
254
  throw n(e, "Failed to clear user config");
256
255
  }
257
256
  }
258
- async initializePluginConfig(l) {
257
+ async initializePluginConfig(o) {
259
258
  try {
260
- let n = this.loadConfig(), d = n.skills || {}, p = d.load || {}, m = p.watch === !0, h = !m || await s(o.DISABLE_SKILLS_LOAD_WATCH_MIGRATION_DONE), g = n.plugins?.allow || [], _ = !g.includes(l), v = g.includes(l) ? g : [...g, l], y = n.gateway?.nodes?.allowCommands || [], b = Array.from(new Set([...y, ...f])), x = !e(y, b), S = m && !h, C = n.plugins?.entries?.[l]?.config?.envInfo, w = n.plugins?.entries?.[l]?.config?.env, T = !!(C?.env || w), E = t(), D = !!C?.env && C.source === "env", O = !C?.env && !!w || D && E && C.env !== E, k = !T || O, A = {
261
- env: E || w || (u() ? "test" : "production"),
259
+ let n = this.loadConfig(), c = n.skills || {}, u = c.load || {}, d = u.watch === !1, f = n.plugins?.allow || [], p = !f.includes(o), m = f.includes(o) ? f : [...f, o], h = n.gateway?.nodes?.allowCommands || [], g = Array.from(new Set([...h, ...l])), _ = !e(h, g), v = !d, y = n.plugins?.entries?.[o]?.config?.envInfo, b = n.plugins?.entries?.[o]?.config?.env, x = !!(y?.env || b), S = t(), C = !!y?.env && y.source === "env", w = !y?.env && !!b || C && S && y.env !== S, T = !x || w, E = {
260
+ env: S || b || (s() ? "test" : "production"),
262
261
  source: "env"
263
- }, j = n.plugins?.entries?.[l]?.config || {}, M = k ? {
264
- ...j,
265
- envInfo: A,
262
+ }, D = n.plugins?.entries?.[o]?.config || {}, O = T ? {
263
+ ...D,
264
+ envInfo: E,
266
265
  env: void 0
267
- } : j, N = n.plugins?.entries?.[l]?.enabled !== !0, P = i(n), F = Object.keys(P).length > 0;
268
- if (F && r().info(`[claw-configs] Found ${Object.keys(P).length} providers to rename: ${Object.entries(P).map(([e, t]) => `${e} -> ${t}`).join(", ")}`), !_ && !x && !S && !k && !N && !F) return;
269
- let I = {
266
+ } : D, k = n.plugins?.entries?.[o]?.enabled !== !0, A = i(n), j = Object.keys(A).length > 0;
267
+ if (j && r().info(`[claw-configs] Found ${Object.keys(A).length} providers to rename: ${Object.entries(A).map(([e, t]) => `${e} -> ${t}`).join(", ")}`), !p && !_ && !v && !T && !k && !j) return;
268
+ let M = {
270
269
  ...n,
271
270
  plugins: {
272
271
  ...n.plugins,
273
- allow: v,
272
+ allow: m,
274
273
  entries: {
275
274
  ...n.plugins?.entries,
276
- [l]: {
277
- ...n.plugins?.entries?.[l],
275
+ [o]: {
276
+ ...n.plugins?.entries?.[o],
278
277
  enabled: !0,
279
- config: M
278
+ config: O
280
279
  }
281
280
  }
282
281
  },
@@ -284,27 +283,27 @@ var d = "yoyo", f = /* @__PURE__ */ "alarm.create,alarm.delete,alarm.disable,ala
284
283
  ...n.gateway,
285
284
  nodes: {
286
285
  ...n.gateway?.nodes,
287
- allowCommands: b
286
+ allowCommands: g
288
287
  }
289
288
  }
290
289
  };
291
- S && (I = {
292
- ...I,
290
+ v && (M = {
291
+ ...M,
293
292
  skills: {
294
- ...d,
293
+ ...c,
295
294
  load: {
296
- ...p,
295
+ ...u,
297
296
  watch: !1
298
297
  }
299
298
  }
300
- }, r().info("[claw-configs] Disabled skills.load.watch for yoyo migration")), F && (I = a(I, P), r().info("[claw-configs] Provider renaming completed")), await this.saveConfig(I), S && await c(o.DISABLE_SKILLS_LOAD_WATCH_MIGRATION_DONE);
299
+ }, r().info("[claw-configs] Disabled skills.load.watch for yoyo")), j && (M = a(M, A), r().info("[claw-configs] Provider renaming completed")), await this.saveConfig(M);
301
300
  } catch (e) {
302
301
  throw n(e, "failed to initialize plugin config");
303
302
  }
304
303
  }
305
- }, m = null;
306
- function h() {
307
- return m ||= new p(), m;
304
+ }, d = null;
305
+ function f() {
306
+ return d ||= new u(), d;
308
307
  }
309
308
  //#endregion
310
- export { p as ConfigManager, h as getConfigManager };
309
+ export { u as ConfigManager, f as getConfigManager };
@@ -1,3 +1,3 @@
1
- import "./state-flags.mjs";
2
1
  import "./config-manager.mjs";
3
2
  import "./identity-persist.mjs";
3
+ import "./state-flags.mjs";
@@ -1,66 +1,3 @@
1
- import { useClawLogger as e } from "../../utils/logger.mjs";
2
- import { SafeFsError as t, safeReadFile as n, safeWriteFile as r } from "../../utils/fs-safe.mjs";
3
- import { resolveEffectiveHomeDir as i } from "../../utils/home-dir.mjs";
4
- import a from "node:path";
5
- //#region src/modules/configs/state-flags.ts
6
- var o = { DISABLE_SKILLS_LOAD_WATCH_MIGRATION_DONE: "disableSkillsLoadWatchMigrationDone" }, s = ".openclaw", c = "yoyo", l = "state.json", u = 64 * 1024;
7
- function d() {
8
- return a.join(s, c, l);
9
- }
10
- async function f(r) {
11
- try {
12
- let e = await n({
13
- rootDir: r,
14
- relativePath: d(),
15
- maxBytes: u
16
- });
17
- return v(JSON.parse(e.buffer.toString("utf8")));
18
- } catch (n) {
19
- return n instanceof t && n.code === "not-found" || e().warn(`[yoyo-state] failed to read state: ${String(n)}`), null;
20
- }
21
- }
22
- async function p() {
23
- let t = i();
24
- return t ? f(t) : (e().warn("[yoyo-state] failed to find home dir"), null);
25
- }
26
- async function m(t) {
27
- let n = i();
28
- if (!n) return e().warn("[yoyo-state] failed to find home dir"), null;
29
- let a = {
30
- ...await f(n) ?? _(),
31
- version: 1
32
- };
33
- return t.flags && (a.flags = {
34
- ...a.flags,
35
- ...y(t.flags)
36
- }), await r({
37
- rootDir: n,
38
- relativePath: d(),
39
- data: JSON.stringify(a, null, 2),
40
- encoding: "utf8",
41
- mkdir: !0
42
- }), a;
43
- }
44
- async function h(e) {
45
- return (await p())?.flags?.[e] === !0;
46
- }
47
- async function g(e) {
48
- return m({ flags: { [e]: !0 } });
49
- }
50
- function _() {
51
- return { version: 1 };
52
- }
53
- function v(e) {
54
- return !e || typeof e != "object" || Array.isArray(e) ? _() : {
55
- ..._(),
56
- flags: y(e.flags)
57
- };
58
- }
59
- function y(e) {
60
- if (!e || typeof e != "object" || Array.isArray(e)) return;
61
- let t = {};
62
- for (let [n, r] of Object.entries(e)) typeof r == "boolean" && (t[n] = r);
63
- return Object.keys(t).length > 0 ? t : void 0;
64
- }
65
- //#endregion
66
- export { o as STATE_FLAG, p as getPersistedPluginState, h as hasPersistedStateFlag, g as markPersistedStateFlag, m as updatePersistedPluginState };
1
+ import "../../utils/fs-safe.mjs";
2
+ import "../../utils/home-dir.mjs";
3
+ import "node:path";
@@ -1,16 +1,16 @@
1
1
  import { findPackageRoot as e } from "./package-json.mjs";
2
2
  import t from "node:path";
3
- import n from "node:os";
4
- import { fileURLToPath as r } from "node:url";
3
+ import { fileURLToPath as n } from "node:url";
4
+ import r from "node:os";
5
5
  //#region src/utils/home-dir.ts
6
6
  function i(e) {
7
7
  return e?.trim() || void 0;
8
8
  }
9
- function a(n = import.meta.url) {
10
- return e(n) ?? t.parse(r(n)).root;
9
+ function a(r = import.meta.url) {
10
+ return e(r) ?? t.parse(n(r)).root;
11
11
  }
12
- function o(e = process.env, r = n.homedir) {
13
- let i = s(e, r);
12
+ function o(e = process.env, n = r.homedir) {
13
+ let i = s(e, n);
14
14
  return i ? t.resolve(i) : void 0;
15
15
  }
16
16
  function s(e, t) {
@@ -1,11 +1,11 @@
1
- import { findPackageRoot as e, readPackageJson as t } from "./package-json.mjs";
2
- import { getYoyoRuntime as n } from "../runtime.mjs";
1
+ import { getYoyoRuntime as e } from "../runtime.mjs";
2
+ import { findPackageRoot as t, readPackageJson as n } from "./package-json.mjs";
3
3
  //#region src/utils/version.ts
4
4
  var r = "@honor-claw/yoyo", i = 3;
5
5
  function a() {
6
6
  try {
7
- let e = n().version;
8
- return o(e);
7
+ let t = e().version;
8
+ return o(t);
9
9
  } catch {
10
10
  return i;
11
11
  }
@@ -48,9 +48,9 @@ function d() {
48
48
  }
49
49
  function f() {
50
50
  try {
51
- let n = e(import.meta.url, r);
52
- if (!n) return "0.0.0";
53
- let i = t(n)?.version;
51
+ let e = t(import.meta.url, r);
52
+ if (!e) return "0.0.0";
53
+ let i = n(e)?.version;
54
54
  if (typeof i == "string") return i;
55
55
  } catch {}
56
56
  return "0.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honor-claw/yoyo",
3
- "version": "1.6.1-beta.4",
3
+ "version": "1.6.1-beta.6",
4
4
  "description": "OpenClaw Honor Yoyo connection plugin",
5
5
  "keywords": [
6
6
  "ai",
@@ -48,8 +48,6 @@
48
48
  "flashlight",
49
49
  "airplane_mode",
50
50
  "clean_dirty",
51
- "create_flight_monitor_task",
52
- "query_flight_monitor_task",
53
51
  "express_logistics_search",
54
52
  "desktop",
55
53
  "createTimer",