agent-messenger 1.14.0 → 2.0.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 (931) hide show
  1. package/.claude-plugin/README.md +94 -13
  2. package/.claude-plugin/marketplace.json +51 -12
  3. package/.claude-plugin/plugin.json +14 -3
  4. package/CONTRIBUTING.md +49 -3
  5. package/README.md +211 -54
  6. package/bun.lock +350 -2
  7. package/cubic.yaml +69 -0
  8. package/dist/package.json +118 -9
  9. package/dist/src/cli.d.ts.map +1 -1
  10. package/dist/src/cli.js +27 -6
  11. package/dist/src/cli.js.map +1 -1
  12. package/dist/src/platforms/channeltalk/client.d.ts +5 -1
  13. package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
  14. package/dist/src/platforms/channeltalk/client.js +23 -6
  15. package/dist/src/platforms/channeltalk/client.js.map +1 -1
  16. package/dist/src/platforms/channeltalk/commands/auth.d.ts +1 -1
  17. package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
  18. package/dist/src/platforms/channeltalk/commands/auth.js +4 -4
  19. package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
  20. package/dist/src/platforms/channeltalk/commands/shared.js +1 -1
  21. package/dist/src/platforms/channeltalk/commands/shared.js.map +1 -1
  22. package/dist/src/platforms/channeltalk/ensure-auth.d.ts +2 -2
  23. package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
  24. package/dist/src/platforms/channeltalk/ensure-auth.js +4 -4
  25. package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
  26. package/dist/src/platforms/channeltalk/index.d.ts +2 -2
  27. package/dist/src/platforms/channeltalk/index.d.ts.map +1 -1
  28. package/dist/src/platforms/channeltalk/index.js +1 -2
  29. package/dist/src/platforms/channeltalk/index.js.map +1 -1
  30. package/dist/src/platforms/channeltalk/token-extractor.d.ts +8 -0
  31. package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
  32. package/dist/src/platforms/channeltalk/token-extractor.js +127 -13
  33. package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
  34. package/dist/src/platforms/channeltalk/types.d.ts +52 -949
  35. package/dist/src/platforms/channeltalk/types.d.ts.map +1 -1
  36. package/dist/src/platforms/channeltalk/types.js +1 -1
  37. package/dist/src/platforms/channeltalk/types.js.map +1 -1
  38. package/dist/src/platforms/channeltalkbot/client.d.ts +5 -1
  39. package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
  40. package/dist/src/platforms/channeltalkbot/client.js +24 -9
  41. package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
  42. package/dist/src/platforms/channeltalkbot/commands/auth.js +2 -2
  43. package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
  44. package/dist/src/platforms/channeltalkbot/commands/shared.js +1 -1
  45. package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
  46. package/dist/src/platforms/channeltalkbot/index.d.ts +2 -1
  47. package/dist/src/platforms/channeltalkbot/index.d.ts.map +1 -1
  48. package/dist/src/platforms/channeltalkbot/index.js.map +1 -1
  49. package/dist/src/platforms/channeltalkbot/types.d.ts +24 -186
  50. package/dist/src/platforms/channeltalkbot/types.d.ts.map +1 -1
  51. package/dist/src/platforms/discord/client.d.ts +7 -1
  52. package/dist/src/platforms/discord/client.d.ts.map +1 -1
  53. package/dist/src/platforms/discord/client.js +27 -6
  54. package/dist/src/platforms/discord/client.js.map +1 -1
  55. package/dist/src/platforms/discord/commands/auth.js +2 -2
  56. package/dist/src/platforms/discord/commands/auth.js.map +1 -1
  57. package/dist/src/platforms/discord/commands/channel.js +3 -3
  58. package/dist/src/platforms/discord/commands/channel.js.map +1 -1
  59. package/dist/src/platforms/discord/commands/dm.js +2 -2
  60. package/dist/src/platforms/discord/commands/dm.js.map +1 -1
  61. package/dist/src/platforms/discord/commands/file.js +3 -3
  62. package/dist/src/platforms/discord/commands/file.js.map +1 -1
  63. package/dist/src/platforms/discord/commands/friend.js +1 -1
  64. package/dist/src/platforms/discord/commands/friend.js.map +1 -1
  65. package/dist/src/platforms/discord/commands/member.js +1 -1
  66. package/dist/src/platforms/discord/commands/member.js.map +1 -1
  67. package/dist/src/platforms/discord/commands/mention.js +1 -1
  68. package/dist/src/platforms/discord/commands/mention.js.map +1 -1
  69. package/dist/src/platforms/discord/commands/message.js +6 -6
  70. package/dist/src/platforms/discord/commands/message.js.map +1 -1
  71. package/dist/src/platforms/discord/commands/note.js +2 -2
  72. package/dist/src/platforms/discord/commands/note.js.map +1 -1
  73. package/dist/src/platforms/discord/commands/profile.js +1 -1
  74. package/dist/src/platforms/discord/commands/profile.js.map +1 -1
  75. package/dist/src/platforms/discord/commands/reaction.js +3 -3
  76. package/dist/src/platforms/discord/commands/reaction.js.map +1 -1
  77. package/dist/src/platforms/discord/commands/server.js +1 -1
  78. package/dist/src/platforms/discord/commands/server.js.map +1 -1
  79. package/dist/src/platforms/discord/commands/snapshot.js +1 -1
  80. package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
  81. package/dist/src/platforms/discord/commands/thread.js +2 -2
  82. package/dist/src/platforms/discord/commands/thread.js.map +1 -1
  83. package/dist/src/platforms/discord/commands/user.js +3 -3
  84. package/dist/src/platforms/discord/commands/user.js.map +1 -1
  85. package/dist/src/platforms/discord/ensure-auth.js +1 -1
  86. package/dist/src/platforms/discord/ensure-auth.js.map +1 -1
  87. package/dist/src/platforms/discord/index.d.ts +6 -0
  88. package/dist/src/platforms/discord/index.d.ts.map +1 -0
  89. package/dist/src/platforms/discord/index.js +5 -0
  90. package/dist/src/platforms/discord/index.js.map +1 -0
  91. package/dist/src/platforms/discord/listener.d.ts +41 -0
  92. package/dist/src/platforms/discord/listener.d.ts.map +1 -0
  93. package/dist/src/platforms/discord/listener.js +262 -0
  94. package/dist/src/platforms/discord/listener.js.map +1 -0
  95. package/dist/src/platforms/discord/types.d.ts +150 -352
  96. package/dist/src/platforms/discord/types.d.ts.map +1 -1
  97. package/dist/src/platforms/discord/types.js +28 -0
  98. package/dist/src/platforms/discord/types.js.map +1 -1
  99. package/dist/src/platforms/discordbot/client.d.ts +4 -1
  100. package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
  101. package/dist/src/platforms/discordbot/client.js +23 -7
  102. package/dist/src/platforms/discordbot/client.js.map +1 -1
  103. package/dist/src/platforms/discordbot/commands/auth.js +2 -2
  104. package/dist/src/platforms/discordbot/commands/auth.js.map +1 -1
  105. package/dist/src/platforms/discordbot/commands/shared.js +1 -1
  106. package/dist/src/platforms/discordbot/commands/shared.js.map +1 -1
  107. package/dist/src/platforms/discordbot/types.d.ts +15 -203
  108. package/dist/src/platforms/discordbot/types.d.ts.map +1 -1
  109. package/dist/src/platforms/instagram/cli.d.ts +5 -0
  110. package/dist/src/platforms/instagram/cli.d.ts.map +1 -0
  111. package/dist/src/platforms/instagram/cli.js +30 -0
  112. package/dist/src/platforms/instagram/cli.js.map +1 -0
  113. package/dist/src/platforms/instagram/client.d.ts +65 -0
  114. package/dist/src/platforms/instagram/client.d.ts.map +1 -0
  115. package/dist/src/platforms/instagram/client.js +524 -0
  116. package/dist/src/platforms/instagram/client.js.map +1 -0
  117. package/dist/src/platforms/instagram/commands/auth.d.ts +3 -0
  118. package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -0
  119. package/dist/src/platforms/instagram/commands/auth.js +330 -0
  120. package/dist/src/platforms/instagram/commands/auth.js.map +1 -0
  121. package/dist/src/platforms/instagram/commands/chat.d.ts +3 -0
  122. package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -0
  123. package/dist/src/platforms/instagram/commands/chat.js +42 -0
  124. package/dist/src/platforms/instagram/commands/chat.js.map +1 -0
  125. package/dist/src/platforms/instagram/commands/index.d.ts +4 -0
  126. package/dist/src/platforms/instagram/commands/index.d.ts.map +1 -0
  127. package/dist/src/platforms/instagram/commands/index.js +4 -0
  128. package/dist/src/platforms/instagram/commands/index.js.map +1 -0
  129. package/dist/src/platforms/instagram/commands/message.d.ts +3 -0
  130. package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -0
  131. package/dist/src/platforms/instagram/commands/message.js +102 -0
  132. package/dist/src/platforms/instagram/commands/message.js.map +1 -0
  133. package/dist/src/platforms/instagram/commands/shared.d.ts +8 -0
  134. package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -0
  135. package/dist/src/platforms/instagram/commands/shared.js +31 -0
  136. package/dist/src/platforms/instagram/commands/shared.js.map +1 -0
  137. package/dist/src/platforms/instagram/credential-manager.d.ts +20 -0
  138. package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -0
  139. package/dist/src/platforms/instagram/credential-manager.js +104 -0
  140. package/dist/src/platforms/instagram/credential-manager.js.map +1 -0
  141. package/dist/src/platforms/instagram/ensure-auth.d.ts +2 -0
  142. package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -0
  143. package/dist/src/platforms/instagram/ensure-auth.js +21 -0
  144. package/dist/src/platforms/instagram/ensure-auth.js.map +1 -0
  145. package/dist/src/platforms/instagram/index.d.ts +5 -0
  146. package/dist/src/platforms/instagram/index.d.ts.map +1 -0
  147. package/dist/src/platforms/instagram/index.js +5 -0
  148. package/dist/src/platforms/instagram/index.js.map +1 -0
  149. package/dist/src/platforms/instagram/listener.d.ts +32 -0
  150. package/dist/src/platforms/instagram/listener.d.ts.map +1 -0
  151. package/dist/src/platforms/instagram/listener.js +87 -0
  152. package/dist/src/platforms/instagram/listener.js.map +1 -0
  153. package/dist/src/platforms/instagram/types.d.ts +61 -0
  154. package/dist/src/platforms/instagram/types.d.ts.map +1 -0
  155. package/dist/src/platforms/instagram/types.js +89 -0
  156. package/dist/src/platforms/instagram/types.js.map +1 -0
  157. package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts +27 -0
  158. package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -0
  159. package/dist/src/platforms/kakaotalk/auth/kakao-login.js +213 -0
  160. package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -0
  161. package/dist/src/platforms/kakaotalk/cli.d.ts +5 -0
  162. package/dist/src/platforms/kakaotalk/cli.d.ts.map +1 -0
  163. package/dist/src/platforms/kakaotalk/cli.js +30 -0
  164. package/dist/src/platforms/kakaotalk/cli.js.map +1 -0
  165. package/dist/src/platforms/kakaotalk/client.d.ts +40 -0
  166. package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -0
  167. package/dist/src/platforms/kakaotalk/client.js +290 -0
  168. package/dist/src/platforms/kakaotalk/client.js.map +1 -0
  169. package/dist/src/platforms/kakaotalk/commands/auth.d.ts +3 -0
  170. package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -0
  171. package/dist/src/platforms/kakaotalk/commands/auth.js +515 -0
  172. package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -0
  173. package/dist/src/platforms/kakaotalk/commands/chat.d.ts +3 -0
  174. package/dist/src/platforms/kakaotalk/commands/chat.d.ts.map +1 -0
  175. package/dist/src/platforms/kakaotalk/commands/chat.js +23 -0
  176. package/dist/src/platforms/kakaotalk/commands/chat.js.map +1 -0
  177. package/dist/src/platforms/kakaotalk/commands/index.d.ts +4 -0
  178. package/dist/src/platforms/kakaotalk/commands/index.d.ts.map +1 -0
  179. package/dist/src/platforms/kakaotalk/commands/index.js +4 -0
  180. package/dist/src/platforms/kakaotalk/commands/index.js.map +1 -0
  181. package/dist/src/platforms/kakaotalk/commands/message.d.ts +3 -0
  182. package/dist/src/platforms/kakaotalk/commands/message.d.ts.map +1 -0
  183. package/dist/src/platforms/kakaotalk/commands/message.js +41 -0
  184. package/dist/src/platforms/kakaotalk/commands/message.js.map +1 -0
  185. package/dist/src/platforms/kakaotalk/commands/shared.d.ts +7 -0
  186. package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -0
  187. package/dist/src/platforms/kakaotalk/commands/shared.js +24 -0
  188. package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -0
  189. package/dist/src/platforms/kakaotalk/credential-manager.d.ts +27 -0
  190. package/dist/src/platforms/kakaotalk/credential-manager.d.ts.map +1 -0
  191. package/dist/src/platforms/kakaotalk/credential-manager.js +82 -0
  192. package/dist/src/platforms/kakaotalk/credential-manager.js.map +1 -0
  193. package/dist/src/platforms/kakaotalk/ensure-auth.d.ts +3 -0
  194. package/dist/src/platforms/kakaotalk/ensure-auth.d.ts.map +1 -0
  195. package/dist/src/platforms/kakaotalk/ensure-auth.js +11 -0
  196. package/dist/src/platforms/kakaotalk/ensure-auth.js.map +1 -0
  197. package/dist/src/platforms/kakaotalk/index.d.ts +7 -0
  198. package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -0
  199. package/dist/src/platforms/kakaotalk/index.js +5 -0
  200. package/dist/src/platforms/kakaotalk/index.js.map +1 -0
  201. package/dist/src/platforms/kakaotalk/listener.d.ts +24 -0
  202. package/dist/src/platforms/kakaotalk/listener.d.ts.map +1 -0
  203. package/dist/src/platforms/kakaotalk/listener.js +171 -0
  204. package/dist/src/platforms/kakaotalk/listener.js.map +1 -0
  205. package/dist/src/platforms/kakaotalk/protocol/config.d.ts +14 -0
  206. package/dist/src/platforms/kakaotalk/protocol/config.d.ts.map +1 -0
  207. package/dist/src/platforms/kakaotalk/protocol/config.js +23 -0
  208. package/dist/src/platforms/kakaotalk/protocol/config.js.map +1 -0
  209. package/dist/src/platforms/kakaotalk/protocol/connection.d.ts +25 -0
  210. package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -0
  211. package/dist/src/platforms/kakaotalk/protocol/connection.js +144 -0
  212. package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -0
  213. package/dist/src/platforms/kakaotalk/protocol/crypto.d.ts +8 -0
  214. package/dist/src/platforms/kakaotalk/protocol/crypto.d.ts.map +1 -0
  215. package/dist/src/platforms/kakaotalk/protocol/crypto.js +51 -0
  216. package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -0
  217. package/dist/src/platforms/kakaotalk/protocol/packet.d.ts +7 -0
  218. package/dist/src/platforms/kakaotalk/protocol/packet.d.ts.map +1 -0
  219. package/dist/src/platforms/kakaotalk/protocol/packet.js +38 -0
  220. package/dist/src/platforms/kakaotalk/protocol/packet.js.map +1 -0
  221. package/dist/src/platforms/kakaotalk/protocol/session.d.ts +18 -0
  222. package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -0
  223. package/dist/src/platforms/kakaotalk/protocol/session.js +127 -0
  224. package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -0
  225. package/dist/src/platforms/kakaotalk/protocol/types.d.ts +41 -0
  226. package/dist/src/platforms/kakaotalk/protocol/types.d.ts.map +1 -0
  227. package/dist/src/platforms/kakaotalk/protocol/types.js +8 -0
  228. package/dist/src/platforms/kakaotalk/protocol/types.js.map +1 -0
  229. package/dist/src/platforms/kakaotalk/token-extractor.d.ts +17 -0
  230. package/dist/src/platforms/kakaotalk/token-extractor.d.ts.map +1 -0
  231. package/dist/src/platforms/kakaotalk/token-extractor.js +273 -0
  232. package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -0
  233. package/dist/src/platforms/kakaotalk/types.d.ts +198 -0
  234. package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -0
  235. package/dist/src/platforms/kakaotalk/types.js +74 -0
  236. package/dist/src/platforms/kakaotalk/types.js.map +1 -0
  237. package/dist/src/platforms/line/cli.d.ts +5 -0
  238. package/dist/src/platforms/line/cli.d.ts.map +1 -0
  239. package/dist/src/platforms/line/cli.js +32 -0
  240. package/dist/src/platforms/line/cli.js.map +1 -0
  241. package/dist/src/platforms/line/client.d.ts +31 -0
  242. package/dist/src/platforms/line/client.d.ts.map +1 -0
  243. package/dist/src/platforms/line/client.js +296 -0
  244. package/dist/src/platforms/line/client.js.map +1 -0
  245. package/dist/src/platforms/line/commands/auth.d.ts +3 -0
  246. package/dist/src/platforms/line/commands/auth.d.ts.map +1 -0
  247. package/dist/src/platforms/line/commands/auth.js +199 -0
  248. package/dist/src/platforms/line/commands/auth.js.map +1 -0
  249. package/dist/src/platforms/line/commands/chat.d.ts +3 -0
  250. package/dist/src/platforms/line/commands/chat.d.ts.map +1 -0
  251. package/dist/src/platforms/line/commands/chat.js +28 -0
  252. package/dist/src/platforms/line/commands/chat.js.map +1 -0
  253. package/dist/src/platforms/line/commands/friend.d.ts +3 -0
  254. package/dist/src/platforms/line/commands/friend.d.ts.map +1 -0
  255. package/dist/src/platforms/line/commands/friend.js +25 -0
  256. package/dist/src/platforms/line/commands/friend.js.map +1 -0
  257. package/dist/src/platforms/line/commands/index.d.ts +6 -0
  258. package/dist/src/platforms/line/commands/index.d.ts.map +1 -0
  259. package/dist/src/platforms/line/commands/index.js +6 -0
  260. package/dist/src/platforms/line/commands/index.js.map +1 -0
  261. package/dist/src/platforms/line/commands/message.d.ts +3 -0
  262. package/dist/src/platforms/line/commands/message.d.ts.map +1 -0
  263. package/dist/src/platforms/line/commands/message.js +48 -0
  264. package/dist/src/platforms/line/commands/message.js.map +1 -0
  265. package/dist/src/platforms/line/commands/profile.d.ts +3 -0
  266. package/dist/src/platforms/line/commands/profile.d.ts.map +1 -0
  267. package/dist/src/platforms/line/commands/profile.js +23 -0
  268. package/dist/src/platforms/line/commands/profile.js.map +1 -0
  269. package/dist/src/platforms/line/credential-manager.d.ts +22 -0
  270. package/dist/src/platforms/line/credential-manager.d.ts.map +1 -0
  271. package/dist/src/platforms/line/credential-manager.js +71 -0
  272. package/dist/src/platforms/line/credential-manager.js.map +1 -0
  273. package/dist/src/platforms/line/ensure-auth.d.ts +3 -0
  274. package/dist/src/platforms/line/ensure-auth.d.ts.map +1 -0
  275. package/dist/src/platforms/line/ensure-auth.js +10 -0
  276. package/dist/src/platforms/line/ensure-auth.js.map +1 -0
  277. package/dist/src/platforms/line/index.d.ts +7 -0
  278. package/dist/src/platforms/line/index.d.ts.map +1 -0
  279. package/dist/src/platforms/line/index.js +6 -0
  280. package/dist/src/platforms/line/index.js.map +1 -0
  281. package/dist/src/platforms/line/listener.d.ts +22 -0
  282. package/dist/src/platforms/line/listener.d.ts.map +1 -0
  283. package/dist/src/platforms/line/listener.js +121 -0
  284. package/dist/src/platforms/line/listener.js.map +1 -0
  285. package/dist/src/platforms/line/types.d.ts +165 -0
  286. package/dist/src/platforms/line/types.d.ts.map +1 -0
  287. package/dist/src/platforms/line/types.js +79 -0
  288. package/dist/src/platforms/line/types.js.map +1 -0
  289. package/dist/src/platforms/slack/cli.d.ts.map +1 -1
  290. package/dist/src/platforms/slack/cli.js +6 -1
  291. package/dist/src/platforms/slack/cli.js.map +1 -1
  292. package/dist/src/platforms/slack/client.d.ts +85 -3
  293. package/dist/src/platforms/slack/client.d.ts.map +1 -1
  294. package/dist/src/platforms/slack/client.js +577 -40
  295. package/dist/src/platforms/slack/client.js.map +1 -1
  296. package/dist/src/platforms/slack/commands/activity.js +1 -1
  297. package/dist/src/platforms/slack/commands/activity.js.map +1 -1
  298. package/dist/src/platforms/slack/commands/auth.js +2 -2
  299. package/dist/src/platforms/slack/commands/auth.js.map +1 -1
  300. package/dist/src/platforms/slack/commands/bookmark.d.ts +3 -0
  301. package/dist/src/platforms/slack/commands/bookmark.d.ts.map +1 -0
  302. package/dist/src/platforms/slack/commands/bookmark.js +116 -0
  303. package/dist/src/platforms/slack/commands/bookmark.js.map +1 -0
  304. package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
  305. package/dist/src/platforms/slack/commands/channel.js +198 -5
  306. package/dist/src/platforms/slack/commands/channel.js.map +1 -1
  307. package/dist/src/platforms/slack/commands/drafts.js +1 -1
  308. package/dist/src/platforms/slack/commands/drafts.js.map +1 -1
  309. package/dist/src/platforms/slack/commands/emoji.d.ts +3 -0
  310. package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -0
  311. package/dist/src/platforms/slack/commands/emoji.js +27 -0
  312. package/dist/src/platforms/slack/commands/emoji.js.map +1 -0
  313. package/dist/src/platforms/slack/commands/file.d.ts.map +1 -1
  314. package/dist/src/platforms/slack/commands/file.js +26 -5
  315. package/dist/src/platforms/slack/commands/file.js.map +1 -1
  316. package/dist/src/platforms/slack/commands/index.d.ts +5 -0
  317. package/dist/src/platforms/slack/commands/index.d.ts.map +1 -1
  318. package/dist/src/platforms/slack/commands/index.js +5 -0
  319. package/dist/src/platforms/slack/commands/index.js.map +1 -1
  320. package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
  321. package/dist/src/platforms/slack/commands/message.js +134 -8
  322. package/dist/src/platforms/slack/commands/message.js.map +1 -1
  323. package/dist/src/platforms/slack/commands/pin.d.ts +3 -0
  324. package/dist/src/platforms/slack/commands/pin.d.ts.map +1 -0
  325. package/dist/src/platforms/slack/commands/pin.js +76 -0
  326. package/dist/src/platforms/slack/commands/pin.js.map +1 -0
  327. package/dist/src/platforms/slack/commands/reaction.js +3 -3
  328. package/dist/src/platforms/slack/commands/reaction.js.map +1 -1
  329. package/dist/src/platforms/slack/commands/reminder.d.ts +3 -0
  330. package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -0
  331. package/dist/src/platforms/slack/commands/reminder.js +98 -0
  332. package/dist/src/platforms/slack/commands/reminder.js.map +1 -0
  333. package/dist/src/platforms/slack/commands/saved.js +1 -1
  334. package/dist/src/platforms/slack/commands/saved.js.map +1 -1
  335. package/dist/src/platforms/slack/commands/sections.js +1 -1
  336. package/dist/src/platforms/slack/commands/sections.js.map +1 -1
  337. package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
  338. package/dist/src/platforms/slack/commands/snapshot.js +12 -1
  339. package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
  340. package/dist/src/platforms/slack/commands/unread.js +3 -3
  341. package/dist/src/platforms/slack/commands/unread.js.map +1 -1
  342. package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
  343. package/dist/src/platforms/slack/commands/user.js +78 -1
  344. package/dist/src/platforms/slack/commands/user.js.map +1 -1
  345. package/dist/src/platforms/slack/commands/usergroup.d.ts +3 -0
  346. package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -0
  347. package/dist/src/platforms/slack/commands/usergroup.js +190 -0
  348. package/dist/src/platforms/slack/commands/usergroup.js.map +1 -0
  349. package/dist/src/platforms/slack/credential-manager.d.ts +2 -1
  350. package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -1
  351. package/dist/src/platforms/slack/credential-manager.js +2 -1
  352. package/dist/src/platforms/slack/credential-manager.js.map +1 -1
  353. package/dist/src/platforms/slack/ensure-auth.js +4 -4
  354. package/dist/src/platforms/slack/ensure-auth.js.map +1 -1
  355. package/dist/src/platforms/slack/index.d.ts +4 -1
  356. package/dist/src/platforms/slack/index.d.ts.map +1 -1
  357. package/dist/src/platforms/slack/index.js +3 -1
  358. package/dist/src/platforms/slack/index.js.map +1 -1
  359. package/dist/src/platforms/slack/listener.d.ts +30 -0
  360. package/dist/src/platforms/slack/listener.d.ts.map +1 -0
  361. package/dist/src/platforms/slack/listener.js +157 -0
  362. package/dist/src/platforms/slack/listener.js.map +1 -0
  363. package/dist/src/platforms/slack/types.d.ts +198 -275
  364. package/dist/src/platforms/slack/types.d.ts.map +1 -1
  365. package/dist/src/platforms/slack/types.js +22 -0
  366. package/dist/src/platforms/slack/types.js.map +1 -1
  367. package/dist/src/platforms/slackbot/client.d.ts +4 -1
  368. package/dist/src/platforms/slackbot/client.d.ts.map +1 -1
  369. package/dist/src/platforms/slackbot/client.js +40 -21
  370. package/dist/src/platforms/slackbot/client.js.map +1 -1
  371. package/dist/src/platforms/slackbot/commands/auth.js +2 -2
  372. package/dist/src/platforms/slackbot/commands/auth.js.map +1 -1
  373. package/dist/src/platforms/slackbot/commands/shared.js +1 -1
  374. package/dist/src/platforms/slackbot/commands/shared.js.map +1 -1
  375. package/dist/src/platforms/slackbot/types.d.ts +20 -282
  376. package/dist/src/platforms/slackbot/types.d.ts.map +1 -1
  377. package/dist/src/platforms/teams/client.d.ts +5 -1
  378. package/dist/src/platforms/teams/client.d.ts.map +1 -1
  379. package/dist/src/platforms/teams/client.js +27 -9
  380. package/dist/src/platforms/teams/client.js.map +1 -1
  381. package/dist/src/platforms/teams/commands/auth.js +3 -3
  382. package/dist/src/platforms/teams/commands/auth.js.map +1 -1
  383. package/dist/src/platforms/teams/commands/channel.js +3 -3
  384. package/dist/src/platforms/teams/commands/channel.js.map +1 -1
  385. package/dist/src/platforms/teams/commands/file.js +3 -3
  386. package/dist/src/platforms/teams/commands/file.js.map +1 -1
  387. package/dist/src/platforms/teams/commands/message.js +4 -4
  388. package/dist/src/platforms/teams/commands/message.js.map +1 -1
  389. package/dist/src/platforms/teams/commands/reaction.js +2 -2
  390. package/dist/src/platforms/teams/commands/reaction.js.map +1 -1
  391. package/dist/src/platforms/teams/commands/snapshot.js +1 -1
  392. package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
  393. package/dist/src/platforms/teams/commands/team.js +1 -1
  394. package/dist/src/platforms/teams/commands/team.js.map +1 -1
  395. package/dist/src/platforms/teams/commands/user.js +3 -3
  396. package/dist/src/platforms/teams/commands/user.js.map +1 -1
  397. package/dist/src/platforms/teams/ensure-auth.js +1 -1
  398. package/dist/src/platforms/teams/ensure-auth.js.map +1 -1
  399. package/dist/src/platforms/teams/index.d.ts +6 -0
  400. package/dist/src/platforms/teams/index.d.ts.map +1 -0
  401. package/dist/src/platforms/teams/index.js +5 -0
  402. package/dist/src/platforms/teams/index.js.map +1 -0
  403. package/dist/src/platforms/teams/types.d.ts +26 -193
  404. package/dist/src/platforms/teams/types.d.ts.map +1 -1
  405. package/dist/src/platforms/telegram/app-config.d.ts +7 -0
  406. package/dist/src/platforms/telegram/app-config.d.ts.map +1 -0
  407. package/dist/src/platforms/telegram/app-config.js +39 -0
  408. package/dist/src/platforms/telegram/app-config.js.map +1 -0
  409. package/dist/src/platforms/telegram/chat-utils.d.ts +5 -0
  410. package/dist/src/platforms/telegram/chat-utils.d.ts.map +1 -0
  411. package/dist/src/platforms/telegram/chat-utils.js +33 -0
  412. package/dist/src/platforms/telegram/chat-utils.js.map +1 -0
  413. package/dist/src/platforms/telegram/cli.d.ts +5 -0
  414. package/dist/src/platforms/telegram/cli.d.ts.map +1 -0
  415. package/dist/src/platforms/telegram/cli.js +15 -0
  416. package/dist/src/platforms/telegram/cli.js.map +1 -0
  417. package/dist/src/platforms/telegram/client.d.ts +47 -0
  418. package/dist/src/platforms/telegram/client.d.ts.map +1 -0
  419. package/dist/src/platforms/telegram/client.js +481 -0
  420. package/dist/src/platforms/telegram/client.js.map +1 -0
  421. package/dist/src/platforms/telegram/commands/auth.d.ts +44 -0
  422. package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -0
  423. package/dist/src/platforms/telegram/commands/auth.js +522 -0
  424. package/dist/src/platforms/telegram/commands/auth.js.map +1 -0
  425. package/dist/src/platforms/telegram/commands/chat.d.ts +3 -0
  426. package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -0
  427. package/dist/src/platforms/telegram/commands/chat.js +55 -0
  428. package/dist/src/platforms/telegram/commands/chat.js.map +1 -0
  429. package/dist/src/platforms/telegram/commands/index.d.ts +4 -0
  430. package/dist/src/platforms/telegram/commands/index.d.ts.map +1 -0
  431. package/dist/src/platforms/telegram/commands/index.js +4 -0
  432. package/dist/src/platforms/telegram/commands/index.js.map +1 -0
  433. package/dist/src/platforms/telegram/commands/message.d.ts +3 -0
  434. package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -0
  435. package/dist/src/platforms/telegram/commands/message.js +40 -0
  436. package/dist/src/platforms/telegram/commands/message.js.map +1 -0
  437. package/dist/src/platforms/telegram/commands/shared.d.ts +10 -0
  438. package/dist/src/platforms/telegram/commands/shared.d.ts.map +1 -0
  439. package/dist/src/platforms/telegram/commands/shared.js +32 -0
  440. package/dist/src/platforms/telegram/commands/shared.js.map +1 -0
  441. package/dist/src/platforms/telegram/credential-manager.d.ts +25 -0
  442. package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -0
  443. package/dist/src/platforms/telegram/credential-manager.js +159 -0
  444. package/dist/src/platforms/telegram/credential-manager.js.map +1 -0
  445. package/dist/src/platforms/telegram/my-telegram-org.d.ts +14 -0
  446. package/dist/src/platforms/telegram/my-telegram-org.d.ts.map +1 -0
  447. package/dist/src/platforms/telegram/my-telegram-org.js +164 -0
  448. package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -0
  449. package/dist/src/platforms/telegram/tdlib.d.ts +11 -0
  450. package/dist/src/platforms/telegram/tdlib.d.ts.map +1 -0
  451. package/dist/src/platforms/telegram/tdlib.js +113 -0
  452. package/dist/src/platforms/telegram/tdlib.js.map +1 -0
  453. package/dist/src/platforms/telegram/types.d.ts +192 -0
  454. package/dist/src/platforms/telegram/types.d.ts.map +1 -0
  455. package/dist/src/platforms/telegram/types.js +183 -0
  456. package/dist/src/platforms/telegram/types.js.map +1 -0
  457. package/dist/src/platforms/whatsapp/cli.d.ts +6 -0
  458. package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -0
  459. package/dist/src/platforms/whatsapp/cli.js +31 -0
  460. package/dist/src/platforms/whatsapp/cli.js.map +1 -0
  461. package/dist/src/platforms/whatsapp/client.d.ts +39 -0
  462. package/dist/src/platforms/whatsapp/client.d.ts.map +1 -0
  463. package/dist/src/platforms/whatsapp/client.js +436 -0
  464. package/dist/src/platforms/whatsapp/client.js.map +1 -0
  465. package/dist/src/platforms/whatsapp/commands/auth.d.ts +3 -0
  466. package/dist/src/platforms/whatsapp/commands/auth.d.ts.map +1 -0
  467. package/dist/src/platforms/whatsapp/commands/auth.js +170 -0
  468. package/dist/src/platforms/whatsapp/commands/auth.js.map +1 -0
  469. package/dist/src/platforms/whatsapp/commands/chat.d.ts +3 -0
  470. package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -0
  471. package/dist/src/platforms/whatsapp/commands/chat.js +42 -0
  472. package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -0
  473. package/dist/src/platforms/whatsapp/commands/index.d.ts +4 -0
  474. package/dist/src/platforms/whatsapp/commands/index.d.ts.map +1 -0
  475. package/dist/src/platforms/whatsapp/commands/index.js +4 -0
  476. package/dist/src/platforms/whatsapp/commands/index.js.map +1 -0
  477. package/dist/src/platforms/whatsapp/commands/message.d.ts +3 -0
  478. package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -0
  479. package/dist/src/platforms/whatsapp/commands/message.js +61 -0
  480. package/dist/src/platforms/whatsapp/commands/message.js.map +1 -0
  481. package/dist/src/platforms/whatsapp/commands/shared.d.ts +8 -0
  482. package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -0
  483. package/dist/src/platforms/whatsapp/commands/shared.js +37 -0
  484. package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -0
  485. package/dist/src/platforms/whatsapp/credential-manager.d.ts +20 -0
  486. package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -0
  487. package/dist/src/platforms/whatsapp/credential-manager.js +104 -0
  488. package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -0
  489. package/dist/src/platforms/whatsapp/ensure-auth.d.ts +2 -0
  490. package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -0
  491. package/dist/src/platforms/whatsapp/ensure-auth.js +23 -0
  492. package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -0
  493. package/dist/src/platforms/whatsapp/index.d.ts +4 -0
  494. package/dist/src/platforms/whatsapp/index.d.ts.map +1 -0
  495. package/dist/src/platforms/whatsapp/index.js +4 -0
  496. package/dist/src/platforms/whatsapp/index.js.map +1 -0
  497. package/dist/src/platforms/whatsapp/suppress-ws-warnings.d.ts +11 -0
  498. package/dist/src/platforms/whatsapp/suppress-ws-warnings.d.ts.map +1 -0
  499. package/dist/src/platforms/whatsapp/suppress-ws-warnings.js +24 -0
  500. package/dist/src/platforms/whatsapp/suppress-ws-warnings.js.map +1 -0
  501. package/dist/src/platforms/whatsapp/types.d.ts +42 -0
  502. package/dist/src/platforms/whatsapp/types.d.ts.map +1 -0
  503. package/dist/src/platforms/whatsapp/types.js +75 -0
  504. package/dist/src/platforms/whatsapp/types.js.map +1 -0
  505. package/dist/src/platforms/whatsappbot/cli.d.ts +5 -0
  506. package/dist/src/platforms/whatsappbot/cli.d.ts.map +1 -0
  507. package/dist/src/platforms/whatsappbot/cli.js +17 -0
  508. package/dist/src/platforms/whatsappbot/cli.js.map +1 -0
  509. package/dist/src/platforms/whatsappbot/client.d.ts +31 -0
  510. package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -0
  511. package/dist/src/platforms/whatsappbot/client.js +202 -0
  512. package/dist/src/platforms/whatsappbot/client.js.map +1 -0
  513. package/dist/src/platforms/whatsappbot/commands/auth.d.ts +28 -0
  514. package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -0
  515. package/dist/src/platforms/whatsappbot/commands/auth.js +163 -0
  516. package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -0
  517. package/dist/src/platforms/whatsappbot/commands/index.d.ts +4 -0
  518. package/dist/src/platforms/whatsappbot/commands/index.d.ts.map +1 -0
  519. package/dist/src/platforms/whatsappbot/commands/index.js +4 -0
  520. package/dist/src/platforms/whatsappbot/commands/index.js.map +1 -0
  521. package/dist/src/platforms/whatsappbot/commands/message.d.ts +27 -0
  522. package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -0
  523. package/dist/src/platforms/whatsappbot/commands/message.js +122 -0
  524. package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -0
  525. package/dist/src/platforms/whatsappbot/commands/shared.d.ts +9 -0
  526. package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -0
  527. package/dist/src/platforms/whatsappbot/commands/shared.js +13 -0
  528. package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -0
  529. package/dist/src/platforms/whatsappbot/commands/template.d.ts +16 -0
  530. package/dist/src/platforms/whatsappbot/commands/template.d.ts.map +1 -0
  531. package/dist/src/platforms/whatsappbot/commands/template.js +51 -0
  532. package/dist/src/platforms/whatsappbot/commands/template.js.map +1 -0
  533. package/dist/src/platforms/whatsappbot/credential-manager.d.ts +17 -0
  534. package/dist/src/platforms/whatsappbot/credential-manager.d.ts.map +1 -0
  535. package/dist/src/platforms/whatsappbot/credential-manager.js +121 -0
  536. package/dist/src/platforms/whatsappbot/credential-manager.js.map +1 -0
  537. package/dist/src/platforms/whatsappbot/index.d.ts +5 -0
  538. package/dist/src/platforms/whatsappbot/index.d.ts.map +1 -0
  539. package/dist/src/platforms/whatsappbot/index.js +4 -0
  540. package/dist/src/platforms/whatsappbot/index.js.map +1 -0
  541. package/dist/src/platforms/whatsappbot/types.d.ts +66 -0
  542. package/dist/src/platforms/whatsappbot/types.d.ts.map +1 -0
  543. package/dist/src/platforms/whatsappbot/types.js +28 -0
  544. package/dist/src/platforms/whatsappbot/types.js.map +1 -0
  545. package/dist/src/tui/adapters/channeltalk-adapter.d.ts +19 -0
  546. package/dist/src/tui/adapters/channeltalk-adapter.d.ts.map +1 -0
  547. package/dist/src/tui/adapters/channeltalk-adapter.js +88 -0
  548. package/dist/src/tui/adapters/channeltalk-adapter.js.map +1 -0
  549. package/dist/src/tui/adapters/discord-adapter.d.ts +22 -0
  550. package/dist/src/tui/adapters/discord-adapter.d.ts.map +1 -0
  551. package/dist/src/tui/adapters/discord-adapter.js +100 -0
  552. package/dist/src/tui/adapters/discord-adapter.js.map +1 -0
  553. package/dist/src/tui/adapters/instagram-adapter.d.ts +18 -0
  554. package/dist/src/tui/adapters/instagram-adapter.d.ts.map +1 -0
  555. package/dist/src/tui/adapters/instagram-adapter.js +115 -0
  556. package/dist/src/tui/adapters/instagram-adapter.js.map +1 -0
  557. package/dist/src/tui/adapters/kakaotalk-adapter.d.ts +18 -0
  558. package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -0
  559. package/dist/src/tui/adapters/kakaotalk-adapter.js +146 -0
  560. package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -0
  561. package/dist/src/tui/adapters/line-adapter.d.ts +18 -0
  562. package/dist/src/tui/adapters/line-adapter.d.ts.map +1 -0
  563. package/dist/src/tui/adapters/line-adapter.js +92 -0
  564. package/dist/src/tui/adapters/line-adapter.js.map +1 -0
  565. package/dist/src/tui/adapters/slack-adapter.d.ts +23 -0
  566. package/dist/src/tui/adapters/slack-adapter.d.ts.map +1 -0
  567. package/dist/src/tui/adapters/slack-adapter.js +111 -0
  568. package/dist/src/tui/adapters/slack-adapter.js.map +1 -0
  569. package/dist/src/tui/adapters/teams-adapter.d.ts +20 -0
  570. package/dist/src/tui/adapters/teams-adapter.d.ts.map +1 -0
  571. package/dist/src/tui/adapters/teams-adapter.js +85 -0
  572. package/dist/src/tui/adapters/teams-adapter.js.map +1 -0
  573. package/dist/src/tui/adapters/telegram-adapter.d.ts +18 -0
  574. package/dist/src/tui/adapters/telegram-adapter.d.ts.map +1 -0
  575. package/dist/src/tui/adapters/telegram-adapter.js +183 -0
  576. package/dist/src/tui/adapters/telegram-adapter.js.map +1 -0
  577. package/dist/src/tui/adapters/types.d.ts +41 -0
  578. package/dist/src/tui/adapters/types.d.ts.map +1 -0
  579. package/dist/src/tui/adapters/types.js +2 -0
  580. package/dist/src/tui/adapters/types.js.map +1 -0
  581. package/dist/src/tui/adapters/whatsapp-adapter.d.ts +18 -0
  582. package/dist/src/tui/adapters/whatsapp-adapter.d.ts.map +1 -0
  583. package/dist/src/tui/adapters/whatsapp-adapter.js +120 -0
  584. package/dist/src/tui/adapters/whatsapp-adapter.js.map +1 -0
  585. package/dist/src/tui/app.d.ts +2 -0
  586. package/dist/src/tui/app.d.ts.map +1 -0
  587. package/dist/src/tui/app.js +652 -0
  588. package/dist/src/tui/app.js.map +1 -0
  589. package/dist/src/tui/cli.d.ts +3 -0
  590. package/dist/src/tui/cli.d.ts.map +1 -0
  591. package/dist/src/tui/cli.js +14 -0
  592. package/dist/src/tui/cli.js.map +1 -0
  593. package/dist/src/tui/utils.d.ts +5 -0
  594. package/dist/src/tui/utils.d.ts.map +1 -0
  595. package/dist/src/tui/utils.js +54 -0
  596. package/dist/src/tui/utils.js.map +1 -0
  597. package/dist/src/tui/views/channel-picker.d.ts +18 -0
  598. package/dist/src/tui/views/channel-picker.d.ts.map +1 -0
  599. package/dist/src/tui/views/channel-picker.js +131 -0
  600. package/dist/src/tui/views/channel-picker.js.map +1 -0
  601. package/dist/src/tui/views/workspace-picker.d.ts +18 -0
  602. package/dist/src/tui/views/workspace-picker.d.ts.map +1 -0
  603. package/dist/src/tui/views/workspace-picker.js +131 -0
  604. package/dist/src/tui/views/workspace-picker.js.map +1 -0
  605. package/docs/bun.lock +2 -666
  606. package/docs/content/docs/agent-skills.mdx +1 -1
  607. package/docs/content/docs/cli/channeltalk.mdx +264 -0
  608. package/docs/content/docs/cli/channeltalkbot.mdx +261 -0
  609. package/docs/content/docs/cli/instagram.mdx +211 -0
  610. package/docs/content/docs/cli/kakaotalk.mdx +286 -0
  611. package/docs/content/docs/cli/line.mdx +306 -0
  612. package/docs/content/docs/cli/meta.json +18 -0
  613. package/docs/content/docs/cli/slack.mdx +395 -0
  614. package/docs/content/docs/{integrations → cli}/slackbot.mdx +1 -1
  615. package/docs/content/docs/{integrations → cli}/teams.mdx +2 -2
  616. package/docs/content/docs/cli/telegram.mdx +107 -0
  617. package/docs/content/docs/cli/whatsapp.mdx +163 -0
  618. package/docs/content/docs/cli/whatsappbot.mdx +169 -0
  619. package/docs/content/docs/index.mdx +21 -13
  620. package/docs/content/docs/meta.json +9 -1
  621. package/docs/content/docs/quick-start.mdx +29 -6
  622. package/docs/content/docs/sdk/channeltalk.mdx +384 -0
  623. package/docs/content/docs/sdk/channeltalkbot.mdx +395 -0
  624. package/docs/content/docs/sdk/discord.mdx +535 -0
  625. package/docs/content/docs/sdk/instagram.mdx +367 -0
  626. package/docs/content/docs/sdk/kakaotalk.mdx +290 -0
  627. package/docs/content/docs/sdk/line.mdx +347 -0
  628. package/docs/content/docs/sdk/meta.json +4 -0
  629. package/docs/content/docs/sdk/slack.mdx +671 -0
  630. package/docs/content/docs/sdk/teams.mdx +350 -0
  631. package/docs/content/docs/sdk/whatsapp.mdx +293 -0
  632. package/docs/content/docs/sdk/whatsappbot.mdx +266 -0
  633. package/docs/content/docs/tui.mdx +137 -0
  634. package/docs/public/tui.png +0 -0
  635. package/docs/src/app/page.tsx +885 -308
  636. package/e2e/discordbot.e2e.test.ts +1 -1
  637. package/examples/discord-listen.ts +56 -0
  638. package/examples/kakaotalk-listen.ts +49 -0
  639. package/examples/slack-listen.ts +60 -0
  640. package/package.json +118 -9
  641. package/scripts/postbuild.ts +1 -0
  642. package/scripts/prepublish.ts +21 -1
  643. package/skills/agent-channeltalk/SKILL.md +18 -6
  644. package/skills/agent-channeltalkbot/SKILL.md +1 -1
  645. package/skills/agent-discord/SKILL.md +77 -2
  646. package/skills/agent-discord/references/common-patterns.md +1 -1
  647. package/skills/agent-discordbot/SKILL.md +1 -1
  648. package/skills/agent-instagram/SKILL.md +383 -0
  649. package/skills/agent-instagram/references/authentication.md +256 -0
  650. package/skills/agent-instagram/references/common-patterns.md +362 -0
  651. package/skills/agent-instagram/templates/chat-summary.sh +124 -0
  652. package/skills/agent-instagram/templates/monitor-chat.sh +143 -0
  653. package/skills/agent-instagram/templates/post-message.sh +130 -0
  654. package/skills/agent-kakaotalk/SKILL.md +587 -0
  655. package/skills/agent-kakaotalk/references/authentication.md +343 -0
  656. package/skills/agent-kakaotalk/references/common-patterns.md +403 -0
  657. package/skills/agent-kakaotalk/templates/chat-summary.sh +121 -0
  658. package/skills/agent-kakaotalk/templates/monitor-chat.sh +160 -0
  659. package/skills/agent-kakaotalk/templates/post-message.sh +123 -0
  660. package/skills/agent-line/SKILL.md +490 -0
  661. package/skills/agent-line/references/authentication.md +297 -0
  662. package/skills/agent-line/references/common-patterns.md +355 -0
  663. package/skills/agent-line/templates/chat-summary.sh +63 -0
  664. package/skills/agent-line/templates/monitor-chat.sh +76 -0
  665. package/skills/agent-line/templates/post-message.sh +123 -0
  666. package/skills/agent-slack/SKILL.md +266 -7
  667. package/skills/agent-slack/references/common-patterns.md +105 -39
  668. package/skills/agent-slackbot/SKILL.md +1 -1
  669. package/skills/agent-slackbot/references/common-patterns.md +52 -0
  670. package/skills/agent-teams/SKILL.md +49 -1
  671. package/skills/agent-telegram/SKILL.md +123 -0
  672. package/skills/agent-whatsapp/SKILL.md +382 -0
  673. package/skills/agent-whatsapp/references/authentication.md +191 -0
  674. package/skills/agent-whatsapp/references/common-patterns.md +336 -0
  675. package/skills/agent-whatsapp/templates/chat-summary.sh +122 -0
  676. package/skills/agent-whatsapp/templates/monitor-chat.sh +157 -0
  677. package/skills/agent-whatsapp/templates/post-message.sh +120 -0
  678. package/skills/agent-whatsappbot/SKILL.md +371 -0
  679. package/skills/agent-whatsappbot/references/authentication.md +216 -0
  680. package/skills/agent-whatsappbot/references/common-patterns.md +331 -0
  681. package/skills/agent-whatsappbot/templates/account-summary.sh +127 -0
  682. package/skills/agent-whatsappbot/templates/post-message.sh +120 -0
  683. package/skills/agent-whatsappbot/templates/send-template.sh +153 -0
  684. package/src/cli.ts +34 -6
  685. package/src/platforms/channeltalk/client.test.ts +30 -28
  686. package/src/platforms/channeltalk/client.ts +29 -8
  687. package/src/platforms/channeltalk/commands/auth.ts +9 -7
  688. package/src/platforms/channeltalk/commands/shared.ts +1 -1
  689. package/src/platforms/channeltalk/ensure-auth.ts +10 -8
  690. package/src/platforms/channeltalk/index.test.ts +114 -0
  691. package/src/platforms/channeltalk/index.ts +27 -14
  692. package/src/platforms/channeltalk/token-extractor.test.ts +227 -65
  693. package/src/platforms/channeltalk/token-extractor.ts +146 -25
  694. package/src/platforms/channeltalk/types.ts +3 -1
  695. package/src/platforms/channeltalkbot/client.test.ts +12 -12
  696. package/src/platforms/channeltalkbot/client.ts +31 -11
  697. package/src/platforms/channeltalkbot/commands/auth.test.ts +1 -5
  698. package/src/platforms/channeltalkbot/commands/auth.ts +2 -2
  699. package/src/platforms/channeltalkbot/commands/shared.ts +1 -1
  700. package/src/platforms/channeltalkbot/index.test.ts +76 -0
  701. package/src/platforms/channeltalkbot/index.ts +14 -11
  702. package/src/platforms/discord/client.test.ts +30 -30
  703. package/src/platforms/discord/client.ts +33 -6
  704. package/src/platforms/discord/commands/auth.test.ts +2 -2
  705. package/src/platforms/discord/commands/auth.ts +2 -2
  706. package/src/platforms/discord/commands/channel.test.ts +6 -6
  707. package/src/platforms/discord/commands/channel.ts +3 -3
  708. package/src/platforms/discord/commands/dm.ts +2 -2
  709. package/src/platforms/discord/commands/file.ts +3 -3
  710. package/src/platforms/discord/commands/friend.test.ts +5 -5
  711. package/src/platforms/discord/commands/friend.ts +1 -1
  712. package/src/platforms/discord/commands/member.test.ts +4 -4
  713. package/src/platforms/discord/commands/member.ts +1 -1
  714. package/src/platforms/discord/commands/mention.test.ts +4 -4
  715. package/src/platforms/discord/commands/mention.ts +1 -1
  716. package/src/platforms/discord/commands/message.ts +6 -6
  717. package/src/platforms/discord/commands/note.ts +2 -2
  718. package/src/platforms/discord/commands/profile.ts +1 -1
  719. package/src/platforms/discord/commands/reaction.ts +3 -3
  720. package/src/platforms/discord/commands/server.test.ts +2 -2
  721. package/src/platforms/discord/commands/server.ts +1 -1
  722. package/src/platforms/discord/commands/snapshot.ts +1 -1
  723. package/src/platforms/discord/commands/thread.test.ts +5 -5
  724. package/src/platforms/discord/commands/thread.ts +2 -2
  725. package/src/platforms/discord/commands/user.ts +3 -3
  726. package/src/platforms/discord/ensure-auth.ts +1 -1
  727. package/src/platforms/discord/index.test.ts +84 -0
  728. package/src/platforms/discord/index.ts +51 -0
  729. package/src/platforms/discord/listener.test.ts +782 -0
  730. package/src/platforms/discord/listener.ts +297 -0
  731. package/src/platforms/discord/types.ts +133 -0
  732. package/src/platforms/discordbot/client.test.ts +33 -33
  733. package/src/platforms/discordbot/client.ts +28 -7
  734. package/src/platforms/discordbot/commands/auth.test.ts +1 -5
  735. package/src/platforms/discordbot/commands/auth.ts +2 -2
  736. package/src/platforms/discordbot/commands/channel.test.ts +1 -5
  737. package/src/platforms/discordbot/commands/message.test.ts +1 -3
  738. package/src/platforms/discordbot/commands/server.test.ts +1 -5
  739. package/src/platforms/discordbot/commands/shared.ts +1 -1
  740. package/src/platforms/discordbot/commands/snapshot.test.ts +1 -3
  741. package/src/platforms/discordbot/commands/thread.test.ts +1 -3
  742. package/src/platforms/discordbot/commands/user.test.ts +1 -5
  743. package/src/platforms/instagram/cli.ts +37 -0
  744. package/src/platforms/instagram/client.test.ts +396 -0
  745. package/src/platforms/instagram/client.ts +655 -0
  746. package/src/platforms/instagram/commands/auth.ts +401 -0
  747. package/src/platforms/instagram/commands/chat.ts +49 -0
  748. package/src/platforms/instagram/commands/index.ts +3 -0
  749. package/src/platforms/instagram/commands/message.ts +134 -0
  750. package/src/platforms/instagram/commands/shared.test.ts +51 -0
  751. package/src/platforms/instagram/commands/shared.ts +55 -0
  752. package/src/platforms/instagram/credential-manager.test.ts +277 -0
  753. package/src/platforms/instagram/credential-manager.ts +134 -0
  754. package/src/platforms/instagram/ensure-auth.test.ts +84 -0
  755. package/src/platforms/instagram/ensure-auth.ts +24 -0
  756. package/src/platforms/instagram/index.test.ts +44 -0
  757. package/src/platforms/instagram/index.ts +16 -0
  758. package/src/platforms/instagram/listener.test.ts +130 -0
  759. package/src/platforms/instagram/listener.ts +106 -0
  760. package/src/platforms/instagram/types.test.ts +228 -0
  761. package/src/platforms/instagram/types.ts +153 -0
  762. package/src/platforms/kakaotalk/auth/kakao-login.ts +296 -0
  763. package/src/platforms/kakaotalk/cli.ts +37 -0
  764. package/src/platforms/kakaotalk/client.test.ts +490 -0
  765. package/src/platforms/kakaotalk/client.ts +328 -0
  766. package/src/platforms/kakaotalk/commands/auth.ts +569 -0
  767. package/src/platforms/kakaotalk/commands/chat.ts +34 -0
  768. package/src/platforms/kakaotalk/commands/index.ts +3 -0
  769. package/src/platforms/kakaotalk/commands/message.ts +56 -0
  770. package/src/platforms/kakaotalk/commands/shared.ts +38 -0
  771. package/src/platforms/kakaotalk/credential-manager.test.ts +231 -0
  772. package/src/platforms/kakaotalk/credential-manager.ts +110 -0
  773. package/src/platforms/kakaotalk/ensure-auth.ts +16 -0
  774. package/src/platforms/kakaotalk/index.test.ts +68 -0
  775. package/src/platforms/kakaotalk/index.ts +30 -0
  776. package/src/platforms/kakaotalk/listener.test.ts +370 -0
  777. package/src/platforms/kakaotalk/listener.ts +203 -0
  778. package/src/platforms/kakaotalk/protocol/NOTICE.md +51 -0
  779. package/src/platforms/kakaotalk/protocol/config.ts +28 -0
  780. package/src/platforms/kakaotalk/protocol/connection.ts +159 -0
  781. package/src/platforms/kakaotalk/protocol/crypto.ts +71 -0
  782. package/src/platforms/kakaotalk/protocol/packet.ts +47 -0
  783. package/src/platforms/kakaotalk/protocol/session.ts +156 -0
  784. package/src/platforms/kakaotalk/protocol/types.ts +42 -0
  785. package/src/platforms/kakaotalk/token-extractor.ts +320 -0
  786. package/src/platforms/kakaotalk/types.ts +212 -0
  787. package/src/platforms/line/cli.ts +39 -0
  788. package/src/platforms/line/client.test.ts +162 -0
  789. package/src/platforms/line/client.ts +352 -0
  790. package/src/platforms/line/commands/auth.ts +219 -0
  791. package/src/platforms/line/commands/chat.ts +34 -0
  792. package/src/platforms/line/commands/friend.ts +28 -0
  793. package/src/platforms/line/commands/index.ts +5 -0
  794. package/src/platforms/line/commands/message.ts +59 -0
  795. package/src/platforms/line/commands/profile.ts +24 -0
  796. package/src/platforms/line/credential-manager.test.ts +163 -0
  797. package/src/platforms/line/credential-manager.ts +99 -0
  798. package/src/platforms/line/ensure-auth.ts +13 -0
  799. package/src/platforms/line/index.test.ts +48 -0
  800. package/src/platforms/line/index.ts +27 -0
  801. package/src/platforms/line/listener.test.ts +341 -0
  802. package/src/platforms/line/listener.ts +138 -0
  803. package/src/platforms/line/types.test.ts +157 -0
  804. package/src/platforms/line/types.ts +181 -0
  805. package/src/platforms/slack/cli.ts +10 -0
  806. package/src/platforms/slack/client.test.ts +703 -69
  807. package/src/platforms/slack/client.ts +664 -43
  808. package/src/platforms/slack/commands/activity.ts +1 -1
  809. package/src/platforms/slack/commands/auth.ts +2 -2
  810. package/src/platforms/slack/commands/bookmark.test.ts +91 -0
  811. package/src/platforms/slack/commands/bookmark.ts +148 -0
  812. package/src/platforms/slack/commands/channel.test.ts +47 -1
  813. package/src/platforms/slack/commands/channel.ts +255 -4
  814. package/src/platforms/slack/commands/drafts.ts +1 -1
  815. package/src/platforms/slack/commands/emoji.test.ts +32 -0
  816. package/src/platforms/slack/commands/emoji.ts +33 -0
  817. package/src/platforms/slack/commands/file.ts +30 -4
  818. package/src/platforms/slack/commands/index.ts +5 -0
  819. package/src/platforms/slack/commands/message.ts +173 -7
  820. package/src/platforms/slack/commands/pin.test.ts +72 -0
  821. package/src/platforms/slack/commands/pin.ts +93 -0
  822. package/src/platforms/slack/commands/reaction.ts +3 -3
  823. package/src/platforms/slack/commands/reminder.test.ts +86 -0
  824. package/src/platforms/slack/commands/reminder.ts +125 -0
  825. package/src/platforms/slack/commands/saved.ts +1 -1
  826. package/src/platforms/slack/commands/sections.ts +1 -1
  827. package/src/platforms/slack/commands/snapshot.test.ts +4 -4
  828. package/src/platforms/slack/commands/snapshot.ts +14 -1
  829. package/src/platforms/slack/commands/unread.test.ts +3 -3
  830. package/src/platforms/slack/commands/unread.ts +3 -3
  831. package/src/platforms/slack/commands/user.ts +90 -1
  832. package/src/platforms/slack/commands/usergroup.test.ts +157 -0
  833. package/src/platforms/slack/commands/usergroup.ts +242 -0
  834. package/src/platforms/slack/credential-manager.ts +3 -1
  835. package/src/platforms/slack/ensure-auth.ts +4 -4
  836. package/src/platforms/slack/index.test.ts +59 -0
  837. package/src/platforms/slack/index.ts +46 -1
  838. package/src/platforms/slack/listener.test.ts +370 -0
  839. package/src/platforms/slack/listener.ts +181 -0
  840. package/src/platforms/slack/types.ts +187 -0
  841. package/src/platforms/slackbot/client.test.ts +26 -26
  842. package/src/platforms/slackbot/client.ts +40 -22
  843. package/src/platforms/slackbot/commands/auth.test.ts +1 -5
  844. package/src/platforms/slackbot/commands/auth.ts +2 -2
  845. package/src/platforms/slackbot/commands/shared.ts +1 -1
  846. package/src/platforms/teams/client.test.ts +34 -34
  847. package/src/platforms/teams/client.ts +32 -9
  848. package/src/platforms/teams/commands/auth.test.ts +2 -2
  849. package/src/platforms/teams/commands/auth.ts +3 -3
  850. package/src/platforms/teams/commands/channel.test.ts +6 -6
  851. package/src/platforms/teams/commands/channel.ts +3 -3
  852. package/src/platforms/teams/commands/file.ts +3 -3
  853. package/src/platforms/teams/commands/message.ts +4 -4
  854. package/src/platforms/teams/commands/reaction.ts +2 -2
  855. package/src/platforms/teams/commands/snapshot.ts +1 -1
  856. package/src/platforms/teams/commands/team.test.ts +2 -2
  857. package/src/platforms/teams/commands/team.ts +1 -1
  858. package/src/platforms/teams/commands/user.ts +3 -3
  859. package/src/platforms/teams/ensure-auth.ts +1 -1
  860. package/src/platforms/teams/index.test.ts +74 -0
  861. package/src/platforms/teams/index.ts +30 -0
  862. package/src/platforms/telegram/app-config.test.ts +44 -0
  863. package/src/platforms/telegram/app-config.ts +53 -0
  864. package/src/platforms/telegram/chat-utils.test.ts +71 -0
  865. package/src/platforms/telegram/chat-utils.ts +39 -0
  866. package/src/platforms/telegram/cli.ts +20 -0
  867. package/src/platforms/telegram/client.test.ts +90 -0
  868. package/src/platforms/telegram/client.ts +623 -0
  869. package/src/platforms/telegram/commands/auth.test.ts +113 -0
  870. package/src/platforms/telegram/commands/auth.ts +662 -0
  871. package/src/platforms/telegram/commands/chat.ts +65 -0
  872. package/src/platforms/telegram/commands/index.ts +3 -0
  873. package/src/platforms/telegram/commands/message.ts +51 -0
  874. package/src/platforms/telegram/commands/shared.test.ts +15 -0
  875. package/src/platforms/telegram/commands/shared.ts +50 -0
  876. package/src/platforms/telegram/credential-manager.test.ts +152 -0
  877. package/src/platforms/telegram/credential-manager.ts +203 -0
  878. package/src/platforms/telegram/my-telegram-org.ts +206 -0
  879. package/src/platforms/telegram/tdlib.ts +159 -0
  880. package/src/platforms/telegram/types.test.ts +74 -0
  881. package/src/platforms/telegram/types.ts +417 -0
  882. package/src/platforms/whatsapp/cli.ts +38 -0
  883. package/src/platforms/whatsapp/client.ts +526 -0
  884. package/src/platforms/whatsapp/commands/auth.ts +205 -0
  885. package/src/platforms/whatsapp/commands/chat.ts +49 -0
  886. package/src/platforms/whatsapp/commands/index.ts +3 -0
  887. package/src/platforms/whatsapp/commands/message.ts +79 -0
  888. package/src/platforms/whatsapp/commands/shared.ts +61 -0
  889. package/src/platforms/whatsapp/credential-manager.test.ts +278 -0
  890. package/src/platforms/whatsapp/credential-manager.ts +134 -0
  891. package/src/platforms/whatsapp/ensure-auth.test.ts +85 -0
  892. package/src/platforms/whatsapp/ensure-auth.ts +26 -0
  893. package/src/platforms/whatsapp/index.test.ts +39 -0
  894. package/src/platforms/whatsapp/index.ts +16 -0
  895. package/src/platforms/whatsapp/suppress-ws-warnings.ts +21 -0
  896. package/src/platforms/whatsapp/types.test.ts +190 -0
  897. package/src/platforms/whatsapp/types.ts +95 -0
  898. package/src/platforms/whatsappbot/cli.ts +23 -0
  899. package/src/platforms/whatsappbot/client.test.ts +411 -0
  900. package/src/platforms/whatsappbot/client.ts +256 -0
  901. package/src/platforms/whatsappbot/commands/auth.ts +206 -0
  902. package/src/platforms/whatsappbot/commands/index.ts +3 -0
  903. package/src/platforms/whatsappbot/commands/message.ts +148 -0
  904. package/src/platforms/whatsappbot/commands/shared.ts +22 -0
  905. package/src/platforms/whatsappbot/commands/template.ts +69 -0
  906. package/src/platforms/whatsappbot/credential-manager.test.ts +303 -0
  907. package/src/platforms/whatsappbot/credential-manager.ts +148 -0
  908. package/src/platforms/whatsappbot/index.test.ts +34 -0
  909. package/src/platforms/whatsappbot/index.ts +18 -0
  910. package/src/platforms/whatsappbot/types.test.ts +141 -0
  911. package/src/platforms/whatsappbot/types.ts +71 -0
  912. package/src/tui/adapters/channeltalk-adapter.ts +102 -0
  913. package/src/tui/adapters/discord-adapter.ts +112 -0
  914. package/src/tui/adapters/instagram-adapter.ts +132 -0
  915. package/src/tui/adapters/kakaotalk-adapter.ts +163 -0
  916. package/src/tui/adapters/line-adapter.ts +109 -0
  917. package/src/tui/adapters/slack-adapter.ts +128 -0
  918. package/src/tui/adapters/teams-adapter.ts +95 -0
  919. package/src/tui/adapters/telegram-adapter.ts +203 -0
  920. package/src/tui/adapters/types.ts +43 -0
  921. package/src/tui/adapters/whatsapp-adapter.ts +138 -0
  922. package/src/tui/app.ts +689 -0
  923. package/src/tui/cli.ts +18 -0
  924. package/src/tui/utils.test.ts +149 -0
  925. package/src/tui/utils.ts +58 -0
  926. package/src/tui/views/channel-picker.ts +146 -0
  927. package/src/tui/views/workspace-picker.ts +146 -0
  928. package/docs/content/docs/integrations/meta.json +0 -5
  929. package/docs/content/docs/integrations/slack.mdx +0 -218
  930. package/docs/content/docs/{integrations → cli}/discord.mdx +19 -19
  931. package/docs/content/docs/{integrations → cli}/discordbot.mdx +8 -8
@@ -46,23 +46,23 @@ function resetMocks() {
46
46
  }
47
47
 
48
48
  describe('SlackClient', () => {
49
- describe('constructor', () => {
50
- test('throws SlackError when token is empty', () => {
51
- expect(() => new SlackClient('', 'xoxd-cookie')).toThrow(SlackError)
52
- expect(() => new SlackClient('', 'xoxd-cookie')).toThrow('Token is required')
49
+ describe('login', () => {
50
+ test('throws SlackError when token is empty', async () => {
51
+ await expect(new SlackClient().login({ token: '', cookie: 'xoxd-cookie' })).rejects.toThrow(SlackError)
52
+ await expect(new SlackClient().login({ token: '', cookie: 'xoxd-cookie' })).rejects.toThrow('Token is required')
53
53
  })
54
54
 
55
- test('throws SlackError when cookie is empty', () => {
56
- expect(() => new SlackClient('xoxc-token', '')).toThrow(SlackError)
57
- expect(() => new SlackClient('xoxc-token', '')).toThrow('Cookie is required')
55
+ test('throws SlackError when cookie is empty', async () => {
56
+ await expect(new SlackClient().login({ token: 'xoxc-token', cookie: '' })).rejects.toThrow(SlackError)
57
+ await expect(new SlackClient().login({ token: 'xoxc-token', cookie: '' })).rejects.toThrow('Cookie is required')
58
58
  })
59
59
 
60
- test('throws SlackError when both token and cookie are empty', () => {
61
- expect(() => new SlackClient('', '')).toThrow(SlackError)
60
+ test('throws SlackError when both token and cookie are empty', async () => {
61
+ await expect(new SlackClient().login({ token: '', cookie: '' })).rejects.toThrow(SlackError)
62
62
  })
63
63
 
64
- test('creates client successfully with valid token and cookie', () => {
65
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
64
+ test('creates client successfully with valid token and cookie', async () => {
65
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
66
66
  expect(client).toBeInstanceOf(SlackClient)
67
67
  })
68
68
  })
@@ -79,7 +79,7 @@ describe('SlackClient', () => {
79
79
  team: 'Test Team',
80
80
  })
81
81
 
82
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
82
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
83
83
  // @ts-expect-error - accessing private property for testing
84
84
  client.client = mockWebClient as unknown as WebClient
85
85
 
@@ -94,7 +94,7 @@ describe('SlackClient', () => {
94
94
  error: 'invalid_auth',
95
95
  })
96
96
 
97
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
97
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
98
98
  // @ts-expect-error - accessing private property for testing
99
99
  client.client = mockWebClient as unknown as WebClient
100
100
 
@@ -128,7 +128,7 @@ describe('SlackClient', () => {
128
128
  ],
129
129
  })
130
130
 
131
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
131
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
132
132
  // @ts-expect-error - accessing private property for testing
133
133
  client.client = mockWebClient as unknown as WebClient
134
134
 
@@ -168,7 +168,7 @@ describe('SlackClient', () => {
168
168
  ],
169
169
  })
170
170
 
171
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
171
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
172
172
  // @ts-expect-error - accessing private property for testing
173
173
  client.client = mockWebClient as unknown as WebClient
174
174
 
@@ -183,7 +183,7 @@ describe('SlackClient', () => {
183
183
  error: 'channel_not_found',
184
184
  })
185
185
 
186
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
186
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
187
187
  // @ts-expect-error - accessing private property for testing
188
188
  client.client = mockWebClient as unknown as WebClient
189
189
 
@@ -207,7 +207,7 @@ describe('SlackClient', () => {
207
207
  },
208
208
  })
209
209
 
210
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
210
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
211
211
  // @ts-expect-error - accessing private property for testing
212
212
  client.client = mockWebClient as unknown as WebClient
213
213
 
@@ -222,7 +222,7 @@ describe('SlackClient', () => {
222
222
  error: 'channel_not_found',
223
223
  })
224
224
 
225
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
225
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
226
226
  // @ts-expect-error - accessing private property for testing
227
227
  client.client = mockWebClient as unknown as WebClient
228
228
 
@@ -234,19 +234,19 @@ describe('SlackClient', () => {
234
234
  beforeEach(() => resetMocks())
235
235
 
236
236
  test('returns channel ID unchanged when input starts with C', async () => {
237
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
237
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
238
238
  const channel = await client.resolveChannel('C123ABC')
239
239
  expect(channel).toBe('C123ABC')
240
240
  })
241
241
 
242
242
  test('returns channel ID unchanged when input starts with D', async () => {
243
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
243
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
244
244
  const channel = await client.resolveChannel('D123ABC')
245
245
  expect(channel).toBe('D123ABC')
246
246
  })
247
247
 
248
248
  test('returns channel ID unchanged when input starts with G', async () => {
249
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
249
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
250
250
  const channel = await client.resolveChannel('G123ABC')
251
251
  expect(channel).toBe('G123ABC')
252
252
  })
@@ -266,7 +266,7 @@ describe('SlackClient', () => {
266
266
  ],
267
267
  })
268
268
 
269
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
269
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
270
270
  // @ts-expect-error - accessing private property for testing
271
271
  client.client = mockWebClient as unknown as WebClient
272
272
 
@@ -290,7 +290,7 @@ describe('SlackClient', () => {
290
290
  ],
291
291
  })
292
292
 
293
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
293
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
294
294
  // @ts-expect-error - accessing private property for testing
295
295
  client.client = mockWebClient as unknown as WebClient
296
296
 
@@ -300,7 +300,7 @@ describe('SlackClient', () => {
300
300
  })
301
301
 
302
302
  test('returns channel ID unchanged when input is #C prefixed ID', async () => {
303
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
303
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
304
304
  const channel = await client.resolveChannel('#C123ABC')
305
305
  expect(channel).toBe('C123ABC')
306
306
  })
@@ -320,7 +320,7 @@ describe('SlackClient', () => {
320
320
  ],
321
321
  })
322
322
 
323
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
323
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
324
324
  // @ts-expect-error - accessing private property for testing
325
325
  client.client = mockWebClient as unknown as WebClient
326
326
 
@@ -345,7 +345,7 @@ describe('SlackClient', () => {
345
345
  messages,
346
346
  })
347
347
 
348
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
348
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
349
349
  // @ts-expect-error - accessing private property for testing
350
350
  client.client = mockWebClient as unknown as WebClient
351
351
 
@@ -362,7 +362,7 @@ describe('SlackClient', () => {
362
362
  messages: [{ ts: '123.456', text: 'Hello', type: 'message' }],
363
363
  })
364
364
 
365
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
365
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
366
366
  // @ts-expect-error - accessing private property for testing
367
367
  client.client = mockWebClient as unknown as WebClient
368
368
 
@@ -378,7 +378,7 @@ describe('SlackClient', () => {
378
378
  error: 'channel_not_found',
379
379
  })
380
380
 
381
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
381
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
382
382
  // @ts-expect-error - accessing private property for testing
383
383
  client.client = mockWebClient as unknown as WebClient
384
384
 
@@ -396,7 +396,7 @@ describe('SlackClient', () => {
396
396
  message: { ts: '123.456', text: 'Hello', type: 'message' },
397
397
  })
398
398
 
399
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
399
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
400
400
  // @ts-expect-error - accessing private property for testing
401
401
  client.client = mockWebClient as unknown as WebClient
402
402
 
@@ -414,7 +414,7 @@ describe('SlackClient', () => {
414
414
  message: { ts: '123.789', text: 'Reply', type: 'message', thread_ts: '123.456' },
415
415
  })
416
416
 
417
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
417
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
418
418
  // @ts-expect-error - accessing private property for testing
419
419
  client.client = mockWebClient as unknown as WebClient
420
420
 
@@ -431,7 +431,7 @@ describe('SlackClient', () => {
431
431
  error: 'channel_not_found',
432
432
  })
433
433
 
434
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
434
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
435
435
  // @ts-expect-error - accessing private property for testing
436
436
  client.client = mockWebClient as unknown as WebClient
437
437
 
@@ -449,7 +449,7 @@ describe('SlackClient', () => {
449
449
  message: { ts: '123.456', text: 'Updated', type: 'message' },
450
450
  })
451
451
 
452
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
452
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
453
453
  // @ts-expect-error - accessing private property for testing
454
454
  client.client = mockWebClient as unknown as WebClient
455
455
 
@@ -466,7 +466,7 @@ describe('SlackClient', () => {
466
466
  error: 'message_not_found',
467
467
  })
468
468
 
469
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
469
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
470
470
  // @ts-expect-error - accessing private property for testing
471
471
  client.client = mockWebClient as unknown as WebClient
472
472
 
@@ -480,7 +480,7 @@ describe('SlackClient', () => {
480
480
  test('deletes message', async () => {
481
481
  mockWebClient.chat.delete.mockResolvedValue({ ok: true })
482
482
 
483
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
483
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
484
484
  // @ts-expect-error - accessing private property for testing
485
485
  client.client = mockWebClient as unknown as WebClient
486
486
 
@@ -496,7 +496,7 @@ describe('SlackClient', () => {
496
496
  error: 'message_not_found',
497
497
  })
498
498
 
499
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
499
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
500
500
  // @ts-expect-error - accessing private property for testing
501
501
  client.client = mockWebClient as unknown as WebClient
502
502
 
@@ -510,7 +510,7 @@ describe('SlackClient', () => {
510
510
  test('adds reaction to message', async () => {
511
511
  mockWebClient.reactions.add.mockResolvedValue({ ok: true })
512
512
 
513
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
513
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
514
514
  // @ts-expect-error - accessing private property for testing
515
515
  client.client = mockWebClient as unknown as WebClient
516
516
 
@@ -526,7 +526,7 @@ describe('SlackClient', () => {
526
526
  error: 'already_reacted',
527
527
  })
528
528
 
529
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
529
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
530
530
  // @ts-expect-error - accessing private property for testing
531
531
  client.client = mockWebClient as unknown as WebClient
532
532
 
@@ -540,7 +540,7 @@ describe('SlackClient', () => {
540
540
  test('removes reaction from message', async () => {
541
541
  mockWebClient.reactions.remove.mockResolvedValue({ ok: true })
542
542
 
543
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
543
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
544
544
  // @ts-expect-error - accessing private property for testing
545
545
  client.client = mockWebClient as unknown as WebClient
546
546
 
@@ -556,7 +556,7 @@ describe('SlackClient', () => {
556
556
  error: 'no_reaction',
557
557
  })
558
558
 
559
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
559
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
560
560
  // @ts-expect-error - accessing private property for testing
561
561
  client.client = mockWebClient as unknown as WebClient
562
562
 
@@ -592,7 +592,7 @@ describe('SlackClient', () => {
592
592
  ],
593
593
  })
594
594
 
595
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
595
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
596
596
  // @ts-expect-error - accessing private property for testing
597
597
  client.client = mockWebClient as unknown as WebClient
598
598
 
@@ -634,7 +634,7 @@ describe('SlackClient', () => {
634
634
  ],
635
635
  })
636
636
 
637
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
637
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
638
638
  // @ts-expect-error - accessing private property for testing
639
639
  client.client = mockWebClient as unknown as WebClient
640
640
 
@@ -649,7 +649,7 @@ describe('SlackClient', () => {
649
649
  error: 'invalid_auth',
650
650
  })
651
651
 
652
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
652
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
653
653
  // @ts-expect-error - accessing private property for testing
654
654
  client.client = mockWebClient as unknown as WebClient
655
655
 
@@ -666,7 +666,7 @@ describe('SlackClient', () => {
666
666
  members: ['U123', 'U456', 'U789'],
667
667
  })
668
668
 
669
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
669
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
670
670
  // @ts-expect-error - accessing private property for testing
671
671
  client.client = mockWebClient as unknown as WebClient
672
672
 
@@ -689,7 +689,7 @@ describe('SlackClient', () => {
689
689
  members: ['U789'],
690
690
  })
691
691
 
692
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
692
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
693
693
  // @ts-expect-error - accessing private property for testing
694
694
  client.client = mockWebClient as unknown as WebClient
695
695
 
@@ -704,7 +704,7 @@ describe('SlackClient', () => {
704
704
  error: 'channel_not_found',
705
705
  })
706
706
 
707
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
707
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
708
708
  // @ts-expect-error - accessing private property for testing
709
709
  client.client = mockWebClient as unknown as WebClient
710
710
 
@@ -729,7 +729,7 @@ describe('SlackClient', () => {
729
729
  },
730
730
  })
731
731
 
732
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
732
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
733
733
  // @ts-expect-error - accessing private property for testing
734
734
  client.client = mockWebClient as unknown as WebClient
735
735
 
@@ -744,7 +744,7 @@ describe('SlackClient', () => {
744
744
  error: 'user_not_found',
745
745
  })
746
746
 
747
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
747
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
748
748
  // @ts-expect-error - accessing private property for testing
749
749
  client.client = mockWebClient as unknown as WebClient
750
750
 
@@ -777,7 +777,7 @@ describe('SlackClient', () => {
777
777
  ],
778
778
  })
779
779
 
780
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
780
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
781
781
  // @ts-expect-error - accessing private property for testing
782
782
  client.client = mockWebClient as unknown as WebClient
783
783
 
@@ -794,7 +794,7 @@ describe('SlackClient', () => {
794
794
  error: 'file_upload_failed',
795
795
  })
796
796
 
797
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
797
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
798
798
  // @ts-expect-error - accessing private property for testing
799
799
  client.client = mockWebClient as unknown as WebClient
800
800
 
@@ -807,7 +807,7 @@ describe('SlackClient', () => {
807
807
  files: [],
808
808
  })
809
809
 
810
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
810
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
811
811
  // @ts-expect-error - accessing private property for testing
812
812
  client.client = mockWebClient as unknown as WebClient
813
813
 
@@ -820,7 +820,7 @@ describe('SlackClient', () => {
820
820
  files: [{ ok: true, files: [] }],
821
821
  })
822
822
 
823
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
823
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
824
824
  // @ts-expect-error - accessing private property for testing
825
825
  client.client = mockWebClient as unknown as WebClient
826
826
 
@@ -848,7 +848,7 @@ describe('SlackClient', () => {
848
848
  ],
849
849
  })
850
850
 
851
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
851
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
852
852
  // @ts-expect-error - accessing private property for testing
853
853
  client.client = mockWebClient as unknown as WebClient
854
854
 
@@ -863,7 +863,7 @@ describe('SlackClient', () => {
863
863
  files: [],
864
864
  })
865
865
 
866
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
866
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
867
867
  // @ts-expect-error - accessing private property for testing
868
868
  client.client = mockWebClient as unknown as WebClient
869
869
 
@@ -877,7 +877,7 @@ describe('SlackClient', () => {
877
877
  error: 'invalid_auth',
878
878
  })
879
879
 
880
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
880
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
881
881
  // @ts-expect-error - accessing private property for testing
882
882
  client.client = mockWebClient as unknown as WebClient
883
883
 
@@ -904,7 +904,7 @@ describe('SlackClient', () => {
904
904
  },
905
905
  })
906
906
 
907
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
907
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
908
908
  // @ts-expect-error - accessing private property for testing
909
909
  client.client = mockWebClient as unknown as WebClient
910
910
 
@@ -917,7 +917,7 @@ describe('SlackClient', () => {
917
917
  test('throws on API failure', async () => {
918
918
  mockWebClient.files.info.mockResolvedValue({ ok: false, error: 'file_not_found' })
919
919
 
920
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
920
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
921
921
  // @ts-expect-error - accessing private property for testing
922
922
  client.client = mockWebClient as unknown as WebClient
923
923
 
@@ -947,7 +947,7 @@ describe('SlackClient', () => {
947
947
  globalThis.fetch = async () => new Response(Buffer.from('test content'), { status: 200 })
948
948
 
949
949
  try {
950
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
950
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
951
951
  // @ts-expect-error - accessing private property for testing
952
952
  client.client = mockWebClient as unknown as WebClient
953
953
 
@@ -975,7 +975,7 @@ describe('SlackClient', () => {
975
975
  },
976
976
  })
977
977
 
978
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
978
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
979
979
  // @ts-expect-error - accessing private property for testing
980
980
  client.client = mockWebClient as unknown as WebClient
981
981
 
@@ -1001,7 +1001,7 @@ describe('SlackClient', () => {
1001
1001
  globalThis.fetch = async () => new Response('Forbidden', { status: 403, statusText: 'Forbidden' })
1002
1002
 
1003
1003
  try {
1004
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1004
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1005
1005
  // @ts-expect-error - accessing private property for testing
1006
1006
  client.client = mockWebClient as unknown as WebClient
1007
1007
 
@@ -1034,7 +1034,7 @@ describe('SlackClient', () => {
1034
1034
  }
1035
1035
 
1036
1036
  try {
1037
- const client = new SlackClient('xoxc-test-token', 'xoxd-test-cookie')
1037
+ const client = await new SlackClient().login({ token: 'xoxc-test-token', cookie: 'xoxd-test-cookie' })
1038
1038
  // @ts-expect-error - accessing private property for testing
1039
1039
  client.client = mockWebClient as unknown as WebClient
1040
1040
 
@@ -1080,7 +1080,7 @@ describe('SlackClient', () => {
1080
1080
  has_more: false,
1081
1081
  })
1082
1082
 
1083
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1083
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1084
1084
  // @ts-expect-error - accessing private property for testing
1085
1085
  client.client = mockWebClient as unknown as WebClient
1086
1086
 
@@ -1100,7 +1100,7 @@ describe('SlackClient', () => {
1100
1100
  has_more: false,
1101
1101
  })
1102
1102
 
1103
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1103
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1104
1104
  // @ts-expect-error - accessing private property for testing
1105
1105
  client.client = mockWebClient as unknown as WebClient
1106
1106
 
@@ -1117,7 +1117,7 @@ describe('SlackClient', () => {
1117
1117
  has_more: false,
1118
1118
  })
1119
1119
 
1120
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1120
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1121
1121
  // @ts-expect-error - accessing private property for testing
1122
1122
  client.client = mockWebClient as unknown as WebClient
1123
1123
 
@@ -1143,7 +1143,7 @@ describe('SlackClient', () => {
1143
1143
  response_metadata: { next_cursor: 'cursor123' },
1144
1144
  })
1145
1145
 
1146
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1146
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1147
1147
  // @ts-expect-error - accessing private property for testing
1148
1148
  client.client = mockWebClient as unknown as WebClient
1149
1149
 
@@ -1158,7 +1158,7 @@ describe('SlackClient', () => {
1158
1158
  error: 'thread_not_found',
1159
1159
  })
1160
1160
 
1161
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1161
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1162
1162
  // @ts-expect-error - accessing private property for testing
1163
1163
  client.client = mockWebClient as unknown as WebClient
1164
1164
 
@@ -1171,7 +1171,7 @@ describe('SlackClient', () => {
1171
1171
  error: 'channel_not_found',
1172
1172
  })
1173
1173
 
1174
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1174
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1175
1175
  // @ts-expect-error - accessing private property for testing
1176
1176
  client.client = mockWebClient as unknown as WebClient
1177
1177
 
@@ -1204,7 +1204,7 @@ describe('SlackClient', () => {
1204
1204
  ],
1205
1205
  })
1206
1206
 
1207
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1207
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1208
1208
  // @ts-expect-error - accessing private property for testing
1209
1209
  client.client = mockWebClient as unknown as WebClient
1210
1210
 
@@ -1220,7 +1220,7 @@ describe('SlackClient', () => {
1220
1220
 
1221
1221
  mockWebClient.conversations.list.mockRejectedValue(rateLimitError)
1222
1222
 
1223
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1223
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1224
1224
  // @ts-expect-error - accessing private property for testing
1225
1225
  client.client = mockWebClient as unknown as WebClient
1226
1226
 
@@ -1235,7 +1235,7 @@ describe('SlackClient', () => {
1235
1235
 
1236
1236
  mockWebClient.conversations.list.mockRejectedValue(otherError)
1237
1237
 
1238
- const client = new SlackClient('xoxc-token', 'xoxd-cookie')
1238
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1239
1239
  // @ts-expect-error - accessing private property for testing
1240
1240
  client.client = mockWebClient as unknown as WebClient
1241
1241
 
@@ -1263,3 +1263,637 @@ describe('SlackClient', () => {
1263
1263
  })
1264
1264
  })
1265
1265
  })
1266
+
1267
+ describe('SlackClient extended methods', () => {
1268
+ async function makeClient() {
1269
+ const client = await new SlackClient().login({ token: 'xoxc-token', cookie: 'xoxd-cookie' })
1270
+ const mock: any = {
1271
+ pins: {
1272
+ add: mock_fn(() => Promise.resolve({ ok: true })),
1273
+ remove: mock_fn(() => Promise.resolve({ ok: true })),
1274
+ list: mock_fn(() => Promise.resolve({ ok: true, items: [] })),
1275
+ },
1276
+ conversations: {
1277
+ create: mock_fn(() => Promise.resolve({ ok: true, channel: { id: 'C001', name: 'test', is_private: false, is_archived: false, created: 0, creator: 'U001' } })),
1278
+ archive: mock_fn(() => Promise.resolve({ ok: true })),
1279
+ setTopic: mock_fn(() => Promise.resolve({ ok: true, topic: 'new-topic' })),
1280
+ setPurpose: mock_fn(() => Promise.resolve({ ok: true, purpose: 'new-purpose' })),
1281
+ invite: mock_fn(() => Promise.resolve({ ok: true, channel: { id: 'C001', name: 'test', is_private: false, is_archived: false, created: 0, creator: 'U001' } })),
1282
+ join: mock_fn(() => Promise.resolve({ ok: true, channel: { id: 'C001', name: 'test', is_private: false, is_archived: false, created: 0, creator: 'U001' } })),
1283
+ leave: mock_fn(() => Promise.resolve({ ok: true })),
1284
+ list: mock_fn(() => Promise.resolve({ ok: true, channels: [] })),
1285
+ },
1286
+ chat: {
1287
+ scheduleMessage: mock_fn(() => Promise.resolve({ ok: true, scheduled_message_id: 'SM001' })),
1288
+ scheduledMessages: {
1289
+ list: mock_fn(() => Promise.resolve({ ok: true, scheduled_messages: [] })),
1290
+ },
1291
+ deleteScheduledMessage: mock_fn(() => Promise.resolve({ ok: true })),
1292
+ postEphemeral: mock_fn(() => Promise.resolve({ ok: true, message_ts: '123.456' })),
1293
+ getPermalink: mock_fn(() => Promise.resolve({ ok: true, permalink: 'https://slack.com/archives/C001/p123456' })),
1294
+ },
1295
+ users: {
1296
+ lookupByEmail: mock_fn(() => Promise.resolve({ ok: true, user: { id: 'U001', name: 'test', real_name: 'Test User', is_admin: false, is_owner: false, is_bot: false, is_app_user: false } })),
1297
+ profile: {
1298
+ get: mock_fn(() => Promise.resolve({ ok: true, profile: { display_name: 'Test', status_text: '', status_emoji: '' } })),
1299
+ set: mock_fn(() => Promise.resolve({ ok: true, profile: { display_name: 'Test', status_text: 'Working', status_emoji: ':computer:' } })),
1300
+ },
1301
+ },
1302
+ reminders: {
1303
+ add: mock_fn(() => Promise.resolve({ ok: true, reminder: { id: 'Rm001', creator: 'U001', text: 'Test', user: 'U001', recurring: false, time: 1700000000, complete_ts: 0 } })),
1304
+ list: mock_fn(() => Promise.resolve({ ok: true, reminders: [] })),
1305
+ complete: mock_fn(() => Promise.resolve({ ok: true })),
1306
+ delete: mock_fn(() => Promise.resolve({ ok: true })),
1307
+ },
1308
+ files: {
1309
+ delete: mock_fn(() => Promise.resolve({ ok: true })),
1310
+ },
1311
+ emoji: {
1312
+ list: mock_fn(() => Promise.resolve({ ok: true, emoji: { party_blob: 'https://example.com/party_blob.gif' } })),
1313
+ },
1314
+ apiCall: mock_fn((method: string) => {
1315
+ if (method === 'bookmarks.add') return Promise.resolve({ ok: true, bookmark: { id: 'Bm001', channel_id: 'C001', title: 'Test', link: 'https://example.com', type: 'link', date_created: 0, date_updated: 0, created_by: 'U001' } })
1316
+ if (method === 'bookmarks.edit') return Promise.resolve({ ok: true, bookmark: { id: 'Bm001', channel_id: 'C001', title: 'Updated', link: 'https://example.com', type: 'link', date_created: 0, date_updated: 1, created_by: 'U001' } })
1317
+ if (method === 'bookmarks.remove') return Promise.resolve({ ok: true })
1318
+ if (method === 'bookmarks.list') return Promise.resolve({ ok: true, bookmarks: [] })
1319
+ if (method === 'usergroups.list') return Promise.resolve({ ok: true, usergroups: [{ id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: 'Eng team', is_external: false, is_usergroup: true, date_create: 100, date_update: 200, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001'], user_count: 1 }] })
1320
+ if (method === 'usergroups.create') return Promise.resolve({ ok: true, usergroup: { id: 'S002', team_id: 'T001', name: 'Marketing', handle: 'marketing', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 100, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: [], user_count: 0 } })
1321
+ if (method === 'usergroups.update') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Updated', handle: 'updated', description: 'New desc', is_external: false, is_usergroup: true, date_create: 100, date_update: 300, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001'], user_count: 1 } })
1322
+ if (method === 'usergroups.disable') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 300, date_delete: 400, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: 'U001', prefs: { channels: [], groups: [] }, users: [], user_count: 0 } })
1323
+ if (method === 'usergroups.enable') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 500, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001'], user_count: 1 } })
1324
+ if (method === 'usergroups.users.list') return Promise.resolve({ ok: true, users: ['U001', 'U002'] })
1325
+ if (method === 'usergroups.users.update') return Promise.resolve({ ok: true, usergroup: { id: 'S001', team_id: 'T001', name: 'Engineering', handle: 'engineering', description: '', is_external: false, is_usergroup: true, date_create: 100, date_update: 600, date_delete: 0, auto_type: null, created_by: 'U001', updated_by: 'U001', deleted_by: null, prefs: { channels: [], groups: [] }, users: ['U001', 'U003'], user_count: 2 } })
1326
+ return Promise.resolve({ ok: true })
1327
+ }),
1328
+ }
1329
+ // @ts-expect-error - accessing private property for testing
1330
+ client.client = mock
1331
+ return { client, mock }
1332
+ }
1333
+
1334
+ function mock_fn(impl: (...args: any[]) => any) {
1335
+ return mock(impl)
1336
+ }
1337
+
1338
+ describe('pinMessage', () => {
1339
+ test('calls pins.add with correct args', async () => {
1340
+ const { client, mock } = await makeClient()
1341
+ await client.pinMessage('C001', '123.456')
1342
+ expect(mock.pins.add).toHaveBeenCalledWith({ channel: 'C001', timestamp: '123.456' })
1343
+ })
1344
+
1345
+ test('throws SlackError on API failure', async () => {
1346
+ const { client, mock } = await makeClient()
1347
+ mock.pins.add.mockResolvedValue({ ok: false, error: 'not_pinned' })
1348
+ await expect(client.pinMessage('C001', '123.456')).rejects.toThrow(SlackError)
1349
+ })
1350
+ })
1351
+
1352
+ describe('unpinMessage', () => {
1353
+ test('calls pins.remove with correct args', async () => {
1354
+ const { client, mock } = await makeClient()
1355
+ await client.unpinMessage('C001', '123.456')
1356
+ expect(mock.pins.remove).toHaveBeenCalledWith({ channel: 'C001', timestamp: '123.456' })
1357
+ })
1358
+
1359
+ test('throws SlackError on API failure', async () => {
1360
+ const { client, mock } = await makeClient()
1361
+ mock.pins.remove.mockResolvedValue({ ok: false, error: 'no_pin' })
1362
+ await expect(client.unpinMessage('C001', '123.456')).rejects.toThrow(SlackError)
1363
+ })
1364
+ })
1365
+
1366
+ describe('listPins', () => {
1367
+ test('returns mapped pin items', async () => {
1368
+ const { client, mock } = await makeClient()
1369
+ mock.pins.list.mockResolvedValue({
1370
+ ok: true,
1371
+ items: [{ message: { ts: '1.2', text: 'hi', type: 'message' }, created: 100, created_by: 'U001' }],
1372
+ })
1373
+ const pins = await client.listPins('C001')
1374
+ expect(pins).toHaveLength(1)
1375
+ expect(pins[0].message.ts).toBe('1.2')
1376
+ expect(pins[0].created_by).toBe('U001')
1377
+ })
1378
+
1379
+ test('throws SlackError on API failure', async () => {
1380
+ const { client, mock } = await makeClient()
1381
+ mock.pins.list.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1382
+ await expect(client.listPins('C001')).rejects.toThrow(SlackError)
1383
+ })
1384
+ })
1385
+
1386
+ describe('addBookmark', () => {
1387
+ test('calls bookmarks.add and returns bookmark', async () => {
1388
+ const { client } = await makeClient()
1389
+ const result = await client.addBookmark('C001', 'Test', 'https://example.com')
1390
+ expect(result.id).toBe('Bm001')
1391
+ expect(result.title).toBe('Test')
1392
+ })
1393
+
1394
+ test('throws SlackError on API failure', async () => {
1395
+ const { client, mock } = await makeClient()
1396
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1397
+ await expect(client.addBookmark('C001', 'Test', 'https://example.com')).rejects.toThrow(SlackError)
1398
+ })
1399
+ })
1400
+
1401
+ describe('editBookmark', () => {
1402
+ test('calls bookmarks.edit and returns updated bookmark', async () => {
1403
+ const { client } = await makeClient()
1404
+ const result = await client.editBookmark('C001', 'Bm001', { title: 'Updated' })
1405
+ expect(result.title).toBe('Updated')
1406
+ })
1407
+
1408
+ test('throws SlackError on API failure', async () => {
1409
+ const { client, mock } = await makeClient()
1410
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'bookmark_not_found' })
1411
+ await expect(client.editBookmark('C001', 'Bm001', { title: 'X' })).rejects.toThrow(SlackError)
1412
+ })
1413
+ })
1414
+
1415
+ describe('removeBookmark', () => {
1416
+ test('calls bookmarks.remove successfully', async () => {
1417
+ const { client, mock } = await makeClient()
1418
+ await client.removeBookmark('C001', 'Bm001')
1419
+ expect(mock.apiCall).toHaveBeenCalledWith('bookmarks.remove', { channel_id: 'C001', bookmark_id: 'Bm001' })
1420
+ })
1421
+
1422
+ test('throws SlackError on API failure', async () => {
1423
+ const { client, mock } = await makeClient()
1424
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'bookmark_not_found' })
1425
+ await expect(client.removeBookmark('C001', 'Bm001')).rejects.toThrow(SlackError)
1426
+ })
1427
+ })
1428
+
1429
+ describe('listBookmarks', () => {
1430
+ test('returns empty array when no bookmarks', async () => {
1431
+ const { client } = await makeClient()
1432
+ const result = await client.listBookmarks('C001')
1433
+ expect(result).toHaveLength(0)
1434
+ })
1435
+
1436
+ test('throws SlackError on API failure', async () => {
1437
+ const { client, mock } = await makeClient()
1438
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1439
+ await expect(client.listBookmarks('C001')).rejects.toThrow(SlackError)
1440
+ })
1441
+ })
1442
+
1443
+ describe('scheduleMessage', () => {
1444
+ test('returns scheduled message with id', async () => {
1445
+ const { client } = await makeClient()
1446
+ const result = await client.scheduleMessage('C001', 'Hello', 1700000000)
1447
+ expect(result.id).toBe('SM001')
1448
+ expect(result.text).toBe('Hello')
1449
+ expect(result.channel_id).toBe('C001')
1450
+ })
1451
+
1452
+ test('throws SlackError on API failure', async () => {
1453
+ const { client, mock } = await makeClient()
1454
+ mock.chat.scheduleMessage.mockResolvedValue({ ok: false, error: 'invalid_time' })
1455
+ await expect(client.scheduleMessage('C001', 'Hello', 1700000000)).rejects.toThrow(SlackError)
1456
+ })
1457
+ })
1458
+
1459
+ describe('listScheduledMessages', () => {
1460
+ test('returns empty array when no scheduled messages', async () => {
1461
+ const { client } = await makeClient()
1462
+ const result = await client.listScheduledMessages()
1463
+ expect(result).toHaveLength(0)
1464
+ })
1465
+
1466
+ test('throws SlackError on API failure', async () => {
1467
+ const { client, mock } = await makeClient()
1468
+ mock.chat.scheduledMessages.list.mockResolvedValue({ ok: false, error: 'invalid_auth' })
1469
+ await expect(client.listScheduledMessages()).rejects.toThrow(SlackError)
1470
+ })
1471
+ })
1472
+
1473
+ describe('deleteScheduledMessage', () => {
1474
+ test('calls deleteScheduledMessage with correct args', async () => {
1475
+ const { client, mock } = await makeClient()
1476
+ await client.deleteScheduledMessage('C001', 'SM001')
1477
+ expect(mock.chat.deleteScheduledMessage).toHaveBeenCalledWith({ channel: 'C001', scheduled_message_id: 'SM001' })
1478
+ })
1479
+
1480
+ test('throws SlackError on API failure', async () => {
1481
+ const { client, mock } = await makeClient()
1482
+ mock.chat.deleteScheduledMessage.mockResolvedValue({ ok: false, error: 'invalid_scheduled_message_id' })
1483
+ await expect(client.deleteScheduledMessage('C001', 'SM001')).rejects.toThrow(SlackError)
1484
+ })
1485
+ })
1486
+
1487
+ describe('createChannel', () => {
1488
+ test('returns created channel', async () => {
1489
+ const { client } = await makeClient()
1490
+ const ch = await client.createChannel('new-channel')
1491
+ expect(ch.id).toBe('C001')
1492
+ expect(ch.name).toBe('test')
1493
+ })
1494
+
1495
+ test('throws SlackError on API failure', async () => {
1496
+ const { client, mock } = await makeClient()
1497
+ mock.conversations.create.mockResolvedValue({ ok: false, error: 'name_taken' })
1498
+ await expect(client.createChannel('existing')).rejects.toThrow(SlackError)
1499
+ })
1500
+ })
1501
+
1502
+ describe('archiveChannel', () => {
1503
+ test('archives channel successfully', async () => {
1504
+ const { client, mock } = await makeClient()
1505
+ await client.archiveChannel('C001')
1506
+ expect(mock.conversations.archive).toHaveBeenCalledWith({ channel: 'C001' })
1507
+ })
1508
+
1509
+ test('throws SlackError on API failure', async () => {
1510
+ const { client, mock } = await makeClient()
1511
+ mock.conversations.archive.mockResolvedValue({ ok: false, error: 'already_archived' })
1512
+ await expect(client.archiveChannel('C001')).rejects.toThrow(SlackError)
1513
+ })
1514
+ })
1515
+
1516
+ describe('setChannelTopic', () => {
1517
+ test('returns new topic', async () => {
1518
+ const { client } = await makeClient()
1519
+ const result = await client.setChannelTopic('C001', 'new-topic')
1520
+ expect(result.topic).toBe('new-topic')
1521
+ })
1522
+
1523
+ test('throws SlackError on API failure', async () => {
1524
+ const { client, mock } = await makeClient()
1525
+ mock.conversations.setTopic.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1526
+ await expect(client.setChannelTopic('C001', 'topic')).rejects.toThrow(SlackError)
1527
+ })
1528
+ })
1529
+
1530
+ describe('setChannelPurpose', () => {
1531
+ test('returns new purpose', async () => {
1532
+ const { client } = await makeClient()
1533
+ const result = await client.setChannelPurpose('C001', 'new-purpose')
1534
+ expect(result.purpose).toBe('new-purpose')
1535
+ })
1536
+
1537
+ test('throws SlackError on API failure', async () => {
1538
+ const { client, mock } = await makeClient()
1539
+ mock.conversations.setPurpose.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1540
+ await expect(client.setChannelPurpose('C001', 'purpose')).rejects.toThrow(SlackError)
1541
+ })
1542
+ })
1543
+
1544
+ describe('inviteToChannel', () => {
1545
+ test('returns channel after invite', async () => {
1546
+ const { client } = await makeClient()
1547
+ const ch = await client.inviteToChannel('C001', 'U002')
1548
+ expect(ch.id).toBe('C001')
1549
+ })
1550
+
1551
+ test('throws SlackError on API failure', async () => {
1552
+ const { client, mock } = await makeClient()
1553
+ mock.conversations.invite.mockResolvedValue({ ok: false, error: 'user_not_found' })
1554
+ await expect(client.inviteToChannel('C001', 'U999')).rejects.toThrow(SlackError)
1555
+ })
1556
+ })
1557
+
1558
+ describe('joinChannel', () => {
1559
+ test('returns channel after joining', async () => {
1560
+ const { client } = await makeClient()
1561
+ const ch = await client.joinChannel('C001')
1562
+ expect(ch.id).toBe('C001')
1563
+ })
1564
+
1565
+ test('throws SlackError on API failure', async () => {
1566
+ const { client, mock } = await makeClient()
1567
+ mock.conversations.join.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1568
+ await expect(client.joinChannel('C001')).rejects.toThrow(SlackError)
1569
+ })
1570
+ })
1571
+
1572
+ describe('leaveChannel', () => {
1573
+ test('leaves channel successfully', async () => {
1574
+ const { client, mock } = await makeClient()
1575
+ await client.leaveChannel('C001')
1576
+ expect(mock.conversations.leave).toHaveBeenCalledWith({ channel: 'C001' })
1577
+ })
1578
+
1579
+ test('throws SlackError on API failure', async () => {
1580
+ const { client, mock } = await makeClient()
1581
+ mock.conversations.leave.mockResolvedValue({ ok: false, error: 'channel_not_found' })
1582
+ await expect(client.leaveChannel('C001')).rejects.toThrow(SlackError)
1583
+ })
1584
+ })
1585
+
1586
+ describe('lookupUserByEmail', () => {
1587
+ test('returns user for given email', async () => {
1588
+ const { client } = await makeClient()
1589
+ const user = await client.lookupUserByEmail('test@example.com')
1590
+ expect(user.id).toBe('U001')
1591
+ expect(user.name).toBe('test')
1592
+ })
1593
+
1594
+ test('throws SlackError on API failure', async () => {
1595
+ const { client, mock } = await makeClient()
1596
+ mock.users.lookupByEmail.mockResolvedValue({ ok: false, error: 'users_not_found' })
1597
+ await expect(client.lookupUserByEmail('nobody@example.com')).rejects.toThrow(SlackError)
1598
+ })
1599
+ })
1600
+
1601
+ describe('getUserProfile', () => {
1602
+ test('returns user profile', async () => {
1603
+ const { client } = await makeClient()
1604
+ const profile = await client.getUserProfile('U001')
1605
+ expect(profile.display_name).toBe('Test')
1606
+ })
1607
+
1608
+ test('throws SlackError on API failure', async () => {
1609
+ const { client, mock } = await makeClient()
1610
+ mock.users.profile.get.mockResolvedValue({ ok: false, error: 'user_not_found' })
1611
+ await expect(client.getUserProfile('U999')).rejects.toThrow(SlackError)
1612
+ })
1613
+ })
1614
+
1615
+ describe('setUserProfile', () => {
1616
+ test('returns updated profile', async () => {
1617
+ const { client } = await makeClient()
1618
+ const profile = await client.setUserProfile({ status_text: 'Working', status_emoji: ':computer:' })
1619
+ expect(profile.status_text).toBe('Working')
1620
+ })
1621
+
1622
+ test('throws SlackError on API failure', async () => {
1623
+ const { client, mock } = await makeClient()
1624
+ mock.users.profile.set.mockResolvedValue({ ok: false, error: 'invalid_profile' })
1625
+ await expect(client.setUserProfile({ status_text: 'x' })).rejects.toThrow(SlackError)
1626
+ })
1627
+ })
1628
+
1629
+ describe('postEphemeral', () => {
1630
+ test('returns message_ts on success', async () => {
1631
+ const { client } = await makeClient()
1632
+ const ts = await client.postEphemeral('C001', 'U001', 'Hello!')
1633
+ expect(ts).toBe('123.456')
1634
+ })
1635
+
1636
+ test('throws SlackError on API failure', async () => {
1637
+ const { client, mock } = await makeClient()
1638
+ mock.chat.postEphemeral.mockResolvedValue({ ok: false, error: 'user_not_in_channel' })
1639
+ await expect(client.postEphemeral('C001', 'U001', 'Hello!')).rejects.toThrow(SlackError)
1640
+ })
1641
+ })
1642
+
1643
+ describe('getPermalink', () => {
1644
+ test('returns permalink on success', async () => {
1645
+ const { client } = await makeClient()
1646
+ const link = await client.getPermalink('C001', '123.456')
1647
+ expect(link).toBe('https://slack.com/archives/C001/p123456')
1648
+ })
1649
+
1650
+ test('throws SlackError on API failure', async () => {
1651
+ const { client, mock } = await makeClient()
1652
+ mock.chat.getPermalink.mockResolvedValue({ ok: false, error: 'message_not_found' })
1653
+ await expect(client.getPermalink('C001', '123.456')).rejects.toThrow(SlackError)
1654
+ })
1655
+ })
1656
+
1657
+ describe('addReminder', () => {
1658
+ test('returns reminder on success', async () => {
1659
+ const { client } = await makeClient()
1660
+ const reminder = await client.addReminder('Do something', 1700000000)
1661
+ expect(reminder.id).toBe('Rm001')
1662
+ expect(reminder.text).toBe('Test')
1663
+ })
1664
+
1665
+ test('throws SlackError on API failure', async () => {
1666
+ const { client, mock } = await makeClient()
1667
+ mock.reminders.add.mockResolvedValue({ ok: false, error: 'invalid_time' })
1668
+ await expect(client.addReminder('Do something', 1700000000)).rejects.toThrow(SlackError)
1669
+ })
1670
+ })
1671
+
1672
+ describe('listReminders', () => {
1673
+ test('returns empty array when no reminders', async () => {
1674
+ const { client } = await makeClient()
1675
+ const result = await client.listReminders()
1676
+ expect(result).toHaveLength(0)
1677
+ })
1678
+
1679
+ test('throws SlackError on API failure', async () => {
1680
+ const { client, mock } = await makeClient()
1681
+ mock.reminders.list.mockResolvedValue({ ok: false, error: 'invalid_auth' })
1682
+ await expect(client.listReminders()).rejects.toThrow(SlackError)
1683
+ })
1684
+ })
1685
+
1686
+ describe('completeReminder', () => {
1687
+ test('completes reminder successfully', async () => {
1688
+ const { client, mock } = await makeClient()
1689
+ await client.completeReminder('Rm001')
1690
+ expect(mock.reminders.complete).toHaveBeenCalledWith({ reminder: 'Rm001' })
1691
+ })
1692
+
1693
+ test('throws SlackError on API failure', async () => {
1694
+ const { client, mock } = await makeClient()
1695
+ mock.reminders.complete.mockResolvedValue({ ok: false, error: 'reminder_not_found' })
1696
+ await expect(client.completeReminder('Rm999')).rejects.toThrow(SlackError)
1697
+ })
1698
+ })
1699
+
1700
+ describe('deleteReminder', () => {
1701
+ test('deletes reminder successfully', async () => {
1702
+ const { client, mock } = await makeClient()
1703
+ await client.deleteReminder('Rm001')
1704
+ expect(mock.reminders.delete).toHaveBeenCalledWith({ reminder: 'Rm001' })
1705
+ })
1706
+
1707
+ test('throws SlackError on API failure', async () => {
1708
+ const { client, mock } = await makeClient()
1709
+ mock.reminders.delete.mockResolvedValue({ ok: false, error: 'reminder_not_found' })
1710
+ await expect(client.deleteReminder('Rm999')).rejects.toThrow(SlackError)
1711
+ })
1712
+ })
1713
+
1714
+ describe('deleteFile', () => {
1715
+ test('deletes file successfully', async () => {
1716
+ const { client, mock } = await makeClient()
1717
+ await client.deleteFile('F001')
1718
+ expect(mock.files.delete).toHaveBeenCalledWith({ file: 'F001' })
1719
+ })
1720
+
1721
+ test('throws SlackError on API failure', async () => {
1722
+ const { client, mock } = await makeClient()
1723
+ mock.files.delete.mockResolvedValue({ ok: false, error: 'file_not_found' })
1724
+ await expect(client.deleteFile('F999')).rejects.toThrow(SlackError)
1725
+ })
1726
+ })
1727
+
1728
+ describe('listEmoji', () => {
1729
+ test('returns emoji map on success', async () => {
1730
+ const { client } = await makeClient()
1731
+ const emoji = await client.listEmoji()
1732
+ expect(emoji['party_blob']).toBe('https://example.com/party_blob.gif')
1733
+ })
1734
+
1735
+ test('throws SlackError on API failure', async () => {
1736
+ const { client, mock } = await makeClient()
1737
+ mock.emoji.list.mockResolvedValue({ ok: false, error: 'invalid_auth' })
1738
+ await expect(client.listEmoji()).rejects.toThrow(SlackError)
1739
+ })
1740
+ })
1741
+
1742
+ describe('listUsergroups', () => {
1743
+ test('returns mapped usergroups', async () => {
1744
+ const { client } = await makeClient()
1745
+ const groups = await client.listUsergroups({ includeCount: true })
1746
+ expect(groups).toHaveLength(1)
1747
+ expect(groups[0].id).toBe('S001')
1748
+ expect(groups[0].name).toBe('Engineering')
1749
+ expect(groups[0].handle).toBe('engineering')
1750
+ expect(groups[0].user_count).toBe(1)
1751
+ })
1752
+
1753
+ test('calls apiCall with correct params', async () => {
1754
+ const { client, mock } = await makeClient()
1755
+ await client.listUsergroups({ includeDisabled: true, includeUsers: true, includeCount: true })
1756
+ expect(mock.apiCall).toHaveBeenCalledWith('usergroups.list', {
1757
+ include_disabled: true,
1758
+ include_users: true,
1759
+ include_count: true,
1760
+ })
1761
+ })
1762
+
1763
+ test('throws SlackError on API failure', async () => {
1764
+ const { client, mock } = await makeClient()
1765
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'invalid_auth' })
1766
+ await expect(client.listUsergroups()).rejects.toThrow(SlackError)
1767
+ })
1768
+ })
1769
+
1770
+ describe('createUsergroup', () => {
1771
+ test('returns created usergroup', async () => {
1772
+ const { client } = await makeClient()
1773
+ const group = await client.createUsergroup('Marketing', { handle: 'marketing' })
1774
+ expect(group.id).toBe('S002')
1775
+ expect(group.name).toBe('Marketing')
1776
+ })
1777
+
1778
+ test('calls apiCall with correct params including channels', async () => {
1779
+ const { client, mock } = await makeClient()
1780
+ await client.createUsergroup('Marketing', { handle: 'marketing', description: 'Mktg', channels: ['C001', 'C002'] })
1781
+ expect(mock.apiCall).toHaveBeenCalledWith('usergroups.create', {
1782
+ name: 'Marketing',
1783
+ handle: 'marketing',
1784
+ description: 'Mktg',
1785
+ channels: 'C001,C002',
1786
+ })
1787
+ })
1788
+
1789
+ test('throws SlackError on API failure', async () => {
1790
+ const { client, mock } = await makeClient()
1791
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'name_already_exists' })
1792
+ await expect(client.createUsergroup('Dup')).rejects.toThrow(SlackError)
1793
+ })
1794
+ })
1795
+
1796
+ describe('updateUsergroup', () => {
1797
+ test('returns updated usergroup', async () => {
1798
+ const { client } = await makeClient()
1799
+ const group = await client.updateUsergroup('S001', { name: 'Updated', handle: 'updated' })
1800
+ expect(group.name).toBe('Updated')
1801
+ expect(group.handle).toBe('updated')
1802
+ })
1803
+
1804
+ test('calls apiCall with correct params', async () => {
1805
+ const { client, mock } = await makeClient()
1806
+ await client.updateUsergroup('S001', { name: 'New', channels: ['C001'] })
1807
+ expect(mock.apiCall).toHaveBeenCalledWith('usergroups.update', {
1808
+ usergroup: 'S001',
1809
+ name: 'New',
1810
+ handle: undefined,
1811
+ description: undefined,
1812
+ channels: 'C001',
1813
+ })
1814
+ })
1815
+
1816
+ test('throws SlackError on API failure', async () => {
1817
+ const { client, mock } = await makeClient()
1818
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
1819
+ await expect(client.updateUsergroup('S999', { name: 'X' })).rejects.toThrow(SlackError)
1820
+ })
1821
+ })
1822
+
1823
+ describe('disableUsergroup', () => {
1824
+ test('returns disabled usergroup with date_delete set', async () => {
1825
+ const { client } = await makeClient()
1826
+ const group = await client.disableUsergroup('S001')
1827
+ expect(group.id).toBe('S001')
1828
+ expect(group.date_delete).toBeGreaterThan(0)
1829
+ })
1830
+
1831
+ test('throws SlackError on API failure', async () => {
1832
+ const { client, mock } = await makeClient()
1833
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
1834
+ await expect(client.disableUsergroup('S999')).rejects.toThrow(SlackError)
1835
+ })
1836
+ })
1837
+
1838
+ describe('enableUsergroup', () => {
1839
+ test('returns enabled usergroup with date_delete cleared', async () => {
1840
+ const { client } = await makeClient()
1841
+ const group = await client.enableUsergroup('S001')
1842
+ expect(group.id).toBe('S001')
1843
+ expect(group.date_delete).toBe(0)
1844
+ })
1845
+
1846
+ test('throws SlackError on API failure', async () => {
1847
+ const { client, mock } = await makeClient()
1848
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
1849
+ await expect(client.enableUsergroup('S999')).rejects.toThrow(SlackError)
1850
+ })
1851
+ })
1852
+
1853
+ describe('listUsergroupMembers', () => {
1854
+ test('returns user ID array', async () => {
1855
+ const { client } = await makeClient()
1856
+ const users = await client.listUsergroupMembers('S001')
1857
+ expect(users).toEqual(['U001', 'U002'])
1858
+ })
1859
+
1860
+ test('calls apiCall with correct params', async () => {
1861
+ const { client, mock } = await makeClient()
1862
+ await client.listUsergroupMembers('S001', { includeDisabled: true })
1863
+ expect(mock.apiCall).toHaveBeenCalledWith('usergroups.users.list', {
1864
+ usergroup: 'S001',
1865
+ include_disabled: true,
1866
+ })
1867
+ })
1868
+
1869
+ test('throws SlackError on API failure', async () => {
1870
+ const { client, mock } = await makeClient()
1871
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'no_such_subteam' })
1872
+ await expect(client.listUsergroupMembers('S999')).rejects.toThrow(SlackError)
1873
+ })
1874
+ })
1875
+
1876
+ describe('updateUsergroupMembers', () => {
1877
+ test('returns updated usergroup with new members', async () => {
1878
+ const { client } = await makeClient()
1879
+ const group = await client.updateUsergroupMembers('S001', ['U001', 'U003'])
1880
+ expect(group.users).toEqual(['U001', 'U003'])
1881
+ expect(group.user_count).toBe(2)
1882
+ })
1883
+
1884
+ test('calls apiCall with comma-joined user IDs', async () => {
1885
+ const { client, mock } = await makeClient()
1886
+ await client.updateUsergroupMembers('S001', ['U001', 'U003'])
1887
+ expect(mock.apiCall).toHaveBeenCalledWith('usergroups.users.update', {
1888
+ usergroup: 'S001',
1889
+ users: 'U001,U003',
1890
+ })
1891
+ })
1892
+
1893
+ test('throws SlackError on API failure', async () => {
1894
+ const { client, mock } = await makeClient()
1895
+ mock.apiCall.mockResolvedValue({ ok: false, error: 'no_users_provided' })
1896
+ await expect(client.updateUsergroupMembers('S001', [])).rejects.toThrow(SlackError)
1897
+ })
1898
+ })
1899
+ })