@honor-claw/yoyo 2026.9.3-alpha.2 → 2026.9.3-beta.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/capabilities/cloud-invoke/invoke.mjs +11 -11
- package/dist/capabilities/node/index.mjs +0 -1
- package/dist/capabilities/node/invoke.mjs +4 -4
- package/dist/capabilities/node/list.mjs +9 -9
- package/dist/capabilities/remote-file/remote-file.mjs +11 -11
- package/dist/channel/lifecycle.mjs +1 -1
- package/dist/cli/login/impl.mjs +11 -12
- package/dist/cloud-channel/channel.mjs +33 -34
- package/dist/cloud-channel/handlers/context/handler.mjs +50 -56
- package/dist/cloud-channel/protocol/v2-adapter.mjs +1 -3
- package/dist/command/help.mjs +6 -9
- package/dist/command/index.mjs +12 -15
- package/dist/command/parser.mjs +10 -14
- package/dist/core/hooks/entry.mjs +7 -8
- package/dist/core/hooks/gateway-lifecycle.mjs +10 -13
- package/dist/core/hooks/prompt.mjs +1 -1
- package/dist/core/prompt/builder.mjs +10 -12
- package/dist/diagnose/collectors/account.mjs +1 -1
- package/dist/honor-auth/browser/flow.mjs +13 -13
- package/dist/honor-auth/login/impl.mjs +4 -4
- package/dist/honor-auth/logout.mjs +7 -7
- package/dist/honor-auth/vault/legacy-migration.mjs +8 -8
- package/dist/messaging/dispatchers/stream/session.mjs +38 -38
- package/dist/messaging/inbound/context.mjs +18 -19
- package/dist/messaging/index.mjs +0 -6
- package/dist/messaging/send/frame.mjs +17 -36
- package/dist/messaging/send/text.mjs +16 -14
- package/dist/messaging/target/address.mjs +11 -14
- package/dist/messaging/target/index.mjs +0 -1
- package/dist/messaging/target/outbound.mjs +13 -20
- package/dist/modules/configs/agent-defaults.mjs +12 -15
- package/dist/modules/configs/index.mjs +0 -1
- package/dist/modules/configs/plugin-init.mjs +1 -1
- package/dist/modules/device/device-info.mjs +1 -1
- package/dist/provisioning/registration/register.mjs +8 -8
- package/dist/schemas.mjs +1 -5
- package/dist/tools/index.mjs +3 -5
- package/dist/tools/remote-file-upload/run.mjs +19 -19
- package/openclaw.plugin.json +1 -2
- package/package.json +1 -1
- package/skills/yoyo-phone-control/SKILL.md +0 -314
- package/skills/yoyo-phone-control/mcptools/adjust_brightness.json +10 -10
- package/skills/yoyo-phone-control/mcptools/create_schedule.json +3 -3
- package/skills/yoyo-phone-control/mcptools/device_operation.json +2 -2
- package/skills/yoyo-phone-control/mcptools/modify_schedule.json +8 -0
- package/skills/yoyo-phone-control/mcptools/screen_recorder.json +1 -1
- package/skills/yoyo-phone-control/mcptools/search_message.json +5 -21
- package/skills/yoyo-phone-control/mcptools/vibration_mode.json +1 -1
- package/skills/yoyo-phone-control/mcptools/volume.json +12 -12
- package/dist/capabilities/cron/delivery-capture.mjs +0 -49
- package/dist/capabilities/cron/events.mjs +0 -93
- package/dist/capabilities/cron/index.mjs +0 -3
- package/dist/capabilities/cron/service.mjs +0 -140
- package/dist/capabilities/node/device-target.mjs +0 -49
- package/dist/cloud-channel/handlers/context/cron.mjs +0 -58
- package/dist/cloud-channel/handlers/push-inbound.mjs +0 -8
- package/dist/command/mock/handler.mjs +0 -92
- package/dist/command/mock/help.mjs +0 -10
- package/dist/command/mock/index.mjs +0 -3
- package/dist/command/mock/parser.mjs +0 -18
- package/dist/core/hooks/cron-observer.mjs +0 -26
- package/dist/core/prompt/cron.mjs +0 -19
- package/dist/messaging/notification/inbound.mjs +0 -66
- package/dist/messaging/notification/index.mjs +0 -4
- package/dist/messaging/notification/notify.mjs +0 -28
- package/dist/messaging/notification/outbox.mjs +0 -148
- package/dist/messaging/notification/types.mjs +0 -6
- package/dist/modules/configs/owner-allow-from.mjs +0 -53
- package/dist/tools/send-message/index.mjs +0 -2
- package/dist/tools/send-message/tool.mjs +0 -71
- package/dist/tools/send-message/types.mjs +0 -8
- package/skills/yoyo-phone-control/mcptools/memorySearch.json +0 -100
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
2
|
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import "../../apis/
|
|
5
|
-
import { HonorAccount as r } from "../../honor-auth/vault/impl.mjs";
|
|
3
|
+
import { HonorAccount as n } from "../../honor-auth/vault/impl.mjs";
|
|
4
|
+
import { createClawCloudClient as r } from "../../apis/claw-cloud.mjs";
|
|
6
5
|
import { loadDeviceInfo as i } from "../../modules/device/device-info.mjs";
|
|
7
6
|
import "../../modules/device/index.mjs";
|
|
8
7
|
import "../../honor-auth/vault/index.mjs";
|
|
8
|
+
import "../../apis/index.mjs";
|
|
9
9
|
import { ToolError as a } from "../../tools/error.mjs";
|
|
10
10
|
//#region src/capabilities/cloud-invoke/invoke.ts
|
|
11
11
|
var o = t("capabilities");
|
|
12
12
|
async function s(t) {
|
|
13
|
-
let s = await
|
|
13
|
+
let s = await n.fromUser().current();
|
|
14
14
|
if (!s?.token || !s.userId) throw o.error("cloud invoke skipped: no current user"), new a("unauthorized", "missing current user token");
|
|
15
15
|
let c;
|
|
16
16
|
try {
|
|
@@ -19,19 +19,19 @@ async function s(t) {
|
|
|
19
19
|
throw o.error("cloud invoke failed to get device info", e), new a("ctx missing", "failed to get device info", { cause: e });
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
|
-
let e = await
|
|
22
|
+
let e = await r().invokeCloudTool(c, s, {
|
|
23
23
|
serviceId: t.toolId,
|
|
24
24
|
pluginParams: t.params ?? {},
|
|
25
25
|
...t.timeoutMs === void 0 ? {} : { timeoutMs: t.timeoutMs }
|
|
26
|
-
}),
|
|
26
|
+
}), n = e.data, i = e.status >= 200 && e.status < 300, l = n?.code === "0", u = n?.code === "ICS-500";
|
|
27
27
|
if (!i || !l && !u) throw o.error("cloud invoke response not ok", null, {
|
|
28
28
|
status: e.status,
|
|
29
|
-
code:
|
|
30
|
-
cnMessage:
|
|
31
|
-
cpErrorCode:
|
|
32
|
-
}), new a("api_failed", `code=${
|
|
29
|
+
code: n?.code,
|
|
30
|
+
cnMessage: n?.cnMessage,
|
|
31
|
+
cpErrorCode: n?.data?.cpErrorCode
|
|
32
|
+
}), new a("api_failed", `code=${n?.code ?? "-"} cpErrorCode=${n?.data?.cpErrorCode ?? "-"} message=${n?.cnMessage ?? "-"}`);
|
|
33
33
|
return {
|
|
34
|
-
...
|
|
34
|
+
...n.data === void 0 ? {} : { pluginResponse: n.data },
|
|
35
35
|
code: e.data.code,
|
|
36
36
|
cnMessage: e.data.cnMessage
|
|
37
37
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
2
|
import { buildEndpoint as t } from "../../cloud-channel/protocol/target.mjs";
|
|
3
3
|
import { resolveEnabledYoyoAccountId as n } from "../../modules/configs/channel.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { ClawClient as r } from "../../connection/registry.mjs";
|
|
5
|
+
import { resolveOutboundTraceInfo as i } from "../../messaging/trace/tool-context.mjs";
|
|
5
6
|
import "../../messaging/trace/index.mjs";
|
|
6
|
-
import { ClawClient as i } from "../../connection/registry.mjs";
|
|
7
7
|
//#region src/capabilities/node/invoke.ts
|
|
8
8
|
var a = e("capabilities");
|
|
9
9
|
async function o(e) {
|
|
10
|
-
let a =
|
|
10
|
+
let a = i(e.toolCallId), o = {
|
|
11
11
|
to: t("node", e.nodeId),
|
|
12
12
|
msgType: "nodeInvokeRequest",
|
|
13
13
|
data: { node: {
|
|
@@ -18,7 +18,7 @@ async function o(e) {
|
|
|
18
18
|
} },
|
|
19
19
|
...a ? { traceInfo: a } : {}
|
|
20
20
|
}, c = n();
|
|
21
|
-
return
|
|
21
|
+
return r.forAccount(c).request(o, {
|
|
22
22
|
timeoutMs: e.timeoutMs,
|
|
23
23
|
matchResult: s(e.toolCallId)
|
|
24
24
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
2
|
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "../../apis/
|
|
6
|
-
import { HonorAccount as i } from "../../honor-auth/vault/impl.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";
|
|
7
6
|
import { loadDeviceInfo 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
10
|
import { ToolError as o } from "../../tools/error.mjs";
|
|
11
11
|
import { DeviceStatus as s } from "../../types.mjs";
|
|
12
12
|
//#region src/capabilities/node/list.ts
|
|
@@ -21,7 +21,7 @@ function l(e) {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
async function u(t) {
|
|
24
|
-
let s = await
|
|
24
|
+
let s = await n.fromUser().current();
|
|
25
25
|
if (!s?.token || !s.userId) throw c.error("node device list skipped: no current user"), new o("unauthorized", "missing current user token");
|
|
26
26
|
let u;
|
|
27
27
|
try {
|
|
@@ -30,8 +30,8 @@ async function u(t) {
|
|
|
30
30
|
throw c.error("node device list failed to get device info", e), new o("device_info", "failed to get device info", { cause: e });
|
|
31
31
|
}
|
|
32
32
|
try {
|
|
33
|
-
let e = await
|
|
34
|
-
if (!
|
|
33
|
+
let e = await i().getDeviceList(u, s, { deviceIdList: t?.deviceIdList });
|
|
34
|
+
if (!r(e)) {
|
|
35
35
|
let t = e.data?.code, n = e.data?.cnMessage;
|
|
36
36
|
throw c.error("node device list response not ok", null, {
|
|
37
37
|
status: e.status,
|
|
@@ -39,8 +39,8 @@ async function u(t) {
|
|
|
39
39
|
cnMessage: n
|
|
40
40
|
}), new o("api_failed", `code=${t} message=${n}`);
|
|
41
41
|
}
|
|
42
|
-
let
|
|
43
|
-
return { devices: Array.isArray(
|
|
42
|
+
let n = e.data.data?.deviceList;
|
|
43
|
+
return { devices: Array.isArray(n) ? n.map(l) : [] };
|
|
44
44
|
} catch (t) {
|
|
45
45
|
throw t instanceof o ? t : (c.error("node device list failed", t), new o("network_error", e(t), { cause: t }));
|
|
46
46
|
}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { clawLogger as e } from "../../utils/claw-logger.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import "../../apis/
|
|
5
|
-
import { HonorAccount as r } from "../../honor-auth/vault/impl.mjs";
|
|
2
|
+
import { HonorAccount as t } from "../../honor-auth/vault/impl.mjs";
|
|
3
|
+
import { isClawResponseOk as n } from "../../apis/helpers.mjs";
|
|
4
|
+
import { createClawCloudClient as r } from "../../apis/claw-cloud.mjs";
|
|
6
5
|
import { loadDeviceInfo as i } from "../../modules/device/device-info.mjs";
|
|
7
6
|
import "../../modules/device/index.mjs";
|
|
8
7
|
import "../../honor-auth/vault/index.mjs";
|
|
8
|
+
import "../../apis/index.mjs";
|
|
9
9
|
import { ToolError as a } from "../../tools/error.mjs";
|
|
10
10
|
import { errorLogMeta as o, normalizeNetworkError as s, normalizeUploadLinkError as c } from "./normalize.mjs";
|
|
11
11
|
//#region src/capabilities/remote-file/remote-file.ts
|
|
12
12
|
var l = e("capabilities");
|
|
13
13
|
async function u() {
|
|
14
|
-
let e = await
|
|
14
|
+
let e = await t.fromUser().current();
|
|
15
15
|
if (!e?.token || !e.userId) throw l.error("remote file skipped: no current user"), new a("unauthorized", "missing current user token");
|
|
16
|
-
let
|
|
16
|
+
let n;
|
|
17
17
|
try {
|
|
18
|
-
|
|
18
|
+
n = await i();
|
|
19
19
|
} catch (e) {
|
|
20
20
|
throw l.error("remote file failed to get device info", e), new a("device_info", "failed to get device info", { cause: e });
|
|
21
21
|
}
|
|
22
22
|
return {
|
|
23
|
-
deviceInfo:
|
|
23
|
+
deviceInfo: n,
|
|
24
24
|
token: e.token,
|
|
25
25
|
userId: e.userId
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
async function d(e,
|
|
28
|
+
async function d(e, t) {
|
|
29
29
|
let { deviceInfo: i, token: d } = await u(), f = { token: d }, p;
|
|
30
30
|
try {
|
|
31
|
-
p = await
|
|
31
|
+
p = await r().getUploadLink(i, f, { fileList: e }, { signal: t });
|
|
32
32
|
} catch (t) {
|
|
33
33
|
throw t instanceof a ? t : (l.error("upload link request failed", t, {
|
|
34
34
|
fileCount: e.length,
|
|
35
35
|
...o(t)
|
|
36
36
|
}), s(t));
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
38
|
+
if (n(p)) {
|
|
39
39
|
let e = p.data.data;
|
|
40
40
|
return {
|
|
41
41
|
code: "OK",
|
|
@@ -2,9 +2,9 @@ import { clawLogger as e } from "../utils/claw-logger.mjs";
|
|
|
2
2
|
import { disposeAccountMessaging as t } from "../messaging/dispose.mjs";
|
|
3
3
|
import { loadConfig as n, saveConfig as r } from "../modules/configs/config-store.mjs";
|
|
4
4
|
import { resolveEnabledYoyoAccountId as i, setYoyoChannelAccountEnabled as a } from "../modules/configs/channel.mjs";
|
|
5
|
+
import "../modules/configs/index.mjs";
|
|
5
6
|
import { HonorAccount as o } from "../honor-auth/vault/impl.mjs";
|
|
6
7
|
import "../honor-auth/vault/index.mjs";
|
|
7
|
-
import "../modules/configs/index.mjs";
|
|
8
8
|
import "../messaging/index.mjs";
|
|
9
9
|
import { monitorAccount as s } from "../connection/monitor.mjs";
|
|
10
10
|
import "../connection/index.mjs";
|
package/dist/cli/login/impl.mjs
CHANGED
|
@@ -2,21 +2,20 @@ import { withCommandRuntime as e } from "../../core/runtime.mjs";
|
|
|
2
2
|
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
3
|
import { loadConfig as n, saveConfig as r } from "../../modules/configs/config-store.mjs";
|
|
4
4
|
import { patchYoyoChannelConfig as i, resolveEnabledYoyoAccountId as a, setAllYoyoChannelAccountsEnabled as o, setYoyoChannelAccountEnabled as s } from "../../modules/configs/channel.mjs";
|
|
5
|
-
import { refreshOwnerAllowFrom as c } from "../../modules/configs/owner-allow-from.mjs";
|
|
6
5
|
import "../../modules/configs/index.mjs";
|
|
7
|
-
import { performLogin as
|
|
6
|
+
import { performLogin as c } from "../../honor-auth/login/impl.mjs";
|
|
8
7
|
import "../../honor-auth/index.mjs";
|
|
9
8
|
//#region src/cli/login/impl.ts
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
let { token: e } =
|
|
14
|
-
|
|
15
|
-
let t = a(),
|
|
16
|
-
if (!
|
|
17
|
-
let
|
|
18
|
-
t && t ===
|
|
9
|
+
var l = t("login-cli");
|
|
10
|
+
function u(t, u) {
|
|
11
|
+
u.command("login").description("login to Honor and register devices").option("-u, --uid <userId>", "login with a specific user ID").option("--token <token>", "login with a specific token").action(async (u) => e(t.runtime, async () => {
|
|
12
|
+
let { token: e } = u;
|
|
13
|
+
l.debug("login CLI command called");
|
|
14
|
+
let t = a(), d = await c({ token: e });
|
|
15
|
+
if (!d) return;
|
|
16
|
+
let f = o(n(), !1);
|
|
17
|
+
t && t === d.userId && await r(f), await r(i(s(f, d.userId, !0), { enabled: !0 })), console.log("✅ yoyo channel account enabled.");
|
|
19
18
|
}));
|
|
20
19
|
}
|
|
21
20
|
//#endregion
|
|
22
|
-
export {
|
|
21
|
+
export { u as registerLoginCommand };
|
|
@@ -9,20 +9,19 @@ import { registerAuthHandler as o } from "./handlers/auth.mjs";
|
|
|
9
9
|
import { registerContextHandler as s } from "./handlers/context/handler.mjs";
|
|
10
10
|
import "./handlers/context/index.mjs";
|
|
11
11
|
import { registerPairingHandler as c } from "./handlers/pairing.mjs";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { V2Adapter as p } from "./protocol/v2-adapter.mjs";
|
|
12
|
+
import { registerUserMessageHandler as l } from "./handlers/user-message.mjs";
|
|
13
|
+
import { summarizeServiceEvent as u } from "./log-summary.mjs";
|
|
14
|
+
import { V1Adapter as d } from "./protocol/v1-adapter.mjs";
|
|
15
|
+
import { V2Adapter as f } from "./protocol/v2-adapter.mjs";
|
|
17
16
|
import "./protocol/index.mjs";
|
|
18
|
-
import { UNEXPECTED_RAW_CODE_SEMANTICS as
|
|
19
|
-
import { CloudSocket as
|
|
20
|
-
import { CloudEventBus as
|
|
21
|
-
import { MessageHandler as
|
|
17
|
+
import { UNEXPECTED_RAW_CODE_SEMANTICS as p } from "./protocol/semantics.mjs";
|
|
18
|
+
import { CloudSocket as m } from "./transport/cloud-socket.mjs";
|
|
19
|
+
import { CloudEventBus as h } from "./transport/event-bus.mjs";
|
|
20
|
+
import { MessageHandler as g } from "./transport/message-handler.mjs";
|
|
22
21
|
import "./transport/index.mjs";
|
|
23
|
-
import { buildCloudSocketConnectParams as
|
|
22
|
+
import { buildCloudSocketConnectParams as _ } from "./utils.mjs";
|
|
24
23
|
//#region src/cloud-channel/channel.ts
|
|
25
|
-
var
|
|
24
|
+
var v = e("cloud-channel"), y = 3e4, b = "v2", x = class {
|
|
26
25
|
config;
|
|
27
26
|
cloudSocket;
|
|
28
27
|
gatewaySessions;
|
|
@@ -35,8 +34,8 @@ var y = e("cloud-channel"), b = 3e4, x = "v2", S = class {
|
|
|
35
34
|
businessPingTimer = new r("recurring");
|
|
36
35
|
constructor(e) {
|
|
37
36
|
this.config = e;
|
|
38
|
-
let t = new
|
|
39
|
-
this.protocol = e.protocol ??
|
|
37
|
+
let t = new h();
|
|
38
|
+
this.protocol = e.protocol ?? b, this.context = { accountId: e.accountId }, this.messageHandler = new g(t, this.context), this.adapter = S(this.protocol), this.cloudSocket = new m({
|
|
40
39
|
loadConnectParams: this.provideConnectParams,
|
|
41
40
|
onFrame: this.handleCloudFrame,
|
|
42
41
|
onOpen: this.handleCloudOpen,
|
|
@@ -48,78 +47,78 @@ var y = e("cloud-channel"), b = 3e4, x = "v2", S = class {
|
|
|
48
47
|
}), this.authorizationRefreshManager = new i({
|
|
49
48
|
accountId: e.accountId,
|
|
50
49
|
outbound: this.dispatcher
|
|
51
|
-
}), this.gatewaySessions = new n(this.dispatcher), c(this.gatewaySessions, t),
|
|
50
|
+
}), this.gatewaySessions = new n(this.dispatcher), c(this.gatewaySessions, t), l(this.gatewaySessions, t), s(this.dispatcher, t), o(this.authorizationRefreshManager, t);
|
|
52
51
|
}
|
|
53
52
|
start() {
|
|
54
|
-
|
|
53
|
+
v.info("starting connection"), this.cloudSocket.start();
|
|
55
54
|
}
|
|
56
55
|
destroy() {
|
|
57
|
-
|
|
56
|
+
v.info("closing connection"), this.businessPingTimer.stop(), this.authorizationRefreshManager.destroy(), this.gatewaySessions.closeAll(), this.dispatcher.destroy(), this.cloudSocket.stop();
|
|
58
57
|
}
|
|
59
58
|
getOutboundPort() {
|
|
60
59
|
return this.dispatcher;
|
|
61
60
|
}
|
|
62
61
|
provideConnectParams = async () => {
|
|
63
62
|
let e = await this.config.credentialProvider();
|
|
64
|
-
return e ?
|
|
63
|
+
return e ? _(e.token, this.protocol) : null;
|
|
65
64
|
};
|
|
66
65
|
handleCloudOpen = () => {
|
|
67
|
-
|
|
66
|
+
v.info("cloud connection established"), this.businessPingTimer.start(this.sendBusinessPing, y), this.authorizationRefreshManager.start(), this.config.onOpen?.();
|
|
68
67
|
};
|
|
69
68
|
handleCloudClose = () => {
|
|
70
|
-
|
|
69
|
+
v.info("cloud connection closed"), this.businessPingTimer.stop(), this.config.onClose?.();
|
|
71
70
|
};
|
|
72
71
|
sendBusinessPing = async () => {
|
|
73
72
|
await this.dispatcher.send({
|
|
74
73
|
to: t("yoyoclawservice"),
|
|
75
74
|
msgType: "pingMessage",
|
|
76
75
|
silent: !0
|
|
77
|
-
}) ||
|
|
76
|
+
}) || v.warn("failed to send pingMessage");
|
|
78
77
|
};
|
|
79
78
|
handleCloudFrame = (e) => {
|
|
80
79
|
let t;
|
|
81
80
|
try {
|
|
82
81
|
t = this.adapter.normalize(e);
|
|
83
82
|
} catch (e) {
|
|
84
|
-
|
|
83
|
+
v.error("protocol adapter failed", e);
|
|
85
84
|
return;
|
|
86
85
|
}
|
|
87
86
|
switch (t.kind) {
|
|
88
87
|
case "SUCCESS": {
|
|
89
88
|
let e = t.serviceEvent;
|
|
90
89
|
if (e.payload.msgType === "pingMessage") {
|
|
91
|
-
|
|
90
|
+
v.debug("ignored inbound pingMessage", u(e));
|
|
92
91
|
return;
|
|
93
92
|
}
|
|
94
|
-
|
|
93
|
+
v.debug("normalized cloud message", u(e)), this.dispatcher.consume(e), this.messageHandler.handleCloudMessage(e);
|
|
95
94
|
return;
|
|
96
95
|
}
|
|
97
96
|
case "TARGET_OFFLINE":
|
|
98
|
-
|
|
97
|
+
v.info("remote device offline", { session: t.offlineSocketId }), this.gatewaySessions.closeSession(t.offlineSocketId);
|
|
99
98
|
return;
|
|
100
99
|
case "DEVICE_NOT_REGISTERED":
|
|
101
|
-
|
|
100
|
+
v.info("device not registered, notifying connection layer"), this.config.onError?.({ type: "device-not-registered" });
|
|
102
101
|
return;
|
|
103
102
|
case "TOKEN_EXPIRED":
|
|
104
|
-
|
|
103
|
+
v.warn("unauthorized by cloud, pausing refresh"), this.authorizationRefreshManager.pauseForUnauthorized();
|
|
105
104
|
return;
|
|
106
105
|
case "UNEXPECTED": {
|
|
107
|
-
let e =
|
|
108
|
-
e ?
|
|
106
|
+
let e = p[t.rawCode];
|
|
107
|
+
e ? v.warn(e, { rawCode: t.rawCode }) : v.warn("unexpected message", { rawCode: t.rawCode });
|
|
109
108
|
return;
|
|
110
109
|
}
|
|
111
110
|
case "INVALID":
|
|
112
|
-
|
|
111
|
+
v.error("failed to parse message", t.error);
|
|
113
112
|
return;
|
|
114
|
-
default:
|
|
113
|
+
default: v.warn("non-success control code", { kind: t.kind });
|
|
115
114
|
}
|
|
116
115
|
};
|
|
117
116
|
handleSocketError = (e) => {
|
|
118
|
-
|
|
117
|
+
v.info("cloud socket error, notifying connection layer", { type: e.type }), this.config.onError?.(e);
|
|
119
118
|
};
|
|
120
119
|
};
|
|
121
|
-
function
|
|
122
|
-
return e === "v1" ? new
|
|
120
|
+
function S(e) {
|
|
121
|
+
return e === "v1" ? new d() : new f();
|
|
123
122
|
}
|
|
124
123
|
//#endregion
|
|
125
|
-
export {
|
|
124
|
+
export { x as ClawChannel };
|
|
@@ -8,39 +8,36 @@ import { switchModel as a } from "../../../capabilities/routing/model-switch.mjs
|
|
|
8
8
|
import "../../../capabilities/routing/index.mjs";
|
|
9
9
|
import { createDeviceToolSetUpdateAck as o } from "../../../provisioning/toolset/ack.mjs";
|
|
10
10
|
import "../../../provisioning/toolset/index.mjs";
|
|
11
|
-
import { CRON_LIST_CONTEXT_NAME as s, CRON_REMOVE_CONTEXT_NAME as c, cronListFetchHandler as l, cronRemoveUpdateHandler as u } from "./cron.mjs";
|
|
12
11
|
//#region src/cloud-channel/handlers/context/handler.ts
|
|
13
|
-
var
|
|
12
|
+
var s = t("cloud-handlers"), c = {
|
|
14
13
|
style: "SOUL.md",
|
|
15
14
|
soul: "SOUL.md"
|
|
16
|
-
},
|
|
17
|
-
function
|
|
15
|
+
}, l = new Set(["DeviceToolSet", "UniversalToolSet"]);
|
|
16
|
+
function u(e, t) {
|
|
18
17
|
let n = r(), i = {
|
|
19
18
|
adminCapability: n,
|
|
20
19
|
outbound: e,
|
|
21
|
-
updateHandlers:
|
|
22
|
-
fetchHandlers:
|
|
23
|
-
}, a = (e
|
|
20
|
+
updateHandlers: d(n),
|
|
21
|
+
fetchHandlers: f(n)
|
|
22
|
+
}, a = (e) => h(e, i);
|
|
24
23
|
t.register("fetchContexts", a), t.register("updateContexts", a);
|
|
25
24
|
}
|
|
26
|
-
function
|
|
25
|
+
function d(e) {
|
|
27
26
|
return {
|
|
28
|
-
style: ({ payload: t }) => e.setAgentFile(
|
|
29
|
-
soul: ({ payload: t }) =>
|
|
30
|
-
"model.primary": ({ payload: e, event: t }) =>
|
|
31
|
-
DeviceToolSet: ({ payload: e, context: t }) =>
|
|
32
|
-
UniversalToolSet: ({ payload: e, context: t }) =>
|
|
33
|
-
[c]: u
|
|
27
|
+
style: ({ payload: t }) => e.setAgentFile(c.style, typeof t?.content == "string" ? t.content : ""),
|
|
28
|
+
soul: ({ payload: t }) => b(e, t),
|
|
29
|
+
"model.primary": ({ payload: e, event: t }) => p(e, t),
|
|
30
|
+
DeviceToolSet: ({ payload: e, context: t }) => x(e, t),
|
|
31
|
+
UniversalToolSet: ({ payload: e, context: t }) => x(e, t)
|
|
34
32
|
};
|
|
35
33
|
}
|
|
36
|
-
function
|
|
34
|
+
function f(e) {
|
|
37
35
|
return {
|
|
38
36
|
skills: () => e.getSkillsStatus(),
|
|
39
|
-
"models.list": ({ event: e }) =>
|
|
40
|
-
[s]: l
|
|
37
|
+
"models.list": ({ event: e }) => m(e)
|
|
41
38
|
};
|
|
42
39
|
}
|
|
43
|
-
async function
|
|
40
|
+
async function p(e, t) {
|
|
44
41
|
let r = typeof e?.provider == "string" ? e.provider : "", i = typeof e?.id == "string" ? e.id : "", o = await a({
|
|
45
42
|
accountId: n(),
|
|
46
43
|
deviceId: t.from.deviceId,
|
|
@@ -59,7 +56,7 @@ async function v(e, t) {
|
|
|
59
56
|
}
|
|
60
57
|
};
|
|
61
58
|
}
|
|
62
|
-
async function
|
|
59
|
+
async function m(e) {
|
|
63
60
|
let t = await i(n(), e.from.deviceId ?? "");
|
|
64
61
|
return t.ok ? {
|
|
65
62
|
ok: !0,
|
|
@@ -69,59 +66,56 @@ async function y(e) {
|
|
|
69
66
|
error: t.error
|
|
70
67
|
};
|
|
71
68
|
}
|
|
72
|
-
async function
|
|
73
|
-
let { from:
|
|
74
|
-
|
|
75
|
-
msgType:
|
|
69
|
+
async function h(t, n) {
|
|
70
|
+
let { from: r, payload: i } = t, a = i.msgType, o = a === "updateContexts", c = r.deviceId;
|
|
71
|
+
s.info("handling context request", {
|
|
72
|
+
msgType: a,
|
|
76
73
|
sourceDeviceId: c
|
|
77
74
|
});
|
|
78
|
-
let
|
|
79
|
-
if (!
|
|
80
|
-
await
|
|
75
|
+
let u = t.data?.contexts?.[0], d = g(u);
|
|
76
|
+
if (!d.valid || !d.context) {
|
|
77
|
+
await _(n.outbound, a, t, u, d.error ?? "Invalid context");
|
|
81
78
|
return;
|
|
82
79
|
}
|
|
83
|
-
let f =
|
|
84
|
-
|
|
80
|
+
let f = d.context, p = f.header.name;
|
|
81
|
+
o && l.has(p) && (f.payload = {
|
|
85
82
|
...f.payload,
|
|
86
83
|
nodeId: c
|
|
87
84
|
});
|
|
88
85
|
try {
|
|
89
|
-
let e =
|
|
86
|
+
let e = o ? n.updateHandlers[p] : n.fetchHandlers[p];
|
|
90
87
|
if (!e) {
|
|
91
|
-
await
|
|
88
|
+
await _(n.outbound, a, t, u, `Unsupported context name: ${p}`);
|
|
92
89
|
return;
|
|
93
90
|
}
|
|
94
|
-
if (
|
|
95
|
-
await
|
|
91
|
+
if (y(o, p) && !await n.adminCapability.waitForReady()) {
|
|
92
|
+
await _(n.outbound, a, t, f, "Admin gateway client not ready");
|
|
96
93
|
return;
|
|
97
94
|
}
|
|
98
|
-
let
|
|
95
|
+
let r = o ? await e({
|
|
99
96
|
payload: f.payload,
|
|
100
97
|
context: f,
|
|
101
98
|
event: t
|
|
102
|
-
}) : await e({
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
106
|
-
if (i.noReply) {
|
|
107
|
-
d.info(`${s ? "update" : "fetch"} context processed (no reply)`, { contextName: m });
|
|
99
|
+
}) : await e({ event: t });
|
|
100
|
+
if (r.noReply) {
|
|
101
|
+
s.info(`${o ? "update" : "fetch"} context processed (no reply)`, { contextName: p });
|
|
108
102
|
return;
|
|
109
103
|
}
|
|
110
|
-
|
|
104
|
+
r.ok ? (s.info(`${o ? "update" : "fetch"} context successfully`), await v(n.outbound, a, t, u, r.responsePayload ?? {
|
|
111
105
|
ok: !0,
|
|
112
|
-
...
|
|
113
|
-
})) : (
|
|
106
|
+
...r.data
|
|
107
|
+
})) : (s.error(`failed to ${o ? "update" : "fetch"} context`, r.error, { contextName: p }), await v(n.outbound, a, t, u, r.responsePayload ?? {
|
|
114
108
|
ok: !1,
|
|
115
|
-
error:
|
|
116
|
-
...
|
|
117
|
-
...
|
|
109
|
+
error: r.error,
|
|
110
|
+
...r.data,
|
|
111
|
+
...o && { name: p }
|
|
118
112
|
}));
|
|
119
113
|
} catch (r) {
|
|
120
114
|
let i = e(r);
|
|
121
|
-
|
|
115
|
+
s.error(`error ${o ? "updating" : "fetching"} context`, r, { contextName: p }), await _(n.outbound, a, t, u, i);
|
|
122
116
|
}
|
|
123
117
|
}
|
|
124
|
-
function
|
|
118
|
+
function g(e) {
|
|
125
119
|
return e?.header?.name ? {
|
|
126
120
|
valid: !0,
|
|
127
121
|
context: e
|
|
@@ -130,13 +124,13 @@ function x(e) {
|
|
|
130
124
|
error: "Missing context name"
|
|
131
125
|
};
|
|
132
126
|
}
|
|
133
|
-
async function
|
|
134
|
-
|
|
127
|
+
async function _(e, t, n, r, i) {
|
|
128
|
+
s.error(i), await v(e, t, n, r, {
|
|
135
129
|
ok: !1,
|
|
136
130
|
error: i
|
|
137
131
|
});
|
|
138
132
|
}
|
|
139
|
-
async function
|
|
133
|
+
async function v(e, t, n, r, i) {
|
|
140
134
|
let a = [{
|
|
141
135
|
header: r?.header ?? {
|
|
142
136
|
name: "unknown",
|
|
@@ -150,11 +144,11 @@ async function C(e, t, n, r, i) {
|
|
|
150
144
|
data: { contexts: a }
|
|
151
145
|
});
|
|
152
146
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
147
|
+
function y(e, t) {
|
|
148
|
+
return !e || !l.has(t);
|
|
155
149
|
}
|
|
156
|
-
async function
|
|
157
|
-
let n = await e.setAgentFile(
|
|
150
|
+
async function b(e, t) {
|
|
151
|
+
let n = await e.setAgentFile(c.soul, typeof t?.md == "string" ? t.md : ""), r = t?.id;
|
|
158
152
|
return r === void 0 ? n : {
|
|
159
153
|
...n,
|
|
160
154
|
data: {
|
|
@@ -163,7 +157,7 @@ async function T(e, t) {
|
|
|
163
157
|
}
|
|
164
158
|
};
|
|
165
159
|
}
|
|
166
|
-
async function
|
|
160
|
+
async function x(e, t) {
|
|
167
161
|
let n = await o({
|
|
168
162
|
namespace: t?.header.namespace,
|
|
169
163
|
payload: e
|
|
@@ -175,4 +169,4 @@ async function E(e, t) {
|
|
|
175
169
|
};
|
|
176
170
|
}
|
|
177
171
|
//#endregion
|
|
178
|
-
export {
|
|
172
|
+
export { u as registerContextHandler };
|
|
@@ -50,8 +50,7 @@ function n(e) {
|
|
|
50
50
|
...e.lastId ? { lastId: e.lastId } : {},
|
|
51
51
|
...e.contexts ? { contexts: e.contexts } : {},
|
|
52
52
|
...e.node ? { node: e.node } : {},
|
|
53
|
-
...e.agentMessage ? { agentMessage: e.agentMessage } : {}
|
|
54
|
-
...e.notification ? { notification: e.notification } : {}
|
|
53
|
+
...e.agentMessage ? { agentMessage: e.agentMessage } : {}
|
|
55
54
|
};
|
|
56
55
|
return Object.keys(t).length ? { data: t } : {};
|
|
57
56
|
}
|
|
@@ -81,7 +80,6 @@ function i(e) {
|
|
|
81
80
|
case "interrupt":
|
|
82
81
|
case "newSession":
|
|
83
82
|
case "agentReply":
|
|
84
|
-
case "agentPush":
|
|
85
83
|
case "nodeInvokeRequest":
|
|
86
84
|
case "nodeInvokeResult":
|
|
87
85
|
case "pingMessage":
|
package/dist/command/help.mjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { isBetaVersion as e } from "../utils/version.mjs";
|
|
2
|
-
import { MOCK_COMMAND_HELP_ITEMS as t } from "./mock/help.mjs";
|
|
3
|
-
import "./mock/index.mjs";
|
|
4
1
|
//#region src/command/help.ts
|
|
5
|
-
var
|
|
2
|
+
var e = [
|
|
6
3
|
{
|
|
7
4
|
example: "/yoyo help",
|
|
8
5
|
description: "查看 YOYO 控虾可用指令及使用方式"
|
|
@@ -24,10 +21,10 @@ var n = [
|
|
|
24
21
|
description: "查看指定消息轮次的处理时间线和异常信息"
|
|
25
22
|
}
|
|
26
23
|
];
|
|
27
|
-
function
|
|
28
|
-
let
|
|
29
|
-
for (let
|
|
30
|
-
return
|
|
24
|
+
function t() {
|
|
25
|
+
let t = ["YOYO 控虾命令帮助"];
|
|
26
|
+
for (let n of e) t.push("", n.example, ` ${n.description}`);
|
|
27
|
+
return t.join("\n");
|
|
31
28
|
}
|
|
32
29
|
//#endregion
|
|
33
|
-
export {
|
|
30
|
+
export { t as handleHelpCommand };
|