@honor-claw/yoyo 2026.6.9-alpha.2 → 2026.6.9-alpha.4
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 +6 -4
- package/dist/capabilities/node/list.mjs +25 -11
- package/dist/channel/accounts.mjs +1 -1
- package/dist/channel/consts.mjs +1 -1
- package/dist/channel/directory.mjs +5 -2
- package/dist/channel/lifecycle.mjs +9 -25
- package/dist/channel/security.mjs +2 -6
- package/dist/channel/setup-wizard.mjs +2 -4
- package/dist/channel/status.mjs +29 -42
- package/dist/cloud-channel/channel.mjs +5 -4
- package/dist/cloud-channel/handlers/context/handler.mjs +41 -36
- package/dist/cloud-channel/transport/cloud-socket.mjs +2 -2
- package/dist/cloud-channel/transport/index.mjs +1 -0
- package/dist/cloud-channel/transport/outbound-port.mjs +23 -29
- package/dist/commands/login/impl.mjs +13 -13
- package/dist/commands/status/index.mjs +8 -8
- package/dist/connection/client.mjs +70 -7
- package/dist/connection/index.mjs +1 -2
- package/dist/connection/monitor.mjs +14 -25
- package/dist/connection/registry.mjs +21 -0
- package/dist/core/hooks/entry.mjs +7 -6
- package/dist/core/hooks/gateway-lifecycle.mjs +21 -0
- package/dist/core/hooks/skill-refresh.mjs +9 -10
- package/dist/core/hooks/tool-trace.mjs +22 -44
- package/dist/core/prompt/skill.mjs +6 -7
- package/dist/core/runtime.mjs +5 -1
- package/dist/gateway/client/client.mjs +1 -1
- package/dist/honor-auth/logout.mjs +1 -1
- package/dist/honor-auth/vault/impl.mjs +46 -57
- package/dist/honor-auth/vault/legacy-migration.mjs +8 -8
- package/dist/index.mjs +4 -4
- 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/{stream → dispatchers/stream}/error.mjs +1 -1
- 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/{stream → dispatchers/stream}/resolvers.mjs +1 -1
- package/dist/messaging/{stream → dispatchers/stream}/session.mjs +15 -11
- package/dist/messaging/dispatchers/stream/tool/error.mjs +26 -0
- package/dist/messaging/dispatchers/stream/tool/event-builder.mjs +18 -0
- package/dist/messaging/{stream → dispatchers/stream}/tool/index.mjs +2 -2
- package/dist/messaging/{stream → dispatchers/stream}/tool/sanitize.mjs +1 -1
- package/dist/messaging/{stream → dispatchers/stream}/tool/trace-store.mjs +16 -61
- package/dist/messaging/inbound/abort/detect.mjs +5 -5
- package/dist/messaging/inbound/abort/index.mjs +1 -1
- package/dist/messaging/inbound/agent.mjs +5 -4
- package/dist/messaging/inbound/command.mjs +38 -0
- package/dist/messaging/inbound/context.mjs +16 -14
- package/dist/messaging/inbound/dispatch.mjs +25 -15
- package/dist/messaging/inbound/interrupt.mjs +22 -21
- package/dist/messaging/inbound/new-session.mjs +21 -18
- package/dist/messaging/inbound/user-message.mjs +3 -3
- package/dist/messaging/index.mjs +1 -0
- package/dist/messaging/send/frame.mjs +8 -13
- package/dist/messaging/send/text.mjs +1 -0
- package/dist/messaging/session/defaults.mjs +41 -0
- package/dist/messaging/session/index.mjs +1 -0
- package/dist/messaging/target/chat-id.mjs +36 -14
- package/dist/messaging/target/index.mjs +3 -0
- package/dist/modules/configs/agent-defaults.mjs +25 -0
- package/dist/modules/configs/channel.mjs +18 -12
- package/dist/modules/configs/index.mjs +2 -2
- package/dist/modules/configs/plugin-init.mjs +36 -26
- package/dist/modules/device/device-info.mjs +7 -7
- package/dist/modules/device/index.mjs +1 -1
- package/dist/modules/status/channel.mjs +1 -17
- package/dist/modules/status/storage.mjs +17 -15
- package/dist/provisioning/registration/register.mjs +52 -28
- package/dist/provisioning/toolset/ack.mjs +10 -15
- package/dist/provisioning/toolset/artifacts.mjs +37 -36
- package/dist/provisioning/toolset/consts.mjs +2 -2
- package/dist/provisioning/toolset/processor.mjs +2 -2
- package/dist/provisioning/toolset/skill-refresh-marker.mjs +30 -25
- package/dist/tools/error.mjs +9 -0
- package/dist/tools/index.mjs +8 -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/claw-logger.mjs +1 -1
- package/dist/utils/fs-safe.mjs +30 -30
- package/openclaw.plugin.json +3 -0
- package/package.json +3 -2
- package/skills/yoyo-phone-control/SKILL.md +1 -63
- package/skills/yoyo-phone-control/configs/sub-skills.json +2 -21
- package/dist/connection/manager.mjs +0 -92
- package/dist/core/service/index.mjs +0 -27
- package/dist/messaging/stream/dispatcher.mjs +0 -74
- package/dist/messaging/stream/tool/callbacks.mjs +0 -36
- package/dist/messaging/stream/tool/output.mjs +0 -38
- package/dist/utils/base64-json.mjs +0 -14
- package/skills/yoyo-phone-control/references/alarm-create.md +0 -519
- package/skills/yoyo-phone-control/references/alarm-delete.md +0 -370
- package/skills/yoyo-phone-control/references/alarm-disable.md +0 -372
- package/skills/yoyo-phone-control/references/alarm-enable.md +0 -372
- package/skills/yoyo-phone-control/references/alarm-query.md +0 -565
- package/skills/yoyo-phone-control/references/alarm-update.md +0 -461
- package/skills/yoyo-phone-control/references/countdown-timer.md +0 -393
- package/skills/yoyo-phone-control/references/schedule-create.md +0 -541
- package/skills/yoyo-phone-control/references/schedule-delete.md +0 -582
- package/skills/yoyo-phone-control/references/schedule-search.md +0 -673
- package/skills/yoyo-phone-control/references/schedule-update.md +0 -630
- package/skills/yoyo-phone-control/references/screen-record.md +0 -236
- package/skills/yoyo-phone-control/references/volume-operate.md +0 -284
package/dist/apis/claw-cloud.mjs
CHANGED
|
@@ -57,13 +57,15 @@ var o = class {
|
|
|
57
57
|
"x-jwt-token": n.token,
|
|
58
58
|
"x-device-id": e.deviceId,
|
|
59
59
|
"x-udid": e.deviceId
|
|
60
|
+
}, a = {
|
|
61
|
+
businessTag: "YOYO_CLAW",
|
|
62
|
+
role: "node",
|
|
63
|
+
ignoreBizExtInfo: !0,
|
|
64
|
+
...r?.deviceIdList?.length ? { deviceIdList: r.deviceIdList } : {}
|
|
60
65
|
};
|
|
61
66
|
return this.httpClient.post("/v1/user/devicelist", {
|
|
62
67
|
headers: i,
|
|
63
|
-
body:
|
|
64
|
-
businessTag: "YOYO_CLAW",
|
|
65
|
-
role: "node"
|
|
66
|
-
},
|
|
68
|
+
body: a,
|
|
67
69
|
timeout: r?.timeoutMs ?? 3e4
|
|
68
70
|
});
|
|
69
71
|
}
|
|
@@ -3,23 +3,37 @@ import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
|
3
3
|
import { getCurrentUser as n } from "../../honor-auth/vault/impl.mjs";
|
|
4
4
|
import { isOKResponse as r } from "../../apis/helpers.mjs";
|
|
5
5
|
import { createClawCloudClient as i } from "../../apis/claw-cloud.mjs";
|
|
6
|
-
import "../../apis/index.mjs";
|
|
7
6
|
import { getDeviceInfo as a } from "../../modules/device/device-info.mjs";
|
|
8
7
|
import "../../modules/device/index.mjs";
|
|
9
8
|
import "../../honor-auth/vault/index.mjs";
|
|
9
|
+
import "../../apis/index.mjs";
|
|
10
|
+
import { ToolError as o } from "../../tools/error.mjs";
|
|
10
11
|
//#region src/capabilities/node/list.ts
|
|
11
|
-
var
|
|
12
|
-
async function
|
|
13
|
-
let
|
|
14
|
-
if (!
|
|
12
|
+
var s = t("capabilities/node");
|
|
13
|
+
async function c(t) {
|
|
14
|
+
let c = await n();
|
|
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
|
+
}
|
|
15
22
|
try {
|
|
16
|
-
let e = await
|
|
17
|
-
if (!r(
|
|
18
|
-
|
|
19
|
-
|
|
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 : [] };
|
|
20
34
|
} catch (t) {
|
|
21
|
-
|
|
35
|
+
throw t instanceof o ? t : (s.error("node device list failed", t), new o("network_error", e(t), { cause: t }));
|
|
22
36
|
}
|
|
23
37
|
}
|
|
24
38
|
//#endregion
|
|
25
|
-
export {
|
|
39
|
+
export { c as listNodeDevices };
|
package/dist/channel/consts.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/channel/consts.ts
|
|
2
|
-
var e = "YOYO控虾", t = "
|
|
2
|
+
var e = "YOYO控虾", t = "HONOR/yoyo (YOYO控虾)", n = "/channels/yoyo", r = "yoyo", i = "Connect OpenClaw to Honor YOYO Assistant.";
|
|
3
3
|
//#endregion
|
|
4
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 };
|
|
@@ -2,8 +2,11 @@ import { listNodeDevices as e } from "../capabilities/node/list.mjs";
|
|
|
2
2
|
import "../capabilities/node/index.mjs";
|
|
3
3
|
//#region src/channel/directory.ts
|
|
4
4
|
async function t(t) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
try {
|
|
6
|
+
return i((await e()).devices.filter((e) => r(e)).map((e) => n(e)), t);
|
|
7
|
+
} catch {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
7
10
|
}
|
|
8
11
|
function n(e) {
|
|
9
12
|
let t = e.deviceId.trim(), n = e.deviceName?.trim() || t;
|
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
import { clawLogger as e } from "../utils/claw-logger.mjs";
|
|
2
2
|
import { disposeAccountMessaging as t } from "../messaging/dispose.mjs";
|
|
3
3
|
import "../messaging/index.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import "../modules/status/index.mjs";
|
|
6
|
-
import { monitorAccount as r } from "../connection/monitor.mjs";
|
|
4
|
+
import { monitorAccount as n } from "../connection/monitor.mjs";
|
|
7
5
|
import "../connection/index.mjs";
|
|
8
6
|
//#region src/channel/lifecycle.ts
|
|
9
|
-
var
|
|
7
|
+
var r = e("channel/lifecycle"), i = {
|
|
10
8
|
async startAccount(e) {
|
|
11
9
|
let t = e.accountId;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
}
|
|
10
|
+
r.info("start account channel", { accountId: t }), await n({
|
|
11
|
+
accountId: t,
|
|
12
|
+
abortSignal: e.abortSignal
|
|
13
|
+
});
|
|
26
14
|
},
|
|
27
15
|
async stopAccount(e) {
|
|
28
|
-
let
|
|
29
|
-
await t(
|
|
30
|
-
running: !1,
|
|
31
|
-
connected: !1,
|
|
32
|
-
lastStopAt: Date.now()
|
|
33
|
-
}), i.info("stop account channel", { accountId: r });
|
|
16
|
+
let n = e.accountId;
|
|
17
|
+
await t(n), r.info("stop account channel", { accountId: n });
|
|
34
18
|
}
|
|
35
19
|
};
|
|
36
20
|
//#endregion
|
|
37
|
-
export {
|
|
21
|
+
export { i as yoyoChannelGateway };
|
|
@@ -1,8 +1,4 @@
|
|
|
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
1
|
//#region src/channel/security.ts
|
|
6
|
-
var
|
|
2
|
+
var e = { collectWarnings: async ({ account: e }) => e.configured === !1 ? ["YOYO channel has not been configured. Run `openclaw configure (channel/yoyo)`."] : e.enabled === !1 ? ["YOYO channel is disabled. Run `openclaw configure (channel/yoyo)` to enable it."] : [] };
|
|
7
3
|
//#endregion
|
|
8
|
-
export {
|
|
4
|
+
export { e as yoyoChannelSecurity };
|
|
@@ -8,12 +8,10 @@ import "../honor-auth/index.mjs";
|
|
|
8
8
|
var s = {
|
|
9
9
|
channel: e,
|
|
10
10
|
async getStatus(n) {
|
|
11
|
-
let r = a(n.cfg) !== t;
|
|
12
11
|
return {
|
|
13
12
|
channel: e,
|
|
14
|
-
configured:
|
|
15
|
-
statusLines: [
|
|
16
|
-
selectionHint: r ? "Ready" : "Login Required"
|
|
13
|
+
configured: a(n.cfg) !== t,
|
|
14
|
+
statusLines: []
|
|
17
15
|
};
|
|
18
16
|
},
|
|
19
17
|
configure: async (e) => {
|
package/dist/channel/status.mjs
CHANGED
|
@@ -1,46 +1,33 @@
|
|
|
1
1
|
import { YOYO_DEFAULT_ACCOUNT_ID as e } from "../consts.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
configured: !1,
|
|
9
|
-
running: !1,
|
|
10
|
-
connected: !1
|
|
11
|
-
}, r = {
|
|
12
|
-
defaultRuntime: n,
|
|
13
|
-
buildChannelSummary: async ({ account: e, defaultAccountId: n, snapshot: r }) => {
|
|
14
|
-
let i = await t(e.accountId);
|
|
15
|
-
return {
|
|
16
|
-
accountId: e.accountId,
|
|
17
|
-
defaultAccountId: n,
|
|
18
|
-
configured: e.configured,
|
|
19
|
-
enabled: e.enabled,
|
|
20
|
-
brand: "honor",
|
|
21
|
-
running: r.running ?? i.running,
|
|
22
|
-
connected: r.connected ?? i.connected,
|
|
23
|
-
lastStartAt: r.lastStartAt ?? i.lastStartAt,
|
|
24
|
-
lastStopAt: r.lastStopAt ?? i.lastStopAt,
|
|
25
|
-
lastError: r.lastError ?? i.lastError
|
|
26
|
-
};
|
|
2
|
+
var t = {
|
|
3
|
+
defaultRuntime: {
|
|
4
|
+
accountId: e,
|
|
5
|
+
enabled: !1,
|
|
6
|
+
configured: !1,
|
|
7
|
+
running: !1
|
|
27
8
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
9
|
+
buildChannelSummary: async ({ snapshot: e }) => ({
|
|
10
|
+
configured: e.configured ?? !1,
|
|
11
|
+
running: e.running ?? !1,
|
|
12
|
+
brand: "honor",
|
|
13
|
+
lastStartAt: e.lastStartAt ?? null,
|
|
14
|
+
lastStopAt: e.lastStopAt ?? null,
|
|
15
|
+
lastError: e.lastError ?? null,
|
|
16
|
+
port: e.port ?? null,
|
|
17
|
+
probe: e.probe,
|
|
18
|
+
lastProbeAt: e.lastProbeAt ?? null
|
|
19
|
+
}),
|
|
20
|
+
buildAccountSnapshot: async ({ account: e, runtime: t }) => ({
|
|
21
|
+
accountId: e.accountId,
|
|
22
|
+
enabled: e.enabled,
|
|
23
|
+
configured: e.configured,
|
|
24
|
+
brand: "honor",
|
|
25
|
+
running: t?.running ?? !1,
|
|
26
|
+
lastStartAt: t?.lastStartAt ?? null,
|
|
27
|
+
lastStopAt: t?.lastStopAt ?? null,
|
|
28
|
+
lastError: t?.lastError ?? null,
|
|
29
|
+
port: t?.port ?? null
|
|
30
|
+
})
|
|
44
31
|
};
|
|
45
32
|
//#endregion
|
|
46
|
-
export {
|
|
33
|
+
export { t as yoyoChannelStatus };
|
|
@@ -15,8 +15,9 @@ import { V2Adapter as f } from "./protocol/v2-adapter.mjs";
|
|
|
15
15
|
import "./protocol/index.mjs";
|
|
16
16
|
import { CloudSocket as p } from "./transport/cloud-socket.mjs";
|
|
17
17
|
import { CloudEventBus as m } from "./transport/event-bus.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
18
|
+
import { createOutboundPort as h } from "./transport/outbound-port.mjs";
|
|
19
|
+
import "./transport/index.mjs";
|
|
20
|
+
import { MessageHandler as g } from "./transport/message-handler.mjs";
|
|
20
21
|
import { buildCloudSocketConnectParams as _ } from "./utils.mjs";
|
|
21
22
|
//#region src/cloud-channel/channel.ts
|
|
22
23
|
var v = e("channel"), y = 3e4, b = "v2", x = class {
|
|
@@ -33,13 +34,13 @@ var v = e("channel"), y = 3e4, b = "v2", x = class {
|
|
|
33
34
|
constructor(e) {
|
|
34
35
|
this.config = e;
|
|
35
36
|
let t = new m();
|
|
36
|
-
this.protocol = e.protocol ?? b, this.messageHandler = new
|
|
37
|
+
this.protocol = e.protocol ?? b, this.messageHandler = new g(t), this.adapter = S(this.protocol), this.cloudSocket = new p({
|
|
37
38
|
connectParamsProvider: this.provideConnectParams,
|
|
38
39
|
onFrame: this.handleCloudFrame,
|
|
39
40
|
onOpen: this.handleCloudOpen,
|
|
40
41
|
onClose: this.handleCloudClose,
|
|
41
42
|
onError: this.handleSocketError
|
|
42
|
-
}), this.outbound =
|
|
43
|
+
}), this.outbound = h(this.adapter, this.cloudSocket, e.deviceInfo), this.authorizationRefreshManager = new a({ outbound: this.outbound }), this.gatewaySessions = new r(this.adminCapability, this.outbound), c(this.gatewaySessions, t), l(this.gatewaySessions, t), s(this.adminCapability, this.outbound, t), o(this.authorizationRefreshManager, t);
|
|
43
44
|
}
|
|
44
45
|
start() {
|
|
45
46
|
v.info("starting connection"), this.adminCapability.start(), this.cloudSocket.start();
|
|
@@ -2,72 +2,76 @@ import { clawLogger as e } from "../../../utils/claw-logger.mjs";
|
|
|
2
2
|
import { createDeviceToolSetUpdateAck as t } from "../../../provisioning/toolset/ack.mjs";
|
|
3
3
|
import "../../../provisioning/toolset/index.mjs";
|
|
4
4
|
//#region src/cloud-channel/handlers/context/handler.ts
|
|
5
|
-
var n = e("context"), r = { style: "SOUL.md" };
|
|
6
|
-
function
|
|
5
|
+
var n = e("context"), r = { style: "SOUL.md" }, i = new Set(["DeviceToolSet", "UniversalToolSet"]);
|
|
6
|
+
function a(e, t, n) {
|
|
7
7
|
let r = {
|
|
8
8
|
adminCapability: e,
|
|
9
9
|
outbound: t,
|
|
10
|
-
updateHandlers:
|
|
11
|
-
fetchHandlers:
|
|
12
|
-
}, i = (e) =>
|
|
10
|
+
updateHandlers: o(e),
|
|
11
|
+
fetchHandlers: s(e)
|
|
12
|
+
}, i = (e) => c(e, r);
|
|
13
13
|
n.register("fetchContexts", i), n.register("updateContexts", i);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function o(e) {
|
|
16
16
|
return {
|
|
17
17
|
style: (t) => e.setAgentFile(r.style, typeof t?.content == "string" ? t.content : ""),
|
|
18
18
|
"model.primary": (t) => e.switchPrimaryModel(typeof t?.provider == "string" ? t.provider : "", typeof t?.id == "string" ? t.id : ""),
|
|
19
|
-
DeviceToolSet:
|
|
20
|
-
UniversalToolSet:
|
|
19
|
+
DeviceToolSet: p,
|
|
20
|
+
UniversalToolSet: p
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function s(e) {
|
|
24
24
|
return {
|
|
25
25
|
skills: () => e.getSkillsStatus(),
|
|
26
26
|
"models.list": () => e.getModelList()
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
async function
|
|
30
|
-
let { from: r, payload:
|
|
29
|
+
async function c(e, t) {
|
|
30
|
+
let { from: r, payload: a } = e, o = a.msgType, s = o === "updateContexts", c = r.deviceId;
|
|
31
31
|
n.info("handling context request", {
|
|
32
|
-
msgType:
|
|
33
|
-
sourceDeviceId:
|
|
32
|
+
msgType: o,
|
|
33
|
+
sourceDeviceId: c
|
|
34
34
|
});
|
|
35
|
-
let
|
|
36
|
-
if (!
|
|
37
|
-
|
|
35
|
+
let p = e.data?.contexts?.[0], m = l(p);
|
|
36
|
+
if (!m.valid || !m.context) {
|
|
37
|
+
u(t.outbound, o, e, p, m.error ?? "Invalid context");
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
let
|
|
40
|
+
let h = m.context, g = h.header.name;
|
|
41
|
+
s && i.has(g) && (h.payload = {
|
|
42
|
+
...h.payload,
|
|
43
|
+
nodeId: c
|
|
44
|
+
});
|
|
41
45
|
try {
|
|
42
|
-
let r =
|
|
46
|
+
let r = s ? t.updateHandlers[g] : t.fetchHandlers[g];
|
|
43
47
|
if (!r) {
|
|
44
|
-
|
|
48
|
+
u(t.outbound, o, e, p, `Unsupported context name: ${g}`);
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
|
-
if (
|
|
48
|
-
|
|
51
|
+
if (f(s, g) && !await t.adminCapability.waitForReady()) {
|
|
52
|
+
u(t.outbound, o, e, h, "Admin gateway client not ready");
|
|
49
53
|
return;
|
|
50
54
|
}
|
|
51
|
-
let i =
|
|
55
|
+
let i = s ? await r(h.payload, h) : await r();
|
|
52
56
|
if (i.noReply) {
|
|
53
|
-
n.info(`${
|
|
57
|
+
n.info(`${s ? "update" : "fetch"} context processed (no reply)`, { contextName: g });
|
|
54
58
|
return;
|
|
55
59
|
}
|
|
56
|
-
i.ok ? (n.info(`${
|
|
60
|
+
i.ok ? (n.info(`${s ? "update" : "fetch"} context successfully`), d(t.outbound, o, e, p, i.responsePayload ?? {
|
|
57
61
|
ok: !0,
|
|
58
62
|
...i.data
|
|
59
|
-
})) : (n.error(`failed to ${
|
|
63
|
+
})) : (n.error(`failed to ${s ? "update" : "fetch"} context`, i.error, { contextName: g }), d(t.outbound, o, e, p, i.responsePayload ?? {
|
|
60
64
|
ok: !1,
|
|
61
65
|
error: i.error,
|
|
62
66
|
...i.data,
|
|
63
|
-
...
|
|
67
|
+
...s && { name: g }
|
|
64
68
|
}));
|
|
65
69
|
} catch (r) {
|
|
66
70
|
let i = r instanceof Error ? r.message : String(r);
|
|
67
|
-
n.error(`error ${
|
|
71
|
+
n.error(`error ${s ? "updating" : "fetching"} context`, r, { contextName: g }), u(t.outbound, o, e, p, i);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
|
-
function
|
|
74
|
+
function l(e) {
|
|
71
75
|
return e?.header?.name ? {
|
|
72
76
|
valid: !0,
|
|
73
77
|
context: e
|
|
@@ -76,13 +80,13 @@ function c(e) {
|
|
|
76
80
|
error: "Missing context name"
|
|
77
81
|
};
|
|
78
82
|
}
|
|
79
|
-
function
|
|
80
|
-
n.error(a),
|
|
83
|
+
function u(e, t, r, i, a) {
|
|
84
|
+
n.error(a), d(e, t, r, i, {
|
|
81
85
|
ok: !1,
|
|
82
86
|
error: a
|
|
83
87
|
});
|
|
84
88
|
}
|
|
85
|
-
function
|
|
89
|
+
function d(e, t, n, r, i) {
|
|
86
90
|
let a = [{
|
|
87
91
|
header: r?.header ?? {
|
|
88
92
|
name: "unknown",
|
|
@@ -90,15 +94,16 @@ function u(e, t, n, r, i) {
|
|
|
90
94
|
},
|
|
91
95
|
payload: i
|
|
92
96
|
}];
|
|
93
|
-
e.
|
|
97
|
+
e.send({
|
|
98
|
+
replyTo: n,
|
|
94
99
|
msgType: t,
|
|
95
100
|
data: { contexts: a }
|
|
96
101
|
});
|
|
97
102
|
}
|
|
98
|
-
function
|
|
99
|
-
return !e || t
|
|
103
|
+
function f(e, t) {
|
|
104
|
+
return !e || !i.has(t);
|
|
100
105
|
}
|
|
101
|
-
async function
|
|
106
|
+
async function p(e, n) {
|
|
102
107
|
let r = await t({
|
|
103
108
|
namespace: n?.header.namespace,
|
|
104
109
|
payload: e
|
|
@@ -110,4 +115,4 @@ async function f(e, n) {
|
|
|
110
115
|
};
|
|
111
116
|
}
|
|
112
117
|
//#endregion
|
|
113
|
-
export {
|
|
118
|
+
export { a as registerContextHandler };
|
|
@@ -5,7 +5,7 @@ import { emitStatusEvent as r } from "../../modules/status/global.mjs";
|
|
|
5
5
|
import { RecurringTimer as i } from "../../utils/recurring-timer.mjs";
|
|
6
6
|
import a from "ws";
|
|
7
7
|
//#region src/cloud-channel/transport/cloud-socket.ts
|
|
8
|
-
var o = e("cloud-socket"), s = 3e4, c =
|
|
8
|
+
var o = e("cloud-socket"), s = 3e4, c = 16e3, l = 1e3, u = 2, d = 999, f = class {
|
|
9
9
|
ws = null;
|
|
10
10
|
options;
|
|
11
11
|
retryCount = 0;
|
|
@@ -114,7 +114,7 @@ var o = e("cloud-socket"), s = 3e4, c = 4e3, l = 1e3, u = 2, d = 999, f = class
|
|
|
114
114
|
}), this.retryTimer.start(() => void this.connect(!0), e);
|
|
115
115
|
}
|
|
116
116
|
calculateRetryDelay() {
|
|
117
|
-
let e = l * u ** Math.min(this.retryCount,
|
|
117
|
+
let e = l * u ** Math.min(this.retryCount, 4);
|
|
118
118
|
return Math.min(e, c);
|
|
119
119
|
}
|
|
120
120
|
sendPing = () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./outbound-port.mjs";
|
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
+
import { buildEndpoint as t } from "../protocol/target.mjs";
|
|
3
|
+
import { uuid as n } from "../../utils/id.mjs";
|
|
3
4
|
//#region src/cloud-channel/transport/outbound-port.ts
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
msgType: t.msgType ?? e.payload.msgType,
|
|
18
|
-
data: t.data,
|
|
19
|
-
bizExtInfo: t.bizExtInfo
|
|
20
|
-
}, e.payload.traceInfo);
|
|
21
|
-
return i.send(n.serialize(a));
|
|
22
|
-
}
|
|
23
|
-
};
|
|
5
|
+
function r(r, a, o) {
|
|
6
|
+
let s = e("outbound");
|
|
7
|
+
return { send(e) {
|
|
8
|
+
let c = !!e.replyTo, l = e.replyTo, u = c && l ? l.from : e.to;
|
|
9
|
+
if (!u) return s.warn("missing 'to' and no replyTo", { msgType: e.msgType }), !1;
|
|
10
|
+
let d = c && l ? l.payload.traceInfo : {
|
|
11
|
+
traceId: n(),
|
|
12
|
+
timestamp: Date.now()
|
|
13
|
+
};
|
|
14
|
+
if (!d) return s.warn("replyTo missing traceInfo", { msgType: e.msgType }), !1;
|
|
15
|
+
let f = i(t("yoyoclaw", o.deviceId, o.port), u, e.msgType, d, e.data, e.bizExtInfo);
|
|
16
|
+
return a.send(r.serialize(f), e.silent);
|
|
17
|
+
} };
|
|
24
18
|
}
|
|
25
|
-
function
|
|
19
|
+
function i(e, t, n, r, i, a) {
|
|
26
20
|
return {
|
|
27
21
|
from: e,
|
|
28
|
-
to: t
|
|
22
|
+
to: t,
|
|
29
23
|
payload: {
|
|
30
|
-
msgType:
|
|
31
|
-
traceInfo:
|
|
32
|
-
...
|
|
24
|
+
msgType: n,
|
|
25
|
+
traceInfo: r,
|
|
26
|
+
...a ? { bizExtInfo: a } : {}
|
|
33
27
|
},
|
|
34
|
-
...
|
|
28
|
+
...i ? { data: i } : {}
|
|
35
29
|
};
|
|
36
30
|
}
|
|
37
31
|
//#endregion
|
|
38
|
-
export {
|
|
32
|
+
export { r as createOutboundPort };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { loadConfig as t, saveConfig as n } from "../../modules/configs/config-store.mjs";
|
|
3
|
+
import { patchYoyoChannelConfig as r, setAllYoyoChannelAccountsEnabled as i, setYoyoChannelAccountEnabled as a } from "../../modules/configs/channel.mjs";
|
|
4
4
|
import "../../modules/configs/index.mjs";
|
|
5
|
-
import { performLogin as
|
|
5
|
+
import { performLogin as o } from "../../honor-auth/login/impl.mjs";
|
|
6
6
|
import "../../honor-auth/index.mjs";
|
|
7
7
|
//#region src/commands/login/impl.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
let { uid:
|
|
12
|
-
if (
|
|
13
|
-
let
|
|
14
|
-
userId:
|
|
15
|
-
token:
|
|
8
|
+
var s = e("login-cli");
|
|
9
|
+
function c(e, c) {
|
|
10
|
+
c.command("login").description("login to yoyoclaw and register devices").option("-u, --uid <userId>", "login with a specific user ID").option("--token <token>", "login with a specific token").action(async (e) => {
|
|
11
|
+
let { uid: c, token: l } = e;
|
|
12
|
+
if (s.debug("login CLI command called"), c && l) throw Error("please provide either --uid or --token, not both");
|
|
13
|
+
let u = await o({
|
|
14
|
+
userId: c,
|
|
15
|
+
token: l
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
u && (await n(r(a(i(t(), !1), u.userId, !0), { enabled: !0 })), console.log("✅ yoyo channel account enabled."));
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
|
-
export {
|
|
21
|
+
export { c as registerLoginCommand };
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { getEnvInfo as n } from "../../modules/configs/plugin.mjs";
|
|
2
|
+
import { getEnvInfo as t } from "../../modules/configs/plugin.mjs";
|
|
4
3
|
import "../../modules/configs/index.mjs";
|
|
5
|
-
import {
|
|
4
|
+
import { ensureStatusLoaded as n } from "../../modules/status/global.mjs";
|
|
5
|
+
import { getCurrentUser as r } from "../../honor-auth/vault/impl.mjs";
|
|
6
|
+
import { getDeviceInfo as i } from "../../modules/device/device-info.mjs";
|
|
6
7
|
import "../../honor-auth/vault/index.mjs";
|
|
7
|
-
import { ensureStatusLoaded as i } from "../../modules/status/global.mjs";
|
|
8
8
|
import "../../modules/status/index.mjs";
|
|
9
9
|
//#region src/commands/status/index.ts
|
|
10
10
|
var a = e("status-cli");
|
|
11
11
|
function o(e, o) {
|
|
12
12
|
o.command("status").description("Show YOYOClaw connection status").action(async () => {
|
|
13
|
-
if (a.debug("status CLI command called"), !await
|
|
13
|
+
if (a.debug("status CLI command called"), !await r()) {
|
|
14
14
|
console.log("🚫 You need to login first. Please run: openclaw honor login");
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
let e = await
|
|
17
|
+
let e = await n();
|
|
18
18
|
if (!await e.hasPersistedStatus()) {
|
|
19
19
|
console.log("\n📭 No connection status record yet."), console.log(" The connection service has not been started, or has never persisted a status."), console.log(" The service runs with the host process; please check that it is active.");
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
let o = e.getStatus(), c = null;
|
|
23
23
|
try {
|
|
24
|
-
c = await
|
|
24
|
+
c = await i();
|
|
25
25
|
} catch {}
|
|
26
|
-
let l =
|
|
26
|
+
let l = t();
|
|
27
27
|
s(o, c, l);
|
|
28
28
|
});
|
|
29
29
|
}
|