@xmanrui/dsh-im 2.6.0 → 3.0.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.
- package/README.en.md +3 -3
- package/README.md +3 -3
- package/bin/dsh-im.mjs +1 -1
- package/lib/client.js +1409 -1409
- package/lib/index.js +8 -8
- package/package.json +2 -2
- package/plugin-src/client/channels/dingtalk/index.js +0 -17
- package/plugin-src/client/channels/dingtalk/styles.js +2 -2
- package/plugin-src/client/channels/feishu/index.js +0 -29
- package/plugin-src/client/channels/feishu/styles.js +2 -2
- package/plugin-src/client/channels/qq/index.js +0 -9
- package/plugin-src/client/channels/wecom/index.js +0 -9
- package/plugin-src/client/channels/weixin/index.js +0 -19
- package/plugin-src/client/channels/weixin/styles.js +2 -2
- package/plugin-src/client/index.js +4 -4
- package/scripts/verify-package.mjs +48 -11
- package/src/channels/feishu/bridge.mjs +5 -2
- package/src/channels/feishu/message-utils.mjs +1 -1
- package/src/channels/shared/connection-test.mjs +1 -1
- package/src/channels/shared/i18n-en/feishu.mjs +6 -6
- package/src/channels/shared/i18n-en/shared-c.mjs +2 -2
package/lib/index.js
CHANGED
|
@@ -103,7 +103,7 @@ Subsequent messages will use this model and reasoning effort.`,"\u63A8\u7406\u7B
|
|
|
103
103
|
{effort}
|
|
104
104
|
|
|
105
105
|
Current model: {model}
|
|
106
|
-
Subsequent messages will use this reasoning effort.`,"\u7528\u6CD5\uFF1A/compact\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /compact (no arguments)","\u6682\u65E0\u53EF\u538B\u7F29\u7684\u5386\u53F2\u8BB0\u5F55\u3002":"No compactable history yet.","\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\u6216\u6267\u884C\u538B\u7F29\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The current Session is generating a reply or compacting; please try again later.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88\u3002":"Context compaction was cancelled.","\u538B\u7F29\u671F\u95F4\u4F1A\u8BDD\u5386\u53F2\u53D1\u751F\u53D8\u5316\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\uFF0C\u8BF7\u91CD\u8BD5\u3002":"The Session history changed during compaction; the Session was not modified this time, please try again.","\u672A\u80FD\u751F\u6210\u6709\u6548\u7684\u538B\u7F29\u6458\u8981\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\u3002":"Could not produce a useful compaction summary; the Session was not modified this time.","\u4E0A\u4E0B\u6587\u538B\u7F29\u672A\u6B63\u5E38\u5B8C\u6210\uFF0C\u90E8\u5206\u4F1A\u8BDD\u5386\u53F2\u53EF\u80FD\u5DF2\u53D8\u5316\uFF0C\u8BF7\u68C0\u67E5\u4F1A\u8BDD\u540E\u518D\u91CD\u8BD5\u3002":"Context compaction did not finish cleanly; some Session history may have changed. Please inspect the Session before retrying.","\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29\uFF0C\u4F46\u4F1A\u8BDD\u4FDD\u5B58\u5931\u8D25\u3002":"Context was compacted, but saving the Session failed.","\u5DF2\u538B\u7F29 {count} \u6761\u5386\u53F2\u8BB0\u5F55\uFF08\u7EA6 {tokens} \u4E2A token\uFF09\u3002":"Compacted {count} history items (~{tokens} tokens).","\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210\u3002":"Context compaction completed.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\u3002":"Context compaction failed.","\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u7684\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u53D1\u9001\u65B0\u6D88\u606F\u5F00\u542F\u4F1A\u8BDD\u3002":"The Session bound to this chat no longer exists; please send a new message to start a Session.","\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The current Session is generating a reply; please try again later.","\u5F53\u524D Harness \u6682\u4E0D\u652F\u6301\u4ECE\u673A\u5668\u4EBA\u6267\u884C\u4E0A\u4E0B\u6587\u538B\u7F29\u3002":"The current Harness does not support running context compaction from a bot yet.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Context compaction failed; please try again later.","\u5F53\u524D\u673A\u5668\u4EBA\u6CA1\u6709\u53EF\u7528\u7684\u4F1A\u8BDD\u72B6\u6001\u3002":"This bot has no available Session state.","\u5F53\u524D\u804A\u5929\u8FD8\u6CA1\u6709\u53EF\u538B\u7F29\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u53D1\u9001\u4E00\u6761\u6D88\u606F\u3002":"This chat has no Session to compact yet; please send a message first.","\u5F53\u524D\u673A\u5668\u4EBA\u6682\u4E0D\u652F\u6301\u4E0A\u4E0B\u6587\u538B\u7F29\u3002":"This bot does not support context compaction yet.","\u5F53\u524D Harness \u672A\u6CE8\u518C /compact \u547D\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u4E0A\u4E0B\u6587\u538B\u7F29\u7EC4\u4EF6\u5DF2\u542F\u7528\u3002":"The current Harness has not registered the /compact command; please make sure the context compaction component is enabled.","\u7528\u6CD5\uFF1A/stop\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /stop (no arguments)","\u7528\u6CD5\uFF1A/version\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /version (no arguments)","\u7528\u6CD5\uFF1A/steer <\u8865\u5145\u6307\u4EE4>":"Usage: /steer <additional instruction>","\u63A7\u5236\u547D\u4EE4\u4EC5\u652F\u6301\u7EAF\u6587\u5B57\uFF0C\u8BF7\u79FB\u9664\u56FE\u7247\u540E\u91CD\u8BD5\u3002":"Control commands support text only; please remove images and try again.","\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002":"This chat has no running task.","\u5DF2\u8BF7\u6C42\u505C\u6B62\u5F53\u524D\u4EFB\u52A1\u3002":"Stop requested for the current task.","\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\uFF0C\u8BF7\u76F4\u63A5\u53D1\u9001\u666E\u901A\u6D88\u606F\u3002":"This chat has no running task; just send a regular message.","\u5F53\u524D\u804A\u5929\u6CA1\u6709\u7ED1\u5B9A\u4F1A\u8BDD\uFF0C\u65E0\u6CD5\u8865\u5145\u6307\u4EE4\u3002\u8BF7\u5148\u7ED1\u5B9A\u4F1A\u8BDD\u3002":"No session is bound to this chat, so an additional instruction cannot be given. Bind a session first.","\u4EFB\u52A1\u5DF2\u7ED3\u675F\uFF0C\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\uFF0C\u65E0\u6CD5\u8865\u5145\u6307\u4EE4\u3002\u8BF7\u76F4\u63A5\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u65B0\u4EFB\u52A1\u3002":"The task has ended and there is no running task to steer. Send a message to start a new task.","\u5DF2\u63D0\u4EA4\u8865\u5145\u6307\u4EE4\uFF0CAgent \u4F1A\u5728\u4E0B\u4E00\u6B65\u8BFB\u53D6\u3002":"Additional instruction submitted; the Agent will read it at the next step."};var JU={"\u8BF7\u7CBE\u51C6\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\uFF08\u4E5F\u652F\u6301\uFF1A\u540C\u610F / \u4E0D\u540C\u610F / yes / no\uFF09\u3002":"Please reply exactly with \u300C\u6279\u51C6\u300D (approve) or \u300C\u62D2\u7EDD\u300D (reject). Also accepted: \u540C\u610F / \u4E0D\u540C\u610F / yes / no.","\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u95EE\u9898\uFF0C\u518D\u7CBE\u51C6\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002":"Please finish the current question first, then reply exactly with \u300C\u6279\u51C6\u300D (approve) or \u300C\u62D2\u7EDD\u300D (reject).","\u8BE5\u5BA1\u6279\u5DF2\u5904\u7406\uFF0C\u65E0\u9700\u518D\u6B21\u56DE\u590D\u3002":"This approval has already been handled; no need to reply again.","DeepSeek Harness \u9700\u8981\u4F60\u7684\u5BA1\u6279\uFF1A":"DeepSeek Harness needs your approval:","\u5DE5\u5177\uFF1A{tool}":"Tool: {tool}","\u64CD\u4F5C\u53C2\u6570\uFF1A":"Operation parameters:","\u539F\u56E0\uFF1A{reason}":"Reason: {reason}","\u7FA4\u804A\u4E2D\u8BF7 @\u673A\u5668\u4EBA \u540E\u53D1\u9001\u5BA1\u6279\u51B3\u5B9A\u3002":"In group chats, please @ the bot before sending your approval decision.","\u53EA\u6709\u53D1\u8D77\u5F53\u524D\u4EFB\u52A1\u7684\u7528\u6237\u53EF\u4EE5\u5904\u7406\u8FD9\u6761\u5BA1\u6279\u3002":"Only the user who started the current task can handle this approval.","\u5BA1\u6279\u51B3\u5B9A\u6B63\u5728\u63D0\u4EA4\uFF0C\u8BF7\u7A0D\u5019\u3002":"Your approval decision is being submitted; please wait.","\u5DF2\u6279\u51C6\uFF0C\u4EC5\u5BF9\u672C\u6B21\u64CD\u4F5C\u6709\u6548\u3002":"Approved \u2014 valid for this operation only.","\u5DF2\u62D2\u7EDD\u6B64\u6B21\u64CD\u4F5C\u3002":"This operation was rejected.","\u65E0\u6CD5\u5B8C\u6574\u5C55\u793A\u8FD9\u6B21\u64CD\u4F5C\uFF0C\u5DF2\u5B89\u5168\u62D2\u7EDD\u6B64\u6B21\u5BA1\u6279\u3002":"The operation could not be displayed in full, so this approval was safely rejected.","\u5BA1\u6279\u63D0\u4EA4\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002":"Failed to submit the approval; please reply with \u300C\u6279\u51C6\u300D (approve) or \u300C\u62D2\u7EDD\u300D (reject) again.","DeepSeek Harness \u9700\u8981\u4F60\u8865\u5145\u4FE1\u606F{progress}\uFF1A":"DeepSeek Harness needs more information{progress}:","\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u7B54\u3002":"Please enter your answer.","\u8BF7\u56DE\u590D\u9009\u9879\u5E8F\u53F7\u6216\u6587\u5B57\uFF1B\u591A\u9009\u7528\u9017\u53F7\u5206\u9694\uFF0C\u4E5F\u53EF\u8865\u5145\u5176\u4ED6\u5185\u5BB9\u3002":"Reply with option numbers or text; separate multiple choices with commas, or add anything else.","\u8BF7\u56DE\u590D\u4E00\u4E2A\u9009\u9879\u5E8F\u53F7\u6216\u6587\u5B57\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u5176\u4ED6\u7B54\u6848\u3002":"Reply with an option number or its text, or type your own answer directly.","\u8BF7\u76F4\u63A5\u56DE\u590D\u4F60\u7684\u7B54\u6848\u3002":"Please reply with your answer directly.","\u7FA4\u804A\u4E2D\u8BF7 @\u673A\u5668\u4EBA \u540E\u53D1\u9001\u7B54\u6848\u3002":"In group chats, please @ the bot before sending your answer.","\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u56FE\u7247\uFF0C\u8BF7\u7528 /models \u67E5\u770B\u53EF\u7528\u6A21\u578B\uFF0C\u518D\u7528 /model <\u5E8F\u53F7> \u5207\u6362\u540E\u91CD\u53D1\u3002":"The current model does not support images. Use /models to list available models, switch with /model <number>, then resend.","\u56FE\u7247\u8D85\u8FC7\u5BBF\u4E3B\u5141\u8BB8\u7684\u5927\u5C0F\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The image exceeds the size allowed by the host; compress it and try again.","\u56FE\u7247\u5206\u8FA8\u7387\u8FC7\u9AD8\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The image resolution is too high; compress it and try again.","\u56FE\u7247\u5185\u5BB9\u65E0\u6548\u6216\u683C\u5F0F\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"The image content is invalid or its format is unsupported; please resend it.","\u672A\u80FD\u8BFB\u53D6\u56FE\u7247\u5185\u5BB9\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"Could not read the image content; please resend it.","\u56FE\u7247\u683C\u5F0F\u4E0E\u5B9E\u9645\u5185\u5BB9\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"The image format does not match its actual content; please resend it.","\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u6570\u91CF\u8D85\u8FC7\u5BBF\u4E3B\u9650\u5236\uFF0C\u8BF7\u51CF\u5C11\u540E\u91CD\u8BD5\u3002":"The number of images sent at once exceeds the host limit; send fewer and try again.","\u56FE\u7247\u603B\u5927\u5C0F\u8D85\u8FC7\u5BBF\u4E3B\u9650\u5236\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The total image size exceeds the host limit; send fewer images or compress them and try again.","\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\u53D1\u751F\u4E86\u91CD\u5B9A\u5411\uFF0C\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u3002":"The image download URL redirected and cannot be read right now.","\u56FE\u7247\u4E0B\u8F7D\u5931\u8D25\uFF08HTTP {status}\uFF09\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"Image download failed (HTTP {status}); please resend it and try again.","\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The image is larger than 5 MB; compress it and try again.","\u4E00\u6B21\u6700\u591A\u53EA\u80FD\u5904\u7406 {maxImages} \u5F20\u56FE\u7247\u3002":"At most {maxImages} images can be processed at once.","\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u603B\u5927\u5C0F\u8FC7\u5927\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6570\u91CF\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The total size of the images sent is too large; send fewer images or compress them and try again.","\u56FE\u7247\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"Image download failed; please resend it and try again.","\u6682\u4E0D\u652F\u6301\u8BE5\u56FE\u7247\u683C\u5F0F\uFF0C\u8BF7\u53D1\u9001 JPEG\u3001PNG\u3001WebP \u6216 GIF \u56FE\u7247\u3002":"This image format is not supported yet; please send a JPEG, PNG, WebP, or GIF image.","\u2705 DeepSeek Harness \u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F":"\u2705 DeepSeek Harness connection test succeeded","\u8FD9\u6761\u6D88\u606F\u7531\u63D2\u4EF6\u9875\u9762\u4E2D\u7684\u201C{name}\u201D\u673A\u5668\u4EBA\u5361\u7247\u53D1\u51FA\u3002":'This message was sent from the "{name}" bot card on the plugin page.',"{channelLabel}\u5C1A\u672A\u6536\u5230\u53EF\u7528\u4E8E\u6D4B\u8BD5\u7684\u79C1\u804A\u6D88\u606F\u3002":"The {channelLabel} has not received a direct message that can be used for testing yet.",\u673A\u5668\u4EBA:"bot","\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026","\u5904\u7406\u5B8C\u6210\u3002":"Processing complete.",\u5DE5\u5177:"tool","\u6B63\u5728\u6574\u7406\u7ED3\u679C\u2026":"Gathering results\u2026","_\u6B63\u5728\u641C\u7D22\u7F51\u7EDC\u5E76\u6574\u7406\u4FE1\u606F\u2026_":"_Searching the web and gathering information\u2026_","_\u6B63\u5728\u4F7F\u7528 {name}\u2026_":"_Using {name}\u2026_","\u8BF7\u5206\u6790\u8FD9\u5F20\u56FE\u7247\u3002":"Analyze this image.","\u6587\u4EF6\u63A5\u6536\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"File reception failed. Please resend it.","\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"File download failed. Please resend it.","Agent Preset \u65E0\u6548\u3002":"Invalid Agent Preset.","/batch \u5F00\u59CB\u6279\u91CF\u8F93\u5165\uFF08\u4EC5\u79C1\u804A\uFF0C\u6700\u591A 10 \u6761\u6587\u5B57\uFF09":"/batch Start batch input (direct messages only, up to 10 text messages)","/send \u63D0\u4EA4\u5F53\u524D\u6279\u6B21":"/send Submit the current batch","/cancel \u53D6\u6D88\u5F53\u524D\u6279\u6B21":"/cancel Cancel the current batch","\u5F00\u59CB\u6279\u91CF\u8F93\u5165\uFF08\u4EC5\u79C1\u804A\uFF09":"Start batch input (direct messages only)",\u63D0\u4EA4\u5F53\u524D\u6279\u6B21:"Submit the current batch",\u53D6\u6D88\u5F53\u524D\u6279\u6B21:"Cancel the current batch","\u5F53\u524D\u5DF2\u5904\u4E8E\u6279\u91CF\u8F93\u5165\u6A21\u5F0F\uFF0C\u5DF2\u6536\u96C6 {count}/{limit} \u6761\u3002\n\u8BF7\u53D1\u9001 /send \u63D0\u4EA4\u6216 /cancel \u53D6\u6D88\u3002":`Batch input is already active with {count}/{limit} messages collected.
|
|
106
|
+
Subsequent messages will use this reasoning effort.`,"\u7528\u6CD5\uFF1A/compact\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /compact (no arguments)","\u6682\u65E0\u53EF\u538B\u7F29\u7684\u5386\u53F2\u8BB0\u5F55\u3002":"No compactable history yet.","\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\u6216\u6267\u884C\u538B\u7F29\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The current Session is generating a reply or compacting; please try again later.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88\u3002":"Context compaction was cancelled.","\u538B\u7F29\u671F\u95F4\u4F1A\u8BDD\u5386\u53F2\u53D1\u751F\u53D8\u5316\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\uFF0C\u8BF7\u91CD\u8BD5\u3002":"The Session history changed during compaction; the Session was not modified this time, please try again.","\u672A\u80FD\u751F\u6210\u6709\u6548\u7684\u538B\u7F29\u6458\u8981\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\u3002":"Could not produce a useful compaction summary; the Session was not modified this time.","\u4E0A\u4E0B\u6587\u538B\u7F29\u672A\u6B63\u5E38\u5B8C\u6210\uFF0C\u90E8\u5206\u4F1A\u8BDD\u5386\u53F2\u53EF\u80FD\u5DF2\u53D8\u5316\uFF0C\u8BF7\u68C0\u67E5\u4F1A\u8BDD\u540E\u518D\u91CD\u8BD5\u3002":"Context compaction did not finish cleanly; some Session history may have changed. Please inspect the Session before retrying.","\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29\uFF0C\u4F46\u4F1A\u8BDD\u4FDD\u5B58\u5931\u8D25\u3002":"Context was compacted, but saving the Session failed.","\u5DF2\u538B\u7F29 {count} \u6761\u5386\u53F2\u8BB0\u5F55\uFF08\u7EA6 {tokens} \u4E2A token\uFF09\u3002":"Compacted {count} history items (~{tokens} tokens).","\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210\u3002":"Context compaction completed.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\u3002":"Context compaction failed.","\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u7684\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u53D1\u9001\u65B0\u6D88\u606F\u5F00\u542F\u4F1A\u8BDD\u3002":"The Session bound to this chat no longer exists; please send a new message to start a Session.","\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The current Session is generating a reply; please try again later.","\u5F53\u524D Harness \u6682\u4E0D\u652F\u6301\u4ECE\u673A\u5668\u4EBA\u6267\u884C\u4E0A\u4E0B\u6587\u538B\u7F29\u3002":"The current Harness does not support running context compaction from a bot yet.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Context compaction failed; please try again later.","\u5F53\u524D\u673A\u5668\u4EBA\u6CA1\u6709\u53EF\u7528\u7684\u4F1A\u8BDD\u72B6\u6001\u3002":"This bot has no available Session state.","\u5F53\u524D\u804A\u5929\u8FD8\u6CA1\u6709\u53EF\u538B\u7F29\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u53D1\u9001\u4E00\u6761\u6D88\u606F\u3002":"This chat has no Session to compact yet; please send a message first.","\u5F53\u524D\u673A\u5668\u4EBA\u6682\u4E0D\u652F\u6301\u4E0A\u4E0B\u6587\u538B\u7F29\u3002":"This bot does not support context compaction yet.","\u5F53\u524D Harness \u672A\u6CE8\u518C /compact \u547D\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u4E0A\u4E0B\u6587\u538B\u7F29\u7EC4\u4EF6\u5DF2\u542F\u7528\u3002":"The current Harness has not registered the /compact command; please make sure the context compaction component is enabled.","\u7528\u6CD5\uFF1A/stop\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /stop (no arguments)","\u7528\u6CD5\uFF1A/version\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /version (no arguments)","\u7528\u6CD5\uFF1A/steer <\u8865\u5145\u6307\u4EE4>":"Usage: /steer <additional instruction>","\u63A7\u5236\u547D\u4EE4\u4EC5\u652F\u6301\u7EAF\u6587\u5B57\uFF0C\u8BF7\u79FB\u9664\u56FE\u7247\u540E\u91CD\u8BD5\u3002":"Control commands support text only; please remove images and try again.","\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002":"This chat has no running task.","\u5DF2\u8BF7\u6C42\u505C\u6B62\u5F53\u524D\u4EFB\u52A1\u3002":"Stop requested for the current task.","\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\uFF0C\u8BF7\u76F4\u63A5\u53D1\u9001\u666E\u901A\u6D88\u606F\u3002":"This chat has no running task; just send a regular message.","\u5F53\u524D\u804A\u5929\u6CA1\u6709\u7ED1\u5B9A\u4F1A\u8BDD\uFF0C\u65E0\u6CD5\u8865\u5145\u6307\u4EE4\u3002\u8BF7\u5148\u7ED1\u5B9A\u4F1A\u8BDD\u3002":"No session is bound to this chat, so an additional instruction cannot be given. Bind a session first.","\u4EFB\u52A1\u5DF2\u7ED3\u675F\uFF0C\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\uFF0C\u65E0\u6CD5\u8865\u5145\u6307\u4EE4\u3002\u8BF7\u76F4\u63A5\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u65B0\u4EFB\u52A1\u3002":"The task has ended and there is no running task to steer. Send a message to start a new task.","\u5DF2\u63D0\u4EA4\u8865\u5145\u6307\u4EE4\uFF0CAgent \u4F1A\u5728\u4E0B\u4E00\u6B65\u8BFB\u53D6\u3002":"Additional instruction submitted; the Agent will read it at the next step."};var JU={"\u8BF7\u7CBE\u51C6\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\uFF08\u4E5F\u652F\u6301\uFF1A\u540C\u610F / \u4E0D\u540C\u610F / yes / no\uFF09\u3002":"Please reply exactly with \u300C\u6279\u51C6\u300D (approve) or \u300C\u62D2\u7EDD\u300D (reject). Also accepted: \u540C\u610F / \u4E0D\u540C\u610F / yes / no.","\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u95EE\u9898\uFF0C\u518D\u7CBE\u51C6\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002":"Please finish the current question first, then reply exactly with \u300C\u6279\u51C6\u300D (approve) or \u300C\u62D2\u7EDD\u300D (reject).","\u8BE5\u5BA1\u6279\u5DF2\u5904\u7406\uFF0C\u65E0\u9700\u518D\u6B21\u56DE\u590D\u3002":"This approval has already been handled; no need to reply again.","DeepSeek Harness \u9700\u8981\u4F60\u7684\u5BA1\u6279\uFF1A":"DeepSeek Harness needs your approval:","\u5DE5\u5177\uFF1A{tool}":"Tool: {tool}","\u64CD\u4F5C\u53C2\u6570\uFF1A":"Operation parameters:","\u539F\u56E0\uFF1A{reason}":"Reason: {reason}","\u7FA4\u804A\u4E2D\u8BF7 @\u673A\u5668\u4EBA \u540E\u53D1\u9001\u5BA1\u6279\u51B3\u5B9A\u3002":"In group chats, please @ the bot before sending your approval decision.","\u53EA\u6709\u53D1\u8D77\u5F53\u524D\u4EFB\u52A1\u7684\u7528\u6237\u53EF\u4EE5\u5904\u7406\u8FD9\u6761\u5BA1\u6279\u3002":"Only the user who started the current task can handle this approval.","\u5BA1\u6279\u51B3\u5B9A\u6B63\u5728\u63D0\u4EA4\uFF0C\u8BF7\u7A0D\u5019\u3002":"Your approval decision is being submitted; please wait.","\u5DF2\u6279\u51C6\uFF0C\u4EC5\u5BF9\u672C\u6B21\u64CD\u4F5C\u6709\u6548\u3002":"Approved \u2014 valid for this operation only.","\u5DF2\u62D2\u7EDD\u6B64\u6B21\u64CD\u4F5C\u3002":"This operation was rejected.","\u65E0\u6CD5\u5B8C\u6574\u5C55\u793A\u8FD9\u6B21\u64CD\u4F5C\uFF0C\u5DF2\u5B89\u5168\u62D2\u7EDD\u6B64\u6B21\u5BA1\u6279\u3002":"The operation could not be displayed in full, so this approval was safely rejected.","\u5BA1\u6279\u63D0\u4EA4\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002":"Failed to submit the approval; please reply with \u300C\u6279\u51C6\u300D (approve) or \u300C\u62D2\u7EDD\u300D (reject) again.","DeepSeek Harness \u9700\u8981\u4F60\u8865\u5145\u4FE1\u606F{progress}\uFF1A":"DeepSeek Harness needs more information{progress}:","\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u7B54\u3002":"Please enter your answer.","\u8BF7\u56DE\u590D\u9009\u9879\u5E8F\u53F7\u6216\u6587\u5B57\uFF1B\u591A\u9009\u7528\u9017\u53F7\u5206\u9694\uFF0C\u4E5F\u53EF\u8865\u5145\u5176\u4ED6\u5185\u5BB9\u3002":"Reply with option numbers or text; separate multiple choices with commas, or add anything else.","\u8BF7\u56DE\u590D\u4E00\u4E2A\u9009\u9879\u5E8F\u53F7\u6216\u6587\u5B57\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u5176\u4ED6\u7B54\u6848\u3002":"Reply with an option number or its text, or type your own answer directly.","\u8BF7\u76F4\u63A5\u56DE\u590D\u4F60\u7684\u7B54\u6848\u3002":"Please reply with your answer directly.","\u7FA4\u804A\u4E2D\u8BF7 @\u673A\u5668\u4EBA \u540E\u53D1\u9001\u7B54\u6848\u3002":"In group chats, please @ the bot before sending your answer.","\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u56FE\u7247\uFF0C\u8BF7\u7528 /models \u67E5\u770B\u53EF\u7528\u6A21\u578B\uFF0C\u518D\u7528 /model <\u5E8F\u53F7> \u5207\u6362\u540E\u91CD\u53D1\u3002":"The current model does not support images. Use /models to list available models, switch with /model <number>, then resend.","\u56FE\u7247\u8D85\u8FC7\u5BBF\u4E3B\u5141\u8BB8\u7684\u5927\u5C0F\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The image exceeds the size allowed by the host; compress it and try again.","\u56FE\u7247\u5206\u8FA8\u7387\u8FC7\u9AD8\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The image resolution is too high; compress it and try again.","\u56FE\u7247\u5185\u5BB9\u65E0\u6548\u6216\u683C\u5F0F\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"The image content is invalid or its format is unsupported; please resend it.","\u672A\u80FD\u8BFB\u53D6\u56FE\u7247\u5185\u5BB9\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"Could not read the image content; please resend it.","\u56FE\u7247\u683C\u5F0F\u4E0E\u5B9E\u9645\u5185\u5BB9\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"The image format does not match its actual content; please resend it.","\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u6570\u91CF\u8D85\u8FC7\u5BBF\u4E3B\u9650\u5236\uFF0C\u8BF7\u51CF\u5C11\u540E\u91CD\u8BD5\u3002":"The number of images sent at once exceeds the host limit; send fewer and try again.","\u56FE\u7247\u603B\u5927\u5C0F\u8D85\u8FC7\u5BBF\u4E3B\u9650\u5236\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The total image size exceeds the host limit; send fewer images or compress them and try again.","\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\u53D1\u751F\u4E86\u91CD\u5B9A\u5411\uFF0C\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u3002":"The image download URL redirected and cannot be read right now.","\u56FE\u7247\u4E0B\u8F7D\u5931\u8D25\uFF08HTTP {status}\uFF09\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"Image download failed (HTTP {status}); please resend it and try again.","\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The image is larger than 5 MB; compress it and try again.","\u4E00\u6B21\u6700\u591A\u53EA\u80FD\u5904\u7406 {maxImages} \u5F20\u56FE\u7247\u3002":"At most {maxImages} images can be processed at once.","\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u603B\u5927\u5C0F\u8FC7\u5927\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6570\u91CF\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002":"The total size of the images sent is too large; send fewer images or compress them and try again.","\u56FE\u7247\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"Image download failed; please resend it and try again.","\u6682\u4E0D\u652F\u6301\u8BE5\u56FE\u7247\u683C\u5F0F\uFF0C\u8BF7\u53D1\u9001 JPEG\u3001PNG\u3001WebP \u6216 GIF \u56FE\u7247\u3002":"This image format is not supported yet; please send a JPEG, PNG, WebP, or GIF image.","\u2705 DeepSeek Harness \u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F":"\u2705 DeepSeek Harness connection test succeeded","\u8FD9\u6761\u6D88\u606F\u7531\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u4E2D\u7684\u201C{name}\u201D\u673A\u5668\u4EBA\u5361\u7247\u53D1\u51FA\u3002":'This message was sent from the "{name}" bot card on the IM Bot settings page.',"{channelLabel}\u5C1A\u672A\u6536\u5230\u53EF\u7528\u4E8E\u6D4B\u8BD5\u7684\u79C1\u804A\u6D88\u606F\u3002":"The {channelLabel} has not received a direct message that can be used for testing yet.",\u673A\u5668\u4EBA:"bot","\u6B63\u5728\u5904\u7406\u2026":"Processing\u2026","\u5904\u7406\u5B8C\u6210\u3002":"Processing complete.",\u5DE5\u5177:"tool","\u6B63\u5728\u6574\u7406\u7ED3\u679C\u2026":"Gathering results\u2026","_\u6B63\u5728\u641C\u7D22\u7F51\u7EDC\u5E76\u6574\u7406\u4FE1\u606F\u2026_":"_Searching the web and gathering information\u2026_","_\u6B63\u5728\u4F7F\u7528 {name}\u2026_":"_Using {name}\u2026_","\u8BF7\u5206\u6790\u8FD9\u5F20\u56FE\u7247\u3002":"Analyze this image.","\u6587\u4EF6\u63A5\u6536\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"File reception failed. Please resend it.","\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002":"File download failed. Please resend it.","Agent Preset \u65E0\u6548\u3002":"Invalid Agent Preset.","/batch \u5F00\u59CB\u6279\u91CF\u8F93\u5165\uFF08\u4EC5\u79C1\u804A\uFF0C\u6700\u591A 10 \u6761\u6587\u5B57\uFF09":"/batch Start batch input (direct messages only, up to 10 text messages)","/send \u63D0\u4EA4\u5F53\u524D\u6279\u6B21":"/send Submit the current batch","/cancel \u53D6\u6D88\u5F53\u524D\u6279\u6B21":"/cancel Cancel the current batch","\u5F00\u59CB\u6279\u91CF\u8F93\u5165\uFF08\u4EC5\u79C1\u804A\uFF09":"Start batch input (direct messages only)",\u63D0\u4EA4\u5F53\u524D\u6279\u6B21:"Submit the current batch",\u53D6\u6D88\u5F53\u524D\u6279\u6B21:"Cancel the current batch","\u5F53\u524D\u5DF2\u5904\u4E8E\u6279\u91CF\u8F93\u5165\u6A21\u5F0F\uFF0C\u5DF2\u6536\u96C6 {count}/{limit} \u6761\u3002\n\u8BF7\u53D1\u9001 /send \u63D0\u4EA4\u6216 /cancel \u53D6\u6D88\u3002":`Batch input is already active with {count}/{limit} messages collected.
|
|
107
107
|
Send /send to submit or /cancel to cancel.`,"\u5F53\u524D\u5DF2\u5904\u4E8E\u6279\u91CF\u8F93\u5165\u6A21\u5F0F\uFF0C\u5DF2\u6536\u96C6 {count}/{limit} \u6761\u3002\n\u5B8C\u6210\u540E\u53D1\u9001 /send\uFF0C\u53D6\u6D88\u8BF7\u53D1\u9001 /cancel\u3002":`Batch input is already active with {count}/{limit} messages collected.
|
|
108
108
|
Send /send when finished or /cancel to cancel.`,"[\u6D88\u606F {index}]":"[Message {index}]","\u4EE5\u4E0B\u662F\u7528\u6237\u901A\u8FC7\u6279\u91CF\u8F93\u5165\u6A21\u5F0F\u53D1\u9001\u7684\u591A\u6761\u5185\u5BB9\uFF0C\u8BF7\u6309\u987A\u5E8F\u4F5C\u4E3A\u540C\u4E00\u6B21\u8F93\u5165\u7EDF\u4E00\u5904\u7406\u3002":"The user sent the following messages in batch input mode. Process them in order as one input.","\u6279\u91CF\u8F93\u5165\u6A21\u5F0F\u4EC5\u652F\u6301\u79C1\u804A\uFF0C\u8BF7\u5728\u4E0E\u673A\u5668\u4EBA\u7684\u79C1\u804A\u4E2D\u4F7F\u7528\u3002":"Batch input is available only in direct messages. Please use it in a direct chat with the bot.","\u5F53\u524D\u804A\u5929\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3001\u5F85\u56DE\u7B54\u95EE\u9898\u6216\u5F85\u5BA1\u6279\u8BF7\u6C42\u3002\n\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u4EA4\u4E92\u6216\u53D1\u9001 /stop\uFF0C\u518D\u4F7F\u7528 /batch\u3002":`This chat has a running task, unanswered question, or pending approval.
|
|
109
109
|
Finish the current interaction or send /stop before using /batch.`,"\u7528\u6CD5\uFF1A/{command}\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09":"Usage: /{command} (without arguments)","\u6279\u91CF\u8F93\u5165\u547D\u4EE4\u4EC5\u652F\u6301\u7EAF\u6587\u5B57\uFF0C\u8BF7\u79FB\u9664\u56FE\u7247\u6216\u6587\u4EF6\u540E\u91CD\u8BD5\u3002":"Batch input commands support text only. Remove the image or file and try again.","\u5F53\u524D\u6CA1\u6709\u5F85\u63D0\u4EA4\u7684\u6279\u91CF\u5185\u5BB9\uFF0C\u8BF7\u5148\u53D1\u9001 /batch\u3002":"There is no batch to submit. Send /batch first.","\u5F53\u524D\u6CA1\u6709\u6B63\u5728\u8FDB\u884C\u7684\u6279\u91CF\u8F93\u5165\u3002":"There is no active batch input.","\u5DF2\u8FDB\u5165\u6279\u91CF\u8F93\u5165\u6A21\u5F0F\uFF0C\u6700\u591A\u53EF\u53D1\u9001 {limit} \u6761\u6587\u5B57\u3002\n\u5B8C\u6210\u540E\u53D1\u9001 /send\uFF0C\u53D6\u6D88\u8BF7\u53D1\u9001 /cancel\u3002":`Batch input started. You can send up to {limit} text messages.
|
|
@@ -111,7 +111,7 @@ Send /send when finished or /cancel to cancel.`,"\u6279\u91CF\u8F93\u5165\u6A21\
|
|
|
111
111
|
Continue with text, or use /send or /cancel.`,"\u5F53\u524D\u6279\u6B21\u6B63\u5728\u63D0\u4EA4\uFF0C\u8BF7\u52FF\u91CD\u590D\u53D1\u9001 /send\u3002":"The current batch is being submitted. Do not send /send again.","\u6279\u91CF\u5185\u5BB9\u5DF2\u7ECF\u63D0\u4EA4\uFF0C\u65E0\u6CD5\u53D6\u6D88\u3002\n\u5982\u9700\u505C\u6B62\u5F53\u524D\u4EFB\u52A1\uFF0C\u8BF7\u53D1\u9001 /stop\u3002":`The batch has already been submitted and cannot be cancelled.
|
|
112
112
|
Send /stop if you need to stop the current task.`,"\u5F53\u524D\u6279\u6B21\u6B63\u5728\u63D0\u4EA4\uFF0C\u8BF7\u7B49\u5F85\u5904\u7406\u5B8C\u6210\u540E\u518D\u5F00\u542F\u65B0\u6279\u6B21\u3002":"The current batch is being submitted. Wait for it to finish before starting another batch.","\u5DF2\u53D6\u6D88\u6279\u91CF\u8F93\u5165\u3002":"Batch input cancelled.","\u5DF2\u53D6\u6D88\u6279\u91CF\u8F93\u5165\uFF0C\u5171\u4E22\u5F03 {count} \u6761\u6D88\u606F\u3002":"Batch input cancelled; {count} messages were discarded.","\u5F53\u524D\u6279\u6B21\u8FD8\u6CA1\u6709\u5185\u5BB9\uFF0C\u8BF7\u5148\u53D1\u9001\u6587\u5B57\uFF0C\u6216\u4F7F\u7528 /cancel \u53D6\u6D88\u3002":"The current batch is empty. Send some text first or use /cancel.","\u5F53\u524D\u6B63\u5728\u6279\u91CF\u8F93\u5165\uFF0C\u8BF7\u5148\u53D1\u9001 /send \u63D0\u4EA4\u6216 /cancel \u53D6\u6D88\u3002":"Batch input is active. Send /send to submit or /cancel to cancel first.","\u5F53\u524D\u6279\u6B21\u5DF2\u6EE1\uFF0C\u8FD9\u6761\u6D88\u606F\u672A\u6536\u5F55\u3002\n\u8BF7\u5148\u53D1\u9001 /send \u63D0\u4EA4\u6216 /cancel \u53D6\u6D88\uFF0C\u7136\u540E\u91CD\u65B0\u53D1\u9001\u8FD9\u6761\u6D88\u606F\u3002":`The current batch is full, so this message was not collected.
|
|
113
113
|
Send /send or /cancel first, then resend this message.`,"\u5DF2\u6536\u96C6 {count}/{limit} \u6761\uFF0C\u5F53\u524D\u6279\u6B21\u5DF2\u6EE1\uFF0C\u8BF7\u53D1\u9001 /send \u63D0\u4EA4\u6216 /cancel \u53D6\u6D88\u3002":"Collected {count}/{limit} messages. The batch is full; send /send or /cancel.","\u6279\u91CF\u5185\u5BB9\u63D0\u4EA4\u5931\u8D25\uFF0C\u5DF2\u4FDD\u7559 {count} \u6761\u6D88\u606F\u3002\n\u8BF7\u518D\u6B21\u53D1\u9001 /send \u91CD\u8BD5\u6216 /cancel \u53D6\u6D88\u3002":`Batch submission failed; {count} messages were retained.
|
|
114
|
-
Send /send to retry or /cancel to cancel.`};var qU={"\u5317\u6C47\u661F\u6CB3 AIOS \u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"BeiHui XingHe AIOS is connected to DeepSeek Harness.","/repair \u8865\u5168\u98DE\u4E66\u6743\u9650\u4E0E\u5361\u7247\u56DE\u8C03":"/repair Complete Feishu permissions and the card callback","/m\uFF08\u6216 /menu\uFF09 \u6253\u5F00\u4EA4\u4E92\u5361\u7247\u83DC\u5355":"/m (or /menu) Open the interactive card menu","/watch [Session ID \u6216\u5E8F\u53F7] \u5173\u6CE8\u4F1A\u8BDD\uFF0C\u4EFB\u52A1\u5B8C\u6210\u81EA\u52A8\u63A8\u9001":"/watch [Session ID or index] Watch a session; completion is pushed automatically","/unwatch [Session ID \u6216\u5E8F\u53F7] \u53D6\u6D88\u5173\u6CE8":"/unwatch [Session ID or index] Stop watching","/watchlist \u67E5\u770B\u5173\u6CE8\u5217\u8868":"/watchlist View the watch list","/archived on|off \u4F1A\u8BDD\u5217\u8868\u662F\u5426\u5305\u542B\u5F52\u6863\u4F1A\u8BDD":"/archived on|off Whether the session list includes archived sessions","\u5DE5\u4F5C\u533A\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84\u3002":"The workspace must be an absolute path.","\u5DE5\u4F5C\u533A\u8DEF\u5F84\u4E0D\u5B58\u5728\u3002":"The workspace path does not exist.","\u5DE5\u4F5C\u533A\u8DEF\u5F84\u5FC5\u987B\u6307\u5411\u4E00\u4E2A\u76EE\u5F55\u3002":"The workspace path must point to a directory.","\u673A\u5668\u4EBA\u6B63\u5728\u79FB\u9664\u6216\u5DF2\u91CD\u65B0\u63A5\u5165\uFF0C\u65E0\u6CD5\u64CD\u4F5C\u539F\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u533A\u3002":"The bot is being removed or has been reconnected; the original session\u2019s workspace cannot be changed.","\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The operation failed. Please try again later.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u673A\u5668\u4EBA\u7F3A\u5C11\u98DE\u4E66\u6587\u4EF6\u4E0A\u4F20\u6743\u9650 im:resource\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u63D2\u4EF6\u9875\u9762\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u5B8C\u6210\u98DE\u4E66\u8981\u6C42\u7684\u53D1\u5E03\u5BA1\u6279\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated, but the bot lacks the Feishu file-upload scope im:resource. Run /repair in a direct chat with the bot, or click the \u201CComplete permissions\u201D button on the plugin page and scan the QR code. Complete any publishing approval Feishu requires, then try again.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u98DE\u4E66 30 MB \u4E0A\u9650\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the Feishu 30 MB limit and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0C\u98DE\u4E66\u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002":'The result file "{name}" is empty; Feishu does not allow sending empty files.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u98DE\u4E66\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was temporarily rate-limited by Feishu and could not be sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent right now. Please try again later.',"\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002\u5982\u679C\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u5728 DeepSeek Harness \u7684\u98DE\u4E66\u63D2\u4EF6\u9875\u9762\u68C0\u67E5\u8FDE\u63A5\u72B6\u6001\u3002":"Message processing failed. Please try again later. If the problem persists, check the connection status on the Feishu plugin page in DeepSeek Harness.","\u5DF2\u5F00\u542F\u5168\u65B0 Harness \u4F1A\u8BDD\u3002":"A brand-new Harness session has started.","\u98DE\u4E66\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The Feishu bot is connected to DeepSeek Harness and working normally.","\u7528\u6CD5\uFF1A/archived on\uFF08\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\uFF09\u6216 /archived off\uFF08\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\uFF09":"Usage: /archived on (include archived sessions) or /archived off (hide archived sessions)","\u5DF2\u5F00\u542F\uFF1A\u4F1A\u8BDD\u5217\u8868\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\u3002":"On: the session list includes archived sessions.","\u5DF2\u5173\u95ED\uFF1A\u4F1A\u8BDD\u5217\u8868\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\u3002":"Off: the session list hides archived sessions.","\u4E3A\u907F\u514D\u6388\u6743\u94FE\u63A5\u66B4\u9732\uFF0C\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u53D1\u9001 /repair\u3002":"To keep the authorization link private, send /repair to the bot in a direct message.","\u65E0\u6CD5\u8BC6\u522B\u5F53\u524D\u53D1\u9001\u8005\uFF0C\u672A\u53D1\u8D77\u4FEE\u590D\u3002":"The current sender could not be identified, so repair was not started.","\u5F53\u524D Host \u7248\u672C\u6682\u4E0D\u652F\u6301\u804A\u5929\u5185\u4FEE\u590D\uFF0C\u8BF7\u5148\u66F4\u65B0\u63D2\u4EF6\u3002":"The current Host version does not support in-chat repair. Update the plugin first.","\u7528\u6CD5\uFF1A/repair\u3001/repair qr\u3001/repair status\u3001/repair cancel \u6216 /repair verify":"Usage: /repair, /repair qr, /repair status, /repair cancel, or /repair verify","\u5F53\u524D Runtime \u6CA1\u6709\u53EF\u6062\u590D\u7684\u4FEE\u590D\u4EFB\u52A1\u8BB0\u5F55\uFF08\u673A\u5668\u4EBA\u53EF\u80FD\u521A\u5B8C\u6210\u5BC6\u94A5\u66F4\u65B0\u5E76\u91CD\u542F\uFF09\u3002\u672C\u547D\u4EE4\u4E0D\u4F1A\u542F\u52A8\u65B0\u7684\u6388\u6743\uFF1B\u8BF7\u67E5\u770B\u673A\u5668\u4EBA\u53D1\u9001\u7684\u9A8C\u8BC1\u7ED3\u679C\uFF0C\u786E\u8BA4\u4E0A\u4E00\u6B21\u4EFB\u52A1\u5DF2\u7ED3\u675F\u540E\u518D\u53D1\u9001 /repair\u3002":"The current Runtime has no recoverable repair attempt (the bot may have just rotated its secret and restarted). This command starts no new authorization. Check the verification result the bot sent, then send /repair after the previous attempt has finished.","\u53E6\u4E00\u4F4D\u7528\u6237\u6B63\u5728\u4FEE\u590D\u8BE5\u673A\u5668\u4EBA\uFF0C\u672C\u6B21\u4E0D\u4F1A\u663E\u793A\u5176\u6388\u6743\u4FE1\u606F\u3002":"Another user is repairing this bot; its authorization info will not be shown this time.","\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u4FEE\u590D\u4EFB\u52A1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not cancel the repair task right now. Please try again later.","\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u65E7\u4FEE\u590D\u4EFB\u52A1\uFF0C\u672A\u751F\u6210\u65B0\u94FE\u63A5\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not cancel the previous repair attempt, so no new link was generated. Please try again later.","\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\u4FEE\u590D\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not check the repair status right now. Please try again later.","\u4FEE\u590D\u6D41\u7A0B\u6682\u65F6\u5931\u8D25\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u8BF7\u7A0D\u540E\u53D1\u9001 /repair \u91CD\u8BD5\u3002":"The repair flow failed for now; the existing bot connection is unaffected. Send /repair again later.","\u98DE\u4E66\u8FD4\u56DE\u4E86\u65E0\u6CD5\u5B89\u5168\u9A8C\u8BC1\u7684\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002":"Feishu returned an authorization link that cannot be verified safely. This repair was aborted.","\u98DE\u4E66\u672A\u8FD4\u56DE\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002":"Feishu did not return an authorization link. This repair was aborted.","\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u53D1\u9001\u5E76\u7B49\u5F85\u6D4B\u8BD5\u6309\u94AE\u56DE\u8C03\uFF1B\u6536\u5230\u771F\u5B9E\u56DE\u8C03\u540E\u624D\u4F1A\u5B8C\u6210\u3002":"Authorization confirmed. Sending a test button and waiting for its callback; this completes only after a real callback arrives.","\u4FEE\u590D\u72B6\u6001\u67E5\u8BE2\u4E2D\u65AD\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u53D1\u9001 /repair status \u91CD\u8BD5\u67E5\u8BE2\u3002":"The repair status query was interrupted; the existing bot connection is unaffected. Send /repair status to retry.",\u94FE\u63A5\u4E3A\u77ED\u671F\u6709\u6548:"The link is valid for a short time.","\u94FE\u63A5\u7EA6 {minutes} \u5206\u949F\u540E\u8FC7\u671F":"The link expires in about {minutes} minutes","\u65E7\u6388\u6743\u94FE\u63A5\u5DF2\u4F5C\u5E9F\uFF0C\u5DF2\u751F\u6210\u65B0\u7684\u4FEE\u590D\u94FE\u63A5\u3002":"The previous authorization link was invalidated and a new repair link was generated.","\u{1F527} \u51C6\u5907\u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03\u3002":"\u{1F527} Preparing to complete permissions and the callback.","\u672C\u6B21\u6700\u591A\u589E\u91CF\u6DFB\u52A0\u4E09\u9879\uFF1A\u5361\u7247\u56DE\u8C03 card.action.trigger\uFF1B\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\u7684\u79DF\u6237\u6743\u9650 im:message:readonly\uFF08\u7528\u4E8E\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u4E2D\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\uFF1B\u4EE5\u53CA im:resource\uFF08\u7528\u4E8E\u4E0A\u4F20\u673A\u5668\u4EBA\u53D1\u9001\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\u3002\u786E\u8BA4\u9875\u53EA\u4F1A\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u7684\u9879\uFF1B\u82E5\u51FA\u73B0\u4E0A\u8FF0\u8303\u56F4\u4E4B\u5916\u7684\u914D\u7F6E\uFF0C\u8BF7\u53D6\u6D88\u3002":"This may incrementally add up to three items: the card callback card.action.trigger; the tenant scope im:message:readonly, shown by Feishu as \u201CRead direct and group messages\u201D and used to read images or files in user messages; and im:resource, used to upload images or files sent by the bot. The confirmation page shows only items the app is currently missing; cancel if anything outside this scope appears.","\u5F53\u524D\u8BBE\u5907\u76F4\u63A5\u6253\u5F00\uFF1A":"Open directly on this device:","\u82E5\u8981\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\uFF0C\u53D1\u9001 /repair qr\u3002{expiry}\u3002":"To scan with another device, send /repair qr. {expiry}.","\u8BF7\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\u5B8C\u6210\u6388\u6743{remaining}\u3002":"Complete authorization by scanning with another device{remaining}.","\uFF08\u5269\u4F59\u7EA6 {minutes} \u5206\u949F\uFF09":" (about {minutes} minutes left)","\u4E8C\u7EF4\u7801\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\uFF0C\u8BF7\u76F4\u63A5\u6253\u5F00\u6388\u6743\u94FE\u63A5\uFF1A\n{url}":`The QR code could not be sent. Open the authorization link directly:
|
|
114
|
+
Send /send to retry or /cancel to cancel.`};var qU={"\u5317\u6C47\u661F\u6CB3 AIOS \u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"BeiHui XingHe AIOS is connected to DeepSeek Harness.","/repair \u8865\u5168\u98DE\u4E66\u6743\u9650\u4E0E\u5361\u7247\u56DE\u8C03":"/repair Complete Feishu permissions and the card callback","/m\uFF08\u6216 /menu\uFF09 \u6253\u5F00\u4EA4\u4E92\u5361\u7247\u83DC\u5355":"/m (or /menu) Open the interactive card menu","/watch [Session ID \u6216\u5E8F\u53F7] \u5173\u6CE8\u4F1A\u8BDD\uFF0C\u4EFB\u52A1\u5B8C\u6210\u81EA\u52A8\u63A8\u9001":"/watch [Session ID or index] Watch a session; completion is pushed automatically","/unwatch [Session ID \u6216\u5E8F\u53F7] \u53D6\u6D88\u5173\u6CE8":"/unwatch [Session ID or index] Stop watching","/watchlist \u67E5\u770B\u5173\u6CE8\u5217\u8868":"/watchlist View the watch list","/archived on|off \u4F1A\u8BDD\u5217\u8868\u662F\u5426\u5305\u542B\u5F52\u6863\u4F1A\u8BDD":"/archived on|off Whether the session list includes archived sessions","\u5DE5\u4F5C\u533A\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84\u3002":"The workspace must be an absolute path.","\u5DE5\u4F5C\u533A\u8DEF\u5F84\u4E0D\u5B58\u5728\u3002":"The workspace path does not exist.","\u5DE5\u4F5C\u533A\u8DEF\u5F84\u5FC5\u987B\u6307\u5411\u4E00\u4E2A\u76EE\u5F55\u3002":"The workspace path must point to a directory.","\u673A\u5668\u4EBA\u6B63\u5728\u79FB\u9664\u6216\u5DF2\u91CD\u65B0\u63A5\u5165\uFF0C\u65E0\u6CD5\u64CD\u4F5C\u539F\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u533A\u3002":"The bot is being removed or has been reconnected; the original session\u2019s workspace cannot be changed.","\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The operation failed. Please try again later.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u673A\u5668\u4EBA\u7F3A\u5C11\u98DE\u4E66\u6587\u4EF6\u4E0A\u4F20\u6743\u9650 im:resource\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u5B8C\u6210\u98DE\u4E66\u8981\u6C42\u7684\u53D1\u5E03\u5BA1\u6279\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated, but the bot lacks the Feishu file-upload scope im:resource. Run /repair in a direct chat with the bot, or click the \u201CComplete permissions\u201D button on the IM Bot settings page and scan the QR code. Complete any publishing approval Feishu requires, then try again.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u98DE\u4E66 30 MB \u4E0A\u9650\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the Feishu 30 MB limit and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0C\u98DE\u4E66\u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002":'The result file "{name}" is empty; Feishu does not allow sending empty files.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u98DE\u4E66\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was temporarily rate-limited by Feishu and could not be sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent right now. Please try again later.',"\u5904\u7406\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002\u5982\u679C\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u5728 DeepSeek Harness \u7684\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u68C0\u67E5\u98DE\u4E66\u8FDE\u63A5\u72B6\u6001\u3002":"Message processing failed. Please try again later. If the problem persists, check the Feishu connection status on the IM Bot settings page in DeepSeek Harness.","\u5DF2\u5F00\u542F\u5168\u65B0 Harness \u4F1A\u8BDD\u3002":"A brand-new Harness session has started.","\u98DE\u4E66\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The Feishu bot is connected to DeepSeek Harness and working normally.","\u7528\u6CD5\uFF1A/archived on\uFF08\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\uFF09\u6216 /archived off\uFF08\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\uFF09":"Usage: /archived on (include archived sessions) or /archived off (hide archived sessions)","\u5DF2\u5F00\u542F\uFF1A\u4F1A\u8BDD\u5217\u8868\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\u3002":"On: the session list includes archived sessions.","\u5DF2\u5173\u95ED\uFF1A\u4F1A\u8BDD\u5217\u8868\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\u3002":"Off: the session list hides archived sessions.","\u4E3A\u907F\u514D\u6388\u6743\u94FE\u63A5\u66B4\u9732\uFF0C\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u53D1\u9001 /repair\u3002":"To keep the authorization link private, send /repair to the bot in a direct message.","\u65E0\u6CD5\u8BC6\u522B\u5F53\u524D\u53D1\u9001\u8005\uFF0C\u672A\u53D1\u8D77\u4FEE\u590D\u3002":"The current sender could not be identified, so repair was not started.","\u5F53\u524D Host \u7248\u672C\u6682\u4E0D\u652F\u6301\u804A\u5929\u5185\u4FEE\u590D\uFF0C\u8BF7\u5148\u66F4\u65B0\u63D2\u4EF6\u3002":"The current Host version does not support in-chat repair. Update the plugin first.","\u7528\u6CD5\uFF1A/repair\u3001/repair qr\u3001/repair status\u3001/repair cancel \u6216 /repair verify":"Usage: /repair, /repair qr, /repair status, /repair cancel, or /repair verify","\u5F53\u524D Runtime \u6CA1\u6709\u53EF\u6062\u590D\u7684\u4FEE\u590D\u4EFB\u52A1\u8BB0\u5F55\uFF08\u673A\u5668\u4EBA\u53EF\u80FD\u521A\u5B8C\u6210\u5BC6\u94A5\u66F4\u65B0\u5E76\u91CD\u542F\uFF09\u3002\u672C\u547D\u4EE4\u4E0D\u4F1A\u542F\u52A8\u65B0\u7684\u6388\u6743\uFF1B\u8BF7\u67E5\u770B\u673A\u5668\u4EBA\u53D1\u9001\u7684\u9A8C\u8BC1\u7ED3\u679C\uFF0C\u786E\u8BA4\u4E0A\u4E00\u6B21\u4EFB\u52A1\u5DF2\u7ED3\u675F\u540E\u518D\u53D1\u9001 /repair\u3002":"The current Runtime has no recoverable repair attempt (the bot may have just rotated its secret and restarted). This command starts no new authorization. Check the verification result the bot sent, then send /repair after the previous attempt has finished.","\u53E6\u4E00\u4F4D\u7528\u6237\u6B63\u5728\u4FEE\u590D\u8BE5\u673A\u5668\u4EBA\uFF0C\u672C\u6B21\u4E0D\u4F1A\u663E\u793A\u5176\u6388\u6743\u4FE1\u606F\u3002":"Another user is repairing this bot; its authorization info will not be shown this time.","\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u4FEE\u590D\u4EFB\u52A1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not cancel the repair task right now. Please try again later.","\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u65E7\u4FEE\u590D\u4EFB\u52A1\uFF0C\u672A\u751F\u6210\u65B0\u94FE\u63A5\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not cancel the previous repair attempt, so no new link was generated. Please try again later.","\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\u4FEE\u590D\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not check the repair status right now. Please try again later.","\u4FEE\u590D\u6D41\u7A0B\u6682\u65F6\u5931\u8D25\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u8BF7\u7A0D\u540E\u53D1\u9001 /repair \u91CD\u8BD5\u3002":"The repair flow failed for now; the existing bot connection is unaffected. Send /repair again later.","\u98DE\u4E66\u8FD4\u56DE\u4E86\u65E0\u6CD5\u5B89\u5168\u9A8C\u8BC1\u7684\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002":"Feishu returned an authorization link that cannot be verified safely. This repair was aborted.","\u98DE\u4E66\u672A\u8FD4\u56DE\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002":"Feishu did not return an authorization link. This repair was aborted.","\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u53D1\u9001\u5E76\u7B49\u5F85\u6D4B\u8BD5\u6309\u94AE\u56DE\u8C03\uFF1B\u6536\u5230\u771F\u5B9E\u56DE\u8C03\u540E\u624D\u4F1A\u5B8C\u6210\u3002":"Authorization confirmed. Sending a test button and waiting for its callback; this completes only after a real callback arrives.","\u4FEE\u590D\u72B6\u6001\u67E5\u8BE2\u4E2D\u65AD\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u53D1\u9001 /repair status \u91CD\u8BD5\u67E5\u8BE2\u3002":"The repair status query was interrupted; the existing bot connection is unaffected. Send /repair status to retry.",\u94FE\u63A5\u4E3A\u77ED\u671F\u6709\u6548:"The link is valid for a short time.","\u94FE\u63A5\u7EA6 {minutes} \u5206\u949F\u540E\u8FC7\u671F":"The link expires in about {minutes} minutes","\u65E7\u6388\u6743\u94FE\u63A5\u5DF2\u4F5C\u5E9F\uFF0C\u5DF2\u751F\u6210\u65B0\u7684\u4FEE\u590D\u94FE\u63A5\u3002":"The previous authorization link was invalidated and a new repair link was generated.","\u{1F527} \u51C6\u5907\u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03\u3002":"\u{1F527} Preparing to complete permissions and the callback.","\u672C\u6B21\u6700\u591A\u589E\u91CF\u6DFB\u52A0\u4E09\u9879\uFF1A\u5361\u7247\u56DE\u8C03 card.action.trigger\uFF1B\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\u7684\u79DF\u6237\u6743\u9650 im:message:readonly\uFF08\u7528\u4E8E\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u4E2D\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\uFF1B\u4EE5\u53CA im:resource\uFF08\u7528\u4E8E\u4E0A\u4F20\u673A\u5668\u4EBA\u53D1\u9001\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\u3002\u786E\u8BA4\u9875\u53EA\u4F1A\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u7684\u9879\uFF1B\u82E5\u51FA\u73B0\u4E0A\u8FF0\u8303\u56F4\u4E4B\u5916\u7684\u914D\u7F6E\uFF0C\u8BF7\u53D6\u6D88\u3002":"This may incrementally add up to three items: the card callback card.action.trigger; the tenant scope im:message:readonly, shown by Feishu as \u201CRead direct and group messages\u201D and used to read images or files in user messages; and im:resource, used to upload images or files sent by the bot. The confirmation page shows only items the app is currently missing; cancel if anything outside this scope appears.","\u5F53\u524D\u8BBE\u5907\u76F4\u63A5\u6253\u5F00\uFF1A":"Open directly on this device:","\u82E5\u8981\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\uFF0C\u53D1\u9001 /repair qr\u3002{expiry}\u3002":"To scan with another device, send /repair qr. {expiry}.","\u8BF7\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\u5B8C\u6210\u6388\u6743{remaining}\u3002":"Complete authorization by scanning with another device{remaining}.","\uFF08\u5269\u4F59\u7EA6 {minutes} \u5206\u949F\uFF09":" (about {minutes} minutes left)","\u4E8C\u7EF4\u7801\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\uFF0C\u8BF7\u76F4\u63A5\u6253\u5F00\u6388\u6743\u94FE\u63A5\uFF1A\n{url}":`The QR code could not be sent. Open the authorization link directly:
|
|
115
115
|
{url}`,"\u6388\u6743\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF1B\u5E73\u53F0\u672A\u8FD4\u56DE\u6210\u529F\u7ED3\u679C\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5DF2\u4FEE\u590D\u3002\u53D1\u9001 /repair \u751F\u6210\u65B0\u94FE\u63A5\u3002":"The authorization link expired; the platform returned no success, so the repair cannot be confirmed. Send /repair for a new link.","\u5DF2\u53D6\u6D88\u672C\u6B21\u4FEE\u590D\u6388\u6743\uFF0C\u672A\u786E\u8BA4\u5B8C\u6210\u4FEE\u590D\u3002":"Repair authorization was cancelled; the repair was not confirmed.","\u4F60\u5DF2\u53D6\u6D88\u6216\u62D2\u7EDD\u6388\u6743\uFF0C\u6CA1\u6709\u786E\u8BA4\u4FEE\u590D\uFF1B\u53D1\u9001 /repair \u53EF\u91CD\u8BD5\u3002":"You cancelled or declined authorization, so the repair was not confirmed. Send /repair to retry.","\u6388\u6743\u5DF2\u63D0\u4EA4\uFF0C\u4F46\u672A\u6536\u5230\u6D4B\u8BD5\u6309\u94AE\u56DE\u8C03\u3002\u53EF\u80FD\u5C1A\u672A\u70B9\u51FB\u6216\u914D\u7F6E\u4ECD\u5728\u4F20\u64AD\uFF1B\u7A0D\u540E\u53D1\u9001 /repair verify \u67E5\u8BE2\uFF0C\u4E0D\u8981\u76F2\u76EE\u91CD\u590D\u6388\u6743\u3002":"Authorization was submitted, but no test-button callback arrived. It may not have been tapped yet, or the config is still propagating. Send /repair verify later to check; do not authorize blindly again.","\u4FEE\u590D\u6D41\u7A0B\u6682\u65F6\u5931\u8D25\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u53D1\u9001 /repair \u53EF\u91CD\u8BD5\u3002":"The repair flow failed for now; the existing bot connection is unaffected. Send /repair to retry.","\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u7B49\u5F85\u4E13\u7528\u6D4B\u8BD5\u6309\u94AE\u7684\u771F\u5B9E\u56DE\u8C03\uFF1B\u56DE\u8C03\u5230\u8FBE\u524D\u4E0D\u4F1A\u5BA3\u544A\u6210\u529F\u3002":"Authorization confirmed. Waiting for the real callback from the dedicated test button; success is not declared until it arrives.","\u6388\u6743\u5C1A\u672A\u5B8C\u6210\uFF0C\u6682\u65F6\u4E0D\u80FD\u9A8C\u8BC1\u5361\u7247\u6309\u94AE\u3002\u8BF7\u5148\u6253\u5F00\u6388\u6743\u94FE\u63A5\u5E76\u786E\u8BA4\u3002":"Authorization is not complete, so the card buttons cannot be verified yet. Open the authorization link and confirm first.","\u4FEE\u590D\u4EFB\u52A1\u6B63\u5728\u7B49\u5F85\u6388\u6743{remaining}\u3002\u53D1\u9001 /repair qr \u53EF\u83B7\u53D6\u4E8C\u7EF4\u7801\uFF0C/repair cancel \u53EF\u53D6\u6D88\u3002":"The repair task is waiting for authorization{remaining}. Send /repair qr for the QR code, or /repair cancel to cancel.","\uFF0C\u5269\u4F59\u7EA6 {minutes} \u5206\u949F":", about {minutes} minutes left","\u8FD9\u4E2A\u83DC\u5355\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u56DE\u590D /m \u91CD\u65B0\u6253\u5F00\u3002":"This menu has expired. Send /m to reopen it.","\u83DC\u5355\u6CA1\u6709\u8FD9\u4E2A\u7F16\u53F7\uFF0C\u56DE\u590D /m \u91CD\u65B0\u6253\u5F00\u3002":"This menu has no such number. Send /m to reopen it.","\u672C\u9875\u53EA\u6709 {count} \u4E2A\u4F1A\u8BDD\uFF0C\u56DE\u590D /sessionlist \u91CD\u65B0\u67E5\u770B\u3002":"This page has only {count} sessions. Send /sessionlist to view them again.","\u53EA\u6709 {count} \u4E2A\u5DE5\u4F5C\u533A\uFF0C\u56DE\u590D /workspacelist \u91CD\u65B0\u67E5\u770B\u3002":"There are only {count} workspaces. Send /workspacelist to view them again.","\u5173\u6CE8\u5217\u8868\u53EA\u6709 {count} \u4E2A\u4F1A\u8BDD\u3002":"The watch list has only {count} sessions.","\u5DF2\u7ED1\u5B9A\u4F1A\u8BDD\u300C{title}\u300D\nID\uFF1A{id}":`Session bound: "{title}"
|
|
116
116
|
ID: {id}`,"\u7ED1\u5B9A\u5931\u8D25\uFF1A{message}":"Binding failed: {message}","\u5207\u6362\u5931\u8D25\uFF1A{message}":"Switch failed: {message}","\u7528\u6CD5\uFF1A/watch <Session ID \u6216\u5F53\u524D\u5DE5\u4F5C\u533A\u5E8F\u53F7>":"Usage: /watch <Session ID or the current workspace index>","\u5F53\u524D\u673A\u5668\u4EBA\u6CA1\u6709\u53EF\u7528\u7684\u5DE5\u4F5C\u533A\uFF0C\u65E0\u6CD5\u6309\u5E8F\u53F7\u89E3\u6790\u4F1A\u8BDD\u3002":"This bot has no available workspace, so sessions cannot be resolved by index.","\u5F53\u524D\u5DE5\u4F5C\u533A\u53EA\u6709 {count} \u4E2A\u4F1A\u8BDD\u3002":"The current workspace has only {count} sessions.","\u6CA1\u6709\u627E\u5230\u8FD9\u4E2A\u4F1A\u8BDD\uFF0C\u8BF7\u7528 /sessionlist \u67E5\u770B\u53EF\u7528\u4F1A\u8BDD\u3002":"Session not found. Use /sessionlist to see the available sessions.","\u5F53\u524D\u72B6\u6001\u5B58\u50A8\u4E0D\u652F\u6301\u5173\u6CE8\u3002":"The current state store does not support watching.","\u65E0\u6CD5\u89E3\u6790\u4F1A\u8BDD\uFF1A{message}":"Could not resolve the session: {message}","\u6BCF\u4E2A\u804A\u5929\u6700\u591A\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\u3002":"Each chat can watch at most {count} sessions.","\u5173\u6CE8\u5217\u8868\u91CC\u6CA1\u6709\u8FD9\u4E2A\u4F1A\u8BDD\uFF0C\u56DE\u590D /watchlist \u67E5\u770B\u3002":"This session is not in the watch list. Send /watchlist to view it.","\u5DF2\u5173\u6CE8\u4F1A\u8BDD\u300C{title}\u300D\uFF0C\u4EFB\u52A1\u5B8C\u6210\u4F1A\u63A8\u9001\u7ED3\u679C\u3002":'Watching session "{title}"; results are pushed when the task completes.',"\u5173\u6CE8\u5931\u8D25\uFF1A{message}":"Could not watch: {message}","\u5DF2\u53D6\u6D88\u5173\u6CE8\u300C{title}\u300D\u3002":'Unwatched "{title}".',"\u53D6\u6D88\u5931\u8D25\uFF1A{message}":"Could not unwatch: {message}","\u98DE\u4E66\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the Feishu interaction question.","\u5F53\u524D\u4EFB\u52A1\u4ECD\u5728\u8FD0\u884C\uFF0C\u8BF7\u5148\u505C\u6B62\u4EFB\u52A1\u6216\u7B49\u5F85\u4EFB\u52A1\u5B8C\u6210\u540E\u518D\u5F00\u542F\u65B0\u4F1A\u8BDD\u3002":"The current task is still running. Stop it or wait for it to finish before starting a new session.","\u8BF7\u8F93\u5165\u8865\u5145\u6307\u4EE4\u540E\u518D\u63D0\u4EA4\u3002":"Enter an instruction before submitting.","\u64CD\u4F5C\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002":"Too many card actions are pending. Please try again shortly.","\u5361\u7247\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The card action failed. Please try again later.","\u8BF7\u5148\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u4F1A\u8BDD\u3002":"Select at least one session first.","\u5DF2\u6279\u91CF\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\u3002":"Now watching {count} sessions.","\u5DF2\u6279\u91CF\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\uFF0C\u53E6\u6709 {failed} \u4E2A\u672A\u6210\u529F\u3002":"Now watching {count} sessions; {failed} could not be processed.","\u5DF2\u5173\u6CE8\uFF08\u6216\u5DF2\u8FBE\u5173\u6CE8\u4E0A\u9650\uFF09\u3002":"Sessions are already watched, or the watch limit has been reached.","\u5DF2\u53D6\u6D88\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\u3002":"Stopped watching {count} sessions.","\u5DF2\u53D6\u6D88\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\uFF0C\u53E6\u6709 {failed} \u4E2A\u672A\u6210\u529F\u3002":"Stopped watching {count} sessions; {failed} could not be processed.","\u6240\u9009\u4F1A\u8BDD\u5747\u672A\u5904\u7406\u6210\u529F\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"None of the selected sessions could be processed. Please try again later.","\u6240\u9009\u4F1A\u8BDD\u5DF2\u5728\u5173\u6CE8\u5217\u8868\u4E2D\u3002":"The selected sessions are already being watched.","\u6240\u9009\u4F1A\u8BDD\u5DF2\u4E0D\u5728\u5173\u6CE8\u5217\u8868\u4E2D\u3002":"The selected sessions are no longer in the watch list.","\u672A\u53D6\u6D88\u4EFB\u4F55\u5173\u6CE8\u3002":"No watches were removed.","\u5F53\u524D\u6CA1\u6709\u7ED1\u5B9A\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u4ECE\u4F1A\u8BDD\u5217\u8868\u9009\u62E9\u3002":"No session is currently bound. Select one from the session list first.","\u5DF2\u5C31\u7EEA\uFF0C\u76F4\u63A5\u53D1\u6D88\u606F\u5373\u53EF\u7EE7\u7EED\u5F53\u524D\u4F1A\u8BDD\u3002":"Ready. Send a message to continue the current session.","\u4FEE\u590D\u9700\u5728\u79C1\u804A\u4E2D\u9A8C\u8BC1\u63A5\u5165\u8005\u8EAB\u4EFD\uFF0C\u8BF7\u76F4\u63A5\u53D1\u9001 /repair \u5F00\u59CB\u3002":"Repair must verify the owner in a direct chat. Send /repair there to begin.","\u6682\u65F6\u65E0\u6CD5\u83B7\u53D6\u9884\u8BBE\u5217\u8868\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not load the preset list. Please try again later.","\u6682\u65F6\u65E0\u6CD5\u83B7\u53D6\u7CFB\u7EDF\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not load system status. Please try again later.",\u8FDE\u63A5\u6B63\u5E38:"Connected","\u9884\u8BBE\uFF1A{preset}":"Preset: {preset}",\u672A\u77E5:"Unknown","/stop \u6267\u884C\u5B8C\u6210\u3002":"/stop completed.","\u505C\u6B62\u4EFB\u52A1\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not stop the task. Please try again later.","\u5DF2\u63D0\u4EA4\u8865\u5145\u6307\u4EE4\u3002":"Instruction submitted.","\u9884\u8BBE\u91CD\u7F6E\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not reset the preset. Please try again later.","\u9884\u8BBE\u5207\u6362\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not switch the preset. Please try again later.","\u{1F916} \u52A9\u624B\u4E2D\u5FC3":"\u{1F916} Assistant center","**\u8BBE\u7F6E**":"**Settings**",\u5207\u6362\u4F1A\u8BDD:"Switch session","\u9009\u62E9\u4F1A\u8BDD\uFF08\u5F53\u524D\u672A\u7ED1\u5B9A\uFF09":"Select a session (none currently bound)",\u8DDF\u968F\u9ED8\u8BA4:"Follow default",\u5207\u6362\u9884\u8BBE:"Switch preset",\u5207\u6362\u6A21\u578B:"Switch model","\u5F53\u524D\u5DE5\u4F5C\u533A\u6682\u65E0\u53EF\u7528\u4F1A\u8BDD\u3002":"There are no available sessions in the current workspace.","\u{1F916} \u5207\u6362\u9884\u8BBE":"\u{1F916} Switch preset","\u{1F9E0} \u5207\u6362\u6A21\u578B":"\u{1F9E0} Switch model","\u{1F195} \u65B0\u4F1A\u8BDD":"\u{1F195} New session","\u{1F4CB} \u4F1A\u8BDD/\u5173\u6CE8":"\u{1F4CB} Sessions / watches","\u{1F5C2} \u5DE5\u4F5C\u533A\u5217\u8868":"\u{1F5C2} Workspace list","**\u4EFB\u52A1\u63A7\u5236**":"**Task controls**","\u23F9 \u505C\u6B62":"\u23F9 Stop","\u{1F4D0} \u538B\u7F29":"\u{1F4D0} Compact","**\u8865\u5145\u6307\u4EE4**":"**Steer task**",\u9009\u62E9\u8865\u5145\u6307\u4EE4:"Choose an instruction",\u7EE7\u7EED:"Continue",\u52A0\u901F\u8FD0\u884C:"Move faster",\u603B\u7ED3\u5F53\u524D\u8FDB\u5C55:"Summarize current progress",\u66F4\u7B80\u6D01\u4E9B:"Be more concise",\u66F4\u8BE6\u7EC6\u4E9B:"Be more detailed","\u270F\uFE0F \u66F4\u591A / \u81EA\u5B9A\u4E49\u2026":"\u270F\uFE0F More / custom\u2026","\u{1F5C4} \u5F52\u6863\uFF1A{state}":"\u{1F5C4} Archived: {state}",\u5DF2\u663E\u793A:"shown",\u5DF2\u9690\u85CF:"hidden",\u5207\u6362\u5F52\u6863\u663E\u793A:"Toggle archived sessions","\u{1F4CA} \u72B6\u6001":"\u{1F4CA} Status","\u{1F4D6} \u5E2E\u52A9":"\u{1F4D6} Help","**\u6570\u5B57\u515C\u5E95**\n**1**\u5DE5\u4F5C\u533A\u5217\u8868 \xB7 **2**\u65B0\u4F1A\u8BDD \xB7 **3**\u4F1A\u8BDD\u5217\u8868 \xB7 **4**\u72B6\u6001\n**5**\u{1F527}\u8865\u5168\u6743\u9650 \xB7 **6**\u5E2E\u52A9":`**Number fallback**
|
|
117
117
|
**1** Workspace list \xB7 **2** New session \xB7 **3** Session list \xB7 **4** Status
|
|
@@ -132,9 +132,9 @@ ID: {id}`,"\u7ED1\u5B9A\u5931\u8D25\uFF1A{message}":"Binding failed: {message}",
|
|
|
132
132
|
Reply with a number for a quick action:
|
|
133
133
|
**1** Workspace list \xB7 **2** New session \xB7 **3** Sessions/watches
|
|
134
134
|
**4** Status \xB7 **5** Complete permissions \xB7 **6** Help`,"\u4ECE\u4E0B\u65B9\u4E0B\u62C9\u9009\u62E9\u8865\u5145\u6307\u4EE4\uFF1B\u6700\u540E\u4E00\u9879\u53EF\u81EA\u5B9A\u4E49\u8F93\u5165\u3002":"Choose an instruction below; the last option lets you enter a custom one.","\u5F53\u524D\u6CA1\u6709\u7ED1\u5B9A\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u4F1A\u8BDD\u518D\u8865\u5145\u6307\u4EE4\u3002":"No session is bound. Bind one before steering the task.","\u2795 \u8865\u5145\u6307\u4EE4":"\u2795 Steer task","\u8F93\u5165\u8865\u5145\u6307\u4EE4\u540E\u70B9\u300C\u63D0\u4EA4\u300D\uFF0C\u53D1\u9001\u7ED9\u5F53\u524D\u8FD0\u884C\u7684\u4EFB\u52A1\u3002":"Enter an instruction and press Submit to send it to the running task.",\u8F93\u5165\u4F60\u7684\u8865\u5145\u6307\u4EE4:"Enter your instruction",\u63D0\u4EA4:"Submit","\u2795 \u81EA\u5B9A\u4E49\u6307\u4EE4":"\u2795 Custom instruction","\u{1F916} \u52A9\u624B\u83DC\u5355":"\u{1F916} Assistant menu","**\u70B9\u51FB\u6309\u94AE\u6216\u76F4\u63A5\u56DE\u590D\u6570\u5B57**":"**Tap a button or reply with a number**","1 \xB7 \u4F1A\u8BDD\u5217\u8868":"1 \xB7 Sessions","2 \xB7 \u5DE5\u4F5C\u533A":"2 \xB7 Workspace","3 \xB7 \u65B0\u4F1A\u8BDD":"3 \xB7 New session","4 \xB7 \u72B6\u6001":"4 \xB7 Status","5 \xB7 \u5E2E\u52A9":"5 \xB7 Help","**6 \xB7 \u8865\u5168\u6743\u9650**\uFF08\u8BF7\u76F4\u63A5\u56DE\u590D\u6570\u5B57 **6**\uFF09":"**6 \xB7 Complete permissions** (reply with the number **6**)","7 \xB7 \u5173\u6CE8\u5217\u8868":"7 \xB7 Watch list","\u{1F9EA} \u9A8C\u8BC1\u5361\u7247\u6309\u94AE":"\u{1F9EA} Verify card buttons","\u6388\u6743\u5DF2\u63D0\u4EA4\u3002\u8BF7\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\uFF1B\u673A\u5668\u4EBA\u771F\u5B9E\u6536\u5230\u56DE\u8C03\u540E\u624D\u4F1A\u5224\u5B9A\u4FEE\u590D\u6210\u529F\u3002":"Authorization submitted. Tap the button below; the repair is confirmed only after the bot receives the real callback.",\u5B8C\u6210\u9A8C\u8BC1:"Finish verification","**\u5DE5\u4F5C\u533A**\uFF1A{workspace}\n\u5171 **{total}** \u4E2A\u4F1A\u8BDD{paging}":`**Workspace**: {workspace}
|
|
135
|
-
**{total}** sessions in total{paging}`,"\uFF08\u7B2C {page}/{pageCount} \u9875\uFF09":" (page {page}/{pageCount})","\u2B50\u53D6\u5173":"\u2B50 Unwatch","\u2B50\u5173\u6CE8":"\u2B50 Watch","\u25C0 \u4E0A\u4E00\u9875":"\u25C0 Previous","\u4E0B\u4E00\u9875 \u25B6":"Next \u25B6","\u56DE\u590D\u6570\u5B57\uFF081~N\uFF09\u7ED1\u5B9A\u672C\u9875\u4F1A\u8BDD\u3002":"Reply with a number (1\u2013N) to bind a session on this page.","\u{1F4C2} \u4F1A\u8BDD\u5217\u8868":"\u{1F4C2} Session list","\u5F53\u524D Host \u4E0A\u6CA1\u6709\u5DF2\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\u3002":"No workspaces are registered on the current Host.","\u56DE\u590D\u6570\u5B57\u5207\u6362\u5DE5\u4F5C\u533A\uFF0C\u6216\u70B9\u51FB\u6309\u94AE\uFF1A":"Reply with a number to switch workspaces, or tap a button:","\u{1F5C2} \u5DE5\u4F5C\u533A":"\u{1F5C2} Workspace","\u{1F916} \u52A9\u624B\u83DC\u5355\uFF08\u56DE\u590D\u6570\u5B57\u5373\u53EF\uFF0C\u65E0\u9700\u8BB0\u547D\u4EE4\uFF09":"\u{1F916} Assistant menu (reply with a number \u2014 no need to memorize commands)","1 \xB7 /sessionlist \u5217\u51FA\u4F1A\u8BDD\uFF08\u56DE\u590D\u6570\u5B57\u7ED1\u5B9A\uFF09":"1 \xB7 /sessionlist List sessions (reply with a number to bind)","2 \xB7 /workspacelist \u5217\u51FA\u5DE5\u4F5C\u533A\uFF08\u56DE\u590D\u6570\u5B57\u5207\u6362\uFF09":"2 \xB7 /workspacelist List workspaces (reply with a number to switch)","3 \xB7 /new \u5F00\u542F\u65B0\u4F1A\u8BDD":"3 \xB7 /new Start a new session","4 \xB7 /status \u8FDE\u63A5\u72B6\u6001":"4 \xB7 /status Connection status","5 \xB7 /help \u672C\u5E2E\u52A9":"5 \xB7 /help This help","6 \xB7 /repair \u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03\uFF08\u8BF7\u56DE\u590D\u6570\u5B57 6\uFF09":"6 \xB7 /repair Complete permissions and callback (reply with the number 6)","7 \xB7 /watchlist \u5173\u6CE8\u5217\u8868":"7 \xB7 /watchlist Watch list","\u76F4\u63A5\u53D1\u9001\u6587\u5B57/\u56FE\u7247\u5373\u7EE7\u7EED\u5F53\u524D\u4F1A\u8BDD\u3002":"Send text or an image directly to continue the current session.","/session ID \u6216\u5E8F\u53F7 \u7ED1\u5B9A\u5DF2\u6709\u4F1A\u8BDD":"/session ID or index Bind an existing session","/watch ID \u6216\u5E8F\u53F7 \u5173\u6CE8\u4F1A\u8BDD\uFF08\u5B8C\u6210\u540E\u63A8\u9001\uFF09":"/watch ID or index Watch a session (push when done)","/compact \u538B\u7F29\u4E0A\u4E0B\u6587":"/compact Compact the context","/workspace \u7EDD\u5BF9\u8DEF\u5F84 \u5207\u6362\u5DE5\u4F5C\u533A":"/workspace <absolute path> Switch workspace","/presetlist \u5217\u51FA\u53EF\u7528 Agent Preset":"/presetlist List available Agent Presets","\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\uFF0C\u56DE\u590D\u6570\u5B57\u6216\u70B9\u6309\u94AE\u53D6\u6D88\u5173\u6CE8\uFF1A":"Completion is pushed automatically. Reply with a number or tap a button to unwatch:","\u{1F441} \u5173\u6CE8\u5217\u8868":"\u{1F441} Watch list","\u2B50 \u53D6\u6D88\u5173\u6CE8":"\u2B50 Unwatch","\u2606 \u5173\u6CE8":"\u2606 Watch","\u{1F50D} \u5173\u6CE8\u5217\u8868":"\u{1F50D} Watch list",\u52FE\u9009\u8981\u5173\u6CE8\u7684\u4F1A\u8BDD:"Select sessions to watch",\u52FE\u9009\u8981\u53D6\u6D88\u5173\u6CE8\u7684\u4F1A\u8BDD:"Select sessions to unwatch","\u5F53\u524D\u6CA1\u6709\u5173\u6CE8\u7684\u4F1A\u8BDD\u3002\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\u7ED3\u679C\u3002":"No sessions are being watched. Results are pushed automatically when tasks complete.","\u5F53\u524D\u5173\u6CE8 **{count}** \u4E2A\u4F1A\u8BDD\uFF1A":"Currently watching **{count}** sessions:","**\u2795 \u6DFB\u52A0\u5173\u6CE8**\uFF08\u591A\u9009\u4E0B\u62C9\u52FE\u9009\uFF09":"**\u2795 Add watch** (select from the multi-select dropdown)","**\u2796 \u53D6\u6D88\u5173\u6CE8**\uFF08\u591A\u9009\u4E0B\u62C9\u52FE\u9009\uFF09":"**\u2796 Remove watch** (select from the multi-select dropdown)","\u{1F4CB} \u4F1A\u8BDD\u5217\u8868":"\u{1F4CB} Session list","\u{1F519} \u8FD4\u56DE\u83DC\u5355":"\u{1F519} Back to menu",\u5DF2\u5B8C\u6210:"Completed",\u5DF2\u505C\u6B62:"Stopped",\u5DF2\u4E2D\u6B62:"Aborted",\u5DF2\u53D6\u6D88:"Cancelled",\u5DF2\u7ED3\u675F:"Ended","\u2705 \u4EFB\u52A1\u5B8C\u6210":"\u2705 Task complete","**\u72B6\u6001**\uFF1A{reason}":"**Status**: {reason}",\u6253\u5F00\u4F1A\u8BDD\u5217\u8868:"Open session list",\u5DE5\u4F5C\u533A:"Workspace","\u7ED1\u5B9A\u8BE5\u4F1A\u8BDD\u540E\u53EF\u7EE7\u7EED\u8FFD\u95EE\uFF0C\u8F93\u5165\u6587\u5B57\u5373\u53EF\u3002":"After binding this session you can keep asking; just type a message.","\u5F53\u524D\u6CA1\u6709\u5173\u6CE8\u7684\u4F1A\u8BDD\u3002\n`/watch <ID|\u5E8F\u53F7>` \u5173\u6CE8\u540E\uFF0C\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\u3002":"No sessions are being watched.\nWatch one with `/watch <ID|index>` and completion is pushed automatically.","\u6B63\u5728\u751F\u6210\u2026":"Generating\u2026",\u56DE\u7B54\u5B8C\u6210:"Answer complete",\u98DE\u4E66\u673A\u5668\u4EBA:"Feishu bot","\u98DE\u4E66\u673A\u5668\u4EBA\u7F3A\u5C11\u56FE\u7247\u8BFB\u53D6\u6743\u9650 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u63D2\u4EF6\u9875\u9762\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u6309\u98DE\u4E66\u63D0\u793A\u53D1\u5E03\u65B0\u7248\u672C\u3001\u5B8C\u6210\u5FC5\u8981\u5BA1\u6279\u540E\uFF0C\u518D\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002":"The Feishu bot is missing the image-read scope im:message:readonly, shown by Feishu as \u201CRead direct and group messages.\u201D Run /repair in a direct chat with the bot, or click the \u201CComplete permissions\u201D button on the plugin page and scan the QR code. Publish a new version and complete any approval requested by Feishu, then resend the image.","\u2705 \u4FEE\u590D\u5B8C\u6210\uFF1A\u5DF2\u5B9E\u6D4B\u6536\u5230 card.action.trigger\uFF0C\u83DC\u5355\u6309\u94AE\u73B0\u5728\u53EF\u7528\u3002":"\u2705 Repair complete: card.action.trigger was received in a real test; the menu buttons now work.","\u26A0\uFE0F \u4FEE\u590D\u9A8C\u8BC1\u8D85\u65F6\uFF1A\u672A\u6536\u5230\u6D4B\u8BD5\u5361\u6309\u94AE\u7684 card.action.trigger\uFF0C\u4E0D\u80FD\u786E\u8BA4\u6309\u94AE\u5DF2\u4FEE\u590D\u3002\u8BF7\u4E0D\u8981\u91CD\u590D\u6388\u6743\uFF1B\u5148\u68C0\u67E5\u98DE\u4E66\u5F00\u653E\u5E73\u53F0\u7684\u5361\u7247\u56DE\u8C03\u914D\u7F6E\uFF0C\u786E\u8BA4\u540E\u518D\u53D1\u9001 /repair\u3002":"\u26A0\uFE0F Repair verification timed out: no card.action.trigger from the test card button was received, so the buttons cannot be confirmed repaired. Do not authorize again; check the card-callback configuration in Feishu Open Platform first, then send /repair.","\u26A0\uFE0F \u4FEE\u590D\u9A8C\u8BC1\u5931\u8D25\uFF1A\u65E0\u6CD5\u53D1\u9001\u4E13\u7528\u6D4B\u8BD5\u5361\uFF0C\u4E0D\u80FD\u786E\u8BA4 card.action.trigger \u5DF2\u6062\u590D\u3002\u8BF7\u4E0D\u8981\u91CD\u590D\u6388\u6743\uFF1B\u5148\u68C0\u67E5\u673A\u5668\u4EBA\u6D88\u606F\u6743\u9650\u548C\u8FDE\u63A5\u72B6\u6001\u3002":"\u26A0\uFE0F Repair verification failed: the dedicated test card could not be sent, so card.action.trigger cannot be confirmed restored. Do not authorize again; check the bot message permission and connection status first.","\u26A0\uFE0F \u4FEE\u590D\u9A8C\u8BC1\u4E2D\u65AD\uFF1ARuntime \u5DF2\u505C\u6B62\uFF0C\u672A\u5B8C\u6210 card.action.trigger \u5B9E\u6D4B\uFF0C\u4E0D\u80FD\u786E\u8BA4\u4FEE\u590D\u6210\u529F\u3002\u8BF7\u4E0D\u8981\u91CD\u590D\u6388\u6743\uFF1B\u5148\u7B49\u5F85\u673A\u5668\u4EBA\u6062\u590D\u8FDE\u63A5\u3002":"\u26A0\uFE0F Repair verification interrupted: the Runtime stopped before the card.action.trigger test completed, so the repair cannot be confirmed. Do not authorize again; wait for the bot to reconnect."};var zU={"\u5DF2\u8FDE\u63A5 DeepSeek Harness\uFF0C\u6B63\u5728\u601D\u8003\u2026":"Connected to DeepSeek Harness, thinking\u2026","\u9489\u9489\u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"The DingTalk bot is connected to DeepSeek Harness.","\u9489\u9489\u672A\u80FD\u6362\u53D6\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\uFF1B\u82E5\u6301\u7EED\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u673A\u5668\u4EBA\u7684\u201C\u4F01\u4E1A\u5185\u673A\u5668\u4EBA\u53D1\u9001\u6D88\u606F\u6743\u9650\u201D\u3002":`DingTalk could not provide the image download address. Please resend; if it keeps failing, check the bot's "Send messages as an internal robot" permission.`,"\u9489\u9489\u6CA1\u6709\u8FD4\u56DE\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"DingTalk did not return an image download address. Please resend.","\u9489\u9489\u8FD4\u56DE\u7684\u56FE\u7247\u4E34\u65F6\u5730\u5740\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"The temporary image address returned by DingTalk could not be read. Please resend.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u53D1\u9001\u7ED3\u679C\u672A\u80FD\u786E\u8BA4\uFF0C\u8BF7\u5148\u68C0\u67E5\u804A\u5929\u5185\u662F\u5426\u5DF2\u6536\u5230\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u8BD5\u3002":'Delivery of the result file "{name}" could not be confirmed. Please check whether it already arrived in the chat before retrying.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u9489\u9489\u5E94\u7528\u6216\u673A\u5668\u4EBA\u7F3A\u5C11\u6587\u4EF6\u6D88\u606F\u6743\u9650\u3002\u8BF7\u5F00\u901A\u5E94\u7528 qyapi_base \u6743\u9650\uFF0C\u5E76\u786E\u8BA4\u673A\u5668\u4EBA\u5177\u5907\u6587\u4EF6\u6D88\u606F\u53D1\u9001\u80FD\u529B\u3002":`Result file "{name}" was generated, but the DingTalk app or bot lacks file message permission. Enable the app's qyapi_base permission and make sure the bot can send file messages.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D\u9489\u9489\u673A\u5668\u4EBA\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'Result file "{name}" exceeds the file size limit of the current DingTalk bot and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u9489\u9489\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'Result file "{name}" was rate-limited by DingTalk and could not be sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u9489\u9489\u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6D88\u606F\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u7C7B\u578B\u548C\u673A\u5668\u4EBA\u6587\u4EF6\u6D88\u606F\u914D\u7F6E\u3002":`Result file "{name}" was generated, but DingTalk rejected the file message. Check the file type and the bot's file message configuration.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7\u9489\u9489\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'Result file "{name}" was generated but could not be sent via DingTalk right now. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u5DF2\u751F\u6210\u3002":"The result file has been generated.","\u9489\u9489\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The DingTalk bot is connected to DeepSeek Harness normally.","\u9489\u9489\u547D\u4EE4\u5904\u7406\u5931\u8D25\u3002":"Failed to process the DingTalk command.","\u9489\u9489\u6D88\u606F\u6CA1\u6709\u5B89\u5168\u7684\u56DE\u590D\u5730\u5740\u3002":"The DingTalk message has no safe reply address.","\u9489\u9489\u5BA1\u6279\u5904\u7406\u5931\u8D25\u3002":"Failed to process the DingTalk approval.","\u9489\u9489\u6D88\u606F\u5904\u7406\u5931\u8D25\u3002":"Failed to process the DingTalk message.","\u9489\u9489\u6D88\u606F\u683C\u5F0F\u65E0\u6548\u3002":"Invalid DingTalk message format.","\u9489\u9489\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the DingTalk interaction question.",\u9489\u9489\u7528\u6237:"DingTalk user",\u9489\u9489\u673A\u5668\u4EBA:"DingTalk bot",\u8EAB\u4EFD\u5DF2\u9690\u85CF:"Identity hidden","\u9489\u9489\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The DingTalk bot credentials are missing. Remove the bot and scan the QR code again.","\u9489\u9489\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The DingTalk connection is not ready. Please try again later.","\u9489\u9489\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The DingTalk connection is still not ready. Please try again later.","\u626B\u7801\u63A5\u5165\u5DF2\u53D6\u6D88\u3002":"QR code setup has been cancelled.","\u65E0\u6CD5\u751F\u6210\u9489\u9489\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not generate the DingTalk QR code. Please try again later.","\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002":"The QR code has expired. Generate a new one.","\u9489\u9489\u5DF2\u63A5\u5165\uFF0C\u4F46\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"DingTalk is connected, but the message connection is not ready yet. Please try again later.","\u9489\u9489\u672A\u5B8C\u6210\u673A\u5668\u4EBA\u6388\u6743\uFF0C\u8BF7\u91CD\u65B0\u626B\u7801\u3002":"DingTalk did not complete the bot authorization. Please scan the QR code again.","\u9489\u9489\u6388\u6743\u72B6\u6001\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u91CD\u8BD5\u3002":"The DingTalk authorization status is temporarily unavailable. Retrying.","\u9489\u9489\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002":"DingTalk authorization succeeded, but the configuration could not be saved safely.","\u9489\u9489\u6388\u6743\u67E5\u8BE2\u6682\u65F6\u5931\u8D25\uFF0C\u6B63\u5728\u91CD\u8BD5\u3002":"The DingTalk authorization query failed temporarily. Retrying.","\u9489\u9489\u673A\u5668\u4EBA\uFF08{clientId}\uFF09":"DingTalk bot ({clientId})","\u9489\u9489 Stream \u6D88\u606F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The DingTalk Stream message connection is running normally",\u9489\u9489\u6D88\u606F\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The DingTalk message connection is currently offline"};var VU={"\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"The Enterprise WeChat bot is connected to DeepSeek Harness.","\u5F53\u524D\u5F85\u5904\u7406\u56FE\u7247\u8F83\u591A\uFF0C\u8BF7\u7A0D\u540E\u91CD\u65B0\u53D1\u9001\u3002":"Too many images are pending. Please send them again later.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u4F01\u4E1A\u5FAE\u4FE1\u667A\u80FD\u673A\u5668\u4EBA\u7F3A\u5C11\u7D20\u6750\u4E0A\u4F20\u6216\u6587\u4EF6\u6D88\u606F\u80FD\u529B\uFF0C\u8BF7\u68C0\u67E5\u673A\u5668\u4EBA\u6743\u9650\u3002":'The result file "{name}" was generated, but the Enterprise WeChat bot lacks media upload or file message capability. Please check the bot permissions.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the file size this Enterprise WeChat bot can send and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0C\u4F01\u4E1A\u5FAE\u4FE1\u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002":'The result file "{name}" is empty. Enterprise WeChat does not allow sending empty files.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u4F01\u4E1A\u5FAE\u4FE1\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was rate-limited by Enterprise WeChat and could not be sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u4F01\u4E1A\u5FAE\u4FE1\u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6216\u6587\u4EF6\u6D88\u606F\u3002":'The result file "{name}" was generated, but Enterprise WeChat rejected the file or file message.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent via Enterprise WeChat right now. Please try again later.',"\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u4F46\u6CA1\u6709\u751F\u6210\u53EF\u663E\u793A\u7684\u6587\u672C\u3002":"The task completed, but no displayable text was generated.","\u76EE\u524D\u652F\u6301\u6587\u5B57\u3001\u56FE\u7247\u548C\u8BED\u97F3\u8F6C\u5199\u6D88\u606F\u3002":"Currently only text, images, and voice transcription messages are supported.","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The connection between the Enterprise WeChat bot and DeepSeek Harness is working.","\u6B63\u5728\u601D\u8003\u4E2D\u2026":"Thinking\u2026","\u4F01\u4E1A\u5FAE\u4FE1\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the Enterprise WeChat interaction question.","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The Enterprise WeChat bot credentials are missing. Please remove the bot and scan the QR code again.","\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The Enterprise WeChat connection is not ready. The plugin will retry automatically.","\u626B\u7801\u7ED1\u5B9A\u5DF2\u53D6\u6D88\u3002":"QR code binding has been cancelled.","\u65E0\u6CD5\u751F\u6210\u4F01\u4E1A\u5FAE\u4FE1\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Unable to generate the Enterprise WeChat QR code. Please try again later.","\u4F01\u4E1A\u5FAE\u4FE1\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002":"The Enterprise WeChat QR code has expired. Please generate a new one.","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u5DF2\u7ED1\u5B9A\uFF0C\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"The Enterprise WeChat bot is bound, but the message connection is not ready yet.","\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The Enterprise WeChat connection is still not ready. Please try again later.","\u4F01\u4E1A\u5FAE\u4FE1\u626B\u7801\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The Enterprise WeChat QR scan was not completed. Please generate a new QR code.","\u4F01\u4E1A\u5FAE\u4FE1\u626B\u7801\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The Enterprise WeChat QR service is temporarily unavailable. Please generate a new QR code.","\u4F01\u4E1A\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002":"Enterprise WeChat authorization succeeded, but the connection configuration could not be saved safely.",\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA:"Enterprise WeChat bot","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\uFF08{botId}\uFF09":"Enterprise WeChat bot ({botId})","\u4F01\u4E1A\u5FAE\u4FE1 WebSocket \u957F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The Enterprise WeChat WebSocket long connection is running normally","\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The Enterprise WeChat connection is not ready. The plugin will retry automatically",\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The Enterprise WeChat connection is currently offline"};var WU={"QQ \u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"The QQ bot is connected to DeepSeek Harness.","\u56DE\u7B54\u8F83\u957F\uFF0C\u540E\u7EED\u5185\u5BB9\u672A\u80FD\u901A\u8FC7 QQ \u5B8C\u6574\u53D1\u9001\uFF0C\u8BF7\u56DE\u590D\u201C\u7EE7\u7EED\u201D\u3002":"The answer is long and the rest could not be sent fully through QQ. Reply \u201C\u7EE7\u7EED\u201D (continue) to receive it.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46 QQ \u4ECA\u65E5\u6587\u4EF6\u4E0A\u4F20\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":`The result file "{name}" was generated, but QQ's daily file upload quota is used up. Please try again later.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u5F53\u524D QQ \u673A\u5668\u4EBA\u6CA1\u6709\u6587\u4EF6\u6D88\u606F\u6743\u9650\u3002":'The result file "{name}" was generated, but the current QQ bot does not have file message permission.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D QQ \u673A\u5668\u4EBA\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the file size the current QQ bot can send and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0CQQ \u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002":'The result file "{name}" is empty, and QQ does not allow sending empty files.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB QQ \u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was temporarily rate-limited by QQ and was not sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46 QQ \u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6216\u6587\u4EF6\u6D88\u606F\u3002":'The result file "{name}" was generated, but QQ rejected the file or file message.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7 QQ \u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent via QQ right now. Please try again later.',"QQ \u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The QQ bot is connected to DeepSeek Harness normally.","QQ \u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the QQ interaction question.","QQ \u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The QQ bot credentials are missing. Remove the bot and scan the QR code again.","QQ \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The QQ connection is not ready; the plugin will retry automatically.","QQ \u626B\u7801\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The QQ QR service is temporarily unavailable. Please generate a new QR code.","\u65E0\u6CD5\u751F\u6210 QQ \u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Unable to generate the QQ QR code. Please try again later.","QQ \u673A\u5668\u4EBA\u5DF2\u7ED1\u5B9A\uFF0C\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"The QQ bot is bound, but the message connection is not ready yet.","QQ \u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The QQ connection is still not ready. Please try again later.",QQ\u673A\u5668\u4EBA\u5C1A\u672A\u8FDE\u63A5:"The QQ bot is not connected yet","QQ \u673A\u5668\u4EBA\uFF08{appId}\uFF09":"QQ bot ({appId})",QQ\u673A\u5668\u4EBA:"QQ bot","QQ WebSocket \u957F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The QQ WebSocket long connection is running normally","QQ \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The QQ connection is not ready; the plugin will retry automatically","QQ \u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF":"The QQ connection is currently offline","QQ \u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002":"QQ authorization succeeded, but the connection configuration could not be saved safely."};var ZU={"\u5FAE\u4FE1\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"WeChat is connected to DeepSeek Harness.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u5FAE\u4FE1\u673A\u5668\u4EBA\u5F53\u524D\u6CA1\u6709\u6587\u4EF6\u6D88\u606F\u53D1\u9001\u6743\u9650\uFF0C\u8BF7\u68C0\u67E5\u673A\u5668\u4EBA\u6587\u4EF6\u6D88\u606F\u80FD\u529B\u3002":`The result file "{name}" was generated, but the WeChat bot currently has no permission to send file messages. Please check the bot's file messaging capability.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D\u5FAE\u4FE1\u4F1A\u8BDD\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the file size limit of the current WeChat conversation and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u5FAE\u4FE1\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was temporarily rate-limited by WeChat and was not sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u5FAE\u4FE1\u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6D88\u606F\u3002":'The result file "{name}" was generated, but WeChat rejected the file message.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7\u5FAE\u4FE1\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent via WeChat right now. Please try again later.',"\u76EE\u524D\u652F\u6301\u6587\u5B57\u3001\u56FE\u7247\uFF0C\u4EE5\u53CA\u5FAE\u4FE1\u5DF2\u8F6C\u6210\u6587\u5B57\u7684\u8BED\u97F3\u6D88\u606F\u3002":"Currently supports text, images, and voice messages that WeChat has converted to text.","\u5FAE\u4FE1\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"WeChat is connected to DeepSeek Harness normally.","\u5FAE\u4FE1\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the WeChat interaction question.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u8BFB\u53D6\u73B0\u6709\u767B\u5F55\u51ED\u636E\u3002\u8BF7\u68C0\u67E5 DSH \u51ED\u636E\u5B58\u50A8\u3002":"WeChat was authorized, but the existing login credential could not be read. Please check the DSH credential store.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u767B\u5F55\u51ED\u636E\u65E0\u6CD5\u5199\u5165 DSH \u51ED\u636E\u5B58\u50A8\u3002\u8BF7\u68C0\u67E5\u51ED\u636E\u5B58\u50A8\u662F\u5426\u53EF\u5199\u3002":"WeChat was authorized, but the login credential could not be written to the DSH credential store. Please check that the credential store is writable.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u8D26\u53F7\u914D\u7F6E\u65E0\u6CD5\u5199\u5165\u672C\u673A\u3002\u8BF7\u68C0\u67E5 DSH_HOME \u76EE\u5F55\u6743\u9650\u3002":"WeChat was authorized, but the account configuration could not be written locally. Please check the DSH_HOME directory permissions.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u521D\u59CB\u5316\u8D26\u53F7\u72B6\u6001\u6216\u5DE5\u4F5C\u533A\u3002\u8BF7\u68C0\u67E5 DSH_HOME \u548C\u5DE5\u4F5C\u533A\u76EE\u5F55\u3002":"WeChat was authorized, but the account state or workspace could not be initialized. Please check DSH_HOME and the workspace directories.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u63D2\u4EF6\u65E0\u6CD5\u8FDE\u63A5\u672C\u673A Harness\u3002\u8BF7\u68C0\u67E5 dsh web \u5730\u5740\u548C\u7AEF\u53E3\u3002":"WeChat was authorized, but the plugin could not connect to the local Harness. Please check the dsh web address and port.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u8D85\u65F6\u3002\u8BF7\u786E\u8BA4 dsh web \u672A\u963B\u585E\u3002":"WeChat was authorized, but the Harness health check timed out. Please confirm dsh web is not blocked.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u9700\u8981\u8EAB\u4EFD\u8BA4\u8BC1\u3002\u8BF7\u68C0\u67E5\u4EE3\u7406\u3001\u7F51\u5173\u6216\u81EA\u5B9A\u4E49\u9274\u6743\u914D\u7F6E\u3002":"WeChat was authorized, but the Harness health check requires authentication. Please check proxy, gateway, or custom auth configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u672C\u673A Harness \u8BF7\u6C42\u88AB\u4EE3\u7406\u8981\u6C42\u8BA4\u8BC1\u3002\u8BF7\u8BA9\u56DE\u73AF\u5730\u5740\u7ED5\u8FC7\u4EE3\u7406\uFF0C\u5E76\u68C0\u67E5 NO_PROXY \u914D\u7F6E\u3002":"WeChat was authorized, but the local Harness request was challenged for proxy authentication. Please bypass the proxy for loopback addresses and check the NO_PROXY configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5F02\u5E38\u62D2\u7EDD\u4E86\u56DE\u73AF\u5730\u5740\u7684\u5065\u5EB7\u68C0\u67E5\u3002\u8BF7\u68C0\u67E5 HTTP \u4EE3\u7406\u3001Harness \u6E90\u7801\u7248\u672C\u548C\u6784\u5EFA\u4EA7\u7269\u3002":"WeChat was authorized, but Harness unexpectedly rejected the health check from a loopback address. Please check the HTTP proxy, Harness source version, and build artifacts.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u7684 Host \u4FE1\u4EFB\u68C0\u67E5\u62D2\u7EDD\u4E86\u975E\u56DE\u73AF\u5730\u5740\u8BF7\u6C42\u3002\u8BF7\u68C0\u67E5 harnessBaseUrl \u4E0E trustedHosts \u914D\u7F6E\u3002":"WeChat was authorized, but the Harness Host trust check rejected a non-loopback request. Please check the harnessBaseUrl and trustedHosts configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u5065\u5EB7\u68C0\u67E5\u6536\u5230\u4E86\u975E Harness \u6807\u51C6\u7684 403 \u62D2\u7EDD\u54CD\u5E94\u3002\u8BF7\u68C0\u67E5\u4EE3\u7406\u6216\u7F51\u5173\u914D\u7F6E\u3002":"WeChat was authorized, but the health check received a non-standard Harness 403 rejection. Please check the proxy or gateway configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u627E\u4E0D\u5230 Harness \u5065\u5EB7\u68C0\u67E5\u63A5\u53E3\u3002\u8BF7\u786E\u8BA4 Harness \u4E0E\u63D2\u4EF6\u7248\u672C\u517C\u5BB9\u3002":"WeChat was authorized, but the Harness health check endpoint was not found. Please confirm the Harness and plugin versions are compatible.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u8FD4\u56DE\u670D\u52A1\u9519\u8BEF\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but the Harness health check returned a server error. Please check the dsh web logs.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002\u8BF7\u786E\u8BA4 Harness \u4E0E\u63D2\u4EF6\u7248\u672C\u517C\u5BB9\u3002":"WeChat was authorized, but Harness returned an unrecognized response. Please confirm the Harness and plugin versions are compatible.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u62D2\u7EDD\u4E86\u5065\u5EB7\u68C0\u67E5\u8BF7\u6C42\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but Harness rejected the health check request. Please check the dsh web logs.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u53D1\u751F\u672A\u77E5\u9519\u8BEF\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but the Harness health check failed with an unknown error. Please check the dsh web logs.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u6D88\u606F\u8FDE\u63A5\u521D\u59CB\u5316\u5931\u8D25\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u540E\u91CD\u8BD5\u3002":"WeChat was authorized, but the message connection failed to initialize. Please check the dsh web logs and try again.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u6FC0\u6D3B\u8FC7\u7A0B\u4E2D\u53D1\u751F\u672A\u77E5\u9519\u8BEF\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but an unknown error occurred during activation. Please check the dsh web logs.","\u767B\u5F55\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u8D26\u53F7\u540E\u91CD\u65B0\u626B\u7801\u3002":"The login credential is missing. Please remove the account and scan the QR code again.","\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The WeChat connection is not ready; the plugin will retry automatically.","\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The WeChat connection is not ready; the plugin will retry automatically","\u65E0\u6CD5\u751F\u6210\u5FAE\u4FE1\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Unable to generate the WeChat QR code. Please try again later.","\u5FAE\u4FE1\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The WeChat connection is still not ready. Please try again later.",\u5FAE\u4FE1\u673A\u5668\u4EBA:"WeChat Bot","\u5FAE\u4FE1\u673A\u5668\u4EBA\uFF08{name}\uFF09":"WeChat Bot ({name})",\u5FAE\u4FE1\u6D88\u606F\u957F\u8F6E\u8BE2\u8FD0\u884C\u6B63\u5E38:"WeChat message long-polling is running normally",\u5FAE\u4FE1\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The WeChat connection is currently offline","\u914D\u5BF9\u7801\u591A\u6B21\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The pairing code was entered incorrectly too many times. Please generate a new QR code.","\u8BE5\u5FAE\u4FE1\u8D26\u53F7\u5DF2\u7ED1\u5B9A\uFF0C\u4F46\u672C\u673A\u6CA1\u6709\u53EF\u6062\u590D\u7684\u51ED\u636E\u3002":"This WeChat account is already bound, but no recoverable credential exists on this machine.","\u5FAE\u4FE1\u6388\u6743\u6210\u529F\uFF0C\u4F46\u8FD4\u56DE\u7684\u8D26\u53F7\u51ED\u636E\u4E0D\u5B8C\u6574\u3002":"WeChat authorization succeeded, but the returned account credential is incomplete.","\u5FAE\u4FE1\u767B\u5F55\u51ED\u636E\u5DF2\u5931\u6548\uFF0C\u8BF7\u79FB\u9664\u8D26\u53F7\u540E\u91CD\u65B0\u626B\u7801\u3002":"The WeChat login credential has expired. Please remove the account and scan the QR code again.","\u5FAE\u4FE1\u6D88\u606F\u540C\u6B65\u8BF7\u6C42\u88AB\u62D2\u7EDD\u3002":"The WeChat message sync request was rejected.","\u5FAE\u4FE1\u56FE\u7247\u7684\u52A0\u5BC6\u5BC6\u94A5\u65E0\u6548\u3002":"The encryption key of the WeChat image is invalid.","\u5FAE\u4FE1\u56FE\u7247\u7684\u52A0\u5BC6\u6570\u636E\u65E0\u6548\u3002":"The encrypted data of the WeChat image is invalid.","\u5FAE\u4FE1\u56FE\u7247\u89E3\u5BC6\u5931\u8D25\u3002":"Failed to decrypt the WeChat image.","\u5FAE\u4FE1\u56FE\u7247\u6CA1\u6709\u53EF\u7528\u7684\u4E0B\u8F7D\u5730\u5740\u3002":"The WeChat image has no usable download URL.","\u5FAE\u4FE1\u56FE\u7247\u7684\u4E0B\u8F7D\u5730\u5740\u65E0\u6548\u3002":"The download URL of the WeChat image is invalid.","\u5FAE\u4FE1\u56FE\u7247\u7684\u4E0B\u8F7D\u5730\u5740\u4E0D\u53D7\u4FE1\u4EFB\u3002":"The download URL of the WeChat image is not trusted.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u8FDE\u63A5\u5730\u5740\u3002":"The WeChat service returned an invalid connection URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u53D7\u4FE1\u4EFB\u7684\u8FDE\u63A5\u5730\u5740\u3002":"The WeChat service returned an untrusted connection URL.","\u5FAE\u4FE1\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u626B\u7801\u5730\u5740\u3002":"The WeChat service did not return a QR-code URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u626B\u7801\u5730\u5740\u3002":"The WeChat service returned an invalid QR-code URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u53D7\u4FE1\u4EFB\u7684\u626B\u7801\u5730\u5740\u3002":"The WeChat service returned an untrusted QR-code URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u6587\u4EF6\u4E0A\u4F20\u5730\u5740\u3002":"The WeChat service returned an invalid file upload URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u53D7\u4FE1\u4EFB\u7684\u6587\u4EF6\u4E0A\u4F20\u5730\u5740\u3002":"The WeChat service returned an untrusted file upload URL.","\u5FAE\u4FE1\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u6587\u4EF6\u4E0A\u4F20\u5730\u5740\u3002":"The WeChat service did not return a file upload URL.","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u88AB\u62D2\u7EDD\uFF08HTTP {status}\uFF09\u3002":"The WeChat file upload was rejected (HTTP {status}).","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF08HTTP {status}\uFF09\u3002":"The WeChat file upload failed (HTTP {status}).","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u54CD\u5E94\u7F3A\u5C11\u4E0B\u8F7D\u53C2\u6570\u3002":"The WeChat file upload response is missing the download parameter.","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\u3002":"The WeChat file upload failed.","\u62D2\u7EDD\u8BBF\u95EE\u4E0D\u53D7\u4FE1\u4EFB\u7684\u5FAE\u4FE1\u670D\u52A1\u5730\u5740\u3002":"Refusing to access an untrusted WeChat service URL.","\u5FAE\u4FE1\u670D\u52A1\u8BF7\u6C42\u5931\u8D25\uFF08HTTP {status}\uFF09\u3002":"The WeChat service request failed (HTTP {status}).","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u54CD\u5E94\u3002":"The WeChat service returned an unparseable response.","\u5FAE\u4FE1\u670D\u52A1\u8BF7\u6C42\u8D85\u65F6\u3002":"The WeChat service request timed out.","\u6682\u65F6\u65E0\u6CD5\u8BBF\u95EE\u5FAE\u4FE1\u670D\u52A1\u3002":"The WeChat service is temporarily unreachable.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u626B\u7801\u72B6\u6001\u3002":"The WeChat service returned an unrecognized QR-code status.","\u5FAE\u4FE1\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u4E8C\u7EF4\u7801\u4EE4\u724C\u3002":"The WeChat service did not return a QR-code token.","\u5FAE\u4FE1\u670D\u52A1\u62D2\u7EDD\u4E86\u56DE\u590D\u6D88\u606F\u3002":"The WeChat service rejected the reply message.","\u5FAE\u4FE1\u670D\u52A1\u62D2\u7EDD\u4E86\u6587\u4EF6\u4E0A\u4F20\u8BF7\u6C42\u3002":"The WeChat service rejected the file upload request.","\u5FAE\u4FE1\u670D\u52A1\u62D2\u7EDD\u4E86\u6587\u4EF6\u6D88\u606F\u3002":"The WeChat service rejected the file message.","\u5FAE\u4FE1\u8D26\u53F7\u8FDE\u63A5\u542F\u52A8\u5931\u8D25\u3002":"Failed to start the WeChat account connection."};var XU={Slack\u673A\u5668\u4EBA:"Slack bot","Slack\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u63A5\u5165\u3002":"Slack bot credentials are missing. Remove the bot and connect it again.","Slack Socket Mode \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The Slack Socket Mode connection is not ready yet. The plugin will retry automatically.","Slack\u673A\u5668\u4EBA\u5DF2\u63A5\u5165\uFF0CSocket Mode \u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"The Slack bot is connected, but the Socket Mode connection is not ready yet.","Slack Socket Mode \u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u4E24\u4E2A Token\u3002":"The Slack Socket Mode connection is still not ready. Check both tokens.",Slack\u673A\u5668\u4EBA\u5C1A\u672A\u8FDE\u63A5:"The Slack bot is not connected yet","Slack Socket Mode \u957F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The Slack Socket Mode long-lived connection is running normally","Slack\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The Slack connection is not ready. The plugin will retry automatically",Slack\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The Slack connection is currently offline","Slack \u672A\u6388\u6743\u673A\u5668\u4EBA\u8BFB\u53D6\u8BE5\u6587\u4EF6\u3002\u8BF7\u4E3A\u5E94\u7528\u6DFB\u52A0 files:read \u540E\u91CD\u65B0\u5B89\u88C5\uFF0C\u518D\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002":"Slack has not granted the bot access to this file. Add the files:read scope to the app, reinstall it, then send the image again.","Slack Bot Token \u5FC5\u987B\u4EE5 xoxb- \u5F00\u5934\u3002":"The Slack Bot Token must start with xoxb-.","Slack App Token \u5FC5\u987B\u4EE5 xapp- \u5F00\u5934\u3002":"The Slack App Token must start with xapp-.","Slack Bot Token \u6CA1\u6709\u8FD4\u56DE\u5B8C\u6574\u7684\u673A\u5668\u4EBA\u8EAB\u4EFD\u3002":"The Slack Bot Token did not return a complete bot identity.","Slack App Token \u65E0\u6CD5\u521B\u5EFA Socket Mode \u8FDE\u63A5\uFF0C\u8BF7\u786E\u8BA4\u5DF2\u542F\u7528 Socket Mode \u548C connections:write\u3002":"The Slack App Token could not create a Socket Mode connection. Make sure Socket Mode and connections:write are enabled."};var $U={\u5F00\u542F\u4E00\u4E2A\u5168\u65B0\u4F1A\u8BDD:"Start a brand-new Session",\u538B\u7F29\u5F53\u524D\u4F1A\u8BDD\u7684\u8F83\u65E9\u4E0A\u4E0B\u6587:"Compact the earlier context of the current Session",\u5207\u6362\u5DE5\u4F5C\u533A:"Switch Workspace",\u5217\u51FA\u5DE5\u4F5C\u533A\u7EDD\u5BF9\u8DEF\u5F84:"List Workspace absolute paths","\u5217\u51FA\u4F1A\u8BDD ID \u548C\u6807\u9898":"List Session IDs and titles",\u5C06\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u5230\u6307\u5B9A\u4F1A\u8BDD:"Bind the current chat to a specific Session",\u6309\u5E8F\u53F7\u5217\u51FA\u6240\u6709\u53EF\u7528\u6A21\u578B:"List all available models by number",\u67E5\u770B\u6216\u5207\u6362\u5F53\u524D\u4F1A\u8BDD\u6A21\u578B:"View or switch the model of the current Session","\u5217\u51FA\u53EF\u7528 Agent Preset":"List available Agent Presets","\u67E5\u770B\u6216\u8BBE\u7F6E\u65B0\u4F1A\u8BDD Agent Preset":"View or set the Agent Preset for new Sessions",\u505C\u6B62\u5F53\u524D\u4EFB\u52A1:"Stop the current task",\u7EA0\u504F\u5F53\u524D\u4EFB\u52A1:"Steer the current task",\u68C0\u67E5\u8FDE\u63A5\u72B6\u6001:"Check connection status",\u67E5\u770B\u63D2\u4EF6\u7248\u672C:"Show plugin version",\u663E\u793A\u5E2E\u52A9:"Show help","\u8BE5 Telegram \u673A\u5668\u4EBA\u5DF2\u914D\u7F6E Webhook\uFF0C\u8BF7\u5148\u5728\u539F\u670D\u52A1\u4E2D\u79FB\u9664 Webhook \u540E\u91CD\u8BD5\u3002":"This Telegram bot already has a Webhook configured. Remove the Webhook from the original service and try again.",Telegram\u673A\u5668\u4EBA:"Telegram Bot"," Bot API \u957F\u8F6E\u8BE2":" Bot API long polling"};var eH={"Discord Bot Token \u65E0\u6548\uFF0C\u8BF7\u91CD\u65B0\u586B\u5199\u3002":"The Discord Bot Token is invalid. Please enter it again.","Discord Gateway Intents \u914D\u7F6E\u4E0D\u6B63\u786E\uFF0C\u8BF7\u68C0\u67E5 Developer Portal \u7684 Bot \u8BBE\u7F6E\u3002":"The Discord Gateway Intents are misconfigured. Please check the Bot settings in the Developer Portal.",Discord\u673A\u5668\u4EBA:"Discord Bot"," Gateway \u957F\u8FDE\u63A5":" Gateway long-lived connection"};var AH={"WhatsApp \u5173\u8054\u8BBE\u5907\u5DF2\u5931\u6548\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The WhatsApp linked device is no longer valid. Remove it and scan the QR code again.","WhatsApp \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The WhatsApp connection is not ready yet; the plugin will retry automatically.","WhatsApp \u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The WhatsApp connection is still not ready. Please try again later.",WhatsApp\u673A\u5668\u4EBA\u5C1A\u672A\u8FDE\u63A5:"The WhatsApp bot is not connected yet",WhatsApp\u673A\u5668\u4EBA:"WhatsApp bot","WhatsApp Web \u5173\u8054\u8BBE\u5907\u8FD0\u884C\u6B63\u5E38":"The WhatsApp Web linked device is working normally","WhatsApp \u8FDE\u63A5\u672A\u5C31\u7EEA":"The WhatsApp connection is not ready","WhatsApp \u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF":"The WhatsApp connection is currently offline","WhatsApp \u5DF2\u7ED1\u5B9A\uFF0C\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"WhatsApp is linked, but the messaging connection is not ready yet.","WhatsApp \u5DF2\u626B\u7801\uFF0C\u4F46\u65E0\u6CD5\u4FDD\u5B58\u5173\u8054\u8BBE\u5907\u3002":"The QR code was scanned, but the linked device could not be saved.","\u65E0\u6CD5\u8FDE\u63A5 WhatsApp\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"Unable to connect to WhatsApp. Please generate a new QR code.",WhatsApp\u8D26\u53F7:"WhatsApp account"," Web \u5173\u8054\u8BBE\u5907":" Web linked device"};var tH={"AI Office \u62D2\u7EDD\u4E86 Device Token\u3002":"AI Office rejected the Device Token.","AI Office Connector Hook \u5C1A\u672A\u5C31\u7EEA\u3002":"The AI Office Connector Hook is not ready yet.","AI Office Connector \u534F\u8BAE\u7248\u672C\u4E0D\u517C\u5BB9\u3002":"The AI Office Connector protocol version is incompatible.","\u672C\u673A\u6682\u65F6\u65E0\u6CD5\u8BBF\u95EE AI Office\u3002":"This machine cannot reach AI Office right now.","AI Office \u8FDE\u63A5\u5DF2\u4E2D\u65AD\u3002":"The AI Office connection was interrupted.","\u672C\u673A Harness \u5DF2\u505C\u6B62\u8FD9\u6B21\u6267\u884C\u3002":"The local Harness stopped this run.","Office Job \u5DF2\u88AB\u9886\u53D6\u3001\u53D6\u6D88\u6216\u7ED3\u675F\u3002":"The Office Job has already been claimed, cancelled, or finished.","\u672C\u673A Harness \u672A\u80FD\u5B8C\u6210\u4EFB\u52A1\uFF1B\u8BF7\u68C0\u67E5 Harness \u4F1A\u8BDD\u540E\u91CD\u8BD5\u3002":"The local Harness could not complete the task; check the Harness Session and try again.","Office Job \u5F15\u7528\u4E86\u672C\u673A\u672A\u914D\u7F6E\u7684 Workspace/Preset alias\u3002":"The Office Job references a Workspace/Preset alias that is not configured locally.","\u4F60\u6B63\u5728\u672C\u673A DeepSeek Harness \u4E2D\u7EE7\u7EED\u4E00\u4E2A\u6765\u81EA AI Office \u7684\u4EFB\u52A1\u3002":"You are continuing an AI Office task inside the local DeepSeek Harness.","\u53EA\u5728\u5F53\u524D Workspace \u5185\u884C\u52A8\u3002\u5B8C\u6210\u540E\u5FC5\u987B\u8FD4\u56DE\uFF1A\u7ED3\u679C\u6458\u8981\u3001\u6539\u52A8\u6587\u4EF6\u3001\u9A8C\u8BC1\u8BC1\u636E\u3001\u672A\u89E3\u51B3\u98CE\u9669\u3002":"Act only within the current Workspace. When finished you must return: a result summary, changed files, verification evidence, and unresolved risks.","## \u672C\u673A Instruction Preset":"## Local Instruction Preset","## \u672C\u8F6E\u8865\u5145\u6307\u4EE4":"## Additional Instructions for This Round","## Office \u65F6\u95F4\u7EBF":"## Office Timeline","\u6279\u51C6 {tool}":"Approve {tool}","Harness \u5DE5\u5177":"Harness tool","Harness \u9700\u8981 {count} \u9879\u8865\u5145\u4FE1\u606F":"Harness needs {count} pieces of additional information","\u5DF2\u9886\u53D6 Job\uFF0C\u51C6\u5907 Workspace alias\uFF1A{alias}":"Job claimed; preparing Workspace alias: {alias}","Harness Session \u5DF2\u521B\u5EFA\u3002":"Harness Session created.","\u6B63\u5728\u4F7F\u7528 {tool}\u2026":"Using {tool}\u2026"};var rH=Object.freeze(Object.assign({},YU,jU,JU,qU,zU,VU,WU,ZU,XU,$U,eH,AH,tH));var aH="zh";function iH(n){let t=typeof n=="string"?n.trim().toLowerCase():"";aH=t==="english"||/^en(?:[-_].*)?$/u.test(t)?"en":"zh"}function D(n,t){if(typeof n!="string")return n;let o=aH==="en"?rH[n]??n:n;return t==null?o:o.replace(/\{(\w+)\}/g,(i,e)=>Object.hasOwn(t,e)?String(t[e]):i)}var yb=Object.freeze({version:1,bots:Object.freeze([])}),ige=new Set(["clientId","secretRef","approvedSenders"]);function zo(n){return typeof n=="string"&&n.trim()?n.trim():null}function oge(n){return $se("sha256").update(n).digest("hex")}function sH(n){let t=zo(n);return t&&/^dt_[a-f0-9]{24}$/.test(t)?t:null}function nge(n){let t=zo(n);return t&&/^DSH_DINGTALK_BOT_SECRET_[A-F0-9]{24}$/.test(t)?t:null}function sge(n){let t=zo(n);return t&&/^dt_sender_[a-f0-9]{32}$/.test(t)?t:null}function gge(n){let t=typeof n=="string"?{staffId:n}:n;if(!t||typeof t!="object"||Array.isArray(t))return null;let o=sge(t.senderKey),i=zo(t.staffId);return!o||!i?null:Object.freeze({senderKey:o,staffId:i,displayName:zo(t.displayName),approvedAt:zo(t.approvedAt)})}function cge(n){if(!Array.isArray(n))return null;let t=n.map(gge);if(t.some(e=>e===null))return null;let o=new Set,i=new Set;for(let e of t){if(o.has(e.staffId)||i.has(e.senderKey))return null;o.add(e.staffId),i.add(e.senderKey)}return Object.freeze(t)}function gf(n){let t=zo(n);if(!t)throw new TypeError("clientId is required");let o=oge(t).slice(0,24);return Object.freeze({botId:`dt_${o}`,secretRef:`DSH_DINGTALK_BOT_SECRET_${o.toUpperCase()}`})}function gH(){return`dt_sender_${nH().replaceAll("-","")}`}function mb(n){return zo(n)?D("\u8EAB\u4EFD\u5DF2\u9690\u85CF"):D("\u9489\u9489\u7528\u6237")}function Sb(n){let t=zo(n);return t?t.length<=8?`${t.slice(0,2)}\u2022\u2022\u2022\u2022`:`${t.slice(0,4)}\u2022\u2022\u2022\u2022${t.slice(-4)}`:D("\u9489\u9489\u673A\u5668\u4EBA")}function cH(n,{stored:t=!1}={}){if(!n||typeof n!="object"||Array.isArray(n)||"clientSecret"in n||"client_secret"in n||"deviceCode"in n||t&&Object.keys(n).some(r=>!ige.has(r)))return null;let o=zo(n.clientId),i=nge(n.secretRef),e=cge(n.approvedSenders??[]);if(!o||!i||!e)return null;let a=gf(o);return a.secretRef!==i||(n.botId===void 0?a.botId:sH(n.botId))!==a.botId?null:Object.freeze({botId:a.botId,clientId:o,secretRef:i,approvedSenders:e})}function Ige(n){if(!n||n.version!==1||!Array.isArray(n.bots))return null;let t=n.bots.map(a=>cH(a,{stored:!0}));if(t.some(a=>a===null))return null;let o=new Set,i=new Set,e=new Set;for(let a of t){if(o.has(a.botId)||i.has(a.clientId)||e.has(a.secretRef))return null;o.add(a.botId),i.add(a.clientId),e.add(a.secretRef)}return Object.freeze({version:1,bots:Object.freeze(t)})}function lge(n){return{version:1,bots:n.bots.map(t=>({clientId:t.clientId,secretRef:t.secretRef,approvedSenders:t.approvedSenders.map(o=>({senderKey:o.senderKey,staffId:o.staffId,displayName:o.displayName,approvedAt:o.approvedAt}))}))}}var sf=class{#e;#A=yb;#t=Promise.resolve();constructor(t){if(!zo(t))throw new TypeError("config path is required");this.#e=t}async load(){try{let t=Ige(JSON.parse(await Age(this.#e,"utf8")));if(!t)throw new Error("dsh-dingtalk config contains invalid bot data");this.#A=t}catch(t){if(t?.code!=="ENOENT")throw t;this.#A=yb}return this}list(){return structuredClone(this.#A.bots)}get(t){let o=this.#A.bots.find(i=>i.botId===t);return o?structuredClone(o):null}getByClientId(t){let o=this.#A.bots.find(i=>i.clientId===t);return o?structuredClone(o):null}async save(t){let o=cH(t);if(!o)throw new Error("Refusing to persist invalid dsh-dingtalk bot data");return this.#r(i=>{if(i.find(A=>(A.clientId===o.clientId||A.secretRef===o.secretRef)&&A.botId!==o.botId))throw new Error("Duplicate DingTalk bot identity");let a=i.findIndex(A=>A.botId===o.botId);return a===-1?i.push(o):i[a]=o,structuredClone(o)})}async remove(t){if(!sH(t))throw new TypeError("Invalid DingTalk bot id");return this.#r(o=>{let i=o.findIndex(a=>a.botId===t);if(i===-1)return null;let[e]=o.splice(i,1);return structuredClone(e)})}async clear(){let t=this.#t.then(async()=>{try{await oH(this.#e)}catch(o){if(o?.code!=="ENOENT")throw o}this.#A=yb});this.#t=t.then(()=>{},()=>{}),await t}async#r(t){let o,i=this.#t.then(async()=>{let e=[...this.#A.bots];o=t(e);let a=Object.freeze({version:1,bots:Object.freeze(e)});await this.#a(a),this.#A=a});return this.#t=i.then(()=>{},()=>{}),await i,o}async#a(t){await ege(age(this.#e),{recursive:!0,mode:448});let o=`${this.#e}.${process.pid}.${nH()}.tmp`;try{await rge(o,`${JSON.stringify(lge(t),null,2)}
|
|
135
|
+
**{total}** sessions in total{paging}`,"\uFF08\u7B2C {page}/{pageCount} \u9875\uFF09":" (page {page}/{pageCount})","\u2B50\u53D6\u5173":"\u2B50 Unwatch","\u2B50\u5173\u6CE8":"\u2B50 Watch","\u25C0 \u4E0A\u4E00\u9875":"\u25C0 Previous","\u4E0B\u4E00\u9875 \u25B6":"Next \u25B6","\u56DE\u590D\u6570\u5B57\uFF081~N\uFF09\u7ED1\u5B9A\u672C\u9875\u4F1A\u8BDD\u3002":"Reply with a number (1\u2013N) to bind a session on this page.","\u{1F4C2} \u4F1A\u8BDD\u5217\u8868":"\u{1F4C2} Session list","\u5F53\u524D Host \u4E0A\u6CA1\u6709\u5DF2\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\u3002":"No workspaces are registered on the current Host.","\u56DE\u590D\u6570\u5B57\u5207\u6362\u5DE5\u4F5C\u533A\uFF0C\u6216\u70B9\u51FB\u6309\u94AE\uFF1A":"Reply with a number to switch workspaces, or tap a button:","\u{1F5C2} \u5DE5\u4F5C\u533A":"\u{1F5C2} Workspace","\u{1F916} \u52A9\u624B\u83DC\u5355\uFF08\u56DE\u590D\u6570\u5B57\u5373\u53EF\uFF0C\u65E0\u9700\u8BB0\u547D\u4EE4\uFF09":"\u{1F916} Assistant menu (reply with a number \u2014 no need to memorize commands)","1 \xB7 /sessionlist \u5217\u51FA\u4F1A\u8BDD\uFF08\u56DE\u590D\u6570\u5B57\u7ED1\u5B9A\uFF09":"1 \xB7 /sessionlist List sessions (reply with a number to bind)","2 \xB7 /workspacelist \u5217\u51FA\u5DE5\u4F5C\u533A\uFF08\u56DE\u590D\u6570\u5B57\u5207\u6362\uFF09":"2 \xB7 /workspacelist List workspaces (reply with a number to switch)","3 \xB7 /new \u5F00\u542F\u65B0\u4F1A\u8BDD":"3 \xB7 /new Start a new session","4 \xB7 /status \u8FDE\u63A5\u72B6\u6001":"4 \xB7 /status Connection status","5 \xB7 /help \u672C\u5E2E\u52A9":"5 \xB7 /help This help","6 \xB7 /repair \u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03\uFF08\u8BF7\u56DE\u590D\u6570\u5B57 6\uFF09":"6 \xB7 /repair Complete permissions and callback (reply with the number 6)","7 \xB7 /watchlist \u5173\u6CE8\u5217\u8868":"7 \xB7 /watchlist Watch list","\u76F4\u63A5\u53D1\u9001\u6587\u5B57/\u56FE\u7247\u5373\u7EE7\u7EED\u5F53\u524D\u4F1A\u8BDD\u3002":"Send text or an image directly to continue the current session.","/session ID \u6216\u5E8F\u53F7 \u7ED1\u5B9A\u5DF2\u6709\u4F1A\u8BDD":"/session ID or index Bind an existing session","/watch ID \u6216\u5E8F\u53F7 \u5173\u6CE8\u4F1A\u8BDD\uFF08\u5B8C\u6210\u540E\u63A8\u9001\uFF09":"/watch ID or index Watch a session (push when done)","/compact \u538B\u7F29\u4E0A\u4E0B\u6587":"/compact Compact the context","/workspace \u7EDD\u5BF9\u8DEF\u5F84 \u5207\u6362\u5DE5\u4F5C\u533A":"/workspace <absolute path> Switch workspace","/presetlist \u5217\u51FA\u53EF\u7528 Agent Preset":"/presetlist List available Agent Presets","\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\uFF0C\u56DE\u590D\u6570\u5B57\u6216\u70B9\u6309\u94AE\u53D6\u6D88\u5173\u6CE8\uFF1A":"Completion is pushed automatically. Reply with a number or tap a button to unwatch:","\u{1F441} \u5173\u6CE8\u5217\u8868":"\u{1F441} Watch list","\u2B50 \u53D6\u6D88\u5173\u6CE8":"\u2B50 Unwatch","\u2606 \u5173\u6CE8":"\u2606 Watch","\u{1F50D} \u5173\u6CE8\u5217\u8868":"\u{1F50D} Watch list",\u52FE\u9009\u8981\u5173\u6CE8\u7684\u4F1A\u8BDD:"Select sessions to watch",\u52FE\u9009\u8981\u53D6\u6D88\u5173\u6CE8\u7684\u4F1A\u8BDD:"Select sessions to unwatch","\u5F53\u524D\u6CA1\u6709\u5173\u6CE8\u7684\u4F1A\u8BDD\u3002\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\u7ED3\u679C\u3002":"No sessions are being watched. Results are pushed automatically when tasks complete.","\u5F53\u524D\u5173\u6CE8 **{count}** \u4E2A\u4F1A\u8BDD\uFF1A":"Currently watching **{count}** sessions:","**\u2795 \u6DFB\u52A0\u5173\u6CE8**\uFF08\u591A\u9009\u4E0B\u62C9\u52FE\u9009\uFF09":"**\u2795 Add watch** (select from the multi-select dropdown)","**\u2796 \u53D6\u6D88\u5173\u6CE8**\uFF08\u591A\u9009\u4E0B\u62C9\u52FE\u9009\uFF09":"**\u2796 Remove watch** (select from the multi-select dropdown)","\u{1F4CB} \u4F1A\u8BDD\u5217\u8868":"\u{1F4CB} Session list","\u{1F519} \u8FD4\u56DE\u83DC\u5355":"\u{1F519} Back to menu",\u5DF2\u5B8C\u6210:"Completed",\u5DF2\u505C\u6B62:"Stopped",\u5DF2\u4E2D\u6B62:"Aborted",\u5DF2\u53D6\u6D88:"Cancelled",\u5DF2\u7ED3\u675F:"Ended","\u2705 \u4EFB\u52A1\u5B8C\u6210":"\u2705 Task complete","**\u72B6\u6001**\uFF1A{reason}":"**Status**: {reason}",\u6253\u5F00\u4F1A\u8BDD\u5217\u8868:"Open session list",\u5DE5\u4F5C\u533A:"Workspace","\u7ED1\u5B9A\u8BE5\u4F1A\u8BDD\u540E\u53EF\u7EE7\u7EED\u8FFD\u95EE\uFF0C\u8F93\u5165\u6587\u5B57\u5373\u53EF\u3002":"After binding this session you can keep asking; just type a message.","\u5F53\u524D\u6CA1\u6709\u5173\u6CE8\u7684\u4F1A\u8BDD\u3002\n`/watch <ID|\u5E8F\u53F7>` \u5173\u6CE8\u540E\uFF0C\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\u3002":"No sessions are being watched.\nWatch one with `/watch <ID|index>` and completion is pushed automatically.","\u6B63\u5728\u751F\u6210\u2026":"Generating\u2026",\u56DE\u7B54\u5B8C\u6210:"Answer complete",\u98DE\u4E66\u673A\u5668\u4EBA:"Feishu bot","\u98DE\u4E66\u673A\u5668\u4EBA\u7F3A\u5C11\u56FE\u7247\u8BFB\u53D6\u6743\u9650 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u6309\u98DE\u4E66\u63D0\u793A\u53D1\u5E03\u65B0\u7248\u672C\u3001\u5B8C\u6210\u5FC5\u8981\u5BA1\u6279\u540E\uFF0C\u518D\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002":"The Feishu bot is missing the image-read scope im:message:readonly, shown by Feishu as \u201CRead direct and group messages.\u201D Run /repair in a direct chat with the bot, or click the \u201CComplete permissions\u201D button on the IM Bot settings page and scan the QR code. Publish a new version and complete any approval requested by Feishu, then resend the image.","\u2705 \u4FEE\u590D\u5B8C\u6210\uFF1A\u5DF2\u5B9E\u6D4B\u6536\u5230 card.action.trigger\uFF0C\u83DC\u5355\u6309\u94AE\u73B0\u5728\u53EF\u7528\u3002":"\u2705 Repair complete: card.action.trigger was received in a real test; the menu buttons now work.","\u26A0\uFE0F \u4FEE\u590D\u9A8C\u8BC1\u8D85\u65F6\uFF1A\u672A\u6536\u5230\u6D4B\u8BD5\u5361\u6309\u94AE\u7684 card.action.trigger\uFF0C\u4E0D\u80FD\u786E\u8BA4\u6309\u94AE\u5DF2\u4FEE\u590D\u3002\u8BF7\u4E0D\u8981\u91CD\u590D\u6388\u6743\uFF1B\u5148\u68C0\u67E5\u98DE\u4E66\u5F00\u653E\u5E73\u53F0\u7684\u5361\u7247\u56DE\u8C03\u914D\u7F6E\uFF0C\u786E\u8BA4\u540E\u518D\u53D1\u9001 /repair\u3002":"\u26A0\uFE0F Repair verification timed out: no card.action.trigger from the test card button was received, so the buttons cannot be confirmed repaired. Do not authorize again; check the card-callback configuration in Feishu Open Platform first, then send /repair.","\u26A0\uFE0F \u4FEE\u590D\u9A8C\u8BC1\u5931\u8D25\uFF1A\u65E0\u6CD5\u53D1\u9001\u4E13\u7528\u6D4B\u8BD5\u5361\uFF0C\u4E0D\u80FD\u786E\u8BA4 card.action.trigger \u5DF2\u6062\u590D\u3002\u8BF7\u4E0D\u8981\u91CD\u590D\u6388\u6743\uFF1B\u5148\u68C0\u67E5\u673A\u5668\u4EBA\u6D88\u606F\u6743\u9650\u548C\u8FDE\u63A5\u72B6\u6001\u3002":"\u26A0\uFE0F Repair verification failed: the dedicated test card could not be sent, so card.action.trigger cannot be confirmed restored. Do not authorize again; check the bot message permission and connection status first.","\u26A0\uFE0F \u4FEE\u590D\u9A8C\u8BC1\u4E2D\u65AD\uFF1ARuntime \u5DF2\u505C\u6B62\uFF0C\u672A\u5B8C\u6210 card.action.trigger \u5B9E\u6D4B\uFF0C\u4E0D\u80FD\u786E\u8BA4\u4FEE\u590D\u6210\u529F\u3002\u8BF7\u4E0D\u8981\u91CD\u590D\u6388\u6743\uFF1B\u5148\u7B49\u5F85\u673A\u5668\u4EBA\u6062\u590D\u8FDE\u63A5\u3002":"\u26A0\uFE0F Repair verification interrupted: the Runtime stopped before the card.action.trigger test completed, so the repair cannot be confirmed. Do not authorize again; wait for the bot to reconnect."};var zU={"\u5DF2\u8FDE\u63A5 DeepSeek Harness\uFF0C\u6B63\u5728\u601D\u8003\u2026":"Connected to DeepSeek Harness, thinking\u2026","\u9489\u9489\u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"The DingTalk bot is connected to DeepSeek Harness.","\u9489\u9489\u672A\u80FD\u6362\u53D6\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\uFF1B\u82E5\u6301\u7EED\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u673A\u5668\u4EBA\u7684\u201C\u4F01\u4E1A\u5185\u673A\u5668\u4EBA\u53D1\u9001\u6D88\u606F\u6743\u9650\u201D\u3002":`DingTalk could not provide the image download address. Please resend; if it keeps failing, check the bot's "Send messages as an internal robot" permission.`,"\u9489\u9489\u6CA1\u6709\u8FD4\u56DE\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"DingTalk did not return an image download address. Please resend.","\u9489\u9489\u8FD4\u56DE\u7684\u56FE\u7247\u4E34\u65F6\u5730\u5740\u65E0\u6CD5\u8BFB\u53D6\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002":"The temporary image address returned by DingTalk could not be read. Please resend.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u53D1\u9001\u7ED3\u679C\u672A\u80FD\u786E\u8BA4\uFF0C\u8BF7\u5148\u68C0\u67E5\u804A\u5929\u5185\u662F\u5426\u5DF2\u6536\u5230\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u8BD5\u3002":'Delivery of the result file "{name}" could not be confirmed. Please check whether it already arrived in the chat before retrying.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u9489\u9489\u5E94\u7528\u6216\u673A\u5668\u4EBA\u7F3A\u5C11\u6587\u4EF6\u6D88\u606F\u6743\u9650\u3002\u8BF7\u5F00\u901A\u5E94\u7528 qyapi_base \u6743\u9650\uFF0C\u5E76\u786E\u8BA4\u673A\u5668\u4EBA\u5177\u5907\u6587\u4EF6\u6D88\u606F\u53D1\u9001\u80FD\u529B\u3002":`Result file "{name}" was generated, but the DingTalk app or bot lacks file message permission. Enable the app's qyapi_base permission and make sure the bot can send file messages.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D\u9489\u9489\u673A\u5668\u4EBA\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'Result file "{name}" exceeds the file size limit of the current DingTalk bot and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u9489\u9489\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'Result file "{name}" was rate-limited by DingTalk and could not be sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u9489\u9489\u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6D88\u606F\uFF0C\u8BF7\u68C0\u67E5\u6587\u4EF6\u7C7B\u578B\u548C\u673A\u5668\u4EBA\u6587\u4EF6\u6D88\u606F\u914D\u7F6E\u3002":`Result file "{name}" was generated, but DingTalk rejected the file message. Check the file type and the bot's file message configuration.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7\u9489\u9489\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'Result file "{name}" was generated but could not be sent via DingTalk right now. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u5DF2\u751F\u6210\u3002":"The result file has been generated.","\u9489\u9489\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The DingTalk bot is connected to DeepSeek Harness normally.","\u9489\u9489\u547D\u4EE4\u5904\u7406\u5931\u8D25\u3002":"Failed to process the DingTalk command.","\u9489\u9489\u6D88\u606F\u6CA1\u6709\u5B89\u5168\u7684\u56DE\u590D\u5730\u5740\u3002":"The DingTalk message has no safe reply address.","\u9489\u9489\u5BA1\u6279\u5904\u7406\u5931\u8D25\u3002":"Failed to process the DingTalk approval.","\u9489\u9489\u6D88\u606F\u5904\u7406\u5931\u8D25\u3002":"Failed to process the DingTalk message.","\u9489\u9489\u6D88\u606F\u683C\u5F0F\u65E0\u6548\u3002":"Invalid DingTalk message format.","\u9489\u9489\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the DingTalk interaction question.",\u9489\u9489\u7528\u6237:"DingTalk user",\u9489\u9489\u673A\u5668\u4EBA:"DingTalk bot",\u8EAB\u4EFD\u5DF2\u9690\u85CF:"Identity hidden","\u9489\u9489\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The DingTalk bot credentials are missing. Remove the bot and scan the QR code again.","\u9489\u9489\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The DingTalk connection is not ready. Please try again later.","\u9489\u9489\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The DingTalk connection is still not ready. Please try again later.","\u626B\u7801\u63A5\u5165\u5DF2\u53D6\u6D88\u3002":"QR code setup has been cancelled.","\u65E0\u6CD5\u751F\u6210\u9489\u9489\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Could not generate the DingTalk QR code. Please try again later.","\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002":"The QR code has expired. Generate a new one.","\u9489\u9489\u5DF2\u63A5\u5165\uFF0C\u4F46\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"DingTalk is connected, but the message connection is not ready yet. Please try again later.","\u9489\u9489\u672A\u5B8C\u6210\u673A\u5668\u4EBA\u6388\u6743\uFF0C\u8BF7\u91CD\u65B0\u626B\u7801\u3002":"DingTalk did not complete the bot authorization. Please scan the QR code again.","\u9489\u9489\u6388\u6743\u72B6\u6001\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u91CD\u8BD5\u3002":"The DingTalk authorization status is temporarily unavailable. Retrying.","\u9489\u9489\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002":"DingTalk authorization succeeded, but the configuration could not be saved safely.","\u9489\u9489\u6388\u6743\u67E5\u8BE2\u6682\u65F6\u5931\u8D25\uFF0C\u6B63\u5728\u91CD\u8BD5\u3002":"The DingTalk authorization query failed temporarily. Retrying.","\u9489\u9489\u673A\u5668\u4EBA\uFF08{clientId}\uFF09":"DingTalk bot ({clientId})","\u9489\u9489 Stream \u6D88\u606F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The DingTalk Stream message connection is running normally",\u9489\u9489\u6D88\u606F\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The DingTalk message connection is currently offline"};var VU={"\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"The Enterprise WeChat bot is connected to DeepSeek Harness.","\u5F53\u524D\u5F85\u5904\u7406\u56FE\u7247\u8F83\u591A\uFF0C\u8BF7\u7A0D\u540E\u91CD\u65B0\u53D1\u9001\u3002":"Too many images are pending. Please send them again later.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u4F01\u4E1A\u5FAE\u4FE1\u667A\u80FD\u673A\u5668\u4EBA\u7F3A\u5C11\u7D20\u6750\u4E0A\u4F20\u6216\u6587\u4EF6\u6D88\u606F\u80FD\u529B\uFF0C\u8BF7\u68C0\u67E5\u673A\u5668\u4EBA\u6743\u9650\u3002":'The result file "{name}" was generated, but the Enterprise WeChat bot lacks media upload or file message capability. Please check the bot permissions.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the file size this Enterprise WeChat bot can send and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0C\u4F01\u4E1A\u5FAE\u4FE1\u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002":'The result file "{name}" is empty. Enterprise WeChat does not allow sending empty files.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u4F01\u4E1A\u5FAE\u4FE1\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was rate-limited by Enterprise WeChat and could not be sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u4F01\u4E1A\u5FAE\u4FE1\u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6216\u6587\u4EF6\u6D88\u606F\u3002":'The result file "{name}" was generated, but Enterprise WeChat rejected the file or file message.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7\u4F01\u4E1A\u5FAE\u4FE1\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent via Enterprise WeChat right now. Please try again later.',"\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u4F46\u6CA1\u6709\u751F\u6210\u53EF\u663E\u793A\u7684\u6587\u672C\u3002":"The task completed, but no displayable text was generated.","\u76EE\u524D\u652F\u6301\u6587\u5B57\u3001\u56FE\u7247\u548C\u8BED\u97F3\u8F6C\u5199\u6D88\u606F\u3002":"Currently only text, images, and voice transcription messages are supported.","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The connection between the Enterprise WeChat bot and DeepSeek Harness is working.","\u6B63\u5728\u601D\u8003\u4E2D\u2026":"Thinking\u2026","\u4F01\u4E1A\u5FAE\u4FE1\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the Enterprise WeChat interaction question.","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The Enterprise WeChat bot credentials are missing. Please remove the bot and scan the QR code again.","\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The Enterprise WeChat connection is not ready. The plugin will retry automatically.","\u626B\u7801\u7ED1\u5B9A\u5DF2\u53D6\u6D88\u3002":"QR code binding has been cancelled.","\u65E0\u6CD5\u751F\u6210\u4F01\u4E1A\u5FAE\u4FE1\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Unable to generate the Enterprise WeChat QR code. Please try again later.","\u4F01\u4E1A\u5FAE\u4FE1\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002":"The Enterprise WeChat QR code has expired. Please generate a new one.","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\u5DF2\u7ED1\u5B9A\uFF0C\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"The Enterprise WeChat bot is bound, but the message connection is not ready yet.","\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The Enterprise WeChat connection is still not ready. Please try again later.","\u4F01\u4E1A\u5FAE\u4FE1\u626B\u7801\u6CA1\u6709\u5B8C\u6210\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The Enterprise WeChat QR scan was not completed. Please generate a new QR code.","\u4F01\u4E1A\u5FAE\u4FE1\u626B\u7801\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The Enterprise WeChat QR service is temporarily unavailable. Please generate a new QR code.","\u4F01\u4E1A\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002":"Enterprise WeChat authorization succeeded, but the connection configuration could not be saved safely.",\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA:"Enterprise WeChat bot","\u4F01\u4E1A\u5FAE\u4FE1\u673A\u5668\u4EBA\uFF08{botId}\uFF09":"Enterprise WeChat bot ({botId})","\u4F01\u4E1A\u5FAE\u4FE1 WebSocket \u957F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The Enterprise WeChat WebSocket long connection is running normally","\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The Enterprise WeChat connection is not ready. The plugin will retry automatically",\u4F01\u4E1A\u5FAE\u4FE1\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The Enterprise WeChat connection is currently offline"};var WU={"QQ \u673A\u5668\u4EBA\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"The QQ bot is connected to DeepSeek Harness.","\u56DE\u7B54\u8F83\u957F\uFF0C\u540E\u7EED\u5185\u5BB9\u672A\u80FD\u901A\u8FC7 QQ \u5B8C\u6574\u53D1\u9001\uFF0C\u8BF7\u56DE\u590D\u201C\u7EE7\u7EED\u201D\u3002":"The answer is long and the rest could not be sent fully through QQ. Reply \u201C\u7EE7\u7EED\u201D (continue) to receive it.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46 QQ \u4ECA\u65E5\u6587\u4EF6\u4E0A\u4F20\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":`The result file "{name}" was generated, but QQ's daily file upload quota is used up. Please try again later.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u5F53\u524D QQ \u673A\u5668\u4EBA\u6CA1\u6709\u6587\u4EF6\u6D88\u606F\u6743\u9650\u3002":'The result file "{name}" was generated, but the current QQ bot does not have file message permission.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D QQ \u673A\u5668\u4EBA\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the file size the current QQ bot can send and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0CQQ \u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002":'The result file "{name}" is empty, and QQ does not allow sending empty files.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB QQ \u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was temporarily rate-limited by QQ and was not sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46 QQ \u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6216\u6587\u4EF6\u6D88\u606F\u3002":'The result file "{name}" was generated, but QQ rejected the file or file message.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7 QQ \u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent via QQ right now. Please try again later.',"QQ \u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"The QQ bot is connected to DeepSeek Harness normally.","QQ \u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the QQ interaction question.","QQ \u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The QQ bot credentials are missing. Remove the bot and scan the QR code again.","QQ \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The QQ connection is not ready; the plugin will retry automatically.","QQ \u626B\u7801\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The QQ QR service is temporarily unavailable. Please generate a new QR code.","\u65E0\u6CD5\u751F\u6210 QQ \u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Unable to generate the QQ QR code. Please try again later.","QQ \u673A\u5668\u4EBA\u5DF2\u7ED1\u5B9A\uFF0C\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"The QQ bot is bound, but the message connection is not ready yet.","QQ \u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The QQ connection is still not ready. Please try again later.",QQ\u673A\u5668\u4EBA\u5C1A\u672A\u8FDE\u63A5:"The QQ bot is not connected yet","QQ \u673A\u5668\u4EBA\uFF08{appId}\uFF09":"QQ bot ({appId})",QQ\u673A\u5668\u4EBA:"QQ bot","QQ WebSocket \u957F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The QQ WebSocket long connection is running normally","QQ \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The QQ connection is not ready; the plugin will retry automatically","QQ \u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF":"The QQ connection is currently offline","QQ \u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002":"QQ authorization succeeded, but the connection configuration could not be saved safely."};var ZU={"\u5FAE\u4FE1\u5DF2\u8FDE\u63A5 DeepSeek Harness\u3002":"WeChat is connected to DeepSeek Harness.","\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u5FAE\u4FE1\u673A\u5668\u4EBA\u5F53\u524D\u6CA1\u6709\u6587\u4EF6\u6D88\u606F\u53D1\u9001\u6743\u9650\uFF0C\u8BF7\u68C0\u67E5\u673A\u5668\u4EBA\u6587\u4EF6\u6D88\u606F\u80FD\u529B\u3002":`The result file "{name}" was generated, but the WeChat bot currently has no permission to send file messages. Please check the bot's file messaging capability.`,"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u5F53\u524D\u5FAE\u4FE1\u4F1A\u8BDD\u53EF\u53D1\u9001\u7684\u6587\u4EF6\u5927\u5C0F\uFF0C\u672A\u53D1\u9001\u3002":'The result file "{name}" exceeds the file size limit of the current WeChat conversation and was not sent.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u5FAE\u4FE1\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was temporarily rate-limited by WeChat and was not sent. Please try again later.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u5FAE\u4FE1\u62D2\u7EDD\u4E86\u8BE5\u6587\u4EF6\u6D88\u606F\u3002":'The result file "{name}" was generated, but WeChat rejected the file message.',"\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u901A\u8FC7\u5FAE\u4FE1\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":'The result file "{name}" was generated but could not be sent via WeChat right now. Please try again later.',"\u76EE\u524D\u652F\u6301\u6587\u5B57\u3001\u56FE\u7247\uFF0C\u4EE5\u53CA\u5FAE\u4FE1\u5DF2\u8F6C\u6210\u6587\u5B57\u7684\u8BED\u97F3\u6D88\u606F\u3002":"Currently supports text, images, and voice messages that WeChat has converted to text.","\u5FAE\u4FE1\u4E0E DeepSeek Harness \u8FDE\u63A5\u6B63\u5E38\u3002":"WeChat is connected to DeepSeek Harness normally.","\u5FAE\u4FE1\u4EA4\u4E92\u95EE\u9898\u53D1\u9001\u5931\u8D25\u3002":"Failed to send the WeChat interaction question.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u8BFB\u53D6\u73B0\u6709\u767B\u5F55\u51ED\u636E\u3002\u8BF7\u68C0\u67E5 DSH \u51ED\u636E\u5B58\u50A8\u3002":"WeChat was authorized, but the existing login credential could not be read. Please check the DSH credential store.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u767B\u5F55\u51ED\u636E\u65E0\u6CD5\u5199\u5165 DSH \u51ED\u636E\u5B58\u50A8\u3002\u8BF7\u68C0\u67E5\u51ED\u636E\u5B58\u50A8\u662F\u5426\u53EF\u5199\u3002":"WeChat was authorized, but the login credential could not be written to the DSH credential store. Please check that the credential store is writable.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u8D26\u53F7\u914D\u7F6E\u65E0\u6CD5\u5199\u5165\u672C\u673A\u3002\u8BF7\u68C0\u67E5 DSH_HOME \u76EE\u5F55\u6743\u9650\u3002":"WeChat was authorized, but the account configuration could not be written locally. Please check the DSH_HOME directory permissions.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u521D\u59CB\u5316\u8D26\u53F7\u72B6\u6001\u6216\u5DE5\u4F5C\u533A\u3002\u8BF7\u68C0\u67E5 DSH_HOME \u548C\u5DE5\u4F5C\u533A\u76EE\u5F55\u3002":"WeChat was authorized, but the account state or workspace could not be initialized. Please check DSH_HOME and the workspace directories.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u63D2\u4EF6\u65E0\u6CD5\u8FDE\u63A5\u672C\u673A Harness\u3002\u8BF7\u68C0\u67E5 dsh web \u5730\u5740\u548C\u7AEF\u53E3\u3002":"WeChat was authorized, but the plugin could not connect to the local Harness. Please check the dsh web address and port.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u8D85\u65F6\u3002\u8BF7\u786E\u8BA4 dsh web \u672A\u963B\u585E\u3002":"WeChat was authorized, but the Harness health check timed out. Please confirm dsh web is not blocked.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u9700\u8981\u8EAB\u4EFD\u8BA4\u8BC1\u3002\u8BF7\u68C0\u67E5\u4EE3\u7406\u3001\u7F51\u5173\u6216\u81EA\u5B9A\u4E49\u9274\u6743\u914D\u7F6E\u3002":"WeChat was authorized, but the Harness health check requires authentication. Please check proxy, gateway, or custom auth configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u672C\u673A Harness \u8BF7\u6C42\u88AB\u4EE3\u7406\u8981\u6C42\u8BA4\u8BC1\u3002\u8BF7\u8BA9\u56DE\u73AF\u5730\u5740\u7ED5\u8FC7\u4EE3\u7406\uFF0C\u5E76\u68C0\u67E5 NO_PROXY \u914D\u7F6E\u3002":"WeChat was authorized, but the local Harness request was challenged for proxy authentication. Please bypass the proxy for loopback addresses and check the NO_PROXY configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5F02\u5E38\u62D2\u7EDD\u4E86\u56DE\u73AF\u5730\u5740\u7684\u5065\u5EB7\u68C0\u67E5\u3002\u8BF7\u68C0\u67E5 HTTP \u4EE3\u7406\u3001Harness \u6E90\u7801\u7248\u672C\u548C\u6784\u5EFA\u4EA7\u7269\u3002":"WeChat was authorized, but Harness unexpectedly rejected the health check from a loopback address. Please check the HTTP proxy, Harness source version, and build artifacts.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u7684 Host \u4FE1\u4EFB\u68C0\u67E5\u62D2\u7EDD\u4E86\u975E\u56DE\u73AF\u5730\u5740\u8BF7\u6C42\u3002\u8BF7\u68C0\u67E5 harnessBaseUrl \u4E0E trustedHosts \u914D\u7F6E\u3002":"WeChat was authorized, but the Harness Host trust check rejected a non-loopback request. Please check the harnessBaseUrl and trustedHosts configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u5065\u5EB7\u68C0\u67E5\u6536\u5230\u4E86\u975E Harness \u6807\u51C6\u7684 403 \u62D2\u7EDD\u54CD\u5E94\u3002\u8BF7\u68C0\u67E5\u4EE3\u7406\u6216\u7F51\u5173\u914D\u7F6E\u3002":"WeChat was authorized, but the health check received a non-standard Harness 403 rejection. Please check the proxy or gateway configuration.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u627E\u4E0D\u5230 Harness \u5065\u5EB7\u68C0\u67E5\u63A5\u53E3\u3002\u8BF7\u786E\u8BA4 Harness \u4E0E\u63D2\u4EF6\u7248\u672C\u517C\u5BB9\u3002":"WeChat was authorized, but the Harness health check endpoint was not found. Please confirm the Harness and plugin versions are compatible.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u8FD4\u56DE\u670D\u52A1\u9519\u8BEF\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but the Harness health check returned a server error. Please check the dsh web logs.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u54CD\u5E94\u3002\u8BF7\u786E\u8BA4 Harness \u4E0E\u63D2\u4EF6\u7248\u672C\u517C\u5BB9\u3002":"WeChat was authorized, but Harness returned an unrecognized response. Please confirm the Harness and plugin versions are compatible.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u62D2\u7EDD\u4E86\u5065\u5EB7\u68C0\u67E5\u8BF7\u6C42\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but Harness rejected the health check request. Please check the dsh web logs.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46 Harness \u5065\u5EB7\u68C0\u67E5\u53D1\u751F\u672A\u77E5\u9519\u8BEF\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but the Harness health check failed with an unknown error. Please check the dsh web logs.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u6D88\u606F\u8FDE\u63A5\u521D\u59CB\u5316\u5931\u8D25\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u540E\u91CD\u8BD5\u3002":"WeChat was authorized, but the message connection failed to initialize. Please check the dsh web logs and try again.","\u5FAE\u4FE1\u5DF2\u6388\u6743\uFF0C\u4F46\u6FC0\u6D3B\u8FC7\u7A0B\u4E2D\u53D1\u751F\u672A\u77E5\u9519\u8BEF\u3002\u8BF7\u67E5\u770B dsh web \u65E5\u5FD7\u3002":"WeChat was authorized, but an unknown error occurred during activation. Please check the dsh web logs.","\u767B\u5F55\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u8D26\u53F7\u540E\u91CD\u65B0\u626B\u7801\u3002":"The login credential is missing. Please remove the account and scan the QR code again.","\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The WeChat connection is not ready; the plugin will retry automatically.","\u5FAE\u4FE1\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The WeChat connection is not ready; the plugin will retry automatically","\u65E0\u6CD5\u751F\u6210\u5FAE\u4FE1\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"Unable to generate the WeChat QR code. Please try again later.","\u5FAE\u4FE1\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The WeChat connection is still not ready. Please try again later.",\u5FAE\u4FE1\u673A\u5668\u4EBA:"WeChat Bot","\u5FAE\u4FE1\u673A\u5668\u4EBA\uFF08{name}\uFF09":"WeChat Bot ({name})",\u5FAE\u4FE1\u6D88\u606F\u957F\u8F6E\u8BE2\u8FD0\u884C\u6B63\u5E38:"WeChat message long-polling is running normally",\u5FAE\u4FE1\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The WeChat connection is currently offline","\u914D\u5BF9\u7801\u591A\u6B21\u9519\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"The pairing code was entered incorrectly too many times. Please generate a new QR code.","\u8BE5\u5FAE\u4FE1\u8D26\u53F7\u5DF2\u7ED1\u5B9A\uFF0C\u4F46\u672C\u673A\u6CA1\u6709\u53EF\u6062\u590D\u7684\u51ED\u636E\u3002":"This WeChat account is already bound, but no recoverable credential exists on this machine.","\u5FAE\u4FE1\u6388\u6743\u6210\u529F\uFF0C\u4F46\u8FD4\u56DE\u7684\u8D26\u53F7\u51ED\u636E\u4E0D\u5B8C\u6574\u3002":"WeChat authorization succeeded, but the returned account credential is incomplete.","\u5FAE\u4FE1\u767B\u5F55\u51ED\u636E\u5DF2\u5931\u6548\uFF0C\u8BF7\u79FB\u9664\u8D26\u53F7\u540E\u91CD\u65B0\u626B\u7801\u3002":"The WeChat login credential has expired. Please remove the account and scan the QR code again.","\u5FAE\u4FE1\u6D88\u606F\u540C\u6B65\u8BF7\u6C42\u88AB\u62D2\u7EDD\u3002":"The WeChat message sync request was rejected.","\u5FAE\u4FE1\u56FE\u7247\u7684\u52A0\u5BC6\u5BC6\u94A5\u65E0\u6548\u3002":"The encryption key of the WeChat image is invalid.","\u5FAE\u4FE1\u56FE\u7247\u7684\u52A0\u5BC6\u6570\u636E\u65E0\u6548\u3002":"The encrypted data of the WeChat image is invalid.","\u5FAE\u4FE1\u56FE\u7247\u89E3\u5BC6\u5931\u8D25\u3002":"Failed to decrypt the WeChat image.","\u5FAE\u4FE1\u56FE\u7247\u6CA1\u6709\u53EF\u7528\u7684\u4E0B\u8F7D\u5730\u5740\u3002":"The WeChat image has no usable download URL.","\u5FAE\u4FE1\u56FE\u7247\u7684\u4E0B\u8F7D\u5730\u5740\u65E0\u6548\u3002":"The download URL of the WeChat image is invalid.","\u5FAE\u4FE1\u56FE\u7247\u7684\u4E0B\u8F7D\u5730\u5740\u4E0D\u53D7\u4FE1\u4EFB\u3002":"The download URL of the WeChat image is not trusted.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u8FDE\u63A5\u5730\u5740\u3002":"The WeChat service returned an invalid connection URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u53D7\u4FE1\u4EFB\u7684\u8FDE\u63A5\u5730\u5740\u3002":"The WeChat service returned an untrusted connection URL.","\u5FAE\u4FE1\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u626B\u7801\u5730\u5740\u3002":"The WeChat service did not return a QR-code URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u626B\u7801\u5730\u5740\u3002":"The WeChat service returned an invalid QR-code URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u53D7\u4FE1\u4EFB\u7684\u626B\u7801\u5730\u5740\u3002":"The WeChat service returned an untrusted QR-code URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u6587\u4EF6\u4E0A\u4F20\u5730\u5740\u3002":"The WeChat service returned an invalid file upload URL.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u4E0D\u53D7\u4FE1\u4EFB\u7684\u6587\u4EF6\u4E0A\u4F20\u5730\u5740\u3002":"The WeChat service returned an untrusted file upload URL.","\u5FAE\u4FE1\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u6587\u4EF6\u4E0A\u4F20\u5730\u5740\u3002":"The WeChat service did not return a file upload URL.","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u88AB\u62D2\u7EDD\uFF08HTTP {status}\uFF09\u3002":"The WeChat file upload was rejected (HTTP {status}).","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF08HTTP {status}\uFF09\u3002":"The WeChat file upload failed (HTTP {status}).","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u54CD\u5E94\u7F3A\u5C11\u4E0B\u8F7D\u53C2\u6570\u3002":"The WeChat file upload response is missing the download parameter.","\u5FAE\u4FE1\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\u3002":"The WeChat file upload failed.","\u62D2\u7EDD\u8BBF\u95EE\u4E0D\u53D7\u4FE1\u4EFB\u7684\u5FAE\u4FE1\u670D\u52A1\u5730\u5740\u3002":"Refusing to access an untrusted WeChat service URL.","\u5FAE\u4FE1\u670D\u52A1\u8BF7\u6C42\u5931\u8D25\uFF08HTTP {status}\uFF09\u3002":"The WeChat service request failed (HTTP {status}).","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u54CD\u5E94\u3002":"The WeChat service returned an unparseable response.","\u5FAE\u4FE1\u670D\u52A1\u8BF7\u6C42\u8D85\u65F6\u3002":"The WeChat service request timed out.","\u6682\u65F6\u65E0\u6CD5\u8BBF\u95EE\u5FAE\u4FE1\u670D\u52A1\u3002":"The WeChat service is temporarily unreachable.","\u5FAE\u4FE1\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u626B\u7801\u72B6\u6001\u3002":"The WeChat service returned an unrecognized QR-code status.","\u5FAE\u4FE1\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u4E8C\u7EF4\u7801\u4EE4\u724C\u3002":"The WeChat service did not return a QR-code token.","\u5FAE\u4FE1\u670D\u52A1\u62D2\u7EDD\u4E86\u56DE\u590D\u6D88\u606F\u3002":"The WeChat service rejected the reply message.","\u5FAE\u4FE1\u670D\u52A1\u62D2\u7EDD\u4E86\u6587\u4EF6\u4E0A\u4F20\u8BF7\u6C42\u3002":"The WeChat service rejected the file upload request.","\u5FAE\u4FE1\u670D\u52A1\u62D2\u7EDD\u4E86\u6587\u4EF6\u6D88\u606F\u3002":"The WeChat service rejected the file message.","\u5FAE\u4FE1\u8D26\u53F7\u8FDE\u63A5\u542F\u52A8\u5931\u8D25\u3002":"Failed to start the WeChat account connection."};var XU={Slack\u673A\u5668\u4EBA:"Slack bot","Slack\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u63A5\u5165\u3002":"Slack bot credentials are missing. Remove the bot and connect it again.","Slack Socket Mode \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The Slack Socket Mode connection is not ready yet. The plugin will retry automatically.","Slack\u673A\u5668\u4EBA\u5DF2\u63A5\u5165\uFF0CSocket Mode \u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"The Slack bot is connected, but the Socket Mode connection is not ready yet.","Slack Socket Mode \u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u68C0\u67E5\u4E24\u4E2A Token\u3002":"The Slack Socket Mode connection is still not ready. Check both tokens.",Slack\u673A\u5668\u4EBA\u5C1A\u672A\u8FDE\u63A5:"The Slack bot is not connected yet","Slack Socket Mode \u957F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38":"The Slack Socket Mode long-lived connection is running normally","Slack\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5":"The Slack connection is not ready. The plugin will retry automatically",Slack\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF:"The Slack connection is currently offline","Slack \u672A\u6388\u6743\u673A\u5668\u4EBA\u8BFB\u53D6\u8BE5\u6587\u4EF6\u3002\u8BF7\u4E3A\u5E94\u7528\u6DFB\u52A0 files:read \u540E\u91CD\u65B0\u5B89\u88C5\uFF0C\u518D\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002":"Slack has not granted the bot access to this file. Add the files:read scope to the app, reinstall it, then send the image again.","Slack Bot Token \u5FC5\u987B\u4EE5 xoxb- \u5F00\u5934\u3002":"The Slack Bot Token must start with xoxb-.","Slack App Token \u5FC5\u987B\u4EE5 xapp- \u5F00\u5934\u3002":"The Slack App Token must start with xapp-.","Slack Bot Token \u6CA1\u6709\u8FD4\u56DE\u5B8C\u6574\u7684\u673A\u5668\u4EBA\u8EAB\u4EFD\u3002":"The Slack Bot Token did not return a complete bot identity.","Slack App Token \u65E0\u6CD5\u521B\u5EFA Socket Mode \u8FDE\u63A5\uFF0C\u8BF7\u786E\u8BA4\u5DF2\u542F\u7528 Socket Mode \u548C connections:write\u3002":"The Slack App Token could not create a Socket Mode connection. Make sure Socket Mode and connections:write are enabled."};var $U={\u5F00\u542F\u4E00\u4E2A\u5168\u65B0\u4F1A\u8BDD:"Start a brand-new Session",\u538B\u7F29\u5F53\u524D\u4F1A\u8BDD\u7684\u8F83\u65E9\u4E0A\u4E0B\u6587:"Compact the earlier context of the current Session",\u5207\u6362\u5DE5\u4F5C\u533A:"Switch Workspace",\u5217\u51FA\u5DE5\u4F5C\u533A\u7EDD\u5BF9\u8DEF\u5F84:"List Workspace absolute paths","\u5217\u51FA\u4F1A\u8BDD ID \u548C\u6807\u9898":"List Session IDs and titles",\u5C06\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u5230\u6307\u5B9A\u4F1A\u8BDD:"Bind the current chat to a specific Session",\u6309\u5E8F\u53F7\u5217\u51FA\u6240\u6709\u53EF\u7528\u6A21\u578B:"List all available models by number",\u67E5\u770B\u6216\u5207\u6362\u5F53\u524D\u4F1A\u8BDD\u6A21\u578B:"View or switch the model of the current Session","\u5217\u51FA\u53EF\u7528 Agent Preset":"List available Agent Presets","\u67E5\u770B\u6216\u8BBE\u7F6E\u65B0\u4F1A\u8BDD Agent Preset":"View or set the Agent Preset for new Sessions",\u505C\u6B62\u5F53\u524D\u4EFB\u52A1:"Stop the current task",\u7EA0\u504F\u5F53\u524D\u4EFB\u52A1:"Steer the current task",\u68C0\u67E5\u8FDE\u63A5\u72B6\u6001:"Check connection status",\u67E5\u770B\u63D2\u4EF6\u7248\u672C:"Show plugin version",\u663E\u793A\u5E2E\u52A9:"Show help","\u8BE5 Telegram \u673A\u5668\u4EBA\u5DF2\u914D\u7F6E Webhook\uFF0C\u8BF7\u5148\u5728\u539F\u670D\u52A1\u4E2D\u79FB\u9664 Webhook \u540E\u91CD\u8BD5\u3002":"This Telegram bot already has a Webhook configured. Remove the Webhook from the original service and try again.",Telegram\u673A\u5668\u4EBA:"Telegram Bot"," Bot API \u957F\u8F6E\u8BE2":" Bot API long polling"};var eH={"Discord Bot Token \u65E0\u6548\uFF0C\u8BF7\u91CD\u65B0\u586B\u5199\u3002":"The Discord Bot Token is invalid. Please enter it again.","Discord Gateway Intents \u914D\u7F6E\u4E0D\u6B63\u786E\uFF0C\u8BF7\u68C0\u67E5 Developer Portal \u7684 Bot \u8BBE\u7F6E\u3002":"The Discord Gateway Intents are misconfigured. Please check the Bot settings in the Developer Portal.",Discord\u673A\u5668\u4EBA:"Discord Bot"," Gateway \u957F\u8FDE\u63A5":" Gateway long-lived connection"};var AH={"WhatsApp \u5173\u8054\u8BBE\u5907\u5DF2\u5931\u6548\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002":"The WhatsApp linked device is no longer valid. Remove it and scan the QR code again.","WhatsApp \u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u63D2\u4EF6\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002":"The WhatsApp connection is not ready yet; the plugin will retry automatically.","WhatsApp \u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002":"The WhatsApp connection is still not ready. Please try again later.",WhatsApp\u673A\u5668\u4EBA\u5C1A\u672A\u8FDE\u63A5:"The WhatsApp bot is not connected yet",WhatsApp\u673A\u5668\u4EBA:"WhatsApp bot","WhatsApp Web \u5173\u8054\u8BBE\u5907\u8FD0\u884C\u6B63\u5E38":"The WhatsApp Web linked device is working normally","WhatsApp \u8FDE\u63A5\u672A\u5C31\u7EEA":"The WhatsApp connection is not ready","WhatsApp \u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF":"The WhatsApp connection is currently offline","WhatsApp \u5DF2\u7ED1\u5B9A\uFF0C\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\u3002":"WhatsApp is linked, but the messaging connection is not ready yet.","WhatsApp \u5DF2\u626B\u7801\uFF0C\u4F46\u65E0\u6CD5\u4FDD\u5B58\u5173\u8054\u8BBE\u5907\u3002":"The QR code was scanned, but the linked device could not be saved.","\u65E0\u6CD5\u8FDE\u63A5 WhatsApp\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u4E8C\u7EF4\u7801\u3002":"Unable to connect to WhatsApp. Please generate a new QR code.",WhatsApp\u8D26\u53F7:"WhatsApp account"," Web \u5173\u8054\u8BBE\u5907":" Web linked device"};var tH={"AI Office \u62D2\u7EDD\u4E86 Device Token\u3002":"AI Office rejected the Device Token.","AI Office Connector Hook \u5C1A\u672A\u5C31\u7EEA\u3002":"The AI Office Connector Hook is not ready yet.","AI Office Connector \u534F\u8BAE\u7248\u672C\u4E0D\u517C\u5BB9\u3002":"The AI Office Connector protocol version is incompatible.","\u672C\u673A\u6682\u65F6\u65E0\u6CD5\u8BBF\u95EE AI Office\u3002":"This machine cannot reach AI Office right now.","AI Office \u8FDE\u63A5\u5DF2\u4E2D\u65AD\u3002":"The AI Office connection was interrupted.","\u672C\u673A Harness \u5DF2\u505C\u6B62\u8FD9\u6B21\u6267\u884C\u3002":"The local Harness stopped this run.","Office Job \u5DF2\u88AB\u9886\u53D6\u3001\u53D6\u6D88\u6216\u7ED3\u675F\u3002":"The Office Job has already been claimed, cancelled, or finished.","\u672C\u673A Harness \u672A\u80FD\u5B8C\u6210\u4EFB\u52A1\uFF1B\u8BF7\u68C0\u67E5 Harness \u4F1A\u8BDD\u540E\u91CD\u8BD5\u3002":"The local Harness could not complete the task; check the Harness Session and try again.","Office Job \u5F15\u7528\u4E86\u672C\u673A\u672A\u914D\u7F6E\u7684 Workspace/Preset alias\u3002":"The Office Job references a Workspace/Preset alias that is not configured locally.","\u4F60\u6B63\u5728\u672C\u673A DeepSeek Harness \u4E2D\u7EE7\u7EED\u4E00\u4E2A\u6765\u81EA AI Office \u7684\u4EFB\u52A1\u3002":"You are continuing an AI Office task inside the local DeepSeek Harness.","\u53EA\u5728\u5F53\u524D Workspace \u5185\u884C\u52A8\u3002\u5B8C\u6210\u540E\u5FC5\u987B\u8FD4\u56DE\uFF1A\u7ED3\u679C\u6458\u8981\u3001\u6539\u52A8\u6587\u4EF6\u3001\u9A8C\u8BC1\u8BC1\u636E\u3001\u672A\u89E3\u51B3\u98CE\u9669\u3002":"Act only within the current Workspace. When finished you must return: a result summary, changed files, verification evidence, and unresolved risks.","## \u672C\u673A Instruction Preset":"## Local Instruction Preset","## \u672C\u8F6E\u8865\u5145\u6307\u4EE4":"## Additional Instructions for This Round","## Office \u65F6\u95F4\u7EBF":"## Office Timeline","\u6279\u51C6 {tool}":"Approve {tool}","Harness \u5DE5\u5177":"Harness tool","Harness \u9700\u8981 {count} \u9879\u8865\u5145\u4FE1\u606F":"Harness needs {count} pieces of additional information","\u5DF2\u9886\u53D6 Job\uFF0C\u51C6\u5907 Workspace alias\uFF1A{alias}":"Job claimed; preparing Workspace alias: {alias}","Harness Session \u5DF2\u521B\u5EFA\u3002":"Harness Session created.","\u6B63\u5728\u4F7F\u7528 {tool}\u2026":"Using {tool}\u2026"};var rH=Object.freeze(Object.assign({},YU,jU,JU,qU,zU,VU,WU,ZU,XU,$U,eH,AH,tH));var aH="zh";function iH(n){let t=typeof n=="string"?n.trim().toLowerCase():"";aH=t==="english"||/^en(?:[-_].*)?$/u.test(t)?"en":"zh"}function D(n,t){if(typeof n!="string")return n;let o=aH==="en"?rH[n]??n:n;return t==null?o:o.replace(/\{(\w+)\}/g,(i,e)=>Object.hasOwn(t,e)?String(t[e]):i)}var yb=Object.freeze({version:1,bots:Object.freeze([])}),ige=new Set(["clientId","secretRef","approvedSenders"]);function zo(n){return typeof n=="string"&&n.trim()?n.trim():null}function oge(n){return $se("sha256").update(n).digest("hex")}function sH(n){let t=zo(n);return t&&/^dt_[a-f0-9]{24}$/.test(t)?t:null}function nge(n){let t=zo(n);return t&&/^DSH_DINGTALK_BOT_SECRET_[A-F0-9]{24}$/.test(t)?t:null}function sge(n){let t=zo(n);return t&&/^dt_sender_[a-f0-9]{32}$/.test(t)?t:null}function gge(n){let t=typeof n=="string"?{staffId:n}:n;if(!t||typeof t!="object"||Array.isArray(t))return null;let o=sge(t.senderKey),i=zo(t.staffId);return!o||!i?null:Object.freeze({senderKey:o,staffId:i,displayName:zo(t.displayName),approvedAt:zo(t.approvedAt)})}function cge(n){if(!Array.isArray(n))return null;let t=n.map(gge);if(t.some(e=>e===null))return null;let o=new Set,i=new Set;for(let e of t){if(o.has(e.staffId)||i.has(e.senderKey))return null;o.add(e.staffId),i.add(e.senderKey)}return Object.freeze(t)}function gf(n){let t=zo(n);if(!t)throw new TypeError("clientId is required");let o=oge(t).slice(0,24);return Object.freeze({botId:`dt_${o}`,secretRef:`DSH_DINGTALK_BOT_SECRET_${o.toUpperCase()}`})}function gH(){return`dt_sender_${nH().replaceAll("-","")}`}function mb(n){return zo(n)?D("\u8EAB\u4EFD\u5DF2\u9690\u85CF"):D("\u9489\u9489\u7528\u6237")}function Sb(n){let t=zo(n);return t?t.length<=8?`${t.slice(0,2)}\u2022\u2022\u2022\u2022`:`${t.slice(0,4)}\u2022\u2022\u2022\u2022${t.slice(-4)}`:D("\u9489\u9489\u673A\u5668\u4EBA")}function cH(n,{stored:t=!1}={}){if(!n||typeof n!="object"||Array.isArray(n)||"clientSecret"in n||"client_secret"in n||"deviceCode"in n||t&&Object.keys(n).some(r=>!ige.has(r)))return null;let o=zo(n.clientId),i=nge(n.secretRef),e=cge(n.approvedSenders??[]);if(!o||!i||!e)return null;let a=gf(o);return a.secretRef!==i||(n.botId===void 0?a.botId:sH(n.botId))!==a.botId?null:Object.freeze({botId:a.botId,clientId:o,secretRef:i,approvedSenders:e})}function Ige(n){if(!n||n.version!==1||!Array.isArray(n.bots))return null;let t=n.bots.map(a=>cH(a,{stored:!0}));if(t.some(a=>a===null))return null;let o=new Set,i=new Set,e=new Set;for(let a of t){if(o.has(a.botId)||i.has(a.clientId)||e.has(a.secretRef))return null;o.add(a.botId),i.add(a.clientId),e.add(a.secretRef)}return Object.freeze({version:1,bots:Object.freeze(t)})}function lge(n){return{version:1,bots:n.bots.map(t=>({clientId:t.clientId,secretRef:t.secretRef,approvedSenders:t.approvedSenders.map(o=>({senderKey:o.senderKey,staffId:o.staffId,displayName:o.displayName,approvedAt:o.approvedAt}))}))}}var sf=class{#e;#A=yb;#t=Promise.resolve();constructor(t){if(!zo(t))throw new TypeError("config path is required");this.#e=t}async load(){try{let t=Ige(JSON.parse(await Age(this.#e,"utf8")));if(!t)throw new Error("dsh-dingtalk config contains invalid bot data");this.#A=t}catch(t){if(t?.code!=="ENOENT")throw t;this.#A=yb}return this}list(){return structuredClone(this.#A.bots)}get(t){let o=this.#A.bots.find(i=>i.botId===t);return o?structuredClone(o):null}getByClientId(t){let o=this.#A.bots.find(i=>i.clientId===t);return o?structuredClone(o):null}async save(t){let o=cH(t);if(!o)throw new Error("Refusing to persist invalid dsh-dingtalk bot data");return this.#r(i=>{if(i.find(A=>(A.clientId===o.clientId||A.secretRef===o.secretRef)&&A.botId!==o.botId))throw new Error("Duplicate DingTalk bot identity");let a=i.findIndex(A=>A.botId===o.botId);return a===-1?i.push(o):i[a]=o,structuredClone(o)})}async remove(t){if(!sH(t))throw new TypeError("Invalid DingTalk bot id");return this.#r(o=>{let i=o.findIndex(a=>a.botId===t);if(i===-1)return null;let[e]=o.splice(i,1);return structuredClone(e)})}async clear(){let t=this.#t.then(async()=>{try{await oH(this.#e)}catch(o){if(o?.code!=="ENOENT")throw o}this.#A=yb});this.#t=t.then(()=>{},()=>{}),await t}async#r(t){let o,i=this.#t.then(async()=>{let e=[...this.#A.bots];o=t(e);let a=Object.freeze({version:1,bots:Object.freeze(e)});await this.#a(a),this.#A=a});return this.#t=i.then(()=>{},()=>{}),await i,o}async#a(t){await ege(age(this.#e),{recursive:!0,mode:448});let o=`${this.#e}.${process.pid}.${nH()}.tmp`;try{await rge(o,`${JSON.stringify(lge(t),null,2)}
|
|
136
136
|
`,{encoding:"utf8",flag:"wx",mode:384}),await tge(o,this.#e)}catch(i){try{await oH(o)}catch(e){if(e?.code!=="ENOENT")throw new AggregateError([i,e])}throw i}}};var lH="https://oapi.dingtalk.com",pge="DING_DWS_CLAW";function Vo(n){return typeof n=="string"&&n.trim()?n.trim():null}function IH(n,t){let o=Number(n);return Number.isFinite(o)&&o>0?o:t}function dge(n){let t;try{t=new URL(Vo(n)??lH)}catch{throw new TypeError("DingTalk registration base URL must be a valid HTTPS URL")}let o=t.hostname==="dingtalk.com"||t.hostname.endsWith(".dingtalk.com");if(t.protocol!=="https:"||t.port||!o||t.username||t.password||t.search||t.hash)throw new TypeError("DingTalk registration base URL must be a valid HTTPS URL");return t.pathname=t.pathname.replace(/\/+$/,""),t.href.replace(/\/$/,"")}function hge(n){let t=typeof n?.now=="function"?n.now():n();if(!Number.isFinite(t))throw new TypeError("clock must return a finite timestamp");return t}function Ege(n,t){if(!n||typeof n!="object"||Array.isArray(n))throw new On("invalid-response",`DingTalk ${t} returned an invalid response`,t);if(Number(n.errcode)!==0)throw new On("api-error",`DingTalk ${t} request was rejected`,t);return n}var On=class extends Error{constructor(t,o,i,e={}){super(o,e),this.name="DingtalkDeviceAuthError",this.code=t,this.action=i}},cf=class{#e;#A;#t;#r;constructor({fetch:t=globalThis.fetch,clock:o=Date,baseUrl:i=lH,timeoutMs:e=15e3}={}){if(typeof t!="function")throw new TypeError("fetch is required");if(typeof o!="function"&&typeof o?.now!="function")throw new TypeError("clock must be a function or expose now()");if(!Number.isFinite(e)||e<=0)throw new TypeError("timeoutMs must be a positive number");this.#e=t,this.#A=o,this.#t=dge(i),this.#r=e}async start({signal:t}={}){let o=await this.#a("/app/registration/init",{source:pge},"initialization",t),i=Vo(o.nonce);if(!i)throw new On("missing-nonce","DingTalk registration initialization did not return a nonce","initialization");let e=await this.#a("/app/registration/begin",{nonce:i},"begin",t),a=Vo(e.device_code),A=Vo(e.verification_uri_complete);if(!a||!A)throw new On("incomplete-registration","DingTalk registration did not return complete QR metadata","begin");let r=IH(e.expires_in,7200),s=IH(e.interval,5)*1e3;return Object.freeze({deviceCode:a,verificationUrl:A,verificationUri:Vo(e.verification_uri),userCode:Vo(e.user_code),expiresAt:hge(this.#A)+r*1e3,pollIntervalMs:s})}async poll(t){let o=Vo(typeof t=="string"?t:t?.deviceCode),i=typeof t=="object"?t?.signal:void 0;if(!o)throw new TypeError("deviceCode is required");let e=await this.#a("/app/registration/poll",{device_code:o},"poll",i),a=Vo(e.status)?.toUpperCase(),A=["WAITING","SUCCESS","FAIL","EXPIRED"].includes(a)?a:"UNKNOWN";return Object.freeze({status:A,clientId:Vo(e.client_id),clientSecret:Vo(e.client_secret),failReason:Vo(e.fail_reason)})}async#a(t,o,i,e){let a,A=AbortSignal.timeout(this.#r),r=e?AbortSignal.any([e,A]):A;try{a=await this.#e(`${this.#t}${t}`,{method:"POST",headers:{accept:"application/json","content-type":"application/json"},body:JSON.stringify(o),redirect:"error",signal:r})}catch(g){throw e?.aborted?e.reason??g:A.aborted?new On("timeout",`DingTalk ${i} request timed out`,i,{cause:g}):g?.name==="AbortError"?g:new On("network-error",`DingTalk ${i} request could not be completed`,i,{cause:g})}if(!a||a.ok===!1||typeof a.json!="function")throw new On("http-error",`DingTalk ${i} request failed`,i);let s;try{s=await a.json()}catch(g){throw new On("invalid-json",`DingTalk ${i} returned invalid JSON`,i,{cause:g})}return Ege(s,i)}};import{randomUUID as wge}from"node:crypto";var pH=new WeakMap,Db=Symbol("dsh-im.connection-test-state-identity");function dH(n){return n?.[Db]??n}function Cge(n){return typeof n=="string"&&n.trim()?n.trim():null}function io(n,t){if(!n||!t||typeof t!="object")return!1;try{return pH.set(dH(n),structuredClone(t)),!0}catch{return!1}}function Kh(n){let t=n?pH.get(dH(n)):null;return t?structuredClone(t):null}function ma(n,t=D("\u673A\u5668\u4EBA")){let o=Cge(n)??t;return`${D("\u2705 DeepSeek Harness \u8FDE\u63A5\u6D4B\u8BD5\u6210\u529F")}
|
|
137
|
-
${D("\u8FD9\u6761\u6D88\u606F\u7531\u63D2\u4EF6\u9875\u9762\u4E2D\u7684\u201C{name}\u201D\u673A\u5668\u4EBA\u5361\u7247\u53D1\u51FA\u3002",{name:o})}`}function Ir(n=D("\u673A\u5668\u4EBA")){let t=new Error(D("{channelLabel}\u5C1A\u672A\u6536\u5230\u53EF\u7528\u4E8E\u6D4B\u8BD5\u7684\u79C1\u804A\u6D88\u606F\u3002",{channelLabel:n}));return t.code="test-target-unavailable",t}async function Tg({state:n,send:t,text:o,channelLabel:i}){let e=Kh(n);if(!e)throw Ir(i);return await t(e,o),{sent:!0}}function rr(n){return Object.freeze(n?{sent:!1,code:n?.code==="test-target-unavailable"?"test-target-unavailable":"test-message-failed"}:{sent:!0})}import{randomUUID as uge}from"node:crypto";var Bge=Object.freeze({AUTH:"MODEL_AUTH",MISSING_CREDENTIAL:"MODEL_AUTH",INVALID_CREDENTIAL:"MODEL_AUTH",QUOTA:"MODEL_QUOTA",RATE_LIMIT:"MODEL_RATE_LIMIT",CONTEXT_WINDOW_EXCEEDED:"MODEL_CONTEXT_LIMIT",UNKNOWN_MODEL:"MODEL_UNAVAILABLE",NO_ADAPTER:"MODEL_UNAVAILABLE",UNSUPPORTED_OPTION:"MODEL_CONFIG",UNSUPPORTED_REASONING_EFFORT:"MODEL_CONFIG",TIMEOUT:"MODEL_TIMEOUT",TRANSPORT:"MODEL_TRANSPORT",SERVER:"MODEL_SERVICE",STREAM_CLOSED:"MODEL_STREAM",MALFORMED_RESPONSE:"MODEL_STREAM",EMPTY_RESPONSE:"MODEL_EMPTY_REPLY",CONTENT_FILTER:"MODEL_CONTENT_REJECTED",UNSUPPORTED_CONTENT:"MODEL_CONFIG"}),fge=Object.freeze({HARNESS_CONNECT:"\u65E0\u6CD5\u8FDE\u63A5\u5904\u7406\u670D\u52A1\uFF0C\u6D88\u606F\u5C1A\u672A\u63D0\u4EA4\u3002\u8BF7\u786E\u8BA4 DeepSeek Harness \u6B63\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002",HARNESS_TIMEOUT:"\u5904\u7406\u670D\u52A1\u54CD\u5E94\u8D85\u65F6\uFF0C\u6D88\u606F\u5C1A\u672A\u5F00\u59CB\u5904\u7406\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",HARNESS_RESULT_UNCERTAIN:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u4EFB\u52A1\u72B6\u6001\uFF0C\u4EFB\u52A1\u53EF\u80FD\u5DF2\u7ECF\u5F00\u59CB\u3002\u8BF7\u5148\u7B49\u5F85\u6216\u53D1\u9001 /stop\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\u3002",HARNESS_ACCESS:"\u5904\u7406\u670D\u52A1\u62D2\u7EDD\u4E86\u673A\u5668\u4EBA\u8FDE\u63A5\u3002\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5 Harness \u5730\u5740\u3001\u4EE3\u7406\u6216\u8BBF\u95EE\u914D\u7F6E\u540E\u91CD\u8BD5\u3002",HARNESS_PROTOCOL:"\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u7684\u63A5\u53E3\u4E0D\u517C\u5BB9\u3002\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5 Harness \u5730\u5740\u5E76\u66F4\u65B0\u76F8\u5173\u7248\u672C\u3002",HARNESS_SERVICE:"DeepSeek Harness \u6682\u65F6\u65E0\u6CD5\u5B8C\u6210\u8BF7\u6C42\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_REPLY_TIMEOUT:"\u7B49\u5F85\u6A21\u578B\u56DE\u590D\u8D85\u65F6\uFF0C\u4EFB\u52A1\u53EF\u80FD\u4ECD\u5728\u8FD0\u884C\u3002\u8BF7\u5148\u7B49\u5F85\u6216\u53D1\u9001 /stop\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\u3002",MODEL_AUTH:"\u6A21\u578B\u51ED\u636E\u7F3A\u5931\u6216\u5DF2\u5931\u6548\u3002\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\u540E\u91CD\u8BD5\u3002",MODEL_QUOTA:"\u6A21\u578B\u989D\u5EA6\u6216\u4F59\u989D\u4E0D\u8DB3\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7BA1\u7406\u5458\u8865\u5145\u989D\u5EA6\u6216\u5207\u6362\u6A21\u578B\u540E\u91CD\u8BD5\u3002",MODEL_RATE_LIMIT:"\u6A21\u578B\u670D\u52A1\u6B63\u5728\u9650\u6D41\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_CONTEXT_LIMIT:"\u5F53\u524D\u4F1A\u8BDD\u5185\u5BB9\u8D85\u8FC7\u6A21\u578B\u4E0A\u4E0B\u6587\u4E0A\u9650\u3002\u8BF7\u53D1\u9001 /compact \u6216 /new \u540E\u91CD\u8BD5\u3002",MODEL_UNAVAILABLE:"\u5F53\u524D\u6A21\u578B\u4E0D\u5B58\u5728\u6216\u4E0D\u652F\u6301\u6240\u9009\u914D\u7F6E\u3002\u8BF7\u53D1\u9001 /models\uFF0C\u5E76\u4F7F\u7528 /model \u91CD\u65B0\u9009\u62E9\u3002",MODEL_CONFIG:"\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u8FD9\u7C7B\u5185\u5BB9\u6216\u6240\u9009\u914D\u7F6E\u3002\u8BF7\u8C03\u6574\u5185\u5BB9\u3001\u6A21\u578B\u6216\u63A8\u7406\u7B49\u7EA7\u540E\u91CD\u8BD5\u3002",MODEL_TIMEOUT:"\u6A21\u578B\u670D\u52A1\u54CD\u5E94\u8D85\u65F6\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_TRANSPORT:"\u6682\u65F6\u65E0\u6CD5\u8FDE\u63A5\u6A21\u578B\u670D\u52A1\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_SERVICE:"\u6A21\u578B\u670D\u52A1\u6682\u65F6\u5F02\u5E38\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_STREAM:"\u6A21\u578B\u56DE\u590D\u4E2D\u65AD\u6216\u683C\u5F0F\u5F02\u5E38\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u3002",MODEL_EMPTY_REPLY:"\u6A21\u578B\u6CA1\u6709\u8FD4\u56DE\u53EF\u663E\u793A\u7684\u5185\u5BB9\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u53D1\u751F\uFF0C\u8BF7\u5207\u6362\u6A21\u578B\u3002",MODEL_CONTENT_REJECTED:"\u6A21\u578B\u62D2\u7EDD\u5904\u7406\u5F53\u524D\u5185\u5BB9\u3002\u8BF7\u8C03\u6574\u95EE\u9898\u5185\u5BB9\u540E\u91CD\u8BD5\u3002",MODEL_OUTPUT_LIMIT:"\u6A21\u578B\u8FBE\u5230\u8F93\u51FA\u957F\u5EA6\u4E0A\u9650\uFF0C\u4F46\u6CA1\u6709\u751F\u6210\u53EF\u663E\u793A\u7684\u7ED3\u679C\u3002\u8BF7\u7F29\u5C0F\u4EFB\u52A1\u8303\u56F4\u540E\u91CD\u8BD5\u3002",TURN_BLOCKED:"\u4EFB\u52A1\u6B63\u5728\u7B49\u5F85\u65E0\u6CD5\u5728\u5F53\u524D\u6E20\u9053\u5B8C\u6210\u7684\u64CD\u4F5C\u3002\u8BF7\u5728 DeepSeek Harness \u4E2D\u5904\u7406\u540E\u518D\u8BD5\u3002",TURN_INTERRUPTED:"\u4EFB\u52A1\u88AB\u610F\u5916\u4E2D\u65AD\uFF0C\u672C\u6B21\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u3002",SESSION_NOT_FOUND:"\u5F53\u524D\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\u3002\u8BF7\u53D1\u9001 /new \u521B\u5EFA\u65B0\u4F1A\u8BDD\u540E\u91CD\u8BD5\u3002",SESSION_BUSY:"\u5F53\u524D\u4F1A\u8BDD\u4ECD\u5728\u5904\u7406\u4E0A\u4E00\u9879\u4EFB\u52A1\u3002\u8BF7\u7B49\u5F85\u5B8C\u6210\uFF0C\u6216\u53D1\u9001 /stop \u540E\u91CD\u8BD5\u3002",SESSION_STALE:"\u5DE5\u4F5C\u533A\u6216\u4F1A\u8BDD\u72B6\u6001\u521A\u521A\u53D1\u751F\u53D8\u5316\u3002\u8BF7\u91CD\u65B0\u53D1\u9001\u8FD9\u6761\u6D88\u606F\u3002",WORKSPACE_UNAVAILABLE:"\u5F53\u524D\u5DE5\u4F5C\u533A\u4E0D\u5B58\u5728\u6216\u6682\u4E0D\u53EF\u7528\u3002\u8BF7\u91CD\u65B0\u9009\u62E9\u5DE5\u4F5C\u533A\u540E\u91CD\u8BD5\u3002",PRESET_UNAVAILABLE:"\u5F53\u524D Agent Preset \u4E0D\u5B58\u5728\u6216\u6682\u4E0D\u53EF\u7528\u3002\u8BF7\u53D1\u9001 /presetlist \u540E\u91CD\u65B0\u9009\u62E9\u3002",CHANNEL_PERMISSION:"\u56DE\u590D\u5DF2\u7ECF\u751F\u6210\uFF0C\u4F46\u673A\u5668\u4EBA\u6CA1\u6709\u53D1\u9001\u6743\u9650\u3002\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u68C0\u67E5\u6E20\u9053\u6743\u9650\u6216\u91CD\u65B0\u7ED1\u5B9A\u673A\u5668\u4EBA\u3002",CHANNEL_RATE_LIMIT:"\u56DE\u590D\u5DF2\u7ECF\u751F\u6210\uFF0C\u4F46\u5F53\u524D\u6E20\u9053\u6B63\u5728\u9650\u6D41\uFF0C\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",CHANNEL_DELIVERY_UNCERTAIN:"\u56DE\u590D\u53D1\u9001\u7ED3\u679C\u672A\u80FD\u786E\u8BA4\u3002\u8BF7\u5148\u68C0\u67E5\u804A\u5929\u5185\u662F\u5426\u5DF2\u7ECF\u6536\u5230\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\u3002",CHANNEL_DELIVERY:"\u56DE\u590D\u5DF2\u7ECF\u751F\u6210\uFF0C\u4F46\u5F53\u524D\u6E20\u9053\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",INPUT_INVALID:"\u5F53\u524D\u6D88\u606F\u5305\u542B\u65E0\u6CD5\u5904\u7406\u7684\u56FE\u7247\u6216\u6587\u4EF6\u3002\u8BF7\u8C03\u6574\u540E\u91CD\u65B0\u53D1\u9001\u3002",INTERNAL_UNKNOWN:"\u4EFB\u52A1\u672A\u5B8C\u6210\uFF0C\u6682\u65F6\u65E0\u6CD5\u786E\u5B9A\u539F\u56E0\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u53D1\u751F\uFF0C\u8BF7\u5C06\u53C2\u8003\u53F7\u63D0\u4F9B\u7ED9\u7BA1\u7406\u5458\u3002"});function Qge(n){if(n?.code!=="harness-turn-failed")return null;let t=n?.providerCode??n?.details?.providerCode;return typeof t!="string"?null:Bge[t.trim().toUpperCase()]??null}function yge(n){let t=typeof n?.code=="string"?n.code:"",o=Qge(n);if(o)return o;if(t==="harness-connect-failed")return["session.prompt","session.history"].includes(n?.method)?"HARNESS_RESULT_UNCERTAIN":"HARNESS_CONNECT";if(t==="harness-timeout")return["session.prompt","session.history"].includes(n?.method)?"HARNESS_RESULT_UNCERTAIN":"HARNESS_TIMEOUT";if(t==="harness-reply-timeout")return"MODEL_REPLY_TIMEOUT";if(["harness-auth-required","harness-proxy-auth-required","harness-loopback-forbidden","harness-host-untrusted","harness-request-forbidden"].includes(t))return"HARNESS_ACCESS";if(["harness-api-not-found","harness-response-invalid"].includes(t))return"HARNESS_PROTOCOL";if(t==="harness-turn-failed")return"INTERNAL_UNKNOWN";if(["harness-http-failed","harness-rpc-rejected"].includes(t))return"HARNESS_SERVICE";if(t==="model-empty-response")return"MODEL_EMPTY_REPLY";if(t==="model-max-tokens")return"MODEL_OUTPUT_LIMIT";if(t==="turn-blocked")return"TURN_BLOCKED";if(["turn-interrupted","turn-aborted"].includes(t))return"TURN_INTERRUPTED";if(t==="session-not-found")return"SESSION_NOT_FOUND";if(t==="agent-busy")return"SESSION_BUSY";if(t==="workspace-session-stale")return"SESSION_STALE";if(t.startsWith("workspace-"))return"WORKSPACE_UNAVAILABLE";if(t.startsWith("agent-preset-"))return"PRESET_UNAVAILABLE";if(t.startsWith("image-")||t.startsWith("inbound-file-")||t==="attachment-error")return"INPUT_INVALID";let i=Number(n?.status??n?.httpStatus);return i===401||i===403||["channel-permission","permission-required","artifact-permission-required","forbidden","stale-token"].includes(t)?"CHANNEL_PERMISSION":i===429||["channel-rate-limit","rate-limited","artifact-rate-limited"].includes(t)?"CHANNEL_RATE_LIMIT":["channel-delivery-uncertain","delivery-uncertain","artifact-delivery-uncertain"].includes(t)?"CHANNEL_DELIVERY_UNCERTAIN":t==="channel-delivery-failed"||t.startsWith("artifact-")||["network-error","timeout"].includes(t)?"CHANNEL_DELIVERY":"INTERNAL_UNKNOWN"}function mge(n){return typeof n=="string"&&/^[A-Z0-9-]{6,40}$/u.test(n)?n:`MF-${uge().slice(0,8).toUpperCase()}`}function Sge(n){return typeof n!="string"||!/^[A-Za-z0-9_-]{1,64}$/u.test(n)?null:n.toUpperCase().replaceAll("-","_")}function Dge(n,{userMessage:t,reason:o,referenceId:i,at:e=Date.now()}={}){let a=Sge(o),A=yge(n),r=A==="INTERNAL_UNKNOWN"&&a&&typeof t=="string"&&t.trim()?"INPUT_INVALID":A;return Object.freeze({code:r,reason:a??r,message:typeof t=="string"&&t.trim()?t.trim():D(fge[r]),referenceId:mge(i),at:Number.isFinite(e)?e:Date.now()})}function dt(n){return`${n.message}
|
|
137
|
+
${D("\u8FD9\u6761\u6D88\u606F\u7531\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u4E2D\u7684\u201C{name}\u201D\u673A\u5668\u4EBA\u5361\u7247\u53D1\u51FA\u3002",{name:o})}`}function Ir(n=D("\u673A\u5668\u4EBA")){let t=new Error(D("{channelLabel}\u5C1A\u672A\u6536\u5230\u53EF\u7528\u4E8E\u6D4B\u8BD5\u7684\u79C1\u804A\u6D88\u606F\u3002",{channelLabel:n}));return t.code="test-target-unavailable",t}async function Tg({state:n,send:t,text:o,channelLabel:i}){let e=Kh(n);if(!e)throw Ir(i);return await t(e,o),{sent:!0}}function rr(n){return Object.freeze(n?{sent:!1,code:n?.code==="test-target-unavailable"?"test-target-unavailable":"test-message-failed"}:{sent:!0})}import{randomUUID as uge}from"node:crypto";var Bge=Object.freeze({AUTH:"MODEL_AUTH",MISSING_CREDENTIAL:"MODEL_AUTH",INVALID_CREDENTIAL:"MODEL_AUTH",QUOTA:"MODEL_QUOTA",RATE_LIMIT:"MODEL_RATE_LIMIT",CONTEXT_WINDOW_EXCEEDED:"MODEL_CONTEXT_LIMIT",UNKNOWN_MODEL:"MODEL_UNAVAILABLE",NO_ADAPTER:"MODEL_UNAVAILABLE",UNSUPPORTED_OPTION:"MODEL_CONFIG",UNSUPPORTED_REASONING_EFFORT:"MODEL_CONFIG",TIMEOUT:"MODEL_TIMEOUT",TRANSPORT:"MODEL_TRANSPORT",SERVER:"MODEL_SERVICE",STREAM_CLOSED:"MODEL_STREAM",MALFORMED_RESPONSE:"MODEL_STREAM",EMPTY_RESPONSE:"MODEL_EMPTY_REPLY",CONTENT_FILTER:"MODEL_CONTENT_REJECTED",UNSUPPORTED_CONTENT:"MODEL_CONFIG"}),fge=Object.freeze({HARNESS_CONNECT:"\u65E0\u6CD5\u8FDE\u63A5\u5904\u7406\u670D\u52A1\uFF0C\u6D88\u606F\u5C1A\u672A\u63D0\u4EA4\u3002\u8BF7\u786E\u8BA4 DeepSeek Harness \u6B63\u5728\u8FD0\u884C\u540E\u91CD\u8BD5\u3002",HARNESS_TIMEOUT:"\u5904\u7406\u670D\u52A1\u54CD\u5E94\u8D85\u65F6\uFF0C\u6D88\u606F\u5C1A\u672A\u5F00\u59CB\u5904\u7406\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",HARNESS_RESULT_UNCERTAIN:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u4EFB\u52A1\u72B6\u6001\uFF0C\u4EFB\u52A1\u53EF\u80FD\u5DF2\u7ECF\u5F00\u59CB\u3002\u8BF7\u5148\u7B49\u5F85\u6216\u53D1\u9001 /stop\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\u3002",HARNESS_ACCESS:"\u5904\u7406\u670D\u52A1\u62D2\u7EDD\u4E86\u673A\u5668\u4EBA\u8FDE\u63A5\u3002\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5 Harness \u5730\u5740\u3001\u4EE3\u7406\u6216\u8BBF\u95EE\u914D\u7F6E\u540E\u91CD\u8BD5\u3002",HARNESS_PROTOCOL:"\u673A\u5668\u4EBA\u4E0E DeepSeek Harness \u7684\u63A5\u53E3\u4E0D\u517C\u5BB9\u3002\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5 Harness \u5730\u5740\u5E76\u66F4\u65B0\u76F8\u5173\u7248\u672C\u3002",HARNESS_SERVICE:"DeepSeek Harness \u6682\u65F6\u65E0\u6CD5\u5B8C\u6210\u8BF7\u6C42\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_REPLY_TIMEOUT:"\u7B49\u5F85\u6A21\u578B\u56DE\u590D\u8D85\u65F6\uFF0C\u4EFB\u52A1\u53EF\u80FD\u4ECD\u5728\u8FD0\u884C\u3002\u8BF7\u5148\u7B49\u5F85\u6216\u53D1\u9001 /stop\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\u3002",MODEL_AUTH:"\u6A21\u578B\u51ED\u636E\u7F3A\u5931\u6216\u5DF2\u5931\u6548\u3002\u8BF7\u7BA1\u7406\u5458\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\u540E\u91CD\u8BD5\u3002",MODEL_QUOTA:"\u6A21\u578B\u989D\u5EA6\u6216\u4F59\u989D\u4E0D\u8DB3\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7BA1\u7406\u5458\u8865\u5145\u989D\u5EA6\u6216\u5207\u6362\u6A21\u578B\u540E\u91CD\u8BD5\u3002",MODEL_RATE_LIMIT:"\u6A21\u578B\u670D\u52A1\u6B63\u5728\u9650\u6D41\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_CONTEXT_LIMIT:"\u5F53\u524D\u4F1A\u8BDD\u5185\u5BB9\u8D85\u8FC7\u6A21\u578B\u4E0A\u4E0B\u6587\u4E0A\u9650\u3002\u8BF7\u53D1\u9001 /compact \u6216 /new \u540E\u91CD\u8BD5\u3002",MODEL_UNAVAILABLE:"\u5F53\u524D\u6A21\u578B\u4E0D\u5B58\u5728\u6216\u4E0D\u652F\u6301\u6240\u9009\u914D\u7F6E\u3002\u8BF7\u53D1\u9001 /models\uFF0C\u5E76\u4F7F\u7528 /model \u91CD\u65B0\u9009\u62E9\u3002",MODEL_CONFIG:"\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u8FD9\u7C7B\u5185\u5BB9\u6216\u6240\u9009\u914D\u7F6E\u3002\u8BF7\u8C03\u6574\u5185\u5BB9\u3001\u6A21\u578B\u6216\u63A8\u7406\u7B49\u7EA7\u540E\u91CD\u8BD5\u3002",MODEL_TIMEOUT:"\u6A21\u578B\u670D\u52A1\u54CD\u5E94\u8D85\u65F6\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_TRANSPORT:"\u6682\u65F6\u65E0\u6CD5\u8FDE\u63A5\u6A21\u578B\u670D\u52A1\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_SERVICE:"\u6A21\u578B\u670D\u52A1\u6682\u65F6\u5F02\u5E38\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",MODEL_STREAM:"\u6A21\u578B\u56DE\u590D\u4E2D\u65AD\u6216\u683C\u5F0F\u5F02\u5E38\uFF0C\u672C\u6B21\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u3002",MODEL_EMPTY_REPLY:"\u6A21\u578B\u6CA1\u6709\u8FD4\u56DE\u53EF\u663E\u793A\u7684\u5185\u5BB9\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u53D1\u751F\uFF0C\u8BF7\u5207\u6362\u6A21\u578B\u3002",MODEL_CONTENT_REJECTED:"\u6A21\u578B\u62D2\u7EDD\u5904\u7406\u5F53\u524D\u5185\u5BB9\u3002\u8BF7\u8C03\u6574\u95EE\u9898\u5185\u5BB9\u540E\u91CD\u8BD5\u3002",MODEL_OUTPUT_LIMIT:"\u6A21\u578B\u8FBE\u5230\u8F93\u51FA\u957F\u5EA6\u4E0A\u9650\uFF0C\u4F46\u6CA1\u6709\u751F\u6210\u53EF\u663E\u793A\u7684\u7ED3\u679C\u3002\u8BF7\u7F29\u5C0F\u4EFB\u52A1\u8303\u56F4\u540E\u91CD\u8BD5\u3002",TURN_BLOCKED:"\u4EFB\u52A1\u6B63\u5728\u7B49\u5F85\u65E0\u6CD5\u5728\u5F53\u524D\u6E20\u9053\u5B8C\u6210\u7684\u64CD\u4F5C\u3002\u8BF7\u5728 DeepSeek Harness \u4E2D\u5904\u7406\u540E\u518D\u8BD5\u3002",TURN_INTERRUPTED:"\u4EFB\u52A1\u88AB\u610F\u5916\u4E2D\u65AD\uFF0C\u672C\u6B21\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u3002",SESSION_NOT_FOUND:"\u5F53\u524D\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\u3002\u8BF7\u53D1\u9001 /new \u521B\u5EFA\u65B0\u4F1A\u8BDD\u540E\u91CD\u8BD5\u3002",SESSION_BUSY:"\u5F53\u524D\u4F1A\u8BDD\u4ECD\u5728\u5904\u7406\u4E0A\u4E00\u9879\u4EFB\u52A1\u3002\u8BF7\u7B49\u5F85\u5B8C\u6210\uFF0C\u6216\u53D1\u9001 /stop \u540E\u91CD\u8BD5\u3002",SESSION_STALE:"\u5DE5\u4F5C\u533A\u6216\u4F1A\u8BDD\u72B6\u6001\u521A\u521A\u53D1\u751F\u53D8\u5316\u3002\u8BF7\u91CD\u65B0\u53D1\u9001\u8FD9\u6761\u6D88\u606F\u3002",WORKSPACE_UNAVAILABLE:"\u5F53\u524D\u5DE5\u4F5C\u533A\u4E0D\u5B58\u5728\u6216\u6682\u4E0D\u53EF\u7528\u3002\u8BF7\u91CD\u65B0\u9009\u62E9\u5DE5\u4F5C\u533A\u540E\u91CD\u8BD5\u3002",PRESET_UNAVAILABLE:"\u5F53\u524D Agent Preset \u4E0D\u5B58\u5728\u6216\u6682\u4E0D\u53EF\u7528\u3002\u8BF7\u53D1\u9001 /presetlist \u540E\u91CD\u65B0\u9009\u62E9\u3002",CHANNEL_PERMISSION:"\u56DE\u590D\u5DF2\u7ECF\u751F\u6210\uFF0C\u4F46\u673A\u5668\u4EBA\u6CA1\u6709\u53D1\u9001\u6743\u9650\u3002\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u68C0\u67E5\u6E20\u9053\u6743\u9650\u6216\u91CD\u65B0\u7ED1\u5B9A\u673A\u5668\u4EBA\u3002",CHANNEL_RATE_LIMIT:"\u56DE\u590D\u5DF2\u7ECF\u751F\u6210\uFF0C\u4F46\u5F53\u524D\u6E20\u9053\u6B63\u5728\u9650\u6D41\uFF0C\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",CHANNEL_DELIVERY_UNCERTAIN:"\u56DE\u590D\u53D1\u9001\u7ED3\u679C\u672A\u80FD\u786E\u8BA4\u3002\u8BF7\u5148\u68C0\u67E5\u804A\u5929\u5185\u662F\u5426\u5DF2\u7ECF\u6536\u5230\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u63D0\u4EA4\u3002",CHANNEL_DELIVERY:"\u56DE\u590D\u5DF2\u7ECF\u751F\u6210\uFF0C\u4F46\u5F53\u524D\u6E20\u9053\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\u3002\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",INPUT_INVALID:"\u5F53\u524D\u6D88\u606F\u5305\u542B\u65E0\u6CD5\u5904\u7406\u7684\u56FE\u7247\u6216\u6587\u4EF6\u3002\u8BF7\u8C03\u6574\u540E\u91CD\u65B0\u53D1\u9001\u3002",INTERNAL_UNKNOWN:"\u4EFB\u52A1\u672A\u5B8C\u6210\uFF0C\u6682\u65F6\u65E0\u6CD5\u786E\u5B9A\u539F\u56E0\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u6301\u7EED\u53D1\u751F\uFF0C\u8BF7\u5C06\u53C2\u8003\u53F7\u63D0\u4F9B\u7ED9\u7BA1\u7406\u5458\u3002"});function Qge(n){if(n?.code!=="harness-turn-failed")return null;let t=n?.providerCode??n?.details?.providerCode;return typeof t!="string"?null:Bge[t.trim().toUpperCase()]??null}function yge(n){let t=typeof n?.code=="string"?n.code:"",o=Qge(n);if(o)return o;if(t==="harness-connect-failed")return["session.prompt","session.history"].includes(n?.method)?"HARNESS_RESULT_UNCERTAIN":"HARNESS_CONNECT";if(t==="harness-timeout")return["session.prompt","session.history"].includes(n?.method)?"HARNESS_RESULT_UNCERTAIN":"HARNESS_TIMEOUT";if(t==="harness-reply-timeout")return"MODEL_REPLY_TIMEOUT";if(["harness-auth-required","harness-proxy-auth-required","harness-loopback-forbidden","harness-host-untrusted","harness-request-forbidden"].includes(t))return"HARNESS_ACCESS";if(["harness-api-not-found","harness-response-invalid"].includes(t))return"HARNESS_PROTOCOL";if(t==="harness-turn-failed")return"INTERNAL_UNKNOWN";if(["harness-http-failed","harness-rpc-rejected"].includes(t))return"HARNESS_SERVICE";if(t==="model-empty-response")return"MODEL_EMPTY_REPLY";if(t==="model-max-tokens")return"MODEL_OUTPUT_LIMIT";if(t==="turn-blocked")return"TURN_BLOCKED";if(["turn-interrupted","turn-aborted"].includes(t))return"TURN_INTERRUPTED";if(t==="session-not-found")return"SESSION_NOT_FOUND";if(t==="agent-busy")return"SESSION_BUSY";if(t==="workspace-session-stale")return"SESSION_STALE";if(t.startsWith("workspace-"))return"WORKSPACE_UNAVAILABLE";if(t.startsWith("agent-preset-"))return"PRESET_UNAVAILABLE";if(t.startsWith("image-")||t.startsWith("inbound-file-")||t==="attachment-error")return"INPUT_INVALID";let i=Number(n?.status??n?.httpStatus);return i===401||i===403||["channel-permission","permission-required","artifact-permission-required","forbidden","stale-token"].includes(t)?"CHANNEL_PERMISSION":i===429||["channel-rate-limit","rate-limited","artifact-rate-limited"].includes(t)?"CHANNEL_RATE_LIMIT":["channel-delivery-uncertain","delivery-uncertain","artifact-delivery-uncertain"].includes(t)?"CHANNEL_DELIVERY_UNCERTAIN":t==="channel-delivery-failed"||t.startsWith("artifact-")||["network-error","timeout"].includes(t)?"CHANNEL_DELIVERY":"INTERNAL_UNKNOWN"}function mge(n){return typeof n=="string"&&/^[A-Z0-9-]{6,40}$/u.test(n)?n:`MF-${uge().slice(0,8).toUpperCase()}`}function Sge(n){return typeof n!="string"||!/^[A-Za-z0-9_-]{1,64}$/u.test(n)?null:n.toUpperCase().replaceAll("-","_")}function Dge(n,{userMessage:t,reason:o,referenceId:i,at:e=Date.now()}={}){let a=Sge(o),A=yge(n),r=A==="INTERNAL_UNKNOWN"&&a&&typeof t=="string"&&t.trim()?"INPUT_INVALID":A;return Object.freeze({code:r,reason:a??r,message:typeof t=="string"&&t.trim()?t.trim():D(fge[r]),referenceId:mge(i),at:Number.isFinite(e)?e:Date.now()})}function dt(n){return`${n.message}
|
|
138
138
|
|
|
139
139
|
${D("\u9519\u8BEF\u7801\uFF1A{code}\uFF1B\u53C2\u8003\u53F7\uFF1A{referenceId}",n)}`}function At(n,t,o){let i=Dge(t,o);return n.lastMessageError=i,i}function oo(n){n.lastMessageError=null}function Sa(n,{uncertain:t=!0}={}){let o=new Error("Channel message delivery failed",{cause:n}),i=Number(n?.status??n?.httpStatus);return o.code=i===401||i===403?"channel-permission":i===429?"channel-rate-limit":t?"channel-delivery-uncertain":"channel-delivery-failed",Number.isInteger(i)&&(o.status=i),o}function qr(n){return!n||typeof n!="object"||typeof n.code!="string"||!n.code||typeof n.reason!="string"||!n.reason||typeof n.message!="string"||!n.message||typeof n.referenceId!="string"||!n.referenceId||!Number.isFinite(n.at)?null:{code:n.code.slice(0,64),reason:n.reason.slice(0,64),message:n.message.slice(0,500),referenceId:n.referenceId.slice(0,40),at:n.at}}var hH=new Set(["starting","pending","connecting"]),If=new Set(["connected","expired","failed","cancelled"]);function zr(n){return typeof n=="string"&&n.trim()?n.trim():null}function Da(n,t){return Object.freeze({code:n,message:t})}function uH(n){return typeof n?.now=="function"?n.now():n()}function Oge(n){return new Date(uH(n)).toISOString()}function Ng(){return new DOMException("DingTalk provisioning was cancelled","AbortError")}function qc(n){return n?{attemptId:n.id,status:n.state,...n.verificationUrl?{verificationUrl:n.verificationUrl}:{},...n.expiresAt?{expiresAt:n.expiresAt}:{},...n.pollIntervalMs?{pollIntervalMs:n.pollIntervalMs}:{},...n.botId?{botId:n.botId}:{},...n.alreadyConnected?{alreadyConnected:!0}:{},...n.error?{error:structuredClone(n.error)}:{}}:null}function wb(n){if(!n)return{};let t=typeof n.status=="function"?n.status():n.status;return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function EH(n,t){if(!n||t.connected===!1||t.ready===!1)return!1;let o=zr(t.dingtalkStreamState??t.dingtalkConnectionState??t.connectionState??t.state)?.toLowerCase();return["failed","error","offline","disconnected","stopped"].includes(o)?!1:t.connected===!0||t.ready===!0||o==="connected"||o==="ready"}function BH(n){if(!n||typeof n!="object"||Array.isArray(n))return null;let t=zr(n.staffId??n.senderStaffId??n.senderId);if(!t)return null;let o=zr(n.requestId),i=o&&/^ding_sender_[A-Za-z0-9_-]{1,100}$/.test(o)&&!o.includes(t)?o:null;return i?{requestId:i,staffId:t,displayName:zr(n.displayName??n.senderName??n.senderNick)??D("\u9489\u9489\u7528\u6237"),requestedAt:zr(n.requestedAt)}:null}function CH(n){if(!Array.isArray(n.pendingSenders))return[];let t=new Set,o=[];for(let i of n.pendingSenders){let e=BH(i);!e||t.has(e.staffId)||(t.add(e.staffId),o.push(e))}return o}function bge(n){return{requestId:n.requestId,displayName:n.displayName,senderIdMasked:mb(n.staffId),requestedAt:n.requestedAt}}function Mge(n){return{senderKey:n.senderKey,displayName:zr(n.displayName)??D("\u9489\u9489\u7528\u6237"),senderIdMasked:mb(n.staffId),approvedAt:zr(n.approvedAt)}}var xh=class{#e;#A;#t;#r;#a;#i;#c;#s=new Map;#I=new Map;#o=new Map;#n=null;#g=new Map;#l=0;#p=!1;constructor({deviceAuth:t,credentials:o,configStore:i,createRuntime:e,deleteState:a=async()=>{},logger:A=console,clock:r=Date}){if(!t||typeof t.start!="function"||typeof t.poll!="function")throw new TypeError("DingtalkController requires a DingTalk device auth client");if(!o||typeof o.resolve!="function"||typeof o.set!="function"||typeof o.unset!="function")throw new TypeError("DingtalkController requires the DSH credential provider");if(!i||typeof i.list!="function"||typeof i.get!="function"||typeof i.getByClientId!="function"||typeof i.save!="function"||typeof i.remove!="function")throw new TypeError("DingtalkController requires a loaded config store");if(typeof e!="function")throw new TypeError("createRuntime is required");if(typeof a!="function")throw new TypeError("deleteState must be a function");if(typeof r!="function"&&typeof r?.now!="function")throw new TypeError("clock must be a function or expose now()");this.#e=t,this.#A=o,this.#t=i,this.#r=e,this.#a=a,this.#i=A,this.#c=r}async initialize(){if(this.#p)return this.status();for(let t of this.#t.list()){let o=this.#s.get(t.botId);try{if(EH(o,wb(o)))continue}catch{}await this.#Q(t.botId,async()=>{let i=this.#t.get(t.botId);if(!i||this.#p)return;let e=await this.#f(i.secretRef);if(!e){this.#I.set(i.botId,Da("missing-secret",D("\u9489\u9489\u673A\u5668\u4EBA\u51ED\u636E\u7F3A\u5931\uFF0C\u8BF7\u79FB\u9664\u540E\u91CD\u65B0\u626B\u7801\u3002"))),this.#b();return}try{await this.#u(i,e),this.#I.delete(i.botId)}catch{this.#I.set(i.botId,Da("connection-failed",D("\u9489\u9489\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"))),this.#i.warn?.(`[dsh-dingtalk] bot ${i.botId} failed to initialize`)}this.#b()})}return this.status()}async startProvisioning({signal:t}={}){if(this.#p)throw new Error("dsh-dingtalk controller is closed");this.#n&&await this.cancelProvisioning(this.#n);let o={id:wge(),state:"starting",controller:new AbortController,deviceCode:null,verificationUrl:null,expiresAt:null,pollIntervalMs:null,pollTask:null,botId:null,alreadyConnected:!1,error:null};this.#o.set(o.id,o),this.#n=o.id,this.#b();let i=()=>o.controller.abort(t?.reason);t?.aborted?i():t?.addEventListener("abort",i,{once:!0});try{let e=await this.#e.start({signal:o.controller.signal});if(this.#y(o),o.deviceCode=zr(e.deviceCode),o.verificationUrl=zr(e.verificationUrl),o.expiresAt=Number(e.expiresAt),o.pollIntervalMs=Number(e.pollIntervalMs),!o.deviceCode||!o.verificationUrl||!Number.isFinite(o.expiresAt)||!Number.isFinite(o.pollIntervalMs)||o.pollIntervalMs<=0)throw new Error("DingTalk device auth returned incomplete registration metadata");return o.state="pending",this.#b(),qc(o)}catch(e){if(o.controller.signal.aborted||e?.name==="AbortError"?(o.state="cancelled",o.error=Da("cancelled",D("\u626B\u7801\u63A5\u5165\u5DF2\u53D6\u6D88\u3002"))):(o.state="failed",o.error=Da("qr-start-failed",D("\u65E0\u6CD5\u751F\u6210\u9489\u9489\u4E8C\u7EF4\u7801\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"))),this.#n===o.id&&(this.#n=null),this.#b(),o.state==="failed")throw e;return qc(o)}finally{t?.removeEventListener("abort",i)}}async bindCredentials({clientId:t,clientSecret:o}={}){if(this.#p)throw new Error("dsh-dingtalk controller is closed");let i=zr(t),e=zr(o);if(!i||!e)throw new TypeError("DingTalk Client ID and Client Secret are required");if(this.#n&&await this.cancelProvisioning(this.#n),this.#p)throw new Error("dsh-dingtalk controller is closed");let a=gf(i);return await this.#Q(a.botId,async()=>{if(this.#p)throw Ng();let A=this.#t.getByClientId(i),r=await this.#A.resolve(a.secretRef).catch(()=>{});if(this.#p)throw Ng();let s={botId:a.botId,clientId:i,secretRef:a.secretRef,approvedSenders:A?.approvedSenders??[]};await this.#A.set(a.secretRef,e);try{await this.#t.save(s)}catch(g){throw await this.#m(a.secretRef,r),g}try{await this.#u(s,e),this.#I.delete(a.botId)}catch{this.#I.set(a.botId,Da("connection-failed",D("\u9489\u9489\u5DF2\u63A5\u5165\uFF0C\u4F46\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"))),this.#i.warn?.("[dsh-dingtalk] credential-bound bot saved but its connection is not ready")}this.#b()}),this.status()}async registrationStatus(t){let o=this.#o.get(t);if(!o)return null;if(If.has(o.state)||o.state==="starting")return qc(o);if(uH(this.#c)>=o.expiresAt)return o.state="expired",o.error=Da("expired",D("\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002")),this.#n===o.id&&(this.#n=null),this.#b(),qc(o);if(!o.pollTask){let i=this.#d(o).finally(()=>{o.pollTask===i&&(o.pollTask=null)});o.pollTask=i}return await o.pollTask,qc(o)}async cancelProvisioning(t){let o=this.#o.get(t);return o?(If.has(o.state)||(o.controller.abort(),await o.pollTask?.catch(()=>{}),If.has(o.state)||(o.state="cancelled"),o.error??=Da("cancelled",D("\u626B\u7801\u63A5\u5165\u5DF2\u53D6\u6D88\u3002"))),this.#n===o.id&&(this.#n=null),this.#b(),qc(o)):null}async reconnectBot(t){let o=this.#t.get(t);if(!o)throw new Error("Unknown DingTalk bot");return await this.#Q(t,async()=>{let i=await this.#f(o.secretRef);if(!i)throw new Error("The DingTalk client secret is missing");try{await this.#u(o,i),this.#I.delete(t)}catch(e){throw this.#I.set(t,Da("connection-failed",D("\u9489\u9489\u8FDE\u63A5\u4ECD\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"))),e}finally{this.#b()}}),this.status()}async sendConnectionTest(t){let o=this.#t.get(t);if(!o)throw new Error("Unknown DingTalk bot");return this.#Q(t,async()=>{let i=this.#s.get(t);if(!i?.status?.ready||typeof i.sendConnectionTest!="function")throw Ir(D("\u9489\u9489\u673A\u5668\u4EBA"));return i.sendConnectionTest(ma(D("\u9489\u9489\u673A\u5668\u4EBA\uFF08{clientId}\uFF09",{clientId:Sb(o.clientId)})))})}async deleteBot(t){let o=this.#t.get(t);if(!o)throw new Error("Unknown DingTalk bot");return await this.#Q(t,async()=>{let i=await this.#A.resolve(o.secretRef).catch(()=>{});await this.#B(t);try{await this.#A.unset(o.secretRef),await this.#t.remove(t)}catch(e){throw zr(i?.value)&&(await this.#A.set(o.secretRef,i.value).catch(()=>{}),await this.#u(o,i.value).catch(()=>{})),new Error("Unable to remove the DingTalk bot safely.",{cause:e})}try{await this.#a({botId:t,config:o})}catch{this.#i.warn?.(`[dsh-dingtalk] bot ${t} state cleanup failed`)}this.#I.delete(t),this.#b()}),this.status()}async approveSender(t,o){let i=this.#t.get(t);if(!i)throw new Error("Unknown DingTalk bot");let e=this.#s.get(t),a=typeof e?.pendingSender=="function"?BH(e.pendingSender(o)):null,A=CH(wb(e)),r=a?.requestId===o?a:A.find(g=>g.requestId===o);if(!r)throw new Error("Unknown DingTalk sender approval request");if(i.approvedSenders.some(g=>g.staffId===r.staffId))return this.status();let s={...i,approvedSenders:[...i.approvedSenders,{senderKey:gH(),staffId:r.staffId,displayName:r.displayName,approvedAt:Oge(this.#c)}]};return await this.#E(i,s),this.status()}async revokeSender(t,o){let i=this.#t.get(t);if(!i)throw new Error("Unknown DingTalk bot");let e=i.approvedSenders.findIndex(A=>A.senderKey===o);if(e===-1)throw new Error("Unknown approved DingTalk sender");let a=[...i.approvedSenders];return a.splice(e,1),await this.#E(i,{...i,approvedSenders:a}),this.status()}status(){let t=this.#t.list().map(e=>{let a=this.#s.get(e.botId),A={};try{A=wb(a)}catch{A={state:"error"}}let r=EH(a,A),s=this.#I.get(e.botId),g=r?"connected":s?"error":"offline",c=new Set(e.approvedSenders.map(d=>d.staffId)),I=CH(A).filter(d=>!c.has(d.staffId)).map(bge);return{botId:e.botId,state:g,connected:r,configured:!0,bot:{name:D("\u9489\u9489\u673A\u5668\u4EBA"),clientIdMasked:Sb(e.clientId)},health:{status:r?"healthy":s?"error":"offline",summary:r?D("\u9489\u9489 Stream \u6D88\u606F\u8FDE\u63A5\u8FD0\u884C\u6B63\u5E38"):s?.message??D("\u9489\u9489\u6D88\u606F\u8FDE\u63A5\u5F53\u524D\u79BB\u7EBF"),lastCheckedAt:A.lastCheckedAt??null},stats:{messagesReceived:Number(A.messagesReceived)||0,messagesReplied:Number(A.messagesReplied)||0},lastMessageError:qr(A.lastMessageError),senders:{pending:I,approved:e.approvedSenders.map(Mge)},error:s?structuredClone(s):null}}),o=t.filter(e=>e.connected).length,i=this.#n?this.#o.get(this.#n):null;return{schemaVersion:1,revision:this.#l,state:i&&hH.has(i.state)?"provisioning":t.length===0?"disconnected":o===t.length?"connected":o>0?"degraded":"offline",bots:t,totals:{configured:t.length,connected:o},...i&&hH.has(i.state)?{provisioning:qc(i)}:{}}}async close(){this.#p||(this.#p=!0,this.#n&&await this.cancelProvisioning(this.#n),await Promise.allSettled([...this.#s.keys()].map(t=>this.#B(t))),await Promise.allSettled([...this.#g.values()]),await Promise.allSettled([...this.#s.keys()].map(t=>this.#B(t))))}async#d(t){try{this.#y(t);let o=await this.#e.poll({deviceCode:t.deviceCode,signal:t.controller.signal});this.#y(t);let i=zr(o.status)?.toUpperCase();if(i==="WAITING")t.state="pending",t.error=null;else if(i==="SUCCESS"){let e=zr(o.clientId),a=zr(o.clientSecret);if(!e||!a)throw new Error("DingTalk returned incomplete credentials");t.state="connecting",t.error=null,this.#b();let A=await this.#h(t,{clientId:e,clientSecret:a});t.botId=A.botId,t.alreadyConnected=A.alreadyConnected,t.state="connected",this.#n===t.id&&(this.#n=null)}else i==="EXPIRED"?(t.state="expired",t.error=Da("expired",D("\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u751F\u6210\u3002")),this.#n===t.id&&(this.#n=null)):i==="FAIL"?(t.state="failed",t.error=Da("authorization-failed",D("\u9489\u9489\u672A\u5B8C\u6210\u673A\u5668\u4EBA\u6388\u6743\uFF0C\u8BF7\u91CD\u65B0\u626B\u7801\u3002")),this.#n===t.id&&(this.#n=null)):(t.state="pending",t.error=Da("poll-pending",D("\u9489\u9489\u6388\u6743\u72B6\u6001\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u91CD\u8BD5\u3002")))}catch(o){t.controller.signal.aborted||o?.name==="AbortError"?(t.state="cancelled",t.error=Da("cancelled",D("\u626B\u7801\u63A5\u5165\u5DF2\u53D6\u6D88\u3002")),this.#n===t.id&&(this.#n=null)):t.state==="connecting"?(t.state="failed",t.error=Da("activation-failed",D("\u9489\u9489\u5DF2\u6388\u6743\uFF0C\u4F46\u65E0\u6CD5\u5B89\u5168\u4FDD\u5B58\u63A5\u5165\u914D\u7F6E\u3002")),this.#n===t.id&&(this.#n=null),this.#i.error?.("[dsh-dingtalk] bot activation failed")):(t.state="pending",t.error=Da("poll-failed",D("\u9489\u9489\u6388\u6743\u67E5\u8BE2\u6682\u65F6\u5931\u8D25\uFF0C\u6B63\u5728\u91CD\u8BD5\u3002")))}finally{this.#b(),this.#C()}}async#h(t,{clientId:o,clientSecret:i}){let e=gf(o),a=this.#t.getByClientId(o),A=await this.#A.resolve(e.secretRef).catch(()=>{}),r={botId:e.botId,clientId:o,secretRef:e.secretRef,approvedSenders:a?.approvedSenders??[]};return this.#Q(e.botId,async()=>{let s=async()=>{await this.#B(e.botId),a?await this.#t.save(a).catch(()=>{}):this.#t.get(e.botId)&&await this.#t.remove(e.botId).catch(()=>null)&&await this.#a({botId:e.botId,config:r}).catch(c=>{this.#i.warn?.("[dsh-dingtalk] failed to clean up cancelled bot state:",c)}),await this.#m(e.secretRef,A),a&&zr(A?.value)&&await this.#u(a,A.value).catch(()=>{})};await this.#A.set(e.secretRef,i);try{this.#y(t),await this.#t.save(r),this.#y(t)}catch(g){throw await s(),g}try{await this.#u(r,i),this.#y(t),this.#I.delete(e.botId)}catch{if(t.controller.signal.aborted||this.#n!==t.id)throw await s(),Ng();this.#I.set(e.botId,Da("connection-failed",D("\u9489\u9489\u5DF2\u63A5\u5165\uFF0C\u4F46\u6D88\u606F\u8FDE\u63A5\u6682\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"))),this.#i.warn?.("[dsh-dingtalk] authorized bot saved but its connection is not ready")}return{botId:e.botId,alreadyConnected:!!a}})}async#E(t,o){return this.#Q(t.botId,async()=>{let i=await this.#f(t.secretRef);if(!i)throw new Error("The DingTalk client secret is missing");await this.#t.save(o);try{await this.#u(o,i),this.#I.delete(t.botId)}catch(e){throw await this.#t.save(t).catch(()=>{}),await this.#u(t,i).catch(()=>{}),this.#I.set(t.botId,Da("connection-failed",D("\u9489\u9489\u8FDE\u63A5\u672A\u5C31\u7EEA\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"))),e}finally{this.#b()}})}async#u(t,o){if(this.#p||(await this.#B(t.botId),this.#p))throw Ng();let i=await this.#r({botId:t.botId,config:structuredClone(t),clientSecret:o});if(!i||typeof i.start!="function"||typeof i.stop!="function")throw new TypeError("createRuntime returned an invalid DingTalk runtime");if(this.#p)throw await i.stop().catch(()=>{}),Ng();this.#s.set(t.botId,i);try{if(await i.start(),this.#p)throw await i.stop().catch(()=>{}),Ng()}catch(e){throw this.#s.get(t.botId)===i&&this.#s.delete(t.botId),await i.stop().catch(()=>{}),e}}async#B(t){let o=this.#s.get(t);this.#s.delete(t),await o?.stop().catch(()=>{this.#i.warn?.(`[dsh-dingtalk] bot ${t} failed to stop cleanly`)})}async#f(t){let o=await this.#A.resolve(t).catch(()=>{});return zr(o?.value)}async#m(t,o){try{zr(o?.value)?await this.#A.set(t,o.value):await this.#A.unset(t)}catch{this.#i.error?.(`[dsh-dingtalk] failed to restore credential ${t}`)}}#y(t){if(t.controller.signal.aborted||this.#n!==t.id)throw Ng()}#Q(t,o){if(this.#p)return Promise.reject(new Error("dsh-dingtalk controller is closed"));let a=(this.#g.get(t)??Promise.resolve()).catch(()=>{}).then(o).finally(()=>{this.#g.get(t)===a&&this.#g.delete(t)});return this.#g.set(t,a),a}#C(){for(let[t,o]of this.#o)t!==this.#n&&If.has(o.state)&&this.#o.size>16&&this.#o.delete(t)}#b(){this.#l+=1}};import{randomUUID as Yh}from"node:crypto";import{extname as Gge}from"node:path";var yH=5*1024*1024,_ge=20,Tge=20*1024*1024,Nge="\u8BF7\u5206\u6790\u8FD9\u5F20\u56FE\u7247\u3002",ut=class extends Error{constructor(t,o,i,e={}){super(o,e),this.name="ImagePromptError",this.code=t,this.userMessage=i}},fH=Object.freeze({MODEL_DOES_NOT_SUPPORT_IMAGES:"\u5F53\u524D\u6A21\u578B\u4E0D\u652F\u6301\u56FE\u7247\uFF0C\u8BF7\u7528 /models \u67E5\u770B\u53EF\u7528\u6A21\u578B\uFF0C\u518D\u7528 /model <\u5E8F\u53F7> \u5207\u6362\u540E\u91CD\u53D1\u3002",IMAGE_TOO_LARGE:"\u56FE\u7247\u8D85\u8FC7\u5BBF\u4E3B\u5141\u8BB8\u7684\u5927\u5C0F\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002",IMAGE_TOO_MANY_PIXELS:"\u56FE\u7247\u5206\u8FA8\u7387\u8FC7\u9AD8\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002",INVALID_IMAGE:"\u56FE\u7247\u5185\u5BB9\u65E0\u6548\u6216\u683C\u5F0F\u4E0D\u53D7\u652F\u6301\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002",INVALID_IMAGE_BASE64:"\u672A\u80FD\u8BFB\u53D6\u56FE\u7247\u5185\u5BB9\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002",IMAGE_TYPE_MISMATCH:"\u56FE\u7247\u683C\u5F0F\u4E0E\u5B9E\u9645\u5185\u5BB9\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002",TOO_MANY_IMAGES:"\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u6570\u91CF\u8D85\u8FC7\u5BBF\u4E3B\u9650\u5236\uFF0C\u8BF7\u51CF\u5C11\u540E\u91CD\u8BD5\u3002",IMAGES_TOO_LARGE:"\u56FE\u7247\u603B\u5927\u5C0F\u8D85\u8FC7\u5BBF\u4E3B\u9650\u5236\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002"});function Rge(n,t){let o=AbortSignal.timeout(t);return n?AbortSignal.any([n,o]):o}async function Ob(n){try{await n?.body?.cancel?.()}catch{}}async function no(n,{fetchImpl:t=fetch,headers:o,signal:i,maxBytes:e=yH,timeoutMs:a=15e3,allowedHosts:A}={}){let r=new URL(n);if(r.protocol!=="https:")throw new Error("Image download URL must use HTTPS");if(Array.isArray(A)&&!A.some(I=>typeof I=="string"&&(r.hostname===I||I.startsWith(".")&&(r.hostname===I.slice(1)||r.hostname.endsWith(I)))))throw new Error("Image download URL is not hosted by the messaging platform");let s=await t(r,{method:"GET",headers:o,signal:Rge(i,a),redirect:"manual"});if(Number.isInteger(s?.status)&&s.status>=300&&s.status<400)throw await Ob(s),new ut("image-redirect-blocked",`Image download redirect was blocked (HTTP ${s.status})`,D("\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\u53D1\u751F\u4E86\u91CD\u5B9A\u5411\uFF0C\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u3002"));if(!s?.ok)throw await Ob(s),new ut("image-http-error",`Image download failed with HTTP ${s?.status??"unknown"}`,D("\u56FE\u7247\u4E0B\u8F7D\u5931\u8D25\uFF08HTTP {status}\uFF09\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002",{status:s?.status??"unknown"}));let g=Number(s.headers?.get?.("content-length"));if(Number.isFinite(g)&&g>e)throw await Ob(s),new ut("image-too-large",`Image response declares ${g} bytes; the limit is ${e}`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));if(s.body?.[Symbol.asyncIterator]){let I=[],d=0;for await(let B of s.body){let f=Buffer.from(B);if(d+=f.length,d>e)throw await s.body.cancel?.().catch?.(()=>{}),new ut("image-too-large",`Image response exceeded ${e} bytes`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));I.push(f)}return Buffer.concat(I,d)}let c=Buffer.from(await s.arrayBuffer());if(c.length>e)throw new ut("image-too-large",`Image response contains ${c.length} bytes; the limit is ${e}`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));return c}function kge(n){return typeof n=="string"?n.trim():""}function mH(n){return Array.isArray(n?.images)?n.images.filter(Boolean):[]}function QH(n){return typeof n!="string"?void 0:n.replaceAll("\\","/").split("/").at(-1)?.replace(/[\u0000-\u001f\u007f]/g,"").trim().slice(0,255)||void 0}function vge(n){if(n.length>=8&&n[0]===137&&n[1]===80&&n[2]===78&&n[3]===71&&n[4]===13&&n[5]===10&&n[6]===26&&n[7]===10)return"image/png";if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"image/jpeg";if(n.length>=6){let t=n.subarray(0,6).toString("ascii");if(t==="GIF87a"||t==="GIF89a")return"image/gif"}return n.length>=12&&n.subarray(0,4).toString("ascii")==="RIFF"&&n.subarray(8,12).toString("ascii")==="WEBP"?"image/webp":null}function Pge(n){if(Buffer.isBuffer(n)||n instanceof Uint8Array)return{data:Buffer.from(n)};let t=n?.data??n?.buffer;return Buffer.isBuffer(t)||t instanceof Uint8Array?{data:Buffer.from(t),name:n?.name??n?.filename}:null}function qt(n){return mH(n).length>0}async function so(n,{signal:t,maxImageBytes:o=yH,maxImages:i=_ge,maxTotalImageBytes:e=Tge}={}){let a=mH(n);if(a.length>i)throw new ut("too-many-images",`Image message contains ${a.length} images; the limit is ${i}`,D("\u4E00\u6B21\u6700\u591A\u53EA\u80FD\u5904\u7406 {maxImages} \u5F20\u56FE\u7247\u3002",{maxImages:i}));let A=kge(n?.content),r=[],s=0;A?r.push({type:"text",text:A}):a.length>0&&r.push({type:"text",text:D(Nge)});for(let[g,c]of a.entries()){if(t?.throwIfAborted(),Number.isFinite(c?.size)&&c.size>o)throw new ut("image-too-large",`Image ${g+1} declares ${c.size} bytes; the limit is ${o}`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));if(Number.isFinite(c?.size)&&s+c.size>e)throw new ut("images-too-large",`Images declare more than ${e} bytes in total`,D("\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u603B\u5927\u5C0F\u8FC7\u5927\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6570\u91CF\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));let I;try{I=c?.data===void 0?await c?.load?.({signal:t,maxBytes:o}):c.data}catch(f){throw t?.aborted||f?.name==="AbortError"||f?.name==="TimeoutError"||f instanceof ut?f:new ut("image-download-failed",`Unable to download image ${g+1}: ${f?.message??String(f)}`,D("\u56FE\u7247\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u540E\u518D\u8BD5\u3002"),{cause:f})}let d=Pge(I);if(!d?.data.length)throw new ut("invalid-image-data",`Image ${g+1} returned no data`,D("\u672A\u80FD\u8BFB\u53D6\u56FE\u7247\u5185\u5BB9\uFF0C\u8BF7\u91CD\u65B0\u53D1\u9001\u3002"));if(d.data.length>o)throw new ut("image-too-large",`Image ${g+1} contains ${d.data.length} bytes; the limit is ${o}`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));if(s+d.data.length>e)throw new ut("images-too-large",`Images contain more than ${e} bytes in total`,D("\u4E00\u6B21\u53D1\u9001\u7684\u56FE\u7247\u603B\u5927\u5C0F\u8FC7\u5927\uFF0C\u8BF7\u51CF\u5C11\u56FE\u7247\u6570\u91CF\u6216\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));s+=d.data.length;let B=vge(d.data);if(!B)throw new ut("unsupported-image-type",`Image ${g+1} is not JPEG, PNG, GIF, or WebP`,D("\u6682\u4E0D\u652F\u6301\u8BE5\u56FE\u7247\u683C\u5F0F\uFF0C\u8BF7\u53D1\u9001 JPEG\u3001PNG\u3001WebP \u6216 GIF \u56FE\u7247\u3002"));r.push({type:"image",mediaType:B,data:d.data.toString("base64"),...QH(d.name??c?.name)?{name:QH(d.name??c?.name)}:{}})}return r}function vi(n){if(n instanceof ut)return{code:"image-prompt-error",reason:n.code,userMessage:n.userMessage};if(n?.code!=="attachment-error"||typeof n?.details?.reason!="string")return null;let t=n.details.reason,o=Object.hasOwn(fH,t)?D(fH[t]):null;return o?{code:"attachment-error",reason:t,userMessage:o}:null}function go(n){return vi(n)?.userMessage??null}var SH="https://oapi.dingtalk.com/",Fge="https://api.dingtalk.com/",Lge="DING_DWS_CLAW",Uge="02fcf2f4-5e02-4a85-b672-46d1f715543e.schema",zc="\u{1F914}\u601D\u8003\u4E2D",wH="\u2705\u5DF2\u5B8C\u6210",OH="\u274C\u5904\u7406\u5931\u8D25",Hge=15e3,Kge=5e3,xge="2659900",Yge="im_bg_1",jge=new Set(["WAITING","SUCCESS","FAIL","EXPIRED"]),gt=class extends Error{constructor(t,o,i={}){super(o,i),this.name="DingtalkApiError",this.code=t,this.status=i.status,this.providerCode=i.providerCode}};function WA(n){return typeof n=="string"&&n.trim()?n.trim():null}function qh(n){let t=n==null?null:String(n).trim();return t&&/^-?[A-Za-z0-9_.:-]{1,160}$/.test(t)?t:void 0}function bH(n,t){return Number.isInteger(t?.status)&&(n.status=t.status),t?.providerCode!==void 0&&(n.providerCode=t.providerCode),n}function jh(n,{fallback:t="artifact-provider-rejected"}={}){if(n?.code?.startsWith?.("artifact-"))return n;let o=Number(n?.status),i=qh(n?.providerCode),e=i??"",a=t,A="DingTalk could not prepare the file for delivery.";o===401||o===403||i==="401"||i==="403"||/(?:permission|forbidden|unauthor|access.?denied|\.auth(?:\.|$))/i.test(e)?(a="artifact-permission-required",A="DingTalk denied permission to send the file."):o===413||i==="413"||/(?:too.?large|size.?limit)/i.test(e)?(a="artifact-too-large",A="The file exceeds DingTalk's size limit."):o===429||i==="429"||/(?:rate.?limit|too.?many|throttl)/i.test(e)?(a="artifact-rate-limited",A="DingTalk rate-limited file delivery."):t==="artifact-provider-rejected"&&(A="DingTalk rejected the file message.");let r=new Error(A,{cause:n});return r.code=a,bH(r,n)}function Jge(n){let t=new Error("DingTalk file delivery result is uncertain",{cause:n});return t.code="artifact-delivery-uncertain",bH(t,n)}function bb(n){if(!n||typeof n!="object")return null;for(let t of["errcode","code"])if(n[t]!==void 0&&n[t]!==0&&n[t]!=="0")return qh(n[t])??"rejected";return null}function qge(n,t){if(t?.aborted)throw Mn(t);let o=Number(n?.status);return n?.code==="network-error"||n?.code==="timeout"||n?.code==="invalid-response"||o>=500&&o<600?Jge(n):jh(n)}function zge(n){let t;try{t=new URL(n)}catch(o){throw new gt("invalid-image-download","\u9489\u9489\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u56FE\u7247\u4E0B\u8F7D\u5730\u5740\u3002",{cause:o})}return t.protocol==="http:"&&(!t.port||t.port==="80")&&(t.protocol="https:",t.port=""),t}function DH(n){let t=n.toLowerCase().replace(/\.$/,"");return t==="dingtalk.com"||t.endsWith(".dingtalk.com")}function Nb(n,{label:t,requireSubdomain:o=!0}={}){let i;try{i=new URL(n)}catch{throw new gt("invalid-url",`${t??"\u9489\u9489\u670D\u52A1"}\u8FD4\u56DE\u4E86\u65E0\u6548\u5730\u5740\u3002`)}let e=i.hostname.toLowerCase().replace(/\.$/,""),a=o?e!=="dingtalk.com"&&DH(e):DH(e);if(i.protocol!=="https:"||!a||i.port&&i.port!=="443")throw new gt("untrusted-url",`${t??"\u9489\u9489\u670D\u52A1"}\u5730\u5740\u4E0D\u53D7\u4FE1\u4EFB\u3002`);if(i.username||i.password)throw new gt("untrusted-url",`${t??"\u9489\u9489\u670D\u52A1"}\u5730\u5740\u4E0D\u53D7\u4FE1\u4EFB\u3002`);return i}function Rg(n){let t=WA(n);if(!t)throw new gt("invalid-session-webhook","\u9489\u9489\u6D88\u606F\u6CA1\u6709\u53EF\u7528\u7684\u56DE\u590D\u5730\u5740\u3002");let o=Nb(t,{label:"\u9489\u9489\u56DE\u590D",requireSubdomain:!1});return o.hash="",o.toString()}function MH(n,t=4e3){let o=typeof n=="string"?n.trim():"";if(!o)return[];if(!Number.isInteger(t)||t<1)throw new TypeError("maxChars must be a positive integer");if(o.length<=t)return[o];let i=[],e=o;for(;e.length>t;){let a=e.lastIndexOf(`
|
|
140
140
|
`,t);a<Math.floor(t*.6)&&(a=t),i.push(e.slice(0,a)),e=e.slice(a).replace(/^\n+/,"")}return e&&i.push(e),i}function Mn(n){return n?.reason instanceof Error?n.reason:new DOMException("The operation was aborted","AbortError")}function Vge(n,t){return n<=0?Promise.resolve():new Promise((o,i)=>{if(t?.aborted){i(Mn(t));return}let e=setTimeout(()=>{t?.removeEventListener("abort",a),o()},n),a=()=>{clearTimeout(e),i(Mn(t))};t?.addEventListener("abort",a,{once:!0})})}async function bn(n,t,{body:o,signal:i,timeoutMs:e=Hge,headers:a={},method:A="POST",action:r="request"}={}){let s=new AbortController,g=!1,c=()=>s.abort(i?.reason);if(i?.aborted)throw Mn(i);i?.addEventListener("abort",c,{once:!0});let I=e>0?setTimeout(()=>{g=!0,s.abort()},e):null;try{let d=await n(t,{method:A,redirect:"error",headers:{"content-type":"application/json",...a},body:JSON.stringify(o??{}),signal:s.signal});if(!d.ok){let B;try{let f=await d.json();B=qh(f?.code??f?.errcode)}catch{}throw new gt("http-error",`\u9489\u9489\u670D\u52A1\u8BF7\u6C42\u5931\u8D25\uFF08HTTP ${d.status}\uFF09\u3002`,{status:d.status,providerCode:B})}try{return await d.json()}catch(B){throw new gt("invalid-response","\u9489\u9489\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u54CD\u5E94\u3002",{cause:B})}}catch(d){throw i?.aborted?Mn(i):g?new gt("timeout","\u9489\u9489\u670D\u52A1\u8BF7\u6C42\u8D85\u65F6\u3002",{cause:d}):d instanceof gt?d:new gt("network-error",`\u6682\u65F6\u65E0\u6CD5\u5B8C\u6210\u9489\u9489${r}\u8BF7\u6C42\u3002`,{cause:d})}finally{I&&clearTimeout(I),i?.removeEventListener("abort",c)}}async function Wge(n,t,{body:o,signal:i,timeoutMs:e=6e4}={}){let a=new AbortController,A=!1,r=()=>a.abort(i?.reason);if(i?.aborted)throw Mn(i);i?.addEventListener("abort",r,{once:!0});let s=setTimeout(()=>{A=!0,a.abort()},e);try{let g=await n(t,{method:"POST",body:o,signal:a.signal,redirect:"error"}),c,I;try{c=await g.json()}catch(d){I=d}if(!g.ok)throw new gt("http-error",`\u9489\u9489\u670D\u52A1\u8BF7\u6C42\u5931\u8D25\uFF08HTTP ${g.status}\uFF09\u3002`,{status:g.status,providerCode:qh(c?.code??c?.errcode)});if(I)throw new gt("invalid-response","\u9489\u9489\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u89E3\u6790\u7684\u54CD\u5E94\u3002",{cause:I});return c}catch(g){throw i?.aborted?Mn(i):A?new gt("timeout","\u9489\u9489\u670D\u52A1\u8BF7\u6C42\u8D85\u65F6\u3002",{cause:g}):g instanceof gt?g:new gt("network-error","\u6682\u65F6\u65E0\u6CD5\u5B8C\u6210\u9489\u9489\u6587\u4EF6\u4E0A\u4F20\u8BF7\u6C42\u3002",{cause:g})}finally{clearTimeout(s),i?.removeEventListener("abort",r)}}function Zge(n){let t=WA(n?.robotCode);if(!t)throw new TypeError("DingTalk robotCode is required");if(n?.type==="group"){let o=WA(n.openConversationId);if(o)return{type:"group",robotCode:t,openConversationId:o}}if(n?.type==="user"){let o=WA(n.userId);if(o)return{type:"user",robotCode:t,userId:o}}throw new TypeError("DingTalk file target is invalid")}function Xge(n){return Gge(n).slice(1).toLowerCase()}function $ge(n){if(n?.type==="user"){let t=WA(n.userId);if(t)return{type:"user",userId:t}}if(n?.type==="group"){let t=WA(n.openConversationId);if(t)return{type:"group",openConversationId:t}}throw new TypeError("DingTalk AI Card target is invalid")}function Mb(n,t){return{cardParamMap:{flowStatus:t,msgContent:Jh(n),staticMsgContent:"",sys_full_json_obj:JSON.stringify({order:["msgContent"]}),config:JSON.stringify({autoLayout:!0})}}}function ece(n,t,o){let i={outTrackId:n,userIdType:1};return t.type==="group"?{...i,openSpaceId:`dtv1.card//IM_GROUP.${t.openConversationId}`,imGroupOpenDeliverModel:{robotCode:o}}:{...i,openSpaceId:`dtv1.card//IM_ROBOT.${t.userId}`,imRobotOpenDeliverModel:{spaceType:"IM_ROBOT",robotCode:o,extension:{dynamicSummary:"true"}}}}function Jh(n){let o=(typeof n=="string"?n.replace(/\r\n?/g,`
|
|
@@ -143,7 +143,7 @@ ${D("\u9519\u8BEF\u7801\uFF1A{code}\uFF1B\u53C2\u8003\u53F7\uFF1A{referenceId}",
|
|
|
143
143
|
`:/^\s{0,3}(?:[-*+] |\d+[.)] |#{1,6} |\||> )/.test(o[a+1])?`${e}
|
|
144
144
|
`:`${e}<br>`}).join("")}function _b(n,t){if(!n||typeof n!="object"||n.errcode!==0)throw new gt("registration-rejected",`\u9489\u9489\u626B\u7801${t}\u5931\u8D25\u3002`);return n}function Tb(n,t){let o=Number(n);return Number.isFinite(o)&&o>0?o:t}function _H({fetchImpl:n=fetch,registrationBaseUrl:t=process.env.DINGTALK_REGISTRATION_BASE_URL||SH,registrationSource:o=process.env.DINGTALK_REGISTRATION_SOURCE||Lge,now:i=()=>Date.now(),cardMinIntervalMs:e=50,cardBackoffMs:a=1e3,delay:A=Vge}={}){if(typeof n!="function")throw new TypeError("fetchImpl must be a function");if(typeof i!="function")throw new TypeError("now must be a function");if(!Number.isFinite(e)||e<0)throw new TypeError("cardMinIntervalMs must be a non-negative number");if(!Number.isFinite(a)||a<0)throw new TypeError("cardBackoffMs must be a non-negative number");if(typeof A!="function")throw new TypeError("delay must be a function");let r=Nb(t,{label:"\u9489\u9489\u6CE8\u518C\u670D\u52A1",requireSubdomain:!1}),s=new URL(Fge),g=WA(o);if(!g)throw new TypeError("registrationSource is required");let c=new Map,I=new Map,d=new Map,B=Promise.resolve(),f=0,Q=(H,J)=>new URL(J.replace(/^\//,""),H);async function y({clientId:H,clientSecret:J,signal:q,requestKind:U="normal"}){let R=WA(H),V=WA(J);if(!R||!V)throw new TypeError("clientId and clientSecret are required");let L=c.get(R);if(L&&L.expiresAt>i())return L.token;let T=U==="reaction"?d:I;if(T.has(R))return T.get(R);let W=(async()=>{let ie=await bn(n,Q(s,"v1.0/oauth2/accessToken"),{body:{appKey:R,appSecret:V},signal:q,action:"\u9274\u6743"}),ge=WA(ie?.accessToken);if(!ge)throw new gt("invalid-access-token","\u9489\u9489\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE\u8BBF\u95EE\u4EE4\u724C\u3002");let Se=Tb(ie?.expireIn??ie?.expiresIn,7200),de=Math.max(1e3,(Se-60)*1e3);return c.set(R,{token:ge,expiresAt:i()+de}),ge})().finally(()=>T.delete(R));return T.set(R,W),W}async function m({clientId:H,clientSecret:J,robotCode:q,messageId:U,conversationId:R,reactionName:V=zc,signal:L},T){let k=WA(H),W=WA(J),ie=WA(q)??k,ge=WA(U),Se=WA(R),de=WA(V);if(!k||!W)throw new TypeError("clientId and clientSecret are required");if(!ie)throw new TypeError("robotCode is required");if(!ge||!Se)throw new TypeError("messageId and conversationId are required");if(!de)throw new TypeError("reactionName is required");let De=await y({clientId:k,clientSecret:W,signal:L,requestKind:"reaction"}),fe=await bn(n,Q(s,`v1.0/robot/emotion/${T}`),{body:{robotCode:ie,openMsgId:ge,openConversationId:Se,emotionType:2,emotionName:de,textEmotion:{emotionId:xge,emotionName:de,text:de,backgroundId:Yge}},headers:{"x-acs-dingtalk-access-token":De},signal:L,timeoutMs:Kge,action:T==="reply"?"\u6D88\u606F\u72B6\u6001\u6DFB\u52A0":"\u6D88\u606F\u72B6\u6001\u64A4\u56DE"}),ve=fe?.success===!1?qh(fe?.code??fe?.errcode)??"rejected":bb(fe);if(ve)throw new gt("reaction-rejected","\u9489\u9489\u670D\u52A1\u62D2\u7EDD\u4E86\u6D88\u606F\u72B6\u6001\u8BF7\u6C42\u3002",{providerCode:ve});return!0}async function _({clientId:H,clientSecret:J,robotCode:q,downloadCode:U,signal:R,kind:V}){let L=WA(q),T=WA(U);if(!L||!T)throw new TypeError("robotCode and downloadCode are required");let k=await y({clientId:H,clientSecret:J,signal:R}),W;try{W=await bn(n,Q(s,"v1.0/robot/messageFiles/download"),{body:{downloadCode:T,robotCode:L},headers:{"x-acs-dingtalk-access-token":k},signal:R,action:`${V==="image"?"\u56FE\u7247":"\u6587\u4EF6"}\u4E0B\u8F7D\u5730\u5740`})}catch(ge){throw R?.aborted?ge:new gt(`${V}-download-address-failed`,`\u9489\u9489${V==="image"?"\u56FE\u7247":"\u6587\u4EF6"}\u4E0B\u8F7D\u5730\u5740\u83B7\u53D6\u5931\u8D25\u3002`,{cause:ge,status:ge?.status,providerCode:ge?.providerCode})}let ie=WA(W?.downloadUrl??W?.download_url);if(!ie)throw new gt(`invalid-${V}-download`,`\u9489\u9489\u670D\u52A1\u6CA1\u6709\u8FD4\u56DE${V==="image"?"\u56FE\u7247":"\u6587\u4EF6"}\u4E0B\u8F7D\u5730\u5740\u3002`);return zge(ie)}function N(H){let J=async()=>{let U=Math.max(0,f-i());U>0&&await A(U,H),f=Math.max(f,i())+e},q=B.then(J,J);return B=q.catch(()=>{}),q}async function G(H,J){await N(J.signal);try{return await bn(n,Q(s,H),J)}catch(q){if(!(q instanceof gt)||q.status!==403)throw q;return await A(a,J.signal),await N(J.signal),bn(n,Q(s,H),J)}}async function Y({clientId:H,clientSecret:J,cardInstanceId:q,text:U,signal:R}){let V=WA(q),L=WA(U);if(!V)throw new TypeError("cardInstanceId is required");if(!L)throw new TypeError("text is required");let k={"x-acs-dingtalk-access-token":await y({clientId:H,clientSecret:J,signal:R})},W=[G("v1.0/card/streaming",{method:"PUT",body:{outTrackId:V,guid:Yh(),key:"msgContent",content:Jh(L),isFull:!0,isFinalize:!1,isError:!0},headers:k,signal:R,action:"AI Card \u5931\u8D25\u6536\u53E3"}),G("v1.0/card/instances",{method:"PUT",body:{outTrackId:V,cardData:Mb(L,"5"),cardUpdateOptions:{updateCardDataByKey:!0}},headers:k,signal:R,action:"AI Card \u5931\u8D25\u72B6\u6001"})],ie=await Promise.allSettled(W);if(ie.every(({status:ge})=>ge==="rejected"))throw ie[0].reason;return!0}async function j({clientId:H,clientSecret:J,target:q,file:U,signal:R},{uploadType:V,messageKey:L,createMessageParams:T}){if(!U||typeof U!="object"||typeof U.fileName!="string"||!U.fileName||!Buffer.isBuffer(U.bytes))throw new TypeError("A DingTalk file is required");let k=Zge(q),W;try{W=await y({clientId:H,clientSecret:J,signal:R})}catch(Re){if(R?.aborted)throw Mn(R);let AA=Number(Re?.status),ue=Re?.code==="http-error"&&AA>=400&&AA<500?"artifact-provider-rejected":"artifact-provider-failed";throw jh(Re,{fallback:ue})}let ie=new URL("media/upload",SH);ie.searchParams.set("access_token",W),ie.searchParams.set("type",V);let ge=new FormData;ge.append("media",new Blob([U.bytes],{type:U.mediaType??"application/octet-stream"}),U.fileName);let Se;try{Se=await Wge(n,ie,{body:ge,signal:R})}catch(Re){if(R?.aborted)throw Mn(R);let AA=Number(Re?.status),ue=Re?.code==="http-error"&&AA>=400&&AA<500?"artifact-provider-rejected":"artifact-provider-failed";throw jh(Re,{fallback:ue})}let de=bb(Se),De=WA(Se?.media_id);if(de||!De)throw jh(new gt("upload-rejected","\u9489\u9489\u670D\u52A1\u62D2\u7EDD\u4E86\u6587\u4EF6\u4E0A\u4F20\u3002",{providerCode:de??"missing-media-id"}));R?.throwIfAborted();let fe={robotCode:k.robotCode,msgKey:L,msgParam:JSON.stringify(T(De,U)),...k.type==="group"?{openConversationId:k.openConversationId}:{userIds:[k.userId]}},ve=k.type==="group"?"v1.0/robot/groupMessages/send":"v1.0/robot/oToMessages/batchSend",eA;try{eA=await bn(n,Q(s,ve),{body:fe,headers:{"x-acs-dingtalk-access-token":W},signal:R,action:"\u6587\u4EF6\u6D88\u606F\u53D1\u9001"})}catch(Re){throw qge(Re,R)}let iA=bb(eA);if(iA)throw jh(new gt("send-rejected","\u9489\u9489\u670D\u52A1\u62D2\u7EDD\u4E86\u6587\u4EF6\u6D88\u606F\u3002",{providerCode:iA}));return eA}return Object.freeze({async beginRegistration({signal:H}={}){let J=_b(await bn(n,Q(r,"app/registration/init"),{body:{source:g},signal:H,action:"\u521D\u59CB\u5316"}),"\u521D\u59CB\u5316"),q=WA(J.nonce);if(!q)throw new gt("invalid-registration","\u9489\u9489\u626B\u7801\u521D\u59CB\u5316\u7F3A\u5C11 nonce\u3002");let U=_b(await bn(n,Q(r,"app/registration/begin"),{body:{nonce:q},signal:H,action:"\u521B\u5EFA"}),"\u521B\u5EFA"),R=WA(U.device_code),V=WA(U.verification_uri_complete);if(!R||!V)throw new gt("invalid-registration","\u9489\u9489\u626B\u7801\u670D\u52A1\u8FD4\u56DE\u7684\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002");let L=Nb(V,{label:"\u9489\u9489\u626B\u7801",requireSubdomain:!1}).toString();return{deviceCode:R,userCode:WA(U.user_code)??void 0,verificationUri:WA(U.verification_uri)??void 0,verificationUriComplete:L,expiresInSeconds:Tb(U.expires_in,7200),intervalSeconds:Tb(U.interval,5)}},async pollRegistration({deviceCode:H,signal:J}={}){let q=WA(H);if(!q)throw new TypeError("deviceCode is required");let U=_b(await bn(n,Q(r,"app/registration/poll"),{body:{device_code:q},signal:J,action:"\u72B6\u6001\u67E5\u8BE2"}),"\u72B6\u6001\u67E5\u8BE2"),R=WA(U.status)?.toUpperCase();if(!R||!jge.has(R))throw new gt("invalid-registration-status","\u9489\u9489\u626B\u7801\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6CD5\u8BC6\u522B\u7684\u72B6\u6001\u3002");let V={status:R,failReason:WA(U.fail_reason)??void 0};if(R==="SUCCESS"&&(V.clientId=WA(U.client_id)??void 0,V.clientSecret=WA(U.client_secret)??void 0,!V.clientId||!V.clientSecret))throw new gt("missing-credentials","\u9489\u9489\u626B\u7801\u5DF2\u786E\u8BA4\uFF0C\u4F46\u6CA1\u6709\u8FD4\u56DE\u673A\u5668\u4EBA\u51ED\u636E\u3002");return V},accessToken:y,async addReaction(H){return m(H,"reply")},async recallReaction(H){return m(H,"recall")},async addThinkingReaction(H){return m({...H,reactionName:zc},"reply")},async recallThinkingReaction(H){return m({...H,reactionName:zc},"recall")},async downloadImage({clientId:H,clientSecret:J,robotCode:q,downloadCode:U,signal:R,maxBytes:V}){let L=await _({clientId:H,clientSecret:J,robotCode:q,downloadCode:U,signal:R,kind:"image"});try{return await no(L,{fetchImpl:n,signal:R,maxBytes:V})}catch(T){throw R?.aborted||T instanceof ut?T:new gt("image-content-download-failed","\u9489\u9489\u56FE\u7247\u5185\u5BB9\u4E0B\u8F7D\u5931\u8D25\u3002",{cause:T})}},async downloadFile({clientId:H,clientSecret:J,robotCode:q,downloadCode:U,signal:R}){let V=await _({clientId:H,clientSecret:J,robotCode:q,downloadCode:U,signal:R,kind:"file"});if(V.protocol!=="https:")throw new gt("invalid-file-download","\u9489\u9489\u670D\u52A1\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u6587\u4EF6\u4E0B\u8F7D\u5730\u5740\u3002");try{let L=await n(V,{method:"GET",redirect:"follow",signal:R});if(!L?.ok)throw await L?.body?.cancel?.().catch?.(()=>{}),new gt("file-content-download-failed",`\u9489\u9489\u6587\u4EF6\u5185\u5BB9\u4E0B\u8F7D\u5931\u8D25\uFF08HTTP ${L?.status??"unknown"}\uFF09\u3002`,{status:L?.status});return Buffer.from(await L.arrayBuffer())}catch(L){throw R?.aborted?Mn(R):L instanceof gt?L:new gt("file-content-download-failed","\u9489\u9489\u6587\u4EF6\u5185\u5BB9\u4E0B\u8F7D\u5931\u8D25\u3002",{cause:L})}},async createAiCard({clientId:H,clientSecret:J,target:q,initialText:U,signal:R}){let V=WA(H),L=WA(J),T=WA(U);if(!V||!L)throw new TypeError("clientId and clientSecret are required");if(!T)throw new TypeError("initialText is required");let k=$ge(q),W=await y({clientId:V,clientSecret:L,signal:R}),ie=`dsh_${Yh()}`,ge={"x-acs-dingtalk-access-token":W},Se=!1;try{await G("v1.0/card/instances",{body:{cardTemplateId:Uge,outTrackId:ie,cardData:{cardParamMap:{config:JSON.stringify({autoLayout:!0})}},callbackType:"STREAM",imGroupOpenSpaceModel:{supportForward:!0},imRobotOpenSpaceModel:{supportForward:!0}},headers:ge,signal:R,action:"AI Card \u521B\u5EFA"}),await G("v1.0/card/instances/deliver",{body:ece(ie,k,V),headers:ge,signal:R,action:"AI Card \u6295\u653E"}),Se=!0,await G("v1.0/card/instances",{method:"PUT",body:{outTrackId:ie,cardData:Mb(T,"2")},headers:ge,signal:R,action:"AI Card \u542F\u52A8"}),await G("v1.0/card/streaming",{method:"PUT",body:{outTrackId:ie,guid:Yh(),key:"msgContent",content:Jh(T).replace(/\n+$/,""),isFull:!0,isFinalize:!1,isError:!1},headers:ge,signal:R,action:"AI Card \u542F\u52A8"})}catch(de){if(Se){let De=AbortSignal.timeout(5e3);await Y({clientId:V,clientSecret:L,cardInstanceId:ie,text:D("\u5361\u7247\u5DF2\u7ED3\u675F\uFF0C\u8BF7\u67E5\u770B\u540E\u7EED\u6D88\u606F\u3002"),signal:De}).catch(()=>{})}throw de}return{cardInstanceId:ie}},async updateAiCard({clientId:H,clientSecret:J,cardInstanceId:q,text:U,signal:R}){let V=WA(q),L=WA(U);if(!V)throw new TypeError("cardInstanceId is required");if(!L)throw new TypeError("text is required");let T=await y({clientId:H,clientSecret:J,signal:R});return await G("v1.0/card/streaming",{method:"PUT",body:{outTrackId:V,guid:Yh(),key:"msgContent",content:Jh(L).replace(/\n+$/,""),isFull:!0,isFinalize:!1,isError:!1},headers:{"x-acs-dingtalk-access-token":T},signal:R,action:"AI Card \u66F4\u65B0"}),!0},async finishAiCard({clientId:H,clientSecret:J,cardInstanceId:q,text:U,signal:R}){let V=WA(q),L=WA(U);if(!V)throw new TypeError("cardInstanceId is required");if(!L)throw new TypeError("text is required");let k={"x-acs-dingtalk-access-token":await y({clientId:H,clientSecret:J,signal:R})},W=Jh(L);await G("v1.0/card/streaming",{method:"PUT",body:{outTrackId:V,guid:Yh(),key:"msgContent",content:W,isFull:!0,isFinalize:!0,isError:!1},headers:k,signal:R,action:"AI Card \u5B8C\u6210"});let ie=!0,ge={method:"PUT",body:{outTrackId:V,cardData:Mb(L,"3"),cardUpdateOptions:{updateCardDataByKey:!0}},headers:k,signal:R,action:"AI Card \u6536\u53E3"};try{await G("v1.0/card/instances",ge)}catch{try{await G("v1.0/card/instances",ge)}catch{ie=!1}}return{delivered:!0,completed:ie}},failAiCard:Y,async sendText({clientId:H,clientSecret:J,sessionWebhook:q,text:U,signal:R}){let V=WA(U);if(!V)throw new TypeError("text is required");let L=Rg(q),T=await y({clientId:H,clientSecret:J,signal:R}),k=await bn(n,L,{body:{msgtype:"text",text:{content:V}},headers:{"x-acs-dingtalk-access-token":T},signal:R,action:"\u6D88\u606F\u56DE\u590D"});if(k?.errcode!==void 0&&k.errcode!==0||k?.code!==void 0&&k.code!==0)throw new gt("send-rejected","\u9489\u9489\u670D\u52A1\u62D2\u7EDD\u4E86\u56DE\u590D\u6D88\u606F\u3002");return!0},async sendFile(H){return j(H,{uploadType:"file",messageKey:"sampleFile",createMessageParams:(J,q)=>({mediaId:J,fileName:q.fileName,fileType:Xge(q.fileName)})})},async sendImage(H){return j(H,{uploadType:"image",messageKey:"sampleImageMsg",createMessageParams:J=>({photoURL:J})})},clearAccessToken(H){let J=WA(H);J&&c.delete(J)}})}var Ace=500,tce="\u5361\u7247\u5DF2\u7ED3\u675F\uFF0C\u8BF7\u67E5\u770B\u540E\u7EED\u6D88\u606F\u3002";function Rb(n,t){if(typeof n!="string")throw new TypeError(`${t} must be a string`);return n}function TH(n,t){if(typeof n!="string"||!n.trim())throw new TypeError(`${t} is required`);return n.trim()}function NH({api:n,clientId:t,clientSecret:o,target:i,signal:e,logger:a=console,updateIntervalMs:A=Ace,clock:r=()=>Date.now(),timer:s={setTimeout:(g,c)=>globalThis.setTimeout(g,c),clearTimeout:g=>globalThis.clearTimeout(g)}}={}){if(!n||typeof n.createAiCard!="function"||typeof n.updateAiCard!="function"||typeof n.finishAiCard!="function")throw new TypeError("DingTalk AI Card API is required");let g=TH(t,"clientId"),c=TH(o,"clientSecret");if(i==null)throw new TypeError("target is required");if(!Number.isFinite(A)||A<0)throw new TypeError("updateIntervalMs must be a non-negative number");if(typeof r!="function")throw new TypeError("clock must be a function");if(typeof s?.setTimeout!="function"||typeof s?.clearTimeout!="function")throw new TypeError("timer must provide setTimeout and clearTimeout");let I=()=>{let T=r();if(!Number.isFinite(T))throw new TypeError("clock must return a finite timestamp");return T};I();let d=e?.aborted?"aborted":"idle",B=null,f=null,Q=null,y=null,m=null,_=null,N=0,G=()=>{Q!==null&&(s.clearTimeout(Q),Q=null)},Y=()=>e?.removeEventListener("abort",q),j=T=>{d=T,f=null,G(),Y()},H=()=>!B||typeof n.failAiCard!="function"?Promise.resolve(!1):(_||(_=n.failAiCard({...B,text:D(tce),signal:AbortSignal.timeout(5e3)}).then(()=>!0,()=>!1)),_),J=T=>{d==="failed"||d==="finished"||d==="aborted"||(H(),j("failed"),a?.error?.(`[dsh-dingtalk] AI Card ${T} failed`))};function q(){d==="finished"||d==="failed"||d==="aborted"||(H(),j("aborted"))}d!=="aborted"&&e?.addEventListener("abort",q,{once:!0});let U=()=>{if(d!=="active"||y||f===null)return;let T=Math.max(0,N+A-I());if(T>0){Q=s.setTimeout(()=>{Q=null,U()},T);return}let k=f;f=null,y=(async()=>{try{await n.updateAiCard({...B,text:k,finished:!1}),N=I()}catch{if(e?.aborted||d==="aborted")return;J("update")}})().finally(()=>{y=null,d==="active"&&f!==null&&U()})};return Object.freeze({start:async T=>{if(Rb(T,"initialText"),d!=="idle")return!1;d="starting";try{let k=await n.createAiCard({clientId:g,clientSecret:c,target:i,initialText:T,signal:e}),W=typeof k?.cardInstanceId=="string"?k.cardInstanceId.trim():"";if(!W)throw new TypeError("DingTalk did not return a card instance id");return B=Object.freeze({clientId:g,clientSecret:c,target:i,cardInstanceId:W,signal:e}),d!=="starting"?(H(),!1):(N=I(),d="active",!0)}catch{return e?.aborted||d==="aborted"?(j("aborted"),!1):(J("creation"),!1)}},push:T=>{Rb(T,"progressText"),d==="active"&&(f=T,!Q&&!y&&U())},finish:T=>{if(Rb(T,"finalText"),d==="finished")return Promise.resolve(!0);if(d==="finishing")return m;if(d!=="active")return Promise.resolve(!1);d="finishing",f=null,G();let k=y;return m=(async()=>{if(k&&await k,d!=="finishing")return!1;try{return await n.finishAiCard({...B,text:T}),d!=="finishing"?!1:(j("finished"),!0)}catch{return e?.aborted||d==="aborted"?(j("aborted"),!1):(J("finish"),!1)}})(),m}})}function lf(n){return typeof n=="string"&&n.trim()?n.trim():null}function ti(n){return n&&typeof n.id=="string"&&typeof n.question=="string"&&(n.header===void 0||typeof n.header=="string")&&(n.detail===void 0||typeof n.detail=="string")&&(n.multiSelect===void 0||typeof n.multiSelect=="boolean")&&(n.options===void 0||Array.isArray(n.options)&&n.options.every(t=>t&&typeof t.label=="string"&&(t.description===void 0||typeof t.description=="string")))}function ri(n,t,o,{requiresMention:i=!1}={}){let e=[],a=o>1?`\uFF08${t+1}/${o}\uFF09`:"";e.push(D("DeepSeek Harness \u9700\u8981\u4F60\u8865\u5145\u4FE1\u606F{progress}\uFF1A",{progress:a})),lf(n.header)&&e.push("",n.header.trim()),e.push("",lf(n.question)??D("\u8BF7\u8F93\u5165\u4F60\u7684\u56DE\u7B54\u3002")),lf(n.detail)&&e.push("",n.detail.trim());let A=Array.isArray(n.options)?n.options:[];return A.length>0?(e.push(""),A.forEach((r,s)=>{let g=typeof r?.label=="string"?r.label:"",c=lf(r?.description);e.push(`${s+1}. ${g}${c?` \u2014 ${c}`:""}`)}),e.push("",n.multiSelect===!0?D("\u8BF7\u56DE\u590D\u9009\u9879\u5E8F\u53F7\u6216\u6587\u5B57\uFF1B\u591A\u9009\u7528\u9017\u53F7\u5206\u9694\uFF0C\u4E5F\u53EF\u8865\u5145\u5176\u4ED6\u5185\u5BB9\u3002"):D("\u8BF7\u56DE\u590D\u4E00\u4E2A\u9009\u9879\u5E8F\u53F7\u6216\u6587\u5B57\uFF0C\u4E5F\u53EF\u76F4\u63A5\u8F93\u5165\u5176\u4ED6\u7B54\u6848\u3002"))):e.push("",D("\u8BF7\u76F4\u63A5\u56DE\u590D\u4F60\u7684\u7B54\u6848\u3002")),i&&e.push("",D("\u7FA4\u804A\u4E2D\u8BF7 @\u673A\u5668\u4EBA \u540E\u53D1\u9001\u7B54\u6848\u3002")),e.join(`
|
|
145
145
|
`)}function RH(n,t){let o=n.trim();if(!o)return null;if(/^\d+$/.test(o)){let e=t[Number(o)-1];return typeof e?.label=="string"?e.label:null}let i=t.find(e=>e?.label===o);return typeof i?.label=="string"?i.label:null}function ai(n,t){let o=Array.isArray(n.options)?n.options:[];if(o.length===0)return{id:n.id,selected:[],custom:t};let i=RH(t,o);if(n.multiSelect!==!0)return i?{id:n.id,selected:[i]}:{id:n.id,selected:[],custom:t};if(i)return{id:n.id,selected:[i]};let e=[],a=[];for(let A of t.split(/[,,、;;\n]+/)){let r=A.trim();if(!r)continue;let s=RH(r,o);s?e.includes(s)||e.push(s):a.push(r)}return{id:n.id,selected:e,...a.length>0?{custom:a.join("\u3001")}:{}}}var rce=new Map([["\u6279\u51C6","allowed-once"],["\u540C\u610F","allowed-once"],["yes","allowed-once"],["\u62D2\u7EDD","rejected"],["\u4E0D\u540C\u610F","rejected"],["no","rejected"]]),kb="\u8BF7\u7CBE\u51C6\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\uFF08\u4E5F\u652F\u6301\uFF1A\u540C\u610F / \u4E0D\u540C\u610F / yes / no\uFF09\u3002",ace="\u8BF7\u5148\u5B8C\u6210\u5F53\u524D\u95EE\u9898\uFF0C\u518D\u7CBE\u51C6\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002",Gl="\u8BE5\u5BA1\u6279\u5DF2\u5904\u7406\uFF0C\u65E0\u9700\u518D\u6B21\u56DE\u590D\u3002",ice=5*6e4,oce=2048;function wa(n){return typeof n=="string"?n.trim():""}function vb(n){return wa(n).replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g,"")}function nce(n){return rce.get(wa(n).toLowerCase())??null}function vH(n){return n?.type==="approval/requested"&&!!wa(n.sessionId)&&!!wa(n.approvalId)&&!!wa(n.toolName)&&(n.callId===void 0||!!wa(n.callId))&&(n.reason===void 0||typeof n.reason=="string")}function sce(n){let t=n?.arguments;if(t!==null&&typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return null}if(typeof t!="string")return null;let o=vb(t);if(!o)return t===""?"{}":null;try{return JSON.stringify(JSON.parse(o),null,2)}catch{return o}}function Pb(n,{toolCall:t,requiresMention:o=!1,maxArgumentsLength:i=6e3}={}){if(!vH(n))return null;let e=wa(n.callId);if(!e||wa(t?.callId)!==e||wa(t?.name)!==wa(n.toolName))return null;let a=sce(t);if(!a||a.length>i)return null;let A=[D("DeepSeek Harness \u9700\u8981\u4F60\u7684\u5BA1\u6279\uFF1A"),"",D("\u5DE5\u5177\uFF1A{tool}",{tool:vb(n.toolName)}),D("\u64CD\u4F5C\u53C2\u6570\uFF1A"),a],r=vb(n.reason);return r&&A.push(D("\u539F\u56E0\uFF1A{reason}",{reason:r})),A.push("",D(kb)),o&&A.push("",D("\u7FA4\u804A\u4E2D\u8BF7 @\u673A\u5668\u4EBA \u540E\u53D1\u9001\u5BA1\u6279\u51B3\u5B9A\u3002")),A.join(`
|
|
146
|
-
`)}function kH(n,t){return{ok:!0,value:{sessionId:n.sessionId,approvalId:n.approvalId,outcome:t}}}function pf(n){return n==="allowed-once"?D("\u5DF2\u6279\u51C6\uFF0C\u4EC5\u5BF9\u672C\u6B21\u64CD\u4F5C\u6709\u6548\u3002"):n==="rejected"?D("\u5DF2\u62D2\u7EDD\u6B64\u6B21\u64CD\u4F5C\u3002"):D(Gl)}var ii=class{#e;#A;#t=new Map;#r=new Map;#a=new Map;constructor({label:t="IM",logger:o=console}={}){this.#e=t,this.#A=o}hasPending(t){return this.#r.get(t)?.items.some(o=>!o.inactive)===!0}claimReply({key:t,actor:o,text:i,addressed:e=!0,hasPendingQuestion:a=!1,questionCompletion:A,isQuestionPending:r,send:s}){let c=this.#r.get(t)?.items[0],I=nce(i),d=(f,Q=!1)=>({...Q?{resolved:!0}:{},process:async y=>{typeof y=="function"&&await y()===!1||await s(f)}}),B=a&&c&&A&&typeof A.then=="function";return a&&!B?null:!c||c.inactive?(this.#a.get(t)??0)<=Date.now()?(this.#a.delete(t),null):I?d(D(Gl),!0):null:c.actor!==o||c.requiresMention&&e!==!0?I?d(D("\u53EA\u6709\u53D1\u8D77\u5F53\u524D\u4EFB\u52A1\u7684\u7528\u6237\u53EF\u4EE5\u5904\u7406\u8FD9\u6761\u5BA1\u6279\u3002")):null:{process:async f=>{let Q=c.presented,m=(c.replyTail??Promise.resolve()).catch(()=>{}).then(async()=>{if(!(typeof f=="function"&&await f()===!1)){if(B){if(await A.catch(()=>{}),c.inactive||c.resolving)return;if(typeof r=="function"&&r()){await s(D(ace));return}}if(await c.activationTask?.catch(()=>{}),await c.presentationTask?.catch(()=>{}),c.inactive||c.resolving){await s(D(Gl));return}if(c.send=s,!Q||!c.presented){if(c.presented||await this.#i(c),c.inactive||c.resolving)return;await s(D(kb));return}if(c.submitting){await s(D("\u5BA1\u6279\u51B3\u5B9A\u6B63\u5728\u63D0\u4EA4\uFF0C\u8BF7\u7A0D\u5019\u3002"));return}if(!I){await s(D(kb));return}await this.#c(c,I)}});c.replyTail=m;try{await m}finally{c.replyTail===m&&(c.replyTail=null)}}}}async handleRequested(t,o){if(t?.kind!=="approval")return!1;let i=t.payload,e=wa(i?.approvalId);if(!wa(t.rpcId)||!wa(t.sessionId)||!e||!vH(i)||i.sessionId!==t.sessionId||typeof t.respond!="function")return this.#A.warn?.(`[dsh-im:${this.#e}] ignored an invalid Harness approval`),!0;if(t.recovered===!0)return await this.#g(t,i),!0;let a=this.#t.get(e);if(a)return a.interaction=t,a.toolCall=t.toolCall,a.presented||await this.#i(a),!0;let A=o?.send,r=wa(o?.key),s=wa(o?.actor);if(!r||!s||typeof A!="function")return this.#A.warn?.(`[dsh-im:${this.#e}] ignored an approval without a reply route`),await this.#g(t,i),!0;let g=Pb(i,{toolCall:t.toolCall,requiresMention:o.requiresMention===!0});if(!g){let d=await this.#g(t,i);return await A(d?D("\u65E0\u6CD5\u5B8C\u6574\u5C55\u793A\u8FD9\u6B21\u64CD\u4F5C\uFF0C\u5DF2\u5B89\u5168\u62D2\u7EDD\u6B64\u6B21\u5BA1\u6279\u3002"):D(Gl)),!0}let c={approvalId:e,sessionId:t.sessionId,interaction:t,toolCall:t.toolCall,key:r,actor:s,requiresMention:o.requiresMention===!0,send:A,text:g,presented:!1,presentationTask:null,deliveryCompleted:!1,replyTail:null,submitting:!1,inactive:!1,resolving:!1,closedOutcome:null,resolutionNotified:!1,activationTask:null};this.#t.set(e,c);let I=this.#r.get(r)??{items:[]};return I.items.push(c),this.#r.set(r,I),I.items[0]===c&&await this.#i(c),!0}async handleResolved(t){if(t?.kind!=="approval")return!1;let o=this.#t.get(wa(t.interactionId));if(!o||(o.resolving=!0,o.activationTask&&await o.activationTask.catch(()=>{}),o.inactive||this.#t.get(o.approvalId)!==o))return!0;let i=o.presentationTask,e=o.presented||i,a=o.send,A=this.#o(o);return await this.#s(A,async()=>{let r=o.presented;i&&(r=await i.then(()=>!0,()=>!1)),e&&r&&(o.resolutionNotified=!0,await a(pf(t.outcome)).catch(()=>{}))}),!0}async closeRoute(t){let o=this.#r.get(t);if(!o)return;let i=[...o.items];for(let e of i)this.#o(e);await Promise.all(i.map(async e=>{try{await e.interaction.respond(kH(e,"rejected"),{signal:AbortSignal.timeout(5e3)}),e.closedOutcome="rejected",(e.presented||e.deliveryCompleted)&&!e.resolutionNotified&&(e.resolutionNotified=!0,await e.send(pf("rejected")).catch(()=>{}))}catch(a){a?.code==="interaction-not-pending"?(e.closedOutcome="resolved",(e.presented||e.deliveryCompleted)&&!e.resolutionNotified&&(e.resolutionNotified=!0,await e.send(D(Gl)).catch(()=>{}))):this.#A.warn?.(`[dsh-im:${this.#e}] failed to reject a closing approval:`,a)}}))}async#i(t){if(this.#r.get(t.key)?.items[0]!==t||t.inactive||t.resolving||t.presented||(await t.activationTask?.catch(()=>{}),this.#r.get(t.key)?.items[0]!==t||t.inactive||t.resolving||t.presented))return;if(t.presentationTask)return t.presentationTask;let o=Promise.resolve().then(()=>t.send(t.text));t.presentationTask=o;try{await o,t.deliveryCompleted=!0,t.inactive?t.closedOutcome&&!t.resolutionNotified&&(t.resolutionNotified=!0,await t.send(pf(t.closedOutcome)).catch(()=>{})):t.presented=!0}finally{t.presentationTask===o&&(t.presentationTask=null)}}async#c(t,o){t.submitting=!0;try{await t.interaction.respond(kH(t,o))}catch(a){if(a?.code==="interaction-not-pending"){let A=t.send,r=this.#o(t);await this.#s(r,async()=>{t.resolutionNotified||await A(D(Gl)).catch(()=>{})});return}if(t.inactive)return;t.submitting=!1,this.#A.error?.(`[dsh-im:${this.#e}] failed to submit an approval:`,a),await t.send(D("\u5BA1\u6279\u63D0\u4EA4\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002")).catch(()=>{});return}let i=t.send,e=this.#o(t);await this.#s(e,async()=>{t.resolutionNotified||await i(pf(o)).catch(()=>{})})}async#s(t,o){let i,e=new Promise(a=>{i=a});t&&(t.activationTask=e);try{await o()}finally{i(),t?.activationTask===e&&(t.activationTask=null)}await this.#I(t)}async#I(t){if(t)try{await this.#i(t)}catch(o){this.#A.error?.(`[dsh-im:${this.#e}] failed to present the next approval:`,o);try{t.interaction.reconnect?.()}catch{}}}#o(t){if(t.inactive)return null;t.inactive=!0,this.#n(t.key),this.#t.delete(t.approvalId);let o=this.#r.get(t.key);if(!o)return null;let i=o.items[0]===t,e=o.items.indexOf(t);return e!==-1&&o.items.splice(e,1),o.items.length===0?(this.#r.delete(t.key),null):i?o.items[0]:null}#n(t){let o=Date.now();for(let[i,e]of this.#a)e<=o&&this.#a.delete(i);for(this.#a.delete(t),this.#a.set(t,o+ice);this.#a.size>oce;)this.#a.delete(this.#a.keys().next().value)}async#g(t,o){try{return await t.respond({ok:!0,value:{sessionId:t.sessionId,approvalId:o.approvalId,outcome:"rejected"}},{signal:AbortSignal.timeout(5e3)}),!0}catch(i){if(i?.code==="interaction-not-pending")return!1;throw i}}};var Gb=new WeakMap;function gce(n){let t=Gb.get(n);return t||(t=new Map,Gb.set(n,t)),t}async function Vc(n,t,o){let i=typeof n;if(i!=="object"&&i!=="function"||n===null)throw new TypeError("state is required");if(typeof t!="string"||!t)throw new TypeError("conversation key is required");if(typeof o!="function")throw new TypeError("operation is required");let e=gce(n),a=e.get(t)??Promise.resolve(),A,r=new Promise(s=>{A=s});e.set(t,r),await a;try{return await o()}finally{A(),e.get(t)===r&&(e.delete(t),e.size===0&&Gb.delete(n))}}var oi="workspace-session-stale";function PH(n,t){return typeof n.workspaceSession=="function"?n.workspaceSession(t):Object.freeze({sessionId:t,sessionExists:(...o)=>n.sessionExists(t,...o),models:(...o)=>n.getSessionModels(t,...o),selectModel:(...o)=>n.selectSessionModel(t,...o),isRunning:(...o)=>n.isSessionRunning(t,...o),hasActiveTurn:(...o)=>n.hasActiveTurn(t,...o),stopActiveTurn:(...o)=>n.stopActiveTurn(t,...o),steerActiveTurn:(...o)=>n.steerActiveTurn(t,...o),ask:(...o)=>n.ask(t,...o)})}async function cce(n,t){return t===void 0?n.sessionExists():n.sessionExists(t)}async function Ice(n,t){return t===void 0?n.createSession():n.createSession(t)}async function ni({harness:n,state:t,key:o,text:i,content:e,createOptions:a,existsOptions:A,askOptions:r}){for(;;)try{let s=await Vc(t,o,async()=>{let B=t.sessionFor(o),f=B?PH(n,B):null;if(!f||!await cce(f,A)){if(B=await Ice(n,a),await t.setSession(o,B)===!1)return null;f=PH(n,B)}return{sessionId:B,session:f}});if(!s)continue;let g=[],c=typeof r=="object"&&typeof r?.onArtifact=="function"?r.onArtifact:null,I=typeof r=="number"?{timeoutMs:r}:{...r};I.onArtifact=async B=>{g.push(B),await c?.(B)};let d=await s.session.ask(e??i,I);return{sessionId:s.sessionId,answer:d,...g.length>0?{artifacts:g}:{}}}catch(s){if(s?.code!==oi)throw s}}var lce=/^\/compact(?=$|\s)([\s\S]*)$/i,pce="\u7528\u6CD5\uFF1A/compact\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09",GH=new Map([["No compactable history yet.","\u6682\u65E0\u53EF\u538B\u7F29\u7684\u5386\u53F2\u8BB0\u5F55\u3002"],["Compaction is unavailable because this process has an active compaction, or the agent is not idle.","\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\u6216\u6267\u884C\u538B\u7F29\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"],["Compaction cancelled.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88\u3002"],["The history selected for compaction changed before it could be replaced. The conversation is unchanged; the attempt is recorded in the session log.","\u538B\u7F29\u671F\u95F4\u4F1A\u8BDD\u5386\u53F2\u53D1\u751F\u53D8\u5316\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\uFF0C\u8BF7\u91CD\u8BD5\u3002"],["Compaction could not produce a useful summary. The conversation is unchanged; the attempt is recorded in the session log.","\u672A\u80FD\u751F\u6210\u6709\u6548\u7684\u538B\u7F29\u6458\u8981\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\u3002"],["Compaction did not finish cleanly; some session history may have changed. Inspect the current session state before retrying.","\u4E0A\u4E0B\u6587\u538B\u7F29\u672A\u6B63\u5E38\u5B8C\u6210\uFF0C\u90E8\u5206\u4F1A\u8BDD\u5386\u53F2\u53EF\u80FD\u5DF2\u53D8\u5316\uFF0C\u8BF7\u68C0\u67E5\u4F1A\u8BDD\u540E\u518D\u91CD\u8BD5\u3002"],["Compaction finished, but the session could not be saved.","\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29\uFF0C\u4F46\u4F1A\u8BDD\u4FDD\u5B58\u5931\u8D25\u3002"]]);function Wc(n){return{handled:!0,message:n,messages:[n]}}function dce(n){if(!n||typeof n!="object"||!["success","error"].includes(n.kind)||n.text!==void 0&&typeof n.text!="string")throw new TypeError("Harness returned an invalid /compact result");let t=n.text?.trim()??"",o=/^Compacted (\d+) history items \(~(\d+) tokens\)\.$/u.exec(t);return o?D("\u5DF2\u538B\u7F29 {count} \u6761\u5386\u53F2\u8BB0\u5F55\uFF08\u7EA6 {tokens} \u4E2A token\uFF09\u3002",{count:o[1],tokens:o[2]}):GH.has(t)?D(GH.get(t)):t||(n.kind==="success"?D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210\u3002"):D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\u3002"))}function hce(n){let t=n?.code??n?.failure?.code;return t==="session-not-found"?D("\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u7684\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u53D1\u9001\u65B0\u6D88\u606F\u5F00\u542F\u4F1A\u8BDD\u3002"):t==="agent-busy"?D("\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"):t==="cancelled"||n?.name==="AbortError"?D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88\u3002"):t===oi||t==="workspace-bot-not-found"?D("\u5DE5\u4F5C\u533A\u6216\u673A\u5668\u4EBA\u72B6\u6001\u5DF2\u53D1\u751F\u53D8\u5316\uFF0C\u8BF7\u91CD\u8BD5\u3002"):t==="commands-unavailable"?D("\u5F53\u524D Harness \u6682\u4E0D\u652F\u6301\u4ECE\u673A\u5668\u4EBA\u6267\u884C\u4E0A\u4E0B\u6587\u538B\u7F29\u3002"):D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002")}async function si(n,t,o,i,e={}){if(typeof n!="string")return null;let a=lce.exec(n.trim());if(!a)return null;if(a[1].trim())return Wc(D(pce));if(typeof o?.sessionFor!="function")return Wc(D("\u5F53\u524D\u673A\u5668\u4EBA\u6CA1\u6709\u53EF\u7528\u7684\u4F1A\u8BDD\u72B6\u6001\u3002"));let A=o.sessionFor(i);if(typeof A!="string"||!A)return Wc(D("\u5F53\u524D\u804A\u5929\u8FD8\u6CA1\u6709\u53EF\u538B\u7F29\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u53D1\u9001\u4E00\u6761\u6D88\u606F\u3002"));if(typeof t?.executeCommand!="function")return Wc(D("\u5F53\u524D\u673A\u5668\u4EBA\u6682\u4E0D\u652F\u6301\u4E0A\u4E0B\u6587\u538B\u7F29\u3002"));try{let r=await t.executeCommand(A,"/compact",e);return Wc(r===void 0?D("\u5F53\u524D Harness \u672A\u6CE8\u518C /compact \u547D\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u4E0A\u4E0B\u6587\u538B\u7F29\u7EC4\u4EF6\u5DF2\u542F\u7528\u3002"):dce(r?.result))}catch(r){return Wc(hce(r))}}var FH={name:"@xmanrui/dsh-im",version:"2.6.0",description:"\u628A\u4E5D\u79CD IM \u673A\u5668\u4EBA\u548C\u516C\u7F51 AI Office \u63A5\u5165\u672C\u673A DeepSeek Harness\u3002 Connect nine IM channels and a public AI Office to a local DeepSeek Harness.",keywords:["deepseek-harness","dsh","dsh-plugin","ai-agent","im","instant-messaging","chatbot","feishu","lark","wechat","wecom","dingtalk","qq","slack","telegram","discord","whatsapp","ai-office"],author:{name:"xmanrui",url:"https://github.com/xmanrui"},contributors:[{name:"C3H3-AI",url:"https://github.com/C3H3-AI"}],license:"MIT",type:"module",repository:{type:"git",url:"git+https://github.com/xmanrui/dsh-im.git"},homepage:"https://github.com/xmanrui/dsh-im#readme",bugs:"https://github.com/xmanrui/dsh-im/issues",publishConfig:{access:"public"},bin:{"dsh-im":"bin/dsh-im.mjs"},main:"./lib/index.js",exports:{".":"./lib/index.js","./client":"./lib/client.js","./package.json":"./package.json"},files:["assets","bin","cordis.patch.yml","lib","plugin-src","scripts","src","LICENSE","README.md","README.en.md","THIRD_PARTY_NOTICES.md"],dsh:{bundle:{patch:"./cordis.patch.yml"},client:{inject:["@deepseek-ai/dsh-client-connection","@deepseek-ai/dsh-client-runtime","@deepseek-ai/dsh-client-ui-settings","@deepseek-ai/dsh-client-ui-slots","@deepseek-ai/dsh-client-locale"],platform:"web"}},scripts:{build:"node plugin-src/client/build.mjs && node plugin-src/host/build.mjs",test:"node --test test/*.test.mjs test/channels/*/*.test.mjs",check:"npm test && npm run build && node scripts/verify-package.mjs"},engines:{node:">=22.19"},dependencies:{"@tencent-connect/qqbot-connector":"1.2.0","@tencent-connect/qqbot-nodejs":"1.0.4","@wecom/aibot-node-sdk":"1.0.7","dingtalk-stream":"2.1.4",qrcode:"1.5.4"},devDependencies:{"@larksuiteoapi/node-sdk":"1.73.0","@whiskeysockets/baileys":"7.0.0-rc14",esbuild:"0.25.9","https-proxy-agent":"5.0.1",react:"18.3.1","react-dom":"18.3.1","react-test-renderer":"18.3.1"}};var Cce=/^\/(?:stop|steer|version)(?=$|\s)/iu,uce=/^\/stop(?=$|\s)/iu,Bce=/^\/version(?=$|\s)/iu,fce="\u7528\u6CD5\uFF1A/stop\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09",Qce="\u7528\u6CD5\uFF1A/version\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09",yce="\u7528\u6CD5\uFF1A/steer <\u8865\u5145\u6307\u4EE4>",mce="\u63A7\u5236\u547D\u4EE4\u4EC5\u652F\u6301\u7EAF\u6587\u5B57\uFF0C\u8BF7\u79FB\u9664\u56FE\u7247\u540E\u91CD\u8BD5\u3002";function co(n,t={}){return{message:n,...t}}function LH(n){return n?{signal:n}:{}}function UH(n,t,o){if(typeof t?.sessionFor!="function")return null;let i=t.sessionFor(o);if(typeof i!="string"||!i)return null;if(typeof n?.workspaceSession!="function")throw new TypeError("Harness does not support workspace sessions");let e=n.workspaceSession(i);if(!e||typeof e!="object")throw new TypeError("Harness returned an invalid workspace session");return e}function Pi(n){return typeof n=="string"&&Cce.test(n.trim())}async function gi(n,t,o,i,{signal:e,hasImages:a=!1,pendingInteraction:A=!1,control:r}={}){if(!Pi(n))return null;let s=n.trim(),g=uce.test(s),c=Bce.test(s);if(a)return co(D(mce));if(c)return/^\/version$/iu.test(s)?co(`dsh-im v${FH.version}`):co(D(Qce));if(g){if(!/^\/stop$/iu.test(s))return co(D(fce));let Q=UH(t,o,i);if(!Q)return co(D("\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002"));if(typeof Q.stopActiveTurn!="function")throw new TypeError("Harness session does not support stopping active turns");return await Q.stopActiveTurn(r,LH(e))?co(D("\u5DF2\u8BF7\u6C42\u505C\u6B62\u5F53\u524D\u4EFB\u52A1\u3002"),{stopped:!0}):co(D("\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002"))}let d=/^\/steer(?:\s+([\s\S]*))?$/iu.exec(s)?.[1]?.trim()??"";if(!d)return co(D(yce));if(A)return co([D("\u5F53\u524D\u4EFB\u52A1\u6B63\u5728\u7B49\u5F85\u4F60\u7684\u56DE\u7B54\u6216\u5BA1\u6279\u3002"),"",D("\u8BF7\u5148\u5904\u7406\u5F53\u524D\u8BF7\u6C42\uFF0C\u6216\u8005\u53D1\u9001 /stop \u505C\u6B62\u4EFB\u52A1\u3002")].join(`
|
|
146
|
+
`)}function kH(n,t){return{ok:!0,value:{sessionId:n.sessionId,approvalId:n.approvalId,outcome:t}}}function pf(n){return n==="allowed-once"?D("\u5DF2\u6279\u51C6\uFF0C\u4EC5\u5BF9\u672C\u6B21\u64CD\u4F5C\u6709\u6548\u3002"):n==="rejected"?D("\u5DF2\u62D2\u7EDD\u6B64\u6B21\u64CD\u4F5C\u3002"):D(Gl)}var ii=class{#e;#A;#t=new Map;#r=new Map;#a=new Map;constructor({label:t="IM",logger:o=console}={}){this.#e=t,this.#A=o}hasPending(t){return this.#r.get(t)?.items.some(o=>!o.inactive)===!0}claimReply({key:t,actor:o,text:i,addressed:e=!0,hasPendingQuestion:a=!1,questionCompletion:A,isQuestionPending:r,send:s}){let c=this.#r.get(t)?.items[0],I=nce(i),d=(f,Q=!1)=>({...Q?{resolved:!0}:{},process:async y=>{typeof y=="function"&&await y()===!1||await s(f)}}),B=a&&c&&A&&typeof A.then=="function";return a&&!B?null:!c||c.inactive?(this.#a.get(t)??0)<=Date.now()?(this.#a.delete(t),null):I?d(D(Gl),!0):null:c.actor!==o||c.requiresMention&&e!==!0?I?d(D("\u53EA\u6709\u53D1\u8D77\u5F53\u524D\u4EFB\u52A1\u7684\u7528\u6237\u53EF\u4EE5\u5904\u7406\u8FD9\u6761\u5BA1\u6279\u3002")):null:{process:async f=>{let Q=c.presented,m=(c.replyTail??Promise.resolve()).catch(()=>{}).then(async()=>{if(!(typeof f=="function"&&await f()===!1)){if(B){if(await A.catch(()=>{}),c.inactive||c.resolving)return;if(typeof r=="function"&&r()){await s(D(ace));return}}if(await c.activationTask?.catch(()=>{}),await c.presentationTask?.catch(()=>{}),c.inactive||c.resolving){await s(D(Gl));return}if(c.send=s,!Q||!c.presented){if(c.presented||await this.#i(c),c.inactive||c.resolving)return;await s(D(kb));return}if(c.submitting){await s(D("\u5BA1\u6279\u51B3\u5B9A\u6B63\u5728\u63D0\u4EA4\uFF0C\u8BF7\u7A0D\u5019\u3002"));return}if(!I){await s(D(kb));return}await this.#c(c,I)}});c.replyTail=m;try{await m}finally{c.replyTail===m&&(c.replyTail=null)}}}}async handleRequested(t,o){if(t?.kind!=="approval")return!1;let i=t.payload,e=wa(i?.approvalId);if(!wa(t.rpcId)||!wa(t.sessionId)||!e||!vH(i)||i.sessionId!==t.sessionId||typeof t.respond!="function")return this.#A.warn?.(`[dsh-im:${this.#e}] ignored an invalid Harness approval`),!0;if(t.recovered===!0)return await this.#g(t,i),!0;let a=this.#t.get(e);if(a)return a.interaction=t,a.toolCall=t.toolCall,a.presented||await this.#i(a),!0;let A=o?.send,r=wa(o?.key),s=wa(o?.actor);if(!r||!s||typeof A!="function")return this.#A.warn?.(`[dsh-im:${this.#e}] ignored an approval without a reply route`),await this.#g(t,i),!0;let g=Pb(i,{toolCall:t.toolCall,requiresMention:o.requiresMention===!0});if(!g){let d=await this.#g(t,i);return await A(d?D("\u65E0\u6CD5\u5B8C\u6574\u5C55\u793A\u8FD9\u6B21\u64CD\u4F5C\uFF0C\u5DF2\u5B89\u5168\u62D2\u7EDD\u6B64\u6B21\u5BA1\u6279\u3002"):D(Gl)),!0}let c={approvalId:e,sessionId:t.sessionId,interaction:t,toolCall:t.toolCall,key:r,actor:s,requiresMention:o.requiresMention===!0,send:A,text:g,presented:!1,presentationTask:null,deliveryCompleted:!1,replyTail:null,submitting:!1,inactive:!1,resolving:!1,closedOutcome:null,resolutionNotified:!1,activationTask:null};this.#t.set(e,c);let I=this.#r.get(r)??{items:[]};return I.items.push(c),this.#r.set(r,I),I.items[0]===c&&await this.#i(c),!0}async handleResolved(t){if(t?.kind!=="approval")return!1;let o=this.#t.get(wa(t.interactionId));if(!o||(o.resolving=!0,o.activationTask&&await o.activationTask.catch(()=>{}),o.inactive||this.#t.get(o.approvalId)!==o))return!0;let i=o.presentationTask,e=o.presented||i,a=o.send,A=this.#o(o);return await this.#s(A,async()=>{let r=o.presented;i&&(r=await i.then(()=>!0,()=>!1)),e&&r&&(o.resolutionNotified=!0,await a(pf(t.outcome)).catch(()=>{}))}),!0}async closeRoute(t){let o=this.#r.get(t);if(!o)return;let i=[...o.items];for(let e of i)this.#o(e);await Promise.all(i.map(async e=>{try{await e.interaction.respond(kH(e,"rejected"),{signal:AbortSignal.timeout(5e3)}),e.closedOutcome="rejected",(e.presented||e.deliveryCompleted)&&!e.resolutionNotified&&(e.resolutionNotified=!0,await e.send(pf("rejected")).catch(()=>{}))}catch(a){a?.code==="interaction-not-pending"?(e.closedOutcome="resolved",(e.presented||e.deliveryCompleted)&&!e.resolutionNotified&&(e.resolutionNotified=!0,await e.send(D(Gl)).catch(()=>{}))):this.#A.warn?.(`[dsh-im:${this.#e}] failed to reject a closing approval:`,a)}}))}async#i(t){if(this.#r.get(t.key)?.items[0]!==t||t.inactive||t.resolving||t.presented||(await t.activationTask?.catch(()=>{}),this.#r.get(t.key)?.items[0]!==t||t.inactive||t.resolving||t.presented))return;if(t.presentationTask)return t.presentationTask;let o=Promise.resolve().then(()=>t.send(t.text));t.presentationTask=o;try{await o,t.deliveryCompleted=!0,t.inactive?t.closedOutcome&&!t.resolutionNotified&&(t.resolutionNotified=!0,await t.send(pf(t.closedOutcome)).catch(()=>{})):t.presented=!0}finally{t.presentationTask===o&&(t.presentationTask=null)}}async#c(t,o){t.submitting=!0;try{await t.interaction.respond(kH(t,o))}catch(a){if(a?.code==="interaction-not-pending"){let A=t.send,r=this.#o(t);await this.#s(r,async()=>{t.resolutionNotified||await A(D(Gl)).catch(()=>{})});return}if(t.inactive)return;t.submitting=!1,this.#A.error?.(`[dsh-im:${this.#e}] failed to submit an approval:`,a),await t.send(D("\u5BA1\u6279\u63D0\u4EA4\u5931\u8D25\uFF0C\u8BF7\u91CD\u65B0\u56DE\u590D\u300C\u6279\u51C6\u300D\u6216\u300C\u62D2\u7EDD\u300D\u3002")).catch(()=>{});return}let i=t.send,e=this.#o(t);await this.#s(e,async()=>{t.resolutionNotified||await i(pf(o)).catch(()=>{})})}async#s(t,o){let i,e=new Promise(a=>{i=a});t&&(t.activationTask=e);try{await o()}finally{i(),t?.activationTask===e&&(t.activationTask=null)}await this.#I(t)}async#I(t){if(t)try{await this.#i(t)}catch(o){this.#A.error?.(`[dsh-im:${this.#e}] failed to present the next approval:`,o);try{t.interaction.reconnect?.()}catch{}}}#o(t){if(t.inactive)return null;t.inactive=!0,this.#n(t.key),this.#t.delete(t.approvalId);let o=this.#r.get(t.key);if(!o)return null;let i=o.items[0]===t,e=o.items.indexOf(t);return e!==-1&&o.items.splice(e,1),o.items.length===0?(this.#r.delete(t.key),null):i?o.items[0]:null}#n(t){let o=Date.now();for(let[i,e]of this.#a)e<=o&&this.#a.delete(i);for(this.#a.delete(t),this.#a.set(t,o+ice);this.#a.size>oce;)this.#a.delete(this.#a.keys().next().value)}async#g(t,o){try{return await t.respond({ok:!0,value:{sessionId:t.sessionId,approvalId:o.approvalId,outcome:"rejected"}},{signal:AbortSignal.timeout(5e3)}),!0}catch(i){if(i?.code==="interaction-not-pending")return!1;throw i}}};var Gb=new WeakMap;function gce(n){let t=Gb.get(n);return t||(t=new Map,Gb.set(n,t)),t}async function Vc(n,t,o){let i=typeof n;if(i!=="object"&&i!=="function"||n===null)throw new TypeError("state is required");if(typeof t!="string"||!t)throw new TypeError("conversation key is required");if(typeof o!="function")throw new TypeError("operation is required");let e=gce(n),a=e.get(t)??Promise.resolve(),A,r=new Promise(s=>{A=s});e.set(t,r),await a;try{return await o()}finally{A(),e.get(t)===r&&(e.delete(t),e.size===0&&Gb.delete(n))}}var oi="workspace-session-stale";function PH(n,t){return typeof n.workspaceSession=="function"?n.workspaceSession(t):Object.freeze({sessionId:t,sessionExists:(...o)=>n.sessionExists(t,...o),models:(...o)=>n.getSessionModels(t,...o),selectModel:(...o)=>n.selectSessionModel(t,...o),isRunning:(...o)=>n.isSessionRunning(t,...o),hasActiveTurn:(...o)=>n.hasActiveTurn(t,...o),stopActiveTurn:(...o)=>n.stopActiveTurn(t,...o),steerActiveTurn:(...o)=>n.steerActiveTurn(t,...o),ask:(...o)=>n.ask(t,...o)})}async function cce(n,t){return t===void 0?n.sessionExists():n.sessionExists(t)}async function Ice(n,t){return t===void 0?n.createSession():n.createSession(t)}async function ni({harness:n,state:t,key:o,text:i,content:e,createOptions:a,existsOptions:A,askOptions:r}){for(;;)try{let s=await Vc(t,o,async()=>{let B=t.sessionFor(o),f=B?PH(n,B):null;if(!f||!await cce(f,A)){if(B=await Ice(n,a),await t.setSession(o,B)===!1)return null;f=PH(n,B)}return{sessionId:B,session:f}});if(!s)continue;let g=[],c=typeof r=="object"&&typeof r?.onArtifact=="function"?r.onArtifact:null,I=typeof r=="number"?{timeoutMs:r}:{...r};I.onArtifact=async B=>{g.push(B),await c?.(B)};let d=await s.session.ask(e??i,I);return{sessionId:s.sessionId,answer:d,...g.length>0?{artifacts:g}:{}}}catch(s){if(s?.code!==oi)throw s}}var lce=/^\/compact(?=$|\s)([\s\S]*)$/i,pce="\u7528\u6CD5\uFF1A/compact\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09",GH=new Map([["No compactable history yet.","\u6682\u65E0\u53EF\u538B\u7F29\u7684\u5386\u53F2\u8BB0\u5F55\u3002"],["Compaction is unavailable because this process has an active compaction, or the agent is not idle.","\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\u6216\u6267\u884C\u538B\u7F29\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"],["Compaction cancelled.","\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88\u3002"],["The history selected for compaction changed before it could be replaced. The conversation is unchanged; the attempt is recorded in the session log.","\u538B\u7F29\u671F\u95F4\u4F1A\u8BDD\u5386\u53F2\u53D1\u751F\u53D8\u5316\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\uFF0C\u8BF7\u91CD\u8BD5\u3002"],["Compaction could not produce a useful summary. The conversation is unchanged; the attempt is recorded in the session log.","\u672A\u80FD\u751F\u6210\u6709\u6548\u7684\u538B\u7F29\u6458\u8981\uFF0C\u672C\u6B21\u672A\u4FEE\u6539\u4F1A\u8BDD\u3002"],["Compaction did not finish cleanly; some session history may have changed. Inspect the current session state before retrying.","\u4E0A\u4E0B\u6587\u538B\u7F29\u672A\u6B63\u5E38\u5B8C\u6210\uFF0C\u90E8\u5206\u4F1A\u8BDD\u5386\u53F2\u53EF\u80FD\u5DF2\u53D8\u5316\uFF0C\u8BF7\u68C0\u67E5\u4F1A\u8BDD\u540E\u518D\u91CD\u8BD5\u3002"],["Compaction finished, but the session could not be saved.","\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29\uFF0C\u4F46\u4F1A\u8BDD\u4FDD\u5B58\u5931\u8D25\u3002"]]);function Wc(n){return{handled:!0,message:n,messages:[n]}}function dce(n){if(!n||typeof n!="object"||!["success","error"].includes(n.kind)||n.text!==void 0&&typeof n.text!="string")throw new TypeError("Harness returned an invalid /compact result");let t=n.text?.trim()??"",o=/^Compacted (\d+) history items \(~(\d+) tokens\)\.$/u.exec(t);return o?D("\u5DF2\u538B\u7F29 {count} \u6761\u5386\u53F2\u8BB0\u5F55\uFF08\u7EA6 {tokens} \u4E2A token\uFF09\u3002",{count:o[1],tokens:o[2]}):GH.has(t)?D(GH.get(t)):t||(n.kind==="success"?D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5B8C\u6210\u3002"):D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\u3002"))}function hce(n){let t=n?.code??n?.failure?.code;return t==="session-not-found"?D("\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u7684\u4F1A\u8BDD\u5DF2\u4E0D\u5B58\u5728\uFF0C\u8BF7\u53D1\u9001\u65B0\u6D88\u606F\u5F00\u542F\u4F1A\u8BDD\u3002"):t==="agent-busy"?D("\u5F53\u524D\u4F1A\u8BDD\u6B63\u5728\u751F\u6210\u56DE\u590D\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"):t==="cancelled"||n?.name==="AbortError"?D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88\u3002"):t===oi||t==="workspace-bot-not-found"?D("\u5DE5\u4F5C\u533A\u6216\u673A\u5668\u4EBA\u72B6\u6001\u5DF2\u53D1\u751F\u53D8\u5316\uFF0C\u8BF7\u91CD\u8BD5\u3002"):t==="commands-unavailable"?D("\u5F53\u524D Harness \u6682\u4E0D\u652F\u6301\u4ECE\u673A\u5668\u4EBA\u6267\u884C\u4E0A\u4E0B\u6587\u538B\u7F29\u3002"):D("\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002")}async function si(n,t,o,i,e={}){if(typeof n!="string")return null;let a=lce.exec(n.trim());if(!a)return null;if(a[1].trim())return Wc(D(pce));if(typeof o?.sessionFor!="function")return Wc(D("\u5F53\u524D\u673A\u5668\u4EBA\u6CA1\u6709\u53EF\u7528\u7684\u4F1A\u8BDD\u72B6\u6001\u3002"));let A=o.sessionFor(i);if(typeof A!="string"||!A)return Wc(D("\u5F53\u524D\u804A\u5929\u8FD8\u6CA1\u6709\u53EF\u538B\u7F29\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u53D1\u9001\u4E00\u6761\u6D88\u606F\u3002"));if(typeof t?.executeCommand!="function")return Wc(D("\u5F53\u524D\u673A\u5668\u4EBA\u6682\u4E0D\u652F\u6301\u4E0A\u4E0B\u6587\u538B\u7F29\u3002"));try{let r=await t.executeCommand(A,"/compact",e);return Wc(r===void 0?D("\u5F53\u524D Harness \u672A\u6CE8\u518C /compact \u547D\u4EE4\uFF0C\u8BF7\u786E\u8BA4\u4E0A\u4E0B\u6587\u538B\u7F29\u7EC4\u4EF6\u5DF2\u542F\u7528\u3002"):dce(r?.result))}catch(r){return Wc(hce(r))}}var FH={name:"@xmanrui/dsh-im",version:"3.0.0",description:"\u628A\u4E5D\u79CD IM \u673A\u5668\u4EBA\u548C\u516C\u7F51 AI Office \u63A5\u5165\u672C\u673A DeepSeek Harness\u3002 Connect nine IM channels and a public AI Office to a local DeepSeek Harness.",keywords:["deepseek-harness","dsh","dsh-plugin","ai-agent","im","instant-messaging","chatbot","feishu","lark","wechat","wecom","dingtalk","qq","slack","telegram","discord","whatsapp","ai-office"],author:{name:"xmanrui",url:"https://github.com/xmanrui"},contributors:[{name:"C3H3-AI",url:"https://github.com/C3H3-AI"}],license:"MIT",type:"module",repository:{type:"git",url:"git+https://github.com/xmanrui/dsh-im.git"},homepage:"https://github.com/xmanrui/dsh-im#readme",bugs:"https://github.com/xmanrui/dsh-im/issues",publishConfig:{access:"public"},bin:{"dsh-im":"bin/dsh-im.mjs"},main:"./lib/index.js",exports:{".":"./lib/index.js","./client":"./lib/client.js","./package.json":"./package.json"},files:["assets","bin","cordis.patch.yml","lib","plugin-src","scripts","src","LICENSE","README.md","README.en.md","THIRD_PARTY_NOTICES.md"],dsh:{bundle:{patch:"./cordis.patch.yml"},client:{inject:["@deepseek-ai/dsh-client-connection","@deepseek-ai/dsh-client-runtime","@deepseek-ai/dsh-client-ui-settings","@deepseek-ai/dsh-client-ui-slots","@deepseek-ai/dsh-client-locale"],platform:"web"}},scripts:{build:"node plugin-src/client/build.mjs && node plugin-src/host/build.mjs",test:"node --test test/*.test.mjs test/channels/*/*.test.mjs",check:"npm run build && npm test && node scripts/verify-package.mjs"},engines:{node:">=22.19"},dependencies:{"@tencent-connect/qqbot-connector":"1.2.0","@tencent-connect/qqbot-nodejs":"1.0.4","@wecom/aibot-node-sdk":"1.0.7","dingtalk-stream":"2.1.4",qrcode:"1.5.4"},devDependencies:{"@larksuiteoapi/node-sdk":"1.73.0","@whiskeysockets/baileys":"7.0.0-rc14",esbuild:"0.25.9","https-proxy-agent":"5.0.1",react:"18.3.1","react-dom":"18.3.1","react-test-renderer":"18.3.1"}};var Cce=/^\/(?:stop|steer|version)(?=$|\s)/iu,uce=/^\/stop(?=$|\s)/iu,Bce=/^\/version(?=$|\s)/iu,fce="\u7528\u6CD5\uFF1A/stop\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09",Qce="\u7528\u6CD5\uFF1A/version\uFF08\u4E0D\u5E26\u53C2\u6570\uFF09",yce="\u7528\u6CD5\uFF1A/steer <\u8865\u5145\u6307\u4EE4>",mce="\u63A7\u5236\u547D\u4EE4\u4EC5\u652F\u6301\u7EAF\u6587\u5B57\uFF0C\u8BF7\u79FB\u9664\u56FE\u7247\u540E\u91CD\u8BD5\u3002";function co(n,t={}){return{message:n,...t}}function LH(n){return n?{signal:n}:{}}function UH(n,t,o){if(typeof t?.sessionFor!="function")return null;let i=t.sessionFor(o);if(typeof i!="string"||!i)return null;if(typeof n?.workspaceSession!="function")throw new TypeError("Harness does not support workspace sessions");let e=n.workspaceSession(i);if(!e||typeof e!="object")throw new TypeError("Harness returned an invalid workspace session");return e}function Pi(n){return typeof n=="string"&&Cce.test(n.trim())}async function gi(n,t,o,i,{signal:e,hasImages:a=!1,pendingInteraction:A=!1,control:r}={}){if(!Pi(n))return null;let s=n.trim(),g=uce.test(s),c=Bce.test(s);if(a)return co(D(mce));if(c)return/^\/version$/iu.test(s)?co(`dsh-im v${FH.version}`):co(D(Qce));if(g){if(!/^\/stop$/iu.test(s))return co(D(fce));let Q=UH(t,o,i);if(!Q)return co(D("\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002"));if(typeof Q.stopActiveTurn!="function")throw new TypeError("Harness session does not support stopping active turns");return await Q.stopActiveTurn(r,LH(e))?co(D("\u5DF2\u8BF7\u6C42\u505C\u6B62\u5F53\u524D\u4EFB\u52A1\u3002"),{stopped:!0}):co(D("\u5F53\u524D\u804A\u5929\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\u3002"))}let d=/^\/steer(?:\s+([\s\S]*))?$/iu.exec(s)?.[1]?.trim()??"";if(!d)return co(D(yce));if(A)return co([D("\u5F53\u524D\u4EFB\u52A1\u6B63\u5728\u7B49\u5F85\u4F60\u7684\u56DE\u7B54\u6216\u5BA1\u6279\u3002"),"",D("\u8BF7\u5148\u5904\u7406\u5F53\u524D\u8BF7\u6C42\uFF0C\u6216\u8005\u53D1\u9001 /stop \u505C\u6B62\u4EFB\u52A1\u3002")].join(`
|
|
147
147
|
`));let B=UH(t,o,i);if(!B)return co(D("\u5F53\u524D\u804A\u5929\u6CA1\u6709\u7ED1\u5B9A\u4F1A\u8BDD\uFF0C\u65E0\u6CD5\u8865\u5145\u6307\u4EE4\u3002\u8BF7\u5148\u7ED1\u5B9A\u4F1A\u8BDD\u3002"));if(typeof B.steerActiveTurn!="function")throw new TypeError("Harness session does not support steering active turns");let f=await B.steerActiveTurn(d,r,LH(e));return co(f?D("\u5DF2\u63D0\u4EA4\u8865\u5145\u6307\u4EE4\uFF0CAgent \u4F1A\u5728\u4E0B\u4E00\u6B65\u8BFB\u53D6\u3002"):D("\u4EFB\u52A1\u5DF2\u7ED3\u675F\uFF0C\u6CA1\u6709\u6B63\u5728\u8FD0\u884C\u7684\u4EFB\u52A1\uFF0C\u65E0\u6CD5\u8865\u5145\u6307\u4EE4\u3002\u8BF7\u76F4\u63A5\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u65B0\u4EFB\u52A1\u3002"))}import{realpath as xH,stat as YH}from"node:fs/promises";import{isAbsolute as jH,resolve as Sce}from"node:path";var Dce=/^\/workspace(?:\s+([\s\S]+))?$/i,wce=/^\/workspacelist(?:\s+([\s\S]+))?$/i,Oce=/^\/sessionlist(?:\s+([\s\S]+))?$/i,bce=/^\/session(?=$|\s)/i,Mce=/^\/session[ \t]+([^\s]+)$/i,_ce=4096,Tce=1800,Nce=256,JH=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u,Rce=/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+/gu,qH="\u7528\u6CD5\uFF1A/session Session ID \u6216\u5F53\u524D\u5DE5\u4F5C\u533A\u5E8F\u53F7\uFF08/session N\uFF09",Fl=["\u7528\u6CD5\uFF1A","/sessionlist \u5217\u51FA\u5F53\u524D\u5DE5\u4F5C\u533A\u4F1A\u8BDD","/sessionlist \u5DE5\u4F5C\u533A\u5E8F\u53F7 \u6309 /workspacelist \u5E8F\u53F7\u5217\u51FA\u4F1A\u8BDD","/sessionlist \u5DE5\u4F5C\u533A\u7EDD\u5BF9\u8DEF\u5F84 \u5217\u51FA\u6307\u5B9A\u5DE5\u4F5C\u533A\u4F1A\u8BDD"].join(`
|
|
148
148
|
`);function Pt(n,t=[n]){return{handled:!0,message:n,messages:t}}function Ll(n){return typeof n!="string"||n.length>_ce||!jH(n)||JH.test(n)?null:Sce(n)}function df(n){return typeof n!="string"?"":n.replace(Rce," ").replace(/\s+/gu," ").trim()}function HH(n){return typeof n=="string"&&n.length>0&&n.length<=Nce&&!new RegExp("\\p{White_Space}","u").test(n)&&!JH.test(n)}async function Fb(n){let t=await Promise.all(n.map(async o=>{let i=Ll(o);if(!i)return null;try{return(await YH(i)).isDirectory()?Ll(await xH(i)):null}catch{return null}}));return[...new Set(t.filter(Boolean))]}async function Lb(n){if(typeof n!="string"||!jH(n.trim()))return{error:D(`\u5DE5\u4F5C\u533A\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84\u3002
|
|
149
149
|
{usage}`,{usage:D(Fl)})};let t=Ll(n.trim());if(!t)return{error:D(`\u5DE5\u4F5C\u533A\u8DEF\u5F84\u5305\u542B\u4E0D\u652F\u6301\u7684\u5B57\u7B26\u6216\u957F\u5EA6\u8D85\u8FC7\u9650\u5236\u3002
|
|
@@ -318,7 +318,7 @@ ${i.length>0?i.join(`
|
|
|
318
318
|
</vote>`,resources:[]};let a=[];e.topic&&a.push(e.topic);for(let A of(i=e.options)!==null&&i!==void 0?i:[])a.push(`\u2022 ${A}`);return{content:`<vote>
|
|
319
319
|
${a.join(`
|
|
320
320
|
`)}
|
|
321
|
-
</vote>`,resources:[]}}),t_e=new Map([["text",ZMe],["post",jMe],["image",FMe],["file",vMe],["audio",TMe],["video",$8],["media",$8],["sticker",VMe],["interactive",UMe],["merge_forward",KMe],["share_chat",qMe],["share_user",zMe],["location",HMe],["system",WMe],["vote",A_e],["todo",XMe],["calendar",NMe],["general_calendar",RMe],["share_calendar_event",kMe],["folder",PMe],["hongbao",GMe],["video_chat",e_e]]);function ez(n,t,o){var i;return h(this,void 0,void 0,function*(){let e=(i=t_e.get(t))!==null&&i!==void 0?i:X8;try{return yield e(n,o)}catch{return X8(n)}})}function Qz(n,t){var o,i,e,a,A,r,s,g,c,I,d,B;let f=(i=(o=n.context)===null||o===void 0?void 0:o.open_message_id)!==null&&i!==void 0?i:n.open_message_id,Q=(a=(e=n.context)===null||e===void 0?void 0:e.open_chat_id)!==null&&a!==void 0?a:n.open_chat_id,y=(A=n.operator)===null||A===void 0?void 0:A.open_id;return!f||!Q||!y?null:{messageId:f,chatId:Q,operator:{openId:y,userId:(r=n.operator)===null||r===void 0?void 0:r.user_id,name:(s=n.operator)===null||s===void 0?void 0:s.name},action:{value:(g=n.action)===null||g===void 0?void 0:g.value,tag:(I=(c=n.action)===null||c===void 0?void 0:c.tag)!==null&&I!==void 0?I:"unknown",name:(d=n.action)===null||d===void 0?void 0:d.name,option:(B=n.action)===null||B===void 0?void 0:B.option},raw:t?.includeRaw?n:void 0}}function fk(n,t,o){var i,e,a,A;let r=n.message_id,s=(i=n.reaction_type)===null||i===void 0?void 0:i.emoji_type,g=(e=n.user_id)===null||e===void 0?void 0:e.open_id;if(!r||!s||!g)return null;let c=n.action_time,I=c?parseInt(c,10):void 0;return{messageId:r,operator:{openId:g,userId:(A=(a=n.user_id)===null||a===void 0?void 0:a.user_id)!==null&&A!==void 0?A:void 0},emojiType:s,action:t,actionTime:I!=null&&Number.isFinite(I)?I:void 0,raw:o?.includeRaw?n:void 0}}function yz(n,t){var o,i,e,a,A,r,s,g,c;let I=n.chat_id,d=(o=n.operator_id)===null||o===void 0?void 0:o.open_id;if(!I||!d)return null;let B=(r=(a=(i=n.name)!==null&&i!==void 0?i:(e=n.i18n_names)===null||e===void 0?void 0:e.zh_cn)!==null&&a!==void 0?a:(A=n.i18n_names)===null||A===void 0?void 0:A.en_us)!==null&&r!==void 0?r:(s=n.i18n_names)===null||s===void 0?void 0:s.ja_jp;return{chatId:I,operator:{openId:d,userId:(c=(g=n.operator_id)===null||g===void 0?void 0:g.user_id)!==null&&c!==void 0?c:void 0},botName:B,external:n.external,raw:t?.includeRaw?n:void 0}}function mz(n,t){var o,i,e,a,A,r,s,g,c,I,d,B,f;let Q=(o=n.file_token)!==null&&o!==void 0?o:(i=n.notice_meta)===null||i===void 0?void 0:i.file_token,y=(e=n.file_type)!==null&&e!==void 0?e:(a=n.notice_meta)===null||a===void 0?void 0:a.file_type,m=n.comment_id,_=(r=(A=n.notice_meta)===null||A===void 0?void 0:A.from_user_id)!==null&&r!==void 0?r:n.user_id,N=_?.open_id;if(!Q||!y||!m||!N)return null;let G=(c=(s=n.create_time)!==null&&s!==void 0?s:(g=n.notice_meta)===null||g===void 0?void 0:g.timestamp)!==null&&c!==void 0?c:n.action_time,Y=G?parseInt(G,10):Date.now();return{fileToken:Q,fileType:y,commentId:m,replyId:n.reply_id,operator:{openId:N,userId:(I=_?.user_id)!==null&&I!==void 0?I:void 0,unionId:_?.union_id},mentionedBot:!!((f=(d=n.is_mentioned)!==null&&d!==void 0?d:(B=n.notice_meta)===null||B===void 0?void 0:B.is_mentioned)!==null&&f!==void 0?f:n.is_mention),timestamp:Number.isFinite(Y)?Y:Date.now(),raw:t?.includeRaw?n:void 0}}function Sz(n,t){var o,i,e,a,A;return h(this,void 0,void 0,function*(){let r=n.message,s=(o=t.botIdentity)===null||o===void 0?void 0:o.openId,{mentions:g,mentionsByOpenId:c,mentionList:I,mentionAll:d,mentionedBot:B}=mMe(r.mentions,s),f=d||r_e(r.content),Q={messageId:r.message_id,botOpenId:s,mentions:g,mentionsByOpenId:c,stripBotMentions:(i=t.stripBotMentions)!==null&&i!==void 0?i:!0,fetchSubMessages:t.fetchSubMessages,resolveUserName:t.resolveUserName,batchResolveNames:t.batchResolveNames,dispatch:ez},{content:y,resources:m}=yield ez(r.content,r.message_type,Q),_=SMe(y,Q),N=n.sender.sender_id.open_id,G=(a=(e=n.sender.sender_id.user_id)!==null&&e!==void 0?e:n.sender.sender_id.union_id)!==null&&a!==void 0?a:"",Y=N??G,j=N?(A=t.resolveSenderName)===null||A===void 0?void 0:A.call(t,N):void 0,H=r.create_time?parseInt(r.create_time,10):0;return{messageId:r.message_id,chatId:r.chat_id,chatType:r.chat_type,senderId:Y,senderName:j,content:_,rawContentType:r.message_type,resources:m,mentions:I,mentionAll:f,mentionedBot:B,rootId:r.root_id,threadId:r.thread_id,replyToMessageId:r.parent_id,createTime:Number.isFinite(H)?H:0,raw:t.includeRaw?n:void 0}})}function r_e(n){return n?/@_all\b/.test(n):!1}var Fy=class{constructor(t){var o,i,e,a,A,r,s;this.handlers={},this.connected=!1,this.opts=t,this.logger=new Xg((o=t.loggerLevel)!==null&&o!==void 0?o:ji.info,(i=t.logger)!==null&&i!==void 0?i:Zs),this.rawClient=new _y({appId:t.appId,appSecret:t.appSecret,domain:(e=t.domain)!==null&&e!==void 0?e:zn.Feishu,cache:t.cache,httpInstance:t.httpInstance,logger:t.logger,loggerLevel:t.loggerLevel,source:t.source,extraUaTags:["channel"]}),this.dispatcher=new Ny({verificationToken:(a=t.webhook)===null||a===void 0?void 0:a.verificationToken,encryptKey:(A=t.webhook)===null||A===void 0?void 0:A.encryptKey,cache:t.cache,logger:t.logger,loggerLevel:t.loggerLevel}),this.sender=new pk(this.rawClient,(r=t.outbound)!==null&&r!==void 0?r:{},this.logger),this.safety=new Bk({config:t.safety,policy:t.policy,cache:(s=t.cache)!==null&&s!==void 0?s:wC,logger:this.logger,onReject:g=>{var c,I;(I=(c=this.handlers).reject)===null||I===void 0||I.call(c,g)},onMessage:g=>h(this,void 0,void 0,function*(){let c=this.handlers.message;c&&(yield c(g))})})}connect(){return h(this,void 0,void 0,function*(){return this.connectPromise?this.connectPromise:(this.connectPromise=this.doConnect().catch(t=>{throw this.connectPromise=void 0,t}),this.connectPromise)})}doConnect(){var t;return h(this,void 0,void 0,function*(){this.botIdentity=yield this.fetchBotIdentity(),this.safety.setBotIdentity(this.botIdentity),this.registerDispatcherHandlers(),((t=this.opts.transport)!==null&&t!==void 0?t:"websocket")==="websocket"&&(yield this.connectWebSocket(15e3)),this.connected=!0})}connectWebSocket(t){return new Promise((o,i)=>{var e;let a=!1,A=setTimeout(()=>{a||(a=!0,i(new Rt("not_connected",`WebSocket handshake did not complete within ${t}ms`)))},t);this.rawWsClient=new ky({appId:this.opts.appId,appSecret:this.opts.appSecret,domain:(e=this.opts.domain)!==null&&e!==void 0?e:zn.Feishu,logger:this.opts.logger,loggerLevel:this.opts.loggerLevel,httpInstance:this.opts.httpInstance,autoReconnect:!0,source:this.opts.source,extraUaTags:["channel"],agent:this.opts.agent,wsConfig:this.opts.wsConfig,handshakeTimeoutMs:this.opts.handshakeTimeoutMs,onReady:()=>{a||(a=!0,clearTimeout(A),o())},onError:r=>{a||(a=!0,clearTimeout(A),i(new Rt("not_connected",`WebSocket connect failed: ${r.message}`,{cause:r})))},onReconnecting:()=>{var r,s;return(s=(r=this.handlers).reconnecting)===null||s===void 0?void 0:s.call(r)},onReconnected:()=>{var r,s;return(s=(r=this.handlers).reconnected)===null||s===void 0?void 0:s.call(r)}}),this.rawWsClient.start({eventDispatcher:this.dispatcher})})}disconnect(){var t;return h(this,void 0,void 0,function*(){if(this.connected){try{(t=this.rawWsClient)===null||t===void 0||t.close({})}catch{}try{yield this.safety.dispose()}catch{}this.connected=!1,this.connectPromise=void 0}})}getConnectionStatus(){var t;return(t=this.rawWsClient)===null||t===void 0?void 0:t.getConnectionStatus()}on(t,o){if(typeof t=="string")return this.attachSingle(t,o);let i=[];return Object.keys(t).forEach(e=>{let a=t[e];a&&i.push(this.attachSingle(e,a))}),()=>i.forEach(e=>e())}attachSingle(t,o){return this.handlers[t]&&this.logger.warn(`channel: handler for "${t}" is being overwritten`),this.handlers[t]=o,()=>{this.handlers[t]===o&&delete this.handlers[t]}}send(t,o,i){return h(this,void 0,void 0,function*(){return this.sender.send(t,o,i)})}stream(t,o,i){return h(this,void 0,void 0,function*(){return this.sender.stream(t,o,i)})}updateCard(t,o){return h(this,void 0,void 0,function*(){yield this.sender.patchCard(t,o)})}editMessage(t,o){return h(this,void 0,void 0,function*(){yield this.rawClient.im.v1.message.update({path:{message_id:t},data:{msg_type:"text",content:JSON.stringify({text:o})}})})}recallMessage(t){return h(this,void 0,void 0,function*(){yield this.rawClient.im.v1.message.delete({path:{message_id:t}})})}addReaction(t,o){var i,e;return h(this,void 0,void 0,function*(){let a=yield this.rawClient.im.v1.messageReaction.create({path:{message_id:t},data:{reaction_type:{emoji_type:o}}}),A=(e=(i=a?.data)===null||i===void 0?void 0:i.reaction_id)!==null&&e!==void 0?e:a?.reaction_id;if(!A)throw new Rt("unknown","messageReaction.create returned no reaction_id");return A})}removeReaction(t,o){return h(this,void 0,void 0,function*(){yield this.rawClient.im.v1.messageReaction.delete({path:{message_id:t,reaction_id:o}})})}removeReactionByEmoji(t,o){var i,e;return h(this,void 0,void 0,function*(){let a=yield this.rawClient.im.v1.messageReaction.list({path:{message_id:t},params:{reaction_type:o,page_size:50}}),r=((e=(i=a?.data)===null||i===void 0?void 0:i.items)!==null&&e!==void 0?e:[]).find(s=>{var g;return((g=s.operator)===null||g===void 0?void 0:g.operator_type)==="app"});return r?.reaction_id?(yield this.removeReaction(t,r.reaction_id),!0):!1})}downloadResource(t,o){return h(this,void 0,void 0,function*(){if(o==="image"){let e=yield this.rawClient.im.v1.image.get({path:{image_key:t}});return yield Az(e)}let i=yield this.rawClient.im.v1.file.get({path:{file_key:t}});return yield Az(i)})}getChatInfo(t){var o,i;return h(this,void 0,void 0,function*(){let a=(o=(yield this.rawClient.im.v1.chat.get({path:{chat_id:t}})).data)!==null&&o!==void 0?o:{};return{chatId:t,name:a.name,description:a.description,chatType:(i=a.chat_mode)!==null&&i!==void 0?i:"group",ownerId:a.owner_id,memberCount:a.user_count}})}getChatMode(t){var o;return h(this,void 0,void 0,function*(){let e=(o=(yield this.rawClient.im.v1.chat.get({path:{chat_id:t}})).data)===null||o===void 0?void 0:o.chat_mode;return e==="p2p"?"p2p":e==="topic"?"topic":"group"})}updatePolicy(t){this.safety.updatePolicy(t)}getPolicy(){return this.safety.getPolicy()}fetchBotIdentity(){var t;return h(this,void 0,void 0,function*(){let o;try{let a=yield this.rawClient.request({url:"/open-apis/bot/v3/info",method:"GET"}),A=a.bot;if(A?.open_id)return{openId:A.open_id,name:(t=A.app_name)!==null&&t!==void 0?t:"bot"};o=new Error(`bot/v3/info response missing open_id: ${JSON.stringify(a).slice(0,200)}`)}catch(a){o=a}let i=Mk(o),e=i.code==="unknown"?"not_connected":i.code;throw new Rt(e,"could not resolve bot identity via /open-apis/bot/v3/info \u2014 required for channel to function",{cause:o})})}registerDispatcherHandlers(){var t,o;let i=A=>h(this,void 0,void 0,function*(){var r,s,g,c;try{return(s=(r=(yield this.rawClient.im.v1.message.get({path:{message_id:A}})).data)===null||r===void 0?void 0:r.items)!==null&&s!==void 0?s:[]}catch(I){return(c=(g=this.logger).warn)===null||c===void 0||c.call(g,"channel: fetchSubMessages failed",I),[]}}),e=(o=(t=this.opts.includeRawEvent)!==null&&t!==void 0?t:this.opts.includeRawInMessage)!==null&&o!==void 0?o:!1,a={botIdentity:this.botIdentity,stripBotMentions:!0,includeRaw:e,fetchSubMessages:i};this.dispatcher.register({"im.message.receive_v1":A=>h(this,void 0,void 0,function*(){try{let r=yield Sz(A,a);yield this.safety.pushMessage(r)}catch(r){this.emitError(r)}}),"card.action.trigger":A=>h(this,void 0,void 0,function*(){let r=Qz(A,{includeRaw:e});if(!r)return;let s=o_e(r.action);yield this.safety.pushAction(`card:${r.messageId}:${r.operator.openId}:${s}`,r.chatId,()=>h(this,void 0,void 0,function*(){let g=this.handlers.cardAction;g&&(yield g(r))}))}),"im.message.reaction.created_v1":A=>h(this,void 0,void 0,function*(){let r=fk(A,"added",{includeRaw:e});if(!r)return;let s=tz(r);yield this.safety.pushLight(s,()=>{var g,c;return(c=(g=this.handlers).reaction)===null||c===void 0?void 0:c.call(g,r)})}),"im.message.reaction.deleted_v1":A=>h(this,void 0,void 0,function*(){let r=fk(A,"removed",{includeRaw:e});if(!r)return;let s=tz(r);yield this.safety.pushLight(s,()=>{var g,c;return(c=(g=this.handlers).reaction)===null||c===void 0?void 0:c.call(g,r)})}),"im.chat.member.bot.added_v1":A=>{var r,s;let g=yz(A,{includeRaw:e});if(g)try{(s=(r=this.handlers).botAdded)===null||s===void 0||s.call(r,g)}catch(c){this.emitError(c)}},"drive.notice.comment_add_v1":A=>h(this,void 0,void 0,function*(){var r;let s=mz(A,{includeRaw:e});s&&(yield this.safety.pushAction(`comment:${s.fileToken}:${s.commentId}:${(r=s.replyId)!==null&&r!==void 0?r:""}`,s.fileToken,()=>h(this,void 0,void 0,function*(){let g=this.handlers.comment;g&&(yield g(s))})))})})}emitError(t){var o,i,e;let a=t instanceof Rt?t:new Rt("unknown",String((o=t?.message)!==null&&o!==void 0?o:t),{cause:t}),A=this.handlers.error;A?A(a):(e=(i=this.logger).error)===null||e===void 0||e.call(i,"channel: unhandled error",a)}};function a_e(n){return new Fy(n)}function Az(n){return h(this,void 0,void 0,function*(){if(Buffer.isBuffer(n))return n;if(n instanceof Uint8Array)return Buffer.from(n);if(typeof n=="object"&&n!==null){let t=n;if(typeof t.getReadableStream=="function")return yield i_e(t.getReadableStream());if(Buffer.isBuffer(t.data))return t.data;if(t.data instanceof Uint8Array)return Buffer.from(t.data)}throw new Rt("unknown","unexpected download response type")})}function i_e(n){return new Promise((t,o)=>{let i=[];n.on("data",e=>{i.push(Buffer.isBuffer(e)?e:Buffer.from(e))}),n.on("end",()=>t(Buffer.concat(i))),n.on("error",o)})}function tz(n){var t;return`rx:${n.messageId}:${n.operator.openId}:${n.emojiType}:${n.action}:${(t=n.actionTime)!==null&&t!==void 0?t:0}`}function o_e(n){var t,o,i;let e=typeof n.value=="string"?n.value:JSON.stringify((t=n.value)!==null&&t!==void 0?t:""),a=e.length>128?e.slice(0,128):e;return`${n.tag}|${(o=n.name)!==null&&o!==void 0?o:""}|${(i=n.option)!==null&&i!==void 0?i:""}|${a}`}var CV=ze(N_(),1);var Dz=Object.freeze([250,1e3,3e3,5e3,1e4,3e4]);function wz(n,t){return Number.isFinite(n)&&n>=0?n:t}function n_e(n){if(!Array.isArray(n)||n.length===0)return[...Dz];let t=n.map(o=>wz(o,-1)).filter(o=>o>=0);return t.length>0?t:[...Dz]}function s_e(n){let t=Number.isInteger(n?.totals?.configured)?n.totals.configured:Array.isArray(n?.bots)?n.bots.length:0,o=Number.isInteger(n?.totals?.connected)?n.totals.connected:Array.isArray(n?.bots)?n.bots.filter(i=>i?.connected===!0).length:0;return{configured:t,connected:o}}var Uy=class{#e;#A;#t;#r;#a;#i;#c;#s=null;#I=null;#o=0;#n=!1;#g=!1;#l;#p;constructor({controller:t,harness:o,logger:i=console,retryDelaysMs:e,healthyIntervalMs:a=15e3,setTimeoutImpl:A=setTimeout,clearTimeoutImpl:r=clearTimeout}){if(!t||typeof t.initialize!="function"||typeof t.status!="function")throw new TypeError("ConnectionSupervisor requires a controller");if(!o||typeof o.ensureRunning!="function")throw new TypeError("ConnectionSupervisor requires a Harness client");this.#e=t,this.#A=o,this.#t=i,this.#r=n_e(e),this.#a=wz(a,15e3),this.#i=A,this.#c=r,this.#l=new Promise(s=>{this.#p=s})}get ready(){return this.#l}start(){return this.#n||this.#g?this:(this.#n=!0,this.#d(0),this)}async close(){this.#g||(this.#g=!0,this.#s!==null&&(this.#c(this.#s),this.#s=null),await this.#I?.catch(()=>{}),this.#p?.(null),this.#p=null)}#d(t){this.#g||(this.#s=this.#i(()=>{this.#s=null,this.#h()},t),this.#s?.unref?.())}async#h(){if(this.#g||this.#I)return;let t=this.#E();this.#I=t;try{await t}finally{this.#I===t&&(this.#I=null)}}async#E(){try{await this.#A.ensureRunning()}catch(t){if(this.#g)return;this.#u("Harness Host is not ready",t);return}if(!this.#g)try{if(await this.#e.initialize(),this.#g)return;let t=await this.#e.status();this.#p?.(t),this.#p=null;let o=s_e(t);if(o.connected<o.configured){let i=this.#r[Math.min(this.#o,this.#r.length-1)];this.#o+=1,this.#t.warn?.(`[dsh-feishu] ${o.connected}/${o.configured} bots connected; retrying automatically in ${i}ms`),this.#d(i);return}this.#o=0,this.#d(this.#a)}catch(t){if(this.#g)return;this.#u("Bot connection reconciliation failed",t)}}#u(t,o){let i=this.#r[Math.min(this.#o,this.#r.length-1)];this.#o+=1,this.#t.warn?.(`[dsh-feishu] ${t}; retrying automatically in ${i}ms`,o),this.#d(i)}};function Nk(n){return new Uy(n)}function Oz(n,t){let o=n==="lark"?"https://open.larksuite.com":"https://open.feishu.cn";return new URL(t,o)}function bz(n,t){if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${t} returned a non-JSON response`);if(n.code!==0)throw new Error(`${t} failed: ${n.msg||`code ${n.code}`}`);return n}async function Mz({appId:n,appSecret:t,domain:o="feishu",httpInstance:i,timeoutMs:e=15e3}){if(!n||!t)throw new Error("Feishu credentials are incomplete");if(!i||typeof i.request!="function")throw new TypeError("Feishu verification requires an HTTP instance");let a=bz(await i.request({method:"POST",url:Oz(o,"/open-apis/auth/v3/tenant_access_token/internal").href,headers:{"content-type":"application/json; charset=utf-8"},data:{app_id:n,app_secret:t},signal:AbortSignal.timeout(e),timeout:e}),"Feishu authentication");if(!a.tenant_access_token)throw new Error("Feishu authentication returned no tenant access token");let r=bz(await i.request({method:"GET",url:Oz(o,"/open-apis/bot/v3/info/").href,headers:{authorization:`Bearer ${a.tenant_access_token}`},signal:AbortSignal.timeout(e),timeout:e}),"Feishu bot verification").bot??{};return Object.freeze({appId:n,name:r.app_name??r.bot_name??null,openId:r.open_id??null,activated:r.activate_status??null})}import{randomUUID as hTe}from"node:crypto";import R_e from"qrcode";var Hy=99991672,g_e=64*1024,c_e=1e3,I_e="\u98DE\u4E66\u673A\u5668\u4EBA\u7F3A\u5C11\u56FE\u7247\u8BFB\u53D6\u6743\u9650 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u63D2\u4EF6\u9875\u9762\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u6309\u98DE\u4E66\u63D0\u793A\u53D1\u5E03\u65B0\u7248\u672C\u3001\u5B8C\u6210\u5FC5\u8981\u5BA1\u6279\u540E\uFF0C\u518D\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002";function _z(n){if(n?.message?.chat_type==="p2p"){let i=n?.sender?.sender_id?.open_id||n?.sender?.sender_id?.user_id;if(!i)throw new Error("Feishu p2p event has no sender id");return`p2p:${i}`}let o=n?.message?.chat_id;if(!o)throw new Error("Feishu group event has no chat id");return`group:${o}`}function vk(n){let t=n?.message?.content;if(t&&typeof t=="object")return t;if(typeof t!="string")return null;try{let o=JSON.parse(t);return o&&typeof o=="object"?o:null}catch{return null}}function kk(n,t){let o=typeof n=="string"?n:"";for(let i of t?.message?.mentions??[])typeof i?.key=="string"&&i.key&&(o=o.replaceAll(i.key,""));return o.trim()}function zp(n){if(n?.message?.message_type!=="text")return null;let t=vk(n);return t?kk(t.text,n):null}function qp(n){return typeof n=="string"&&n.trim()?n.trim():null}function l_e(n,t=vk(n)){if(n?.message?.message_type!=="post"||!t)return null;let o=[],i=qp(kk(t.title,n));i&&o.push(i);let e=[];for(let a of Array.isArray(t.content)?t.content:[]){if(!Array.isArray(a))continue;let A="";for(let s of a){let g=String(s?.tag??"").toLowerCase();if(g==="img"){let c=qp(s?.image_key);c&&e.push(c)}else(g==="text"||g==="a"||g==="link")&&typeof s?.text=="string"&&(A+=s.text)}let r=qp(kk(A,n));r&&o.push(r)}return{text:o.join(`
|
|
321
|
+
</vote>`,resources:[]}}),t_e=new Map([["text",ZMe],["post",jMe],["image",FMe],["file",vMe],["audio",TMe],["video",$8],["media",$8],["sticker",VMe],["interactive",UMe],["merge_forward",KMe],["share_chat",qMe],["share_user",zMe],["location",HMe],["system",WMe],["vote",A_e],["todo",XMe],["calendar",NMe],["general_calendar",RMe],["share_calendar_event",kMe],["folder",PMe],["hongbao",GMe],["video_chat",e_e]]);function ez(n,t,o){var i;return h(this,void 0,void 0,function*(){let e=(i=t_e.get(t))!==null&&i!==void 0?i:X8;try{return yield e(n,o)}catch{return X8(n)}})}function Qz(n,t){var o,i,e,a,A,r,s,g,c,I,d,B;let f=(i=(o=n.context)===null||o===void 0?void 0:o.open_message_id)!==null&&i!==void 0?i:n.open_message_id,Q=(a=(e=n.context)===null||e===void 0?void 0:e.open_chat_id)!==null&&a!==void 0?a:n.open_chat_id,y=(A=n.operator)===null||A===void 0?void 0:A.open_id;return!f||!Q||!y?null:{messageId:f,chatId:Q,operator:{openId:y,userId:(r=n.operator)===null||r===void 0?void 0:r.user_id,name:(s=n.operator)===null||s===void 0?void 0:s.name},action:{value:(g=n.action)===null||g===void 0?void 0:g.value,tag:(I=(c=n.action)===null||c===void 0?void 0:c.tag)!==null&&I!==void 0?I:"unknown",name:(d=n.action)===null||d===void 0?void 0:d.name,option:(B=n.action)===null||B===void 0?void 0:B.option},raw:t?.includeRaw?n:void 0}}function fk(n,t,o){var i,e,a,A;let r=n.message_id,s=(i=n.reaction_type)===null||i===void 0?void 0:i.emoji_type,g=(e=n.user_id)===null||e===void 0?void 0:e.open_id;if(!r||!s||!g)return null;let c=n.action_time,I=c?parseInt(c,10):void 0;return{messageId:r,operator:{openId:g,userId:(A=(a=n.user_id)===null||a===void 0?void 0:a.user_id)!==null&&A!==void 0?A:void 0},emojiType:s,action:t,actionTime:I!=null&&Number.isFinite(I)?I:void 0,raw:o?.includeRaw?n:void 0}}function yz(n,t){var o,i,e,a,A,r,s,g,c;let I=n.chat_id,d=(o=n.operator_id)===null||o===void 0?void 0:o.open_id;if(!I||!d)return null;let B=(r=(a=(i=n.name)!==null&&i!==void 0?i:(e=n.i18n_names)===null||e===void 0?void 0:e.zh_cn)!==null&&a!==void 0?a:(A=n.i18n_names)===null||A===void 0?void 0:A.en_us)!==null&&r!==void 0?r:(s=n.i18n_names)===null||s===void 0?void 0:s.ja_jp;return{chatId:I,operator:{openId:d,userId:(c=(g=n.operator_id)===null||g===void 0?void 0:g.user_id)!==null&&c!==void 0?c:void 0},botName:B,external:n.external,raw:t?.includeRaw?n:void 0}}function mz(n,t){var o,i,e,a,A,r,s,g,c,I,d,B,f;let Q=(o=n.file_token)!==null&&o!==void 0?o:(i=n.notice_meta)===null||i===void 0?void 0:i.file_token,y=(e=n.file_type)!==null&&e!==void 0?e:(a=n.notice_meta)===null||a===void 0?void 0:a.file_type,m=n.comment_id,_=(r=(A=n.notice_meta)===null||A===void 0?void 0:A.from_user_id)!==null&&r!==void 0?r:n.user_id,N=_?.open_id;if(!Q||!y||!m||!N)return null;let G=(c=(s=n.create_time)!==null&&s!==void 0?s:(g=n.notice_meta)===null||g===void 0?void 0:g.timestamp)!==null&&c!==void 0?c:n.action_time,Y=G?parseInt(G,10):Date.now();return{fileToken:Q,fileType:y,commentId:m,replyId:n.reply_id,operator:{openId:N,userId:(I=_?.user_id)!==null&&I!==void 0?I:void 0,unionId:_?.union_id},mentionedBot:!!((f=(d=n.is_mentioned)!==null&&d!==void 0?d:(B=n.notice_meta)===null||B===void 0?void 0:B.is_mentioned)!==null&&f!==void 0?f:n.is_mention),timestamp:Number.isFinite(Y)?Y:Date.now(),raw:t?.includeRaw?n:void 0}}function Sz(n,t){var o,i,e,a,A;return h(this,void 0,void 0,function*(){let r=n.message,s=(o=t.botIdentity)===null||o===void 0?void 0:o.openId,{mentions:g,mentionsByOpenId:c,mentionList:I,mentionAll:d,mentionedBot:B}=mMe(r.mentions,s),f=d||r_e(r.content),Q={messageId:r.message_id,botOpenId:s,mentions:g,mentionsByOpenId:c,stripBotMentions:(i=t.stripBotMentions)!==null&&i!==void 0?i:!0,fetchSubMessages:t.fetchSubMessages,resolveUserName:t.resolveUserName,batchResolveNames:t.batchResolveNames,dispatch:ez},{content:y,resources:m}=yield ez(r.content,r.message_type,Q),_=SMe(y,Q),N=n.sender.sender_id.open_id,G=(a=(e=n.sender.sender_id.user_id)!==null&&e!==void 0?e:n.sender.sender_id.union_id)!==null&&a!==void 0?a:"",Y=N??G,j=N?(A=t.resolveSenderName)===null||A===void 0?void 0:A.call(t,N):void 0,H=r.create_time?parseInt(r.create_time,10):0;return{messageId:r.message_id,chatId:r.chat_id,chatType:r.chat_type,senderId:Y,senderName:j,content:_,rawContentType:r.message_type,resources:m,mentions:I,mentionAll:f,mentionedBot:B,rootId:r.root_id,threadId:r.thread_id,replyToMessageId:r.parent_id,createTime:Number.isFinite(H)?H:0,raw:t.includeRaw?n:void 0}})}function r_e(n){return n?/@_all\b/.test(n):!1}var Fy=class{constructor(t){var o,i,e,a,A,r,s;this.handlers={},this.connected=!1,this.opts=t,this.logger=new Xg((o=t.loggerLevel)!==null&&o!==void 0?o:ji.info,(i=t.logger)!==null&&i!==void 0?i:Zs),this.rawClient=new _y({appId:t.appId,appSecret:t.appSecret,domain:(e=t.domain)!==null&&e!==void 0?e:zn.Feishu,cache:t.cache,httpInstance:t.httpInstance,logger:t.logger,loggerLevel:t.loggerLevel,source:t.source,extraUaTags:["channel"]}),this.dispatcher=new Ny({verificationToken:(a=t.webhook)===null||a===void 0?void 0:a.verificationToken,encryptKey:(A=t.webhook)===null||A===void 0?void 0:A.encryptKey,cache:t.cache,logger:t.logger,loggerLevel:t.loggerLevel}),this.sender=new pk(this.rawClient,(r=t.outbound)!==null&&r!==void 0?r:{},this.logger),this.safety=new Bk({config:t.safety,policy:t.policy,cache:(s=t.cache)!==null&&s!==void 0?s:wC,logger:this.logger,onReject:g=>{var c,I;(I=(c=this.handlers).reject)===null||I===void 0||I.call(c,g)},onMessage:g=>h(this,void 0,void 0,function*(){let c=this.handlers.message;c&&(yield c(g))})})}connect(){return h(this,void 0,void 0,function*(){return this.connectPromise?this.connectPromise:(this.connectPromise=this.doConnect().catch(t=>{throw this.connectPromise=void 0,t}),this.connectPromise)})}doConnect(){var t;return h(this,void 0,void 0,function*(){this.botIdentity=yield this.fetchBotIdentity(),this.safety.setBotIdentity(this.botIdentity),this.registerDispatcherHandlers(),((t=this.opts.transport)!==null&&t!==void 0?t:"websocket")==="websocket"&&(yield this.connectWebSocket(15e3)),this.connected=!0})}connectWebSocket(t){return new Promise((o,i)=>{var e;let a=!1,A=setTimeout(()=>{a||(a=!0,i(new Rt("not_connected",`WebSocket handshake did not complete within ${t}ms`)))},t);this.rawWsClient=new ky({appId:this.opts.appId,appSecret:this.opts.appSecret,domain:(e=this.opts.domain)!==null&&e!==void 0?e:zn.Feishu,logger:this.opts.logger,loggerLevel:this.opts.loggerLevel,httpInstance:this.opts.httpInstance,autoReconnect:!0,source:this.opts.source,extraUaTags:["channel"],agent:this.opts.agent,wsConfig:this.opts.wsConfig,handshakeTimeoutMs:this.opts.handshakeTimeoutMs,onReady:()=>{a||(a=!0,clearTimeout(A),o())},onError:r=>{a||(a=!0,clearTimeout(A),i(new Rt("not_connected",`WebSocket connect failed: ${r.message}`,{cause:r})))},onReconnecting:()=>{var r,s;return(s=(r=this.handlers).reconnecting)===null||s===void 0?void 0:s.call(r)},onReconnected:()=>{var r,s;return(s=(r=this.handlers).reconnected)===null||s===void 0?void 0:s.call(r)}}),this.rawWsClient.start({eventDispatcher:this.dispatcher})})}disconnect(){var t;return h(this,void 0,void 0,function*(){if(this.connected){try{(t=this.rawWsClient)===null||t===void 0||t.close({})}catch{}try{yield this.safety.dispose()}catch{}this.connected=!1,this.connectPromise=void 0}})}getConnectionStatus(){var t;return(t=this.rawWsClient)===null||t===void 0?void 0:t.getConnectionStatus()}on(t,o){if(typeof t=="string")return this.attachSingle(t,o);let i=[];return Object.keys(t).forEach(e=>{let a=t[e];a&&i.push(this.attachSingle(e,a))}),()=>i.forEach(e=>e())}attachSingle(t,o){return this.handlers[t]&&this.logger.warn(`channel: handler for "${t}" is being overwritten`),this.handlers[t]=o,()=>{this.handlers[t]===o&&delete this.handlers[t]}}send(t,o,i){return h(this,void 0,void 0,function*(){return this.sender.send(t,o,i)})}stream(t,o,i){return h(this,void 0,void 0,function*(){return this.sender.stream(t,o,i)})}updateCard(t,o){return h(this,void 0,void 0,function*(){yield this.sender.patchCard(t,o)})}editMessage(t,o){return h(this,void 0,void 0,function*(){yield this.rawClient.im.v1.message.update({path:{message_id:t},data:{msg_type:"text",content:JSON.stringify({text:o})}})})}recallMessage(t){return h(this,void 0,void 0,function*(){yield this.rawClient.im.v1.message.delete({path:{message_id:t}})})}addReaction(t,o){var i,e;return h(this,void 0,void 0,function*(){let a=yield this.rawClient.im.v1.messageReaction.create({path:{message_id:t},data:{reaction_type:{emoji_type:o}}}),A=(e=(i=a?.data)===null||i===void 0?void 0:i.reaction_id)!==null&&e!==void 0?e:a?.reaction_id;if(!A)throw new Rt("unknown","messageReaction.create returned no reaction_id");return A})}removeReaction(t,o){return h(this,void 0,void 0,function*(){yield this.rawClient.im.v1.messageReaction.delete({path:{message_id:t,reaction_id:o}})})}removeReactionByEmoji(t,o){var i,e;return h(this,void 0,void 0,function*(){let a=yield this.rawClient.im.v1.messageReaction.list({path:{message_id:t},params:{reaction_type:o,page_size:50}}),r=((e=(i=a?.data)===null||i===void 0?void 0:i.items)!==null&&e!==void 0?e:[]).find(s=>{var g;return((g=s.operator)===null||g===void 0?void 0:g.operator_type)==="app"});return r?.reaction_id?(yield this.removeReaction(t,r.reaction_id),!0):!1})}downloadResource(t,o){return h(this,void 0,void 0,function*(){if(o==="image"){let e=yield this.rawClient.im.v1.image.get({path:{image_key:t}});return yield Az(e)}let i=yield this.rawClient.im.v1.file.get({path:{file_key:t}});return yield Az(i)})}getChatInfo(t){var o,i;return h(this,void 0,void 0,function*(){let a=(o=(yield this.rawClient.im.v1.chat.get({path:{chat_id:t}})).data)!==null&&o!==void 0?o:{};return{chatId:t,name:a.name,description:a.description,chatType:(i=a.chat_mode)!==null&&i!==void 0?i:"group",ownerId:a.owner_id,memberCount:a.user_count}})}getChatMode(t){var o;return h(this,void 0,void 0,function*(){let e=(o=(yield this.rawClient.im.v1.chat.get({path:{chat_id:t}})).data)===null||o===void 0?void 0:o.chat_mode;return e==="p2p"?"p2p":e==="topic"?"topic":"group"})}updatePolicy(t){this.safety.updatePolicy(t)}getPolicy(){return this.safety.getPolicy()}fetchBotIdentity(){var t;return h(this,void 0,void 0,function*(){let o;try{let a=yield this.rawClient.request({url:"/open-apis/bot/v3/info",method:"GET"}),A=a.bot;if(A?.open_id)return{openId:A.open_id,name:(t=A.app_name)!==null&&t!==void 0?t:"bot"};o=new Error(`bot/v3/info response missing open_id: ${JSON.stringify(a).slice(0,200)}`)}catch(a){o=a}let i=Mk(o),e=i.code==="unknown"?"not_connected":i.code;throw new Rt(e,"could not resolve bot identity via /open-apis/bot/v3/info \u2014 required for channel to function",{cause:o})})}registerDispatcherHandlers(){var t,o;let i=A=>h(this,void 0,void 0,function*(){var r,s,g,c;try{return(s=(r=(yield this.rawClient.im.v1.message.get({path:{message_id:A}})).data)===null||r===void 0?void 0:r.items)!==null&&s!==void 0?s:[]}catch(I){return(c=(g=this.logger).warn)===null||c===void 0||c.call(g,"channel: fetchSubMessages failed",I),[]}}),e=(o=(t=this.opts.includeRawEvent)!==null&&t!==void 0?t:this.opts.includeRawInMessage)!==null&&o!==void 0?o:!1,a={botIdentity:this.botIdentity,stripBotMentions:!0,includeRaw:e,fetchSubMessages:i};this.dispatcher.register({"im.message.receive_v1":A=>h(this,void 0,void 0,function*(){try{let r=yield Sz(A,a);yield this.safety.pushMessage(r)}catch(r){this.emitError(r)}}),"card.action.trigger":A=>h(this,void 0,void 0,function*(){let r=Qz(A,{includeRaw:e});if(!r)return;let s=o_e(r.action);yield this.safety.pushAction(`card:${r.messageId}:${r.operator.openId}:${s}`,r.chatId,()=>h(this,void 0,void 0,function*(){let g=this.handlers.cardAction;g&&(yield g(r))}))}),"im.message.reaction.created_v1":A=>h(this,void 0,void 0,function*(){let r=fk(A,"added",{includeRaw:e});if(!r)return;let s=tz(r);yield this.safety.pushLight(s,()=>{var g,c;return(c=(g=this.handlers).reaction)===null||c===void 0?void 0:c.call(g,r)})}),"im.message.reaction.deleted_v1":A=>h(this,void 0,void 0,function*(){let r=fk(A,"removed",{includeRaw:e});if(!r)return;let s=tz(r);yield this.safety.pushLight(s,()=>{var g,c;return(c=(g=this.handlers).reaction)===null||c===void 0?void 0:c.call(g,r)})}),"im.chat.member.bot.added_v1":A=>{var r,s;let g=yz(A,{includeRaw:e});if(g)try{(s=(r=this.handlers).botAdded)===null||s===void 0||s.call(r,g)}catch(c){this.emitError(c)}},"drive.notice.comment_add_v1":A=>h(this,void 0,void 0,function*(){var r;let s=mz(A,{includeRaw:e});s&&(yield this.safety.pushAction(`comment:${s.fileToken}:${s.commentId}:${(r=s.replyId)!==null&&r!==void 0?r:""}`,s.fileToken,()=>h(this,void 0,void 0,function*(){let g=this.handlers.comment;g&&(yield g(s))})))})})}emitError(t){var o,i,e;let a=t instanceof Rt?t:new Rt("unknown",String((o=t?.message)!==null&&o!==void 0?o:t),{cause:t}),A=this.handlers.error;A?A(a):(e=(i=this.logger).error)===null||e===void 0||e.call(i,"channel: unhandled error",a)}};function a_e(n){return new Fy(n)}function Az(n){return h(this,void 0,void 0,function*(){if(Buffer.isBuffer(n))return n;if(n instanceof Uint8Array)return Buffer.from(n);if(typeof n=="object"&&n!==null){let t=n;if(typeof t.getReadableStream=="function")return yield i_e(t.getReadableStream());if(Buffer.isBuffer(t.data))return t.data;if(t.data instanceof Uint8Array)return Buffer.from(t.data)}throw new Rt("unknown","unexpected download response type")})}function i_e(n){return new Promise((t,o)=>{let i=[];n.on("data",e=>{i.push(Buffer.isBuffer(e)?e:Buffer.from(e))}),n.on("end",()=>t(Buffer.concat(i))),n.on("error",o)})}function tz(n){var t;return`rx:${n.messageId}:${n.operator.openId}:${n.emojiType}:${n.action}:${(t=n.actionTime)!==null&&t!==void 0?t:0}`}function o_e(n){var t,o,i;let e=typeof n.value=="string"?n.value:JSON.stringify((t=n.value)!==null&&t!==void 0?t:""),a=e.length>128?e.slice(0,128):e;return`${n.tag}|${(o=n.name)!==null&&o!==void 0?o:""}|${(i=n.option)!==null&&i!==void 0?i:""}|${a}`}var CV=ze(N_(),1);var Dz=Object.freeze([250,1e3,3e3,5e3,1e4,3e4]);function wz(n,t){return Number.isFinite(n)&&n>=0?n:t}function n_e(n){if(!Array.isArray(n)||n.length===0)return[...Dz];let t=n.map(o=>wz(o,-1)).filter(o=>o>=0);return t.length>0?t:[...Dz]}function s_e(n){let t=Number.isInteger(n?.totals?.configured)?n.totals.configured:Array.isArray(n?.bots)?n.bots.length:0,o=Number.isInteger(n?.totals?.connected)?n.totals.connected:Array.isArray(n?.bots)?n.bots.filter(i=>i?.connected===!0).length:0;return{configured:t,connected:o}}var Uy=class{#e;#A;#t;#r;#a;#i;#c;#s=null;#I=null;#o=0;#n=!1;#g=!1;#l;#p;constructor({controller:t,harness:o,logger:i=console,retryDelaysMs:e,healthyIntervalMs:a=15e3,setTimeoutImpl:A=setTimeout,clearTimeoutImpl:r=clearTimeout}){if(!t||typeof t.initialize!="function"||typeof t.status!="function")throw new TypeError("ConnectionSupervisor requires a controller");if(!o||typeof o.ensureRunning!="function")throw new TypeError("ConnectionSupervisor requires a Harness client");this.#e=t,this.#A=o,this.#t=i,this.#r=n_e(e),this.#a=wz(a,15e3),this.#i=A,this.#c=r,this.#l=new Promise(s=>{this.#p=s})}get ready(){return this.#l}start(){return this.#n||this.#g?this:(this.#n=!0,this.#d(0),this)}async close(){this.#g||(this.#g=!0,this.#s!==null&&(this.#c(this.#s),this.#s=null),await this.#I?.catch(()=>{}),this.#p?.(null),this.#p=null)}#d(t){this.#g||(this.#s=this.#i(()=>{this.#s=null,this.#h()},t),this.#s?.unref?.())}async#h(){if(this.#g||this.#I)return;let t=this.#E();this.#I=t;try{await t}finally{this.#I===t&&(this.#I=null)}}async#E(){try{await this.#A.ensureRunning()}catch(t){if(this.#g)return;this.#u("Harness Host is not ready",t);return}if(!this.#g)try{if(await this.#e.initialize(),this.#g)return;let t=await this.#e.status();this.#p?.(t),this.#p=null;let o=s_e(t);if(o.connected<o.configured){let i=this.#r[Math.min(this.#o,this.#r.length-1)];this.#o+=1,this.#t.warn?.(`[dsh-feishu] ${o.connected}/${o.configured} bots connected; retrying automatically in ${i}ms`),this.#d(i);return}this.#o=0,this.#d(this.#a)}catch(t){if(this.#g)return;this.#u("Bot connection reconciliation failed",t)}}#u(t,o){let i=this.#r[Math.min(this.#o,this.#r.length-1)];this.#o+=1,this.#t.warn?.(`[dsh-feishu] ${t}; retrying automatically in ${i}ms`,o),this.#d(i)}};function Nk(n){return new Uy(n)}function Oz(n,t){let o=n==="lark"?"https://open.larksuite.com":"https://open.feishu.cn";return new URL(t,o)}function bz(n,t){if(!n||typeof n!="object"||Array.isArray(n))throw new Error(`${t} returned a non-JSON response`);if(n.code!==0)throw new Error(`${t} failed: ${n.msg||`code ${n.code}`}`);return n}async function Mz({appId:n,appSecret:t,domain:o="feishu",httpInstance:i,timeoutMs:e=15e3}){if(!n||!t)throw new Error("Feishu credentials are incomplete");if(!i||typeof i.request!="function")throw new TypeError("Feishu verification requires an HTTP instance");let a=bz(await i.request({method:"POST",url:Oz(o,"/open-apis/auth/v3/tenant_access_token/internal").href,headers:{"content-type":"application/json; charset=utf-8"},data:{app_id:n,app_secret:t},signal:AbortSignal.timeout(e),timeout:e}),"Feishu authentication");if(!a.tenant_access_token)throw new Error("Feishu authentication returned no tenant access token");let r=bz(await i.request({method:"GET",url:Oz(o,"/open-apis/bot/v3/info/").href,headers:{authorization:`Bearer ${a.tenant_access_token}`},signal:AbortSignal.timeout(e),timeout:e}),"Feishu bot verification").bot??{};return Object.freeze({appId:n,name:r.app_name??r.bot_name??null,openId:r.open_id??null,activated:r.activate_status??null})}import{randomUUID as hTe}from"node:crypto";import R_e from"qrcode";var Hy=99991672,g_e=64*1024,c_e=1e3,I_e="\u98DE\u4E66\u673A\u5668\u4EBA\u7F3A\u5C11\u56FE\u7247\u8BFB\u53D6\u6743\u9650 im:message:readonly\uFF08\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\uFF09\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u6309\u98DE\u4E66\u63D0\u793A\u53D1\u5E03\u65B0\u7248\u672C\u3001\u5B8C\u6210\u5FC5\u8981\u5BA1\u6279\u540E\uFF0C\u518D\u91CD\u65B0\u53D1\u9001\u56FE\u7247\u3002";function _z(n){if(n?.message?.chat_type==="p2p"){let i=n?.sender?.sender_id?.open_id||n?.sender?.sender_id?.user_id;if(!i)throw new Error("Feishu p2p event has no sender id");return`p2p:${i}`}let o=n?.message?.chat_id;if(!o)throw new Error("Feishu group event has no chat id");return`group:${o}`}function vk(n){let t=n?.message?.content;if(t&&typeof t=="object")return t;if(typeof t!="string")return null;try{let o=JSON.parse(t);return o&&typeof o=="object"?o:null}catch{return null}}function kk(n,t){let o=typeof n=="string"?n:"";for(let i of t?.message?.mentions??[])typeof i?.key=="string"&&i.key&&(o=o.replaceAll(i.key,""));return o.trim()}function zp(n){if(n?.message?.message_type!=="text")return null;let t=vk(n);return t?kk(t.text,n):null}function qp(n){return typeof n=="string"&&n.trim()?n.trim():null}function l_e(n,t=vk(n)){if(n?.message?.message_type!=="post"||!t)return null;let o=[],i=qp(kk(t.title,n));i&&o.push(i);let e=[];for(let a of Array.isArray(t.content)?t.content:[]){if(!Array.isArray(a))continue;let A="";for(let s of a){let g=String(s?.tag??"").toLowerCase();if(g==="img"){let c=qp(s?.image_key);c&&e.push(c)}else(g==="text"||g==="a"||g==="link")&&typeof s?.text=="string"&&(A+=s.text)}let r=qp(kk(A,n));r&&o.push(r)}return{text:o.join(`
|
|
322
322
|
`),imageKeys:e}}function p_e(n,t){return typeof n?.get=="function"?n.get(t):n?.[t]??n?.[t.toLowerCase()]??null}function d_e(n){let t=p_e(n,"content-length");if(t==null||t==="")return null;let o=Number(t);return Number.isFinite(o)&&o>=0?o:null}async function h_e(n,{signal:t,maxBytes:o}){if(!n||typeof n[Symbol.asyncIterator]!="function")throw new Error("Feishu image download returned no readable stream");t?.throwIfAborted();let i=()=>n.destroy?.(t.reason??new DOMException("Feishu image download aborted","AbortError"));t?.addEventListener("abort",i,{once:!0});let e=[],a=0;try{for await(let A of n){t?.throwIfAborted();let r=Buffer.from(A);if(a+=r.length,a>o)throw n.destroy?.(),new ut("image-too-large",`Feishu image exceeds ${o} bytes`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));e.push(r)}return t?.throwIfAborted(),Buffer.concat(e,a)}finally{t?.removeEventListener("abort",i)}}async function E_e(n,{signal:t}){if(!n||typeof n[Symbol.asyncIterator]!="function")throw new Error("Feishu file download returned no readable stream");t?.throwIfAborted();let o=()=>n.destroy?.(t.reason??new DOMException("Feishu file download aborted","AbortError"));t?.addEventListener("abort",o,{once:!0});let i=[],e=0;try{for await(let a of n){t?.throwIfAborted();let A=Buffer.from(a);e+=A.length,i.push(A)}return t?.throwIfAborted(),Buffer.concat(i,e)}finally{t?.removeEventListener("abort",o)}}function Rk(n){if(!n||typeof n!="object")return null;let t=n.code??n.error?.code;return Number.isSafeInteger(Number(t))?Number(t):null}async function C_e(n,t){if(!n||typeof n[Symbol.asyncIterator]!="function")return null;t?.throwIfAborted();let o=AbortSignal.timeout(c_e),i=t?AbortSignal.any([t,o]):o,e=()=>n.destroy?.(i.reason);i.addEventListener("abort",e,{once:!0});let a=[],A=0;try{for await(let r of n){let s=Buffer.from(r);if(A+=s.length,A>g_e)return n.destroy?.(),null;a.push(s)}return Buffer.concat(a,A).toString("utf8")}catch{return t?.throwIfAborted(),null}finally{i.removeEventListener("abort",e)}}async function u_e(n,t){let o=[n],i=new Set;for(;o.length>0&&i.size<8;){let e=o.shift();if(!e||typeof e!="object"&&typeof e!="function"||i.has(e))continue;i.add(e);let a=Rk(e),A=e.response?.data??e.data;if(a===Hy)return A?.destroy?.(),a;if(A&&typeof A[Symbol.asyncIterator]=="function"){let r=await C_e(A,t);try{let s=Rk(JSON.parse(r));if(s===Hy)return s}catch{}}else{let r=Rk(A);if(r===Hy)return r}o.push(e.cause)}return null}async function B_e(n,t){return await u_e(n,t)!==Hy?n:new ut("feishu-image-permission-required","Feishu image download requires the im:message:readonly tenant scope",D(I_e),{cause:n})}function f_e(n,t,o){return{async load({signal:i,maxBytes:e}){i?.throwIfAborted();let a;try{a=await t?.im?.v1?.messageResource?.get?.({path:{message_id:n.message.message_id,file_key:o},params:{type:"image"}})}catch(r){throw await B_e(r,i)}i?.throwIfAborted();let A=d_e(a?.headers);if(A!==null&&A>e)throw a?.getReadableStream?.().destroy?.(),new ut("image-too-large",`Feishu image declares ${A} bytes; the limit is ${e}`,D("\u56FE\u7247\u8D85\u8FC7 5 MB\uFF0C\u8BF7\u538B\u7F29\u540E\u91CD\u8BD5\u3002"));return h_e(a?.getReadableStream?.(),{signal:i,maxBytes:e})}}}function Q_e(n,t,o){let i=qp(o?.file_key);return i?{name:qp(o?.file_name)??"file",async load({signal:e}={}){e?.throwIfAborted();let a=await t?.im?.v1?.messageResource?.get?.({path:{message_id:n.message.message_id,file_key:i},params:{type:"file"}});return e?.throwIfAborted(),E_e(a?.getReadableStream?.(),{signal:e})}}:null}function Pk(n,t){let o=n?.message?.message_type,i=vk(n),e=l_e(n,i),a=o==="image"?qp(i?.image_key):null,A=a?[a]:e?.imageKeys??[],r=o==="file"?Q_e(n,t,i):null;return{content:o==="text"?zp(n)??"":e?.text??"",images:A.map(s=>f_e(n,t,s)),files:r?[r]:[]}}function Tz(n,t=9e3){if(n.length<=t)return[n];let o=[],i=n;for(;i.length>t;){let e=i.lastIndexOf(`
|
|
323
323
|
`,t);e<Math.floor(t*.6)&&(e=t),o.push(i.slice(0,e)),i=i.slice(e).replace(/^\n+/,"")}return i&&o.push(i),o}function Nz(n){return n?.sender?.sender_type==="bot"}function Rz(n,t){if(!t||t.size===0)return!1;if(t.has("*"))return!0;let o=n?.sender?.sender_id?.open_id;return typeof o=="string"&&t.has(o)}var $g=10,Ky="__preset_follow_default__";function Yy(n){return{tag:"plain_text",content:String(n)}}function Ct(n){return{tag:"lark_md",content:String(n)}}function Vn(n,t){return{tag:"column_set",flex_mode:"none",columns:[{tag:"column",width:"weighted",weight:1,elements:[{tag:"button",text:Yy(n),type:"default",width:"fill",behaviors:[{type:"callback",value:{action:t}}]}]}]}}function xy(n,t){return{tag:"button",text:Yy(n),type:"default",width:"fill",behaviors:[{type:"callback",value:{action:t}}]}}function NI(n,t,o,i){return{tag:"column_set",flex_mode:"none",columns:[{tag:"column",width:"weighted",weight:1,elements:[xy(n,t)]},{tag:"column",width:"weighted",weight:1,elements:[xy(o,i)]}]}}function Vp(n,t){let o=n.findIndex(i=>i.value===t);return o>=0?o+1:0}function MC(n){return String(n??"").replace(/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]+/gu," ").replace(/\s+/gu," ").trim()||D("\u6682\u65E0\u6807\u9898")}function wo(n,t){return JSON.stringify({schema:"2.0",header:{title:Yy(n),template:"blue"},body:{elements:t}})}function RI(){return Vn(D("\u{1F519} \u8FD4\u56DE\u83DC\u5355"),"back_to_menu")}function kz(n){let{workspaces:t=[],currentWorkspace:o=null,currentSession:i=null,sessions:e=[],archiveVisible:a=!1,presetCatalog:A=null,modelCatalog:r=null}=n||{},s=i?.id??null,g=i?.title??n?.currentSessionTitle??null,c=(Array.isArray(e)?e:[]).slice(0,20),I=c.length>0,d=Array.isArray(t)&&t.length>0,B=[];B.push({tag:"div",text:Ct(D("**\u8BBE\u7F6E**"))});let f=null;if(I){let k=c.map(W=>({text:{tag:"plain_text",content:`${W.id===s?"\u2713 ":""}${MC(W.title)}`},value:W.id}));f={tag:"select_static",name:"session_pick",placeholder:{tag:"plain_text",content:s?D("\u5207\u6362\u4F1A\u8BDD"):D("\u9009\u62E9\u4F1A\u8BDD\uFF08\u5F53\u524D\u672A\u7ED1\u5B9A\uFF09")},initial_index:Vp(k,s),options:k,behaviors:[{type:"callback",value:{action:"session_pick"}}]}}let Q=null;if(d){let k=t.slice(0,20).map(W=>({text:{tag:"plain_text",content:`${W===o?"\u2713 ":""}${W}`},value:W}));Q={tag:"select_static",name:"workspace_pick",placeholder:{tag:"plain_text",content:D("\u5207\u6362\u5DE5\u4F5C\u533A")},initial_index:Vp(k,o),options:k,behaviors:[{type:"callback",value:{action:"workspace_pick"}}]}}let y=Array.isArray(A?.items)?A.items:[],m=A?._currentId??null,_=m===null,N=null;if(y.length>=1){let k=y.slice(0,30).map(ie=>({text:{tag:"plain_text",content:`${ie.id===m?"\u2713 ":""}${ie.label}`},value:ie.id})),W=_?Ky:m;k.unshift({text:{tag:"plain_text",content:`${_?"\u2713 ":""}${D("\u8DDF\u968F\u9ED8\u8BA4")}`},value:Ky}),N={tag:"select_static",name:"preset_pick",placeholder:{tag:"plain_text",content:D("\u5207\u6362\u9884\u8BBE")},initial_index:Vp(k,W),options:k,behaviors:[{type:"callback",value:{action:"preset_pick"}}]}}let G=Array.isArray(r?.groups)?r.groups:[],Y=r?.current,j=Y?`${Y.provider}/${Y.model}`:null,H=[];for(let k of G)for(let W of k.models||[])H.push({id:`${k.id}/${W.id}`,name:`${k.name} - ${W.name}`});let J=null;if(H.length>1){let k=H.slice(0,30).map(W=>({text:{tag:"plain_text",content:`${W.id===j?"\u2713 ":""}${W.name}`},value:W.id}));J={tag:"select_static",name:"model_pick",placeholder:{tag:"plain_text",content:D("\u5207\u6362\u6A21\u578B")},initial_index:Vp(k,j),options:k,behaviors:[{type:"callback",value:{action:"model_pick"}}]}}function q(k){return{tag:"column",width:"weighted",weight:.1,vertical_align:"center",elements:[{tag:"div",text:{tag:"plain_text",content:k}}]}}function U(k){return{tag:"column",width:"weighted",weight:1,elements:[k]}}let R=[];f&&R.push(f),Q&&R.push(Q),R.length===2?B.push({tag:"column_set",flex_mode:"none",columns:[q("\u{1F4AC}"),U(R[0]),q("\u{1F4C2}"),U(R[1])]}):R[0]&&B.push(R[0]),I||B.push({tag:"div",text:Ct(D("\u5F53\u524D\u5DE5\u4F5C\u533A\u6682\u65E0\u53EF\u7528\u4F1A\u8BDD\u3002"))});let V=[],L=Vn(D("\u{1F916} \u5207\u6362\u9884\u8BBE"),"presets"),T=Vn(D("\u{1F9E0} \u5207\u6362\u6A21\u578B"),"models");return N?V.push(N):V.push(L),J?V.push(J):V.push(T),B.push({tag:"column_set",flex_mode:"none",columns:[q("\u{1F916}"),U(V[0]),q("\u{1F9E0}"),U(V[1])]}),B.push(NI(D("\u{1F195} \u65B0\u4F1A\u8BDD"),"new",D("\u{1F4CB} \u4F1A\u8BDD/\u5173\u6CE8"),"sessions")),!I&&!d&&B.push(Vn(D("\u{1F5C2} \u5DE5\u4F5C\u533A\u5217\u8868"),"workspaces")),B.push({tag:"hr"}),B.push({tag:"div",text:Ct(D("**\u4EFB\u52A1\u63A7\u5236**"))}),B.push(NI(D("\u23F9 \u505C\u6B62"),"stop",D("\u{1F4D0} \u538B\u7F29"),"compact")),B.push({tag:"hr"}),B.push({tag:"column_set",flex_mode:"none",columns:[{tag:"column",width:"weighted",weight:1,elements:[{tag:"div",text:Ct(D("**\u8865\u5145\u6307\u4EE4**"))},{tag:"select_static",name:"steer_pick",placeholder:{tag:"plain_text",content:D("\u9009\u62E9\u8865\u5145\u6307\u4EE4")},initial_index:0,options:[...jz.map(k=>({text:{tag:"plain_text",content:D(k)},value:D(k)})),{text:{tag:"plain_text",content:D("\u270F\uFE0F \u66F4\u591A / \u81EA\u5B9A\u4E49\u2026")},value:"custom"}],behaviors:[{type:"callback",value:{action:"steer_pick"}}]}]},{tag:"column",width:"weighted",weight:1,elements:[{tag:"div",text:Ct(D("\u{1F5C4} \u5F52\u6863\uFF1A{state}",{state:a?D("\u5DF2\u663E\u793A"):D("\u5DF2\u9690\u85CF")}))},Vn(D("\u5207\u6362\u5F52\u6863\u663E\u793A"),"archive_toggle")]}]}),B.push({tag:"hr"}),B.push(NI(D("\u{1F4CA} \u72B6\u6001"),"status",D("\u{1F4D6} \u5E2E\u52A9"),"help")),B.push({tag:"div",text:Ct(D(`**\u6570\u5B57\u515C\u5E95**
|
|
324
324
|
**1**\u5DE5\u4F5C\u533A\u5217\u8868 \xB7 **2**\u65B0\u4F1A\u8BDD \xB7 **3**\u4F1A\u8BDD\u5217\u8868 \xB7 **4**\u72B6\u6001
|
|
@@ -334,11 +334,11 @@ ${s.join(`
|
|
|
334
334
|
`)+t)},{tag:"hr"},{tag:"div",text:Ct(D(S_e))},{tag:"hr"},RI()];return wo(D("\u{1F4D6} \u5E2E\u52A9"),o)}function Uz(n){if(typeof n!="string"||!/^[A-Za-z0-9_-]{16,128}$/.test(n))throw new TypeError("A safe card-action probe nonce is required");return wo(D("\u{1F9EA} \u9A8C\u8BC1\u5361\u7247\u6309\u94AE"),[{tag:"div",text:Ct(D("\u6388\u6743\u5DF2\u63D0\u4EA4\u3002\u8BF7\u70B9\u51FB\u4E0B\u65B9\u6309\u94AE\uFF1B\u673A\u5668\u4EBA\u771F\u5B9E\u6536\u5230\u56DE\u8C03\u540E\u624D\u4F1A\u5224\u5B9A\u4FEE\u590D\u6210\u529F\u3002"))},{tag:"column_set",flex_mode:"none",columns:[{tag:"column",width:"weighted",weight:1,elements:[{tag:"button",text:Yy(D("\u5B8C\u6210\u9A8C\u8BC1")),type:"primary",width:"fill",behaviors:[{type:"callback",value:{action:"repair_verify",nonce:n}}]}]}]}])}function Hz(n,t,o,i,e=new Set){let a=o*$g,A=t.slice(a,a+$g),r=Math.max(1,Math.ceil(i/$g)),s=I=>typeof e?.has=="function"&&e.has(I),g=(I,d)=>({tag:"column_set",flex_mode:"none",horizontal_spacing:"default",columns:[{tag:"column",width:"90px",vertical_align:"center",elements:[I]},{tag:"column",width:"weighted",weight:1,vertical_align:"center",elements:[d]}]}),c=[{tag:"div",text:Ct(D(`**\u5DE5\u4F5C\u533A**\uFF1A{workspace}
|
|
335
335
|
\u5171 **{total}** \u4E2A\u4F1A\u8BDD{paging}`,{workspace:`\`${n}\``,total:i,paging:i>$g?D("\uFF08\u7B2C {page}/{pageCount} \u9875\uFF09",{page:o+1,pageCount:r}):""}))},...A.map((I,d)=>{let B=`${d+1}. ${MC(I.title)}${I.archived===!0?D("\uFF08\u5DF2\u5F52\u6863\uFF09"):""}`,f=s(I.sessionId);return g(xy(f?D("\u2B50 \u53D6\u6D88\u5173\u6CE8"):D("\u2606 \u5173\u6CE8"),f?`unwatch:${I.sessionId}`:`watch:${I.sessionId}`),xy(B,`use:${I.sessionId}`))})];return o>0&&c.push(Vn(D("\u25C0 \u4E0A\u4E00\u9875"),`sessions:${o-1}`)),o+1<r&&c.push(Vn(D("\u4E0B\u4E00\u9875 \u25B6"),`sessions:${o+1}`)),c.push({tag:"hr"},NI(D("\u{1F519} \u8FD4\u56DE\u83DC\u5355"),"back_to_menu",D("\u{1F50D} \u5173\u6CE8\u5217\u8868"),"watchlist"),{tag:"div",text:Ct(D("\u56DE\u590D\u6570\u5B57\uFF081~N\uFF09\u7ED1\u5B9A\u672C\u9875\u4F1A\u8BDD\u3002"))}),wo(D("\u{1F4C2} \u4F1A\u8BDD\u5217\u8868"),c)}function Kz(n,t){let o=n.length===0?[{tag:"div",text:Ct(D("\u5F53\u524D Host \u4E0A\u6CA1\u6709\u5DF2\u767B\u8BB0\u7684\u5DE5\u4F5C\u533A\u3002"))},RI()]:[{tag:"div",text:Ct(D("\u56DE\u590D\u6570\u5B57\u5207\u6362\u5DE5\u4F5C\u533A\uFF0C\u6216\u70B9\u51FB\u6309\u94AE\uFF1A"))},...n.map((i,e)=>Vn(`${e+1}. ${i}${i===t?D("\uFF08\u5F53\u524D\uFF09"):""}`,`workspace:${i}`)),{tag:"hr"},RI()];return wo(D("\u{1F5C2} \u5DE5\u4F5C\u533A"),o)}function D_e(n,t){let o=new Set(n.map(e=>e.sessionId)),i=(Array.isArray(t)?t:[]).filter(e=>e?.sessionId&&!o.has(e.sessionId)).slice(0,30).map(e=>({text:{tag:"plain_text",content:MC(e.title??e.sessionId)},value:e.sessionId}));return i.length===0?null:{tag:"multi_select_static",name:"watch_add",placeholder:{tag:"plain_text",content:D("\u52FE\u9009\u8981\u5173\u6CE8\u7684\u4F1A\u8BDD")},options:i,behaviors:[{type:"callback",value:{action:"watch_add",kind:"multi"}}]}}function w_e(n){let t=n.slice(0,30).map(o=>({text:{tag:"plain_text",content:MC(o.title)},value:o.sessionId}));return t.length===0?null:{tag:"multi_select_static",name:"watch_remove",placeholder:{tag:"plain_text",content:D("\u52FE\u9009\u8981\u53D6\u6D88\u5173\u6CE8\u7684\u4F1A\u8BDD")},options:t,behaviors:[{type:"callback",value:{action:"watch_remove",kind:"multi"}}]}}function xz(n,t){let o=Array.isArray(n)?n:[],i=D_e(o,t),e=w_e(o),a=[];return o.length===0?a.push({tag:"div",text:Ct(D("\u5F53\u524D\u6CA1\u6709\u5173\u6CE8\u7684\u4F1A\u8BDD\u3002\u4EFB\u52A1\u5B8C\u6210\u4F1A\u81EA\u52A8\u63A8\u9001\u7ED3\u679C\u3002"))}):a.push({tag:"div",text:Ct(D("\u5F53\u524D\u5173\u6CE8 **{count}** \u4E2A\u4F1A\u8BDD\uFF1A",{count:o.length}))}),i&&a.push({tag:"hr"},{tag:"div",text:Ct(D("**\u2795 \u6DFB\u52A0\u5173\u6CE8**\uFF08\u591A\u9009\u4E0B\u62C9\u52FE\u9009\uFF09"))},i),e&&a.push({tag:"hr"},{tag:"div",text:Ct(D("**\u2796 \u53D6\u6D88\u5173\u6CE8**\uFF08\u591A\u9009\u4E0B\u62C9\u52FE\u9009\uFF09"))},e),a.push({tag:"hr"},NI(D("\u{1F4CB} \u4F1A\u8BDD\u5217\u8868"),"sessions",D("\u{1F519} \u8FD4\u56DE\u83DC\u5355"),"back_to_menu")),wo(D("\u{1F441} \u5173\u6CE8\u5217\u8868"),a)}function Yz(n,t,o){let i=o==="completed"?D("\u5DF2\u5B8C\u6210"):o==="stopped"?D("\u5DF2\u505C\u6B62"):o==="aborted"?D("\u5DF2\u4E2D\u6B62"):o==="cancelled"?D("\u5DF2\u53D6\u6D88"):D("\u5DF2\u7ED3\u675F");return wo(D("\u2705 \u4EFB\u52A1\u5B8C\u6210"),[{tag:"div",text:Ct(`**${MC(t)}**
|
|
336
336
|
\`${n}\``)},{tag:"div",text:Ct(D("**\u72B6\u6001**\uFF1A{reason}",{reason:i}))},{tag:"hr"},NI(D("\u{1F4CB} \u4F1A\u8BDD\u5217\u8868"),"sessions",D("\u{1F519} \u8FD4\u56DE\u83DC\u5355"),"back_to_menu"),{tag:"div",text:Ct(D("\u7ED1\u5B9A\u8BE5\u4F1A\u8BDD\u540E\u53EF\u7EE7\u7EED\u8FFD\u95EE\uFF0C\u8F93\u5165\u6587\u5B57\u5373\u53EF\u3002"))}])}var jz=["\u7EE7\u7EED","\u52A0\u901F\u8FD0\u884C","\u603B\u7ED3\u5F53\u524D\u8FDB\u5C55","\u66F4\u7B80\u6D01\u4E9B","\u66F4\u8BE6\u7EC6\u4E9B"],_C="__steer_custom__";function Jz({hasSession:n}){let t=n?D("\u4ECE\u4E0B\u65B9\u4E0B\u62C9\u9009\u62E9\u8865\u5145\u6307\u4EE4\uFF1B\u6700\u540E\u4E00\u9879\u53EF\u81EA\u5B9A\u4E49\u8F93\u5165\u3002"):D("\u5F53\u524D\u6CA1\u6709\u7ED1\u5B9A\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u7ED1\u5B9A\u4F1A\u8BDD\u518D\u8865\u5145\u6307\u4EE4\u3002"),o=jz.map(e=>({text:{tag:"plain_text",content:D(e)},value:D(e)}));o.push({text:{tag:"plain_text",content:D("\u270F\uFE0F \u66F4\u591A / \u81EA\u5B9A\u4E49\u2026")},value:_C});let i=[{tag:"div",text:Ct(t)},{tag:"hr"},{tag:"select_static",name:"steer_quick",placeholder:{tag:"plain_text",content:D("\u9009\u62E9\u8865\u5145\u6307\u4EE4")},initial_index:0,options:o,behaviors:[{type:"callback",value:{action:"steer",source:"quick"}}]},{tag:"hr"},Vn(D("\u{1F519} \u8FD4\u56DE\u83DC\u5355"),"back_to_menu")];return wo(D("\u2795 \u8865\u5145\u6307\u4EE4"),i)}function Gk(){let n=[{tag:"div",text:Ct(D("\u8F93\u5165\u8865\u5145\u6307\u4EE4\u540E\u70B9\u300C\u63D0\u4EA4\u300D\uFF0C\u53D1\u9001\u7ED9\u5F53\u524D\u8FD0\u884C\u7684\u4EFB\u52A1\u3002"))},{tag:"hr"},{tag:"form",name:"steer_form",elements:[{tag:"input",name:"steer_text",placeholder:{tag:"plain_text",content:D("\u8F93\u5165\u4F60\u7684\u8865\u5145\u6307\u4EE4")}},{tag:"button",name:"steer_submit",text:{tag:"plain_text",content:D("\u63D0\u4EA4")},type:"primary",width:"fill",form_action_type:"submit",behaviors:[{type:"callback",value:{action:"steer",source:"form"}}]}]},{tag:"hr"},Vn(D("\u{1F519} \u8FD4\u56DE\u83DC\u5355"),"back_to_menu")];return wo(D("\u2795 \u81EA\u5B9A\u4E49\u6307\u4EE4"),n)}import{mkdir as O_e,readFile as b_e,rename as M_e,writeFile as __e}from"node:fs/promises";import{dirname as T_e}from"node:path";var N_e=Object.freeze({version:1,sessions:{},seenMessageIds:[],watches:{},includeArchivedSessions:!1}),Jy=20;function Fk(n){return n&&typeof n=="object"&&typeof n.sessionId=="string"&&n.sessionId.length>0&&typeof n.chatId=="string"&&n.chatId.length>0}var jy=class{#e;#A=structuredClone(N_e);#t=Promise.resolve();constructor(t){this.#e=t}async load(){try{let t=JSON.parse(await b_e(this.#e,"utf8"));this.#A={version:1,sessions:t.sessions&&typeof t.sessions=="object"?t.sessions:{},seenMessageIds:Array.isArray(t.seenMessageIds)?t.seenMessageIds.slice(-1e3):[],watches:t.watches&&typeof t.watches=="object"?t.watches:{},includeArchivedSessions:typeof t.includeArchivedSessions=="boolean"?t.includeArchivedSessions:!1}}catch(t){if(t?.code!=="ENOENT")throw t;await this.#r()}return this}sessionFor(t){return this.#A.sessions[t]??null}async setSession(t,o){this.#A.sessions[t]=o,await this.#r()}async clearSession(t){delete this.#A.sessions[t],await this.#r()}async clearSessions(){this.#A.sessions={},await this.#r()}hasSeen(t){return this.#A.seenMessageIds.includes(t)}async markSeen(t){this.hasSeen(t)||(this.#A.seenMessageIds.push(t),this.#A.seenMessageIds.length>1e3&&this.#A.seenMessageIds.splice(0,this.#A.seenMessageIds.length-1e3),await this.#r())}snapshot(){return structuredClone(this.#A)}watchEntries(t){let o=this.#A.watches[t];return Array.isArray(o)?o.filter(Fk):[]}watchEntry(t,o){return this.watchEntries(t).find(i=>i.sessionId===o)??null}async setWatch(t,o){let i=this.#A.watches[t]??[],e=i.findIndex(a=>a.sessionId===o.sessionId);e===-1?(i.length>=Jy&&i.shift(),i.push(o)):i[e]=o,this.#A.watches[t]=i,await this.#r()}async removeWatch(t,o){let i=this.#A.watches[t]??[];this.#A.watches[t]=i.filter(e=>e.sessionId!==o),await this.#r()}async clearWatches(t){delete this.#A.watches[t],await this.#r()}keysWatching(t){return Object.entries(this.#A.watches).filter(([,o])=>Array.isArray(o)&&o.some(i=>Fk(i)&&i.sessionId===t)).map(([o])=>o)}watchedSessionIds(){let t=new Set;for(let o of Object.values(this.#A.watches))if(Array.isArray(o))for(let i of o)Fk(i)&&t.add(i.sessionId);return[...t]}includesArchivedSessions(){return this.#A.includeArchivedSessions===!0}async setIncludeArchivedSessions(t){this.#A.includeArchivedSessions=t===!0,await this.#r()}async#r(){let t=JSON.stringify(this.#A,null,2)+`
|
|
337
|
-
`;this.#t=this.#t.then(async()=>{await O_e(T_e(this.#e),{recursive:!0,mode:448});let o=`${this.#e}.tmp`;await __e(o,t,{encoding:"utf8",mode:384}),await M_e(o,this.#e)}),await this.#t}};var ec=Object.freeze({MENTION:"mention",ALL:"all"});function Ji(n){return n===ec.ALL?ec.ALL:ec.MENTION}function qy(n){return n===ec.MENTION||n===ec.ALL}var zy=()=>D("\u8FD9\u4E2A\u95EE\u9898\u5DF2\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u5904\u7406\uFF0C\u65E0\u9700\u518D\u6B21\u56DE\u7B54\u3002"),k_e=30*6e4,v_e=/^\/m(?:enu)?$/i,P_e=/^\/repair(?:\s|$)/i,G_e=/^\/repair(?:\s+(qr|status|cancel|verify))?\s*$/i,qz=/^\/watch(?:\s+([^\s]+))?$/i,zz=/^\/unwatch(?:\s+([^\s]+))?$/i,F_e=/^\/watchlist$/i,L_e=/^\/sessionlist(?:\s|$)/i,U_e=/^\/workspacelist$/i,H_e=/^\d{1,2}$/,K_e=10*6e4,x_e=50,Y_e=8,j_e=8,J_e=10*6e4,Vz=400,q_e=10*6e4,z_e=100,V_e=50,W_e=500,Z_e=5e3,X_e=5e3,$_e=15e3,eTe=1e3,eV=new Set(["starting","qr_ready","polling","slow_down","domain_switched"]),Lk=new Set([...eV,"saving"]),Vy=new Set(["succeeded","expired","cancelled","error"]),ATe=new Set(["accounts.feishu.cn","open.feishu.cn","accounts.larksuite.com","open.larksuite.com"]),Wz=/^\/archived(?:\s+(on|off))?$/i,tTe=/^\/(?:m(?:enu)?|new|help|status|compact|sessionlist(?:\s|$)|workspacelist|watchlist|archived(?:\s+(on|off))?)$/i,rTe=["/session Session ID \u6216\u5F53\u524D\u5DE5\u4F5C\u533A\u5E8F\u53F7 \u5C06\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u5230\u6307\u5B9A\u4F1A\u8BDD","/workspacelist \u5217\u51FA\u5DE5\u4F5C\u533A\u7EDD\u5BF9\u8DEF\u5F84","/sessionlist [\u5DE5\u4F5C\u533A\u5E8F\u53F7\u6216\u7EDD\u5BF9\u8DEF\u5F84] \u5217\u51FA\u4F1A\u8BDD ID \u548C\u6807\u9898"];function TC(n){switch(n?.code){case"workspace-not-absolute":return D("\u5DE5\u4F5C\u533A\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84\u3002");case"workspace-not-found":return D("\u5DE5\u4F5C\u533A\u8DEF\u5F84\u4E0D\u5B58\u5728\u3002");case"workspace-not-directory":return D("\u5DE5\u4F5C\u533A\u8DEF\u5F84\u5FC5\u987B\u6307\u5411\u4E00\u4E2A\u76EE\u5F55\u3002");case"workspace-bot-not-found":return D("\u673A\u5668\u4EBA\u6B63\u5728\u79FB\u9664\u6216\u5DF2\u91CD\u65B0\u63A5\u5165\uFF0C\u65E0\u6CD5\u64CD\u4F5C\u539F\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u533A\u3002");default:return D("\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002")}}function aTe(n,t){let o=String(n??D("\u7ED3\u679C\u6587\u4EF6")).replace(/[\r\n]+/g," ").trim()||D("\u7ED3\u679C\u6587\u4EF6");switch(t?.code){case"artifact-permission-required":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u673A\u5668\u4EBA\u7F3A\u5C11\u98DE\u4E66\u6587\u4EF6\u4E0A\u4F20\u6743\u9650 im:resource\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u63D2\u4EF6\u9875\u9762\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u5B8C\u6210\u98DE\u4E66\u8981\u6C42\u7684\u53D1\u5E03\u5BA1\u6279\u540E\u91CD\u8BD5\u3002",{name:o});case"artifact-too-large":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u98DE\u4E66 30 MB \u4E0A\u9650\uFF0C\u672A\u53D1\u9001\u3002",{name:o});case"artifact-empty":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0C\u98DE\u4E66\u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002",{name:o});case"artifact-changed":case"artifact-invalid":case"artifact-unavailable":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u6216\u51C6\u5907\u53D1\u9001\uFF0C\u8BF7\u786E\u8BA4\u6587\u4EF6\u4ECD\u53EF\u8BBF\u95EE\u540E\u91CD\u8BD5\u3002",{name:o});case"artifact-rate-limited":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u98DE\u4E66\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",{name:o});case"artifact-delivery-uncertain":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u53D1\u9001\u7ED3\u679C\u672A\u80FD\u786E\u8BA4\uFF0C\u8BF7\u5148\u68C0\u67E5\u804A\u5929\u5185\u662F\u5426\u5DF2\u6536\u5230\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u8BD5\u3002",{name:o});default:return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",{name:o})}}function Wy(n,t){return typeof n=="string"&&n.trim()?n:t.length>0?D("\u7ED3\u679C\u6587\u4EF6\u5DF2\u751F\u6210\u3002"):n}function CA(n){return typeof n=="string"&&n.trim()?n.trim():null}function Zz(n){if(n&&typeof n=="object"&&!Array.isArray(n))return n;if(typeof n!="string"||!n.trim())return{};try{let t=JSON.parse(n);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function RC(n){if(n==null)return null;if(Array.isArray(n)){for(let o of n){let i=RC(o);if(i!==null)return i}return null}if(n&&typeof n=="object")return"value"in n?RC(n.value):"option"in n?RC(n.option):null;if(typeof n!="string")return null;let t=n.trim();if(!t)return null;if(t.startsWith("[")||t.startsWith("{")||t.startsWith('"'))try{let o=JSON.parse(t);if(o!==n)return RC(o)}catch{}return t}function Xs(n){if(n==null)return[];if(Array.isArray(n))return n.flatMap(o=>Xs(o));if(n&&typeof n=="object")return"value"in n?Xs(n.value):"option"in n?Xs(n.option):[];if(typeof n!="string")return[];let t=n.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{")||t.startsWith('"'))try{let o=JSON.parse(t);if(o!==n)return Xs(o)}catch{}return t.split(",").map(o=>o.trim()).filter(Boolean)}function nn(n){return Number.isSafeInteger(n)&&n>=-1}function kC(n){return Number.isSafeInteger(n)&&n>=0}function Xy(n){return Number.isSafeInteger(n?.watchStartedAt)&&n.watchStartedAt>=0?n.watchStartedAt:null}function Zy(n){return n&&(Xy(n)!==null||!nn(n.lastSeq))}function iTe(n){return(Array.isArray(n?.events)?n.events:[]).map(t=>t?.event??t).filter(t=>t&&typeof t=="object"&&kC(t.seq)).sort((t,o)=>t.seq-o.seq)}function $y(n){return CA(n?.sender?.sender_id?.open_id)??CA(n?.sender?.sender_id?.user_id)}function oTe(n){return CA(n?.sender?.sender_id?.open_id)}function Xz(n,t){return new Promise((o,i)=>{if(t?.aborted){i(t.reason??new DOMException("Aborted","AbortError"));return}let e=setTimeout(a,n);e.unref?.();function a(){t?.removeEventListener("abort",A),o()}function A(){clearTimeout(e),i(t.reason??new DOMException("Aborted","AbortError"))}t?.addEventListener("abort",A,{once:!0})})}function NC(n,{botId:t}={}){let o=n&&typeof n=="object"?n:{},i=o.registration&&typeof o.registration=="object"?o.registration:o,e=CA(i.operation)??CA(o.operation);if(e&&e!=="callback_repair")throw new Error("The active Feishu operation is not a callback repair");let a=CA(i.botId)??CA(o.botId);if(t&&a&&a!==t)throw new Error("The Feishu repair belongs to another bot");let A=CA(i.state),r=i.attemptId??i.attempt,s=typeof r=="string"||Number.isFinite(r)?String(r):null;if(!A||!s)throw new Error("Feishu returned an invalid repair status");let g=CA(i.verificationUrl)??CA(i.qrCodeUrl),c=Number(i.expiresAt),I=Number(i.remainingSeconds),d=Number(i.pollIntervalMs)||Number(i.pollIntervalSeconds)*1e3;return{state:A,attemptId:s,botId:a,verificationUrl:g,expiresAt:Number.isFinite(c)?c:null,remainingSeconds:Number.isFinite(I)?I:null,pollIntervalMs:Number.isFinite(d)&&d>0?d:null,error:i.error&&typeof i.error=="object"?{code:CA(i.error.code),message:CA(i.error.message)}:null}}function $z(n,t){let o=new URL(n);if(o.protocol!=="https:"||!ATe.has(o.hostname))throw new Error("Feishu returned an untrusted repair URL");if(o.searchParams.get("tp")!=="sdk"||o.searchParams.get("clientID")!==t||o.searchParams.has("createOnly"))throw new Error("Feishu returned an invalid existing-app repair URL");if(o.toString().includes("{{client_id}}")||o.toString().includes("%7B%7Bclient_id%7D%7D"))throw new Error("Feishu returned an unresolved client id placeholder");return o.toString()}function nTe(n,t){return t.needsPresentation!==!0&&t.questions[t.index]&&$y(n)===t.actor&&n?.message?.message_type==="text"&&CA(zp(n))}function sTe(n){for(let t of["messagesReceived","messagesReplied","messagesRejected"])n[t]??=0;n.lastMessageAt??=null,n.lastReplyAt??=null,n.lastRejectedAt??=null,n.lastError??=null,n.lastMessageError??=null}var em=class{#e;#A;#t;#r;#a=new Map;#i=new Ii;#c=new Map;#s=new Map;#I=new Map;#o=new Set;#n=new Set;#g=new Set;#l=new Set;#p=new Map;#d=new Map;#h=new Map;#E=new Map;#u=new Map;#B=new Map;#f=new Map;#m=new Map;#y=new Map;#Q;#C;#b;#M;#w;#S;#_;#R;#k;#N;#v;#T=null;#F=0;#O;#U;#L=new Map;#Y=new Map;#K=null;#J=new Map;#P=new Map;#H=new Map;#q=new Map;#G;constructor({client:t,channel:o,harness:i,state:e,status:a,allowedSenderOpenIds:A=new Set,botId:r,appId:s,botOpenId:g,groupResponseMode:c=ec.ALL,repair:I,repairPollIntervalMs:d=eTe,repairLinkWaitMs:B=$_e,cardDataTimeoutMs:f=X_e,replyTimeoutMs:Q=6e5,logger:y=console,signal:m}){if(!t||!i||!e||!a)throw new TypeError("Feishu bridge dependencies are required");if(I!=null){if(!I||typeof I.start!="function"||typeof I.status!="function"||typeof I.cancel!="function")throw new TypeError("Feishu repair capability requires start/status/cancel");if(!CA(r)||!CA(s))throw new TypeError("Feishu repair capability requires botId and appId")}if(!Number.isFinite(d)||d<=0||!Number.isFinite(B)||B<=0||!Number.isFinite(f)||f<=0)throw new TypeError("Feishu timing values must be positive numbers");this.#e=t,this.#A=o,this.#t=i,this.#r=e,this.#C=a,this.#b=A,this.#_=CA(r),this.#R=CA(s),this.#k=CA(g),this.#N=Ji(c),this.#v=I??null,this.#O=d,this.#U=B,this.#G=f,this.#M=Q,this.#w=y,this.#Q=new ii({label:"Feishu",logger:y}),this.#S=m,sTe(this.#C),typeof this.#t?.watchHarnessEvents=="function"&&queueMicrotask(()=>this.#Te())}setGroupResponseMode(t){this.#N=Ji(t)}#$(t){if(t?.message?.chat_type==="p2p")return!0;let o=Array.isArray(t?.message?.mentions)?t.message.mentions:[];return this.#k?o.some(i=>i?.id?.open_id===this.#k||i?.open_id===this.#k):o.length>0}accept(t){if(this.#S?.aborted)return Promise.resolve();let o=CA(t?.message?.message_id);if(!o||Nz(t))return Promise.resolve();if(!Rz(t,this.#b))return this.#C.messagesRejected+=1,this.#C.lastRejectedAt=new Date().toISOString(),this.#w.warn?.("[dsh-feishu] ignored a message from a sender outside the allowlist"),Promise.resolve();let i=this.#$(t);if(t?.message?.chat_type!=="p2p"&&this.#N===ec.MENTION&&!i||this.#r.hasSeen(o)||this.#o.has(o))return Promise.resolve();let e;try{e=_z(t)}catch{return this.#C.messagesRejected+=1,this.#C.lastRejectedAt=new Date().toISOString(),Promise.resolve()}if(t.message.chat_type==="p2p"){let f=CA(t.message.chat_id);f&&io(this.#r,{chatId:f})}this.#o.add(o);let a=this.#EA(o),A=Pk(t,this.#e),r=CA(A.content)??"",s=t.message.message_type==="text"?CA(zp(t))??"":"",g=t.message.message_type==="text"&&lo(s),c=this.#c.get(e),I=this.#i.status(e);if(g&&t.message.chat_type!=="p2p")return this.#te(t,o,a,{message:Tn()});if(t.message.chat_type==="p2p"&&(g||I.phase==="collecting")){let Q=/^\/batch$/iu.test(s)&&I.phase==="idle"&&(this.#a.has(e)||c||this.#Q.hasPending(e))?{handled:!0,kind:"busy",message:po()}:this.#i.handle(e,s,{plainText:t.message.message_type==="text"&&!!s});if(Q.handled){if(Q.kind==="submit"){let y={...t,batchSubmission:{token:Q.token},message:{...t.message,message_type:"text",content:JSON.stringify({text:Q.prompt}),mentions:[]}};return this.#z(y,o,e,a)}return this.#te(t,o,a,Q)}}if(tTe.test(r))return Promise.resolve().then(()=>this.#Se(t,e,{alreadyRecorded:!1})).then(()=>this.#Ae(o,a,"DONE")).catch(Q=>this.#V(t,o,a,Q)).finally(()=>this.#o.delete(o));let d=Gt(A)?null:Pi(r)?gi:Gi(r)?Fi:Li(r)?ci:null;if(d&&i){let f=this.#Fe(t,o,e,A,d),Q;return Q=f.then(()=>this.#Ae(o,a,"DONE")).catch(y=>this.#V(t,o,a,y)).finally(()=>{this.#o.delete(o),this.#g.delete(Q)}),this.#g.add(Q),Q}if(this.#fe(t,e))return Promise.resolve().then(()=>this.#Qe(t,o)).then(()=>this.#Ae(o,a,"DONE")).catch(Q=>this.#V(t,o,a,Q)).finally(()=>this.#o.delete(o));let B=this.#Q.claimReply({key:e,actor:$y(t),messageId:o,text:zp(t)??"",addressed:i,hasPendingQuestion:!!c,questionCompletion:c?.submitting||c?.claimedReplyMessageId?c.queue:null,isQuestionPending:()=>this.#c.has(e),send:f=>this.#D(t.message.chat_id,f)});if(B){let f=B.process(async()=>this.#r.hasSeen(o)?!1:(await this.#r.markSeen(o),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1,!0)),Q;return Q=f.then(()=>this.#Ae(o,a,"DONE")).catch(y=>this.#V(t,o,a,y)).finally(()=>{this.#o.delete(o),this.#n.delete(Q)}),this.#n.add(Q),Q}if(c&&$y(t)!==c.actor)return this.#z(t,o,e,a);if(c?.submitting||c?.claimedReplyMessageId)return this.#z(t,o,e,a);if(c){nTe(t,c)&&(c.claimedReplyMessageId=o);let Q=(c.queue??Promise.resolve()).catch(()=>{}).then(()=>this.#lA(t,o,e,c,a));c.queue=Q;let y=()=>{c.claimedReplyMessageId===o&&(c.claimedReplyMessageId=null),c.queue===Q&&(c.queue=null)},m;return m=Q.then(()=>(y(),this.#Ae(o,a,"DONE")),_=>(y(),this.#V(t,o,a,_))).finally(()=>{y(),this.#o.delete(o),this.#n.delete(m)}),this.#n.add(m),m}return this.#z(t,o,e,a)}#te(t,o,i,e){let a;return a=Promise.resolve().then(async()=>{this.#r.hasSeen(o)||(await this.#r.markSeen(o),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1,e?.message&&await this.#D(t.message.chat_id,e.message),this.#C.lastError=null)}).then(()=>this.#Ae(o,i,"DONE")).catch(A=>this.#V(t,o,i,A)).finally(()=>{this.#o.delete(o),this.#g.delete(a)}),this.#g.add(a),a}#z(t,o,i,e,{releaseMessageId:a=!0,alreadyRecorded:A=!1,finalize:r=!0}={}){let g=(this.#a.get(i)??Promise.resolve()).catch(()=>{}).then(()=>this.#Se(t,i,{alreadyRecorded:A})),c=r?g.then(async d=>(await this.#Ae(o,e,"DONE"),d)).catch(d=>this.#V(t,o,e,d)):g,I;return I=c.finally(()=>{a&&this.#o.delete(o),this.#a.get(i)===I&&this.#a.delete(i)}),this.#a.set(i,I),I}#Z(t,{logLabel:o="operation",logLevel:i="warn",userMessage:e,reason:a}={}){this.#C.lastError=t?.message??String(t);let A=At(this.#C,t,{userMessage:e,reason:a});return this.#w?.[i]?.(`[dsh-feishu] ${o} failed [${A.referenceId}]:`,t?.message??String(t)),A}async#x(t,o,i={}){let e=this.#Z(o,i),a=i.appendMessage?`${dt(e)}
|
|
337
|
+
`;this.#t=this.#t.then(async()=>{await O_e(T_e(this.#e),{recursive:!0,mode:448});let o=`${this.#e}.tmp`;await __e(o,t,{encoding:"utf8",mode:384}),await M_e(o,this.#e)}),await this.#t}};var ec=Object.freeze({MENTION:"mention",ALL:"all"});function Ji(n){return n===ec.ALL?ec.ALL:ec.MENTION}function qy(n){return n===ec.MENTION||n===ec.ALL}var zy=()=>D("\u8FD9\u4E2A\u95EE\u9898\u5DF2\u5728\u5176\u4ED6\u5BA2\u6237\u7AEF\u5904\u7406\uFF0C\u65E0\u9700\u518D\u6B21\u56DE\u7B54\u3002"),k_e=30*6e4,v_e=/^\/m(?:enu)?$/i,P_e=/^\/repair(?:\s|$)/i,G_e=/^\/repair(?:\s+(qr|status|cancel|verify))?\s*$/i,qz=/^\/watch(?:\s+([^\s]+))?$/i,zz=/^\/unwatch(?:\s+([^\s]+))?$/i,F_e=/^\/watchlist$/i,L_e=/^\/sessionlist(?:\s|$)/i,U_e=/^\/workspacelist$/i,H_e=/^\d{1,2}$/,K_e=10*6e4,x_e=50,Y_e=8,j_e=8,J_e=10*6e4,Vz=400,q_e=10*6e4,z_e=100,V_e=50,W_e=500,Z_e=5e3,X_e=5e3,$_e=15e3,eTe=1e3,eV=new Set(["starting","qr_ready","polling","slow_down","domain_switched"]),Lk=new Set([...eV,"saving"]),Vy=new Set(["succeeded","expired","cancelled","error"]),ATe=new Set(["accounts.feishu.cn","open.feishu.cn","accounts.larksuite.com","open.larksuite.com"]),Wz=/^\/archived(?:\s+(on|off))?$/i,tTe=/^\/(?:m(?:enu)?|new|help|status|compact|sessionlist(?:\s|$)|workspacelist|watchlist|archived(?:\s+(on|off))?)$/i,rTe=["/session Session ID \u6216\u5F53\u524D\u5DE5\u4F5C\u533A\u5E8F\u53F7 \u5C06\u5F53\u524D\u804A\u5929\u7ED1\u5B9A\u5230\u6307\u5B9A\u4F1A\u8BDD","/workspacelist \u5217\u51FA\u5DE5\u4F5C\u533A\u7EDD\u5BF9\u8DEF\u5F84","/sessionlist [\u5DE5\u4F5C\u533A\u5E8F\u53F7\u6216\u7EDD\u5BF9\u8DEF\u5F84] \u5217\u51FA\u4F1A\u8BDD ID \u548C\u6807\u9898"];function TC(n){switch(n?.code){case"workspace-not-absolute":return D("\u5DE5\u4F5C\u533A\u5FC5\u987B\u662F\u7EDD\u5BF9\u8DEF\u5F84\u3002");case"workspace-not-found":return D("\u5DE5\u4F5C\u533A\u8DEF\u5F84\u4E0D\u5B58\u5728\u3002");case"workspace-not-directory":return D("\u5DE5\u4F5C\u533A\u8DEF\u5F84\u5FC5\u987B\u6307\u5411\u4E00\u4E2A\u76EE\u5F55\u3002");case"workspace-bot-not-found":return D("\u673A\u5668\u4EBA\u6B63\u5728\u79FB\u9664\u6216\u5DF2\u91CD\u65B0\u63A5\u5165\uFF0C\u65E0\u6CD5\u64CD\u4F5C\u539F\u4F1A\u8BDD\u7684\u5DE5\u4F5C\u533A\u3002");default:return D("\u64CD\u4F5C\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002")}}function aTe(n,t){let o=String(n??D("\u7ED3\u679C\u6587\u4EF6")).replace(/[\r\n]+/g," ").trim()||D("\u7ED3\u679C\u6587\u4EF6");switch(t?.code){case"artifact-permission-required":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u673A\u5668\u4EBA\u7F3A\u5C11\u98DE\u4E66\u6587\u4EF6\u4E0A\u4F20\u6743\u9650 im:resource\u3002\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u6267\u884C /repair \u547D\u4EE4\uFF0C\u6216\u8005\u5728\u300CIM\u673A\u5668\u4EBA\u300D\u8BBE\u7F6E\u9875\u70B9\u51FB\u201C\u8865\u5168\u6743\u9650\u201D\u6309\u94AE\u5E76\u626B\u7801\u3002\u5B8C\u6210\u98DE\u4E66\u8981\u6C42\u7684\u53D1\u5E03\u5BA1\u6279\u540E\u91CD\u8BD5\u3002",{name:o});case"artifact-too-large":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u8D85\u8FC7\u98DE\u4E66 30 MB \u4E0A\u9650\uFF0C\u672A\u53D1\u9001\u3002",{name:o});case"artifact-empty":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u4E3A\u7A7A\uFF0C\u98DE\u4E66\u4E0D\u5141\u8BB8\u53D1\u9001\u7A7A\u6587\u4EF6\u3002",{name:o});case"artifact-changed":case"artifact-invalid":case"artifact-unavailable":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u65E0\u6CD5\u8BFB\u53D6\u6216\u51C6\u5907\u53D1\u9001\uFF0C\u8BF7\u786E\u8BA4\u6587\u4EF6\u4ECD\u53EF\u8BBF\u95EE\u540E\u91CD\u8BD5\u3002",{name:o});case"artifact-rate-limited":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u6682\u65F6\u88AB\u98DE\u4E66\u9650\u6D41\uFF0C\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",{name:o});case"artifact-delivery-uncertain":return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u53D1\u9001\u7ED3\u679C\u672A\u80FD\u786E\u8BA4\uFF0C\u8BF7\u5148\u68C0\u67E5\u804A\u5929\u5185\u662F\u5426\u5DF2\u6536\u5230\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u8BD5\u3002",{name:o});default:return D("\u7ED3\u679C\u6587\u4EF6\u300C{name}\u300D\u5DF2\u751F\u6210\uFF0C\u4F46\u6682\u65F6\u672A\u80FD\u53D1\u9001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002",{name:o})}}function Wy(n,t){return typeof n=="string"&&n.trim()?n:t.length>0?D("\u7ED3\u679C\u6587\u4EF6\u5DF2\u751F\u6210\u3002"):n}function CA(n){return typeof n=="string"&&n.trim()?n.trim():null}function Zz(n){if(n&&typeof n=="object"&&!Array.isArray(n))return n;if(typeof n!="string"||!n.trim())return{};try{let t=JSON.parse(n);return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}function RC(n){if(n==null)return null;if(Array.isArray(n)){for(let o of n){let i=RC(o);if(i!==null)return i}return null}if(n&&typeof n=="object")return"value"in n?RC(n.value):"option"in n?RC(n.option):null;if(typeof n!="string")return null;let t=n.trim();if(!t)return null;if(t.startsWith("[")||t.startsWith("{")||t.startsWith('"'))try{let o=JSON.parse(t);if(o!==n)return RC(o)}catch{}return t}function Xs(n){if(n==null)return[];if(Array.isArray(n))return n.flatMap(o=>Xs(o));if(n&&typeof n=="object")return"value"in n?Xs(n.value):"option"in n?Xs(n.option):[];if(typeof n!="string")return[];let t=n.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{")||t.startsWith('"'))try{let o=JSON.parse(t);if(o!==n)return Xs(o)}catch{}return t.split(",").map(o=>o.trim()).filter(Boolean)}function nn(n){return Number.isSafeInteger(n)&&n>=-1}function kC(n){return Number.isSafeInteger(n)&&n>=0}function Xy(n){return Number.isSafeInteger(n?.watchStartedAt)&&n.watchStartedAt>=0?n.watchStartedAt:null}function Zy(n){return n&&(Xy(n)!==null||!nn(n.lastSeq))}function iTe(n){return(Array.isArray(n?.events)?n.events:[]).map(t=>t?.event??t).filter(t=>t&&typeof t=="object"&&kC(t.seq)).sort((t,o)=>t.seq-o.seq)}function $y(n){return CA(n?.sender?.sender_id?.open_id)??CA(n?.sender?.sender_id?.user_id)}function oTe(n){return CA(n?.sender?.sender_id?.open_id)}function Xz(n,t){return new Promise((o,i)=>{if(t?.aborted){i(t.reason??new DOMException("Aborted","AbortError"));return}let e=setTimeout(a,n);e.unref?.();function a(){t?.removeEventListener("abort",A),o()}function A(){clearTimeout(e),i(t.reason??new DOMException("Aborted","AbortError"))}t?.addEventListener("abort",A,{once:!0})})}function NC(n,{botId:t}={}){let o=n&&typeof n=="object"?n:{},i=o.registration&&typeof o.registration=="object"?o.registration:o,e=CA(i.operation)??CA(o.operation);if(e&&e!=="callback_repair")throw new Error("The active Feishu operation is not a callback repair");let a=CA(i.botId)??CA(o.botId);if(t&&a&&a!==t)throw new Error("The Feishu repair belongs to another bot");let A=CA(i.state),r=i.attemptId??i.attempt,s=typeof r=="string"||Number.isFinite(r)?String(r):null;if(!A||!s)throw new Error("Feishu returned an invalid repair status");let g=CA(i.verificationUrl)??CA(i.qrCodeUrl),c=Number(i.expiresAt),I=Number(i.remainingSeconds),d=Number(i.pollIntervalMs)||Number(i.pollIntervalSeconds)*1e3;return{state:A,attemptId:s,botId:a,verificationUrl:g,expiresAt:Number.isFinite(c)?c:null,remainingSeconds:Number.isFinite(I)?I:null,pollIntervalMs:Number.isFinite(d)&&d>0?d:null,error:i.error&&typeof i.error=="object"?{code:CA(i.error.code),message:CA(i.error.message)}:null}}function $z(n,t){let o=new URL(n);if(o.protocol!=="https:"||!ATe.has(o.hostname))throw new Error("Feishu returned an untrusted repair URL");if(o.searchParams.get("tp")!=="sdk"||o.searchParams.get("clientID")!==t||o.searchParams.has("createOnly"))throw new Error("Feishu returned an invalid existing-app repair URL");if(o.toString().includes("{{client_id}}")||o.toString().includes("%7B%7Bclient_id%7D%7D"))throw new Error("Feishu returned an unresolved client id placeholder");return o.toString()}function nTe(n,t){return t.needsPresentation!==!0&&t.questions[t.index]&&$y(n)===t.actor&&n?.message?.message_type==="text"&&CA(zp(n))}function sTe(n){for(let t of["messagesReceived","messagesReplied","messagesRejected"])n[t]??=0;n.lastMessageAt??=null,n.lastReplyAt??=null,n.lastRejectedAt??=null,n.lastError??=null,n.lastMessageError??=null}var em=class{#e;#A;#t;#r;#a=new Map;#i=new Ii;#c=new Map;#s=new Map;#I=new Map;#o=new Set;#n=new Set;#g=new Set;#l=new Set;#p=new Map;#d=new Map;#h=new Map;#E=new Map;#u=new Map;#B=new Map;#f=new Map;#m=new Map;#y=new Map;#Q;#C;#b;#M;#w;#S;#_;#R;#k;#N;#v;#T=null;#F=0;#O;#U;#L=new Map;#Y=new Map;#K=null;#J=new Map;#P=new Map;#H=new Map;#q=new Map;#G;constructor({client:t,channel:o,harness:i,state:e,status:a,allowedSenderOpenIds:A=new Set,botId:r,appId:s,botOpenId:g,groupResponseMode:c=ec.ALL,repair:I,repairPollIntervalMs:d=eTe,repairLinkWaitMs:B=$_e,cardDataTimeoutMs:f=X_e,replyTimeoutMs:Q=6e5,logger:y=console,signal:m}){if(!t||!i||!e||!a)throw new TypeError("Feishu bridge dependencies are required");if(I!=null){if(!I||typeof I.start!="function"||typeof I.status!="function"||typeof I.cancel!="function")throw new TypeError("Feishu repair capability requires start/status/cancel");if(!CA(r)||!CA(s))throw new TypeError("Feishu repair capability requires botId and appId")}if(!Number.isFinite(d)||d<=0||!Number.isFinite(B)||B<=0||!Number.isFinite(f)||f<=0)throw new TypeError("Feishu timing values must be positive numbers");this.#e=t,this.#A=o,this.#t=i,this.#r=e,this.#C=a,this.#b=A,this.#_=CA(r),this.#R=CA(s),this.#k=CA(g),this.#N=Ji(c),this.#v=I??null,this.#O=d,this.#U=B,this.#G=f,this.#M=Q,this.#w=y,this.#Q=new ii({label:"Feishu",logger:y}),this.#S=m,sTe(this.#C),typeof this.#t?.watchHarnessEvents=="function"&&queueMicrotask(()=>this.#Te())}setGroupResponseMode(t){this.#N=Ji(t)}#$(t){if(t?.message?.chat_type==="p2p")return!0;let o=Array.isArray(t?.message?.mentions)?t.message.mentions:[];return this.#k?o.some(i=>i?.id?.open_id===this.#k||i?.open_id===this.#k):o.length>0}accept(t){if(this.#S?.aborted)return Promise.resolve();let o=CA(t?.message?.message_id);if(!o||Nz(t))return Promise.resolve();if(!Rz(t,this.#b))return this.#C.messagesRejected+=1,this.#C.lastRejectedAt=new Date().toISOString(),this.#w.warn?.("[dsh-feishu] ignored a message from a sender outside the allowlist"),Promise.resolve();let i=this.#$(t);if(t?.message?.chat_type!=="p2p"&&this.#N===ec.MENTION&&!i||this.#r.hasSeen(o)||this.#o.has(o))return Promise.resolve();let e;try{e=_z(t)}catch{return this.#C.messagesRejected+=1,this.#C.lastRejectedAt=new Date().toISOString(),Promise.resolve()}if(t.message.chat_type==="p2p"){let f=CA(t.message.chat_id);f&&io(this.#r,{chatId:f})}this.#o.add(o);let a=this.#EA(o),A=Pk(t,this.#e),r=CA(A.content)??"",s=t.message.message_type==="text"?CA(zp(t))??"":"",g=t.message.message_type==="text"&&lo(s),c=this.#c.get(e),I=this.#i.status(e);if(g&&t.message.chat_type!=="p2p")return this.#te(t,o,a,{message:Tn()});if(t.message.chat_type==="p2p"&&(g||I.phase==="collecting")){let Q=/^\/batch$/iu.test(s)&&I.phase==="idle"&&(this.#a.has(e)||c||this.#Q.hasPending(e))?{handled:!0,kind:"busy",message:po()}:this.#i.handle(e,s,{plainText:t.message.message_type==="text"&&!!s});if(Q.handled){if(Q.kind==="submit"){let y={...t,batchSubmission:{token:Q.token},message:{...t.message,message_type:"text",content:JSON.stringify({text:Q.prompt}),mentions:[]}};return this.#z(y,o,e,a)}return this.#te(t,o,a,Q)}}if(tTe.test(r))return Promise.resolve().then(()=>this.#Se(t,e,{alreadyRecorded:!1})).then(()=>this.#Ae(o,a,"DONE")).catch(Q=>this.#V(t,o,a,Q)).finally(()=>this.#o.delete(o));let d=Gt(A)?null:Pi(r)?gi:Gi(r)?Fi:Li(r)?ci:null;if(d&&i){let f=this.#Fe(t,o,e,A,d),Q;return Q=f.then(()=>this.#Ae(o,a,"DONE")).catch(y=>this.#V(t,o,a,y)).finally(()=>{this.#o.delete(o),this.#g.delete(Q)}),this.#g.add(Q),Q}if(this.#fe(t,e))return Promise.resolve().then(()=>this.#Qe(t,o)).then(()=>this.#Ae(o,a,"DONE")).catch(Q=>this.#V(t,o,a,Q)).finally(()=>this.#o.delete(o));let B=this.#Q.claimReply({key:e,actor:$y(t),messageId:o,text:zp(t)??"",addressed:i,hasPendingQuestion:!!c,questionCompletion:c?.submitting||c?.claimedReplyMessageId?c.queue:null,isQuestionPending:()=>this.#c.has(e),send:f=>this.#D(t.message.chat_id,f)});if(B){let f=B.process(async()=>this.#r.hasSeen(o)?!1:(await this.#r.markSeen(o),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1,!0)),Q;return Q=f.then(()=>this.#Ae(o,a,"DONE")).catch(y=>this.#V(t,o,a,y)).finally(()=>{this.#o.delete(o),this.#n.delete(Q)}),this.#n.add(Q),Q}if(c&&$y(t)!==c.actor)return this.#z(t,o,e,a);if(c?.submitting||c?.claimedReplyMessageId)return this.#z(t,o,e,a);if(c){nTe(t,c)&&(c.claimedReplyMessageId=o);let Q=(c.queue??Promise.resolve()).catch(()=>{}).then(()=>this.#lA(t,o,e,c,a));c.queue=Q;let y=()=>{c.claimedReplyMessageId===o&&(c.claimedReplyMessageId=null),c.queue===Q&&(c.queue=null)},m;return m=Q.then(()=>(y(),this.#Ae(o,a,"DONE")),_=>(y(),this.#V(t,o,a,_))).finally(()=>{y(),this.#o.delete(o),this.#n.delete(m)}),this.#n.add(m),m}return this.#z(t,o,e,a)}#te(t,o,i,e){let a;return a=Promise.resolve().then(async()=>{this.#r.hasSeen(o)||(await this.#r.markSeen(o),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1,e?.message&&await this.#D(t.message.chat_id,e.message),this.#C.lastError=null)}).then(()=>this.#Ae(o,i,"DONE")).catch(A=>this.#V(t,o,i,A)).finally(()=>{this.#o.delete(o),this.#g.delete(a)}),this.#g.add(a),a}#z(t,o,i,e,{releaseMessageId:a=!0,alreadyRecorded:A=!1,finalize:r=!0}={}){let g=(this.#a.get(i)??Promise.resolve()).catch(()=>{}).then(()=>this.#Se(t,i,{alreadyRecorded:A})),c=r?g.then(async d=>(await this.#Ae(o,e,"DONE"),d)).catch(d=>this.#V(t,o,e,d)):g,I;return I=c.finally(()=>{a&&this.#o.delete(o),this.#a.get(i)===I&&this.#a.delete(i)}),this.#a.set(i,I),I}#Z(t,{logLabel:o="operation",logLevel:i="warn",userMessage:e,reason:a}={}){this.#C.lastError=t?.message??String(t);let A=At(this.#C,t,{userMessage:e,reason:a});return this.#w?.[i]?.(`[dsh-feishu] ${o} failed [${A.referenceId}]:`,t?.message??String(t)),A}async#x(t,o,i={}){let e=this.#Z(o,i),a=i.appendMessage?`${dt(e)}
|
|
338
338
|
|
|
339
339
|
${i.appendMessage}`:dt(e);return await this.#D(t,a).catch(()=>{}),e}async#V(t,o,i,e){if(e?.code==="turn-stopped"){await this.#Ge(o,i),e?.batchInputMessage&&await this.#D(t.message.chat_id,e.batchInputMessage).catch(()=>{});return}if(this.#S?.aborted){await this.#Ge(o,i);return}let a=Eo(e)??go(e),A=this.#Z(e,{logLabel:"message handling",logLevel:"error",userMessage:a,reason:vi(e)?.reason});await this.#Ae(o,i,"ERROR");let r=e?.batchInputMessage?`${dt(A)}
|
|
340
340
|
|
|
341
|
-
${e.batchInputMessage}`:dt(A);await this.#D(t.message.chat_id,r).catch(()=>{})}async waitForIdle(){for(;;){let t=[...this.#a.values(),...[...this.#c.values()].flatMap(o=>o.queue?[o.queue]:[]),...this.#n,...this.#g,...this.#l,...this.#J.values(),...[...this.#P.values()].map(o=>o.promise)];if(t.length===0||(await Promise.allSettled(t),this.#a.size===0&&this.#n.size===0&&this.#g.size===0&&this.#l.size===0&&this.#J.size===0&&this.#P.size===0&&![...this.#c.values()].some(o=>o.queue)))return}}#j(){let t=AbortSignal.timeout(this.#G);return this.#S?AbortSignal.any([this.#S,t]):t}#ee(t){return this.#c.has(t)||this.#Q.hasPending(t)}async#Fe(t,o,i,e,a){if(this.#S?.throwIfAborted(),this.#r.hasSeen(o))return;await this.#r.markSeen(o),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1;let A=await a(CA(e.content)??"",this.#t,this.#r,i,{signal:this.#S,hasImages:qt(e),hasFiles:Gt(e),pendingInteraction:this.#ee(i),control:{owner:this,key:i}});A?.stopped&&await Promise.allSettled([this.#me(i),this.#Q.closeRoute(i)]);for(let r of A?.messages??[A?.message])r&&await this.#D(t.message.chat_id,r);this.#C.lastError=null}async#Se(t,o,{alreadyRecorded:i=!1}={}){this.#S?.throwIfAborted();let e=t.message.message_id;if(!i){if(this.#r.hasSeen(e))return;await this.#r.markSeen(e),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1}let a=Pk(t,this.#e),A=a.content,r=qt(a),s=Gt(a),g=t.message.message_type==="text"&&!r&&!s?A:null;if(!A&&!r&&!s){await this.#D(t.message.chat_id,D("\u76EE\u524D\u652F\u6301\u6587\u5B57\u3001\u56FE\u7247\u548C\u6587\u4EF6\u6D88\u606F\u3002"));return}if(g!==null&&P_e.test(g)){await this.#De(t,g);return}if(g==="/help"){await this.#D(t.message.chat_id,Fz());return}if(v_e.test(g)){await this.#X(o,t.message.chat_id);return}if(g==="/new"){if(this.#a.has(o)||this.#ee(o)){await this.#D(t.message.chat_id,D("\u5F53\u524D\u4EFB\u52A1\u4ECD\u5728\u8FD0\u884C\uFF0C\u8BF7\u5148\u505C\u6B62\u4EFB\u52A1\u6216\u7B49\u5F85\u4EFB\u52A1\u5B8C\u6210\u540E\u518D\u5F00\u542F\u65B0\u4F1A\u8BDD\u3002"));return}await this.#r.clearSession(o),await this.#D(t.message.chat_id,D("\u5DF2\u5F00\u542F\u5168\u65B0 Harness \u4F1A\u8BDD\u3002")),await this.#X(o,t.message.chat_id);return}if(g==="/status"){await this.#Xe(o,t.message.chat_id);return}if(g==="/compact"){let f=await si(g,this.#t,this.#r,o,{signal:this.#S});f&&await this.#D(t.message.chat_id,f.message);return}if(L_e.test(g)){let f=g.slice(12).trim()||null;await this.#ge({chatId:t.message.chat_id,key:o},f,0);return}if(U_e.test(g)){await this.#be({chatId:t.message.chat_id,key:o});return}if(qz.test(g)){let f=(qz.exec(g)?.[1]??"").trim()||null;await this.#he(o,t.message.chat_id,f);return}if(zz.test(g)){let f=(zz.exec(g)?.[1]??"").trim()||null;await this.#Ee(o,t.message.chat_id,f);return}if(F_e.test(g)){await this.#Ce(o,t.message.chat_id);return}if(Wz.test(g)){let Q=Wz.exec(g)[1]?.toLowerCase();if(Q!=="on"&&Q!=="off"){await this.#D(t.message.chat_id,D("\u7528\u6CD5\uFF1A/archived on\uFF08\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\uFF09\u6216 /archived off\uFF08\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\uFF09"));return}typeof this.#r?.setIncludeArchivedSessions=="function"&&await this.#r.setIncludeArchivedSessions(Q==="on"),await this.#D(t.message.chat_id,Q==="on"?D("\u5DF2\u5F00\u542F\uFF1A\u4F1A\u8BDD\u5217\u8868\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\u3002"):D("\u5DF2\u5173\u95ED\uFF1A\u4F1A\u8BDD\u5217\u8868\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\u3002"));return}if(H_e.test(g)){let f=this.#Je(o);if(f){await this.#qe(f,Number(g),{chatId:t.message.chat_id,key:o,event:t});return}}let c=g===null?null:await Io(A,this.#t,o);if(c){for(let f of c.messages??[c.message])await this.#D(t.message.chat_id,f);return}let I=g===null?null:await si(g,this.#t,this.#r,o,{signal:this.#S});if(I){await this.#D(t.message.chat_id,I.message);return}this.#w.info?.(`[dsh-feishu] processing ${t.message.chat_type} message ${e}`);let d=t.batchSubmission??null,B=!1;try{let{receipt:f,artifactSendErrors:Q,textDeliveryErrors:y=0}=await this.#IA(t,o,a,{onAskComplete:d?()=>{B=this.#i.complete(o,d.token).completed}:void 0});return this.#C.messagesReplied+=1,this.#C.lastReplyAt=new Date().toISOString(),this.#C.lastError=null,y===0&&Q===0&&oo(this.#C),f}catch(f){if(d&&!B){if(f?.code==="turn-stopped")throw this.#i.complete(o,d.token),f;let Q=this.#i.fail(o,d.token);if(Q.retained){let y=new Error(f?.message??String(f),{cause:f});throw y.code=f?.code,y.providerCode=f?.providerCode,y.method=f?.method,Number.isInteger(f?.status)&&(y.status=f.status),y.batchInputMessage=Q.message,y}}throw f}finally{await this.#me(o),await this.#Q.closeRoute(o)}}async#De(t,o){if(t?.message?.chat_type!=="p2p"){await this.#D(t.message.chat_id,D("\u4E3A\u907F\u514D\u6388\u6743\u94FE\u63A5\u66B4\u9732\uFF0C\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u53D1\u9001 /repair\u3002"));return}let i=oTe(t);if(!i){await this.#D(t.message.chat_id,D("\u65E0\u6CD5\u8BC6\u522B\u5F53\u524D\u53D1\u9001\u8005\uFF0C\u672A\u53D1\u8D77\u4FEE\u590D\u3002"));return}if(!this.#v){await this.#D(t.message.chat_id,D("\u5F53\u524D Host \u7248\u672C\u6682\u4E0D\u652F\u6301\u804A\u5929\u5185\u4FEE\u590D\uFF0C\u8BF7\u5148\u66F4\u65B0\u63D2\u4EF6\u3002"));return}let e=G_e.exec(o);if(!e){await this.#D(t.message.chat_id,D("\u7528\u6CD5\uFF1A/repair\u3001/repair qr\u3001/repair status\u3001/repair cancel \u6216 /repair verify"));return}let a=e[1]?.toLowerCase()??"start",A=t.message.chat_id;if(a==="start"){await this.#Le({actorOpenId:i,chatId:A});return}let r=this.#T;if(!r){await this.#D(A,D("\u5F53\u524D Runtime \u6CA1\u6709\u53EF\u6062\u590D\u7684\u4FEE\u590D\u4EFB\u52A1\u8BB0\u5F55\uFF08\u673A\u5668\u4EBA\u53EF\u80FD\u521A\u5B8C\u6210\u5BC6\u94A5\u66F4\u65B0\u5E76\u91CD\u542F\uFF09\u3002\u672C\u547D\u4EE4\u4E0D\u4F1A\u542F\u52A8\u65B0\u7684\u6388\u6743\uFF1B\u8BF7\u67E5\u770B\u673A\u5668\u4EBA\u53D1\u9001\u7684\u9A8C\u8BC1\u7ED3\u679C\uFF0C\u786E\u8BA4\u4E0A\u4E00\u6B21\u4EFB\u52A1\u5DF2\u7ED3\u675F\u540E\u518D\u53D1\u9001 /repair\u3002"));return}if(r.actorOpenId!==i){await this.#D(A,D("\u53E6\u4E00\u4F4D\u7528\u6237\u6B63\u5728\u4FEE\u590D\u8BE5\u673A\u5668\u4EBA\uFF0C\u672C\u6B21\u4E0D\u4F1A\u663E\u793A\u5176\u6388\u6743\u4FE1\u606F\u3002"));return}if(a==="cancel"){let g;try{let c=await this.#v.cancel(this.#se(r));g=NC(c,{botId:this.#_}),r.snapshot=g}catch{await this.#D(A,D("\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u4FEE\u590D\u4EFB\u52A1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}g.state==="cancelled"&&(r.stopped=!0,this.#F+=1),await this.#D(A,this.#re(g));return}let s;try{s=await this.#le(r)}catch{await this.#D(A,D("\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\u4FEE\u590D\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}if(a==="qr"){if(!Lk.has(s.state)||!r.verificationUrl){await this.#D(A,this.#re(s,{verificationFocused:!0}));return}await this.#xe(A,r.verificationUrl,s);return}await this.#D(A,this.#re(s,{verificationFocused:a==="verify"}))}#se(t){return{botId:this.#_,attemptId:t.attemptId,actorOpenId:t.actorOpenId,chatId:t.chatId}}async#Le({actorOpenId:t,chatId:o}){let i=this.#T,e=!1;if(i&&Lk.has(i.snapshot.state)){if(i.actorOpenId!==t){await this.#D(o,D("\u53E6\u4E00\u4F4D\u7528\u6237\u6B63\u5728\u4FEE\u590D\u8BE5\u673A\u5668\u4EBA\uFF0C\u672C\u6B21\u4E0D\u4F1A\u663E\u793A\u5176\u6388\u6743\u4FE1\u606F\u3002"));return}let r;try{r=await this.#le(i)}catch{await this.#D(o,D("\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\u4FEE\u590D\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}if(r.state==="saving"){await this.#D(o,this.#re(r));return}if(eV.has(r.state)){let s;try{s=NC(await this.#v.cancel(this.#se(i)),{botId:this.#_}),i.snapshot=s}catch{await this.#D(o,D("\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u65E7\u4FEE\u590D\u4EFB\u52A1\uFF0C\u672A\u751F\u6210\u65B0\u94FE\u63A5\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}if(!Vy.has(s.state)){await this.#D(o,this.#re(s));return}i.stopped=!0,this.#F+=1,e=s.state==="cancelled"}else Vy.has(r.state)&&(i.stopped=!0,this.#F+=1)}let a;try{a=NC(await this.#v.start({botId:this.#_,actorOpenId:t,chatId:o}),{botId:this.#_}),a=await this.#Ue(a,{actorOpenId:t,chatId:o})}catch{await this.#D(o,D("\u4FEE\u590D\u6D41\u7A0B\u6682\u65F6\u5931\u8D25\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u8BF7\u7A0D\u540E\u53D1\u9001 /repair \u91CD\u8BD5\u3002"));return}let A={attemptId:a.attemptId,actorOpenId:t,chatId:o,snapshot:a,verificationUrl:null,stopped:!1,announcedSaving:!1,announcedTerminal:!1};if(this.#T=A,a.verificationUrl)try{A.verificationUrl=$z(a.verificationUrl,this.#R)}catch{A.stopped=!0,await this.#v.cancel(this.#se(A)).catch(()=>{}),await this.#D(o,D("\u98DE\u4E66\u8FD4\u56DE\u4E86\u65E0\u6CD5\u5B89\u5168\u9A8C\u8BC1\u7684\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002"));return}if(Vy.has(a.state)){A.announcedTerminal=!0,a.state!=="succeeded"&&await this.#D(o,this.#re(a));return}if(!A.verificationUrl){A.stopped=!0,await this.#D(o,D("\u98DE\u4E66\u672A\u8FD4\u56DE\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002"));return}await this.#Ke(o,A.verificationUrl,a,{restarted:e}),this.#He(A)}async#Ue(t,o){let i=t,e=Date.now()+this.#U;for(;!i.verificationUrl&&Lk.has(i.state);){if(Date.now()>=e)throw new Error("Feishu repair link timed out");await Xz(Math.min(100,this.#O),this.#S),i=NC(await this.#v.status({botId:this.#_,attemptId:i.attemptId,actorOpenId:o.actorOpenId,chatId:o.chatId}),{botId:this.#_})}return i}async#le(t){let o=NC(await this.#v.status(this.#se(t)),{botId:this.#_});if(o.attemptId!==t.attemptId)throw new Error("Feishu repair attempt changed unexpectedly");return t.snapshot=o,o.verificationUrl&&(t.verificationUrl=$z(o.verificationUrl,this.#R)),o}#He(t){let o=++this.#F;(async()=>{for(;!t.stopped&&this.#T===t&&this.#F===o&&!this.#S?.aborted;){let i=Math.max(250,Math.min(1e4,t.snapshot.pollIntervalMs??this.#O));if(await Xz(i,this.#S),t.stopped||this.#T!==t||this.#F!==o)return;let e=await this.#le(t);if(e.state==="saving"&&!t.announcedSaving&&(t.announcedSaving=!0,await this.#D(t.chatId,D("\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u53D1\u9001\u5E76\u7B49\u5F85\u6D4B\u8BD5\u6309\u94AE\u56DE\u8C03\uFF1B\u6536\u5230\u771F\u5B9E\u56DE\u8C03\u540E\u624D\u4F1A\u5B8C\u6210\u3002"))),Vy.has(e.state)){t.stopped=!0,e.state!=="succeeded"&&!t.announcedTerminal&&(t.announcedTerminal=!0,await this.#D(t.chatId,this.#re(e)));return}}})().catch(async()=>{this.#S?.aborted||t.stopped||this.#T!==t||(t.stopped=!0,this.#w.warn?.("[dsh-feishu] callback repair status monitoring failed"),await this.#D(t.chatId,D("\u4FEE\u590D\u72B6\u6001\u67E5\u8BE2\u4E2D\u65AD\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u53D1\u9001 /repair status \u91CD\u8BD5\u67E5\u8BE2\u3002")).catch(()=>{}))})}async#Ke(t,o,i,{restarted:e=!1}={}){let a=i.remainingSeconds??(i.expiresAt?Math.max(0,Math.ceil((i.expiresAt-Date.now())/1e3)):null),A=a===null?D("\u94FE\u63A5\u4E3A\u77ED\u671F\u6709\u6548"):D("\u94FE\u63A5\u7EA6 {minutes} \u5206\u949F\u540E\u8FC7\u671F",{minutes:Math.max(1,Math.ceil(a/60))});await this.#D(t,[e?D("\u65E7\u6388\u6743\u94FE\u63A5\u5DF2\u4F5C\u5E9F\uFF0C\u5DF2\u751F\u6210\u65B0\u7684\u4FEE\u590D\u94FE\u63A5\u3002"):D("\u{1F527} \u51C6\u5907\u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03\u3002"),D("\u672C\u6B21\u6700\u591A\u589E\u91CF\u6DFB\u52A0\u4E09\u9879\uFF1A\u5361\u7247\u56DE\u8C03 card.action.trigger\uFF1B\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\u7684\u79DF\u6237\u6743\u9650 im:message:readonly\uFF08\u7528\u4E8E\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u4E2D\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\uFF1B\u4EE5\u53CA im:resource\uFF08\u7528\u4E8E\u4E0A\u4F20\u673A\u5668\u4EBA\u53D1\u9001\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\u3002\u786E\u8BA4\u9875\u53EA\u4F1A\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u7684\u9879\uFF1B\u82E5\u51FA\u73B0\u4E0A\u8FF0\u8303\u56F4\u4E4B\u5916\u7684\u914D\u7F6E\uFF0C\u8BF7\u53D6\u6D88\u3002"),"",D("\u5F53\u524D\u8BBE\u5907\u76F4\u63A5\u6253\u5F00\uFF1A"),o,"",D("\u82E5\u8981\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\uFF0C\u53D1\u9001 /repair qr\u3002{expiry}\u3002",{expiry:A})].join(`
|
|
341
|
+
${e.batchInputMessage}`:dt(A);await this.#D(t.message.chat_id,r).catch(()=>{})}async waitForIdle(){for(;;){let t=[...this.#a.values(),...[...this.#c.values()].flatMap(o=>o.queue?[o.queue]:[]),...this.#n,...this.#g,...this.#l,...this.#J.values(),...[...this.#P.values()].map(o=>o.promise)];if(t.length===0||(await Promise.allSettled(t),this.#a.size===0&&this.#n.size===0&&this.#g.size===0&&this.#l.size===0&&this.#J.size===0&&this.#P.size===0&&![...this.#c.values()].some(o=>o.queue)))return}}#j(){let t=AbortSignal.timeout(this.#G);return this.#S?AbortSignal.any([this.#S,t]):t}#ee(t){return this.#c.has(t)||this.#Q.hasPending(t)}async#Fe(t,o,i,e,a){if(this.#S?.throwIfAborted(),this.#r.hasSeen(o))return;await this.#r.markSeen(o),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1;let A=await a(CA(e.content)??"",this.#t,this.#r,i,{signal:this.#S,hasImages:qt(e),hasFiles:Gt(e),pendingInteraction:this.#ee(i),control:{owner:this,key:i}});A?.stopped&&await Promise.allSettled([this.#me(i),this.#Q.closeRoute(i)]);for(let r of A?.messages??[A?.message])r&&await this.#D(t.message.chat_id,r);this.#C.lastError=null}async#Se(t,o,{alreadyRecorded:i=!1}={}){this.#S?.throwIfAborted();let e=t.message.message_id;if(!i){if(this.#r.hasSeen(e))return;await this.#r.markSeen(e),this.#C.lastMessageAt=new Date().toISOString(),this.#C.messagesReceived+=1}let a=Pk(t,this.#e),A=a.content,r=qt(a),s=Gt(a),g=!r&&!s&&A?A.trim():null;if(!A&&!r&&!s){await this.#D(t.message.chat_id,D("\u76EE\u524D\u652F\u6301\u6587\u5B57\u3001\u56FE\u7247\u548C\u6587\u4EF6\u6D88\u606F\u3002"));return}if(g!==null&&P_e.test(g)){await this.#De(t,g);return}if(g==="/help"){await this.#D(t.message.chat_id,Fz());return}if(v_e.test(g)){await this.#X(o,t.message.chat_id);return}if(g==="/new"){if(this.#a.has(o)||this.#ee(o)){await this.#D(t.message.chat_id,D("\u5F53\u524D\u4EFB\u52A1\u4ECD\u5728\u8FD0\u884C\uFF0C\u8BF7\u5148\u505C\u6B62\u4EFB\u52A1\u6216\u7B49\u5F85\u4EFB\u52A1\u5B8C\u6210\u540E\u518D\u5F00\u542F\u65B0\u4F1A\u8BDD\u3002"));return}await this.#r.clearSession(o),await this.#D(t.message.chat_id,D("\u5DF2\u5F00\u542F\u5168\u65B0 Harness \u4F1A\u8BDD\u3002")),await this.#X(o,t.message.chat_id);return}if(g==="/status"){await this.#Xe(o,t.message.chat_id);return}if(g==="/compact"){let f=await si(g,this.#t,this.#r,o,{signal:this.#S});f&&await this.#D(t.message.chat_id,f.message);return}if(L_e.test(g)){let f=g.slice(12).trim()||null;await this.#ge({chatId:t.message.chat_id,key:o},f,0);return}if(U_e.test(g)){await this.#be({chatId:t.message.chat_id,key:o});return}if(qz.test(g)){let f=(qz.exec(g)?.[1]??"").trim()||null;await this.#he(o,t.message.chat_id,f);return}if(zz.test(g)){let f=(zz.exec(g)?.[1]??"").trim()||null;await this.#Ee(o,t.message.chat_id,f);return}if(F_e.test(g)){await this.#Ce(o,t.message.chat_id);return}if(Wz.test(g)){let Q=Wz.exec(g)[1]?.toLowerCase();if(Q!=="on"&&Q!=="off"){await this.#D(t.message.chat_id,D("\u7528\u6CD5\uFF1A/archived on\uFF08\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\uFF09\u6216 /archived off\uFF08\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\uFF09"));return}typeof this.#r?.setIncludeArchivedSessions=="function"&&await this.#r.setIncludeArchivedSessions(Q==="on"),await this.#D(t.message.chat_id,Q==="on"?D("\u5DF2\u5F00\u542F\uFF1A\u4F1A\u8BDD\u5217\u8868\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\u3002"):D("\u5DF2\u5173\u95ED\uFF1A\u4F1A\u8BDD\u5217\u8868\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\u3002"));return}if(H_e.test(g)){let f=this.#Je(o);if(f){await this.#qe(f,Number(g),{chatId:t.message.chat_id,key:o,event:t});return}}let c=g===null?null:await Io(A,this.#t,o);if(c){for(let f of c.messages??[c.message])await this.#D(t.message.chat_id,f);return}let I=g===null?null:await si(g,this.#t,this.#r,o,{signal:this.#S});if(I){await this.#D(t.message.chat_id,I.message);return}this.#w.info?.(`[dsh-feishu] processing ${t.message.chat_type} message ${e}`);let d=t.batchSubmission??null,B=!1;try{let{receipt:f,artifactSendErrors:Q,textDeliveryErrors:y=0}=await this.#IA(t,o,a,{onAskComplete:d?()=>{B=this.#i.complete(o,d.token).completed}:void 0});return this.#C.messagesReplied+=1,this.#C.lastReplyAt=new Date().toISOString(),this.#C.lastError=null,y===0&&Q===0&&oo(this.#C),f}catch(f){if(d&&!B){if(f?.code==="turn-stopped")throw this.#i.complete(o,d.token),f;let Q=this.#i.fail(o,d.token);if(Q.retained){let y=new Error(f?.message??String(f),{cause:f});throw y.code=f?.code,y.providerCode=f?.providerCode,y.method=f?.method,Number.isInteger(f?.status)&&(y.status=f.status),y.batchInputMessage=Q.message,y}}throw f}finally{await this.#me(o),await this.#Q.closeRoute(o)}}async#De(t,o){if(t?.message?.chat_type!=="p2p"){await this.#D(t.message.chat_id,D("\u4E3A\u907F\u514D\u6388\u6743\u94FE\u63A5\u66B4\u9732\uFF0C\u8BF7\u79C1\u804A\u673A\u5668\u4EBA\u53D1\u9001 /repair\u3002"));return}let i=oTe(t);if(!i){await this.#D(t.message.chat_id,D("\u65E0\u6CD5\u8BC6\u522B\u5F53\u524D\u53D1\u9001\u8005\uFF0C\u672A\u53D1\u8D77\u4FEE\u590D\u3002"));return}if(!this.#v){await this.#D(t.message.chat_id,D("\u5F53\u524D Host \u7248\u672C\u6682\u4E0D\u652F\u6301\u804A\u5929\u5185\u4FEE\u590D\uFF0C\u8BF7\u5148\u66F4\u65B0\u63D2\u4EF6\u3002"));return}let e=G_e.exec(o);if(!e){await this.#D(t.message.chat_id,D("\u7528\u6CD5\uFF1A/repair\u3001/repair qr\u3001/repair status\u3001/repair cancel \u6216 /repair verify"));return}let a=e[1]?.toLowerCase()??"start",A=t.message.chat_id;if(a==="start"){await this.#Le({actorOpenId:i,chatId:A});return}let r=this.#T;if(!r){await this.#D(A,D("\u5F53\u524D Runtime \u6CA1\u6709\u53EF\u6062\u590D\u7684\u4FEE\u590D\u4EFB\u52A1\u8BB0\u5F55\uFF08\u673A\u5668\u4EBA\u53EF\u80FD\u521A\u5B8C\u6210\u5BC6\u94A5\u66F4\u65B0\u5E76\u91CD\u542F\uFF09\u3002\u672C\u547D\u4EE4\u4E0D\u4F1A\u542F\u52A8\u65B0\u7684\u6388\u6743\uFF1B\u8BF7\u67E5\u770B\u673A\u5668\u4EBA\u53D1\u9001\u7684\u9A8C\u8BC1\u7ED3\u679C\uFF0C\u786E\u8BA4\u4E0A\u4E00\u6B21\u4EFB\u52A1\u5DF2\u7ED3\u675F\u540E\u518D\u53D1\u9001 /repair\u3002"));return}if(r.actorOpenId!==i){await this.#D(A,D("\u53E6\u4E00\u4F4D\u7528\u6237\u6B63\u5728\u4FEE\u590D\u8BE5\u673A\u5668\u4EBA\uFF0C\u672C\u6B21\u4E0D\u4F1A\u663E\u793A\u5176\u6388\u6743\u4FE1\u606F\u3002"));return}if(a==="cancel"){let g;try{let c=await this.#v.cancel(this.#se(r));g=NC(c,{botId:this.#_}),r.snapshot=g}catch{await this.#D(A,D("\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u4FEE\u590D\u4EFB\u52A1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}g.state==="cancelled"&&(r.stopped=!0,this.#F+=1),await this.#D(A,this.#re(g));return}let s;try{s=await this.#le(r)}catch{await this.#D(A,D("\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\u4FEE\u590D\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}if(a==="qr"){if(!Lk.has(s.state)||!r.verificationUrl){await this.#D(A,this.#re(s,{verificationFocused:!0}));return}await this.#xe(A,r.verificationUrl,s);return}await this.#D(A,this.#re(s,{verificationFocused:a==="verify"}))}#se(t){return{botId:this.#_,attemptId:t.attemptId,actorOpenId:t.actorOpenId,chatId:t.chatId}}async#Le({actorOpenId:t,chatId:o}){let i=this.#T,e=!1;if(i&&Lk.has(i.snapshot.state)){if(i.actorOpenId!==t){await this.#D(o,D("\u53E6\u4E00\u4F4D\u7528\u6237\u6B63\u5728\u4FEE\u590D\u8BE5\u673A\u5668\u4EBA\uFF0C\u672C\u6B21\u4E0D\u4F1A\u663E\u793A\u5176\u6388\u6743\u4FE1\u606F\u3002"));return}let r;try{r=await this.#le(i)}catch{await this.#D(o,D("\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\u4FEE\u590D\u72B6\u6001\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}if(r.state==="saving"){await this.#D(o,this.#re(r));return}if(eV.has(r.state)){let s;try{s=NC(await this.#v.cancel(this.#se(i)),{botId:this.#_}),i.snapshot=s}catch{await this.#D(o,D("\u6682\u65F6\u65E0\u6CD5\u53D6\u6D88\u65E7\u4FEE\u590D\u4EFB\u52A1\uFF0C\u672A\u751F\u6210\u65B0\u94FE\u63A5\uFF1B\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"));return}if(!Vy.has(s.state)){await this.#D(o,this.#re(s));return}i.stopped=!0,this.#F+=1,e=s.state==="cancelled"}else Vy.has(r.state)&&(i.stopped=!0,this.#F+=1)}let a;try{a=NC(await this.#v.start({botId:this.#_,actorOpenId:t,chatId:o}),{botId:this.#_}),a=await this.#Ue(a,{actorOpenId:t,chatId:o})}catch{await this.#D(o,D("\u4FEE\u590D\u6D41\u7A0B\u6682\u65F6\u5931\u8D25\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u8BF7\u7A0D\u540E\u53D1\u9001 /repair \u91CD\u8BD5\u3002"));return}let A={attemptId:a.attemptId,actorOpenId:t,chatId:o,snapshot:a,verificationUrl:null,stopped:!1,announcedSaving:!1,announcedTerminal:!1};if(this.#T=A,a.verificationUrl)try{A.verificationUrl=$z(a.verificationUrl,this.#R)}catch{A.stopped=!0,await this.#v.cancel(this.#se(A)).catch(()=>{}),await this.#D(o,D("\u98DE\u4E66\u8FD4\u56DE\u4E86\u65E0\u6CD5\u5B89\u5168\u9A8C\u8BC1\u7684\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002"));return}if(Vy.has(a.state)){A.announcedTerminal=!0,a.state!=="succeeded"&&await this.#D(o,this.#re(a));return}if(!A.verificationUrl){A.stopped=!0,await this.#D(o,D("\u98DE\u4E66\u672A\u8FD4\u56DE\u6388\u6743\u94FE\u63A5\uFF0C\u5DF2\u4E2D\u6B62\u672C\u6B21\u4FEE\u590D\u3002"));return}await this.#Ke(o,A.verificationUrl,a,{restarted:e}),this.#He(A)}async#Ue(t,o){let i=t,e=Date.now()+this.#U;for(;!i.verificationUrl&&Lk.has(i.state);){if(Date.now()>=e)throw new Error("Feishu repair link timed out");await Xz(Math.min(100,this.#O),this.#S),i=NC(await this.#v.status({botId:this.#_,attemptId:i.attemptId,actorOpenId:o.actorOpenId,chatId:o.chatId}),{botId:this.#_})}return i}async#le(t){let o=NC(await this.#v.status(this.#se(t)),{botId:this.#_});if(o.attemptId!==t.attemptId)throw new Error("Feishu repair attempt changed unexpectedly");return t.snapshot=o,o.verificationUrl&&(t.verificationUrl=$z(o.verificationUrl,this.#R)),o}#He(t){let o=++this.#F;(async()=>{for(;!t.stopped&&this.#T===t&&this.#F===o&&!this.#S?.aborted;){let i=Math.max(250,Math.min(1e4,t.snapshot.pollIntervalMs??this.#O));if(await Xz(i,this.#S),t.stopped||this.#T!==t||this.#F!==o)return;let e=await this.#le(t);if(e.state==="saving"&&!t.announcedSaving&&(t.announcedSaving=!0,await this.#D(t.chatId,D("\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u53D1\u9001\u5E76\u7B49\u5F85\u6D4B\u8BD5\u6309\u94AE\u56DE\u8C03\uFF1B\u6536\u5230\u771F\u5B9E\u56DE\u8C03\u540E\u624D\u4F1A\u5B8C\u6210\u3002"))),Vy.has(e.state)){t.stopped=!0,e.state!=="succeeded"&&!t.announcedTerminal&&(t.announcedTerminal=!0,await this.#D(t.chatId,this.#re(e)));return}}})().catch(async()=>{this.#S?.aborted||t.stopped||this.#T!==t||(t.stopped=!0,this.#w.warn?.("[dsh-feishu] callback repair status monitoring failed"),await this.#D(t.chatId,D("\u4FEE\u590D\u72B6\u6001\u67E5\u8BE2\u4E2D\u65AD\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u53D1\u9001 /repair status \u91CD\u8BD5\u67E5\u8BE2\u3002")).catch(()=>{}))})}async#Ke(t,o,i,{restarted:e=!1}={}){let a=i.remainingSeconds??(i.expiresAt?Math.max(0,Math.ceil((i.expiresAt-Date.now())/1e3)):null),A=a===null?D("\u94FE\u63A5\u4E3A\u77ED\u671F\u6709\u6548"):D("\u94FE\u63A5\u7EA6 {minutes} \u5206\u949F\u540E\u8FC7\u671F",{minutes:Math.max(1,Math.ceil(a/60))});await this.#D(t,[e?D("\u65E7\u6388\u6743\u94FE\u63A5\u5DF2\u4F5C\u5E9F\uFF0C\u5DF2\u751F\u6210\u65B0\u7684\u4FEE\u590D\u94FE\u63A5\u3002"):D("\u{1F527} \u51C6\u5907\u8865\u5168\u6743\u9650\u4E0E\u56DE\u8C03\u3002"),D("\u672C\u6B21\u6700\u591A\u589E\u91CF\u6DFB\u52A0\u4E09\u9879\uFF1A\u5361\u7247\u56DE\u8C03 card.action.trigger\uFF1B\u98DE\u4E66\u663E\u793A\u4E3A\u201C\u83B7\u53D6\u5355\u804A\u3001\u7FA4\u7EC4\u6D88\u606F\u201D\u7684\u79DF\u6237\u6743\u9650 im:message:readonly\uFF08\u7528\u4E8E\u8BFB\u53D6\u7528\u6237\u6D88\u606F\u4E2D\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\uFF1B\u4EE5\u53CA im:resource\uFF08\u7528\u4E8E\u4E0A\u4F20\u673A\u5668\u4EBA\u53D1\u9001\u7684\u56FE\u7247\u6216\u6587\u4EF6\uFF09\u3002\u786E\u8BA4\u9875\u53EA\u4F1A\u663E\u793A\u5F53\u524D\u7F3A\u5C11\u7684\u9879\uFF1B\u82E5\u51FA\u73B0\u4E0A\u8FF0\u8303\u56F4\u4E4B\u5916\u7684\u914D\u7F6E\uFF0C\u8BF7\u53D6\u6D88\u3002"),"",D("\u5F53\u524D\u8BBE\u5907\u76F4\u63A5\u6253\u5F00\uFF1A"),o,"",D("\u82E5\u8981\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\uFF0C\u53D1\u9001 /repair qr\u3002{expiry}\u3002",{expiry:A})].join(`
|
|
342
342
|
`))}async#xe(t,o,i){try{let e=await R_e.toBuffer(o,{errorCorrectionLevel:"M",margin:1,width:480,type:"png"}),a=await this.#e.im.v1.image.create({data:{image_type:"message",image:e}}),A=CA(a?.image_key)??CA(a?.data?.image_key);if(!A)throw new Error("Feishu QR upload returned no image key");let r=i.remainingSeconds??(i.expiresAt?Math.max(0,Math.ceil((i.expiresAt-Date.now())/1e3)):null),s=r===null?"":D("\uFF08\u5269\u4F59\u7EA6 {minutes} \u5206\u949F\uFF09",{minutes:Math.max(1,Math.ceil(r/60))});await this.#D(t,D("\u8BF7\u7528\u53E6\u4E00\u53F0\u8BBE\u5907\u626B\u7801\u5B8C\u6210\u6388\u6743{remaining}\u3002",{remaining:s}));let g=await this.#e.im.v1.message.create({params:{receive_id_type:"chat_id"},data:{receive_id:t,msg_type:"image",content:JSON.stringify({image_key:A})}});if(g?.code&&g.code!==0)throw new Error("Feishu QR message send failed")}catch{await this.#D(t,D(`\u4E8C\u7EF4\u7801\u6682\u65F6\u65E0\u6CD5\u53D1\u9001\uFF0C\u8BF7\u76F4\u63A5\u6253\u5F00\u6388\u6743\u94FE\u63A5\uFF1A
|
|
343
343
|
{url}`,{url:o}))}}#re(t,{verificationFocused:o=!1}={}){if(t.state==="succeeded")return D("\u2705 \u4FEE\u590D\u5B8C\u6210\uFF1A\u5DF2\u5B9E\u6D4B\u6536\u5230 card.action.trigger\uFF0C\u83DC\u5355\u6309\u94AE\u73B0\u5728\u53EF\u7528\u3002");if(t.state==="expired"||t.error?.code==="expired_token")return D("\u6388\u6743\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF1B\u5E73\u53F0\u672A\u8FD4\u56DE\u6210\u529F\u7ED3\u679C\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5DF2\u4FEE\u590D\u3002\u53D1\u9001 /repair \u751F\u6210\u65B0\u94FE\u63A5\u3002");if(t.state==="cancelled"||t.error?.code==="abort")return D("\u5DF2\u53D6\u6D88\u672C\u6B21\u4FEE\u590D\u6388\u6743\uFF0C\u672A\u786E\u8BA4\u5B8C\u6210\u4FEE\u590D\u3002");if(t.error?.code==="access_denied")return D("\u4F60\u5DF2\u53D6\u6D88\u6216\u62D2\u7EDD\u6388\u6743\uFF0C\u6CA1\u6709\u786E\u8BA4\u4FEE\u590D\uFF1B\u53D1\u9001 /repair \u53EF\u91CD\u8BD5\u3002");if(t.error?.code==="card_action_probe_timeout"||t.error?.code==="card-action-probe-timeout")return D("\u6388\u6743\u5DF2\u63D0\u4EA4\uFF0C\u4F46\u672A\u6536\u5230\u6D4B\u8BD5\u6309\u94AE\u56DE\u8C03\u3002\u53EF\u80FD\u5C1A\u672A\u70B9\u51FB\u6216\u914D\u7F6E\u4ECD\u5728\u4F20\u64AD\uFF1B\u7A0D\u540E\u53D1\u9001 /repair verify \u67E5\u8BE2\uFF0C\u4E0D\u8981\u76F2\u76EE\u91CD\u590D\u6388\u6743\u3002");if(t.state==="error")return D("\u4FEE\u590D\u6D41\u7A0B\u6682\u65F6\u5931\u8D25\uFF0C\u73B0\u6709\u673A\u5668\u4EBA\u8FDE\u63A5\u4E0D\u53D7\u5F71\u54CD\uFF1B\u53D1\u9001 /repair \u53EF\u91CD\u8BD5\u3002");if(t.state==="saving")return D("\u6388\u6743\u5DF2\u786E\u8BA4\uFF0C\u6B63\u5728\u7B49\u5F85\u4E13\u7528\u6D4B\u8BD5\u6309\u94AE\u7684\u771F\u5B9E\u56DE\u8C03\uFF1B\u56DE\u8C03\u5230\u8FBE\u524D\u4E0D\u4F1A\u5BA3\u544A\u6210\u529F\u3002");if(o)return D("\u6388\u6743\u5C1A\u672A\u5B8C\u6210\uFF0C\u6682\u65F6\u4E0D\u80FD\u9A8C\u8BC1\u5361\u7247\u6309\u94AE\u3002\u8BF7\u5148\u6253\u5F00\u6388\u6743\u94FE\u63A5\u5E76\u786E\u8BA4\u3002");let i=t.remainingSeconds===null?"":D("\uFF0C\u5269\u4F59\u7EA6 {minutes} \u5206\u949F",{minutes:Math.max(1,Math.ceil(t.remainingSeconds/60))});return D("\u4FEE\u590D\u4EFB\u52A1\u6B63\u5728\u7B49\u5F85\u6388\u6743{remaining}\u3002\u53D1\u9001 /repair qr \u53EF\u83B7\u53D6\u4E8C\u7EF4\u7801\uFF0C/repair cancel \u53EF\u53D6\u6D88\u3002",{remaining:i})}onCardAction(t){let o=CA(t?.operator?.open_id)??CA(t?.operator?.user_id)??CA(t?.operator?.operator_id?.open_id)??CA(t?.operator?.operator_id?.user_id)??CA(t?.open_id)??CA(t?.user_id);if(!(o!==null&&(this.#b.has("*")||this.#b.has(o))))return this.#w.warn?.("[dsh-feishu] ignoring card action from an unallowed sender"),Promise.resolve();let e=Zz(t?.action?.value),a=Zz(t?.action?.form_value),A=CA(e.action)??CA(t?.action?.action);if(!A)return Promise.resolve();let r=RC(t?.action?.option)??(A.endsWith("_pick")?Xs(t?.action?.options)[0]:null),s=[...new Set([...Xs(e.options),...Xs(t?.action?.options),...Xs(a[A]),...A==="watch_add"||A==="watch_remove"?Xs(t?.action?.option):[]])],g=A==="workspace_pick"&&typeof r=="string"?`workspace:${r}`:A==="session_pick"&&typeof r=="string"?`use:${r}`:A==="preset_pick"&&typeof r=="string"?`preset:select:${r}`:A==="model_pick"&&typeof r=="string"?`model:select:${r}`:A==="archive_pick"&&typeof r=="string"?`archive:${r}`:A==="steer_pick"&&typeof r=="string"?`steer:${r}`:A,c=CA(t?.context?.open_message_id)??CA(t?.open_message_id)??CA(t?.message_id),I=c?this.#Y.get(c):null;if(!I){let Y=CA(t?.context?.open_chat_id)??CA(t?.open_chat_id)??CA(t?.chat_id);return Y&&this.#D(Y,D("\u8FD9\u4E2A\u83DC\u5355\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u56DE\u590D /m \u91CD\u65B0\u6253\u5F00\u3002")).catch(()=>{}),Promise.resolve()}this.#Y.delete(c),this.#Y.set(c,I);let d={...I,messageId:c,selections:s,operatorOpenId:o},B=CA(e.source),f=CA(a.steer_text),Q=CA(t?.event_id)??CA(t?.header?.event_id)??CA(t?.uuid)??CA(t?.header?.uuid),y=JSON.stringify({messageId:c,resolvedAction:g,option:r,multiValues:s,source:B,formText:f}),m=g==="stop",_=g.startsWith("steer:")?g.slice(6):null,G=A==="steer"&&B==="quick"&&r!==null&&r!==_C||A==="steer"&&B==="form"&&f!==null||_!==null&&_!==""&&!(_==="custom"||_===_C);return this.#je(d,y,async()=>{if(A==="steer"){if(B==="quick"&&r){if(r===_C){await this.#W(d.chatId,Gk(),{key:d.key,updateMessageId:d.messageId});return}await this.#pe(d,r);return}if(B==="form"){if(f){await this.#pe(d,f);return}await this.#D(d.chatId,D("\u8BF7\u8F93\u5165\u8865\u5145\u6307\u4EE4\u540E\u518D\u63D0\u4EA4\u3002"));return}}await this.#ae(g,d)},{lane:m||G?"control":"regular",coalesceStop:m,eventId:Q,operatorOpenId:o})}#we(t=Date.now()){for(let[o,i]of this.#m)i<=t&&this.#m.delete(o);for(;this.#m.size>Vz;){let o=this.#m.keys().next().value;if(o===void 0)break;this.#m.delete(o)}}#Oe(t,o=Date.now()){t&&(this.#m.delete(t),this.#m.set(t,o+J_e),this.#we(o))}#Ye(t){let o=t.key,i=Date.now(),e=this.#y.get(o);if(e?.task||e&&i-e.at<Z_e)return e?.task??Promise.resolve();this.#w.warn?.("[dsh-feishu] card action queue is full; dropping callbacks");let a;for(a=this.#D(t.chatId,D("\u64CD\u4F5C\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\u3002")).catch(()=>{}).finally(()=>{this.#l.delete(a);let A=this.#y.get(o);A?.task===a&&this.#y.set(o,{at:A.at,task:null})}),this.#y.delete(o),this.#y.set(o,{at:i,task:a}),this.#l.add(a);this.#y.size>200;){let A=this.#y.keys().next().value;if(A===void 0)break;this.#y.delete(A)}return a}#je(t,o,i,{lane:e="regular",coalesceStop:a=!1,eventId:A=null,operatorOpenId:r=null}={}){let s=t.key,g=A?`${s}\0${r??""}\0event:${A}`:null,c=g??`${s}\0${r??""}\0action:${o}`,I=Date.now();if(this.#we(I),g&&(this.#m.get(g)??0)>I)return Promise.resolve();let d=this.#u.get(c);if(d)return d;if(a){let j=this.#B.get(s);if(j){if(g)for(this.#f.delete(g),this.#f.set(g,j);this.#f.size>Vz;){let H=this.#f.keys().next().value;if(H===void 0)break;this.#f.delete(H)}return j}}let B=e==="control",f=B?this.#d:this.#p,Q=B?this.#E:this.#h,y=B?j_e:Y_e,m=Q.get(s)??0,_=a?y+1:y;if(m>=_)return this.#Ye(t);let N=f.get(s)??Promise.resolve();Q.set(s,m+1);let G,Y=!1;return G=N.catch(()=>{}).then(async()=>{this.#S?.throwIfAborted(),Y=!0,await i()}).catch(async j=>{this.#S?.aborted||await this.#x(t.chatId,j,{logLabel:"card action"})}).finally(()=>{if(this.#u.get(c)===G&&this.#u.delete(c),Y&&g&&this.#Oe(g),a&&this.#B.get(s)===G&&this.#B.delete(s),a){let H=Date.now();for(let[J,q]of this.#f)q===G&&(this.#f.delete(J),this.#Oe(J,H))}f.get(s)===G&&f.delete(s);let j=(Q.get(s)??1)-1;j>0?Q.set(s,j):Q.delete(s),this.#l.delete(G)}),this.#u.set(c,G),a&&this.#B.set(s,G),this.#l.add(G),f.set(s,G),G}async#ae(t,{chatId:o,key:i,messageId:e=null,sessionWorkspace:a=null,sessionPage:A=0,selections:r=[]}){if(t==="sessions"||/^sessions:\d+$/.test(t)){let s=t==="sessions"?0:Number(t.slice(9));await this.#ge({chatId:o,key:i},a,s,{updateMessageId:e});return}if(t==="workspaces"){await this.#be({chatId:o,key:i},{updateMessageId:e});return}if(t==="watchlist"){await this.#Ce(i,o,{updateMessageId:e});return}if(t==="watch_add"||t==="watch_remove"){if(r.length===0){await this.#D(o,D("\u8BF7\u5148\u9009\u62E9\u81F3\u5C11\u4E00\u4E2A\u4F1A\u8BDD\u3002"));return}let s=0,g=0;if(t==="watch_add"){let I=new Map;try{I=await this.#sA(a)}catch(d){this.#w.warn?.("[dsh-feishu] batch watch validation failed:",d.message)}for(let d of r){let B=I.get(d);if(!B){g+=1;continue}let f=await this.#he(i,o,d,{notify:!1,validatedTarget:B});f.changed?s+=1:f.ok||(g+=1)}}else for(let I of r){let d=await this.#Ee(i,o,I,{notify:!1});d.changed?s+=1:d.ok||(g+=1)}let c=s>0&&g>0?t==="watch_add"?D("\u5DF2\u6279\u91CF\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\uFF0C\u53E6\u6709 {failed} \u4E2A\u672A\u6210\u529F\u3002",{count:s,failed:g}):D("\u5DF2\u53D6\u6D88\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\uFF0C\u53E6\u6709 {failed} \u4E2A\u672A\u6210\u529F\u3002",{count:s,failed:g}):s>0?t==="watch_add"?D("\u5DF2\u6279\u91CF\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\u3002",{count:s}):D("\u5DF2\u53D6\u6D88\u5173\u6CE8 {count} \u4E2A\u4F1A\u8BDD\u3002",{count:s}):g>0?D("\u6240\u9009\u4F1A\u8BDD\u5747\u672A\u5904\u7406\u6210\u529F\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"):t==="watch_add"?D("\u6240\u9009\u4F1A\u8BDD\u5DF2\u5728\u5173\u6CE8\u5217\u8868\u4E2D\u3002"):D("\u6240\u9009\u4F1A\u8BDD\u5DF2\u4E0D\u5728\u5173\u6CE8\u5217\u8868\u4E2D\u3002");try{await this.#Ce(i,o,{updateMessageId:e})}catch(I){this.#w.warn?.("[dsh-feishu] watch list refresh failed:",I.message)}await this.#D(o,c).catch(I=>{this.#w.warn?.("[dsh-feishu] watch batch summary failed:",I.message)});return}if(t==="new"){if(this.#a.has(i)||this.#ee(i)){await this.#D(o,D("\u5F53\u524D\u4EFB\u52A1\u4ECD\u5728\u8FD0\u884C\uFF0C\u8BF7\u5148\u505C\u6B62\u4EFB\u52A1\u6216\u7B49\u5F85\u4EFB\u52A1\u5B8C\u6210\u540E\u518D\u5F00\u542F\u65B0\u4F1A\u8BDD\u3002"));return}await this.#r.clearSession(i),await this.#D(o,D("\u5DF2\u5F00\u542F\u5168\u65B0 Harness \u4F1A\u8BDD\u3002")),await this.#X(i,o,{updateMessageId:e});return}if(t==="use:current"){let s=this.#r.sessionFor(i);if(typeof s!="string"||!s){await this.#D(o,D("\u5F53\u524D\u6CA1\u6709\u7ED1\u5B9A\u7684\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u4ECE\u4F1A\u8BDD\u5217\u8868\u9009\u62E9\u3002"));return}await this.#D(o,D("\u5DF2\u5C31\u7EEA\uFF0C\u76F4\u63A5\u53D1\u6D88\u606F\u5373\u53EF\u7EE7\u7EED\u5F53\u524D\u4F1A\u8BDD\u3002"));return}if(t==="archive_toggle"||t==="archive:on"||t==="archive:off"){let s=t==="archive:on"?!0:t==="archive:off"?!1:!(this.#r?.includesArchivedSessions?.()??!1);await this.#r?.setIncludeArchivedSessions?.(s),await this.#D(o,s?D("\u5DF2\u5F00\u542F\uFF1A\u4F1A\u8BDD\u5217\u8868\u5305\u542B\u5F52\u6863\u4F1A\u8BDD\u3002"):D("\u5DF2\u5173\u95ED\uFF1A\u4F1A\u8BDD\u5217\u8868\u9690\u85CF\u5F52\u6863\u4F1A\u8BDD\u3002")),await this.#X(i,o,{updateMessageId:e});return}if(t==="repair"){await this.#D(o,D("\u4FEE\u590D\u9700\u5728\u79C1\u804A\u4E2D\u9A8C\u8BC1\u63A5\u5165\u8005\u8EAB\u4EFD\uFF0C\u8BF7\u76F4\u63A5\u53D1\u9001 /repair \u5F00\u59CB\u3002"));return}if(t==="compact"){await this.#AA(i,o);return}if(t==="stop"){await this.#tA(i,o);return}if(t==="steer"){await this.#rA(i,o,{updateMessageId:e});return}if(t.startsWith("steer:")){let s=t.slice(6);if(s==="custom"){await this.#W(o,Gk(),{key:i,updateMessageId:e});return}await this.#pe({key:i,chatId:o},s);return}if(t==="presets"){await this.#We(i,o,{updateMessageId:e});return}if(t==="models"){await this.#Ze(i,o,{updateMessageId:e});return}if(t==="status"){await this.#$e(i,o,{updateMessageId:e});return}if(t==="help"){await this.#eA(i,o,{updateMessageId:e});return}if(t==="back_to_menu"){await this.#X(i,o,{updateMessageId:e});return}if(t==="preset_default"){await this.#_e(i,o,{updateMessageId:e});return}if(t.startsWith("preset:select:")){let s=t.slice(14);if(s===Ky){await this.#_e(i,o,{updateMessageId:e});return}await this.#aA(i,o,s,{updateMessageId:e});return}if(t.startsWith("model:select:")){let s=t.slice(13);await this.#iA(i,o,s,{updateMessageId:e});return}if(t.startsWith("use:")){await this.#ze(i,o,t.slice(4),{updateMessageId:e});return}if(t.startsWith("workspace:")){await this.#Ve(i,o,t.slice(10),{updateMessageId:e});return}if(t.startsWith("unwatch:")){(await this.#Ee(i,o,t.slice(8))).ok&&e&&await this.#ge({chatId:o,key:i},a,A,{updateMessageId:e});return}if(t.startsWith("watch:")){let s=t.slice(6);(await this.#he(i,o,s,{workspaceHint:a})).ok&&e&&await this.#ge({chatId:o,key:i},a,A,{updateMessageId:e})}}#ie(t,o){if(this.#L.size>=x_e){let i=this.#L.keys().next().value;i!==void 0&&this.#L.delete(i)}this.#L.delete(t),this.#L.set(t,{...o,expiresAt:Date.now()+K_e})}#Je(t){let o=this.#L.get(t);return o?o.expiresAt<Date.now()?(this.#L.delete(t),null):o:null}async#qe(t,o,{chatId:i,key:e,event:a}){if(t.kind==="menu"){let r=["workspaces","new","sessions","status","repair","help"][o-1];if(!r){await this.#D(i,D("\u83DC\u5355\u6CA1\u6709\u8FD9\u4E2A\u7F16\u53F7\uFF0C\u56DE\u590D /m \u91CD\u65B0\u6253\u5F00\u3002"));return}if(r==="repair"){await this.#De(a,"/repair");return}await this.#ae(r,{chatId:i,key:e});return}if(t.kind==="sessions"){let A=t.sessions[o-1];if(!A?.sessionId){await this.#D(i,D("\u672C\u9875\u53EA\u6709 {count} \u4E2A\u4F1A\u8BDD\uFF0C\u56DE\u590D /sessionlist \u91CD\u65B0\u67E5\u770B\u3002",{count:t.sessions.length}));return}await this.#ae(`use:${A.sessionId}`,{chatId:i,key:e});return}if(t.kind==="workspaces"){let A=t.paths[o-1];if(!A){await this.#D(i,D("\u53EA\u6709 {count} \u4E2A\u5DE5\u4F5C\u533A\uFF0C\u56DE\u590D /workspacelist \u91CD\u65B0\u67E5\u770B\u3002",{count:t.paths.length}));return}await this.#ae(`workspace:${A}`,{chatId:i,key:e});return}if(t.kind==="watches"){let A=t.entries[o-1];if(!A?.sessionId){await this.#D(i,D("\u5173\u6CE8\u5217\u8868\u53EA\u6709 {count} \u4E2A\u4F1A\u8BDD\u3002",{count:t.entries.length}));return}await this.#ae(`unwatch:${A.sessionId}`,{chatId:i,key:e})}}#oe(t){return this.#r?.includesArchivedSessions?.()===!1?t.filter(o=>o.archived!==!0):t}async#ge({chatId:t,key:o},i,e=0,{updateMessageId:a=null}={}){try{let A=this.#j(),r=await Ub(i??"",this.#t,{signal:A});if(r.error){await this.#D(t,r.error);return}let s=await this.#t.listWorkspaceSessions(r.workspace,{signal:A}),g=this.#oe(Array.isArray(s?.sessions)?s.sessions:[]),c=s?.workspace??r.workspace;if(g.length===0){await this.#D(t,D(`\u5DE5\u4F5C\u533A\uFF1A{workspace}
|
|
344
344
|
\u8BE5\u5DE5\u4F5C\u533A\u6682\u65E0\u4F1A\u8BDD\u3002`,{workspace:c}));return}let I=Math.ceil(g.length/$g),d=Number.isSafeInteger(e)&&e>0?Math.min(e,I-1):0,B=new Set((this.#r.watchEntries?.(o)??[]).map(Q=>Q.sessionId)),f=g.slice(d*$g,(d+1)*$g);this.#ie(o,{kind:"sessions",sessions:f.map(Q=>({...Q,watched:B.has(Q.sessionId)}))}),await this.#W(t,Hz(c,g,d,g.length,B),{key:o,updateMessageId:a,sessionWorkspace:r.workspace,sessionPage:d})}catch(A){await this.#x(t,A,{logLabel:"session list"})}}async#be({chatId:t,key:o},{updateMessageId:i=null}={}){try{let{current:e,paths:a}=await zh(this.#t,{signal:this.#j()});this.#ie(o,{kind:"workspaces",paths:a}),await this.#W(t,Kz(a,e),{key:o,updateMessageId:i})}catch(e){await this.#x(t,e,{logLabel:"workspace list"})}}async#ze(t,o,i,{updateMessageId:e=null}={}){try{let a=await this.#t.bindWorkspaceSession(t,i),A=String(a?.title??"").replace(/\s+/gu," ").trim()||D("\u6682\u65E0\u6807\u9898");await this.#D(o,D(`\u5DF2\u7ED1\u5B9A\u4F1A\u8BDD\u300C{title}\u300D
|