@honor-claw/yoyo 2026.7.1-beta.9 → 2026.9.2-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/apis/claw-cloud.mjs +6 -9
- package/dist/capabilities/remote-file/paths.mjs +36 -25
- package/dist/diagnose/collectors/account.mjs +15 -18
- package/dist/gateway/client/auth/index.mjs +0 -1
- package/dist/messaging/dispatchers/stream/controller.mjs +63 -21
- package/dist/messaging/dispatchers/stream/resolvers.mjs +27 -16
- package/dist/messaging/dispatchers/stream/session.mjs +2 -4
- package/dist/messaging/send/text.mjs +8 -2
- package/dist/provisioning/registration/register.mjs +34 -39
- package/dist/tools/remote-file-download/run.mjs +74 -64
- package/dist/tools/remote-file-download/tool.mjs +1 -0
- package/dist/tools/remote-file-upload/helpers.mjs +34 -31
- package/package.json +1 -1
- package/skills/yoyo-file-transfer/SKILL.md +34 -22
- package/skills/yoyo-file-transfer/references/pc-to-phone.md +45 -13
- package/skills/yoyo-file-transfer/references/phone-to-pc.md +61 -20
- package/skills/yoyo-phone-control/SKILL.md +309 -0
- package/skills/yoyo-phone-control/mcptools/airplane_mode.json +1 -1
- package/skills/yoyo-phone-control/mcptools/battery.json +1 -1
- package/skills/yoyo-phone-control/mcptools/bluetooth.json +1 -1
- package/skills/yoyo-phone-control/mcptools/call.json +1 -1
- package/skills/yoyo-phone-control/mcptools/camera.json +1 -4
- package/skills/yoyo-phone-control/mcptools/cancel_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/cancel_countup_timer.json +9 -15
- package/skills/yoyo-phone-control/mcptools/capture_screenshot.json +7 -50
- package/skills/yoyo-phone-control/mcptools/check_alarm.json +1 -1
- package/skills/yoyo-phone-control/mcptools/check_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/check_countup_timer.json +9 -15
- package/skills/yoyo-phone-control/mcptools/check_schedule.json +23 -3
- package/skills/yoyo-phone-control/mcptools/check_todo.json +11 -12
- package/skills/yoyo-phone-control/mcptools/clean_dirty.json +1 -1
- package/skills/yoyo-phone-control/mcptools/close_alarm.json +1 -1
- package/skills/yoyo-phone-control/mcptools/close_app.json +1 -1
- package/skills/yoyo-phone-control/mcptools/close_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/close_countup_timer.json +8 -10
- package/skills/yoyo-phone-control/mcptools/close_ring.json +3 -5
- package/skills/yoyo-phone-control/mcptools/close_schedule.json +3 -5
- package/skills/yoyo-phone-control/mcptools/configure_auto_record.json +66 -0
- package/skills/yoyo-phone-control/mcptools/create_alarm.json +1 -1
- package/skills/yoyo-phone-control/mcptools/create_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/create_countup_timer.json +8 -10
- package/skills/yoyo-phone-control/mcptools/create_schedule.json +26 -2
- package/skills/yoyo-phone-control/mcptools/create_todo.json +21 -5
- package/skills/yoyo-phone-control/mcptools/dark_mode.json +1 -1
- package/skills/yoyo-phone-control/mcptools/delay_ring.json +3 -4
- package/skills/yoyo-phone-control/mcptools/delete_alarm.json +1 -1
- package/skills/yoyo-phone-control/mcptools/delete_schedule.json +14 -2
- package/skills/yoyo-phone-control/mcptools/delete_todo.json +91 -7
- package/skills/yoyo-phone-control/mcptools/express_logistics_query.json +1 -1
- package/skills/yoyo-phone-control/mcptools/eyecomfort.json +1 -1
- package/skills/yoyo-phone-control/mcptools/flashlight.json +1 -1
- package/skills/yoyo-phone-control/mcptools/get_user_location.json +1 -1
- package/skills/yoyo-phone-control/mcptools/gui_task_create.json +1 -1
- package/skills/yoyo-phone-control/mcptools/gui_task_pause.json +1 -1
- package/skills/yoyo-phone-control/mcptools/gui_task_terminate.json +1 -1
- package/skills/yoyo-phone-control/mcptools/hotspot.json +1 -1
- package/skills/yoyo-phone-control/mcptools/hover_button.json +1 -1
- package/skills/yoyo-phone-control/mcptools/jump_video_progress.json +2 -2
- package/skills/yoyo-phone-control/mcptools/location_service.json +2 -2
- package/skills/yoyo-phone-control/mcptools/mobile_data.json +1 -1
- package/skills/yoyo-phone-control/mcptools/modify_alarm.json +31 -9
- package/skills/yoyo-phone-control/mcptools/modify_schedule.json +25 -8
- package/skills/yoyo-phone-control/mcptools/modify_todo.json +94 -6
- package/skills/yoyo-phone-control/mcptools/multi_screen.json +169 -0
- package/skills/yoyo-phone-control/mcptools/musicFeedbackAction.json +1 -1
- package/skills/yoyo-phone-control/mcptools/navigation_service.json +50 -14
- package/skills/yoyo-phone-control/mcptools/nfc.json +2 -2
- package/skills/yoyo-phone-control/mcptools/no_disturb.json +1 -1
- package/skills/yoyo-phone-control/mcptools/onehanded_mode.json +1 -1
- package/skills/yoyo-phone-control/mcptools/open_alarm.json +1 -1
- package/skills/yoyo-phone-control/mcptools/open_app.json +1 -1
- package/skills/yoyo-phone-control/mcptools/open_transport_code.json +1 -1
- package/skills/yoyo-phone-control/mcptools/operateMusic.json +1 -1
- package/skills/yoyo-phone-control/mcptools/operateVideo.json +2 -2
- package/skills/yoyo-phone-control/mcptools/operate_audio.json +1 -1
- package/skills/yoyo-phone-control/mcptools/pause_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/pause_countup_timer.json +9 -15
- package/skills/yoyo-phone-control/mcptools/phone_service.json +83 -0
- package/skills/yoyo-phone-control/mcptools/playMusic.json +1 -1
- package/skills/yoyo-phone-control/mcptools/playVideo.json +1 -1
- package/skills/yoyo-phone-control/mcptools/play_audio.json +1 -1
- package/skills/yoyo-phone-control/mcptools/quiet_mode.json +2 -2
- package/skills/yoyo-phone-control/mcptools/record.json +1 -1
- package/skills/yoyo-phone-control/mcptools/redial_recall.json +7 -14
- package/skills/yoyo-phone-control/mcptools/restart_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/restart_countup_timer.json +9 -7
- package/skills/yoyo-phone-control/mcptools/resume_countdown_timer.json +1 -1
- package/skills/yoyo-phone-control/mcptools/resume_countup_timer.json +9 -19
- package/skills/yoyo-phone-control/mcptools/ringing_mode.json +2 -2
- package/skills/yoyo-phone-control/mcptools/scan_code.json +1 -1
- package/skills/yoyo-phone-control/mcptools/search_call_record.json +80 -0
- package/skills/yoyo-phone-control/mcptools/search_contact.json +1 -1
- package/skills/yoyo-phone-control/mcptools/search_message.json +1 -1
- package/skills/yoyo-phone-control/mcptools/send_message.json +1 -1
- package/skills/yoyo-phone-control/mcptools/setMusicPlayMode.json +1 -1
- package/skills/yoyo-phone-control/mcptools/set_auto_record.json +53 -0
- package/skills/yoyo-phone-control/mcptools/set_specified_number_auto_record.json +77 -0
- package/skills/yoyo-phone-control/mcptools/set_video_clarity.json +2 -2
- package/skills/yoyo-phone-control/mcptools/set_video_play_mode.json +2 -2
- package/skills/yoyo-phone-control/mcptools/set_video_playback_speed.json +2 -2
- package/skills/yoyo-phone-control/mcptools/simple_mode.json +3 -4
- package/skills/yoyo-phone-control/mcptools/sound_and_vibration.json +71 -0
- package/skills/yoyo-phone-control/mcptools/status_bar_show.json +1 -1
- package/skills/yoyo-phone-control/mcptools/switchMusic.json +1 -1
- package/skills/yoyo-phone-control/mcptools/switch_audio.json +1 -1
- package/skills/yoyo-phone-control/mcptools/switch_video.json +2 -2
- package/skills/yoyo-phone-control/mcptools/uninstall_app.json +1 -1
- package/skills/yoyo-phone-control/mcptools/usb_shared_network.json +1 -1
- package/skills/yoyo-phone-control/mcptools/wlan.json +1 -1
- package/skills/yoyo-phone-control/references/local-user-file-search.md +7 -0
- package/dist/gateway/client/auth/gateway-auth.mjs +0 -16
- package/dist/utils/hash.mjs +0 -10
- package/skills/yoyo-file-transfer/references/phone-to-phone.md +0 -117
package/dist/apis/claw-cloud.mjs
CHANGED
|
@@ -10,27 +10,24 @@ var o = class {
|
|
|
10
10
|
constructor(e, t) {
|
|
11
11
|
this.httpClient = new i(e, t);
|
|
12
12
|
}
|
|
13
|
-
async registerDevice(n, r
|
|
14
|
-
let
|
|
13
|
+
async registerDevice(n, r) {
|
|
14
|
+
let i = {
|
|
15
15
|
"x-trace-id": t(),
|
|
16
16
|
"x-jwt-token": r.token,
|
|
17
17
|
"x-device-id": n.deviceId
|
|
18
|
-
},
|
|
18
|
+
}, a = {
|
|
19
19
|
businessTag: "YOYO_CLAW",
|
|
20
20
|
role: "yoyoclaw",
|
|
21
21
|
deviceInfo: {
|
|
22
22
|
...n,
|
|
23
23
|
manufacture: n.manufacture,
|
|
24
24
|
brand: n.brand,
|
|
25
|
-
bizExtInfo: {
|
|
26
|
-
...i,
|
|
27
|
-
pluginVersionCode: String(e())
|
|
28
|
-
}
|
|
25
|
+
bizExtInfo: { pluginVersionCode: String(e()) }
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
28
|
return this.httpClient.post("/v1/device/registry", {
|
|
32
|
-
headers:
|
|
33
|
-
body:
|
|
29
|
+
headers: i,
|
|
30
|
+
body: a
|
|
34
31
|
});
|
|
35
32
|
}
|
|
36
33
|
async logoutDevice(e, n) {
|
|
@@ -1,38 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import r from "node:
|
|
4
|
-
import
|
|
1
|
+
import { toErrorMessage as e } from "../../utils/error.mjs";
|
|
2
|
+
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
|
+
import { existsSync as n, readdirSync as r } from "node:fs";
|
|
4
|
+
import i from "node:path";
|
|
5
|
+
import a from "node:os";
|
|
6
|
+
import { canonicalPathFromExistingAncestor as o, resolveAbsolutePathForRead as s, resolveAbsolutePathForWrite as c, sanitizeUntrustedFileName as l } from "openclaw/plugin-sdk/security-runtime";
|
|
7
|
+
import { ensureAbsoluteDirectory as u } from "openclaw/plugin-sdk/infra-runtime";
|
|
5
8
|
//#region src/capabilities/remote-file/paths.ts
|
|
6
|
-
var
|
|
7
|
-
|
|
9
|
+
var d = t("capabilities");
|
|
10
|
+
function f(e) {
|
|
11
|
+
if (!e) throw Error("path is required");
|
|
12
|
+
if (e.includes("\0")) throw Error("path must not contain NUL bytes");
|
|
13
|
+
if (!i.isAbsolute(e)) throw Error("path must be absolute");
|
|
14
|
+
}
|
|
15
|
+
var p = i.join(a.homedir(), ".openclaw", "downloads");
|
|
16
|
+
async function m(t) {
|
|
8
17
|
try {
|
|
9
|
-
return
|
|
10
|
-
} catch {
|
|
11
|
-
return {
|
|
18
|
+
return f(t), { absolutePath: await o((await s(t)).path) };
|
|
19
|
+
} catch (n) {
|
|
20
|
+
return d.error("resolve read path failed", n, { localPath: t }), {
|
|
12
21
|
error: !0,
|
|
13
|
-
message:
|
|
22
|
+
message: `文件不存在或不可读: ${e(n)}`
|
|
14
23
|
};
|
|
15
24
|
}
|
|
16
25
|
}
|
|
17
|
-
async function
|
|
18
|
-
let r =
|
|
26
|
+
async function h(e, t) {
|
|
27
|
+
let r = e && e.trim().length > 0 ? e : p, i;
|
|
19
28
|
try {
|
|
20
|
-
|
|
29
|
+
f(r), i = (await c(r)).path;
|
|
21
30
|
} catch {
|
|
22
31
|
return {
|
|
23
32
|
ok: !1,
|
|
24
33
|
message: "目标目录路径格式不正确"
|
|
25
34
|
};
|
|
26
35
|
}
|
|
27
|
-
if (
|
|
36
|
+
if (t === !1) return n(i) ? {
|
|
28
37
|
ok: !0,
|
|
29
|
-
dir:
|
|
38
|
+
dir: i
|
|
30
39
|
} : {
|
|
31
40
|
ok: !1,
|
|
32
41
|
message: "目标目录不存在"
|
|
33
42
|
};
|
|
34
43
|
try {
|
|
35
|
-
let e = await
|
|
44
|
+
let e = await u(i);
|
|
36
45
|
return e.ok ? {
|
|
37
46
|
ok: !0,
|
|
38
47
|
dir: e.path
|
|
@@ -47,17 +56,19 @@ async function f(t, n) {
|
|
|
47
56
|
};
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
|
-
function
|
|
51
|
-
let
|
|
59
|
+
function g(e, t) {
|
|
60
|
+
let n = l(e, "download"), r = i.extname(n), a = r ? n.slice(0, -r.length) : n;
|
|
61
|
+
if (!t.has(n)) return n;
|
|
62
|
+
let o = 1;
|
|
63
|
+
for (; t.has(`${a} (${o})${r}`);) o++;
|
|
64
|
+
return `${a} (${o})${r}`;
|
|
65
|
+
}
|
|
66
|
+
function _(e) {
|
|
52
67
|
try {
|
|
53
|
-
|
|
68
|
+
return new Set(r(e));
|
|
54
69
|
} catch {
|
|
55
|
-
return
|
|
70
|
+
return /* @__PURE__ */ new Set();
|
|
56
71
|
}
|
|
57
|
-
if (!s.has(i)) return i;
|
|
58
|
-
let c = 1;
|
|
59
|
-
for (; s.has(`${o} (${c})${a}`);) c++;
|
|
60
|
-
return `${o} (${c})${a}`;
|
|
61
72
|
}
|
|
62
73
|
//#endregion
|
|
63
|
-
export {
|
|
74
|
+
export { p as DEFAULT_DOWNLOAD_DIR, g as nextAvailableName, h as prepareSaveDir, _ as readExistingNames, m as resolveReadPath };
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
import { getPersistedIdentity as e } from "../../modules/configs/identity-persist.mjs";
|
|
2
|
-
import { createGatewayAuthMd5 as t, isSameGatewayAuthMd5 as n } from "../../gateway/client/auth/gateway-auth.mjs";
|
|
3
|
-
import "../../gateway/client/auth/index.mjs";
|
|
4
|
-
import { getGatewayAuthConfig as r } from "../../modules/configs/gateway.mjs";
|
|
5
2
|
import "../../modules/configs/index.mjs";
|
|
6
|
-
import { HonorAccount as
|
|
3
|
+
import { HonorAccount as t } from "../../honor-auth/vault/impl.mjs";
|
|
7
4
|
import "../../honor-auth/vault/index.mjs";
|
|
8
5
|
//#region src/diagnose/collectors/account.ts
|
|
9
|
-
async function
|
|
10
|
-
let
|
|
6
|
+
async function n(n, r, i) {
|
|
7
|
+
let a = new Set(n.enabledAccountIds), o = n.configuredAccountIds.map((e) => ({
|
|
11
8
|
accountId: e,
|
|
12
|
-
enabled:
|
|
13
|
-
})),
|
|
14
|
-
if (!
|
|
15
|
-
let
|
|
9
|
+
enabled: a.has(e)
|
|
10
|
+
})), s = await e(), c = s?.pluginVersionCode !== void 0, l = !!(c && !s?.gatewayAuthMd5 && s?.pluginVersionCode === i);
|
|
11
|
+
if (!r) return { accounts: o };
|
|
12
|
+
let u = await t.fromUser(r).getTokenStatus();
|
|
16
13
|
return {
|
|
17
|
-
accounts:
|
|
14
|
+
accounts: o,
|
|
18
15
|
selected: {
|
|
19
|
-
accountId:
|
|
16
|
+
accountId: r,
|
|
20
17
|
enabled: !0,
|
|
21
|
-
loggedIn:
|
|
22
|
-
token:
|
|
18
|
+
loggedIn: u.status !== "absent",
|
|
19
|
+
token: u,
|
|
23
20
|
registration: {
|
|
24
|
-
registered:
|
|
25
|
-
matchesCurrent:
|
|
26
|
-
...
|
|
21
|
+
registered: c,
|
|
22
|
+
matchesCurrent: l,
|
|
23
|
+
...s?.pluginVersionCode === void 0 ? {} : { pluginVersionCode: s.pluginVersionCode }
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
};
|
|
30
27
|
}
|
|
31
28
|
//#endregion
|
|
32
|
-
export {
|
|
29
|
+
export { n as collectAccount };
|
|
@@ -5,16 +5,16 @@ import { getToolUseTraceSteps as i } from "../../trace/tool.mjs";
|
|
|
5
5
|
import "../../trace/index.mjs";
|
|
6
6
|
import { normalizeAnswerPartial as a, normalizeFinalVisibleText as o } from "../../guard/content.mjs";
|
|
7
7
|
import "../../guard/index.mjs";
|
|
8
|
-
import { finishThinking as s,
|
|
9
|
-
import { captureErrorPayload as
|
|
10
|
-
import { resolveAnswerPartialDelta as
|
|
8
|
+
import { finishThinking as s, pushStreamDelta as c, pushThinkingDelta as l, pushToolEvent as u, pushToolStatus as d } from "./session.mjs";
|
|
9
|
+
import { captureErrorPayload as f } from "./error.mjs";
|
|
10
|
+
import { resolveAnswerPartialDelta as p, resolveThinkingDelta as m, rotateAnswerSegment as h } from "./resolvers.mjs";
|
|
11
11
|
import { buildToolResultEvent as g, buildToolStartEvent as _ } from "./tool/event-builder.mjs";
|
|
12
12
|
//#region src/messaging/dispatchers/stream/controller.ts
|
|
13
|
-
var v = t("dispatcher");
|
|
14
|
-
function
|
|
13
|
+
var v = t("dispatcher"), y = "💬";
|
|
14
|
+
function b(e, t) {
|
|
15
15
|
return e ?? `no-id:${t}`;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
17
|
+
var x = class {
|
|
18
18
|
session;
|
|
19
19
|
includeThinking;
|
|
20
20
|
includeToolCalls;
|
|
@@ -34,7 +34,7 @@ var b = class {
|
|
|
34
34
|
this.emittedToolStartKeys.has(e) || this.enqueueToolStatus(e, t, n);
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
d(this.session, e, t, n);
|
|
38
38
|
}
|
|
39
39
|
enqueueToolStatus(e, t, n) {
|
|
40
40
|
let r = {
|
|
@@ -47,13 +47,13 @@ var b = class {
|
|
|
47
47
|
let t = this.pendingToolStatus.get(e);
|
|
48
48
|
if (t) {
|
|
49
49
|
this.pendingToolStatus.delete(e);
|
|
50
|
-
for (let { status: n, name: r } of t)
|
|
50
|
+
for (let { status: n, name: r } of t) d(this.session, e, r, n);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
emitToolStart(e) {
|
|
54
54
|
if (!this.includeToolCalls || !e.name) return;
|
|
55
|
-
let t =
|
|
56
|
-
this.emittedToolStartKeys.has(t) || (this.emittedToolStartKeys.add(t),
|
|
55
|
+
let t = b(e.toolCallId, e.name);
|
|
56
|
+
this.emittedToolStartKeys.has(t) || (this.emittedToolStartKeys.add(t), u(this.session, _(e)), this.pendingToolKeys.add(t), e.toolCallId && this.flushPendingToolStatus(e.toolCallId), v.debug("tool start emitted", {
|
|
57
57
|
sessionKey: this.session.sessionKey,
|
|
58
58
|
toolName: e.name,
|
|
59
59
|
hasToolCallId: !!e.toolCallId,
|
|
@@ -61,7 +61,7 @@ var b = class {
|
|
|
61
61
|
}));
|
|
62
62
|
}
|
|
63
63
|
emitToolResult(e) {
|
|
64
|
-
this.includeToolCalls && (
|
|
64
|
+
this.includeToolCalls && (u(this.session, g(e)), this.pendingToolKeys.delete(b(e.toolCallId, e.toolName)), e.toolCallId && this.pendingToolStatus.delete(e.toolCallId), this.pendingToolKeys.size === 0 && this.flushPendingReplyPayloads());
|
|
65
65
|
}
|
|
66
66
|
onToolStart = (e) => {
|
|
67
67
|
e.phase && e.phase !== "start" || e.name && this.emitToolStart({
|
|
@@ -72,7 +72,16 @@ var b = class {
|
|
|
72
72
|
};
|
|
73
73
|
handleAfterToolCall(e) {
|
|
74
74
|
let t = this.findLatestFinishedStep(e);
|
|
75
|
-
|
|
75
|
+
if (t) {
|
|
76
|
+
this.emitToolResult(t);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
v.warn("tool result frame skipped, no finished step", {
|
|
80
|
+
sessionKey: this.session.sessionKey,
|
|
81
|
+
chatId: this.session.chatId,
|
|
82
|
+
hasToolCallId: !!e,
|
|
83
|
+
pendingTools: this.pendingToolKeys.size
|
|
84
|
+
});
|
|
76
85
|
}
|
|
77
86
|
findLatestFinishedStep(e) {
|
|
78
87
|
let t = i(this.session.chatId);
|
|
@@ -99,16 +108,16 @@ var b = class {
|
|
|
99
108
|
this.pendingReplyPayloads.push(n);
|
|
100
109
|
return;
|
|
101
110
|
}
|
|
102
|
-
let r =
|
|
103
|
-
r &&
|
|
111
|
+
let r = p(this.session, n);
|
|
112
|
+
r && c(this.session, r);
|
|
104
113
|
};
|
|
105
114
|
async drainPendingReplyPayloads() {
|
|
106
115
|
if (this.pendingReplyPayloads.length === 0) return;
|
|
107
116
|
let e = this.pendingReplyPayloads;
|
|
108
117
|
this.pendingReplyPayloads = [];
|
|
109
118
|
for (let t of e) {
|
|
110
|
-
let e =
|
|
111
|
-
e && await
|
|
119
|
+
let e = p(this.session, t);
|
|
120
|
+
e && await c(this.session, e);
|
|
112
121
|
}
|
|
113
122
|
}
|
|
114
123
|
flushPendingReplyPayloads() {
|
|
@@ -116,20 +125,52 @@ var b = class {
|
|
|
116
125
|
}
|
|
117
126
|
onReasoningStream = (e) => {
|
|
118
127
|
if (!this.includeThinking) return;
|
|
119
|
-
let t =
|
|
120
|
-
t &&
|
|
128
|
+
let t = m(this.session, e);
|
|
129
|
+
t && l(this.session, t);
|
|
121
130
|
};
|
|
122
131
|
onReasoningEnd = () => {
|
|
123
132
|
this.includeThinking && s(this.session);
|
|
124
133
|
};
|
|
134
|
+
rescueCommentaryProgress(e) {
|
|
135
|
+
if (typeof e != "string" || !e.startsWith(y)) return;
|
|
136
|
+
let t = e.slice(2).trimStart(), n = this.session.answerSnapshot;
|
|
137
|
+
if (!t || n.startsWith(t)) return;
|
|
138
|
+
if (this.pendingReplyPayloads.length > 0) {
|
|
139
|
+
v.warn("commentary rescue skipped: pending reply payloads", {
|
|
140
|
+
sessionKey: this.session.sessionKey,
|
|
141
|
+
pending: this.pendingReplyPayloads.length
|
|
142
|
+
});
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
let r = t.startsWith(n) ? t.slice(n.length) : t;
|
|
146
|
+
h(this.session, t), c(this.session, r);
|
|
147
|
+
}
|
|
148
|
+
async pushFinalAnswerDiff(e) {
|
|
149
|
+
if (!e) return;
|
|
150
|
+
let t = 0;
|
|
151
|
+
for (let n of [this.session.answerSnapshot, this.session.prevAnswerSnapshot]) if (n) {
|
|
152
|
+
if (n.startsWith(e)) return;
|
|
153
|
+
for (let r of [n, n.trim()]) r && e.startsWith(r) && r.length > t && (t = r.length);
|
|
154
|
+
}
|
|
155
|
+
t >= e.length || (t === 0 && v.debug("final diff full push, no covered segment", {
|
|
156
|
+
sessionKey: this.session.sessionKey,
|
|
157
|
+
textLen: e.length,
|
|
158
|
+
snapshotLen: this.session.answerSnapshot.length,
|
|
159
|
+
prevLen: this.session.prevAnswerSnapshot.length
|
|
160
|
+
}), h(this.session, e), await c(this.session, e.slice(t)));
|
|
161
|
+
}
|
|
125
162
|
deliver = async (e, t) => {
|
|
126
|
-
if (t.kind
|
|
163
|
+
if (t.kind === "tool") {
|
|
164
|
+
this.rescueCommentaryProgress(e.text);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!f(this.session, e) && e.isReasoning !== !0 && t.kind === "final") {
|
|
127
168
|
let t = o(e.text ?? "");
|
|
128
169
|
if (this.isGated) {
|
|
129
170
|
this.pendingReplyPayloads.push({ text: t });
|
|
130
171
|
return;
|
|
131
172
|
}
|
|
132
|
-
await this.flushPendingReplyPayloads(), await
|
|
173
|
+
await this.flushPendingReplyPayloads(), await this.pushFinalAnswerDiff(t);
|
|
133
174
|
}
|
|
134
175
|
};
|
|
135
176
|
onError = (t) => {
|
|
@@ -156,6 +197,7 @@ var b = class {
|
|
|
156
197
|
onAgentRunStart: (e) => {
|
|
157
198
|
n(this.session.chatId, "dispatched"), r(this.session.chatId, e);
|
|
158
199
|
},
|
|
200
|
+
suppressToolErrorWarnings: !0,
|
|
159
201
|
...this.includeThinking ? {
|
|
160
202
|
onReasoningStream: this.onReasoningStream,
|
|
161
203
|
onReasoningEnd: this.onReasoningEnd
|
|
@@ -166,4 +208,4 @@ var b = class {
|
|
|
166
208
|
}
|
|
167
209
|
};
|
|
168
210
|
//#endregion
|
|
169
|
-
export {
|
|
211
|
+
export { x as StreamingController };
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
+
import { clawLogger as e } from "../../../utils/claw-logger.mjs";
|
|
1
2
|
//#region src/messaging/dispatchers/stream/resolvers.ts
|
|
2
|
-
|
|
3
|
+
var t = e("dispatcher");
|
|
4
|
+
function n(e, t) {
|
|
3
5
|
return t.length < e.length || !t.startsWith(e);
|
|
4
6
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
if (typeof n.text != "string" || n.text.length === 0) return "";
|
|
8
|
-
if (n.replace) return t.answerSnapshot = n.text, "";
|
|
9
|
-
if (e(t.answerSnapshot, n.text)) return t.answerSnapshot = n.text, n.text;
|
|
10
|
-
let r = n.text.slice(t.answerSnapshot.length);
|
|
11
|
-
return t.answerSnapshot = n.text, r;
|
|
7
|
+
function r(e, t) {
|
|
8
|
+
e.prevAnswerSnapshot = e.answerSnapshot, e.answerSnapshot = t;
|
|
12
9
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
10
|
+
function i(e, i) {
|
|
11
|
+
if (i.delta) return typeof i.text == "string" ? e.answerSnapshot = i.text : e.answerSnapshot += i.delta, i.delta;
|
|
12
|
+
if (typeof i.text != "string" || i.text.length === 0) return "";
|
|
13
|
+
if (i.replace) return t.debug("answer partial dropped: replace frame", {
|
|
14
|
+
sessionKey: e.sessionKey,
|
|
15
|
+
chatId: e.chatId,
|
|
16
|
+
snapshotLen: e.answerSnapshot.length,
|
|
17
|
+
textLen: i.text.length,
|
|
18
|
+
textHead: i.text.slice(0, 16)
|
|
19
|
+
}), r(e, i.text), "";
|
|
20
|
+
if (n(e.answerSnapshot, i.text)) return r(e, i.text), i.text;
|
|
21
|
+
let a = i.text.slice(e.answerSnapshot.length);
|
|
22
|
+
return e.answerSnapshot = i.text, a;
|
|
23
|
+
}
|
|
24
|
+
function a(e, t) {
|
|
25
|
+
let r = t.text ?? "";
|
|
15
26
|
if (!r) return "";
|
|
16
|
-
if (
|
|
17
|
-
if (e
|
|
18
|
-
let
|
|
19
|
-
return
|
|
27
|
+
if (t.isReasoningSnapshot) {
|
|
28
|
+
if (n(e.thinkingSnapshot, r)) return e.thinkingSnapshot = r, r;
|
|
29
|
+
let t = r.slice(e.thinkingSnapshot.length);
|
|
30
|
+
return e.thinkingSnapshot = r, t;
|
|
20
31
|
}
|
|
21
|
-
return
|
|
32
|
+
return e.thinkingSnapshot += r, r;
|
|
22
33
|
}
|
|
23
34
|
//#endregion
|
|
24
|
-
export {
|
|
35
|
+
export { i as resolveAnswerPartialDelta, a as resolveThinkingDelta, r as rotateAnswerSegment };
|
|
@@ -26,6 +26,7 @@ function c(e) {
|
|
|
26
26
|
silent: e.silent ?? !1,
|
|
27
27
|
contentGuard: r(),
|
|
28
28
|
answerSnapshot: "",
|
|
29
|
+
prevAnswerSnapshot: "",
|
|
29
30
|
thinkingSnapshot: "",
|
|
30
31
|
hasPushedAnswerText: !1,
|
|
31
32
|
hasPushedThinkingText: !1
|
|
@@ -130,8 +131,5 @@ async function h(r, i) {
|
|
|
130
131
|
async function g(e) {
|
|
131
132
|
e.finished || (e.error && await u(e, e.answerSnapshot ? `\n${e.error.userMessage}` : e.error.userMessage), await h(e, "reply_completed"));
|
|
132
133
|
}
|
|
133
|
-
async function _(e, t) {
|
|
134
|
-
e.hasPushedAnswerText || await u(e, t);
|
|
135
|
-
}
|
|
136
134
|
//#endregion
|
|
137
|
-
export { c as createStreamSession, g as finishStreamSession, f as finishThinking,
|
|
135
|
+
export { c as createStreamSession, g as finishStreamSession, f as finishThinking, u as pushStreamDelta, d as pushThinkingDelta, p as pushToolEvent, m as pushToolStatus, s as setSessionError, l as startStreamSession };
|
|
@@ -10,7 +10,10 @@ async function a(a) {
|
|
|
10
10
|
if (c.length === 0) return {
|
|
11
11
|
channel: e,
|
|
12
12
|
messageId: "",
|
|
13
|
-
|
|
13
|
+
target: {
|
|
14
|
+
kind: "chat",
|
|
15
|
+
id: s
|
|
16
|
+
}
|
|
14
17
|
};
|
|
15
18
|
let l = t();
|
|
16
19
|
return {
|
|
@@ -29,7 +32,10 @@ async function a(a) {
|
|
|
29
32
|
turnId: l
|
|
30
33
|
}
|
|
31
34
|
}) ?? "",
|
|
32
|
-
|
|
35
|
+
target: {
|
|
36
|
+
kind: "chat",
|
|
37
|
+
id: s
|
|
38
|
+
}
|
|
33
39
|
};
|
|
34
40
|
}
|
|
35
41
|
//#endregion
|
|
@@ -1,66 +1,61 @@
|
|
|
1
1
|
import { getYoyoPluginVersionCode as e } from "../../utils/version.mjs";
|
|
2
2
|
import { clawLogger as t } from "../../utils/claw-logger.mjs";
|
|
3
3
|
import { getPersistedIdentity as n, updatePersistedIdentity as r } from "../../modules/configs/identity-persist.mjs";
|
|
4
|
-
import { formatHashForLog as i } from "../../utils/hash.mjs";
|
|
5
|
-
import { createGatewayAuthMd5 as a, isSameGatewayAuthMd5 as o } from "../../gateway/client/auth/gateway-auth.mjs";
|
|
6
|
-
import "../../gateway/client/auth/index.mjs";
|
|
7
|
-
import { getGatewayAuthConfig as s } from "../../modules/configs/gateway.mjs";
|
|
8
4
|
import "../../modules/configs/index.mjs";
|
|
9
|
-
import { HonorAccount as
|
|
10
|
-
import { isOKResponse as
|
|
11
|
-
import { createClawCloudClient as
|
|
12
|
-
import { loadDeviceInfo as
|
|
5
|
+
import { HonorAccount as i } from "../../honor-auth/vault/impl.mjs";
|
|
6
|
+
import { isOKResponse as a } from "../../apis/helpers.mjs";
|
|
7
|
+
import { createClawCloudClient as o } from "../../apis/claw-cloud.mjs";
|
|
8
|
+
import { loadDeviceInfo as s } from "../../modules/device/device-info.mjs";
|
|
13
9
|
import "../../modules/device/index.mjs";
|
|
14
10
|
import "../../honor-auth/vault/index.mjs";
|
|
15
11
|
import "../../apis/index.mjs";
|
|
16
12
|
//#region src/provisioning/registration/register.ts
|
|
17
|
-
var
|
|
18
|
-
async function
|
|
13
|
+
var c = t("registration"), l = /* @__PURE__ */ new Map();
|
|
14
|
+
async function u(t, n) {
|
|
19
15
|
if (!t || !n) throw Error("设备信息或用户信息缺失");
|
|
20
|
-
let r =
|
|
21
|
-
if (!
|
|
22
|
-
await
|
|
16
|
+
let r = e(), i = await o().registerDevice(t, n);
|
|
17
|
+
if (!a(i)) throw Error(`注册失败:${i.data?.cnMessage}`);
|
|
18
|
+
await f(r);
|
|
23
19
|
}
|
|
24
|
-
async function
|
|
25
|
-
let r =
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
f.info("registration state unchanged, skipping device registration");
|
|
20
|
+
async function d(t) {
|
|
21
|
+
let r = e(), i = await n(), a = i?.gatewayAuthMd5, o = i?.pluginVersionCode;
|
|
22
|
+
if (c.info("checking registration state", {
|
|
23
|
+
gatewayAuthPushed: !!a,
|
|
24
|
+
pluginVersionCodeCurrent: r,
|
|
25
|
+
pluginVersionCodePersisted: o ?? "none"
|
|
26
|
+
}), !a && o === r) {
|
|
27
|
+
c.info("registration state unchanged, skipping device registration");
|
|
33
28
|
return;
|
|
34
29
|
}
|
|
35
|
-
|
|
30
|
+
a && c.info("legacy registration pushed gateway credentials, re-registering without them"), c.info("registration state changed, registering device"), await u(await s(), t), c.info("device registration succeeded", { pluginVersionCode: r });
|
|
36
31
|
}
|
|
37
|
-
async function
|
|
32
|
+
async function f(e) {
|
|
38
33
|
try {
|
|
39
34
|
await r({
|
|
40
|
-
gatewayAuthMd5:
|
|
41
|
-
pluginVersionCode:
|
|
42
|
-
}),
|
|
35
|
+
gatewayAuthMd5: void 0,
|
|
36
|
+
pluginVersionCode: e
|
|
37
|
+
}), c.info("registration state persisted after device registration");
|
|
43
38
|
} catch (e) {
|
|
44
|
-
|
|
39
|
+
c.warn("failed to persist registration state", { error: String(e) });
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
|
-
async function
|
|
48
|
-
let t =
|
|
49
|
-
if (t) return
|
|
42
|
+
async function p(e) {
|
|
43
|
+
let t = l.get(e);
|
|
44
|
+
if (t) return c.warn("re-registration already in progress for account, skipping", { accountId: e }), t;
|
|
50
45
|
let n = (async () => {
|
|
51
|
-
let t =
|
|
46
|
+
let t = i.fromUser(e);
|
|
52
47
|
try {
|
|
53
48
|
let n = await t.current();
|
|
54
|
-
if (!n?.token) return
|
|
55
|
-
let r = await
|
|
56
|
-
return
|
|
49
|
+
if (!n?.token) return c.warn("no matching token available during device re-registration", { expectedAccountId: e }), await t.clear(), !1;
|
|
50
|
+
let r = await s();
|
|
51
|
+
return c.info("attempting to re-register device", { deviceId: r.deviceId }), await u(r, n), c.info("device re-registered successfully, awaiting cloud-socket retry"), !0;
|
|
57
52
|
} catch (e) {
|
|
58
|
-
return
|
|
53
|
+
return c.error("device re-registration failed, clearing credentials", e), await t.clear(), !1;
|
|
59
54
|
} finally {
|
|
60
|
-
|
|
55
|
+
l.delete(e);
|
|
61
56
|
}
|
|
62
57
|
})();
|
|
63
|
-
return
|
|
58
|
+
return l.set(e, n), n;
|
|
64
59
|
}
|
|
65
60
|
//#endregion
|
|
66
|
-
export {
|
|
61
|
+
export { u as registerDevice, d as registerDeviceIfRegistrationStateChanged, p as reregisterDevice };
|