@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,276 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * feishu_task_tasklist tool -- Manage Feishu task lists.
7
+ *
8
+ * P0 Actions: create, get, list, tasks 支持通过 auth_type 参数切换用户(user)或应用(tenant)身份。
9
+ * P1 Actions: patch, add_members
10
+ *
11
+ * Uses the Feishu Task v2 API:
12
+ * - create: POST /open-apis/task/v2/tasklists
13
+ * - get: GET /open-apis/task/v2/tasklists/:tasklist_guid
14
+ * - list: GET /open-apis/task/v2/tasklists
15
+ * - tasks: GET /open-apis/task/v2/tasklists/:tasklist_guid/tasks
16
+ * - patch: PATCH /open-apis/task/v2/tasklists/:tasklist_guid
17
+ * - add_members: POST /open-apis/task/v2/tasklists/:tasklist_guid/add_members
18
+ */
19
+ /* eslint-disable @typescript-eslint/no-explicit-any */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.registerFeishuTaskTasklistTool = registerFeishuTaskTasklistTool;
22
+ const typebox_1 = require("@sinclair/typebox");
23
+ const helpers_1 = require("../helpers.js");
24
+ // ---------------------------------------------------------------------------
25
+ // Schema
26
+ // ---------------------------------------------------------------------------
27
+ const FeishuTaskTasklistAuthType = typebox_1.Type.Optional((0, helpers_1.StringEnum)(['tenant', 'user'], {
28
+ description: '调用 API 时使用的 Token 类型。可选值:"tenant"(应用身份) 或 "user"(用户身份)。默认使用 "user"。',
29
+ }));
30
+ const FeishuTaskTasklistSchema = typebox_1.Type.Union([
31
+ // CREATE (P0)
32
+ typebox_1.Type.Object({
33
+ action: typebox_1.Type.Literal('create'),
34
+ auth_type: FeishuTaskTasklistAuthType,
35
+ name: typebox_1.Type.String({
36
+ description: '清单名称',
37
+ }),
38
+ members: typebox_1.Type.Optional(typebox_1.Type.Array(typebox_1.Type.Object({
39
+ id: typebox_1.Type.String({ description: '成员 ID(通常为 open_id)' }),
40
+ type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['user', 'app'])),
41
+ role: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['editor', 'viewer'])),
42
+ }), {
43
+ description: '清单成员列表(editor=可编辑,viewer=可查看)。注意:创建人自动成为 owner,如在 members 中也指定创建人,该用户最终成为 owner 并从 members 中移除(同一用户只能有一个角色)。成员类型支持 user 和 app,默认为 user。',
44
+ })),
45
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
46
+ }),
47
+ // GET (P0)
48
+ typebox_1.Type.Object({
49
+ action: typebox_1.Type.Literal('get'),
50
+ auth_type: FeishuTaskTasklistAuthType,
51
+ tasklist_guid: typebox_1.Type.String({ description: '清单 GUID' }),
52
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
53
+ }),
54
+ // LIST (P0)
55
+ typebox_1.Type.Object({
56
+ action: typebox_1.Type.Literal('list'),
57
+ auth_type: FeishuTaskTasklistAuthType,
58
+ page_size: typebox_1.Type.Optional(typebox_1.Type.Number({ description: '每页数量,默认 50,最大 100' })),
59
+ page_token: typebox_1.Type.Optional(typebox_1.Type.String({ description: '分页标记' })),
60
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
61
+ }),
62
+ // TASKS (P0) - 列出清单内的任务
63
+ typebox_1.Type.Object({
64
+ action: typebox_1.Type.Literal('tasks'),
65
+ auth_type: FeishuTaskTasklistAuthType,
66
+ tasklist_guid: typebox_1.Type.String({ description: '清单 GUID' }),
67
+ page_size: typebox_1.Type.Optional(typebox_1.Type.Number({ description: '每页数量,默认 50,最大 100' })),
68
+ page_token: typebox_1.Type.Optional(typebox_1.Type.String({ description: '分页标记' })),
69
+ completed: typebox_1.Type.Optional(typebox_1.Type.Boolean({ description: '是否只返回已完成的任务(默认返回所有)' })),
70
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
71
+ }),
72
+ // PATCH (P1)
73
+ typebox_1.Type.Object({
74
+ action: typebox_1.Type.Literal('patch'),
75
+ auth_type: FeishuTaskTasklistAuthType,
76
+ tasklist_guid: typebox_1.Type.String({ description: '清单 GUID' }),
77
+ name: typebox_1.Type.Optional(typebox_1.Type.String({ description: '新的清单名称' })),
78
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
79
+ }),
80
+ // ADD_MEMBERS (P1)
81
+ typebox_1.Type.Object({
82
+ action: typebox_1.Type.Literal('add_members'),
83
+ auth_type: FeishuTaskTasklistAuthType,
84
+ tasklist_guid: typebox_1.Type.String({ description: '清单 GUID' }),
85
+ members: typebox_1.Type.Array(typebox_1.Type.Object({
86
+ id: typebox_1.Type.String({ description: '成员 ID(通常为 open_id)' }),
87
+ type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['user', 'app'])),
88
+ role: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['editor', 'viewer'])),
89
+ }), { description: '要添加的成员列表' }),
90
+ user_id_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['open_id', 'union_id', 'user_id'])),
91
+ }),
92
+ ]);
93
+ // ---------------------------------------------------------------------------
94
+ // Registration
95
+ // ---------------------------------------------------------------------------
96
+ function registerFeishuTaskTasklistTool(api) {
97
+ if (!api.config)
98
+ return;
99
+ const cfg = api.config;
100
+ const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_task_tasklist');
101
+ (0, helpers_1.registerTool)(api, {
102
+ name: 'feishu_task_tasklist',
103
+ label: 'Feishu Task Lists',
104
+ description: '【以用户或应用身份】飞书任务清单管理工具。当用户要求创建/查询/管理清单、查看清单内的任务时使用。Actions: create(创建清单), get(获取清单详情), list(列出所有可读取的清单,包括我创建的和他人共享给我的), tasks(列出清单内的任务), patch(更新清单), add_members(添加成员)。',
105
+ parameters: FeishuTaskTasklistSchema,
106
+ async execute(_toolCallId, params) {
107
+ const p = params;
108
+ try {
109
+ const client = toolClient();
110
+ switch (p.action) {
111
+ // -----------------------------------------------------------------
112
+ // CREATE
113
+ // -----------------------------------------------------------------
114
+ case 'create': {
115
+ log.info(`create: name=${p.name}, members_count=${p.members?.length ?? 0}`);
116
+ const data = { name: p.name };
117
+ // 转换成员格式
118
+ if (p.members && p.members.length > 0) {
119
+ data.members = p.members.map((m) => ({
120
+ id: m.id,
121
+ type: m.type || 'user',
122
+ role: m.role || 'editor',
123
+ }));
124
+ }
125
+ const res = await client.invoke('feishu_task_tasklist.create', (sdk, opts) => sdk.task.v2.tasklist.create({
126
+ params: {
127
+ user_id_type: 'open_id',
128
+ },
129
+ data,
130
+ }, opts), { as: p.auth_type || 'user' });
131
+ (0, helpers_1.assertLarkOk)(res);
132
+ log.info(`create: created tasklist ${res.data?.tasklist?.guid}`);
133
+ return (0, helpers_1.json)({
134
+ tasklist: res.data?.tasklist,
135
+ });
136
+ }
137
+ // -----------------------------------------------------------------
138
+ // GET
139
+ // -----------------------------------------------------------------
140
+ case 'get': {
141
+ log.info(`get: tasklist_guid=${p.tasklist_guid}`);
142
+ const res = await client.invoke('feishu_task_tasklist.get', (sdk, opts) => sdk.task.v2.tasklist.get({
143
+ path: {
144
+ tasklist_guid: p.tasklist_guid,
145
+ },
146
+ params: {
147
+ user_id_type: 'open_id',
148
+ },
149
+ }, opts), { as: p.auth_type || 'user' });
150
+ (0, helpers_1.assertLarkOk)(res);
151
+ log.info(`get: returned tasklist ${p.tasklist_guid}`);
152
+ return (0, helpers_1.json)({
153
+ tasklist: res.data?.tasklist,
154
+ });
155
+ }
156
+ // -----------------------------------------------------------------
157
+ // LIST
158
+ // -----------------------------------------------------------------
159
+ case 'list': {
160
+ log.info(`list: page_size=${p.page_size ?? 50}`);
161
+ const res = await client.invoke('feishu_task_tasklist.list', (sdk, opts) => sdk.task.v2.tasklist.list({
162
+ params: {
163
+ page_size: p.page_size,
164
+ page_token: p.page_token,
165
+ user_id_type: 'open_id',
166
+ },
167
+ }, opts), { as: p.auth_type || 'user' });
168
+ (0, helpers_1.assertLarkOk)(res);
169
+ const data = res.data;
170
+ log.info(`list: returned ${data?.items?.length ?? 0} tasklists`);
171
+ return (0, helpers_1.json)({
172
+ tasklists: data?.items,
173
+ has_more: data?.has_more ?? false,
174
+ page_token: data?.page_token,
175
+ });
176
+ }
177
+ // -----------------------------------------------------------------
178
+ // TASKS - 列出清单内的任务
179
+ // -----------------------------------------------------------------
180
+ case 'tasks': {
181
+ log.info(`tasks: tasklist_guid=${p.tasklist_guid}, completed=${p.completed ?? 'all'}`);
182
+ const res = await client.invoke('feishu_task_tasklist.tasks', (sdk, opts) => sdk.task.v2.tasklist.tasks({
183
+ path: {
184
+ tasklist_guid: p.tasklist_guid,
185
+ },
186
+ params: {
187
+ page_size: p.page_size,
188
+ page_token: p.page_token,
189
+ completed: p.completed,
190
+ user_id_type: 'open_id',
191
+ },
192
+ }, opts), { as: p.auth_type || 'user' });
193
+ (0, helpers_1.assertLarkOk)(res);
194
+ const data = res.data;
195
+ log.info(`tasks: returned ${data?.items?.length ?? 0} tasks`);
196
+ return (0, helpers_1.json)({
197
+ tasks: data?.items,
198
+ has_more: data?.has_more ?? false,
199
+ page_token: data?.page_token,
200
+ });
201
+ }
202
+ // -----------------------------------------------------------------
203
+ // PATCH
204
+ // -----------------------------------------------------------------
205
+ case 'patch': {
206
+ log.info(`patch: tasklist_guid=${p.tasklist_guid}, name=${p.name}`);
207
+ // 飞书 Task API 要求特殊的更新格式
208
+ const tasklistData = {};
209
+ const updateFields = [];
210
+ if (p.name !== undefined) {
211
+ tasklistData.name = p.name;
212
+ updateFields.push('name');
213
+ }
214
+ if (updateFields.length === 0) {
215
+ return (0, helpers_1.json)({
216
+ error: 'No fields to update',
217
+ });
218
+ }
219
+ const res = await client.invoke('feishu_task_tasklist.patch', (sdk, opts) => sdk.task.v2.tasklist.patch({
220
+ path: {
221
+ tasklist_guid: p.tasklist_guid,
222
+ },
223
+ params: {
224
+ user_id_type: 'open_id',
225
+ },
226
+ data: {
227
+ tasklist: tasklistData,
228
+ update_fields: updateFields,
229
+ },
230
+ }, opts), { as: p.auth_type || 'user' });
231
+ (0, helpers_1.assertLarkOk)(res);
232
+ log.info(`patch: updated tasklist ${p.tasklist_guid}`);
233
+ return (0, helpers_1.json)({
234
+ tasklist: res.data?.tasklist,
235
+ });
236
+ }
237
+ // -----------------------------------------------------------------
238
+ // ADD_MEMBERS
239
+ // -----------------------------------------------------------------
240
+ case 'add_members': {
241
+ if (!p.members || p.members.length === 0) {
242
+ return (0, helpers_1.json)({
243
+ error: 'members is required and cannot be empty',
244
+ });
245
+ }
246
+ log.info(`add_members: tasklist_guid=${p.tasklist_guid}, members_count=${p.members.length}`);
247
+ const memberData = p.members.map((m) => ({
248
+ id: m.id,
249
+ type: m.type || 'user',
250
+ role: m.role || 'editor',
251
+ }));
252
+ const res = await client.invoke('feishu_task_tasklist.add_members', (sdk, opts) => sdk.task.v2.tasklist.addMembers({
253
+ path: {
254
+ tasklist_guid: p.tasklist_guid,
255
+ },
256
+ params: {
257
+ user_id_type: 'open_id',
258
+ },
259
+ data: {
260
+ members: memberData,
261
+ },
262
+ }, opts), { as: p.auth_type || 'user' });
263
+ (0, helpers_1.assertLarkOk)(res);
264
+ log.info(`add_members: added ${p.members.length} members to tasklist ${p.tasklist_guid}`);
265
+ return (0, helpers_1.json)({
266
+ tasklist: res.data?.tasklist,
267
+ });
268
+ }
269
+ }
270
+ }
271
+ catch (err) {
272
+ return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
273
+ }
274
+ },
275
+ }, { name: 'feishu_task_tasklist' });
276
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * Wiki 工具集
6
+ * 统一导出所有知识库相关工具的注册函数
7
+ */
8
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
9
+ /**
10
+ * 注册所有 Wiki 工具
11
+ */
12
+ export declare function registerFeishuWikiTools(api: OpenClawPluginApi): void;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * Wiki 工具集
7
+ * 统一导出所有知识库相关工具的注册函数
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.registerFeishuWikiTools = registerFeishuWikiTools;
11
+ const accounts_1 = require("../../../core/accounts.js");
12
+ const tools_config_1 = require("../../../core/tools-config.js");
13
+ const space_1 = require("./space.js");
14
+ const space_node_1 = require("./space-node.js");
15
+ /**
16
+ * 注册所有 Wiki 工具
17
+ */
18
+ function registerFeishuWikiTools(api) {
19
+ if (!api.config) {
20
+ api.logger.debug?.('feishu_wiki: No config available, skipping');
21
+ return;
22
+ }
23
+ const accounts = (0, accounts_1.getEnabledLarkAccounts)(api.config);
24
+ if (accounts.length === 0) {
25
+ api.logger.debug?.('feishu_wiki: No Feishu accounts configured, skipping');
26
+ return;
27
+ }
28
+ const toolsCfg = (0, tools_config_1.resolveAnyEnabledToolsConfig)(accounts);
29
+ if (!toolsCfg.wiki) {
30
+ api.logger.debug?.('feishu_wiki: wiki tool disabled in all accounts');
31
+ return;
32
+ }
33
+ // 注册所有工具
34
+ const registered = [];
35
+ if ((0, space_1.registerFeishuWikiSpaceTool)(api))
36
+ registered.push('feishu_wiki_space');
37
+ if ((0, space_node_1.registerFeishuWikiSpaceNodeTool)(api))
38
+ registered.push('feishu_wiki_space_node');
39
+ if (registered.length > 0) {
40
+ api.logger.debug?.(`feishu_wiki: Registered ${registered.join(', ')}`);
41
+ }
42
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * feishu_wiki_space_node tool -- Manage Feishu Wiki space nodes.
6
+ *
7
+ * Actions: list, get, create, move, copy
8
+ *
9
+ * Uses the Feishu Wiki API:
10
+ * - list: GET /open-apis/wiki/v2/spaces/:space_id/nodes
11
+ * - get: GET /open-apis/wiki/v2/spaces/get_node
12
+ * - create: POST /open-apis/wiki/v2/spaces/:space_id/nodes
13
+ * - move: POST /open-apis/wiki/v2/spaces/:space_id/nodes/:node_token/move
14
+ * - copy: POST /open-apis/wiki/v2/spaces/:space_id/nodes/:node_token/copy
15
+ */
16
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
17
+ export declare function registerFeishuWikiSpaceNodeTool(api: OpenClawPluginApi): boolean;
@@ -0,0 +1,233 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
4
+ * SPDX-License-Identifier: MIT
5
+ *
6
+ * feishu_wiki_space_node tool -- Manage Feishu Wiki space nodes.
7
+ *
8
+ * Actions: list, get, create, move, copy
9
+ *
10
+ * Uses the Feishu Wiki API:
11
+ * - list: GET /open-apis/wiki/v2/spaces/:space_id/nodes
12
+ * - get: GET /open-apis/wiki/v2/spaces/get_node
13
+ * - create: POST /open-apis/wiki/v2/spaces/:space_id/nodes
14
+ * - move: POST /open-apis/wiki/v2/spaces/:space_id/nodes/:node_token/move
15
+ * - copy: POST /open-apis/wiki/v2/spaces/:space_id/nodes/:node_token/copy
16
+ */
17
+ /* eslint-disable @typescript-eslint/no-explicit-any */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.registerFeishuWikiSpaceNodeTool = registerFeishuWikiSpaceNodeTool;
20
+ const typebox_1 = require("@sinclair/typebox");
21
+ const helpers_1 = require("../helpers.js");
22
+ // ---------------------------------------------------------------------------
23
+ // Schema
24
+ // ---------------------------------------------------------------------------
25
+ const FeishuWikiSpaceNodeSchema = typebox_1.Type.Union([
26
+ // LIST NODES
27
+ typebox_1.Type.Object({
28
+ action: typebox_1.Type.Literal('list'),
29
+ space_id: typebox_1.Type.String({
30
+ description: 'space_id',
31
+ }),
32
+ parent_node_token: typebox_1.Type.Optional(typebox_1.Type.String({
33
+ description: 'parent_node_token',
34
+ })),
35
+ page_size: typebox_1.Type.Optional(typebox_1.Type.Integer({
36
+ description: 'page_size',
37
+ minimum: 1,
38
+ })),
39
+ page_token: typebox_1.Type.Optional(typebox_1.Type.String({
40
+ description: 'page_token',
41
+ })),
42
+ }),
43
+ // GET NODE
44
+ typebox_1.Type.Object({
45
+ action: typebox_1.Type.Literal('get'),
46
+ token: typebox_1.Type.String({
47
+ description: 'node token',
48
+ }),
49
+ obj_type: typebox_1.Type.Optional((0, helpers_1.StringEnum)(['doc', 'sheet', 'mindnote', 'bitable', 'file', 'docx', 'slides', 'wiki'], { description: 'obj_type' })),
50
+ }),
51
+ // CREATE NODE
52
+ typebox_1.Type.Object({
53
+ action: typebox_1.Type.Literal('create'),
54
+ space_id: typebox_1.Type.String({
55
+ description: 'space_id',
56
+ }),
57
+ obj_type: (0, helpers_1.StringEnum)(['sheet', 'mindnote', 'bitable', 'file', 'docx', 'slides'], { description: 'obj_type' }),
58
+ parent_node_token: typebox_1.Type.Optional(typebox_1.Type.String({
59
+ description: 'parent_node_token',
60
+ })),
61
+ node_type: (0, helpers_1.StringEnum)(['origin', 'shortcut'], {
62
+ description: 'node_type',
63
+ }),
64
+ origin_node_token: typebox_1.Type.Optional(typebox_1.Type.String({
65
+ description: 'origin_node_token',
66
+ })),
67
+ title: typebox_1.Type.Optional(typebox_1.Type.String({
68
+ description: 'title',
69
+ })),
70
+ }),
71
+ // MOVE NODE
72
+ typebox_1.Type.Object({
73
+ action: typebox_1.Type.Literal('move'),
74
+ space_id: typebox_1.Type.String({
75
+ description: 'space_id',
76
+ }),
77
+ node_token: typebox_1.Type.String({
78
+ description: 'node_token',
79
+ }),
80
+ target_parent_token: typebox_1.Type.Optional(typebox_1.Type.String({
81
+ description: 'target_parent_token',
82
+ })),
83
+ }),
84
+ // COPY NODE
85
+ typebox_1.Type.Object({
86
+ action: typebox_1.Type.Literal('copy'),
87
+ space_id: typebox_1.Type.String({
88
+ description: 'space_id',
89
+ }),
90
+ node_token: typebox_1.Type.String({
91
+ description: 'node_token',
92
+ }),
93
+ target_space_id: typebox_1.Type.Optional(typebox_1.Type.String({
94
+ description: 'target_space_id',
95
+ })),
96
+ target_parent_token: typebox_1.Type.Optional(typebox_1.Type.String({
97
+ description: 'target_parent_token',
98
+ })),
99
+ title: typebox_1.Type.Optional(typebox_1.Type.String({
100
+ description: 'title',
101
+ })),
102
+ }),
103
+ ]);
104
+ // ---------------------------------------------------------------------------
105
+ // Registration
106
+ // ---------------------------------------------------------------------------
107
+ function registerFeishuWikiSpaceNodeTool(api) {
108
+ if (!api.config)
109
+ return false;
110
+ const cfg = api.config;
111
+ const { toolClient, log } = (0, helpers_1.createToolContext)(api, 'feishu_wiki_space_node');
112
+ return (0, helpers_1.registerTool)(api, {
113
+ name: 'feishu_wiki_space_node',
114
+ label: 'Feishu Wiki Space Nodes',
115
+ description: '飞书知识库节点管理工具。操作:list(列表)、get(获取)、create(创建)、move(移动)、copy(复制)。' +
116
+ '节点是知识库中的文档,包括 doc、bitable(多维表表格)、sheet(电子表格) 等类型。' +
117
+ 'node_token 是节点的唯一标识符,obj_token 是实际文档的 token。可通过 get 操作将 wiki 类型的 node_token 转换为实际文档的 obj_token。',
118
+ parameters: FeishuWikiSpaceNodeSchema,
119
+ async execute(_toolCallId, params) {
120
+ const p = params;
121
+ try {
122
+ const client = toolClient();
123
+ switch (p.action) {
124
+ // -----------------------------------------------------------------
125
+ // LIST NODES
126
+ // -----------------------------------------------------------------
127
+ case 'list': {
128
+ log.info(`list: space_id=${p.space_id}, parent=${p.parent_node_token ?? '(root)'}, page_size=${p.page_size ?? 50}`);
129
+ const res = await client.invoke('feishu_wiki_space_node.list', (sdk, opts) => sdk.wiki.spaceNode.list({
130
+ path: { space_id: p.space_id },
131
+ params: {
132
+ page_size: p.page_size,
133
+ page_token: p.page_token,
134
+ parent_node_token: p.parent_node_token,
135
+ },
136
+ }, opts), { as: 'user' });
137
+ (0, helpers_1.assertLarkOk)(res);
138
+ const data = res.data;
139
+ log.info(`list: returned ${data?.items?.length ?? 0} nodes`);
140
+ return (0, helpers_1.json)({
141
+ nodes: data?.items,
142
+ has_more: data?.has_more,
143
+ page_token: data?.page_token,
144
+ });
145
+ }
146
+ // -----------------------------------------------------------------
147
+ // GET NODE
148
+ // -----------------------------------------------------------------
149
+ case 'get': {
150
+ log.info(`get: token=${p.token}, obj_type=${p.obj_type ?? 'wiki'}`);
151
+ const res = await client.invoke('feishu_wiki_space_node.get', (sdk, opts) => sdk.wiki.space.getNode({
152
+ params: {
153
+ token: p.token,
154
+ obj_type: (p.obj_type || 'wiki'),
155
+ },
156
+ }, opts), { as: 'user' });
157
+ (0, helpers_1.assertLarkOk)(res);
158
+ log.info(`get: retrieved node ${p.token}`);
159
+ return (0, helpers_1.json)({
160
+ node: res.data?.node,
161
+ });
162
+ }
163
+ // -----------------------------------------------------------------
164
+ // CREATE NODE
165
+ // -----------------------------------------------------------------
166
+ case 'create': {
167
+ log.info(`create: space_id=${p.space_id}, obj_type=${p.obj_type}, parent=${p.parent_node_token ?? '(root)'}, title=${p.title ?? '(empty)'}, node_type=${p.node_type}, original_node_token=${p.origin_node_token ?? '(empty)'}`);
168
+ const res = await client.invoke('feishu_wiki_space_node.create', (sdk, opts) => sdk.wiki.spaceNode.create({
169
+ path: { space_id: p.space_id },
170
+ data: {
171
+ obj_type: p.obj_type,
172
+ parent_node_token: p.parent_node_token,
173
+ node_type: p.node_type,
174
+ origin_node_token: p.origin_node_token,
175
+ title: p.title,
176
+ },
177
+ }, opts), { as: 'user' });
178
+ (0, helpers_1.assertLarkOk)(res);
179
+ log.info(`create: created node_token=${res.data?.node?.node_token}`);
180
+ return (0, helpers_1.json)({
181
+ node: res.data?.node,
182
+ });
183
+ }
184
+ // -----------------------------------------------------------------
185
+ // MOVE NODE
186
+ // -----------------------------------------------------------------
187
+ case 'move': {
188
+ log.info(`move: space_id=${p.space_id}, node_token=${p.node_token}, target_parent=${p.target_parent_token ?? '(root)'}`);
189
+ const res = await client.invoke('feishu_wiki_space_node.move', (sdk, opts) => sdk.wiki.spaceNode.move({
190
+ path: {
191
+ space_id: p.space_id,
192
+ node_token: p.node_token,
193
+ },
194
+ data: {
195
+ target_parent_token: p.target_parent_token,
196
+ },
197
+ }, opts), { as: 'user' });
198
+ (0, helpers_1.assertLarkOk)(res);
199
+ log.info(`move: moved node ${p.node_token}`);
200
+ return (0, helpers_1.json)({
201
+ node: res.data?.node,
202
+ });
203
+ }
204
+ // -----------------------------------------------------------------
205
+ // COPY NODE
206
+ // -----------------------------------------------------------------
207
+ case 'copy': {
208
+ log.info(`copy: space_id=${p.space_id}, node_token=${p.node_token}, target_space=${p.target_space_id ?? '(same)'}, target_parent=${p.target_parent_token ?? '(root)'}`);
209
+ const res = await client.invoke('feishu_wiki_space_node.copy', (sdk, opts) => sdk.wiki.spaceNode.copy({
210
+ path: {
211
+ space_id: p.space_id,
212
+ node_token: p.node_token,
213
+ },
214
+ data: {
215
+ target_space_id: p.target_space_id,
216
+ target_parent_token: p.target_parent_token,
217
+ title: p.title,
218
+ },
219
+ }, opts), { as: 'user' });
220
+ (0, helpers_1.assertLarkOk)(res);
221
+ log.info(`copy: copied to node_token=${res.data?.node?.node_token}`);
222
+ return (0, helpers_1.json)({
223
+ node: res.data?.node,
224
+ });
225
+ }
226
+ }
227
+ }
228
+ catch (err) {
229
+ return await (0, helpers_1.handleInvokeErrorWithAutoAuth)(err, cfg);
230
+ }
231
+ },
232
+ }, { name: 'feishu_wiki_space_node' });
233
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ *
5
+ * feishu_wiki_space tool -- Manage Feishu Wiki spaces.
6
+ *
7
+ * Actions: list, get, create
8
+ *
9
+ * Uses the Feishu Wiki API:
10
+ * - list: GET /open-apis/wiki/v2/spaces
11
+ * - get: GET /open-apis/wiki/v2/spaces/:space_id
12
+ * - create: POST /open-apis/wiki/v2/spaces
13
+ */
14
+ import type { OpenClawPluginApi } from 'openclaw/plugin-sdk';
15
+ export declare function registerFeishuWikiSpaceTool(api: OpenClawPluginApi): boolean;