agent-messenger 2.7.0 → 2.8.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 (511) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +6 -0
  3. package/.oxfmtrc.json +13 -1
  4. package/.oxlintrc.json +10 -1
  5. package/README.md +1 -1
  6. package/dist/package.json +59 -58
  7. package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
  8. package/dist/src/platforms/channeltalk/client.js +2 -2
  9. package/dist/src/platforms/channeltalk/client.js.map +1 -1
  10. package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
  11. package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
  12. package/dist/src/platforms/channeltalk/commands/message.d.ts.map +1 -1
  13. package/dist/src/platforms/channeltalk/commands/message.js.map +1 -1
  14. package/dist/src/platforms/channeltalk/commands/snapshot.d.ts.map +1 -1
  15. package/dist/src/platforms/channeltalk/commands/snapshot.js.map +1 -1
  16. package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
  17. package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
  18. package/dist/src/platforms/channeltalk/token-extractor.d.ts +9 -23
  19. package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
  20. package/dist/src/platforms/channeltalk/token-extractor.js +109 -341
  21. package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
  22. package/dist/src/platforms/channeltalkbot/client.d.ts +1 -1
  23. package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
  24. package/dist/src/platforms/channeltalkbot/client.js +4 -4
  25. package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
  26. package/dist/src/platforms/channeltalkbot/commands/auth.d.ts.map +1 -1
  27. package/dist/src/platforms/channeltalkbot/commands/auth.js +4 -1
  28. package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
  29. package/dist/src/platforms/channeltalkbot/commands/shared.d.ts.map +1 -1
  30. package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
  31. package/dist/src/platforms/discord/commands/auth.js.map +1 -1
  32. package/dist/src/platforms/discord/commands/whoami.d.ts.map +1 -1
  33. package/dist/src/platforms/discord/commands/whoami.js.map +1 -1
  34. package/dist/src/platforms/discord/token-extractor.d.ts +2 -10
  35. package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
  36. package/dist/src/platforms/discord/token-extractor.js +38 -172
  37. package/dist/src/platforms/discord/token-extractor.js.map +1 -1
  38. package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
  39. package/dist/src/platforms/discordbot/client.js.map +1 -1
  40. package/dist/src/platforms/instagram/cli.d.ts.map +1 -1
  41. package/dist/src/platforms/instagram/cli.js +1 -4
  42. package/dist/src/platforms/instagram/cli.js.map +1 -1
  43. package/dist/src/platforms/instagram/client.d.ts.map +1 -1
  44. package/dist/src/platforms/instagram/client.js +8 -7
  45. package/dist/src/platforms/instagram/client.js.map +1 -1
  46. package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
  47. package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
  48. package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -1
  49. package/dist/src/platforms/instagram/commands/chat.js.map +1 -1
  50. package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -1
  51. package/dist/src/platforms/instagram/commands/message.js.map +1 -1
  52. package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -1
  53. package/dist/src/platforms/instagram/commands/shared.js.map +1 -1
  54. package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -1
  55. package/dist/src/platforms/instagram/credential-manager.js +1 -1
  56. package/dist/src/platforms/instagram/credential-manager.js.map +1 -1
  57. package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -1
  58. package/dist/src/platforms/instagram/ensure-auth.js.map +1 -1
  59. package/dist/src/platforms/instagram/token-extractor.d.ts +7 -19
  60. package/dist/src/platforms/instagram/token-extractor.d.ts.map +1 -1
  61. package/dist/src/platforms/instagram/token-extractor.js +44 -270
  62. package/dist/src/platforms/instagram/token-extractor.js.map +1 -1
  63. package/dist/src/platforms/instagram/types.d.ts.map +1 -1
  64. package/dist/src/platforms/instagram/types.js +4 -2
  65. package/dist/src/platforms/instagram/types.js.map +1 -1
  66. package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -1
  67. package/dist/src/platforms/kakaotalk/auth/kakao-login.js +18 -4
  68. package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -1
  69. package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
  70. package/dist/src/platforms/kakaotalk/client.js +3 -3
  71. package/dist/src/platforms/kakaotalk/client.js.map +1 -1
  72. package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -1
  73. package/dist/src/platforms/kakaotalk/commands/auth.js +15 -9
  74. package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
  75. package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -1
  76. package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -1
  77. package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -1
  78. package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -1
  79. package/dist/src/platforms/kakaotalk/protocol/crypto.js +1 -1
  80. package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -1
  81. package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
  82. package/dist/src/platforms/kakaotalk/protocol/session.js +1 -3
  83. package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
  84. package/dist/src/platforms/kakaotalk/token-extractor.js +5 -2
  85. package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -1
  86. package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
  87. package/dist/src/platforms/kakaotalk/types.js +4 -2
  88. package/dist/src/platforms/kakaotalk/types.js.map +1 -1
  89. package/dist/src/platforms/line/cli.d.ts.map +1 -1
  90. package/dist/src/platforms/line/cli.js +1 -4
  91. package/dist/src/platforms/line/cli.js.map +1 -1
  92. package/dist/src/platforms/line/client.d.ts.map +1 -1
  93. package/dist/src/platforms/line/client.js +5 -13
  94. package/dist/src/platforms/line/client.js.map +1 -1
  95. package/dist/src/platforms/line/commands/chat.d.ts.map +1 -1
  96. package/dist/src/platforms/line/commands/chat.js.map +1 -1
  97. package/dist/src/platforms/line/commands/message.d.ts.map +1 -1
  98. package/dist/src/platforms/line/commands/message.js.map +1 -1
  99. package/dist/src/platforms/line/listener.js +1 -1
  100. package/dist/src/platforms/line/listener.js.map +1 -1
  101. package/dist/src/platforms/slack/cli.d.ts.map +1 -1
  102. package/dist/src/platforms/slack/cli.js.map +1 -1
  103. package/dist/src/platforms/slack/client-mappers.d.ts +14 -0
  104. package/dist/src/platforms/slack/client-mappers.d.ts.map +1 -0
  105. package/dist/src/platforms/slack/client-mappers.js +245 -0
  106. package/dist/src/platforms/slack/client-mappers.js.map +1 -0
  107. package/dist/src/platforms/slack/client.d.ts +0 -1
  108. package/dist/src/platforms/slack/client.d.ts.map +1 -1
  109. package/dist/src/platforms/slack/client.js +41 -455
  110. package/dist/src/platforms/slack/client.js.map +1 -1
  111. package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
  112. package/dist/src/platforms/slack/commands/channel.js.map +1 -1
  113. package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -1
  114. package/dist/src/platforms/slack/commands/emoji.js +1 -3
  115. package/dist/src/platforms/slack/commands/emoji.js.map +1 -1
  116. package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
  117. package/dist/src/platforms/slack/commands/message.js.map +1 -1
  118. package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -1
  119. package/dist/src/platforms/slack/commands/reminder.js.map +1 -1
  120. package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
  121. package/dist/src/platforms/slack/commands/user.js.map +1 -1
  122. package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -1
  123. package/dist/src/platforms/slack/commands/usergroup.js.map +1 -1
  124. package/dist/src/platforms/slack/commands/whoami.d.ts.map +1 -1
  125. package/dist/src/platforms/slack/commands/whoami.js.map +1 -1
  126. package/dist/src/platforms/slack/token-extractor.d.ts +2 -6
  127. package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
  128. package/dist/src/platforms/slack/token-extractor.js +35 -229
  129. package/dist/src/platforms/slack/token-extractor.js.map +1 -1
  130. package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
  131. package/dist/src/platforms/slackbot/cli.js +1 -1
  132. package/dist/src/platforms/slackbot/cli.js.map +1 -1
  133. package/dist/src/platforms/teams/client.d.ts.map +1 -1
  134. package/dist/src/platforms/teams/client.js +1 -1
  135. package/dist/src/platforms/teams/client.js.map +1 -1
  136. package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
  137. package/dist/src/platforms/teams/commands/auth.js +4 -1
  138. package/dist/src/platforms/teams/commands/auth.js.map +1 -1
  139. package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -1
  140. package/dist/src/platforms/teams/commands/whoami.js.map +1 -1
  141. package/dist/src/platforms/teams/token-extractor.d.ts +6 -18
  142. package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
  143. package/dist/src/platforms/teams/token-extractor.js +71 -324
  144. package/dist/src/platforms/teams/token-extractor.js.map +1 -1
  145. package/dist/src/platforms/telegram/cli.d.ts.map +1 -1
  146. package/dist/src/platforms/telegram/cli.js +1 -4
  147. package/dist/src/platforms/telegram/cli.js.map +1 -1
  148. package/dist/src/platforms/telegram/client.d.ts.map +1 -1
  149. package/dist/src/platforms/telegram/client.js.map +1 -1
  150. package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -1
  151. package/dist/src/platforms/telegram/commands/auth.js +1 -1
  152. package/dist/src/platforms/telegram/commands/auth.js.map +1 -1
  153. package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -1
  154. package/dist/src/platforms/telegram/commands/chat.js.map +1 -1
  155. package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -1
  156. package/dist/src/platforms/telegram/commands/message.js.map +1 -1
  157. package/dist/src/platforms/telegram/commands/whoami.js +1 -1
  158. package/dist/src/platforms/telegram/commands/whoami.js.map +1 -1
  159. package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -1
  160. package/dist/src/platforms/telegram/credential-manager.js +6 -2
  161. package/dist/src/platforms/telegram/credential-manager.js.map +1 -1
  162. package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -1
  163. package/dist/src/platforms/webex/cli.d.ts.map +1 -1
  164. package/dist/src/platforms/webex/cli.js +1 -4
  165. package/dist/src/platforms/webex/cli.js.map +1 -1
  166. package/dist/src/platforms/webex/client.d.ts.map +1 -1
  167. package/dist/src/platforms/webex/client.js +3 -7
  168. package/dist/src/platforms/webex/client.js.map +1 -1
  169. package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
  170. package/dist/src/platforms/webex/commands/auth.js +1 -3
  171. package/dist/src/platforms/webex/commands/auth.js.map +1 -1
  172. package/dist/src/platforms/webex/commands/member.d.ts.map +1 -1
  173. package/dist/src/platforms/webex/commands/member.js +1 -3
  174. package/dist/src/platforms/webex/commands/member.js.map +1 -1
  175. package/dist/src/platforms/webex/commands/message.d.ts.map +1 -1
  176. package/dist/src/platforms/webex/commands/message.js.map +1 -1
  177. package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
  178. package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
  179. package/dist/src/platforms/webex/commands/space.d.ts.map +1 -1
  180. package/dist/src/platforms/webex/commands/space.js.map +1 -1
  181. package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -1
  182. package/dist/src/platforms/webex/commands/whoami.js.map +1 -1
  183. package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
  184. package/dist/src/platforms/webex/credential-manager.js.map +1 -1
  185. package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -1
  186. package/dist/src/platforms/webex/ensure-auth.js +1 -3
  187. package/dist/src/platforms/webex/ensure-auth.js.map +1 -1
  188. package/dist/src/platforms/webex/index.d.ts +1 -1
  189. package/dist/src/platforms/webex/index.d.ts.map +1 -1
  190. package/dist/src/platforms/webex/index.js.map +1 -1
  191. package/dist/src/platforms/webex/markdown-to-html.js.map +1 -1
  192. package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -1
  193. package/dist/src/platforms/webex/token-extractor.js +5 -14
  194. package/dist/src/platforms/webex/token-extractor.js.map +1 -1
  195. package/dist/src/platforms/wechatbot/client.d.ts.map +1 -1
  196. package/dist/src/platforms/wechatbot/client.js.map +1 -1
  197. package/dist/src/platforms/wechatbot/commands/message.d.ts.map +1 -1
  198. package/dist/src/platforms/wechatbot/commands/message.js.map +1 -1
  199. package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -1
  200. package/dist/src/platforms/whatsapp/cli.js +1 -4
  201. package/dist/src/platforms/whatsapp/cli.js.map +1 -1
  202. package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -1
  203. package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -1
  204. package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -1
  205. package/dist/src/platforms/whatsapp/commands/message.js.map +1 -1
  206. package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -1
  207. package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -1
  208. package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -1
  209. package/dist/src/platforms/whatsapp/credential-manager.js +1 -1
  210. package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -1
  211. package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -1
  212. package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -1
  213. package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -1
  214. package/dist/src/platforms/whatsappbot/client.js +2 -2
  215. package/dist/src/platforms/whatsappbot/client.js.map +1 -1
  216. package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -1
  217. package/dist/src/platforms/whatsappbot/commands/auth.js +4 -1
  218. package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -1
  219. package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -1
  220. package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -1
  221. package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -1
  222. package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -1
  223. package/dist/src/shared/chromium/browsers.d.ts +7 -0
  224. package/dist/src/shared/chromium/browsers.d.ts.map +1 -0
  225. package/dist/src/shared/chromium/browsers.js +89 -0
  226. package/dist/src/shared/chromium/browsers.js.map +1 -0
  227. package/dist/src/shared/chromium/cookie-reader.d.ts +20 -0
  228. package/dist/src/shared/chromium/cookie-reader.d.ts.map +1 -0
  229. package/dist/src/shared/chromium/cookie-reader.js +99 -0
  230. package/dist/src/shared/chromium/cookie-reader.js.map +1 -0
  231. package/dist/src/shared/chromium/decryptor.d.ts +42 -0
  232. package/dist/src/shared/chromium/decryptor.d.ts.map +1 -0
  233. package/dist/src/shared/chromium/decryptor.js +205 -0
  234. package/dist/src/shared/chromium/decryptor.js.map +1 -0
  235. package/dist/src/shared/chromium/index.d.ts +6 -0
  236. package/dist/src/shared/chromium/index.d.ts.map +1 -0
  237. package/dist/src/shared/chromium/index.js +4 -0
  238. package/dist/src/shared/chromium/index.js.map +1 -0
  239. package/dist/src/shared/chromium/types.d.ts +11 -0
  240. package/dist/src/shared/chromium/types.d.ts.map +1 -0
  241. package/dist/src/shared/chromium/types.js +2 -0
  242. package/dist/src/shared/chromium/types.js.map +1 -0
  243. package/dist/src/shared/utils/derived-key-cache.d.ts +1 -1
  244. package/dist/src/shared/utils/derived-key-cache.d.ts.map +1 -1
  245. package/dist/src/shared/utils/linux-keyring.js +4 -1
  246. package/dist/src/shared/utils/linux-keyring.js.map +1 -1
  247. package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -1
  248. package/dist/src/tui/adapters/kakaotalk-adapter.js +6 -1
  249. package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -1
  250. package/dist/src/tui/adapters/telegram-adapter.js +1 -1
  251. package/dist/src/tui/adapters/telegram-adapter.js.map +1 -1
  252. package/dist/src/tui/adapters/webex-adapter.js +1 -1
  253. package/dist/src/tui/adapters/webex-adapter.js.map +1 -1
  254. package/dist/src/tui/app.d.ts.map +1 -1
  255. package/dist/src/tui/app.js +112 -23
  256. package/dist/src/tui/app.js.map +1 -1
  257. package/dist/src/tui/utils.d.ts.map +1 -1
  258. package/dist/src/tui/utils.js +11 -13
  259. package/dist/src/tui/utils.js.map +1 -1
  260. package/dist/src/tui/views/channel-picker.d.ts.map +1 -1
  261. package/dist/src/tui/views/channel-picker.js.map +1 -1
  262. package/dist/src/tui/views/workspace-picker.d.ts.map +1 -1
  263. package/dist/src/tui/views/workspace-picker.js.map +1 -1
  264. package/docs/content/docs/cli/channeltalk.mdx +24 -22
  265. package/docs/content/docs/cli/channeltalkbot.mdx +7 -7
  266. package/docs/content/docs/cli/instagram.mdx +4 -4
  267. package/docs/content/docs/cli/kakaotalk.mdx +9 -8
  268. package/docs/content/docs/cli/line.mdx +14 -14
  269. package/docs/content/docs/cli/webex.mdx +19 -19
  270. package/docs/content/docs/cli/wechatbot.mdx +12 -11
  271. package/docs/content/docs/cli/whatsapp.mdx +5 -4
  272. package/docs/content/docs/cli/whatsappbot.mdx +11 -11
  273. package/docs/content/docs/index.mdx +7 -7
  274. package/docs/content/docs/meta.json +1 -9
  275. package/docs/content/docs/sdk/channeltalk.mdx +5 -6
  276. package/docs/content/docs/sdk/channeltalkbot.mdx +6 -12
  277. package/docs/content/docs/sdk/discord.mdx +36 -43
  278. package/docs/content/docs/sdk/instagram.mdx +18 -18
  279. package/docs/content/docs/sdk/kakaotalk.mdx +27 -18
  280. package/docs/content/docs/sdk/line.mdx +8 -13
  281. package/docs/content/docs/sdk/meta.json +14 -1
  282. package/docs/content/docs/sdk/slack.mdx +36 -42
  283. package/docs/content/docs/sdk/teams.mdx +2 -8
  284. package/docs/content/docs/sdk/webex.mdx +2 -12
  285. package/docs/content/docs/sdk/wechatbot.mdx +1 -5
  286. package/docs/content/docs/sdk/whatsapp.mdx +10 -19
  287. package/docs/content/docs/sdk/whatsappbot.mdx +2 -10
  288. package/docs/content/docs/tui.mdx +23 -23
  289. package/docs/src/app/page.tsx +353 -108
  290. package/e2e/channeltalkbot.e2e.test.ts +1 -5
  291. package/e2e/config.ts +6 -2
  292. package/package.json +59 -58
  293. package/scripts/prepublish.ts +1 -3
  294. package/skills/agent-channeltalk/SKILL.md +1 -1
  295. package/skills/agent-channeltalkbot/SKILL.md +1 -1
  296. package/skills/agent-discord/SKILL.md +1 -1
  297. package/skills/agent-discordbot/SKILL.md +1 -1
  298. package/skills/agent-instagram/SKILL.md +1 -1
  299. package/skills/agent-kakaotalk/SKILL.md +1 -1
  300. package/skills/agent-line/SKILL.md +1 -1
  301. package/skills/agent-slack/SKILL.md +1 -1
  302. package/skills/agent-slackbot/SKILL.md +1 -1
  303. package/skills/agent-teams/SKILL.md +1 -1
  304. package/skills/agent-telegram/SKILL.md +1 -1
  305. package/skills/agent-webex/SKILL.md +1 -1
  306. package/skills/agent-wechatbot/SKILL.md +1 -1
  307. package/skills/agent-whatsapp/SKILL.md +1 -1
  308. package/skills/agent-whatsappbot/SKILL.md +1 -1
  309. package/src/platforms/channeltalk/client.test.ts +116 -29
  310. package/src/platforms/channeltalk/client.ts +26 -6
  311. package/src/platforms/channeltalk/commands/auth.test.ts +5 -5
  312. package/src/platforms/channeltalk/commands/auth.ts +19 -5
  313. package/src/platforms/channeltalk/commands/message.test.ts +2 -6
  314. package/src/platforms/channeltalk/commands/message.ts +5 -1
  315. package/src/platforms/channeltalk/commands/snapshot.test.ts +19 -4
  316. package/src/platforms/channeltalk/commands/snapshot.ts +5 -1
  317. package/src/platforms/channeltalk/ensure-auth.test.ts +20 -17
  318. package/src/platforms/channeltalk/ensure-auth.ts +6 -7
  319. package/src/platforms/channeltalk/index.ts +0 -1
  320. package/src/platforms/channeltalk/token-extractor.test.ts +33 -25
  321. package/src/platforms/channeltalk/token-extractor.ts +120 -372
  322. package/src/platforms/channeltalkbot/client.test.ts +1 -3
  323. package/src/platforms/channeltalkbot/client.ts +39 -13
  324. package/src/platforms/channeltalkbot/commands/auth.test.ts +3 -1
  325. package/src/platforms/channeltalkbot/commands/auth.ts +4 -1
  326. package/src/platforms/channeltalkbot/commands/bot.test.ts +13 -5
  327. package/src/platforms/channeltalkbot/commands/message.test.ts +12 -6
  328. package/src/platforms/channeltalkbot/commands/shared.ts +6 -2
  329. package/src/platforms/channeltalkbot/commands/snapshot.test.ts +17 -5
  330. package/src/platforms/channeltalkbot/credential-manager.test.ts +1 -1
  331. package/src/platforms/channeltalkbot/index.test.ts +0 -2
  332. package/src/platforms/channeltalkbot/index.ts +0 -1
  333. package/src/platforms/discord/commands/auth.test.ts +6 -4
  334. package/src/platforms/discord/commands/auth.ts +14 -14
  335. package/src/platforms/discord/commands/whoami.test.ts +2 -4
  336. package/src/platforms/discord/commands/whoami.ts +2 -0
  337. package/src/platforms/discord/ensure-auth.test.ts +5 -3
  338. package/src/platforms/discord/index.ts +0 -1
  339. package/src/platforms/discord/listener.test.ts +7 -1
  340. package/src/platforms/discord/token-extractor.test.ts +18 -12
  341. package/src/platforms/discord/token-extractor.ts +46 -190
  342. package/src/platforms/discordbot/client.ts +1 -4
  343. package/src/platforms/discordbot/commands/auth.test.ts +3 -1
  344. package/src/platforms/discordbot/commands/channel.test.ts +3 -1
  345. package/src/platforms/discordbot/commands/message.test.ts +3 -1
  346. package/src/platforms/discordbot/commands/server.test.ts +3 -1
  347. package/src/platforms/discordbot/commands/snapshot.test.ts +3 -1
  348. package/src/platforms/discordbot/commands/thread.test.ts +3 -1
  349. package/src/platforms/discordbot/commands/user.test.ts +3 -1
  350. package/src/platforms/instagram/cli.ts +1 -4
  351. package/src/platforms/instagram/client.test.ts +3 -8
  352. package/src/platforms/instagram/client.ts +39 -34
  353. package/src/platforms/instagram/commands/auth.test.ts +13 -12
  354. package/src/platforms/instagram/commands/auth.ts +136 -71
  355. package/src/platforms/instagram/commands/chat.test.ts +21 -24
  356. package/src/platforms/instagram/commands/chat.ts +2 -0
  357. package/src/platforms/instagram/commands/message.test.ts +29 -24
  358. package/src/platforms/instagram/commands/message.ts +3 -4
  359. package/src/platforms/instagram/commands/shared.ts +2 -5
  360. package/src/platforms/instagram/commands/whoami.test.ts +4 -6
  361. package/src/platforms/instagram/credential-manager.ts +2 -6
  362. package/src/platforms/instagram/ensure-auth.test.ts +1 -4
  363. package/src/platforms/instagram/ensure-auth.ts +6 -3
  364. package/src/platforms/instagram/listener.test.ts +7 -3
  365. package/src/platforms/instagram/token-extractor.test.ts +4 -16
  366. package/src/platforms/instagram/token-extractor.ts +55 -309
  367. package/src/platforms/instagram/types.test.ts +2 -6
  368. package/src/platforms/instagram/types.ts +4 -2
  369. package/src/platforms/kakaotalk/auth/kakao-login.ts +30 -8
  370. package/src/platforms/kakaotalk/client.test.ts +37 -25
  371. package/src/platforms/kakaotalk/client.ts +23 -12
  372. package/src/platforms/kakaotalk/commands/auth.test.ts +6 -18
  373. package/src/platforms/kakaotalk/commands/auth.ts +101 -47
  374. package/src/platforms/kakaotalk/commands/chat.test.ts +8 -11
  375. package/src/platforms/kakaotalk/commands/message.test.ts +15 -24
  376. package/src/platforms/kakaotalk/commands/shared.ts +1 -0
  377. package/src/platforms/kakaotalk/commands/whoami.test.ts +6 -10
  378. package/src/platforms/kakaotalk/credential-manager.test.ts +1 -4
  379. package/src/platforms/kakaotalk/index.test.ts +1 -0
  380. package/src/platforms/kakaotalk/index.ts +0 -2
  381. package/src/platforms/kakaotalk/listener.test.ts +7 -1
  382. package/src/platforms/kakaotalk/protocol/connection.ts +4 -1
  383. package/src/platforms/kakaotalk/protocol/crypto.ts +1 -1
  384. package/src/platforms/kakaotalk/protocol/session.ts +12 -6
  385. package/src/platforms/kakaotalk/token-extractor.ts +5 -5
  386. package/src/platforms/kakaotalk/types.ts +8 -7
  387. package/src/platforms/line/cli.ts +1 -4
  388. package/src/platforms/line/client.ts +12 -20
  389. package/src/platforms/line/commands/auth.test.ts +2 -1
  390. package/src/platforms/line/commands/chat.test.ts +2 -1
  391. package/src/platforms/line/commands/chat.ts +1 -4
  392. package/src/platforms/line/commands/friend.test.ts +2 -1
  393. package/src/platforms/line/commands/message.test.ts +2 -1
  394. package/src/platforms/line/commands/message.ts +2 -9
  395. package/src/platforms/line/commands/whoami.test.ts +2 -1
  396. package/src/platforms/line/credential-manager.test.ts +1 -2
  397. package/src/platforms/line/index.test.ts +1 -0
  398. package/src/platforms/line/listener.ts +1 -1
  399. package/src/platforms/line/types.test.ts +1 -0
  400. package/src/platforms/slack/cli.ts +3 -1
  401. package/src/platforms/slack/client-mappers.ts +297 -0
  402. package/src/platforms/slack/client.test.ts +532 -17
  403. package/src/platforms/slack/client.ts +69 -458
  404. package/src/platforms/slack/commands/channel.ts +1 -4
  405. package/src/platforms/slack/commands/emoji.test.ts +6 -4
  406. package/src/platforms/slack/commands/emoji.ts +20 -22
  407. package/src/platforms/slack/commands/message.ts +6 -1
  408. package/src/platforms/slack/commands/pin.test.ts +14 -12
  409. package/src/platforms/slack/commands/reminder.ts +7 -6
  410. package/src/platforms/slack/commands/user.ts +6 -1
  411. package/src/platforms/slack/commands/usergroup.test.ts +3 -3
  412. package/src/platforms/slack/commands/usergroup.ts +10 -7
  413. package/src/platforms/slack/commands/whoami.test.ts +1 -1
  414. package/src/platforms/slack/commands/whoami.ts +2 -0
  415. package/src/platforms/slack/index.ts +0 -2
  416. package/src/platforms/slack/listener.test.ts +1 -0
  417. package/src/platforms/slack/token-extractor.test.ts +7 -12
  418. package/src/platforms/slack/token-extractor.ts +47 -255
  419. package/src/platforms/slackbot/cli.ts +8 -1
  420. package/src/platforms/slackbot/commands/auth.test.ts +3 -1
  421. package/src/platforms/teams/client.ts +1 -1
  422. package/src/platforms/teams/commands/auth.test.ts +1 -1
  423. package/src/platforms/teams/commands/auth.ts +4 -1
  424. package/src/platforms/teams/commands/whoami.test.ts +2 -4
  425. package/src/platforms/teams/commands/whoami.ts +2 -0
  426. package/src/platforms/teams/index.ts +0 -1
  427. package/src/platforms/teams/token-extractor.ts +82 -350
  428. package/src/platforms/telegram/app-config.test.ts +1 -0
  429. package/src/platforms/telegram/chat-utils.test.ts +5 -1
  430. package/src/platforms/telegram/cli.ts +2 -4
  431. package/src/platforms/telegram/client.test.ts +16 -3
  432. package/src/platforms/telegram/client.ts +14 -4
  433. package/src/platforms/telegram/commands/auth.test.ts +1 -0
  434. package/src/platforms/telegram/commands/auth.ts +3 -4
  435. package/src/platforms/telegram/commands/chat.test.ts +2 -5
  436. package/src/platforms/telegram/commands/chat.ts +1 -0
  437. package/src/platforms/telegram/commands/message.test.ts +2 -5
  438. package/src/platforms/telegram/commands/message.ts +1 -0
  439. package/src/platforms/telegram/commands/shared.test.ts +1 -0
  440. package/src/platforms/telegram/commands/whoami.test.ts +5 -7
  441. package/src/platforms/telegram/commands/whoami.ts +1 -1
  442. package/src/platforms/telegram/credential-manager.test.ts +1 -0
  443. package/src/platforms/telegram/credential-manager.ts +11 -2
  444. package/src/platforms/telegram/my-telegram-org.ts +6 -2
  445. package/src/platforms/telegram/types.test.ts +1 -0
  446. package/src/platforms/webex/app-config.test.ts +1 -0
  447. package/src/platforms/webex/cli.ts +1 -4
  448. package/src/platforms/webex/client.test.ts +4 -12
  449. package/src/platforms/webex/client.ts +14 -52
  450. package/src/platforms/webex/commands/auth.test.ts +7 -1
  451. package/src/platforms/webex/commands/auth.ts +12 -15
  452. package/src/platforms/webex/commands/member.test.ts +1 -3
  453. package/src/platforms/webex/commands/member.ts +14 -19
  454. package/src/platforms/webex/commands/message.ts +4 -15
  455. package/src/platforms/webex/commands/snapshot.test.ts +28 -3
  456. package/src/platforms/webex/commands/snapshot.ts +3 -3
  457. package/src/platforms/webex/commands/space.test.ts +3 -3
  458. package/src/platforms/webex/commands/space.ts +2 -9
  459. package/src/platforms/webex/commands/whoami.test.ts +12 -5
  460. package/src/platforms/webex/commands/whoami.ts +2 -0
  461. package/src/platforms/webex/credential-manager.ts +11 -2
  462. package/src/platforms/webex/ensure-auth.ts +1 -3
  463. package/src/platforms/webex/index.ts +1 -7
  464. package/src/platforms/webex/markdown-to-html.test.ts +6 -18
  465. package/src/platforms/webex/markdown-to-html.ts +8 -8
  466. package/src/platforms/webex/token-extractor.ts +6 -29
  467. package/src/platforms/wechatbot/client.test.ts +6 -2
  468. package/src/platforms/wechatbot/client.ts +6 -1
  469. package/src/platforms/wechatbot/commands/auth.test.ts +3 -7
  470. package/src/platforms/wechatbot/commands/message.test.ts +1 -4
  471. package/src/platforms/wechatbot/commands/message.ts +5 -1
  472. package/src/platforms/wechatbot/commands/template.test.ts +1 -4
  473. package/src/platforms/wechatbot/commands/user.test.ts +2 -7
  474. package/src/platforms/whatsapp/cli.ts +1 -4
  475. package/src/platforms/whatsapp/commands/auth.test.ts +19 -22
  476. package/src/platforms/whatsapp/commands/chat.test.ts +21 -24
  477. package/src/platforms/whatsapp/commands/chat.ts +2 -0
  478. package/src/platforms/whatsapp/commands/message.test.ts +22 -24
  479. package/src/platforms/whatsapp/commands/message.ts +3 -5
  480. package/src/platforms/whatsapp/commands/shared.ts +2 -5
  481. package/src/platforms/whatsapp/commands/whoami.test.ts +2 -2
  482. package/src/platforms/whatsapp/credential-manager.ts +2 -6
  483. package/src/platforms/whatsapp/ensure-auth.test.ts +1 -4
  484. package/src/platforms/whatsapp/ensure-auth.ts +14 -6
  485. package/src/platforms/whatsapp/index.ts +0 -2
  486. package/src/platforms/whatsappbot/client.test.ts +13 -7
  487. package/src/platforms/whatsappbot/client.ts +18 -4
  488. package/src/platforms/whatsappbot/commands/auth.ts +4 -1
  489. package/src/platforms/whatsappbot/commands/message.test.ts +12 -2
  490. package/src/platforms/whatsappbot/commands/message.ts +16 -3
  491. package/src/platforms/whatsappbot/commands/shared.ts +3 -1
  492. package/src/platforms/whatsappbot/commands/whoami.test.ts +1 -3
  493. package/src/platforms/whatsappbot/index.ts +0 -2
  494. package/src/shared/chromium/browsers.test.ts +274 -0
  495. package/src/shared/chromium/browsers.ts +86 -0
  496. package/src/shared/chromium/cookie-reader.test.ts +274 -0
  497. package/src/shared/chromium/cookie-reader.ts +111 -0
  498. package/src/shared/chromium/decryptor.test.ts +449 -0
  499. package/src/shared/chromium/decryptor.ts +227 -0
  500. package/src/shared/chromium/index.ts +11 -0
  501. package/src/shared/chromium/types.ts +11 -0
  502. package/src/shared/utils/derived-key-cache.ts +1 -1
  503. package/src/shared/utils/linux-keyring.ts +4 -4
  504. package/src/tui/adapters/kakaotalk-adapter.ts +6 -1
  505. package/src/tui/adapters/telegram-adapter.ts +1 -1
  506. package/src/tui/adapters/webex-adapter.ts +1 -1
  507. package/src/tui/app.ts +149 -59
  508. package/src/tui/utils.test.ts +144 -145
  509. package/src/tui/utils.ts +27 -29
  510. package/src/tui/views/channel-picker.ts +1 -1
  511. package/src/tui/views/workspace-picker.ts +1 -1
@@ -1,4 +1,5 @@
1
1
  import { WebClient } from '@slack/web-api';
2
+ import { mapBookmark, mapChannel, mapDM, mapFile, mapMessage, mapPin, mapReminder, mapSavedItem, mapScheduledMessage, mapUser, mapUserProfile, mapUsergroup, } from './client-mappers.js';
2
3
  export class SlackError extends Error {
3
4
  code;
4
5
  constructor(message, code) {
@@ -95,28 +96,7 @@ export class SlackClient {
95
96
  this.checkResponse(response);
96
97
  if (response.channels) {
97
98
  for (const ch of response.channels) {
98
- channels.push({
99
- id: ch.id,
100
- name: ch.name,
101
- is_private: ch.is_private || false,
102
- is_archived: ch.is_archived || false,
103
- created: ch.created || 0,
104
- creator: ch.creator || '',
105
- topic: ch.topic
106
- ? {
107
- value: ch.topic.value || '',
108
- creator: ch.topic.creator || '',
109
- last_set: ch.topic.last_set || 0,
110
- }
111
- : undefined,
112
- purpose: ch.purpose
113
- ? {
114
- value: ch.purpose.value || '',
115
- creator: ch.purpose.creator || '',
116
- last_set: ch.purpose.last_set || 0,
117
- }
118
- : undefined,
119
- });
99
+ channels.push(mapChannel(ch));
120
100
  }
121
101
  }
122
102
  cursor = response.response_metadata?.next_cursor;
@@ -138,11 +118,7 @@ export class SlackClient {
138
118
  this.checkResponse(response);
139
119
  if (response.channels) {
140
120
  for (const ch of response.channels) {
141
- dms.push({
142
- id: ch.id,
143
- user: ch.user || ch.name || '',
144
- is_mpim: ch.is_mpim || false,
145
- });
121
+ dms.push(mapDM(ch));
146
122
  }
147
123
  }
148
124
  cursor = response.response_metadata?.next_cursor;
@@ -154,29 +130,7 @@ export class SlackClient {
154
130
  return this.withRetry(async () => {
155
131
  const response = await this.ensureAuth().conversations.info({ channel: id });
156
132
  this.checkResponse(response);
157
- const ch = response.channel;
158
- return {
159
- id: ch.id,
160
- name: ch.name,
161
- is_private: ch.is_private || false,
162
- is_archived: ch.is_archived || false,
163
- created: ch.created || 0,
164
- creator: ch.creator || '',
165
- topic: ch.topic
166
- ? {
167
- value: ch.topic.value || '',
168
- creator: ch.topic.creator || '',
169
- last_set: ch.topic.last_set || 0,
170
- }
171
- : undefined,
172
- purpose: ch.purpose
173
- ? {
174
- value: ch.purpose.value || '',
175
- creator: ch.purpose.creator || '',
176
- last_set: ch.purpose.last_set || 0,
177
- }
178
- : undefined,
179
- };
133
+ return mapChannel(response.channel);
180
134
  });
181
135
  }
182
136
  async resolveChannel(channel) {
@@ -200,14 +154,7 @@ export class SlackClient {
200
154
  thread_ts: threadTs,
201
155
  });
202
156
  this.checkResponse(response);
203
- const msg = response.message;
204
- return {
205
- ts: response.ts,
206
- text: msg.text || text,
207
- type: msg.type || 'message',
208
- user: msg.user,
209
- thread_ts: msg.thread_ts,
210
- };
157
+ return mapMessage(response.message, { ts: response.ts, text, type: 'message' });
211
158
  });
212
159
  }
213
160
  async getMessages(channel, limitOrOptions) {
@@ -221,34 +168,7 @@ export class SlackClient {
221
168
  latest,
222
169
  });
223
170
  this.checkResponse(response);
224
- return (response.messages || []).map((msg) => ({
225
- ts: msg.ts,
226
- text: msg.text || '',
227
- type: msg.type || 'message',
228
- user: msg.user,
229
- username: msg.username,
230
- thread_ts: msg.thread_ts,
231
- reply_count: msg.reply_count,
232
- replies: msg.replies,
233
- reactions: msg.reactions,
234
- edited: msg.edited
235
- ? {
236
- user: msg.edited.user || '',
237
- ts: msg.edited.ts || '',
238
- }
239
- : undefined,
240
- files: msg.files?.map((f) => ({
241
- id: f.id,
242
- name: f.name,
243
- title: f.title || f.name || '',
244
- mimetype: f.mimetype || 'application/octet-stream',
245
- size: f.size || 0,
246
- url_private: f.url_private || '',
247
- created: f.created || 0,
248
- user: f.user || '',
249
- channels: f.channels,
250
- })),
251
- }));
171
+ return (response.messages || []).map((msg) => mapMessage(msg));
252
172
  });
253
173
  }
254
174
  async getMessage(channel, ts) {
@@ -264,34 +184,7 @@ export class SlackClient {
264
184
  if (!msg || msg.ts !== ts) {
265
185
  return null;
266
186
  }
267
- return {
268
- ts: msg.ts,
269
- text: msg.text || '',
270
- type: msg.type || 'message',
271
- user: msg.user,
272
- username: msg.username,
273
- thread_ts: msg.thread_ts,
274
- reply_count: msg.reply_count,
275
- replies: msg.replies,
276
- reactions: msg.reactions,
277
- edited: msg.edited
278
- ? {
279
- user: msg.edited.user || '',
280
- ts: msg.edited.ts || '',
281
- }
282
- : undefined,
283
- files: msg.files?.map((f) => ({
284
- id: f.id,
285
- name: f.name,
286
- title: f.title || f.name || '',
287
- mimetype: f.mimetype || 'application/octet-stream',
288
- size: f.size || 0,
289
- url_private: f.url_private || '',
290
- created: f.created || 0,
291
- user: f.user || '',
292
- channels: f.channels,
293
- })),
294
- };
187
+ return mapMessage(msg);
295
188
  });
296
189
  }
297
190
  async updateMessage(channel, ts, text) {
@@ -302,13 +195,7 @@ export class SlackClient {
302
195
  text,
303
196
  });
304
197
  this.checkResponse(response);
305
- const msg = response.message;
306
- return {
307
- ts: response.ts,
308
- text: msg.text || text,
309
- type: 'message',
310
- user: msg.user,
311
- };
198
+ return mapMessage(response.message, { ts: response.ts, text, type: 'message' });
312
199
  });
313
200
  }
314
201
  async deleteMessage(channel, ts) {
@@ -352,23 +239,7 @@ export class SlackClient {
352
239
  this.checkResponse(response);
353
240
  if (response.members) {
354
241
  for (const member of response.members) {
355
- users.push({
356
- id: member.id,
357
- name: member.name,
358
- real_name: member.real_name || member.name || '',
359
- is_admin: member.is_admin || false,
360
- is_owner: member.is_owner || false,
361
- is_bot: member.is_bot || false,
362
- is_app_user: member.is_app_user || false,
363
- profile: member.profile
364
- ? {
365
- email: member.profile.email,
366
- phone: member.profile.phone,
367
- title: member.profile.title,
368
- status_text: member.profile.status_text,
369
- }
370
- : undefined,
371
- });
242
+ users.push(mapUser(member));
372
243
  }
373
244
  }
374
245
  cursor = response.response_metadata?.next_cursor;
@@ -399,24 +270,7 @@ export class SlackClient {
399
270
  return this.withRetry(async () => {
400
271
  const response = await this.ensureAuth().users.info({ user: id });
401
272
  this.checkResponse(response);
402
- const member = response.user;
403
- return {
404
- id: member.id,
405
- name: member.name,
406
- real_name: member.real_name || member.name || '',
407
- is_admin: member.is_admin || false,
408
- is_owner: member.is_owner || false,
409
- is_bot: member.is_bot || false,
410
- is_app_user: member.is_app_user || false,
411
- profile: member.profile
412
- ? {
413
- email: member.profile.email,
414
- phone: member.profile.phone,
415
- title: member.profile.title,
416
- status_text: member.profile.status_text,
417
- }
418
- : undefined,
419
- };
273
+ return mapUser(response.user);
420
274
  });
421
275
  }
422
276
  async uploadFile(channels, file, filename) {
@@ -432,17 +286,7 @@ export class SlackClient {
432
286
  if (!f) {
433
287
  throw new SlackError('No file returned in upload response', 'file_not_found');
434
288
  }
435
- return {
436
- id: f.id,
437
- name: f.name,
438
- title: f.title || f.name || '',
439
- mimetype: f.mimetype || 'application/octet-stream',
440
- size: f.size || 0,
441
- url_private: f.url_private || '',
442
- created: f.created || 0,
443
- user: f.user || '',
444
- channels: f.channels,
445
- };
289
+ return mapFile(f);
446
290
  });
447
291
  }
448
292
  async listFiles(channel) {
@@ -451,35 +295,14 @@ export class SlackClient {
451
295
  channel,
452
296
  });
453
297
  this.checkResponse(response);
454
- return (response.files || []).map((f) => ({
455
- id: f.id,
456
- name: f.name,
457
- title: f.title || f.name || '',
458
- mimetype: f.mimetype || 'application/octet-stream',
459
- size: f.size || 0,
460
- url_private: f.url_private || '',
461
- created: f.created || 0,
462
- user: f.user || '',
463
- channels: f.channels,
464
- }));
298
+ return (response.files || []).map((f) => mapFile(f));
465
299
  });
466
300
  }
467
301
  async getFileInfo(fileId) {
468
302
  return this.withRetry(async () => {
469
303
  const response = await this.ensureAuth().files.info({ file: fileId });
470
304
  this.checkResponse(response);
471
- const f = response.file;
472
- return {
473
- id: f.id,
474
- name: f.name,
475
- title: f.title || f.name || '',
476
- mimetype: f.mimetype || 'application/octet-stream',
477
- size: f.size || 0,
478
- url_private: f.url_private || '',
479
- created: f.created || 0,
480
- user: f.user || '',
481
- channels: f.channels,
482
- };
305
+ return mapFile(response.file);
483
306
  });
484
307
  }
485
308
  async downloadFile(fileId) {
@@ -537,33 +360,7 @@ export class SlackClient {
537
360
  cursor: options.cursor,
538
361
  });
539
362
  this.checkResponse(response);
540
- const messages = (response.messages || []).map((msg) => ({
541
- ts: msg.ts,
542
- text: msg.text || '',
543
- type: msg.type || 'message',
544
- user: msg.user,
545
- username: msg.username,
546
- thread_ts: msg.thread_ts,
547
- reply_count: msg.reply_count,
548
- edited: msg.edited
549
- ? {
550
- user: msg.edited.user || '',
551
- ts: msg.edited.ts || '',
552
- }
553
- : undefined,
554
- reactions: msg.reactions,
555
- files: msg.files?.map((f) => ({
556
- id: f.id,
557
- name: f.name,
558
- title: f.title || f.name || '',
559
- mimetype: f.mimetype || 'application/octet-stream',
560
- size: f.size || 0,
561
- url_private: f.url_private || '',
562
- created: f.created || 0,
563
- user: f.user || '',
564
- channels: f.channels,
565
- })),
566
- }));
363
+ const messages = (response.messages || []).map((msg) => mapMessage(msg));
567
364
  return {
568
365
  messages,
569
366
  has_more: response.has_more || false,
@@ -641,30 +438,7 @@ export class SlackClient {
641
438
  limit: 50,
642
439
  });
643
440
  this.checkResponse(response);
644
- const items = (response.items || []).map((item) => ({
645
- type: item.type || 'message',
646
- message: {
647
- ts: item.message?.ts || '',
648
- text: item.message?.text || '',
649
- user: item.message?.user,
650
- username: item.message?.username,
651
- type: item.message?.type || 'message',
652
- thread_ts: item.message?.thread_ts,
653
- reply_count: item.message?.reply_count,
654
- replies: item.message?.replies,
655
- edited: item.message?.edited
656
- ? {
657
- user: item.message.edited.user || '',
658
- ts: item.message.edited.ts || '',
659
- }
660
- : undefined,
661
- },
662
- channel: {
663
- id: item.channel?.id || '',
664
- name: item.channel?.name || '',
665
- },
666
- date_created: item.date_created || 0,
667
- }));
441
+ const items = (response.items || []).map((item) => mapSavedItem(item));
668
442
  return {
669
443
  items,
670
444
  has_more: response.has_more || false,
@@ -745,20 +519,7 @@ export class SlackClient {
745
519
  this.checkResponse(response);
746
520
  return (response.items || [])
747
521
  .filter((item) => item.message)
748
- .map((item) => ({
749
- channel,
750
- message: {
751
- ts: item.message.ts || '',
752
- text: item.message.text || '',
753
- user: item.message.user,
754
- username: item.message.username,
755
- type: item.message.type || 'message',
756
- thread_ts: item.message.thread_ts,
757
- reply_count: item.message.reply_count,
758
- },
759
- date_created: item.created || 0,
760
- created_by: item.created_by || '',
761
- }));
522
+ .map((item) => mapPin(item, channel));
762
523
  });
763
524
  }
764
525
  async addBookmark(channel, title, link, options) {
@@ -771,19 +532,12 @@ export class SlackClient {
771
532
  emoji: options?.emoji,
772
533
  });
773
534
  this.checkResponse(response);
774
- const b = response.bookmark;
775
- return {
776
- id: b.id || '',
777
- channel_id: b.channel_id || channel,
778
- title: b.title || title,
779
- link: b.link || link,
780
- emoji: b.emoji,
781
- icon_url: b.icon_url,
782
- type: b.type || 'link',
783
- date_created: b.date_created || 0,
784
- date_updated: b.date_updated || 0,
785
- created_by: b.created_by || '',
786
- };
535
+ return mapBookmark(response.bookmark, {
536
+ channel_id: channel,
537
+ title,
538
+ link,
539
+ type: options?.type || 'link',
540
+ });
787
541
  });
788
542
  }
789
543
  async editBookmark(channel, bookmarkId, options) {
@@ -794,19 +548,7 @@ export class SlackClient {
794
548
  ...options,
795
549
  });
796
550
  this.checkResponse(response);
797
- const b = response.bookmark;
798
- return {
799
- id: b.id || bookmarkId,
800
- channel_id: b.channel_id || channel,
801
- title: b.title || '',
802
- link: b.link || '',
803
- emoji: b.emoji,
804
- icon_url: b.icon_url,
805
- type: b.type || 'link',
806
- date_created: b.date_created || 0,
807
- date_updated: b.date_updated || 0,
808
- created_by: b.created_by || '',
809
- };
551
+ return mapBookmark(response.bookmark, { id: bookmarkId, channel_id: channel, type: 'link' });
810
552
  });
811
553
  }
812
554
  async removeBookmark(channel, bookmarkId) {
@@ -822,18 +564,7 @@ export class SlackClient {
822
564
  return this.withRetry(async () => {
823
565
  const response = await this.ensureAuth().apiCall('bookmarks.list', { channel_id: channel });
824
566
  this.checkResponse(response);
825
- return (response.bookmarks || []).map((b) => ({
826
- id: b.id || '',
827
- channel_id: b.channel_id || channel,
828
- title: b.title || '',
829
- link: b.link || '',
830
- emoji: b.emoji,
831
- icon_url: b.icon_url,
832
- type: b.type || 'link',
833
- date_created: b.date_created || 0,
834
- date_updated: b.date_updated || 0,
835
- created_by: b.created_by || '',
836
- }));
567
+ return (response.bookmarks || []).map((bookmark) => mapBookmark(bookmark, { channel_id: channel, type: 'link' }));
837
568
  });
838
569
  }
839
570
  async scheduleMessage(channel, text, postAt, threadTs) {
@@ -845,13 +576,12 @@ export class SlackClient {
845
576
  thread_ts: threadTs,
846
577
  });
847
578
  this.checkResponse(response);
848
- return {
849
- id: response.scheduled_message_id || '',
579
+ return mapScheduledMessage(response, {
850
580
  channel_id: channel,
851
581
  post_at: postAt,
852
582
  date_created: Math.floor(Date.now() / 1000),
853
583
  text,
854
- };
584
+ });
855
585
  });
856
586
  }
857
587
  async listScheduledMessages(channel) {
@@ -864,13 +594,7 @@ export class SlackClient {
864
594
  ...(cursor ? { cursor } : {}),
865
595
  });
866
596
  this.checkResponse(response);
867
- const messages = (response.scheduled_messages || []).map((msg) => ({
868
- id: msg.id || msg.scheduled_message_id || '',
869
- channel_id: msg.channel_id || '',
870
- post_at: msg.post_at || 0,
871
- date_created: msg.date_created || 0,
872
- text: msg.text || '',
873
- }));
597
+ const messages = (response.scheduled_messages || []).map((message) => mapScheduledMessage(message));
874
598
  allMessages.push(...messages);
875
599
  cursor = response.response_metadata?.next_cursor;
876
600
  } while (cursor);
@@ -890,29 +614,7 @@ export class SlackClient {
890
614
  return this.withRetry(async () => {
891
615
  const response = await this.ensureAuth().conversations.create({ name, is_private: isPrivate });
892
616
  this.checkResponse(response);
893
- const ch = response.channel;
894
- return {
895
- id: ch.id,
896
- name: ch.name,
897
- is_private: ch.is_private || false,
898
- is_archived: ch.is_archived || false,
899
- created: ch.created || 0,
900
- creator: ch.creator || '',
901
- topic: ch.topic
902
- ? {
903
- value: ch.topic.value || '',
904
- creator: ch.topic.creator || '',
905
- last_set: ch.topic.last_set || 0,
906
- }
907
- : undefined,
908
- purpose: ch.purpose
909
- ? {
910
- value: ch.purpose.value || '',
911
- creator: ch.purpose.creator || '',
912
- last_set: ch.purpose.last_set || 0,
913
- }
914
- : undefined,
915
- };
617
+ return mapChannel(response.channel, { name });
916
618
  });
917
619
  }
918
620
  async archiveChannel(channel) {
@@ -939,30 +641,14 @@ export class SlackClient {
939
641
  return this.withRetry(async () => {
940
642
  const response = await this.ensureAuth().conversations.invite({ channel, users });
941
643
  this.checkResponse(response);
942
- const ch = response.channel;
943
- return {
944
- id: ch.id,
945
- name: ch.name,
946
- is_private: ch.is_private || false,
947
- is_archived: ch.is_archived || false,
948
- created: ch.created || 0,
949
- creator: ch.creator || '',
950
- };
644
+ return mapChannel(response.channel);
951
645
  });
952
646
  }
953
647
  async joinChannel(channel) {
954
648
  return this.withRetry(async () => {
955
649
  const response = await this.ensureAuth().conversations.join({ channel });
956
650
  this.checkResponse(response);
957
- const ch = response.channel;
958
- return {
959
- id: ch.id,
960
- name: ch.name,
961
- is_private: ch.is_private || false,
962
- is_archived: ch.is_archived || false,
963
- created: ch.created || 0,
964
- creator: ch.creator || '',
965
- };
651
+ return mapChannel(response.channel);
966
652
  });
967
653
  }
968
654
  async leaveChannel(channel) {
@@ -975,80 +661,21 @@ export class SlackClient {
975
661
  return this.withRetry(async () => {
976
662
  const response = await this.ensureAuth().users.lookupByEmail({ email });
977
663
  this.checkResponse(response);
978
- const member = response.user;
979
- return {
980
- id: member.id,
981
- name: member.name,
982
- real_name: member.real_name || member.name || '',
983
- is_admin: member.is_admin || false,
984
- is_owner: member.is_owner || false,
985
- is_bot: member.is_bot || false,
986
- is_app_user: member.is_app_user || false,
987
- profile: member.profile
988
- ? {
989
- email: member.profile.email,
990
- phone: member.profile.phone,
991
- title: member.profile.title,
992
- status_text: member.profile.status_text,
993
- }
994
- : undefined,
995
- };
664
+ return mapUser(response.user);
996
665
  });
997
666
  }
998
667
  async getUserProfile(userId) {
999
668
  return this.withRetry(async () => {
1000
669
  const response = await this.ensureAuth().users.profile.get({ user: userId });
1001
670
  this.checkResponse(response);
1002
- const p = response.profile || {};
1003
- return {
1004
- title: p.title,
1005
- phone: p.phone,
1006
- skype: p.skype,
1007
- real_name: p.real_name,
1008
- real_name_normalized: p.real_name_normalized,
1009
- display_name: p.display_name,
1010
- display_name_normalized: p.display_name_normalized,
1011
- status_text: p.status_text,
1012
- status_emoji: p.status_emoji,
1013
- status_expiration: p.status_expiration,
1014
- email: p.email,
1015
- first_name: p.first_name,
1016
- last_name: p.last_name,
1017
- image_24: p.image_24,
1018
- image_32: p.image_32,
1019
- image_48: p.image_48,
1020
- image_72: p.image_72,
1021
- image_192: p.image_192,
1022
- image_512: p.image_512,
1023
- };
671
+ return mapUserProfile(response.profile);
1024
672
  });
1025
673
  }
1026
674
  async setUserProfile(profile) {
1027
675
  return this.withRetry(async () => {
1028
676
  const response = await this.ensureAuth().users.profile.set({ profile: profile });
1029
677
  this.checkResponse(response);
1030
- const p = response.profile || {};
1031
- return {
1032
- title: p.title,
1033
- phone: p.phone,
1034
- skype: p.skype,
1035
- real_name: p.real_name,
1036
- real_name_normalized: p.real_name_normalized,
1037
- display_name: p.display_name,
1038
- display_name_normalized: p.display_name_normalized,
1039
- status_text: p.status_text,
1040
- status_emoji: p.status_emoji,
1041
- status_expiration: p.status_expiration,
1042
- email: p.email,
1043
- first_name: p.first_name,
1044
- last_name: p.last_name,
1045
- image_24: p.image_24,
1046
- image_32: p.image_32,
1047
- image_48: p.image_48,
1048
- image_72: p.image_72,
1049
- image_192: p.image_192,
1050
- image_512: p.image_512,
1051
- };
678
+ return mapUserProfile(response.profile);
1052
679
  });
1053
680
  }
1054
681
  async postEphemeral(channel, user, text) {
@@ -1069,31 +696,14 @@ export class SlackClient {
1069
696
  return this.withRetry(async () => {
1070
697
  const response = await this.ensureAuth().reminders.add({ text, time: time, user: options?.user });
1071
698
  this.checkResponse(response);
1072
- const r = response.reminder || {};
1073
- return {
1074
- id: r.id || '',
1075
- creator: r.creator || '',
1076
- text: r.text || text,
1077
- user: r.user || '',
1078
- recurring: r.recurring || false,
1079
- time: r.time || time,
1080
- complete_ts: r.complete_ts || 0,
1081
- };
699
+ return mapReminder(response.reminder, { text, time });
1082
700
  });
1083
701
  }
1084
702
  async listReminders() {
1085
703
  return this.withRetry(async () => {
1086
704
  const response = await this.ensureAuth().reminders.list({});
1087
705
  this.checkResponse(response);
1088
- return (response.reminders || []).map((r) => ({
1089
- id: r.id || '',
1090
- creator: r.creator || '',
1091
- text: r.text || '',
1092
- user: r.user || '',
1093
- recurring: r.recurring || false,
1094
- time: r.time || 0,
1095
- complete_ts: r.complete_ts || 0,
1096
- }));
706
+ return (response.reminders || []).map((reminder) => mapReminder(reminder));
1097
707
  });
1098
708
  }
1099
709
  async completeReminder(reminderId) {
@@ -1121,30 +731,6 @@ export class SlackClient {
1121
731
  return (response.emoji || {});
1122
732
  });
1123
733
  }
1124
- mapUsergroup(ug) {
1125
- return {
1126
- id: ug.id || '',
1127
- team_id: ug.team_id || '',
1128
- name: ug.name || '',
1129
- handle: ug.handle || '',
1130
- description: ug.description || '',
1131
- is_external: ug.is_external ?? false,
1132
- is_usergroup: ug.is_usergroup ?? true,
1133
- date_create: ug.date_create ?? 0,
1134
- date_update: ug.date_update ?? 0,
1135
- date_delete: ug.date_delete ?? 0,
1136
- auto_type: ug.auto_type ?? null,
1137
- created_by: ug.created_by || '',
1138
- updated_by: ug.updated_by || '',
1139
- deleted_by: ug.deleted_by ?? null,
1140
- prefs: {
1141
- channels: ug.prefs?.channels || [],
1142
- groups: ug.prefs?.groups || [],
1143
- },
1144
- users: ug.users || [],
1145
- user_count: ug.user_count ?? 0,
1146
- };
1147
- }
1148
734
  async listUsergroups(options) {
1149
735
  return this.withRetry(async () => {
1150
736
  const response = await this.ensureAuth().apiCall('usergroups.list', {
@@ -1153,7 +739,7 @@ export class SlackClient {
1153
739
  include_count: options?.includeCount,
1154
740
  });
1155
741
  this.checkResponse(response);
1156
- return (response.usergroups || []).map((ug) => this.mapUsergroup(ug));
742
+ return (response.usergroups || []).map((usergroup) => mapUsergroup(usergroup));
1157
743
  });
1158
744
  }
1159
745
  async createUsergroup(name, options) {
@@ -1165,7 +751,7 @@ export class SlackClient {
1165
751
  channels: options?.channels?.join(','),
1166
752
  });
1167
753
  this.checkResponse(response);
1168
- return this.mapUsergroup(response.usergroup);
754
+ return mapUsergroup(response.usergroup);
1169
755
  });
1170
756
  }
1171
757
  async updateUsergroup(usergroupId, options) {
@@ -1178,7 +764,7 @@ export class SlackClient {
1178
764
  channels: options.channels?.join(','),
1179
765
  });
1180
766
  this.checkResponse(response);
1181
- return this.mapUsergroup(response.usergroup);
767
+ return mapUsergroup(response.usergroup);
1182
768
  });
1183
769
  }
1184
770
  async disableUsergroup(usergroupId) {
@@ -1187,7 +773,7 @@ export class SlackClient {
1187
773
  usergroup: usergroupId,
1188
774
  });
1189
775
  this.checkResponse(response);
1190
- return this.mapUsergroup(response.usergroup);
776
+ return mapUsergroup(response.usergroup);
1191
777
  });
1192
778
  }
1193
779
  async enableUsergroup(usergroupId) {
@@ -1196,7 +782,7 @@ export class SlackClient {
1196
782
  usergroup: usergroupId,
1197
783
  });
1198
784
  this.checkResponse(response);
1199
- return this.mapUsergroup(response.usergroup);
785
+ return mapUsergroup(response.usergroup);
1200
786
  });
1201
787
  }
1202
788
  async listUsergroupMembers(usergroupId, options) {
@@ -1216,7 +802,7 @@ export class SlackClient {
1216
802
  users: users.join(','),
1217
803
  });
1218
804
  this.checkResponse(response);
1219
- return this.mapUsergroup(response.usergroup);
805
+ return mapUsergroup(response.usergroup);
1220
806
  });
1221
807
  }
1222
808
  }