@larksuite/openclaw-lark 2026.3.17 → 2026.3.18-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +8 -12
  2. package/index.d.ts +1 -1
  3. package/index.js +86 -43
  4. package/package.json +1 -2
  5. package/skills/feishu-calendar/SKILL.md +0 -2
  6. package/skills/feishu-task/SKILL.md +1 -1
  7. package/src/card/builder.js +19 -11
  8. package/src/card/cardkit.js +27 -20
  9. package/src/card/flush-controller.js +7 -4
  10. package/src/card/image-resolver.js +9 -6
  11. package/src/card/markdown-style.js +3 -1
  12. package/src/card/reply-dispatcher-types.js +7 -5
  13. package/src/card/reply-dispatcher.js +97 -67
  14. package/src/card/reply-mode.js +7 -3
  15. package/src/card/streaming-card-controller.js +55 -52
  16. package/src/card/unavailable-guard.js +14 -11
  17. package/src/channel/abort-detect.js +7 -3
  18. package/src/channel/chat-queue.js +17 -8
  19. package/src/channel/config-adapter.js +17 -12
  20. package/src/channel/directory.js +19 -14
  21. package/src/channel/event-handlers.js +33 -28
  22. package/src/channel/monitor.js +28 -21
  23. package/src/channel/onboarding-config.js +15 -8
  24. package/src/channel/onboarding-migrate.js +6 -4
  25. package/src/channel/onboarding.js +21 -19
  26. package/src/channel/plugin.js +81 -46
  27. package/src/channel/probe.js +5 -3
  28. package/src/channel/types.js +1 -1
  29. package/src/commands/auth.js +27 -24
  30. package/src/commands/diagnose.js +63 -23
  31. package/src/commands/doctor.js +34 -31
  32. package/src/commands/index.js +24 -18
  33. package/src/commands/locale.js +1 -1
  34. package/src/core/accounts.d.ts +14 -0
  35. package/src/core/accounts.js +44 -13
  36. package/src/core/agent-config.js +15 -7
  37. package/src/core/api-error.js +12 -8
  38. package/src/core/app-owner-fallback.js +7 -5
  39. package/src/core/app-scope-checker.js +19 -12
  40. package/src/core/auth-errors.js +19 -12
  41. package/src/core/chat-info-cache.js +13 -8
  42. package/src/core/config-schema.d.ts +28 -28
  43. package/src/core/config-schema.js +85 -83
  44. package/src/core/device-flow.js +12 -8
  45. package/src/core/domains.js +9 -4
  46. package/src/core/feishu-fetch.js +5 -3
  47. package/src/core/footer-config.js +8 -5
  48. package/src/core/lark-client.d.ts +1 -1
  49. package/src/core/lark-client.js +52 -14
  50. package/src/core/lark-logger.js +8 -6
  51. package/src/core/lark-ticket.js +9 -5
  52. package/src/core/message-unavailable.js +30 -19
  53. package/src/core/owner-policy.js +8 -4
  54. package/src/core/permission-url.js +5 -2
  55. package/src/core/raw-request.js +7 -4
  56. package/src/core/scope-manager.js +22 -12
  57. package/src/core/security-check.js +20 -11
  58. package/src/core/shutdown-hooks.js +7 -3
  59. package/src/core/targets.js +17 -8
  60. package/src/core/token-store.js +45 -39
  61. package/src/core/tool-client.js +82 -41
  62. package/src/core/tool-scopes.d.ts +12 -9
  63. package/src/core/tool-scopes.js +23 -18
  64. package/src/core/tools-config.js +18 -13
  65. package/src/core/types.js +1 -1
  66. package/src/core/uat-client.js +35 -31
  67. package/src/core/version.js +12 -9
  68. package/src/messaging/converters/audio.js +8 -5
  69. package/src/messaging/converters/calendar.js +14 -9
  70. package/src/messaging/converters/content-converter.js +17 -12
  71. package/src/messaging/converters/file.js +6 -3
  72. package/src/messaging/converters/folder.js +6 -3
  73. package/src/messaging/converters/hongbao.js +6 -3
  74. package/src/messaging/converters/image.js +6 -3
  75. package/src/messaging/converters/index.js +45 -43
  76. package/src/messaging/converters/interactive/card-converter.js +36 -33
  77. package/src/messaging/converters/interactive/card-utils.js +7 -3
  78. package/src/messaging/converters/interactive/index.js +10 -7
  79. package/src/messaging/converters/interactive/legacy.js +3 -1
  80. package/src/messaging/converters/interactive/types.js +4 -2
  81. package/src/messaging/converters/location.js +6 -3
  82. package/src/messaging/converters/merge-forward.js +9 -6
  83. package/src/messaging/converters/post.js +8 -5
  84. package/src/messaging/converters/share.js +9 -5
  85. package/src/messaging/converters/sticker.js +6 -3
  86. package/src/messaging/converters/system.js +6 -3
  87. package/src/messaging/converters/text.js +8 -5
  88. package/src/messaging/converters/todo.js +7 -4
  89. package/src/messaging/converters/types.js +1 -1
  90. package/src/messaging/converters/unknown.js +6 -3
  91. package/src/messaging/converters/utils.js +9 -4
  92. package/src/messaging/converters/video-chat.js +7 -4
  93. package/src/messaging/converters/video.js +8 -5
  94. package/src/messaging/converters/vote.js +6 -3
  95. package/src/messaging/inbound/dedup.js +6 -2
  96. package/src/messaging/inbound/dispatch-builders.js +18 -12
  97. package/src/messaging/inbound/dispatch-commands.js +15 -12
  98. package/src/messaging/inbound/dispatch-context.js +15 -11
  99. package/src/messaging/inbound/dispatch.js +46 -44
  100. package/src/messaging/inbound/enrich.js +25 -19
  101. package/src/messaging/inbound/gate-effects.js +7 -5
  102. package/src/messaging/inbound/gate.js +19 -26
  103. package/src/messaging/inbound/handler.js +34 -32
  104. package/src/messaging/inbound/media-resolver.js +9 -6
  105. package/src/messaging/inbound/mention.js +21 -11
  106. package/src/messaging/inbound/parse-io.js +11 -7
  107. package/src/messaging/inbound/parse.js +17 -15
  108. package/src/messaging/inbound/permission.js +10 -7
  109. package/src/messaging/inbound/policy.js +15 -8
  110. package/src/messaging/inbound/reaction-handler.js +57 -21
  111. package/src/messaging/inbound/user-name-cache.js +19 -11
  112. package/src/messaging/outbound/actions.js +47 -45
  113. package/src/messaging/outbound/chat-manage.js +14 -9
  114. package/src/messaging/outbound/deliver.js +34 -24
  115. package/src/messaging/outbound/fetch.js +6 -2
  116. package/src/messaging/outbound/forward.js +8 -6
  117. package/src/messaging/outbound/media-url-utils.js +52 -11
  118. package/src/messaging/outbound/media.js +85 -39
  119. package/src/messaging/outbound/outbound.js +20 -18
  120. package/src/messaging/outbound/reactions.js +15 -10
  121. package/src/messaging/outbound/send.js +75 -55
  122. package/src/messaging/outbound/typing.js +17 -14
  123. package/src/messaging/shared/message-lookup.js +14 -12
  124. package/src/messaging/types.js +1 -1
  125. package/src/tools/auto-auth.d.ts +1 -1
  126. package/src/tools/auto-auth.js +51 -48
  127. package/src/tools/helpers.d.ts +1 -1
  128. package/src/tools/helpers.js +39 -27
  129. package/src/tools/mcp/doc/create.d.ts +1 -1
  130. package/src/tools/mcp/doc/create.js +13 -11
  131. package/src/tools/mcp/doc/fetch.d.ts +1 -1
  132. package/src/tools/mcp/doc/fetch.js +10 -8
  133. package/src/tools/mcp/doc/index.js +23 -15
  134. package/src/tools/mcp/doc/update.d.ts +1 -1
  135. package/src/tools/mcp/doc/update.js +21 -19
  136. package/src/tools/mcp/shared.d.ts +1 -1
  137. package/src/tools/mcp/shared.js +31 -21
  138. package/src/tools/oapi/bitable/app-table-field.js +46 -44
  139. package/src/tools/oapi/bitable/app-table-record.js +87 -85
  140. package/src/tools/oapi/bitable/app-table-view.d.ts +1 -2
  141. package/src/tools/oapi/bitable/app-table-view.js +47 -71
  142. package/src/tools/oapi/bitable/app-table.d.ts +2 -4
  143. package/src/tools/oapi/bitable/app-table.js +46 -99
  144. package/src/tools/oapi/bitable/app.js +41 -39
  145. package/src/tools/oapi/bitable/index.js +12 -5
  146. package/src/tools/oapi/calendar/calendar.js +25 -23
  147. package/src/tools/oapi/calendar/event-attendee.d.ts +0 -2
  148. package/src/tools/oapi/calendar/event-attendee.js +31 -134
  149. package/src/tools/oapi/calendar/event.js +144 -142
  150. package/src/tools/oapi/calendar/freebusy.js +21 -19
  151. package/src/tools/oapi/calendar/index.js +10 -4
  152. package/src/tools/oapi/chat/chat.d.ts +1 -1
  153. package/src/tools/oapi/chat/chat.js +24 -22
  154. package/src/tools/oapi/chat/index.js +13 -6
  155. package/src/tools/oapi/chat/members.d.ts +1 -1
  156. package/src/tools/oapi/chat/members.js +16 -14
  157. package/src/tools/oapi/common/get-user.js +17 -15
  158. package/src/tools/oapi/common/index.js +6 -2
  159. package/src/tools/oapi/common/search-user.js +14 -12
  160. package/src/tools/oapi/drive/doc-comments.d.ts +1 -1
  161. package/src/tools/oapi/drive/doc-comments.js +39 -37
  162. package/src/tools/oapi/drive/doc-media.d.ts +1 -1
  163. package/src/tools/oapi/drive/doc-media.js +74 -39
  164. package/src/tools/oapi/drive/file.d.ts +1 -1
  165. package/src/tools/oapi/drive/file.js +143 -108
  166. package/src/tools/oapi/drive/index.js +20 -12
  167. package/src/tools/oapi/helpers.d.ts +1 -1
  168. package/src/tools/oapi/helpers.js +59 -28
  169. package/src/tools/oapi/im/format-messages.js +20 -17
  170. package/src/tools/oapi/im/index.js +15 -8
  171. package/src/tools/oapi/im/message-read.d.ts +1 -1
  172. package/src/tools/oapi/im/message-read.js +74 -67
  173. package/src/tools/oapi/im/message.d.ts +1 -1
  174. package/src/tools/oapi/im/message.js +159 -28
  175. package/src/tools/oapi/im/resource.d.ts +1 -1
  176. package/src/tools/oapi/im/resource.js +52 -17
  177. package/src/tools/oapi/im/time-utils.js +19 -9
  178. package/src/tools/oapi/im/user-name-uat.js +9 -5
  179. package/src/tools/oapi/index.js +36 -34
  180. package/src/tools/oapi/sdk-types.js +1 -1
  181. package/src/tools/oapi/search/doc-search.d.ts +1 -1
  182. package/src/tools/oapi/search/doc-search.js +30 -28
  183. package/src/tools/oapi/search/index.js +11 -8
  184. package/src/tools/oapi/sheets/index.js +11 -8
  185. package/src/tools/oapi/sheets/sheet.d.ts +1 -1
  186. package/src/tools/oapi/sheets/sheet.js +120 -85
  187. package/src/tools/oapi/task/comment.js +29 -27
  188. package/src/tools/oapi/task/index.js +10 -4
  189. package/src/tools/oapi/task/subtask.js +36 -34
  190. package/src/tools/oapi/task/task.js +73 -71
  191. package/src/tools/oapi/task/tasklist.d.ts +1 -3
  192. package/src/tools/oapi/task/tasklist.js +54 -117
  193. package/src/tools/oapi/wiki/index.js +17 -10
  194. package/src/tools/oapi/wiki/space-node.d.ts +1 -1
  195. package/src/tools/oapi/wiki/space-node.js +52 -50
  196. package/src/tools/oapi/wiki/space.d.ts +1 -1
  197. package/src/tools/oapi/wiki/space.js +27 -25
  198. package/src/tools/oauth-batch-auth.js +45 -38
  199. package/src/tools/oauth-cards.js +19 -10
  200. package/src/tools/oauth.js +69 -66
  201. package/src/tools/onboarding-auth.js +17 -15
  202. package/src/tools/tat/im/index.js +7 -4
  203. package/src/tools/tat/im/resource.d.ts +1 -1
  204. package/src/tools/tat/im/resource.js +52 -18
package/README.md CHANGED
@@ -29,18 +29,14 @@ Additionally, the plugin supports:
29
29
 
30
30
  ## Security & Risk Warnings (Read Before Use)
31
31
 
32
- **Core risk:** This plugin connects to your work data via Lark/Feishu APIs—messages, docs, calendars, contacts. Anything the AI can read could theoretically be leaked. While we have implemented security protections, AI systems are not yet mature or stable enough to guarantee absolute safety.
33
-
34
- **Strong recommendations:**
35
- - Use a personal account for evaluation and testing at this stage.
36
- - Use the related Lark/Feishu apps personally, and avoid deploying to large numbers of users.
37
- - Avoid using it in group chats to reduce the risk of data exposure.
38
- - Using this bot for multiple users and/or with a company Feishu account may introduce data security and privacy risks. Make sure you comply with your organization’s internal data security and privacy requirements to avoid data leakage, privilege escalation, privacy violations, or related consequences.
39
-
40
- **Other operational risks**
41
- - AI is not perfect and may hallucinate: It may sometimes misunderstand your intent or generate content that appears reasonable but is inaccurate.
42
- - Some operations are irreversible: For example, messages sent by the AI on your behalf are sent in your name and cannot be undone once sent.
43
- - **Mitigation advice:** For important operations involving sending, modifying, or writing data, always **preview first, then confirm**. Never allow the AI to operate in a fully autonomous mode without human oversight.
32
+ This plugin integrates with OpenClaw AI automation capabilities and carries inherent risks such as model hallucinations, unpredictable execution, and prompt injection. After you authorize Lark/Feishu permissions, OpenClaw will act under your user identity within the authorized scope, which may lead to high-risk consequences such as leakage of sensitive data or unauthorized operations. Please use with caution.
33
+
34
+ To reduce these risks, the plugin enables default security protections at multiple layers. However, these risks still exist. We strongly recommend that you do not proactively modify any default security settings; once relevant restrictions are relaxed, the risks will increase significantly, and you will bear the consequences.
35
+
36
+ We recommend using the Lark/Feishu bot connected to OpenClaw as a private conversational assistant. Do not add it to group chats or allow other users to interact with it, to avoid abuse of permissions or data leakage.
37
+
38
+ Please fully understand all usage risks. By using this plugin, you are deemed to voluntarily assume all related responsibilities.
39
+
44
40
 
45
41
  **Disclaimer:**
46
42
 
package/index.d.ts CHANGED
@@ -30,7 +30,7 @@ declare const plugin: {
30
30
  id: string;
31
31
  name: string;
32
32
  description: string;
33
- configSchema: import("openclaw/plugin-sdk").OpenClawPluginConfigSchema;
33
+ configSchema: any;
34
34
  register(api: OpenClawPluginApi): void;
35
35
  };
36
36
  export default plugin;
package/index.js CHANGED
@@ -8,37 +8,80 @@
8
8
  * Registers the Feishu channel and all tool families:
9
9
  * doc, wiki, drive, perm, bitable, task, calendar.
10
10
  */
11
- import { emptyPluginConfigSchema } from 'openclaw/plugin-sdk';
12
- import { feishuPlugin } from './src/channel/plugin';
13
- import { LarkClient } from './src/core/lark-client';
14
- import { registerOapiTools } from './src/tools/oapi/index';
15
- import { registerFeishuMcpDocTools } from './src/tools/mcp/doc/index';
16
- import { registerFeishuOAuthTool } from './src/tools/oauth';
17
- import { registerFeishuOAuthBatchAuthTool } from './src/tools/oauth-batch-auth';
18
- import { runDiagnosis, formatDiagReportCli, traceByMessageId, formatTraceOutput, analyzeTrace, } from './src/commands/diagnose';
19
- import { registerCommands } from './src/commands/index';
20
- import { larkLogger } from './src/core/lark-logger';
21
- import { emitSecurityWarnings } from './src/core/security-check';
22
- const log = larkLogger('plugin');
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.isMessageExpired = exports.checkMessageGate = exports.parseMessageEvent = exports.handleFeishuReaction = exports.feishuPlugin = exports.buildMentionedCardContent = exports.buildMentionedMessage = exports.formatMentionAllForCard = exports.formatMentionAllForText = exports.formatMentionForCard = exports.formatMentionForText = exports.extractMessageBody = exports.nonBotMentions = exports.mentionedBot = exports.feishuMessageActions = exports.listChatMembersFeishu = exports.removeChatMembersFeishu = exports.addChatMembersFeishu = exports.updateChatFeishu = exports.forwardMessageFeishu = exports.VALID_FEISHU_EMOJI_TYPES = exports.FeishuEmoji = exports.listReactionsFeishu = exports.removeReactionFeishu = exports.addReactionFeishu = exports.probeFeishu = exports.sendMediaLark = exports.sendCardLark = exports.sendTextLark = exports.uploadAndSendMediaLark = exports.sendAudioLark = exports.sendFileLark = exports.sendImageLark = exports.uploadFileLark = exports.uploadImageLark = exports.getMessageFeishu = exports.editMessageFeishu = exports.updateCardFeishu = exports.sendCardFeishu = exports.sendMessageFeishu = exports.monitorFeishuProvider = void 0;
13
+ const plugin_sdk_1 = require("openclaw/plugin-sdk");
14
+ const plugin_1 = require("./src/channel/plugin");
15
+ const lark_client_1 = require("./src/core/lark-client");
16
+ const index_1 = require("./src/tools/oapi/index");
17
+ const index_2 = require("./src/tools/mcp/doc/index");
18
+ const oauth_1 = require("./src/tools/oauth");
19
+ const oauth_batch_auth_1 = require("./src/tools/oauth-batch-auth");
20
+ const diagnose_1 = require("./src/commands/diagnose");
21
+ const index_3 = require("./src/commands/index");
22
+ const lark_logger_1 = require("./src/core/lark-logger");
23
+ const security_check_1 = require("./src/core/security-check");
24
+ const log = (0, lark_logger_1.larkLogger)('plugin');
23
25
  // ---------------------------------------------------------------------------
24
26
  // Re-exports for external consumers
25
27
  // ---------------------------------------------------------------------------
26
- export { monitorFeishuProvider } from './src/channel/monitor';
27
- export { sendMessageFeishu, sendCardFeishu, updateCardFeishu, editMessageFeishu } from './src/messaging/outbound/send';
28
- export { getMessageFeishu } from './src/messaging/outbound/fetch';
29
- export { uploadImageLark, uploadFileLark, sendImageLark, sendFileLark, sendAudioLark, uploadAndSendMediaLark, } from './src/messaging/outbound/media';
30
- export { sendTextLark, sendCardLark, sendMediaLark, } from './src/messaging/outbound/deliver';
31
- export { probeFeishu } from './src/channel/probe';
32
- export { addReactionFeishu, removeReactionFeishu, listReactionsFeishu, FeishuEmoji, VALID_FEISHU_EMOJI_TYPES, } from './src/messaging/outbound/reactions';
33
- export { forwardMessageFeishu } from './src/messaging/outbound/forward';
34
- export { updateChatFeishu, addChatMembersFeishu, removeChatMembersFeishu, listChatMembersFeishu, } from './src/messaging/outbound/chat-manage';
35
- export { feishuMessageActions } from './src/messaging/outbound/actions';
36
- export { mentionedBot, nonBotMentions, extractMessageBody, formatMentionForText, formatMentionForCard, formatMentionAllForText, formatMentionAllForCard, buildMentionedMessage, buildMentionedCardContent, } from './src/messaging/inbound/mention';
37
- export { feishuPlugin } from './src/channel/plugin';
38
- export { handleFeishuReaction } from './src/messaging/inbound/reaction-handler';
39
- export { parseMessageEvent } from './src/messaging/inbound/parse';
40
- export { checkMessageGate } from './src/messaging/inbound/gate';
41
- export { isMessageExpired } from './src/messaging/inbound/dedup';
28
+ var monitor_1 = require("./src/channel/monitor");
29
+ Object.defineProperty(exports, "monitorFeishuProvider", { enumerable: true, get: function () { return monitor_1.monitorFeishuProvider; } });
30
+ var send_1 = require("./src/messaging/outbound/send");
31
+ Object.defineProperty(exports, "sendMessageFeishu", { enumerable: true, get: function () { return send_1.sendMessageFeishu; } });
32
+ Object.defineProperty(exports, "sendCardFeishu", { enumerable: true, get: function () { return send_1.sendCardFeishu; } });
33
+ Object.defineProperty(exports, "updateCardFeishu", { enumerable: true, get: function () { return send_1.updateCardFeishu; } });
34
+ Object.defineProperty(exports, "editMessageFeishu", { enumerable: true, get: function () { return send_1.editMessageFeishu; } });
35
+ var fetch_1 = require("./src/messaging/outbound/fetch");
36
+ Object.defineProperty(exports, "getMessageFeishu", { enumerable: true, get: function () { return fetch_1.getMessageFeishu; } });
37
+ var media_1 = require("./src/messaging/outbound/media");
38
+ Object.defineProperty(exports, "uploadImageLark", { enumerable: true, get: function () { return media_1.uploadImageLark; } });
39
+ Object.defineProperty(exports, "uploadFileLark", { enumerable: true, get: function () { return media_1.uploadFileLark; } });
40
+ Object.defineProperty(exports, "sendImageLark", { enumerable: true, get: function () { return media_1.sendImageLark; } });
41
+ Object.defineProperty(exports, "sendFileLark", { enumerable: true, get: function () { return media_1.sendFileLark; } });
42
+ Object.defineProperty(exports, "sendAudioLark", { enumerable: true, get: function () { return media_1.sendAudioLark; } });
43
+ Object.defineProperty(exports, "uploadAndSendMediaLark", { enumerable: true, get: function () { return media_1.uploadAndSendMediaLark; } });
44
+ var deliver_1 = require("./src/messaging/outbound/deliver");
45
+ Object.defineProperty(exports, "sendTextLark", { enumerable: true, get: function () { return deliver_1.sendTextLark; } });
46
+ Object.defineProperty(exports, "sendCardLark", { enumerable: true, get: function () { return deliver_1.sendCardLark; } });
47
+ Object.defineProperty(exports, "sendMediaLark", { enumerable: true, get: function () { return deliver_1.sendMediaLark; } });
48
+ var probe_1 = require("./src/channel/probe");
49
+ Object.defineProperty(exports, "probeFeishu", { enumerable: true, get: function () { return probe_1.probeFeishu; } });
50
+ var reactions_1 = require("./src/messaging/outbound/reactions");
51
+ Object.defineProperty(exports, "addReactionFeishu", { enumerable: true, get: function () { return reactions_1.addReactionFeishu; } });
52
+ Object.defineProperty(exports, "removeReactionFeishu", { enumerable: true, get: function () { return reactions_1.removeReactionFeishu; } });
53
+ Object.defineProperty(exports, "listReactionsFeishu", { enumerable: true, get: function () { return reactions_1.listReactionsFeishu; } });
54
+ Object.defineProperty(exports, "FeishuEmoji", { enumerable: true, get: function () { return reactions_1.FeishuEmoji; } });
55
+ Object.defineProperty(exports, "VALID_FEISHU_EMOJI_TYPES", { enumerable: true, get: function () { return reactions_1.VALID_FEISHU_EMOJI_TYPES; } });
56
+ var forward_1 = require("./src/messaging/outbound/forward");
57
+ Object.defineProperty(exports, "forwardMessageFeishu", { enumerable: true, get: function () { return forward_1.forwardMessageFeishu; } });
58
+ var chat_manage_1 = require("./src/messaging/outbound/chat-manage");
59
+ Object.defineProperty(exports, "updateChatFeishu", { enumerable: true, get: function () { return chat_manage_1.updateChatFeishu; } });
60
+ Object.defineProperty(exports, "addChatMembersFeishu", { enumerable: true, get: function () { return chat_manage_1.addChatMembersFeishu; } });
61
+ Object.defineProperty(exports, "removeChatMembersFeishu", { enumerable: true, get: function () { return chat_manage_1.removeChatMembersFeishu; } });
62
+ Object.defineProperty(exports, "listChatMembersFeishu", { enumerable: true, get: function () { return chat_manage_1.listChatMembersFeishu; } });
63
+ var actions_1 = require("./src/messaging/outbound/actions");
64
+ Object.defineProperty(exports, "feishuMessageActions", { enumerable: true, get: function () { return actions_1.feishuMessageActions; } });
65
+ var mention_1 = require("./src/messaging/inbound/mention");
66
+ Object.defineProperty(exports, "mentionedBot", { enumerable: true, get: function () { return mention_1.mentionedBot; } });
67
+ Object.defineProperty(exports, "nonBotMentions", { enumerable: true, get: function () { return mention_1.nonBotMentions; } });
68
+ Object.defineProperty(exports, "extractMessageBody", { enumerable: true, get: function () { return mention_1.extractMessageBody; } });
69
+ Object.defineProperty(exports, "formatMentionForText", { enumerable: true, get: function () { return mention_1.formatMentionForText; } });
70
+ Object.defineProperty(exports, "formatMentionForCard", { enumerable: true, get: function () { return mention_1.formatMentionForCard; } });
71
+ Object.defineProperty(exports, "formatMentionAllForText", { enumerable: true, get: function () { return mention_1.formatMentionAllForText; } });
72
+ Object.defineProperty(exports, "formatMentionAllForCard", { enumerable: true, get: function () { return mention_1.formatMentionAllForCard; } });
73
+ Object.defineProperty(exports, "buildMentionedMessage", { enumerable: true, get: function () { return mention_1.buildMentionedMessage; } });
74
+ Object.defineProperty(exports, "buildMentionedCardContent", { enumerable: true, get: function () { return mention_1.buildMentionedCardContent; } });
75
+ var plugin_2 = require("./src/channel/plugin");
76
+ Object.defineProperty(exports, "feishuPlugin", { enumerable: true, get: function () { return plugin_2.feishuPlugin; } });
77
+ var reaction_handler_1 = require("./src/messaging/inbound/reaction-handler");
78
+ Object.defineProperty(exports, "handleFeishuReaction", { enumerable: true, get: function () { return reaction_handler_1.handleFeishuReaction; } });
79
+ var parse_1 = require("./src/messaging/inbound/parse");
80
+ Object.defineProperty(exports, "parseMessageEvent", { enumerable: true, get: function () { return parse_1.parseMessageEvent; } });
81
+ var gate_1 = require("./src/messaging/inbound/gate");
82
+ Object.defineProperty(exports, "checkMessageGate", { enumerable: true, get: function () { return gate_1.checkMessageGate; } });
83
+ var dedup_1 = require("./src/messaging/inbound/dedup");
84
+ Object.defineProperty(exports, "isMessageExpired", { enumerable: true, get: function () { return dedup_1.isMessageExpired; } });
42
85
  // ---------------------------------------------------------------------------
43
86
  // Plugin definition
44
87
  // ---------------------------------------------------------------------------
@@ -46,19 +89,19 @@ const plugin = {
46
89
  id: 'openclaw-lark',
47
90
  name: 'Feishu',
48
91
  description: 'Lark/Feishu channel plugin with im/doc/wiki/drive/task/calendar tools',
49
- configSchema: emptyPluginConfigSchema(),
92
+ configSchema: (0, plugin_sdk_1.emptyPluginConfigSchema)(),
50
93
  register(api) {
51
- LarkClient.setRuntime(api.runtime);
52
- api.registerChannel({ plugin: feishuPlugin });
94
+ lark_client_1.LarkClient.setRuntime(api.runtime);
95
+ api.registerChannel({ plugin: plugin_1.feishuPlugin });
53
96
  // ========================================
54
97
  // Register OAPI tools (calendar, task - using Feishu Open API directly)
55
- registerOapiTools(api);
98
+ (0, index_1.registerOapiTools)(api);
56
99
  // Register MCP doc tools (using Model Context Protocol)
57
- registerFeishuMcpDocTools(api);
100
+ (0, index_2.registerFeishuMcpDocTools)(api);
58
101
  // Register OAuth tool (UAT device flow authorization)
59
- registerFeishuOAuthTool(api);
102
+ (0, oauth_1.registerFeishuOAuthTool)(api);
60
103
  // Register OAuth batch auth tool (batch authorization for all app scopes)
61
- registerFeishuOAuthBatchAuthTool(api);
104
+ (0, oauth_batch_auth_1.registerFeishuOAuthBatchAuthTool)(api);
62
105
  // ---- Tool call hooks (auto-trace AI tool invocations) ----
63
106
  api.on('before_tool_call', (event) => {
64
107
  log.info(`tool call: ${event.toolName} params=${JSON.stringify(event.params)}`);
@@ -82,21 +125,21 @@ const plugin = {
82
125
  .action(async (opts) => {
83
126
  try {
84
127
  if (opts.trace) {
85
- const lines = await traceByMessageId(opts.trace);
128
+ const lines = await (0, diagnose_1.traceByMessageId)(opts.trace);
86
129
  // eslint-disable-next-line no-console -- CLI 命令直接输出到终端
87
- console.log(formatTraceOutput(lines, opts.trace));
130
+ console.log((0, diagnose_1.formatTraceOutput)(lines, opts.trace));
88
131
  if (opts.analyze && lines.length > 0) {
89
132
  // eslint-disable-next-line no-console -- CLI 命令直接输出到终端
90
- console.log(analyzeTrace(lines, opts.trace));
133
+ console.log((0, diagnose_1.analyzeTrace)(lines, opts.trace));
91
134
  }
92
135
  }
93
136
  else {
94
- const report = await runDiagnosis({
137
+ const report = await (0, diagnose_1.runDiagnosis)({
95
138
  config: ctx.config,
96
139
  logger: ctx.logger,
97
140
  });
98
141
  // eslint-disable-next-line no-console -- CLI 命令直接输出到终端
99
- console.log(formatDiagReportCli(report));
142
+ console.log((0, diagnose_1.formatDiagReportCli)(report));
100
143
  if (report.overallStatus === 'unhealthy') {
101
144
  process.exitCode = 1;
102
145
  }
@@ -109,11 +152,11 @@ const plugin = {
109
152
  });
110
153
  }, { commands: ['feishu-diagnose'] });
111
154
  // Chat commands: /feishu_diagnose, /feishu_doctor, /feishu_auth, /feishu
112
- registerCommands(api);
155
+ (0, index_3.registerCommands)(api);
113
156
  // ---- Multi-account security checks ----
114
157
  if (api.config) {
115
- emitSecurityWarnings(api.config, api.logger);
158
+ (0, security_check_1.emitSecurityWarnings)(api.config, api.logger);
116
159
  }
117
160
  },
118
161
  };
119
- export default plugin;
162
+ exports.default = plugin;
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@larksuite/openclaw-lark",
3
- "version": "2026.3.17",
3
+ "version": "2026.3.18-beta.1",
4
4
  "description": "OpenClaw Lark/Feishu channel plugin",
5
- "type": "module",
6
5
  "bin": {
7
6
  "openclaw-lark": "bin/openclaw-lark.js"
8
7
  },
@@ -28,7 +28,6 @@ description: |
28
28
  | 查重复日程实例 | feishu_calendar_event | instances | event_id, start_time, end_time | - | - |
29
29
  | 查忙闲 | feishu_calendar_freebusy | list | time_min, time_max, user_ids[] | - | - |
30
30
  | 邀请参会人 | feishu_calendar_event_attendee | create | calendar_id, event_id, attendees[] | - | - |
31
- | 删除参会人 | feishu_calendar_event_attendee | batch_delete | calendar_id, event_id, user_open_ids[] | - | - |
32
31
 
33
32
  ---
34
33
 
@@ -63,7 +62,6 @@ description: |
63
62
 
64
63
  - ✅ 创建日程:`user_open_id = SenderId`
65
64
  - ✅ 邀请参会人:`attendees[].id = "ou_xxx"`
66
- - ✅ 删除参会人:`user_open_ids = ["ou_xxx"]`(工具已优化,直接传 open_id 即可)
67
65
 
68
66
  ⚠️ **ID 格式区分**:
69
67
  - `ou_xxx`:用户的 open_id(**你应该使用的**)
@@ -4,7 +4,7 @@ description: |
4
4
  飞书任务管理工具,用于创建、查询、更新任务和清单。
5
5
 
6
6
  **当以下情况时使用此 Skill**:
7
- (1) 需要创建、查询、更新、删除任务
7
+ (1) 需要创建、查询、更新任务
8
8
  (2) 需要创建、管理任务清单
9
9
  (3) 需要查看任务列表或清单内的任务
10
10
  (4) 用户提到"任务"、"待办"、"to-do"、"清单"、"task"
@@ -8,7 +8,15 @@
8
8
  * Provides utilities to construct Feishu Interactive Message Cards for
9
9
  * different agent response states (thinking, streaming, complete, confirm).
10
10
  */
11
- import { optimizeMarkdownStyle } from './markdown-style';
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.REASONING_ELEMENT_ID = exports.STREAMING_ELEMENT_ID = void 0;
13
+ exports.splitReasoningText = splitReasoningText;
14
+ exports.stripReasoningTags = stripReasoningTags;
15
+ exports.formatReasoningDuration = formatReasoningDuration;
16
+ exports.formatElapsed = formatElapsed;
17
+ exports.buildCardContent = buildCardContent;
18
+ exports.toCardKit2 = toCardKit2;
19
+ const markdown_style_1 = require("./markdown-style");
12
20
  // ---------------------------------------------------------------------------
13
21
  // Constants
14
22
  // ---------------------------------------------------------------------------
@@ -17,8 +25,8 @@ import { optimizeMarkdownStyle } from './markdown-style';
17
25
  * `cardElement.content()` API targets this element for typewriter-effect
18
26
  * streaming updates.
19
27
  */
20
- export const STREAMING_ELEMENT_ID = 'streaming_content';
21
- export const REASONING_ELEMENT_ID = 'reasoning_content';
28
+ exports.STREAMING_ELEMENT_ID = 'streaming_content';
29
+ exports.REASONING_ELEMENT_ID = 'reasoning_content';
22
30
  // ---------------------------------------------------------------------------
23
31
  // Helpers
24
32
  // ---------------------------------------------------------------------------
@@ -37,7 +45,7 @@ const REASONING_PREFIX = 'Reasoning:\n';
37
45
  *
38
46
  * Equivalent to the framework's `splitTelegramReasoningText()`.
39
47
  */
40
- export function splitReasoningText(text) {
48
+ function splitReasoningText(text) {
41
49
  if (typeof text !== 'string' || !text.trim())
42
50
  return {};
43
51
  const trimmed = text.trim();
@@ -85,7 +93,7 @@ function extractThinkingContent(text) {
85
93
  * Strip reasoning blocks — both XML tags with their content and any
86
94
  * "Reasoning:\n" prefixed content.
87
95
  */
88
- export function stripReasoningTags(text) {
96
+ function stripReasoningTags(text) {
89
97
  // Strip complete XML blocks
90
98
  let result = text.replace(/<\s*(?:think(?:ing)?|thought|antthinking)\s*>[\s\S]*?<\s*\/\s*(?:think(?:ing)?|thought|antthinking)\s*>/gi, '');
91
99
  // Strip unclosed tag at end (streaming)
@@ -110,14 +118,14 @@ function cleanReasoningPrefix(text) {
110
118
  * Format reasoning duration into a human-readable i18n pair.
111
119
  * e.g. { zh: "思考了 3.2s", en: "Thought for 3.2s" }
112
120
  */
113
- export function formatReasoningDuration(ms) {
121
+ function formatReasoningDuration(ms) {
114
122
  const d = formatElapsed(ms);
115
123
  return { zh: `思考了 ${d}`, en: `Thought for ${d}` };
116
124
  }
117
125
  /**
118
126
  * Format milliseconds into a human-readable duration string.
119
127
  */
120
- export function formatElapsed(ms) {
128
+ function formatElapsed(ms) {
121
129
  const seconds = ms / 1000;
122
130
  return seconds < 60 ? `${seconds.toFixed(1)}s` : `${Math.floor(seconds / 60)}m ${Math.round(seconds % 60)}s`;
123
131
  }
@@ -142,7 +150,7 @@ function buildFooter(zhText, enText, isError) {
142
150
  * Build a full Feishu Interactive Message Card JSON object for the
143
151
  * given state.
144
152
  */
145
- export function buildCardContent(state, data = {}) {
153
+ function buildCardContent(state, data = {}) {
146
154
  switch (state) {
147
155
  case 'thinking':
148
156
  return buildThinkingCard();
@@ -198,7 +206,7 @@ function buildStreamingCard(partialText, toolCalls, reasoningText) {
198
206
  // Answer phase: show answer content only
199
207
  elements.push({
200
208
  tag: 'markdown',
201
- content: optimizeMarkdownStyle(partialText),
209
+ content: (0, markdown_style_1.optimizeMarkdownStyle)(partialText),
202
210
  });
203
211
  }
204
212
  // Tool calls in progress
@@ -262,7 +270,7 @@ function buildCompleteCard(params) {
262
270
  // Full text content
263
271
  elements.push({
264
272
  tag: 'markdown',
265
- content: optimizeMarkdownStyle(text),
273
+ content: (0, markdown_style_1.optimizeMarkdownStyle)(text),
266
274
  });
267
275
  // Tool calls summary
268
276
  if (toolCalls.length > 0) {
@@ -392,7 +400,7 @@ function buildConfirmCard(confirmData) {
392
400
  * Convert an old-format FeishuCard to CardKit JSON 2.0 format.
393
401
  * JSON 2.0 uses `body.elements` instead of top-level `elements`.
394
402
  */
395
- export function toCardKit2(card) {
403
+ function toCardKit2(card) {
396
404
  const result = {
397
405
  schema: '2.0',
398
406
  config: card.config,
@@ -5,11 +5,18 @@
5
5
  *
6
6
  * CardKit streaming APIs for Lark/Feishu.
7
7
  */
8
- import { LarkClient } from '../core/lark-client';
9
- import { larkLogger } from '../core/lark-logger';
10
- import { normalizeFeishuTarget, normalizeMessageId, resolveReceiveIdType } from '../core/targets';
11
- import { runWithMessageUnavailableGuard } from '../core/message-unavailable';
12
- const log = larkLogger('card/cardkit');
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.createCardEntity = createCardEntity;
10
+ exports.streamCardContent = streamCardContent;
11
+ exports.updateCardKitCard = updateCardKitCard;
12
+ exports.updateCardKitCardForAuth = updateCardKitCardForAuth;
13
+ exports.sendCardByCardId = sendCardByCardId;
14
+ exports.setCardStreamingMode = setCardStreamingMode;
15
+ const lark_client_1 = require("../core/lark-client");
16
+ const lark_logger_1 = require("../core/lark-logger");
17
+ const targets_1 = require("../core/targets");
18
+ const message_unavailable_1 = require("../core/message-unavailable");
19
+ const log = (0, lark_logger_1.larkLogger)('card/cardkit');
13
20
  // ---------------------------------------------------------------------------
14
21
  // Helpers
15
22
  // ---------------------------------------------------------------------------
@@ -37,9 +44,9 @@ function logCardKitResponse(params) {
37
44
  * Returns the card_id directly, bypassing the idConvert step.
38
45
  * The card can then be sent via IM API and streamed via CardKit.
39
46
  */
40
- export async function createCardEntity(params) {
47
+ async function createCardEntity(params) {
41
48
  const { cfg, card, accountId } = params;
42
- const client = LarkClient.fromCfg(cfg, accountId).sdk;
49
+ const client = lark_client_1.LarkClient.fromCfg(cfg, accountId).sdk;
43
50
  // SDK 返回类型不完整,运行时包含 code/msg/data 字段
44
51
  const response = (await client.cardkit.v1.card.create({
45
52
  data: {
@@ -63,9 +70,9 @@ export async function createCardEntity(params) {
63
70
  * @param params.content - The full cumulative text (not a delta).
64
71
  * @param params.sequence - Monotonically increasing sequence number.
65
72
  */
66
- export async function streamCardContent(params) {
73
+ async function streamCardContent(params) {
67
74
  const { cfg, cardId, elementId, content, sequence, accountId } = params;
68
- const client = LarkClient.fromCfg(cfg, accountId).sdk;
75
+ const client = lark_client_1.LarkClient.fromCfg(cfg, accountId).sdk;
69
76
  // SDK 返回类型不完整,运行时包含 code/msg 字段
70
77
  const resp = (await client.cardkit.v1.cardElement.content({
71
78
  data: { content, sequence },
@@ -87,9 +94,9 @@ export async function streamCardContent(params) {
87
94
  * @param params.card - The new card JSON content.
88
95
  * @param params.sequence - Monotonically increasing sequence number.
89
96
  */
90
- export async function updateCardKitCard(params) {
97
+ async function updateCardKitCard(params) {
91
98
  const { cfg, cardId, card, sequence, accountId } = params;
92
- const client = LarkClient.fromCfg(cfg, accountId).sdk;
99
+ const client = lark_client_1.LarkClient.fromCfg(cfg, accountId).sdk;
93
100
  // SDK 返回类型不完整,运行时包含 code/msg 字段
94
101
  const resp = (await client.cardkit.v1.card.update({
95
102
  data: {
@@ -104,7 +111,7 @@ export async function updateCardKitCard(params) {
104
111
  context: `seq=${sequence}, cardId=${cardId}`,
105
112
  });
106
113
  }
107
- export async function updateCardKitCardForAuth(params) {
114
+ async function updateCardKitCardForAuth(params) {
108
115
  return updateCardKitCard(params);
109
116
  }
110
117
  /**
@@ -114,17 +121,17 @@ export async function updateCardKitCardForAuth(params) {
114
121
  * This links the IM message to the CardKit card entity, enabling
115
122
  * streaming updates via cardElement.content().
116
123
  */
117
- export async function sendCardByCardId(params) {
124
+ async function sendCardByCardId(params) {
118
125
  const { cfg, to, cardId, replyToMessageId, replyInThread, accountId } = params;
119
- const client = LarkClient.fromCfg(cfg, accountId).sdk;
126
+ const client = lark_client_1.LarkClient.fromCfg(cfg, accountId).sdk;
120
127
  const contentPayload = JSON.stringify({
121
128
  type: 'card',
122
129
  data: { card_id: cardId },
123
130
  });
124
131
  if (replyToMessageId) {
125
132
  // 规范化 message_id,处理合成 ID(如 "om_xxx:auth-complete")
126
- const normalizedId = normalizeMessageId(replyToMessageId);
127
- const response = await runWithMessageUnavailableGuard({
133
+ const normalizedId = (0, targets_1.normalizeMessageId)(replyToMessageId);
134
+ const response = await (0, message_unavailable_1.runWithMessageUnavailableGuard)({
128
135
  messageId: normalizedId,
129
136
  operation: 'im.message.reply(interactive.cardkit)',
130
137
  fn: () => client.im.message.reply({
@@ -137,11 +144,11 @@ export async function sendCardByCardId(params) {
137
144
  chatId: response?.data?.chat_id ?? '',
138
145
  };
139
146
  }
140
- const target = normalizeFeishuTarget(to);
147
+ const target = (0, targets_1.normalizeFeishuTarget)(to);
141
148
  if (!target) {
142
149
  throw new Error(`[feishu-send] Invalid target: "${to}"`);
143
150
  }
144
- const receiveIdType = resolveReceiveIdType(target);
151
+ const receiveIdType = (0, targets_1.resolveReceiveIdType)(target);
145
152
  const response = await client.im.message.create({
146
153
  // SDK 类型将 receive_id_type 限定为字面量联合,但运行时接受动态值
147
154
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -163,9 +170,9 @@ export async function sendCardByCardId(params) {
163
170
  * Must be called after streaming is complete to restore normal card
164
171
  * behaviour (forwarding, interaction callbacks, etc.).
165
172
  */
166
- export async function setCardStreamingMode(params) {
173
+ async function setCardStreamingMode(params) {
167
174
  const { cfg, cardId, streamingMode, sequence, accountId } = params;
168
- const client = LarkClient.fromCfg(cfg, accountId).sdk;
175
+ const client = lark_client_1.LarkClient.fromCfg(cfg, accountId).sdk;
169
176
  // SDK 返回类型不完整,运行时包含 code/msg 字段
170
177
  const resp = (await client.cardkit.v1.card.settings({
171
178
  data: {
@@ -9,11 +9,13 @@
9
9
  * mutex-guarded flushing, and reflush-on-conflict. Contains no
10
10
  * business logic — the actual flush work is provided via a callback.
11
11
  */
12
- import { THROTTLE_CONSTANTS } from './reply-dispatcher-types';
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.FlushController = void 0;
14
+ const reply_dispatcher_types_1 = require("./reply-dispatcher-types");
13
15
  // ---------------------------------------------------------------------------
14
16
  // FlushController
15
17
  // ---------------------------------------------------------------------------
16
- export class FlushController {
18
+ class FlushController {
17
19
  doFlush;
18
20
  flushInProgress = false;
19
21
  flushResolvers = [];
@@ -93,14 +95,14 @@ export class FlushController {
93
95
  const elapsed = now - this.lastUpdateTime;
94
96
  if (elapsed >= throttleMs) {
95
97
  this.cancelPendingFlush();
96
- if (elapsed > THROTTLE_CONSTANTS.LONG_GAP_THRESHOLD_MS) {
98
+ if (elapsed > reply_dispatcher_types_1.THROTTLE_CONSTANTS.LONG_GAP_THRESHOLD_MS) {
97
99
  // After a long gap, batch briefly so the first visible update
98
100
  // contains meaningful text rather than just 1-2 characters.
99
101
  this.lastUpdateTime = now;
100
102
  this.pendingFlushTimer = setTimeout(() => {
101
103
  this.pendingFlushTimer = null;
102
104
  void this.flush();
103
- }, THROTTLE_CONSTANTS.BATCH_AFTER_GAP_MS);
105
+ }, reply_dispatcher_types_1.THROTTLE_CONSTANTS.BATCH_AFTER_GAP_MS);
104
106
  }
105
107
  else {
106
108
  await this.flush();
@@ -133,3 +135,4 @@ export class FlushController {
133
135
  }
134
136
  }
135
137
  }
138
+ exports.FlushController = FlushController;
@@ -9,12 +9,14 @@
9
9
  * images referenced via `![alt](https://...)` in model-generated markdown,
10
10
  * replacing them with `![alt](img_xxx)` that Feishu cards can render.
11
11
  */
12
- import { fetchRemoteImageBuffer, uploadImageLark } from '../messaging/outbound/media';
13
- import { larkLogger } from '../core/lark-logger';
14
- const log = larkLogger('card/image-resolver');
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.ImageResolver = void 0;
14
+ const media_1 = require("../messaging/outbound/media");
15
+ const lark_logger_1 = require("../core/lark-logger");
16
+ const log = (0, lark_logger_1.larkLogger)('card/image-resolver');
15
17
  /** Matches complete markdown image syntax: `![alt](value)` */
16
18
  const IMAGE_RE = /!\[([^\]]*)\]\(([^)\s]+)\)/g;
17
- export class ImageResolver {
19
+ class ImageResolver {
18
20
  /** URL → imageKey for successfully uploaded images. */
19
21
  resolved = new Map();
20
22
  /** URL → upload Promise for in-flight uploads (dedup). */
@@ -90,8 +92,8 @@ export class ImageResolver {
90
92
  async doUpload(url) {
91
93
  try {
92
94
  log.info('uploading image', { url });
93
- const buffer = await fetchRemoteImageBuffer(url);
94
- const { imageKey } = await uploadImageLark({
95
+ const buffer = await (0, media_1.fetchRemoteImageBuffer)(url);
96
+ const { imageKey } = await (0, media_1.uploadImageLark)({
95
97
  cfg: this.cfg,
96
98
  image: buffer,
97
99
  imageType: 'message',
@@ -111,3 +113,4 @@ export class ImageResolver {
111
113
  }
112
114
  }
113
115
  }
116
+ exports.ImageResolver = ImageResolver;
@@ -5,6 +5,8 @@
5
5
  *
6
6
  * Markdown 样式优化工具
7
7
  */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.optimizeMarkdownStyle = optimizeMarkdownStyle;
8
10
  /**
9
11
  * 优化 Markdown 样式:
10
12
  * - 标题降级:H1 → H4,H2~H6 → H5
@@ -14,7 +16,7 @@
14
16
  * - 表格:单元格前后补空格,分隔符行规范化,表格前后加空行
15
17
  * - 代码块内容不受影响
16
18
  */
17
- export function optimizeMarkdownStyle(text, cardVersion = 2) {
19
+ function optimizeMarkdownStyle(text, cardVersion = 2) {
18
20
  try {
19
21
  let r = _optimizeMarkdownStyle(text, cardVersion);
20
22
  r = stripInvalidImageKeys(r);
@@ -9,10 +9,12 @@
9
9
  * reply-dispatcher.ts, streaming-card-controller.ts, flush-controller.ts,
10
10
  * and unavailable-guard.ts.
11
11
  */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.EMPTY_REPLY_FALLBACK_TEXT = exports.THROTTLE_CONSTANTS = exports.PHASE_TRANSITIONS = exports.TERMINAL_PHASES = exports.CARD_PHASES = void 0;
12
14
  // ---------------------------------------------------------------------------
13
15
  // CardPhase — explicit state machine replacing boolean flags
14
16
  // ---------------------------------------------------------------------------
15
- export const CARD_PHASES = {
17
+ exports.CARD_PHASES = {
16
18
  idle: 'idle',
17
19
  creating: 'creating',
18
20
  streaming: 'streaming',
@@ -21,13 +23,13 @@ export const CARD_PHASES = {
21
23
  terminated: 'terminated',
22
24
  creation_failed: 'creation_failed',
23
25
  };
24
- export const TERMINAL_PHASES = new Set([
26
+ exports.TERMINAL_PHASES = new Set([
25
27
  'completed',
26
28
  'aborted',
27
29
  'terminated',
28
30
  'creation_failed',
29
31
  ]);
30
- export const PHASE_TRANSITIONS = {
32
+ exports.PHASE_TRANSITIONS = {
31
33
  idle: new Set(['creating', 'aborted', 'terminated']),
32
34
  creating: new Set(['streaming', 'creation_failed', 'aborted', 'terminated']),
33
35
  streaming: new Set(['completed', 'aborted', 'terminated']),
@@ -49,10 +51,10 @@ export const PHASE_TRANSITIONS = {
49
51
  * defer the first flush briefly.
50
52
  * - `BATCH_AFTER_GAP_MS`: Batching window after a long gap.
51
53
  */
52
- export const THROTTLE_CONSTANTS = {
54
+ exports.THROTTLE_CONSTANTS = {
53
55
  CARDKIT_MS: 100,
54
56
  PATCH_MS: 1500,
55
57
  LONG_GAP_THRESHOLD_MS: 2000,
56
58
  BATCH_AFTER_GAP_MS: 300,
57
59
  };
58
- export const EMPTY_REPLY_FALLBACK_TEXT = 'Done.';
60
+ exports.EMPTY_REPLY_FALLBACK_TEXT = 'Done.';