@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
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * Tool Scopes 配置
7
+ *
8
+ * 定义所有工具动作所需的飞书权限映射。
9
+ *
10
+ * ## 维护方式
11
+ *
12
+ * ⚠️ 此文件采用**手动维护**,新增或修改工具时需同步更新。
13
+ *
14
+ * ### 新增工具动作
15
+ *
16
+ * 1. 在 `ToolActionKey` 类型中添加新键:
17
+ * ```typescript
18
+ * export type ToolActionKey =
19
+ * | "feishu_calendar_event.create"
20
+ * | "feishu_new_tool.action" // 新增
21
+ * ```
22
+ *
23
+ * 2. 在 `TOOL_SCOPES` 对象中添加对应配置:
24
+ * ```typescript
25
+ * export const TOOL_SCOPES: ToolScopeMapping = {
26
+ * "feishu_new_tool.action": [
27
+ * "required:scope:here"
28
+ * ],
29
+ * };
30
+ * ```
31
+ *
32
+ * 3. 运行 TypeScript 类型检查验证一致性:
33
+ * ```bash
34
+ * cd openclaw/feishu && npx tsc --noEmit
35
+ * ```
36
+ *
37
+ * ### 如何确定所需 Scope
38
+ *
39
+ * 1. **查阅飞书开放平台 API 文档**:https://open.feishu.cn/document
40
+ * 2. **使用 feishu-oapi-search skill**:在 Claude Code 中搜索 API 文档
41
+ * 3. **参考类似工具**:查看功能相近的工具的 scope 配置
42
+ * 4. **实际测试**:观察 API 调用的错误码(LARK_ERROR.APP_SCOPE_MISSING/99991672=应用缺权限,LARK_ERROR.USER_SCOPE_INSUFFICIENT/99991679=用户缺授权)
43
+ *
44
+ * 最后更新: 2026-03-03
45
+ */
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.SENSITIVE_SCOPES = exports.REQUIRED_SCOPE_DESCRIPTIONS = exports.REQUIRED_APP_SCOPES = exports.TOOL_SCOPES = void 0;
48
+ exports.filterSensitiveScopes = filterSensitiveScopes;
49
+ // ===== 数据 =====
50
+ /**
51
+ * Tool Scope 数据
52
+ *
53
+ * 每个工具动作所需的飞书权限列表(Required Scopes)
54
+ *
55
+ * ## 数据说明
56
+ *
57
+ * - 空数组 `[]` 表示该工具动作不需要任何权限
58
+ * - 多个权限表示需要同时拥有所有权限(AND 关系)
59
+ * - 所有 scope 都是 user scopes(用户级权限)
60
+ *
61
+ * ## 示例
62
+ *
63
+ * ```typescript
64
+ * TOOL_SCOPES["feishu_calendar_event.create"]
65
+ * // 返回: ["calendar:calendar.event:create", "calendar:calendar.event:update"]
66
+ * ```
67
+ *
68
+ * @see {@link ToolActionKey} 所有可用的工具动作键
69
+ */
70
+ exports.TOOL_SCOPES = {
71
+ 'feishu_bitable_app.create': ['base:app:create'],
72
+ 'feishu_bitable_app.get': ['base:app:read'],
73
+ 'feishu_bitable_app.list': ['space:document:retrieve'],
74
+ 'feishu_bitable_app.patch': ['base:app:update'],
75
+ 'feishu_bitable_app.copy': ['base:app:copy'],
76
+ 'feishu_bitable_app_table.create': ['base:table:create'],
77
+ 'feishu_bitable_app_table.list': ['base:table:read'],
78
+ 'feishu_bitable_app_table.patch': ['base:table:update'],
79
+ 'feishu_bitable_app_table.batch_create': ['base:table:create'],
80
+ 'feishu_bitable_app_table_record.create': ['base:record:create'],
81
+ 'feishu_bitable_app_table_record.update': ['base:record:update'],
82
+ 'feishu_bitable_app_table_record.delete': ['base:record:delete'],
83
+ 'feishu_bitable_app_table_record.batch_create': ['base:record:create'],
84
+ 'feishu_bitable_app_table_record.batch_update': ['base:record:update'],
85
+ 'feishu_bitable_app_table_record.batch_delete': ['base:record:delete'],
86
+ 'feishu_bitable_app_table_record.list': ['base:record:retrieve'],
87
+ 'feishu_bitable_app_table_field.create': ['base:field:create'],
88
+ 'feishu_bitable_app_table_field.list': ['base:field:read'],
89
+ 'feishu_bitable_app_table_field.update': ['base:field:read', 'base:field:update'],
90
+ 'feishu_bitable_app_table_field.delete': ['base:field:delete'],
91
+ 'feishu_bitable_app_table_view.create': ['base:view:write_only'],
92
+ 'feishu_bitable_app_table_view.get': ['base:view:read'],
93
+ 'feishu_bitable_app_table_view.list': ['base:view:read'],
94
+ 'feishu_bitable_app_table_view.patch': ['base:view:write_only'],
95
+ 'feishu_calendar_calendar.list': ['calendar:calendar:read'],
96
+ 'feishu_calendar_calendar.get': ['calendar:calendar:read'],
97
+ 'feishu_calendar_calendar.primary': ['calendar:calendar:read'],
98
+ 'feishu_calendar_event.create': ['calendar:calendar.event:create', 'calendar:calendar.event:update'],
99
+ 'feishu_calendar_event.list': ['calendar:calendar.event:read'],
100
+ 'feishu_calendar_event.get': ['calendar:calendar.event:read'],
101
+ 'feishu_calendar_event.patch': ['calendar:calendar.event:update'],
102
+ 'feishu_calendar_event.delete': ['calendar:calendar.event:delete'],
103
+ 'feishu_calendar_event.search': ['calendar:calendar.event:read'],
104
+ 'feishu_calendar_event.reply': ['calendar:calendar.event:reply'],
105
+ 'feishu_calendar_event.instances': ['calendar:calendar.event:read'],
106
+ 'feishu_calendar_event.instance_view': ['calendar:calendar.event:read'],
107
+ 'feishu_calendar_event_attendee.create': ['calendar:calendar.event:update'],
108
+ 'feishu_calendar_event_attendee.list': ['calendar:calendar.event:read'],
109
+ 'feishu_calendar_freebusy.list': ['calendar:calendar.free_busy:read'],
110
+ 'feishu_task_attachment.upload': ['task:attachment:write'],
111
+ 'feishu_task_task.create': ['task:task:write', 'task:task:writeonly'],
112
+ 'feishu_task_task.get': ['task:task:read', 'task:task:write'],
113
+ 'feishu_task_task.list': ['task:task:read', 'task:task:write'],
114
+ 'feishu_task_task.patch': ['task:task:write', 'task:task:writeonly'],
115
+ 'feishu_task_task.add_members': ['task:task:write', 'task:task:writeonly'],
116
+ 'feishu_task_task.append_steps': ['task:task:write', 'task:task:writeonly'],
117
+ 'feishu_task_tasklist.create': ['task:tasklist:write'],
118
+ 'feishu_task_tasklist.get': ['task:tasklist:read', 'task:tasklist:write'],
119
+ 'feishu_task_tasklist.list': ['task:tasklist:read', 'task:tasklist:write'],
120
+ 'feishu_task_tasklist.tasks': ['task:tasklist:read', 'task:tasklist:write'],
121
+ 'feishu_task_tasklist.patch': ['task:tasklist:write'],
122
+ 'feishu_task_tasklist.add_members': ['task:tasklist:write'],
123
+ 'feishu_task_comment.create': ['task:comment:write'],
124
+ 'feishu_task_comment.list': ['task:comment:read', 'task:comment:write'],
125
+ 'feishu_task_comment.get': ['task:comment:read', 'task:comment:write'],
126
+ 'feishu_task_section.create': ['task:task'],
127
+ 'feishu_task_section.get': ['task:task'],
128
+ 'feishu_task_section.list': ['task:task'],
129
+ 'feishu_task_section.patch': ['task:task'],
130
+ 'feishu_task_section.tasks': ['task:task'],
131
+ 'feishu_task_subtask.create': ['task:task:write'],
132
+ 'feishu_task_subtask.list': ['task:task:read', 'task:task:write'],
133
+ 'feishu_task_agent.register': ['task:task:write'],
134
+ 'feishu_task_agent.update_profile': ['task:task:write', 'task:task:writeonly'],
135
+ 'feishu_chat.search': ['im:chat:read'],
136
+ 'feishu_chat.get': ['im:chat:read'],
137
+ 'feishu_chat_members.default': ['im:chat.members:read'],
138
+ 'feishu_drive_file.list': ['space:document:retrieve'],
139
+ 'feishu_drive_file.get_meta': ['drive:drive.metadata:readonly'],
140
+ 'feishu_drive_file.copy': ['docs:document:copy'],
141
+ 'feishu_drive_file.move': ['space:document:move'],
142
+ 'feishu_drive_file.delete': ['space:document:delete'],
143
+ 'feishu_drive_file.upload': ['drive:file:upload'],
144
+ 'feishu_drive_file.download': ['drive:file:download'],
145
+ 'feishu_doc_media.download': ['board:whiteboard:node:read', 'docs:document.media:download'],
146
+ 'feishu_doc_media.insert': ['docx:document:write_only', 'docs:document.media:upload'],
147
+ 'feishu_doc_comments.list': ['wiki:node:read', 'docs:document.comment:read'],
148
+ 'feishu_doc_comments.list_replies': ['wiki:node:read', 'docs:document.comment:read'],
149
+ 'feishu_doc_comments.create': ['wiki:node:read', 'docs:document.comment:create'],
150
+ 'feishu_doc_comments.reply': ['wiki:node:read', 'docs:document.comment:create'],
151
+ 'feishu_doc_comments.patch': ['docs:document.comment:update'],
152
+ 'feishu_wiki_space.list': ['wiki:space:retrieve'],
153
+ 'feishu_wiki_space.get': ['wiki:space:read'],
154
+ 'feishu_wiki_space.create': ['wiki:space:write_only'],
155
+ 'feishu_wiki_space_node.list': ['wiki:node:retrieve'],
156
+ 'feishu_wiki_space_node.get': ['wiki:node:read'],
157
+ 'feishu_wiki_space_node.create': ['wiki:node:create'],
158
+ 'feishu_wiki_space_node.move': ['wiki:node:move'],
159
+ 'feishu_wiki_space_node.copy': ['wiki:node:copy'],
160
+ 'feishu_im_user_message.send': ['im:message', 'im:message.send_as_user'],
161
+ 'feishu_im_user_message.reply': ['im:message', 'im:message.send_as_user'],
162
+ 'feishu_im_user_fetch_resource.default': [
163
+ 'im:message.group_msg:get_as_user',
164
+ 'im:message.p2p_msg:get_as_user',
165
+ 'im:message:readonly',
166
+ ],
167
+ 'feishu_im_user_get_messages.default': [
168
+ 'im:chat:read',
169
+ 'im:message:readonly',
170
+ 'im:message.group_msg:get_as_user',
171
+ 'im:message.p2p_msg:get_as_user',
172
+ 'contact:contact.base:readonly',
173
+ 'contact:user.base:readonly',
174
+ ],
175
+ 'feishu_im_user_search_messages.default': [
176
+ 'im:chat:read',
177
+ 'im:message:readonly',
178
+ 'im:message.group_msg:get_as_user',
179
+ 'im:message.p2p_msg:get_as_user',
180
+ 'contact:contact.base:readonly',
181
+ 'contact:user.base:readonly',
182
+ 'search:message',
183
+ ],
184
+ 'feishu_search_doc_wiki.search': ['search:docs:read'],
185
+ 'feishu_get_user.basic_batch': ['contact:user.basic_profile:readonly'],
186
+ 'feishu_get_user.default': ['contact:contact.base:readonly', 'contact:user.base:readonly'],
187
+ 'feishu_search_user.default': ['contact:user:search'],
188
+ 'feishu_create_doc.default': [
189
+ 'board:whiteboard:node:create',
190
+ 'docx:document:create',
191
+ 'docx:document:readonly',
192
+ 'docx:document:write_only',
193
+ 'wiki:node:create',
194
+ 'wiki:node:read',
195
+ 'docs:document.media:upload',
196
+ ],
197
+ 'feishu_fetch_doc.default': ['docx:document:readonly', 'wiki:node:read'],
198
+ 'feishu_update_doc.default': [
199
+ 'board:whiteboard:node:create',
200
+ 'docx:document:create',
201
+ 'docx:document:readonly',
202
+ 'docx:document:write_only',
203
+ ],
204
+ 'feishu_sheet.info': ['sheets:spreadsheet.meta:read', 'sheets:spreadsheet:read'],
205
+ 'feishu_sheet.read': ['sheets:spreadsheet.meta:read', 'sheets:spreadsheet:read'],
206
+ 'feishu_sheet.write': [
207
+ 'sheets:spreadsheet.meta:read',
208
+ 'sheets:spreadsheet:read',
209
+ 'sheets:spreadsheet:create',
210
+ 'sheets:spreadsheet:write_only',
211
+ ],
212
+ 'feishu_sheet.append': [
213
+ 'sheets:spreadsheet.meta:read',
214
+ 'sheets:spreadsheet:read',
215
+ 'sheets:spreadsheet:create',
216
+ 'sheets:spreadsheet:write_only',
217
+ ],
218
+ 'feishu_sheet.find': ['sheets:spreadsheet.meta:read', 'sheets:spreadsheet:read'],
219
+ 'feishu_sheet.create': [
220
+ 'sheets:spreadsheet.meta:read',
221
+ 'sheets:spreadsheet:read',
222
+ 'sheets:spreadsheet:create',
223
+ 'sheets:spreadsheet:write_only',
224
+ ],
225
+ 'feishu_sheet.export': ['docs:document:export'],
226
+ };
227
+ // ===== 必需的应用身份权限 =====
228
+ /**
229
+ * 飞书插件运行必须开通的应用身份权限清单
230
+ *
231
+ * 这些权限是插件基础功能(消息接收、卡片交互、基本信息查询等)所必需的,
232
+ * 如果缺失这些权限,插件将无法正常工作。
233
+ *
234
+ * 权限分类:
235
+ * - im:message.* - 消息接收和发送
236
+ * - im:chat.* - 群聊管理
237
+ * - im:resource - 消息资源(图片、文件等)
238
+ * - cardkit:card.* - 卡片交互
239
+ * - application:application:self_manage - 应用自身权限查询(权限检查基础)
240
+ * - contact:contact.base:readonly - 通讯录基础信息
241
+ * - docx:document:readonly - 文档基础只读(文档链接预览等)
242
+ *
243
+ * 最后更新: 2026-03-03
244
+ */
245
+ exports.REQUIRED_APP_SCOPES = [
246
+ 'contact:contact.base:readonly',
247
+ 'docx:document:readonly',
248
+ 'im:chat:read',
249
+ 'im:chat:update',
250
+ 'im:message.group_at_msg:readonly',
251
+ 'im:message.p2p_msg:readonly',
252
+ 'im:message.pins:read',
253
+ 'im:message.pins:write_only',
254
+ 'im:message.reactions:read',
255
+ 'im:message.reactions:write_only',
256
+ 'im:message:readonly',
257
+ 'im:message:recall',
258
+ 'im:message:send_as_bot',
259
+ 'im:message:send_multi_users',
260
+ 'im:message:send_sys_msg',
261
+ 'im:message:update',
262
+ 'im:resource',
263
+ 'application:application:self_manage',
264
+ 'cardkit:card:write',
265
+ 'cardkit:card:read',
266
+ ];
267
+ /**
268
+ * 必需权限用途说明
269
+ *
270
+ * 描述每个必需权限的具体用途,帮助管理员理解为什么需要开通该权限。
271
+ */
272
+ exports.REQUIRED_SCOPE_DESCRIPTIONS = {
273
+ 'contact:contact.base:readonly': '获取用户基本信息(姓名、头像)',
274
+ 'docx:document:readonly': '读取文档内容、预览文档链接',
275
+ 'im:chat:read': '读取群聊信息、获取群成员列表',
276
+ 'im:chat:update': '修改群聊设置(群名称、群公告等)',
277
+ 'im:message.group_at_msg:readonly': '接收群聊中 @ 机器人的消息',
278
+ 'im:message.p2p_msg:readonly': '接收私聊消息',
279
+ 'im:message.pins:read': '读取消息置顶状态',
280
+ 'im:message.pins:write_only': '置顶/取消置顶消息',
281
+ 'im:message.reactions:read': '读取消息表情回复',
282
+ 'im:message.reactions:write_only': '添加/删除消息表情回复',
283
+ 'im:message:readonly': '读取消息内容、历史消息',
284
+ 'im:message:recall': '↩撤回机器人发送的消息',
285
+ 'im:message:send_as_bot': '以机器人身份发送消息',
286
+ 'im:message:send_multi_users': '批量发送私聊消息',
287
+ 'im:message:send_sys_msg': '发送系统通知消息',
288
+ 'im:message:update': '更新/编辑已发送的消息',
289
+ 'im:resource': '上传/下载消息资源(图片、文件等)',
290
+ 'application:application:self_manage': '查询应用自身权限状态(诊断基础)',
291
+ 'cardkit:card:write': '创建和更新消息卡片',
292
+ 'cardkit:card:read': '读取消息卡片状态',
293
+ };
294
+ // ===== 高敏感权限 =====
295
+ /**
296
+ * 高敏感权限清单
297
+ *
298
+ * 这些权限具有较高的敏感度,不应在批量授权时自动申请。
299
+ * 用户需要明确知晓这些权限的影响后,才能手动授权。
300
+ *
301
+ * 权限说明:
302
+ * - im:message.send_as_user - 以用户身份发送消息(高风险,可能被滥用发送钓鱼或垃圾消息)
303
+ * - space:document:delete - 删除云文档
304
+ * - calendar:calendar.event:delete - 删除日程
305
+ * - base:table:delete - 删除多维表格数据表
306
+ *
307
+ * 使用场景:
308
+ * - 批量授权时会自动过滤掉这些权限
309
+ * - 需要这些权限的功能会单独提示用户授权
310
+ *
311
+ * 最后更新: 2026-03-17
312
+ */
313
+ exports.SENSITIVE_SCOPES = [
314
+ 'im:message.send_as_user',
315
+ 'space:document:delete',
316
+ 'calendar:calendar.event:delete',
317
+ 'base:table:delete',
318
+ ];
319
+ /**
320
+ * 过滤掉高敏感权限
321
+ *
322
+ * 用于批量授权时排除高敏感权限,这些权限需要用户明确授权。
323
+ *
324
+ * @param scopes - 原始权限列表
325
+ * @returns 过滤后的权限列表(不包含高敏感权限)
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * const allScopes = ["im:message", "im:message.send_as_user", "calendar:calendar:read"];
330
+ * const safeScopes = filterSensitiveScopes(allScopes);
331
+ * // 返回: ["im:message", "calendar:calendar:read"]
332
+ * ```
333
+ */
334
+ function filterSensitiveScopes(scopes) {
335
+ const sensitiveSet = new Set(exports.SENSITIVE_SCOPES);
336
+ return scopes.filter((scope) => !sensitiveSet.has(scope));
337
+ }
338
+ // ===== 统计信息 =====
339
+ /**
340
+ * 工具动作总数: 96
341
+ * 唯一 scope 总数: 74
342
+ * 必需应用权限总数: 20
343
+ * 高敏感权限总数: 4
344
+ */
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * Default values and resolution logic for the Feishu tools configuration.
6
+ *
7
+ * Each boolean flag controls whether a particular category of Feishu-specific
8
+ * agent tools (document access, wiki queries, drive operations, etc.) is
9
+ * enabled for a given account.
10
+ */
11
+ import type { ClawdbotConfig } from 'openclaw/plugin-sdk';
12
+ import type { FeishuToolsConfig, LarkAccount } from './types';
13
+ /**
14
+ * The default tools configuration.
15
+ *
16
+ * By default every non-destructive capability is enabled. The `perm` flag
17
+ * (permission management) defaults to `false` because granting / revoking
18
+ * permissions is a privileged operation that admins should opt into
19
+ * explicitly.
20
+ */
21
+ export declare const DEFAULT_TOOLS_CONFIG: Required<FeishuToolsConfig>;
22
+ /**
23
+ * Merge a partial tools configuration with `DEFAULT_TOOLS_CONFIG`.
24
+ *
25
+ * Fields present in the input take precedence; anything absent falls back
26
+ * to the default value.
27
+ */
28
+ export declare function resolveToolsConfig(cfg?: FeishuToolsConfig): Required<FeishuToolsConfig>;
29
+ /**
30
+ * 合并多个账户的工具配置(取并集)。
31
+ *
32
+ * 工具注册是全局的(启动时注册一次),只要任意一个账户启用了某工具,
33
+ * 该工具就应被注册。执行时由 LarkTicket 路由到具体账户。
34
+ */
35
+ export declare function resolveAnyEnabledToolsConfig(accounts: LarkAccount[]): Required<FeishuToolsConfig>;
36
+ /**
37
+ * 检查工具是否应该被注册(channel 级别的 tools.deny 检查)。
38
+ *
39
+ * 从 `channels.feishu.tools.deny` 读取禁用列表,支持通配符模式。
40
+ *
41
+ * @param cfg - OpenClaw 配置对象
42
+ * @param toolName - 工具名称(如 `feishu_im_user_message`)
43
+ * @returns `true` 如果应该注册,`false` 如果应该跳过
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * // 配置示例:
48
+ * // channels.feishu.tools.deny: ["feishu_im_user_message", "feishu_calendar_*"]
49
+ *
50
+ * shouldRegisterTool(cfg, "feishu_im_user_message") // false
51
+ * shouldRegisterTool(cfg, "feishu_calendar_event") // false (匹配通配符)
52
+ * shouldRegisterTool(cfg, "feishu_task_task") // true
53
+ * ```
54
+ */
55
+ export declare function shouldRegisterTool(cfg: ClawdbotConfig, toolName: string): boolean;
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * Default values and resolution logic for the Feishu tools configuration.
7
+ *
8
+ * Each boolean flag controls whether a particular category of Feishu-specific
9
+ * agent tools (document access, wiki queries, drive operations, etc.) is
10
+ * enabled for a given account.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.DEFAULT_TOOLS_CONFIG = void 0;
14
+ exports.resolveToolsConfig = resolveToolsConfig;
15
+ exports.resolveAnyEnabledToolsConfig = resolveAnyEnabledToolsConfig;
16
+ exports.shouldRegisterTool = shouldRegisterTool;
17
+ // ---------------------------------------------------------------------------
18
+ // Defaults
19
+ // ---------------------------------------------------------------------------
20
+ /**
21
+ * The default tools configuration.
22
+ *
23
+ * By default every non-destructive capability is enabled. The `perm` flag
24
+ * (permission management) defaults to `false` because granting / revoking
25
+ * permissions is a privileged operation that admins should opt into
26
+ * explicitly.
27
+ */
28
+ exports.DEFAULT_TOOLS_CONFIG = {
29
+ doc: true,
30
+ wiki: true,
31
+ drive: true,
32
+ scopes: true,
33
+ perm: false,
34
+ mail: true,
35
+ sheets: true,
36
+ okr: false,
37
+ };
38
+ // ---------------------------------------------------------------------------
39
+ // Resolver
40
+ // ---------------------------------------------------------------------------
41
+ /**
42
+ * Merge a partial tools configuration with `DEFAULT_TOOLS_CONFIG`.
43
+ *
44
+ * Fields present in the input take precedence; anything absent falls back
45
+ * to the default value.
46
+ */
47
+ function resolveToolsConfig(cfg) {
48
+ if (!cfg)
49
+ return { ...exports.DEFAULT_TOOLS_CONFIG };
50
+ return {
51
+ doc: cfg.doc ?? exports.DEFAULT_TOOLS_CONFIG.doc,
52
+ wiki: cfg.wiki ?? exports.DEFAULT_TOOLS_CONFIG.wiki,
53
+ drive: cfg.drive ?? exports.DEFAULT_TOOLS_CONFIG.drive,
54
+ perm: cfg.perm ?? exports.DEFAULT_TOOLS_CONFIG.perm,
55
+ scopes: cfg.scopes ?? exports.DEFAULT_TOOLS_CONFIG.scopes,
56
+ mail: cfg.mail ?? exports.DEFAULT_TOOLS_CONFIG.mail,
57
+ sheets: cfg.sheets ?? exports.DEFAULT_TOOLS_CONFIG.sheets,
58
+ okr: cfg.okr ?? exports.DEFAULT_TOOLS_CONFIG.okr,
59
+ };
60
+ }
61
+ // ---------------------------------------------------------------------------
62
+ // Multi-account aggregation
63
+ // ---------------------------------------------------------------------------
64
+ /**
65
+ * 合并多个账户的工具配置(取并集)。
66
+ *
67
+ * 工具注册是全局的(启动时注册一次),只要任意一个账户启用了某工具,
68
+ * 该工具就应被注册。执行时由 LarkTicket 路由到具体账户。
69
+ */
70
+ function resolveAnyEnabledToolsConfig(accounts) {
71
+ const merged = {
72
+ doc: false,
73
+ wiki: false,
74
+ drive: false,
75
+ perm: false,
76
+ scopes: false,
77
+ mail: false,
78
+ sheets: false,
79
+ okr: false,
80
+ };
81
+ for (const account of accounts) {
82
+ const cfg = resolveToolsConfig(account.config.tools);
83
+ merged.doc = merged.doc || cfg.doc;
84
+ merged.wiki = merged.wiki || cfg.wiki;
85
+ merged.drive = merged.drive || cfg.drive;
86
+ merged.perm = merged.perm || cfg.perm;
87
+ merged.scopes = merged.scopes || cfg.scopes;
88
+ merged.mail = merged.mail || cfg.mail;
89
+ merged.sheets = merged.sheets || cfg.sheets;
90
+ merged.okr = merged.okr || cfg.okr;
91
+ }
92
+ return merged;
93
+ }
94
+ // ---------------------------------------------------------------------------
95
+ // Channel-level tool registration control
96
+ // ---------------------------------------------------------------------------
97
+ /**
98
+ * Check whether a string matches any of the given patterns.
99
+ * Supports trailing `*` as a simple wildcard (e.g., `feishu_calendar_*`).
100
+ */
101
+ function matchesAnyPattern(value, patterns) {
102
+ for (const pattern of patterns) {
103
+ if (pattern === '*')
104
+ return true;
105
+ if (pattern.endsWith('*')) {
106
+ if (value.startsWith(pattern.slice(0, -1)))
107
+ return true;
108
+ }
109
+ else if (value === pattern) {
110
+ return true;
111
+ }
112
+ }
113
+ return false;
114
+ }
115
+ /**
116
+ * 检查工具是否应该被注册(channel 级别的 tools.deny 检查)。
117
+ *
118
+ * 从 `channels.feishu.tools.deny` 读取禁用列表,支持通配符模式。
119
+ *
120
+ * @param cfg - OpenClaw 配置对象
121
+ * @param toolName - 工具名称(如 `feishu_im_user_message`)
122
+ * @returns `true` 如果应该注册,`false` 如果应该跳过
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * // 配置示例:
127
+ * // channels.feishu.tools.deny: ["feishu_im_user_message", "feishu_calendar_*"]
128
+ *
129
+ * shouldRegisterTool(cfg, "feishu_im_user_message") // false
130
+ * shouldRegisterTool(cfg, "feishu_calendar_event") // false (匹配通配符)
131
+ * shouldRegisterTool(cfg, "feishu_task_task") // true
132
+ * ```
133
+ */
134
+ function shouldRegisterTool(cfg, toolName) {
135
+ const feishuConfig = cfg.channels?.feishu;
136
+ const denyList = feishuConfig?.['tools']?.['deny'];
137
+ if (Array.isArray(denyList) && denyList.length > 0) {
138
+ if (matchesAnyPattern(toolName, denyList)) {
139
+ return false;
140
+ }
141
+ }
142
+ return true;
143
+ }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * Core type definitions for the OpenClaw Lark/Feishu channel plugin.
6
+ *
7
+ * Contains inferred Zod config types, domain/connection enums, identifier types,
8
+ * tools configuration, and account types. Messaging, outbound, and channel types
9
+ * live in their respective module type files.
10
+ */
11
+ import type { FeishuAccountConfigSchema, FeishuConfigSchema, FeishuGroupSchema, UATConfigSchema, z } from './config-schema';
12
+ /** Fully resolved top-level Feishu channel configuration. */
13
+ export type FeishuConfig = z.infer<typeof FeishuConfigSchema>;
14
+ /** Per-group configuration overrides. */
15
+ export type FeishuGroupConfig = z.infer<typeof FeishuGroupSchema>;
16
+ /** Per-account configuration overrides (mirrors top-level minus `accounts`). */
17
+ export type FeishuAccountConfig = z.infer<typeof FeishuAccountConfigSchema>;
18
+ /**
19
+ * The Lark platform brand.
20
+ * - `"feishu"` targets the China-mainland Feishu service.
21
+ * - `"lark"` targets the international Lark service.
22
+ * - Any other string is treated as a custom base URL.
23
+ */
24
+ export type LarkBrand = 'feishu' | 'lark' | (string & {});
25
+ /** How the plugin connects to Feishu to receive events. */
26
+ export type FeishuConnectionMode = 'websocket' | 'webhook';
27
+ /** The four ID types recognised by the Feishu API. */
28
+ export type FeishuIdType = 'open_id' | 'user_id' | 'union_id' | 'chat_id';
29
+ /** Per-feature toggles for the Feishu-specific tool capabilities. */
30
+ export interface FeishuToolsConfig {
31
+ doc?: boolean;
32
+ wiki?: boolean;
33
+ drive?: boolean;
34
+ perm?: boolean;
35
+ scopes?: boolean;
36
+ mail?: boolean;
37
+ sheets?: boolean;
38
+ okr?: boolean;
39
+ }
40
+ /** Per-feature toggles for card footer metadata visibility. */
41
+ export interface FeishuFooterConfig {
42
+ status?: boolean;
43
+ elapsed?: boolean;
44
+ tokens?: boolean;
45
+ cache?: boolean;
46
+ context?: boolean;
47
+ model?: boolean;
48
+ }
49
+ /** Common fields shared by all resolved account states. */
50
+ interface LarkAccountBase {
51
+ accountId: string;
52
+ enabled: boolean;
53
+ name?: string;
54
+ encryptKey?: string;
55
+ verificationToken?: string;
56
+ brand: LarkBrand;
57
+ config: FeishuConfig;
58
+ }
59
+ /** An account with both `appId` and `appSecret` present. */
60
+ export type ConfiguredLarkAccount = LarkAccountBase & {
61
+ configured: true;
62
+ appId: string;
63
+ appSecret: string;
64
+ };
65
+ /** An account that is missing `appId` and/or `appSecret`. */
66
+ export type UnconfiguredLarkAccount = LarkAccountBase & {
67
+ configured: false;
68
+ appId?: string;
69
+ appSecret?: string;
70
+ };
71
+ /** A resolved Lark account — either fully configured or not. */
72
+ export type LarkAccount = ConfiguredLarkAccount | UnconfiguredLarkAccount;
73
+ /** UAT (User Access Token) configuration. */
74
+ export type FeishuUATConfig = z.infer<typeof UATConfigSchema>;
75
+ /** The minimum credential set needed to interact with the Lark API. */
76
+ export interface LarkCredentials {
77
+ appId: string;
78
+ appSecret: string;
79
+ encryptKey?: string;
80
+ verificationToken?: string;
81
+ brand: LarkBrand;
82
+ }
83
+ /** Result of probing an app's connectivity / permissions. */
84
+ export interface FeishuProbeResult {
85
+ ok: boolean;
86
+ error?: string;
87
+ appId?: string;
88
+ botName?: string;
89
+ botOpenId?: string;
90
+ }
91
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * Core type definitions for the OpenClaw Lark/Feishu channel plugin.
7
+ *
8
+ * Contains inferred Zod config types, domain/connection enums, identifier types,
9
+ * tools configuration, and account types. Messaging, outbound, and channel types
10
+ * live in their respective module type files.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });