@honor-claw/yoyo 2026.6.9 → 2026.7.1-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 +19 -0
- package/dist/capabilities/cloud-invoke/index.mjs +1 -0
- package/dist/capabilities/cloud-invoke/invoke.mjs +43 -0
- package/dist/capabilities/node/invoke.mjs +2 -2
- package/dist/capabilities/node/types.mjs +1 -1
- package/dist/cloud-channel/handlers/context/handler.mjs +6 -3
- package/dist/core/hooks/tool-trace.mjs +9 -5
- package/dist/core/prompt/builder.mjs +13 -8
- package/dist/core/prompt/cloud-tool.mjs +7 -0
- package/dist/messaging/dispatchers/stream/controller.mjs +29 -29
- package/dist/messaging/dispatchers/stream/error.mjs +1 -2
- package/dist/messaging/trace/lifecycle.mjs +16 -3
- package/dist/messaging/trace/tool-context.mjs +30 -17
- package/dist/modules/configs/plugin-init.mjs +1 -0
- package/dist/tools/cloud-invoke/index.mjs +1 -0
- package/dist/tools/cloud-invoke/tool.mjs +48 -0
- package/dist/tools/index.mjs +8 -6
- package/dist/tools/node-invoke/status-mapper.mjs +14 -10
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/yoyo-phone-control/SKILL.md +5 -0
- package/skills/yoyo-phone-control/mcptools/about_device.json +72 -0
- package/skills/yoyo-phone-control/mcptools/ai_caption.json +89 -0
- package/skills/yoyo-phone-control/mcptools/answer_phone.json +35 -0
- package/skills/yoyo-phone-control/mcptools/aod.json +68 -0
- package/skills/yoyo-phone-control/mcptools/app_clone.json +77 -0
- package/skills/yoyo-phone-control/mcptools/app_lock.json +28 -0
- package/skills/yoyo-phone-control/mcptools/app_manager.json +88 -0
- package/skills/yoyo-phone-control/mcptools/auto_intercept_one_ring_call.json +64 -0
- package/skills/yoyo-phone-control/mcptools/auto_rotate.json +58 -0
- package/skills/yoyo-phone-control/mcptools/book_train_ticket.json +59 -0
- package/skills/yoyo-phone-control/mcptools/camera.json +3 -0
- package/skills/yoyo-phone-control/mcptools/cancel_countdown_timer.json +8 -1
- package/skills/yoyo-phone-control/mcptools/cancel_countup_timer.json +47 -0
- package/skills/yoyo-phone-control/mcptools/check_alarm.json +5 -1
- package/skills/yoyo-phone-control/mcptools/check_countup_timer.json +47 -0
- package/skills/yoyo-phone-control/mcptools/close_alarm.json +8 -1
- package/skills/yoyo-phone-control/mcptools/close_countdown_timer.json +5 -1
- package/skills/yoyo-phone-control/mcptools/close_countup_timer.json +47 -0
- package/skills/yoyo-phone-control/mcptools/close_ring.json +55 -0
- package/skills/yoyo-phone-control/mcptools/close_schedule.json +39 -0
- package/skills/yoyo-phone-control/mcptools/color_temp.json +70 -0
- package/skills/yoyo-phone-control/mcptools/control_center.json +28 -0
- package/skills/yoyo-phone-control/mcptools/copy_file.json +70 -0
- package/skills/yoyo-phone-control/mcptools/create_alarm.json +12 -0
- package/skills/yoyo-phone-control/mcptools/create_countup_timer.json +47 -0
- package/skills/yoyo-phone-control/mcptools/create_file.json +63 -0
- package/skills/yoyo-phone-control/mcptools/create_todo.json +3 -3
- package/skills/yoyo-phone-control/mcptools/delay_ring.json +60 -0
- package/skills/yoyo-phone-control/mcptools/delete_alarm.json +8 -1
- package/skills/yoyo-phone-control/mcptools/delete_schedule.json +8 -1
- package/skills/yoyo-phone-control/mcptools/delete_todo.json +0 -1
- package/skills/yoyo-phone-control/mcptools/desktop.json +20 -150
- package/skills/yoyo-phone-control/mcptools/digital_balance.json +72 -0
- package/skills/yoyo-phone-control/mcptools/display_and_brightness.json +75 -0
- package/skills/yoyo-phone-control/mcptools/download_app.json +67 -0
- package/skills/yoyo-phone-control/mcptools/express_logistics_query.json +3 -4
- package/skills/yoyo-phone-control/mcptools/eyecomfort.json +3 -0
- package/skills/yoyo-phone-control/mcptools/find_device.json +38 -0
- package/skills/yoyo-phone-control/mcptools/find_phone.json +47 -0
- package/skills/yoyo-phone-control/mcptools/free_screen.json +76 -0
- package/skills/yoyo-phone-control/mcptools/get_address_lat_lng.json +86 -0
- package/skills/yoyo-phone-control/mcptools/get_user_location.json +2 -21
- package/skills/yoyo-phone-control/mcptools/gui_task_pause.json +0 -1
- package/skills/yoyo-phone-control/mcptools/hang_up_phone.json +35 -0
- package/skills/yoyo-phone-control/mcptools/harassment.json +55 -0
- package/skills/yoyo-phone-control/mcptools/honor_board.json +92 -0
- package/skills/yoyo-phone-control/mcptools/honor_share.json +72 -0
- package/skills/yoyo-phone-control/mcptools/identify_food_calories.json +60 -0
- package/skills/yoyo-phone-control/mcptools/image_search_commodity.json +74 -0
- package/skills/yoyo-phone-control/mcptools/image_to_document_router.json +73 -0
- package/skills/yoyo-phone-control/mcptools/input_method.json +42 -0
- package/skills/yoyo-phone-control/mcptools/language.json +59 -0
- package/skills/yoyo-phone-control/mcptools/local_user_data_qa.json +124 -0
- package/skills/yoyo-phone-control/mcptools/local_user_file_search.json +35 -27
- package/skills/yoyo-phone-control/mcptools/magazine_unlock.json +80 -0
- package/skills/yoyo-phone-control/mcptools/magic_portal.json +58 -0
- package/skills/yoyo-phone-control/mcptools/migrate.json +84 -0
- package/skills/yoyo-phone-control/mcptools/mobile_data.json +11 -15
- package/skills/yoyo-phone-control/mcptools/modify_alarm.json +124 -0
- package/skills/yoyo-phone-control/mcptools/modify_schedule.json +8 -1
- package/skills/yoyo-phone-control/mcptools/modify_todo.json +0 -1
- package/skills/yoyo-phone-control/mcptools/motion_sickness_relief.json +76 -0
- package/skills/yoyo-phone-control/mcptools/move_file.json +73 -0
- package/skills/yoyo-phone-control/mcptools/multi_window.json +99 -0
- package/skills/yoyo-phone-control/mcptools/multimodal_dialogue.json +73 -0
- package/skills/yoyo-phone-control/mcptools/navigation_bar.json +60 -0
- package/skills/yoyo-phone-control/mcptools/navigation_service.json +93 -0
- package/skills/yoyo-phone-control/mcptools/net_accelerate.json +72 -0
- package/skills/yoyo-phone-control/mcptools/no_disturb_schedule.json +84 -0
- package/skills/yoyo-phone-control/mcptools/notification_sound.json +83 -0
- package/skills/yoyo-phone-control/mcptools/onehanded_mode.json +4 -25
- package/skills/yoyo-phone-control/mcptools/open_alarm.json +8 -1
- package/skills/yoyo-phone-control/mcptools/open_countdown_timer.json +0 -1
- package/skills/yoyo-phone-control/mcptools/open_countup_timer.json +47 -0
- package/skills/yoyo-phone-control/mcptools/open_schedule.json +35 -0
- package/skills/yoyo-phone-control/mcptools/operateRhythm.json +1 -2
- package/skills/yoyo-phone-control/mcptools/outdoor_mode.json +68 -0
- package/skills/yoyo-phone-control/mcptools/parallel_space.json +59 -0
- package/skills/yoyo-phone-control/mcptools/pause_countdown_timer.json +8 -1
- package/skills/yoyo-phone-control/mcptools/pause_countup_timer.json +51 -0
- package/skills/yoyo-phone-control/mcptools/playVideo.json +10 -2
- package/skills/yoyo-phone-control/mcptools/print_file.json +60 -0
- package/skills/yoyo-phone-control/mcptools/ptz_control.json +62 -0
- package/skills/yoyo-phone-control/mcptools/query_group_buy.json +86 -0
- package/skills/yoyo-phone-control/mcptools/read_schedule.json +77 -0
- package/skills/yoyo-phone-control/mcptools/recognitionMusic.json +1 -1
- package/skills/yoyo-phone-control/mcptools/remote_control.json +98 -0
- package/skills/yoyo-phone-control/mcptools/renewal_query.json +63 -0
- package/skills/yoyo-phone-control/mcptools/restart_countdown_timer.json +8 -1
- package/skills/yoyo-phone-control/mcptools/restart_countup_timer.json +47 -0
- package/skills/yoyo-phone-control/mcptools/restore_screen_display.json +55 -0
- package/skills/yoyo-phone-control/mcptools/resume_countdown_timer.json +8 -1
- package/skills/yoyo-phone-control/mcptools/resume_countup_timer.json +51 -0
- package/skills/yoyo-phone-control/mcptools/ring_tone.json +102 -0
- package/skills/yoyo-phone-control/mcptools/save_file.json +70 -0
- package/skills/yoyo-phone-control/mcptools/scheduled_power_operation.json +76 -0
- package/skills/yoyo-phone-control/mcptools/screen_saver.json +72 -0
- package/skills/yoyo-phone-control/mcptools/scroll_page.json +30 -0
- package/skills/yoyo-phone-control/mcptools/search_nearby_share_device.json +63 -0
- package/skills/yoyo-phone-control/mcptools/search_notification.json +64 -0
- package/skills/yoyo-phone-control/mcptools/send_express.json +51 -0
- package/skills/yoyo-phone-control/mcptools/send_message.json +5 -6
- package/skills/yoyo-phone-control/mcptools/simple_mode.json +76 -0
- package/skills/yoyo-phone-control/mcptools/smart_call.json +99 -0
- package/skills/yoyo-phone-control/mcptools/smart_cover.json +68 -0
- package/skills/yoyo-phone-control/mcptools/storage.json +117 -0
- package/skills/yoyo-phone-control/mcptools/system_update.json +48 -0
- package/skills/yoyo-phone-control/mcptools/theme.json +65 -0
- package/skills/yoyo-phone-control/mcptools/toAntiVirusActivity.json +82 -0
- package/skills/yoyo-phone-control/mcptools/update_app.json +65 -0
- package/skills/yoyo-phone-control/mcptools/usb_debug.json +68 -0
- package/skills/yoyo-phone-control/mcptools/yoyo_calendar.json +56 -0
- package/skills/yoyo-phone-control/mcptools/yoyo_suggestions.json +115 -0
- package/skills/yoyo-smart-home/SKILL.md +78 -0
- package/skills/yoyo-smart-home/mcptools/device_control.json +136 -0
- package/skills/yoyo-smart-home/mcptools/device_query.json +114 -0
- package/skills/yoyo-smart-home/mcptools/skill_exit.json +6 -0
package/dist/apis/claw-cloud.mjs
CHANGED
|
@@ -69,6 +69,25 @@ var o = class {
|
|
|
69
69
|
timeout: r?.timeoutMs ?? 3e4
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
async invokeCloudTool(e, n, r) {
|
|
73
|
+
let i = {
|
|
74
|
+
"x-trace-id": t(),
|
|
75
|
+
"x-jwt-token": n.token
|
|
76
|
+
}, a = {
|
|
77
|
+
pluginService: { serviceId: r.serviceId },
|
|
78
|
+
pluginParams: r.pluginParams,
|
|
79
|
+
device: {
|
|
80
|
+
deviceId: e.deviceId,
|
|
81
|
+
role: "yoyoclaw",
|
|
82
|
+
port: e.port
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return this.httpClient.post("/icsplugin/execute", {
|
|
86
|
+
headers: i,
|
|
87
|
+
body: a,
|
|
88
|
+
timeout: r?.timeoutMs ?? 3e4
|
|
89
|
+
});
|
|
90
|
+
}
|
|
72
91
|
async exchangeToken(e, r) {
|
|
73
92
|
let i = t(), o = {
|
|
74
93
|
"Content-Type": "application/json",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./invoke.mjs";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
|
+
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
+
import { HonorAccount as n } from "../../honor-auth/vault/impl.mjs";
|
|
4
|
+
import { createClawCloudClient as r } from "../../apis/claw-cloud.mjs";
|
|
5
|
+
import { loadDeviceInfo as i } from "../../modules/device/device-info.mjs";
|
|
6
|
+
import "../../modules/device/index.mjs";
|
|
7
|
+
import "../../honor-auth/vault/index.mjs";
|
|
8
|
+
import "../../apis/index.mjs";
|
|
9
|
+
import { ToolError as a } from "../../tools/error.mjs";
|
|
10
|
+
//#region src/capabilities/cloud-invoke/invoke.ts
|
|
11
|
+
var o = t("capabilities");
|
|
12
|
+
async function s(t) {
|
|
13
|
+
let s = await n.fromUser().current();
|
|
14
|
+
if (!s?.token || !s.userId) throw o.error("cloud invoke skipped: no current user"), new a("unauthorized", "missing current user token");
|
|
15
|
+
let c;
|
|
16
|
+
try {
|
|
17
|
+
c = await i();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw o.error("cloud invoke failed to get device info", e), new a("ctx missing", "failed to get device info", { cause: e });
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
let e = await r().invokeCloudTool(c, s, {
|
|
23
|
+
serviceId: t.toolId,
|
|
24
|
+
pluginParams: t.params ?? {},
|
|
25
|
+
...t.timeoutMs === void 0 ? {} : { timeoutMs: t.timeoutMs }
|
|
26
|
+
}), n = e.data, i = e.status >= 200 && e.status < 300, l = n?.code === "0", u = n?.code === "ICS-500";
|
|
27
|
+
if (!i || !l && !u) throw o.error("cloud invoke response not ok", null, {
|
|
28
|
+
status: e.status,
|
|
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
|
+
return {
|
|
34
|
+
...n.data === void 0 ? {} : { pluginResponse: n.data },
|
|
35
|
+
code: e.data.code,
|
|
36
|
+
cnMessage: e.data.cnMessage
|
|
37
|
+
};
|
|
38
|
+
} catch (t) {
|
|
39
|
+
throw t instanceof a ? t : (o.error("cloud invoke failed", t), new a("network_error", e(t), { cause: t }));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { s as invokeCloudToolService };
|
|
@@ -2,12 +2,12 @@ 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
4
|
import { ClawClient as r } from "../../connection/registry.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { resolveOutboundTraceInfo as i } from "../../messaging/trace/tool-context.mjs";
|
|
6
6
|
import "../../messaging/trace/index.mjs";
|
|
7
7
|
//#region src/capabilities/node/invoke.ts
|
|
8
8
|
var a = e("capabilities");
|
|
9
9
|
async function o(e) {
|
|
10
|
-
let a = i(e.toolCallId)
|
|
10
|
+
let a = i(e.toolCallId), o = {
|
|
11
11
|
to: t("node", e.nodeId),
|
|
12
12
|
msgType: "nodeInvokeRequest",
|
|
13
13
|
data: { node: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/capabilities/node/types.ts
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
|
-
return e[e.Processing = 0] = "Processing", e[e.ProcessingAlt = 100] = "ProcessingAlt", e[e.Suspended = 101] = "Suspended", e[e.Success = 200] = "Success", e[e.InternalError = 300] = "InternalError", e[e.CompensationFailed = 400] = "CompensationFailed", e;
|
|
3
|
+
return e[e.Processing = 0] = "Processing", e[e.ProcessingAlt = 100] = "ProcessingAlt", e[e.Suspended = 101] = "Suspended", e[e.Success = 200] = "Success", e[e.InternalError = 300] = "InternalError", e[e.CompensationFailed = 400] = "CompensationFailed", e[e.UserRejected = 403] = "UserRejected", e;
|
|
4
4
|
}({});
|
|
5
5
|
//#endregion
|
|
6
6
|
export { e as NodeInvokeRunStatusE };
|
|
@@ -5,16 +5,20 @@ import { recordToolCallEnd as r, recordToolCallStart as i } from "../../messagin
|
|
|
5
5
|
//#region src/core/hooks/tool-trace.ts
|
|
6
6
|
function a(a) {
|
|
7
7
|
a.on("before_tool_call", (t, r) => {
|
|
8
|
-
let a = t.toolCallId ?? r.toolCallId;
|
|
9
|
-
i({
|
|
8
|
+
let a = t.toolCallId ?? r.toolCallId, o = t.runId ?? r.runId;
|
|
9
|
+
if (i({
|
|
10
10
|
sessionKey: r.sessionKey,
|
|
11
11
|
toolName: t.toolName,
|
|
12
12
|
params: t.params,
|
|
13
13
|
toolCallId: a,
|
|
14
|
-
runId:
|
|
14
|
+
runId: o
|
|
15
|
+
}), !a) return;
|
|
16
|
+
let s = n(r.sessionKey), c = s && o ? s.runId === o : !1;
|
|
17
|
+
!c && !r.sessionKey || e(a, {
|
|
18
|
+
...c ? s : {},
|
|
19
|
+
...r.sessionKey ? { sessionKey: r.sessionKey } : {},
|
|
20
|
+
...o ? { runId: o } : {}
|
|
15
21
|
});
|
|
16
|
-
let o = n(r.sessionKey);
|
|
17
|
-
a && o && e(a, o);
|
|
18
22
|
}), a.on("after_tool_call", (e, n) => {
|
|
19
23
|
r({
|
|
20
24
|
sessionKey: n.sessionKey,
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
import { resolveAgentPromptContribution as e } from "./agent.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveCloudToolPromptContribution as t } from "./cloud-tool.mjs";
|
|
3
|
+
import { resolveSkillPromptContribution as n } from "./skill.mjs";
|
|
3
4
|
//#region src/core/prompt/builder.ts
|
|
4
|
-
function
|
|
5
|
+
function r(e) {
|
|
5
6
|
let t = e.filter((e) => !!e);
|
|
6
7
|
return t.length > 0 ? t.join("\n\n") : void 0;
|
|
7
8
|
}
|
|
8
|
-
function
|
|
9
|
-
let t =
|
|
9
|
+
function i(e) {
|
|
10
|
+
let t = r(e.map((e) => e.prependSystemContext)), n = r(e.map((e) => e.prependContext));
|
|
10
11
|
return {
|
|
11
12
|
...t ? { prependSystemContext: t } : {},
|
|
12
|
-
...
|
|
13
|
+
...n ? { prependContext: n } : {}
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
async function
|
|
16
|
-
return
|
|
16
|
+
async function a() {
|
|
17
|
+
return i([
|
|
18
|
+
t(),
|
|
19
|
+
e(),
|
|
20
|
+
await n()
|
|
21
|
+
]);
|
|
17
22
|
}
|
|
18
23
|
//#endregion
|
|
19
|
-
export {
|
|
24
|
+
export { a as resolvePromptBuildContribution };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/core/prompt/cloud-tool.ts
|
|
2
|
+
var e = "## Skill 使用云工具调用规则\n\n当已读取的 SKILL.md frontmatter 包含 allowed-tools 声明时:\n\n1. 根据用户意图和 SKILL.md 正文,从 allowed-tools 中选定工具名。\n2. 工具名对应当前 Skill 目录下的 mcptools/<工具名>.json;选定后直接使用 read 读取该文件,无需先查看 mcptools 目录。\n3. 使用 JSON 顶层 id 作为 cloud_invoke.toolId,并按 inputSchema 提取 params。allowed-tools 中的名称、<tool> 信息中的 toolName 和 JSON 的 name 仅用于定位工具,不作为 toolId。\n4. 若工具定义说明不可实际调用,则按其说明处理;否则调用 cloud_invoke,传入 { toolId: JSON.id, params }。\n\n例如,选中 demo_tool 后直接读取 mcptools/demo_tool.json;若其中 id 为 service-123,则 cloud_invoke.toolId 使用 service-123。\n\n明确属于 yoyo-phone-control 等设备控制 Skill(走 node_invoke 通道)的工具,不得通过 cloud_invoke 调用。";
|
|
3
|
+
function t() {
|
|
4
|
+
return { prependSystemContext: e };
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { t as resolveCloudToolPromptContribution };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { toErrorMessage as e } from "../../../utils/error.mjs";
|
|
2
2
|
import { clawLogger as t } from "../../../utils/claw-logger.mjs";
|
|
3
|
-
import { recordLifecycleEvent as n } from "../../trace/lifecycle.mjs";
|
|
4
|
-
import { getToolUseTraceSteps as
|
|
3
|
+
import { recordLifecycleEvent as n, updateActiveTurnRunId as r } from "../../trace/lifecycle.mjs";
|
|
4
|
+
import { getToolUseTraceSteps as i } from "../../trace/tool.mjs";
|
|
5
5
|
import "../../trace/index.mjs";
|
|
6
|
-
import { normalizeAnswerPartial as
|
|
6
|
+
import { normalizeAnswerPartial as a, normalizeFinalVisibleText as o } from "../../guard/content.mjs";
|
|
7
7
|
import "../../guard/index.mjs";
|
|
8
|
-
import { finishThinking as
|
|
9
|
-
import { captureErrorPayload as
|
|
10
|
-
import { resolveAnswerPartialDelta as
|
|
11
|
-
import { buildToolResultEvent as
|
|
8
|
+
import { finishThinking as s, pushFinalVisibleText as c, pushStreamDelta as l, pushThinkingDelta as u, pushToolEvent as d } from "./session.mjs";
|
|
9
|
+
import { captureErrorPayload as f } from "./error.mjs";
|
|
10
|
+
import { resolveAnswerPartialDelta as p, resolveThinkingDelta as m } from "./resolvers.mjs";
|
|
11
|
+
import { buildToolResultEvent as h, buildToolStartEvent as g } from "./tool/event-builder.mjs";
|
|
12
12
|
//#region src/messaging/dispatchers/stream/controller.ts
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var _ = t("dispatcher");
|
|
14
|
+
function v(e, t) {
|
|
15
15
|
return e ?? `no-id:${t}`;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
17
|
+
var y = class {
|
|
18
18
|
session;
|
|
19
19
|
includeThinking;
|
|
20
20
|
includeToolCalls;
|
|
@@ -30,8 +30,8 @@ var v = class {
|
|
|
30
30
|
}
|
|
31
31
|
emitToolStart(e) {
|
|
32
32
|
if (!this.includeToolCalls || !e.name) return;
|
|
33
|
-
let t =
|
|
34
|
-
this.emittedToolStartKeys.has(t) || (this.emittedToolStartKeys.add(t),
|
|
33
|
+
let t = v(e.toolCallId, e.name);
|
|
34
|
+
this.emittedToolStartKeys.has(t) || (this.emittedToolStartKeys.add(t), d(this.session, g(e)), this.pendingToolKeys.add(t), _.debug("tool start emitted", {
|
|
35
35
|
sessionKey: this.session.sessionKey,
|
|
36
36
|
toolName: e.name,
|
|
37
37
|
hasToolCallId: !!e.toolCallId,
|
|
@@ -39,7 +39,7 @@ var v = class {
|
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
41
|
emitToolResult(e) {
|
|
42
|
-
this.includeToolCalls && (
|
|
42
|
+
this.includeToolCalls && (d(this.session, h(e)), this.pendingToolKeys.delete(v(e.toolCallId, e.toolName)), this.pendingToolKeys.size === 0 && this.flushPendingReplyPayloads());
|
|
43
43
|
}
|
|
44
44
|
onToolStart = (e) => {
|
|
45
45
|
e.phase && e.phase !== "start" || e.name && this.emitToolStart({
|
|
@@ -53,7 +53,7 @@ var v = class {
|
|
|
53
53
|
t && this.emitToolResult(t);
|
|
54
54
|
}
|
|
55
55
|
findLatestFinishedStep(e) {
|
|
56
|
-
let t =
|
|
56
|
+
let t = i(this.session.chatId);
|
|
57
57
|
if (e) for (let n = t.length - 1; n >= 0; --n) {
|
|
58
58
|
let r = t[n];
|
|
59
59
|
if (r.status !== "running" && r.toolCallId === e) return r;
|
|
@@ -67,7 +67,7 @@ var v = class {
|
|
|
67
67
|
return this.pendingToolKeys.size > 0;
|
|
68
68
|
}
|
|
69
69
|
onPartialReply = async (e) => {
|
|
70
|
-
let t =
|
|
70
|
+
let t = a(this.session.contentGuard, e);
|
|
71
71
|
if (t.action !== "emit") return;
|
|
72
72
|
let n = {
|
|
73
73
|
text: t.text,
|
|
@@ -77,16 +77,16 @@ var v = class {
|
|
|
77
77
|
this.pendingReplyPayloads.push(n);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
let r =
|
|
81
|
-
r &&
|
|
80
|
+
let r = p(this.session, n);
|
|
81
|
+
r && l(this.session, r);
|
|
82
82
|
};
|
|
83
83
|
async drainPendingReplyPayloads() {
|
|
84
84
|
if (this.pendingReplyPayloads.length === 0) return;
|
|
85
85
|
let e = this.pendingReplyPayloads;
|
|
86
86
|
this.pendingReplyPayloads = [];
|
|
87
87
|
for (let t of e) {
|
|
88
|
-
let e =
|
|
89
|
-
e && await
|
|
88
|
+
let e = p(this.session, t);
|
|
89
|
+
e && await l(this.session, e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
flushPendingReplyPayloads() {
|
|
@@ -94,24 +94,24 @@ var v = class {
|
|
|
94
94
|
}
|
|
95
95
|
onReasoningStream = (e) => {
|
|
96
96
|
if (!this.includeThinking) return;
|
|
97
|
-
let t =
|
|
98
|
-
t &&
|
|
97
|
+
let t = m(this.session, e);
|
|
98
|
+
t && u(this.session, t);
|
|
99
99
|
};
|
|
100
100
|
onReasoningEnd = () => {
|
|
101
|
-
this.includeThinking &&
|
|
101
|
+
this.includeThinking && s(this.session);
|
|
102
102
|
};
|
|
103
103
|
deliver = async (e, t) => {
|
|
104
|
-
if (t.kind !== "tool" && !
|
|
105
|
-
let t =
|
|
104
|
+
if (t.kind !== "tool" && !f(this.session, e) && e.isReasoning !== !0 && t.kind === "final") {
|
|
105
|
+
let t = o(e.text ?? "");
|
|
106
106
|
if (this.isGated) {
|
|
107
107
|
this.pendingReplyPayloads.push({ text: t });
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
await this.flushPendingReplyPayloads(), await
|
|
110
|
+
await this.flushPendingReplyPayloads(), await c(this.session, t);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
onError = (t) => {
|
|
114
|
-
n(this.session.chatId, "reply_error", { error: e(t) }),
|
|
114
|
+
n(this.session.chatId, "reply_error", { error: e(t) }), _.warn("reply dispatcher error", {
|
|
115
115
|
sender: this.session.target.deviceId,
|
|
116
116
|
turnId: this.session.traceInfo.turnId,
|
|
117
117
|
error: t
|
|
@@ -131,8 +131,8 @@ var v = class {
|
|
|
131
131
|
abortSignal: this.session.abortController.signal,
|
|
132
132
|
onToolStart: this.onToolStart,
|
|
133
133
|
onPartialReply: this.onPartialReply,
|
|
134
|
-
onAgentRunStart: () => {
|
|
135
|
-
n(this.session.chatId, "dispatched");
|
|
134
|
+
onAgentRunStart: (e) => {
|
|
135
|
+
n(this.session.chatId, "dispatched"), r(this.session.chatId, e);
|
|
136
136
|
},
|
|
137
137
|
...this.includeThinking ? {
|
|
138
138
|
onReasoningStream: this.onReasoningStream,
|
|
@@ -144,4 +144,4 @@ var v = class {
|
|
|
144
144
|
}
|
|
145
145
|
};
|
|
146
146
|
//#endregion
|
|
147
|
-
export {
|
|
147
|
+
export { y as StreamingController };
|
|
@@ -6,8 +6,7 @@ import { isReplyPayloadNonTerminalToolErrorWarning as r } from "openclaw/plugin-
|
|
|
6
6
|
var i = t("dispatcher"), a = new Set([
|
|
7
7
|
"delivery_error",
|
|
8
8
|
"tool_error",
|
|
9
|
-
"no_visible_reply"
|
|
10
|
-
"runtime_error"
|
|
9
|
+
"no_visible_reply"
|
|
11
10
|
]), o = {
|
|
12
11
|
context_overflow: "当前会话内容过长,请使用 /reset 开启新会话。",
|
|
13
12
|
auth: "模型服务认证失败,请检查模型凭证配置。",
|
|
@@ -20,12 +20,25 @@ function c(e) {
|
|
|
20
20
|
if (!(!t || !n)) return a.chatTraces.get(t)?.turns.find((e) => e.turnId === n)?.session;
|
|
21
21
|
}
|
|
22
22
|
function l(e, t) {
|
|
23
|
+
if (!e || !t) return;
|
|
24
|
+
let n = a.activeTurnIds.get(e);
|
|
25
|
+
if (!n) return;
|
|
26
|
+
let r = a.chatTraces.get(e)?.turns.find((e) => e.turnId === n);
|
|
27
|
+
if (r) {
|
|
28
|
+
if (!r.session) {
|
|
29
|
+
r.session = { runId: t };
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
r.session.runId !== t && (r.session.runId = t);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function u(e, t) {
|
|
23
36
|
e && t && a.sessionChatIds.set(t, e);
|
|
24
37
|
}
|
|
25
|
-
function
|
|
38
|
+
function d(e, t, n) {
|
|
26
39
|
e && n && a.activeTurnIds.get(e) === n && a.activeTurnIds.delete(e), t && a.sessionChatIds.delete(t);
|
|
27
40
|
}
|
|
28
|
-
function
|
|
41
|
+
function f(e, s, c) {
|
|
29
42
|
if (!e) return;
|
|
30
43
|
let l = a.activeTurnIds.get(e);
|
|
31
44
|
if (!l) {
|
|
@@ -46,4 +59,4 @@ function d(e, s, c) {
|
|
|
46
59
|
}), d.updatedAt = u, r(d.lifecycleEvents);
|
|
47
60
|
}
|
|
48
61
|
//#endregion
|
|
49
|
-
export {
|
|
62
|
+
export { u as bindSessionChatId, f as recordLifecycleEvent, d as releaseSessionTurnId, c as resolveTurnSessionBySessionKey, s as startSessionRecord, l as updateActiveTurnRunId };
|
|
@@ -1,30 +1,43 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uuid as e } from "../../utils/id.mjs";
|
|
2
|
+
import { mergeDefined as t } from "../../utils/object.mjs";
|
|
2
3
|
//#region src/messaging/trace/tool-context.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
if (!
|
|
6
|
-
let i =
|
|
4
|
+
var n = /* @__PURE__ */ new Map();
|
|
5
|
+
function r(e, r) {
|
|
6
|
+
if (!e) return;
|
|
7
|
+
let i = n.get(e);
|
|
7
8
|
if (i) {
|
|
8
|
-
i.session =
|
|
9
|
+
i.session = t(i.session, r);
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
+
n.set(e, {
|
|
12
13
|
session: { ...r },
|
|
13
14
|
boundAt: Date.now()
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function i(e) {
|
|
17
18
|
if (!e) return;
|
|
18
|
-
let
|
|
19
|
-
return
|
|
19
|
+
let t = n.get(e);
|
|
20
|
+
return t ? { ...t.session } : void 0;
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
22
|
+
function a(t) {
|
|
23
|
+
let n = t.turnId ?? t.runId;
|
|
24
|
+
return {
|
|
25
|
+
traceId: t.traceId ?? e(),
|
|
26
|
+
...n ? { turnId: n } : {},
|
|
27
|
+
...t.sessionKey ? { sessionId: t.sessionKey } : {}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function o(e) {
|
|
31
|
+
let t = i(e);
|
|
32
|
+
return t ? a(t) : void 0;
|
|
33
|
+
}
|
|
34
|
+
function s(e) {
|
|
35
|
+
e && n.delete(e);
|
|
23
36
|
}
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
for (let [r, i] of
|
|
27
|
-
return
|
|
37
|
+
function c(e) {
|
|
38
|
+
let t = 0;
|
|
39
|
+
for (let [r, i] of n) i.boundAt < e && (n.delete(r), t += 1);
|
|
40
|
+
return t;
|
|
28
41
|
}
|
|
29
42
|
//#endregion
|
|
30
|
-
export {
|
|
43
|
+
export { r as bindToolCallContext, i as getToolCallContext, c as pruneToolCallContexts, s as releaseToolCallContext, o as resolveOutboundTraceInfo };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./tool.mjs";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
|
+
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
+
import { invokeCloudToolService as n } from "../../capabilities/cloud-invoke/invoke.mjs";
|
|
4
|
+
import "../../capabilities/cloud-invoke/index.mjs";
|
|
5
|
+
import { Type as r } from "typebox";
|
|
6
|
+
//#region src/tools/cloud-invoke/tool.ts
|
|
7
|
+
var i = t("tools"), a = {
|
|
8
|
+
name: "cloud_invoke",
|
|
9
|
+
label: "Cloud Invoke",
|
|
10
|
+
description: "指定云侧工具进行调用",
|
|
11
|
+
parameters: r.Object({
|
|
12
|
+
toolId: r.String({ description: "云工具 Id" }),
|
|
13
|
+
params: r.Optional(r.Record(r.String(), r.Unknown(), { description: "云工具执行参数" }))
|
|
14
|
+
}),
|
|
15
|
+
async execute(e, t) {
|
|
16
|
+
let n = await o(t);
|
|
17
|
+
return {
|
|
18
|
+
content: [{
|
|
19
|
+
type: "text",
|
|
20
|
+
text: JSON.stringify(n)
|
|
21
|
+
}],
|
|
22
|
+
details: n
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
async function o(t) {
|
|
27
|
+
try {
|
|
28
|
+
let { pluginResponse: e } = await n({
|
|
29
|
+
toolId: t.toolId,
|
|
30
|
+
...t.params === void 0 ? {} : { params: t.params }
|
|
31
|
+
}), r = e?.choice?.body ?? {};
|
|
32
|
+
return {
|
|
33
|
+
ok: !0,
|
|
34
|
+
result: e?.cpErrorCode || e?.cpErrorMessage ? {
|
|
35
|
+
...r,
|
|
36
|
+
cpErrorCode: e.cpErrorCode,
|
|
37
|
+
cpErrorMessage: e.cpErrorMessage
|
|
38
|
+
} : r
|
|
39
|
+
};
|
|
40
|
+
} catch (t) {
|
|
41
|
+
return i.warn("cloud_invoke failed", { error: e(t) }), {
|
|
42
|
+
ok: !1,
|
|
43
|
+
errorMessage: e(t)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { a as cloudInvokeTool };
|
package/dist/tools/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cloudInvokeTool as e } from "./cloud-invoke/tool.mjs";
|
|
2
|
+
import "./cloud-invoke/index.mjs";
|
|
3
|
+
import { nodeInvokeTool as t } from "./node-invoke/tool.mjs";
|
|
2
4
|
import "./node-invoke/index.mjs";
|
|
3
|
-
import { nodesStatusTool as
|
|
5
|
+
import { nodesStatusTool as n } from "./nodes-status/tool.mjs";
|
|
4
6
|
import "./nodes-status/index.mjs";
|
|
5
|
-
import { pluginRestartTool as
|
|
7
|
+
import { pluginRestartTool as r } from "./plugin-restart/tool.mjs";
|
|
6
8
|
import "./plugin-restart/index.mjs";
|
|
7
9
|
//#region src/tools/index.ts
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
+
function i(i) {
|
|
11
|
+
i.registerTool(n), i.registerTool(t), i.registerTool(e), i.registerTool(r);
|
|
10
12
|
}
|
|
11
13
|
//#endregion
|
|
12
|
-
export {
|
|
14
|
+
export { i as registerTools };
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { NodeInvokeRunStatusE as e } from "../../capabilities/node/types.mjs";
|
|
2
2
|
//#region src/tools/node-invoke/status-mapper.ts
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var t = "用户拒绝设备被执行,请勿再对该节点调用 node_invoke,可向用户说明情况后继续其他操作";
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
return n === e.Success ? {
|
|
5
6
|
ok: !0,
|
|
6
|
-
result:
|
|
7
|
-
} :
|
|
7
|
+
result: r
|
|
8
|
+
} : n === e.InternalError || n === e.CompensationFailed ? {
|
|
8
9
|
ok: !1,
|
|
9
|
-
result:
|
|
10
|
-
} :
|
|
10
|
+
result: r
|
|
11
|
+
} : n === e.Processing || n === e.ProcessingAlt ? {
|
|
11
12
|
ok: !1,
|
|
12
13
|
errorMessage: "node is still processing"
|
|
13
|
-
} :
|
|
14
|
+
} : n === e.Suspended ? {
|
|
14
15
|
ok: !1,
|
|
15
16
|
errorMessage: "tool suspended, waiting for user action"
|
|
17
|
+
} : n === e.UserRejected ? {
|
|
18
|
+
ok: !1,
|
|
19
|
+
errorMessage: t
|
|
16
20
|
} : {
|
|
17
21
|
ok: !0,
|
|
18
|
-
result:
|
|
19
|
-
warnMessage: `unknown runStatus ${
|
|
22
|
+
result: r,
|
|
23
|
+
warnMessage: `unknown runStatus ${n}`
|
|
20
24
|
};
|
|
21
25
|
}
|
|
22
26
|
//#endregion
|
|
23
|
-
export {
|
|
27
|
+
export { n as mapNodeInvokeStatus };
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -173,6 +173,7 @@ metadata: { "openclaw": { "emoji": "📱", "always": true } }
|
|
|
173
173
|
| 连接错误 / 超时 | 等待后重试 | 是(最多 3 次) |
|
|
174
174
|
| 节点处理中 / 挂起 | 节点仍在执行或等待用户介入,提示用户并按需重试 | 否 |
|
|
175
175
|
| 设备离线 | 重新调用 `nodes_status` 确认 `status` | 否 |
|
|
176
|
+
| 用户拒绝设备被执行 | 收到"用户拒绝设备被执行"后不再通过 `node_invoke` 调用**该节点**;对其他节点/其他工具的调用不受影响,可继续。作用域仅限当前这轮会话,下一轮新对话可再次对该节点调用 | 否(仅该节点,仅本轮会话) |
|
|
176
177
|
|
|
177
178
|
如果参数错误**必须强制执行**重新读取 `SKILL.md` 和对应的工具定义文件,并重新执行。
|
|
178
179
|
3 次重试均失败后,停止重试,向用户报告错误诊断并建议手动处理。
|
|
@@ -191,6 +192,10 @@ metadata: { "openclaw": { "emoji": "📱", "always": true } }
|
|
|
191
192
|
|
|
192
193
|
- 示例:`❌ Honor Magic6 不支持该操作`
|
|
193
194
|
|
|
195
|
+
**用户拒绝设备被执行时**:用户已在设备侧主动终止该节点的操作(`node_invoke` 返回"用户拒绝设备被执行"),不再通过 `node_invoke` 继续调用**该节点**。这只是对该被拒节点的收敛,不要求停止整个任务——模型仍可继续对话收尾、对其他节点发起 `node_invoke` 或调用其他工具。**作用域仅限当前这轮会话**:下一轮新对话不受影响,可再次对该节点 `node_invoke` 下发工具执行。
|
|
196
|
+
|
|
197
|
+
- 示例:`用户已取消对该设备的本次操作。`
|
|
198
|
+
|
|
194
199
|
**原则**:
|
|
195
200
|
|
|
196
201
|
- 始终包含设备名称
|