@honor-claw/yoyo 1.3.0 → 1.4.0-alpha.1
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.
|
@@ -5,7 +5,12 @@ import { wrapError as r } from "../../utils/error.mjs";
|
|
|
5
5
|
import { useClawLogger as i } from "../../utils/logger.mjs";
|
|
6
6
|
import { detectProvidersToRename as a, updateProviderReferences as o } from "./provider.mjs";
|
|
7
7
|
//#region src/modules/configs/config-manager.ts
|
|
8
|
-
var s = "yoyo", c = { watch: !0 }, l = 250, u = /* @__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(","), d =
|
|
8
|
+
var s = "yoyo", c = { watch: !0 }, l = 250, u = /* @__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(","), d = {
|
|
9
|
+
input: 0,
|
|
10
|
+
output: 0,
|
|
11
|
+
cacheRead: 0,
|
|
12
|
+
cacheWrite: 0
|
|
13
|
+
}, f = class {
|
|
9
14
|
loadConfig() {
|
|
10
15
|
try {
|
|
11
16
|
return t().config.loadConfig();
|
|
@@ -246,30 +251,30 @@ var s = "yoyo", c = { watch: !0 }, l = 250, u = /* @__PURE__ */ "alarm.create,al
|
|
|
246
251
|
}
|
|
247
252
|
async initializePluginConfig(t) {
|
|
248
253
|
try {
|
|
249
|
-
let r = this.loadConfig(), s = r.plugins?.allow || [],
|
|
250
|
-
...
|
|
254
|
+
let r = this.loadConfig(), s = r.plugins?.allow || [], f = s.includes(t) ? s : [...s, t], p = r.gateway?.nodes?.allowCommands || [], m = Array.from(new Set([...p, ...u])), h = r.skills || {}, g = h.load || {}, _ = g.watch === c.watch && g.watchDebounceMs !== void 0 ? g : {
|
|
255
|
+
...g,
|
|
251
256
|
...c,
|
|
252
|
-
watchDebounceMs:
|
|
253
|
-
},
|
|
254
|
-
env:
|
|
257
|
+
watchDebounceMs: g.watchDebounceMs ?? l
|
|
258
|
+
}, v = r.plugins?.entries?.[t]?.config?.envInfo, y = r.plugins?.entries?.[t]?.config?.env, b = !!(v?.env || y), x = n(), S = !!v?.env && v.source === "env", C = !v?.env && !!y || S && x && v.env !== x, w = !b || C, T = {
|
|
259
|
+
env: x || y || (e() ? "test" : "production"),
|
|
255
260
|
source: "env"
|
|
256
|
-
},
|
|
257
|
-
...
|
|
258
|
-
envInfo:
|
|
261
|
+
}, E = r.plugins?.entries?.[t]?.config || {}, D = w ? {
|
|
262
|
+
...E,
|
|
263
|
+
envInfo: T,
|
|
259
264
|
env: void 0
|
|
260
|
-
} :
|
|
261
|
-
Object.keys(
|
|
262
|
-
let
|
|
265
|
+
} : E, O = a(r);
|
|
266
|
+
Object.keys(O).length > 0 && i().info(`[claw-configs] Found ${Object.keys(O).length} providers to rename: ${Object.entries(O).map(([e, t]) => `${e} -> ${t}`).join(", ")}`);
|
|
267
|
+
let k = {
|
|
263
268
|
...r,
|
|
264
269
|
plugins: {
|
|
265
270
|
...r.plugins,
|
|
266
|
-
allow:
|
|
271
|
+
allow: f,
|
|
267
272
|
entries: {
|
|
268
273
|
...r.plugins?.entries,
|
|
269
274
|
[t]: {
|
|
270
275
|
...r.plugins?.entries?.[t],
|
|
271
276
|
enabled: !0,
|
|
272
|
-
config:
|
|
277
|
+
config: D
|
|
273
278
|
}
|
|
274
279
|
}
|
|
275
280
|
},
|
|
@@ -277,22 +282,25 @@ var s = "yoyo", c = { watch: !0 }, l = 250, u = /* @__PURE__ */ "alarm.create,al
|
|
|
277
282
|
...r.gateway,
|
|
278
283
|
nodes: {
|
|
279
284
|
...r.gateway?.nodes,
|
|
280
|
-
allowCommands:
|
|
285
|
+
allowCommands: m
|
|
281
286
|
}
|
|
282
287
|
},
|
|
283
288
|
skills: {
|
|
284
|
-
...
|
|
285
|
-
load:
|
|
289
|
+
...h,
|
|
290
|
+
load: _
|
|
286
291
|
}
|
|
287
292
|
};
|
|
288
|
-
Object.keys(
|
|
293
|
+
if (Object.keys(O).length > 0 && (k = o(k, O), i().info("[claw-configs] Provider renaming completed")), k.models?.providers) {
|
|
294
|
+
for (let e of Object.values(k.models.providers)) if (Array.isArray(e.models)) for (let t of e.models) t.cost ||= d;
|
|
295
|
+
}
|
|
296
|
+
await this.saveConfig(k);
|
|
289
297
|
} catch (e) {
|
|
290
298
|
throw r(e, "failed to initialize plugin config");
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
|
-
},
|
|
294
|
-
function
|
|
295
|
-
return
|
|
301
|
+
}, p = null;
|
|
302
|
+
function m() {
|
|
303
|
+
return p ||= new f(), p;
|
|
296
304
|
}
|
|
297
305
|
//#endregion
|
|
298
|
-
export {
|
|
306
|
+
export { f as ConfigManager, m as getConfigManager };
|
package/dist/utils/version.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/utils/version.ts
|
|
2
2
|
var e = null;
|
|
3
3
|
function t() {
|
|
4
|
-
return e === null && (e = "1.
|
|
4
|
+
return e === null && (e = "1.4.0-alpha.1".includes("beta") || "1.4.0-alpha.1".includes("alpha")), !!e;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
export { t as isBetaVersion };
|