@fased/fased 0.1.36 → 0.1.38

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 (240) hide show
  1. package/config/capability-catalog.json +241 -0
  2. package/config/dependency-ownership.json +130 -0
  3. package/config/official-channel-catalog.json +39 -0
  4. package/dist/agents/tools/web-fetch-utils.js +2 -1
  5. package/dist/agents/tools/web-fetch-visibility.js +3 -1
  6. package/dist/brand.js +1 -1
  7. package/dist/browser/pw-session.js +2 -1
  8. package/dist/browser/pw-tools-core.state.js +3 -2
  9. package/dist/browser/runtime-dependency.js +27 -0
  10. package/dist/build-info.json +3 -3
  11. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  12. package/dist/capabilities/catalog.js +228 -0
  13. package/dist/cli/components-cli.js +105 -0
  14. package/dist/cli/hooks-cli.js +1 -1
  15. package/dist/cli/plugins-cli.js +3 -3
  16. package/dist/cli/program/register.subclis.js +9 -0
  17. package/dist/cli/update-cli/update-command.js +1 -1
  18. package/dist/commands/doctor-capabilities.js +26 -0
  19. package/dist/commands/doctor.js +2 -0
  20. package/dist/control-ui/assets/{app-DXYMrRJ9.js → app-JBrTSsNu.js} +1480 -1465
  21. package/dist/control-ui/assets/{index-iGQkJE0l.js → index-H-2DWAnH.js} +3 -3
  22. package/dist/control-ui/index.html +1 -1
  23. package/dist/gateway/method-scopes.js +1 -0
  24. package/dist/gateway/server-methods/plugins-marketplace.js +1 -1
  25. package/dist/gateway/server-methods/services.js +8 -0
  26. package/dist/gateway/server-methods-list.js +1 -0
  27. package/dist/infra/optional-runtime-dependency.js +46 -0
  28. package/dist/media/image-ops.js +6 -1
  29. package/dist/media/input-files.js +11 -2
  30. package/dist/media/mime.js +6 -1
  31. package/dist/memory/sqlite-vec.js +7 -1
  32. package/dist/plugin-sdk/{accounts-VqAX3HJ0.js → accounts-BwkH5bTD.js} +1 -1
  33. package/dist/plugin-sdk/{accounts-Zgt0NP54.js → accounts-RT6y7n3H.js} +1 -1
  34. package/dist/plugin-sdk/{actions-lB3PCwsz.js → actions-BrU_JMqM.js} +2 -2
  35. package/dist/plugin-sdk/{actions-BI5QViLk.js → actions-CUdVHzeJ.js} +2 -2
  36. package/dist/plugin-sdk/{active-listener-DKZiSaRA.js → active-listener-CE8t5g6l.js} +1 -1
  37. package/dist/plugin-sdk/{active-listener-D6_pdTMC.js → active-listener-Dx1SEGDn.js} +1 -1
  38. package/dist/plugin-sdk/{audio-preflight-Dx8J7XhV.js → audio-preflight-BPK8t0tI.js} +22 -22
  39. package/dist/plugin-sdk/{audio-preflight-CeRstduc.js → audio-preflight-kCa_KGRH.js} +22 -22
  40. package/dist/plugin-sdk/{audit-BImNOQvk.js → audit-DxB2Kml5.js} +11 -11
  41. package/dist/plugin-sdk/{audit-CKWkq0Un.js → audit-sSeRDwJb.js} +11 -11
  42. package/dist/plugin-sdk/channel-plugin-common.js +3 -2
  43. package/dist/plugin-sdk/{chunk-skAJZWCT.js → chunk-KCxbJLsV.js} +1 -1
  44. package/dist/plugin-sdk/{chunk-Cjw4712g.js → chunk-M2d7r-Zt.js} +1 -1
  45. package/dist/plugin-sdk/{chunk-items-Df5811D0.js → chunk-items-DGHUeFuI.js} +1 -1
  46. package/dist/plugin-sdk/command-status.js +22 -22
  47. package/dist/plugin-sdk/{commands-registry-5J619bQ2.js → commands-registry-CdT-nl7v.js} +2 -2
  48. package/dist/plugin-sdk/{commands-registry-CoLAT03J.js → commands-registry-DoWdYAJd.js} +2 -2
  49. package/dist/plugin-sdk/{common-CSTxewqY.js → common-Cpw-vuuM.js} +1 -1
  50. package/dist/plugin-sdk/{common-BiF0sTnY.js → common-DJWrErdE.js} +1 -1
  51. package/dist/plugin-sdk/{config-BxVjLTIv.js → config-C0qggNKQ.js} +7 -7
  52. package/dist/plugin-sdk/{config-TFokWwvO.js → config-CgwTaper.js} +45 -2
  53. package/dist/plugin-sdk/{config-DXlISPlx.js → config-DtqAN2L3.js} +45 -2
  54. package/dist/plugin-sdk/discord.js +2 -1
  55. package/dist/plugin-sdk/{fetch-guard-DPMynms8.js → fetch-guard-BLdujDnt.js} +1 -1
  56. package/dist/plugin-sdk/{fetch-guard-COLmW2TM.js → fetch-guard-DTKgMN9f.js} +1 -1
  57. package/dist/plugin-sdk/{handle-action-C-UndB8E.js → handle-action-B61D85yo.js} +12 -12
  58. package/dist/plugin-sdk/{handle-action-hhufKxmU.js → handle-action-CjcxGzQD.js} +12 -12
  59. package/dist/plugin-sdk/index.js +22 -22
  60. package/dist/plugin-sdk/{login-DL1oBBfL.js → login-CB_nCjX3.js} +3 -3
  61. package/dist/plugin-sdk/{login-Dnxas1dI.js → login-CzUuDd1v.js} +3 -3
  62. package/dist/plugin-sdk/{login-qr-CVQsGWKq.js → login-qr-D7MEpFza.js} +3 -3
  63. package/dist/plugin-sdk/{login-qr-B343JNXJ.js → login-qr-DgxfBFVN.js} +3 -3
  64. package/dist/plugin-sdk/{manager-BytwRIfK.js → manager-9see0IX5.js} +8 -3
  65. package/dist/plugin-sdk/{manager-BZjd_PCt.js → manager-D2kZ0Cps.js} +8 -3
  66. package/dist/plugin-sdk/{markdown-tables-krKiU4cT.js → markdown-tables-CCSD52rA.js} +1 -1
  67. package/dist/plugin-sdk/{markdown-tables-9rJDQ1X-.js → markdown-tables-DWUNvLrc.js} +1 -1
  68. package/dist/plugin-sdk/{media-D7ZkWU-A.js → media-C7YT4DeU.js} +13 -4
  69. package/dist/plugin-sdk/{media-C6C2c9a4.js → media-Cxw-xLGU.js} +13 -4
  70. package/dist/plugin-sdk/{monitor-BsLMfn3U.js → monitor-6lkdOqhQ.js} +26 -26
  71. package/dist/plugin-sdk/{monitor-BCxkQBoh.js → monitor-C6Ohw9BA.js} +26 -26
  72. package/dist/plugin-sdk/{monitor-BzDW50H6.js → monitor-o20KTHIi.js} +29 -29
  73. package/dist/plugin-sdk/{monitor-CVQNDfhs.js → monitor-rOs3mUol.js} +27 -27
  74. package/dist/plugin-sdk/{openresponses-http-BB67Z4QM.js → openresponses-http-BJONnUdy.js} +22 -22
  75. package/dist/plugin-sdk/{openresponses-http-NE76GGhj.js → openresponses-http-DkWqYznu.js} +22 -22
  76. package/dist/plugin-sdk/{ssrf-u0Ul7okY.js → optional-runtime-dependency-szS49voX.js} +46 -2
  77. package/dist/plugin-sdk/{outbound-PGNWU6T-.js → outbound-BCxOxdi-.js} +6 -6
  78. package/dist/plugin-sdk/{outbound-BHWJD9q0.js → outbound-JIwQbpRY.js} +6 -6
  79. package/dist/plugin-sdk/{outbound-attachment-BVzfhqnk.js → outbound-attachment-C-jSFaEB.js} +1 -1
  80. package/dist/plugin-sdk/{outbound-attachment-ClMvNW17.js → outbound-attachment-D6tj5Y5H.js} +1 -1
  81. package/dist/plugin-sdk/{pi-embedded-runner-DQ6UPx6-.js → pi-embedded-runner-DqDy0MWN.js} +72 -60
  82. package/dist/plugin-sdk/{pi-model-discovery-D51L5E9I.js → pi-model-discovery-DadlvsZW.js} +1 -1
  83. package/dist/plugin-sdk/{pi-model-discovery-runtime-DxoFm4Vd.js → pi-model-discovery-runtime-C5ssE6EW.js} +1 -1
  84. package/dist/plugin-sdk/{pi-model-discovery-runtime-DRuh4PNV.js → pi-model-discovery-runtime-DAaOPt64.js} +2 -2
  85. package/dist/plugin-sdk/{pi-model-discovery-runtime-BTWgkx4x.js → pi-model-discovery-runtime-gd77b0UF.js} +2 -2
  86. package/dist/plugin-sdk/{pi-model-discovery-CkH5l9X5.js → pi-model-discovery-yifTIDIn.js} +1 -1
  87. package/dist/plugin-sdk/{pw-ai-DZs6uYRd.js → pw-ai-Boor5vYw.js} +6 -5
  88. package/dist/plugin-sdk/{pw-ai-Cn-EUPZK.js → pw-ai-sH1Pi-Fh.js} +6 -5
  89. package/dist/plugin-sdk/{registry-B4HvWzob.js → registry-DNkJsNsz.js} +4 -3
  90. package/dist/plugin-sdk/{replies-jDMUBsNO.js → replies-fvzN5wnU.js} +2 -2
  91. package/dist/plugin-sdk/{replies-B_LW9c9f.js → replies-zebgZCHX.js} +2 -2
  92. package/dist/plugin-sdk/{resolve-route-_YZHbS-z.js → resolve-route-CNhTJG_2.js} +1 -1
  93. package/dist/plugin-sdk/{resolve-route-DlHzggnG.js → resolve-route-DO0WR4nB.js} +1 -1
  94. package/dist/plugin-sdk/{resolve-utils-zBhVX3Vx.js → resolve-utils-bixHYDBj.js} +1 -1
  95. package/dist/plugin-sdk/{retry-policy-DGLs5ebP.js → retry-policy-BLYEgIwP.js} +1 -1
  96. package/dist/plugin-sdk/{retry-policy-DaodShGa.js → retry-policy-sM01QZT2.js} +1 -1
  97. package/dist/plugin-sdk/{runtime-Dd0sswuW.js → runtime-BPyuAmka.js} +4 -3
  98. package/dist/plugin-sdk/{paths-CBCpJ5bu.js → runtime-dependency-Csswyv5r.js} +27 -3
  99. package/dist/plugin-sdk/{paths-DW-U2r7Y.js → runtime-dependency-Deg_sw2k.js} +36 -12
  100. package/dist/plugin-sdk/sat-runtime.js +1 -0
  101. package/dist/plugin-sdk/{send-8remZhsH.js → send-B09HRfHN.js} +6 -6
  102. package/dist/plugin-sdk/{send-DaaAscWj.js → send-BBYcgXA4.js} +5 -5
  103. package/dist/plugin-sdk/{send-DFTB0cnx.js → send-BQXQA81e.js} +6 -6
  104. package/dist/plugin-sdk/{send-CtMVvMJs.js → send-BzFdvD_i.js} +6 -6
  105. package/dist/plugin-sdk/{send-Di9irjS-.js → send-C3u-F_8s.js} +6 -6
  106. package/dist/plugin-sdk/{send-Dl88ZKq2.js → send-D3836_UN.js} +6 -6
  107. package/dist/plugin-sdk/{send-ifgZCHVB.js → send-D7tr-EsH.js} +5 -5
  108. package/dist/plugin-sdk/{send-DvUpYh0d.js → send-DRGzRdI3.js} +6 -6
  109. package/dist/plugin-sdk/{send-D2jlPeKH.js → send-DfkPKz_0.js} +4 -4
  110. package/dist/plugin-sdk/{send-QSt6nbny.js → send-DsxFXrCO.js} +4 -4
  111. package/dist/plugin-sdk/{session-CknrceVU.js → session-DG_bYisw.js} +2 -2
  112. package/dist/plugin-sdk/{session-CyRTcJ8N.js → session-EIStzK0E.js} +2 -2
  113. package/dist/plugin-sdk/{skill-commands-DHxkTA0s.js → skill-commands-CkgGmWBS.js} +2 -2
  114. package/dist/plugin-sdk/{skill-commands-CLXAG5sU.js → skill-commands-hyZA0LE3.js} +2 -2
  115. package/dist/plugin-sdk/{slack-Br9c6Yzs.js → slack-BErIh0uj.js} +34 -34
  116. package/dist/plugin-sdk/{slack-BpJXkwxF.js → slack-CGTAN4UD.js} +34 -34
  117. package/dist/plugin-sdk/{slack-actions-8tLGt1Ht.js → slack-actions-BQawWGTJ.js} +11 -11
  118. package/dist/plugin-sdk/{slack-actions-CDSSRo8Y.js → slack-actions-DDMszx56.js} +11 -11
  119. package/dist/plugin-sdk/slack.js +2 -1
  120. package/dist/plugin-sdk/src/brand.d.ts +2 -2
  121. package/dist/plugin-sdk/src/browser/runtime-dependency.d.ts +3 -0
  122. package/dist/plugin-sdk/src/infra/optional-runtime-dependency.d.ts +6 -0
  123. package/dist/plugin-sdk/{ssrf-fG4UHKBw.js → ssrf-Cce6LubA.js} +41 -7
  124. package/dist/plugin-sdk/{status-DoxnzyMC.js → status-CCGFb0f2.js} +76 -64
  125. package/dist/plugin-sdk/{sticker-cache-zmJ39ByC.js → sticker-cache-CKAkkCoU.js} +3 -3
  126. package/dist/plugin-sdk/{sticker-cache-D7WcMYsF.js → sticker-cache-wxl1Me2i.js} +3 -3
  127. package/dist/plugin-sdk/{tables-CkxblF0u.js → tables-BD7H5ug-.js} +1 -1
  128. package/dist/plugin-sdk/{tables-RBtf8G4P.js → tables-CJE8kB35.js} +1 -1
  129. package/dist/plugin-sdk/{telegram-actions-DAeYXSLk.js → telegram-actions-BRUNEXMr.js} +25 -25
  130. package/dist/plugin-sdk/{telegram-actions-BDeS3ocd.js → telegram-actions-r86ntIKR.js} +25 -25
  131. package/dist/plugin-sdk/telegram.js +2 -1
  132. package/dist/plugin-sdk/{thread-bindings.lifecycle-DsB94WbE.js → thread-bindings.lifecycle-Djem8FWF.js} +2 -2
  133. package/dist/plugin-sdk/{thread-bindings.lifecycle-DMhV3TsR.js → thread-bindings.lifecycle-gmHv3hc7.js} +2 -2
  134. package/dist/plugin-sdk/{thread-bindings.state-DYWpy7hJ.js → thread-bindings.state-CNT2vxm3.js} +2 -2
  135. package/dist/plugin-sdk/{thread-bindings.state-DG5cBaRn.js → thread-bindings.state-D8kN2X6H.js} +2 -2
  136. package/dist/plugin-sdk/{web-DJwacWQo.js → web-02I0vmdu.js} +26 -26
  137. package/dist/plugin-sdk/{web-IJ4NoGPJ.js → web-CXz56wyu.js} +26 -26
  138. package/dist/plugin-sdk/{whatsapp-actions-DAY8hWpD.js → whatsapp-actions-68Mfs2dJ.js} +12 -12
  139. package/dist/plugin-sdk/{whatsapp-actions-6opfo-oB.js → whatsapp-actions-DRqtzvTO.js} +12 -12
  140. package/dist/plugin-sdk/whatsapp.js +2 -1
  141. package/dist/plugin-sdk/{wsl-B2euLEc2.js → wsl-DcM2PgSS.js} +3 -3
  142. package/dist/plugin-sdk/{wsl-B8eyviuv.js → wsl-PXrdWitE.js} +3 -3
  143. package/dist/plugins/update.js +1 -1
  144. package/dist/tts/tts-core.js +6 -1
  145. package/dist/wizard/onboarding.finalize.js +9 -0
  146. package/extensions/acpx/package.json +1 -1
  147. package/extensions/bluebubbles/package.json +1 -1
  148. package/extensions/copilot-proxy/package.json +1 -1
  149. package/extensions/diagnostics-otel/package.json +1 -1
  150. package/extensions/fased-federation/package.json +1 -1
  151. package/extensions/google-gemini-cli-auth/package.json +1 -1
  152. package/extensions/imessage/package.json +1 -1
  153. package/extensions/irc/package.json +1 -1
  154. package/extensions/line/package.json +1 -1
  155. package/extensions/llm-task/package.json +1 -1
  156. package/extensions/lobster/package.json +1 -1
  157. package/extensions/matrix/CHANGELOG.md +12 -0
  158. package/extensions/matrix/package.json +1 -1
  159. package/extensions/mattermost/package.json +1 -1
  160. package/extensions/memory-core/package.json +2 -2
  161. package/extensions/memory-lancedb/package.json +1 -1
  162. package/extensions/minimax-portal-auth/package.json +1 -1
  163. package/extensions/msteams/CHANGELOG.md +12 -0
  164. package/extensions/msteams/package.json +1 -1
  165. package/extensions/nextcloud-talk/package.json +1 -1
  166. package/extensions/nostr/CHANGELOG.md +12 -0
  167. package/extensions/nostr/package.json +1 -1
  168. package/extensions/open-prose/package.json +1 -1
  169. package/extensions/sat-mining/package.json +1 -1
  170. package/extensions/signal/package.json +1 -1
  171. package/extensions/synology-chat/package.json +1 -1
  172. package/extensions/tlon/package.json +1 -1
  173. package/extensions/twitch/CHANGELOG.md +12 -0
  174. package/extensions/twitch/package.json +1 -1
  175. package/extensions/voice-call/CHANGELOG.md +12 -0
  176. package/extensions/voice-call/package.json +1 -1
  177. package/extensions/zalo/CHANGELOG.md +12 -0
  178. package/extensions/zalo/package.json +1 -1
  179. package/extensions/zalouser/CHANGELOG.md +12 -0
  180. package/extensions/zalouser/package.json +1 -1
  181. package/package.json +22 -15
  182. package/extensions/feishu/fased.plugin.json +0 -10
  183. package/extensions/feishu/index.ts +0 -63
  184. package/extensions/feishu/package.json +0 -33
  185. package/extensions/feishu/skills/feishu-doc/SKILL.md +0 -211
  186. package/extensions/feishu/skills/feishu-doc/references/block-types.md +0 -103
  187. package/extensions/feishu/skills/feishu-drive/SKILL.md +0 -97
  188. package/extensions/feishu/skills/feishu-perm/SKILL.md +0 -119
  189. package/extensions/feishu/skills/feishu-wiki/SKILL.md +0 -111
  190. package/extensions/feishu/src/accounts.ts +0 -159
  191. package/extensions/feishu/src/bitable.ts +0 -713
  192. package/extensions/feishu/src/bot.ts +0 -979
  193. package/extensions/feishu/src/channel.ts +0 -359
  194. package/extensions/feishu/src/client.ts +0 -118
  195. package/extensions/feishu/src/config-schema.ts +0 -226
  196. package/extensions/feishu/src/dedup.ts +0 -54
  197. package/extensions/feishu/src/directory.ts +0 -177
  198. package/extensions/feishu/src/doc-schema.ts +0 -122
  199. package/extensions/feishu/src/docx.ts +0 -998
  200. package/extensions/feishu/src/drive-schema.ts +0 -46
  201. package/extensions/feishu/src/drive.ts +0 -232
  202. package/extensions/feishu/src/dynamic-agent.ts +0 -131
  203. package/extensions/feishu/src/external-keys.ts +0 -19
  204. package/extensions/feishu/src/media.ts +0 -447
  205. package/extensions/feishu/src/mention.ts +0 -133
  206. package/extensions/feishu/src/monitor.ts +0 -434
  207. package/extensions/feishu/src/onboarding.ts +0 -430
  208. package/extensions/feishu/src/outbound.ts +0 -56
  209. package/extensions/feishu/src/perm-schema.ts +0 -52
  210. package/extensions/feishu/src/perm.ts +0 -180
  211. package/extensions/feishu/src/policy.ts +0 -116
  212. package/extensions/feishu/src/probe.ts +0 -44
  213. package/extensions/feishu/src/reactions.ts +0 -160
  214. package/extensions/feishu/src/reply-dispatcher.ts +0 -239
  215. package/extensions/feishu/src/runtime.ts +0 -14
  216. package/extensions/feishu/src/send-result.ts +0 -29
  217. package/extensions/feishu/src/send-target.ts +0 -25
  218. package/extensions/feishu/src/send.ts +0 -313
  219. package/extensions/feishu/src/streaming-card.ts +0 -218
  220. package/extensions/feishu/src/targets.ts +0 -78
  221. package/extensions/feishu/src/tool-account.ts +0 -58
  222. package/extensions/feishu/src/tools-config.ts +0 -21
  223. package/extensions/feishu/src/types.ts +0 -81
  224. package/extensions/feishu/src/typing.ts +0 -80
  225. package/extensions/feishu/src/wiki-schema.ts +0 -55
  226. package/extensions/feishu/src/wiki.ts +0 -237
  227. package/extensions/googlechat/fased.plugin.json +0 -9
  228. package/extensions/googlechat/index.ts +0 -19
  229. package/extensions/googlechat/package.json +0 -37
  230. package/extensions/googlechat/src/accounts.ts +0 -147
  231. package/extensions/googlechat/src/actions.ts +0 -176
  232. package/extensions/googlechat/src/api.ts +0 -282
  233. package/extensions/googlechat/src/auth.ts +0 -137
  234. package/extensions/googlechat/src/channel.ts +0 -591
  235. package/extensions/googlechat/src/monitor.ts +0 -996
  236. package/extensions/googlechat/src/onboarding.ts +0 -344
  237. package/extensions/googlechat/src/runtime.ts +0 -14
  238. package/extensions/googlechat/src/targets.ts +0 -65
  239. package/extensions/googlechat/src/types.config.ts +0 -3
  240. package/extensions/googlechat/src/types.ts +0 -73
@@ -1,180 +0,0 @@
1
- import type * as Lark from "@larksuiteoapi/node-sdk";
2
- import type { FasedAgentPluginApi } from "fased/plugin-sdk";
3
- import { listEnabledFeishuAccounts } from "./accounts.js";
4
- import { FeishuPermSchema, type FeishuPermParams } from "./perm-schema.js";
5
- import { createFeishuToolClient, resolveAnyEnabledFeishuToolsConfig } from "./tool-account.js";
6
-
7
- // ============ Helpers ============
8
-
9
- function json(data: unknown) {
10
- return {
11
- content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
12
- details: data,
13
- };
14
- }
15
-
16
- type ListTokenType =
17
- | "doc"
18
- | "sheet"
19
- | "file"
20
- | "wiki"
21
- | "bitable"
22
- | "docx"
23
- | "mindnote"
24
- | "minutes"
25
- | "slides";
26
- type CreateTokenType =
27
- | "doc"
28
- | "sheet"
29
- | "file"
30
- | "wiki"
31
- | "bitable"
32
- | "docx"
33
- | "folder"
34
- | "mindnote"
35
- | "minutes"
36
- | "slides";
37
- type MemberType =
38
- | "email"
39
- | "openid"
40
- | "unionid"
41
- | "openchat"
42
- | "opendepartmentid"
43
- | "userid"
44
- | "groupid"
45
- | "wikispaceid";
46
- type PermType = "view" | "edit" | "full_access";
47
-
48
- // ============ Actions ============
49
-
50
- async function listMembers(client: Lark.Client, token: string, type: string) {
51
- const res = await client.drive.permissionMember.list({
52
- path: { token },
53
- params: { type: type as ListTokenType },
54
- });
55
- if (res.code !== 0) {
56
- throw new Error(res.msg);
57
- }
58
-
59
- return {
60
- members:
61
- res.data?.items?.map((m) => ({
62
- member_type: m.member_type,
63
- member_id: m.member_id,
64
- perm: m.perm,
65
- name: m.name,
66
- })) ?? [],
67
- };
68
- }
69
-
70
- async function addMember(
71
- client: Lark.Client,
72
- token: string,
73
- type: string,
74
- memberType: string,
75
- memberId: string,
76
- perm: string,
77
- ) {
78
- const res = await client.drive.permissionMember.create({
79
- path: { token },
80
- params: { type: type as CreateTokenType, need_notification: false },
81
- data: {
82
- member_type: memberType as MemberType,
83
- member_id: memberId,
84
- perm: perm as PermType,
85
- },
86
- });
87
- if (res.code !== 0) {
88
- throw new Error(res.msg);
89
- }
90
-
91
- return {
92
- success: true,
93
- member: res.data?.member,
94
- };
95
- }
96
-
97
- async function removeMember(
98
- client: Lark.Client,
99
- token: string,
100
- type: string,
101
- memberType: string,
102
- memberId: string,
103
- ) {
104
- const res = await client.drive.permissionMember.delete({
105
- path: { token, member_id: memberId },
106
- params: { type: type as CreateTokenType, member_type: memberType as MemberType },
107
- });
108
- if (res.code !== 0) {
109
- throw new Error(res.msg);
110
- }
111
-
112
- return {
113
- success: true,
114
- };
115
- }
116
-
117
- // ============ Tool Registration ============
118
-
119
- export function registerFeishuPermTools(api: FasedAgentPluginApi) {
120
- if (!api.config) {
121
- api.logger.debug?.("feishu_perm: No config available, skipping perm tools");
122
- return;
123
- }
124
-
125
- const accounts = listEnabledFeishuAccounts(api.config);
126
- if (accounts.length === 0) {
127
- api.logger.debug?.("feishu_perm: No Feishu accounts configured, skipping perm tools");
128
- return;
129
- }
130
-
131
- const toolsCfg = resolveAnyEnabledFeishuToolsConfig(accounts);
132
- if (!toolsCfg.perm) {
133
- api.logger.debug?.("feishu_perm: perm tool disabled in config (default: false)");
134
- return;
135
- }
136
-
137
- type FeishuPermExecuteParams = FeishuPermParams & { accountId?: string };
138
-
139
- api.registerTool(
140
- (ctx) => {
141
- const defaultAccountId = ctx.agentAccountId;
142
- return {
143
- name: "feishu_perm",
144
- label: "Feishu Perm",
145
- description: "Feishu permission management. Actions: list, add, remove",
146
- parameters: FeishuPermSchema,
147
- async execute(_toolCallId, params) {
148
- const p = params as FeishuPermExecuteParams;
149
- try {
150
- const client = createFeishuToolClient({
151
- api,
152
- executeParams: p,
153
- defaultAccountId,
154
- });
155
- switch (p.action) {
156
- case "list":
157
- return json(await listMembers(client, p.token, p.type));
158
- case "add":
159
- return json(
160
- await addMember(client, p.token, p.type, p.member_type, p.member_id, p.perm),
161
- );
162
- case "remove":
163
- return json(
164
- await removeMember(client, p.token, p.type, p.member_type, p.member_id),
165
- );
166
- default:
167
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- exhaustive check fallback
168
- return json({ error: `Unknown action: ${(p as any).action}` });
169
- }
170
- } catch (err) {
171
- return json({ error: err instanceof Error ? err.message : String(err) });
172
- }
173
- },
174
- };
175
- },
176
- { name: "feishu_perm" },
177
- );
178
-
179
- api.logger.debug?.(`feishu_perm: Registered feishu_perm tool`);
180
- }
@@ -1,116 +0,0 @@
1
- import type { AllowlistMatch, ChannelGroupContext, GroupToolPolicyConfig } from "fased/plugin-sdk";
2
- import { normalizeFeishuTarget } from "./targets.js";
3
- import type { FeishuConfig, FeishuGroupConfig } from "./types.js";
4
-
5
- export type FeishuAllowlistMatch = AllowlistMatch<"wildcard" | "id">;
6
-
7
- function normalizeFeishuAllowEntry(raw: string): string {
8
- const trimmed = raw.trim();
9
- if (!trimmed) {
10
- return "";
11
- }
12
- if (trimmed === "*") {
13
- return "*";
14
- }
15
- const withoutProviderPrefix = trimmed.replace(/^feishu:/i, "");
16
- const normalized = normalizeFeishuTarget(withoutProviderPrefix) ?? withoutProviderPrefix;
17
- return normalized.trim().toLowerCase();
18
- }
19
-
20
- export function resolveFeishuAllowlistMatch(params: {
21
- allowFrom: Array<string | number>;
22
- senderId: string;
23
- senderIds?: Array<string | null | undefined>;
24
- senderName?: string | null;
25
- }): FeishuAllowlistMatch {
26
- const allowFrom = params.allowFrom
27
- .map((entry) => normalizeFeishuAllowEntry(String(entry)))
28
- .filter(Boolean);
29
- if (allowFrom.length === 0) {
30
- return { allowed: false };
31
- }
32
- if (allowFrom.includes("*")) {
33
- return { allowed: true, matchKey: "*", matchSource: "wildcard" };
34
- }
35
-
36
- // Feishu allowlists are ID-based; mutable display names must never grant access.
37
- const senderCandidates = [params.senderId, ...(params.senderIds ?? [])]
38
- .map((entry) => normalizeFeishuAllowEntry(String(entry ?? "")))
39
- .filter(Boolean);
40
-
41
- for (const senderId of senderCandidates) {
42
- if (allowFrom.includes(senderId)) {
43
- return { allowed: true, matchKey: senderId, matchSource: "id" };
44
- }
45
- }
46
-
47
- return { allowed: false };
48
- }
49
-
50
- export function resolveFeishuGroupConfig(params: {
51
- cfg?: FeishuConfig;
52
- groupId?: string | null;
53
- }): FeishuGroupConfig | undefined {
54
- const groups = params.cfg?.groups ?? {};
55
- const groupId = params.groupId?.trim();
56
- if (!groupId) {
57
- return undefined;
58
- }
59
-
60
- const direct = groups[groupId];
61
- if (direct) {
62
- return direct;
63
- }
64
-
65
- const lowered = groupId.toLowerCase();
66
- const matchKey = Object.keys(groups).find((key) => key.toLowerCase() === lowered);
67
- return matchKey ? groups[matchKey] : undefined;
68
- }
69
-
70
- export function resolveFeishuGroupToolPolicy(
71
- params: ChannelGroupContext,
72
- ): GroupToolPolicyConfig | undefined {
73
- const cfg = params.cfg.channels?.feishu as FeishuConfig | undefined;
74
- if (!cfg) {
75
- return undefined;
76
- }
77
-
78
- const groupConfig = resolveFeishuGroupConfig({
79
- cfg,
80
- groupId: params.groupId,
81
- });
82
-
83
- return groupConfig?.tools;
84
- }
85
-
86
- export function isFeishuGroupAllowed(params: {
87
- groupPolicy: "open" | "allowlist" | "disabled";
88
- allowFrom: Array<string | number>;
89
- senderId: string;
90
- senderIds?: Array<string | null | undefined>;
91
- senderName?: string | null;
92
- }): boolean {
93
- const { groupPolicy } = params;
94
- if (groupPolicy === "disabled") {
95
- return false;
96
- }
97
- if (groupPolicy === "open") {
98
- return true;
99
- }
100
- return resolveFeishuAllowlistMatch(params).allowed;
101
- }
102
-
103
- export function resolveFeishuReplyPolicy(params: {
104
- isDirectMessage: boolean;
105
- globalConfig?: FeishuConfig;
106
- groupConfig?: FeishuGroupConfig;
107
- }): { requireMention: boolean } {
108
- if (params.isDirectMessage) {
109
- return { requireMention: false };
110
- }
111
-
112
- const requireMention =
113
- params.groupConfig?.requireMention ?? params.globalConfig?.requireMention ?? true;
114
-
115
- return { requireMention };
116
- }
@@ -1,44 +0,0 @@
1
- import { createFeishuClient, type FeishuClientCredentials } from "./client.js";
2
- import type { FeishuProbeResult } from "./types.js";
3
-
4
- export async function probeFeishu(creds?: FeishuClientCredentials): Promise<FeishuProbeResult> {
5
- if (!creds?.appId || !creds?.appSecret) {
6
- return {
7
- ok: false,
8
- error: "missing credentials (appId, appSecret)",
9
- };
10
- }
11
-
12
- try {
13
- const client = createFeishuClient(creds);
14
- // Use bot/v3/info API to get bot information
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- SDK generic request method
16
- const response = await (client as any).request({
17
- method: "GET",
18
- url: "/open-apis/bot/v3/info",
19
- data: {},
20
- });
21
-
22
- if (response.code !== 0) {
23
- return {
24
- ok: false,
25
- appId: creds.appId,
26
- error: `API error: ${response.msg || `code ${response.code}`}`,
27
- };
28
- }
29
-
30
- const bot = response.bot || response.data?.bot;
31
- return {
32
- ok: true,
33
- appId: creds.appId,
34
- botName: bot?.bot_name,
35
- botOpenId: bot?.open_id,
36
- };
37
- } catch (err) {
38
- return {
39
- ok: false,
40
- appId: creds.appId,
41
- error: err instanceof Error ? err.message : String(err),
42
- };
43
- }
44
- }
@@ -1,160 +0,0 @@
1
- import type { FasedAgentConfig } from "fased/plugin-sdk";
2
- import { resolveFeishuAccount } from "./accounts.js";
3
- import { createFeishuClient } from "./client.js";
4
-
5
- export type FeishuReaction = {
6
- reactionId: string;
7
- emojiType: string;
8
- operatorType: "app" | "user";
9
- operatorId: string;
10
- };
11
-
12
- /**
13
- * Add a reaction (emoji) to a message.
14
- * @param emojiType - Feishu emoji type, e.g., "SMILE", "THUMBSUP", "HEART"
15
- * @see https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce
16
- */
17
- export async function addReactionFeishu(params: {
18
- cfg: FasedAgentConfig;
19
- messageId: string;
20
- emojiType: string;
21
- accountId?: string;
22
- }): Promise<{ reactionId: string }> {
23
- const { cfg, messageId, emojiType, accountId } = params;
24
- const account = resolveFeishuAccount({ cfg, accountId });
25
- if (!account.configured) {
26
- throw new Error(`Feishu account "${account.accountId}" not configured`);
27
- }
28
-
29
- const client = createFeishuClient(account);
30
-
31
- const response = (await client.im.messageReaction.create({
32
- path: { message_id: messageId },
33
- data: {
34
- reaction_type: {
35
- emoji_type: emojiType,
36
- },
37
- },
38
- })) as {
39
- code?: number;
40
- msg?: string;
41
- data?: { reaction_id?: string };
42
- };
43
-
44
- if (response.code !== 0) {
45
- throw new Error(`Feishu add reaction failed: ${response.msg || `code ${response.code}`}`);
46
- }
47
-
48
- const reactionId = response.data?.reaction_id;
49
- if (!reactionId) {
50
- throw new Error("Feishu add reaction failed: no reaction_id returned");
51
- }
52
-
53
- return { reactionId };
54
- }
55
-
56
- /**
57
- * Remove a reaction from a message.
58
- */
59
- export async function removeReactionFeishu(params: {
60
- cfg: FasedAgentConfig;
61
- messageId: string;
62
- reactionId: string;
63
- accountId?: string;
64
- }): Promise<void> {
65
- const { cfg, messageId, reactionId, accountId } = params;
66
- const account = resolveFeishuAccount({ cfg, accountId });
67
- if (!account.configured) {
68
- throw new Error(`Feishu account "${account.accountId}" not configured`);
69
- }
70
-
71
- const client = createFeishuClient(account);
72
-
73
- const response = (await client.im.messageReaction.delete({
74
- path: {
75
- message_id: messageId,
76
- reaction_id: reactionId,
77
- },
78
- })) as { code?: number; msg?: string };
79
-
80
- if (response.code !== 0) {
81
- throw new Error(`Feishu remove reaction failed: ${response.msg || `code ${response.code}`}`);
82
- }
83
- }
84
-
85
- /**
86
- * List all reactions for a message.
87
- */
88
- export async function listReactionsFeishu(params: {
89
- cfg: FasedAgentConfig;
90
- messageId: string;
91
- emojiType?: string;
92
- accountId?: string;
93
- }): Promise<FeishuReaction[]> {
94
- const { cfg, messageId, emojiType, accountId } = params;
95
- const account = resolveFeishuAccount({ cfg, accountId });
96
- if (!account.configured) {
97
- throw new Error(`Feishu account "${account.accountId}" not configured`);
98
- }
99
-
100
- const client = createFeishuClient(account);
101
-
102
- const response = (await client.im.messageReaction.list({
103
- path: { message_id: messageId },
104
- params: emojiType ? { reaction_type: emojiType } : undefined,
105
- })) as {
106
- code?: number;
107
- msg?: string;
108
- data?: {
109
- items?: Array<{
110
- reaction_id?: string;
111
- reaction_type?: { emoji_type?: string };
112
- operator_type?: string;
113
- operator_id?: { open_id?: string; user_id?: string; union_id?: string };
114
- }>;
115
- };
116
- };
117
-
118
- if (response.code !== 0) {
119
- throw new Error(`Feishu list reactions failed: ${response.msg || `code ${response.code}`}`);
120
- }
121
-
122
- const items = response.data?.items ?? [];
123
- return items.map((item) => ({
124
- reactionId: item.reaction_id ?? "",
125
- emojiType: item.reaction_type?.emoji_type ?? "",
126
- operatorType: item.operator_type === "app" ? "app" : "user",
127
- operatorId:
128
- item.operator_id?.open_id ?? item.operator_id?.user_id ?? item.operator_id?.union_id ?? "",
129
- }));
130
- }
131
-
132
- /**
133
- * Common Feishu emoji types for convenience.
134
- * @see https://open.feishu.cn/document/server-docs/im-v1/message-reaction/emojis-introduce
135
- */
136
- export const FeishuEmoji = {
137
- // Common reactions
138
- THUMBSUP: "THUMBSUP",
139
- THUMBSDOWN: "THUMBSDOWN",
140
- HEART: "HEART",
141
- SMILE: "SMILE",
142
- GRINNING: "GRINNING",
143
- LAUGHING: "LAUGHING",
144
- CRY: "CRY",
145
- ANGRY: "ANGRY",
146
- SURPRISED: "SURPRISED",
147
- THINKING: "THINKING",
148
- CLAP: "CLAP",
149
- OK: "OK",
150
- FIST: "FIST",
151
- PRAY: "PRAY",
152
- FIRE: "FIRE",
153
- PARTY: "PARTY",
154
- CHECK: "CHECK",
155
- CROSS: "CROSS",
156
- QUESTION: "QUESTION",
157
- EXCLAMATION: "EXCLAMATION",
158
- } as const;
159
-
160
- export type FeishuEmojiType = (typeof FeishuEmoji)[keyof typeof FeishuEmoji];