@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,18 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * feishu_task_attachment tool -- Manage task attachments.
6
+ *
7
+ * Actions:
8
+ * - upload: Upload task attachment (tenant identity)
9
+ */
10
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
11
+ export interface FeishuTaskAttachmentParams {
12
+ action: 'upload';
13
+ resource_type?: 'task' | 'task_delivery';
14
+ resource_id: string;
15
+ file: string;
16
+ name?: string;
17
+ }
18
+ export declare function registerFeishuTaskAttachmentTool(api: OpenClawPluginApi): void;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * feishu_task_attachment tool -- Manage task attachments.
7
+ *
8
+ * Actions:
9
+ * - upload: Upload task attachment (tenant identity)
10
+ */
11
+ /* eslint-disable @typescript-eslint/no-explicit-any */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.registerFeishuTaskAttachmentTool = registerFeishuTaskAttachmentTool;
14
+ const typebox_1 = require("@sinclair/typebox");
15
+ const helpers_1 = require("../helpers.js");
16
+ const raw_request_1 = require("../../../core/raw-request.js");
17
+ // ---------------------------------------------------------------------------
18
+ // Schema
19
+ // ---------------------------------------------------------------------------
20
+ const FeishuTaskAttachmentSchema = typebox_1.Type.Union([
21
+ typebox_1.Type.Object({
22
+ action: typebox_1.Type.Literal('upload'),
23
+ resource_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['task', 'task_delivery'], {
24
+ description: '资源类型,可选值:task、task_delivery。默认 task。',
25
+ default: 'task',
26
+ })),
27
+ resource_id: typebox_1.Type.String({
28
+ description: '资源 ID。',
29
+ }),
30
+ file: typebox_1.Type.String({
31
+ description: '文件内容base64编码字符串',
32
+ }),
33
+ name: typebox_1.Type.Optional(typebox_1.Type.String({
34
+ description: '文件名。',
35
+ })),
36
+ }),
37
+ ]);
38
+ ;
39
+ // ---------------------------------------------------------------------------
40
+ // Internal helpers
41
+ // ---------------------------------------------------------------------------
42
+ function resolvePathForAction(action) {
43
+ if (action === 'upload') {
44
+ return { path: '/open-apis/task/v2/attachments/upload', env: [] };
45
+ }
46
+ return { path: '/open-apis/task/v2/attachments/upload', env: [] };
47
+ }
48
+ // ---------------------------------------------------------------------------
49
+ // Registration
50
+ // ---------------------------------------------------------------------------
51
+ function registerFeishuTaskAttachmentTool(api) {
52
+ if (!api.config)
53
+ return;
54
+ const cfg = api.config;
55
+ const { toolClient } = (0, helpers_1.createToolContext)(api, 'feishu_task_attachment');
56
+ (0, helpers_1.registerTool)(api, {
57
+ name: 'feishu_task_attachment',
58
+ label: 'Feishu Task Attachment',
59
+ description: '飞书任务附件工具。当前提供 upload action,用于上传任务附件。',
60
+ parameters: FeishuTaskAttachmentSchema,
61
+ async execute(_toolCallId, params) {
62
+ const p = params;
63
+ try {
64
+ const resolved = resolvePathForAction(p.action);
65
+ const client = toolClient();
66
+ const resourceType = p.resource_type ?? 'task';
67
+ const formData = new FormData();
68
+ formData.append('resource_type', resourceType);
69
+ formData.append('resource_id', p.resource_id);
70
+ // 将 base64 字符串解码为二进制文件
71
+ const fileBuffer = Buffer.from(p.file, 'base64');
72
+ // 创建 File 对象并添加到 FormData
73
+ const file = new File([fileBuffer], p.name ?? 'attachment');
74
+ formData.append('file', file);
75
+ const as = 'tenant';
76
+ const tatRes = await (0, raw_request_1.rawLarkRequest)({
77
+ brand: client.account.brand,
78
+ path: '/open-apis/auth/v3/tenant_access_token/internal/',
79
+ method: 'POST',
80
+ body: {
81
+ app_id: client.account.appId,
82
+ app_secret: client.account.appSecret,
83
+ },
84
+ });
85
+ const token = tatRes?.tenant_access_token;
86
+ if (!token) {
87
+ return (0, helpers_1.json)({
88
+ error: 'Failed to get tenant_access_token.',
89
+ response: tatRes,
90
+ });
91
+ }
92
+ const res = await client.invokeByPath('feishu_task_attachment.upload', resolved.path, {
93
+ method: 'POST',
94
+ as,
95
+ body: formData,
96
+ headers: {
97
+ 'Authorization': `Bearer ${token}`,
98
+ },
99
+ });
100
+ return (0, helpers_1.json)(res);
101
+ }
102
+ catch (err) {
103
+ return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
104
+ }
105
+ },
106
+ }, { name: 'feishu_task_attachment' });
107
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * feishu_task_comment tool -- Manage Feishu task comments.
6
+ *
7
+ * P1 Actions: create, list, get 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
8
+ *
9
+ * Uses the Feishu Task v2 API:
10
+ * - create: POST /open-apis/task/v2/tasks/:task_guid/comments
11
+ * - list: GET /open-apis/task/v2/tasks/:task_guid/comments
12
+ * - get: GET /open-apis/task/v2/comments/:comment_id
13
+ */
14
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
15
+ export declare function registerFeishuTaskCommentTool(api: OpenClawPluginApi): void;
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * feishu_task_comment tool -- Manage Feishu task comments.
7
+ *
8
+ * P1 Actions: create, list, get 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
9
+ *
10
+ * Uses the Feishu Task v2 API:
11
+ * - create: POST /open-apis/task/v2/tasks/:task_guid/comments
12
+ * - list: GET /open-apis/task/v2/tasks/:task_guid/comments
13
+ * - get: GET /open-apis/task/v2/comments/:comment_id
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.registerFeishuTaskCommentTool = registerFeishuTaskCommentTool;
17
+ const typebox_1 = require("@sinclair/typebox");
18
+ const helpers_1 = require("../helpers.js");
19
+ // ---------------------------------------------------------------------------
20
+ // Schema
21
+ // ---------------------------------------------------------------------------
22
+ const FeishuTaskCommentAuthType = typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
23
+ description: '调用 API 时使用的 Token 类型。可选值:"tenant"(应用身份) 或 "user"(用户身份)。默认使用 "user"。',
24
+ }));
25
+ const FeishuTaskCommentSchema = typebox_1.Type.Union([
26
+ // CREATE (P1)
27
+ typebox_1.Type.Object({
28
+ action: typebox_1.Type.Literal('create'),
29
+ auth_type: FeishuTaskCommentAuthType,
30
+ task_guid: typebox_1.Type.String({ description: '任务 GUID' }),
31
+ content: typebox_1.Type.String({ description: '评论内容(纯文本,最长 3000 字符)' }),
32
+ reply_to_comment_id: typebox_1.Type.Optional(typebox_1.Type.String({ description: '要回复的评论 ID(用于回复评论)' })),
33
+ }),
34
+ // LIST (P1)
35
+ typebox_1.Type.Object({
36
+ action: typebox_1.Type.Literal('list'),
37
+ auth_type: FeishuTaskCommentAuthType,
38
+ resource_id: typebox_1.Type.String({ description: '要获取评论的资源 ID(任务 GUID)' }),
39
+ direction: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['asc', 'desc'], {
40
+ description: '排序方式(asc=从旧到新,desc=从新到旧,默认 asc)',
41
+ })),
42
+ page_size: typebox_1.Type.Optional(typebox_1.Type.Number({ description: '每页数量,默认 50,最大 100' })),
43
+ page_token: typebox_1.Type.Optional(typebox_1.Type.String({ description: '分页标记' })),
44
+ }),
45
+ // GET (P1)
46
+ typebox_1.Type.Object({
47
+ action: typebox_1.Type.Literal('get'),
48
+ auth_type: FeishuTaskCommentAuthType,
49
+ comment_id: typebox_1.Type.String({ description: '评论 ID' }),
50
+ }),
51
+ ]);
52
+ // ---------------------------------------------------------------------------
53
+ // Registration
54
+ // ---------------------------------------------------------------------------
55
+ function registerFeishuTaskCommentTool(api) {
56
+ if (!api.config)
57
+ return;
58
+ const cfg = api.config;
59
+ const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_task_comment');
60
+ (0, helpers_1.registerTool)(api, {
61
+ name: 'feishu_task_comment',
62
+ label: 'Feishu Task Comments',
63
+ description: '【以用户或应用身份】飞书任务评论管理工具。当用户要求添加/查询任务评论、回复评论时使用。Actions: create(添加评论), list(列出任务的所有评论), get(获取单个评论详情)。',
64
+ parameters: FeishuTaskCommentSchema,
65
+ async execute(_toolCallId, params) {
66
+ const p = params;
67
+ try {
68
+ const client = toolClient();
69
+ switch (p.action) {
70
+ // -----------------------------------------------------------------
71
+ // CREATE
72
+ // -----------------------------------------------------------------
73
+ case 'create': {
74
+ log.info(`create: task_guid=${p.task_guid}, reply_to=${p.reply_to_comment_id ?? 'none'}`);
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ const data = {
77
+ content: p.content,
78
+ resource_type: 'task',
79
+ resource_id: p.task_guid,
80
+ };
81
+ if (p.reply_to_comment_id) {
82
+ data.reply_to_comment_id = p.reply_to_comment_id;
83
+ }
84
+ const res = await client.invoke('feishu_task_comment.create', (sdk, opts) => sdk.task.v2.comment.create({
85
+ params: {
86
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
87
+ user_id_type: 'open_id',
88
+ },
89
+ data,
90
+ }, opts), { as: p.auth_type || 'user' });
91
+ (0, helpers_1.assertLarkOk)(res);
92
+ log.info(`create: created comment ${res.data?.comment?.id}`);
93
+ return (0, helpers_1.json)({
94
+ comment: res.data?.comment,
95
+ });
96
+ }
97
+ // -----------------------------------------------------------------
98
+ // LIST
99
+ // -----------------------------------------------------------------
100
+ case 'list': {
101
+ log.info(`list: resource_id=${p.resource_id}, direction=${p.direction ?? 'asc'}, page_size=${p.page_size ?? 50}`);
102
+ const res = await client.invoke('feishu_task_comment.list', (sdk, opts) => sdk.task.v2.comment.list({
103
+ params: {
104
+ resource_type: 'task',
105
+ resource_id: p.resource_id,
106
+ direction: p.direction,
107
+ page_size: p.page_size,
108
+ page_token: p.page_token,
109
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
+ user_id_type: 'open_id',
111
+ },
112
+ }, opts), { as: p.auth_type || 'user' });
113
+ (0, helpers_1.assertLarkOk)(res);
114
+ const data = res.data;
115
+ log.info(`list: returned ${data?.items?.length ?? 0} comments`);
116
+ return (0, helpers_1.json)({
117
+ comments: data?.items,
118
+ has_more: data?.has_more ?? false,
119
+ page_token: data?.page_token,
120
+ });
121
+ }
122
+ // -----------------------------------------------------------------
123
+ // GET
124
+ // -----------------------------------------------------------------
125
+ case 'get': {
126
+ log.info(`get: comment_id=${p.comment_id}`);
127
+ const res = await client.invoke('feishu_task_comment.get', (sdk, opts) => sdk.task.v2.comment.get({
128
+ path: {
129
+ comment_id: p.comment_id,
130
+ },
131
+ params: {
132
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
133
+ user_id_type: 'open_id',
134
+ },
135
+ }, opts), { as: p.auth_type || 'user' });
136
+ (0, helpers_1.assertLarkOk)(res);
137
+ log.info(`get: returned comment ${p.comment_id}`);
138
+ return (0, helpers_1.json)({
139
+ comment: res.data?.comment,
140
+ });
141
+ }
142
+ }
143
+ }
144
+ catch (err) {
145
+ return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
146
+ }
147
+ },
148
+ }, { name: 'feishu_task_comment' });
149
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+ export { registerFeishuTaskTaskTool } from './task';
6
+ export { registerFeishuTaskTasklistTool } from './tasklist';
7
+ export { registerFeishuTaskAttachmentTool } from './attachment';
8
+ export { registerFeishuTaskCommentTool } from './comment';
9
+ export { registerFeishuTaskSubtaskTool } from './subtask';
10
+ export { registerFeishuTaskSectionTool } from './section';
11
+ export { registerFeishuTaskAgentTool } from './task_agent';
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.registerFeishuTaskAgentTool = exports.registerFeishuTaskSectionTool = exports.registerFeishuTaskSubtaskTool = exports.registerFeishuTaskCommentTool = exports.registerFeishuTaskAttachmentTool = exports.registerFeishuTaskTasklistTool = exports.registerFeishuTaskTaskTool = void 0;
8
+ var task_1 = require("./task.js");
9
+ Object.defineProperty(exports, "registerFeishuTaskTaskTool", { enumerable: true, get: function () { return task_1.registerFeishuTaskTaskTool; } });
10
+ var tasklist_1 = require("./tasklist.js");
11
+ Object.defineProperty(exports, "registerFeishuTaskTasklistTool", { enumerable: true, get: function () { return tasklist_1.registerFeishuTaskTasklistTool; } });
12
+ var attachment_1 = require("./attachment.js");
13
+ Object.defineProperty(exports, "registerFeishuTaskAttachmentTool", { enumerable: true, get: function () { return attachment_1.registerFeishuTaskAttachmentTool; } });
14
+ var comment_1 = require("./comment.js");
15
+ Object.defineProperty(exports, "registerFeishuTaskCommentTool", { enumerable: true, get: function () { return comment_1.registerFeishuTaskCommentTool; } });
16
+ var subtask_1 = require("./subtask.js");
17
+ Object.defineProperty(exports, "registerFeishuTaskSubtaskTool", { enumerable: true, get: function () { return subtask_1.registerFeishuTaskSubtaskTool; } });
18
+ var section_1 = require("./section.js");
19
+ Object.defineProperty(exports, "registerFeishuTaskSectionTool", { enumerable: true, get: function () { return section_1.registerFeishuTaskSectionTool; } });
20
+ var task_agent_1 = require("./task_agent.js");
21
+ Object.defineProperty(exports, "registerFeishuTaskAgentTool", { enumerable: true, get: function () { return task_agent_1.registerFeishuTaskAgentTool; } });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * feishu_task_section tool -- Manage Feishu task sections.
6
+ *
7
+ * P0 Actions: create, get, list, patch, tasks 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
8
+ *
9
+ * Uses the Feishu Task v2 API:
10
+ * - create: POST /open-apis/task/v2/sections
11
+ * - get: GET /open-apis/task/v2/sections/:section_guid
12
+ * - patch: PATCH /open-apis/task/v2/sections/:section_guid
13
+ * - list: GET /open-apis/task/v2/sections
14
+ * - tasks: GET /open-apis/task/v2/sections/:section_guid/tasks
15
+ */
16
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
17
+ export declare function registerFeishuTaskSectionTool(api: OpenClawPluginApi): void;
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * feishu_task_section tool -- Manage Feishu task sections.
7
+ *
8
+ * P0 Actions: create, get, list, patch, tasks 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
9
+ *
10
+ * Uses the Feishu Task v2 API:
11
+ * - create: POST /open-apis/task/v2/sections
12
+ * - get: GET /open-apis/task/v2/sections/:section_guid
13
+ * - patch: PATCH /open-apis/task/v2/sections/:section_guid
14
+ * - list: GET /open-apis/task/v2/sections
15
+ * - tasks: GET /open-apis/task/v2/sections/:section_guid/tasks
16
+ */
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.registerFeishuTaskSectionTool = registerFeishuTaskSectionTool;
20
+ const typebox_1 = require("@sinclair/typebox");
21
+ const helpers_1 = require("../helpers.js");
22
+ // ---------------------------------------------------------------------------
23
+ // Schema
24
+ // ---------------------------------------------------------------------------
25
+ const FeishuTaskSectionAuthType = typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
26
+ description: '调用 API 时使用的 Token 类型。可选值:"tenant"(应用身份) 或 "user"(用户身份)。默认使用 "user"。',
27
+ }));
28
+ const FeishuTaskSectionSchema = typebox_1.Type.Union([
29
+ // CREATE
30
+ typebox_1.Type.Object({
31
+ action: typebox_1.Type.Literal('create'),
32
+ auth_type: FeishuTaskSectionAuthType,
33
+ name: typebox_1.Type.String({
34
+ description: '自定义分组名。不允许为空,最大100个utf8字符。',
35
+ }),
36
+ resource_type: (0, helpers_1.StringEnum)(['tasklist', 'my_tasks']),
37
+ resource_id: typebox_1.Type.Optional(typebox_1.Type.String({
38
+ description: '自定义分组要归属的资源id。当resource_type为"tasklist"时这里需要填写清单的GUID;当resource_type为"my_tasks"时,无需填写。',
39
+ })),
40
+ insert_before: typebox_1.Type.Optional(typebox_1.Type.String({
41
+ description: '要将新分组插入到自定义分分组的前面的目标分组的guid。',
42
+ })),
43
+ insert_after: typebox_1.Type.Optional(typebox_1.Type.String({
44
+ description: '要将新分组插入到自定义分分组的后面的目标分组的guid。',
45
+ })),
46
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
47
+ }),
48
+ // GET
49
+ typebox_1.Type.Object({
50
+ action: typebox_1.Type.Literal('get'),
51
+ auth_type: FeishuTaskSectionAuthType,
52
+ section_guid: typebox_1.Type.String({
53
+ description: '要获取的自定义分组GUID',
54
+ }),
55
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
56
+ }),
57
+ // PATCH
58
+ typebox_1.Type.Object({
59
+ action: typebox_1.Type.Literal('patch'),
60
+ auth_type: FeishuTaskSectionAuthType,
61
+ section_guid: typebox_1.Type.String({
62
+ description: '要更新的自定义分组GUID',
63
+ }),
64
+ name: typebox_1.Type.Optional(typebox_1.Type.String({
65
+ description: '自定义字段名字',
66
+ })),
67
+ insert_before: typebox_1.Type.Optional(typebox_1.Type.String({
68
+ description: '要让当前自定义分组放到某个自定义分组前面的secion_guid,用于改变当前自定义分组的位置。',
69
+ })),
70
+ insert_after: typebox_1.Type.Optional(typebox_1.Type.String({
71
+ description: '要让当前自定义分组放到某个自定义分组后面的secion_guid,用于改变当前自定义分组的位置。',
72
+ })),
73
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
74
+ }),
75
+ // LIST
76
+ typebox_1.Type.Object({
77
+ action: typebox_1.Type.Literal('list'),
78
+ auth_type: FeishuTaskSectionAuthType,
79
+ resource_type: (0, helpers_1.StringEnum)(['tasklist', 'my_tasks']),
80
+ resource_id: typebox_1.Type.Optional(typebox_1.Type.String({
81
+ description: '如resource_type为"tasklist",这里需要填写要列取自定义分组的清单的GUID。',
82
+ })),
83
+ page_size: typebox_1.Type.Optional(typebox_1.Type.Number({
84
+ description: '分页大小',
85
+ })),
86
+ page_token: typebox_1.Type.Optional(typebox_1.Type.String({
87
+ description: '分页标记',
88
+ })),
89
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
90
+ }),
91
+ // TASKS
92
+ typebox_1.Type.Object({
93
+ action: typebox_1.Type.Literal('tasks'),
94
+ auth_type: FeishuTaskSectionAuthType,
95
+ section_guid: typebox_1.Type.String({
96
+ description: '要获取任务的自定义分组全局唯一ID',
97
+ }),
98
+ page_size: typebox_1.Type.Optional(typebox_1.Type.Number({
99
+ description: '分页大小',
100
+ })),
101
+ page_token: typebox_1.Type.Optional(typebox_1.Type.String({
102
+ description: '分页标记',
103
+ })),
104
+ completed: typebox_1.Type.Optional(typebox_1.Type.Boolean({
105
+ description: '按照任务状态过滤,如果不填写则表示不按完成状态过滤',
106
+ })),
107
+ created_from: typebox_1.Type.Optional(typebox_1.Type.String({
108
+ description: '按照创建时间筛选的起始时间(支持 ISO 8601 或毫秒时间戳)',
109
+ })),
110
+ created_to: typebox_1.Type.Optional(typebox_1.Type.String({
111
+ description: '按照创建时间筛选的结束时间(支持 ISO 8601 或毫秒时间戳)',
112
+ })),
113
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
114
+ }),
115
+ ]);
116
+ // ---------------------------------------------------------------------------
117
+ // Registration
118
+ // ---------------------------------------------------------------------------
119
+ function registerFeishuTaskSectionTool(api) {
120
+ if (!api.config)
121
+ return;
122
+ const cfg = api.config;
123
+ const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_task_section');
124
+ (0, helpers_1.registerTool)(api, {
125
+ name: 'feishu_task_section',
126
+ label: 'Feishu Task Section Management',
127
+ description: '【以用户或应用身份】飞书任务自定义分组管理工具。用于创建、查询、更新自定义分组,以及列出分组内的任务。Actions: create(创建分组), get(获取分组详情), patch(更新分组), list(获取分组列表), tasks(获取分组任务列表)。',
128
+ parameters: FeishuTaskSectionSchema,
129
+ async execute(_toolCallId, params) {
130
+ const p = params;
131
+ try {
132
+ const client = toolClient();
133
+ switch (p.action) {
134
+ // -----------------------------------------------------------------
135
+ // CREATE SECTION
136
+ // -----------------------------------------------------------------
137
+ case 'create': {
138
+ log.info(`create: name=${p.name}, resource_type=${p.resource_type}`);
139
+ const data = {
140
+ name: p.name,
141
+ resource_type: p.resource_type,
142
+ };
143
+ if (p.resource_id)
144
+ data.resource_id = p.resource_id;
145
+ if (p.insert_before)
146
+ data.insert_before = p.insert_before;
147
+ if (p.insert_after)
148
+ data.insert_after = p.insert_after;
149
+ const res = await client.invoke('feishu_task_section.create', (sdk, opts) => sdk.task.v2.section.create({
150
+ data,
151
+ params: {
152
+ user_id_type: (p.user_id_type || 'open_id'),
153
+ },
154
+ }, opts), { as: p.auth_type || 'user' });
155
+ (0, helpers_1.assertLarkOk)(res);
156
+ log.info(`create: section created: section_guid=${res.data?.section?.guid}`);
157
+ return (0, helpers_1.json)({
158
+ section: res.data?.section,
159
+ });
160
+ }
161
+ // -----------------------------------------------------------------
162
+ // GET SECTION
163
+ // -----------------------------------------------------------------
164
+ case 'get': {
165
+ log.info(`get: section_guid=${p.section_guid}`);
166
+ const res = await client.invoke('feishu_task_section.get', (sdk, opts) => sdk.task.v2.section.get({
167
+ path: { section_guid: p.section_guid },
168
+ params: {
169
+ user_id_type: (p.user_id_type || 'open_id'),
170
+ },
171
+ }, opts), { as: p.auth_type || 'user' });
172
+ (0, helpers_1.assertLarkOk)(res);
173
+ log.info(`get: retrieved section ${p.section_guid}`);
174
+ return (0, helpers_1.json)({
175
+ section: res.data?.section,
176
+ });
177
+ }
178
+ // -----------------------------------------------------------------
179
+ // PATCH SECTION
180
+ // -----------------------------------------------------------------
181
+ case 'patch': {
182
+ log.info(`patch: section_guid=${p.section_guid}`);
183
+ const sectionData = {};
184
+ const updateFields = [];
185
+ if (p.name !== undefined) {
186
+ sectionData.name = p.name;
187
+ updateFields.push('name');
188
+ }
189
+ if (p.insert_before !== undefined) {
190
+ sectionData.insert_before = p.insert_before;
191
+ updateFields.push('insert_before');
192
+ }
193
+ if (p.insert_after !== undefined) {
194
+ sectionData.insert_after = p.insert_after;
195
+ updateFields.push('insert_after');
196
+ }
197
+ if (updateFields.length === 0) {
198
+ return (0, helpers_1.json)({
199
+ error: 'No fields to update',
200
+ });
201
+ }
202
+ const res = await client.invoke('feishu_task_section.patch', (sdk, opts) => sdk.task.v2.section.patch({
203
+ path: { section_guid: p.section_guid },
204
+ data: {
205
+ section: sectionData,
206
+ update_fields: updateFields,
207
+ },
208
+ params: {
209
+ user_id_type: (p.user_id_type || 'open_id'),
210
+ },
211
+ }, opts), { as: p.auth_type || 'user' });
212
+ (0, helpers_1.assertLarkOk)(res);
213
+ log.info(`patch: section ${p.section_guid} updated`);
214
+ return (0, helpers_1.json)({
215
+ section: res.data?.section,
216
+ });
217
+ }
218
+ // -----------------------------------------------------------------
219
+ // LIST SECTIONS
220
+ // -----------------------------------------------------------------
221
+ case 'list': {
222
+ log.info(`list: resource_type=${p.resource_type}, page_size=${p.page_size ?? 50}`);
223
+ const paramsData = {
224
+ resource_type: p.resource_type,
225
+ user_id_type: (p.user_id_type || 'open_id'),
226
+ };
227
+ if (p.resource_id)
228
+ paramsData.resource_id = p.resource_id;
229
+ if (p.page_size !== undefined)
230
+ paramsData.page_size = p.page_size;
231
+ if (p.page_token !== undefined)
232
+ paramsData.page_token = p.page_token;
233
+ const res = await client.invoke('feishu_task_section.list', (sdk, opts) => sdk.task.v2.section.list({
234
+ params: paramsData,
235
+ }, opts), { as: p.auth_type || 'user' });
236
+ (0, helpers_1.assertLarkOk)(res);
237
+ const data = res.data;
238
+ log.info(`list: returned ${data?.items?.length ?? 0} sections`);
239
+ return (0, helpers_1.json)({
240
+ sections: data?.items,
241
+ has_more: data?.has_more ?? false,
242
+ page_token: data?.page_token,
243
+ });
244
+ }
245
+ // -----------------------------------------------------------------
246
+ // TASKS IN SECTION
247
+ // -----------------------------------------------------------------
248
+ case 'tasks': {
249
+ log.info(`tasks: section_guid=${p.section_guid}`);
250
+ const paramsData = {
251
+ user_id_type: (p.user_id_type || 'open_id'),
252
+ };
253
+ if (p.page_size !== undefined)
254
+ paramsData.page_size = p.page_size;
255
+ if (p.page_token !== undefined)
256
+ paramsData.page_token = p.page_token;
257
+ if (p.completed !== undefined)
258
+ paramsData.completed = p.completed;
259
+ if (p.created_from) {
260
+ const ts = (0, helpers_1.parseTimeToTimestampMs)(p.created_from);
261
+ if (ts)
262
+ paramsData.created_from = ts;
263
+ else
264
+ paramsData.created_from = p.created_from;
265
+ }
266
+ if (p.created_to) {
267
+ const ts = (0, helpers_1.parseTimeToTimestampMs)(p.created_to);
268
+ if (ts)
269
+ paramsData.created_to = ts;
270
+ else
271
+ paramsData.created_to = p.created_to;
272
+ }
273
+ const res = await client.invoke('feishu_task_section.tasks', (sdk, opts) => sdk.task.v2.section.tasks({
274
+ path: { section_guid: p.section_guid },
275
+ params: paramsData,
276
+ }, opts), { as: p.auth_type || 'user' });
277
+ (0, helpers_1.assertLarkOk)(res);
278
+ const data = res.data;
279
+ log.info(`tasks: returned ${data?.items?.length ?? 0} tasks`);
280
+ return (0, helpers_1.json)({
281
+ tasks: data?.items,
282
+ has_more: data?.has_more ?? false,
283
+ page_token: data?.page_token,
284
+ });
285
+ }
286
+ }
287
+ }
288
+ catch (err) {
289
+ return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
290
+ }
291
+ },
292
+ }, { name: 'feishu_task_section' });
293
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * feishu_task_subtask tool -- Manage Feishu task subtasks.
6
+ *
7
+ * P1 Actions: create, list 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
8
+ *
9
+ * Uses the Feishu Task v2 API:
10
+ * - create: POST /open-apis/task/v2/tasks/:task_guid/subtasks
11
+ * - list: GET /open-apis/task/v2/tasks/:task_guid/subtasks
12
+ */
13
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
14
+ export declare function registerFeishuTaskSubtaskTool(api: OpenClawPluginApi): void;