@honor-claw/yoyo 1.6.1-beta.6 → 2026.6.9-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.
- package/dist/apis/claw-cloud.mjs +38 -16
- package/dist/apis/hosts.mjs +7 -6
- package/dist/apis/oauth.mjs +39 -0
- package/dist/capabilities/admin/impl.mjs +143 -0
- package/dist/capabilities/admin/manager.mjs +63 -0
- package/dist/capabilities/node/index.mjs +1 -0
- package/dist/capabilities/node/list.mjs +25 -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 +35 -0
- package/dist/channel/lifecycle.mjs +37 -0
- package/dist/channel/messaging.mjs +59 -0
- package/dist/channel/plugin.mjs +41 -0
- package/dist/channel/security.mjs +8 -0
- package/dist/channel/setup-wizard.mjs +41 -0
- package/dist/channel/status.mjs +46 -0
- package/dist/cloud-channel/authorization/refresh-manager.mjs +65 -0
- package/dist/cloud-channel/channel.mjs +94 -50
- package/dist/cloud-channel/handlers/auth.mjs +22 -0
- package/dist/cloud-channel/handlers/context/handler.mjs +113 -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/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 +129 -0
- package/dist/cloud-channel/transport/event-bus.mjs +22 -0
- package/dist/cloud-channel/transport/message-handler.mjs +12 -0
- package/dist/cloud-channel/transport/outbound-port.mjs +38 -0
- package/dist/cloud-channel/utils.mjs +12 -9
- package/dist/commands/env/impl.mjs +20 -17
- package/dist/commands/login/impl.mjs +10 -6
- package/dist/commands/logout/impl.mjs +9 -7
- package/dist/commands/status/index.mjs +31 -26
- package/dist/connection/client.mjs +10 -0
- package/dist/connection/index.mjs +3 -0
- package/dist/connection/manager.mjs +98 -0
- package/dist/connection/monitor.mjs +30 -0
- package/dist/consts.mjs +4 -0
- package/dist/core/hooks/entry.mjs +9 -0
- package/dist/core/hooks/prompt.mjs +8 -0
- package/dist/core/hooks/skill-refresh.mjs +24 -0
- package/dist/core/hooks/tool-trace.mjs +48 -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 +15 -0
- package/dist/core/runtime.mjs +14 -0
- package/dist/core/service/index.mjs +27 -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 +6 -5
- 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 +219 -0
- package/dist/honor-auth/{assets → browser/assets}/favicon.mjs +1 -1
- package/dist/honor-auth/browser/flow.mjs +60 -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 +63 -0
- package/dist/honor-auth/logout.mjs +16 -0
- package/dist/honor-auth/vault/impl.mjs +93 -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 +16 -0
- package/dist/index.mjs +14 -14
- package/dist/messaging/chat-queue/dispatcher.mjs +25 -0
- package/dist/messaging/chat-queue/queue.mjs +20 -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 +30 -0
- package/dist/messaging/inbound/context.mjs +65 -0
- package/dist/messaging/inbound/dispatch.mjs +28 -0
- package/dist/messaging/inbound/extracts.mjs +15 -0
- package/dist/messaging/inbound/index.mjs +3 -0
- package/dist/messaging/inbound/interrupt.mjs +30 -0
- package/dist/messaging/inbound/new-session.mjs +26 -0
- package/dist/messaging/inbound/user-message.mjs +31 -0
- package/dist/messaging/index.mjs +10 -0
- package/dist/messaging/outbound/adapter.mjs +10 -0
- package/dist/messaging/outbound/index.mjs +1 -0
- package/dist/messaging/send/frame.mjs +34 -0
- package/dist/messaging/send/index.mjs +2 -0
- package/dist/messaging/send/text.mjs +26 -0
- package/dist/messaging/stream/dispatcher.mjs +74 -0
- package/dist/messaging/stream/error.mjs +56 -0
- package/dist/messaging/stream/resolvers.mjs +20 -0
- package/dist/messaging/stream/session.mjs +127 -0
- package/dist/messaging/stream/tool/callbacks.mjs +36 -0
- package/dist/messaging/stream/tool/index.mjs +4 -0
- package/dist/messaging/stream/tool/output.mjs +38 -0
- package/dist/messaging/stream/tool/sanitize.mjs +77 -0
- package/dist/messaging/stream/tool/trace-store.mjs +165 -0
- package/dist/messaging/target/address.mjs +23 -0
- package/dist/messaging/target/chat-id.mjs +20 -0
- package/dist/messaging/target/outbound.mjs +24 -0
- package/dist/modules/configs/channel.mjs +44 -0
- package/dist/modules/configs/config-store.mjs +28 -0
- package/dist/modules/configs/gateway.mjs +27 -0
- package/dist/modules/configs/identity-persist.mjs +17 -38
- package/dist/modules/configs/index.mjs +6 -1
- package/dist/modules/configs/plugin-init.mjs +70 -0
- package/dist/modules/configs/plugin-patch.mjs +28 -0
- package/dist/modules/configs/plugin.mjs +114 -0
- package/dist/modules/configs/provider.mjs +17 -9
- package/dist/modules/configs/state-flags.mjs +3 -0
- package/dist/modules/device/device-info.mjs +40 -35
- package/dist/modules/device/index.mjs +0 -4
- 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 +17 -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 +50 -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 +44 -0
- package/dist/{modules/device-toolset → provisioning/toolset}/ack.mjs +1 -1
- package/dist/{modules/device-toolset → provisioning/toolset}/archive.mjs +1 -1
- package/dist/provisioning/toolset/artifacts.mjs +74 -0
- package/dist/{modules/device-toolset → provisioning/toolset}/consts.mjs +2 -2
- package/dist/{modules/device-toolset → provisioning/toolset}/copy-fallback.mjs +1 -1
- package/dist/{modules/device-toolset → provisioning/toolset}/index.mjs +1 -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 +2 -2
- package/dist/provisioning/toolset/skill-refresh-marker.mjs +42 -0
- package/dist/schemas.mjs +4 -0
- package/dist/utils/base64-json.mjs +14 -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 +31 -31
- 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 +28 -0
- package/package.json +16 -3
- package/skills/{yoyo-control → yoyo-phone-control}/SKILL.md +1 -1
- 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/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/dist/{services/connection → honor-auth/login}/index.mjs +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/configs/sub-skills.json +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/airplane-mode.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/alarm-create.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/alarm-delete.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/alarm-disable.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/alarm-enable.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/alarm-query.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/alarm-update.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/app-close.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/app-open.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/app-uninstall.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/app_name_to_pkgName.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/audio-record.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/autoscreen-onnotice.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/battery.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/bluetooth.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/brightness.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/call-phone.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/call-search.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/camera.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/capture-screenshot.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/clean-dirty.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/contact-search.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/countdown-timer.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/dark-mode.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/desktop.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/device-operation.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/express-logistics-search.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/eyecomfort.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/file-upload.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/flashlight.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/gui-task-create.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/gui-task-pause.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/gui-task-terminate.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/hotspot.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/local-search.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/location-service.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/message-search.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/message-send.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/mobile-data.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/nfc.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/no-disturb.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/quiet-mode.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/ringing-mode.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/scan-code.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/schedule-create.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/schedule-delete.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/schedule-search.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/schedule-update.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/screen-record.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/status-bar-show.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/task-result-query.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/usb-shared-network.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/vibration-mode.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/volume-operate.md +0 -0
- /package/skills/{yoyo-control → yoyo-phone-control}/references/wlan.md +0 -0
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,50 @@ 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
|
+
};
|
|
61
|
+
return this.httpClient.post("/v1/user/devicelist", {
|
|
62
|
+
headers: i,
|
|
63
|
+
body: {
|
|
64
|
+
businessTag: "YOYO_CLAW",
|
|
65
|
+
role: "node"
|
|
66
|
+
},
|
|
67
|
+
timeout: r?.timeoutMs ?? 3e4
|
|
68
|
+
});
|
|
69
|
+
}
|
|
53
70
|
async exchangeToken(e, r) {
|
|
54
|
-
let i = t(),
|
|
71
|
+
let i = t(), o = {
|
|
55
72
|
"Content-Type": "application/json",
|
|
56
73
|
"x-device-id": e.deviceId,
|
|
57
74
|
"x-trace-id": i
|
|
58
|
-
},
|
|
59
|
-
"userId" in r
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
redirectUri:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
}, s = {};
|
|
76
|
+
if ("userId" in r) o["x-agw-userId"] = r.userId;
|
|
77
|
+
else if ("token" in r) o["x-jwt-token"] = r.token;
|
|
78
|
+
else {
|
|
79
|
+
let { clientId: e, redirectUri: t } = a();
|
|
80
|
+
s = {
|
|
81
|
+
clientId: e,
|
|
82
|
+
code: r.code,
|
|
83
|
+
redirectUri: t
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
let c = await this.httpClient.post("/v1/user/jwtToken", {
|
|
87
|
+
body: s,
|
|
88
|
+
headers: o,
|
|
67
89
|
timeout: 15e3
|
|
68
90
|
});
|
|
69
|
-
if (n(
|
|
70
|
-
throw Error(`failed to get token: ${JSON.stringify(
|
|
91
|
+
if (n(c) && c.data.data) return c.data.data;
|
|
92
|
+
throw Error(`failed to get token: ${JSON.stringify(c.data)}, traceId: ${i}`);
|
|
71
93
|
}
|
|
72
94
|
};
|
|
73
|
-
function
|
|
95
|
+
function s() {
|
|
74
96
|
let e = r();
|
|
75
|
-
return new
|
|
97
|
+
return new o(`https://${e.clawCloud}/aicloud/yoyo-claw-service`, e.grayTag ? { defaultHeaders: { "x-gray": e.grayTag } } : void 0);
|
|
76
98
|
}
|
|
77
99
|
//#endregion
|
|
78
|
-
export {
|
|
100
|
+
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,143 @@
|
|
|
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 = class {
|
|
5
|
+
manager = new t();
|
|
6
|
+
constructor() {
|
|
7
|
+
this.manager.init();
|
|
8
|
+
}
|
|
9
|
+
start() {
|
|
10
|
+
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
|
+
//#endregion
|
|
143
|
+
export { r as AdminCapabilityImpl };
|
|
@@ -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 @@
|
|
|
1
|
+
import "./list.mjs";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
|
+
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
+
import { getCurrentUser 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 "../../apis/index.mjs";
|
|
7
|
+
import { getDeviceInfo as a } from "../../modules/device/device-info.mjs";
|
|
8
|
+
import "../../modules/device/index.mjs";
|
|
9
|
+
import "../../honor-auth/vault/index.mjs";
|
|
10
|
+
//#region src/capabilities/node/list.ts
|
|
11
|
+
var o = t("capabilities/node");
|
|
12
|
+
async function s() {
|
|
13
|
+
let t = await n();
|
|
14
|
+
if (!t?.token || !t.userId) return o.debug("node device list skipped: no current user"), null;
|
|
15
|
+
try {
|
|
16
|
+
let e = await a(), n = await i().getDeviceList(e, t);
|
|
17
|
+
if (!r(n)) return o.warn("node device list response not ok", { status: n.status }), { devices: [] };
|
|
18
|
+
let s = n.data.data?.deviceList;
|
|
19
|
+
return { devices: Array.isArray(s) ? s : [] };
|
|
20
|
+
} catch (t) {
|
|
21
|
+
return o.warn("node device list failed", { error: e(t) }), null;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { s as listNodeDevices };
|
|
@@ -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: 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", 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,35 @@
|
|
|
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
|
+
let a = await e();
|
|
6
|
+
return a ? i(a.devices.filter((e) => r(e)).map((e) => n(e)), t) : [];
|
|
7
|
+
}
|
|
8
|
+
function n(e) {
|
|
9
|
+
let t = e.deviceId.trim(), n = e.deviceName?.trim() || t;
|
|
10
|
+
return {
|
|
11
|
+
kind: "user",
|
|
12
|
+
id: `device:${t}`,
|
|
13
|
+
name: n,
|
|
14
|
+
handle: `@${n}`,
|
|
15
|
+
raw: { deviceId: t }
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function r(e) {
|
|
19
|
+
return typeof e.deviceId == "string" && e.deviceId.trim().length > 0;
|
|
20
|
+
}
|
|
21
|
+
function i(e, t) {
|
|
22
|
+
let n = t.query?.trim().toLowerCase(), r = n ? e.filter((e) => [
|
|
23
|
+
e.id,
|
|
24
|
+
e.name,
|
|
25
|
+
e.handle
|
|
26
|
+
].filter((e) => typeof e == "string").some((e) => e.toLowerCase().includes(n))) : e;
|
|
27
|
+
return typeof t.limit == "number" && t.limit >= 0 ? r.slice(0, t.limit) : r;
|
|
28
|
+
}
|
|
29
|
+
var a = {
|
|
30
|
+
self: async () => null,
|
|
31
|
+
listPeers: async (e) => t(e),
|
|
32
|
+
listGroups: async () => []
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { a as yoyoDirectory };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { clawLogger as e } from "../utils/claw-logger.mjs";
|
|
2
|
+
import { disposeAccountMessaging as t } from "../messaging/dispose.mjs";
|
|
3
|
+
import "../messaging/index.mjs";
|
|
4
|
+
import { setChannelAccountStatus as n } from "../modules/status/channel.mjs";
|
|
5
|
+
import "../modules/status/index.mjs";
|
|
6
|
+
import { monitorAccount as r } from "../connection/monitor.mjs";
|
|
7
|
+
import "../connection/index.mjs";
|
|
8
|
+
//#region src/channel/lifecycle.ts
|
|
9
|
+
var i = e("channel/lifecycle"), a = {
|
|
10
|
+
async startAccount(e) {
|
|
11
|
+
let t = e.accountId;
|
|
12
|
+
i.info("start account channel", { accountId: t });
|
|
13
|
+
try {
|
|
14
|
+
await r({
|
|
15
|
+
userId: t,
|
|
16
|
+
abortSignal: e.abortSignal
|
|
17
|
+
});
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw await n(t, {
|
|
20
|
+
running: !1,
|
|
21
|
+
connected: !1,
|
|
22
|
+
lastStartAt: null,
|
|
23
|
+
lastError: "account not ready"
|
|
24
|
+
}), e;
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
async stopAccount(e) {
|
|
28
|
+
let r = e.accountId;
|
|
29
|
+
await t(r), await n(r, {
|
|
30
|
+
running: !1,
|
|
31
|
+
connected: !1,
|
|
32
|
+
lastStopAt: Date.now()
|
|
33
|
+
}), i.info("stop account channel", { accountId: r });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { a as yoyoChannelGateway };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { YOYO_CHANNEL_ID as e } from "../consts.mjs";
|
|
2
|
+
import { buildChatTo as t, buildFrom as n, readChatIdFromTo as r, readDeviceIdFromTo as i } from "../messaging/target/address.mjs";
|
|
3
|
+
import { buildChatId as a, parseChatId as o } from "../messaging/target/chat-id.mjs";
|
|
4
|
+
import { resolveOutboundTarget as s } from "../messaging/target/outbound.mjs";
|
|
5
|
+
import { buildChannelOutboundSessionRoute as c, stripChannelTargetPrefix as l } from "openclaw/plugin-sdk/channel-core";
|
|
6
|
+
//#region src/channel/messaging.ts
|
|
7
|
+
function u(t) {
|
|
8
|
+
let n = l(t, e).trim();
|
|
9
|
+
return d(t, n) ? n : void 0;
|
|
10
|
+
}
|
|
11
|
+
function d(e, t = e) {
|
|
12
|
+
let n = t.trim(), a = r(n);
|
|
13
|
+
if (a !== void 0) return a.length > 0 && f(a);
|
|
14
|
+
let o = i(n);
|
|
15
|
+
return o !== void 0 && o.trim().length > 0;
|
|
16
|
+
}
|
|
17
|
+
function f(e) {
|
|
18
|
+
try {
|
|
19
|
+
return o(e), !0;
|
|
20
|
+
} catch {
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function p(r, i, o) {
|
|
25
|
+
let s = a(i, o);
|
|
26
|
+
return c({
|
|
27
|
+
cfg: r.cfg,
|
|
28
|
+
agentId: r.agentId,
|
|
29
|
+
channel: e,
|
|
30
|
+
accountId: i,
|
|
31
|
+
peer: {
|
|
32
|
+
kind: "direct",
|
|
33
|
+
id: s
|
|
34
|
+
},
|
|
35
|
+
chatType: "direct",
|
|
36
|
+
from: n(s),
|
|
37
|
+
to: t(s)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function m(e) {
|
|
41
|
+
try {
|
|
42
|
+
let t = s(e.resolvedTarget?.to ?? e.target, e.accountId ?? void 0);
|
|
43
|
+
return p(e, t.accountId, t.deviceId);
|
|
44
|
+
} catch {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
var h = {
|
|
49
|
+
targetPrefixes: [e],
|
|
50
|
+
normalizeTarget: u,
|
|
51
|
+
inferTargetChatType: () => "direct",
|
|
52
|
+
targetResolver: {
|
|
53
|
+
looksLikeId: d,
|
|
54
|
+
hint: "<chat:<chatId> | device:<deviceId>>"
|
|
55
|
+
},
|
|
56
|
+
resolveOutboundSessionRoute: m
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { h as yoyoMessaging };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { YOYO_CHANNEL_ID as e } from "../consts.mjs";
|
|
2
|
+
import { yoyoOutbound as t } from "../messaging/outbound/adapter.mjs";
|
|
3
|
+
import "../messaging/index.mjs";
|
|
4
|
+
import { yoyoAgentPrompt as n } from "./agent-prompt.mjs";
|
|
5
|
+
import { yoyoCapabilities as r } from "./capabilities.mjs";
|
|
6
|
+
import { yoyoChannelConfigAdapter as i } from "./config.mjs";
|
|
7
|
+
import { YOYO_CHANNEL_BLURB as a, YOYO_CHANNEL_DOCS_LABEL as o, YOYO_CHANNEL_DOCS_PATH as s, YOYO_CHANNEL_LABEL as c, YOYO_CHANNEL_SELECTION_LABEL as l } from "./consts.mjs";
|
|
8
|
+
import { yoyoDirectory as u } from "./directory.mjs";
|
|
9
|
+
import { yoyoChannelGateway as d } from "./lifecycle.mjs";
|
|
10
|
+
import { yoyoMessaging as f } from "./messaging.mjs";
|
|
11
|
+
import { yoyoChannelSecurity as p } from "./security.mjs";
|
|
12
|
+
import { yoyoChannelSetupWizard as m } from "./setup-wizard.mjs";
|
|
13
|
+
import { yoyoChannelStatus as h } from "./status.mjs";
|
|
14
|
+
//#region src/channel/plugin.ts
|
|
15
|
+
var g = {
|
|
16
|
+
id: e,
|
|
17
|
+
meta: {
|
|
18
|
+
id: e,
|
|
19
|
+
label: c,
|
|
20
|
+
selectionLabel: l,
|
|
21
|
+
docsPath: s,
|
|
22
|
+
docsLabel: o,
|
|
23
|
+
blurb: a
|
|
24
|
+
},
|
|
25
|
+
capabilities: r,
|
|
26
|
+
messaging: f,
|
|
27
|
+
directory: u,
|
|
28
|
+
agentPrompt: n,
|
|
29
|
+
config: i,
|
|
30
|
+
setupWizard: m,
|
|
31
|
+
reload: { configPrefixes: ["channels.yoyo"] },
|
|
32
|
+
status: h,
|
|
33
|
+
security: p,
|
|
34
|
+
gateway: d,
|
|
35
|
+
outbound: t
|
|
36
|
+
};
|
|
37
|
+
function _(e) {
|
|
38
|
+
e.registerChannel({ plugin: g });
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { _ as registerChannels };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClawClient as e } from "../connection/client.mjs";
|
|
2
|
+
import { getCurrentUser as t } from "../honor-auth/vault/impl.mjs";
|
|
3
|
+
import "../honor-auth/vault/index.mjs";
|
|
4
|
+
import "../connection/index.mjs";
|
|
5
|
+
//#region src/channel/security.ts
|
|
6
|
+
var n = { collectWarnings: async ({ account: n }) => n.configured === !1 ? ["YOYO channel has not been configured. Run `openclaw configure (channel/yoyo)`."] : n.enabled === !1 ? ["YOYO channel is disabled. Run `openclaw configure (channel/yoyo)` to enable it."] : e.connected() ? (await t())?.token ? [] : ["YOYO channel is enabled but the Honor account is not logged in."] : ["YOYO channel WebSocket is not connected."] };
|
|
7
|
+
//#endregion
|
|
8
|
+
export { n as yoyoChannelSecurity };
|