@chbo297/infoflow 2026.2.28 → 2026.3.4
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/index.ts +6 -1
- package/package.json +1 -1
- package/src/bot.ts +18 -3
- package/src/monitor.ts +1 -1
- package/src/types.ts +2 -0
package/index.ts
CHANGED
|
@@ -11,7 +11,12 @@ const plugin = {
|
|
|
11
11
|
register(api: OpenClawPluginApi) {
|
|
12
12
|
setInfoflowRuntime(api.runtime);
|
|
13
13
|
api.registerChannel({ plugin: infoflowPlugin });
|
|
14
|
-
api.
|
|
14
|
+
api.registerHttpRoute({
|
|
15
|
+
path: "/webhook/infoflow",
|
|
16
|
+
auth: "plugin",
|
|
17
|
+
match: "exact",
|
|
18
|
+
handler: handleInfoflowWebhookRequest,
|
|
19
|
+
});
|
|
15
20
|
},
|
|
16
21
|
};
|
|
17
22
|
|
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -364,9 +364,16 @@ export async function handleGroupChatMessage(params: HandleGroupChatParams): Pro
|
|
|
364
364
|
// Build two versions: mes (for CommandBody, no @xxx) and rawMes (for RawBody, with @xxx)
|
|
365
365
|
let textContent = "";
|
|
366
366
|
let rawTextContent = "";
|
|
367
|
+
const replyContextItems: string[] = [];
|
|
367
368
|
if (Array.isArray(bodyItems)) {
|
|
368
369
|
for (const item of bodyItems) {
|
|
369
|
-
if (item.type === "
|
|
370
|
+
if (item.type === "replyData") {
|
|
371
|
+
// 引用回复:提取被引用消息的内容(可能有多条引用)
|
|
372
|
+
const replyBody = (item.content ?? "").trim();
|
|
373
|
+
if (replyBody) {
|
|
374
|
+
replyContextItems.push(replyBody);
|
|
375
|
+
}
|
|
376
|
+
} else if (item.type === "TEXT") {
|
|
370
377
|
textContent += item.content ?? "";
|
|
371
378
|
rawTextContent += item.content ?? "";
|
|
372
379
|
} else if (item.type === "LINK") {
|
|
@@ -385,12 +392,18 @@ export async function handleGroupChatMessage(params: HandleGroupChatParams): Pro
|
|
|
385
392
|
}
|
|
386
393
|
}
|
|
387
394
|
|
|
388
|
-
|
|
395
|
+
let mes = textContent.trim() || String(msgData.content ?? msgData.text ?? "");
|
|
389
396
|
const rawMes = rawTextContent.trim() || mes;
|
|
390
397
|
|
|
391
|
-
|
|
398
|
+
const replyContext = replyContextItems.length > 0 ? replyContextItems : undefined;
|
|
399
|
+
|
|
400
|
+
if (!mes && !replyContext) {
|
|
392
401
|
return;
|
|
393
402
|
}
|
|
403
|
+
// If mes is empty but replyContext exists, use a placeholder so the message is not dropped
|
|
404
|
+
if (!mes && replyContext) {
|
|
405
|
+
mes = "(引用回复)";
|
|
406
|
+
}
|
|
394
407
|
|
|
395
408
|
// Extract sender name from header or fallback to fromuser
|
|
396
409
|
const senderName = String(header?.username ?? header?.nickname ?? msgData.username ?? fromuser);
|
|
@@ -411,6 +424,7 @@ export async function handleGroupChatMessage(params: HandleGroupChatParams): Pro
|
|
|
411
424
|
bodyItems,
|
|
412
425
|
mentionIds:
|
|
413
426
|
mentionIds.userIds.length > 0 || mentionIds.agentIds.length > 0 ? mentionIds : undefined,
|
|
427
|
+
replyContext,
|
|
414
428
|
},
|
|
415
429
|
accountId,
|
|
416
430
|
statusSink,
|
|
@@ -494,6 +508,7 @@ export async function handleInfoflowMessage(params: HandleInfoflowMessageParams)
|
|
|
494
508
|
OriginatingChannel: "infoflow",
|
|
495
509
|
OriginatingTo: toAddress,
|
|
496
510
|
WasMentioned: isGroup ? event.wasMentioned : undefined,
|
|
511
|
+
ReplyToBody: event.replyContext ? event.replyContext.join("\n---\n") : undefined,
|
|
497
512
|
CommandAuthorized: true,
|
|
498
513
|
});
|
|
499
514
|
|
package/src/monitor.ts
CHANGED
|
@@ -65,7 +65,7 @@ function registerInfoflowWebhookTarget(target: WebhookTarget): () => void {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// ---------------------------------------------------------------------------
|
|
68
|
-
// HTTP handler (registered via api.
|
|
68
|
+
// HTTP handler (registered via api.registerHttpRoute)
|
|
69
69
|
// ---------------------------------------------------------------------------
|
|
70
70
|
|
|
71
71
|
/**
|
package/src/types.ts
CHANGED
|
@@ -167,6 +167,8 @@ export type InfoflowMessageEvent = {
|
|
|
167
167
|
bodyItems?: InfoflowInboundBodyItem[];
|
|
168
168
|
/** Non-bot mention IDs extracted from AT items in group messages (excluding bot itself) */
|
|
169
169
|
mentionIds?: InfoflowMentionIds;
|
|
170
|
+
/** Reply/quote context extracted from replyData body items (supports multiple quotes) */
|
|
171
|
+
replyContext?: string[];
|
|
170
172
|
};
|
|
171
173
|
|
|
172
174
|
// ---------------------------------------------------------------------------
|