visionclaw 0.1.217 → 0.1.218-beta.0

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 (180) hide show
  1. package/dist/agent/engines/pi/tools.d.ts.map +1 -1
  2. package/dist/agent/engines/pi/tools.js +2 -1
  3. package/dist/agent/engines/pi/tools.js.map +1 -1
  4. package/dist/agent/fast-response-eligibility.d.ts.map +1 -1
  5. package/dist/agent/fast-response-eligibility.js +3 -0
  6. package/dist/agent/fast-response-eligibility.js.map +1 -1
  7. package/dist/agent/fund-league-hold.d.ts +1 -1
  8. package/dist/agent/fund-league-hold.d.ts.map +1 -1
  9. package/dist/agent/fund-league-hold.js +11 -1
  10. package/dist/agent/fund-league-hold.js.map +1 -1
  11. package/dist/agent/heartbeat-manager.d.ts +4 -0
  12. package/dist/agent/heartbeat-manager.d.ts.map +1 -1
  13. package/dist/agent/heartbeat-manager.js +56 -0
  14. package/dist/agent/heartbeat-manager.js.map +1 -1
  15. package/dist/agent/interrupt-handler.d.ts +0 -2
  16. package/dist/agent/interrupt-handler.d.ts.map +1 -1
  17. package/dist/agent/interrupt-handler.js +0 -4
  18. package/dist/agent/interrupt-handler.js.map +1 -1
  19. package/dist/agent/lifecycle-trace.d.ts +9 -0
  20. package/dist/agent/lifecycle-trace.d.ts.map +1 -1
  21. package/dist/agent/lifecycle-trace.js +16 -1
  22. package/dist/agent/lifecycle-trace.js.map +1 -1
  23. package/dist/agent/lifecycle-transitions.d.ts +21 -0
  24. package/dist/agent/lifecycle-transitions.d.ts.map +1 -0
  25. package/dist/agent/lifecycle-transitions.js +33 -0
  26. package/dist/agent/lifecycle-transitions.js.map +1 -0
  27. package/dist/agent/loop.d.ts.map +1 -1
  28. package/dist/agent/loop.js +4 -0
  29. package/dist/agent/loop.js.map +1 -1
  30. package/dist/agent/onboarding-gate.d.ts.map +1 -1
  31. package/dist/agent/onboarding-gate.js +5 -0
  32. package/dist/agent/onboarding-gate.js.map +1 -1
  33. package/dist/agent/reply-target.d.ts.map +1 -1
  34. package/dist/agent/reply-target.js +2 -0
  35. package/dist/agent/reply-target.js.map +1 -1
  36. package/dist/agent/status.d.ts.map +1 -1
  37. package/dist/agent/status.js +2 -0
  38. package/dist/agent/status.js.map +1 -1
  39. package/dist/agent/wake-cycle-runner.d.ts.map +1 -1
  40. package/dist/agent/wake-cycle-runner.js +10 -16
  41. package/dist/agent/wake-cycle-runner.js.map +1 -1
  42. package/dist/channels/qq-access.d.ts +294 -0
  43. package/dist/channels/qq-access.d.ts.map +1 -0
  44. package/dist/channels/qq-access.js +426 -0
  45. package/dist/channels/qq-access.js.map +1 -0
  46. package/dist/channels/qq-bind-link.d.ts +65 -0
  47. package/dist/channels/qq-bind-link.d.ts.map +1 -0
  48. package/dist/channels/qq-bind-link.js +108 -0
  49. package/dist/channels/qq-bind-link.js.map +1 -0
  50. package/dist/channels/qq-commands.d.ts.map +1 -1
  51. package/dist/channels/qq-commands.js +3 -0
  52. package/dist/channels/qq-commands.js.map +1 -1
  53. package/dist/channels/qq-group-names.d.ts +27 -0
  54. package/dist/channels/qq-group-names.d.ts.map +1 -0
  55. package/dist/channels/qq-group-names.js +64 -0
  56. package/dist/channels/qq-group-names.js.map +1 -0
  57. package/dist/channels/qq-group-welcome.d.ts +75 -0
  58. package/dist/channels/qq-group-welcome.d.ts.map +1 -0
  59. package/dist/channels/qq-group-welcome.js +165 -0
  60. package/dist/channels/qq-group-welcome.js.map +1 -0
  61. package/dist/channels/qq-owner-commands.d.ts +178 -0
  62. package/dist/channels/qq-owner-commands.d.ts.map +1 -0
  63. package/dist/channels/qq-owner-commands.js +425 -0
  64. package/dist/channels/qq-owner-commands.js.map +1 -0
  65. package/dist/channels/qq-owner-name.d.ts +41 -0
  66. package/dist/channels/qq-owner-name.d.ts.map +1 -0
  67. package/dist/channels/qq-owner-name.js +71 -0
  68. package/dist/channels/qq-owner-name.js.map +1 -0
  69. package/dist/channels/qq-status.d.ts +2 -0
  70. package/dist/channels/qq-status.d.ts.map +1 -1
  71. package/dist/channels/qq-status.js +4 -0
  72. package/dist/channels/qq-status.js.map +1 -1
  73. package/dist/channels/qq.d.ts +126 -3
  74. package/dist/channels/qq.d.ts.map +1 -1
  75. package/dist/channels/qq.js +688 -25
  76. package/dist/channels/qq.js.map +1 -1
  77. package/dist/config/qq-access.d.ts +102 -0
  78. package/dist/config/qq-access.d.ts.map +1 -0
  79. package/dist/config/qq-access.js +99 -0
  80. package/dist/config/qq-access.js.map +1 -0
  81. package/dist/config/types.d.ts +138 -3
  82. package/dist/config/types.d.ts.map +1 -1
  83. package/dist/config/types.js +11 -0
  84. package/dist/config/types.js.map +1 -1
  85. package/dist/i18n/messages.d.ts +136 -0
  86. package/dist/i18n/messages.d.ts.map +1 -1
  87. package/dist/i18n/messages.js +108 -0
  88. package/dist/i18n/messages.js.map +1 -1
  89. package/dist/onboarding/onboarding-service-client.d.ts +58 -0
  90. package/dist/onboarding/onboarding-service-client.d.ts.map +1 -1
  91. package/dist/onboarding/onboarding-service-client.js +27 -0
  92. package/dist/onboarding/onboarding-service-client.js.map +1 -1
  93. package/dist/onboarding/remote-set-owner.d.ts.map +1 -1
  94. package/dist/onboarding/remote-set-owner.js +26 -0
  95. package/dist/onboarding/remote-set-owner.js.map +1 -1
  96. package/dist/onboarding/send-invite.d.ts +6 -2
  97. package/dist/onboarding/send-invite.d.ts.map +1 -1
  98. package/dist/onboarding/send-invite.js +43 -3
  99. package/dist/onboarding/send-invite.js.map +1 -1
  100. package/dist/threads/task-sidecar.d.ts +1 -1
  101. package/dist/threads/task-sidecar.d.ts.map +1 -1
  102. package/dist/threads/task-sidecar.js +5 -4
  103. package/dist/threads/task-sidecar.js.map +1 -1
  104. package/dist/tools/email.d.ts +1 -1
  105. package/dist/tools/event-trigger.d.ts +1 -1
  106. package/dist/tools/index.d.ts.map +1 -1
  107. package/dist/tools/index.js +2 -0
  108. package/dist/tools/index.js.map +1 -1
  109. package/dist/tools/mcp-manager.d.ts +1 -1
  110. package/dist/tools/qq-access.d.ts +6 -0
  111. package/dist/tools/qq-access.d.ts.map +1 -0
  112. package/dist/tools/qq-access.js +36 -0
  113. package/dist/tools/qq-access.js.map +1 -0
  114. package/dist/tools/skill.d.ts +1 -1
  115. package/dist/tools/totp.d.ts +1 -1
  116. package/dist-agent/bundle.cjs +2 -2
  117. package/package.json +1 -1
  118. package/dist/builtin-skills/catalog/phone-adb-automation/SKILL.md +0 -412
  119. package/dist/builtin-skills/catalog/phone-adb-automation/phone_input.sh +0 -132
  120. package/dist/builtin-skills/catalog/phone-adb-automation/phone_launch.sh +0 -166
  121. package/dist/builtin-skills/catalog/phone-adb-automation/phone_screenshot.sh +0 -87
  122. package/dist/builtin-skills/catalog/phone-adb-automation/phone_security_kbd.py +0 -174
  123. package/dist/builtin-skills/catalog/phone-adb-automation/phone_setup.sh +0 -274
  124. package/dist/builtin-skills/catalog/phone-adb-automation/phone_swipe.sh +0 -111
  125. package/dist/builtin-skills/catalog/phone-adb-automation/phone_tap.sh +0 -87
  126. package/dist/builtin-skills/catalog/phone-adb-automation/phone_ui_parse.py +0 -176
  127. package/dist/builtin-skills/catalog/phone-adb-automation/phone_wake_unlock.sh +0 -67
  128. package/dist/builtin-skills/macos-automation/SKILL.md +0 -132
  129. package/dist/builtin-skills/transcribe-audio/SKILL.md +0 -122
  130. package/dist/builtin-skills/visionclaw-manual/SKILL.md +0 -337
  131. package/dist/obs/rdp/icons/icons/app_windows.svg +0 -4
  132. package/dist/obs/rdp/icons/icons/clip_get.svg +0 -4
  133. package/dist/obs/rdp/icons/icons/clip_send.svg +0 -4
  134. package/dist/obs/rdp/icons/icons/clip_shared.svg +0 -4
  135. package/dist/obs/rdp/icons/icons/clipboard.svg +0 -4
  136. package/dist/obs/rdp/icons/icons/clipboard_shared.svg +0 -4
  137. package/dist/obs/rdp/icons/icons/control.svg +0 -4
  138. package/dist/obs/rdp/icons/icons/desktop.svg +0 -4
  139. package/dist/obs/rdp/icons/icons/display.svg +0 -4
  140. package/dist/obs/rdp/icons/icons/launchpad.svg +0 -4
  141. package/dist/obs/rdp/icons/icons/mission_control.svg +0 -4
  142. package/dist/obs/rdp/icons/icons/screenshot.svg +0 -4
  143. package/dist/obs/rdp/icons/icons/zoom_actual.svg +0 -4
  144. package/dist/obs/rdp/icons/icons/zoom_fit.svg +0 -4
  145. package/dist/obs/rdp/icons/icons/zoom_in.svg +0 -4
  146. package/dist/obs/rdp/icons/icons/zoom_out.svg +0 -4
  147. package/dist/realtime/assets/index.html +0 -1058
  148. package/dist/realtime/assets/samples/alloy.mp3 +0 -0
  149. package/dist/realtime/assets/samples/ash.mp3 +0 -0
  150. package/dist/realtime/assets/samples/ballad.mp3 +0 -0
  151. package/dist/realtime/assets/samples/cedar.mp3 +0 -0
  152. package/dist/realtime/assets/samples/coral.mp3 +0 -0
  153. package/dist/realtime/assets/samples/echo.mp3 +0 -0
  154. package/dist/realtime/assets/samples/marin.mp3 +0 -0
  155. package/dist/realtime/assets/samples/sage.mp3 +0 -0
  156. package/dist/realtime/assets/samples/shimmer.mp3 +0 -0
  157. package/dist/realtime/assets/samples/verse.mp3 +0 -0
  158. package/dist-agent/assets/index.html +0 -1058
  159. package/dist-agent/assets/samples/alloy.mp3 +0 -0
  160. package/dist-agent/assets/samples/ash.mp3 +0 -0
  161. package/dist-agent/assets/samples/ballad.mp3 +0 -0
  162. package/dist-agent/assets/samples/cedar.mp3 +0 -0
  163. package/dist-agent/assets/samples/coral.mp3 +0 -0
  164. package/dist-agent/assets/samples/echo.mp3 +0 -0
  165. package/dist-agent/assets/samples/marin.mp3 +0 -0
  166. package/dist-agent/assets/samples/sage.mp3 +0 -0
  167. package/dist-agent/assets/samples/shimmer.mp3 +0 -0
  168. package/dist-agent/assets/samples/verse.mp3 +0 -0
  169. package/dist-agent/playwriter-relay.cjs +0 -95
  170. package/dist-agent/realtime/assets/index.html +0 -1058
  171. package/dist-agent/realtime/assets/samples/alloy.mp3 +0 -0
  172. package/dist-agent/realtime/assets/samples/ash.mp3 +0 -0
  173. package/dist-agent/realtime/assets/samples/ballad.mp3 +0 -0
  174. package/dist-agent/realtime/assets/samples/cedar.mp3 +0 -0
  175. package/dist-agent/realtime/assets/samples/coral.mp3 +0 -0
  176. package/dist-agent/realtime/assets/samples/echo.mp3 +0 -0
  177. package/dist-agent/realtime/assets/samples/marin.mp3 +0 -0
  178. package/dist-agent/realtime/assets/samples/sage.mp3 +0 -0
  179. package/dist-agent/realtime/assets/samples/shimmer.mp3 +0 -0
  180. package/dist-agent/realtime/assets/samples/verse.mp3 +0 -0
@@ -0,0 +1,425 @@
1
+ import { randomBytes } from "node:crypto";
2
+ import { resolveGroupPolicy, ownerMemberIn, SHOW_BIND_OWNER_COMMAND } from "./qq-access.js";
3
+ import { normalizeQqOpenId } from "../config/qq-access.js";
4
+ import { t } from "../i18n/index.js";
5
+ // `/bind` (it handed out the /bind-owner code) is hidden together with that command: see SHOW_BIND_OWNER_COMMAND.
6
+ const commandPattern = (withBind) => new RegExp(`^/(groups|people|${withBind ? "bind|" : ""}qq-access)(?:\\s+([\\s\\S]*))?$`, "i");
7
+ const COMMAND_PATTERN = commandPattern(SHOW_BIND_OWNER_COMMAND);
8
+ const CONFIRM_PATTERN = /^(?:确认|confirm)$/i;
9
+ export const QQ_CONFIRM_WINDOW_MS = 5 * 60_000;
10
+ /** How long after a prompt a stray "confirm" is still taken as being about it. */
11
+ export const QQ_CONFIRM_LAPSE_MEMORY_MS = 30 * 60_000;
12
+ /** A relayed command nobody answered (older service, service down) gets told so after this long. */
13
+ export const QQ_COMMAND_REPLY_TIMEOUT_MS = 3 * 60_000;
14
+ const MAX_PENDING = 10;
15
+ const MAX_TEXT = 500;
16
+ const noop = () => undefined;
17
+ export class QqOwnerCommandBridge {
18
+ send;
19
+ wake;
20
+ now;
21
+ sendPrompt;
22
+ queue = [];
23
+ waiting = new Map();
24
+ confirmation = null;
25
+ confirmSeq = 0;
26
+ /** A prompt that lapsed or was dropped: a late "confirm" is answered instead of going to the agent as chat. */
27
+ lapsed = null;
28
+ constructor(send, wake = noop, now = Date.now,
29
+ /** Sends a question with Confirm / Cancel buttons (falls back to the plain text, which also says to reply "confirm"). */
30
+ sendPrompt) {
31
+ this.send = send;
32
+ this.wake = wake;
33
+ this.now = now;
34
+ this.sendPrompt = sendPrompt;
35
+ }
36
+ /** The service-facing text for a message, or null when it is not one of these commands. */
37
+ static relayText(message) {
38
+ const match = COMMAND_PATTERN.exec(message.trim());
39
+ if (!match)
40
+ return null;
41
+ const word = match[1].toLowerCase();
42
+ const rest = match[2]?.trim() ?? "";
43
+ if (word === "qq-access")
44
+ return rest;
45
+ return rest ? `${word} ${rest}` : word;
46
+ }
47
+ /**
48
+ * Handle an owner private message. Returns true when it was one of these commands (or the
49
+ * "confirm" that follows a prompt) and must not go on to the agent.
50
+ */
51
+ tryHandle(message, sender, msgId, locale) {
52
+ const text = message.trim();
53
+ const now = this.now();
54
+ const confirming = this.confirmation && now - this.confirmation.at <= QQ_CONFIRM_WINDOW_MS ? this.confirmation : null;
55
+ // Whatever the owner says next, the pending question is answered or dropped.
56
+ if (this.confirmation && !confirming)
57
+ this.lapsed = { at: this.confirmation.at };
58
+ else if (this.confirmation && !CONFIRM_PATTERN.test(text))
59
+ this.lapsed = { at: this.confirmation.at };
60
+ this.confirmation = null;
61
+ if (CONFIRM_PATTERN.test(text)) {
62
+ if (confirming) {
63
+ this.lapsed = null;
64
+ this.enqueue(confirming.text, true, sender, msgId, locale, confirming.token);
65
+ return true;
66
+ }
67
+ // "confirm" with nothing to confirm: if a prompt did run out (or was cancelled by another
68
+ // message) a little while ago, say so; otherwise it is ordinary chat.
69
+ if (this.lapsed && now - this.lapsed.at <= QQ_CONFIRM_LAPSE_MEMORY_MS) {
70
+ this.lapsed = null;
71
+ this.send(sender, msgId, t("qq.owner_cmd.confirm_expired", locale));
72
+ return true;
73
+ }
74
+ }
75
+ const relay = QqOwnerCommandBridge.relayText(text);
76
+ if (relay === null)
77
+ return false;
78
+ this.enqueue(relay, false, sender, msgId, locale);
79
+ return true;
80
+ }
81
+ /**
82
+ * A tap on one of the buttons this bot sent in the private chat (the caller has verified the tap
83
+ * came from the owner's private chat). Returns true when the data was one of ours.
84
+ * qqa:y:<n> / qqa:n:<n> answer the latest question (<n> must still be the open one)
85
+ * qqa:gb:y|n:<group id> (handled by the adapter) the owner's answer to "bind yourself in this group?"
86
+ * qqa:allow:<group id> "Allow this group": same as /qq-access allow <group>
87
+ */
88
+ tryHandleButton(data, sender, msgId, locale) {
89
+ const answer = /^qqa:([yn]):(\d{1,9})$/.exec(data);
90
+ if (answer) {
91
+ const open = this.confirmation && this.now() - this.confirmation.at <= QQ_CONFIRM_WINDOW_MS && this.confirmation.id === Number(answer[2]) ? this.confirmation : null;
92
+ if (!open) {
93
+ this.send(sender, msgId, t("qq.owner_cmd.button_expired", locale));
94
+ return true;
95
+ }
96
+ this.confirmation = null;
97
+ this.lapsed = null;
98
+ if (answer[1] === "n")
99
+ this.send(sender, msgId, t("qq.owner_cmd.cancelled", locale));
100
+ else
101
+ this.enqueue(open.text, true, sender, msgId, locale, open.token);
102
+ return true;
103
+ }
104
+ if (data === "qqa:bind") {
105
+ // An old "Bind me" button from before the code was hidden: nothing to hand out any more.
106
+ this.send(sender, msgId, t("qq.owner_cmd.button_expired", locale));
107
+ return true;
108
+ }
109
+ const allow = /^qqa:allow:([0-9A-Fa-f]{32})$/.exec(data);
110
+ if (allow) {
111
+ this.confirmation = null;
112
+ this.enqueue(`allow ${allow[1].toUpperCase()}`, false, sender, msgId, locale);
113
+ return true;
114
+ }
115
+ return false;
116
+ }
117
+ ask(sender, msgId, text, id) {
118
+ if (this.sendPrompt)
119
+ this.sendPrompt(sender, msgId, text, id);
120
+ else
121
+ this.send(sender, msgId, text);
122
+ }
123
+ enqueue(text, confirm, sender, msgId, locale, confirmToken, direct) {
124
+ if (text.length > MAX_TEXT || this.queue.length + this.waiting.size >= MAX_PENDING) {
125
+ const busy = t("qq.owner_cmd.busy", locale);
126
+ if (direct)
127
+ direct({ text: busy, needsConfirm: false });
128
+ else
129
+ this.send(sender, msgId, busy);
130
+ return;
131
+ }
132
+ const request = { id: `c${randomBytes(9).toString("hex")}`, text, confirm, locale, ...(confirmToken ? { confirmToken } : {}) };
133
+ this.queue.push({ request, sender, msgId, ...(direct ? { direct } : {}) });
134
+ this.wake();
135
+ }
136
+ /**
137
+ * The owner's assistant changes a setting on the owner's behalf (the owner asked for it in the
138
+ * private chat, in their own words). Same path as a typed command: relayed to the service, validated
139
+ * and stored there. Resolves with the service's one-sentence answer. Never resolves without an answer
140
+ * (a timeout answers too). Callers must have checked that the request comes from the owner's private
141
+ * chat; this class does not know about groups.
142
+ */
143
+ submitDirect(text, sender, msgId, locale) {
144
+ const command = text.trim().replace(/^\/?(?:qq-access)\s*/i, "");
145
+ return new Promise((resolve) => {
146
+ let settled = false;
147
+ const once = (result) => {
148
+ if (settled)
149
+ return;
150
+ settled = true;
151
+ clearTimeout(guard);
152
+ resolve(result);
153
+ };
154
+ // A request that never reaches a heartbeat must not leave the assistant waiting for ever.
155
+ const guard = setTimeout(() => once({ text: t("qq.owner_cmd.no_answer", locale), needsConfirm: false }), QQ_COMMAND_REPLY_TIMEOUT_MS + 30_000);
156
+ guard.unref();
157
+ this.confirmation = null;
158
+ this.enqueue(command, false, sender, msgId, locale, undefined, once);
159
+ });
160
+ }
161
+ /** Requests for the next heartbeat. They are answered by the heartbeat response, or timed out. */
162
+ drain() {
163
+ const batch = this.queue.splice(0);
164
+ for (const pending of batch) {
165
+ this.waiting.set(pending.request.id, pending);
166
+ pending.timer = setTimeout(() => this.expire(pending.request.id), QQ_COMMAND_REPLY_TIMEOUT_MS);
167
+ pending.timer.unref();
168
+ }
169
+ return batch.map((pending) => pending.request);
170
+ }
171
+ /** The heartbeat failed: the requests go out again with the next one (same ids: the service de-duplicates). */
172
+ requeue(requests) {
173
+ const back = [];
174
+ for (const request of requests) {
175
+ const pending = this.waiting.get(request.id);
176
+ if (!pending)
177
+ continue;
178
+ if (pending.timer)
179
+ clearTimeout(pending.timer);
180
+ this.waiting.delete(request.id);
181
+ back.push(pending);
182
+ }
183
+ this.queue.unshift(...back);
184
+ }
185
+ /** Answers from the service: tell the owner, and remember a confirmation prompt. */
186
+ onReplies(replies) {
187
+ for (const reply of replies) {
188
+ const pending = this.waiting.get(reply.id);
189
+ if (!pending)
190
+ continue;
191
+ if (pending.timer)
192
+ clearTimeout(pending.timer);
193
+ this.waiting.delete(reply.id);
194
+ if (reply.needsConfirm) {
195
+ this.confirmation = { text: pending.request.text, at: this.now(), id: ++this.confirmSeq, ...(typeof reply.confirmToken === "string" ? { token: reply.confirmToken.slice(0, 2100) } : {}) };
196
+ this.lapsed = null;
197
+ }
198
+ const text = reply.text.slice(0, 3500);
199
+ if (pending.direct) {
200
+ // A question that needs the owner's yes goes to the owner directly; the assistant just learns it was asked.
201
+ if (reply.needsConfirm && this.confirmation)
202
+ this.ask(pending.sender, pending.msgId, text, this.confirmation.id);
203
+ pending.direct({ text, needsConfirm: reply.needsConfirm === true });
204
+ continue;
205
+ }
206
+ if (reply.needsConfirm && this.confirmation)
207
+ this.ask(pending.sender, pending.msgId, text, this.confirmation.id);
208
+ else
209
+ this.send(pending.sender, pending.msgId, text);
210
+ }
211
+ }
212
+ expire(id) {
213
+ const pending = this.waiting.get(id);
214
+ if (!pending)
215
+ return;
216
+ this.waiting.delete(id);
217
+ const none = t("qq.owner_cmd.no_answer", pending.request.locale);
218
+ if (pending.direct)
219
+ pending.direct({ text: none, needsConfirm: false });
220
+ else
221
+ this.send(pending.sender, pending.msgId, none);
222
+ }
223
+ dispose() {
224
+ for (const pending of [...this.waiting.values(), ...this.queue])
225
+ pending.direct?.({ text: t("qq.owner_cmd.no_answer", pending.request.locale), needsConfirm: false });
226
+ for (const pending of this.waiting.values())
227
+ if (pending.timer)
228
+ clearTimeout(pending.timer);
229
+ this.waiting.clear();
230
+ this.queue = [];
231
+ }
232
+ }
233
+ // ---- "the bot joined a group" notice ------------------------------------------------------------
234
+ const shortId = (id) => (id.length <= 12 ? id : `${id.slice(0, 6)}…${id.slice(-4)}`);
235
+ /**
236
+ * The private message telling the owner the bot joined a group: which group (its note when the
237
+ * owner gave one, else a short group_openid), where it stands now, and how to start using it there.
238
+ * It holds no secret and no command to type: the owner answers with the Confirm / Cancel buttons, or
239
+ * re-sends the question from the GRU bot page.
240
+ */
241
+ export function buildGroupJoinNotice(input) {
242
+ const { access, locale } = input;
243
+ const group = normalizeQqOpenId(input.groupOpenId);
244
+ // The group's name leads; the short id is only a helper after it (a nameless group is "an unnamed group").
245
+ const label = `${input.name?.trim() ? input.name.trim() : locale === "zh" ? "未命名的群" : "an unnamed group"} (ID ${shortId(group)})`;
246
+ const policy = resolveGroupPolicy(access, group);
247
+ const lines = [t("qq.group_notice.head", locale, label)];
248
+ if (!policy) {
249
+ lines.push(t("qq.group_notice.status_blocked", locale));
250
+ }
251
+ else {
252
+ // The response mode is not offered for now: the assistant answers only when @ mentioned.
253
+ const mode = t("qq.group_notice.mode_at", locale);
254
+ const who = t(policy.senderPolicy === "owner" ? "qq.group_notice.who_owner" : policy.senderPolicy === "list" ? "qq.group_notice.who_list" : "qq.group_notice.who_everyone", locale);
255
+ // Only a proven binding counts: a nickname match is a guess and is still asked about.
256
+ const bound = ownerMemberIn(access, group, [], { provenOnly: true }).length > 0;
257
+ lines.push(t("qq.group_notice.status_allowed", locale, mode, who));
258
+ if (policy.senderPolicy === "owner")
259
+ lines.push(t(bound ? "qq.group_notice.bound" : "qq.group_notice.not_bound", locale));
260
+ else if (!bound)
261
+ lines.push(t("qq.group_notice.owner_unknown", locale));
262
+ }
263
+ const proven = ownerMemberIn(access, group, [], { provenOnly: true }).length > 0;
264
+ if (input.withButtons && policy && !proven)
265
+ lines.push(t("qq.group_notice.ask_bind", locale));
266
+ else if (!input.withButtons)
267
+ lines.push(t("qq.group_notice.howto", locale));
268
+ return lines.join("\n");
269
+ }
270
+ /** Private-chat buttons answering "bind yourself as the owner in this group?": qqa:gb:y:<group> / qqa:gb:n:<group>. */
271
+ export const GROUP_BIND_PREFIX = "qqa:gb:";
272
+ export function parseGroupBindButton(data) {
273
+ const match = /^qqa:gb:([yn]):([0-9A-F]{32})$/.exec(data);
274
+ return match ? { group: match[2], confirmed: match[1] === "y" } : null;
275
+ }
276
+ /**
277
+ * The buttons under the "bot joined a group" notice: "Allow this group" while it is not allowed,
278
+ * "Bind me" while "only me" has nobody bound there. They are sent in the owner's private chat only,
279
+ * and a tap is honoured only from that chat, so a group member can never press them.
280
+ */
281
+ export function buildGroupJoinButtons(input) {
282
+ const group = normalizeQqOpenId(input.groupOpenId);
283
+ if (!/^[0-9A-F]{32}$/.test(group))
284
+ return [];
285
+ const policy = resolveGroupPolicy(input.access, group);
286
+ const row = [];
287
+ if (!policy)
288
+ row.push({ label: t("qq.button.allow_group", input.locale), data: `qqa:allow:${group}` });
289
+ const rows = [];
290
+ if (row.length > 0)
291
+ rows.push(row);
292
+ // Nobody has PROVEN to be the owner there (a nickname match is only a guess): ask whether to bind. The "Bind me"
293
+ // button is posted in the group only after the owner confirms here, in private.
294
+ // (Not for a group that is not allowed yet: the bot ignores it, so there is nothing to bind until it is allowed.)
295
+ if (policy && ownerMemberIn(input.access, group, [], { provenOnly: true }).length === 0) {
296
+ rows.push([
297
+ { label: t("qq.button.confirm", input.locale), data: `${GROUP_BIND_PREFIX}y:${group}` },
298
+ { label: t("qq.button.cancel", input.locale), data: `${GROUP_BIND_PREFIX}n:${group}` },
299
+ ]);
300
+ }
301
+ return rows;
302
+ }
303
+ const NOTICE_WINDOW_MS = 10 * 60_000;
304
+ /** Proactive notices per window: far below QQ's limits (20/min per user), so a burst of new groups cannot become a storm. */
305
+ const NOTICE_MAX_PER_WINDOW = 10;
306
+ const NOTICE_HOUR_MS = 60 * 60_000;
307
+ /** And per hour, so that a steady trickle of new groups (a farmed allow-all bot) cannot add up to 60 messages an hour. */
308
+ const NOTICE_MAX_PER_HOUR = 20;
309
+ /** A group the service lists again (the owner asked on the GRU page) is told again only this long after the last time. */
310
+ export const NOTICE_RENOTIFY_MS = 10 * 60_000;
311
+ /** Delivery attempts for a group when the failure looks transient (no QQ answer). */
312
+ const NOTICE_MAX_ATTEMPTS = 3;
313
+ /** QQ answered with an error code: the user switched proactive messages off, or no permission. Nothing to retry. */
314
+ const isRefusal = (message) => /4005401[3]|4003410[5]/.test(message);
315
+ /**
316
+ * Tells the owner, once per group, that the bot was added to it. The service lists the groups still
317
+ * to announce; this sends one private (proactive) message each and acks the group in the next
318
+ * heartbeat report, which the service stores (`owner_notified_at`) so the group is never listed again.
319
+ * A group is acked after a send, after QQ refuses it (proactive messages switched off, no permission,
320
+ * rate limit: logged, never retried in a loop), and after a few transient failures. It is not acked
321
+ * (so it comes back on a later heartbeat) only while the adapter is not connected or the window is full.
322
+ */
323
+ export class QqGroupNotifier {
324
+ deps;
325
+ acks = new Set();
326
+ /**
327
+ * Groups handled by this process (bounded) and when: not offered twice while an ack is in flight. The owner can
328
+ * ask for the question again from the GRU page (the service lists the group once more); that is honoured after
329
+ * NOTICE_RENOTIFY_MS, long enough for the ack of the previous message to have reached the service.
330
+ */
331
+ told = new Map();
332
+ busy = new Set();
333
+ attempts = new Map();
334
+ sent = [];
335
+ chain = Promise.resolve();
336
+ constructor(deps) {
337
+ this.deps = deps;
338
+ }
339
+ offer(notices) {
340
+ const now = this.deps.now ?? Date.now;
341
+ for (const notice of notices.slice(0, 5)) {
342
+ const group = normalizeQqOpenId(notice.group);
343
+ if (!group || this.busy.has(group))
344
+ continue;
345
+ const toldAt = this.told.get(group);
346
+ if (toldAt !== undefined && now() - toldAt < NOTICE_RENOTIFY_MS)
347
+ continue;
348
+ if (this.deps.refused?.()) {
349
+ // The owner closed proactive messages: say nothing, and do not ask again.
350
+ this.settle(group);
351
+ this.deps.log.debug(`QQ: group notice skipped (proactive messages are off): ${shortId(group)}`);
352
+ continue;
353
+ }
354
+ if (!this.deps.ready())
355
+ return;
356
+ this.sent = this.sent.filter((at) => now() - at < NOTICE_HOUR_MS);
357
+ // Groups over a cap stay un-acked on the service, so they are offered again later and told then.
358
+ if (this.sent.length >= NOTICE_MAX_PER_HOUR)
359
+ return;
360
+ if (this.sent.filter((at) => now() - at < NOTICE_WINDOW_MS).length >= NOTICE_MAX_PER_WINDOW)
361
+ return;
362
+ this.sent.push(now());
363
+ this.busy.add(group);
364
+ const name = typeof notice.name === "string" ? notice.name : undefined;
365
+ this.chain = this.chain.then(() => this.deliver(group, name));
366
+ }
367
+ }
368
+ async deliver(group, name) {
369
+ try {
370
+ let label = name;
371
+ if (!label && this.deps.nameOf)
372
+ label = await this.deps.nameOf(group).catch(() => undefined);
373
+ const base = { access: this.deps.access(), groupOpenId: group, name: label, locale: this.deps.locale() };
374
+ const rows = this.deps.buttons ? buildGroupJoinButtons(base) : [];
375
+ if (rows.length > 0)
376
+ await this.deps.send(buildGroupJoinNotice({ ...base, withButtons: true }), { rows, fallbackText: buildGroupJoinNotice(base) });
377
+ else
378
+ await this.deps.send(buildGroupJoinNotice(base));
379
+ this.settle(group);
380
+ }
381
+ catch (err) {
382
+ const message = err instanceof Error ? err.message : String(err);
383
+ const attempts = (this.attempts.get(group) ?? 0) + 1;
384
+ this.attempts.set(group, attempts);
385
+ if (isRefusal(message)) {
386
+ this.settle(group);
387
+ this.deps.log.debug(`QQ: group notice refused by QQ (proactive messages off or no permission): ${shortId(group)}`);
388
+ }
389
+ else if (message.startsWith("QQ API ") || attempts >= NOTICE_MAX_ATTEMPTS) {
390
+ this.settle(group);
391
+ this.deps.log.warn(`QQ: group notice for ${shortId(group)} not delivered: ${message}`);
392
+ }
393
+ else {
394
+ this.deps.log.warn(`QQ: group notice for ${shortId(group)} failed (will retry): ${message}`);
395
+ }
396
+ }
397
+ finally {
398
+ this.busy.delete(group);
399
+ }
400
+ }
401
+ settle(group) {
402
+ this.acks.add(group);
403
+ this.told.set(group, (this.deps.now ?? Date.now)());
404
+ if (this.told.size > 2000)
405
+ for (const oldest of this.told.keys()) {
406
+ this.told.delete(oldest);
407
+ break;
408
+ }
409
+ }
410
+ /** Groups to ack in the next heartbeat report. */
411
+ drainAcks() {
412
+ const out = [...this.acks];
413
+ this.acks = new Set();
414
+ return out;
415
+ }
416
+ requeueAcks(groups) {
417
+ for (const group of groups)
418
+ this.acks.add(group);
419
+ }
420
+ /** Resolves when everything offered so far has been attempted (tests). */
421
+ idle() {
422
+ return this.chain;
423
+ }
424
+ }
425
+ //# sourceMappingURL=qq-owner-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qq-owner-commands.js","sourceRoot":"","sources":["../../src/channels/qq-owner-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,OAAO,EAAE,iBAAiB,EAAuB,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,CAAC,EAAe,MAAM,kBAAkB,CAAC;AA+BlD,kHAAkH;AAClH,MAAM,cAAc,GAAG,CAAC,QAAiB,EAAU,EAAE,CACnD,IAAI,MAAM,CAAC,oBAAoB,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,iCAAiC,EAAE,GAAG,CAAC,CAAC;AAChG,MAAM,eAAe,GAAG,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAChE,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAC5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAC;AAC/C,kFAAkF;AAClF,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,GAAG,MAAM,CAAC;AACtD,oGAAoG;AACpG,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,GAAG,MAAM,CAAC;AACtD,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,QAAQ,GAAG,GAAG,CAAC;AAWrB,MAAM,IAAI,GAAG,GAA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,EAAE,CAAC,CAAC;YAC/F,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,KAAa;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI;YAAE,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;gBAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAAC,MAAM;YAAC,CAAC;IACxG,CAAC;IAED,kDAAkD;IAClD,SAAS;QACP,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,WAAW,CAAC,MAAyB;QACnC,KAAK,MAAM,KAAK,IAAI,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,0EAA0E;IAC1E,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * A person's name for comparison: Unicode-compatible forms folded (full-width letters, ligatures), lower case, and
3
+ * every space, control and zero-width character removed. "Jojo Lock", "jojolock" and "JOJOLOCK" are the same.
4
+ * Empty when nothing is left.
5
+ */
6
+ export declare function normalizePersonName(value: unknown): string;
7
+ export type OwnerNameVerdict = {
8
+ kind: "recognised";
9
+ member: string;
10
+ } | {
11
+ kind: "ambiguous";
12
+ } | {
13
+ kind: "none";
14
+ };
15
+ /**
16
+ * Recognises the owner in a group by name. Where the owner's name comes from: the owner's name the service holds for
17
+ * this assistant (owner config `ownerName`, the Gru display name). QQ's GET /v2/groups/{id}/members is refused
18
+ * (11253) so nobody can list a group's members: the only chance to compare is when a member shows up in a group
19
+ * event (`author.username`, the member's QQ nickname). The owner's private (C2C) events carry no nickname.
20
+ *
21
+ * RISK: a nickname can be copied. This is a guess, never proof. Safeguards (all enforced, with tests):
22
+ * - only while the group has NO owner binding at all; a proven binding (code / Gru confirmation) is never replaced;
23
+ * - the name must match exactly one member; two different members with that name -> no recognition, and a
24
+ * recognition already made is withdrawn (the "Bind" button flow takes over);
25
+ * - a name-recognised owner does not pass the "only me" gate and is not shown to the assistant as the owner;
26
+ * - the service re-checks the claim against its own member records, shows it as "recognised by name" on the page
27
+ * and the owner can unbind it or replace it with a proven binding at any time.
28
+ */
29
+ export declare class QqOwnerNameMatcher {
30
+ private readonly candidates;
31
+ /**
32
+ * @param ownerName the owner's name (unnormalised)
33
+ * @param nickname the member's QQ nickname from the event
34
+ * @param hasOwner the group already has an owner binding (proven or earlier recognised)
35
+ */
36
+ observe(groupOpenId: string, memberOpenId: string, nickname: unknown, ownerName: unknown, hasOwner: boolean): OwnerNameVerdict;
37
+ /** More than one member with the owner's name has been seen in this group. */
38
+ isAmbiguous(groupOpenId: string): boolean;
39
+ forget(groupOpenId: string): void;
40
+ }
41
+ //# sourceMappingURL=qq-owner-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qq-owner-name.d.ts","sourceRoot":"","sources":["../../src/channels/qq-owner-name.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI1D;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAIrB;;;;;;;;;;;;;GAaG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAE7D;;;;OAIG;IACH,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,gBAAgB;IAwB9H,8EAA8E;IAC9E,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAIzC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CAGlC"}
@@ -0,0 +1,71 @@
1
+ import { normalizeQqOpenId } from "../config/qq-access.js";
2
+ /**
3
+ * A person's name for comparison: Unicode-compatible forms folded (full-width letters, ligatures), lower case, and
4
+ * every space, control and zero-width character removed. "Jojo Lock", "jojolock" and "JOJOLOCK" are the same.
5
+ * Empty when nothing is left.
6
+ */
7
+ export function normalizePersonName(value) {
8
+ if (typeof value !== "string")
9
+ return "";
10
+ // eslint-disable-next-line no-control-regex
11
+ return value.slice(0, 200).normalize("NFKC").toLowerCase().replace(/[\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202f\u2060\ufeff\s]+/g, "");
12
+ }
13
+ const MAX_GROUPS = 500;
14
+ /**
15
+ * Recognises the owner in a group by name. Where the owner's name comes from: the owner's name the service holds for
16
+ * this assistant (owner config `ownerName`, the Gru display name). QQ's GET /v2/groups/{id}/members is refused
17
+ * (11253) so nobody can list a group's members: the only chance to compare is when a member shows up in a group
18
+ * event (`author.username`, the member's QQ nickname). The owner's private (C2C) events carry no nickname.
19
+ *
20
+ * RISK: a nickname can be copied. This is a guess, never proof. Safeguards (all enforced, with tests):
21
+ * - only while the group has NO owner binding at all; a proven binding (code / Gru confirmation) is never replaced;
22
+ * - the name must match exactly one member; two different members with that name -> no recognition, and a
23
+ * recognition already made is withdrawn (the "Bind" button flow takes over);
24
+ * - a name-recognised owner does not pass the "only me" gate and is not shown to the assistant as the owner;
25
+ * - the service re-checks the claim against its own member records, shows it as "recognised by name" on the page
26
+ * and the owner can unbind it or replace it with a proven binding at any time.
27
+ */
28
+ export class QqOwnerNameMatcher {
29
+ candidates = new Map();
30
+ /**
31
+ * @param ownerName the owner's name (unnormalised)
32
+ * @param nickname the member's QQ nickname from the event
33
+ * @param hasOwner the group already has an owner binding (proven or earlier recognised)
34
+ */
35
+ observe(groupOpenId, memberOpenId, nickname, ownerName, hasOwner) {
36
+ const wanted = normalizePersonName(ownerName);
37
+ const group = normalizeQqOpenId(groupOpenId);
38
+ const member = normalizeQqOpenId(memberOpenId);
39
+ if (!wanted || !group || !member)
40
+ return { kind: "none" };
41
+ if (normalizePersonName(nickname) === wanted) {
42
+ let set = this.candidates.get(group);
43
+ if (!set) {
44
+ set = new Set();
45
+ this.candidates.set(group, set);
46
+ if (this.candidates.size > MAX_GROUPS) {
47
+ const oldest = this.candidates.keys().next();
48
+ if (!oldest.done)
49
+ this.candidates.delete(oldest.value);
50
+ }
51
+ }
52
+ set.add(member);
53
+ }
54
+ const set = this.candidates.get(group);
55
+ if (!set || set.size === 0)
56
+ return { kind: "none" };
57
+ if (set.size > 1)
58
+ return { kind: "ambiguous" };
59
+ if (hasOwner)
60
+ return { kind: "none" };
61
+ return { kind: "recognised", member: [...set][0] };
62
+ }
63
+ /** More than one member with the owner's name has been seen in this group. */
64
+ isAmbiguous(groupOpenId) {
65
+ return (this.candidates.get(normalizeQqOpenId(groupOpenId))?.size ?? 0) > 1;
66
+ }
67
+ forget(groupOpenId) {
68
+ this.candidates.delete(normalizeQqOpenId(groupOpenId));
69
+ }
70
+ }
71
+ //# sourceMappingURL=qq-owner-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qq-owner-name.js","sourceRoot":"","sources":["../../src/channels/qq-owner-name.ts"],"names":[],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C;oBACtC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;oBAC7C,IAAI,CAAC,MAAM,CAAC,IAAI;wBAAE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACzD,CAAC;YACH,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACpD,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAC/C,IAAI,QAAQ;YAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACtC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,CAAC;IAED,8EAA8E;IAC9E,WAAW,CAAC,WAAmB;QAC7B,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9E,CAAC;IAED,MAAM,CAAC,WAAmB;QACxB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;IACzD,CAAC;CACF"}
@@ -27,6 +27,8 @@ export declare class QqProgressStream {
27
27
  private chain;
28
28
  constructor(transport: QqProgressPost);
29
29
  arm(openId: string, msgId?: string): void;
30
+ /** Stop streaming until the next arm(), e.g. when the latest turn is not a C2C chat. */
31
+ disarm(): void;
30
32
  publish(activity: PublicThreadActivity): void;
31
33
  private flush;
32
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"qq-status.d.ts","sourceRoot":"","sources":["../../src/channels/qq-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAsB7F;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAmBlH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAUf,OAAO,CAAC,QAAQ,CAAC,SAAS;IATtC,OAAO,CAAC,MAAM,CAAmD;IACjE,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,KAAK,CAAoC;gBAEpB,SAAS,EAAE,cAAc;IAEtD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAUzC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;YAS/B,KAAK;CAqCpB"}
1
+ {"version":3,"file":"qq-status.d.ts","sourceRoot":"","sources":["../../src/channels/qq-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAsB7F;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAmBlH;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACtF,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAUf,OAAO,CAAC,QAAQ,CAAC,SAAS;IATtC,OAAO,CAAC,MAAM,CAAmD;IACjE,OAAO,CAAC,IAAI,CAAM;IAClB,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAmC;IACtD,OAAO,CAAC,KAAK,CAAoC;gBAEpB,SAAS,EAAE,cAAc;IAEtD,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAUzC,wFAAwF;IACxF,MAAM,IAAI,IAAI;IAId,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;YAS/B,KAAK;CAqCpB"}
@@ -69,6 +69,10 @@ export class QqProgressStream {
69
69
  this.disabled = false;
70
70
  this.contentType = "markdown";
71
71
  }
72
+ /** Stop streaming until the next arm(), e.g. when the latest turn is not a C2C chat. */
73
+ disarm() {
74
+ this.anchor = null;
75
+ }
72
76
  publish(activity) {
73
77
  if (!this.anchor || this.closed || this.disabled)
74
78
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"qq-status.js","sourceRoot":"","sources":["../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