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
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-slackbot
3
3
  description: Interact with Slack workspaces using bot tokens - send messages, read channels, manage reactions
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-slackbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -165,6 +165,15 @@ If a memorized ID returns an error (channel not found, user not found), remove i
165
165
 
166
166
  ## Commands
167
167
 
168
+ ### Whoami Command
169
+
170
+ ```bash
171
+ # Show current authenticated bot
172
+ agent-slackbot whoami
173
+ agent-slackbot whoami --pretty
174
+ agent-slackbot whoami --bot <bot-id>
175
+ ```
176
+
168
177
  ### Message Commands
169
178
 
170
179
  ```bash
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-teams
3
3
  description: Interact with Microsoft Teams - send messages, read channels, manage reactions
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-teams:*)
6
6
  metadata:
7
7
  openclaw:
@@ -161,6 +161,16 @@ agent-teams auth switch-account work
161
161
  agent-teams auth switch-account personal
162
162
  ```
163
163
 
164
+ ### Whoami Command
165
+
166
+ ```bash
167
+ # Show current authenticated user
168
+ agent-teams whoami
169
+ agent-teams whoami --pretty
170
+ ```
171
+
172
+ Output includes the authenticated user's identity information.
173
+
164
174
  ### Message Commands
165
175
 
166
176
  ```bash
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-telegram
3
3
  description: Interact with Telegram through TDLib - authenticate, inspect chats, and send messages
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-telegram:*)
6
6
  ---
7
7
 
@@ -103,6 +103,11 @@ agent-telegram auth logout # Logout
103
103
  ## Common Commands
104
104
 
105
105
  ```bash
106
+ # Show current authenticated user
107
+ agent-telegram whoami
108
+ agent-telegram whoami --pretty
109
+ agent-telegram whoami --account <account-id>
110
+
106
111
  # Search chats by title or username
107
112
  agent-telegram chat search "project"
108
113
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-webex
3
3
  description: Interact with Cisco Webex - send messages, read spaces, manage memberships
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-webex:*)
6
6
  metadata:
7
7
  openclaw:
@@ -188,6 +188,16 @@ agent-webex auth status
188
188
  agent-webex auth logout
189
189
  ```
190
190
 
191
+ ### Whoami Command
192
+
193
+ ```bash
194
+ # Show current authenticated user
195
+ agent-webex whoami
196
+ agent-webex whoami --pretty
197
+ ```
198
+
199
+ Output includes the authenticated user's identity information.
200
+
191
201
  ### Space Commands
192
202
 
193
203
  ```bash
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-wechatbot
3
3
  description: Interact with WeChat Official Account using API credentials - send messages, manage templates, list followers
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-wechatbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -174,6 +174,15 @@ agent-wechatbot auth remove <account-id>
174
174
  agent-wechatbot auth clear
175
175
  ```
176
176
 
177
+ ### Whoami Command
178
+
179
+ ```bash
180
+ # Show current authenticated bot
181
+ agent-wechatbot whoami
182
+ agent-wechatbot whoami --pretty
183
+ agent-wechatbot whoami --account <account-id>
184
+ ```
185
+
177
186
  ### Message Commands
178
187
 
179
188
  ```bash
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-whatsapp
3
3
  description: Interact with WhatsApp - send messages, read chats, manage conversations
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-whatsapp:*)
6
6
  metadata:
7
7
  openclaw:
@@ -16,7 +16,7 @@ metadata:
16
16
 
17
17
  # Agent WhatsApp
18
18
 
19
- A Baileys-backed WhatsApp CLI for AI agents. Links as a companion device via pairing code, so your phone stays connected. Each command connects on demand and disconnects when done.
19
+ A Baileys-backed WhatsApp CLI for AI agents. Links as a companion device via QR code or pairing code, so your phone stays connected. Each command connects on demand and disconnects when done.
20
20
 
21
21
  Use one of these entrypoints:
22
22
  - Global install: `agent-whatsapp ...`
@@ -27,6 +27,7 @@ Use one of these entrypoints:
27
27
  Before diving in, a few things about WhatsApp's architecture:
28
28
 
29
29
  - **JID** (Jabber ID) = WhatsApp's address format. Individual: `1234567890@s.whatsapp.net`. Group: `123456789-123345@g.us`. You can pass plain phone numbers and the CLI resolves them to JIDs automatically.
30
+ - **QR code auth** = links the CLI as a companion device by scanning a QR code displayed in the terminal or browser. Open WhatsApp > Linked Devices > Link a Device and scan the code.
30
31
  - **Pairing code auth** = links the CLI as a companion device using a numeric code displayed in your terminal. Enter it in WhatsApp on your phone under Linked Devices.
31
32
  - **Connect-on-demand** = the CLI opens a WebSocket connection for each command and disconnects afterward. There's no persistent background process.
32
33
  - **Multi-account** = multiple WhatsApp accounts can be linked. Use `auth list` and `auth use` to switch between them.
@@ -34,7 +35,10 @@ Before diving in, a few things about WhatsApp's architecture:
34
35
  ## Quick Start
35
36
 
36
37
  ```bash
37
- # Link as companion device (enter the pairing code on your phone)
38
+ # Link as companion device via QR code (scan with your phone)
39
+ agent-whatsapp auth login --qr
40
+
41
+ # Or link via pairing code (enter the code on your phone)
38
42
  agent-whatsapp auth login --phone +1234567890
39
43
 
40
44
  # List chats
@@ -46,7 +50,10 @@ agent-whatsapp message send +1234567890 "Hello from agent-whatsapp"
46
50
 
47
51
  ## Authentication Flow
48
52
 
49
- WhatsApp uses pairing code authentication. The CLI registers as a companion (linked) device, so your phone session is never affected.
53
+ WhatsApp supports two authentication methods. Both register the CLI as a companion (linked) device, so your phone session is never affected.
54
+
55
+ - **QR code** (`--qr`): A QR code is displayed in the terminal and opened in the browser. Scan it with WhatsApp on your phone. No phone number needed.
56
+ - **Pairing code** (`--phone`): A numeric code is displayed. Enter it in WhatsApp on your phone under Linked Devices > Link with phone number.
50
57
 
51
58
  ### Agent Behavior (MANDATORY)
52
59
 
@@ -60,28 +67,36 @@ agent-whatsapp auth list
60
67
 
61
68
  If accounts exist, use `agent-whatsapp auth use <account-id>` and retry the original command.
62
69
 
63
- **Step 2: If no accounts, ask for phone number**
70
+ **Step 2: If no accounts, start QR login (preferred)**
71
+
72
+ ```bash
73
+ agent-whatsapp auth login --qr
74
+ # -> QR code displayed in terminal + opened in browser
75
+ # -> {"next_action":"scan_qr","qr_url":"...","message":"Scan with WhatsApp on your phone"}
76
+ ```
64
77
 
65
- Ask the user for their WhatsApp phone number (international format, e.g. `+1234567890`). This is the ONLY thing the user needs to provide.
78
+ Tell the user to scan the QR code with WhatsApp: Settings > Linked Devices > Link a Device > scan the QR code.
66
79
 
67
- **Step 3: Start login**
80
+ **Alternative: Pairing code login**
81
+
82
+ If QR scanning is not possible (e.g. headless environment), ask for the phone number and use pairing code:
68
83
 
69
84
  ```bash
70
85
  agent-whatsapp auth login --phone +1234567890
71
- # -> {"next_action":"enter_pairing_code","pairing_code":"A1B2-C3D4","message":"Enter this code in WhatsApp on your phone: Linked Devices > Link a Device."}
86
+ # -> {"pairing_code":"A1B2-C3D4","message":"Enter this code in WhatsApp > Linked Devices > Link with phone number"}
72
87
  ```
73
88
 
74
- Tell the user the pairing code and ask them to enter it on their phone: open WhatsApp > Settings > Linked Devices > Link a Device > enter the code.
89
+ Tell the user the pairing code and ask them to enter it on their phone.
75
90
 
76
- **Step 4: Wait for confirmation**
91
+ **Step 3: Wait for confirmation**
77
92
 
78
- The CLI polls until the user confirms on their phone. Once confirmed:
93
+ The CLI waits until the user confirms on their phone. Once confirmed:
79
94
 
80
95
  ```bash
81
96
  # -> {"authenticated":true,...}
82
97
  ```
83
98
 
84
- **Step 5: Retry the original command**
99
+ **Step 4: Retry the original command**
85
100
 
86
101
  After successful auth, immediately execute whatever the user originally asked for.
87
102
 
@@ -169,6 +184,9 @@ If a memorized JID returns an error, remove it from `MEMORY.md`. Don't blindly t
169
184
  ### Auth Commands
170
185
 
171
186
  ```bash
187
+ # Link as companion device via QR code (no phone number needed)
188
+ agent-whatsapp auth login --qr
189
+
172
190
  # Link as companion device via pairing code
173
191
  agent-whatsapp auth login --phone +1234567890
174
192
 
@@ -187,6 +205,17 @@ agent-whatsapp auth logout
187
205
  agent-whatsapp auth logout --account <id>
188
206
  ```
189
207
 
208
+ ### Whoami Command
209
+
210
+ ```bash
211
+ # Show current authenticated user
212
+ agent-whatsapp whoami
213
+ agent-whatsapp whoami --pretty
214
+ agent-whatsapp whoami --account <account-id>
215
+ ```
216
+
217
+ Output includes the authenticated user's identity information.
218
+
190
219
  ### Chat Commands
191
220
 
192
221
  ```bash
@@ -319,13 +348,13 @@ All commands return consistent error format:
319
348
 
320
349
  ```json
321
350
  {
322
- "error": "No WhatsApp account linked. Run: agent-whatsapp auth login --phone <number>"
351
+ "error": "No WhatsApp account linked. Run: agent-whatsapp auth login --qr"
323
352
  }
324
353
  ```
325
354
 
326
355
  Common errors:
327
356
 
328
- - `No WhatsApp account linked` - not authenticated. Run `auth login --phone <number>`.
357
+ - `No WhatsApp account linked` - not authenticated. Run `auth login --qr` or `auth login --phone <number>`.
329
358
  - `Connection timeout` - WebSocket connection to WhatsApp failed. Retry the command.
330
359
  - `Invalid JID` - malformed phone number or JID. Use international format with `+` prefix.
331
360
  - `Not a group participant` - can't send to a group you're not a member of.
@@ -361,6 +390,14 @@ pnpm dlx --package agent-messenger agent-whatsapp chat list --pretty
361
390
 
362
391
  **NEVER run `npx agent-whatsapp`, `bunx agent-whatsapp`, or `pnpm dlx agent-whatsapp`** without `--package agent-messenger`. It will fail or install a wrong package since `agent-whatsapp` is not the npm package name.
363
392
 
393
+ ### QR code not scanning
394
+
395
+ 1. Make sure WhatsApp is open on your phone
396
+ 2. Go to Settings > Linked Devices > Link a Device
397
+ 3. Point your phone camera at the QR code in the terminal or browser
398
+ 4. If the QR code expires, run `auth login --qr` again for a fresh code
399
+ 5. If QR scanning fails, try pairing code: `auth login --phone <number>`
400
+
364
401
  ### Pairing code not working
365
402
 
366
403
  1. Make sure WhatsApp is open on your phone
@@ -389,5 +426,5 @@ WhatsApp may disconnect linked devices that are inactive for extended periods. I
389
426
  agent-whatsapp auth status
390
427
 
391
428
  # Re-link if needed
392
- agent-whatsapp auth login --phone +1234567890
429
+ agent-whatsapp auth login --qr
393
430
  ```
@@ -2,7 +2,37 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- agent-whatsapp uses pairing code authentication via [Baileys](https://github.com/WhiskeySockets/Baileys). The CLI registers as a companion (linked) device, so your phone session is never affected. Each command connects on demand and disconnects when done.
5
+ agent-whatsapp uses [Baileys](https://github.com/WhiskeySockets/Baileys) to authenticate via QR code or pairing code. The CLI registers as a companion (linked) device, so your phone session is never affected. Each command connects on demand and disconnects when done.
6
+
7
+ ## QR Code Login
8
+
9
+ ### How It Works
10
+
11
+ 1. The CLI generates a QR code and displays it in the terminal (and opens it in the browser)
12
+ 2. You scan the QR code with WhatsApp on your phone: Settings > Linked Devices > Link a Device
13
+ 3. Session credentials are stored locally for future commands
14
+
15
+ ### Starting Login
16
+
17
+ ```bash
18
+ agent-whatsapp auth login --qr
19
+ ```
20
+
21
+ In interactive mode, a QR code is rendered in the terminal and opened in the browser. In non-interactive mode, JSON output is emitted:
22
+
23
+ ```json
24
+ {"next_action":"scan_qr","qr_url":"...","qr_html_path":"/tmp/whatsapp-qr-....html","message":"Scan with WhatsApp on your phone"}
25
+ ```
26
+
27
+ After scanning:
28
+
29
+ ```json
30
+ {"authenticated":true,"account_id":"qr-default"}
31
+ ```
32
+
33
+ ### QR Code Refresh
34
+
35
+ Baileys emits a new QR code every ~20 seconds. The terminal QR updates automatically. The browser tab is only opened once. If the QR expires after ~2 minutes, run `auth login --qr` again.
6
36
 
7
37
  ## Pairing Code Login
8
38
 
@@ -10,8 +40,8 @@ agent-whatsapp uses pairing code authentication via [Baileys](https://github.com
10
40
 
11
41
  1. You provide your phone number in international format (e.g. `+1234567890`)
12
42
  2. The CLI generates a numeric pairing code and displays it
13
- 3. You enter the code on your phone: WhatsApp > Settings > Linked Devices > Link a Device
14
- 4. The CLI polls until you confirm on your phone
43
+ 3. You enter the code on your phone: WhatsApp > Settings > Linked Devices > Link with phone number
44
+ 4. The CLI waits until you confirm on your phone
15
45
  5. Session credentials are stored locally for future commands
16
46
 
17
47
  ### Starting Login
@@ -34,7 +64,7 @@ After confirmation on your phone:
34
64
 
35
65
  ### Login Failures
36
66
 
37
- If the pairing code expires (typically after 60 seconds), run `auth login` again for a fresh code. If your phone isn't connected to the internet, the pairing will time out.
67
+ If the pairing code expires (typically after 60 seconds), run `auth login --phone <number>` again for a fresh code. If your phone isn't connected to the internet, the pairing will time out.
38
68
 
39
69
  ## Multi-Account Management
40
70
 
@@ -121,7 +151,7 @@ Output when not authenticated:
121
151
 
122
152
  ```json
123
153
  {
124
- "error": "No WhatsApp account linked. Run: agent-whatsapp auth login --phone <number>"
154
+ "error": "No WhatsApp account configured. Run \"auth login --qr\" or \"auth login --phone <phone-number>\" first."
125
155
  }
126
156
  ```
127
157
 
@@ -163,7 +193,7 @@ If commands start failing with auth errors:
163
193
  agent-whatsapp auth status
164
194
 
165
195
  # Re-link if needed
166
- agent-whatsapp auth login --phone +1234567890
196
+ agent-whatsapp auth login --qr
167
197
 
168
198
  # Verify it worked
169
199
  agent-whatsapp auth status
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: agent-whatsappbot
3
3
  description: Interact with WhatsApp using Cloud API credentials - send messages, manage templates
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  allowed-tools: Bash(agent-whatsappbot:*)
6
6
  metadata:
7
7
  openclaw:
@@ -169,6 +169,15 @@ agent-whatsappbot auth remove <account-id>
169
169
  agent-whatsappbot auth clear
170
170
  ```
171
171
 
172
+ ### Whoami Command
173
+
174
+ ```bash
175
+ # Show current authenticated bot
176
+ agent-whatsappbot whoami
177
+ agent-whatsappbot whoami --pretty
178
+ agent-whatsappbot whoami --account <account-id>
179
+ ```
180
+
172
181
  ### Message Commands
173
182
 
174
183
  ```bash
@@ -12,6 +12,7 @@ import {
12
12
  createManagerCommand,
13
13
  createMessageCommand,
14
14
  createSnapshotCommand,
15
+ createWhoamiCommand,
15
16
  } from './commands'
16
17
  import { ensureChannelAuth } from './ensure-auth'
17
18
 
@@ -45,6 +46,7 @@ program.addCommand(createGroupCommand())
45
46
  program.addCommand(createManagerCommand())
46
47
  program.addCommand(createBotCommand())
47
48
  program.addCommand(createSnapshotCommand())
49
+ program.addCommand(createWhoamiCommand())
48
50
 
49
51
  program.parseAsync(process.argv)
50
52
 
@@ -5,3 +5,4 @@ export { createGroupCommand, groupCommand } from './group'
5
5
  export { createManagerCommand, managerCommand } from './manager'
6
6
  export { createMessageCommand, messageCommand } from './message'
7
7
  export { createSnapshotCommand, snapshotCommand } from './snapshot'
8
+ export { createWhoamiCommand, whoamiCommand } from './whoami'
@@ -0,0 +1,64 @@
1
+ import { beforeEach, describe, expect, mock, test } from 'bun:test'
2
+
3
+ const mockGetAccount = mock(() =>
4
+ Promise.resolve({
5
+ id: 'account-1',
6
+ name: 'Test User',
7
+ email: 'test@example.com',
8
+ emailVerified: true,
9
+ language: 'en',
10
+ country: 'US',
11
+ createdAt: 1700000000000,
12
+ }),
13
+ )
14
+
15
+ mock.module('./shared', () => ({
16
+ getClient: async () => ({
17
+ getAccount: mockGetAccount,
18
+ }),
19
+ getCurrentWorkspaceId: async () => 'ws-1',
20
+ }))
21
+
22
+ import { whoamiAction } from './whoami'
23
+
24
+ describe('whoami command', () => {
25
+ beforeEach(() => {
26
+ mockGetAccount.mockReset()
27
+ mockGetAccount.mockImplementation(() =>
28
+ Promise.resolve({
29
+ id: 'account-1',
30
+ name: 'Test User',
31
+ email: 'test@example.com',
32
+ emailVerified: true,
33
+ language: 'en',
34
+ country: 'US',
35
+ createdAt: 1700000000000,
36
+ }),
37
+ )
38
+ })
39
+
40
+ test('whoamiAction returns account info', async () => {
41
+ const result = await whoamiAction({})
42
+
43
+ expect(mockGetAccount).toHaveBeenCalled()
44
+ expect(result.account).toEqual({
45
+ id: 'account-1',
46
+ name: 'Test User',
47
+ email: 'test@example.com',
48
+ email_verified: true,
49
+ language: 'en',
50
+ country: 'US',
51
+ created_at: 1700000000000,
52
+ })
53
+ expect(result.error).toBeUndefined()
54
+ })
55
+
56
+ test('whoamiAction returns error when getAccount fails', async () => {
57
+ mockGetAccount.mockImplementation(() => Promise.reject(new Error('Not authenticated')))
58
+
59
+ const result = await whoamiAction({})
60
+
61
+ expect(result.error).toBe('Not authenticated')
62
+ expect(result.account).toBeUndefined()
63
+ })
64
+ })
@@ -0,0 +1,62 @@
1
+ import { Command } from 'commander'
2
+
3
+ import { formatOutput } from '@/shared/utils/output'
4
+
5
+ import { getClient } from './shared'
6
+
7
+ interface ActionOptions {
8
+ workspace?: string
9
+ pretty?: boolean
10
+ }
11
+
12
+ interface WhoamiResult {
13
+ account?: {
14
+ id: string
15
+ name: string
16
+ email: string
17
+ email_verified: boolean
18
+ language: string
19
+ country: string
20
+ created_at: number
21
+ }
22
+ error?: string
23
+ }
24
+
25
+ export async function whoamiAction(options: ActionOptions = {}): Promise<WhoamiResult> {
26
+ try {
27
+ const client = await getClient(options)
28
+ const account = await client.getAccount()
29
+ return {
30
+ account: {
31
+ id: account.id,
32
+ name: account.name,
33
+ email: account.email,
34
+ email_verified: account.emailVerified,
35
+ language: account.language,
36
+ country: account.country,
37
+ created_at: account.createdAt,
38
+ },
39
+ }
40
+ } catch (error) {
41
+ return { error: (error as Error).message }
42
+ }
43
+ }
44
+
45
+ function cliOutput(result: WhoamiResult, pretty?: boolean): void {
46
+ console.log(formatOutput(result, pretty))
47
+ if (result.error) {
48
+ process.exit(1)
49
+ }
50
+ }
51
+
52
+ export function createWhoamiCommand(): Command {
53
+ return new Command('whoami')
54
+ .description('Show current authenticated user')
55
+ .option('--workspace <id>', 'Workspace ID')
56
+ .option('--pretty', 'Pretty print JSON output')
57
+ .action(async (opts: ActionOptions) => {
58
+ cliOutput(await whoamiAction(opts), opts.pretty)
59
+ })
60
+ }
61
+
62
+ export const whoamiCommand = createWhoamiCommand()
@@ -11,6 +11,7 @@ import {
11
11
  managerCommand,
12
12
  messageCommand,
13
13
  snapshotCommand,
14
+ whoamiCommand,
14
15
  } from './commands/index'
15
16
 
16
17
  const program = new Command()
@@ -24,6 +25,7 @@ program
24
25
  .option('--bot <name>', 'Bot name to use for sending messages')
25
26
 
26
27
  program.addCommand(authCommand)
28
+ program.addCommand(whoamiCommand)
27
29
  program.addCommand(messageCommand)
28
30
  program.addCommand(chatCommand)
29
31
  program.addCommand(groupCommand)
@@ -5,3 +5,4 @@ export { groupCommand } from './group'
5
5
  export { managerCommand } from './manager'
6
6
  export { messageCommand } from './message'
7
7
  export { snapshotCommand } from './snapshot'
8
+ export { whoamiCommand } from './whoami'
@@ -0,0 +1,104 @@
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 mockGetChannel = mock(() =>
8
+ Promise.resolve({
9
+ id: 'channel-id-123',
10
+ name: 'Test Channel',
11
+ homepageUrl: 'https://test.channel.io',
12
+ description: 'Test channel description',
13
+ }),
14
+ )
15
+
16
+ mock.module('../client', () => ({
17
+ ChannelBotClient: class MockChannelBotClient {
18
+ async login(_credentials?: { accessKey: string; accessSecret: string }) {
19
+ return this
20
+ }
21
+ getChannel = mockGetChannel
22
+ },
23
+ }))
24
+
25
+ import { ChannelBotCredentialManager } from '../credential-manager'
26
+ import { whoamiAction } from './whoami'
27
+
28
+ describe('whoami command', () => {
29
+ let tempDir: string
30
+ let originalEnv: NodeJS.ProcessEnv
31
+
32
+ beforeEach(async () => {
33
+ tempDir = join(tmpdir(), `channeltalkbot-whoami-test-${Date.now()}`)
34
+ await mkdir(tempDir, { recursive: true })
35
+ originalEnv = { ...process.env }
36
+ delete process.env.E2E_CHANNELBOT_ACCESS_KEY
37
+ delete process.env.E2E_CHANNELBOT_ACCESS_SECRET
38
+ mockGetChannel.mockClear()
39
+ })
40
+
41
+ afterEach(() => {
42
+ if (existsSync(tempDir)) {
43
+ rmSync(tempDir, { recursive: true })
44
+ }
45
+ process.env = originalEnv
46
+ })
47
+
48
+ test('returns channel info for current workspace', async () => {
49
+ const manager = new ChannelBotCredentialManager(tempDir)
50
+ await manager.setCredentials({
51
+ workspace_id: 'workspace1',
52
+ workspace_name: 'Test Workspace',
53
+ access_key: 'key123',
54
+ access_secret: 'secret123',
55
+ })
56
+
57
+ const result = await whoamiAction({ _credManager: manager })
58
+
59
+ expect(result.id).toBe('channel-id-123')
60
+ expect(result.name).toBe('Test Channel')
61
+ expect(result.homepage_url).toBe('https://test.channel.io')
62
+ expect(result.description).toBe('Test channel description')
63
+ expect(result.error).toBeUndefined()
64
+ })
65
+
66
+ test('returns channel info for specific --workspace', async () => {
67
+ const manager = new ChannelBotCredentialManager(tempDir)
68
+ await manager.setCredentials({
69
+ workspace_id: 'workspace1',
70
+ workspace_name: 'Workspace 1',
71
+ access_key: 'key1',
72
+ access_secret: 'secret1',
73
+ })
74
+ await manager.setCredentials({
75
+ workspace_id: 'workspace2',
76
+ workspace_name: 'Workspace 2',
77
+ access_key: 'key2',
78
+ access_secret: 'secret2',
79
+ })
80
+
81
+ const result = await whoamiAction({ workspace: 'workspace1', _credManager: manager })
82
+
83
+ expect(result.id).toBe('channel-id-123')
84
+ expect(result.name).toBe('Test Channel')
85
+ expect(mockGetChannel).toHaveBeenCalledTimes(1)
86
+ })
87
+
88
+ test('returns error when client throws', async () => {
89
+ mockGetChannel.mockImplementationOnce(() => Promise.reject(new Error('API Error')))
90
+
91
+ const manager = new ChannelBotCredentialManager(tempDir)
92
+ await manager.setCredentials({
93
+ workspace_id: 'workspace1',
94
+ workspace_name: 'Test Workspace',
95
+ access_key: 'key123',
96
+ access_secret: 'secret123',
97
+ })
98
+
99
+ const result = await whoamiAction({ _credManager: manager })
100
+
101
+ expect(result.error).toBeDefined()
102
+ expect(result.error).toContain('API Error')
103
+ })
104
+ })