@xmanrui/dsh-im 5.0.3 → 5.2.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 (44) hide show
  1. package/README.en.md +18 -8
  2. package/README.md +18 -8
  3. package/docs/client-integration.md +10 -2
  4. package/lib/client.js +687 -496
  5. package/lib/index.js +318 -294
  6. package/package.json +1 -1
  7. package/plugin-src/client/channels/feishu/group-settings.js +10 -9
  8. package/plugin-src/client/channels/feishu/index.js +3 -3
  9. package/plugin-src/client/global-settings.js +29 -24
  10. package/plugin-src/client/group-history-settings.js +72 -0
  11. package/plugin-src/client/i18n.js +19 -3
  12. package/plugin-src/client/index.js +4 -1
  13. package/plugin-src/client/plugin-page.js +18 -0
  14. package/plugin-src/client/styles.js +13 -4
  15. package/plugin-src/host/channels/feishu/production.mjs +2 -0
  16. package/plugin-src/host/channels/feishu/rpc.mjs +5 -4
  17. package/plugin-src/host/channels/qq/production.mjs +2 -0
  18. package/plugin-src/host/channels/shared/production.mjs +2 -0
  19. package/plugin-src/host/channels/slack/production.mjs +2 -0
  20. package/plugin-src/host/channels/whatsapp/production.mjs +2 -0
  21. package/plugin-src/host/group-history-rpc.mjs +22 -0
  22. package/plugin-src/host/group-history-runtime.mjs +21 -0
  23. package/plugin-src/host/inbound-ttl-rpc.mjs +6 -2
  24. package/plugin-src/host/index.mjs +4 -1
  25. package/src/channels/discord/discord-runtime.mjs +8 -0
  26. package/src/channels/feishu/bridge.mjs +23 -1
  27. package/src/channels/feishu/feishu-runtime.mjs +5 -0
  28. package/src/channels/feishu/multi-bot-controller.mjs +17 -3
  29. package/src/channels/feishu/plugin-controller.mjs +2 -0
  30. package/src/channels/feishu/repair-manager.mjs +2 -1
  31. package/src/channels/qq/qq-bridge.mjs +19 -0
  32. package/src/channels/qq/qq-runtime.mjs +4 -0
  33. package/src/channels/shared/group-history-access.mjs +133 -0
  34. package/src/channels/shared/group-history-store.mjs +383 -0
  35. package/src/channels/shared/group-history.mjs +56 -0
  36. package/src/channels/shared/harness-client.mjs +9 -1
  37. package/src/channels/shared/i18n-en/feishu.mjs +2 -2
  38. package/src/channels/shared/text-harness-bridge.mjs +1 -0
  39. package/src/channels/slack/manifest.mjs +2 -0
  40. package/src/channels/slack/slack-runtime.mjs +10 -2
  41. package/src/channels/telegram/telegram-runtime.mjs +7 -0
  42. package/src/channels/wecom/wecom-runtime.mjs +8 -1
  43. package/src/channels/weixin/weixin-api.mjs +21 -2
  44. package/src/channels/whatsapp/whatsapp-runtime.mjs +20 -0
package/lib/client.js CHANGED
@@ -590,12 +590,12 @@ async function callManagementRpc(connection, channel7, method, payload, signal)
590
590
  }
591
591
 
592
592
  // plugin-src/client/index.js
593
- var React40 = __toESM(require("react"), 1);
593
+ var React41 = __toESM(require("react"), 1);
594
594
 
595
595
  // package.json
596
596
  var package_default = {
597
597
  name: "@xmanrui/dsh-im",
598
- version: "5.0.3",
598
+ version: "5.2.0",
599
599
  icon: "./assets/logo-plugin-message-link-gradient.webp",
600
600
  description: "\u628A\u5FAE\u4FE1\u3001\u98DE\u4E66\u3001\u4F01\u5FAE\u3001\u9489\u9489\u3001QQ\u3001Telegram\u3001WhatsApp\u3001Slack\u3001Discord\u3001Matrix\u63A5\u5165DSH\u3002 Connect Telegram, WhatsApp, Slack, Discord, Matrix, WeChat, Feishu, WeCom, DingTalk, and QQ to DSH.",
601
601
  keywords: [
@@ -1184,6 +1184,22 @@ var EN = Object.freeze({
1184
1184
  ...diagnostics_default,
1185
1185
  ...image_input_default,
1186
1186
  "$locale": "en",
1187
+ "\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u7B49\u5F85\u6743\u9650\u751F\u6548": "Keep this page open while the permission takes effect",
1188
+ "\u7FA4\u804A\u5929\u8BB0\u5F55": "Group chat history",
1189
+ "\u7FA4\u804A\u5929\u8BB0\u5F55\u4FDD\u7559\u5929\u6570": "Group chat retention (days)",
1190
+ "\u8FC7\u671F\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u6E05\u7406\u3002": "Expired group messages and files are removed automatically.",
1191
+ "\u4FDD\u7559\u5929\u6570": "Retention days",
1192
+ "\u5929": "days",
1193
+ "\u6B63\u5728\u8BFB\u53D6\u7FA4\u8BB0\u5F55\u8BBE\u7F6E\u2026": "Loading group history settings\u2026",
1194
+ "\u4FDD\u7559\u5929\u6570\u5FC5\u987B\u4E3A\u6B63\u6574\u6570\u3002": "Retention days must be a positive integer.",
1195
+ "\u65E0\u6CD5\u8BFB\u53D6\u6216\u4FDD\u5B58\u7FA4\u8BB0\u5F55\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002": "Unable to read or save group history settings. Try again.",
1196
+ "\u7FA4\u8BB0\u5F55\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002": "Unrecognized group history settings response.",
1197
+ "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u53EA\u589E\u91CF\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u5355\u72EC\u6388\u6743\u91C7\u96C6\u65F6\u4FDD\u7559\u539F\u6765\u7684\u56DE\u590D\u65B9\u5F0F\uFF1B\u9009\u62E9\u54CD\u5E94\u6240\u6709\u6D88\u606F\u65F6\u624D\u5207\u6362\u3002": "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.",
1198
+ "\u79C1\u804A\u59CB\u7EC8\u54CD\u5E94\uFF1B\u7FA4\u804A\u4EC5\u5904\u7406\u660E\u786E @\u5F53\u524D\u673A\u5668\u4EBA\u7684\u6D88\u606F\u3002\u4E5F\u53EF\u5355\u72EC\u6388\u6743\u91C7\u96C6\u7FA4\u6D88\u606F\uFF0C\u4FDD\u6301\u4EC5 @ \u65F6\u56DE\u590D\u3002": "Direct messages always receive replies; groups require a mention. You can authorize group recording separately below.",
1199
+ "\u9700\u6388\u6743 im:message.group_msg\uFF1B\u6388\u6743\u91C7\u96C6\u4E0D\u6539\u53D8\u7FA4\u56DE\u590D\u6A21\u5F0F\u3002": "Requires im:message.group_msg. Recording authorization does not change the reply mode.",
1200
+ "\u5173\u95ED Privacy Mode \u6216\u8BBE\u4E3A\u7FA4\u7BA1\u7406\u5458\u540E\u624D\u80FD\u63A5\u6536\u666E\u901A\u7FA4\u6D88\u606F\uFF1B\u53EA\u4FDD\u5B58\u5E73\u53F0\u5B9E\u9645\u6295\u9012\u7684\u6D88\u606F\u3002": "Disable Privacy Mode or make the bot a group administrator. Only messages actually delivered by the platform are saved.",
1201
+ "\u9700\u8981\u9891\u9053\u8BBF\u95EE\u6743\u9650\u53CA MESSAGE_CONTENT\uFF1B\u672A\u6388\u6743\u65F6\u6B63\u6587\u548C\u9644\u4EF6\u53EF\u80FD\u4E3A\u7A7A\u3002": "Requires channel access and MESSAGE_CONTENT. Text and attachments may be empty without authorization.",
1202
+ "\u9700\u8BA2\u9605 message.channels / message.groups\uFF0C\u5E76\u5DF2\u52A0\u5165\u76EE\u6807\u9891\u9053\u3002": "Subscribe to message.channels / message.groups and add the bot to the target channel.",
1187
1203
  "\u4FEE\u6539\u522B\u540D": "Edit alias",
1188
1204
  "\u5173\u95ED\u4FEE\u6539\u522B\u540D": "Close alias editor",
1189
1205
  "\u539F\u540D\u79F0": "Original name",
@@ -1738,7 +1754,7 @@ var EN = Object.freeze({
1738
1754
  "\u6B63\u5728\u7533\u8BF7 QQ \u4E8C\u7EF4\u7801\u2026": "Requesting QQ QR code\u2026",
1739
1755
  "\u6B63\u5728\u751F\u6210 WhatsApp \u4E8C\u7EF4\u7801": "Generating WhatsApp QR code",
1740
1756
  "\u626B\u7801\uFF0C\u521B\u5EFA\u7B2C\u4E00\u4E2A\u98DE\u4E66\u5165\u53E3": "Scan to create your first Feishu bot",
1741
- "\u626B\u7801\u53EA\u4F1A\u65B0\u589E\u4E00\u4E2A\u673A\u5668\u4EBA\uFF0C\u5DF2\u63A5\u5165\u7684\u673A\u5668\u4EBA\u4F1A\u7EE7\u7EED\u6B63\u5E38\u6536\u53D1\u6D88\u606F\u3002": "Scanning adds one bot. Existing bots will continue to send and receive messages.",
1757
+ "\u626B\u7801\u4F1A\u65B0\u589E\u4E00\u4E2A\u673A\u5668\u4EBA\uFF0C\u5E76\u7533\u8BF7 im:message.group_msg\uFF08\u63A5\u6536\u672A @ \u7684\u7FA4\u6D88\u606F\uFF09\u3001im:message:readonly\uFF08\u8BFB\u53D6\u6D88\u606F\u4E2D\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\u7B49\u6240\u9700\u6743\u9650\u3002\u65B0\u673A\u5668\u4EBA\u9ED8\u8BA4\u4EC5 @ \u65F6\u56DE\u590D\uFF0C\u5B9E\u9645\u6536\u5230\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u4FDD\u5B58\uFF1B\u5DF2\u63A5\u5165\u7684\u673A\u5668\u4EBA\u7EE7\u7EED\u6B63\u5E38\u6536\u53D1\u6D88\u606F\u3002": "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.",
1742
1758
  "\u65E0\u9700\u624B\u52A8\u586B\u5199 App ID\u3002\u4EE5\u540E\u8FD8\u53EF\u4EE5\u7EE7\u7EED\u6DFB\u52A0\u673A\u5668\u4EBA\uFF0C\u5206\u522B\u670D\u52A1\u4E0D\u540C\u56E2\u961F\u6216\u98DE\u4E66\u79DF\u6237\u3002": "No App ID is required. You can add more bots later for different teams or Feishu tenants.",
1743
1759
  "\u4F7F\u7528\u98DE\u4E66\u626B\u7801\u521B\u5EFA\u673A\u5668\u4EBA": "Scan with Feishu to create a bot",
1744
1760
  "\u5237\u65B0\u4E8C\u7EF4\u7801\u540E\u7EE7\u7EED": "Refresh the QR code to continue",
@@ -1758,7 +1774,7 @@ var EN = Object.freeze({
1758
1774
  "\u6743\u9650\u914D\u7F6E\u5DF2\u63D0\u4EA4\uFF0C\u6B63\u5728\u542F\u7528\u5168\u90E8\u6D88\u606F\u6A21\u5F0F\u5E76\u91CD\u8FDE\u6B64\u673A\u5668\u4EBA\uFF1B\u6B64\u9636\u6BB5\u65E0\u6CD5\u53D6\u6D88\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u4F1A\u4E2D\u65AD\u3002": "The permission update was submitted. Enabling all-message mode and reconnecting this bot. This stage cannot be cancelled; other bots will not be interrupted.",
1759
1775
  "\u6B63\u5728\u4E3A\u73B0\u6709\u98DE\u4E66\u5E94\u7528\u7533\u8BF7\u7FA4\u6D88\u606F\u6743\u9650\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u5019\u3002": "Requesting a group-message permission QR code for the existing Feishu app\u2026",
1760
1776
  "\u7FA4\u6D88\u606F\u6743\u9650\u6CA1\u6709\u5F00\u901A\u5B8C\u6210": "Group-message permission was not granted",
1761
- "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u589E\u91CF\u8865\u5145\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u6309\u94AE\u56DE\u8C03\u3001\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\u3001\u63A5\u6536\u7FA4\u5185\u5176\u4ED6\u673A\u5668\u4EBA @ \u5F53\u524D\u673A\u5668\u4EBA\u6240\u9700\u7684 im:message.group_at_msg.include_bot:readonly\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u5B8C\u6210\u540E\u6B64\u673A\u5668\u4EBA\u4F1A\u77ED\u6682\u91CD\u8FDE\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002": "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 \u201CRead direct and group messages\u201D), 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.",
1777
+ "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u589E\u91CF\u8865\u5145\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u6309\u94AE\u56DE\u8C03\u3001\u63A5\u6536\u672A @ \u7FA4\u6D88\u606F\u6240\u9700\u7684 im:message.group_msg\u3001\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\u3001\u63A5\u6536\u7FA4\u5185\u5176\u4ED6\u673A\u5668\u4EBA @ \u5F53\u524D\u673A\u5668\u4EBA\u6240\u9700\u7684 im:message.group_at_msg.include_bot:readonly\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\uFF0C\u7FA4\u56DE\u590D\u65B9\u5F0F\u4FDD\u6301\u4E0D\u53D8\uFF0C\u5B9E\u9645\u6536\u5230\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u4FDD\u5B58\u3002\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u5B8C\u6210\u540E\u6B64\u673A\u5668\u4EBA\u4F1A\u77ED\u6682\u91CD\u8FDE\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002": "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 \u201CRead direct and group messages\u201D), 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.",
1762
1778
  "\u6838\u5BF9\u73B0\u6709\u5E94\u7528\u540D\u79F0\uFF0C\u5E76\u786E\u8BA4\u53EA\u65B0\u589E\u5F53\u524D\u7F3A\u5C11\u7684\u4E0A\u8FF0\u914D\u7F6E": "Review the existing app name and confirm that only the missing items described above are added",
1763
1779
  "\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u7B49\u5F85\u6743\u9650\u4E0E\u56DE\u8C03\u8865\u5168\u5B8C\u6210": "Keep this page open until permissions and the callback are complete",
1764
1780
  "\u53D6\u6D88\u8865\u5168": "Cancel setup",
@@ -1769,7 +1785,7 @@ var EN = Object.freeze({
1769
1785
  "\u6743\u9650\u4E0E\u56DE\u8C03\u6CA1\u6709\u8865\u5168\u5B8C\u6210": "Permissions and callback setup did not finish",
1770
1786
  "\u8865\u5168\u6743\u9650": "Complete permissions",
1771
1787
  "\u8865\u5168\u8303\u56F4": "Completion scope",
1772
- "\u589E\u91CF\u6DFB\u52A0\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u56DE\u8C03 card.action.trigger\u3001\u8BFB\u53D6\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002": "Adds the missing card callback card.action.trigger, im:message:readonly for reading images or files in messages (shown by Feishu as \u201CRead direct and group messages\u201D), 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.",
1788
+ "\u589E\u91CF\u6DFB\u52A0\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u56DE\u8C03 card.action.trigger\u3001\u63A5\u6536\u672A @ \u7FA4\u6D88\u606F\u6240\u9700\u7684 im:message.group_msg\u3001\u8BFB\u53D6\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\uFF0C\u7FA4\u56DE\u590D\u65B9\u5F0F\u4FDD\u6301\u4E0D\u53D8\uFF0C\u5B9E\u9645\u6536\u5230\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u4FDD\u5B58\u3002": "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 \u201CRead direct and group messages\u201D), 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.",
1773
1789
  "\u7B49\u5F85\u626B\u7801\u2026": "Waiting for scan\u2026",
1774
1790
  "\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u6743\u9650\u8865\u5168\u4E8C\u7EF4\u7801": "Feishu returned a permission-completion QR code for a different bot",
1775
1791
  "\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u7FA4\u6D88\u606F\u6743\u9650\u4E8C\u7EF4\u7801": "Feishu returned a group-message permission QR code for a different bot",
@@ -2674,42 +2690,42 @@ var CONFIG_ISSUE_LABELS = Object.freeze({
2674
2690
  var CONFIG_FIELD = /^(?:\$|version|accounts(?:\[\d{1,10}\](?:\.(?:accountId|ownerUserId|botId|tokenRef|baseUrl))?)?|(?:workspaces|agentPresets|models)(?:\[\d{1,10}\]\.(?:key|value))?|deliveryTargets(?:\[\d{1,10}\]\.(?:key|targets(?:\[\d{1,10}\])?))?)$/;
2675
2691
  function normalizeDiagnosticDetails(value) {
2676
2692
  if (!value || typeof value !== "object" || Array.isArray(value)) return {};
2677
- const result = {};
2693
+ const result2 = {};
2678
2694
  for (const [field2, allowed] of [["operation", OPERATIONS], ["stage", STAGES], ["reason", REASONS], ["resource", RESOURCES], ["method", RPC_METHODS], ["transport", TRANSPORTS], ["submissionState", SUBMISSION_STATES], ["lastFailureReason", REASONS]]) {
2679
- if (allowed.has(value[field2])) result[field2] = value[field2];
2695
+ if (allowed.has(value[field2])) result2[field2] = value[field2];
2680
2696
  }
2681
- if (DIAGNOSTIC_CHANNELS.includes(value.channel)) result.channel = value.channel;
2697
+ if (DIAGNOSTIC_CHANNELS.includes(value.channel)) result2.channel = value.channel;
2682
2698
  if (Array.isArray(value.reasons)) {
2683
2699
  const reasons = [...new Set(value.reasons.filter((v) => REASONS.has(v) && !["unknown", "multiple-causes"].includes(v)))].slice(0, 16);
2684
- if (reasons.length) result.reasons = reasons;
2700
+ if (reasons.length) result2.reasons = reasons;
2685
2701
  }
2686
- for (const field2 of ["durationMs", "timeoutMs"]) if (Number.isFinite(value[field2]) && value[field2] >= 0) result[field2] = Math.round(value[field2]);
2687
- if (Number.isSafeInteger(value.attempts) && value.attempts >= 0) result.attempts = value.attempts;
2688
- for (const field2 of ["nodeVersion", "dshVersion"]) if (typeof value[field2] === "string" && /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value[field2]) && value[field2].length < 80) result[field2] = value[field2];
2689
- if (["darwin", "linux", "win32", "freebsd"].includes(value.platform)) result.platform = value.platform;
2690
- if (["ilinkai.weixin.qq.com", "oapi.dingtalk.com", "api.dingtalk.com", "api.telegram.org", "discord.com", "slack.com", "open.feishu.cn", "qyapi.weixin.qq.com"].includes(value.host)) result.host = value.host;
2702
+ for (const field2 of ["durationMs", "timeoutMs"]) if (Number.isFinite(value[field2]) && value[field2] >= 0) result2[field2] = Math.round(value[field2]);
2703
+ if (Number.isSafeInteger(value.attempts) && value.attempts >= 0) result2.attempts = value.attempts;
2704
+ for (const field2 of ["nodeVersion", "dshVersion"]) if (typeof value[field2] === "string" && /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value[field2]) && value[field2].length < 80) result2[field2] = value[field2];
2705
+ if (["darwin", "linux", "win32", "freebsd"].includes(value.platform)) result2.platform = value.platform;
2706
+ if (["ilinkai.weixin.qq.com", "oapi.dingtalk.com", "api.dingtalk.com", "api.telegram.org", "discord.com", "slack.com", "open.feishu.cn", "qyapi.weixin.qq.com"].includes(value.host)) result2.host = value.host;
2691
2707
  if (value.dependencies && typeof value.dependencies === "object") {
2692
2708
  const dependencies = {};
2693
2709
  for (const name2 of ["dingtalkStream", "axios", "httpsProxyAgent", "agentBase"]) {
2694
2710
  const version = value.dependencies[name2];
2695
2711
  if (typeof version === "string" && /^\d+\.\d+\.\d+(?:[-+][A-Za-z0-9.-]+)?$/.test(version) && version.length <= 80) dependencies[name2] = version;
2696
2712
  }
2697
- if (Object.keys(dependencies).length) result.dependencies = dependencies;
2713
+ if (Object.keys(dependencies).length) result2.dependencies = dependencies;
2698
2714
  }
2699
- if (typeof value.proxyConfigured === "boolean") result.proxyConfigured = value.proxyConfigured;
2700
- if (value.truncated === true) result.truncated = true;
2701
- if (CONFIG_FILES.has(value.file)) result.file = value.file;
2702
- if (typeof value.field === "string" && CONFIG_FIELD.test(value.field)) result.field = value.field;
2703
- if (typeof value.issue === "string" && Object.hasOwn(CONFIG_ISSUE_LABELS, value.issue)) result.issue = value.issue;
2704
- if (/^(?:(?:WX|DT|IM)-CONN|MF)-[A-F0-9]{8}$/.test(value.referenceId ?? "")) result.referenceId = value.referenceId;
2705
- if (typeof value.occurredAt === "string" && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(value.occurredAt) && Number.isFinite(Date.parse(value.occurredAt))) result.occurredAt = value.occurredAt;
2706
- if (Number.isInteger(value.httpStatus) && value.httpStatus >= 100 && value.httpStatus <= 599) result.httpStatus = value.httpStatus;
2715
+ if (typeof value.proxyConfigured === "boolean") result2.proxyConfigured = value.proxyConfigured;
2716
+ if (value.truncated === true) result2.truncated = true;
2717
+ if (CONFIG_FILES.has(value.file)) result2.file = value.file;
2718
+ if (typeof value.field === "string" && CONFIG_FIELD.test(value.field)) result2.field = value.field;
2719
+ if (typeof value.issue === "string" && Object.hasOwn(CONFIG_ISSUE_LABELS, value.issue)) result2.issue = value.issue;
2720
+ if (/^(?:(?:WX|DT|IM)-CONN|MF)-[A-F0-9]{8}$/.test(value.referenceId ?? "")) result2.referenceId = value.referenceId;
2721
+ if (typeof value.occurredAt === "string" && /^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(value.occurredAt) && Number.isFinite(Date.parse(value.occurredAt))) result2.occurredAt = value.occurredAt;
2722
+ if (Number.isInteger(value.httpStatus) && value.httpStatus >= 100 && value.httpStatus <= 599) result2.httpStatus = value.httpStatus;
2707
2723
  const provider = typeof value.providerCode === "number" && Number.isSafeInteger(value.providerCode) ? String(value.providerCode) : value.providerCode;
2708
- if (typeof provider === "string" && /^-?\d{1,12}$/.test(provider)) result.providerCode = provider;
2709
- if (typeof value.pluginVersion === "string" && /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value.pluginVersion) && value.pluginVersion.length <= 64) result.pluginVersion = value.pluginVersion;
2710
- if (["succeeded", "failed", "not-attempted", "unknown"].includes(value.rollback)) result.rollback = value.rollback;
2711
- if (typeof value.hint === "string" && value.hint.trim()) result.hint = value.hint.trim().slice(0, 500);
2712
- return result;
2724
+ if (typeof provider === "string" && /^-?\d{1,12}$/.test(provider)) result2.providerCode = provider;
2725
+ if (typeof value.pluginVersion === "string" && /^\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$/.test(value.pluginVersion) && value.pluginVersion.length <= 64) result2.pluginVersion = value.pluginVersion;
2726
+ if (["succeeded", "failed", "not-attempted", "unknown"].includes(value.rollback)) result2.rollback = value.rollback;
2727
+ if (typeof value.hint === "string" && value.hint.trim()) result2.hint = value.hint.trim().slice(0, 500);
2728
+ return result2;
2713
2729
  }
2714
2730
  var DIAGNOSTIC_CHANNELS = Object.freeze(["weixin", "feishu", "dingtalk", "wecom", "qq", "slack", "telegram", "discord", "whatsapp", "wecom-app", "imessage", "email", "office"]);
2715
2731
  function diagnosticFields(value) {
@@ -3706,13 +3722,13 @@ function normalizeTestMessage(value) {
3706
3722
  const code = value.code === "test-target-unavailable" ? "test-target-unavailable" : "test-message-failed";
3707
3723
  return { sent: false, code, ...value.error ? { error: normalizeConnectionError(value.error) } : {} };
3708
3724
  }
3709
- function unwrapRpcResult(result) {
3710
- if (!isRecord(result) || typeof result.ok !== "boolean") {
3725
+ function unwrapRpcResult(result2) {
3726
+ if (!isRecord(result2) || typeof result2.ok !== "boolean") {
3711
3727
  throw new Error("\u9489\u9489\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
3712
3728
  }
3713
- if (!result.ok) {
3729
+ if (!result2.ok) {
3714
3730
  const visible = normalizeError(
3715
- result.error,
3731
+ result2.error,
3716
3732
  "DINGTALK_RPC_ERROR",
3717
3733
  "\u9489\u9489\u64CD\u4F5C\u5931\u8D25"
3718
3734
  ) ?? { code: "DINGTALK_RPC_ERROR", message: "\u9489\u9489\u64CD\u4F5C\u5931\u8D25" };
@@ -3720,10 +3736,10 @@ function unwrapRpcResult(result) {
3720
3736
  error.code = visible.code;
3721
3737
  if (visible.hint) error.hint = visible.hint;
3722
3738
  if (visible.referenceId) error.referenceId = visible.referenceId;
3723
- Object.assign(error, diagnosticFields(result.error));
3739
+ Object.assign(error, diagnosticFields(result2.error));
3724
3740
  throw error;
3725
3741
  }
3726
- return result.value;
3742
+ return result2.value;
3727
3743
  }
3728
3744
  function safeQrSource(value) {
3729
3745
  if (typeof value !== "string" || value.length > MAX_QR_SOURCE_LENGTH) return void 0;
@@ -3737,23 +3753,23 @@ function normalizeProvisioning(value, now = Date.now()) {
3737
3753
  const reportedStatus = optionalString(source.status, 32) ?? optionalString(source.state, 32);
3738
3754
  const status = PROVISION_STATES.has(reportedStatus) ? reportedStatus : "failed";
3739
3755
  const expiresAt = timestamp(source.expiresAt) ?? now + clamp(source.expiresIn, 1, 2 * 60 * 60, 10 * 60) * 1e3;
3740
- const result = {
3756
+ const result2 = {
3741
3757
  attemptId,
3742
3758
  status,
3743
3759
  expiresAt,
3744
3760
  pollIntervalMs: clamp(source.pollIntervalMs, 1e3, 1e4, 3e3)
3745
3761
  };
3746
3762
  const qrCodeDataUrl = safeQrSource(source.qrCodeDataUrl);
3747
- if (qrCodeDataUrl) result.qrCodeDataUrl = qrCodeDataUrl;
3748
- if (opaqueId(source.botId)) result.botId = opaqueId(source.botId);
3749
- if (source.alreadyConnected === true) result.alreadyConnected = true;
3763
+ if (qrCodeDataUrl) result2.qrCodeDataUrl = qrCodeDataUrl;
3764
+ if (opaqueId(source.botId)) result2.botId = opaqueId(source.botId);
3765
+ if (source.alreadyConnected === true) result2.alreadyConnected = true;
3750
3766
  const error = normalizeError(
3751
3767
  source.error,
3752
3768
  "DINGTALK_PROVISION_FAILED",
3753
3769
  "\u9489\u9489\u673A\u5668\u4EBA\u6CA1\u6709\u63A5\u5165\u5B8C\u6210"
3754
3770
  );
3755
- if (error) result.error = error;
3756
- return result;
3771
+ if (error) result2.error = error;
3772
+ return result2;
3757
3773
  }
3758
3774
  function normalizeBot(value) {
3759
3775
  if (!isRecord(value)) return void 0;
@@ -3821,12 +3837,12 @@ function normalizeSnapshot(value) {
3821
3837
  modelCatalog: normalizeModelCatalog(source.modelCatalog)
3822
3838
  };
3823
3839
  }
3824
- function connectionTestFeedback(result) {
3825
- if (result?.sent === true) return "\u9489\u9489\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\uFF0C\u6D4B\u8BD5\u6D88\u606F\u5DF2\u53D1\u9001\u3002";
3826
- if (result?.code === "test-target-unavailable") {
3840
+ function connectionTestFeedback(result2) {
3841
+ if (result2?.sent === true) return "\u9489\u9489\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\uFF0C\u6D4B\u8BD5\u6D88\u606F\u5DF2\u53D1\u9001\u3002";
3842
+ if (result2?.code === "test-target-unavailable") {
3827
3843
  return "\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\u3002\u673A\u5668\u4EBA\u5C1A\u672A\u6536\u5230\u53EF\u7528\u4E8E\u6D4B\u8BD5\u7684\u79C1\u804A\u6D88\u606F\u3002";
3828
3844
  }
3829
- return result ? "\u9489\u9489\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\uFF0C\u4F46\u6D4B\u8BD5\u6D88\u606F\u53D1\u9001\u5931\u8D25\u3002" : null;
3845
+ return result2 ? "\u9489\u9489\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\uFF0C\u4F46\u6D4B\u8BD5\u6D88\u606F\u53D1\u9001\u5931\u8D25\u3002" : null;
3830
3846
  }
3831
3847
  function presentError(error) {
3832
3848
  return normalizeError(
@@ -6277,32 +6293,32 @@ function DingtalkSettingsTab({ rpcCall }) {
6277
6293
  controller.signal
6278
6294
  );
6279
6295
  if (!canCommit()) return;
6280
- const result = normalizeProvisioning(response);
6281
- if (result.status === "connected") {
6296
+ const result2 = normalizeProvisioning(response);
6297
+ if (result2.status === "connected") {
6282
6298
  const snapshot = await loadStatus({
6283
6299
  signal: controller.signal,
6284
6300
  silent: true,
6285
6301
  restoreProvisioning: false
6286
6302
  });
6287
6303
  if (!canCommit()) return;
6288
- const account = result.botId ? snapshot?.bots.find((bot) => bot.botId === result.botId) : snapshot?.bots.find((bot) => bot.connected);
6304
+ const account = result2.botId ? snapshot?.bots.find((bot) => bot.botId === result2.botId) : snapshot?.bots.find((bot) => bot.connected);
6289
6305
  if (!account?.connected) {
6290
6306
  if (account?.error) {
6291
- setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result, status: "failed", error: account.error } : current);
6307
+ setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result2, status: "failed", error: account.error } : current);
6292
6308
  return;
6293
6309
  }
6294
- setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result, status: "connecting" } : current);
6295
- schedule(result.pollIntervalMs);
6310
+ setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result2, status: "connecting" } : current);
6311
+ schedule(result2.pollIntervalMs);
6296
6312
  return;
6297
6313
  }
6298
6314
  setProvision(null);
6299
- announce(result.alreadyConnected ? "\u8FD9\u4E2A\u9489\u9489\u673A\u5668\u4EBA\u5DF2\u7ECF\u63A5\u5165\u5E76\u4FDD\u6301\u5728\u7EBF\u3002" : "\u9489\u9489\u673A\u5668\u4EBA\u5DF2\u63A5\u5165\uFF0C\u53EF\u4EE5\u5F00\u59CB\u53D1\u9001\u6D88\u606F\u3002");
6315
+ announce(result2.alreadyConnected ? "\u8FD9\u4E2A\u9489\u9489\u673A\u5668\u4EBA\u5DF2\u7ECF\u63A5\u5165\u5E76\u4FDD\u6301\u5728\u7EBF\u3002" : "\u9489\u9489\u673A\u5668\u4EBA\u5DF2\u63A5\u5165\uFF0C\u53EF\u4EE5\u5F00\u59CB\u53D1\u9001\u6D88\u606F\u3002");
6300
6316
  return;
6301
6317
  }
6302
6318
  if (!canCommit()) return;
6303
- setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result, durationMs: current.durationMs } : current);
6304
- if (ACTIVE_PROVISION_STATES.has(result.status)) {
6305
- schedule(result.pollIntervalMs);
6319
+ setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result2, durationMs: current.durationMs } : current);
6320
+ if (ACTIVE_PROVISION_STATES.has(result2.status)) {
6321
+ schedule(result2.pollIntervalMs);
6306
6322
  }
6307
6323
  } catch (error) {
6308
6324
  if (error?.name === "AbortError" || !canCommit()) return;
@@ -6585,8 +6601,8 @@ function text2(value, fallback, max = 240) {
6585
6601
  return typeof value === "string" && value.trim() ? value.trim().slice(0, max) : fallback;
6586
6602
  }
6587
6603
  function id(value) {
6588
- const result = text2(value, "", 128);
6589
- return /^[a-z\d_-]+$/i.test(result) ? result : void 0;
6604
+ const result2 = text2(value, "", 128);
6605
+ return /^[a-z\d_-]+$/i.test(result2) ? result2 : void 0;
6590
6606
  }
6591
6607
  function timestamp2(value) {
6592
6608
  if (typeof value === "number" && Number.isFinite(value)) return value;
@@ -6610,17 +6626,17 @@ var TOKEN_BOT_ENDPOINTS = Object.freeze({
6610
6626
  function createTokenChannelApi(channel7, connectionSummary, {
6611
6627
  normalizeBotExtension = () => ({})
6612
6628
  } = {}) {
6613
- const unwrapRpcResult17 = (result) => {
6614
- if (!isRecord2(result) || typeof result.ok !== "boolean") {
6629
+ const unwrapRpcResult17 = (result2) => {
6630
+ if (!isRecord2(result2) || typeof result2.ok !== "boolean") {
6615
6631
  throw new Error(`${channel7} \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94`);
6616
6632
  }
6617
- if (!result.ok) {
6618
- const error = new Error(text2(result.error?.message, `${channel7} \u64CD\u4F5C\u5931\u8D25`));
6619
- error.code = text2(result.error?.code, `${channel7.toUpperCase()}_RPC_ERROR`, 80);
6620
- Object.assign(error, diagnosticFields(result.error));
6633
+ if (!result2.ok) {
6634
+ const error = new Error(text2(result2.error?.message, `${channel7} \u64CD\u4F5C\u5931\u8D25`));
6635
+ error.code = text2(result2.error?.code, `${channel7.toUpperCase()}_RPC_ERROR`, 80);
6636
+ Object.assign(error, diagnosticFields(result2.error));
6621
6637
  throw error;
6622
6638
  }
6623
- return result.value;
6639
+ return result2.value;
6624
6640
  };
6625
6641
  const normalizeBot8 = (value) => {
6626
6642
  if (!isRecord2(value) || !id(value.botId)) return void 0;
@@ -7486,18 +7502,18 @@ function normalizeRegistrationOperation(value) {
7486
7502
  function isTargetedAppUpdate(operation) {
7487
7503
  return operation === FEISHU_REGISTRATION_OPERATIONS.CALLBACK_REPAIR || operation === FEISHU_REGISTRATION_OPERATIONS.GROUP_MESSAGE_PERMISSION;
7488
7504
  }
7489
- function unwrapRpcResult3(result) {
7490
- if (!isRecord3(result) || typeof result.ok !== "boolean") {
7505
+ function unwrapRpcResult3(result2) {
7506
+ if (!isRecord3(result2) || typeof result2.ok !== "boolean") {
7491
7507
  throw new Error("\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
7492
7508
  }
7493
- if (!result.ok) {
7494
- const message = optionalString2(result.error?.message) ?? "\u98DE\u4E66\u670D\u52A1\u8BF7\u6C42\u5931\u8D25";
7509
+ if (!result2.ok) {
7510
+ const message = optionalString2(result2.error?.message) ?? "\u98DE\u4E66\u670D\u52A1\u8BF7\u6C42\u5931\u8D25";
7495
7511
  const error = new Error(message);
7496
- error.code = optionalString2(result.error?.code) ?? "FEISHU_RPC_ERROR";
7497
- Object.assign(error, diagnosticFields(result.error));
7512
+ error.code = optionalString2(result2.error?.code) ?? "FEISHU_RPC_ERROR";
7513
+ Object.assign(error, diagnosticFields(result2.error));
7498
7514
  throw error;
7499
7515
  }
7500
- return result.value;
7516
+ return result2.value;
7501
7517
  }
7502
7518
  function normalizeProvisioning2(value, now = Date.now()) {
7503
7519
  const source = isRecord3(value?.provisioning) ? value.provisioning : value;
@@ -8015,7 +8031,7 @@ function QrPane({ provision, now, onRefresh, onCancel, busy }) {
8015
8031
  h2("span", null, repairing ? `\u6B63\u5728\u4E3A\u300C${botName}\u300D\u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03` : grantingGroupMessages ? `\u6B63\u5728\u4E3A\u300C${botName}\u300D\u5F00\u901A\u7FA4\u6D88\u606F\u6743\u9650` : "\u6B63\u5728\u6DFB\u52A0\u65B0\u673A\u5668\u4EBA")
8016
8032
  ),
8017
8033
  h2("h3", null, expired ? "\u5237\u65B0\u4E8C\u7EF4\u7801\u540E\u7EE7\u7EED" : repairing ? "\u4F7F\u7528\u98DE\u4E66\u626B\u7801\u8865\u5168\u6743\u9650" : grantingGroupMessages ? "\u4F7F\u7528\u98DE\u4E66\u786E\u8BA4\u7FA4\u6D88\u606F\u6743\u9650" : "\u4F7F\u7528\u98DE\u4E66\u626B\u7801\u521B\u5EFA\u673A\u5668\u4EBA"),
8018
- h2("p", null, repairing ? "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u589E\u91CF\u8865\u5145\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u6309\u94AE\u56DE\u8C03\u3001\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\u3001\u63A5\u6536\u7FA4\u5185\u5176\u4ED6\u673A\u5668\u4EBA @ \u5F53\u524D\u673A\u5668\u4EBA\u6240\u9700\u7684 im:message.group_at_msg.include_bot:readonly\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u5B8C\u6210\u540E\u6B64\u673A\u5668\u4EBA\u4F1A\u77ED\u6682\u91CD\u8FDE\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002" : grantingGroupMessages ? "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u53EA\u589E\u91CF\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u7528\u201C\u54CD\u5E94\u6240\u6709\u7FA4\u6D88\u606F\u201D\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002" : "\u626B\u7801\u53EA\u4F1A\u65B0\u589E\u4E00\u4E2A\u673A\u5668\u4EBA\uFF0C\u5DF2\u63A5\u5165\u7684\u673A\u5668\u4EBA\u4F1A\u7EE7\u7EED\u6B63\u5E38\u6536\u53D1\u6D88\u606F\u3002"),
8034
+ h2("p", null, repairing ? "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u589E\u91CF\u8865\u5145\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u6309\u94AE\u56DE\u8C03\u3001\u63A5\u6536\u672A @ \u7FA4\u6D88\u606F\u6240\u9700\u7684 im:message.group_msg\u3001\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\u3001\u63A5\u6536\u7FA4\u5185\u5176\u4ED6\u673A\u5668\u4EBA @ \u5F53\u524D\u673A\u5668\u4EBA\u6240\u9700\u7684 im:message.group_at_msg.include_bot:readonly\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\uFF0C\u7FA4\u56DE\u590D\u65B9\u5F0F\u4FDD\u6301\u4E0D\u53D8\uFF0C\u5B9E\u9645\u6536\u5230\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u4FDD\u5B58\u3002\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u5B8C\u6210\u540E\u6B64\u673A\u5668\u4EBA\u4F1A\u77ED\u6682\u91CD\u8FDE\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002" : grantingGroupMessages ? "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u53EA\u589E\u91CF\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u7528\u201C\u54CD\u5E94\u6240\u6709\u7FA4\u6D88\u606F\u201D\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002" : "\u626B\u7801\u4F1A\u65B0\u589E\u4E00\u4E2A\u673A\u5668\u4EBA\uFF0C\u5E76\u7533\u8BF7 im:message.group_msg\uFF08\u63A5\u6536\u672A @ \u7684\u7FA4\u6D88\u606F\uFF09\u3001im:message:readonly\uFF08\u8BFB\u53D6\u6D88\u606F\u4E2D\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\u7B49\u6240\u9700\u6743\u9650\u3002\u65B0\u673A\u5668\u4EBA\u9ED8\u8BA4\u4EC5 @ \u65F6\u56DE\u590D\uFF0C\u5B9E\u9645\u6536\u5230\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u4FDD\u5B58\uFF1B\u5DF2\u63A5\u5165\u7684\u673A\u5668\u4EBA\u7EE7\u7EED\u6B63\u5E38\u6536\u53D1\u6D88\u606F\u3002"),
8019
8035
  h2(
8020
8036
  "ol",
8021
8037
  { className: "bxf-steps dim-steps" },
@@ -8413,7 +8429,7 @@ function BotCard({
8413
8429
  role: "tooltip"
8414
8430
  },
8415
8431
  h2("strong", null, "\u8865\u5168\u8303\u56F4"),
8416
- h2("span", null, "\u589E\u91CF\u6DFB\u52A0\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u56DE\u8C03 card.action.trigger\u3001\u8BFB\u53D6\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002")
8432
+ h2("span", null, "\u589E\u91CF\u6DFB\u52A0\u5F53\u524D\u7F3A\u5C11\u7684\u5361\u7247\u56DE\u8C03 card.action.trigger\u3001\u63A5\u6536\u672A @ \u7FA4\u6D88\u606F\u6240\u9700\u7684 im:message.group_msg\u3001\u8BFB\u53D6\u6D88\u606F\u5185\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3001\u4E0A\u4F20\u673A\u5668\u4EBA\u56FE\u7247\u6216\u6587\u4EF6\u6240\u9700\u7684 im:resource\uFF0C\u4EE5\u53CA\u539F\u751F\u547D\u4EE4\u9762\u677F\u6240\u9700\u7684 application:app_slash_command:read / write\uFF1B\u786E\u8BA4\u9875\u53EA\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u9879\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\uFF0C\u7FA4\u56DE\u590D\u65B9\u5F0F\u4FDD\u6301\u4E0D\u53D8\uFF0C\u5B9E\u9645\u6536\u5230\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u4FDD\u5B58\u3002")
8417
8433
  )
8418
8434
  ),
8419
8435
  h2(Button5, {
@@ -8779,17 +8795,17 @@ function FeishuSettingsTab({ rpcCall }) {
8779
8795
  const targetBot = targetedUpdate ? model.bots.find((bot) => bot.botId === activeProvision?.botId) : void 0;
8780
8796
  setProvisionBusy(true);
8781
8797
  try {
8782
- const result = attemptId ? normalizePollResult(await invoke(FEISHU_ENDPOINTS.cancelProvisioning, { attemptId })) : null;
8783
- if (targetedUpdate && result) {
8784
- if (result.operation !== activeProvision.operation || result.botId !== activeProvision.botId) {
8798
+ const result2 = attemptId ? normalizePollResult(await invoke(FEISHU_ENDPOINTS.cancelProvisioning, { attemptId })) : null;
8799
+ if (targetedUpdate && result2) {
8800
+ if (result2.operation !== activeProvision.operation || result2.botId !== activeProvision.botId) {
8785
8801
  throw new Error("\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u6CE8\u518C\u8FDB\u5EA6");
8786
8802
  }
8787
- if (result.status === "connecting") {
8803
+ if (result2.status === "connecting") {
8788
8804
  setModel((current) => current.provisioning?.attemptId === attemptId ? {
8789
8805
  ...current,
8790
8806
  provisioning: {
8791
8807
  ...current.provisioning,
8792
- ...result.provisioning ?? {},
8808
+ ...result2.provisioning ?? {},
8793
8809
  phase: "connecting",
8794
8810
  submitted: true,
8795
8811
  expired: false
@@ -8798,7 +8814,7 @@ function FeishuSettingsTab({ rpcCall }) {
8798
8814
  announce(grantingGroupMessages ? "\u6743\u9650\u914D\u7F6E\u5DF2\u63D0\u4EA4\uFF0C\u6B63\u5728\u542F\u7528\u5168\u90E8\u6D88\u606F\u6A21\u5F0F\u5E76\u91CD\u8FDE\u6B64\u673A\u5668\u4EBA\uFF1B\u6B64\u9636\u6BB5\u65E0\u6CD5\u53D6\u6D88\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u4F1A\u4E2D\u65AD\u3002" : "\u914D\u7F6E\u5DF2\u63D0\u4EA4\uFF0C\u6B63\u5728\u4FDD\u5B58\u6743\u9650\u3001\u9A8C\u8BC1\u5361\u7247\u56DE\u8C03\u5E76\u91CD\u8FDE\u6B64\u673A\u5668\u4EBA\uFF1B\u6B64\u9636\u6BB5\u65E0\u6CD5\u53D6\u6D88\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u4F1A\u4E2D\u65AD\u3002");
8799
8815
  return;
8800
8816
  }
8801
- if (result.status === "connected") {
8817
+ if (result2.status === "connected") {
8802
8818
  const targetBotName = targetBot?.bot.name ?? activeProvision.botName ?? "\u673A\u5668\u4EBA";
8803
8819
  setModel((current) => ({ ...current, provisioning: null }));
8804
8820
  announce(grantingGroupMessages ? `${targetBotName}\u5DF2\u5F00\u901A\u7FA4\u6D88\u606F\u6743\u9650\uFF0C\u5E76\u542F\u7528\u201C\u54CD\u5E94\u6240\u6709\u7FA4\u6D88\u606F\u201D\u3002` : `${targetBotName}\u7684\u6743\u9650\u4E0E\u56DE\u8C03\u5DF2\u8865\u5168\u3002`);
@@ -8854,17 +8870,17 @@ function FeishuSettingsTab({ rpcCall }) {
8854
8870
  const controller = new AbortController();
8855
8871
  const timer = window.setTimeout(async () => {
8856
8872
  try {
8857
- const result = normalizePollResult(await invoke(
8873
+ const result2 = normalizePollResult(await invoke(
8858
8874
  FEISHU_ENDPOINTS.pollProvisioning,
8859
8875
  { attemptId: provision2.attemptId },
8860
8876
  controller.signal
8861
8877
  ));
8862
- if (result.operation !== provision2.operation || isTargetedAppUpdate2(provision2) && result.botId !== provision2.botId) {
8878
+ if (result2.operation !== provision2.operation || isTargetedAppUpdate2(provision2) && result2.botId !== provision2.botId) {
8863
8879
  throw new Error("\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u6CE8\u518C\u8FDB\u5EA6");
8864
8880
  }
8865
- if (result.status === "connected") {
8881
+ if (result2.status === "connected") {
8866
8882
  const snapshot = await loadStatus({ signal: controller.signal, silent: true, restoreProvisioning: false });
8867
- const targetBot = snapshot?.bots.find((bot) => bot.botId === result.botId);
8883
+ const targetBot = snapshot?.bots.find((bot) => bot.botId === result2.botId);
8868
8884
  if (!snapshot) {
8869
8885
  throw new Error(isCallbackRepair(provision2) ? "\u6743\u9650\u4E0E\u56DE\u8C03\u5DF2\u66F4\u65B0\uFF0C\u4F46\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u673A\u5668\u4EBA\u8FDE\u63A5\u72B6\u6001" : isGroupMessagePermission(provision2) ? "\u7FA4\u6D88\u606F\u6743\u9650\u5DF2\u66F4\u65B0\uFF0C\u4F46\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u673A\u5668\u4EBA\u8FDE\u63A5\u72B6\u6001" : "\u673A\u5668\u4EBA\u5DF2\u7ECF\u521B\u5EFA\uFF0C\u4F46\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u8FDE\u63A5\u72B6\u6001");
8870
8886
  }
@@ -8874,27 +8890,27 @@ function FeishuSettingsTab({ rpcCall }) {
8874
8890
  }
8875
8891
  setModel((current) => ({ ...current, provisioning: null }));
8876
8892
  announce(isCallbackRepair(provision2) ? `${targetBot.bot.name}\u7684\u6743\u9650\u4E0E\u56DE\u8C03\u5DF2\u8865\u5168\u3002` : isGroupMessagePermission(provision2) ? `${targetBot.bot.name}\u5DF2\u5F00\u901A\u7FA4\u6D88\u606F\u6743\u9650\uFF0C\u5E76\u542F\u7528\u201C\u54CD\u5E94\u6240\u6709\u7FA4\u6D88\u606F\u201D\u3002` : targetBot ? `${targetBot.bot.name}\u5DF2\u8FDE\u63A5\uFF0C\u53EF\u4EE5\u5728\u98DE\u4E66\u4E2D\u5F00\u59CB\u804A\u5929\u3002` : "\u65B0\u98DE\u4E66\u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5\uFF0C\u53EF\u4EE5\u5F00\u59CB\u804A\u5929\u3002");
8877
- if (result.botId) setFocusBotId(result.botId);
8893
+ if (result2.botId) setFocusBotId(result2.botId);
8878
8894
  return;
8879
8895
  }
8880
- if (result.status === "failed") {
8881
- const error = new Error(result.message ?? (isCallbackRepair(provision2) ? "\u98DE\u4E66\u6743\u9650\u4E0E\u56DE\u8C03\u8865\u5168\u5931\u8D25" : isGroupMessagePermission(provision2) ? "\u98DE\u4E66\u7FA4\u6D88\u606F\u6743\u9650\u5F00\u901A\u5931\u8D25" : "\u98DE\u4E66\u5E94\u7528\u521B\u5EFA\u5931\u8D25"));
8896
+ if (result2.status === "failed") {
8897
+ const error = new Error(result2.message ?? (isCallbackRepair(provision2) ? "\u98DE\u4E66\u6743\u9650\u4E0E\u56DE\u8C03\u8865\u5168\u5931\u8D25" : isGroupMessagePermission(provision2) ? "\u98DE\u4E66\u7FA4\u6D88\u606F\u6743\u9650\u5F00\u901A\u5931\u8D25" : "\u98DE\u4E66\u5E94\u7528\u521B\u5EFA\u5931\u8D25"));
8882
8898
  error.code = "FEISHU_PROVISION_FAILED";
8883
8899
  throw error;
8884
8900
  }
8885
- if (result.status === "expired") {
8901
+ if (result2.status === "expired") {
8886
8902
  setModel((current) => current.provisioning?.attemptId === provision2.attemptId ? { ...current, provisioning: { ...current.provisioning, phase: "qr", expired: true } } : current);
8887
8903
  return;
8888
8904
  }
8889
8905
  setModel((current) => {
8890
8906
  if (current.provisioning?.attemptId !== provision2.attemptId) return current;
8891
- const next = result.provisioning ?? current.provisioning;
8907
+ const next = result2.provisioning ?? current.provisioning;
8892
8908
  return {
8893
8909
  ...current,
8894
8910
  provisioning: {
8895
8911
  ...current.provisioning,
8896
8912
  ...next,
8897
- phase: ["scanned", "connecting"].includes(result.status) ? "connecting" : "qr"
8913
+ phase: ["scanned", "connecting"].includes(result2.status) ? "connecting" : "qr"
8898
8914
  }
8899
8915
  };
8900
8916
  });
@@ -9848,23 +9864,23 @@ function text3(value, fallback, max = 240) {
9848
9864
  return typeof value === "string" && value.trim() ? value.trim().slice(0, max) : fallback;
9849
9865
  }
9850
9866
  function id2(value) {
9851
- const result = text3(value, "", 128);
9852
- return /^[a-z\d_-]+$/i.test(result) ? result : void 0;
9867
+ const result2 = text3(value, "", 128);
9868
+ return /^[a-z\d_-]+$/i.test(result2) ? result2 : void 0;
9853
9869
  }
9854
9870
  function timestamp3(value) {
9855
9871
  if (typeof value === "number" && Number.isFinite(value)) return value;
9856
9872
  const parsed = typeof value === "string" ? Date.parse(value) : Number.NaN;
9857
9873
  return Number.isNaN(parsed) ? void 0 : parsed;
9858
9874
  }
9859
- function unwrapRpcResult4(result) {
9860
- if (!isRecord4(result) || typeof result.ok !== "boolean") throw new Error("QQ \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
9861
- if (!result.ok) {
9862
- const error = new Error(text3(result.error?.message, "QQ \u64CD\u4F5C\u5931\u8D25"));
9863
- error.code = text3(result.error?.code, "QQ_RPC_ERROR", 80);
9864
- Object.assign(error, diagnosticFields(result.error));
9875
+ function unwrapRpcResult4(result2) {
9876
+ if (!isRecord4(result2) || typeof result2.ok !== "boolean") throw new Error("QQ \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
9877
+ if (!result2.ok) {
9878
+ const error = new Error(text3(result2.error?.message, "QQ \u64CD\u4F5C\u5931\u8D25"));
9879
+ error.code = text3(result2.error?.code, "QQ_RPC_ERROR", 80);
9880
+ Object.assign(error, diagnosticFields(result2.error));
9865
9881
  throw error;
9866
9882
  }
9867
- return result.value;
9883
+ return result2.value;
9868
9884
  }
9869
9885
  function safeQrSource3(value) {
9870
9886
  return typeof value === "string" && value.length <= 2 * 1024 * 1024 && QR_DATA_URL2.test(value) ? value : void 0;
@@ -9875,7 +9891,7 @@ function normalizeProvisioning3(value, now = Date.now()) {
9875
9891
  const attemptId = id2(source.attemptId);
9876
9892
  if (!attemptId) throw new Error("QQ \u626B\u7801\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u6709\u6548\u7684\u7ED1\u5B9A\u4EFB\u52A1");
9877
9893
  const reported = text3(source.status, "failed", 32);
9878
- const result = {
9894
+ const result2 = {
9879
9895
  attemptId,
9880
9896
  status: PROVISION_STATES2.has(reported) ? reported : "failed",
9881
9897
  expiresAt: timestamp3(source.expiresAt) ?? now + 5 * 6e4,
@@ -9883,14 +9899,14 @@ function normalizeProvisioning3(value, now = Date.now()) {
9883
9899
  qrRevision: Number.isSafeInteger(source.qrRevision) ? source.qrRevision : 0
9884
9900
  };
9885
9901
  const qrCodeDataUrl = safeQrSource3(source.qrCodeDataUrl);
9886
- if (qrCodeDataUrl) result.qrCodeDataUrl = qrCodeDataUrl;
9887
- if (id2(source.botId)) result.botId = id2(source.botId);
9888
- if (isRecord4(source.error)) result.error = {
9902
+ if (qrCodeDataUrl) result2.qrCodeDataUrl = qrCodeDataUrl;
9903
+ if (id2(source.botId)) result2.botId = id2(source.botId);
9904
+ if (isRecord4(source.error)) result2.error = {
9889
9905
  ...diagnosticFields(source.error),
9890
9906
  code: text3(source.error.code, "QQ_PROVISION_FAILED", 80),
9891
9907
  message: text3(source.error.message, "QQ \u673A\u5668\u4EBA\u6CA1\u6709\u63A5\u5165\u5B8C\u6210")
9892
9908
  };
9893
- return result;
9909
+ return result2;
9894
9910
  }
9895
9911
  function normalizeBot3(value) {
9896
9912
  if (!isRecord4(value) || !id2(value.botId)) return void 0;
@@ -9948,12 +9964,12 @@ function normalizeSnapshot3(value) {
9948
9964
  ...testMessage ? { testMessage } : {}
9949
9965
  };
9950
9966
  }
9951
- function connectionTestFeedback2(result) {
9952
- if (result?.sent === true) return "\u6D4B\u8BD5\u6D88\u606F\u5DF2\u53D1\u9001\uFF0C\u8BF7\u5230\u5BF9\u5E94\u673A\u5668\u4EBA\u4F1A\u8BDD\u4E2D\u786E\u8BA4\u3002";
9953
- if (result?.code === "test-target-unavailable") {
9967
+ function connectionTestFeedback2(result2) {
9968
+ if (result2?.sent === true) return "\u6D4B\u8BD5\u6D88\u606F\u5DF2\u53D1\u9001\uFF0C\u8BF7\u5230\u5BF9\u5E94\u673A\u5668\u4EBA\u4F1A\u8BDD\u4E2D\u786E\u8BA4\u3002";
9969
+ if (result2?.code === "test-target-unavailable") {
9954
9970
  return "\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\u3002\u673A\u5668\u4EBA\u5C1A\u672A\u6536\u5230\u53EF\u7528\u4E8E\u6D4B\u8BD5\u7684\u79C1\u804A\u6D88\u606F\u3002";
9955
9971
  }
9956
- return result ? "\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\uFF0C\u4F46\u6D4B\u8BD5\u6D88\u606F\u53D1\u9001\u5931\u8D25\u3002" : null;
9972
+ return result2 ? "\u8FDE\u63A5\u68C0\u67E5\u5B8C\u6210\uFF0C\u4F46\u6D4B\u8BD5\u6D88\u606F\u53D1\u9001\u5931\u8D25\u3002" : null;
9957
9973
  }
9958
9974
  function presentError4(error) {
9959
9975
  return {
@@ -10717,15 +10733,15 @@ function officeHookUrls(baseUrl) {
10717
10733
  function record(value) {
10718
10734
  return value !== null && typeof value === "object" && !Array.isArray(value);
10719
10735
  }
10720
- function unwrapOfficeRpc(result) {
10721
- if (!record(result) || typeof result.ok !== "boolean") throw new Error("AI Office \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
10722
- if (!result.ok) {
10723
- const error = new Error(typeof result.error?.message === "string" ? result.error.message : "AI Office \u64CD\u4F5C\u5931\u8D25");
10724
- error.code = typeof result.error?.code === "string" ? result.error.code : "office-rpc-error";
10725
- Object.assign(error, diagnosticFields(result.error));
10736
+ function unwrapOfficeRpc(result2) {
10737
+ if (!record(result2) || typeof result2.ok !== "boolean") throw new Error("AI Office \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
10738
+ if (!result2.ok) {
10739
+ const error = new Error(typeof result2.error?.message === "string" ? result2.error.message : "AI Office \u64CD\u4F5C\u5931\u8D25");
10740
+ error.code = typeof result2.error?.code === "string" ? result2.error.code : "office-rpc-error";
10741
+ Object.assign(error, diagnosticFields(result2.error));
10726
10742
  throw error;
10727
10743
  }
10728
- return result.value;
10744
+ return result2.value;
10729
10745
  }
10730
10746
  function normalizeOfficeStatus(value) {
10731
10747
  if (!record(value) || value.configured !== true) {
@@ -11061,6 +11077,8 @@ settings:
11061
11077
  event_subscriptions:
11062
11078
  bot_events:
11063
11079
  - app_mention
11080
+ - message.channels
11081
+ - message.groups
11064
11082
  - message.im
11065
11083
  org_deploy_enabled: false
11066
11084
  socket_mode_enabled: true
@@ -11368,8 +11386,8 @@ function text4(value, fallback, max = 240) {
11368
11386
  return typeof value === "string" && value.trim() ? value.trim().slice(0, max) : fallback;
11369
11387
  }
11370
11388
  function id3(value) {
11371
- const result = text4(value, "", 128);
11372
- return /^[a-z\d_-]+$/i.test(result) ? result : void 0;
11389
+ const result2 = text4(value, "", 128);
11390
+ return /^[a-z\d_-]+$/i.test(result2) ? result2 : void 0;
11373
11391
  }
11374
11392
  function timestamp4(value) {
11375
11393
  if (typeof value === "number" && Number.isFinite(value)) return value;
@@ -11383,15 +11401,15 @@ function normalizeTestMessage3(value) {
11383
11401
  const code = value.code === "test-target-unavailable" ? "test-target-unavailable" : "test-message-failed";
11384
11402
  return { sent: false, code, ...value.error ? { error: normalizeConnectionError(value.error) } : {} };
11385
11403
  }
11386
- function unwrapRpcResult7(result) {
11387
- if (!isRecord5(result) || typeof result.ok !== "boolean") throw new Error("\u4F01\u4E1A\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
11388
- if (!result.ok) {
11389
- const error = new Error(text4(result.error?.message, "\u4F01\u4E1A\u5FAE\u4FE1\u64CD\u4F5C\u5931\u8D25"));
11390
- error.code = text4(result.error?.code, "WECOM_RPC_ERROR", 80);
11391
- Object.assign(error, diagnosticFields(result.error));
11404
+ function unwrapRpcResult7(result2) {
11405
+ if (!isRecord5(result2) || typeof result2.ok !== "boolean") throw new Error("\u4F01\u4E1A\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
11406
+ if (!result2.ok) {
11407
+ const error = new Error(text4(result2.error?.message, "\u4F01\u4E1A\u5FAE\u4FE1\u64CD\u4F5C\u5931\u8D25"));
11408
+ error.code = text4(result2.error?.code, "WECOM_RPC_ERROR", 80);
11409
+ Object.assign(error, diagnosticFields(result2.error));
11392
11410
  throw error;
11393
11411
  }
11394
- return result.value;
11412
+ return result2.value;
11395
11413
  }
11396
11414
  function safeQrSource4(value) {
11397
11415
  return typeof value === "string" && value.length <= 2 * 1024 * 1024 && QR_DATA_URL3.test(value) ? value : void 0;
@@ -11402,7 +11420,7 @@ function normalizeProvisioning4(value, now = Date.now()) {
11402
11420
  const attemptId = id3(source.attemptId);
11403
11421
  if (!attemptId) throw new Error("\u4F01\u4E1A\u5FAE\u4FE1\u626B\u7801\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u6709\u6548\u7684\u7ED1\u5B9A\u4EFB\u52A1");
11404
11422
  const reported = text4(source.status, "failed", 32);
11405
- const result = {
11423
+ const result2 = {
11406
11424
  attemptId,
11407
11425
  status: PROVISION_STATES3.has(reported) ? reported : "failed",
11408
11426
  expiresAt: timestamp4(source.expiresAt) ?? now + 5 * 6e4,
@@ -11410,14 +11428,14 @@ function normalizeProvisioning4(value, now = Date.now()) {
11410
11428
  qrRevision: Number.isSafeInteger(source.qrRevision) ? source.qrRevision : 0
11411
11429
  };
11412
11430
  const qrCodeDataUrl = safeQrSource4(source.qrCodeDataUrl);
11413
- if (qrCodeDataUrl) result.qrCodeDataUrl = qrCodeDataUrl;
11414
- if (id3(source.botId)) result.botId = id3(source.botId);
11415
- if (isRecord5(source.error)) result.error = {
11431
+ if (qrCodeDataUrl) result2.qrCodeDataUrl = qrCodeDataUrl;
11432
+ if (id3(source.botId)) result2.botId = id3(source.botId);
11433
+ if (isRecord5(source.error)) result2.error = {
11416
11434
  ...diagnosticFields(source.error),
11417
11435
  code: text4(source.error.code, "WECOM_PROVISION_FAILED", 80),
11418
11436
  message: text4(source.error.message, "\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u6CA1\u6709\u63A5\u5165\u5B8C\u6210")
11419
11437
  };
11420
- return result;
11438
+ return result2;
11421
11439
  }
11422
11440
  function normalizeBot4(value) {
11423
11441
  if (!isRecord5(value) || !id3(value.botId)) return void 0;
@@ -12238,8 +12256,8 @@ function text5(value, fallback, max = 240) {
12238
12256
  return typeof value === "string" && value.trim() ? value.trim().slice(0, max) : fallback;
12239
12257
  }
12240
12258
  function id4(value) {
12241
- const result = text5(value, "", 128);
12242
- return /^[a-z\d_-]+$/i.test(result) ? result : void 0;
12259
+ const result2 = text5(value, "", 128);
12260
+ return /^[a-z\d_-]+$/i.test(result2) ? result2 : void 0;
12243
12261
  }
12244
12262
  function optionalUrl(value) {
12245
12263
  const raw = text5(value, "", 512);
@@ -12257,15 +12275,15 @@ function normalizeTestMessage4(value) {
12257
12275
  const code = value.code === "test-target-unavailable" ? "test-target-unavailable" : "test-message-failed";
12258
12276
  return { sent: false, code, ...value.error ? { error: normalizeConnectionError(value.error) } : {} };
12259
12277
  }
12260
- function unwrapRpcResult8(result) {
12261
- if (!isRecord6(result) || typeof result.ok !== "boolean") throw new Error("\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
12262
- if (!result.ok) {
12263
- const error = new Error(text5(result.error?.message, "\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528\u64CD\u4F5C\u5931\u8D25"));
12264
- error.code = text5(result.error?.code, "WECOM_APP_RPC_ERROR", 80);
12265
- Object.assign(error, diagnosticFields(result.error));
12278
+ function unwrapRpcResult8(result2) {
12279
+ if (!isRecord6(result2) || typeof result2.ok !== "boolean") throw new Error("\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
12280
+ if (!result2.ok) {
12281
+ const error = new Error(text5(result2.error?.message, "\u4F01\u4E1A\u5FAE\u4FE1\u5E94\u7528\u64CD\u4F5C\u5931\u8D25"));
12282
+ error.code = text5(result2.error?.code, "WECOM_APP_RPC_ERROR", 80);
12283
+ Object.assign(error, diagnosticFields(result2.error));
12266
12284
  throw error;
12267
12285
  }
12268
- return result.value;
12286
+ return result2.value;
12269
12287
  }
12270
12288
  function normalizeBot5(value) {
12271
12289
  if (!isRecord6(value) || !id4(value.botId)) return void 0;
@@ -13144,17 +13162,17 @@ function invalidResponse() {
13144
13162
  error.details = { stage: "management.request", occurredAt: (/* @__PURE__ */ new Date()).toISOString() };
13145
13163
  return error;
13146
13164
  }
13147
- function unwrapRpcResult9(result) {
13148
- if (!isRecord7(result) || typeof result.ok !== "boolean") {
13165
+ function unwrapRpcResult9(result2) {
13166
+ if (!isRecord7(result2) || typeof result2.ok !== "boolean") {
13149
13167
  throw invalidResponse();
13150
13168
  }
13151
- if (!result.ok) {
13152
- if (!isRecord7(result.error)) throw invalidResponse();
13153
- const visible = normalizeConnectionError2(result.error, "WEIXIN_RPC_ERROR", "\u5FAE\u4FE1\u64CD\u4F5C\u5931\u8D25");
13169
+ if (!result2.ok) {
13170
+ if (!isRecord7(result2.error)) throw invalidResponse();
13171
+ const visible = normalizeConnectionError2(result2.error, "WEIXIN_RPC_ERROR", "\u5FAE\u4FE1\u64CD\u4F5C\u5931\u8D25");
13154
13172
  const error = Object.assign(new Error(visible.message), visible);
13155
13173
  throw error;
13156
13174
  }
13157
- return result.value;
13175
+ return result2.value;
13158
13176
  }
13159
13177
  function safeQrSource5(value) {
13160
13178
  return typeof value === "string" && /^data:image\/(?:png|webp|svg\+xml)(?:;charset=[^;,]+)?;base64,/i.test(value) ? value : void 0;
@@ -13174,7 +13192,7 @@ function normalizeProvisioning5(value) {
13174
13192
  throw invalidResponse();
13175
13193
  }
13176
13194
  const status = PROVISION_STATES4.has(value.status) ? value.status : "failed";
13177
- const result = {
13195
+ const result2 = {
13178
13196
  attemptId: string(value.attemptId),
13179
13197
  status,
13180
13198
  expiresAt: timestamp6(value.expiresAt) ?? Date.now(),
@@ -13183,14 +13201,14 @@ function normalizeProvisioning5(value) {
13183
13201
  };
13184
13202
  const verificationUrl = safeVerificationUrl(value.verificationUrl);
13185
13203
  const qrCodeDataUrl = safeQrSource5(value.qrCodeDataUrl);
13186
- if (verificationUrl) result.verificationUrl = verificationUrl;
13187
- if (qrCodeDataUrl) result.qrCodeDataUrl = qrCodeDataUrl;
13188
- if (string(value.botId)) result.botId = string(value.botId);
13189
- if (value.alreadyConnected === true) result.alreadyConnected = true;
13204
+ if (verificationUrl) result2.verificationUrl = verificationUrl;
13205
+ if (qrCodeDataUrl) result2.qrCodeDataUrl = qrCodeDataUrl;
13206
+ if (string(value.botId)) result2.botId = string(value.botId);
13207
+ if (value.alreadyConnected === true) result2.alreadyConnected = true;
13190
13208
  if (isRecord7(value.error)) {
13191
- result.error = normalizeConnectionError2(value.error, "WEIXIN_PROVISION_FAILED", "\u5FAE\u4FE1\u7ED1\u5B9A\u6CA1\u6709\u5B8C\u6210");
13209
+ result2.error = normalizeConnectionError2(value.error, "WEIXIN_PROVISION_FAILED", "\u5FAE\u4FE1\u7ED1\u5B9A\u6CA1\u6709\u5B8C\u6210");
13192
13210
  }
13193
- return result;
13211
+ return result2;
13194
13212
  }
13195
13213
  function normalizeBot6(value) {
13196
13214
  if (!isRecord7(value) || !string(value.botId) || !isRecord7(value.bot)) return null;
@@ -13706,14 +13724,14 @@ function WeixinSettingsTab({ rpcCall }) {
13706
13724
  }, "announcement");
13707
13725
  }, [scheduleAnimationFrame]);
13708
13726
  const invoke = React23.useCallback(async (endpoint, payload = {}, signal) => {
13709
- let result;
13727
+ let result2;
13710
13728
  try {
13711
- result = await rpcCall(endpoint, payload, signal);
13729
+ result2 = await rpcCall(endpoint, payload, signal);
13712
13730
  } catch (error) {
13713
13731
  if (signal?.aborted) throw error;
13714
13732
  throw managementRequestError(error, endpoint);
13715
13733
  }
13716
- return unwrapRpcResult9(result);
13734
+ return unwrapRpcResult9(result2);
13717
13735
  }, [rpcCall]);
13718
13736
  const loadStatus = React23.useCallback(async ({
13719
13737
  signal,
@@ -13844,32 +13862,32 @@ function WeixinSettingsTab({ rpcCall }) {
13844
13862
  });
13845
13863
  const poll = async () => {
13846
13864
  try {
13847
- const result = normalizeProvisioning5(await invoke(
13865
+ const result2 = normalizeProvisioning5(await invoke(
13848
13866
  WEIXIN_ENDPOINTS.pollProvisioning,
13849
13867
  { attemptId },
13850
13868
  controller.signal
13851
13869
  ));
13852
13870
  if (scheduler.disposed) return;
13853
- if (result.status === "connected") {
13871
+ if (result2.status === "connected") {
13854
13872
  const snapshot = await loadStatus({
13855
13873
  signal: controller.signal,
13856
13874
  silent: true,
13857
13875
  restoreProvisioning: false
13858
13876
  });
13859
13877
  if (scheduler.disposed) return;
13860
- const account = snapshot?.bots.find((bot) => bot.botId === result.botId);
13878
+ const account = snapshot?.bots.find((bot) => bot.botId === result2.botId);
13861
13879
  if (!account?.connected) {
13862
- setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result, status: "connecting" } : current);
13863
- scheduler.schedule(poll, result.pollIntervalMs);
13880
+ setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result2, status: "connecting" } : current);
13881
+ scheduler.schedule(poll, result2.pollIntervalMs);
13864
13882
  return;
13865
13883
  }
13866
13884
  setProvision(null);
13867
- announce(result.alreadyConnected ? "\u8FD9\u4E2A\u5FAE\u4FE1\u8D26\u53F7\u5DF2\u7ECF\u7ED1\u5B9A\u5E76\u4FDD\u6301\u5728\u7EBF\u3002" : "\u5FAE\u4FE1\u5DF2\u7ED1\u5B9A\uFF0C\u53EF\u4EE5\u5F00\u59CB\u5411\u5DF2\u7ED1\u5B9A\u7684\u673A\u5668\u4EBA\u53D1\u6D88\u606F\u3002");
13885
+ announce(result2.alreadyConnected ? "\u8FD9\u4E2A\u5FAE\u4FE1\u8D26\u53F7\u5DF2\u7ECF\u7ED1\u5B9A\u5E76\u4FDD\u6301\u5728\u7EBF\u3002" : "\u5FAE\u4FE1\u5DF2\u7ED1\u5B9A\uFF0C\u53EF\u4EE5\u5F00\u59CB\u5411\u5DF2\u7ED1\u5B9A\u7684\u673A\u5668\u4EBA\u53D1\u6D88\u606F\u3002");
13868
13886
  return;
13869
13887
  }
13870
- setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result, durationMs: current.durationMs } : current);
13871
- if (["pending", "scanned", "connecting"].includes(result.status)) {
13872
- scheduler.schedule(poll, result.pollIntervalMs);
13888
+ setProvision((current) => current?.attemptId === attemptId ? { ...current, ...result2, durationMs: current.durationMs } : current);
13889
+ if (["pending", "scanned", "connecting"].includes(result2.status)) {
13890
+ scheduler.schedule(poll, result2.pollIntervalMs);
13873
13891
  }
13874
13892
  } catch (error) {
13875
13893
  if (scheduler.disposed || error?.name === "AbortError") return;
@@ -14285,25 +14303,25 @@ function text6(value, fallback, max = 240) {
14285
14303
  return typeof value === "string" && value.trim() ? value.trim().slice(0, max) : fallback;
14286
14304
  }
14287
14305
  function id5(value) {
14288
- const result = text6(value, "", 128);
14289
- return /^[a-z\d_-]+$/i.test(result) ? result : void 0;
14306
+ const result2 = text6(value, "", 128);
14307
+ return /^[a-z\d_-]+$/i.test(result2) ? result2 : void 0;
14290
14308
  }
14291
14309
  function timestamp7(value) {
14292
14310
  if (typeof value === "number" && Number.isFinite(value)) return value;
14293
14311
  const parsed = typeof value === "string" ? Date.parse(value) : Number.NaN;
14294
14312
  return Number.isNaN(parsed) ? void 0 : parsed;
14295
14313
  }
14296
- function unwrapRpcResult10(result) {
14297
- if (!isRecord8(result) || typeof result.ok !== "boolean") {
14314
+ function unwrapRpcResult10(result2) {
14315
+ if (!isRecord8(result2) || typeof result2.ok !== "boolean") {
14298
14316
  throw new Error("WhatsApp \u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94");
14299
14317
  }
14300
- if (!result.ok) {
14301
- const error = new Error(text6(result.error?.message, "WhatsApp \u64CD\u4F5C\u5931\u8D25"));
14302
- error.code = text6(result.error?.code, "WHATSAPP_RPC_ERROR", 80);
14303
- Object.assign(error, diagnosticFields(result.error));
14318
+ if (!result2.ok) {
14319
+ const error = new Error(text6(result2.error?.message, "WhatsApp \u64CD\u4F5C\u5931\u8D25"));
14320
+ error.code = text6(result2.error?.code, "WHATSAPP_RPC_ERROR", 80);
14321
+ Object.assign(error, diagnosticFields(result2.error));
14304
14322
  throw error;
14305
14323
  }
14306
- return result.value;
14324
+ return result2.value;
14307
14325
  }
14308
14326
  function safeQrSource6(value) {
14309
14327
  return typeof value === "string" && value.length <= 2 * 1024 * 1024 && QR_DATA_URL4.test(value) ? value : void 0;
@@ -14314,7 +14332,7 @@ function normalizeProvisioning6(value, now = Date.now()) {
14314
14332
  const attemptId = id5(source.attemptId);
14315
14333
  if (!attemptId) throw new Error("WhatsApp \u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u6709\u6548\u7684\u626B\u7801\u4EFB\u52A1");
14316
14334
  const reported = text6(source.status, "failed", 32);
14317
- const result = {
14335
+ const result2 = {
14318
14336
  attemptId,
14319
14337
  status: PROVISION_STATES5.has(reported) ? reported : "failed",
14320
14338
  expiresAt: timestamp7(source.expiresAt) ?? now + 6e4,
@@ -14322,14 +14340,14 @@ function normalizeProvisioning6(value, now = Date.now()) {
14322
14340
  qrRevision: Number.isSafeInteger(source.qrRevision) ? source.qrRevision : 0
14323
14341
  };
14324
14342
  const qrCodeDataUrl = safeQrSource6(source.qrCodeDataUrl);
14325
- if (qrCodeDataUrl) result.qrCodeDataUrl = qrCodeDataUrl;
14326
- if (id5(source.botId)) result.botId = id5(source.botId);
14327
- if (isRecord8(source.error)) result.error = {
14343
+ if (qrCodeDataUrl) result2.qrCodeDataUrl = qrCodeDataUrl;
14344
+ if (id5(source.botId)) result2.botId = id5(source.botId);
14345
+ if (isRecord8(source.error)) result2.error = {
14328
14346
  ...diagnosticFields(source.error),
14329
14347
  code: text6(source.error.code, "WHATSAPP_PROVISION_FAILED", 80),
14330
14348
  message: text6(source.error.message, "WhatsApp \u6CA1\u6709\u63A5\u5165\u5B8C\u6210")
14331
14349
  };
14332
- return result;
14350
+ return result2;
14333
14351
  }
14334
14352
  function normalizeBot7(value) {
14335
14353
  if (!isRecord8(value) || !id5(value.botId)) return void 0;
@@ -15374,9 +15392,9 @@ function AgentMailAuth({ rpcCall, endpoints, disabled, address = "", onAuthorize
15374
15392
  let cancelled = false;
15375
15393
  const timer = setInterval(async () => {
15376
15394
  try {
15377
- const result = await invoke(endpoints.pollAuth, {});
15395
+ const result2 = await invoke(endpoints.pollAuth, {});
15378
15396
  if (cancelled) return;
15379
- if (result?.authorized) {
15397
+ if (result2?.authorized) {
15380
15398
  setStatus("authorized");
15381
15399
  onAuthorized?.({
15382
15400
  transport: "agent-mail",
@@ -15384,7 +15402,7 @@ function AgentMailAuth({ rpcCall, endpoints, disabled, address = "", onAuthorize
15384
15402
  // token passes through here — only the address to bind.
15385
15403
  // The server resolves the mailbox address; carry it through or the
15386
15404
  // field stays empty and the bind has nothing to use.
15387
- ...result.address ? { address: result.address } : {}
15405
+ ...result2.address ? { address: result2.address } : {}
15388
15406
  });
15389
15407
  }
15390
15408
  } catch (pollError) {
@@ -15857,8 +15875,8 @@ function MailboxReauthorize({ address, disabled, rpcCall, endpoints, onDone }) {
15857
15875
  let cancelled = false;
15858
15876
  const timer = setInterval(async () => {
15859
15877
  try {
15860
- const result = await invoke(endpoints.pollAuth, {});
15861
- if (cancelled || !result?.authorized) return;
15878
+ const result2 = await invoke(endpoints.pollAuth, {});
15879
+ if (cancelled || !result2?.authorized) return;
15862
15880
  clearInterval(timer);
15863
15881
  await onDone?.({ silent: true });
15864
15882
  } catch {
@@ -16010,9 +16028,9 @@ function useEmailChannelEnabled(rpcCall) {
16010
16028
  React26.useEffect(() => {
16011
16029
  if (typeof rpcCall !== "function") return void 0;
16012
16030
  let active = true;
16013
- Promise.resolve().then(() => rpcCall(EMAIL_ENDPOINTS.availability, {})).then((result) => {
16031
+ Promise.resolve().then(() => rpcCall(EMAIL_ENDPOINTS.availability, {})).then((result2) => {
16014
16032
  if (!active) return;
16015
- const value = result?.ok === false ? null : result?.value ?? result;
16033
+ const value = result2?.ok === false ? null : result2?.value ?? result2;
16016
16034
  setEnabled(value?.enabled === true);
16017
16035
  }).catch(() => {
16018
16036
  if (active) setEnabled(false);
@@ -16276,8 +16294,8 @@ function installInterfaceLanguageMirror(ctx, {
16276
16294
  if (active === null || active === mirrored) return;
16277
16295
  mirrored = active;
16278
16296
  Promise.resolve(rpcCall(HOST_LANGUAGE_ENDPOINTS.mirror, { locale: active })).then(
16279
- (result) => {
16280
- if (result?.ok === true) {
16297
+ (result2) => {
16298
+ if (result2?.ok === true) {
16281
16299
  attempt = 0;
16282
16300
  return;
16283
16301
  }
@@ -16388,14 +16406,14 @@ function clonePolicy(policy) {
16388
16406
  group: cloneScope(policy.group)
16389
16407
  };
16390
16408
  }
16391
- function unwrapRpcResult14(result) {
16392
- if (result?.ok === true) return result.value;
16393
- if (result?.ok === false) {
16394
- const error = new Error(result.error?.message || "\u8BBF\u95EE\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
16395
- error.code = result.error?.code;
16409
+ function unwrapRpcResult14(result2) {
16410
+ if (result2?.ok === true) return result2.value;
16411
+ if (result2?.ok === false) {
16412
+ const error = new Error(result2.error?.message || "\u8BBF\u95EE\u8BBE\u7F6E\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
16413
+ error.code = result2.error?.code;
16396
16414
  throw error;
16397
16415
  }
16398
- return result;
16416
+ return result2;
16399
16417
  }
16400
16418
  function policyFromSnapshot(value, botId) {
16401
16419
  const source = value?.snapshot ?? value;
@@ -16718,9 +16736,9 @@ function AccessPolicySettingsPage({ channel: channel7, account, rpcCall, onSaved
16718
16736
 
16719
16737
  // plugin-src/client/bot-general-settings.js
16720
16738
  var React29 = __toESM(require("react"), 1);
16721
- function settingsFromResult(result, botId) {
16722
- if (result?.ok !== true) throw new Error(result?.error?.message || "\u65E0\u6CD5\u8BFB\u53D6\u901A\u7528\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
16723
- const bot = result.value?.bots?.find((entry) => entry.botId === botId);
16739
+ function settingsFromResult(result2, botId) {
16740
+ if (result2?.ok !== true) throw new Error(result2?.error?.message || "\u65E0\u6CD5\u8BFB\u53D6\u901A\u7528\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
16741
+ const bot = result2.value?.bots?.find((entry) => entry.botId === botId);
16724
16742
  if (!bot) throw new Error("\u627E\u4E0D\u5230\u8981\u4FEE\u6539\u7684\u673A\u5668\u4EBA\u3002");
16725
16743
  return {
16726
16744
  busyMessageMode: normalizeBusyMessageMode(bot.busyMessageMode),
@@ -17070,11 +17088,11 @@ function GroupResponseModeEditor({
17070
17088
  }
17071
17089
  };
17072
17090
  const authorize = async () => {
17073
- if (current !== "all" || saving || authorizing || disabled || authorizationDisabled) return;
17091
+ if (saving || authorizing || disabled || authorizationDisabled) return;
17074
17092
  setAuthorizing(true);
17075
17093
  setError(null);
17076
17094
  try {
17077
- await onAuthorize?.();
17095
+ await onAuthorize?.({ preserveResponseMode: current !== "all" });
17078
17096
  } catch (cause) {
17079
17097
  setError(cause?.message ?? "\u7FA4\u6D88\u606F\u6743\u9650\u6388\u6743\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002");
17080
17098
  } finally {
@@ -17114,9 +17132,9 @@ function GroupResponseModeEditor({
17114
17132
  h2(
17115
17133
  "p",
17116
17134
  { className: "dim-feishuGroupHelp" },
17117
- current === "mention" ? permissionGranted ? "\u79C1\u804A\u59CB\u7EC8\u54CD\u5E94\uFF1B\u7FA4\u804A\u4EC5\u5904\u7406\u660E\u786E @\u5F53\u524D\u673A\u5668\u4EBA\u7684\u6D88\u606F\u3002\u7FA4\u6D88\u606F\u6743\u9650\u5DF2\u5F00\u901A\uFF0C\u518D\u6B21\u5207\u6362\u65E0\u9700\u6388\u6743\u3002" : "\u79C1\u804A\u59CB\u7EC8\u54CD\u5E94\uFF1B\u7FA4\u804A\u4EC5\u5904\u7406\u660E\u786E @\u5F53\u524D\u673A\u5668\u4EBA\u7684\u6D88\u606F\u3002\u9009\u62E9\u5168\u90E8\u6D88\u606F\u540E\u4F1A\u6253\u5F00\u98DE\u4E66\u5B98\u65B9\u6388\u6743\u6D41\u7A0B\u3002" : permissionGranted ? "\u5DF2\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF08im:message.group_msg\uFF09\uFF1B\u673A\u5668\u4EBA\u4F1A\u5904\u7406\u7FA4\u804A\u4E2D\u7684\u6240\u6709\u53EF\u89C1\u6D88\u606F\u3002" : "\u5C1A\u672A\u786E\u8BA4\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF0C\u8BF7\u5B8C\u6210\u98DE\u4E66\u6388\u6743\u3002"
17135
+ current === "mention" ? permissionGranted ? "\u79C1\u804A\u59CB\u7EC8\u54CD\u5E94\uFF1B\u7FA4\u804A\u4EC5\u5904\u7406\u660E\u786E @\u5F53\u524D\u673A\u5668\u4EBA\u7684\u6D88\u606F\u3002\u7FA4\u6D88\u606F\u6743\u9650\u5DF2\u5F00\u901A\uFF0C\u518D\u6B21\u5207\u6362\u65E0\u9700\u6388\u6743\u3002" : "\u79C1\u804A\u59CB\u7EC8\u54CD\u5E94\uFF1B\u7FA4\u804A\u4EC5\u5904\u7406\u660E\u786E @\u5F53\u524D\u673A\u5668\u4EBA\u7684\u6D88\u606F\u3002\u4E5F\u53EF\u5355\u72EC\u6388\u6743\u91C7\u96C6\u7FA4\u6D88\u606F\uFF0C\u4FDD\u6301\u4EC5 @ \u65F6\u56DE\u590D\u3002" : permissionGranted ? "\u5DF2\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF08im:message.group_msg\uFF09\uFF1B\u673A\u5668\u4EBA\u4F1A\u5904\u7406\u7FA4\u804A\u4E2D\u7684\u6240\u6709\u53EF\u89C1\u6D88\u606F\u3002" : "\u5C1A\u672A\u786E\u8BA4\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF0C\u8BF7\u5B8C\u6210\u98DE\u4E66\u6388\u6743\u3002"
17118
17136
  ),
17119
- current === "all" ? h2(
17137
+ current === "all" || !permissionGranted ? h2(
17120
17138
  "div",
17121
17139
  { className: "dim-feishuGroupPermissionAction" },
17122
17140
  h2(SettingsButton, {
@@ -17295,14 +17313,14 @@ function PermissionFlow({ provision, now, busy, botName, onRetry, onCancel, onCl
17295
17313
  h2(
17296
17314
  "p",
17297
17315
  null,
17298
- "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u53EA\u589E\u91CF\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF1B\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u786E\u8BA4\u540E\u4F1A\u81EA\u52A8\u542F\u7528\u201C\u54CD\u5E94\u6240\u6709\u7FA4\u6D88\u606F\u201D\uFF0C\u5176\u4ED6\u673A\u5668\u4EBA\u4E0D\u53D7\u5F71\u54CD\u3002"
17316
+ "\u626B\u7801\u4F1A\u66F4\u65B0\u73B0\u6709\u98DE\u4E66\u5E94\u7528\uFF0C\u53EA\u589E\u91CF\u5F00\u901A\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u65B0\u5E94\u7528\u3002\u5355\u72EC\u6388\u6743\u91C7\u96C6\u65F6\u4FDD\u7559\u539F\u6765\u7684\u56DE\u590D\u65B9\u5F0F\uFF1B\u9009\u62E9\u54CD\u5E94\u6240\u6709\u6D88\u606F\u65F6\u624D\u5207\u6362\u3002"
17299
17317
  ),
17300
17318
  h2(
17301
17319
  "ol",
17302
17320
  null,
17303
17321
  h2("li", null, "\u6253\u5F00\u98DE\u4E66\u79FB\u52A8\u7AEF\uFF0C\u4F7F\u7528\u626B\u4E00\u626B\u8BFB\u53D6\u4E8C\u7EF4\u7801"),
17304
17322
  h2("li", null, "\u6838\u5BF9\u73B0\u6709\u5E94\u7528\uFF0C\u5E76\u786E\u8BA4\u201C\u83B7\u53D6\u7FA4\u7EC4\u4E2D\u6240\u6709\u6D88\u606F\u201D\u6743\u9650"),
17305
- h2("li", null, "\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u7B49\u5F85\u6743\u9650\u751F\u6548\u5E76\u81EA\u52A8\u5207\u6362\u54CD\u5E94\u65B9\u5F0F")
17323
+ h2("li", null, "\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u7B49\u5F85\u6743\u9650\u751F\u6548")
17306
17324
  ),
17307
17325
  h2(
17308
17326
  "div",
@@ -17350,9 +17368,9 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17350
17368
  return unwrapRpcResult3(await rpcCall(endpoint, payload, signal));
17351
17369
  }, [rpcCall]);
17352
17370
  const applySnapshot = React31.useCallback((value) => {
17353
- const result = targetBotFromSnapshot(value, account.botId);
17354
- if (mounted.current) setSettings(groupSettingsFrom(result.bot));
17355
- return result;
17371
+ const result2 = targetBotFromSnapshot(value, account.botId);
17372
+ if (mounted.current) setSettings(groupSettingsFrom(result2.bot));
17373
+ return result2;
17356
17374
  }, [account.botId]);
17357
17375
  const loadSettings = React31.useCallback(async ({ signal, restoreProvisioning = false } = {}) => {
17358
17376
  setRefreshing(true);
@@ -17360,9 +17378,9 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17360
17378
  try {
17361
17379
  const value = await invoke(FEISHU_ENDPOINTS.status, {}, signal);
17362
17380
  if (signal?.aborted || !mounted.current) return void 0;
17363
- const result = applySnapshot(value);
17381
+ const result2 = applySnapshot(value);
17364
17382
  if (restoreProvisioning) {
17365
- const active = result.snapshot.provisioning;
17383
+ const active = result2.snapshot.provisioning;
17366
17384
  if (active?.operation === GROUP_MESSAGE_PERMISSION_OPERATION2 && active.botId === account.botId) {
17367
17385
  const timestamp8 = Date.now();
17368
17386
  setNow(timestamp8);
@@ -17374,7 +17392,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17374
17392
  });
17375
17393
  }
17376
17394
  }
17377
- return result.bot;
17395
+ return result2.bot;
17378
17396
  } catch (cause) {
17379
17397
  if (signal?.aborted || cause?.name === "AbortError" || !mounted.current) return void 0;
17380
17398
  setRefreshError(presentError3(cause));
@@ -17392,7 +17410,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17392
17410
  const value = await invoke(endpoint, { botId: account.botId, ...payload });
17393
17411
  applySnapshot(value);
17394
17412
  }, [account.botId, applySnapshot, invoke]);
17395
- const startAuthorization = React31.useCallback(async ({ replace = false } = {}) => {
17413
+ const startAuthorization = React31.useCallback(async ({ replace = false, preserveResponseMode = provision?.preserveResponseMode === true } = {}) => {
17396
17414
  if (provisionBusy) return;
17397
17415
  const previousAttemptId = provision?.attemptId;
17398
17416
  setProvisionBusy(true);
@@ -17406,7 +17424,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17406
17424
  }
17407
17425
  const normalized = normalizeProvisioning2(await invoke(
17408
17426
  FEISHU_ENDPOINTS.beginGroupMessagePermission,
17409
- { botId: account.botId }
17427
+ { botId: account.botId, ...preserveResponseMode ? { preserveResponseMode: true } : {} }
17410
17428
  ));
17411
17429
  if (normalized.operation !== GROUP_MESSAGE_PERMISSION_OPERATION2 || normalized.botId !== account.botId) {
17412
17430
  throw new Error("\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u7FA4\u6D88\u606F\u6743\u9650\u4E8C\u7EF4\u7801");
@@ -17417,6 +17435,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17417
17435
  setProvision({
17418
17436
  phase: normalized.submitted ? "connecting" : "qr",
17419
17437
  ...normalized,
17438
+ preserveResponseMode,
17420
17439
  durationMs: Math.max(1, normalized.expiresAt - timestamp8),
17421
17440
  expired: false
17422
17441
  });
@@ -17445,32 +17464,32 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17445
17464
  const controller = new AbortController();
17446
17465
  const timer = timerHost.setTimeout(async () => {
17447
17466
  try {
17448
- const result = normalizePollResult(await invoke(
17467
+ const result2 = normalizePollResult(await invoke(
17449
17468
  FEISHU_ENDPOINTS.pollProvisioning,
17450
17469
  { attemptId: provision.attemptId },
17451
17470
  controller.signal
17452
17471
  ));
17453
- if (result.operation !== GROUP_MESSAGE_PERMISSION_OPERATION2 || result.botId !== account.botId) {
17472
+ if (result2.operation !== GROUP_MESSAGE_PERMISSION_OPERATION2 || result2.botId !== account.botId) {
17454
17473
  throw new Error("\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u6CE8\u518C\u8FDB\u5EA6");
17455
17474
  }
17456
- if (result.status === "connected") {
17475
+ if (result2.status === "connected") {
17457
17476
  await finishAuthorization(controller.signal);
17458
17477
  return;
17459
17478
  }
17460
- if (result.status === "failed") {
17461
- const error = new Error(result.message ?? "\u98DE\u4E66\u7FA4\u6D88\u606F\u6743\u9650\u5F00\u901A\u5931\u8D25");
17479
+ if (result2.status === "failed") {
17480
+ const error = new Error(result2.message ?? "\u98DE\u4E66\u7FA4\u6D88\u606F\u6743\u9650\u5F00\u901A\u5931\u8D25");
17462
17481
  error.code = "FEISHU_PROVISION_FAILED";
17463
17482
  throw error;
17464
17483
  }
17465
- if (result.status === "expired") {
17484
+ if (result2.status === "expired") {
17466
17485
  if (mounted.current) setProvision((current) => current?.attemptId === provision.attemptId ? { ...current, phase: "qr", expired: true } : current);
17467
17486
  return;
17468
17487
  }
17469
17488
  if (mounted.current) {
17470
17489
  setProvision((current) => current?.attemptId === provision.attemptId ? {
17471
17490
  ...current,
17472
- ...result.provisioning ?? {},
17473
- phase: ["scanned", "connecting"].includes(result.status) ? "connecting" : "qr"
17491
+ ...result2.provisioning ?? {},
17492
+ phase: ["scanned", "connecting"].includes(result2.status) ? "connecting" : "qr"
17474
17493
  } : current);
17475
17494
  }
17476
17495
  } catch (cause) {
@@ -17504,18 +17523,18 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17504
17523
  }
17505
17524
  setProvisionBusy(true);
17506
17525
  try {
17507
- const result = normalizePollResult(await invoke(
17526
+ const result2 = normalizePollResult(await invoke(
17508
17527
  FEISHU_ENDPOINTS.cancelProvisioning,
17509
17528
  { attemptId: provision.attemptId }
17510
17529
  ));
17511
- if (result.operation !== GROUP_MESSAGE_PERMISSION_OPERATION2 || result.botId !== account.botId) {
17530
+ if (result2.operation !== GROUP_MESSAGE_PERMISSION_OPERATION2 || result2.botId !== account.botId) {
17512
17531
  throw new Error("\u98DE\u4E66\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u5339\u914D\u7684\u6CE8\u518C\u8FDB\u5EA6");
17513
17532
  }
17514
- if (result.status === "connecting") {
17533
+ if (result2.status === "connecting") {
17515
17534
  setProvision((current) => ({ ...current, phase: "connecting", submitted: true }));
17516
17535
  return;
17517
17536
  }
17518
- if (result.status === "connected") {
17537
+ if (result2.status === "connected") {
17519
17538
  await finishAuthorization();
17520
17539
  return;
17521
17540
  }
@@ -17555,7 +17574,7 @@ function FeishuGroupSettingsPage({ account, rpcCall }) {
17555
17574
  }
17556
17575
  await saveSetting(FEISHU_ENDPOINTS.setGroupResponseMode, { groupResponseMode });
17557
17576
  },
17558
- onAuthorize: () => startAuthorization()
17577
+ onAuthorize: (options) => startAuthorization(options)
17559
17578
  }),
17560
17579
  h2(MentionTopicReplyEditor, {
17561
17580
  value: settings.mentionTopicReply,
@@ -18200,14 +18219,14 @@ var CHANNEL_DEFINITIONS = Object.freeze({
18200
18219
  function presentError14(error, fallback) {
18201
18220
  return error?.message || fallback;
18202
18221
  }
18203
- function unwrapRpcResult15(result) {
18204
- if (result?.ok === true) return result.value;
18205
- if (result?.ok === false) {
18206
- const error = new Error(result.error?.message || "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
18207
- error.code = result.error?.code;
18222
+ function unwrapRpcResult15(result2) {
18223
+ if (result2?.ok === true) return result2.value;
18224
+ if (result2?.ok === false) {
18225
+ const error = new Error(result2.error?.message || "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
18226
+ error.code = result2.error?.code;
18208
18227
  throw error;
18209
18228
  }
18210
- return result;
18229
+ return result2;
18211
18230
  }
18212
18231
  function targetsFrom(value) {
18213
18232
  if (Array.isArray(value)) return value;
@@ -18984,8 +19003,128 @@ function DeliveryTargetSettingsPage({
18984
19003
  );
18985
19004
  }
18986
19005
 
18987
- // plugin-src/client/global-settings.js
19006
+ // plugin-src/client/group-history-settings.js
18988
19007
  var React36 = __toESM(require("react"), 1);
19008
+ var GROUP_HISTORY_SETTINGS_ENDPOINTS = Object.freeze({
19009
+ get: "settings.group-history.get",
19010
+ set: "settings.group-history.set"
19011
+ });
19012
+ function result(value) {
19013
+ if (value?.ok === false) throw new Error(value.error?.message || "\u65E0\u6CD5\u8BFB\u53D6\u6216\u4FDD\u5B58\u7FA4\u8BB0\u5F55\u8BBE\u7F6E\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
19014
+ return value?.ok === true ? value.value : value;
19015
+ }
19016
+ function GroupHistorySettings({ rpcCall }) {
19017
+ const [days, setDays] = React36.useState("14");
19018
+ const [phase, setPhase] = React36.useState("loading");
19019
+ const [error, setError] = React36.useState(null);
19020
+ const [notice, setNotice] = React36.useState(null);
19021
+ const mounted = React36.useRef(false);
19022
+ const busy = React36.useRef(false);
19023
+ const id6 = React36.useId();
19024
+ const load = React36.useCallback(async (signal) => {
19025
+ setPhase("loading");
19026
+ setError(null);
19027
+ try {
19028
+ const settings = result(await rpcCall(GROUP_HISTORY_SETTINGS_ENDPOINTS.get, {}, signal));
19029
+ if (signal?.aborted || !mounted.current) return;
19030
+ if (!Number.isSafeInteger(settings?.groupHistoryRetentionDays)) throw new Error("\u7FA4\u8BB0\u5F55\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
19031
+ setDays(String(settings.groupHistoryRetentionDays));
19032
+ setError(settings.error ?? null);
19033
+ setPhase("ready");
19034
+ } catch (caught) {
19035
+ if (signal?.aborted || !mounted.current) return;
19036
+ setError(caught.message);
19037
+ setPhase("error");
19038
+ }
19039
+ }, [rpcCall]);
19040
+ React36.useEffect(() => {
19041
+ mounted.current = true;
19042
+ const controller = new AbortController();
19043
+ void load(controller.signal);
19044
+ return () => {
19045
+ mounted.current = false;
19046
+ controller.abort();
19047
+ };
19048
+ }, [load]);
19049
+ const save = async (event) => {
19050
+ event.preventDefault();
19051
+ if (busy.current || phase !== "ready") return;
19052
+ const value = Number(days);
19053
+ if (!/^\d+$/.test(days.trim()) || !Number.isSafeInteger(value) || value < 1 || !Number.isSafeInteger(value * 864e5)) {
19054
+ setError("\u4FDD\u7559\u5929\u6570\u5FC5\u987B\u4E3A\u6B63\u6574\u6570\u3002");
19055
+ return;
19056
+ }
19057
+ busy.current = true;
19058
+ setPhase("saving");
19059
+ setError(null);
19060
+ setNotice(null);
19061
+ try {
19062
+ const settings = result(await rpcCall(GROUP_HISTORY_SETTINGS_ENDPOINTS.set, { groupHistoryRetentionDays: value }));
19063
+ if (mounted.current) {
19064
+ setDays(String(settings.groupHistoryRetentionDays));
19065
+ setNotice("\u5DF2\u4FDD\u5B58");
19066
+ }
19067
+ } catch (caught) {
19068
+ if (mounted.current) setError(caught.message);
19069
+ } finally {
19070
+ busy.current = false;
19071
+ if (mounted.current) setPhase("ready");
19072
+ }
19073
+ };
19074
+ return h2(
19075
+ "section",
19076
+ { className: "dim-botGeneralSettings dim-groupHistorySettings", "aria-label": "\u7FA4\u804A\u5929\u8BB0\u5F55", "aria-busy": phase === "loading" || phase === "saving" },
19077
+ h2(
19078
+ "form",
19079
+ { onSubmit: save },
19080
+ h2(
19081
+ "div",
19082
+ { className: "dim-botGeneralRow" },
19083
+ h2(
19084
+ "div",
19085
+ { className: "dim-botGeneralText" },
19086
+ h2("label", { className: "dim-botGeneralTitle", htmlFor: `${id6}-days` }, "\u7FA4\u804A\u5929\u8BB0\u5F55\u4FDD\u7559\u5929\u6570"),
19087
+ h2("p", { className: "dim-botGeneralHelp", id: `${id6}-description` }, "\u8FC7\u671F\u7684\u7FA4\u6D88\u606F\u548C\u6587\u4EF6\u4F1A\u81EA\u52A8\u6E05\u7406\u3002")
19088
+ ),
19089
+ h2(
19090
+ "div",
19091
+ { className: "dim-botGeneralControl dim-groupHistoryControl" },
19092
+ h2("input", {
19093
+ id: `${id6}-days`,
19094
+ className: "dim-groupHistoryInput",
19095
+ type: "number",
19096
+ min: 1,
19097
+ step: 1,
19098
+ value: days,
19099
+ disabled: phase !== "ready",
19100
+ "aria-describedby": `${id6}-description`,
19101
+ onChange: (event) => {
19102
+ setDays(event.target.value);
19103
+ setNotice(null);
19104
+ }
19105
+ }),
19106
+ h2("span", { className: "dim-groupHistoryUnit" }, "\u5929")
19107
+ )
19108
+ ),
19109
+ h2(
19110
+ "div",
19111
+ { className: "dim-botGeneralActions" },
19112
+ h2("button", {
19113
+ type: "submit",
19114
+ className: "dim-deliveryButton dim-groupHistorySave",
19115
+ "data-kind": "primary",
19116
+ disabled: phase !== "ready"
19117
+ }, phase === "saving" ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58")
19118
+ )
19119
+ ),
19120
+ phase === "loading" ? h2("p", { role: "status", className: "dim-botGeneralHelp dim-groupHistoryFeedback" }, "\u6B63\u5728\u8BFB\u53D6\u7FA4\u8BB0\u5F55\u8BBE\u7F6E\u2026") : null,
19121
+ error ? h2("p", { role: "alert", className: "dim-accessFeedback dim-groupHistoryFeedback", "data-tone": "error" }, error) : null,
19122
+ notice ? h2("p", { role: "status", className: "dim-botGeneralHelp dim-groupHistoryFeedback" }, notice) : null
19123
+ );
19124
+ }
19125
+
19126
+ // plugin-src/client/global-settings.js
19127
+ var React37 = __toESM(require("react"), 1);
18989
19128
 
18990
19129
  // src/channels/shared/inbound-ttl.mjs
18991
19130
  var DEFAULT_INBOUND_TTL_HOURS = 168;
@@ -19014,15 +19153,15 @@ var DEFAULT_IMAGE_INPUT_SETTINGS = Object.freeze({
19014
19153
  });
19015
19154
  function normalizeImageInputSettings(value) {
19016
19155
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
19017
- const result = {};
19156
+ const result2 = {};
19018
19157
  for (const key of Object.keys(DEFAULT_IMAGE_INPUT_SETTINGS)) {
19019
19158
  const input = value[key];
19020
19159
  const number = typeof input === "string" && /^\d+$/.test(input.trim()) ? Number(input.trim()) : input;
19021
19160
  if (!Number.isSafeInteger(number) || number < 1 || !Number.isSafeInteger(number * IMAGE_MEGABYTE)) return null;
19022
- result[key] = number;
19161
+ result2[key] = number;
19023
19162
  }
19024
- if (result.maxDownloadMb < result.maxImageMb || result.maxTotalMb < result.maxImageMb) return null;
19025
- return Object.freeze(result);
19163
+ if (result2.maxDownloadMb < result2.maxImageMb || result2.maxTotalMb < result2.maxImageMb) return null;
19164
+ return Object.freeze(result2);
19026
19165
  }
19027
19166
 
19028
19167
  // plugin-src/client/global-settings.js
@@ -19040,14 +19179,14 @@ var GLOBAL_SETTINGS_ENDPOINTS = Object.freeze({
19040
19179
  function presentError15(error, fallback) {
19041
19180
  return error?.message || fallback;
19042
19181
  }
19043
- function unwrapRpcResult16(result) {
19044
- if (result?.ok === true) return result.value;
19045
- if (result?.ok === false) {
19046
- const error = new Error(result.error?.message || "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
19047
- error.code = result.error?.code;
19182
+ function unwrapRpcResult16(result2) {
19183
+ if (result2?.ok === true) return result2.value;
19184
+ if (result2?.ok === false) {
19185
+ const error = new Error(result2.error?.message || "\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");
19186
+ error.code = result2.error?.code;
19048
19187
  throw error;
19049
19188
  }
19050
- return result;
19189
+ return result2;
19051
19190
  }
19052
19191
  function GlobalSettingsLogoGlyph({ size } = {}) {
19053
19192
  return h2("svg", {
@@ -19070,20 +19209,20 @@ function GlobalButton({ children, kind = "secondary", className = "", ...props }
19070
19209
  }, children);
19071
19210
  }
19072
19211
  function ImageInputSettings({ rpcCall }) {
19073
- const [values, setValues] = React36.useState(DEFAULT_IMAGE_INPUT_SETTINGS);
19074
- const [phase, setPhase] = React36.useState("loading");
19075
- const [error, setError] = React36.useState(null);
19076
- const [saved, setSaved] = React36.useState(false);
19077
- const mounted = React36.useRef(false);
19078
- const saving = React36.useRef(false);
19079
- const id6 = React36.useId();
19080
- const load = React36.useCallback(async (signal) => {
19212
+ const [values, setValues] = React37.useState(DEFAULT_IMAGE_INPUT_SETTINGS);
19213
+ const [phase, setPhase] = React37.useState("loading");
19214
+ const [error, setError] = React37.useState(null);
19215
+ const [saved, setSaved] = React37.useState(false);
19216
+ const mounted = React37.useRef(false);
19217
+ const saving = React37.useRef(false);
19218
+ const id6 = React37.useId();
19219
+ const load = React37.useCallback(async (signal) => {
19081
19220
  setPhase("loading");
19082
19221
  setError(null);
19083
19222
  try {
19084
- const result = unwrapRpcResult16(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.getImages, {}, signal));
19223
+ const result2 = unwrapRpcResult16(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.getImages, {}, signal));
19085
19224
  if (signal?.aborted || !mounted.current) return;
19086
- const settings = normalizeImageInputSettings(result);
19225
+ const settings = normalizeImageInputSettings(result2);
19087
19226
  if (!settings) throw new Error("\u901A\u7528\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
19088
19227
  setValues(settings);
19089
19228
  setPhase("ready");
@@ -19093,7 +19232,7 @@ function ImageInputSettings({ rpcCall }) {
19093
19232
  setPhase("error");
19094
19233
  }
19095
19234
  }, [rpcCall]);
19096
- React36.useEffect(() => {
19235
+ React37.useEffect(() => {
19097
19236
  mounted.current = true;
19098
19237
  const controller = new AbortController();
19099
19238
  void load(controller.signal);
@@ -19115,10 +19254,10 @@ function ImageInputSettings({ rpcCall }) {
19115
19254
  setPhase("saving");
19116
19255
  setError(null);
19117
19256
  try {
19118
- const result = unwrapRpcResult16(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.setImages, settings));
19119
- if (!normalizeImageInputSettings(result)) throw new Error("\u901A\u7528\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
19257
+ const result2 = unwrapRpcResult16(await rpcCall(GLOBAL_SETTINGS_ENDPOINTS.setImages, settings));
19258
+ if (!normalizeImageInputSettings(result2)) throw new Error("\u901A\u7528\u8BBE\u7F6E\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
19120
19259
  if (mounted.current) {
19121
- setValues(result);
19260
+ setValues(result2);
19122
19261
  setSaved(true);
19123
19262
  }
19124
19263
  } catch (caught) {
@@ -19199,30 +19338,30 @@ function ImageInputSettings({ rpcCall }) {
19199
19338
  phase === "loading" ? h2("p", { className: "dim-globalInline dim-imageSettingsFeedback", role: "status" }, "\u6B63\u5728\u8BFB\u53D6\u56FE\u7247\u8BBE\u7F6E\u2026") : null
19200
19339
  );
19201
19340
  }
19202
- function GlobalSettingsPanel({ rpcCall }) {
19203
- const [phase, setPhase] = React36.useState("loading");
19204
- const [loadError, setLoadError] = React36.useState(null);
19205
- const [ttlInput, setTtlInput] = React36.useState("");
19206
- const [savedTtl, setSavedTtl] = React36.useState(null);
19207
- const [ttlError, setTtlError] = React36.useState(false);
19208
- const [saveError, setSaveError] = React36.useState(null);
19209
- const [saveSucceeded, setSaveSucceeded] = React36.useState(false);
19210
- const [isSaving, setIsSaving] = React36.useState(false);
19211
- const [sweepConfirming, setSweepConfirming] = React36.useState(false);
19212
- const [sweeping, setSweeping] = React36.useState(false);
19213
- const ttlErrorId = React36.useId();
19214
- const ttlHintsId = React36.useId();
19215
- const sweepTriggerId = React36.useId();
19216
- const sweepConfirmId = React36.useId();
19217
- const sweepConfirmTextId = React36.useId();
19218
- const sweepConfirmButtonId = React36.useId();
19219
- const mounted = React36.useRef(true);
19220
- const saving = React36.useRef(false);
19221
- const invoke = React36.useCallback(async (endpoint, payload = {}, signal) => {
19341
+ function AttachmentSettingsPanel({ rpcCall }) {
19342
+ const [phase, setPhase] = React37.useState("loading");
19343
+ const [loadError, setLoadError] = React37.useState(null);
19344
+ const [ttlInput, setTtlInput] = React37.useState("");
19345
+ const [savedTtl, setSavedTtl] = React37.useState(null);
19346
+ const [ttlError, setTtlError] = React37.useState(false);
19347
+ const [saveError, setSaveError] = React37.useState(null);
19348
+ const [saveSucceeded, setSaveSucceeded] = React37.useState(false);
19349
+ const [isSaving, setIsSaving] = React37.useState(false);
19350
+ const [sweepConfirming, setSweepConfirming] = React37.useState(false);
19351
+ const [sweeping, setSweeping] = React37.useState(false);
19352
+ const ttlErrorId = React37.useId();
19353
+ const ttlHintsId = React37.useId();
19354
+ const sweepTriggerId = React37.useId();
19355
+ const sweepConfirmId = React37.useId();
19356
+ const sweepConfirmTextId = React37.useId();
19357
+ const sweepConfirmButtonId = React37.useId();
19358
+ const mounted = React37.useRef(true);
19359
+ const saving = React37.useRef(false);
19360
+ const invoke = React37.useCallback(async (endpoint, payload = {}, signal) => {
19222
19361
  if (typeof rpcCall !== "function") throw new Error("\u901A\u7528\u8BBE\u7F6E\u6682\u4E0D\u53EF\u7528\u3002");
19223
19362
  return unwrapRpcResult16(await rpcCall(endpoint, payload, signal));
19224
19363
  }, [rpcCall]);
19225
- const loadSettings = React36.useCallback(async ({ signal } = {}) => {
19364
+ const loadSettings = React37.useCallback(async ({ signal } = {}) => {
19226
19365
  setPhase("loading");
19227
19366
  setLoadError(null);
19228
19367
  try {
@@ -19246,7 +19385,7 @@ function GlobalSettingsPanel({ rpcCall }) {
19246
19385
  setPhase("error");
19247
19386
  }
19248
19387
  }, [invoke]);
19249
- React36.useEffect(() => {
19388
+ React37.useEffect(() => {
19250
19389
  mounted.current = true;
19251
19390
  const controller = new AbortController();
19252
19391
  void loadSettings({ signal: controller.signal });
@@ -19255,7 +19394,7 @@ function GlobalSettingsPanel({ rpcCall }) {
19255
19394
  controller.abort();
19256
19395
  };
19257
19396
  }, [loadSettings]);
19258
- React36.useEffect(() => {
19397
+ React37.useEffect(() => {
19259
19398
  if (!sweepConfirming) return;
19260
19399
  globalThis.document?.getElementById(sweepConfirmButtonId)?.focus();
19261
19400
  }, [sweepConfirmButtonId, sweepConfirming]);
@@ -19315,194 +19454,206 @@ function GlobalSettingsPanel({ rpcCall }) {
19315
19454
  const proposedTtl = normalizeInboundTtlHours(ttlInput.trim());
19316
19455
  const canSave = phase !== "loading" && !isSaving && proposedTtl !== null && proposedTtl !== savedTtl;
19317
19456
  return h2(
19318
- "section",
19319
- { className: "dim-generalSettingsPage", "aria-label": "\u901A\u7528\u8BBE\u7F6E" },
19320
- h2(
19321
- "header",
19322
- { className: "dim-generalSettingsHeader" },
19323
- h2("h2", null, "\u901A\u7528\u8BBE\u7F6E")
19324
- ),
19325
- h2(
19326
- "div",
19327
- { className: "dim-generalSettingsTabsBar" },
19328
- h2(
19329
- "div",
19330
- {
19331
- className: "dim-generalSettingsTabs",
19332
- role: "tablist",
19333
- "aria-label": "\u901A\u7528\u8BBE\u7F6E\u5206\u7C7B"
19334
- },
19335
- h2("button", {
19336
- type: "button",
19337
- id: ATTACHMENTS_TAB_ID,
19338
- className: "dim-generalSettingsTab",
19339
- role: "tab",
19340
- "aria-selected": true,
19341
- "aria-controls": ATTACHMENTS_PANEL_ID
19342
- }, "\u9644\u4EF6")
19343
- )
19344
- ),
19457
+ "div",
19458
+ {
19459
+ id: ATTACHMENTS_PANEL_ID,
19460
+ className: "dim-generalSettingsTabPanel",
19461
+ role: "tabpanel",
19462
+ "aria-labelledby": ATTACHMENTS_TAB_ID
19463
+ },
19345
19464
  h2(
19346
- "div",
19465
+ "section",
19347
19466
  {
19348
- id: ATTACHMENTS_PANEL_ID,
19349
- className: "dim-generalSettingsTabPanel",
19350
- role: "tabpanel",
19351
- "aria-labelledby": ATTACHMENTS_TAB_ID
19467
+ className: "dim-globalSection",
19468
+ "aria-label": "\u9644\u4EF6",
19469
+ "aria-busy": phase === "loading"
19352
19470
  },
19353
19471
  h2(
19354
- "section",
19355
- {
19356
- className: "dim-globalSection",
19357
- "aria-label": "\u9644\u4EF6",
19358
- "aria-busy": phase === "loading"
19359
- },
19472
+ "div",
19473
+ { className: "dim-globalHead" },
19360
19474
  h2(
19361
19475
  "div",
19362
- { className: "dim-globalHead" },
19476
+ { className: "dim-globalHeadTitle" },
19477
+ h2("h3", { id: "dim-globalTtlTitle" }, "\u9644\u4EF6\u4FDD\u7559\u65F6\u957F (\u5C0F\u65F6)"),
19363
19478
  h2(
19364
19479
  "div",
19365
- { className: "dim-globalHeadTitle" },
19366
- h2("h3", { id: "dim-globalTtlTitle" }, "\u9644\u4EF6\u4FDD\u7559\u65F6\u957F (\u5C0F\u65F6)"),
19480
+ { className: "dim-globalTtlHelp" },
19481
+ h2("button", {
19482
+ type: "button",
19483
+ className: "dim-channelHelpButton dim-globalTtlHelpButton",
19484
+ "aria-label": "\u67E5\u770B\u9644\u4EF6\u4FDD\u7559\u65F6\u957F\u8BF4\u660E",
19485
+ "aria-describedby": ttlHintsId
19486
+ }, h2("span", { "aria-hidden": "true" }, "?")),
19367
19487
  h2(
19368
19488
  "div",
19369
- { className: "dim-globalTtlHelp" },
19370
- h2("button", {
19371
- type: "button",
19372
- className: "dim-channelHelpButton dim-globalTtlHelpButton",
19373
- "aria-label": "\u67E5\u770B\u9644\u4EF6\u4FDD\u7559\u65F6\u957F\u8BF4\u660E",
19374
- "aria-describedby": ttlHintsId
19375
- }, h2("span", { "aria-hidden": "true" }, "?")),
19489
+ {
19490
+ id: ttlHintsId,
19491
+ className: "dim-globalTtlTooltip",
19492
+ role: "tooltip"
19493
+ },
19376
19494
  h2(
19377
- "div",
19378
- {
19379
- id: ttlHintsId,
19380
- className: "dim-globalTtlTooltip",
19381
- role: "tooltip"
19382
- },
19495
+ "ul",
19496
+ { className: "dim-globalTtlHints" },
19497
+ h2(
19498
+ "li",
19499
+ null,
19500
+ h2("code", null, "-1"),
19501
+ h2("span", null, "\u6C38\u4E45\u4FDD\u7559\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6E05\u7406")
19502
+ ),
19503
+ h2(
19504
+ "li",
19505
+ null,
19506
+ h2("code", null, "0"),
19507
+ h2("span", null, "\u6BCF Turn \u7ED3\u675F\u540E\u7ACB\u5373\u6E05\u7406")
19508
+ ),
19383
19509
  h2(
19384
- "ul",
19385
- { className: "dim-globalTtlHints" },
19386
- h2(
19387
- "li",
19388
- null,
19389
- h2("code", null, "-1"),
19390
- h2("span", null, "\u6C38\u4E45\u4FDD\u7559\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u6E05\u7406")
19391
- ),
19392
- h2(
19393
- "li",
19394
- null,
19395
- h2("code", null, "0"),
19396
- h2("span", null, "\u6BCF Turn \u7ED3\u675F\u540E\u7ACB\u5373\u6E05\u7406")
19397
- ),
19398
- h2(
19399
- "li",
19400
- null,
19401
- h2("code", null, `1~${INBOUND_TTL_MAX_HOURS}`),
19402
- h2("span", null, "\u5C0F\u65F6\u540E\u81EA\u52A8\u6E05\u7406")
19403
- )
19510
+ "li",
19511
+ null,
19512
+ h2("code", null, `1~${INBOUND_TTL_MAX_HOURS}`),
19513
+ h2("span", null, "\u5C0F\u65F6\u540E\u81EA\u52A8\u6E05\u7406")
19404
19514
  )
19405
19515
  )
19406
19516
  )
19407
19517
  )
19408
- ),
19518
+ )
19519
+ ),
19520
+ h2(
19521
+ "form",
19522
+ {
19523
+ className: "dim-globalTtlRow",
19524
+ onSubmit: (event) => {
19525
+ event.preventDefault();
19526
+ void commitTtl();
19527
+ }
19528
+ },
19529
+ h2("input", {
19530
+ id: "dim-globalTtlInput",
19531
+ className: "dim-globalTtlInput",
19532
+ type: "text",
19533
+ value: ttlInput,
19534
+ placeholder: String(DEFAULT_INBOUND_TTL_HOURS),
19535
+ autoComplete: "off",
19536
+ disabled: phase === "loading" || isSaving,
19537
+ "aria-labelledby": "dim-globalTtlTitle",
19538
+ "aria-invalid": ttlError ? "true" : void 0,
19539
+ "aria-describedby": ttlError ? ttlErrorId : ttlHintsId,
19540
+ onBlur: () => {
19541
+ setTtlError(normalizeInboundTtlHours(ttlInput.trim()) === null);
19542
+ },
19543
+ onKeyDown: (event) => {
19544
+ if (event.key !== "Enter") return;
19545
+ event.preventDefault();
19546
+ void commitTtl();
19547
+ },
19548
+ onChange: (event) => {
19549
+ setTtlInput(event.target.value);
19550
+ setTtlError(false);
19551
+ setSaveError(null);
19552
+ setSaveSucceeded(false);
19553
+ }
19554
+ }),
19555
+ h2(GlobalButton, {
19556
+ type: "submit",
19557
+ kind: "primary",
19558
+ className: "dim-globalSaveButton",
19559
+ disabled: !canSave
19560
+ }, isSaving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58"),
19409
19561
  h2(
19410
- "form",
19562
+ "div",
19411
19563
  {
19412
- className: "dim-globalTtlRow",
19413
- onSubmit: (event) => {
19414
- event.preventDefault();
19415
- void commitTtl();
19564
+ className: "dim-globalSweepAction",
19565
+ onBlur: (event) => {
19566
+ if (sweepConfirming && !event.currentTarget.contains(event.relatedTarget)) cancelSweep();
19416
19567
  }
19417
19568
  },
19418
- h2("input", {
19419
- id: "dim-globalTtlInput",
19420
- className: "dim-globalTtlInput",
19421
- type: "text",
19422
- value: ttlInput,
19423
- placeholder: String(DEFAULT_INBOUND_TTL_HOURS),
19424
- autoComplete: "off",
19425
- disabled: phase === "loading" || isSaving,
19426
- "aria-labelledby": "dim-globalTtlTitle",
19427
- "aria-invalid": ttlError ? "true" : void 0,
19428
- "aria-describedby": ttlError ? ttlErrorId : ttlHintsId,
19429
- onBlur: () => {
19430
- setTtlError(normalizeInboundTtlHours(ttlInput.trim()) === null);
19431
- },
19432
- onKeyDown: (event) => {
19433
- if (event.key !== "Enter") return;
19434
- event.preventDefault();
19435
- void commitTtl();
19436
- },
19437
- onChange: (event) => {
19438
- setTtlInput(event.target.value);
19439
- setTtlError(false);
19440
- setSaveError(null);
19441
- setSaveSucceeded(false);
19442
- }
19443
- }),
19444
19569
  h2(GlobalButton, {
19445
- type: "submit",
19446
- kind: "primary",
19447
- className: "dim-globalSaveButton",
19448
- disabled: !canSave
19449
- }, isSaving ? "\u4FDD\u5B58\u4E2D\u2026" : "\u4FDD\u5B58"),
19450
- h2(
19570
+ id: sweepTriggerId,
19571
+ className: "dim-globalSweepButton",
19572
+ onClick: () => sweepConfirming ? cancelSweep() : requestSweep(),
19573
+ disabled: sweeping,
19574
+ "aria-haspopup": "dialog",
19575
+ "aria-expanded": sweepConfirming,
19576
+ "aria-controls": sweepConfirmId
19577
+ }, sweeping ? "\u6B63\u5728\u6E05\u7406\u2026" : "\u6E05\u7406\u8FC7\u671F\u9644\u4EF6"),
19578
+ sweepConfirming ? h2(
19451
19579
  "div",
19452
19580
  {
19453
- className: "dim-globalSweepAction",
19454
- onBlur: (event) => {
19455
- if (sweepConfirming && !event.currentTarget.contains(event.relatedTarget)) cancelSweep();
19581
+ id: sweepConfirmId,
19582
+ className: "dim-globalSweepConfirm",
19583
+ role: "alertdialog",
19584
+ "aria-label": "\u786E\u8BA4\u6E05\u7406\u8FC7\u671F\u9644\u4EF6",
19585
+ "aria-describedby": sweepConfirmTextId,
19586
+ onKeyDown: (event) => {
19587
+ if (event.key !== "Escape") return;
19588
+ event.preventDefault();
19589
+ cancelSweep({ restoreFocus: true });
19456
19590
  }
19457
19591
  },
19458
- h2(GlobalButton, {
19459
- id: sweepTriggerId,
19460
- className: "dim-globalSweepButton",
19461
- onClick: () => sweepConfirming ? cancelSweep() : requestSweep(),
19462
- disabled: sweeping,
19463
- "aria-haspopup": "dialog",
19464
- "aria-expanded": sweepConfirming,
19465
- "aria-controls": sweepConfirmId
19466
- }, sweeping ? "\u6B63\u5728\u6E05\u7406\u2026" : "\u6E05\u7406\u8FC7\u671F\u9644\u4EF6"),
19467
- sweepConfirming ? h2(
19592
+ h2("p", { id: sweepConfirmTextId }, "\u786E\u8BA4\u6E05\u7406\u5F53\u524D\u5DF2\u8FC7\u671F\u7684\u9644\u4EF6\uFF1F"),
19593
+ h2(
19468
19594
  "div",
19469
- {
19470
- id: sweepConfirmId,
19471
- className: "dim-globalSweepConfirm",
19472
- role: "alertdialog",
19473
- "aria-label": "\u786E\u8BA4\u6E05\u7406\u8FC7\u671F\u9644\u4EF6",
19474
- "aria-describedby": sweepConfirmTextId,
19475
- onKeyDown: (event) => {
19476
- if (event.key !== "Escape") return;
19477
- event.preventDefault();
19478
- cancelSweep({ restoreFocus: true });
19479
- }
19480
- },
19481
- h2("p", { id: sweepConfirmTextId }, "\u786E\u8BA4\u6E05\u7406\u5F53\u524D\u5DF2\u8FC7\u671F\u7684\u9644\u4EF6\uFF1F"),
19482
- h2(
19483
- "div",
19484
- { className: "dim-globalSweepConfirmActions" },
19485
- h2(GlobalButton, { onClick: () => cancelSweep({ restoreFocus: true }) }, "\u53D6\u6D88"),
19486
- h2(GlobalButton, {
19487
- id: sweepConfirmButtonId,
19488
- kind: "danger",
19489
- className: "dim-globalSweepConfirmButton",
19490
- onClick: () => void runSweep()
19491
- }, "\u786E\u8BA4\u6E05\u7406")
19492
- )
19493
- ) : null
19494
- ),
19495
- inlineStatus ? h2("p", {
19496
- id: ttlErrorId,
19497
- className: "dim-globalInline",
19498
- "data-tone": inlineStatus.role === "alert" ? "error" : void 0,
19499
- role: inlineStatus.role,
19500
- "aria-live": inlineStatus.role === "status" ? "polite" : void 0
19501
- }, inlineStatus.message) : null
19502
- )
19503
- ),
19504
- h2(ImageInputSettings, { rpcCall })
19505
- )
19595
+ { className: "dim-globalSweepConfirmActions" },
19596
+ h2(GlobalButton, { onClick: () => cancelSweep({ restoreFocus: true }) }, "\u53D6\u6D88"),
19597
+ h2(GlobalButton, {
19598
+ id: sweepConfirmButtonId,
19599
+ kind: "danger",
19600
+ className: "dim-globalSweepConfirmButton",
19601
+ onClick: () => void runSweep()
19602
+ }, "\u786E\u8BA4\u6E05\u7406")
19603
+ )
19604
+ ) : null
19605
+ ),
19606
+ inlineStatus ? h2("p", {
19607
+ id: ttlErrorId,
19608
+ className: "dim-globalInline",
19609
+ "data-tone": inlineStatus.role === "alert" ? "error" : void 0,
19610
+ role: inlineStatus.role,
19611
+ "aria-live": inlineStatus.role === "status" ? "polite" : void 0
19612
+ }, inlineStatus.message) : null
19613
+ )
19614
+ ),
19615
+ h2(ImageInputSettings, { rpcCall })
19616
+ );
19617
+ }
19618
+ function GlobalSettingsPanel({ rpcCall }) {
19619
+ const [tab, setTab] = React37.useState("general");
19620
+ const tabs = [{ key: "general", label: "\u901A\u7528" }, { key: "attachments", label: "\u9644\u4EF6" }];
19621
+ return h2(
19622
+ "section",
19623
+ { className: "dim-generalSettingsPage", "aria-label": "\u901A\u7528\u8BBE\u7F6E" },
19624
+ h2("header", { className: "dim-generalSettingsHeader" }, h2("h2", null, "\u901A\u7528\u8BBE\u7F6E")),
19625
+ h2(
19626
+ "div",
19627
+ { className: "dim-generalSettingsTabsBar" },
19628
+ h2(
19629
+ "div",
19630
+ { className: "dim-generalSettingsTabs", role: "tablist", "aria-label": "\u901A\u7528\u8BBE\u7F6E\u5206\u7C7B" },
19631
+ ...tabs.map((item) => h2("button", {
19632
+ key: item.key,
19633
+ type: "button",
19634
+ id: `dim-general-settings-tab-${item.key}`,
19635
+ className: "dim-generalSettingsTab",
19636
+ role: "tab",
19637
+ "aria-selected": tab === item.key,
19638
+ "aria-controls": `dim-general-settings-panel-${item.key}`,
19639
+ tabIndex: tab === item.key ? 0 : -1,
19640
+ onClick: () => setTab(item.key),
19641
+ onKeyDown: (event) => {
19642
+ if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(event.key)) return;
19643
+ event.preventDefault();
19644
+ const next = event.key === "Home" ? "general" : event.key === "End" ? "attachments" : tab === "general" ? "attachments" : "general";
19645
+ setTab(next);
19646
+ globalThis.document?.getElementById(`dim-general-settings-tab-${next}`)?.focus();
19647
+ }
19648
+ }, item.label))
19649
+ )
19650
+ ),
19651
+ tab === "general" ? h2("div", {
19652
+ id: "dim-general-settings-panel-general",
19653
+ className: "dim-generalSettingsTabPanel",
19654
+ role: "tabpanel",
19655
+ "aria-labelledby": "dim-general-settings-tab-general"
19656
+ }, h2(GroupHistorySettings, { rpcCall })) : h2(AttachmentSettingsPanel, { rpcCall })
19506
19657
  );
19507
19658
  }
19508
19659
 
@@ -19564,6 +19715,7 @@ function replacePageLocation(url, location = globalThis.location) {
19564
19715
  // plugin-src/client/styles.js
19565
19716
  var IM_STYLE_ID = "xmanrui-dsh-im-settings";
19566
19717
  var CSS15 = String.raw`
19718
+ .dim-sidebarIcon { display: block; flex: none; }
19567
19719
  .dim-pluginOpen { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px; border: 1px solid var(--dsw-alias-border-l2, #dfe1e5); border-radius: 8px; color: var(--dsw-alias-label-primary, #1f2329); background: var(--dsw-alias-bg-layer-1, #fff); font: inherit; font-size: 13px; line-height: 20px; cursor: pointer; }
19568
19720
  .dim-pluginOpen:hover { background: var(--dsw-alias-interactive-bg-hover, #f7f8fa); }
19569
19721
  .dim-pluginOpen:focus-visible, .dim-pluginBack:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 3px; }
@@ -20206,10 +20358,11 @@ var CSS15 = String.raw`
20206
20358
  .dim-botGeneralHelp { margin: 0; color: var(--dsw-alias-label-tertiary, #8f959e); font-size: 12px; line-height: 18px; overflow-wrap: anywhere; }
20207
20359
  .dim-botGeneralPanelHelp { padding-bottom: 16px; border-bottom: 1px solid var(--dsw-alias-border-l2, #dfe1e5); }
20208
20360
  .dim-botGeneralControl { position: relative; min-width: 0; max-width: 100%; justify-self: end; color: var(--dsw-alias-label-primary, #1f2329); }
20209
- .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; }
20210
- .dim-botGeneralControl select:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, #eef0f3); }
20211
- .dim-botGeneralControl select:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; }
20212
- .dim-botGeneralControl select:disabled { opacity: .5; cursor: not-allowed; }
20361
+ .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; }
20362
+ .dim-botGeneralControl select { cursor: pointer; }
20363
+ .dim-botGeneralControl select:hover:not(:disabled), .dim-groupHistoryInput:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover, #eef0f3); }
20364
+ .dim-botGeneralControl select:focus-visible, .dim-groupHistoryInput:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary, #3370ff); outline-offset: 2px; }
20365
+ .dim-botGeneralControl select:disabled, .dim-groupHistoryInput:disabled { opacity: .5; cursor: not-allowed; }
20213
20366
  .dim-botGeneralControl svg { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); pointer-events: none; }
20214
20367
  .dim-botGeneralControl .dim-contextSwitch { display: block; }
20215
20368
  .dim-botGeneralControl .dim-contextSwitch:disabled { opacity: .5; cursor: not-allowed; }
@@ -20228,6 +20381,13 @@ var CSS15 = String.raw`
20228
20381
  .dim-generalSettingsTab[aria-selected="true"]::after { background: var(--dim-blue); transform: scaleX(1); }
20229
20382
  .dim-generalSettingsTab:focus-visible { outline: 2px solid var(--dim-blue); outline-offset: -2px; border-radius: 5px; }
20230
20383
  .dim-generalSettingsTabPanel { min-width: 0; padding-top: 14px; }
20384
+ .dim-groupHistoryControl { width: 104px; }
20385
+ .dim-groupHistoryInput { box-sizing: border-box; width: 100%; appearance: textfield; }
20386
+ .dim-groupHistoryInput::-webkit-inner-spin-button, .dim-groupHistoryInput::-webkit-outer-spin-button { margin: 0; appearance: none; }
20387
+ .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; }
20388
+ .dim-deliveryButton.dim-groupHistorySave { min-width: 58px; min-height: 36px; border-radius: 10px; }
20389
+ .dim-groupHistoryFeedback { margin-top: 12px; }
20390
+
20231
20391
  .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); }
20232
20392
  .dim-globalSection + .dim-globalSection { margin-top: 12px; }
20233
20393
  .dim-imageSettings { container-type: inline-size; }
@@ -20609,7 +20769,7 @@ function installSessionChannelLogos(document2 = globalThis.document) {
20609
20769
  }
20610
20770
 
20611
20771
  // plugin-src/client/update-panel.js
20612
- var React37 = __toESM(require("react"), 1);
20772
+ var React38 = __toESM(require("react"), 1);
20613
20773
  var import_react_dom4 = require("react-dom");
20614
20774
  var import_valid = __toESM(require_valid(), 1);
20615
20775
  var import_rcompare = __toESM(require_rcompare(), 1);
@@ -20644,14 +20804,14 @@ var ERROR_MESSAGES = Object.freeze({
20644
20804
  "install-timeout": "\u5B89\u88C5\u8D85\u65F6\uFF0C\u8BF7\u5148\u786E\u8BA4\u5F53\u524D\u5B89\u88C5\u72B6\u6001\uFF0C\u518D\u51B3\u5B9A\u662F\u5426\u91CD\u8BD5\u3002",
20645
20805
  "invalid-version": "npm \u8FD4\u56DE\u7684\u7248\u672C\u4FE1\u606F\u65E0\u6548\uFF0C\u6682\u65F6\u65E0\u6CD5\u66F4\u65B0\u3002"
20646
20806
  });
20647
- function unwrapSnapshot(result) {
20648
- if (result?.ok === false) {
20649
- const error = new Error(result.error?.message || "\u66F4\u65B0\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002");
20650
- error.code = result.error?.code;
20807
+ function unwrapSnapshot(result2) {
20808
+ if (result2?.ok === false) {
20809
+ const error = new Error(result2.error?.message || "\u66F4\u65B0\u8BF7\u6C42\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002");
20810
+ error.code = result2.error?.code;
20651
20811
  throw error;
20652
20812
  }
20653
- const value = result?.value;
20654
- if (result?.ok !== true || typeof value?.runningVersion !== "string" || typeof value?.canInstall !== "boolean") {
20813
+ const value = result2?.value;
20814
+ if (result2?.ok !== true || typeof value?.runningVersion !== "string" || typeof value?.canInstall !== "boolean") {
20655
20815
  throw new Error("\u66F4\u65B0\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002");
20656
20816
  }
20657
20817
  return value;
@@ -20702,11 +20862,11 @@ function manualUpdateCommand(snapshot) {
20702
20862
  return `dsh plugin --profile ${profileArgument} add -w @xmanrui/dsh-im@${version}`;
20703
20863
  }
20704
20864
  function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20705
- const [copyState, setCopyState] = React37.useState("idle");
20706
- const commandRef = React37.useRef(null);
20707
- const mounted = React37.useRef(false);
20708
- const copying = React37.useRef(false);
20709
- React37.useEffect(() => {
20865
+ const [copyState, setCopyState] = React38.useState("idle");
20866
+ const commandRef = React38.useRef(null);
20867
+ const mounted = React38.useRef(false);
20868
+ const copying = React38.useRef(false);
20869
+ React38.useEffect(() => {
20710
20870
  mounted.current = true;
20711
20871
  return () => {
20712
20872
  mounted.current = false;
@@ -20738,7 +20898,7 @@ function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20738
20898
  { className: "dim-updateManual", "aria-label": "\u624B\u5DE5\u66F4\u65B0" },
20739
20899
  h2("h4", { className: "dim-updateManualHeading" }, "\u624B\u5DE5\u66F4\u65B0"),
20740
20900
  command ? h2(
20741
- React37.Fragment,
20901
+ React38.Fragment,
20742
20902
  null,
20743
20903
  h2("p", { className: "dim-updateManualHint" }, "\u81EA\u52A8\u66F4\u65B0\u5931\u8D25\u53EF\u4EE5\u4F7F\u7528\u547D\u4EE4\u66F4\u65B0\uFF1A"),
20744
20904
  h2(
@@ -20774,7 +20934,7 @@ function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20774
20934
  "aria-hidden": "true",
20775
20935
  focusable: "false"
20776
20936
  }, copyState === "copied" ? h2("path", { d: "m4 10 4 4 8-8" }) : h2(
20777
- React37.Fragment,
20937
+ React38.Fragment,
20778
20938
  null,
20779
20939
  h2("rect", { x: 7, y: 7, width: 10, height: 11, rx: 1.5 }),
20780
20940
  h2("path", { d: "M5 13H3.5A1.5 1.5 0 0 1 2 11.5v-8A1.5 1.5 0 0 1 3.5 2h8A1.5 1.5 0 0 1 13 3.5V5" })
@@ -20799,10 +20959,10 @@ function ManualUpdateCommand({ command, disabled, sourceInstall, desktop }) {
20799
20959
  );
20800
20960
  }
20801
20961
  function UpdateDialog({ children, onClose }) {
20802
- const dialogRef = React37.useRef(null);
20803
- const titleId = React37.useId();
20804
- const descriptionId = React37.useId();
20805
- React37.useEffect(() => {
20962
+ const dialogRef = React38.useRef(null);
20963
+ const titleId = React38.useId();
20964
+ const descriptionId = React38.useId();
20965
+ React38.useEffect(() => {
20806
20966
  const previous = globalThis.document?.activeElement;
20807
20967
  dialogRef.current?.focus?.();
20808
20968
  return () => {
@@ -20860,20 +21020,20 @@ function UpdateDialog({ children, onClose }) {
20860
21020
  return typeof document !== "undefined" && document.body ? (0, import_react_dom4.createPortal)(content, document.body) : content;
20861
21021
  }
20862
21022
  function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
20863
- const tooltipId = React37.useId();
20864
- const [snapshot, setSnapshot] = React37.useState(null);
20865
- const [action, setAction] = React37.useState("status");
20866
- const [error, setError] = React37.useState(null);
20867
- const [open, setOpen] = React37.useState(false);
20868
- const [uncertainInstall, setUncertainInstall] = React37.useState(false);
20869
- const mounted = React37.useRef(false);
20870
- const busy = React37.useRef(false);
20871
- const readController = React37.useRef(null);
20872
- const pollReadController = React37.useRef(null);
20873
- const installRequest = React37.useRef(null);
20874
- const onStatusRef = React37.useRef(onStatus);
21023
+ const tooltipId = React38.useId();
21024
+ const [snapshot, setSnapshot] = React38.useState(null);
21025
+ const [action, setAction] = React38.useState("status");
21026
+ const [error, setError] = React38.useState(null);
21027
+ const [open, setOpen] = React38.useState(false);
21028
+ const [uncertainInstall, setUncertainInstall] = React38.useState(false);
21029
+ const mounted = React38.useRef(false);
21030
+ const busy = React38.useRef(false);
21031
+ const readController = React38.useRef(null);
21032
+ const pollReadController = React38.useRef(null);
21033
+ const installRequest = React38.useRef(null);
21034
+ const onStatusRef = React38.useRef(onStatus);
20875
21035
  onStatusRef.current = onStatus;
20876
- const accept = React37.useCallback((next) => {
21036
+ const accept = React38.useCallback((next) => {
20877
21037
  setSnapshot(next);
20878
21038
  onStatusRef.current?.(next);
20879
21039
  }, []);
@@ -20882,7 +21042,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
20882
21042
  setUncertainInstall(false);
20883
21043
  accept(next);
20884
21044
  };
20885
- const invoke = React37.useCallback(async (endpoint, payload = {}, signal) => {
21045
+ const invoke = React38.useCallback(async (endpoint, payload = {}, signal) => {
20886
21046
  if (typeof rpcCall !== "function") {
20887
21047
  const unavailable = new Error("\u5F53\u524D Host \u4E0D\u652F\u6301\u66F4\u65B0\u63A5\u53E3\uFF0C\u8BF7\u5148\u624B\u52A8\u66F4\u65B0\u63D2\u4EF6\u5E76\u91CD\u542F\u3002");
20888
21048
  unavailable.code = "update-unavailable";
@@ -20890,7 +21050,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
20890
21050
  }
20891
21051
  return unwrapSnapshot(await rpcCall(endpoint, payload, signal));
20892
21052
  }, [rpcCall]);
20893
- React37.useEffect(() => {
21053
+ React38.useEffect(() => {
20894
21054
  mounted.current = true;
20895
21055
  busy.current = true;
20896
21056
  const controller = new AbortController();
@@ -20913,7 +21073,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
20913
21073
  const activeJob = ACTIVE_STATES4.has(snapshot?.job?.state);
20914
21074
  const restartRequired = snapshot?.job?.state === "restart-required" || snapshot?.blockedReason === "pending-restart";
20915
21075
  const shouldPoll = activeJob || uncertainInstall;
20916
- React37.useEffect(() => {
21076
+ React38.useEffect(() => {
20917
21077
  if (!shouldPoll) return void 0;
20918
21078
  let controller;
20919
21079
  const scheduler = createPollScheduler({
@@ -21014,7 +21174,7 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21014
21174
  const buttonLabel = action === "checking" ? "\u68C0\u67E5\u4E2D\u2026" : action === "starting" || activeJob ? "\u6B63\u5728\u66F4\u65B0\u2026" : restartRequired ? "\u5F85\u624B\u52A8\u91CD\u542F" : snapshot?.canInstall ? "\u66F4\u65B0\u81F3" : "\u68C0\u67E5\u66F4\u65B0";
21015
21175
  const buttonDescription = localizeText(buttonLabel) + (buttonLabel === "\u66F4\u65B0\u81F3" ? ` v${snapshot.latestVersion}` : "");
21016
21176
  return h2(
21017
- React37.Fragment,
21177
+ React38.Fragment,
21018
21178
  null,
21019
21179
  h2(
21020
21180
  "span",
@@ -21064,25 +21224,25 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21064
21224
  h2("dt", null, "\u8FD0\u884C\u7248\u672C"),
21065
21225
  h2("dd", null, `v${snapshot?.runningVersion ?? clientVersion}`),
21066
21226
  snapshot?.installedVersion && snapshot.installedVersion !== snapshot.runningVersion ? h2(
21067
- React37.Fragment,
21227
+ React38.Fragment,
21068
21228
  null,
21069
21229
  h2("dt", null, "\u5DF2\u5B89\u88C5\u7248\u672C"),
21070
21230
  h2("dd", null, `v${snapshot.installedVersion}`)
21071
21231
  ) : null,
21072
21232
  targetVersion ? h2(
21073
- React37.Fragment,
21233
+ React38.Fragment,
21074
21234
  null,
21075
21235
  h2("dt", null, "\u76EE\u6807\u7248\u672C"),
21076
21236
  h2("dd", null, `v${targetVersion}`)
21077
21237
  ) : null,
21078
21238
  latestVersion ? h2(
21079
- React37.Fragment,
21239
+ React38.Fragment,
21080
21240
  null,
21081
21241
  h2("dt", null, "\u6700\u65B0\u7248\u672C"),
21082
21242
  h2("dd", null, `v${latestVersion}`)
21083
21243
  ) : null,
21084
21244
  historicalTargetVersion ? h2(
21085
- React37.Fragment,
21245
+ React38.Fragment,
21086
21246
  null,
21087
21247
  h2("dt", null, "\u4E0A\u6B21\u66F4\u65B0\u76EE\u6807"),
21088
21248
  h2("dd", null, `v${historicalTargetVersion}`)
@@ -21159,8 +21319,8 @@ function UpdatePanel({ rpcCall, clientVersion, onStatus }) {
21159
21319
  }
21160
21320
 
21161
21321
  // plugin-src/client/panel-error-boundary.js
21162
- var React38 = __toESM(require("react"), 1);
21163
- var IMPanelErrorBoundary = class extends React38.Component {
21322
+ var React39 = __toESM(require("react"), 1);
21323
+ var IMPanelErrorBoundary = class extends React39.Component {
21164
21324
  state = { failed: false };
21165
21325
  static getDerivedStateFromError() {
21166
21326
  return { failed: true };
@@ -21180,9 +21340,9 @@ var IMPanelErrorBoundary = class extends React38.Component {
21180
21340
  };
21181
21341
 
21182
21342
  // plugin-src/client/plugin-page.js
21183
- var React39 = __toESM(require("react"), 1);
21343
+ var React40 = __toESM(require("react"), 1);
21184
21344
  var IM_MAIN_PANEL_ID = "xmanrui-dsh-im";
21185
- var h3 = React39.createElement;
21345
+ var h3 = React40.createElement;
21186
21346
  function OpenImAction({ subject, packageName, onOpen, t }) {
21187
21347
  if (subject?.kind !== "bundle" && subject?.kind !== "row") return null;
21188
21348
  if (subject.pkg?.name !== packageName) return null;
@@ -21210,6 +21370,26 @@ function ImPluginPage({ renderPanel, onBack, t }) {
21210
21370
  )
21211
21371
  );
21212
21372
  }
21373
+ function ImSidebarIcon({ size }) {
21374
+ return h3(
21375
+ "svg",
21376
+ {
21377
+ className: "dim-sidebarIcon",
21378
+ "aria-hidden": true,
21379
+ focusable: false,
21380
+ width: size,
21381
+ height: size,
21382
+ viewBox: "0 0 16 16",
21383
+ fill: "none",
21384
+ stroke: "currentColor",
21385
+ strokeWidth: 1,
21386
+ strokeLinecap: "round",
21387
+ strokeLinejoin: "round"
21388
+ },
21389
+ h3("path", { d: "M5 9.5H3.8L1.5 10.7l.7-2.2A2.4 2.4 0 0 1 1.5 6.8V4A2.5 2.5 0 0 1 4 1.5h4A2.5 2.5 0 0 1 10.5 4v3A2.5 2.5 0 0 1 8 9.5h-.5" }),
21390
+ h3("path", { d: "M12 6.5A2.5 2.5 0 0 1 14.5 9v2.8a2.4 2.4 0 0 1-.7 1.7l.7 1.2-2.3-.7H8A2.5 2.5 0 0 1 5.5 11.5V9A2.5 2.5 0 0 1 8 6.5h.5" })
21391
+ );
21392
+ }
21213
21393
  function installImPluginPage(ctx, { packageName, renderPanel }) {
21214
21394
  if (typeof ctx.inject !== "function") return;
21215
21395
  ctx.inject(["layout", "pluginNavigation"], (pageCtx) => pageCtx.slots.inject("main", () => {
@@ -21222,6 +21402,13 @@ function installImPluginPage(ctx, { packageName, renderPanel }) {
21222
21402
  onBack: () => pageCtx.pluginNavigation.openBundle(packageName)
21223
21403
  })
21224
21404
  }, ImPluginPage);
21405
+ const stopSidebar = pageCtx.slots.inject("sidebar.panellist", () => pageCtx.slots.register({
21406
+ name: "sidebar.panellist",
21407
+ id: IM_MAIN_PANEL_ID,
21408
+ order: 10,
21409
+ label: () => pageCtx.locale.bind(IM_LOCALE_NAMESPACE)("IM\u673A\u5668\u4EBA"),
21410
+ locale: IM_LOCALE_NAMESPACE
21411
+ }, ImSidebarIcon));
21225
21412
  const stopActions = pageCtx.slots.inject("plugins.detail.actions", () => pageCtx.slots.register({
21226
21413
  name: "plugins.detail.actions",
21227
21414
  id: "xmanrui-dsh-im-open",
@@ -21234,6 +21421,7 @@ function installImPluginPage(ctx, { packageName, renderPanel }) {
21234
21421
  }, OpenImAction));
21235
21422
  return () => {
21236
21423
  stopActions();
21424
+ stopSidebar();
21237
21425
  unregisterPage();
21238
21426
  };
21239
21427
  }));
@@ -21413,28 +21601,28 @@ function IMSettingsTab({
21413
21601
  browserLocation = globalThis.location,
21414
21602
  navigateToRecoveryUrl = replacePageLocation
21415
21603
  }) {
21416
- const [selected, setSelected] = React40.useState(() => preferredSectionId === GLOBAL_SETTINGS_TAB_ID || CHANNELS.some((channel7) => channel7.id === preferredSectionId) ? preferredSectionId : "weixin");
21417
- const [loopbackRecovery, setLoopbackRecovery] = React40.useState(null);
21418
- const [runningVersion, setRunningVersion] = React40.useState(IM_PLUGIN_VERSION);
21419
- const [deliverySettings, setDeliverySettings] = React40.useState(null);
21604
+ const [selected, setSelected] = React41.useState(() => preferredSectionId === GLOBAL_SETTINGS_TAB_ID || CHANNELS.some((channel7) => channel7.id === preferredSectionId) ? preferredSectionId : "weixin");
21605
+ const [loopbackRecovery, setLoopbackRecovery] = React41.useState(null);
21606
+ const [runningVersion, setRunningVersion] = React41.useState(IM_PLUGIN_VERSION);
21607
+ const [deliverySettings, setDeliverySettings] = React41.useState(null);
21420
21608
  const emailEnabled = useEmailChannelEnabled(emailRpcCall);
21421
- const visibleChannels = React40.useMemo(
21609
+ const visibleChannels = React41.useMemo(
21422
21610
  () => CHANNELS.filter((channel7) => channel7.id !== "email" || emailEnabled),
21423
21611
  [emailEnabled]
21424
21612
  );
21425
- const githubTooltipId = React40.useId();
21426
- const generalSettingsTooltipId = React40.useId();
21613
+ const githubTooltipId = React41.useId();
21614
+ const generalSettingsTooltipId = React41.useId();
21427
21615
  const globalSettingsSelected = selected === GLOBAL_SETTINGS_TAB_ID;
21428
21616
  const active = visibleChannels.find((channel7) => channel7.id === selected) ?? visibleChannels[0];
21429
21617
  const activeTabId = globalSettingsSelected ? "dim-general-settings-trigger" : `dim-tab-${active.id}`;
21430
21618
  const activePanelId = globalSettingsSelected ? `dim-panel-${GLOBAL_SETTINGS_TAB_ID}` : `dim-panel-${active.id}`;
21431
- const reportLoopbackRecovery = React40.useCallback((recovery) => {
21619
+ const reportLoopbackRecovery = React41.useCallback((recovery) => {
21432
21620
  setLoopbackRecovery((current) => current?.url === recovery.url ? current : recovery);
21433
21621
  }, []);
21434
- const reportUpdateStatus = React40.useCallback((snapshot) => {
21622
+ const reportUpdateStatus = React41.useCallback((snapshot) => {
21435
21623
  setRunningVersion(snapshot.runningVersion);
21436
21624
  }, []);
21437
- const rpcCalls = React40.useMemo(() => createLoopbackAwareRpcCalls({
21625
+ const rpcCalls = React41.useMemo(() => createLoopbackAwareRpcCalls({
21438
21626
  dingtalkRpcCall,
21439
21627
  discordRpcCall,
21440
21628
  feishuRpcCall,
@@ -21476,7 +21664,7 @@ function IMSettingsTab({
21476
21664
  weixinRpcCall,
21477
21665
  whatsappRpcCall
21478
21666
  ]);
21479
- const botSettingsContext = React40.useMemo(() => Object.freeze({
21667
+ const botSettingsContext = React41.useMemo(() => Object.freeze({
21480
21668
  openBotSettings: setDeliverySettings
21481
21669
  }), []);
21482
21670
  return h2(
@@ -21700,7 +21888,7 @@ function apply(ctx) {
21700
21888
  };
21701
21889
  const localeSnapshot = () => ctx.locale.getLocale?.()?.active ?? "";
21702
21890
  function IMPanel({ preferredSectionId }) {
21703
- React40.useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
21891
+ React41.useSyncExternalStore(subscribeLocale, localeSnapshot, localeSnapshot);
21704
21892
  return h2(
21705
21893
  IMPanelErrorBoundary,
21706
21894
  null,
@@ -21710,7 +21898,10 @@ function apply(ctx) {
21710
21898
  const buildPanelElement = (props = {}) => h2(IMPanel, {
21711
21899
  preferredSectionId: props.preferredSectionId
21712
21900
  });
21713
- installImPluginPage(ctx, { packageName: package_default.name, renderPanel: buildPanelElement });
21901
+ installImPluginPage(ctx, {
21902
+ packageName: package_default.name,
21903
+ renderPanel: buildPanelElement
21904
+ });
21714
21905
  ctx.effect(() => {
21715
21906
  let disposed = false;
21716
21907
  let stopSettings = null;