@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.
Files changed (113) hide show
  1. package/dist/apis/claw-cloud.mjs +6 -9
  2. package/dist/capabilities/remote-file/paths.mjs +36 -25
  3. package/dist/diagnose/collectors/account.mjs +15 -18
  4. package/dist/gateway/client/auth/index.mjs +0 -1
  5. package/dist/messaging/dispatchers/stream/controller.mjs +63 -21
  6. package/dist/messaging/dispatchers/stream/resolvers.mjs +27 -16
  7. package/dist/messaging/dispatchers/stream/session.mjs +2 -4
  8. package/dist/messaging/send/text.mjs +8 -2
  9. package/dist/provisioning/registration/register.mjs +34 -39
  10. package/dist/tools/remote-file-download/run.mjs +74 -64
  11. package/dist/tools/remote-file-download/tool.mjs +1 -0
  12. package/dist/tools/remote-file-upload/helpers.mjs +34 -31
  13. package/package.json +1 -1
  14. package/skills/yoyo-file-transfer/SKILL.md +34 -22
  15. package/skills/yoyo-file-transfer/references/pc-to-phone.md +45 -13
  16. package/skills/yoyo-file-transfer/references/phone-to-pc.md +61 -20
  17. package/skills/yoyo-phone-control/SKILL.md +309 -0
  18. package/skills/yoyo-phone-control/mcptools/airplane_mode.json +1 -1
  19. package/skills/yoyo-phone-control/mcptools/battery.json +1 -1
  20. package/skills/yoyo-phone-control/mcptools/bluetooth.json +1 -1
  21. package/skills/yoyo-phone-control/mcptools/call.json +1 -1
  22. package/skills/yoyo-phone-control/mcptools/camera.json +1 -4
  23. package/skills/yoyo-phone-control/mcptools/cancel_countdown_timer.json +1 -1
  24. package/skills/yoyo-phone-control/mcptools/cancel_countup_timer.json +9 -15
  25. package/skills/yoyo-phone-control/mcptools/capture_screenshot.json +7 -50
  26. package/skills/yoyo-phone-control/mcptools/check_alarm.json +1 -1
  27. package/skills/yoyo-phone-control/mcptools/check_countdown_timer.json +1 -1
  28. package/skills/yoyo-phone-control/mcptools/check_countup_timer.json +9 -15
  29. package/skills/yoyo-phone-control/mcptools/check_schedule.json +23 -3
  30. package/skills/yoyo-phone-control/mcptools/check_todo.json +11 -12
  31. package/skills/yoyo-phone-control/mcptools/clean_dirty.json +1 -1
  32. package/skills/yoyo-phone-control/mcptools/close_alarm.json +1 -1
  33. package/skills/yoyo-phone-control/mcptools/close_app.json +1 -1
  34. package/skills/yoyo-phone-control/mcptools/close_countdown_timer.json +1 -1
  35. package/skills/yoyo-phone-control/mcptools/close_countup_timer.json +8 -10
  36. package/skills/yoyo-phone-control/mcptools/close_ring.json +3 -5
  37. package/skills/yoyo-phone-control/mcptools/close_schedule.json +3 -5
  38. package/skills/yoyo-phone-control/mcptools/configure_auto_record.json +66 -0
  39. package/skills/yoyo-phone-control/mcptools/create_alarm.json +1 -1
  40. package/skills/yoyo-phone-control/mcptools/create_countdown_timer.json +1 -1
  41. package/skills/yoyo-phone-control/mcptools/create_countup_timer.json +8 -10
  42. package/skills/yoyo-phone-control/mcptools/create_schedule.json +26 -2
  43. package/skills/yoyo-phone-control/mcptools/create_todo.json +21 -5
  44. package/skills/yoyo-phone-control/mcptools/dark_mode.json +1 -1
  45. package/skills/yoyo-phone-control/mcptools/delay_ring.json +3 -4
  46. package/skills/yoyo-phone-control/mcptools/delete_alarm.json +1 -1
  47. package/skills/yoyo-phone-control/mcptools/delete_schedule.json +14 -2
  48. package/skills/yoyo-phone-control/mcptools/delete_todo.json +91 -7
  49. package/skills/yoyo-phone-control/mcptools/express_logistics_query.json +1 -1
  50. package/skills/yoyo-phone-control/mcptools/eyecomfort.json +1 -1
  51. package/skills/yoyo-phone-control/mcptools/flashlight.json +1 -1
  52. package/skills/yoyo-phone-control/mcptools/get_user_location.json +1 -1
  53. package/skills/yoyo-phone-control/mcptools/gui_task_create.json +1 -1
  54. package/skills/yoyo-phone-control/mcptools/gui_task_pause.json +1 -1
  55. package/skills/yoyo-phone-control/mcptools/gui_task_terminate.json +1 -1
  56. package/skills/yoyo-phone-control/mcptools/hotspot.json +1 -1
  57. package/skills/yoyo-phone-control/mcptools/hover_button.json +1 -1
  58. package/skills/yoyo-phone-control/mcptools/jump_video_progress.json +2 -2
  59. package/skills/yoyo-phone-control/mcptools/location_service.json +2 -2
  60. package/skills/yoyo-phone-control/mcptools/mobile_data.json +1 -1
  61. package/skills/yoyo-phone-control/mcptools/modify_alarm.json +31 -9
  62. package/skills/yoyo-phone-control/mcptools/modify_schedule.json +25 -8
  63. package/skills/yoyo-phone-control/mcptools/modify_todo.json +94 -6
  64. package/skills/yoyo-phone-control/mcptools/multi_screen.json +169 -0
  65. package/skills/yoyo-phone-control/mcptools/musicFeedbackAction.json +1 -1
  66. package/skills/yoyo-phone-control/mcptools/navigation_service.json +50 -14
  67. package/skills/yoyo-phone-control/mcptools/nfc.json +2 -2
  68. package/skills/yoyo-phone-control/mcptools/no_disturb.json +1 -1
  69. package/skills/yoyo-phone-control/mcptools/onehanded_mode.json +1 -1
  70. package/skills/yoyo-phone-control/mcptools/open_alarm.json +1 -1
  71. package/skills/yoyo-phone-control/mcptools/open_app.json +1 -1
  72. package/skills/yoyo-phone-control/mcptools/open_transport_code.json +1 -1
  73. package/skills/yoyo-phone-control/mcptools/operateMusic.json +1 -1
  74. package/skills/yoyo-phone-control/mcptools/operateVideo.json +2 -2
  75. package/skills/yoyo-phone-control/mcptools/operate_audio.json +1 -1
  76. package/skills/yoyo-phone-control/mcptools/pause_countdown_timer.json +1 -1
  77. package/skills/yoyo-phone-control/mcptools/pause_countup_timer.json +9 -15
  78. package/skills/yoyo-phone-control/mcptools/phone_service.json +83 -0
  79. package/skills/yoyo-phone-control/mcptools/playMusic.json +1 -1
  80. package/skills/yoyo-phone-control/mcptools/playVideo.json +1 -1
  81. package/skills/yoyo-phone-control/mcptools/play_audio.json +1 -1
  82. package/skills/yoyo-phone-control/mcptools/quiet_mode.json +2 -2
  83. package/skills/yoyo-phone-control/mcptools/record.json +1 -1
  84. package/skills/yoyo-phone-control/mcptools/redial_recall.json +7 -14
  85. package/skills/yoyo-phone-control/mcptools/restart_countdown_timer.json +1 -1
  86. package/skills/yoyo-phone-control/mcptools/restart_countup_timer.json +9 -7
  87. package/skills/yoyo-phone-control/mcptools/resume_countdown_timer.json +1 -1
  88. package/skills/yoyo-phone-control/mcptools/resume_countup_timer.json +9 -19
  89. package/skills/yoyo-phone-control/mcptools/ringing_mode.json +2 -2
  90. package/skills/yoyo-phone-control/mcptools/scan_code.json +1 -1
  91. package/skills/yoyo-phone-control/mcptools/search_call_record.json +80 -0
  92. package/skills/yoyo-phone-control/mcptools/search_contact.json +1 -1
  93. package/skills/yoyo-phone-control/mcptools/search_message.json +1 -1
  94. package/skills/yoyo-phone-control/mcptools/send_message.json +1 -1
  95. package/skills/yoyo-phone-control/mcptools/setMusicPlayMode.json +1 -1
  96. package/skills/yoyo-phone-control/mcptools/set_auto_record.json +53 -0
  97. package/skills/yoyo-phone-control/mcptools/set_specified_number_auto_record.json +77 -0
  98. package/skills/yoyo-phone-control/mcptools/set_video_clarity.json +2 -2
  99. package/skills/yoyo-phone-control/mcptools/set_video_play_mode.json +2 -2
  100. package/skills/yoyo-phone-control/mcptools/set_video_playback_speed.json +2 -2
  101. package/skills/yoyo-phone-control/mcptools/simple_mode.json +3 -4
  102. package/skills/yoyo-phone-control/mcptools/sound_and_vibration.json +71 -0
  103. package/skills/yoyo-phone-control/mcptools/status_bar_show.json +1 -1
  104. package/skills/yoyo-phone-control/mcptools/switchMusic.json +1 -1
  105. package/skills/yoyo-phone-control/mcptools/switch_audio.json +1 -1
  106. package/skills/yoyo-phone-control/mcptools/switch_video.json +2 -2
  107. package/skills/yoyo-phone-control/mcptools/uninstall_app.json +1 -1
  108. package/skills/yoyo-phone-control/mcptools/usb_shared_network.json +1 -1
  109. package/skills/yoyo-phone-control/mcptools/wlan.json +1 -1
  110. package/skills/yoyo-phone-control/references/local-user-file-search.md +7 -0
  111. package/dist/gateway/client/auth/gateway-auth.mjs +0 -16
  112. package/dist/utils/hash.mjs +0 -10
  113. package/skills/yoyo-file-transfer/references/phone-to-phone.md +0 -117
@@ -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, i) {
14
- let a = {
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
- }, o = {
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: a,
33
- body: o
29
+ headers: i,
30
+ body: a
34
31
  });
35
32
  }
36
33
  async logoutDevice(e, n) {
@@ -1,38 +1,47 @@
1
- import { existsSync as e, readdirSync as t } from "node:fs";
2
- import n from "node:path";
3
- import r from "node:os";
4
- import { assertAbsolutePathInput as i, canonicalPathFromExistingAncestor as a, ensureAbsoluteDirectory as o, resolveAbsolutePathForRead as s, resolveAbsolutePathForWrite as c, sanitizeUntrustedFileName as l } from "openclaw/plugin-sdk/security-runtime";
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 u = n.join(r.homedir(), ".openclaw", "downloads");
7
- async function d(e) {
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 i(e), { absolutePath: await a((await s(e)).path) };
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 f(t, n) {
18
- let r = t && t.trim().length > 0 ? t : u, a;
26
+ async function h(e, t) {
27
+ let r = e && e.trim().length > 0 ? e : p, i;
19
28
  try {
20
- i(r), a = (await c(r)).path;
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 (n === !1) return e(a) ? {
36
+ if (t === !1) return n(i) ? {
28
37
  ok: !0,
29
- dir: a
38
+ dir: i
30
39
  } : {
31
40
  ok: !1,
32
41
  message: "目标目录不存在"
33
42
  };
34
43
  try {
35
- let e = await o(a);
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 p(e, r) {
51
- let i = l(r, "download"), a = n.extname(i), o = a ? i.slice(0, -a.length) : i, s;
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
- s = new Set(t(e));
68
+ return new Set(r(e));
54
69
  } catch {
55
- return i;
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 { u as DEFAULT_DOWNLOAD_DIR, p as nextAvailableFileName, f as prepareSaveDir, d as resolveReadPath };
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 i } from "../../honor-auth/vault/impl.mjs";
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 a(a, o, s) {
10
- let c = new Set(a.enabledAccountIds), l = a.configuredAccountIds.map((e) => ({
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: c.has(e)
13
- })), u = await e(), d = t(r()), f = !!(u?.gatewayAuthMd5 && u.pluginVersionCode !== void 0), p = !!(f && n(u?.gatewayAuthMd5, d) && u?.pluginVersionCode === s);
14
- if (!o) return { accounts: l };
15
- let m = await i.fromUser(o).getTokenStatus();
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: l,
14
+ accounts: o,
18
15
  selected: {
19
- accountId: o,
16
+ accountId: r,
20
17
  enabled: !0,
21
- loggedIn: m.status !== "absent",
22
- token: m,
18
+ loggedIn: u.status !== "absent",
19
+ token: u,
23
20
  registration: {
24
- registered: f,
25
- matchesCurrent: p,
26
- ...u?.pluginVersionCode === void 0 ? {} : { pluginVersionCode: u.pluginVersionCode }
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 { a as collectAccount };
29
+ export { n as collectAccount };
@@ -1,3 +1,2 @@
1
1
  import "./payload.mjs";
2
2
  import "./credential-builder.mjs";
3
- import "./gateway-auth.mjs";
@@ -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, pushFinalVisibleText as c, pushStreamDelta as l, pushThinkingDelta as u, pushToolEvent as d, pushToolStatus as f } from "./session.mjs";
9
- import { captureErrorPayload as p } from "./error.mjs";
10
- import { resolveAnswerPartialDelta as m, resolveThinkingDelta as h } from "./resolvers.mjs";
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 y(e, t) {
13
+ var v = t("dispatcher"), y = "💬";
14
+ function b(e, t) {
15
15
  return e ?? `no-id:${t}`;
16
16
  }
17
- var b = class {
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
- f(this.session, e, t, n);
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) f(this.session, e, r, n);
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 = y(e.toolCallId, e.name);
56
- this.emittedToolStartKeys.has(t) || (this.emittedToolStartKeys.add(t), d(this.session, _(e)), this.pendingToolKeys.add(t), e.toolCallId && this.flushPendingToolStatus(e.toolCallId), v.debug("tool start emitted", {
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 && (d(this.session, g(e)), this.pendingToolKeys.delete(y(e.toolCallId, e.toolName)), e.toolCallId && this.pendingToolStatus.delete(e.toolCallId), this.pendingToolKeys.size === 0 && this.flushPendingReplyPayloads());
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
- t && this.emitToolResult(t);
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 = m(this.session, n);
103
- r && l(this.session, 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 = m(this.session, t);
111
- e && await l(this.session, e);
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 = h(this.session, e);
120
- t && u(this.session, 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 !== "tool" && !p(this.session, e) && e.isReasoning !== !0 && t.kind === "final") {
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 c(this.session, t);
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 { b as StreamingController };
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
- function e(e, t) {
3
+ var t = e("dispatcher");
4
+ function n(e, t) {
3
5
  return t.length < e.length || !t.startsWith(e);
4
6
  }
5
- function t(t, n) {
6
- if (n.delta) return typeof n.text == "string" ? t.answerSnapshot = n.text : t.answerSnapshot += n.delta, n.delta;
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 n(t, n) {
14
- let r = n.text ?? "";
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 (n.isReasoningSnapshot) {
17
- if (e(t.thinkingSnapshot, r)) return t.thinkingSnapshot = r, r;
18
- let n = r.slice(t.thinkingSnapshot.length);
19
- return t.thinkingSnapshot = r, n;
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 t.thinkingSnapshot += r, r;
32
+ return e.thinkingSnapshot += r, r;
22
33
  }
23
34
  //#endregion
24
- export { t as resolveAnswerPartialDelta, n as resolveThinkingDelta };
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, _ as pushFinalVisibleText, u as pushStreamDelta, d as pushThinkingDelta, p as pushToolEvent, m as pushToolStatus, s as setSessionError, l as startStreamSession };
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
- chatId: s
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
- chatId: s
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 c } from "../../honor-auth/vault/impl.mjs";
10
- import { isOKResponse as l } from "../../apis/helpers.mjs";
11
- import { createClawCloudClient as u } from "../../apis/claw-cloud.mjs";
12
- import { loadDeviceInfo as d } from "../../modules/device/device-info.mjs";
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 f = t("registration"), p = /* @__PURE__ */ new Map();
18
- async function m(t, n) {
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 = s(), i = a(r), o = e(), c = await u().registerDevice(t, n, r);
21
- if (!l(c)) throw Error(`注册失败:${c.data?.cnMessage}`);
22
- await g(i, o);
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 h(t) {
25
- let r = a(s()), c = e(), l = await n(), u = l?.gatewayAuthMd5, p = l?.pluginVersionCode;
26
- if (f.info("checking registration state", {
27
- gatewayAuthCurrent: i(r),
28
- gatewayAuthPersisted: i(u),
29
- pluginVersionCodeCurrent: c,
30
- pluginVersionCodePersisted: p ?? "none"
31
- }), o(u, r) && p === c) {
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
- f.info("registration state changed, registering device"), await m(await d(), t), f.info("device registration succeeded", { pluginVersionCode: c });
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 g(e, t) {
32
+ async function f(e) {
38
33
  try {
39
34
  await r({
40
- gatewayAuthMd5: e,
41
- pluginVersionCode: t
42
- }), f.info("registration state persisted after device registration");
35
+ gatewayAuthMd5: void 0,
36
+ pluginVersionCode: e
37
+ }), c.info("registration state persisted after device registration");
43
38
  } catch (e) {
44
- f.warn("failed to persist registration state", { error: String(e) });
39
+ c.warn("failed to persist registration state", { error: String(e) });
45
40
  }
46
41
  }
47
- async function _(e) {
48
- let t = p.get(e);
49
- if (t) return f.warn("re-registration already in progress for account, skipping", { accountId: e }), t;
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 = c.fromUser(e);
46
+ let t = i.fromUser(e);
52
47
  try {
53
48
  let n = await t.current();
54
- if (!n?.token) return f.warn("no matching token available during device re-registration", { expectedAccountId: e }), await t.clear(), !1;
55
- let r = await d();
56
- return f.info("attempting to re-register device", { deviceId: r.deviceId }), await m(r, n), f.info("device re-registered successfully, awaiting cloud-socket retry"), !0;
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 f.error("device re-registration failed, clearing credentials", e), await t.clear(), !1;
53
+ return c.error("device re-registration failed, clearing credentials", e), await t.clear(), !1;
59
54
  } finally {
60
- p.delete(e);
55
+ l.delete(e);
61
56
  }
62
57
  })();
63
- return p.set(e, n), n;
58
+ return l.set(e, n), n;
64
59
  }
65
60
  //#endregion
66
- export { m as registerDevice, h as registerDeviceIfRegistrationStateChanged, _ as reregisterDevice };
61
+ export { u as registerDevice, d as registerDeviceIfRegistrationStateChanged, p as reregisterDevice };