@larksuite/openclaw-lark 2025.7.15-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (426) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/bin/openclaw-lark.js +39 -0
  4. package/index.d.ts +36 -0
  5. package/index.js +188 -0
  6. package/openclaw.plugin.json +64 -0
  7. package/package.json +63 -0
  8. package/secret-contract-api.d.ts +15 -0
  9. package/secret-contract-api.js +78 -0
  10. package/skills/feishu-bitable/SKILL.md +248 -0
  11. package/skills/feishu-bitable/references/examples.md +813 -0
  12. package/skills/feishu-bitable/references/field-properties.md +763 -0
  13. package/skills/feishu-bitable/references/record-values.md +911 -0
  14. package/skills/feishu-calendar/SKILL.md +242 -0
  15. package/skills/feishu-channel-rules/SKILL.md +18 -0
  16. package/skills/feishu-channel-rules/references/markdown-syntax.md +138 -0
  17. package/skills/feishu-create-doc/SKILL.md +719 -0
  18. package/skills/feishu-fetch-doc/SKILL.md +93 -0
  19. package/skills/feishu-im-read/SKILL.md +163 -0
  20. package/skills/feishu-task/SKILL.md +340 -0
  21. package/skills/feishu-troubleshoot/SKILL.md +70 -0
  22. package/skills/feishu-update-doc/SKILL.md +285 -0
  23. package/src/card/builder.d.ts +152 -0
  24. package/src/card/builder.js +794 -0
  25. package/src/card/card-error.d.ts +91 -0
  26. package/src/card/card-error.js +206 -0
  27. package/src/card/cardkit.d.ts +90 -0
  28. package/src/card/cardkit.js +203 -0
  29. package/src/card/flush-controller.d.ts +45 -0
  30. package/src/card/flush-controller.js +138 -0
  31. package/src/card/image-resolver.d.ts +45 -0
  32. package/src/card/image-resolver.js +116 -0
  33. package/src/card/markdown-style.d.ts +16 -0
  34. package/src/card/markdown-style.js +106 -0
  35. package/src/card/reasoning-utils.d.ts +14 -0
  36. package/src/card/reasoning-utils.js +64 -0
  37. package/src/card/reply-dispatcher-types.d.ts +132 -0
  38. package/src/card/reply-dispatcher-types.js +61 -0
  39. package/src/card/reply-dispatcher.d.ts +15 -0
  40. package/src/card/reply-dispatcher.js +447 -0
  41. package/src/card/reply-mode.d.ts +41 -0
  42. package/src/card/reply-mode.js +70 -0
  43. package/src/card/streaming-card-controller.d.ts +118 -0
  44. package/src/card/streaming-card-controller.js +1045 -0
  45. package/src/card/tool-use-config.d.ts +26 -0
  46. package/src/card/tool-use-config.js +76 -0
  47. package/src/card/tool-use-display.d.ts +37 -0
  48. package/src/card/tool-use-display.js +476 -0
  49. package/src/card/tool-use-trace-store.d.ts +51 -0
  50. package/src/card/tool-use-trace-store.js +271 -0
  51. package/src/card/unavailable-guard.d.ts +35 -0
  52. package/src/card/unavailable-guard.js +87 -0
  53. package/src/channel/abort-detect.d.ts +47 -0
  54. package/src/channel/abort-detect.js +219 -0
  55. package/src/channel/chat-queue.d.ts +41 -0
  56. package/src/channel/chat-queue.js +68 -0
  57. package/src/channel/config-adapter.d.ts +23 -0
  58. package/src/channel/config-adapter.js +107 -0
  59. package/src/channel/directory.d.ts +57 -0
  60. package/src/channel/directory.js +197 -0
  61. package/src/channel/event-handlers.d.ts +17 -0
  62. package/src/channel/event-handlers.js +380 -0
  63. package/src/channel/interactive-dispatch.d.ts +59 -0
  64. package/src/channel/interactive-dispatch.js +195 -0
  65. package/src/channel/monitor.d.ts +17 -0
  66. package/src/channel/monitor.js +140 -0
  67. package/src/channel/onboarding-config.d.ts +18 -0
  68. package/src/channel/onboarding-config.js +96 -0
  69. package/src/channel/onboarding-migrate.d.ts +25 -0
  70. package/src/channel/onboarding-migrate.js +70 -0
  71. package/src/channel/onboarding.d.ts +12 -0
  72. package/src/channel/onboarding.js +300 -0
  73. package/src/channel/plugin.d.ts +13 -0
  74. package/src/channel/plugin.js +310 -0
  75. package/src/channel/probe.d.ts +14 -0
  76. package/src/channel/probe.js +24 -0
  77. package/src/channel/types.d.ts +37 -0
  78. package/src/channel/types.js +8 -0
  79. package/src/commands/auth.d.ts +21 -0
  80. package/src/commands/auth.js +165 -0
  81. package/src/commands/diagnose.d.ts +69 -0
  82. package/src/commands/diagnose.js +848 -0
  83. package/src/commands/doctor.d.ts +27 -0
  84. package/src/commands/doctor.js +588 -0
  85. package/src/commands/index.d.ts +25 -0
  86. package/src/commands/index.js +219 -0
  87. package/src/commands/locale.d.ts +7 -0
  88. package/src/commands/locale.js +8 -0
  89. package/src/core/accounts.d.ts +51 -0
  90. package/src/core/accounts.js +219 -0
  91. package/src/core/agent-config.d.ts +100 -0
  92. package/src/core/agent-config.js +148 -0
  93. package/src/core/api-error.d.ts +48 -0
  94. package/src/core/api-error.js +117 -0
  95. package/src/core/app-owner-fallback.d.ts +22 -0
  96. package/src/core/app-owner-fallback.js +39 -0
  97. package/src/core/app-scope-checker.d.ts +87 -0
  98. package/src/core/app-scope-checker.js +198 -0
  99. package/src/core/auth-errors.d.ts +144 -0
  100. package/src/core/auth-errors.js +160 -0
  101. package/src/core/card-action-operator.d.ts +33 -0
  102. package/src/core/card-action-operator.js +30 -0
  103. package/src/core/chat-info-cache.d.ts +67 -0
  104. package/src/core/chat-info-cache.js +165 -0
  105. package/src/core/comment-target.d.ts +65 -0
  106. package/src/core/comment-target.js +100 -0
  107. package/src/core/config-schema.d.ts +490 -0
  108. package/src/core/config-schema.js +223 -0
  109. package/src/core/device-flow.d.ts +77 -0
  110. package/src/core/device-flow.js +217 -0
  111. package/src/core/domains.d.ts +18 -0
  112. package/src/core/domains.js +34 -0
  113. package/src/core/feishu-fetch.d.ts +18 -0
  114. package/src/core/feishu-fetch.js +28 -0
  115. package/src/core/footer-config.d.ts +24 -0
  116. package/src/core/footer-config.js +51 -0
  117. package/src/core/lark-client.d.ts +125 -0
  118. package/src/core/lark-client.js +468 -0
  119. package/src/core/lark-logger.d.ts +23 -0
  120. package/src/core/lark-logger.js +160 -0
  121. package/src/core/lark-ticket.d.ts +29 -0
  122. package/src/core/lark-ticket.js +40 -0
  123. package/src/core/message-unavailable.d.ts +53 -0
  124. package/src/core/message-unavailable.js +142 -0
  125. package/src/core/owner-policy.d.ts +32 -0
  126. package/src/core/owner-policy.js +55 -0
  127. package/src/core/permission-url.d.ts +22 -0
  128. package/src/core/permission-url.js +76 -0
  129. package/src/core/raw-request.d.ts +27 -0
  130. package/src/core/raw-request.js +90 -0
  131. package/src/core/runtime-store.d.ts +13 -0
  132. package/src/core/runtime-store.js +29 -0
  133. package/src/core/scope-manager.d.ts +168 -0
  134. package/src/core/scope-manager.js +224 -0
  135. package/src/core/sdk-compat.d.ts +20 -0
  136. package/src/core/sdk-compat.js +28 -0
  137. package/src/core/security-check.d.ts +72 -0
  138. package/src/core/security-check.js +184 -0
  139. package/src/core/shutdown-hooks.d.ts +22 -0
  140. package/src/core/shutdown-hooks.js +61 -0
  141. package/src/core/synthetic-target.d.ts +33 -0
  142. package/src/core/synthetic-target.js +40 -0
  143. package/src/core/targets.d.ts +60 -0
  144. package/src/core/targets.js +173 -0
  145. package/src/core/token-store.d.ts +54 -0
  146. package/src/core/token-store.js +326 -0
  147. package/src/core/tool-client.d.ts +176 -0
  148. package/src/core/tool-client.js +426 -0
  149. package/src/core/tool-scopes.d.ts +156 -0
  150. package/src/core/tool-scopes.js +344 -0
  151. package/src/core/tools-config.d.ts +55 -0
  152. package/src/core/tools-config.js +143 -0
  153. package/src/core/types.d.ts +91 -0
  154. package/src/core/types.js +12 -0
  155. package/src/core/uat-client.d.ts +46 -0
  156. package/src/core/uat-client.js +192 -0
  157. package/src/core/version.d.ts +31 -0
  158. package/src/core/version.js +69 -0
  159. package/src/messaging/converters/audio.d.ts +8 -0
  160. package/src/messaging/converters/audio.js +24 -0
  161. package/src/messaging/converters/calendar.d.ts +13 -0
  162. package/src/messaging/converters/calendar.js +56 -0
  163. package/src/messaging/converters/content-converter-helpers.d.ts +30 -0
  164. package/src/messaging/converters/content-converter-helpers.js +82 -0
  165. package/src/messaging/converters/content-converter.d.ts +24 -0
  166. package/src/messaging/converters/content-converter.js +40 -0
  167. package/src/messaging/converters/file.d.ts +8 -0
  168. package/src/messaging/converters/file.js +24 -0
  169. package/src/messaging/converters/folder.d.ts +8 -0
  170. package/src/messaging/converters/folder.js +24 -0
  171. package/src/messaging/converters/hongbao.d.ts +8 -0
  172. package/src/messaging/converters/hongbao.js +20 -0
  173. package/src/messaging/converters/image.d.ts +8 -0
  174. package/src/messaging/converters/image.js +22 -0
  175. package/src/messaging/converters/index.d.ts +8 -0
  176. package/src/messaging/converters/index.js +53 -0
  177. package/src/messaging/converters/interactive/card-converter.d.ts +76 -0
  178. package/src/messaging/converters/interactive/card-converter.js +1177 -0
  179. package/src/messaging/converters/interactive/card-utils.d.ts +9 -0
  180. package/src/messaging/converters/interactive/card-utils.js +47 -0
  181. package/src/messaging/converters/interactive/index.d.ts +8 -0
  182. package/src/messaging/converters/interactive/index.js +25 -0
  183. package/src/messaging/converters/interactive/legacy.d.ts +11 -0
  184. package/src/messaging/converters/interactive/legacy.js +60 -0
  185. package/src/messaging/converters/interactive/types.d.ts +23 -0
  186. package/src/messaging/converters/interactive/types.js +27 -0
  187. package/src/messaging/converters/location.d.ts +8 -0
  188. package/src/messaging/converters/location.js +23 -0
  189. package/src/messaging/converters/merge-forward.d.ts +32 -0
  190. package/src/messaging/converters/merge-forward.js +235 -0
  191. package/src/messaging/converters/post.d.ts +11 -0
  192. package/src/messaging/converters/post.js +235 -0
  193. package/src/messaging/converters/share.d.ts +9 -0
  194. package/src/messaging/converters/share.js +28 -0
  195. package/src/messaging/converters/sticker.d.ts +8 -0
  196. package/src/messaging/converters/sticker.js +22 -0
  197. package/src/messaging/converters/system.d.ts +12 -0
  198. package/src/messaging/converters/system.js +36 -0
  199. package/src/messaging/converters/text.d.ts +8 -0
  200. package/src/messaging/converters/text.js +18 -0
  201. package/src/messaging/converters/todo.d.ts +8 -0
  202. package/src/messaging/converters/todo.js +45 -0
  203. package/src/messaging/converters/types.d.ts +114 -0
  204. package/src/messaging/converters/types.js +8 -0
  205. package/src/messaging/converters/unknown.d.ts +8 -0
  206. package/src/messaging/converters/unknown.js +20 -0
  207. package/src/messaging/converters/utils.d.ts +22 -0
  208. package/src/messaging/converters/utils.js +57 -0
  209. package/src/messaging/converters/video-chat.d.ts +8 -0
  210. package/src/messaging/converters/video-chat.js +31 -0
  211. package/src/messaging/converters/video.d.ts +8 -0
  212. package/src/messaging/converters/video.js +35 -0
  213. package/src/messaging/converters/vote.d.ts +8 -0
  214. package/src/messaging/converters/vote.js +28 -0
  215. package/src/messaging/inbound/bot-content.d.ts +84 -0
  216. package/src/messaging/inbound/bot-content.js +117 -0
  217. package/src/messaging/inbound/bot-loop-guard.d.ts +48 -0
  218. package/src/messaging/inbound/bot-loop-guard.js +89 -0
  219. package/src/messaging/inbound/comment-context.d.ts +82 -0
  220. package/src/messaging/inbound/comment-context.js +353 -0
  221. package/src/messaging/inbound/comment-handler.d.ts +30 -0
  222. package/src/messaging/inbound/comment-handler.js +269 -0
  223. package/src/messaging/inbound/dedup.d.ts +59 -0
  224. package/src/messaging/inbound/dedup.js +121 -0
  225. package/src/messaging/inbound/dispatch-builders.d.ts +104 -0
  226. package/src/messaging/inbound/dispatch-builders.js +241 -0
  227. package/src/messaging/inbound/dispatch-commands.d.ts +22 -0
  228. package/src/messaging/inbound/dispatch-commands.js +131 -0
  229. package/src/messaging/inbound/dispatch-context.d.ts +67 -0
  230. package/src/messaging/inbound/dispatch-context.js +153 -0
  231. package/src/messaging/inbound/dispatch.d.ts +50 -0
  232. package/src/messaging/inbound/dispatch.js +477 -0
  233. package/src/messaging/inbound/enrich.d.ts +102 -0
  234. package/src/messaging/inbound/enrich.js +236 -0
  235. package/src/messaging/inbound/gate-effects.d.ts +23 -0
  236. package/src/messaging/inbound/gate-effects.js +46 -0
  237. package/src/messaging/inbound/gate.d.ts +91 -0
  238. package/src/messaging/inbound/gate.js +342 -0
  239. package/src/messaging/inbound/handler-registry.d.ts +25 -0
  240. package/src/messaging/inbound/handler-registry.js +23 -0
  241. package/src/messaging/inbound/handler.d.ts +37 -0
  242. package/src/messaging/inbound/handler.js +286 -0
  243. package/src/messaging/inbound/media-resolver.d.ts +32 -0
  244. package/src/messaging/inbound/media-resolver.js +91 -0
  245. package/src/messaging/inbound/mention-registry.d.ts +59 -0
  246. package/src/messaging/inbound/mention-registry.js +115 -0
  247. package/src/messaging/inbound/mention.d.ts +48 -0
  248. package/src/messaging/inbound/mention.js +102 -0
  249. package/src/messaging/inbound/parse-io.d.ts +50 -0
  250. package/src/messaging/inbound/parse-io.js +86 -0
  251. package/src/messaging/inbound/parse.d.ts +28 -0
  252. package/src/messaging/inbound/parse.js +128 -0
  253. package/src/messaging/inbound/permission.d.ts +17 -0
  254. package/src/messaging/inbound/permission.js +44 -0
  255. package/src/messaging/inbound/policy.d.ts +95 -0
  256. package/src/messaging/inbound/policy.js +168 -0
  257. package/src/messaging/inbound/reaction-handler.d.ts +62 -0
  258. package/src/messaging/inbound/reaction-handler.js +259 -0
  259. package/src/messaging/inbound/sentinel-store.d.ts +37 -0
  260. package/src/messaging/inbound/sentinel-store.js +98 -0
  261. package/src/messaging/inbound/synthetic-message.d.ts +26 -0
  262. package/src/messaging/inbound/synthetic-message.js +59 -0
  263. package/src/messaging/inbound/user-name-cache-store.d.ts +62 -0
  264. package/src/messaging/inbound/user-name-cache-store.js +236 -0
  265. package/src/messaging/inbound/user-name-cache.d.ts +78 -0
  266. package/src/messaging/inbound/user-name-cache.js +306 -0
  267. package/src/messaging/inbound/vc-meeting-invited-handler.d.ts +20 -0
  268. package/src/messaging/inbound/vc-meeting-invited-handler.js +236 -0
  269. package/src/messaging/inbound/vc-sender.d.ts +41 -0
  270. package/src/messaging/inbound/vc-sender.js +53 -0
  271. package/src/messaging/outbound/actions.d.ts +16 -0
  272. package/src/messaging/outbound/actions.js +329 -0
  273. package/src/messaging/outbound/bot-peer-context.d.ts +42 -0
  274. package/src/messaging/outbound/bot-peer-context.js +40 -0
  275. package/src/messaging/outbound/chat-manage.d.ts +64 -0
  276. package/src/messaging/outbound/chat-manage.js +117 -0
  277. package/src/messaging/outbound/deliver.d.ts +186 -0
  278. package/src/messaging/outbound/deliver.js +410 -0
  279. package/src/messaging/outbound/fetch.d.ts +12 -0
  280. package/src/messaging/outbound/fetch.js +17 -0
  281. package/src/messaging/outbound/forward.d.ts +26 -0
  282. package/src/messaging/outbound/forward.js +51 -0
  283. package/src/messaging/outbound/media-url-utils.d.ts +29 -0
  284. package/src/messaging/outbound/media-url-utils.js +172 -0
  285. package/src/messaging/outbound/media.d.ts +260 -0
  286. package/src/messaging/outbound/media.js +865 -0
  287. package/src/messaging/outbound/normalize-mentions.d.ts +50 -0
  288. package/src/messaging/outbound/normalize-mentions.js +166 -0
  289. package/src/messaging/outbound/outbound-mention.d.ts +41 -0
  290. package/src/messaging/outbound/outbound-mention.js +112 -0
  291. package/src/messaging/outbound/outbound.d.ts +79 -0
  292. package/src/messaging/outbound/outbound.js +195 -0
  293. package/src/messaging/outbound/reactions.d.ts +124 -0
  294. package/src/messaging/outbound/reactions.js +384 -0
  295. package/src/messaging/outbound/send.d.ts +153 -0
  296. package/src/messaging/outbound/send.js +417 -0
  297. package/src/messaging/outbound/typing.d.ts +60 -0
  298. package/src/messaging/outbound/typing.js +139 -0
  299. package/src/messaging/shared/message-lookup.d.ts +54 -0
  300. package/src/messaging/shared/message-lookup.js +120 -0
  301. package/src/messaging/types.d.ts +316 -0
  302. package/src/messaging/types.js +11 -0
  303. package/src/tools/ask-user-question.d.ts +32 -0
  304. package/src/tools/ask-user-question.js +922 -0
  305. package/src/tools/auto-auth.d.ts +57 -0
  306. package/src/tools/auto-auth.js +904 -0
  307. package/src/tools/helpers.d.ts +264 -0
  308. package/src/tools/helpers.js +389 -0
  309. package/src/tools/mcp/doc/create.d.ts +12 -0
  310. package/src/tools/mcp/doc/create.js +47 -0
  311. package/src/tools/mcp/doc/fetch.d.ts +12 -0
  312. package/src/tools/mcp/doc/fetch.js +39 -0
  313. package/src/tools/mcp/doc/index.d.ts +12 -0
  314. package/src/tools/mcp/doc/index.js +50 -0
  315. package/src/tools/mcp/doc/update.d.ts +12 -0
  316. package/src/tools/mcp/doc/update.js +64 -0
  317. package/src/tools/mcp/shared.d.ts +59 -0
  318. package/src/tools/mcp/shared.js +239 -0
  319. package/src/tools/oapi/bitable/app-table-field.d.ts +16 -0
  320. package/src/tools/oapi/bitable/app-table-field.js +225 -0
  321. package/src/tools/oapi/bitable/app-table-record.d.ts +20 -0
  322. package/src/tools/oapi/bitable/app-table-record.js +439 -0
  323. package/src/tools/oapi/bitable/app-table-view.d.ts +16 -0
  324. package/src/tools/oapi/bitable/app-table-view.js +172 -0
  325. package/src/tools/oapi/bitable/app-table.d.ts +17 -0
  326. package/src/tools/oapi/bitable/app-table.js +195 -0
  327. package/src/tools/oapi/bitable/app.d.ts +18 -0
  328. package/src/tools/oapi/bitable/app.js +189 -0
  329. package/src/tools/oapi/bitable/index.d.ts +9 -0
  330. package/src/tools/oapi/bitable/index.js +17 -0
  331. package/src/tools/oapi/calendar/calendar.d.ts +15 -0
  332. package/src/tools/oapi/calendar/calendar.js +125 -0
  333. package/src/tools/oapi/calendar/event-attendee.d.ts +14 -0
  334. package/src/tools/oapi/calendar/event-attendee.js +161 -0
  335. package/src/tools/oapi/calendar/event.d.ts +16 -0
  336. package/src/tools/oapi/calendar/event.js +712 -0
  337. package/src/tools/oapi/calendar/freebusy.d.ts +13 -0
  338. package/src/tools/oapi/calendar/freebusy.js +114 -0
  339. package/src/tools/oapi/calendar/index.d.ts +8 -0
  340. package/src/tools/oapi/calendar/index.js +15 -0
  341. package/src/tools/oapi/chat/chat.d.ts +16 -0
  342. package/src/tools/oapi/chat/chat.js +127 -0
  343. package/src/tools/oapi/chat/index.d.ts +10 -0
  344. package/src/tools/oapi/chat/index.js +23 -0
  345. package/src/tools/oapi/chat/members.d.ts +11 -0
  346. package/src/tools/oapi/chat/members.js +84 -0
  347. package/src/tools/oapi/common/get-user.d.ts +12 -0
  348. package/src/tools/oapi/common/get-user.js +109 -0
  349. package/src/tools/oapi/common/index.d.ts +6 -0
  350. package/src/tools/oapi/common/index.js +11 -0
  351. package/src/tools/oapi/common/search-user.d.ts +11 -0
  352. package/src/tools/oapi/common/search-user.js +76 -0
  353. package/src/tools/oapi/drive/doc-comments.d.ts +15 -0
  354. package/src/tools/oapi/drive/doc-comments.js +351 -0
  355. package/src/tools/oapi/drive/doc-media.d.ts +19 -0
  356. package/src/tools/oapi/drive/doc-media.js +371 -0
  357. package/src/tools/oapi/drive/file.d.ts +19 -0
  358. package/src/tools/oapi/drive/file.js +519 -0
  359. package/src/tools/oapi/drive/index.d.ts +12 -0
  360. package/src/tools/oapi/drive/index.js +45 -0
  361. package/src/tools/oapi/helpers.d.ts +183 -0
  362. package/src/tools/oapi/helpers.js +385 -0
  363. package/src/tools/oapi/im/format-messages.d.ts +50 -0
  364. package/src/tools/oapi/im/format-messages.js +169 -0
  365. package/src/tools/oapi/im/index.d.ts +10 -0
  366. package/src/tools/oapi/im/index.js +25 -0
  367. package/src/tools/oapi/im/message-read.d.ts +13 -0
  368. package/src/tools/oapi/im/message-read.js +419 -0
  369. package/src/tools/oapi/im/message.d.ts +16 -0
  370. package/src/tools/oapi/im/message.js +152 -0
  371. package/src/tools/oapi/im/resource.d.ts +13 -0
  372. package/src/tools/oapi/im/resource.js +186 -0
  373. package/src/tools/oapi/im/time-utils.d.ts +46 -0
  374. package/src/tools/oapi/im/time-utils.js +212 -0
  375. package/src/tools/oapi/im/user-name-uat.d.ts +26 -0
  376. package/src/tools/oapi/im/user-name-uat.js +143 -0
  377. package/src/tools/oapi/index.d.ts +11 -0
  378. package/src/tools/oapi/index.js +64 -0
  379. package/src/tools/oapi/sdk-types.d.ts +96 -0
  380. package/src/tools/oapi/sdk-types.js +13 -0
  381. package/src/tools/oapi/search/doc-search.d.ts +13 -0
  382. package/src/tools/oapi/search/doc-search.js +194 -0
  383. package/src/tools/oapi/search/index.d.ts +12 -0
  384. package/src/tools/oapi/search/index.js +37 -0
  385. package/src/tools/oapi/sheets/index.d.ts +12 -0
  386. package/src/tools/oapi/sheets/index.js +35 -0
  387. package/src/tools/oapi/sheets/sheet.d.ts +16 -0
  388. package/src/tools/oapi/sheets/sheet.js +688 -0
  389. package/src/tools/oapi/task/attachment.d.ts +18 -0
  390. package/src/tools/oapi/task/attachment.js +107 -0
  391. package/src/tools/oapi/task/comment.d.ts +15 -0
  392. package/src/tools/oapi/task/comment.js +149 -0
  393. package/src/tools/oapi/task/index.d.ts +11 -0
  394. package/src/tools/oapi/task/index.js +21 -0
  395. package/src/tools/oapi/task/section.d.ts +17 -0
  396. package/src/tools/oapi/task/section.js +293 -0
  397. package/src/tools/oapi/task/subtask.d.ts +14 -0
  398. package/src/tools/oapi/task/subtask.js +171 -0
  399. package/src/tools/oapi/task/task.d.ts +19 -0
  400. package/src/tools/oapi/task/task.js +512 -0
  401. package/src/tools/oapi/task/task_agent.d.ts +14 -0
  402. package/src/tools/oapi/task/task_agent.js +108 -0
  403. package/src/tools/oapi/task/tasklist.d.ts +19 -0
  404. package/src/tools/oapi/task/tasklist.js +276 -0
  405. package/src/tools/oapi/wiki/index.d.ts +12 -0
  406. package/src/tools/oapi/wiki/index.js +42 -0
  407. package/src/tools/oapi/wiki/space-node.d.ts +17 -0
  408. package/src/tools/oapi/wiki/space-node.js +233 -0
  409. package/src/tools/oapi/wiki/space.d.ts +15 -0
  410. package/src/tools/oapi/wiki/space.js +133 -0
  411. package/src/tools/oauth-batch-auth.d.ts +11 -0
  412. package/src/tools/oauth-batch-auth.js +150 -0
  413. package/src/tools/oauth-cards.d.ts +39 -0
  414. package/src/tools/oauth-cards.js +324 -0
  415. package/src/tools/oauth.d.ts +47 -0
  416. package/src/tools/oauth.js +592 -0
  417. package/src/tools/onboarding-auth.d.ts +27 -0
  418. package/src/tools/onboarding-auth.js +133 -0
  419. package/src/tools/tat/im/index.d.ts +15 -0
  420. package/src/tools/tat/im/index.js +22 -0
  421. package/src/tools/tat/im/resource.d.ts +15 -0
  422. package/src/tools/tat/im/resource.js +192 -0
  423. package/tsdown.config.d.ts +2 -0
  424. package/tsdown.config.js +25 -0
  425. package/vitest.config.d.ts +2 -0
  426. package/vitest.config.js +12 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lark Technologies Pte. Ltd.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # OpenClaw Lark/Feishu Plugin
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![npm version](https://img.shields.io/npm/v/@larksuite/openclaw-lark.svg)](https://www.npmjs.com/package/@larksuite/openclaw-lark)
5
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D22-blue.svg)](https://nodejs.org/)
6
+
7
+ [中文版](./README.zh.md) | English
8
+
9
+ This is the official Lark/Feishu plugin for OpenClaw, developed and maintained by the Lark/Feishu Open Platform team. It seamlessly connects your OpenClaw Agent to your Lark/Feishu workspace, enabling it to directly read from and write to messages, docs, bases, calendars, tasks, and more.
10
+
11
+ ## Features
12
+
13
+ This plugin provides comprehensive Lark/Feishu integration for OpenClaw, including:
14
+
15
+ | Category | Capabilities |
16
+ |------|------|
17
+ | 💬 Messenger | Read messages (group/DM history, thread replies), send messages, reply to messages, search messages, download images/files |
18
+ | 📄 Docs | Create, update, and read documents |
19
+ | 📊 Base | Create/manage bases, tables, fields, records (CRUD, batch operations, advanced filtering), views |
20
+ | 📈 Sheets | Create, edit, and view spreadsheets |
21
+ | 📅 Calendar | Manage calendars and events (create/query/update/delete/search), manage attendees, check free/busy status |
22
+ | ✅ Tasks | Manage tasks (create/query/update/complete), manage task lists, subtasks, and comments |
23
+
24
+ Additionally, the plugin supports:
25
+ - **📱 Interactive Cards**: Real-time status updates (Thinking/Generating/Complete), plus confirmation buttons for sensitive operations
26
+ - **🌊 Streaming Responses**: Live streaming text directly within message cards
27
+ - **🔒 Permission Policies**: Flexible access control policies for DMs and group chats
28
+ - **⚙️ Advanced Group Configuration**: Per-group settings including allowlists, skill bindings, and custom system prompts
29
+
30
+ ## Security & Risk Warnings (Read Before Use)
31
+
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
+
40
+
41
+ **Disclaimer:**
42
+
43
+ This software is licensed under the MIT License. When running, it calls Lark/Feishu Open Platform APIs. To use these APIs, you must comply with the following agreements and privacy policies:
44
+
45
+ - [Feishu Privacy Policy](https://www.feishu.cn/en/privacy?from=openclaw_plugin_readme)
46
+ - [Feishu User Terms of Service](https://www.feishu.cn/en/terms?from=openclaw_plugin_readme)
47
+ - [Feishu Store App Service Provider Security Management Specifications](https://open.larkoffice.com/document/uAjLw4CM/uMzNwEjLzcDMx4yM3ATM/management-practice/app-service-provider-security-management-specifications)
48
+
49
+ - [Lark Privacy Policy](https://www.larksuite.com/user-terms-of-service)
50
+ - [Lark User Terms of Service](https://www.larksuite.com/privacy-policy)
51
+
52
+ ## Requirements & Installation
53
+
54
+ Before you start, make sure you have the following:
55
+
56
+ - **Node.js**: `v22` or higher.
57
+ - **OpenClaw**: OpenClaw is installed and works properly. For details, visit the [OpenClaw official website](https://openclaw.ai).
58
+
59
+ > **Note**: OpenClaw version must be **2026.2.26** or higher. Check with `openclaw -v`. If below this version, you may encounter issues. Upgrade with:
60
+ > ```bash
61
+ > npm install -g openclaw
62
+ > ```
63
+
64
+ ## Usage Guide
65
+
66
+ [How to Use the Official Lark/Feishu Plugin for OpenClaw](https://bytedance.larkoffice.com/docx/MFK7dDFLFoVlOGxWCv5cTXKmnMh)
67
+
68
+ ## Contributing
69
+
70
+ Community contributions are welcome! If you find a bug or have feature suggestions, please submit an [Issue](https://github.com/larksuite/openclaw-larksuite/issues) or a [Pull Request](https://github.com/larksuite/openclaw-larksuite/pulls).
71
+
72
+ For major changes, we recommend discussing with us first via an Issue.
73
+
74
+ ## License
75
+
76
+ This project is licensed under the **MIT License**. See [LICENSE](./LICENSE.md) for details.
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'node:module';
3
+ import { dirname, join } from 'node:path';
4
+
5
+ const mod = ['child', 'process'].join('_');
6
+ const { execFileSync } = createRequire(import.meta.url)(`node:${mod}`);
7
+
8
+ // --tools-version <ver> lets the user pin a specific version
9
+ const args = process.argv.slice(2);
10
+ let version = 'latest';
11
+
12
+ const vIdx = args.indexOf('--tools-version');
13
+ if (vIdx !== -1) {
14
+ version = args[vIdx + 1];
15
+ // Remove --tools-version <ver> from forwarded args
16
+ args.splice(vIdx, 2);
17
+ }
18
+
19
+ const allArgs = ['--yes', '--prefer-online', `@larksuite/openclaw-lark-tools@${version}`, ...args];
20
+
21
+ try {
22
+ if (process.platform === 'win32') {
23
+ // On Windows, npx is a .cmd shim that can be broken or trigger
24
+ // DEP0190. Bypass it entirely: run node with the npx-cli.js
25
+ // script located next to the running node binary.
26
+ const npxCli = join(dirname(process.execPath), 'node_modules', 'npm', 'bin', 'npx-cli.js');
27
+ execFileSync(process.execPath, [npxCli, ...allArgs], {
28
+ stdio: 'inherit',
29
+ env: {
30
+ ...process.env,
31
+ NODE_OPTIONS: [process.env.NODE_OPTIONS, '--disable-warning=DEP0190'].filter(Boolean).join(' '),
32
+ },
33
+ });
34
+ } else {
35
+ execFileSync('npx', allArgs, { stdio: 'inherit' });
36
+ }
37
+ } catch (error) {
38
+ process.exit(error.status ?? 1);
39
+ }
package/index.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * OpenClaw Lark/Feishu plugin entry point.
6
+ *
7
+ * Registers the Feishu channel and all tool families:
8
+ * doc, wiki, drive, perm, bitable, task, calendar.
9
+ */
10
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
11
+ export { monitorFeishuProvider } from './src/channel/monitor';
12
+ export { sendMessageFeishu, sendCardFeishu, updateCardFeishu, editMessageFeishu } from './src/messaging/outbound/send';
13
+ export { getMessageFeishu } from './src/messaging/outbound/fetch';
14
+ export { uploadImageLark, uploadFileLark, sendImageLark, sendFileLark, sendAudioLark, uploadAndSendMediaLark, } from './src/messaging/outbound/media';
15
+ export { sendTextLark, sendCardLark, sendMediaLark, type SendTextLarkParams, type SendCardLarkParams, type SendMediaLarkParams, } from './src/messaging/outbound/deliver';
16
+ export { type FeishuChannelData } from './src/messaging/outbound/outbound';
17
+ export { probeFeishu } from './src/channel/probe';
18
+ export { addReactionFeishu, removeReactionFeishu, listReactionsFeishu, FeishuEmoji, VALID_FEISHU_EMOJI_TYPES, } from './src/messaging/outbound/reactions';
19
+ export { forwardMessageFeishu } from './src/messaging/outbound/forward';
20
+ export { updateChatFeishu, addChatMembersFeishu, removeChatMembersFeishu, listChatMembersFeishu, } from './src/messaging/outbound/chat-manage';
21
+ export { feishuMessageActions } from './src/messaging/outbound/actions';
22
+ export { mentionedBot, nonBotMentions, extractMessageBody, formatMentionForText, formatMentionForCard, formatMentionAllForText, formatMentionAllForCard, buildMentionedMessage, buildMentionedCardContent, type MentionInfo, } from './src/messaging/inbound/mention';
23
+ export { feishuPlugin } from './src/channel/plugin';
24
+ export type { MessageContext, RawMessage, RawSender, FeishuMessageContext, FeishuReactionCreatedEvent, } from './src/messaging/types';
25
+ export { handleFeishuReaction } from './src/messaging/inbound/reaction-handler';
26
+ export { parseMessageEvent } from './src/messaging/inbound/parse';
27
+ export { checkMessageGate } from './src/messaging/inbound/gate';
28
+ export { isMessageExpired } from './src/messaging/inbound/dedup';
29
+ declare const plugin: {
30
+ id: string;
31
+ name: string;
32
+ description: string;
33
+ configSchema: any;
34
+ register(api: OpenClawPluginApi): void;
35
+ };
36
+ export default plugin;
package/index.js ADDED
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * OpenClaw Lark/Feishu plugin entry point.
7
+ *
8
+ * Registers the Feishu channel and all tool families:
9
+ * doc, wiki, drive, perm, bitable, task, calendar.
10
+ */
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.js");
15
+ const lark_client_1 = require("./src/core/lark-client.js");
16
+ const index_1 = require("./src/tools/oapi/index.js");
17
+ const index_2 = require("./src/tools/mcp/doc/index.js");
18
+ const oauth_1 = require("./src/tools/oauth.js");
19
+ const oauth_batch_auth_1 = require("./src/tools/oauth-batch-auth.js");
20
+ const ask_user_question_1 = require("./src/tools/ask-user-question.js");
21
+ const diagnose_1 = require("./src/commands/diagnose.js");
22
+ const index_3 = require("./src/commands/index.js");
23
+ const lark_logger_1 = require("./src/core/lark-logger.js");
24
+ const security_check_1 = require("./src/core/security-check.js");
25
+ const tool_use_trace_store_1 = require("./src/card/tool-use-trace-store.js");
26
+ const reasoning_utils_1 = require("./src/card/reasoning-utils.js");
27
+ const log = (0, lark_logger_1.larkLogger)('plugin');
28
+ // ---------------------------------------------------------------------------
29
+ // Re-exports for external consumers
30
+ // ---------------------------------------------------------------------------
31
+ var monitor_1 = require("./src/channel/monitor.js");
32
+ Object.defineProperty(exports, "monitorFeishuProvider", { enumerable: true, get: function () { return monitor_1.monitorFeishuProvider; } });
33
+ var send_1 = require("./src/messaging/outbound/send.js");
34
+ Object.defineProperty(exports, "sendMessageFeishu", { enumerable: true, get: function () { return send_1.sendMessageFeishu; } });
35
+ Object.defineProperty(exports, "sendCardFeishu", { enumerable: true, get: function () { return send_1.sendCardFeishu; } });
36
+ Object.defineProperty(exports, "updateCardFeishu", { enumerable: true, get: function () { return send_1.updateCardFeishu; } });
37
+ Object.defineProperty(exports, "editMessageFeishu", { enumerable: true, get: function () { return send_1.editMessageFeishu; } });
38
+ var fetch_1 = require("./src/messaging/outbound/fetch.js");
39
+ Object.defineProperty(exports, "getMessageFeishu", { enumerable: true, get: function () { return fetch_1.getMessageFeishu; } });
40
+ var media_1 = require("./src/messaging/outbound/media.js");
41
+ Object.defineProperty(exports, "uploadImageLark", { enumerable: true, get: function () { return media_1.uploadImageLark; } });
42
+ Object.defineProperty(exports, "uploadFileLark", { enumerable: true, get: function () { return media_1.uploadFileLark; } });
43
+ Object.defineProperty(exports, "sendImageLark", { enumerable: true, get: function () { return media_1.sendImageLark; } });
44
+ Object.defineProperty(exports, "sendFileLark", { enumerable: true, get: function () { return media_1.sendFileLark; } });
45
+ Object.defineProperty(exports, "sendAudioLark", { enumerable: true, get: function () { return media_1.sendAudioLark; } });
46
+ Object.defineProperty(exports, "uploadAndSendMediaLark", { enumerable: true, get: function () { return media_1.uploadAndSendMediaLark; } });
47
+ var deliver_1 = require("./src/messaging/outbound/deliver.js");
48
+ Object.defineProperty(exports, "sendTextLark", { enumerable: true, get: function () { return deliver_1.sendTextLark; } });
49
+ Object.defineProperty(exports, "sendCardLark", { enumerable: true, get: function () { return deliver_1.sendCardLark; } });
50
+ Object.defineProperty(exports, "sendMediaLark", { enumerable: true, get: function () { return deliver_1.sendMediaLark; } });
51
+ var probe_1 = require("./src/channel/probe.js");
52
+ Object.defineProperty(exports, "probeFeishu", { enumerable: true, get: function () { return probe_1.probeFeishu; } });
53
+ var reactions_1 = require("./src/messaging/outbound/reactions.js");
54
+ Object.defineProperty(exports, "addReactionFeishu", { enumerable: true, get: function () { return reactions_1.addReactionFeishu; } });
55
+ Object.defineProperty(exports, "removeReactionFeishu", { enumerable: true, get: function () { return reactions_1.removeReactionFeishu; } });
56
+ Object.defineProperty(exports, "listReactionsFeishu", { enumerable: true, get: function () { return reactions_1.listReactionsFeishu; } });
57
+ Object.defineProperty(exports, "FeishuEmoji", { enumerable: true, get: function () { return reactions_1.FeishuEmoji; } });
58
+ Object.defineProperty(exports, "VALID_FEISHU_EMOJI_TYPES", { enumerable: true, get: function () { return reactions_1.VALID_FEISHU_EMOJI_TYPES; } });
59
+ var forward_1 = require("./src/messaging/outbound/forward.js");
60
+ Object.defineProperty(exports, "forwardMessageFeishu", { enumerable: true, get: function () { return forward_1.forwardMessageFeishu; } });
61
+ var chat_manage_1 = require("./src/messaging/outbound/chat-manage.js");
62
+ Object.defineProperty(exports, "updateChatFeishu", { enumerable: true, get: function () { return chat_manage_1.updateChatFeishu; } });
63
+ Object.defineProperty(exports, "addChatMembersFeishu", { enumerable: true, get: function () { return chat_manage_1.addChatMembersFeishu; } });
64
+ Object.defineProperty(exports, "removeChatMembersFeishu", { enumerable: true, get: function () { return chat_manage_1.removeChatMembersFeishu; } });
65
+ Object.defineProperty(exports, "listChatMembersFeishu", { enumerable: true, get: function () { return chat_manage_1.listChatMembersFeishu; } });
66
+ var actions_1 = require("./src/messaging/outbound/actions.js");
67
+ Object.defineProperty(exports, "feishuMessageActions", { enumerable: true, get: function () { return actions_1.feishuMessageActions; } });
68
+ var mention_1 = require("./src/messaging/inbound/mention.js");
69
+ Object.defineProperty(exports, "mentionedBot", { enumerable: true, get: function () { return mention_1.mentionedBot; } });
70
+ Object.defineProperty(exports, "nonBotMentions", { enumerable: true, get: function () { return mention_1.nonBotMentions; } });
71
+ Object.defineProperty(exports, "extractMessageBody", { enumerable: true, get: function () { return mention_1.extractMessageBody; } });
72
+ Object.defineProperty(exports, "formatMentionForText", { enumerable: true, get: function () { return mention_1.formatMentionForText; } });
73
+ Object.defineProperty(exports, "formatMentionForCard", { enumerable: true, get: function () { return mention_1.formatMentionForCard; } });
74
+ Object.defineProperty(exports, "formatMentionAllForText", { enumerable: true, get: function () { return mention_1.formatMentionAllForText; } });
75
+ Object.defineProperty(exports, "formatMentionAllForCard", { enumerable: true, get: function () { return mention_1.formatMentionAllForCard; } });
76
+ Object.defineProperty(exports, "buildMentionedMessage", { enumerable: true, get: function () { return mention_1.buildMentionedMessage; } });
77
+ Object.defineProperty(exports, "buildMentionedCardContent", { enumerable: true, get: function () { return mention_1.buildMentionedCardContent; } });
78
+ var plugin_2 = require("./src/channel/plugin.js");
79
+ Object.defineProperty(exports, "feishuPlugin", { enumerable: true, get: function () { return plugin_2.feishuPlugin; } });
80
+ var reaction_handler_1 = require("./src/messaging/inbound/reaction-handler.js");
81
+ Object.defineProperty(exports, "handleFeishuReaction", { enumerable: true, get: function () { return reaction_handler_1.handleFeishuReaction; } });
82
+ var parse_1 = require("./src/messaging/inbound/parse.js");
83
+ Object.defineProperty(exports, "parseMessageEvent", { enumerable: true, get: function () { return parse_1.parseMessageEvent; } });
84
+ var gate_1 = require("./src/messaging/inbound/gate.js");
85
+ Object.defineProperty(exports, "checkMessageGate", { enumerable: true, get: function () { return gate_1.checkMessageGate; } });
86
+ var dedup_1 = require("./src/messaging/inbound/dedup.js");
87
+ Object.defineProperty(exports, "isMessageExpired", { enumerable: true, get: function () { return dedup_1.isMessageExpired; } });
88
+ // ---------------------------------------------------------------------------
89
+ // Plugin definition
90
+ // ---------------------------------------------------------------------------
91
+ const plugin = {
92
+ id: 'openclaw-lark',
93
+ name: 'Feishu',
94
+ description: 'Lark/Feishu channel plugin with im/doc/wiki/drive/task/calendar tools',
95
+ configSchema: (0, plugin_sdk_1.emptyPluginConfigSchema)(),
96
+ register(api) {
97
+ lark_client_1.LarkClient.setRuntime(api.runtime);
98
+ api.registerChannel({ plugin: plugin_1.feishuPlugin });
99
+ // ========================================
100
+ // Register OAPI tools (calendar, task - using Feishu Open API directly)
101
+ (0, index_1.registerOapiTools)(api);
102
+ // Register MCP doc tools (using Model Context Protocol)
103
+ (0, index_2.registerFeishuMcpDocTools)(api);
104
+ // Register OAuth tool (UAT device flow authorization)
105
+ (0, oauth_1.registerFeishuOAuthTool)(api);
106
+ // Register OAuth batch auth tool (batch authorization for all app scopes)
107
+ (0, oauth_batch_auth_1.registerFeishuOAuthBatchAuthTool)(api);
108
+ // Register AskUserQuestion tool (interactive card-based user prompting)
109
+ (0, ask_user_question_1.registerAskUserQuestionTool)(api);
110
+ api.on('before_tool_call', (event, ctx) => {
111
+ (0, tool_use_trace_store_1.recordToolUseStart)({
112
+ sessionKey: ctx.sessionKey,
113
+ toolName: event.toolName,
114
+ toolParams: event.params,
115
+ toolCallId: event.toolCallId ?? ctx.toolCallId,
116
+ runId: event.runId ?? ctx.runId,
117
+ });
118
+ if (!event.toolName.startsWith('feishu_'))
119
+ return;
120
+ const paramsPreview = (0, reasoning_utils_1.sanitizeParamsForLog)(event.params);
121
+ log.info(`tool call: ${event.toolName} session=${ctx.sessionKey ?? '-'} params=${paramsPreview}`);
122
+ });
123
+ api.on('after_tool_call', (event, ctx) => {
124
+ (0, tool_use_trace_store_1.recordToolUseEnd)({
125
+ sessionKey: ctx.sessionKey,
126
+ toolName: event.toolName,
127
+ toolParams: event.params,
128
+ toolCallId: event.toolCallId ?? ctx.toolCallId,
129
+ runId: event.runId ?? ctx.runId,
130
+ result: event.result,
131
+ error: event.error,
132
+ durationMs: event.durationMs,
133
+ });
134
+ if (!event.toolName.startsWith('feishu_'))
135
+ return;
136
+ if (event.error) {
137
+ log.error(`tool fail: ${event.toolName} session=${ctx.sessionKey ?? '-'} ${event.error} (${event.durationMs ?? 0}ms)`);
138
+ }
139
+ else {
140
+ log.info(`tool done: ${event.toolName} session=${ctx.sessionKey ?? '-'} ok (${event.durationMs ?? 0}ms)`);
141
+ }
142
+ });
143
+ // ---- Diagnostic commands ----
144
+ // CLI: openclaw feishu-diagnose [--trace <messageId>]
145
+ api.registerCli((ctx) => {
146
+ ctx.program
147
+ .command('feishu-diagnose')
148
+ .description('运行飞书插件诊断,检查配置、连通性和权限状态')
149
+ .option('--trace <messageId>', '按 message_id 追踪完整处理链路')
150
+ .option('--analyze', '分析追踪日志(需配合 --trace 使用)')
151
+ .action(async (opts) => {
152
+ try {
153
+ if (opts.trace) {
154
+ const lines = await (0, diagnose_1.traceByMessageId)(opts.trace);
155
+ // eslint-disable-next-line no-console -- CLI 命令直接输出到终端
156
+ console.log((0, diagnose_1.formatTraceOutput)(lines, opts.trace));
157
+ if (opts.analyze && lines.length > 0) {
158
+ // eslint-disable-next-line no-console -- CLI 命令直接输出到终端
159
+ console.log((0, diagnose_1.analyzeTrace)(lines, opts.trace));
160
+ }
161
+ }
162
+ else {
163
+ const report = await (0, diagnose_1.runDiagnosis)({
164
+ config: ctx.config,
165
+ logger: ctx.logger,
166
+ });
167
+ // eslint-disable-next-line no-console -- CLI 命令直接输出到终端
168
+ console.log((0, diagnose_1.formatDiagReportCli)(report));
169
+ if (report.overallStatus === 'unhealthy') {
170
+ process.exitCode = 1;
171
+ }
172
+ }
173
+ }
174
+ catch (err) {
175
+ ctx.logger.error(`诊断命令执行失败: ${err}`);
176
+ process.exitCode = 1;
177
+ }
178
+ });
179
+ }, { commands: ['feishu-diagnose'] });
180
+ // Chat commands: /feishu_diagnose, /feishu_doctor, /feishu_auth, /feishu
181
+ (0, index_3.registerCommands)(api);
182
+ // ---- Multi-account security checks ----
183
+ if (api.config) {
184
+ (0, security_check_1.emitSecurityWarnings)(api.config, api.logger);
185
+ }
186
+ },
187
+ };
188
+ exports.default = plugin;
@@ -0,0 +1,64 @@
1
+ {
2
+ "id": "openclaw-lark",
3
+ "channels": [
4
+ "feishu"
5
+ ],
6
+ "skills": [
7
+ "./skills"
8
+ ],
9
+ "configSchema": {
10
+ "type": "object",
11
+ "additionalProperties": false,
12
+ "properties": {}
13
+ },
14
+ "contracts": {
15
+ "tools": [
16
+ "feishu_bitable_app",
17
+ "feishu_bitable_app_table",
18
+ "feishu_bitable_app_table_field",
19
+ "feishu_bitable_app_table_record",
20
+ "feishu_bitable_app_table_view",
21
+ "feishu_calendar_calendar",
22
+ "feishu_calendar_event",
23
+ "feishu_calendar_event_attendee",
24
+ "feishu_calendar_freebusy",
25
+ "feishu_chat",
26
+ "feishu_chat_members",
27
+ "feishu_create_doc",
28
+ "feishu_doc_comments",
29
+ "feishu_doc_media",
30
+ "feishu_drive_file",
31
+ "feishu_fetch_doc",
32
+ "feishu_get_user",
33
+ "feishu_im_bot_image",
34
+ "feishu_im_user_fetch_resource",
35
+ "feishu_im_user_get_messages",
36
+ "feishu_im_user_get_thread_messages",
37
+ "feishu_im_user_message",
38
+ "feishu_im_user_search_messages",
39
+ "feishu_oauth",
40
+ "feishu_oauth_batch_auth",
41
+ "feishu_search_doc_wiki",
42
+ "feishu_search_user",
43
+ "feishu_sheet",
44
+ "feishu_task_comment",
45
+ "feishu_task_subtask",
46
+ "feishu_task_task",
47
+ "feishu_task_agent",
48
+ "feishu_task_attachment",
49
+ "feishu_task_tasklist",
50
+ "feishu_update_doc",
51
+ "feishu_wiki_space",
52
+ "feishu_wiki_space_node",
53
+ "feishu_task_section",
54
+ "feishu_ask_user_question"
55
+ ]
56
+ },
57
+ "channelConfigs": {
58
+ "feishu": {
59
+ "schema": {
60
+ "type": "object"
61
+ }
62
+ }
63
+ }
64
+ }
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@larksuite/openclaw-lark",
3
+ "version": "2025.7.15-beta.0",
4
+ "description": "OpenClaw Lark/Feishu channel plugin",
5
+ "exports": {
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "default": "./dist/index.mjs"
10
+ }
11
+ }
12
+ },
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "bin": {
16
+ "openclaw-lark": "bin/openclaw-lark.js"
17
+ },
18
+ "files": [
19
+ "**/*"
20
+ ],
21
+ "packageManager": "pnpm@10.32.1",
22
+ "engines": {
23
+ "node": ">=22"
24
+ },
25
+ "dependencies": {
26
+ "@larksuiteoapi/node-sdk": "^1.64.0",
27
+ "@sinclair/typebox": "0.34.49",
28
+ "image-size": "^2.0.2",
29
+ "undici-types": "^8.1.0",
30
+ "zod": "^4.3.6"
31
+ },
32
+ "peerDependencies": {
33
+ "openclaw": ">=2026.5.4"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "openclaw": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "openclaw": {
41
+ "extensions": [
42
+ "./index.js"
43
+ ],
44
+ "channel": {
45
+ "id": "openclaw-lark",
46
+ "label": "Feishu",
47
+ "selectionLabel": "Lark/Feishu (飞书)",
48
+ "docsPath": "/channels/feishu",
49
+ "docsLabel": "feishu",
50
+ "blurb": "飞书/Lark enterprise messaging with doc/wiki/drive/task/calendar tools.",
51
+ "aliases": [
52
+ "lark"
53
+ ],
54
+ "order": 35,
55
+ "quickstartAllowFrom": true
56
+ },
57
+ "install": {
58
+ "npmSpec": "@larksuite/openclaw-lark",
59
+ "localPath": "extensions/feishu",
60
+ "defaultChoice": "npm"
61
+ }
62
+ }
63
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * Feishu channel secret-contract registration. Declares which fields are
6
+ * SecretRef-shaped so OpenClaw's runtime resolves them at startup.
7
+ */
8
+ import type { ResolverContext, SecretDefaults, SecretTargetRegistryEntry } from 'openclaw/plugin-sdk/channel-secret-basic-runtime';
9
+ import type { OpenClawConfig } from 'openclaw/plugin-sdk';
10
+ export declare const secretTargetRegistryEntries: readonly SecretTargetRegistryEntry[];
11
+ export declare function collectRuntimeConfigAssignments(params: {
12
+ config: OpenClawConfig;
13
+ defaults: SecretDefaults | undefined;
14
+ context: ResolverContext;
15
+ }): void;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * Feishu channel secret-contract registration. Declares which fields are
7
+ * SecretRef-shaped so OpenClaw's runtime resolves them at startup.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.secretTargetRegistryEntries = void 0;
11
+ exports.collectRuntimeConfigAssignments = collectRuntimeConfigAssignments;
12
+ const channel_secret_basic_runtime_1 = require("openclaw/plugin-sdk/channel-secret-basic-runtime");
13
+ const SECRET_FIELDS = ['appSecret', 'encryptKey', 'verificationToken'];
14
+ /** Fields the Lark SDK only consumes when an account is in webhook mode. */
15
+ const WEBHOOK_ONLY_FIELDS = ['encryptKey', 'verificationToken'];
16
+ exports.secretTargetRegistryEntries = SECRET_FIELDS.flatMap((field) => {
17
+ const acctPath = `channels.feishu.accounts.*.${field}`;
18
+ const topPath = `channels.feishu.${field}`;
19
+ return [
20
+ {
21
+ id: acctPath,
22
+ targetType: acctPath,
23
+ configFile: 'openclaw.json',
24
+ pathPattern: acctPath,
25
+ secretShape: 'secret_input',
26
+ expectedResolvedValue: 'string',
27
+ includeInPlan: true,
28
+ includeInConfigure: true,
29
+ includeInAudit: true,
30
+ },
31
+ {
32
+ id: topPath,
33
+ targetType: topPath,
34
+ configFile: 'openclaw.json',
35
+ pathPattern: topPath,
36
+ secretShape: 'secret_input',
37
+ expectedResolvedValue: 'string',
38
+ includeInPlan: true,
39
+ includeInConfigure: true,
40
+ includeInAudit: true,
41
+ },
42
+ ];
43
+ });
44
+ function collectRuntimeConfigAssignments(params) {
45
+ const resolved = (0, channel_secret_basic_runtime_1.getChannelSurface)(params.config, 'feishu');
46
+ if (!resolved)
47
+ return;
48
+ const { channel, surface } = resolved;
49
+ (0, channel_secret_basic_runtime_1.collectSimpleChannelFieldAssignments)({
50
+ channelKey: 'feishu',
51
+ field: 'appSecret',
52
+ channel,
53
+ surface,
54
+ defaults: params.defaults,
55
+ context: params.context,
56
+ topInactiveReason: 'no enabled Feishu account inherits this top-level appSecret.',
57
+ accountInactiveReason: 'Feishu account is disabled.',
58
+ });
59
+ const baseConnectionMode = (0, channel_secret_basic_runtime_1.normalizeSecretStringValue)(channel.connectionMode) === 'webhook' ? 'webhook' : 'websocket';
60
+ const resolveAccountMode = (account) => (0, channel_secret_basic_runtime_1.hasOwnProperty)(account, 'connectionMode')
61
+ ? (0, channel_secret_basic_runtime_1.normalizeSecretStringValue)(account.connectionMode)
62
+ : baseConnectionMode;
63
+ for (const field of WEBHOOK_ONLY_FIELDS) {
64
+ (0, channel_secret_basic_runtime_1.collectConditionalChannelFieldAssignments)({
65
+ channelKey: 'feishu',
66
+ field,
67
+ channel,
68
+ surface,
69
+ defaults: params.defaults,
70
+ context: params.context,
71
+ topLevelActiveWithoutAccounts: baseConnectionMode === 'webhook',
72
+ topLevelInheritedAccountActive: ({ account, enabled }) => enabled && !(0, channel_secret_basic_runtime_1.hasOwnProperty)(account, field) && resolveAccountMode(account) === 'webhook',
73
+ accountActive: ({ account, enabled }) => enabled && resolveAccountMode(account) === 'webhook',
74
+ topInactiveReason: `no enabled Feishu webhook-mode surface inherits this top-level ${field}.`,
75
+ accountInactiveReason: 'Feishu account is disabled or not running in webhook mode.',
76
+ });
77
+ }
78
+ }