@meet-im/meet 3.3.1 → 3.4.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.
- package/dist/src/bot.js +3 -0
- package/dist/src/generated/plugin-build-meta.d.ts +1 -1
- package/dist/src/generated/plugin-build-meta.js +1 -1
- package/dist/src/probe.d.ts +0 -2
- package/dist/src/probe.js +1 -13
- package/dist/src/reply-dispatcher.d.ts +2 -0
- package/dist/src/reply-dispatcher.js +14 -2
- package/dist/src/send.d.ts +5 -1
- package/dist/src/send.js +10 -24
- package/package.json +1 -1
package/dist/src/bot.js
CHANGED
|
@@ -108,6 +108,7 @@ export async function handleMeetMessage(params) {
|
|
|
108
108
|
to: `user:${ctx.senderId}`,
|
|
109
109
|
text: replyText,
|
|
110
110
|
accountId,
|
|
111
|
+
runtime,
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
catch (err) {
|
|
@@ -388,6 +389,8 @@ export async function handleMeetMessage(params) {
|
|
|
388
389
|
agentId: route.agentId,
|
|
389
390
|
runtime: runtime,
|
|
390
391
|
chatId: ctx.chatId,
|
|
392
|
+
senderId: ctx.senderId,
|
|
393
|
+
mentionedBot: ctx.mentionedBot,
|
|
391
394
|
replyToMessageId: ctx.messageId,
|
|
392
395
|
accountId,
|
|
393
396
|
bot,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MEET_PLUGIN_VERSION = "3.
|
|
1
|
+
export declare const MEET_PLUGIN_VERSION = "3.4.0";
|
|
2
2
|
export declare const MEET_OPENCLAW_VERSION = "2026.5.18";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const MEET_PLUGIN_VERSION = "3.
|
|
1
|
+
export const MEET_PLUGIN_VERSION = "3.4.0";
|
|
2
2
|
export const MEET_OPENCLAW_VERSION = "2026.5.18";
|
package/dist/src/probe.d.ts
CHANGED
package/dist/src/probe.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import { getMeetClient } from "./client.js";
|
|
2
|
-
let _logger = null;
|
|
3
|
-
export function setProbeLogger(logger) {
|
|
4
|
-
_logger = logger;
|
|
5
|
-
}
|
|
6
|
-
function log(message) {
|
|
7
|
-
if (_logger) {
|
|
8
|
-
_logger.log(message);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
console.log(message);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
2
|
const probeCache = new Map();
|
|
15
3
|
const PROBE_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
16
4
|
export async function probeMeet(account) {
|
|
@@ -36,7 +24,7 @@ export async function probeMeet(account) {
|
|
|
36
24
|
botId: account.apiToken?.split(":")[0],
|
|
37
25
|
};
|
|
38
26
|
if (updates && updates.msgs.length > 0) {
|
|
39
|
-
log(`[${account.accountId}] probe: received ${updates.msgs.length} update(s)`);
|
|
27
|
+
console.log(`[${account.accountId}] probe: received ${updates.msgs.length} update(s)`);
|
|
40
28
|
}
|
|
41
29
|
probeCache.set(cacheKey, { result, timestamp: Date.now() });
|
|
42
30
|
return result;
|
|
@@ -75,7 +75,7 @@ export function protectMentionsInChunks(chunks) {
|
|
|
75
75
|
return result;
|
|
76
76
|
}
|
|
77
77
|
export async function createMeetReplyDispatcher(opts) {
|
|
78
|
-
const { cfg, agentId, chatId, replyToMessageId, accountId, mediaLocalRoots, sessionInfo, apiToken, apiEndpoint, typingMode } = opts;
|
|
78
|
+
const { cfg, agentId, chatId, senderId, mentionedBot, replyToMessageId, accountId, mediaLocalRoots, sessionInfo, apiToken, apiEndpoint, typingMode } = opts;
|
|
79
79
|
const core = getMeetRuntime();
|
|
80
80
|
const textChunkLimit = core.channel.text.resolveTextChunkLimit(cfg, "meet", accountId, {
|
|
81
81
|
fallbackLimit: 4000,
|
|
@@ -89,6 +89,8 @@ export async function createMeetReplyDispatcher(opts) {
|
|
|
89
89
|
ctx: { ChatType: chatType },
|
|
90
90
|
})
|
|
91
91
|
: undefined;
|
|
92
|
+
const shouldAutoMentionSender = chatType === "channel" && mentionedBot === true && !!senderId;
|
|
93
|
+
const senderMentionText = shouldAutoMentionSender ? `<@${senderId}>` : undefined;
|
|
92
94
|
// 创建 typing callbacks(如果配置了 typing 且有必要参数)
|
|
93
95
|
const hasTypingParams = typingMode && typingMode !== "none" && sessionInfo && apiToken;
|
|
94
96
|
let typingRequestChain = Promise.resolve();
|
|
@@ -181,6 +183,7 @@ export async function createMeetReplyDispatcher(opts) {
|
|
|
181
183
|
mediaUrl: mediaUrls[0],
|
|
182
184
|
mediaLocalRoots,
|
|
183
185
|
accountId,
|
|
186
|
+
runtime: opts.runtime,
|
|
184
187
|
});
|
|
185
188
|
// 后续媒体不带文本
|
|
186
189
|
for (let i = 1; i < mediaUrls.length; i++) {
|
|
@@ -191,6 +194,7 @@ export async function createMeetReplyDispatcher(opts) {
|
|
|
191
194
|
mediaUrl: mediaUrls[i],
|
|
192
195
|
mediaLocalRoots,
|
|
193
196
|
accountId,
|
|
197
|
+
runtime: opts.runtime,
|
|
194
198
|
});
|
|
195
199
|
}
|
|
196
200
|
return;
|
|
@@ -198,13 +202,20 @@ export async function createMeetReplyDispatcher(opts) {
|
|
|
198
202
|
// 只有文本,分片发送
|
|
199
203
|
const rawChunks = core.channel.text.chunkTextWithMode(text, textChunkLimit, chunkMode);
|
|
200
204
|
const protectedChunks = protectMentionsInChunks(rawChunks);
|
|
201
|
-
for (const
|
|
205
|
+
for (const [index, rawChunk] of protectedChunks.entries()) {
|
|
206
|
+
const chunk = index === 0 && senderMentionText
|
|
207
|
+
? rawChunk.includes(senderMentionText)
|
|
208
|
+
? rawChunk
|
|
209
|
+
: `${senderMentionText} ${rawChunk}`
|
|
210
|
+
: rawChunk;
|
|
202
211
|
await sendMessageMeet({
|
|
203
212
|
cfg,
|
|
204
213
|
to: chatId,
|
|
205
214
|
text: chunk,
|
|
206
215
|
accountId,
|
|
207
216
|
replyToMessageId,
|
|
217
|
+
atIds: index === 0 && shouldAutoMentionSender && senderId ? [Number(senderId)] : undefined,
|
|
218
|
+
runtime: opts.runtime,
|
|
208
219
|
});
|
|
209
220
|
}
|
|
210
221
|
},
|
|
@@ -250,6 +261,7 @@ export async function createMeetReplyDispatcher(opts) {
|
|
|
250
261
|
to: chatId,
|
|
251
262
|
text: userMessage,
|
|
252
263
|
accountId,
|
|
264
|
+
runtime: opts.runtime,
|
|
253
265
|
});
|
|
254
266
|
}
|
|
255
267
|
catch {
|
package/dist/src/send.d.ts
CHANGED
|
@@ -10,11 +10,11 @@ export declare function inferContentTypeFromFileName(fileName: string): string |
|
|
|
10
10
|
* 如果原始 contentType 缺失或为通用二进制流,则根据文件名推断
|
|
11
11
|
*/
|
|
12
12
|
export declare function resolveContentType(fileName: string, originalContentType?: string): string;
|
|
13
|
-
export declare function setSendMessageLogger(logger: RuntimeEnv): void;
|
|
14
13
|
export declare function extractAtIds(text: string): {
|
|
15
14
|
text: string;
|
|
16
15
|
atIds: number[];
|
|
17
16
|
};
|
|
17
|
+
export declare function mergeAtIds(explicitAtIds?: number[], extractedAtIds?: number[]): number[];
|
|
18
18
|
export type SendMessageMeetOpts = {
|
|
19
19
|
cfg: ClawdbotConfig;
|
|
20
20
|
to: string;
|
|
@@ -22,6 +22,8 @@ export type SendMessageMeetOpts = {
|
|
|
22
22
|
accountId?: string;
|
|
23
23
|
replyToMessageId?: string;
|
|
24
24
|
atIds?: number[];
|
|
25
|
+
/** Optional runtime for consistent logging. If not provided, falls back to console. */
|
|
26
|
+
runtime?: RuntimeEnv;
|
|
25
27
|
};
|
|
26
28
|
export declare function sendMessageMeet(opts: SendMessageMeetOpts): Promise<{
|
|
27
29
|
messageId: string;
|
|
@@ -41,6 +43,8 @@ export type SendMediaMeetOpts = {
|
|
|
41
43
|
total: number;
|
|
42
44
|
speedPerSecond: string;
|
|
43
45
|
}) => void;
|
|
46
|
+
/** Optional runtime for consistent logging. If not provided, falls back to console. */
|
|
47
|
+
runtime?: RuntimeEnv;
|
|
44
48
|
};
|
|
45
49
|
export declare function sendMediaMeet(opts: SendMediaMeetOpts): Promise<{
|
|
46
50
|
messageId: string;
|
package/dist/src/send.js
CHANGED
|
@@ -108,25 +108,6 @@ export function resolveContentType(fileName, originalContentType) {
|
|
|
108
108
|
const inferred = inferContentTypeFromFileName(fileName);
|
|
109
109
|
return inferred || originalContentType || "application/octet-stream";
|
|
110
110
|
}
|
|
111
|
-
let _logger = null;
|
|
112
|
-
export function setSendMessageLogger(logger) {
|
|
113
|
-
_logger = logger;
|
|
114
|
-
}
|
|
115
|
-
function log(message) {
|
|
116
|
-
if (_logger) {
|
|
117
|
-
_logger.log(message);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
console.log(message);
|
|
121
|
-
}
|
|
122
|
-
function logError(message) {
|
|
123
|
-
if (_logger) {
|
|
124
|
-
_logger.error(message);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
console.error(message);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
111
|
export function extractAtIds(text) {
|
|
131
112
|
const atIds = [];
|
|
132
113
|
text.replace(MENTION_PATTERN, (_, id1, id2) => {
|
|
@@ -138,8 +119,13 @@ export function extractAtIds(text) {
|
|
|
138
119
|
});
|
|
139
120
|
return { text: text.trim(), atIds };
|
|
140
121
|
}
|
|
122
|
+
export function mergeAtIds(explicitAtIds, extractedAtIds) {
|
|
123
|
+
return [...new Set([...(explicitAtIds ?? []), ...(extractedAtIds ?? [])])];
|
|
124
|
+
}
|
|
141
125
|
export async function sendMessageMeet(opts) {
|
|
142
|
-
const { cfg, to, text, accountId, atIds: explicitAtIds } = opts;
|
|
126
|
+
const { cfg, to, text, accountId, atIds: explicitAtIds, runtime } = opts;
|
|
127
|
+
const log = runtime?.log ?? console.log;
|
|
128
|
+
const logError = runtime?.error ?? console.error;
|
|
143
129
|
const account = resolveMeetAccount({ cfg, accountId });
|
|
144
130
|
if (!account.configured) {
|
|
145
131
|
throw new Error(`Meet account not configured: ${accountId ?? "default"}`);
|
|
@@ -181,9 +167,7 @@ export async function sendMessageMeet(opts) {
|
|
|
181
167
|
// 先重写 @handle 为 <@userId>,再提取 atIds
|
|
182
168
|
const textWithMentions = rewriteMeetKnownMentions(text, account.accountId);
|
|
183
169
|
const { text: cleanText, atIds: extractedAtIds } = extractAtIds(textWithMentions);
|
|
184
|
-
const finalAtIds = explicitAtIds
|
|
185
|
-
? [...explicitAtIds, ...extractedAtIds]
|
|
186
|
-
: extractedAtIds;
|
|
170
|
+
const finalAtIds = mergeAtIds(explicitAtIds, extractedAtIds);
|
|
187
171
|
log(`send message to=${to} atIds=${finalAtIds.join(",") || "none"}`);
|
|
188
172
|
const sessionInfo = parseTargetToSessionInfo(to, Number(botUserId));
|
|
189
173
|
try {
|
|
@@ -202,7 +186,9 @@ export async function sendMessageMeet(opts) {
|
|
|
202
186
|
}
|
|
203
187
|
}
|
|
204
188
|
export async function sendMediaMeet(opts) {
|
|
205
|
-
const { cfg, to, text, mediaUrl, mediaLocalRoots, accountId, onProgress } = opts;
|
|
189
|
+
const { cfg, to, text, mediaUrl, mediaLocalRoots, accountId, onProgress, runtime: logRuntime } = opts;
|
|
190
|
+
const log = logRuntime?.log ?? console.log;
|
|
191
|
+
const logError = logRuntime?.error ?? console.error;
|
|
206
192
|
const account = resolveMeetAccount({ cfg, accountId });
|
|
207
193
|
if (!account.configured) {
|
|
208
194
|
throw new Error(`Meet account not configured: ${accountId ?? "default"}`);
|