agent-messenger 2.4.0 → 2.6.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 (359) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/ci.yml +35 -0
  3. package/.github/workflows/release.yml +0 -12
  4. package/README.md +3 -3
  5. package/bun.lock +10 -2
  6. package/dist/package.json +3 -1
  7. package/dist/src/platforms/channeltalk/cli.d.ts.map +1 -1
  8. package/dist/src/platforms/channeltalk/cli.js +2 -1
  9. package/dist/src/platforms/channeltalk/cli.js.map +1 -1
  10. package/dist/src/platforms/channeltalk/commands/index.d.ts +1 -0
  11. package/dist/src/platforms/channeltalk/commands/index.d.ts.map +1 -1
  12. package/dist/src/platforms/channeltalk/commands/index.js +1 -0
  13. package/dist/src/platforms/channeltalk/commands/index.js.map +1 -1
  14. package/dist/src/platforms/channeltalk/commands/whoami.d.ts +22 -0
  15. package/dist/src/platforms/channeltalk/commands/whoami.d.ts.map +1 -0
  16. package/dist/src/platforms/channeltalk/commands/whoami.js +40 -0
  17. package/dist/src/platforms/channeltalk/commands/whoami.js.map +1 -0
  18. package/dist/src/platforms/channeltalkbot/cli.d.ts.map +1 -1
  19. package/dist/src/platforms/channeltalkbot/cli.js +2 -1
  20. package/dist/src/platforms/channeltalkbot/cli.js.map +1 -1
  21. package/dist/src/platforms/channeltalkbot/commands/index.d.ts +1 -0
  22. package/dist/src/platforms/channeltalkbot/commands/index.d.ts.map +1 -1
  23. package/dist/src/platforms/channeltalkbot/commands/index.js +1 -0
  24. package/dist/src/platforms/channeltalkbot/commands/index.js.map +1 -1
  25. package/dist/src/platforms/channeltalkbot/commands/whoami.d.ts +13 -0
  26. package/dist/src/platforms/channeltalkbot/commands/whoami.d.ts.map +1 -0
  27. package/dist/src/platforms/channeltalkbot/commands/whoami.js +31 -0
  28. package/dist/src/platforms/channeltalkbot/commands/whoami.js.map +1 -0
  29. package/dist/src/platforms/discord/cli.d.ts.map +1 -1
  30. package/dist/src/platforms/discord/cli.js +2 -1
  31. package/dist/src/platforms/discord/cli.js.map +1 -1
  32. package/dist/src/platforms/discord/commands/index.d.ts +1 -0
  33. package/dist/src/platforms/discord/commands/index.d.ts.map +1 -1
  34. package/dist/src/platforms/discord/commands/index.js +1 -0
  35. package/dist/src/platforms/discord/commands/index.js.map +1 -1
  36. package/dist/src/platforms/discord/commands/whoami.d.ts +6 -0
  37. package/dist/src/platforms/discord/commands/whoami.d.ts.map +1 -0
  38. package/dist/src/platforms/discord/commands/whoami.js +33 -0
  39. package/dist/src/platforms/discord/commands/whoami.js.map +1 -0
  40. package/dist/src/platforms/discordbot/cli.d.ts.map +1 -1
  41. package/dist/src/platforms/discordbot/cli.js +2 -1
  42. package/dist/src/platforms/discordbot/cli.js.map +1 -1
  43. package/dist/src/platforms/discordbot/commands/index.d.ts +1 -0
  44. package/dist/src/platforms/discordbot/commands/index.d.ts.map +1 -1
  45. package/dist/src/platforms/discordbot/commands/index.js +1 -0
  46. package/dist/src/platforms/discordbot/commands/index.js.map +1 -1
  47. package/dist/src/platforms/discordbot/commands/whoami.d.ts +14 -0
  48. package/dist/src/platforms/discordbot/commands/whoami.d.ts.map +1 -0
  49. package/dist/src/platforms/discordbot/commands/whoami.js +32 -0
  50. package/dist/src/platforms/discordbot/commands/whoami.js.map +1 -0
  51. package/dist/src/platforms/instagram/cli.d.ts.map +1 -1
  52. package/dist/src/platforms/instagram/cli.js +2 -1
  53. package/dist/src/platforms/instagram/cli.js.map +1 -1
  54. package/dist/src/platforms/instagram/client.d.ts +6 -0
  55. package/dist/src/platforms/instagram/client.d.ts.map +1 -1
  56. package/dist/src/platforms/instagram/client.js +12 -0
  57. package/dist/src/platforms/instagram/client.js.map +1 -1
  58. package/dist/src/platforms/instagram/commands/index.d.ts +1 -0
  59. package/dist/src/platforms/instagram/commands/index.d.ts.map +1 -1
  60. package/dist/src/platforms/instagram/commands/index.js +1 -0
  61. package/dist/src/platforms/instagram/commands/index.js.map +1 -1
  62. package/dist/src/platforms/instagram/commands/whoami.d.ts +7 -0
  63. package/dist/src/platforms/instagram/commands/whoami.d.ts.map +1 -0
  64. package/dist/src/platforms/instagram/commands/whoami.js +19 -0
  65. package/dist/src/platforms/instagram/commands/whoami.js.map +1 -0
  66. package/dist/src/platforms/kakaotalk/cli.js +2 -2
  67. package/dist/src/platforms/kakaotalk/cli.js.map +1 -1
  68. package/dist/src/platforms/kakaotalk/client.d.ts +4 -1
  69. package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
  70. package/dist/src/platforms/kakaotalk/client.js +193 -27
  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 +24 -55
  74. package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
  75. package/dist/src/platforms/kakaotalk/commands/index.d.ts +1 -1
  76. package/dist/src/platforms/kakaotalk/commands/index.d.ts.map +1 -1
  77. package/dist/src/platforms/kakaotalk/commands/index.js +1 -1
  78. package/dist/src/platforms/kakaotalk/commands/index.js.map +1 -1
  79. package/dist/src/platforms/kakaotalk/commands/whoami.d.ts +3 -0
  80. package/dist/src/platforms/kakaotalk/commands/whoami.d.ts.map +1 -0
  81. package/dist/src/platforms/kakaotalk/commands/{profile.js → whoami.js} +5 -5
  82. package/dist/src/platforms/kakaotalk/commands/whoami.js.map +1 -0
  83. package/dist/src/platforms/kakaotalk/credential-manager.d.ts.map +1 -1
  84. package/dist/src/platforms/kakaotalk/credential-manager.js +1 -0
  85. package/dist/src/platforms/kakaotalk/credential-manager.js.map +1 -1
  86. package/dist/src/platforms/kakaotalk/index.d.ts +1 -1
  87. package/dist/src/platforms/kakaotalk/index.d.ts.map +1 -1
  88. package/dist/src/platforms/kakaotalk/index.js.map +1 -1
  89. package/dist/src/platforms/kakaotalk/listener.js +2 -2
  90. package/dist/src/platforms/kakaotalk/listener.js.map +1 -1
  91. package/dist/src/platforms/kakaotalk/protocol/config.d.ts +8 -2
  92. package/dist/src/platforms/kakaotalk/protocol/config.d.ts.map +1 -1
  93. package/dist/src/platforms/kakaotalk/protocol/config.js +15 -2
  94. package/dist/src/platforms/kakaotalk/protocol/config.js.map +1 -1
  95. package/dist/src/platforms/kakaotalk/protocol/session.d.ts +6 -2
  96. package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
  97. package/dist/src/platforms/kakaotalk/protocol/session.js +37 -15
  98. package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
  99. package/dist/src/platforms/kakaotalk/protocol/types.d.ts +17 -0
  100. package/dist/src/platforms/kakaotalk/protocol/types.d.ts.map +1 -1
  101. package/dist/src/platforms/kakaotalk/protocol/types.js.map +1 -1
  102. package/dist/src/platforms/kakaotalk/types.d.ts +22 -0
  103. package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
  104. package/dist/src/platforms/kakaotalk/types.js +7 -0
  105. package/dist/src/platforms/kakaotalk/types.js.map +1 -1
  106. package/dist/src/platforms/line/cli.js +2 -2
  107. package/dist/src/platforms/line/cli.js.map +1 -1
  108. package/dist/src/platforms/line/commands/auth.d.ts.map +1 -1
  109. package/dist/src/platforms/line/commands/auth.js +9 -59
  110. package/dist/src/platforms/line/commands/auth.js.map +1 -1
  111. package/dist/src/platforms/line/commands/index.d.ts +1 -1
  112. package/dist/src/platforms/line/commands/index.d.ts.map +1 -1
  113. package/dist/src/platforms/line/commands/index.js +1 -1
  114. package/dist/src/platforms/line/commands/index.js.map +1 -1
  115. package/dist/src/platforms/line/commands/whoami.d.ts +3 -0
  116. package/dist/src/platforms/line/commands/whoami.d.ts.map +1 -0
  117. package/dist/src/platforms/line/commands/{profile.js → whoami.js} +5 -5
  118. package/dist/src/platforms/line/commands/whoami.js.map +1 -0
  119. package/dist/src/platforms/slack/cli.d.ts.map +1 -1
  120. package/dist/src/platforms/slack/cli.js +2 -1
  121. package/dist/src/platforms/slack/cli.js.map +1 -1
  122. package/dist/src/platforms/slack/commands/index.d.ts +1 -0
  123. package/dist/src/platforms/slack/commands/index.d.ts.map +1 -1
  124. package/dist/src/platforms/slack/commands/index.js +1 -0
  125. package/dist/src/platforms/slack/commands/index.js.map +1 -1
  126. package/dist/src/platforms/slack/commands/whoami.d.ts +6 -0
  127. package/dist/src/platforms/slack/commands/whoami.d.ts.map +1 -0
  128. package/dist/src/platforms/slack/commands/whoami.js +39 -0
  129. package/dist/src/platforms/slack/commands/whoami.js.map +1 -0
  130. package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
  131. package/dist/src/platforms/slackbot/cli.js +2 -1
  132. package/dist/src/platforms/slackbot/cli.js.map +1 -1
  133. package/dist/src/platforms/slackbot/commands/index.d.ts +1 -0
  134. package/dist/src/platforms/slackbot/commands/index.d.ts.map +1 -1
  135. package/dist/src/platforms/slackbot/commands/index.js +1 -0
  136. package/dist/src/platforms/slackbot/commands/index.js.map +1 -1
  137. package/dist/src/platforms/slackbot/commands/whoami.d.ts +14 -0
  138. package/dist/src/platforms/slackbot/commands/whoami.d.ts.map +1 -0
  139. package/dist/src/platforms/slackbot/commands/whoami.js +32 -0
  140. package/dist/src/platforms/slackbot/commands/whoami.js.map +1 -0
  141. package/dist/src/platforms/teams/cli.d.ts.map +1 -1
  142. package/dist/src/platforms/teams/cli.js +2 -1
  143. package/dist/src/platforms/teams/cli.js.map +1 -1
  144. package/dist/src/platforms/teams/commands/index.d.ts +1 -0
  145. package/dist/src/platforms/teams/commands/index.d.ts.map +1 -1
  146. package/dist/src/platforms/teams/commands/index.js +1 -0
  147. package/dist/src/platforms/teams/commands/index.js.map +1 -1
  148. package/dist/src/platforms/teams/commands/whoami.d.ts +6 -0
  149. package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -0
  150. package/dist/src/platforms/teams/commands/whoami.js +30 -0
  151. package/dist/src/platforms/teams/commands/whoami.js.map +1 -0
  152. package/dist/src/platforms/telegram/cli.d.ts.map +1 -1
  153. package/dist/src/platforms/telegram/cli.js +2 -1
  154. package/dist/src/platforms/telegram/cli.js.map +1 -1
  155. package/dist/src/platforms/telegram/commands/index.d.ts +1 -0
  156. package/dist/src/platforms/telegram/commands/index.d.ts.map +1 -1
  157. package/dist/src/platforms/telegram/commands/index.js +1 -0
  158. package/dist/src/platforms/telegram/commands/index.js.map +1 -1
  159. package/dist/src/platforms/telegram/commands/whoami.d.ts +7 -0
  160. package/dist/src/platforms/telegram/commands/whoami.d.ts.map +1 -0
  161. package/dist/src/platforms/telegram/commands/whoami.js +27 -0
  162. package/dist/src/platforms/telegram/commands/whoami.js.map +1 -0
  163. package/dist/src/platforms/webex/cli.d.ts.map +1 -1
  164. package/dist/src/platforms/webex/cli.js +2 -1
  165. package/dist/src/platforms/webex/cli.js.map +1 -1
  166. package/dist/src/platforms/webex/commands/index.d.ts +1 -0
  167. package/dist/src/platforms/webex/commands/index.d.ts.map +1 -1
  168. package/dist/src/platforms/webex/commands/index.js +1 -0
  169. package/dist/src/platforms/webex/commands/index.js.map +1 -1
  170. package/dist/src/platforms/webex/commands/message.js +1 -1
  171. package/dist/src/platforms/webex/commands/message.js.map +1 -1
  172. package/dist/src/platforms/webex/commands/whoami.d.ts +6 -0
  173. package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -0
  174. package/dist/src/platforms/webex/commands/whoami.js +30 -0
  175. package/dist/src/platforms/webex/commands/whoami.js.map +1 -0
  176. package/dist/src/platforms/wechatbot/cli.d.ts.map +1 -1
  177. package/dist/src/platforms/wechatbot/cli.js +2 -1
  178. package/dist/src/platforms/wechatbot/cli.js.map +1 -1
  179. package/dist/src/platforms/wechatbot/commands/index.d.ts +1 -0
  180. package/dist/src/platforms/wechatbot/commands/index.d.ts.map +1 -1
  181. package/dist/src/platforms/wechatbot/commands/index.js +1 -0
  182. package/dist/src/platforms/wechatbot/commands/index.js.map +1 -1
  183. package/dist/src/platforms/wechatbot/commands/whoami.d.ts +12 -0
  184. package/dist/src/platforms/wechatbot/commands/whoami.d.ts.map +1 -0
  185. package/dist/src/platforms/wechatbot/commands/whoami.js +33 -0
  186. package/dist/src/platforms/wechatbot/commands/whoami.js.map +1 -0
  187. package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -1
  188. package/dist/src/platforms/whatsapp/cli.js +2 -1
  189. package/dist/src/platforms/whatsapp/cli.js.map +1 -1
  190. package/dist/src/platforms/whatsapp/client.d.ts +8 -0
  191. package/dist/src/platforms/whatsapp/client.d.ts.map +1 -1
  192. package/dist/src/platforms/whatsapp/client.js +116 -8
  193. package/dist/src/platforms/whatsapp/client.js.map +1 -1
  194. package/dist/src/platforms/whatsapp/commands/auth.d.ts.map +1 -1
  195. package/dist/src/platforms/whatsapp/commands/auth.js +115 -45
  196. package/dist/src/platforms/whatsapp/commands/auth.js.map +1 -1
  197. package/dist/src/platforms/whatsapp/commands/index.d.ts +1 -0
  198. package/dist/src/platforms/whatsapp/commands/index.d.ts.map +1 -1
  199. package/dist/src/platforms/whatsapp/commands/index.js +1 -0
  200. package/dist/src/platforms/whatsapp/commands/index.js.map +1 -1
  201. package/dist/src/platforms/whatsapp/commands/shared.js +2 -2
  202. package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -1
  203. package/dist/src/platforms/whatsapp/commands/whoami.d.ts +7 -0
  204. package/dist/src/platforms/whatsapp/commands/whoami.d.ts.map +1 -0
  205. package/dist/src/platforms/whatsapp/commands/whoami.js +19 -0
  206. package/dist/src/platforms/whatsapp/commands/whoami.js.map +1 -0
  207. package/dist/src/platforms/whatsapp/ensure-auth.js +2 -2
  208. package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -1
  209. package/dist/src/platforms/whatsappbot/cli.d.ts.map +1 -1
  210. package/dist/src/platforms/whatsappbot/cli.js +2 -1
  211. package/dist/src/platforms/whatsappbot/cli.js.map +1 -1
  212. package/dist/src/platforms/whatsappbot/commands/index.d.ts +1 -0
  213. package/dist/src/platforms/whatsappbot/commands/index.d.ts.map +1 -1
  214. package/dist/src/platforms/whatsappbot/commands/index.js +1 -0
  215. package/dist/src/platforms/whatsappbot/commands/index.js.map +1 -1
  216. package/dist/src/platforms/whatsappbot/commands/whoami.d.ts +17 -0
  217. package/dist/src/platforms/whatsappbot/commands/whoami.d.ts.map +1 -0
  218. package/dist/src/platforms/whatsappbot/commands/whoami.js +39 -0
  219. package/dist/src/platforms/whatsappbot/commands/whoami.js.map +1 -0
  220. package/dist/src/shared/utils/qr.d.ts +15 -0
  221. package/dist/src/shared/utils/qr.d.ts.map +1 -0
  222. package/dist/src/shared/utils/qr.js +74 -0
  223. package/dist/src/shared/utils/qr.js.map +1 -0
  224. package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -1
  225. package/dist/src/tui/adapters/kakaotalk-adapter.js +5 -2
  226. package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -1
  227. package/dist/src/tui/adapters/whatsapp-adapter.d.ts.map +1 -1
  228. package/dist/src/tui/adapters/whatsapp-adapter.js +20 -15
  229. package/dist/src/tui/adapters/whatsapp-adapter.js.map +1 -1
  230. package/docs/content/docs/cli/channeltalk.mdx +11 -0
  231. package/docs/content/docs/cli/channeltalkbot.mdx +9 -0
  232. package/docs/content/docs/cli/discord.mdx +10 -0
  233. package/docs/content/docs/cli/discordbot.mdx +9 -0
  234. package/docs/content/docs/cli/instagram.mdx +11 -0
  235. package/docs/content/docs/cli/kakaotalk.mdx +27 -39
  236. package/docs/content/docs/cli/line.mdx +4 -4
  237. package/docs/content/docs/cli/slack.mdx +10 -0
  238. package/docs/content/docs/cli/slackbot.mdx +9 -0
  239. package/docs/content/docs/cli/teams.mdx +10 -0
  240. package/docs/content/docs/cli/telegram.mdx +11 -0
  241. package/docs/content/docs/cli/webex.mdx +10 -0
  242. package/docs/content/docs/cli/wechatbot.mdx +9 -0
  243. package/docs/content/docs/cli/whatsapp.mdx +36 -7
  244. package/docs/content/docs/cli/whatsappbot.mdx +9 -0
  245. package/e2e/config.ts +1 -1
  246. package/package.json +3 -1
  247. package/skills/agent-channeltalk/SKILL.md +12 -1
  248. package/skills/agent-channeltalkbot/SKILL.md +10 -1
  249. package/skills/agent-discord/SKILL.md +11 -1
  250. package/skills/agent-discordbot/SKILL.md +10 -1
  251. package/skills/agent-instagram/SKILL.md +12 -1
  252. package/skills/agent-kakaotalk/SKILL.md +24 -70
  253. package/skills/agent-kakaotalk/references/authentication.md +4 -69
  254. package/skills/agent-kakaotalk/references/common-patterns.md +14 -1
  255. package/skills/agent-line/SKILL.md +5 -5
  256. package/skills/agent-slack/SKILL.md +11 -1
  257. package/skills/agent-slackbot/SKILL.md +10 -1
  258. package/skills/agent-teams/SKILL.md +11 -1
  259. package/skills/agent-telegram/SKILL.md +6 -1
  260. package/skills/agent-webex/SKILL.md +11 -1
  261. package/skills/agent-wechatbot/SKILL.md +10 -1
  262. package/skills/agent-whatsapp/SKILL.md +52 -15
  263. package/skills/agent-whatsapp/references/authentication.md +36 -6
  264. package/skills/agent-whatsappbot/SKILL.md +10 -1
  265. package/src/platforms/channeltalk/cli.ts +2 -0
  266. package/src/platforms/channeltalk/commands/index.ts +1 -0
  267. package/src/platforms/channeltalk/commands/whoami.test.ts +64 -0
  268. package/src/platforms/channeltalk/commands/whoami.ts +62 -0
  269. package/src/platforms/channeltalkbot/cli.ts +2 -0
  270. package/src/platforms/channeltalkbot/commands/index.ts +1 -0
  271. package/src/platforms/channeltalkbot/commands/whoami.test.ts +104 -0
  272. package/src/platforms/channeltalkbot/commands/whoami.ts +42 -0
  273. package/src/platforms/discord/cli.ts +2 -0
  274. package/src/platforms/discord/commands/index.ts +1 -0
  275. package/src/platforms/discord/commands/whoami.test.ts +91 -0
  276. package/src/platforms/discord/commands/whoami.ts +36 -0
  277. package/src/platforms/discordbot/cli.ts +2 -0
  278. package/src/platforms/discordbot/commands/index.ts +1 -0
  279. package/src/platforms/discordbot/commands/whoami.test.ts +96 -0
  280. package/src/platforms/discordbot/commands/whoami.ts +44 -0
  281. package/src/platforms/instagram/cli.ts +2 -1
  282. package/src/platforms/instagram/client.ts +13 -0
  283. package/src/platforms/instagram/commands/chat.test.ts +1 -5
  284. package/src/platforms/instagram/commands/index.ts +1 -0
  285. package/src/platforms/instagram/commands/message.test.ts +1 -5
  286. package/src/platforms/instagram/commands/whoami.test.ts +60 -0
  287. package/src/platforms/instagram/commands/whoami.ts +21 -0
  288. package/src/platforms/kakaotalk/cli.ts +2 -2
  289. package/src/platforms/kakaotalk/client.test.ts +25 -14
  290. package/src/platforms/kakaotalk/client.ts +228 -33
  291. package/src/platforms/kakaotalk/commands/auth.ts +22 -73
  292. package/src/platforms/kakaotalk/commands/index.ts +1 -1
  293. package/src/platforms/kakaotalk/commands/{profile.test.ts → whoami.test.ts} +37 -5
  294. package/src/platforms/kakaotalk/commands/{profile.ts → whoami.ts} +4 -4
  295. package/src/platforms/kakaotalk/credential-manager.ts +1 -0
  296. package/src/platforms/kakaotalk/index.ts +1 -0
  297. package/src/platforms/kakaotalk/listener.test.ts +2 -2
  298. package/src/platforms/kakaotalk/listener.ts +2 -2
  299. package/src/platforms/kakaotalk/protocol/config.ts +26 -2
  300. package/src/platforms/kakaotalk/protocol/session.ts +42 -16
  301. package/src/platforms/kakaotalk/protocol/types.ts +9 -0
  302. package/src/platforms/kakaotalk/types.ts +16 -0
  303. package/src/platforms/line/cli.ts +2 -2
  304. package/src/platforms/line/commands/auth.ts +37 -70
  305. package/src/platforms/line/commands/index.ts +1 -1
  306. package/src/platforms/line/commands/{profile.test.ts → whoami.test.ts} +11 -11
  307. package/src/platforms/line/commands/{profile.ts → whoami.ts} +4 -4
  308. package/src/platforms/slack/cli.ts +2 -0
  309. package/src/platforms/slack/commands/index.ts +1 -0
  310. package/src/platforms/slack/commands/whoami.test.ts +126 -0
  311. package/src/platforms/slack/commands/whoami.ts +40 -0
  312. package/src/platforms/slackbot/cli.ts +2 -1
  313. package/src/platforms/slackbot/commands/index.ts +1 -0
  314. package/src/platforms/slackbot/commands/whoami.test.ts +102 -0
  315. package/src/platforms/slackbot/commands/whoami.ts +44 -0
  316. package/src/platforms/teams/cli.ts +2 -0
  317. package/src/platforms/teams/commands/index.ts +1 -0
  318. package/src/platforms/teams/commands/whoami.test.ts +83 -0
  319. package/src/platforms/teams/commands/whoami.ts +33 -0
  320. package/src/platforms/telegram/cli.ts +2 -1
  321. package/src/platforms/telegram/commands/index.ts +1 -0
  322. package/src/platforms/telegram/commands/whoami.test.ts +75 -0
  323. package/src/platforms/telegram/commands/whoami.ts +29 -0
  324. package/src/platforms/webex/cli.ts +2 -1
  325. package/src/platforms/webex/commands/auth.test.ts +58 -46
  326. package/src/platforms/webex/commands/index.ts +1 -0
  327. package/src/platforms/webex/commands/member.test.ts +1 -5
  328. package/src/platforms/webex/commands/message.test.ts +1 -5
  329. package/src/platforms/webex/commands/message.ts +1 -1
  330. package/src/platforms/webex/commands/snapshot.test.ts +1 -5
  331. package/src/platforms/webex/commands/space.test.ts +1 -5
  332. package/src/platforms/webex/commands/whoami.test.ts +113 -0
  333. package/src/platforms/webex/commands/whoami.ts +31 -0
  334. package/src/platforms/webex/credential-manager.test.ts +0 -1
  335. package/src/platforms/wechatbot/cli.ts +2 -1
  336. package/src/platforms/wechatbot/commands/index.ts +1 -0
  337. package/src/platforms/wechatbot/commands/whoami.test.ts +109 -0
  338. package/src/platforms/wechatbot/commands/whoami.ts +43 -0
  339. package/src/platforms/whatsapp/cli.ts +2 -1
  340. package/src/platforms/whatsapp/client.ts +156 -24
  341. package/src/platforms/whatsapp/commands/auth.ts +176 -70
  342. package/src/platforms/whatsapp/commands/index.ts +1 -0
  343. package/src/platforms/whatsapp/commands/shared.ts +2 -2
  344. package/src/platforms/whatsapp/commands/whoami.test.ts +59 -0
  345. package/src/platforms/whatsapp/commands/whoami.ts +21 -0
  346. package/src/platforms/whatsapp/ensure-auth.ts +2 -2
  347. package/src/platforms/whatsappbot/cli.ts +2 -1
  348. package/src/platforms/whatsappbot/commands/index.ts +1 -0
  349. package/src/platforms/whatsappbot/commands/whoami.test.ts +100 -0
  350. package/src/platforms/whatsappbot/commands/whoami.ts +57 -0
  351. package/src/shared/utils/qr.ts +92 -0
  352. package/src/tui/adapters/kakaotalk-adapter.ts +5 -2
  353. package/src/tui/adapters/whatsapp-adapter.ts +19 -16
  354. package/dist/src/platforms/kakaotalk/commands/profile.d.ts +0 -3
  355. package/dist/src/platforms/kakaotalk/commands/profile.d.ts.map +0 -1
  356. package/dist/src/platforms/kakaotalk/commands/profile.js.map +0 -1
  357. package/dist/src/platforms/line/commands/profile.d.ts +0 -3
  358. package/dist/src/platforms/line/commands/profile.d.ts.map +0 -1
  359. package/dist/src/platforms/line/commands/profile.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
  import { Command } from 'commander'
4
4
 
5
5
  import pkg from '../../../package.json' with { type: 'json' }
6
- import { authCommand, messageCommand, templateCommand } from './commands/index'
6
+ import { authCommand, messageCommand, templateCommand, whoamiCommand } from './commands/index'
7
7
 
8
8
  const program = new Command()
9
9
 
@@ -15,6 +15,7 @@ program
15
15
  .option('--account <id>', 'Account ID to use')
16
16
 
17
17
  program.addCommand(authCommand)
18
+ program.addCommand(whoamiCommand)
18
19
  program.addCommand(messageCommand)
19
20
  program.addCommand(templateCommand)
20
21
 
@@ -1,3 +1,4 @@
1
1
  export { authCommand } from './auth'
2
2
  export { messageCommand } from './message'
3
3
  export { templateCommand } from './template'
4
+ export { whoamiCommand } from './whoami'
@@ -0,0 +1,100 @@
1
+ import { afterEach, beforeEach, describe, expect, mock, test } from 'bun:test'
2
+ import { existsSync, rmSync } from 'node:fs'
3
+ import { mkdir } from 'node:fs/promises'
4
+ import { tmpdir } from 'node:os'
5
+ import { join } from 'node:path'
6
+
7
+ const mockVerifyToken = mock(() =>
8
+ Promise.resolve({ verified_name: 'Test Business' }),
9
+ )
10
+
11
+ mock.module('../client', () => ({
12
+ WhatsAppBotClient: class MockWhatsAppBotClient {
13
+ async login(_credentials?: { phoneNumberId: string; accessToken: string }) {
14
+ return this
15
+ }
16
+ verifyToken = mockVerifyToken
17
+ },
18
+ }))
19
+
20
+ // Re-import whoamiAction AFTER mock.module so the mock applies
21
+ const { whoamiAction } = await import('./whoami')
22
+
23
+ import { WhatsAppBotCredentialManager } from '../credential-manager'
24
+
25
+ describe('whoami command', () => {
26
+ let tempDir: string
27
+
28
+ beforeEach(async () => {
29
+ tempDir = join(tmpdir(), `whatsappbot-whoami-test-${Date.now()}`)
30
+ await mkdir(tempDir, { recursive: true })
31
+ mockVerifyToken.mockClear()
32
+ })
33
+
34
+ afterEach(() => {
35
+ if (existsSync(tempDir)) {
36
+ rmSync(tempDir, { recursive: true })
37
+ }
38
+ })
39
+
40
+ test('returns phone number id, account name, and verified name', async () => {
41
+ const manager = new WhatsAppBotCredentialManager(tempDir)
42
+ await manager.setCredentials({
43
+ phone_number_id: '12345678901',
44
+ account_name: 'Test Business',
45
+ access_token: 'EAAtest-token',
46
+ })
47
+
48
+ const result = await whoamiAction({ _credManager: manager })
49
+
50
+ expect(result.phone_number_id).toBe('12345678901')
51
+ expect(result.account_name).toBe('Test Business')
52
+ expect(result.verified_name).toBe('Test Business')
53
+ expect(result.error).toBeUndefined()
54
+ })
55
+
56
+ test('returns info for specific --account', async () => {
57
+ const manager = new WhatsAppBotCredentialManager(tempDir)
58
+ await manager.setCredentials({
59
+ phone_number_id: '11111111111',
60
+ account_name: 'Account A',
61
+ access_token: 'token-a',
62
+ })
63
+ await manager.setCredentials({
64
+ phone_number_id: '22222222222',
65
+ account_name: 'Account B',
66
+ access_token: 'token-b',
67
+ })
68
+
69
+ const result = await whoamiAction({ account: '11111111111', _credManager: manager })
70
+
71
+ expect(result.phone_number_id).toBe('11111111111')
72
+ expect(result.account_name).toBe('Account A')
73
+ expect(result.verified_name).toBe('Test Business')
74
+ })
75
+
76
+ test('returns error when verifyToken fails', async () => {
77
+ mockVerifyToken.mockImplementationOnce(() => Promise.reject(new Error('Invalid token')))
78
+
79
+ const manager = new WhatsAppBotCredentialManager(tempDir)
80
+ await manager.setCredentials({
81
+ phone_number_id: '12345678901',
82
+ account_name: 'Test Business',
83
+ access_token: 'bad-token',
84
+ })
85
+
86
+ const result = await whoamiAction({ _credManager: manager })
87
+
88
+ expect(result.error).toBeDefined()
89
+ expect(result.error).toContain('Invalid token')
90
+ })
91
+
92
+ test('returns error when no credentials', async () => {
93
+ const manager = new WhatsAppBotCredentialManager(tempDir)
94
+
95
+ const result = await whoamiAction({ _credManager: manager })
96
+
97
+ expect(result.error).toBeDefined()
98
+ expect(result.error).toContain('No credentials')
99
+ })
100
+ })
@@ -0,0 +1,57 @@
1
+ import { Command } from 'commander'
2
+
3
+ import { formatOutput } from '@/shared/utils/output'
4
+
5
+ import { WhatsAppBotClient } from '../client'
6
+ import { WhatsAppBotCredentialManager } from '../credential-manager'
7
+
8
+ interface WhoamiOptions {
9
+ account?: string
10
+ pretty?: boolean
11
+ _credManager?: WhatsAppBotCredentialManager
12
+ }
13
+
14
+ interface WhoamiResult {
15
+ phone_number_id?: string | null
16
+ account_name?: string | null
17
+ verified_name?: string
18
+ error?: string
19
+ }
20
+
21
+ export async function whoamiAction(options: WhoamiOptions): Promise<WhoamiResult> {
22
+ try {
23
+ const credManager = options._credManager ?? new WhatsAppBotCredentialManager()
24
+ const creds = await credManager.getCredentials(options.account)
25
+
26
+ if (!creds) {
27
+ return { error: 'No credentials. Run "auth set <phone-number-id> <access-token>" first.' }
28
+ }
29
+
30
+ const client = await new WhatsAppBotClient().login({
31
+ phoneNumberId: creds.phone_number_id,
32
+ accessToken: creds.access_token,
33
+ })
34
+ const verified = await client.verifyToken()
35
+
36
+ return {
37
+ phone_number_id: creds.phone_number_id,
38
+ account_name: creds.account_name ?? null,
39
+ verified_name: verified.verified_name,
40
+ }
41
+ } catch (error) {
42
+ return { error: (error as Error).message }
43
+ }
44
+ }
45
+
46
+ function cliOutput(result: WhoamiResult, pretty?: boolean): void {
47
+ console.log(formatOutput(result, pretty))
48
+ if (result.error) process.exit(1)
49
+ }
50
+
51
+ export const whoamiCommand = new Command('whoami')
52
+ .description('Show current authenticated bot')
53
+ .option('--account <id>', 'Account ID to use')
54
+ .option('--pretty', 'Pretty print JSON output')
55
+ .action(async (opts: WhoamiOptions) => {
56
+ cliOutput(await whoamiAction(opts), opts.pretty)
57
+ })
@@ -0,0 +1,92 @@
1
+ import { execSync } from 'node:child_process'
2
+ import { writeFileSync, unlinkSync } from 'node:fs'
3
+ import { tmpdir } from 'node:os'
4
+ import { join } from 'node:path'
5
+
6
+ import QRCode from 'qrcode'
7
+
8
+ import { info } from './stderr'
9
+
10
+ export interface QRDisplayOptions {
11
+ platform: string
12
+ brandColor: string
13
+ scanInstruction: string
14
+ }
15
+
16
+ export async function createQRHtmlFile(url: string, options: QRDisplayOptions): Promise<string | null> {
17
+ try {
18
+ const svgString = await QRCode.toString(url, { type: 'svg', margin: 2 })
19
+ const html = `<!DOCTYPE html>
20
+ <html><head><meta charset="utf-8"><title>${options.platform} QR Login</title>
21
+ <style>body{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:100vh;margin:0;font-family:-apple-system,system-ui,sans-serif;background:${options.brandColor}}
22
+ .card{background:#fff;border-radius:16px;padding:40px;text-align:center;box-shadow:0 4px 24px rgba(0,0,0,.15)}
23
+ h1{margin:0 0 8px;font-size:22px;color:#111}p{margin:0 0 24px;color:#666;font-size:14px}
24
+ svg{width:280px;height:280px}</style></head>
25
+ <body><div class="card"><h1>${options.platform} Login</h1><p>${options.scanInstruction}</p>${svgString}</div></body></html>`
26
+
27
+ const htmlPath = join(tmpdir(), `${options.platform.toLowerCase()}-qr-${Date.now()}.html`)
28
+ writeFileSync(htmlPath, html)
29
+ setTimeout(() => {
30
+ try {
31
+ unlinkSync(htmlPath)
32
+ } catch {}
33
+ }, 300_000).unref()
34
+ return htmlPath
35
+ } catch {
36
+ return null
37
+ }
38
+ }
39
+
40
+ export function openInBrowser(filePath: string): void {
41
+ try {
42
+ if (process.platform === 'darwin') {
43
+ execSync(`open "${filePath}"`, { stdio: 'ignore' })
44
+ } else if (process.platform === 'win32') {
45
+ execSync(`start "" "${filePath}"`, { stdio: 'ignore' })
46
+ } else {
47
+ execSync(`xdg-open "${filePath}"`, { stdio: 'ignore' })
48
+ }
49
+ } catch {}
50
+ }
51
+
52
+ export async function renderTerminalQR(data: string): Promise<string> {
53
+ return QRCode.toString(data, { type: 'terminal', small: true })
54
+ }
55
+
56
+ export async function displayQR(
57
+ data: string,
58
+ options: QRDisplayOptions & {
59
+ interactive: boolean
60
+ openBrowser?: boolean
61
+ formatOutput: (obj: Record<string, unknown>, pretty?: boolean) => string
62
+ pretty?: boolean
63
+ },
64
+ ): Promise<void> {
65
+ const shouldOpenBrowser = options.openBrowser ?? options.interactive
66
+ const htmlPath = await createQRHtmlFile(data, options)
67
+ if (htmlPath && shouldOpenBrowser) openInBrowser(htmlPath)
68
+
69
+ if (options.interactive) {
70
+ try {
71
+ const qrAscii = await renderTerminalQR(data)
72
+ info(`\n${options.scanInstruction}:\n`)
73
+ info(qrAscii)
74
+ } catch {
75
+ info(`\nOpen the QR code in the browser window, or scan this URL:\n${data}\n`)
76
+ }
77
+ } else {
78
+ console.log(
79
+ options.formatOutput(
80
+ {
81
+ next_action: 'scan_qr',
82
+ qr_url: data,
83
+ qr_html_path: htmlPath,
84
+ message: htmlPath
85
+ ? `QR code opened in browser. ${options.scanInstruction}`
86
+ : `QR code generated. Open qr_url to scan.`,
87
+ },
88
+ options.pretty,
89
+ ),
90
+ )
91
+ }
92
+ }
@@ -64,7 +64,7 @@ export class KakaoTalkAdapter implements PlatformAdapter {
64
64
  if (!creds) throw new Error(`Account ${accountId} not found`)
65
65
 
66
66
  const client = new KakaoTalkClient()
67
- await client.login({ oauthToken: creds.oauth_token, userId: creds.user_id, deviceUuid: creds.device_uuid })
67
+ await client.login({ oauthToken: creds.oauth_token, userId: creds.user_id, deviceUuid: creds.device_uuid, deviceType: creds.device_type })
68
68
  this.client = client
69
69
  this.currentAccount = { id: creds.account_id, name: creds.account_id }
70
70
  }
@@ -86,7 +86,8 @@ export class KakaoTalkAdapter implements PlatformAdapter {
86
86
 
87
87
  const existing = await this.credManager.getAccount()
88
88
  const pendingState = await this.credManager.loadPendingLogin()
89
- const savedDeviceUuid = pendingState?.device_uuid ?? existing?.device_uuid ?? generateDeviceUuid()
89
+ const existingUuid = existing?.auth_method === 'login' ? existing?.device_uuid : undefined
90
+ const savedDeviceUuid = pendingState?.device_uuid ?? existingUuid ?? generateDeviceUuid()
90
91
 
91
92
  let email: string | undefined
92
93
  let password: string | undefined
@@ -139,6 +140,7 @@ export class KakaoTalkAdapter implements PlatformAdapter {
139
140
  refresh_token: result.credentials.refresh_token,
140
141
  device_uuid: result.credentials.device_uuid,
141
142
  device_type: result.credentials.device_type,
143
+ auth_method: 'login',
142
144
  created_at: now,
143
145
  updated_at: now,
144
146
  })
@@ -149,6 +151,7 @@ export class KakaoTalkAdapter implements PlatformAdapter {
149
151
  oauthToken: result.credentials.access_token,
150
152
  userId: result.credentials.user_id,
151
153
  deviceUuid: result.credentials.device_uuid,
154
+ deviceType: result.credentials.device_type,
152
155
  })
153
156
  this.client = client
154
157
  this.currentAccount = { id: result.credentials.user_id, name: email }
@@ -1,5 +1,6 @@
1
1
  import { WhatsAppClient } from '@/platforms/whatsapp/client'
2
2
  import { WhatsAppCredentialManager } from '@/platforms/whatsapp/credential-manager'
3
+ import { renderTerminalQR } from '@/shared/utils/qr'
3
4
 
4
5
  import type { AuthHint, AuthIO, PlatformAdapter, UnifiedChannel, UnifiedMessage, Workspace } from './types'
5
6
 
@@ -80,35 +81,38 @@ export class WhatsAppAdapter implements PlatformAdapter {
80
81
 
81
82
  getAuthHint(): AuthHint {
82
83
  return {
83
- command: 'agent-whatsapp auth login',
84
- description: 'Run the command below and link your WhatsApp account using the pairing code.',
84
+ command: 'agent-whatsapp auth login --qr',
85
+ description: 'Run the command below and scan the QR code with WhatsApp on your phone.',
85
86
  }
86
87
  }
87
88
 
88
89
  async authenticate(io: AuthIO): Promise<void> {
89
- const { createAccountId } = await import('@/platforms/whatsapp/types')
90
-
91
- const phone = await io.prompt('Phone number (e.g. +12025551234)')
92
- if (!phone) throw new Error('Phone number is required')
93
-
94
- io.print('Connecting...')
95
- const accountId = createAccountId(phone)
90
+ io.print('Generating QR code...')
91
+ const accountId = 'qr-default'
92
+ const existingPaths = this.credManager.getAccountPaths(accountId)
93
+ const { rm } = await import('node:fs/promises')
94
+ await rm(existingPaths.auth_dir, { recursive: true, force: true })
96
95
  const paths = await this.credManager.ensureAccountPaths(accountId)
97
96
  const client = await new WhatsAppClient().login({ authDir: paths.auth_dir })
98
97
 
99
98
  let waitForAuth: () => Promise<void>
100
99
  try {
101
- const result = await client.connectForPairing(phone)
100
+ const result = await client.connectForQR(async (qr) => {
101
+ io.print('Scan this QR code with WhatsApp on your phone:')
102
+ try {
103
+ const rendered = await renderTerminalQR(qr)
104
+ io.print(rendered)
105
+ } catch {
106
+ io.print(qr)
107
+ }
108
+ })
102
109
  waitForAuth = result.waitForAuth
103
- const formatted = result.code.length === 8 ? `${result.code.slice(0, 4)}-${result.code.slice(4)}` : result.code
104
- io.print(`Pairing code: ${formatted}`)
105
- io.print('Enter this code in WhatsApp > Linked Devices > Link with phone number')
106
110
  } catch (err) {
107
111
  await client.close()
108
112
  throw err
109
113
  }
110
114
 
111
- io.print('Waiting for confirmation...')
115
+ io.print('Waiting for QR code scan...')
112
116
  try {
113
117
  await waitForAuth()
114
118
  } catch (err) {
@@ -119,14 +123,13 @@ export class WhatsAppAdapter implements PlatformAdapter {
119
123
  const now = new Date().toISOString()
120
124
  await this.credManager.setAccount({
121
125
  account_id: accountId,
122
- phone_number: phone,
123
126
  created_at: now,
124
127
  updated_at: now,
125
128
  })
126
129
  await this.credManager.setCurrent(accountId)
127
130
 
128
131
  this.client = client
129
- this.currentAccount = { id: accountId, name: phone }
132
+ this.currentAccount = { id: accountId, name: accountId }
130
133
  }
131
134
 
132
135
  private ensureClient(): WhatsAppClient {
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const profileCommand: Command;
3
- //# sourceMappingURL=profile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/kakaotalk/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAgBnC,eAAO,MAAM,cAAc,SAIH,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../../../src/platforms/kakaotalk/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE1C,KAAK,UAAU,aAAa,CAAC,OAA+C;IAC1E,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAA;QAC/E,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAc,CAAC,CAAA;IAC7B,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACjD,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,gBAAgB,EAAE,kCAAkC,CAAC;KAC5D,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,aAAa,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare const profileCommand: Command;
3
- //# sourceMappingURL=profile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../../../src/platforms/line/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAoBnC,eAAO,MAAM,cAAc,SAGH,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../../../../src/platforms/line/commands/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAEtC,KAAK,UAAU,aAAa,CAAC,OAA6B;IACxD,IAAI,MAA8B,CAAA;IAClC,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,IAAI,UAAU,EAAE,CAAC,KAAK,EAAE,CAAA;QACvC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAA;QACzC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAc,CAAC,CAAA;IAC7B,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,KAAK,EAAE,CAAA;IACjB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,SAAS,CAAC;KACjD,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,aAAa,CAAC,CAAA"}