@honor-claw/yoyo 1.6.1-beta.9 → 2026.6.9-alpha.10
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/apis/claw-cloud.mjs +41 -16
- package/dist/apis/hosts.mjs +7 -6
- package/dist/apis/oauth.mjs +39 -0
- package/dist/capabilities/admin/impl.mjs +156 -0
- package/dist/capabilities/admin/manager.mjs +63 -0
- package/dist/capabilities/node/index.mjs +3 -0
- package/dist/capabilities/node/invoke.mjs +40 -0
- package/dist/capabilities/node/list.mjs +39 -0
- package/dist/capabilities/node/types.mjs +6 -0
- package/dist/channel/accounts.mjs +34 -0
- package/dist/channel/agent-prompt.mjs +8 -0
- package/dist/channel/capabilities.mjs +17 -0
- package/dist/channel/config.mjs +25 -0
- package/dist/channel/consts.mjs +4 -0
- package/dist/channel/directory.mjs +38 -0
- package/dist/channel/lifecycle.mjs +44 -0
- package/dist/channel/messaging.mjs +52 -0
- package/dist/channel/plugin.mjs +41 -0
- package/dist/channel/security.mjs +4 -0
- package/dist/channel/setup-wizard.mjs +39 -0
- package/dist/channel/status.mjs +33 -0
- package/dist/cloud-channel/authorization/refresh-manager.mjs +66 -0
- package/dist/cloud-channel/channel.mjs +104 -50
- package/dist/cloud-channel/dispatcher/helpers.mjs +19 -0
- package/dist/cloud-channel/dispatcher/impl.mjs +75 -0
- package/dist/cloud-channel/dispatcher/index.mjs +1 -0
- package/dist/cloud-channel/handlers/auth.mjs +22 -0
- package/dist/cloud-channel/handlers/context/handler.mjs +134 -0
- package/dist/cloud-channel/handlers/context/index.mjs +1 -0
- package/dist/cloud-channel/handlers/pairing.mjs +20 -0
- package/dist/cloud-channel/handlers/user-message.mjs +26 -0
- package/dist/cloud-channel/log-summary.mjs +38 -0
- package/dist/cloud-channel/protocol/index.mjs +3 -0
- package/dist/cloud-channel/protocol/semantics.mjs +4 -0
- package/dist/cloud-channel/protocol/target.mjs +14 -0
- package/dist/cloud-channel/protocol/v1-adapter.mjs +123 -0
- package/dist/cloud-channel/{types.mjs → protocol/v1-types.mjs} +1 -2
- package/dist/cloud-channel/protocol/v2-adapter.mjs +94 -0
- package/dist/cloud-channel/protocol/v2-types.mjs +19 -0
- package/dist/cloud-channel/transport/cloud-socket.mjs +133 -0
- package/dist/cloud-channel/transport/event-bus.mjs +22 -0
- package/dist/cloud-channel/transport/index.mjs +3 -0
- package/dist/cloud-channel/transport/message-handler.mjs +13 -0
- package/dist/cloud-channel/utils.mjs +16 -11
- package/dist/commands/debug/clean-tools.mjs +25 -0
- package/dist/commands/debug/impl.mjs +7 -0
- package/dist/commands/debug/index.mjs +1 -0
- package/dist/commands/env/impl.mjs +20 -17
- package/dist/commands/index.mjs +11 -9
- package/dist/commands/login/impl.mjs +16 -9
- package/dist/commands/logout/impl.mjs +9 -7
- package/dist/commands/status/index.mjs +31 -26
- package/dist/connection/client.mjs +73 -0
- package/dist/connection/index.mjs +2 -0
- package/dist/connection/monitor.mjs +19 -0
- package/dist/connection/registry.mjs +22 -0
- package/dist/consts.mjs +4 -0
- package/dist/core/hooks/entry.mjs +10 -0
- package/dist/core/hooks/gateway-lifecycle.mjs +23 -0
- package/dist/core/hooks/prompt.mjs +8 -0
- package/dist/core/hooks/skill-refresh.mjs +23 -0
- package/dist/core/hooks/tool-trace.mjs +26 -0
- package/dist/{modules/prompt/index.mjs → core/prompt/agent.mjs} +5 -2
- package/dist/core/prompt/builder.mjs +19 -0
- package/dist/core/prompt/index.mjs +1 -0
- package/dist/core/prompt/skill.mjs +14 -0
- package/dist/core/runtime.mjs +18 -0
- package/dist/core/services/admin.mjs +18 -0
- package/dist/core/services/entry.mjs +7 -0
- package/dist/{gateway-client/admin-client.mjs → gateway/client/admin.mjs} +9 -20
- package/dist/{modules/device → gateway/client/auth}/credential-builder.mjs +3 -3
- package/dist/{modules/device → gateway/client/auth}/gateway-auth.mjs +2 -2
- package/dist/gateway/client/auth/index.mjs +3 -0
- package/dist/{modules/device/auth.mjs → gateway/client/auth/payload.mjs} +2 -2
- package/dist/{gateway-client → gateway/client}/client.mjs +7 -6
- package/dist/gateway/client/node.mjs +58 -0
- package/dist/{gateway-client/protocol-client.mjs → gateway/client/protocol.mjs} +41 -35
- package/dist/{gateway-client → gateway/client}/types/client.mjs +1 -1
- package/dist/gateway/session/forwarding.mjs +49 -0
- package/dist/gateway/session/manager.mjs +220 -0
- package/dist/honor-auth/{assets → browser/assets}/favicon.mjs +1 -1
- package/dist/honor-auth/browser/flow.mjs +59 -0
- package/dist/honor-auth/browser/index.mjs +1 -0
- package/dist/honor-auth/browser/listener.mjs +126 -0
- package/dist/honor-auth/browser/pkce.mjs +12 -0
- package/dist/honor-auth/{auth-result-html.mjs → browser/result-page.mjs} +1 -1
- package/dist/honor-auth/index.mjs +7 -4
- package/dist/honor-auth/login/impl.mjs +45 -0
- package/dist/honor-auth/login/index.mjs +1 -0
- package/dist/honor-auth/logout.mjs +16 -0
- package/dist/honor-auth/vault/impl.mjs +88 -0
- package/dist/honor-auth/vault/index.mjs +2 -0
- package/dist/honor-auth/vault/legacy-migration.mjs +54 -0
- package/dist/honor-auth/vault/token-expiry.mjs +37 -0
- package/dist/honor-auth/vault/vault.mjs +13 -0
- package/dist/index.mjs +15 -14
- package/dist/messaging/chat-queue/dispatcher.mjs +25 -0
- package/dist/messaging/chat-queue/queue.mjs +20 -0
- package/dist/messaging/dispatchers/command/impl.mjs +55 -0
- package/dist/messaging/dispatchers/command/index.mjs +1 -0
- package/dist/messaging/dispatchers/stream/controller.mjs +135 -0
- package/dist/messaging/dispatchers/stream/error.mjs +56 -0
- package/dist/messaging/dispatchers/stream/factory.mjs +17 -0
- package/dist/messaging/dispatchers/stream/hooks.mjs +49 -0
- package/dist/messaging/dispatchers/stream/index.mjs +4 -0
- package/dist/messaging/dispatchers/stream/registry.mjs +13 -0
- package/dist/messaging/dispatchers/stream/resolvers.mjs +20 -0
- package/dist/messaging/dispatchers/stream/session.mjs +141 -0
- package/dist/messaging/dispatchers/stream/tool/error.mjs +26 -0
- package/dist/messaging/dispatchers/stream/tool/event-builder.mjs +18 -0
- package/dist/messaging/dispatchers/stream/tool/index.mjs +4 -0
- package/dist/messaging/dispatchers/stream/tool/sanitize.mjs +77 -0
- package/dist/messaging/dispatchers/stream/tool/trace-store.mjs +120 -0
- package/dist/messaging/dispose.mjs +21 -0
- package/dist/messaging/inbound/abort/core.mjs +16 -0
- package/dist/messaging/inbound/abort/detect.mjs +18 -0
- package/dist/messaging/inbound/abort/index.mjs +2 -0
- package/dist/messaging/inbound/agent.mjs +32 -0
- package/dist/messaging/inbound/command.mjs +39 -0
- package/dist/messaging/inbound/context.mjs +65 -0
- package/dist/messaging/inbound/dispatch.mjs +38 -0
- package/dist/messaging/inbound/extracts.mjs +15 -0
- package/dist/messaging/inbound/index.mjs +3 -0
- package/dist/messaging/inbound/interrupt.mjs +31 -0
- package/dist/messaging/inbound/new-session.mjs +29 -0
- package/dist/messaging/inbound/user-message.mjs +31 -0
- package/dist/messaging/index.mjs +11 -0
- package/dist/messaging/outbound/adapter.mjs +10 -0
- package/dist/messaging/outbound/index.mjs +1 -0
- package/dist/messaging/send/frame.mjs +38 -0
- package/dist/messaging/send/index.mjs +2 -0
- package/dist/messaging/send/text.mjs +27 -0
- package/dist/messaging/session/defaults.mjs +41 -0
- package/dist/messaging/session/index.mjs +1 -0
- package/dist/messaging/target/address.mjs +23 -0
- package/dist/messaging/target/chat-id-store.mjs +69 -0
- package/dist/messaging/target/chat-id.mjs +20 -0
- package/dist/messaging/target/index.mjs +3 -0
- package/dist/messaging/target/outbound.mjs +24 -0
- package/dist/modules/configs/agent-defaults.mjs +25 -0
- package/dist/modules/configs/channel.mjs +56 -0
- package/dist/modules/configs/config-store.mjs +28 -0
- package/dist/modules/configs/device.mjs +18 -0
- package/dist/modules/configs/gateway.mjs +27 -0
- package/dist/modules/configs/identity-persist.mjs +17 -38
- package/dist/modules/configs/index.mjs +7 -1
- package/dist/modules/configs/plugin-init.mjs +80 -0
- package/dist/modules/configs/plugin-patch.mjs +28 -0
- package/dist/modules/configs/plugin.mjs +95 -0
- package/dist/modules/configs/provider.mjs +18 -13
- package/dist/modules/configs/state-flags.mjs +3 -0
- package/dist/modules/device/device-info.mjs +30 -33
- package/dist/modules/device/index.mjs +1 -5
- package/dist/modules/device/providers/linux.mjs +2 -2
- package/dist/modules/device/providers/macos.mjs +1 -1
- package/dist/modules/device/providers/pad.mjs +13 -14
- package/dist/modules/device/providers/windows.mjs +1 -1
- package/dist/modules/secure-token/crypto-utils.mjs +103 -0
- package/dist/modules/secure-token/darwin.mjs +54 -0
- package/dist/modules/secure-token/index.mjs +3 -0
- package/dist/modules/secure-token/linux.mjs +12 -0
- package/dist/modules/secure-token/secure-store.mjs +22 -0
- package/dist/modules/secure-token/token-record.mjs +6 -0
- package/dist/modules/secure-token/token-vault.mjs +48 -0
- package/dist/modules/secure-token/win32.mjs +12 -0
- package/dist/modules/status/channel.mjs +1 -0
- package/dist/{services/connection/status-tracker → modules/status}/events.mjs +3 -3
- package/dist/modules/status/global.mjs +32 -0
- package/dist/{services/connection/status-tracker → modules/status}/index.mjs +2 -0
- package/dist/modules/status/storage.mjs +52 -0
- package/dist/modules/status/tracker.mjs +155 -0
- package/dist/{services/connection/status-tracker → modules/status}/types.mjs +1 -1
- package/dist/provisioning/registration/index.mjs +1 -0
- package/dist/provisioning/registration/register.mjs +66 -0
- package/dist/{modules/device-toolset → provisioning/toolset}/ack.mjs +11 -16
- package/dist/{modules/device-toolset → provisioning/toolset}/archive.mjs +1 -1
- package/dist/provisioning/toolset/artifacts.mjs +75 -0
- package/dist/provisioning/toolset/cleanup.mjs +55 -0
- package/dist/provisioning/toolset/consts.mjs +5 -0
- package/dist/{modules/device-toolset → provisioning/toolset}/copy-fallback.mjs +1 -1
- package/dist/{modules/device-toolset → provisioning/toolset}/index.mjs +2 -0
- package/dist/{modules/device-toolset → provisioning/toolset}/link.mjs +1 -1
- package/dist/{modules/device-toolset → provisioning/toolset}/md5-index.mjs +1 -1
- package/dist/{modules/device-toolset → provisioning/toolset}/normalize.mjs +1 -1
- package/dist/{modules/device-toolset → provisioning/toolset}/persist.mjs +1 -1
- package/dist/provisioning/toolset/processor.mjs +67 -0
- package/dist/{modules/device-toolset → provisioning/toolset}/skill-inject.mjs +16 -16
- package/dist/provisioning/toolset/skill-refresh-marker.mjs +47 -0
- package/dist/schemas.mjs +4 -0
- package/dist/tools/error.mjs +9 -0
- package/dist/tools/index.mjs +10 -0
- package/dist/tools/node-invoke/index.mjs +1 -0
- package/dist/tools/node-invoke/status-mapper.mjs +23 -0
- package/dist/tools/node-invoke/tool.mjs +45 -0
- package/dist/tools/nodes-status/index.mjs +2 -0
- package/dist/tools/nodes-status/mapper.mjs +19 -0
- package/dist/tools/nodes-status/tool.mjs +44 -0
- package/dist/utils/child-process.mjs +5 -0
- package/dist/utils/claw-logger.mjs +76 -0
- package/dist/utils/env.mjs +1 -4
- package/dist/utils/error.mjs +9 -7
- package/dist/utils/fs-safe.mjs +41 -13
- package/dist/utils/recurring-timer.mjs +19 -0
- package/dist/utils/stringify.mjs +11 -0
- package/dist/utils/version.mjs +35 -34
- package/openclaw.plugin.json +31 -0
- package/package.json +17 -3
- package/skills/yoyo-phone-control/SKILL.md +213 -0
- package/skills/{yoyo-control → yoyo-phone-control}/references/file-upload.md +286 -362
- package/skills/{yoyo-control → yoyo-phone-control}/references/gui-task-create.md +11 -64
- package/skills/{yoyo-control → yoyo-phone-control}/references/gui-task-pause.md +11 -74
- package/skills/{yoyo-control → yoyo-phone-control}/references/gui-task-terminate.md +11 -74
- package/skills/{yoyo-control → yoyo-phone-control}/references/local-search.md +11 -94
- package/skills/{yoyo-control → yoyo-phone-control}/references/task-result-query.md +6 -16
- package/skills/yoyo-update/SKILL.md +1 -1
- package/dist/cloud-channel/admin-client-manager.mjs +0 -75
- package/dist/cloud-channel/authorization-refresh-manager.mjs +0 -104
- package/dist/cloud-channel/client.mjs +0 -164
- package/dist/cloud-channel/message-handler.mjs +0 -422
- package/dist/cloud-channel/session-manager.mjs +0 -71
- package/dist/gateway-client/node-client.mjs +0 -49
- package/dist/honor-auth/browser.mjs +0 -50
- package/dist/honor-auth/callback-server.mjs +0 -101
- package/dist/honor-auth/cloud.mjs +0 -17
- package/dist/honor-auth/config.mjs +0 -27
- package/dist/honor-auth/honor-auth-client.mjs +0 -51
- package/dist/honor-auth/token-manager.mjs +0 -68
- package/dist/hooks/index.mjs +0 -42
- package/dist/modules/configs/config-manager.mjs +0 -309
- package/dist/modules/device/registry.mjs +0 -37
- package/dist/modules/device-toolset/artifacts.mjs +0 -52
- package/dist/modules/device-toolset/consts.mjs +0 -5
- package/dist/modules/device-toolset/processor.mjs +0 -43
- package/dist/modules/device-toolset/skill-refresh-marker.mjs +0 -42
- package/dist/modules/login/impl.mjs +0 -24
- package/dist/runtime.mjs +0 -23
- package/dist/services/connection/impl.mjs +0 -148
- package/dist/services/connection/status-tracker/storage.mjs +0 -49
- package/dist/services/connection/status-tracker/tracker.mjs +0 -142
- package/dist/utils/logger.mjs +0 -15
- package/skills/search/SKILL.md +0 -186
- package/skills/search/scripts/search.sh +0 -69
- package/skills/yoyo-control/SKILL.md +0 -189
- package/dist/{services/connection → capabilities/admin}/index.mjs +0 -0
- package/skills/{yoyo-control → yoyo-phone-control}/configs/sub-skills.json +1 -1
package/dist/apis/claw-cloud.mjs
CHANGED
|
@@ -3,8 +3,9 @@ import { uuid as t } from "../utils/id.mjs";
|
|
|
3
3
|
import { isOKResponse as n } from "./helpers.mjs";
|
|
4
4
|
import { takeApiHost as r } from "./hosts.mjs";
|
|
5
5
|
import { HttpClient as i } from "./http-client.mjs";
|
|
6
|
+
import { getOAuthTokenExchangeConfig as a } from "./oauth.mjs";
|
|
6
7
|
//#region src/apis/claw-cloud.ts
|
|
7
|
-
var
|
|
8
|
+
var o = class {
|
|
8
9
|
httpClient;
|
|
9
10
|
constructor(e, t) {
|
|
10
11
|
this.httpClient = new i(e, t);
|
|
@@ -50,29 +51,53 @@ var a = class {
|
|
|
50
51
|
body: i
|
|
51
52
|
});
|
|
52
53
|
}
|
|
54
|
+
async getDeviceList(e, n, r) {
|
|
55
|
+
let i = {
|
|
56
|
+
"x-trace-id": t(),
|
|
57
|
+
"x-jwt-token": n.token,
|
|
58
|
+
"x-device-id": e.deviceId,
|
|
59
|
+
"x-udid": e.deviceId
|
|
60
|
+
}, a = {
|
|
61
|
+
businessTag: "YOYO_CLAW",
|
|
62
|
+
role: "node",
|
|
63
|
+
ignoreBizExtInfo: !0,
|
|
64
|
+
...r?.deviceIdList?.length ? { deviceIdList: r.deviceIdList } : {}
|
|
65
|
+
};
|
|
66
|
+
return this.httpClient.post("/v1/user/devicelist", {
|
|
67
|
+
headers: i,
|
|
68
|
+
body: a,
|
|
69
|
+
timeout: r?.timeoutMs ?? 3e4
|
|
70
|
+
});
|
|
71
|
+
}
|
|
53
72
|
async exchangeToken(e, r) {
|
|
54
|
-
let i = t(),
|
|
73
|
+
let i = t(), o = {
|
|
55
74
|
"Content-Type": "application/json",
|
|
56
75
|
"x-device-id": e.deviceId,
|
|
57
76
|
"x-trace-id": i
|
|
58
|
-
},
|
|
59
|
-
"userId" in r
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
redirectUri:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
}, s = {};
|
|
78
|
+
if ("userId" in r) o["x-agw-userId"] = r.userId;
|
|
79
|
+
else if ("token" in r) o["x-jwt-token"] = r.token;
|
|
80
|
+
else {
|
|
81
|
+
let { clientId: e, redirectUri: t } = a();
|
|
82
|
+
s = {
|
|
83
|
+
clientId: e,
|
|
84
|
+
code: r.code,
|
|
85
|
+
redirectUri: t
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
let c = await this.httpClient.post("/v1/user/jwtToken", {
|
|
89
|
+
body: s,
|
|
90
|
+
headers: o,
|
|
67
91
|
timeout: 15e3
|
|
68
92
|
});
|
|
69
|
-
if (n(
|
|
70
|
-
|
|
93
|
+
if (n(c) && c.data.data) return c.data.data;
|
|
94
|
+
let l = c.data.cnMessage || "unknown error";
|
|
95
|
+
throw Error(`${l} (code: ${c.data.code}, traceId: ${i})`);
|
|
71
96
|
}
|
|
72
97
|
};
|
|
73
|
-
function
|
|
98
|
+
function s() {
|
|
74
99
|
let e = r();
|
|
75
|
-
return new
|
|
100
|
+
return new o(`https://${e.clawCloud}/aicloud/yoyo-claw-service`, e.grayTag ? { defaultHeaders: { "x-gray": e.grayTag } } : void 0);
|
|
76
101
|
}
|
|
77
102
|
//#endregion
|
|
78
|
-
export {
|
|
103
|
+
export { o as ClawCloudClient, s as createClawCloudClient };
|
package/dist/apis/hosts.mjs
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getEnvAndGray as e } from "../modules/configs/plugin.mjs";
|
|
2
|
+
import "../modules/configs/index.mjs";
|
|
2
3
|
//#region src/apis/hosts.ts
|
|
3
4
|
function t() {
|
|
4
|
-
let t = e(),
|
|
5
|
+
let { envInfo: t, grayTag: n } = e(), r;
|
|
5
6
|
switch (t.env) {
|
|
6
7
|
case "dev":
|
|
7
|
-
|
|
8
|
+
r = {
|
|
8
9
|
clawCloud: "omni-dev-drcn.hiboard.hihonorcloud.com",
|
|
9
10
|
ics: "api-agd-test-drcn.hiboard.hihonorcloud.com"
|
|
10
11
|
};
|
|
11
12
|
break;
|
|
12
13
|
case "test":
|
|
13
|
-
|
|
14
|
+
r = {
|
|
14
15
|
clawCloud: "omni-pre-drcn.hiboard.hihonorcloud.com",
|
|
15
16
|
ics: "api-agd-test-drcn.hiboard.hihonorcloud.com"
|
|
16
17
|
};
|
|
17
18
|
break;
|
|
18
19
|
default:
|
|
19
|
-
|
|
20
|
+
r = {
|
|
20
21
|
clawCloud: "yoyoclaw-drcn.hiboard.hihonorcloud.com",
|
|
21
22
|
ics: "api-prd-drcn.hiboard.hihonorcloud.com"
|
|
22
23
|
};
|
|
23
24
|
break;
|
|
24
25
|
}
|
|
25
|
-
return
|
|
26
|
+
return n && (r.grayTag = n), r;
|
|
26
27
|
}
|
|
27
28
|
//#endregion
|
|
28
29
|
export { t as takeApiHost };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getEnvAndGray as e } from "../modules/configs/plugin.mjs";
|
|
2
|
+
import "../modules/configs/index.mjs";
|
|
3
|
+
//#region src/apis/oauth.ts
|
|
4
|
+
var t = "http://127.0.0.1:8081/deepLink", n = "/oauth2/v3/authorize", r = "openid profile", i = "110", a = "99011000";
|
|
5
|
+
function o() {
|
|
6
|
+
return e().envInfo.env === "production" ? {
|
|
7
|
+
authHost: "https://hnoauth-login-drcn.cloud.honor.com",
|
|
8
|
+
clientId: "221000597"
|
|
9
|
+
} : {
|
|
10
|
+
authHost: "https://hnoauth-login-test-drcn.cloud.honor.com",
|
|
11
|
+
clientId: "221641491"
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
var s = {
|
|
15
|
+
port: 8081,
|
|
16
|
+
path: "/deepLink"
|
|
17
|
+
};
|
|
18
|
+
function c(e) {
|
|
19
|
+
let { authHost: s, clientId: c } = o();
|
|
20
|
+
return `${s}${n}?${new URLSearchParams({
|
|
21
|
+
client_id: c,
|
|
22
|
+
redirect_uri: t,
|
|
23
|
+
scope: r,
|
|
24
|
+
response_type: "code",
|
|
25
|
+
access_type: "offline",
|
|
26
|
+
reqClientType: i,
|
|
27
|
+
loginChannel: a,
|
|
28
|
+
code_challenge: e,
|
|
29
|
+
code_challenge_method: "S256"
|
|
30
|
+
}).toString()}`;
|
|
31
|
+
}
|
|
32
|
+
function l() {
|
|
33
|
+
return {
|
|
34
|
+
clientId: o().clientId,
|
|
35
|
+
redirectUri: t
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { s as OAUTH_CALLBACK, c as buildAuthorizationUrl, l as getOAuthTokenExchangeConfig };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
+
import { AdminClientManager as t } from "./manager.mjs";
|
|
3
|
+
//#region src/capabilities/admin/impl.ts
|
|
4
|
+
var n = e("admin"), r = null, i = class {
|
|
5
|
+
manager = new t();
|
|
6
|
+
constructor() {
|
|
7
|
+
this.manager.init();
|
|
8
|
+
}
|
|
9
|
+
ensureConnected() {
|
|
10
|
+
return this.manager.ensureConnected();
|
|
11
|
+
}
|
|
12
|
+
destroy() {
|
|
13
|
+
this.manager.destroy();
|
|
14
|
+
}
|
|
15
|
+
waitForReady(e) {
|
|
16
|
+
return this.manager.waitForReady(e);
|
|
17
|
+
}
|
|
18
|
+
async pairApprove(e) {
|
|
19
|
+
let t = this.manager.getClient();
|
|
20
|
+
if (!t) return n.warn("admin client not available for auto pair"), !1;
|
|
21
|
+
try {
|
|
22
|
+
let r = await t.devicePairApprove(e);
|
|
23
|
+
return r.ok ? (n.info("auto pair approve completed", { ok: !0 }), !0) : (n.warn("auto pair approve rejected", {
|
|
24
|
+
ok: !1,
|
|
25
|
+
errorCode: r.error?.code
|
|
26
|
+
}), !1);
|
|
27
|
+
} catch (t) {
|
|
28
|
+
return n.error("auto pair approve failed, ignore...", t, { requestId: e }), !1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async setAgentFile(e, t, n) {
|
|
32
|
+
let r = this.manager.getClient();
|
|
33
|
+
if (!r) return {
|
|
34
|
+
ok: !1,
|
|
35
|
+
error: "Admin gateway client not ready"
|
|
36
|
+
};
|
|
37
|
+
if (!t) return {
|
|
38
|
+
ok: !1,
|
|
39
|
+
error: "Missing content in context payload"
|
|
40
|
+
};
|
|
41
|
+
let i = await r.setAgentFile(e, t, n);
|
|
42
|
+
return i.ok ? {
|
|
43
|
+
ok: !0,
|
|
44
|
+
data: { name: "style" }
|
|
45
|
+
} : {
|
|
46
|
+
ok: !1,
|
|
47
|
+
error: `update context failed, ${JSON.stringify(i.error)}`
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async switchPrimaryModel(e, t) {
|
|
51
|
+
let r = this.manager.getClient();
|
|
52
|
+
if (!r) return {
|
|
53
|
+
ok: !1,
|
|
54
|
+
error: "Admin gateway client not ready"
|
|
55
|
+
};
|
|
56
|
+
if (!e || !t) return {
|
|
57
|
+
ok: !1,
|
|
58
|
+
error: "Missing provider or id in context payload"
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
return (await r.switchPrimaryModel(e, t)).ok ? (n.info("switchPrimaryModel success", {
|
|
62
|
+
provider: e,
|
|
63
|
+
id: t
|
|
64
|
+
}), {
|
|
65
|
+
ok: !0,
|
|
66
|
+
data: { resolved: {
|
|
67
|
+
provider: e,
|
|
68
|
+
id: t
|
|
69
|
+
} }
|
|
70
|
+
}) : (n.error("switchPrimaryModel failed, try to fallback main session model"), this.getMainSessionModel());
|
|
71
|
+
} catch (e) {
|
|
72
|
+
return n.error("updatePrimaryModel error, try to fallback main session model", e), this.getMainSessionModel();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async getSkillsStatus() {
|
|
76
|
+
let e = this.manager.getClient();
|
|
77
|
+
return e ? {
|
|
78
|
+
ok: !0,
|
|
79
|
+
data: { skills: (await e.getSkillsStatus()).skills?.filter((e) => e.eligible).map((e) => ({
|
|
80
|
+
name: e.name,
|
|
81
|
+
description: e.description,
|
|
82
|
+
source: e.source,
|
|
83
|
+
disableModelInvocation: e.disabled
|
|
84
|
+
})) ?? [] }
|
|
85
|
+
} : {
|
|
86
|
+
ok: !1,
|
|
87
|
+
error: "Admin gateway client not ready"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async getModelList() {
|
|
91
|
+
let e = this.manager.getClient();
|
|
92
|
+
if (!e) return {
|
|
93
|
+
ok: !1,
|
|
94
|
+
error: "Admin gateway client not ready"
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
let t = await e.getModelList(), { modelProvider: r = "", model: i = "" } = await e.getMainSession();
|
|
98
|
+
return n.info("current primary model", {
|
|
99
|
+
provider: r,
|
|
100
|
+
id: i
|
|
101
|
+
}), {
|
|
102
|
+
ok: !0,
|
|
103
|
+
data: { models: t?.models?.map((e) => Object.assign({}, e, { primary: e.provider === r && e.id === i })) ?? [] }
|
|
104
|
+
};
|
|
105
|
+
} catch (e) {
|
|
106
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
107
|
+
return n.error("fetchModelsList failed", e), {
|
|
108
|
+
ok: !1,
|
|
109
|
+
error: `fetchModelsList error: ${t}`
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
async getMainSessionModel() {
|
|
114
|
+
let e = this.manager.getClient();
|
|
115
|
+
if (!e) return {
|
|
116
|
+
ok: !1,
|
|
117
|
+
error: "Admin gateway client not ready"
|
|
118
|
+
};
|
|
119
|
+
try {
|
|
120
|
+
let t = await e.getMainSession(), { modelProvider: r = "", model: i = "" } = t;
|
|
121
|
+
return n.warn("switchPrimaryModel failed, fallback to current", {
|
|
122
|
+
provider: r,
|
|
123
|
+
id: i
|
|
124
|
+
}), !r || !i ? {
|
|
125
|
+
ok: !1,
|
|
126
|
+
error: `Missing primary model: mainSession-${JSON.stringify(t)}`
|
|
127
|
+
} : {
|
|
128
|
+
ok: !1,
|
|
129
|
+
data: { resolved: {
|
|
130
|
+
provider: r,
|
|
131
|
+
id: i
|
|
132
|
+
} }
|
|
133
|
+
};
|
|
134
|
+
} catch (e) {
|
|
135
|
+
return {
|
|
136
|
+
ok: !1,
|
|
137
|
+
error: `getMainSessionModel error: ${e instanceof Error ? e.message : String(e)}`
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
function a() {
|
|
143
|
+
return r === null && (r = new i()), r;
|
|
144
|
+
}
|
|
145
|
+
function o() {
|
|
146
|
+
return a();
|
|
147
|
+
}
|
|
148
|
+
function s() {
|
|
149
|
+
let e = a().ensureConnected();
|
|
150
|
+
return n.info("admin gateway connection started", { ready: e }), e;
|
|
151
|
+
}
|
|
152
|
+
function c() {
|
|
153
|
+
a().destroy(), n.info("admin gateway connection stopped");
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { s as startAdminConnection, c as stopAdminConnection, o as useAdminCapability };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
+
import { getGatewayAuthConfig as t } from "../../modules/configs/gateway.mjs";
|
|
3
|
+
import "../../modules/configs/index.mjs";
|
|
4
|
+
import n from "../../gateway/client/admin.mjs";
|
|
5
|
+
import { StatusEventTypeE as r } from "../../modules/status/events.mjs";
|
|
6
|
+
import { emitStatusEvent as i } from "../../modules/status/global.mjs";
|
|
7
|
+
//#region src/capabilities/admin/manager.ts
|
|
8
|
+
var a = e("admin"), o = class {
|
|
9
|
+
client = null;
|
|
10
|
+
ready = !1;
|
|
11
|
+
pendingReadyRequests = /* @__PURE__ */ new Map();
|
|
12
|
+
requestIdCounter = 0;
|
|
13
|
+
init() {
|
|
14
|
+
if (this.client !== null) return;
|
|
15
|
+
let e = t(), o = typeof e?.token == "string" ? e.token : "", s = typeof e?.password == "string" ? e.password : "";
|
|
16
|
+
this.client = new n({
|
|
17
|
+
token: o,
|
|
18
|
+
password: s,
|
|
19
|
+
onAuthenticated: () => {
|
|
20
|
+
a.info("admin gateway client authenticated"), this.ready = !0, this.resolveAllPending(!0);
|
|
21
|
+
},
|
|
22
|
+
onClose: (e) => {
|
|
23
|
+
a.info("admin gateway client closed", { reason: e }), this.ready = !1;
|
|
24
|
+
},
|
|
25
|
+
onReconnectFailed: () => {
|
|
26
|
+
a.error("admin gateway client reconnect failed, notifying status tracker"), i({
|
|
27
|
+
type: r.ADMIN_CLIENT_RECONNECT_FAILED,
|
|
28
|
+
data: {}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
destroy() {
|
|
34
|
+
this.client &&= (this.client.stop(), null), this.ready = !1, this.cancelAllPending(), a.info("admin client destroyed");
|
|
35
|
+
}
|
|
36
|
+
getClient() {
|
|
37
|
+
return this.client;
|
|
38
|
+
}
|
|
39
|
+
ensureConnected() {
|
|
40
|
+
return this.client === null && (a.info("admin gateway client is null, initializing"), this.init()), this.ready || (a.info("admin gateway client not ready, connecting"), this.client?.connect()), this.client !== null && this.ready;
|
|
41
|
+
}
|
|
42
|
+
waitForReady(e = 5e3) {
|
|
43
|
+
return this.client !== null && this.ready ? Promise.resolve(!0) : new Promise((t) => {
|
|
44
|
+
let n = `req_${++this.requestIdCounter}`, r = setTimeout(() => {
|
|
45
|
+
this.pendingReadyRequests.delete(n), this.pendingReadyRequests.size === 0 && a.warn("admin gateway client waitForReady timeout, all requests rejected"), t(!1);
|
|
46
|
+
}, e);
|
|
47
|
+
this.pendingReadyRequests.set(n, {
|
|
48
|
+
resolve: t,
|
|
49
|
+
timeout: r
|
|
50
|
+
}), this.ensureConnected();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
cancelAllPending() {
|
|
54
|
+
for (let e of this.pendingReadyRequests.values()) clearTimeout(e.timeout), e.resolve(!1);
|
|
55
|
+
this.pendingReadyRequests.clear();
|
|
56
|
+
}
|
|
57
|
+
resolveAllPending(e) {
|
|
58
|
+
for (let t of this.pendingReadyRequests.values()) clearTimeout(t.timeout), t.resolve(e);
|
|
59
|
+
this.pendingReadyRequests.clear();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { o as AdminClientManager };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
+
import { buildEndpoint as t } from "../../cloud-channel/protocol/target.mjs";
|
|
3
|
+
import { resolveEnabledYoyoAccountId as n } from "../../modules/configs/channel.mjs";
|
|
4
|
+
import { ClawClient as r } from "../../connection/registry.mjs";
|
|
5
|
+
//#region src/capabilities/node/invoke.ts
|
|
6
|
+
var i = e("capabilities/node-invoke");
|
|
7
|
+
async function a(e) {
|
|
8
|
+
let i = {
|
|
9
|
+
to: t("node", e.nodeId),
|
|
10
|
+
msgType: "nodeInvokeRequest",
|
|
11
|
+
data: { node: {
|
|
12
|
+
toolCallId: e.toolCallId,
|
|
13
|
+
nodeId: e.nodeId,
|
|
14
|
+
name: e.name,
|
|
15
|
+
params: e.params
|
|
16
|
+
} }
|
|
17
|
+
}, a = n();
|
|
18
|
+
return r.forAccount(a).request(i, {
|
|
19
|
+
timeoutMs: e.timeoutMs,
|
|
20
|
+
matchResult: o
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function o(e) {
|
|
24
|
+
if (e.payload.msgType !== "nodeInvokeResult") return { matched: !1 };
|
|
25
|
+
let t = e.data?.node;
|
|
26
|
+
return !t || typeof t.runStatus != "number" || !t.nodeId || !t.toolCallId ? (i.warn("nodeInvokeResult missing required fields", { node: t }), {
|
|
27
|
+
matched: !0,
|
|
28
|
+
error: "missing required fields in invoke result"
|
|
29
|
+
}) : {
|
|
30
|
+
matched: !0,
|
|
31
|
+
result: {
|
|
32
|
+
nodeId: t.nodeId,
|
|
33
|
+
toolCallId: t.toolCallId,
|
|
34
|
+
runStatus: t.runStatus,
|
|
35
|
+
result: t.result
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { a as invokeNodeTool };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
|
+
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
+
import { HonorAccount as n } from "../../honor-auth/vault/impl.mjs";
|
|
4
|
+
import { isOKResponse as r } from "../../apis/helpers.mjs";
|
|
5
|
+
import { createClawCloudClient as i } from "../../apis/claw-cloud.mjs";
|
|
6
|
+
import { loadDeviceInfo as a } from "../../modules/device/device-info.mjs";
|
|
7
|
+
import "../../modules/device/index.mjs";
|
|
8
|
+
import "../../honor-auth/vault/index.mjs";
|
|
9
|
+
import "../../apis/index.mjs";
|
|
10
|
+
import { ToolError as o } from "../../tools/error.mjs";
|
|
11
|
+
//#region src/capabilities/node/list.ts
|
|
12
|
+
var s = t("capabilities/node");
|
|
13
|
+
async function c(t) {
|
|
14
|
+
let c = await n.fromUser().current();
|
|
15
|
+
if (!c?.token || !c.userId) throw s.error("node device list skipped: no current user"), new o("unauthorized", "missing current user token");
|
|
16
|
+
let l;
|
|
17
|
+
try {
|
|
18
|
+
l = await a();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw s.error("node device list failed to get device info", e), new o("device_info", "failed to get device info", { cause: e });
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
let e = await i().getDeviceList(l, c, { deviceIdList: t?.deviceIdList });
|
|
24
|
+
if (!r(e)) {
|
|
25
|
+
let t = e.data?.code, n = e.data?.cnMessage;
|
|
26
|
+
throw s.error("node device list response not ok", null, {
|
|
27
|
+
status: e.status,
|
|
28
|
+
code: t,
|
|
29
|
+
cnMessage: n
|
|
30
|
+
}), new o("api_failed", `code=${t} message=${n}`);
|
|
31
|
+
}
|
|
32
|
+
let n = e.data.data?.deviceList;
|
|
33
|
+
return { devices: Array.isArray(n) ? n : [] };
|
|
34
|
+
} catch (t) {
|
|
35
|
+
throw t instanceof o ? t : (s.error("node device list failed", t), new o("network_error", e(t), { cause: t }));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { c as listNodeDevices };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/capabilities/node/types.ts
|
|
2
|
+
var e = /* @__PURE__ */ function(e) {
|
|
3
|
+
return e[e.Processing = 0] = "Processing", e[e.ProcessingAlt = 100] = "ProcessingAlt", e[e.Suspended = 101] = "Suspended", e[e.Success = 200] = "Success", e[e.InternalError = 300] = "InternalError", e[e.CompensationFailed = 400] = "CompensationFailed", e;
|
|
4
|
+
}({});
|
|
5
|
+
//#endregion
|
|
6
|
+
export { e as NodeInvokeRunStatusE };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { YOYO_DEFAULT_ACCOUNT_ID as e } from "../consts.mjs";
|
|
2
|
+
import { readYoyoChannelConfig as t } from "../modules/configs/channel.mjs";
|
|
3
|
+
//#region src/channel/accounts.ts
|
|
4
|
+
function n(e) {
|
|
5
|
+
let n = t(e);
|
|
6
|
+
return {
|
|
7
|
+
channelConfig: n,
|
|
8
|
+
accountIds: Object.keys(n.accounts ?? {})
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function r(e, t) {
|
|
12
|
+
let { channelConfig: r, accountIds: i } = n(e), a = t ?? i[0] ?? "default";
|
|
13
|
+
if (a === "default") return {
|
|
14
|
+
accountId: a,
|
|
15
|
+
enabled: !1,
|
|
16
|
+
configured: !1
|
|
17
|
+
};
|
|
18
|
+
let o = r.accounts?.[a];
|
|
19
|
+
return {
|
|
20
|
+
accountId: a,
|
|
21
|
+
enabled: r.enabled !== !1 && o?.enabled !== !1,
|
|
22
|
+
configured: o !== void 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function i(t) {
|
|
26
|
+
let { channelConfig: r, accountIds: i } = n(t);
|
|
27
|
+
return i.length > 0 ? i : r.enabled === void 0 ? [] : [e];
|
|
28
|
+
}
|
|
29
|
+
function a(t) {
|
|
30
|
+
let { accountIds: r } = n(t);
|
|
31
|
+
return r.length > 0 ? r[0] : e;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { i as listYoyoAccountIds, a as resolveDefaultYoyoAccountId, r as resolveYoyoAccount };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/channel/agent-prompt.ts
|
|
2
|
+
var e = { messageToolHints: () => [
|
|
3
|
+
"- YOYO targeting: omit `target` to reply in the current device chat; use `chat:<chatId>` for the exact device chat returned by the channel, or `device:<deviceId>` resolved against the current account.",
|
|
4
|
+
"- YOYO sends text messages only (no images, files, or cards); prefer markdown formatting for readability.",
|
|
5
|
+
"- YOYO has no reactions, mentions, or threads; every target is a 1:1 device conversation (no group chat)."
|
|
6
|
+
] };
|
|
7
|
+
//#endregion
|
|
8
|
+
export { e as yoyoAgentPrompt };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/channel/capabilities.ts
|
|
2
|
+
var e = {
|
|
3
|
+
chatTypes: ["direct"],
|
|
4
|
+
media: !1,
|
|
5
|
+
reactions: !1,
|
|
6
|
+
edit: !1,
|
|
7
|
+
unsend: !1,
|
|
8
|
+
reply: !1,
|
|
9
|
+
effects: !1,
|
|
10
|
+
groupManagement: !1,
|
|
11
|
+
threads: !1,
|
|
12
|
+
polls: !1,
|
|
13
|
+
nativeCommands: !0,
|
|
14
|
+
blockStreaming: !1
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as yoyoCapabilities };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { setYoyoChannelAccountEnabled as e } from "../modules/configs/channel.mjs";
|
|
2
|
+
import { listYoyoAccountIds as t, resolveDefaultYoyoAccountId as n, resolveYoyoAccount as r } from "./accounts.mjs";
|
|
3
|
+
//#region src/channel/config.ts
|
|
4
|
+
var i = {
|
|
5
|
+
listAccountIds: (e) => t(e),
|
|
6
|
+
defaultAccountId: (e) => n(e),
|
|
7
|
+
resolveAccount: (e, t) => r(e, t),
|
|
8
|
+
setAccountEnabled: ({ cfg: t, accountId: n, enabled: r }) => e(t, n, r),
|
|
9
|
+
isEnabled: (e) => e.enabled,
|
|
10
|
+
isConfigured: (e) => e.configured,
|
|
11
|
+
describeAccount: a,
|
|
12
|
+
hasConfiguredState: ({ cfg: e }) => t(e).length > 0
|
|
13
|
+
};
|
|
14
|
+
function a(e) {
|
|
15
|
+
return {
|
|
16
|
+
accountId: e.accountId,
|
|
17
|
+
enabled: e.enabled,
|
|
18
|
+
configured: e.configured,
|
|
19
|
+
linked: e.configured && e.enabled,
|
|
20
|
+
mode: "websocket",
|
|
21
|
+
statusState: e.enabled ? e.configured ? "enabled" : "login required" : "disabled"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { i as yoyoChannelConfigAdapter };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/channel/consts.ts
|
|
2
|
+
var e = "YOYO控虾", t = "HONOR/yoyo (YOYO控虾)", n = "/channels/yoyo", r = "yoyo", i = "Connect OpenClaw to Honor YOYO Assistant.";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { i as YOYO_CHANNEL_BLURB, r as YOYO_CHANNEL_DOCS_LABEL, n as YOYO_CHANNEL_DOCS_PATH, e as YOYO_CHANNEL_LABEL, t as YOYO_CHANNEL_SELECTION_LABEL };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { listNodeDevices as e } from "../capabilities/node/list.mjs";
|
|
2
|
+
import "../capabilities/node/index.mjs";
|
|
3
|
+
//#region src/channel/directory.ts
|
|
4
|
+
async function t(t) {
|
|
5
|
+
try {
|
|
6
|
+
return i((await e()).devices.filter((e) => r(e)).map((e) => n(e)), t);
|
|
7
|
+
} catch {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function n(e) {
|
|
12
|
+
let t = e.deviceId.trim(), n = e.deviceName?.trim() || t;
|
|
13
|
+
return {
|
|
14
|
+
kind: "user",
|
|
15
|
+
id: `device:${t}`,
|
|
16
|
+
name: n,
|
|
17
|
+
handle: `@${n}`,
|
|
18
|
+
raw: { deviceId: t }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function r(e) {
|
|
22
|
+
return typeof e.deviceId == "string" && e.deviceId.trim().length > 0;
|
|
23
|
+
}
|
|
24
|
+
function i(e, t) {
|
|
25
|
+
let n = t.query?.trim().toLowerCase(), r = n ? e.filter((e) => [
|
|
26
|
+
e.id,
|
|
27
|
+
e.name,
|
|
28
|
+
e.handle
|
|
29
|
+
].filter((e) => typeof e == "string").some((e) => e.toLowerCase().includes(n))) : e;
|
|
30
|
+
return typeof t.limit == "number" && t.limit >= 0 ? r.slice(0, t.limit) : r;
|
|
31
|
+
}
|
|
32
|
+
var a = {
|
|
33
|
+
self: async () => null,
|
|
34
|
+
listPeers: async (e) => t(e),
|
|
35
|
+
listGroups: async () => []
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { a as yoyoDirectory };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { clawLogger as e } from "../utils/claw-logger.mjs";
|
|
2
|
+
import { disposeAccountMessaging as t } from "../messaging/dispose.mjs";
|
|
3
|
+
import { loadConfig as n, saveConfig as r } from "../modules/configs/config-store.mjs";
|
|
4
|
+
import { resolveEnabledYoyoAccountId as i, setYoyoChannelAccountEnabled as a } from "../modules/configs/channel.mjs";
|
|
5
|
+
import "../modules/configs/index.mjs";
|
|
6
|
+
import { HonorAccount as o } from "../honor-auth/vault/impl.mjs";
|
|
7
|
+
import "../honor-auth/vault/index.mjs";
|
|
8
|
+
import "../messaging/index.mjs";
|
|
9
|
+
import { monitorAccount as s } from "../connection/monitor.mjs";
|
|
10
|
+
import "../connection/index.mjs";
|
|
11
|
+
//#region src/channel/lifecycle.ts
|
|
12
|
+
var c = e("channel/lifecycle"), l = {
|
|
13
|
+
async startAccount(e) {
|
|
14
|
+
let t = e.accountId;
|
|
15
|
+
c.info("start account channel", { accountId: t }), await u(e), await s({
|
|
16
|
+
accountId: t,
|
|
17
|
+
abortSignal: e.abortSignal
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
async stopAccount(e) {
|
|
21
|
+
let n = e.accountId;
|
|
22
|
+
await t(n), c.info("stop account channel", { accountId: n });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
async function u(e) {
|
|
26
|
+
let { accountId: t } = e, s = i();
|
|
27
|
+
if (t === s && (await o.fromUser(t).current())?.token) return;
|
|
28
|
+
let l = t === s ? "no credential" : "not the fallback account";
|
|
29
|
+
try {
|
|
30
|
+
await r(a(n(), t, !1), {
|
|
31
|
+
mode: "none",
|
|
32
|
+
reason: `account not connectable: ${l}`
|
|
33
|
+
});
|
|
34
|
+
} catch (e) {
|
|
35
|
+
c.error("failed to disable account in config", e, { accountId: t });
|
|
36
|
+
}
|
|
37
|
+
throw c.warn("account not connectable, disabled", {
|
|
38
|
+
accountId: t,
|
|
39
|
+
expected: s,
|
|
40
|
+
reason: l
|
|
41
|
+
}), Error(`yoyo account not connectable: ${t} (${l})`);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { l as yoyoChannelGateway };
|