@xmanrui/dsh-im 5.9.1 → 5.11.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 (135) hide show
  1. package/PROACTIVE_DELIVERY.en.md +33 -9
  2. package/PROACTIVE_DELIVERY.md +33 -9
  3. package/README.en.md +42 -7
  4. package/README.md +46 -8
  5. package/bin/dsh-im.mjs +65 -0
  6. package/docs/client-integration.md +4 -0
  7. package/lib/client.js +1735 -203
  8. package/lib/index.js +367 -341
  9. package/package.json +7 -6
  10. package/plugin-src/client/access-policy-settings.js +210 -12
  11. package/plugin-src/client/bot-general-settings.js +44 -3
  12. package/plugin-src/client/delivery-settings.js +2 -0
  13. package/plugin-src/client/delivery-sync-settings.js +269 -0
  14. package/plugin-src/client/global-settings.js +45 -7
  15. package/plugin-src/client/i18n-ru.js +112 -0
  16. package/plugin-src/client/i18n.js +110 -0
  17. package/plugin-src/client/im-channels.js +419 -0
  18. package/plugin-src/client/index.js +50 -2
  19. package/plugin-src/client/model-setting.js +6 -3
  20. package/plugin-src/client/styles.js +23 -7
  21. package/plugin-src/client/update-panel.js +2 -1
  22. package/plugin-src/host/channel-list-rpc.mjs +280 -0
  23. package/plugin-src/host/channels/dingtalk/production.mjs +28 -10
  24. package/plugin-src/host/channels/dingtalk/rpc.mjs +10 -1
  25. package/plugin-src/host/channels/feishu/production.mjs +50 -37
  26. package/plugin-src/host/channels/feishu/rpc.mjs +10 -1
  27. package/plugin-src/host/channels/matrix/production.mjs +28 -10
  28. package/plugin-src/host/channels/matrix/rpc.mjs +10 -0
  29. package/plugin-src/host/channels/qq/production.mjs +30 -11
  30. package/plugin-src/host/channels/qq/rpc.mjs +10 -1
  31. package/plugin-src/host/channels/shared/access-policy-production.mjs +9 -0
  32. package/plugin-src/host/channels/shared/binding-events.mjs +109 -0
  33. package/plugin-src/host/channels/shared/production.mjs +14 -1
  34. package/plugin-src/host/channels/shared/reply-content-rpc.mjs +17 -0
  35. package/plugin-src/host/channels/shared/rpc.mjs +9 -0
  36. package/plugin-src/host/channels/shared/workspace-rpc.mjs +1 -0
  37. package/plugin-src/host/channels/slack/production.mjs +28 -10
  38. package/plugin-src/host/channels/slack/rpc.mjs +10 -0
  39. package/plugin-src/host/channels/telegram/production.mjs +5 -0
  40. package/plugin-src/host/channels/wecom/production.mjs +28 -10
  41. package/plugin-src/host/channels/wecom/rpc.mjs +10 -1
  42. package/plugin-src/host/channels/wecom-app/production.mjs +28 -10
  43. package/plugin-src/host/channels/wecom-app/rpc.mjs +9 -0
  44. package/plugin-src/host/channels/weixin/production.mjs +28 -10
  45. package/plugin-src/host/channels/weixin/rpc.mjs +10 -1
  46. package/plugin-src/host/channels/whatsapp/production.mjs +28 -10
  47. package/plugin-src/host/channels/whatsapp/rpc.mjs +10 -1
  48. package/plugin-src/host/delivery-adapter.mjs +35 -20
  49. package/plugin-src/host/delivery-service.mjs +99 -1
  50. package/plugin-src/host/delivery-suggestions.mjs +31 -1
  51. package/plugin-src/host/delivery-sync-rpc.mjs +100 -0
  52. package/plugin-src/host/harness-connection.mjs +2 -1
  53. package/plugin-src/host/harness-peer.mjs +3 -1
  54. package/plugin-src/host/host-language-rpc.mjs +16 -2
  55. package/plugin-src/host/host-language.mjs +29 -0
  56. package/plugin-src/host/index.mjs +30 -1
  57. package/plugin-src/host/modern-harness-api.mjs +5 -1
  58. package/plugin-src/host/root-scope.mjs +32 -0
  59. package/plugin-src/host/session-sync-coordinator.mjs +290 -122
  60. package/plugin-src/host/session-sync-targets.mjs +71 -0
  61. package/plugin-src/management-rpc.mjs +18 -2
  62. package/scripts/verify-package.mjs +48 -10
  63. package/src/channels/dingtalk/dingtalk-bridge.mjs +50 -6
  64. package/src/channels/dingtalk/state-store.mjs +56 -0
  65. package/src/channels/discord/discord-api.mjs +2 -1
  66. package/src/channels/feishu/bridge.mjs +154 -58
  67. package/src/channels/feishu/feishu-cards.mjs +10 -4
  68. package/src/channels/feishu/feishu-runtime.mjs +11 -3
  69. package/src/channels/feishu/message-utils.mjs +106 -30
  70. package/src/channels/feishu/slash-command-panel.mjs +26 -0
  71. package/src/channels/feishu/state-store.mjs +14 -0
  72. package/src/channels/matrix/matrix-api.mjs +2 -1
  73. package/src/channels/qq/qq-bridge.mjs +114 -14
  74. package/src/channels/qq/state-store.mjs +55 -1
  75. package/src/channels/shared/access-policy.mjs +60 -7
  76. package/src/channels/shared/action-card.mjs +83 -7
  77. package/src/channels/shared/bot-workspace-store.mjs +255 -11
  78. package/src/channels/shared/busy-message-dispatcher.mjs +2 -2
  79. package/src/channels/shared/channel-capabilities.mjs +44 -0
  80. package/src/channels/shared/command-catalog.mjs +68 -3
  81. package/src/channels/shared/command-permission.mjs +6 -2
  82. package/src/channels/shared/conversation-state-store.mjs +16 -0
  83. package/src/channels/shared/deferred-delivery-coordinator.mjs +6 -1
  84. package/src/channels/shared/deferred-delivery.mjs +4 -0
  85. package/src/channels/shared/delivery-sync-settings-store.mjs +86 -0
  86. package/src/channels/shared/delivery-sync-settings.mjs +122 -0
  87. package/src/channels/shared/diagnostic-details.mjs +6 -1
  88. package/src/channels/shared/failure-log-file.mjs +79 -0
  89. package/src/channels/shared/harness-client.mjs +259 -96
  90. package/src/channels/shared/i18n-en/diagnostics.mjs +1 -0
  91. package/src/channels/shared/i18n-en/feishu.mjs +2 -2
  92. package/src/channels/shared/i18n-en/shared-a.mjs +13 -2
  93. package/src/channels/shared/i18n-en/shared-b.mjs +73 -4
  94. package/src/channels/shared/i18n-en/shared-d.mjs +144 -0
  95. package/src/channels/shared/i18n-en/weixin.mjs +4 -0
  96. package/src/channels/shared/i18n-en.mjs +2 -0
  97. package/src/channels/shared/i18n-ru/diagnostics.mjs +1 -0
  98. package/src/channels/shared/i18n-ru/feishu.mjs +2 -2
  99. package/src/channels/shared/i18n-ru/shared-a.mjs +13 -2
  100. package/src/channels/shared/i18n-ru/shared-b.mjs +72 -4
  101. package/src/channels/shared/i18n-ru/shared-d.mjs +144 -0
  102. package/src/channels/shared/i18n-ru/weixin.mjs +4 -0
  103. package/src/channels/shared/i18n-ru.mjs +2 -0
  104. package/src/channels/shared/inbound-access.mjs +10 -0
  105. package/src/channels/shared/interface-language-store.mjs +49 -10
  106. package/src/channels/shared/interface-language.mjs +19 -1
  107. package/src/channels/shared/markdown-chunks.mjs +5 -0
  108. package/src/channels/shared/message-failure.mjs +22 -1
  109. package/src/channels/shared/model-setting.mjs +6 -3
  110. package/src/channels/shared/new-command.mjs +158 -4
  111. package/src/channels/shared/plan-goal-command.mjs +132 -0
  112. package/src/channels/shared/qrcode.mjs +5 -0
  113. package/src/channels/shared/reply-content.mjs +102 -0
  114. package/src/channels/shared/reset-command.mjs +46 -0
  115. package/src/channels/shared/semantic/artifact.mjs +133 -29
  116. package/src/channels/shared/semantic/reply-reference.mjs +18 -3
  117. package/src/channels/shared/session-nav-command.mjs +999 -0
  118. package/src/channels/shared/session-ring-support.mjs +184 -0
  119. package/src/channels/shared/session-ring.mjs +202 -0
  120. package/src/channels/shared/session-title.mjs +11 -0
  121. package/src/channels/shared/status-command.mjs +2 -1
  122. package/src/channels/shared/text-harness-bridge.mjs +166 -7
  123. package/src/channels/shared/workspace-command.mjs +567 -31
  124. package/src/channels/shared/workspace-session.mjs +52 -4
  125. package/src/channels/slack/slack-api.mjs +2 -1
  126. package/src/channels/telegram/config-store.mjs +10 -2
  127. package/src/channels/telegram/telegram-api.mjs +19 -1
  128. package/src/channels/telegram/telegram-rich-message.mjs +17 -5
  129. package/src/channels/telegram/telegram-runtime.mjs +14 -1
  130. package/src/channels/wecom/state-store.mjs +13 -1
  131. package/src/channels/wecom/wecom-bridge.mjs +183 -26
  132. package/src/channels/wecom-app/state-store.mjs +13 -1
  133. package/src/channels/wecom-app/wecom-app-bridge.mjs +44 -4
  134. package/src/channels/weixin/state-store.mjs +13 -1
  135. package/src/channels/weixin/weixin-bridge.mjs +71 -4
@@ -0,0 +1,419 @@
1
+ // Read-only directory of every DSH-IM channel and its bound DSH sessions.
2
+ // Opened from the IM settings toolbar; it has no permanent sidebar entry.
3
+ import * as React from 'react';
4
+ import { callManagementRpc } from '../management-rpc.mjs';
5
+ import { h, IM_LOCALE_NAMESPACE, imLocale, localizeTemplate, localizeText } from './i18n.js';
6
+ import { IM_MAIN_PANEL_ID } from './plugin-page.js';
7
+ export const CHANNEL_LIST_RPC_CHANNEL = '/dsh-im-channels';
8
+ export const CHANNEL_SESSIONS_PANEL_ID = 'xmanrui-dsh-im-channels';
9
+
10
+ const CHANNEL_LABELS = Object.freeze({
11
+ matrix: 'Matrix',
12
+ telegram: 'Telegram',
13
+ whatsapp: 'WhatsApp',
14
+ wecom: '微信客服',
15
+ 'wecom-app': '企业微信',
16
+ feishu: '飞书',
17
+ dingtalk: '钉钉',
18
+ slack: 'Slack',
19
+ discord: 'Discord',
20
+ line: 'LINE',
21
+ qq: 'QQ',
22
+ });
23
+
24
+ const styles = Object.freeze({
25
+ header: { display: 'flex', alignItems: 'flex-start', justifyContent: 'space-between', gap: 16, marginBottom: 20 },
26
+ title: { margin: 0, fontSize: 22, fontWeight: 650 },
27
+ description: { margin: '6px 0 0', opacity: 0.68, lineHeight: 1.6 },
28
+ button: { border: '1px solid var(--dim-border, #444)', borderRadius: 6, background: 'transparent', color: 'inherit', padding: '6px 12px', cursor: 'pointer', whiteSpace: 'nowrap' },
29
+ group: { marginBottom: 22 },
30
+ groupTitle: { display: 'flex', alignItems: 'center', gap: 8, margin: '0 0 8px', fontSize: 16 },
31
+ count: { opacity: 0.58, fontSize: 12, fontWeight: 400 },
32
+ tableWrap: { overflowX: 'auto', border: '1px solid var(--dim-border, #444)', borderRadius: 8 },
33
+ table: { width: '100%', borderCollapse: 'collapse', fontSize: 13 },
34
+ th: { textAlign: 'left', padding: '10px 12px', borderBottom: '1px solid var(--dim-border, #444)', opacity: 0.65, fontWeight: 500 },
35
+ td: { padding: '10px 12px', borderBottom: '1px solid var(--dim-border, #333)', verticalAlign: 'top' },
36
+ code: { fontFamily: 'ui-monospace, SFMono-Regular, Consolas, monospace', fontSize: 12, overflowWrap: 'anywhere' },
37
+ secondary: { display: 'block', marginTop: 4, opacity: 0.55, fontSize: 11 },
38
+ muted: { opacity: 0.65, padding: '24px 0' },
39
+ error: { padding: 12, marginBottom: 16, borderRadius: 6, background: 'var(--dim-error-bg, rgba(220, 70, 70, .12))', color: 'var(--dim-error, #e17777)', whiteSpace: 'pre-wrap', overflowWrap: 'anywhere' },
40
+ actions: { display: 'flex', flexWrap: 'wrap', gap: 8, alignItems: 'center' },
41
+ messageList: { display: 'flex', flexDirection: 'column', gap: 12, marginTop: 16 },
42
+ message: { maxWidth: 920, padding: '12px 14px', border: '1px solid var(--dim-border, #444)', borderRadius: 10, background: 'var(--dim-bg-secondary, rgba(127, 127, 127, .06))' },
43
+ userMessage: { borderColor: 'var(--dim-accent-border, rgba(80, 140, 220, .45))', background: 'var(--dim-accent-bg, rgba(80, 140, 220, .08))' },
44
+ messageMeta: { display: 'flex', justifyContent: 'space-between', gap: 12, marginBottom: 7, opacity: 0.62, fontSize: 12 },
45
+ messageText: { whiteSpace: 'pre-wrap', overflowWrap: 'anywhere', lineHeight: 1.65, fontSize: 14 },
46
+ detailMeta: { margin: '8px 0 0', opacity: 0.68, lineHeight: 1.7, overflowWrap: 'anywhere' },
47
+ });
48
+
49
+ function formatTime(value) {
50
+ if (!Number.isFinite(value)) return '';
51
+ try {
52
+ const locale = imLocale();
53
+ const tag = locale === 'zh' ? 'zh-CN' : locale === 'ru' ? 'ru-RU' : 'en-US';
54
+ return new Date(value).toLocaleString(tag, { hour12: false });
55
+ } catch {
56
+ return '';
57
+ }
58
+ }
59
+
60
+ function text(value) {
61
+ return String(value == null ? '' : value);
62
+ }
63
+
64
+ function errorText(error) {
65
+ return error instanceof Error ? error.message : text(error);
66
+ }
67
+
68
+ async function copyText(value) {
69
+ if (globalThis.navigator?.clipboard?.writeText) {
70
+ await globalThis.navigator.clipboard.writeText(value);
71
+ return;
72
+ }
73
+ const area = document.createElement('textarea');
74
+ area.value = value;
75
+ area.style.position = 'fixed';
76
+ area.style.opacity = '0';
77
+ document.body.appendChild(area);
78
+ area.select();
79
+ const copied = document.execCommand('copy');
80
+ area.remove();
81
+ if (!copied) throw new Error('浏览器未允许访问剪贴板');
82
+ }
83
+
84
+ class ChannelListPage extends React.Component {
85
+ constructor(props) {
86
+ super(props);
87
+ this.state = {
88
+ channels: null, error: null, refreshing: false, copyStatus: null,
89
+ selected: null, detail: null, detailError: null, detailLoading: false, loadingEarlier: false,
90
+ };
91
+ this.reload = this.reload.bind(this);
92
+ this.openSession = this.openSession.bind(this);
93
+ this.backToList = this.backToList.bind(this);
94
+ this.loadEarlier = this.loadEarlier.bind(this);
95
+ this.copySession = this.copySession.bind(this);
96
+ this.unmounted = false;
97
+ this.request = null;
98
+ this.detailRequest = null;
99
+ this.copyTimer = null;
100
+ }
101
+
102
+ componentDidMount() {
103
+ void this.reload();
104
+ }
105
+
106
+ componentWillUnmount() {
107
+ this.unmounted = true;
108
+ this.request?.abort();
109
+ this.detailRequest?.abort();
110
+ if (this.copyTimer) clearTimeout(this.copyTimer);
111
+ }
112
+
113
+ rpc(method, payload, signal) {
114
+ const call = this.props.channelListRpcCall || ((endpoint, body, rpcSignal) =>
115
+ callManagementRpc(this.props.ctx.connection, CHANNEL_LIST_RPC_CHANNEL, endpoint, body, rpcSignal));
116
+ return call(method, payload, signal);
117
+ }
118
+
119
+ async reload() {
120
+ this.request?.abort();
121
+ const controller = new AbortController();
122
+ this.request = controller;
123
+ this.setState({ refreshing: true, error: null });
124
+ try {
125
+ const result = await this.rpc('list.channels', {}, controller.signal);
126
+ if (controller.signal.aborted) return;
127
+ if (!result || result.ok !== true) {
128
+ throw new Error(result?.error?.message || result?.error?.code || 'failed to list channels');
129
+ }
130
+ if (!Array.isArray(result.value?.channels)) {
131
+ throw new Error('宿主响应缺少 value.channels,请检查 dsh-im host 是否已重载');
132
+ }
133
+ if (!this.unmounted) this.setState({ channels: result.value.channels });
134
+ } catch (error) {
135
+ if (controller.signal.aborted || this.unmounted) return;
136
+ this.setState({ channels: null, error: errorText(error) });
137
+ } finally {
138
+ if (this.request === controller) {
139
+ this.request = null;
140
+ if (!this.unmounted) this.setState({ refreshing: false });
141
+ }
142
+ }
143
+ }
144
+
145
+ async openSession(group, row) {
146
+ const selected = {
147
+ channel: group.channel,
148
+ key: text(row.key),
149
+ botId: text(row.botId),
150
+ sessionId: text(row.sessionId),
151
+ };
152
+ this.detailRequest?.abort();
153
+ const controller = new AbortController();
154
+ this.detailRequest = controller;
155
+ this.setState({
156
+ selected, detail: null, detailError: null, detailLoading: true, loadingEarlier: false,
157
+ });
158
+ try {
159
+ const result = await this.rpc('session.read', selected, controller.signal);
160
+ if (controller.signal.aborted || this.detailRequest !== controller) return;
161
+ if (!result || result.ok !== true) {
162
+ throw new Error(result?.error?.message || result?.error?.code || 'failed to read session');
163
+ }
164
+ if (!Array.isArray(result.value?.messages)) {
165
+ throw new Error('宿主响应缺少 value.messages,请检查 dsh-im host 是否已重载');
166
+ }
167
+ this.setState({ detail: result.value, detailError: null });
168
+ } catch (error) {
169
+ if (controller.signal.aborted || this.unmounted || this.detailRequest !== controller) return;
170
+ this.setState({ detailError: errorText(error) });
171
+ } finally {
172
+ if (this.detailRequest === controller) {
173
+ this.detailRequest = null;
174
+ if (!this.unmounted) this.setState({ detailLoading: false });
175
+ }
176
+ }
177
+ }
178
+
179
+ backToList() {
180
+ this.detailRequest?.abort();
181
+ this.detailRequest = null;
182
+ this.setState({
183
+ selected: null, detail: null, detailError: null, detailLoading: false, loadingEarlier: false,
184
+ });
185
+ }
186
+
187
+ async loadEarlier() {
188
+ const { selected, detail } = this.state;
189
+ if (!selected || !detail?.hasMore || this.detailRequest) return;
190
+ const controller = new AbortController();
191
+ this.detailRequest = controller;
192
+ this.setState({ loadingEarlier: true, detailError: null });
193
+ try {
194
+ const result = await this.rpc('session.read', {
195
+ ...selected, offset: detail.nextOffset, limit: detail.limit,
196
+ }, controller.signal);
197
+ if (controller.signal.aborted || this.detailRequest !== controller) return;
198
+ if (!result || result.ok !== true) {
199
+ throw new Error(result?.error?.message || result?.error?.code || 'failed to read earlier messages');
200
+ }
201
+ if (!Array.isArray(result.value?.messages)) throw new Error('宿主响应缺少 value.messages');
202
+ const earlier = result.value;
203
+ this.setState(previous => {
204
+ if (!previous.detail) return null;
205
+ // The oldest page is still limit-sized. Keep only the part before the
206
+ // page already displayed, and retain the original snapshot's total.
207
+ const prependCount = Math.max(0, previous.detail.offset - earlier.offset);
208
+ return {
209
+ detail: {
210
+ ...previous.detail,
211
+ offset: earlier.offset,
212
+ hasMore: earlier.hasMore,
213
+ nextOffset: earlier.nextOffset,
214
+ messages: [
215
+ ...earlier.messages.slice(0, prependCount),
216
+ ...previous.detail.messages,
217
+ ],
218
+ },
219
+ };
220
+ });
221
+ } catch (error) {
222
+ if (controller.signal.aborted || this.unmounted || this.detailRequest !== controller) return;
223
+ this.setState({ detailError: errorText(error) });
224
+ } finally {
225
+ if (this.detailRequest === controller) {
226
+ this.detailRequest = null;
227
+ if (!this.unmounted) this.setState({ loadingEarlier: false });
228
+ }
229
+ }
230
+ }
231
+
232
+ async copySession(sessionId) {
233
+ try {
234
+ await copyText(sessionId);
235
+ if (!this.unmounted) this.setState({ copyStatus: { sessionId, ok: true } });
236
+ } catch {
237
+ if (!this.unmounted) this.setState({ copyStatus: { sessionId, ok: false } });
238
+ }
239
+ if (this.copyTimer) clearTimeout(this.copyTimer);
240
+ this.copyTimer = setTimeout(() => {
241
+ if (!this.unmounted) this.setState({ copyStatus: null });
242
+ }, 1800);
243
+ }
244
+
245
+ renderRow(group, row) {
246
+ const sessionId = text(row.sessionId);
247
+ const status = this.state.copyStatus?.sessionId === sessionId ? this.state.copyStatus : null;
248
+ return h('tr', { key: `${group.channel}:${row.botId}:${row.key}:${sessionId}` },
249
+ h('td', { style: styles.td },
250
+ h('code', { style: styles.code }, text(row.key)),
251
+ h('span', { style: styles.secondary }, `bot:${text(row.botId)}`)),
252
+ h('td', { style: styles.td },
253
+ h('button', {
254
+ type: 'button', style: { ...styles.button, ...styles.code, padding: '4px 6px', textAlign: 'left' },
255
+ className: 'im-channel-session-open', onClick: () => { void this.openSession(group, row); },
256
+ 'aria-label': localizeTemplate('查看会话 {sessionId}', { sessionId }), title: '查看该会话的用户与助手正文',
257
+ }, sessionId)),
258
+ h('td', { style: { ...styles.td, width: 88 } },
259
+ h('button', {
260
+ type: 'button', style: styles.button, className: 'im-channel-session-copy',
261
+ onClick: () => { void this.copySession(sessionId); },
262
+ 'aria-label': localizeTemplate('复制会话 ID {sessionId}', { sessionId }),
263
+ }, status ? (status.ok ? '已复制' : '复制失败') : '复制 ID')));
264
+ }
265
+
266
+ renderGroup(group) {
267
+ const label = CHANNEL_LABELS[group.channel] || group.channel;
268
+ const rows = Array.isArray(group.sessions) ? group.sessions : [];
269
+ return h('section', { key: group.channel, className: 'im-channel-group', style: styles.group },
270
+ h('h2', { style: styles.groupTitle }, label,
271
+ group.channel === label ? null : h('span', { style: styles.count }, group.channel),
272
+ h('span', { style: styles.count }, localizeTemplate('{count} 个会话', { count: rows.length }))),
273
+ h('div', { style: styles.tableWrap },
274
+ h('table', { style: styles.table },
275
+ h('thead', null, h('tr', null,
276
+ h('th', { style: styles.th }, '通道 / 会话键'),
277
+ h('th', { style: styles.th }, 'DSH 会话 ID'),
278
+ h('th', { style: styles.th }, '操作'))),
279
+ h('tbody', null, rows.map(row => this.renderRow(group, row))))));
280
+ }
281
+
282
+ renderMessage(message) {
283
+ const role = message.role === 'user' ? '用户' : '助手';
284
+ const time = formatTime(message.time);
285
+ return h('article', {
286
+ key: message.id || `${message.seq}:${message.role}`,
287
+ className: `im-channel-message im-channel-message-${message.role}`,
288
+ style: { ...styles.message, ...(message.role === 'user' ? styles.userMessage : null) },
289
+ },
290
+ h('div', { style: styles.messageMeta },
291
+ h('strong', null, role),
292
+ h('span', null, time || (Number.isInteger(message.seq)
293
+ ? localizeTemplate('事件 {seq}', { seq: message.seq }) : ''))),
294
+ h('div', { style: styles.messageText }, text(message.text)),
295
+ message.truncated ? h('div', { style: styles.secondary }, '本条消息过长,已截断。') : null);
296
+ }
297
+
298
+ renderDetail() {
299
+ const { selected, detail, detailError, detailLoading, loadingEarlier, copyStatus } = this.state;
300
+ const label = CHANNEL_LABELS[selected.channel] || selected.channel;
301
+ const copyState = copyStatus?.sessionId === selected.sessionId ? copyStatus : null;
302
+ let body;
303
+ if (detailLoading && !detail) {
304
+ body = h('p', { style: styles.muted }, '加载中…');
305
+ } else if (!detail) {
306
+ body = null;
307
+ } else if (detail.messages.length === 0) {
308
+ body = h('p', { style: styles.muted }, '没有可显示的用户或助手正文。');
309
+ } else {
310
+ body = h('div', { className: 'im-channel-message-list', style: styles.messageList },
311
+ detail.messages.map(message => this.renderMessage(message)));
312
+ }
313
+ return h(React.Fragment, null,
314
+ h('header', { style: { ...styles.header, flexWrap: 'wrap' } },
315
+ h('div', null,
316
+ h('h1', { style: styles.title }, '会话内容'),
317
+ h('p', { style: styles.detailMeta }, `${label} · ${selected.key}`),
318
+ h('code', { style: styles.code }, selected.sessionId),
319
+ h('p', { style: styles.description }, '只读显示用户与助手正文;系统提示、工具调用和内部推理不显示。')),
320
+ h('div', { style: styles.actions },
321
+ this.renderBackToIm(),
322
+ h('button', { type: 'button', className: 'im-channel-back', style: styles.button, onClick: this.backToList }, '返回列表'),
323
+ h('button', {
324
+ type: 'button', className: 'im-channel-detail-refresh', style: styles.button,
325
+ disabled: detailLoading || loadingEarlier,
326
+ onClick: () => { void this.openSession(selected, selected); },
327
+ }, detailLoading ? '刷新中…' : '刷新'),
328
+ h('button', {
329
+ type: 'button', className: 'im-channel-detail-copy', style: styles.button,
330
+ onClick: () => { void this.copySession(selected.sessionId); },
331
+ }, copyState ? (copyState.ok ? '已复制' : '复制失败') : '复制 ID'))),
332
+ detailError ? h('div', { role: 'alert', style: styles.error },
333
+ localizeTemplate('读取失败:{error}', { error: localizeText(detailError) })) : null,
334
+ detail ? h('div', { style: { marginBottom: 12 } },
335
+ h('p', { style: { ...styles.description, margin: '0 0 10px' } },
336
+ localizeTemplate('已显示 {shown} / {total} 条正文', {
337
+ shown: detail.messages.length, total: detail.total,
338
+ })),
339
+ detail.hasMore ? h('button', {
340
+ type: 'button', className: 'im-channel-load-earlier', style: styles.button,
341
+ onClick: this.loadEarlier, disabled: loadingEarlier,
342
+ }, loadingEarlier ? '加载中…' : '加载更早消息') : null) : null,
343
+ body);
344
+ }
345
+
346
+ renderBackToIm() {
347
+ return this.props.onBackToIm ? h('button', {
348
+ type: 'button', className: 'im-channel-back-to-im', style: styles.button,
349
+ onClick: this.props.onBackToIm,
350
+ }, '返回 IM机器人') : null;
351
+ }
352
+
353
+ render() {
354
+ const { channels, error, refreshing, selected } = this.state;
355
+ if (selected) {
356
+ return h('div', { className: 'dim-pluginPage im-channel-session-detail' },
357
+ h('div', { className: 'dim-pluginPageContent' }, this.renderDetail()));
358
+ }
359
+ let body;
360
+ if (error) {
361
+ body = h('div', { role: 'alert', style: styles.error },
362
+ localizeTemplate('加载失败:{error}', { error: localizeText(error) }));
363
+ } else if (!channels) {
364
+ body = h('p', { style: styles.muted }, '正在读取通道会话…');
365
+ } else if (channels.length === 0) {
366
+ body = h('p', { style: styles.muted }, '尚未发现已绑定 DSH 会话的通道。');
367
+ } else {
368
+ body = channels.map(group => this.renderGroup(group));
369
+ }
370
+ return h('div', { className: 'dim-pluginPage im-channel-sessions-page' },
371
+ h('div', { className: 'dim-pluginPageContent' },
372
+ h('header', { style: { ...styles.header, flexWrap: 'wrap' } },
373
+ h('div', null,
374
+ h('h1', { style: styles.title }, '会话记录'),
375
+ h('p', { style: styles.description }, '只读列出各 IM 通道当前绑定的 DSH 会话;点击会话 ID 查看正文,不会修改绑定。')),
376
+ h('div', { style: styles.actions },
377
+ this.renderBackToIm(),
378
+ h('button', { type: 'button', className: 'im-channel-refresh', style: styles.button, onClick: this.reload, disabled: refreshing },
379
+ refreshing ? '刷新中…' : '刷新'))),
380
+ body));
381
+ }
382
+ }
383
+
384
+ export function ChannelSessionsPanel(props) {
385
+ return h(ChannelListPage, props);
386
+ }
387
+
388
+ export function installChannelSessionsPage(ctx, { channelListRpcCall }) {
389
+ let navigate = null;
390
+ const listeners = new Set();
391
+ const publish = (value) => {
392
+ navigate = value;
393
+ for (const listener of listeners) listener();
394
+ };
395
+ // Only offer the toolbar action while both navigation and its target slot
396
+ // exist. Late services and plugin disposal must not leave a dead button.
397
+ const controller = {
398
+ available: () => navigate !== null,
399
+ open: () => navigate?.(),
400
+ subscribe(listener) {
401
+ listeners.add(listener);
402
+ return () => listeners.delete(listener);
403
+ },
404
+ };
405
+ if (typeof ctx.inject === 'function') {
406
+ ctx.inject(['layout'], pageCtx => pageCtx.slots.inject('main', () => {
407
+ const stopMain = pageCtx.slots.register({
408
+ name: 'main', key: CHANNEL_SESSIONS_PANEL_ID, locale: IM_LOCALE_NAMESPACE,
409
+ inject: () => ({
410
+ channelListRpcCall,
411
+ onBackToIm: () => pageCtx.layout.selectPanel(IM_MAIN_PANEL_ID),
412
+ }),
413
+ }, ChannelSessionsPanel);
414
+ publish(() => pageCtx.layout.selectPanel(CHANNEL_SESSIONS_PANEL_ID));
415
+ return () => { publish(null); stopMain(); };
416
+ }));
417
+ }
418
+ return controller;
419
+ }
@@ -79,6 +79,7 @@ import {
79
79
  replacePageLocation,
80
80
  } from './loopback-recovery.js';
81
81
  import { installImStyles } from './styles.js';
82
+ import { DELIVERY_SYNC_SETTINGS_RPC_CHANNEL } from './delivery-sync-settings.js';
82
83
  import { installSessionChannelLogos } from './session-channel-logos.js';
83
84
  import { installDsBotSessionAvatars } from './ds-bot-session-avatars.js';
84
85
  import { UpdatePanel, UPDATE_RPC_CHANNEL } from './update-panel.js';
@@ -87,6 +88,7 @@ import { IMPanelErrorBoundary } from './panel-error-boundary.js';
87
88
  import { installImPluginPage } from './plugin-page.js';
88
89
  import { installSidebarVisibilitySync, SIDEBAR_SETTINGS_ENDPOINTS, SIDEBAR_SETTINGS_RPC_CHANNEL } from './sidebar-settings.js';
89
90
 
91
+ import { installChannelSessionsPage, CHANNEL_LIST_RPC_CHANNEL } from './im-channels.js';
90
92
  export const name = 'im-settings';
91
93
  export const inject = ['slots', 'connection', 'locale', 'workspaces'];
92
94
  export const IM_PLUGIN_VERSION = manifest.version;
@@ -236,7 +238,10 @@ export function IMSettingsTab({
236
238
  updateRpcCall,
237
239
  deliveryRpcCall,
238
240
  globalSettingsRpcCall,
241
+ deliverySyncRpcCall,
242
+ languageRpcCall,
239
243
  workspaceDirectoryPicker,
244
+ onOpenSessionHistory,
240
245
  preferredSectionId,
241
246
  browserLocation = globalThis.location,
242
247
  navigateToRecoveryUrl = replacePageLocation,
@@ -258,6 +263,7 @@ export function IMSettingsTab({
258
263
  [emailEnabled],
259
264
  );
260
265
  const githubTooltipId = React.useId();
266
+ const sessionHistoryTooltipId = React.useId();
261
267
  const generalSettingsTooltipId = React.useId();
262
268
  const globalSettingsSelected = selected === GLOBAL_SETTINGS_TAB_ID;
263
269
  const active = visibleChannels.find((channel) => channel.id === selected) ?? visibleChannels[0];
@@ -288,6 +294,8 @@ export function IMSettingsTab({
288
294
  updateRpcCall,
289
295
  deliveryRpcCall,
290
296
  globalSettingsRpcCall,
297
+ deliverySyncRpcCall,
298
+ languageRpcCall,
291
299
  imessageRpcCall,
292
300
  emailRpcCall,
293
301
  matrixRpcCall,
@@ -301,6 +309,7 @@ export function IMSettingsTab({
301
309
  deliveryRpcCall,
302
310
  feishuRpcCall,
303
311
  globalSettingsRpcCall,
312
+ deliverySyncRpcCall,
304
313
  imessageRpcCall,
305
314
  emailRpcCall,
306
315
  matrixRpcCall,
@@ -356,6 +365,25 @@ export function IMSettingsTab({
356
365
  className: 'dim-githubTooltip',
357
366
  role: 'tooltip',
358
367
  }, '帮助与反馈 · 前往 GitHub')),
368
+ onOpenSessionHistory ? h('span', { className: 'dim-sessionHistoryAction' },
369
+ h('button', {
370
+ type: 'button',
371
+ className: 'dim-sessionHistoryButton',
372
+ 'aria-label': '会话记录',
373
+ 'aria-describedby': sessionHistoryTooltipId,
374
+ onClick: onOpenSessionHistory,
375
+ }, h('svg', {
376
+ width: 18, height: 18, viewBox: '0 0 24 24', fill: 'none',
377
+ stroke: 'currentColor', strokeWidth: 2, strokeLinecap: 'round', strokeLinejoin: 'round',
378
+ focusable: 'false', 'aria-hidden': 'true',
379
+ },
380
+ h('path', { d: 'M21 15a3 3 0 0 1-3 3H7l-4 3V6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3Z' }),
381
+ h('path', { d: 'M8 8h8M8 12h5' }))),
382
+ h('span', {
383
+ id: sessionHistoryTooltipId,
384
+ className: 'dim-sessionHistoryTooltip',
385
+ role: 'tooltip',
386
+ }, '会话记录')) : null,
359
387
  h('span', { className: 'dim-generalSettingsAction' },
360
388
  h('button', {
361
389
  type: 'button',
@@ -411,7 +439,11 @@ export function IMSettingsTab({
411
439
  : null,
412
440
  h(BotSettingsContext.Provider, { value: botSettingsContext },
413
441
  globalSettingsSelected
414
- ? h(GlobalSettingsPanel, { rpcCall: rpcCalls.globalSettingsRpcCall })
442
+ ? h(GlobalSettingsPanel, {
443
+ rpcCall: rpcCalls.globalSettingsRpcCall,
444
+ deliverySyncRpcCall: rpcCalls.deliverySyncRpcCall,
445
+ languageRpcCall: rpcCalls.languageRpcCall,
446
+ })
415
447
  : deliverySettings?.channel === active.id
416
448
  ? h(DeliveryTargetSettingsPage, {
417
449
  channel: active.id,
@@ -555,6 +587,12 @@ export function apply(ctx) {
555
587
  const globalSettingsRpcCall = (endpoint, payload, signal) =>
556
588
  managementRpc(ctx.connection, Object.values(SIDEBAR_SETTINGS_ENDPOINTS).includes(endpoint)
557
589
  ? SIDEBAR_SETTINGS_RPC_CHANNEL : GLOBAL_SETTINGS_RPC_CHANNEL, endpoint, payload, signal);
590
+ const deliverySyncRpcCall = (endpoint, payload, signal) =>
591
+ managementRpc(ctx.connection, DELIVERY_SYNC_SETTINGS_RPC_CHANNEL, endpoint, payload, signal);
592
+ const languageRpcCall = (endpoint, payload, signal) =>
593
+ managementRpc(ctx.connection, HOST_LANGUAGE_RPC_CHANNEL, endpoint, payload, signal);
594
+ const channelListRpcCall = (endpoint, payload, signal) =>
595
+ managementRpc(ctx.connection, CHANNEL_LIST_RPC_CHANNEL, endpoint, payload, signal);
558
596
  const workspaceDirectoryPicker = Object.freeze({
559
597
  listDirectory: (path, signal) =>
560
598
  callWorkspaceDirectoryApi(ctx, 'listDirectory', path, signal),
@@ -579,6 +617,9 @@ export function apply(ctx) {
579
617
  updateRpcCall,
580
618
  deliveryRpcCall,
581
619
  globalSettingsRpcCall,
620
+ languageRpcCall,
621
+ deliverySyncRpcCall,
622
+ channelListRpcCall,
582
623
  workspaceDirectoryPicker,
583
624
  };
584
625
  const subscribeLocale = (listener) => typeof ctx.on === 'function'
@@ -589,8 +630,14 @@ export function apply(ctx) {
589
630
  // new component type and reset the reader's selected tab or unsaved input.
590
631
  function IMPanel({ preferredSectionId }) {
591
632
  React.useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
633
+ const historyAvailable = React.useSyncExternalStore(
634
+ channelSessionsPage.subscribe, channelSessionsPage.available, channelSessionsPage.available,
635
+ );
592
636
  return h(IMPanelErrorBoundary, null,
593
- h(IMSettingsTab, { ...panelDependencies, preferredSectionId }));
637
+ h(IMSettingsTab, {
638
+ ...panelDependencies, preferredSectionId,
639
+ onOpenSessionHistory: historyAvailable ? channelSessionsPage.open : undefined,
640
+ }));
594
641
  }
595
642
  const buildPanelElement = (props = {}) => h(IMPanel, {
596
643
  preferredSectionId: props.preferredSectionId,
@@ -600,6 +647,7 @@ export function apply(ctx) {
600
647
  packageName: manifest.name,
601
648
  renderPanel: buildPanelElement,
602
649
  });
650
+ const channelSessionsPage = installChannelSessionsPage(ctx, { channelListRpcCall });
603
651
 
604
652
  ctx.effect(() => {
605
653
  sidebarSync = installSidebarVisibilitySync({
@@ -9,6 +9,7 @@ import {
9
9
  sameModelSelection,
10
10
  } from '../../src/channels/shared/model-setting.mjs';
11
11
  import { h, localizeText } from './i18n.js';
12
+ import { ConnectionError, normalizeConnectionError } from './connection-error.js';
12
13
 
13
14
  export const SET_MODEL_ENDPOINT = 'bot.model.set';
14
15
  export { EMPTY_MODEL_CATALOG, normalizeModelCatalog, normalizeModelSelection };
@@ -87,7 +88,8 @@ export function ModelEditor({ model = null, disabled = false, onSave }) {
87
88
  await onSave?.(next);
88
89
  close(true);
89
90
  } catch (cause) {
90
- setError(cause?.message ?? '模型修改失败,请重试。');
91
+ setError(normalizeConnectionError(cause, 'model-update-failed', '模型修改失败,请重试。'));
92
+ close(true);
91
93
  } finally {
92
94
  savingRef.current = false;
93
95
  setSaving(false);
@@ -146,6 +148,7 @@ export function ModelEditor({ model = null, disabled = false, onSave }) {
146
148
  '只影响新建会话;若当前聊天已有会话,先发送 /new,再发送普通消息生效。'))),
147
149
  saving ? h('span', { className: 'dim-presetStatus', role: 'status' }, '保存中…') : null),
148
150
  row('model', '模型', entry?.name ?? (current ? modelSelectionId(current) : localizeText('跟随默认模型'))),
151
+ error ? h('div', { role: 'alert' }, h(ConnectionError, { error })) : null,
149
152
  row('effort', '思考强度', effortLabel, effortDisabled),
150
153
  pane ? h('div', { ref: menuRef, id: `${id}-menu`, role: 'menu',
151
154
  'aria-label': pane === 'model' ? '模型' : '思考强度', 'aria-busy': saving,
@@ -167,6 +170,6 @@ export function ModelEditor({ model = null, disabled = false, onSave }) {
167
170
  ]) : null,
168
171
  effortHint && effortUnavailable ? h('p', { id: `${id}-hint`, className: 'dim-modelHint',
169
172
  role: 'status' }, effortHint) : null,
170
- error || !currentAvailable ? h('p', { className: 'dim-presetError', role: error ? 'alert' : 'status' },
171
- error ?? '当前模型已不可用,请选择其他模型或跟随默认模型。') : null);
173
+ !error && !currentAvailable ? h('p', { className: 'dim-presetError', role: 'status' },
174
+ '当前模型已不可用,请选择其他模型或跟随默认模型。') : null);
172
175
  }
@@ -114,14 +114,14 @@ const CSS = String.raw`
114
114
  .dim-githubLink:focus-visible { outline: 2px solid color-mix(in srgb, var(--dim-blue) 70%, white); outline-offset: 2px; }
115
115
  .dim-updateTooltip, .dim-githubTooltip { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: max-content; max-width: min(220px, 80vw); padding: 6px 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-3, #fff); box-shadow: 0 8px 24px rgb(31 35 41 / 14%); font-size: 11px; line-height: 16px; font-weight: 500; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateY(-3px); pointer-events: none; transition: opacity .15s ease, transform .15s ease, visibility .15s ease; }
116
116
  .dim-updateAction:hover .dim-updateTooltip, .dim-updateTrigger:focus-visible + .dim-updateTooltip, .dim-githubAction:hover .dim-githubTooltip, .dim-githubAction:focus-within .dim-githubTooltip { opacity: 1; visibility: visible; transform: translateY(0); }
117
- .dim-generalSettingsAction { position: relative; display: inline-flex; flex: none; }
118
- .dim-generalSettingsButton { width: 30px; height: 30px; display: grid; place-items: center; flex: none; padding: 0; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 8px; color: var(--dsw-alias-label-secondary, #646a73); background: var(--dsw-alias-bg-layer-1, #fff); cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease; }
119
- .dim-generalSettingsButton svg { display: block; }
120
- .dim-generalSettingsButton:hover { border-color: #aeb3bb; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
117
+ .dim-sessionHistoryAction, .dim-generalSettingsAction { position: relative; display: inline-flex; flex: none; }
118
+ .dim-sessionHistoryButton, .dim-generalSettingsButton { width: 30px; height: 30px; display: grid; place-items: center; flex: none; padding: 0; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 8px; color: var(--dsw-alias-label-secondary, #646a73); background: var(--dsw-alias-bg-layer-1, #fff); cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease, box-shadow .15s ease; }
119
+ .dim-sessionHistoryButton svg, .dim-generalSettingsButton svg { display: block; }
120
+ .dim-sessionHistoryButton:hover, .dim-generalSettingsButton:hover { border-color: #aeb3bb; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
121
121
  .dim-generalSettingsButton[aria-current="page"] { border-color: color-mix(in srgb, var(--dim-blue) 42%, var(--dsw-alias-border-l2, #dfe1e5)); color: var(--dim-blue); background: var(--dim-blue-soft); }
122
- .dim-generalSettingsButton:focus-visible { outline: 2px solid color-mix(in srgb, var(--dim-blue) 70%, white); outline-offset: 2px; }
123
- .dim-generalSettingsTooltip { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: max-content; padding: 6px 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-3, #fff); box-shadow: 0 8px 24px rgb(31 35 41 / 14%); font-size: 11px; line-height: 16px; font-weight: 500; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateY(-3px); pointer-events: none; transition: opacity .15s ease, transform .15s ease, visibility .15s ease; }
124
- .dim-generalSettingsAction:hover .dim-generalSettingsTooltip, .dim-generalSettingsButton:focus-visible + .dim-generalSettingsTooltip { opacity: 1; visibility: visible; transform: translateY(0); }
122
+ .dim-sessionHistoryButton:focus-visible, .dim-generalSettingsButton:focus-visible { outline: 2px solid color-mix(in srgb, var(--dim-blue) 70%, white); outline-offset: 2px; }
123
+ .dim-sessionHistoryTooltip, .dim-generalSettingsTooltip { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: max-content; padding: 6px 9px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 7px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-3, #fff); box-shadow: 0 8px 24px rgb(31 35 41 / 14%); font-size: 11px; line-height: 16px; font-weight: 500; white-space: nowrap; opacity: 0; visibility: hidden; transform: translateY(-3px); pointer-events: none; transition: opacity .15s ease, transform .15s ease, visibility .15s ease; }
124
+ .dim-sessionHistoryAction:hover .dim-sessionHistoryTooltip, .dim-sessionHistoryButton:focus-visible + .dim-sessionHistoryTooltip, .dim-generalSettingsAction:hover .dim-generalSettingsTooltip, .dim-generalSettingsButton:focus-visible + .dim-generalSettingsTooltip { opacity: 1; visibility: visible; transform: translateY(0); }
125
125
  .dim-generalSettingsButton[aria-current="page"] + .dim-generalSettingsTooltip { opacity: 0; visibility: hidden; transform: translateY(-3px); }
126
126
  .dim-layout { display: grid; grid-template-columns: 174px 1px minmax(0, 1fr); gap: 24px; align-items: start; }
127
127
  .dim-rail { display: grid; align-content: start; gap: 8px; padding: 0 4px 1px 1px; }
@@ -822,6 +822,22 @@ const CSS = String.raw`
822
822
  .dim-directoryPickerSpinner { animation-duration: 1.8s; }
823
823
  .dim-collapsibleBody, .dim-collapsibleChevron { transition: none !important; }
824
824
  }
825
+ /* Delivery-sync settings (General settings -> Delivery tab) */
826
+ .dim-deliverySyncSettings { container-type: inline-size; }
827
+ .dim-deliverySyncSettings .dim-globalHead { position: relative; }
828
+ .dim-deliverySyncSettings .dim-globalTtlHelp { position: static; }
829
+ .dim-globalTtlTooltip.dim-deliverySyncTooltip { width: min(360px, 100%); max-width: none; color: var(--dsw-alias-label-secondary, #646a73); font-size: 11px; line-height: 17px; white-space: normal; overflow-wrap: anywhere; }
830
+ .dim-deliverySyncFields { min-width: 0; display: grid; gap: 16px; margin-top: 12px; }
831
+ .dim-deliverySyncField { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 200px); align-items: start; gap: 8px 16px; }
832
+ .dim-deliverySyncLabel { min-width: 0; display: grid; gap: 4px; }
833
+ .dim-deliverySyncLabel > label { color: var(--dsw-alias-label-primary, #1f2329); font-size: 14px; line-height: 22px; }
834
+ .dim-deliverySyncCheckLabel { display: flex; align-items: center; gap: 8px; }
835
+ .dim-deliverySyncCheckLabel input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--dsw-alias-state-business-primary, #3370ff); }
836
+ .dim-deliverySyncHelp { margin: 0; color: var(--dsw-alias-label-secondary, #646a73); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
837
+ .dim-deliverySyncIcon { min-width: 0; display: grid; gap: 4px; }
838
+ .dim-deliverySyncFields .dim-globalTtlInput { width: 100%; min-width: 0; }
839
+ .dim-deliverySyncFeedback { margin: 10px 0 0; }
840
+ @container (max-width: 460px) { .dim-deliverySyncField { grid-template-columns: minmax(0, 1fr); } }
825
841
  `;
826
842
 
827
843
  export function installImStyles() {
@@ -471,7 +471,8 @@ export function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
471
471
  h('strong', null, 'DSH 版本兼容说明'),
472
472
  h('p', { className: 'dim-updateManualHint' }, 'dsh-im 4.25.0 支持到 DSH v0.1.6-alpha.2。'),
473
473
  h('p', { className: 'dim-updateManualHint' }, 'dsh-im 4.39.0 仅支持 DSH 0.2.0-rc.2。'),
474
- h('p', { className: 'dim-updateManualHint' }, 'dsh-im 5.0.0 仅支持 DSH 0.2.1-rc.2。')),
474
+ h('p', { className: 'dim-updateManualHint' }, 'dsh-im 5.0.0 仅支持 DSH 0.2.1-rc.2。'),
475
+ h('p', { className: 'dim-updateManualHint' }, 'dsh-im 5.10.0 起支持 DSH 0.2.2-rc.5。')),
475
476
  h(ManualUpdateCommand, {
476
477
  key: manualCommand ?? 'unavailable', command: manualCommand,
477
478
  disabled: busyAction || activeJob || uncertainInstall,