@xmanrui/dsh-im 5.4.0 → 5.6.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 (105) hide show
  1. package/PROACTIVE_DELIVERY.en.md +15 -0
  2. package/PROACTIVE_DELIVERY.md +15 -0
  3. package/README.en.md +46 -5
  4. package/README.md +46 -5
  5. package/lib/client.js +2579 -664
  6. package/lib/index.js +406 -339
  7. package/package.json +4 -4
  8. package/plugin-src/client/channel-card-meta.js +6 -2
  9. package/plugin-src/client/channels/dingtalk/index.js +12 -9
  10. package/plugin-src/client/channels/feishu/group-settings.js +5 -5
  11. package/plugin-src/client/channels/feishu/index.js +33 -25
  12. package/plugin-src/client/channels/qq/index.js +5 -5
  13. package/plugin-src/client/channels/shared/token-api.js +25 -7
  14. package/plugin-src/client/channels/shared/token-channel.js +18 -11
  15. package/plugin-src/client/channels/telegram/styles.js +4 -0
  16. package/plugin-src/client/channels/telegram/thinking-traces.js +138 -5
  17. package/plugin-src/client/channels/wecom/index.js +5 -5
  18. package/plugin-src/client/channels/wecom-app/index.js +3 -3
  19. package/plugin-src/client/channels/weixin/index.js +2 -2
  20. package/plugin-src/client/channels/whatsapp/index.js +6 -6
  21. package/plugin-src/client/credential-binding.js +3 -2
  22. package/plugin-src/client/delivery-settings.js +4 -4
  23. package/plugin-src/client/ds-bot-settings.js +3 -3
  24. package/plugin-src/client/global-settings.js +5 -2
  25. package/plugin-src/client/i18n-ru.js +1637 -0
  26. package/plugin-src/client/i18n.js +281 -124
  27. package/plugin-src/client/index.js +8 -1
  28. package/plugin-src/host/channels/shared/production.mjs +5 -0
  29. package/plugin-src/host/channels/shared/rpc.mjs +21 -0
  30. package/plugin-src/host/channels/shared/send-limit-rpc.mjs +13 -0
  31. package/plugin-src/host/channels/shared/thinking-cadence-rpc.mjs +16 -0
  32. package/plugin-src/host/channels/telegram/production.mjs +7 -0
  33. package/plugin-src/host/delivery-adapter.mjs +41 -33
  34. package/plugin-src/host/delivery-service.mjs +42 -0
  35. package/plugin-src/host/ds-bot-client.mjs +31 -18
  36. package/plugin-src/host/ds-bot-question-sync.mjs +78 -0
  37. package/plugin-src/host/index.mjs +3 -0
  38. package/plugin-src/host/modern-harness-api.mjs +53 -8
  39. package/plugin-src/host/session-sync-coordinator.mjs +5 -5
  40. package/scripts/verify-package.mjs +18 -6
  41. package/src/channels/dingtalk/dingtalk-bridge.mjs +1 -0
  42. package/src/channels/feishu/bridge.mjs +107 -7
  43. package/src/channels/feishu/feishu-cards.mjs +1 -45
  44. package/src/channels/feishu/feishu-runtime.mjs +10 -0
  45. package/src/channels/feishu/multi-bot-controller.mjs +12 -0
  46. package/src/channels/feishu/slash-command-panel.mjs +2 -5
  47. package/src/channels/qq/qq-bridge.mjs +1 -0
  48. package/src/channels/shared/AGENTS.md +19 -0
  49. package/src/channels/shared/bot-workspace-store.mjs +1 -1
  50. package/src/channels/shared/clear-command.mjs +2 -1
  51. package/src/channels/shared/command-catalog.mjs +8 -5
  52. package/src/channels/shared/compact-command.mjs +2 -1
  53. package/src/channels/shared/conversation-queue.mjs +49 -0
  54. package/src/channels/shared/deferred-delivery-coordinator.mjs +2 -1
  55. package/src/channels/shared/delivery-failure-log.mjs +111 -0
  56. package/src/channels/shared/diagnostic-details.mjs +1 -0
  57. package/src/channels/shared/harness-client.mjs +16 -9
  58. package/src/channels/shared/history-command.mjs +2 -1
  59. package/src/channels/shared/i18n-en/shared-a.mjs +2 -2
  60. package/src/channels/shared/i18n-en/shared-b.mjs +7 -2
  61. package/src/channels/shared/i18n-en/shared-c.mjs +6 -2
  62. package/src/channels/shared/i18n-en/telegram.mjs +6 -0
  63. package/src/channels/shared/i18n-ru/diagnostics.mjs +104 -0
  64. package/src/channels/shared/i18n-ru/dingtalk.mjs +96 -0
  65. package/src/channels/shared/i18n-ru/discord.mjs +10 -0
  66. package/src/channels/shared/i18n-ru/email.mjs +23 -0
  67. package/src/channels/shared/i18n-ru/feishu.mjs +374 -0
  68. package/src/channels/shared/i18n-ru/image-input.mjs +25 -0
  69. package/src/channels/shared/i18n-ru/matrix.mjs +73 -0
  70. package/src/channels/shared/i18n-ru/office.mjs +27 -0
  71. package/src/channels/shared/i18n-ru/permission.mjs +45 -0
  72. package/src/channels/shared/i18n-ru/qq.mjs +88 -0
  73. package/src/channels/shared/i18n-ru/shared-a.mjs +236 -0
  74. package/src/channels/shared/i18n-ru/shared-b.mjs +262 -0
  75. package/src/channels/shared/i18n-ru/shared-c.mjs +176 -0
  76. package/src/channels/shared/i18n-ru/slack.mjs +22 -0
  77. package/src/channels/shared/i18n-ru/telegram.mjs +30 -0
  78. package/src/channels/shared/i18n-ru/wecom-app.mjs +43 -0
  79. package/src/channels/shared/i18n-ru/wecom.mjs +79 -0
  80. package/src/channels/shared/i18n-ru/weixin.mjs +275 -0
  81. package/src/channels/shared/i18n-ru/whatsapp.mjs +18 -0
  82. package/src/channels/shared/i18n-ru.mjs +48 -0
  83. package/src/channels/shared/i18n.mjs +47 -12
  84. package/src/channels/shared/inbound-access.mjs +1 -1
  85. package/src/channels/shared/interface-language.mjs +3 -3
  86. package/src/channels/shared/message-failure.mjs +8 -4
  87. package/src/channels/shared/model-command.mjs +2 -1
  88. package/src/channels/shared/permission-command.mjs +2 -1
  89. package/src/channels/shared/send-limit.mjs +38 -0
  90. package/src/channels/shared/session-error.mjs +11 -0
  91. package/src/channels/shared/status-reaction.mjs +2 -0
  92. package/src/channels/shared/text-harness-bridge.mjs +205 -3
  93. package/src/channels/shared/thinking-cadence.mjs +36 -0
  94. package/src/channels/shared/workspace-command.mjs +43 -17
  95. package/src/channels/shared/workspace-labels.mjs +65 -0
  96. package/src/channels/shared/workspace-session.mjs +24 -4
  97. package/src/channels/telegram/config-store.mjs +34 -1
  98. package/src/channels/telegram/telegram-api.mjs +240 -32
  99. package/src/channels/telegram/telegram-bridge.mjs +62 -1
  100. package/src/channels/telegram/telegram-controller.mjs +29 -0
  101. package/src/channels/telegram/telegram-runtime.mjs +592 -179
  102. package/src/channels/telegram/voice.mjs +250 -0
  103. package/src/channels/wecom/wecom-bridge.mjs +1 -0
  104. package/src/channels/wecom-app/wecom-app-bridge.mjs +1 -0
  105. package/src/channels/weixin/weixin-bridge.mjs +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmanrui/dsh-im",
3
- "version": "5.4.0",
3
+ "version": "5.6.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": [
@@ -112,10 +112,10 @@
112
112
  "@wecom/aibot-node-sdk": "1.0.7",
113
113
  "dingtalk-stream": "2.1.4",
114
114
  "imapflow": "^2.0.5",
115
- "mailparser": "^3.9.28",
116
- "nodemailer": "^10.0.10",
115
+ "mailparser": "^3.9.43",
116
+ "nodemailer": "^10.1.4",
117
117
  "qrcode": "1.5.4",
118
- "undici": "7.29.1"
118
+ "undici": "7.30.1"
119
119
  },
120
120
  "devDependencies": {
121
121
  "@deepseek-ai/cordis": "4.0.1",
@@ -1,7 +1,7 @@
1
1
  import { ConnectionError } from './connection-error.js';
2
2
  import * as React from 'react';
3
3
 
4
- import { h, isEnglish } from './i18n.js';
4
+ import { h, imLocale } from './i18n.js';
5
5
 
6
6
  export const BotSettingsContext = React.createContext(Object.freeze({
7
7
  openBotSettings() {},
@@ -50,9 +50,13 @@ export function BotSettingsButton({
50
50
  h('span', { className: 'dim-moreSettingsChevron', 'aria-hidden': 'true' })));
51
51
  }
52
52
 
53
+ // Date formatting follows the interface language, not English-vs-not: a
54
+ // Russian reader is served ru-RU numerals and month names, not Chinese ones.
55
+ const INTL_LOCALES = Object.freeze({ zh: 'zh-CN', en: 'en-US', ru: 'ru-RU' });
56
+
53
57
  function messageErrorTime(value) {
54
58
  try {
55
- return new Intl.DateTimeFormat(isEnglish() ? 'en-US' : 'zh-CN', {
59
+ return new Intl.DateTimeFormat(INTL_LOCALES[imLocale()] ?? 'en-US', {
56
60
  year: 'numeric',
57
61
  month: '2-digit',
58
62
  day: '2-digit',
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
 
5
5
  import { CredentialActionIcon, CredentialBindingPanel, QrActionIcon } from '../../credential-binding.js';
6
6
  import { AccountSettingsToggle, CollapsibleAccountSection } from '../shared/collapsible-account.js';
7
- import { h } from '../../i18n.js';
7
+ import { channelName, h, localizeTemplate, localizeText } from '../../i18n.js';
8
8
  import { WorkspaceEditor } from '../../workspace-editor.js';
9
9
  import { ContextEnhancementEditor } from '../../context-enhancement.js';
10
10
  import {
@@ -92,7 +92,7 @@ function Heading({ totals, adding, busy, onAdd, onCredential, credentialOpen, ad
92
92
  }, h(CredentialActionIcon), credentialOpen ? '收起凭据' : '手动接入')),
93
93
  totals.configured > 0
94
94
  ? h('div', { className: 'ddt-badge dim-onlineBadge' },
95
- h('span', null, `${totals.connected} / ${totals.configured} 在线`))
95
+ h('span', null, localizeTemplate('{connected} / {configured} 在线', { connected: totals.connected, configured: totals.configured })))
96
96
  : null));
97
97
  }
98
98
 
@@ -107,7 +107,7 @@ function EmptyView({ busy, onStart }) {
107
107
  h('div', { className: 'ddt-cardBody ddt-empty dim-surfaceBody dim-emptyView' },
108
108
  h('div', { className: 'dim-emptyCopy' },
109
109
  h('div', { className: 'ddt-stateLabel dim-stateLabel' },
110
- h('span', { className: 'ddt-dot dim-stateDot' }), h('span', null, '尚未接入钉钉机器人')),
110
+ h('span', { className: 'ddt-dot dim-stateDot' }), h('span', null, localizeTemplate('尚未接入 {channel} 机器人', { channel: channelName('钉钉') }))),
111
111
  h('h3', null, '扫一次码,自动创建并连接机器人'),
112
112
  h('p', null, '授权由钉钉官方页面完成。扫码账号必须已加入一个企业/组织并有权创建机器人;创建成功后,应用凭据会直接写入 Harness Host。'),
113
113
  h('div', { className: 'ddt-actions dim-viewActions' },
@@ -216,12 +216,12 @@ function RemoveConfirmation({ account, busy, onConfirm, onCancel }) {
216
216
  return h('div', {
217
217
  className: 'ddt-confirm dim-confirm',
218
218
  role: 'alertdialog',
219
- 'aria-label': `移除${account.bot.name}`,
219
+ 'aria-label': localizeTemplate('移除{name}', { name: account.bot.name }),
220
220
  onKeyDown: (event) => {
221
221
  if (event.key === 'Escape' && !busy) onCancel();
222
222
  },
223
223
  },
224
- h('strong', null, `从 DeepSeek Harness 移除“${account.bot.name}”?`),
224
+ h('strong', null, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: account.bot.name })),
225
225
  h('p', null, '这会停止消息连接,并删除本机保存的应用凭据、机器人配置及会话映射。钉钉开放平台中的机器人不会被自动删除。'),
226
226
  h('div', { className: 'ddt-actions dim-viewActions' },
227
227
  h(Button, { ref: cancelRef, onClick: onCancel, disabled: busy }, '保留机器人'),
@@ -757,9 +757,12 @@ export function DingtalkSettingsTab({ rpcCall }) {
757
757
  const visibleError = presentError(error);
758
758
  const failureMessage = operation === 'reconnect'
759
759
  ? visibleError.referenceId
760
- ? `连接检查失败:${visibleError.message}(参考号:${visibleError.referenceId})`
760
+ ? localizeTemplate('连接检查失败:{error}(参考号:{reference})', {
761
+ error: localizeText(visibleError.message),
762
+ reference: visibleError.referenceId,
763
+ })
761
764
  : '连接检查失败,请稍后重试。'
762
- : `操作失败:${visibleError.message}`;
765
+ : localizeTemplate('操作失败:{error}', { error: localizeText(visibleError.message) });
763
766
  if (operation === 'reconnect') {
764
767
  setFeedbackByBot((current) => ({
765
768
  ...current,
@@ -910,14 +913,14 @@ export function DingtalkSettingsTab({ rpcCall }) {
910
913
  }),
911
914
  h('div', { className: 'ddt-visuallyHidden', role: 'status', 'aria-live': 'polite' }, notice),
912
915
  model.error && model.phase === 'ready'
913
- ? h('div', { className: 'ddt-statusNotice dim-statusNotice', role: 'alert' }, `状态刷新失败:${model.error.message}`)
916
+ ? h('div', { className: 'ddt-statusNotice dim-statusNotice', role: 'alert' }, localizeTemplate('状态刷新失败:{error}', { error: localizeText(model.error.message) }))
914
917
  : null,
915
918
  model.phase === 'loading'
916
919
  ? h(LoadingView)
917
920
  : model.phase === 'error'
918
921
  ? h('div', { className: 'ddt-card dim-surfaceCard' },
919
922
  h('div', { className: 'ddt-inlineError dim-inlineError', role: 'alert' },
920
- h('h3', null, '无法读取钉钉机器人状态'),
923
+ h('h3', null, localizeTemplate('无法读取 {channel} 机器人状态', { channel: channelName('钉钉') })),
921
924
  h('p', null, model.error?.message ?? '请稍后重试'),
922
925
  h(Button, { onClick: () => void loadStatus() }, '重新读取')))
923
926
  : h(React.Fragment, null,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- import { h } from '../../i18n.js';
3
+ import { h, localizeTemplate } from '../../i18n.js';
4
4
  import {
5
5
  FEISHU_ENDPOINTS,
6
6
  FEISHU_REGISTRATION_OPERATIONS,
@@ -250,14 +250,14 @@ function PermissionFlow({ provision, now, busy, botName, onRetry, onCancel, onCl
250
250
 
251
251
  return h('section', {
252
252
  className: 'dim-feishuGroupAuthorization',
253
- 'aria-label': `${botName}的飞书授权流程`,
253
+ 'aria-label': localizeTemplate('{bot}的飞书授权流程', { bot: botName }),
254
254
  },
255
255
  h('div', { className: 'dim-feishuGroupQrColumn' },
256
256
  h('div', { className: 'dim-feishuGroupQrFrame' },
257
257
  qrSource
258
258
  ? h('img', {
259
259
  src: qrSource,
260
- alt: `用于为${botName}开通群消息权限的一次性授权二维码`,
260
+ alt: localizeTemplate('用于为{bot}开通群消息权限的一次性授权二维码', { bot: botName }),
261
261
  })
262
262
  : h('div', { className: 'dim-feishuGroupQrFallback' },
263
263
  h(QrPlaceholder), h('span', null, '二维码未就绪,请打开授权链接')),
@@ -267,7 +267,7 @@ function PermissionFlow({ provision, now, busy, botName, onRetry, onCancel, onCl
267
267
  : null),
268
268
  h('div', {
269
269
  className: 'dim-feishuGroupCountdown',
270
- 'aria-label': expired ? '二维码已失效' : `二维码剩余 ${formatRemaining(remaining)}`,
270
+ 'aria-label': expired ? '二维码已失效' : localizeTemplate('二维码剩余 {remaining}', { remaining: formatRemaining(remaining) }),
271
271
  },
272
272
  h('span', null, expired ? '等待刷新' : '二维码有效时间'),
273
273
  h('strong', null, formatRemaining(remaining)),
@@ -275,7 +275,7 @@ function PermissionFlow({ provision, now, busy, botName, onRetry, onCancel, onCl
275
275
  h('span', { style: { width: `${Math.round(progress * 100)}%` } })))),
276
276
  h('div', { className: 'dim-feishuGroupAuthorizationCopy' },
277
277
  h('span', { className: 'dim-feishuGroupAuthorizationEyebrow' },
278
- `正在为「${botName}」开通群消息权限`),
278
+ localizeTemplate('正在为「{bot}」开通群消息权限', { bot: botName })),
279
279
  h('h3', null, expired ? '刷新二维码后继续' : '使用飞书确认群消息权限'),
280
280
  h('p', null,
281
281
  '扫码会更新现有飞书应用,只增量开通“获取群组中所有消息”权限,不会创建新应用。单独授权采集时保留原来的回复方式;选择响应所有消息时才切换。'),
@@ -5,7 +5,7 @@ import * as React from "react";
5
5
  import { FeishuLogoGlyph } from "../../channel-logos.js";
6
6
  import { CredentialActionIcon, CredentialBindingPanel, QrActionIcon } from "../../credential-binding.js";
7
7
  import { AccountSettingsToggle, CollapsibleAccountSection } from "../shared/collapsible-account.js";
8
- import { h } from "../../i18n.js";
8
+ import { h, localizeTemplate, localizeText } from "../../i18n.js";
9
9
  import {
10
10
  FEISHU_ENDPOINTS,
11
11
  FEISHU_REGISTRATION_OPERATIONS,
@@ -186,8 +186,14 @@ function Heading({ totals, onAdd, onCredential, credentialOpen, adding, busy, ad
186
186
  hasBots
187
187
  ? h("div", {
188
188
  className: "bxf-totalBadge dim-onlineBadge",
189
- "aria-label": `已接入 ${totals.configured} 个机器人,其中 ${totals.connected} 个在线`,
190
- }, h("span", null, `${totals.connected} / ${totals.configured} 在线`))
189
+ "aria-label": localizeTemplate('已接入 {configured} 个机器人,其中 {connected} 个在线', {
190
+ configured: totals.configured,
191
+ connected: totals.connected,
192
+ }),
193
+ }, h("span", null, localizeTemplate('{connected} / {configured} 在线', {
194
+ connected: totals.connected,
195
+ configured: totals.configured,
196
+ })))
191
197
  : null,
192
198
  ),
193
199
  );
@@ -272,9 +278,9 @@ function QrPane({ provision, now, onRefresh, onCancel, busy }) {
272
278
  ? h("img", {
273
279
  src: qrSource,
274
280
  alt: repairing
275
- ? `用于为${botName}补全权限与回调的一次性授权二维码`
281
+ ? localizeTemplate('用于为{bot}补全权限与回调的一次性授权二维码', { bot: botName })
276
282
  : grantingGroupMessages
277
- ? `用于为${botName}开通群消息权限的一次性授权二维码`
283
+ ? localizeTemplate('用于为{bot}开通群消息权限的一次性授权二维码', { bot: botName })
278
284
  : "用于新增 DeepSeek Harness 飞书机器人的一次性授权二维码",
279
285
  onError: () => setImageFailed(true),
280
286
  })
@@ -287,7 +293,9 @@ function QrPane({ provision, now, onRefresh, onCancel, busy }) {
287
293
  ),
288
294
  h("div", {
289
295
  className: "bxf-countdown dim-countdown",
290
- "aria-label": expired ? "二维码已失效" : `二维码剩余 ${formatRemaining(remaining)}`,
296
+ "aria-label": expired
297
+ ? "二维码已失效"
298
+ : localizeTemplate('二维码剩余 {remaining}', { remaining: formatRemaining(remaining) }),
291
299
  },
292
300
  h("div", { className: "bxf-countdownTop dim-countdownTop", "aria-hidden": "true" },
293
301
  h("span", null, expired ? "等待刷新" : "二维码有效时间"),
@@ -300,9 +308,9 @@ function QrPane({ provision, now, onRefresh, onCancel, busy }) {
300
308
  h("div", { className: "bxf-stateLabel dim-stateLabel" },
301
309
  h("span", { className: "bxf-dot dim-stateDot", "data-tone": "warning" }),
302
310
  h("span", null, repairing
303
- ? `正在为「${botName}」补全权限与回调`
311
+ ? localizeTemplate('正在为「{bot}」补全权限与回调', { bot: botName })
304
312
  : grantingGroupMessages
305
- ? `正在为「${botName}」开通群消息权限`
313
+ ? localizeTemplate('正在为「{bot}」开通群消息权限', { bot: botName })
306
314
  : "正在添加新机器人")),
307
315
  h("h3", null, expired
308
316
  ? "刷新二维码后继续"
@@ -456,7 +464,7 @@ function RemoveConfirmation({ bot, busy, onConfirm, onCancel }) {
456
464
  }
457
465
  },
458
466
  },
459
- h("h4", { id: titleId }, `从 DeepSeek Harness 移除“${bot.bot.name}”?`),
467
+ h("h4", { id: titleId }, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: bot.bot.name })),
460
468
  h("p", { id: descriptionId },
461
469
  "此操作会停止这个机器人的连接,并删除保存在本机的接入配置和凭据。飞书开放平台中的应用不会被自动删除,其他机器人也不受影响。"),
462
470
  h("div", { className: "bxf-actions dim-viewActions" },
@@ -669,7 +677,7 @@ export function BotCard({
669
677
  provisionContent
670
678
  ? h("section", {
671
679
  className: "bxf-botProvision dim-botProvision",
672
- "aria-label": `${bot.name}的飞书授权流程`,
680
+ "aria-label": localizeTemplate('{bot}的飞书授权流程', { bot: bot.name }),
673
681
  "data-provision-for": connection.botId,
674
682
  ref: provisionRef,
675
683
  tabIndex: -1,
@@ -681,7 +689,7 @@ export function BotCard({
681
689
  h(Button, {
682
690
  className: "dim-cardAction", onClick: onReconnect,
683
691
  disabled: Boolean(busy), "aria-busy": busy === "reconnect" ? "true" : undefined,
684
- "aria-label": `${connected ? "检查连接" : "重试连接"}${bot.name}`,
692
+ "aria-label": localizeTemplate(connected ? '检查连接{name}' : '重试连接{name}', { name: bot.name }),
685
693
  }, busy === "reconnect" ? (connected ? "检查中…" : "正在连接…") : connected ? "检查连接" : "重试连接"),
686
694
  h("span", { className: "bxf-repairAction" },
687
695
  h(Button, {
@@ -689,7 +697,7 @@ export function BotCard({
689
697
  onClick: onRepairCallback,
690
698
  disabled: Boolean(busy) || repairDisabled,
691
699
  "aria-busy": busy === "callback-repair" ? "true" : undefined,
692
- "aria-label": `为${bot.name}补全权限与回调`,
700
+ "aria-label": localizeTemplate('为{bot}补全权限与回调', { bot: bot.name }),
693
701
  "aria-describedby": repairTooltipId,
694
702
  }, busy === "callback-repair" ? "等待扫码…" : "补全权限"),
695
703
  h("span", {
@@ -702,7 +710,7 @@ export function BotCard({
702
710
  h(Button, {
703
711
  className: "dim-cardAction", kind: "danger", onClick: onRequestRemove,
704
712
  disabled: Boolean(busy), ref: removeButtonRef,
705
- "aria-label": `从 DeepSeek Harness 移除${bot.name}`,
713
+ "aria-label": localizeTemplate('从 DeepSeek Harness 移除{name}', { name: bot.name }),
706
714
  }, "移除接入")),
707
715
  summary ? h("div", { className: "bxf-healthSummary dim-cardSummary", "data-error": actionError || connection.error ? "true" : undefined },
708
716
  summary) : null,
@@ -1025,9 +1033,9 @@ export function FeishuSettingsTab({ rpcCall }) {
1025
1033
  },
1026
1034
  }));
1027
1035
  announce(repairing
1028
- ? `${botName ?? "机器人"}的权限补全二维码已生成,请使用飞书扫码。`
1036
+ ? localizeTemplate('{bot}的权限补全二维码已生成,请使用飞书扫码。', { bot: botName ?? "机器人" })
1029
1037
  : grantingGroupMessages
1030
- ? `${botName ?? "机器人"}的群消息权限二维码已生成,请使用飞书确认。`
1038
+ ? localizeTemplate('{bot}的群消息权限二维码已生成,请使用飞书确认。', { bot: botName ?? "机器人" })
1031
1039
  : "授权二维码已生成,请使用飞书扫码。");
1032
1040
  } catch (error) {
1033
1041
  setModel((current) => ({
@@ -1116,8 +1124,8 @@ export function FeishuSettingsTab({ rpcCall }) {
1116
1124
  const targetBotName = targetBot?.bot.name ?? activeProvision.botName ?? "机器人";
1117
1125
  setModel((current) => ({ ...current, provisioning: null }));
1118
1126
  announce(grantingGroupMessages
1119
- ? `${targetBotName}已开通群消息权限,并启用“响应所有群消息”。`
1120
- : `${targetBotName}的权限与回调已补全。`);
1127
+ ? localizeTemplate('{bot}已开通群消息权限,并启用“响应所有群消息”。', { bot: targetBotName })
1128
+ : localizeTemplate('{bot}的权限与回调已补全。', { bot: targetBotName }));
1121
1129
  if (activeProvision.botId) setFocusBotId(activeProvision.botId);
1122
1130
  await loadStatus({ silent: true, restoreProvisioning: false });
1123
1131
  return;
@@ -1207,11 +1215,11 @@ export function FeishuSettingsTab({ rpcCall }) {
1207
1215
  }
1208
1216
  setModel((current) => ({ ...current, provisioning: null }));
1209
1217
  announce(isCallbackRepair(provision)
1210
- ? `${targetBot.bot.name}的权限与回调已补全。`
1218
+ ? localizeTemplate('{bot}的权限与回调已补全。', { bot: targetBot.bot.name })
1211
1219
  : isGroupMessagePermission(provision)
1212
- ? `${targetBot.bot.name}已开通群消息权限,并启用“响应所有群消息”。`
1220
+ ? localizeTemplate('{bot}已开通群消息权限,并启用“响应所有群消息”。', { bot: targetBot.bot.name })
1213
1221
  : targetBot
1214
- ? `${targetBot.bot.name}已连接,可以在飞书中开始聊天。`
1222
+ ? localizeTemplate('{bot}已连接,可以在飞书中开始聊天。', { bot: targetBot.bot.name })
1215
1223
  : "新飞书机器人已连接,可以开始聊天。");
1216
1224
  if (result.botId) setFocusBotId(result.botId);
1217
1225
  return;
@@ -1327,8 +1335,8 @@ export function FeishuSettingsTab({ rpcCall }) {
1327
1335
  setTestNoticesByBot((current) => ({ ...current, [botId]: testNotice }));
1328
1336
  }
1329
1337
  announce(testNotice ?? (connection.connected
1330
- ? `${bot.name}连接检查完成。`
1331
- : `${bot.name}已重新连接。`));
1338
+ ? localizeTemplate('{bot}连接检查完成。', { bot: bot.name })
1339
+ : localizeTemplate('{bot}已重新连接。', { bot: bot.name })));
1332
1340
  } catch (error) {
1333
1341
  const failure = new Error("连接检查失败,请稍后重试。");
1334
1342
  failure.code = error?.code;
@@ -1405,11 +1413,11 @@ export function FeishuSettingsTab({ rpcCall }) {
1405
1413
  if (mountedRef.current && workspaceFence.canCommitMutation(snapshotVersion)) {
1406
1414
  mergeSnapshot(snapshot);
1407
1415
  }
1408
- announce(`${bot.name}已从此 DeepSeek Harness 移除;飞书开放平台中的应用未被删除。`);
1416
+ announce(localizeTemplate('{bot}已从此 DeepSeek Harness 移除;飞书开放平台中的应用未被删除。', { bot: bot.name }));
1409
1417
  scheduleAnimationFrame(() => addButtonRef.current?.focus(), "focus");
1410
1418
  } catch (error) {
1411
1419
  setBotError(botId, error);
1412
- announce(`${bot.name}移除失败,请重试。`);
1420
+ announce(localizeTemplate('{bot}移除失败,请重试。', { bot: bot.name }));
1413
1421
  } finally {
1414
1422
  const shouldRefresh = workspaceFence.endMutation();
1415
1423
  if (shouldRefresh && mountedRef.current) void loadStatus({ silent: true });
@@ -1523,7 +1531,7 @@ export function FeishuSettingsTab({ rpcCall }) {
1523
1531
  model.statusError
1524
1532
  ? h("div", { className: "bxf-statusNotice dim-statusNotice", role: "status" },
1525
1533
  h(AlertIcon, { size: 16 }),
1526
- h("span", null, `状态自动刷新失败:${model.statusError.message}`),
1534
+ h("span", null, localizeTemplate('状态自动刷新失败:{error}', { error: localizeText(model.statusError.message) })),
1527
1535
  h(Button, { size: "small", onClick: () => void loadStatus({ silent: true }), disabled: pageBusy }, "立即重试"))
1528
1536
  : null,
1529
1537
  model.phase === "loading"
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import { QqLogoGlyph } from '../../channel-logos.js';
6
6
  import { CredentialActionIcon, CredentialBindingPanel, QrActionIcon } from '../../credential-binding.js';
7
7
  import { AccountSettingsToggle, CollapsibleAccountSection } from '../shared/collapsible-account.js';
8
- import { h } from '../../i18n.js';
8
+ import { channelName, h, localizeTemplate } from '../../i18n.js';
9
9
  import { WorkspaceEditor } from '../../workspace-editor.js';
10
10
  import { ContextEnhancementEditor } from '../../context-enhancement.js';
11
11
  import {
@@ -83,14 +83,14 @@ function Heading({ totals, adding, busy, onAdd, onCredential, credentialOpen, ad
83
83
  }, h(CredentialActionIcon), credentialOpen ? '收起凭据' : '手动接入')),
84
84
  totals.configured > 0
85
85
  ? h('div', { className: 'ddt-badge dim-onlineBadge' },
86
- h('span', null, `${totals.connected} / ${totals.configured} 在线`))
86
+ h('span', null, localizeTemplate('{connected} / {configured} 在线', { connected: totals.connected, configured: totals.configured })))
87
87
  : null));
88
88
  }
89
89
 
90
90
  function LoadingView() {
91
91
  return h('div', { className: 'ddt-card ddt-loading dim-surfaceCard dim-loadingView', 'aria-busy': 'true' },
92
92
  h('div', { className: 'ddt-spinner dim-spinner' }),
93
- h('span', null, '正在读取 QQ 机器人状态…'));
93
+ h('span', null, localizeTemplate('正在读取 {channel} 机器人状态…', { channel: channelName('QQ') })));
94
94
  }
95
95
 
96
96
  function EmptyView({ busy, onStart }) {
@@ -161,7 +161,7 @@ function ProvisionView({ provision, busy, onRetry, onClose }) {
161
161
 
162
162
  function RemoveConfirmation({ account, busy, onConfirm, onCancel }) {
163
163
  return h('div', { className: 'ddt-confirm dim-confirm', role: 'alertdialog' },
164
- h('strong', null, `从 DeepSeek Harness 移除“${account.bot.name}”?`),
164
+ h('strong', null, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: account.bot.name })),
165
165
  h('p', null, '这会停止消息连接,并删除本机保存的应用凭据、机器人配置及会话映射。腾讯平台中的机器人不会被自动删除。'),
166
166
  h('div', { className: 'ddt-actions dim-viewActions' },
167
167
  h(Button, { onClick: onCancel, disabled: busy }, '保留机器人'),
@@ -583,7 +583,7 @@ export function QqSettingsTab({ rpcCall }) {
583
583
  }),
584
584
  model.phase === 'loading' ? h(LoadingView)
585
585
  : model.phase === 'error'
586
- ? h('div', { className: 'ddt-card dim-surfaceCard' }, h('div', { className: 'ddt-inlineError dim-inlineError' }, h('h3', null, '无法读取 QQ 机器人状态'), h(ConnectionError, { error: model.error }), h(Button, { onClick: () => void loadStatus() }, '重新读取')))
586
+ ? h('div', { className: 'ddt-card dim-surfaceCard' }, h('div', { className: 'ddt-inlineError dim-inlineError' }, h('h3', null, localizeTemplate('无法读取 {channel} 机器人状态', { channel: channelName('QQ') })), h(ConnectionError, { error: model.error }), h(Button, { onClick: () => void loadStatus() }, '重新读取')))
587
587
  : h(React.Fragment, null,
588
588
  credentialView,
589
589
  provisionView,
@@ -6,6 +6,13 @@ import { normalizeModelCatalog, normalizeModelSelection, SET_MODEL_ENDPOINT } fr
6
6
  import { normalizeLastMessageError } from '../../last-message-error.js';
7
7
  import { normalizeAccessPolicy } from '../../../../src/channels/shared/access-policy.mjs';
8
8
  import { normalizeContextEnhancementConfig } from '../../../../src/channels/shared/context-enhancement.mjs';
9
+ import {
10
+ normalizeThinkingIntervalSeconds,
11
+ normalizeThinkingNumbering,
12
+ SET_THINKING_CADENCE_ENDPOINT,
13
+ } from '../../../../src/channels/shared/thinking-cadence.mjs';
14
+ import { normalizeSendLimitPerMinute, SET_SEND_LIMIT_ENDPOINT } from '../../../../src/channels/shared/send-limit.mjs';
15
+ import { channelName, localizeTemplate, localizeText } from '../../i18n.js';
9
16
 
10
17
  const ACCOUNT_STATES = new Set(['connected', 'connecting', 'offline', 'error']);
11
18
 
@@ -41,6 +48,8 @@ export const TOKEN_BOT_ENDPOINTS = Object.freeze({
41
48
  setAccessPolicy: 'bot.access-policy.set',
42
49
  setAlias: 'bot.alias.set',
43
50
  setThinkingTraces: 'bot.thinking-traces.set',
51
+ setThinkingCadence: SET_THINKING_CADENCE_ENDPOINT,
52
+ setSendLimit: SET_SEND_LIMIT_ENDPOINT,
44
53
  });
45
54
 
46
55
  export function createTokenChannelApi(channel, connectionSummary, {
@@ -48,10 +57,10 @@ export function createTokenChannelApi(channel, connectionSummary, {
48
57
  } = {}) {
49
58
  const unwrapRpcResult = (result) => {
50
59
  if (!isRecord(result) || typeof result.ok !== 'boolean') {
51
- throw new Error(`${channel} 服务返回了无法识别的响应`);
60
+ throw new Error(localizeTemplate('{channel} 服务返回了无法识别的响应', { channel: channelName(channel) }));
52
61
  }
53
62
  if (!result.ok) {
54
- const error = new Error(text(result.error?.message, `${channel} 操作失败`));
63
+ const error = new Error(text(result.error?.message, localizeTemplate('{channel} 操作失败', { channel: channelName(channel) })));
55
64
  error.code = text(result.error?.code, `${channel.toUpperCase()}_RPC_ERROR`, 80);
56
65
  Object.assign(error, diagnosticFields(result.error));
57
66
  throw error;
@@ -74,19 +83,28 @@ export function createTokenChannelApi(channel, connectionSummary, {
74
83
  busyMessageMode: normalizeBusyMessageMode(value.busyMessageMode), contextEnhancement: normalizeContextEnhancementConfig(value.contextEnhancement),
75
84
  // Absent from the backend means ON; only an explicit false opts out.
76
85
  thinkingTraces: value.thinkingTraces !== false,
86
+ // Absent or unusable falls back to the same defaults the backend applies.
87
+ thinkingNumbering: normalizeThinkingNumbering(value.thinkingNumbering),
88
+ thinkingIntervalSeconds: normalizeThinkingIntervalSeconds(value.thinkingIntervalSeconds),
89
+ // Absent or unusable falls back to the same default the backend applies.
90
+ sendLimitPerMinute: normalizeSendLimitPerMinute(value.sendLimitPerMinute),
77
91
  ...(Object.hasOwn(value, 'accessPolicy')
78
92
  ? { accessPolicy: normalizeAccessPolicy(value.accessPolicy) }
79
93
  : {}),
80
94
  bot: {
81
95
  ...normalizeBotAlias(value.bot),
82
- name: text(value.bot?.name, `${channel}机器人`, 100),
96
+ name: text(value.bot?.name, localizeTemplate('{channel}机器人', { channel: channelName(channel) }), 100),
83
97
  username: text(value.bot?.username, '', 100),
84
98
  idMasked: text(value.bot?.idMasked, '机器人标识已安全保存', 140),
85
99
  },
86
100
  health: {
87
101
  summary: text(
88
102
  value.health?.summary,
89
- connected ? `${channel}${connectionSummary}运行正常` : `${channel}连接尚未就绪`,
103
+ connected
104
+ ? localizeTemplate('{subject}运行正常', {
105
+ subject: `${channelName(channel)}${localizeText(connectionSummary)}`,
106
+ })
107
+ : localizeTemplate('{channel}连接尚未就绪', { channel: channelName(channel) }),
90
108
  ),
91
109
  lastCheckedAt: timestamp(value.health?.lastCheckedAt),
92
110
  },
@@ -94,7 +112,7 @@ export function createTokenChannelApi(channel, connectionSummary, {
94
112
  error: isRecord(value.error) ? {
95
113
  ...diagnosticFields(value.error),
96
114
  code: text(value.error.code, `${channel.toUpperCase()}_ACCOUNT_ERROR`, 80),
97
- message: text(value.error.message, `${channel}连接尚未就绪`),
115
+ message: text(value.error.message, localizeTemplate('{channel}连接尚未就绪', { channel: channelName(channel) })),
98
116
  } : null,
99
117
  ...(isRecord(extension) ? extension : {}),
100
118
  };
@@ -103,7 +121,7 @@ export function createTokenChannelApi(channel, connectionSummary, {
103
121
  const normalizeSnapshot = (value) => {
104
122
  const source = isRecord(value?.snapshot) ? value.snapshot : value;
105
123
  if (!isRecord(source) || !Array.isArray(source.bots)) {
106
- throw new Error(`${channel} 服务没有返回有效的机器人列表`);
124
+ throw new Error(localizeTemplate('{channel} 服务没有返回有效的机器人列表', { channel: channelName(channel) }));
107
125
  }
108
126
  const bots = source.bots.map(normalizeBot).filter(Boolean);
109
127
  return {
@@ -119,7 +137,7 @@ export function createTokenChannelApi(channel, connectionSummary, {
119
137
  const presentError = (error) => ({
120
138
  ...diagnosticFields(error),
121
139
  code: text(error?.code, `${channel.toUpperCase()}_ERROR`, 80),
122
- message: text(error?.message, `${channel}操作失败,请稍后重试`),
140
+ message: text(error?.message, localizeTemplate('{channel}操作失败,请稍后重试', { channel: channelName(channel) })),
123
141
  });
124
142
 
125
143
  return Object.freeze({ unwrapRpcResult, normalizeSnapshot, presentError });
@@ -4,7 +4,7 @@ import * as React from 'react';
4
4
 
5
5
  import { CredentialActionIcon, CredentialBindingPanel } from '../../credential-binding.js';
6
6
  import { AccountSettingsToggle, CollapsibleAccountSection } from './collapsible-account.js';
7
- import { h } from '../../i18n.js';
7
+ import { channelName, h, localizeTemplate, localizeText } from '../../i18n.js';
8
8
  import { installDingtalkStyles } from '../dingtalk/styles.js';
9
9
  import { WorkspaceEditor } from '../../workspace-editor.js';
10
10
  import { ContextEnhancementEditor } from '../../context-enhancement.js';
@@ -74,7 +74,7 @@ export function createTokenChannelSettings(definition) {
74
74
  platformLabel,
75
75
  CredentialPanel = null,
76
76
  credentialPayload = ({ secret }) => ({ token: secret }),
77
- credentialAriaLabel = `使用 Bot Token 接入 ${channel} 机器人`,
77
+ credentialAriaLabel = localizeTemplate('使用 Bot Token 接入 {channel} 机器人', { channel: channelName(channel) }),
78
78
  credentialOpenLabel = '手动接入',
79
79
  credentialCloseLabel = '收起凭据',
80
80
  credentialNoun = 'Bot Token',
@@ -179,8 +179,11 @@ export function createTokenChannelSettings(definition) {
179
179
  ),
180
180
  ),
181
181
  removing ? h('div', { className: 'ddt-confirm dim-confirm', role: 'alertdialog' },
182
- h('strong', null, `从 DeepSeek Harness 移除“${account.bot.name}”?`),
183
- h('p', null, `这会停止消息连接,并删除本机保存的 ${credentialNoun}、机器人配置及会话映射。${platformLabel}中的机器人不会被自动删除。`),
182
+ h('strong', null, localizeTemplate('从 DeepSeek Harness 移除“{name}”?', { name: account.bot.name })),
183
+ h('p', null, localizeTemplate('这会停止消息连接,并删除本机保存的 {credentials}、机器人配置及会话映射。{platform}中的机器人不会被自动删除。', {
184
+ credentials: localizeText(credentialNoun),
185
+ platform: localizeText(platformLabel),
186
+ })),
184
187
  h('div', { className: 'ddt-actions dim-viewActions' },
185
188
  h(Button, { onClick: onCancelRemove, disabled: Boolean(busy) }, '保留机器人'),
186
189
  h(Button, { kind: 'danger', onClick: onConfirmRemove, disabled: Boolean(busy) },
@@ -215,7 +218,7 @@ export function createTokenChannelSettings(definition) {
215
218
  }, []);
216
219
 
217
220
  const invoke = React.useCallback(async (endpoint, payload = {}, signal) => {
218
- if (typeof rpcCall !== 'function') throw new TypeError(`${channel} 设置页缺少 RPC 连接`);
221
+ if (typeof rpcCall !== 'function') throw new TypeError(localizeTemplate('{channel} 设置页缺少 RPC 连接', { channel: channelName(channel) }));
219
222
  const operation = !['connection.status', 'provision.poll', 'provision.begin', 'provision.cancel'].includes(endpoint);
220
223
  if (operation && mounted.current) setOperationError(null);
221
224
  try {
@@ -343,7 +346,7 @@ export function createTokenChannelSettings(definition) {
343
346
  ? h('section', { className: 'dim-listSection' },
344
347
  h(ChannelListHeading, {
345
348
  className: 'ddt-listHeading',
346
- title: `已接入的 ${channel} 机器人`,
349
+ title: localizeTemplate('已接入的 {channel} 机器人', { channel: channelName(channel) }),
347
350
  connectionLabel,
348
351
  }),
349
352
  h('ul', { className: 'ddt-list dim-botList' }, model.bots.map((account) =>
@@ -416,7 +419,7 @@ export function createTokenChannelSettings(definition) {
416
419
  value: model.agentPresetCatalog ?? EMPTY_AGENT_PRESET_CATALOG,
417
420
  }, h('section', {
418
421
  className: `ddt-page ${pageClass} dim-channelPage`,
419
- 'aria-label': `${channel} 设置`,
422
+ 'aria-label': localizeTemplate('{channel} 设置', { channel: channelName(channel) }),
420
423
  },
421
424
  operationError ? h(ConnectionError, { error: operationError }) : null,
422
425
  h('div', { className: 'ddt-heading' },
@@ -432,17 +435,21 @@ export function createTokenChannelSettings(definition) {
432
435
  }, h(CredentialActionIcon), credentialOpen ? credentialCloseLabel : credentialOpenLabel)),
433
436
  model.totals.configured > 0
434
437
  ? h('div', { className: 'ddt-badge dim-onlineBadge' },
435
- h('span', null, `${model.totals.connected} / ${model.totals.configured} 在线`))
438
+ h('span', null, localizeTemplate('{connected} / {configured} 在线', {
439
+ connected: model.totals.connected,
440
+ configured: model.totals.configured,
441
+ })))
436
442
  : null)),
437
443
  model.phase === 'loading'
438
444
  ? h('div', {
439
445
  className: 'ddt-card ddt-loading dim-surfaceCard dim-loadingView',
440
446
  'aria-busy': 'true',
441
- }, h('div', { className: 'ddt-spinner dim-spinner' }), `正在读取 ${channel} 机器人状态…`)
447
+ }, h('div', { className: 'ddt-spinner dim-spinner' }),
448
+ localizeTemplate('正在读取 {channel} 机器人状态…', { channel: channelName(channel) }))
442
449
  : model.phase === 'error'
443
450
  ? h('div', { className: 'ddt-card dim-surfaceCard' },
444
451
  h('div', { className: 'ddt-inlineError dim-inlineError' },
445
- h('h3', null, `无法读取 ${channel} 机器人状态`),
452
+ h('h3', null, localizeTemplate('无法读取 {channel} 机器人状态', { channel: channelName(channel) })),
446
453
  h(ConnectionError, { error: model.error }),
447
454
  h(Button, { onClick: () => void loadStatus() }, '重新读取')))
448
455
  : h(React.Fragment, null,
@@ -475,7 +482,7 @@ export function createTokenChannelSettings(definition) {
475
482
  h('div', { className: 'dim-emptyCopy' },
476
483
  h('div', { className: 'ddt-stateLabel dim-stateLabel' },
477
484
  h('span', { className: 'ddt-dot dim-stateDot' }),
478
- h('span', null, `尚未接入 ${channel} 机器人`)),
485
+ h('span', null, localizeTemplate('尚未接入 {channel} 机器人', { channel: channelName(channel) }))),
479
486
  h('h3', null, emptyTitle),
480
487
  h('p', null, emptyDescription),
481
488
  h('div', { className: 'ddt-actions dim-viewActions' },
@@ -15,6 +15,10 @@ const CSS = String.raw`
15
15
  .dim-accountSettingsSwitch:checked { border-color: #229ed9; background: #229ed9; }
16
16
  .dim-accountSettingsSwitch:checked::before { transform: translateX(13px); background: #fff; }
17
17
  .dim-accountSettingsSwitch:disabled { opacity: 0.5; cursor: not-allowed; }
18
+ .dim-accountSettingsSelect { flex: none; min-width: 0; max-width: 60%; margin: 0; padding: 4px 6px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 6px; background: var(--dsw-alias-bg-layer-1, #fff); color: var(--dsw-alias-label-primary, #1f2329); font: inherit; font-size: 13px; line-height: 20px; }
19
+ .dim-accountSettingsSelect:disabled { opacity: 0.5; cursor: not-allowed; }
20
+ .dim-accountSettingsNumber { appearance: textfield; flex: none; width: 64px; margin: 0; padding: 4px 6px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 6px; background: var(--dsw-alias-bg-layer-1, #fff); color: var(--dsw-alias-label-primary, #1f2329); font: inherit; font-size: 13px; line-height: 20px; text-align: center; }
21
+ .dim-accountSettingsNumber:disabled { opacity: 0.5; cursor: not-allowed; }
18
22
  @media (prefers-reduced-motion: reduce) { .dim-accountSettingsSwitch::before { transition: none; } }
19
23
  `;
20
24