@xmanrui/dsh-im 5.0.2 → 5.1.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 (42) hide show
  1. package/README.en.md +11 -1
  2. package/README.md +11 -1
  3. package/lib/client.js +654 -495
  4. package/lib/index.js +318 -294
  5. package/package.json +1 -1
  6. package/plugin-src/client/channels/feishu/group-settings.js +10 -9
  7. package/plugin-src/client/channels/feishu/index.js +3 -3
  8. package/plugin-src/client/global-settings.js +29 -24
  9. package/plugin-src/client/group-history-settings.js +72 -0
  10. package/plugin-src/client/i18n.js +19 -3
  11. package/plugin-src/client/styles.js +12 -4
  12. package/plugin-src/host/channels/feishu/production.mjs +2 -0
  13. package/plugin-src/host/channels/feishu/rpc.mjs +5 -4
  14. package/plugin-src/host/channels/qq/production.mjs +2 -0
  15. package/plugin-src/host/channels/shared/production.mjs +2 -0
  16. package/plugin-src/host/channels/slack/production.mjs +2 -0
  17. package/plugin-src/host/channels/whatsapp/production.mjs +2 -0
  18. package/plugin-src/host/group-history-rpc.mjs +22 -0
  19. package/plugin-src/host/group-history-runtime.mjs +21 -0
  20. package/plugin-src/host/inbound-ttl-rpc.mjs +6 -2
  21. package/plugin-src/host/index.mjs +4 -1
  22. package/src/channels/discord/discord-runtime.mjs +8 -0
  23. package/src/channels/feishu/bridge.mjs +23 -1
  24. package/src/channels/feishu/feishu-runtime.mjs +5 -0
  25. package/src/channels/feishu/multi-bot-controller.mjs +17 -3
  26. package/src/channels/feishu/plugin-controller.mjs +2 -0
  27. package/src/channels/feishu/repair-manager.mjs +2 -1
  28. package/src/channels/qq/qq-bridge.mjs +19 -0
  29. package/src/channels/qq/qq-runtime.mjs +4 -0
  30. package/src/channels/shared/conversation-state-store.mjs +1 -0
  31. package/src/channels/shared/group-history-access.mjs +133 -0
  32. package/src/channels/shared/group-history-store.mjs +383 -0
  33. package/src/channels/shared/group-history.mjs +56 -0
  34. package/src/channels/shared/harness-client.mjs +3 -0
  35. package/src/channels/shared/i18n-en/feishu.mjs +2 -2
  36. package/src/channels/shared/semantic/artifact.mjs +19 -6
  37. package/src/channels/shared/text-harness-bridge.mjs +1 -0
  38. package/src/channels/slack/manifest.mjs +2 -0
  39. package/src/channels/slack/slack-runtime.mjs +10 -2
  40. package/src/channels/telegram/telegram-runtime.mjs +7 -0
  41. package/src/channels/whatsapp/state-store.mjs +34 -1
  42. package/src/channels/whatsapp/whatsapp-runtime.mjs +42 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmanrui/dsh-im",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "icon": "./assets/logo-plugin-message-link-gradient.webp",
5
5
  "description": "把微信、飞书、企微、钉钉、QQ、Telegram、WhatsApp、Slack、Discord、Matrix接入DSH。 Connect Telegram, WhatsApp, Slack, Discord, Matrix, WeChat, Feishu, WeCom, DingTalk, and QQ to DSH.",
6
6
  "keywords": [
@@ -107,11 +107,11 @@ export function GroupResponseModeEditor({
107
107
  };
108
108
 
109
109
  const authorize = async () => {
110
- if (current !== 'all' || saving || authorizing || disabled || authorizationDisabled) return;
110
+ if (saving || authorizing || disabled || authorizationDisabled) return;
111
111
  setAuthorizing(true);
112
112
  setError(null);
113
113
  try {
114
- await onAuthorize?.();
114
+ await onAuthorize?.({ preserveResponseMode: current !== 'all' });
115
115
  } catch (cause) {
116
116
  setError(cause?.message ?? '群消息权限授权失败,请重试。');
117
117
  } finally {
@@ -142,11 +142,11 @@ export function GroupResponseModeEditor({
142
142
  current === 'mention'
143
143
  ? permissionGranted
144
144
  ? '私聊始终响应;群聊仅处理明确 @当前机器人的消息。群消息权限已开通,再次切换无需授权。'
145
- : '私聊始终响应;群聊仅处理明确 @当前机器人的消息。选择全部消息后会打开飞书官方授权流程。'
145
+ : '私聊始终响应;群聊仅处理明确 @当前机器人的消息。也可单独授权采集群消息,保持仅 @ 时回复。'
146
146
  : permissionGranted
147
147
  ? '已开通“获取群组中所有消息”权限(im:message.group_msg);机器人会处理群聊中的所有可见消息。'
148
148
  : '尚未确认“获取群组中所有消息”权限,请完成飞书授权。'),
149
- current === 'all'
149
+ (current === 'all' || !permissionGranted)
150
150
  ? h('div', { className: 'dim-feishuGroupPermissionAction' },
151
151
  h(SettingsButton, {
152
152
  disabled: disabled || authorizationDisabled || saving || authorizing,
@@ -278,11 +278,11 @@ function PermissionFlow({ provision, now, busy, botName, onRetry, onCancel, onCl
278
278
  `正在为「${botName}」开通群消息权限`),
279
279
  h('h3', null, expired ? '刷新二维码后继续' : '使用飞书确认群消息权限'),
280
280
  h('p', null,
281
- '扫码会更新现有飞书应用,只增量开通“获取群组中所有消息”权限;不会创建新应用。确认后会自动启用“响应所有群消息”,其他机器人不受影响。'),
281
+ '扫码会更新现有飞书应用,只增量开通“获取群组中所有消息”权限,不会创建新应用。单独授权采集时保留原来的回复方式;选择响应所有消息时才切换。'),
282
282
  h('ol', null,
283
283
  h('li', null, '打开飞书移动端,使用扫一扫读取二维码'),
284
284
  h('li', null, '核对现有应用,并确认“获取群组中所有消息”权限'),
285
- h('li', null, '保持本页打开,等待权限生效并自动切换响应方式')),
285
+ h('li', null, '保持本页打开,等待权限生效')),
286
286
  h('div', { className: 'dim-feishuGroupAuthorizationActions' },
287
287
  expired
288
288
  ? h(SettingsButton, { kind: 'primary', onClick: onRetry, disabled: busy },
@@ -377,7 +377,7 @@ export function FeishuGroupSettingsPage({ account, rpcCall }) {
377
377
  applySnapshot(value);
378
378
  }, [account.botId, applySnapshot, invoke]);
379
379
 
380
- const startAuthorization = React.useCallback(async ({ replace = false } = {}) => {
380
+ const startAuthorization = React.useCallback(async ({ replace = false, preserveResponseMode = provision?.preserveResponseMode === true } = {}) => {
381
381
  if (provisionBusy) return;
382
382
  const previousAttemptId = provision?.attemptId;
383
383
  setProvisionBusy(true);
@@ -393,7 +393,7 @@ export function FeishuGroupSettingsPage({ account, rpcCall }) {
393
393
  }
394
394
  const normalized = normalizeProvisioning(await invoke(
395
395
  FEISHU_ENDPOINTS.beginGroupMessagePermission,
396
- { botId: account.botId },
396
+ { botId: account.botId, ...(preserveResponseMode ? { preserveResponseMode: true } : {}) },
397
397
  ));
398
398
  if (normalized.operation !== GROUP_MESSAGE_PERMISSION_OPERATION
399
399
  || normalized.botId !== account.botId) {
@@ -405,6 +405,7 @@ export function FeishuGroupSettingsPage({ account, rpcCall }) {
405
405
  setProvision({
406
406
  phase: normalized.submitted ? 'connecting' : 'qr',
407
407
  ...normalized,
408
+ preserveResponseMode,
408
409
  durationMs: Math.max(1, normalized.expiresAt - timestamp),
409
410
  expired: false,
410
411
  });
@@ -556,7 +557,7 @@ export function FeishuGroupSettingsPage({ account, rpcCall }) {
556
557
  }
557
558
  await saveSetting(FEISHU_ENDPOINTS.setGroupResponseMode, { groupResponseMode });
558
559
  },
559
- onAuthorize: () => startAuthorization(),
560
+ onAuthorize: (options) => startAuthorization(options),
560
561
  }),
561
562
  h(MentionTopicReplyEditor, {
562
563
  value: settings.mentionTopicReply,
@@ -312,10 +312,10 @@ function QrPane({ provision, now, onRefresh, onCancel, busy }) {
312
312
  ? "使用飞书确认群消息权限"
313
313
  : "使用飞书扫码创建机器人"),
314
314
  h("p", null, repairing
315
- ? "扫码会更新现有飞书应用,增量补充当前缺少的卡片按钮回调、读取用户消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource、接收群内其他机器人 @ 当前机器人所需的 im:message.group_at_msg.include_bot:readonly,以及原生命令面板所需的 application:app_slash_command:read / write;不会创建新应用。确认页只显示当前缺少项,完成后此机器人会短暂重连,其他机器人不受影响。"
315
+ ? "扫码会更新现有飞书应用,增量补充当前缺少的卡片按钮回调、接收未 @ 群消息所需的 im:message.group_msg、读取用户消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource、接收群内其他机器人 @ 当前机器人所需的 im:message.group_at_msg.include_bot:readonly,以及原生命令面板所需的 application:app_slash_command:read / write;不会创建新应用,群回复方式保持不变,实际收到的群消息和文件会自动保存。确认页只显示当前缺少项,完成后此机器人会短暂重连,其他机器人不受影响。"
316
316
  : grantingGroupMessages
317
317
  ? "扫码会更新现有飞书应用,只增量开通“获取群组中所有消息”权限;不会创建新应用。确认后会自动启用“响应所有群消息”,其他机器人不受影响。"
318
- : "扫码只会新增一个机器人,已接入的机器人会继续正常收发消息。"),
318
+ : "扫码会新增一个机器人,并申请 im:message.group_msg(接收未 @ 的群消息)、im:message:readonly(读取消息中的图片或文件)等所需权限。新机器人默认仅 @ 时回复,实际收到的群消息和文件会自动保存;已接入的机器人继续正常收发消息。"),
319
319
  h("ol", { className: "bxf-steps dim-steps" },
320
320
  h("li", null, "打开飞书移动端,使用扫一扫读取二维码"),
321
321
  h("li", null, repairing
@@ -698,7 +698,7 @@ export function BotCard({
698
698
  role: "tooltip",
699
699
  },
700
700
  h("strong", null, "补全范围"),
701
- h("span", null, "增量添加当前缺少的卡片回调 card.action.trigger、读取消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource,以及原生命令面板所需的 application:app_slash_command:read / write;确认页只显示当前缺少项,不会创建新应用。"))),
701
+ h("span", null, "增量添加当前缺少的卡片回调 card.action.trigger、接收未 @ 群消息所需的 im:message.group_msg、读取消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource,以及原生命令面板所需的 application:app_slash_command:read / write;确认页只显示当前缺少项,不会创建新应用,群回复方式保持不变,实际收到的群消息和文件会自动保存。"))),
702
702
  h(Button, {
703
703
  className: "dim-cardAction", kind: "danger", onClick: onRequestRemove,
704
704
  disabled: Boolean(busy), ref: removeButtonRef,
@@ -1,3 +1,4 @@
1
+ import { GroupHistorySettings } from './group-history-settings.js';
1
2
  import * as React from 'react';
2
3
 
3
4
  import {
@@ -147,7 +148,7 @@ export function ImageInputSettings({ rpcCall }) {
147
148
  phase === 'loading' ? h('p', { className: 'dim-globalInline dim-imageSettingsFeedback', role: 'status' }, '正在读取图片设置…') : null);
148
149
  }
149
150
 
150
- export function GlobalSettingsPanel({ rpcCall }) {
151
+ function AttachmentSettingsPanel({ rpcCall }) {
151
152
  const [phase, setPhase] = React.useState('loading');
152
153
  const [loadError, setLoadError] = React.useState(null);
153
154
  const [ttlInput, setTtlInput] = React.useState('');
@@ -290,28 +291,9 @@ export function GlobalSettingsPanel({ rpcCall }) {
290
291
  && proposedTtl !== null
291
292
  && proposedTtl !== savedTtl;
292
293
 
293
- return h('section', { className: 'dim-generalSettingsPage', 'aria-label': '通用设置' },
294
- h('header', { className: 'dim-generalSettingsHeader' },
295
- h('h2', null, '通用设置')),
296
- h('div', { className: 'dim-generalSettingsTabsBar' },
297
- h('div', {
298
- className: 'dim-generalSettingsTabs',
299
- role: 'tablist',
300
- 'aria-label': '通用设置分类',
301
- },
302
- h('button', {
303
- type: 'button',
304
- id: ATTACHMENTS_TAB_ID,
305
- className: 'dim-generalSettingsTab',
306
- role: 'tab',
307
- 'aria-selected': true,
308
- 'aria-controls': ATTACHMENTS_PANEL_ID,
309
- }, '附件'))),
310
- h('div', {
311
- id: ATTACHMENTS_PANEL_ID,
312
- className: 'dim-generalSettingsTabPanel',
313
- role: 'tabpanel',
314
- 'aria-labelledby': ATTACHMENTS_TAB_ID,
294
+ return h('div', {
295
+ id: ATTACHMENTS_PANEL_ID, className: 'dim-generalSettingsTabPanel',
296
+ role: 'tabpanel', 'aria-labelledby': ATTACHMENTS_TAB_ID,
315
297
  },
316
298
  h('section', {
317
299
  className: 'dim-globalSection',
@@ -429,5 +411,28 @@ export function GlobalSettingsPanel({ rpcCall }) {
429
411
  'aria-live': inlineStatus.role === 'status' ? 'polite' : undefined,
430
412
  }, inlineStatus.message)
431
413
  : null)),
432
- h(ImageInputSettings, { rpcCall })));
414
+ h(ImageInputSettings, { rpcCall }));
415
+ }
416
+
417
+ export function GlobalSettingsPanel({ rpcCall }) {
418
+ const [tab, setTab] = React.useState('general');
419
+ const tabs = [{ key: 'general', label: '通用' }, { key: 'attachments', label: '附件' }];
420
+ return h('section', { className: 'dim-generalSettingsPage', 'aria-label': '通用设置' },
421
+ h('header', { className: 'dim-generalSettingsHeader' }, h('h2', null, '通用设置')),
422
+ h('div', { className: 'dim-generalSettingsTabsBar' },
423
+ h('div', { className: 'dim-generalSettingsTabs', role: 'tablist', 'aria-label': '通用设置分类' },
424
+ ...tabs.map((item) => h('button', {
425
+ key: item.key, type: 'button', id: `dim-general-settings-tab-${item.key}`,
426
+ className: 'dim-generalSettingsTab', role: 'tab', 'aria-selected': tab === item.key,
427
+ 'aria-controls': `dim-general-settings-panel-${item.key}`, tabIndex: tab === item.key ? 0 : -1,
428
+ onClick: () => setTab(item.key), onKeyDown: (event) => {
429
+ if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
430
+ event.preventDefault();
431
+ const next = event.key === 'Home' ? 'general' : event.key === 'End' ? 'attachments' : tab === 'general' ? 'attachments' : 'general';
432
+ setTab(next); globalThis.document?.getElementById(`dim-general-settings-tab-${next}`)?.focus();
433
+ },
434
+ }, item.label)))),
435
+ tab === 'general' ? h('div', { id: 'dim-general-settings-panel-general', className: 'dim-generalSettingsTabPanel', role: 'tabpanel',
436
+ 'aria-labelledby': 'dim-general-settings-tab-general' }, h(GroupHistorySettings, { rpcCall }))
437
+ : h(AttachmentSettingsPanel, { rpcCall }));
433
438
  }
@@ -0,0 +1,72 @@
1
+ import * as React from 'react';
2
+ import { h } from './i18n.js';
3
+
4
+ export const GROUP_HISTORY_SETTINGS_ENDPOINTS = Object.freeze({
5
+ get: 'settings.group-history.get', set: 'settings.group-history.set',
6
+ });
7
+
8
+ function result(value) {
9
+ if (value?.ok === false) throw new Error(value.error?.message || '无法读取或保存群记录设置,请稍后重试。');
10
+ return value?.ok === true ? value.value : value;
11
+ }
12
+
13
+ export function GroupHistorySettings({ rpcCall }) {
14
+ const [days, setDays] = React.useState('14');
15
+ const [phase, setPhase] = React.useState('loading');
16
+ const [error, setError] = React.useState(null);
17
+ const [notice, setNotice] = React.useState(null);
18
+ const mounted = React.useRef(false);
19
+ const busy = React.useRef(false);
20
+ const id = React.useId();
21
+ const load = React.useCallback(async (signal) => {
22
+ setPhase('loading'); setError(null);
23
+ try {
24
+ const settings = result(await rpcCall(GROUP_HISTORY_SETTINGS_ENDPOINTS.get, {}, signal));
25
+ if (signal?.aborted || !mounted.current) return;
26
+ if (!Number.isSafeInteger(settings?.groupHistoryRetentionDays)) throw new Error('群记录设置返回了无法识别的响应。');
27
+ setDays(String(settings.groupHistoryRetentionDays));
28
+ setError(settings.error ?? null); setPhase('ready');
29
+ } catch (caught) {
30
+ if (signal?.aborted || !mounted.current) return;
31
+ setError(caught.message); setPhase('error');
32
+ }
33
+ }, [rpcCall]);
34
+ React.useEffect(() => {
35
+ mounted.current = true;
36
+ const controller = new AbortController();
37
+ void load(controller.signal);
38
+ return () => { mounted.current = false; controller.abort(); };
39
+ }, [load]);
40
+
41
+ const save = async (event) => {
42
+ event.preventDefault();
43
+ if (busy.current || phase !== 'ready') return;
44
+ const value = Number(days);
45
+ if (!/^\d+$/.test(days.trim()) || !Number.isSafeInteger(value) || value < 1 || !Number.isSafeInteger(value * 86400000)) {
46
+ setError('保留天数必须为正整数。'); return;
47
+ }
48
+ busy.current = true; setPhase('saving'); setError(null); setNotice(null);
49
+ try {
50
+ const settings = result(await rpcCall(GROUP_HISTORY_SETTINGS_ENDPOINTS.set, { groupHistoryRetentionDays: value }));
51
+ if (mounted.current) { setDays(String(settings.groupHistoryRetentionDays)); setNotice('已保存'); }
52
+ } catch (caught) { if (mounted.current) setError(caught.message); }
53
+ finally { busy.current = false; if (mounted.current) setPhase('ready'); }
54
+ };
55
+ return h('section', { className: 'dim-botGeneralSettings dim-groupHistorySettings', 'aria-label': '群聊天记录', 'aria-busy': phase === 'loading' || phase === 'saving' },
56
+ h('form', { onSubmit: save },
57
+ h('div', { className: 'dim-botGeneralRow' },
58
+ h('div', { className: 'dim-botGeneralText' },
59
+ h('label', { className: 'dim-botGeneralTitle', htmlFor: `${id}-days` }, '群聊天记录保留天数'),
60
+ h('p', { className: 'dim-botGeneralHelp', id: `${id}-description` }, '过期的群消息和文件会自动清理。')),
61
+ h('div', { className: 'dim-botGeneralControl dim-groupHistoryControl' },
62
+ h('input', { id: `${id}-days`, className: 'dim-groupHistoryInput', type: 'number', min: 1, step: 1,
63
+ value: days, disabled: phase !== 'ready', 'aria-describedby': `${id}-description`,
64
+ onChange: (event) => { setDays(event.target.value); setNotice(null); } }),
65
+ h('span', { className: 'dim-groupHistoryUnit' }, '天'))),
66
+ h('div', { className: 'dim-botGeneralActions' },
67
+ h('button', { type: 'submit', className: 'dim-deliveryButton dim-groupHistorySave', 'data-kind': 'primary',
68
+ disabled: phase !== 'ready' }, phase === 'saving' ? '保存中…' : '保存'))),
69
+ phase === 'loading' ? h('p', { role: 'status', className: 'dim-botGeneralHelp dim-groupHistoryFeedback' }, '正在读取群记录设置…') : null,
70
+ error ? h('p', { role: 'alert', className: 'dim-accessFeedback dim-groupHistoryFeedback', 'data-tone': 'error' }, error) : null,
71
+ notice ? h('p', { role: 'status', className: 'dim-botGeneralHelp dim-groupHistoryFeedback' }, notice) : null);
72
+ }
@@ -10,6 +10,22 @@ const EN = Object.freeze({
10
10
  ...diagnostics,
11
11
  ...imageInput,
12
12
  '$locale': 'en',
13
+ '保持本页打开,等待权限生效': 'Keep this page open while the permission takes effect',
14
+ "群聊天记录": "Group chat history",
15
+ "群聊天记录保留天数": "Group chat retention (days)",
16
+ "过期的群消息和文件会自动清理。": "Expired group messages and files are removed automatically.",
17
+ "保留天数": "Retention days",
18
+ "天": "days",
19
+ "正在读取群记录设置…": "Loading group history settings…",
20
+ "保留天数必须为正整数。": "Retention days must be a positive integer.",
21
+ "无法读取或保存群记录设置,请稍后重试。": "Unable to read or save group history settings. Try again.",
22
+ "群记录设置返回了无法识别的响应。": "Unrecognized group history settings response.",
23
+ "扫码会更新现有飞书应用,只增量开通“获取群组中所有消息”权限,不会创建新应用。单独授权采集时保留原来的回复方式;选择响应所有消息时才切换。": "Scanning updates the existing Feishu app with permission to receive all group messages. Separate recording authorization preserves the reply mode; selecting all-message replies changes it.",
24
+ "私聊始终响应;群聊仅处理明确 @当前机器人的消息。也可单独授权采集群消息,保持仅 @ 时回复。": "Direct messages always receive replies; groups require a mention. You can authorize group recording separately below.",
25
+ "需授权 im:message.group_msg;授权采集不改变群回复模式。": "Requires im:message.group_msg. Recording authorization does not change the reply mode.",
26
+ "关闭 Privacy Mode 或设为群管理员后才能接收普通群消息;只保存平台实际投递的消息。": "Disable Privacy Mode or make the bot a group administrator. Only messages actually delivered by the platform are saved.",
27
+ "需要频道访问权限及 MESSAGE_CONTENT;未授权时正文和附件可能为空。": "Requires channel access and MESSAGE_CONTENT. Text and attachments may be empty without authorization.",
28
+ "需订阅 message.channels / message.groups,并已加入目标频道。": "Subscribe to message.channels / message.groups and add the bot to the target channel.",
13
29
  '修改别名': 'Edit alias',
14
30
  '关闭修改别名': 'Close alias editor',
15
31
  '原名称': 'Original name',
@@ -566,7 +582,7 @@ const EN = Object.freeze({
566
582
  '正在申请 QQ 二维码…': 'Requesting QQ QR code…',
567
583
  '正在生成 WhatsApp 二维码': 'Generating WhatsApp QR code',
568
584
  '扫码,创建第一个飞书入口': 'Scan to create your first Feishu bot',
569
- '扫码只会新增一个机器人,已接入的机器人会继续正常收发消息。': 'Scanning adds one bot. Existing bots will continue to send and receive messages.',
585
+ '扫码会新增一个机器人,并申请 im:message.group_msg(接收未 @ 的群消息)、im:message:readonly(读取消息中的图片或文件)等所需权限。新机器人默认仅 @ 时回复,实际收到的群消息和文件会自动保存;已接入的机器人继续正常收发消息。': 'Scanning creates a bot and requests the required permissions, including im:message.group_msg for group messages without mentions and im:message:readonly for images or files in messages. New bots reply only when mentioned by default; received group messages and files are saved automatically. Existing bots continue to work.',
570
586
  '无需手动填写 App ID。以后还可以继续添加机器人,分别服务不同团队或飞书租户。': 'No App ID is required. You can add more bots later for different teams or Feishu tenants.',
571
587
  '使用飞书扫码创建机器人': 'Scan with Feishu to create a bot',
572
588
  '刷新二维码后继续': 'Refresh the QR code to continue',
@@ -586,7 +602,7 @@ const EN = Object.freeze({
586
602
  '权限配置已提交,正在启用全部消息模式并重连此机器人;此阶段无法取消,其他机器人不会中断。': 'The permission update was submitted. Enabling all-message mode and reconnecting this bot. This stage cannot be cancelled; other bots will not be interrupted.',
587
603
  '正在为现有飞书应用申请群消息权限二维码,请稍候。': 'Requesting a group-message permission QR code for the existing Feishu app…',
588
604
  '群消息权限没有开通完成': 'Group-message permission was not granted',
589
- '扫码会更新现有飞书应用,增量补充当前缺少的卡片按钮回调、读取用户消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource、接收群内其他机器人 @ 当前机器人所需的 im:message.group_at_msg.include_bot:readonly,以及原生命令面板所需的 application:app_slash_command:read / write;不会创建新应用。确认页只显示当前缺少项,完成后此机器人会短暂重连,其他机器人不受影响。': 'Scanning updates the existing Feishu app with the missing card-button callback, im:message:readonly for reading images or files in user messages (shown by Feishu as “Read direct and group messages”), im:resource for uploading images or files sent by the bot, im:message.group_at_msg.include_bot:readonly for receiving group messages from other bots that mention this bot, and application:app_slash_command:read / write for the native command panel. It does not create a new app. The confirmation page shows only missing items; this bot reconnects briefly afterward, while other bots are unaffected.',
605
+ '扫码会更新现有飞书应用,增量补充当前缺少的卡片按钮回调、接收未 @ 群消息所需的 im:message.group_msg、读取用户消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource、接收群内其他机器人 @ 当前机器人所需的 im:message.group_at_msg.include_bot:readonly,以及原生命令面板所需的 application:app_slash_command:read / write;不会创建新应用,群回复方式保持不变,实际收到的群消息和文件会自动保存。确认页只显示当前缺少项,完成后此机器人会短暂重连,其他机器人不受影响。': 'Scanning updates the existing Feishu app with the missing card-button callback, im:message.group_msg for group messages without mentions, im:message:readonly for reading images or files in user messages (shown by Feishu as “Read direct and group messages”), im:resource for uploading images or files sent by the bot, im:message.group_at_msg.include_bot:readonly for receiving group messages from other bots that mention this bot, and application:app_slash_command:read / write for the native command panel. It does not create a new app or change the group reply mode. Received group messages and files are saved automatically. The confirmation page shows only missing items; this bot reconnects briefly afterward, while other bots are unaffected.',
590
606
  '核对现有应用名称,并确认只新增当前缺少的上述配置': 'Review the existing app name and confirm that only the missing items described above are added',
591
607
  '保持本页打开,等待权限与回调补全完成': 'Keep this page open until permissions and the callback are complete',
592
608
  '取消补全': 'Cancel setup',
@@ -597,7 +613,7 @@ const EN = Object.freeze({
597
613
  '权限与回调没有补全完成': 'Permissions and callback setup did not finish',
598
614
  '补全权限': 'Complete permissions',
599
615
  '补全范围': 'Completion scope',
600
- '增量添加当前缺少的卡片回调 card.action.trigger、读取消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource,以及原生命令面板所需的 application:app_slash_command:read / write;确认页只显示当前缺少项,不会创建新应用。': 'Adds the missing card callback card.action.trigger, im:message:readonly for reading images or files in messages (shown by Feishu as “Read direct and group messages”), im:resource for uploading images or files sent by the bot, and application:app_slash_command:read / write for the native command panel. The confirmation page shows only missing items; no new app is created.',
616
+ '增量添加当前缺少的卡片回调 card.action.trigger、接收未 @ 群消息所需的 im:message.group_msg、读取消息内图片或文件所需的 im:message:readonly(飞书显示为“获取单聊、群组消息”)、上传机器人图片或文件所需的 im:resource,以及原生命令面板所需的 application:app_slash_command:read / write;确认页只显示当前缺少项,不会创建新应用,群回复方式保持不变,实际收到的群消息和文件会自动保存。': 'Adds the missing card callback card.action.trigger, im:message.group_msg for group messages without mentions, im:message:readonly for reading images or files in messages (shown by Feishu as “Read direct and group messages”), im:resource for uploading images or files sent by the bot, and application:app_slash_command:read / write for the native command panel. The confirmation page shows only missing items; no new app is created, and the group reply mode stays unchanged. Received group messages and files are saved automatically.',
601
617
  '等待扫码…': 'Waiting for scan…',
602
618
  '飞书服务返回了不匹配的权限补全二维码': 'Feishu returned a permission-completion QR code for a different bot',
603
619
  '飞书服务返回了不匹配的群消息权限二维码': 'Feishu returned a group-message permission QR code for a different bot',
@@ -643,10 +643,11 @@ const CSS = String.raw`
643
643
  .dim-botGeneralHelp { margin: 0; color: var(--dsw-alias-label-tertiary, #8f959e); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
644
644
  .dim-botGeneralPanelHelp { padding-bottom: 16px; border-bottom: 1px solid var(--dsw-alias-border-l2, #dfe1e5); }
645
645
  .dim-botGeneralControl { position: relative; min-width: 0; max-width: 100%; justify-self: end; color: var(--dsw-alias-label-primary, #1f2329); }
646
- .dim-botGeneralControl select { display: block; min-width: 104px; max-width: 100%; height: 36px; padding: 0 36px 0 14px; border: 0; border-radius: 10px; color: inherit; background: var(--dsw-alias-bg-module-platform, #f5f6f7); font: inherit; font-size: 14px; line-height: 22px; appearance: none; cursor: pointer; }
647
- .dim-botGeneralControl select:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, #eef0f3); }
648
- .dim-botGeneralControl select:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; }
649
- .dim-botGeneralControl select:disabled { opacity: .5; cursor: not-allowed; }
646
+ .dim-botGeneralControl select, .dim-groupHistoryInput { display: block; min-width: 104px; max-width: 100%; height: 36px; padding: 0 36px 0 14px; border: 0; border-radius: 10px; color: inherit; background: var(--dsw-alias-bg-module-platform, #f5f6f7); font: inherit; font-size: 14px; line-height: 22px; appearance: none; }
647
+ .dim-botGeneralControl select { cursor: pointer; }
648
+ .dim-botGeneralControl select:hover:not(:disabled), .dim-groupHistoryInput:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, #eef0f3); }
649
+ .dim-botGeneralControl select:focus-visible, .dim-groupHistoryInput:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; }
650
+ .dim-botGeneralControl select:disabled, .dim-groupHistoryInput:disabled { opacity: .5; cursor: not-allowed; }
650
651
  .dim-botGeneralControl svg { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); pointer-events: none; }
651
652
  .dim-botGeneralControl .dim-contextSwitch { display: block; }
652
653
  .dim-botGeneralControl .dim-contextSwitch:disabled { opacity: .5; cursor: not-allowed; }
@@ -665,6 +666,13 @@ const CSS = String.raw`
665
666
  .dim-generalSettingsTab[aria-selected="true"]::after { background: var(--dim-blue); transform: scaleX(1); }
666
667
  .dim-generalSettingsTab:focus-visible { outline: 2px solid var(--dim-blue); outline-offset: -2px; border-radius: 5px; }
667
668
  .dim-generalSettingsTabPanel { min-width: 0; padding-top: 14px; }
669
+ .dim-groupHistoryControl { width: 104px; }
670
+ .dim-groupHistoryInput { box-sizing: border-box; width: 100%; appearance: textfield; }
671
+ .dim-groupHistoryInput::-webkit-inner-spin-button, .dim-groupHistoryInput::-webkit-outer-spin-button { margin: 0; appearance: none; }
672
+ .dim-groupHistoryUnit { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); color: var(--dsw-alias-label-secondary, #646a73); font-size: 12px; line-height: 18px; pointer-events: none; }
673
+ .dim-deliveryButton.dim-groupHistorySave { min-width: 58px; min-height: 36px; border-radius: 10px; }
674
+ .dim-groupHistoryFeedback { margin-top: 12px; }
675
+
668
676
  .dim-globalSection { min-width: 0; padding: 14px 16px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 12px; background: var(--dsw-alias-bg-layer-3, #fff); }
669
677
  .dim-globalSection + .dim-globalSection { margin-top: 12px; }
670
678
  .dim-imageSettings { container-type: inline-size; }
@@ -1,3 +1,4 @@
1
+ import { getGroupHistoryStore } from '../../group-history-runtime.mjs';
1
2
  import { getImageInputSettingsStore } from '../../../../src/channels/shared/image-input-settings-store.mjs';
2
3
  import { t } from '../../../../src/channels/shared/i18n.mjs';
3
4
  import { homedir } from 'node:os';
@@ -266,6 +267,7 @@ export async function createProductionController(ctx, config = {}, internals = {
266
267
  ownerOpenIds: botConfig.ownerOpenIds ?? [botConfig.ownerOpenId],
267
268
  harness: workspaceScope.harness,
268
269
  state: workspaceScope.state,
270
+ groupHistory: internals.groupHistory ?? getGroupHistoryStore(ctx, config),
269
271
  contextEnhancement: { botId: id, getSettings: () => workspaces.contextEnhancementFor(id) },
270
272
  accessPolicy: accessPolicyProvider(workspaces, id, {
271
273
  channel: 'feishu', config: botConfig,
@@ -105,6 +105,7 @@ const PUBLIC_ERROR_MESSAGES = Object.freeze({
105
105
  credential_update_failed: 'Unable to store the repaired Feishu credentials.',
106
106
  credential_state_unknown: 'The repaired Feishu credentials could not be confirmed after saving.',
107
107
  repair_connection_failed: 'The callback update was accepted, but the selected bot could not reconnect.',
108
+ repair_permissions_save_failed: 'Feishu granted the permissions, but their local state could not be saved. Please retry.',
108
109
  group_message_permission_required: 'Authorize access to all group messages before enabling this mode.',
109
110
  group_message_permission_save_failed: 'Feishu granted the permission, but all-message mode could not be saved.',
110
111
  group_message_permission_connection_failed: 'Feishu granted the permission, but the selected bot could not reconnect.',
@@ -411,9 +412,9 @@ function validPayload(endpoint, payload) {
411
412
  : 'Callback repair requires a single valid botId.';
412
413
  }
413
414
  if (endpoint === FEISHU_ENDPOINTS.beginGroupMessagePermission) {
414
- return hasOnlyKeys(payload, new Set(['botId'])) && safeOpaqueId(payload.botId)
415
- ? null
416
- : 'Group message permission update requires a single valid botId.';
415
+ return hasOnlyKeys(payload, new Set(['botId', 'preserveResponseMode'])) && safeOpaqueId(payload.botId)
416
+ && (payload.preserveResponseMode === undefined || typeof payload.preserveResponseMode === 'boolean')
417
+ ? null : 'Group message permission update requires a valid botId and optional preserveResponseMode.';
417
418
  }
418
419
  if (endpoint === FEISHU_ENDPOINTS.bindCredentials) {
419
420
  return hasOnlyKeys(payload, new Set(['appId', 'appSecret', 'domain']))
@@ -656,7 +657,7 @@ export function createFeishuRpcHandler(controller, { encodeQr = qrCodeDataUrl }
656
657
  if (typeof controller.startGroupMessagePermission !== 'function') {
657
658
  throw new Error('Feishu group message permission update is unavailable.');
658
659
  }
659
- const started = await controller.startGroupMessagePermission(payload.botId);
660
+ const started = await controller.startGroupMessagePermission(payload.botId, { preserveResponseMode: payload.preserveResponseMode === true });
660
661
  const attemptId = String(publicRegistration(started?.registration).attempt);
661
662
  const ready = await waitForQr(controller, started, attemptId, signal);
662
663
  value = (await toPublicFeishuStatus(ready, { encodeQr: cachedEncodeQr })).provisioning;
@@ -1,3 +1,4 @@
1
+ import { getGroupHistoryStore } from '../../group-history-runtime.mjs';
1
2
  import { getImageInputSettingsStore } from '../../../../src/channels/shared/image-input-settings-store.mjs';
2
3
  import { unlink } from 'node:fs/promises';
3
4
  import { homedir } from 'node:os';
@@ -128,6 +129,7 @@ export async function createProductionController(ctx, config = {}, internals = {
128
129
  appSecret,
129
130
  harness: workspaceScope.harness,
130
131
  state: workspaceScope.state,
132
+ groupHistory: internals.groupHistory ?? getGroupHistoryStore(ctx, config),
131
133
  contextEnhancement: { botId, getSettings: () => workspaces.contextEnhancementFor(botId) },
132
134
  accessPolicy: accessPolicyProvider(workspaces, botId, {
133
135
  channel: 'qq', config: botConfig,
@@ -1,3 +1,4 @@
1
+ import { getGroupHistoryStore } from '../../group-history-runtime.mjs';
1
2
  import { getImageInputSettingsStore } from '../../../../src/channels/shared/image-input-settings-store.mjs';
2
3
  import { unlink } from 'node:fs/promises';
3
4
  import { homedir } from 'node:os';
@@ -181,6 +182,7 @@ export async function createTokenProductionController(ctx, config, internals, de
181
182
  ...(typeof createTransport === 'function' ? { createTransport } : {}),
182
183
  harness: workspaceScope.harness,
183
184
  state: workspaceScope.state,
185
+ groupHistory: internals.groupHistory ?? (['telegram', 'discord'].includes(channel) ? getGroupHistoryStore(ctx, config) : undefined),
184
186
  contextEnhancement: { botId, getSettings: () => workspaces.contextEnhancementFor(botId) },
185
187
  accessPolicy: accessPolicyProvider(workspaces, botId, { channel, config: botConfig }),
186
188
  replyTimeoutMs: config.replyTimeoutMs ?? 600_000,
@@ -1,3 +1,4 @@
1
+ import { getGroupHistoryStore } from '../../group-history-runtime.mjs';
1
2
  import { getImageInputSettingsStore } from '../../../../src/channels/shared/image-input-settings-store.mjs';
2
3
  import { unlink } from 'node:fs/promises';
3
4
  import { resolve } from 'node:path';
@@ -116,6 +117,7 @@ export async function createProductionController(ctx, config = {}, internals = {
116
117
  appToken,
117
118
  harness: workspaceScope.harness,
118
119
  state: workspaceScope.state,
120
+ groupHistory: internals.groupHistory ?? getGroupHistoryStore(ctx, config),
119
121
  contextEnhancement: { botId, getSettings: () => workspaces.contextEnhancementFor(botId) },
120
122
  accessPolicy: accessPolicyProvider(workspaces, botId, {
121
123
  channel: 'slack', config: botConfig,
@@ -1,3 +1,4 @@
1
+ import { getGroupHistoryStore } from '../../group-history-runtime.mjs';
1
2
  import { getImageInputSettingsStore } from '../../../../src/channels/shared/image-input-settings-store.mjs';
2
3
  import { rm, unlink } from 'node:fs/promises';
3
4
  import { homedir } from 'node:os';
@@ -136,6 +137,7 @@ export async function createProductionController(ctx, config = {}, internals = {
136
137
  authDir,
137
138
  harness: workspaceScope.harness,
138
139
  state: workspaceScope.state,
140
+ groupHistory: internals.groupHistory ?? getGroupHistoryStore(ctx, config),
139
141
  contextEnhancement: { botId, getSettings: () => workspaces.contextEnhancementFor(botId) },
140
142
  accessPolicy: accessPolicyProvider(workspaces, botId, {
141
143
  channel: 'whatsapp', config: botConfig, equals: whatsappAccessPolicyIdsEqual,
@@ -0,0 +1,22 @@
1
+ export const GROUP_HISTORY_ENDPOINTS = Object.freeze({
2
+ get: 'settings.group-history.get', set: 'settings.group-history.set',
3
+ });
4
+
5
+ export function createGroupHistoryRpcHandler(store) {
6
+ return async (endpoint, payload, signal) => {
7
+ if (!payload || typeof payload !== 'object' || Array.isArray(payload) || signal?.aborted) {
8
+ return { ok: false, error: { code: 'bad-request', message: '群记录设置请求无效。' } };
9
+ }
10
+ const keys = Object.keys(payload).sort().join(',');
11
+ try {
12
+ let value;
13
+ if (endpoint === GROUP_HISTORY_ENDPOINTS.get && keys === '') value = await store.settings();
14
+ else if (endpoint === GROUP_HISTORY_ENDPOINTS.set && keys === 'groupHistoryRetentionDays') value = await store.setRetentionDays(payload.groupHistoryRetentionDays);
15
+ else throw new Error('群记录设置请求无效。');
16
+ return { ok: true, value };
17
+ } catch (error) {
18
+ return { ok: false, error: { code: error.code ?? 'group-history-unavailable',
19
+ message: error.code === 'group-history-invalid' ? error.message : '无法读取或保存群记录设置,请稍后重试。' } };
20
+ }
21
+ };
22
+ }
@@ -0,0 +1,21 @@
1
+ import { homedir } from 'node:os';
2
+ import { join, resolve } from 'node:path';
3
+ import { GroupHistoryStore } from '../../src/channels/shared/group-history-store.mjs';
4
+ import { getInboundTtlRuntime } from './inbound-ttl-runtime.mjs';
5
+
6
+ const runtimes = new Map();
7
+
8
+ export function getGroupHistoryStore(ctx, config = {}) {
9
+ const home = resolve(config.dshHome ?? process.env.DSH_HOME ?? join(homedir(), '.dsh'));
10
+ const root = join(home, 'integrations', 'dsh-im');
11
+ if (runtimes.has(root)) return runtimes.get(root);
12
+ const logger = typeof ctx?.logger === 'function' ? ctx.logger('dsh-im:group-history') : ctx?.logger ?? console;
13
+ const store = new GroupHistoryStore(root, { logger, copyService: getInboundTtlRuntime(ctx, config).service });
14
+ runtimes.set(root, store);
15
+ void store.start().catch((error) => logger.error?.('[dsh-im] group history unavailable:', error.message));
16
+ ctx?.effect?.(() => () => {
17
+ if (runtimes.get(root) === store) runtimes.delete(root);
18
+ return store.close();
19
+ }, 'dsh-im: close group history');
20
+ return store;
21
+ }
@@ -3,6 +3,8 @@ import { normalizeInboundTtlHours } from '../../src/channels/shared/inbound-ttl.
3
3
  import { getInboundTtlRuntime } from './inbound-ttl-runtime.mjs';
4
4
  import { getImageInputSettingsStore } from '../../src/channels/shared/image-input-settings-store.mjs';
5
5
  import { createImageInputRpcHandler, IMAGE_INPUT_ENDPOINTS } from './image-input-rpc.mjs';
6
+ import { getGroupHistoryStore } from './group-history-runtime.mjs';
7
+ import { createGroupHistoryRpcHandler, GROUP_HISTORY_ENDPOINTS } from './group-history-rpc.mjs';
6
8
 
7
9
  export const INBOUND_TTL_RPC_CHANNEL = '/dsh-im-settings';
8
10
  export const INBOUND_TTL_ENDPOINTS = Object.freeze({
@@ -77,10 +79,12 @@ export function installInboundTtlRpc(ctx, options = {}) {
77
79
  ? ctx.logger('dsh-im:inbound-ttl') : (ctx?.logger ?? null);
78
80
  const ttl = createInboundTtlRpcHandler({ ...runtime, logger });
79
81
  const image = createImageInputRpcHandler(getImageInputSettingsStore(options.config));
82
+ const history = createGroupHistoryRpcHandler(options.groupHistory ?? getGroupHistoryStore(ctx, options.config));
80
83
  return registerManagementRpc(ctx,
81
84
  INBOUND_TTL_RPC_CHANNEL,
82
- (endpoint, payload, signal) => Object.values(IMAGE_INPUT_ENDPOINTS).includes(endpoint)
83
- ? image(endpoint, payload, signal) : ttl(endpoint, payload, signal),
85
+ (endpoint, payload, signal) => Object.values(GROUP_HISTORY_ENDPOINTS).includes(endpoint)
86
+ ? history(endpoint, payload, signal) : Object.values(IMAGE_INPUT_ENDPOINTS).includes(endpoint)
87
+ ? image(endpoint, payload, signal) : ttl(endpoint, payload, signal),
84
88
  { authority: 'loopback' },
85
89
  );
86
90
  }
@@ -1,3 +1,4 @@
1
+ import { installGroupHistoryTools } from '../../src/channels/shared/group-history-access.mjs';
1
2
  import { apply as applyDingtalk } from './channels/dingtalk/index.mjs';
2
3
  import { apply as applyDiscord } from './channels/discord/index.mjs';
3
4
  import { apply as applyOffice } from './channels/office/index.mjs';
@@ -32,7 +33,7 @@ export const inject = [
32
33
  ];
33
34
 
34
35
  function channelConfig(config, name, deliveryService) {
35
- const channel = config[name] ?? {};
36
+ const channel = { ...(config.dshHome ? { dshHome: config.dshHome } : {}), ...config[name] };
36
37
  const withAuthority = config.rpcAuthority === undefined
37
38
  ? channel
38
39
  : { ...channel, rpcAuthority: config.rpcAuthority };
@@ -147,9 +148,11 @@ export function createImHostPlugin(internals = {}) {
147
148
  if (typeof ctx?.inject === 'function') {
148
149
  ctx.inject(['tools', 'systemPrompt'], (artifactCtx) => {
149
150
  installOutboundArtifactTool(artifactCtx);
151
+ installGroupHistoryTools(artifactCtx);
150
152
  });
151
153
  } else {
152
154
  installOutboundArtifactTool(ctx);
155
+ installGroupHistoryTools(ctx);
153
156
  }
154
157
  const logger = typeof ctx?.logger === 'function'
155
158
  ? ctx.logger(name)
@@ -1,3 +1,4 @@
1
+ import { captureGroupHistory, groupHistoryEntry } from '../shared/group-history.mjs';
1
2
  import { extractConnectionEvidence, createConnectionDiagnostics, atConnectionStage } from '../shared/connection-error.mjs';
2
3
  import { createEditableMessageStream, splitMessageText } from '../shared/editable-message-stream.mjs';
3
4
  import { chunkMarkdownText } from '../shared/markdown-chunks.mjs';
@@ -544,6 +545,7 @@ export class DiscordRuntime {
544
545
  #harness;
545
546
  #state;
546
547
  #contextEnhancement;
548
+ #groupHistory;
547
549
  #accessPolicy;
548
550
  #logger;
549
551
  #diagnostics;
@@ -577,6 +579,7 @@ export class DiscordRuntime {
577
579
  harness,
578
580
  state,
579
581
  contextEnhancement,
582
+ groupHistory,
580
583
  accessPolicy,
581
584
  logger = console,
582
585
  replyTimeoutMs = 600_000,
@@ -594,6 +597,7 @@ export class DiscordRuntime {
594
597
  this.#harness = harness;
595
598
  this.#state = state;
596
599
  this.#contextEnhancement = contextEnhancement;
600
+ this.#groupHistory = groupHistory;
597
601
  this.#accessPolicy = accessPolicy;
598
602
  this.#logger = logger; this.#diagnostics = createConnectionDiagnostics({ channel: 'discord', logger });
599
603
  this.#replyTimeoutMs = replyTimeoutMs;
@@ -864,6 +868,9 @@ export class DiscordRuntime {
864
868
  const messageId = String(message?.id ?? '');
865
869
  if (!messageId || this.#state.hasSeen(messageId)) return;
866
870
  const preflight = normalizeDiscordMessage(message, this.#config.platformId);
871
+ if (preflight) await captureGroupHistory(this.#groupHistory, preflight, groupHistoryEntry('discord', message, preflight, {
872
+ groupName: this.#channels.get(String(message.channel_id))?.name,
873
+ }), { logger: this.#logger });
867
874
  let accessDecision;
868
875
  if (preflight?.kind === 'group' && preflight.addressed === true
869
876
  && preflight.senderIsBot !== true) {
@@ -903,6 +910,7 @@ export class DiscordRuntime {
903
910
  try {
904
911
  const normalized = await route.pendingRoute;
905
912
  if (normalized) {
913
+ normalized.groupHistory = preflight?.groupHistory;
906
914
  await bridge.accept(normalized, {
907
915
  contextSnapshot: route.contextSnapshot,
908
916
  busyMessageMode: route.busyMessageMode,