agent-messenger 1.0.0 → 1.1.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 (330) hide show
  1. package/.claude/commands/release.md +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.github/workflows/ci.yml +1 -1
  4. package/.github/workflows/e2e.yml.disabled +69 -0
  5. package/README.md +16 -14
  6. package/biome.json +33 -1
  7. package/bun.lock +63 -0
  8. package/dist/package.json +8 -4
  9. package/dist/src/cli.d.ts.map +1 -1
  10. package/dist/src/cli.js +4 -1
  11. package/dist/src/cli.js.map +1 -1
  12. package/dist/src/platforms/discord/cli.js +1 -1
  13. package/dist/src/platforms/discord/client.d.ts.map +1 -1
  14. package/dist/src/platforms/discord/client.js +3 -3
  15. package/dist/src/platforms/discord/client.js.map +1 -1
  16. package/dist/src/platforms/discord/commands/user.d.ts.map +1 -1
  17. package/dist/src/platforms/discord/commands/user.js +10 -1
  18. package/dist/src/platforms/discord/commands/user.js.map +1 -1
  19. package/dist/src/platforms/discord/credential-manager.d.ts.map +1 -1
  20. package/dist/src/platforms/discord/credential-manager.js +18 -12
  21. package/dist/src/platforms/discord/credential-manager.js.map +1 -1
  22. package/dist/src/platforms/slack/cli.js +1 -1
  23. package/dist/src/platforms/slack/credential-manager.d.ts.map +1 -1
  24. package/dist/src/platforms/slack/credential-manager.js +20 -6
  25. package/dist/src/platforms/slack/credential-manager.js.map +1 -1
  26. package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
  27. package/dist/src/platforms/slack/token-extractor.js +34 -9
  28. package/dist/src/platforms/slack/token-extractor.js.map +1 -1
  29. package/dist/src/platforms/teams/cli.d.ts.map +1 -0
  30. package/dist/{cli.js → src/platforms/teams/cli.js} +11 -10
  31. package/dist/src/platforms/teams/cli.js.map +1 -0
  32. package/dist/src/platforms/teams/client.d.ts +32 -0
  33. package/dist/src/platforms/teams/client.d.ts.map +1 -0
  34. package/dist/src/platforms/teams/client.js +202 -0
  35. package/dist/src/platforms/teams/client.js.map +1 -0
  36. package/dist/src/platforms/teams/commands/auth.d.ts +14 -0
  37. package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -0
  38. package/dist/src/platforms/teams/commands/auth.js +176 -0
  39. package/dist/src/platforms/teams/commands/auth.js.map +1 -0
  40. package/dist/src/platforms/teams/commands/channel.d.ts +13 -0
  41. package/dist/src/platforms/teams/commands/channel.d.ts.map +1 -0
  42. package/dist/src/platforms/teams/commands/channel.js +97 -0
  43. package/dist/src/platforms/teams/commands/channel.js.map +1 -0
  44. package/dist/src/platforms/teams/commands/file.d.ts +12 -0
  45. package/dist/src/platforms/teams/commands/file.d.ts.map +1 -0
  46. package/dist/src/platforms/teams/commands/file.js +104 -0
  47. package/dist/src/platforms/teams/commands/file.js.map +1 -0
  48. package/dist/{commands → src/platforms/teams/commands}/index.d.ts +5 -2
  49. package/dist/src/platforms/teams/commands/index.d.ts.map +1 -0
  50. package/dist/{commands → src/platforms/teams/commands}/index.js +5 -2
  51. package/dist/src/platforms/teams/commands/index.js.map +1 -0
  52. package/dist/src/platforms/teams/commands/message.d.ts +17 -0
  53. package/dist/src/platforms/teams/commands/message.d.ts.map +1 -0
  54. package/dist/src/platforms/teams/commands/message.js +133 -0
  55. package/dist/src/platforms/teams/commands/message.js.map +1 -0
  56. package/dist/src/platforms/teams/commands/reaction.d.ts +9 -0
  57. package/dist/src/platforms/teams/commands/reaction.d.ts.map +1 -0
  58. package/dist/src/platforms/teams/commands/reaction.js +68 -0
  59. package/dist/src/platforms/teams/commands/reaction.js.map +1 -0
  60. package/dist/src/platforms/teams/commands/snapshot.d.ts +10 -0
  61. package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -0
  62. package/dist/src/platforms/teams/commands/snapshot.js +85 -0
  63. package/dist/src/platforms/teams/commands/snapshot.js.map +1 -0
  64. package/dist/src/platforms/teams/commands/team.d.ts +18 -0
  65. package/dist/src/platforms/teams/commands/team.d.ts.map +1 -0
  66. package/dist/src/platforms/teams/commands/team.js +130 -0
  67. package/dist/src/platforms/teams/commands/team.js.map +1 -0
  68. package/dist/src/platforms/teams/commands/user.d.ts.map +1 -0
  69. package/dist/src/platforms/teams/commands/user.js +88 -0
  70. package/dist/src/platforms/teams/commands/user.js.map +1 -0
  71. package/dist/src/platforms/teams/credential-manager.d.ts +18 -0
  72. package/dist/src/platforms/teams/credential-manager.d.ts.map +1 -0
  73. package/dist/src/platforms/teams/credential-manager.js +81 -0
  74. package/dist/src/platforms/teams/credential-manager.js.map +1 -0
  75. package/dist/src/platforms/teams/index.d.ts +4 -0
  76. package/dist/src/platforms/teams/index.d.ts.map +1 -0
  77. package/dist/src/platforms/teams/index.js +6 -0
  78. package/dist/src/platforms/teams/index.js.map +1 -0
  79. package/dist/src/platforms/teams/token-extractor.d.ts +36 -0
  80. package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -0
  81. package/dist/src/platforms/teams/token-extractor.js +335 -0
  82. package/dist/src/platforms/teams/token-extractor.js.map +1 -0
  83. package/dist/src/platforms/teams/types.d.ts +209 -0
  84. package/dist/src/platforms/teams/types.d.ts.map +1 -0
  85. package/dist/src/platforms/teams/types.js +65 -0
  86. package/dist/src/platforms/teams/types.js.map +1 -0
  87. package/docs/teams.md +321 -0
  88. package/e2e/README.md +256 -0
  89. package/e2e/config.ts +45 -0
  90. package/e2e/discord.e2e.test.ts +252 -0
  91. package/e2e/helpers.ts +107 -0
  92. package/e2e/slack.e2e.test.ts +309 -0
  93. package/package.json +8 -4
  94. package/scripts/postbuild.ts +15 -0
  95. package/skills/agent-teams/SKILL.md +292 -0
  96. package/skills/agent-teams/references/authentication.md +375 -0
  97. package/skills/agent-teams/references/common-patterns.md +596 -0
  98. package/skills/agent-teams/templates/monitor-channel.sh +239 -0
  99. package/skills/agent-teams/templates/post-message.sh +224 -0
  100. package/skills/agent-teams/templates/team-summary.sh +210 -0
  101. package/src/cli.ts +4 -0
  102. package/src/platforms/discord/client.ts +3 -3
  103. package/src/platforms/discord/commands/auth.test.ts +48 -32
  104. package/src/platforms/discord/commands/channel.test.ts +54 -42
  105. package/src/platforms/discord/commands/file.test.ts +40 -53
  106. package/src/platforms/discord/commands/guild.test.ts +47 -27
  107. package/src/platforms/discord/commands/message.test.ts +54 -51
  108. package/src/platforms/discord/commands/reaction.test.ts +54 -42
  109. package/src/platforms/discord/commands/user.ts +12 -1
  110. package/src/platforms/discord/credential-manager.test.ts +137 -136
  111. package/src/platforms/discord/credential-manager.ts +20 -13
  112. package/src/platforms/discord/token-extractor.test.ts +133 -383
  113. package/{tests → src/platforms/slack}/cli.test.ts +3 -3
  114. package/{tests/slack-client.test.ts → src/platforms/slack/client.test.ts} +1 -1
  115. package/{tests → src/platforms/slack}/commands/auth.test.ts +25 -13
  116. package/{tests → src/platforms/slack}/commands/channel.test.ts +2 -2
  117. package/{tests → src/platforms/slack}/commands/file.test.ts +2 -2
  118. package/{tests → src/platforms/slack}/commands/message.test.ts +2 -2
  119. package/{tests → src/platforms/slack}/commands/reaction.test.ts +1 -1
  120. package/{tests → src/platforms/slack}/commands/snapshot.test.ts +117 -105
  121. package/{tests → src/platforms/slack}/commands/user.test.ts +3 -3
  122. package/{tests → src/platforms/slack}/commands/workspace.test.ts +44 -95
  123. package/{tests → src/platforms/slack}/credential-manager.test.ts +2 -2
  124. package/src/platforms/slack/credential-manager.ts +22 -7
  125. package/src/platforms/slack/token-extractor-node-test.ts +40 -0
  126. package/src/platforms/slack/token-extractor-node.test.ts +10 -0
  127. package/src/platforms/slack/token-extractor.ts +36 -10
  128. package/{tests → src/platforms/slack}/types.test.ts +1 -1
  129. package/src/platforms/teams/cli.ts +36 -0
  130. package/src/platforms/teams/client.test.ts +500 -0
  131. package/src/platforms/teams/client.ts +365 -0
  132. package/src/platforms/teams/commands/auth.test.ts +99 -0
  133. package/src/platforms/teams/commands/auth.ts +232 -0
  134. package/src/platforms/teams/commands/channel.test.ts +147 -0
  135. package/src/platforms/teams/commands/channel.ts +129 -0
  136. package/src/platforms/teams/commands/file.test.ts +88 -0
  137. package/src/platforms/teams/commands/file.ts +144 -0
  138. package/src/platforms/teams/commands/index.ts +12 -0
  139. package/src/platforms/teams/commands/message.test.ts +110 -0
  140. package/src/platforms/teams/commands/message.ts +188 -0
  141. package/src/platforms/teams/commands/reaction.test.ts +87 -0
  142. package/src/platforms/teams/commands/reaction.ts +104 -0
  143. package/src/platforms/teams/commands/snapshot.test.ts +35 -0
  144. package/src/platforms/teams/commands/snapshot.ts +115 -0
  145. package/src/platforms/teams/commands/team.test.ts +157 -0
  146. package/src/platforms/teams/commands/team.ts +164 -0
  147. package/src/platforms/teams/commands/user.test.ts +83 -0
  148. package/src/platforms/teams/commands/user.ts +112 -0
  149. package/src/platforms/teams/credential-manager.test.ts +178 -0
  150. package/src/platforms/teams/credential-manager.ts +92 -0
  151. package/src/platforms/teams/index.ts +5 -0
  152. package/src/platforms/teams/token-extractor.test.ts +429 -0
  153. package/src/platforms/teams/token-extractor.ts +462 -0
  154. package/src/platforms/teams/types.test.ts +226 -0
  155. package/src/platforms/teams/types.ts +140 -0
  156. package/tsconfig.json +1 -1
  157. package/dist/cli.d.ts.map +0 -1
  158. package/dist/cli.js.map +0 -1
  159. package/dist/commands/auth.d.ts +0 -3
  160. package/dist/commands/auth.d.ts.map +0 -1
  161. package/dist/commands/auth.js +0 -140
  162. package/dist/commands/auth.js.map +0 -1
  163. package/dist/commands/channel.d.ts +0 -3
  164. package/dist/commands/channel.d.ts.map +0 -1
  165. package/dist/commands/channel.js +0 -118
  166. package/dist/commands/channel.js.map +0 -1
  167. package/dist/commands/file.d.ts +0 -3
  168. package/dist/commands/file.d.ts.map +0 -1
  169. package/dist/commands/file.js +0 -113
  170. package/dist/commands/file.js.map +0 -1
  171. package/dist/commands/index.d.ts.map +0 -1
  172. package/dist/commands/index.js.map +0 -1
  173. package/dist/commands/message.d.ts +0 -3
  174. package/dist/commands/message.d.ts.map +0 -1
  175. package/dist/commands/message.js +0 -214
  176. package/dist/commands/message.js.map +0 -1
  177. package/dist/commands/reaction.d.ts +0 -3
  178. package/dist/commands/reaction.d.ts.map +0 -1
  179. package/dist/commands/reaction.js +0 -100
  180. package/dist/commands/reaction.js.map +0 -1
  181. package/dist/commands/snapshot.d.ts +0 -3
  182. package/dist/commands/snapshot.d.ts.map +0 -1
  183. package/dist/commands/snapshot.js +0 -88
  184. package/dist/commands/snapshot.js.map +0 -1
  185. package/dist/commands/user.d.ts.map +0 -1
  186. package/dist/commands/user.js +0 -96
  187. package/dist/commands/user.js.map +0 -1
  188. package/dist/commands/workspace.d.ts +0 -3
  189. package/dist/commands/workspace.d.ts.map +0 -1
  190. package/dist/commands/workspace.js +0 -89
  191. package/dist/commands/workspace.js.map +0 -1
  192. package/dist/lib/credential-manager.d.ts +0 -13
  193. package/dist/lib/credential-manager.d.ts.map +0 -1
  194. package/dist/lib/credential-manager.js +0 -58
  195. package/dist/lib/credential-manager.js.map +0 -1
  196. package/dist/lib/index.d.ts +0 -3
  197. package/dist/lib/index.d.ts.map +0 -1
  198. package/dist/lib/index.js +0 -3
  199. package/dist/lib/index.js.map +0 -1
  200. package/dist/lib/ref-manager.d.ts +0 -26
  201. package/dist/lib/ref-manager.d.ts.map +0 -1
  202. package/dist/lib/ref-manager.js +0 -92
  203. package/dist/lib/ref-manager.js.map +0 -1
  204. package/dist/lib/slack-client.d.ts +0 -37
  205. package/dist/lib/slack-client.d.ts.map +0 -1
  206. package/dist/lib/slack-client.js +0 -379
  207. package/dist/lib/slack-client.js.map +0 -1
  208. package/dist/lib/token-extractor.d.ts +0 -28
  209. package/dist/lib/token-extractor.d.ts.map +0 -1
  210. package/dist/lib/token-extractor.js +0 -401
  211. package/dist/lib/token-extractor.js.map +0 -1
  212. package/dist/src/platforms/discord/client.test.d.ts +0 -2
  213. package/dist/src/platforms/discord/client.test.d.ts.map +0 -1
  214. package/dist/src/platforms/discord/client.test.js +0 -367
  215. package/dist/src/platforms/discord/client.test.js.map +0 -1
  216. package/dist/src/platforms/discord/commands/auth.test.d.ts +0 -2
  217. package/dist/src/platforms/discord/commands/auth.test.d.ts.map +0 -1
  218. package/dist/src/platforms/discord/commands/auth.test.js +0 -65
  219. package/dist/src/platforms/discord/commands/auth.test.js.map +0 -1
  220. package/dist/src/platforms/discord/commands/channel.test.d.ts +0 -2
  221. package/dist/src/platforms/discord/commands/channel.test.d.ts.map +0 -1
  222. package/dist/src/platforms/discord/commands/channel.test.js +0 -136
  223. package/dist/src/platforms/discord/commands/channel.test.js.map +0 -1
  224. package/dist/src/platforms/discord/commands/file.test.d.ts +0 -2
  225. package/dist/src/platforms/discord/commands/file.test.d.ts.map +0 -1
  226. package/dist/src/platforms/discord/commands/file.test.js +0 -83
  227. package/dist/src/platforms/discord/commands/file.test.js.map +0 -1
  228. package/dist/src/platforms/discord/commands/guild.test.d.ts +0 -2
  229. package/dist/src/platforms/discord/commands/guild.test.d.ts.map +0 -1
  230. package/dist/src/platforms/discord/commands/guild.test.js +0 -100
  231. package/dist/src/platforms/discord/commands/guild.test.js.map +0 -1
  232. package/dist/src/platforms/discord/commands/message.test.d.ts +0 -2
  233. package/dist/src/platforms/discord/commands/message.test.d.ts.map +0 -1
  234. package/dist/src/platforms/discord/commands/message.test.js +0 -91
  235. package/dist/src/platforms/discord/commands/message.test.js.map +0 -1
  236. package/dist/src/platforms/discord/commands/reaction.test.d.ts +0 -2
  237. package/dist/src/platforms/discord/commands/reaction.test.d.ts.map +0 -1
  238. package/dist/src/platforms/discord/commands/reaction.test.js +0 -115
  239. package/dist/src/platforms/discord/commands/reaction.test.js.map +0 -1
  240. package/dist/src/platforms/discord/commands/snapshot.test.d.ts +0 -2
  241. package/dist/src/platforms/discord/commands/snapshot.test.d.ts.map +0 -1
  242. package/dist/src/platforms/discord/commands/snapshot.test.js +0 -25
  243. package/dist/src/platforms/discord/commands/snapshot.test.js.map +0 -1
  244. package/dist/src/platforms/discord/commands/user.test.d.ts +0 -2
  245. package/dist/src/platforms/discord/commands/user.test.d.ts.map +0 -1
  246. package/dist/src/platforms/discord/commands/user.test.js +0 -103
  247. package/dist/src/platforms/discord/commands/user.test.js.map +0 -1
  248. package/dist/src/platforms/discord/credential-manager.test.d.ts +0 -2
  249. package/dist/src/platforms/discord/credential-manager.test.d.ts.map +0 -1
  250. package/dist/src/platforms/discord/credential-manager.test.js +0 -136
  251. package/dist/src/platforms/discord/credential-manager.test.js.map +0 -1
  252. package/dist/src/platforms/discord/token-extractor.test.d.ts +0 -2
  253. package/dist/src/platforms/discord/token-extractor.test.d.ts.map +0 -1
  254. package/dist/src/platforms/discord/token-extractor.test.js +0 -789
  255. package/dist/src/platforms/discord/token-extractor.test.js.map +0 -1
  256. package/dist/src/platforms/discord/types.test.d.ts +0 -2
  257. package/dist/src/platforms/discord/types.test.d.ts.map +0 -1
  258. package/dist/src/platforms/discord/types.test.js +0 -211
  259. package/dist/src/platforms/discord/types.test.js.map +0 -1
  260. package/dist/src/shared/utils/concurrency.test.d.ts +0 -2
  261. package/dist/src/shared/utils/concurrency.test.d.ts.map +0 -1
  262. package/dist/src/shared/utils/concurrency.test.js +0 -39
  263. package/dist/src/shared/utils/concurrency.test.js.map +0 -1
  264. package/dist/tests/cli.test.d.ts +0 -2
  265. package/dist/tests/cli.test.d.ts.map +0 -1
  266. package/dist/tests/cli.test.js +0 -83
  267. package/dist/tests/cli.test.js.map +0 -1
  268. package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/CURRENT +0 -1
  269. package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOCK +0 -0
  270. package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG +0 -3
  271. package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/LOG.old +0 -1
  272. package/dist/tests/commands/.test-slack-data/Local Storage/leveldb/MANIFEST-000004 +0 -0
  273. package/dist/tests/commands/auth.test.d.ts +0 -2
  274. package/dist/tests/commands/auth.test.d.ts.map +0 -1
  275. package/dist/tests/commands/auth.test.js +0 -304
  276. package/dist/tests/commands/auth.test.js.map +0 -1
  277. package/dist/tests/commands/channel.test.d.ts +0 -2
  278. package/dist/tests/commands/channel.test.d.ts.map +0 -1
  279. package/dist/tests/commands/channel.test.js +0 -166
  280. package/dist/tests/commands/channel.test.js.map +0 -1
  281. package/dist/tests/commands/file.test.d.ts +0 -2
  282. package/dist/tests/commands/file.test.d.ts.map +0 -1
  283. package/dist/tests/commands/file.test.js +0 -175
  284. package/dist/tests/commands/file.test.js.map +0 -1
  285. package/dist/tests/commands/message.test.d.ts +0 -2
  286. package/dist/tests/commands/message.test.d.ts.map +0 -1
  287. package/dist/tests/commands/message.test.js +0 -293
  288. package/dist/tests/commands/message.test.js.map +0 -1
  289. package/dist/tests/commands/reaction.test.d.ts +0 -2
  290. package/dist/tests/commands/reaction.test.d.ts.map +0 -1
  291. package/dist/tests/commands/reaction.test.js +0 -84
  292. package/dist/tests/commands/reaction.test.js.map +0 -1
  293. package/dist/tests/commands/snapshot.test.d.ts +0 -2
  294. package/dist/tests/commands/snapshot.test.d.ts.map +0 -1
  295. package/dist/tests/commands/snapshot.test.js +0 -280
  296. package/dist/tests/commands/snapshot.test.js.map +0 -1
  297. package/dist/tests/commands/user.test.d.ts +0 -2
  298. package/dist/tests/commands/user.test.d.ts.map +0 -1
  299. package/dist/tests/commands/user.test.js +0 -117
  300. package/dist/tests/commands/user.test.js.map +0 -1
  301. package/dist/tests/commands/workspace.test.d.ts +0 -2
  302. package/dist/tests/commands/workspace.test.d.ts.map +0 -1
  303. package/dist/tests/commands/workspace.test.js +0 -453
  304. package/dist/tests/commands/workspace.test.js.map +0 -1
  305. package/dist/tests/credential-manager.test.d.ts +0 -2
  306. package/dist/tests/credential-manager.test.d.ts.map +0 -1
  307. package/dist/tests/credential-manager.test.js +0 -199
  308. package/dist/tests/credential-manager.test.js.map +0 -1
  309. package/dist/tests/slack-client.test.d.ts +0 -2
  310. package/dist/tests/slack-client.test.d.ts.map +0 -1
  311. package/dist/tests/slack-client.test.js +0 -741
  312. package/dist/tests/slack-client.test.js.map +0 -1
  313. package/dist/tests/types.test.d.ts +0 -2
  314. package/dist/tests/types.test.d.ts.map +0 -1
  315. package/dist/tests/types.test.js +0 -215
  316. package/dist/tests/types.test.js.map +0 -1
  317. package/dist/types/index.d.ts +0 -369
  318. package/dist/types/index.d.ts.map +0 -1
  319. package/dist/types/index.js +0 -92
  320. package/dist/types/index.js.map +0 -1
  321. package/dist/utils/error-handler.d.ts +0 -2
  322. package/dist/utils/error-handler.d.ts.map +0 -1
  323. package/dist/utils/error-handler.js +0 -5
  324. package/dist/utils/error-handler.js.map +0 -1
  325. package/dist/utils/output.d.ts +0 -2
  326. package/dist/utils/output.d.ts.map +0 -1
  327. package/dist/utils/output.js +0 -4
  328. package/dist/utils/output.js.map +0 -1
  329. /package/dist/{cli.d.ts → src/platforms/teams/cli.d.ts} +0 -0
  330. /package/dist/{commands → src/platforms/teams/commands}/user.d.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-messenger",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Multi-platform messaging CLI for AI agents (Slack, Discord, Teams)",
5
5
  "type": "module",
6
6
  "module": "dist/cli.js",
@@ -9,11 +9,14 @@
9
9
  "agent-messenger": "./src/cli.ts",
10
10
  "amsg": "./src/cli.ts",
11
11
  "agent-slack": "./src/platforms/slack/cli.ts",
12
- "agent-discord": "./src/platforms/discord/cli.ts"
12
+ "agent-discord": "./src/platforms/discord/cli.ts",
13
+ "agent-teams": "./src/platforms/teams/cli.ts"
13
14
  },
14
15
  "scripts": {
15
- "build": "tsc && sed -i '' '1s|#!/usr/bin/env bun|#!/usr/bin/env node|' dist/cli.js",
16
- "test": "bun test",
16
+ "build": "tsc",
17
+ "postbuild": "bun scripts/postbuild.ts",
18
+ "test": "bun test src/",
19
+ "test:e2e": "bun test e2e/",
17
20
  "typecheck": "tsc --noEmit",
18
21
  "lint": "biome check .",
19
22
  "format": "biome format --write .",
@@ -32,6 +35,7 @@
32
35
  "@types/better-sqlite3": "^7.6.8",
33
36
  "@types/bun": "latest",
34
37
  "@types/node": "^20.10.6",
38
+ "tsx": "^4.21.0",
35
39
  "typescript": "^5.9.3"
36
40
  }
37
41
  }
@@ -0,0 +1,15 @@
1
+ import { readFileSync, writeFileSync } from 'node:fs'
2
+
3
+ const cliFiles = [
4
+ 'dist/src/cli.js',
5
+ 'dist/src/platforms/slack/cli.js',
6
+ 'dist/src/platforms/discord/cli.js',
7
+ ]
8
+
9
+ for (const file of cliFiles) {
10
+ const content = readFileSync(file, 'utf8')
11
+ const updated = content.replace('#!/usr/bin/env bun', '#!/usr/bin/env node')
12
+ writeFileSync(file, updated)
13
+ }
14
+
15
+ console.log(`Updated shebang in ${cliFiles.length} CLI files`)
@@ -0,0 +1,292 @@
1
+ ---
2
+ name: agent-teams
3
+ description: Interact with Microsoft Teams - send messages, read channels, manage reactions
4
+ allowed-tools: Bash(agent-teams:*)
5
+ ---
6
+
7
+ # Agent Teams
8
+
9
+ A TypeScript CLI tool that enables AI agents and humans to interact with Microsoft Teams through a simple command interface. Features seamless token extraction from the Teams desktop app and multi-team support.
10
+
11
+ ## TOKEN EXPIRY WARNING
12
+
13
+ **CRITICAL**: Microsoft Teams tokens expire in **60-90 minutes**! Unlike Discord/Slack, Teams tokens have a short lifespan. You MUST:
14
+
15
+ 1. Check token validity before operations
16
+ 2. Re-extract credentials when tokens expire
17
+ 3. Handle `401 Unauthorized` errors gracefully
18
+
19
+ ```bash
20
+ # Always check auth status first
21
+ agent-teams auth status
22
+
23
+ # If expired, re-extract
24
+ agent-teams auth extract
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```bash
30
+ # Extract credentials from Teams desktop app (zero-config)
31
+ agent-teams auth extract
32
+
33
+ # Get team snapshot
34
+ agent-teams snapshot
35
+
36
+ # Send a message
37
+ agent-teams message send <channel-id> "Hello from AI agent!"
38
+
39
+ # List channels
40
+ agent-teams channel list
41
+ ```
42
+
43
+ ## Authentication
44
+
45
+ ### Seamless Token Extraction
46
+
47
+ agent-teams automatically extracts your Teams credentials from the desktop app:
48
+
49
+ ```bash
50
+ # Just run this - no manual token copying needed
51
+ agent-teams auth extract
52
+
53
+ # Use --debug for troubleshooting
54
+ agent-teams auth extract --debug
55
+ ```
56
+
57
+ This command:
58
+ - Auto-detects your platform (macOS/Linux/Windows)
59
+ - Extracts skypetoken_asm from Teams desktop app's Cookies SQLite database
60
+ - Validates token against Teams API before saving
61
+ - Discovers ALL joined teams
62
+ - Stores credentials securely in `~/.config/agent-messenger/`
63
+
64
+ ### Multi-Team Support
65
+
66
+ ```bash
67
+ # List all available teams
68
+ agent-teams team list
69
+
70
+ # Switch to a different team
71
+ agent-teams team switch <team-id>
72
+
73
+ # Show current team
74
+ agent-teams team current
75
+
76
+ # Check auth status (includes token expiry info)
77
+ agent-teams auth status
78
+ ```
79
+
80
+ ## Commands
81
+
82
+ ### Message Commands
83
+
84
+ ```bash
85
+ # Send a message
86
+ agent-teams message send <channel-id> <content>
87
+ agent-teams message send 19:abc123@thread.tacv2 "Hello world"
88
+
89
+ # List messages
90
+ agent-teams message list <channel-id>
91
+ agent-teams message list 19:abc123@thread.tacv2 --limit 50
92
+
93
+ # Get a single message by ID
94
+ agent-teams message get <channel-id> <message-id>
95
+
96
+ # Delete a message
97
+ agent-teams message delete <channel-id> <message-id> --force
98
+ ```
99
+
100
+ ### Channel Commands
101
+
102
+ ```bash
103
+ # List channels in current team
104
+ agent-teams channel list
105
+
106
+ # Get channel info
107
+ agent-teams channel info <channel-id>
108
+ agent-teams channel info 19:abc123@thread.tacv2
109
+
110
+ # Get channel history (alias for message list)
111
+ agent-teams channel history <channel-id> --limit 100
112
+ ```
113
+
114
+ ### Team Commands
115
+
116
+ ```bash
117
+ # List all teams
118
+ agent-teams team list
119
+
120
+ # Get team info
121
+ agent-teams team info <team-id>
122
+
123
+ # Switch active team
124
+ agent-teams team switch <team-id>
125
+
126
+ # Show current team
127
+ agent-teams team current
128
+ ```
129
+
130
+ ### User Commands
131
+
132
+ ```bash
133
+ # List team members
134
+ agent-teams user list
135
+
136
+ # Get user info
137
+ agent-teams user info <user-id>
138
+
139
+ # Get current user
140
+ agent-teams user me
141
+ ```
142
+
143
+ ### Reaction Commands
144
+
145
+ ```bash
146
+ # Add reaction (use emoji name)
147
+ agent-teams reaction add <channel-id> <message-id> <emoji>
148
+ agent-teams reaction add 19:abc123@thread.tacv2 1234567890 like
149
+
150
+ # Remove reaction
151
+ agent-teams reaction remove <channel-id> <message-id> <emoji>
152
+
153
+ # List reactions on a message
154
+ agent-teams reaction list <channel-id> <message-id>
155
+ ```
156
+
157
+ ### File Commands
158
+
159
+ ```bash
160
+ # Upload file
161
+ agent-teams file upload <channel-id> <path>
162
+ agent-teams file upload 19:abc123@thread.tacv2 ./report.pdf
163
+
164
+ # List files in channel
165
+ agent-teams file list <channel-id>
166
+
167
+ # Get file info
168
+ agent-teams file info <channel-id> <file-id>
169
+ ```
170
+
171
+ ### Snapshot Command
172
+
173
+ Get comprehensive team state for AI agents:
174
+
175
+ ```bash
176
+ # Full snapshot
177
+ agent-teams snapshot
178
+
179
+ # Filtered snapshots
180
+ agent-teams snapshot --channels-only
181
+ agent-teams snapshot --users-only
182
+
183
+ # Limit messages per channel
184
+ agent-teams snapshot --limit 10
185
+ ```
186
+
187
+ Returns JSON with:
188
+ - Team metadata (id, name)
189
+ - Channels (id, name, type, description)
190
+ - Recent messages (id, content, author, timestamp)
191
+ - Members (id, displayName, email)
192
+
193
+ ## Output Format
194
+
195
+ ### JSON (Default)
196
+
197
+ All commands output JSON by default for AI consumption:
198
+
199
+ ```json
200
+ {
201
+ "id": "19:abc123@thread.tacv2",
202
+ "content": "Hello world",
203
+ "author": "John Doe",
204
+ "timestamp": "2024-01-15T10:30:00.000Z"
205
+ }
206
+ ```
207
+
208
+ ### Pretty (Human-Readable)
209
+
210
+ Use `--pretty` flag for formatted output:
211
+
212
+ ```bash
213
+ agent-teams channel list --pretty
214
+ ```
215
+
216
+ ## Key Differences from Discord/Slack
217
+
218
+ | Feature | Teams | Discord | Slack |
219
+ |---------|-------|---------|-------|
220
+ | Server terminology | Team | Guild | Workspace |
221
+ | Channel identifiers | UUID format (19:xxx@thread.tacv2) | Snowflake IDs | Channel name or ID |
222
+ | Token storage | Cookies SQLite | LevelDB | LevelDB |
223
+ | Token expiry | **60-90 minutes** | Rarely expires | Rarely expires |
224
+ | Mentions | `<at id="user-id">Name</at>` | `<@user_id>` | `<@USER_ID>` |
225
+
226
+ **Important**: Teams uses UUID-style channel IDs (like `19:abc123@thread.tacv2`). You cannot use channel names directly - use `channel list` to find IDs first.
227
+
228
+ ## Common Patterns
229
+
230
+ See `references/common-patterns.md` for typical AI agent workflows.
231
+
232
+ ## Templates
233
+
234
+ See `templates/` directory for runnable examples:
235
+ - `post-message.sh` - Send messages with error handling
236
+ - `monitor-channel.sh` - Monitor channel for new messages (with token refresh)
237
+ - `team-summary.sh` - Generate team summary
238
+
239
+ ## Error Handling
240
+
241
+ All commands return consistent error format:
242
+
243
+ ```json
244
+ {
245
+ "error": "Not authenticated. Run \"auth extract\" first."
246
+ }
247
+ ```
248
+
249
+ Common errors:
250
+ - `Not authenticated`: No valid token - run `auth extract`
251
+ - `Token expired`: Token has expired (60-90 min limit) - run `auth extract` again
252
+ - `No current team set`: Run `team switch <id>` first
253
+ - `Message not found`: Invalid message ID
254
+ - `Channel not found`: Invalid channel ID
255
+ - `401 Unauthorized`: Token expired - re-authenticate immediately
256
+
257
+ ## Configuration
258
+
259
+ Credentials stored in: `~/.config/agent-messenger/teams-credentials.json`
260
+
261
+ Format:
262
+ ```json
263
+ {
264
+ "token": "skypetoken_asm_value_here",
265
+ "token_extracted_at": "2024-01-15T10:00:00.000Z",
266
+ "current_team": "team-uuid-here",
267
+ "teams": {
268
+ "team-uuid-here": {
269
+ "team_id": "team-uuid-here",
270
+ "team_name": "My Team"
271
+ }
272
+ }
273
+ }
274
+ ```
275
+
276
+ **Security**: File permissions set to 0600 (owner read/write only)
277
+
278
+ ## Limitations
279
+
280
+ - No real-time events / WebSocket connection
281
+ - No voice/video channel support
282
+ - No team management (create/delete channels, roles)
283
+ - No meeting support
284
+ - No webhook support
285
+ - Plain text messages only (no adaptive cards in v1)
286
+ - User tokens only (no app tokens)
287
+ - **Token expires in 60-90 minutes** - must re-authenticate frequently
288
+
289
+ ## References
290
+
291
+ - [Authentication Guide](references/authentication.md)
292
+ - [Common Patterns](references/common-patterns.md)
@@ -0,0 +1,375 @@
1
+ # Authentication Guide
2
+
3
+ ## Overview
4
+
5
+ agent-teams uses Microsoft Teams' user token extracted directly from the Teams desktop application. This provides seamless authentication without manual token management.
6
+
7
+ ## TOKEN EXPIRY WARNING
8
+
9
+ **CRITICAL**: Microsoft Teams tokens expire in **60-90 minutes**!
10
+
11
+ Unlike Discord or Slack tokens which rarely expire, Teams tokens have a short lifespan. Your scripts and workflows MUST handle token expiry gracefully.
12
+
13
+ ### Token Lifecycle
14
+
15
+ ```
16
+ Token Extracted → Valid for 60-90 min → Expires → Must Re-extract
17
+ ```
18
+
19
+ ### Checking Token Age
20
+
21
+ ```bash
22
+ # Check auth status - includes token age
23
+ agent-teams auth status
24
+ ```
25
+
26
+ Output:
27
+ ```json
28
+ {
29
+ "authenticated": true,
30
+ "user": "john.doe@company.com",
31
+ "current_team": "team-uuid-here",
32
+ "teams_count": 3,
33
+ "token_age_minutes": 45,
34
+ "token_expires_soon": false
35
+ }
36
+ ```
37
+
38
+ When `token_expires_soon` is `true` (>50 min old), re-authenticate proactively.
39
+
40
+ ## Token Extraction
41
+
42
+ ### Automatic Extraction
43
+
44
+ The simplest way to authenticate:
45
+
46
+ ```bash
47
+ agent-teams auth extract
48
+
49
+ # Use --debug for troubleshooting extraction issues
50
+ agent-teams auth extract --debug
51
+ ```
52
+
53
+ This command:
54
+ 1. Detects your operating system (macOS, Linux, Windows)
55
+ 2. Locates the Teams desktop app data directory
56
+ 3. Reads the **Cookies SQLite database** containing session data
57
+ 4. Extracts `skypetoken_asm` cookie value
58
+ 5. Validates token against Teams API before saving
59
+ 6. Discovers ALL joined teams
60
+ 7. Stores credentials securely in `~/.config/agent-messenger/teams-credentials.json`
61
+
62
+ ### Platform-Specific Paths
63
+
64
+ **macOS:**
65
+ ```
66
+ ~/Library/Application Support/Microsoft/Teams/
67
+ ```
68
+
69
+ **Linux:**
70
+ ```
71
+ ~/.config/Microsoft/Microsoft Teams/
72
+ ```
73
+
74
+ **Windows:**
75
+ ```
76
+ %APPDATA%\Microsoft\Teams\
77
+ ```
78
+
79
+ The tool searches within:
80
+ - `Cookies` - SQLite database containing `skypetoken_asm`
81
+ - `Network/Cookies` - Alternative location on some versions
82
+
83
+ ### What Gets Extracted
84
+
85
+ - **skypetoken_asm**: Authentication token for Teams API
86
+ - **teams**: All teams you're a member of
87
+ - **token_extracted_at**: Timestamp for expiry tracking
88
+
89
+ ## Multi-Team Management
90
+
91
+ ### List Teams
92
+
93
+ See all available teams:
94
+
95
+ ```bash
96
+ agent-teams team list
97
+ ```
98
+
99
+ Output:
100
+ ```json
101
+ [
102
+ {
103
+ "id": "team-uuid-1",
104
+ "name": "Engineering",
105
+ "current": true
106
+ },
107
+ {
108
+ "id": "team-uuid-2",
109
+ "name": "Marketing",
110
+ "current": false
111
+ }
112
+ ]
113
+ ```
114
+
115
+ ### Switch Team
116
+
117
+ Change the active team:
118
+
119
+ ```bash
120
+ agent-teams team switch team-uuid-2
121
+ ```
122
+
123
+ All subsequent commands will use the selected team until you switch again.
124
+
125
+ ### Current Team
126
+
127
+ Check which team is active:
128
+
129
+ ```bash
130
+ agent-teams team current
131
+ ```
132
+
133
+ ## Credential Storage
134
+
135
+ ### Location
136
+
137
+ Credentials are stored in:
138
+ ```
139
+ ~/.config/agent-messenger/teams-credentials.json
140
+ ```
141
+
142
+ ### Format
143
+
144
+ ```json
145
+ {
146
+ "token": "skypetoken_asm_value_here",
147
+ "token_extracted_at": "2024-01-15T10:00:00.000Z",
148
+ "current_team": "team-uuid-1",
149
+ "teams": {
150
+ "team-uuid-1": {
151
+ "team_id": "team-uuid-1",
152
+ "team_name": "Engineering"
153
+ },
154
+ "team-uuid-2": {
155
+ "team_id": "team-uuid-2",
156
+ "team_name": "Marketing"
157
+ }
158
+ }
159
+ }
160
+ ```
161
+
162
+ ### Security
163
+
164
+ - File permissions: `0600` (owner read/write only)
165
+ - Tokens are stored in plaintext (same as Teams desktop app)
166
+ - Keep this file secure - it grants access to your Teams account
167
+ - **Tokens auto-expire in 60-90 minutes** - provides some security
168
+
169
+ ## Authentication Status
170
+
171
+ Check if you're authenticated:
172
+
173
+ ```bash
174
+ agent-teams auth status
175
+ ```
176
+
177
+ Output when authenticated:
178
+ ```json
179
+ {
180
+ "authenticated": true,
181
+ "user": "john.doe@company.com",
182
+ "current_team": "team-uuid-here",
183
+ "teams_count": 3,
184
+ "token_age_minutes": 45,
185
+ "token_expires_soon": false
186
+ }
187
+ ```
188
+
189
+ Output when token expired:
190
+ ```json
191
+ {
192
+ "authenticated": false,
193
+ "error": "Token expired. Run \"auth extract\" to re-authenticate."
194
+ }
195
+ ```
196
+
197
+ Output when not authenticated:
198
+ ```json
199
+ {
200
+ "error": "Not authenticated. Run \"auth extract\" first."
201
+ }
202
+ ```
203
+
204
+ ## Token Lifecycle
205
+
206
+ ### When Tokens Expire
207
+
208
+ Teams tokens are invalidated when:
209
+ - **60-90 minutes have passed** (most common!)
210
+ - You sign out of the desktop app
211
+ - Your password is changed
212
+ - Admin revokes your session
213
+ - You manually log out
214
+
215
+ ### Re-authentication Workflow
216
+
217
+ **Proactive (Recommended):**
218
+ ```bash
219
+ # Check token age before operations
220
+ STATUS=$(agent-teams auth status)
221
+ EXPIRES_SOON=$(echo "$STATUS" | jq -r '.token_expires_soon // true')
222
+
223
+ if [ "$EXPIRES_SOON" = "true" ]; then
224
+ echo "Token expiring soon, refreshing..."
225
+ agent-teams auth extract
226
+ fi
227
+
228
+ # Now proceed with operations
229
+ agent-teams message send "$CHANNEL_ID" "Hello!"
230
+ ```
231
+
232
+ **Reactive (On Error):**
233
+ ```bash
234
+ RESULT=$(agent-teams message send "$CHANNEL_ID" "Hello!")
235
+
236
+ if echo "$RESULT" | jq -e '.error' | grep -q "expired\|401"; then
237
+ echo "Token expired, re-authenticating..."
238
+ agent-teams auth extract
239
+
240
+ # Retry the operation
241
+ agent-teams message send "$CHANNEL_ID" "Hello!"
242
+ fi
243
+ ```
244
+
245
+ ## Troubleshooting
246
+
247
+ ### Using Debug Mode
248
+
249
+ For any extraction issues, run with `--debug` to see detailed information:
250
+
251
+ ```bash
252
+ agent-teams auth extract --debug
253
+ ```
254
+
255
+ This shows:
256
+ - Which Teams directory was found
257
+ - Cookies database location
258
+ - Token extraction progress
259
+ - Token validation results
260
+ - Team discovery details
261
+
262
+ ### "Teams desktop app not found"
263
+
264
+ **Cause**: Teams desktop app not installed or in non-standard location
265
+
266
+ **Solution**:
267
+ 1. Install Microsoft Teams desktop app
268
+ 2. Log in to your account
269
+ 3. Run `agent-teams auth extract` again
270
+
271
+ ### "No Teams token found"
272
+
273
+ **Cause**: Not logged into Teams or cookie storage corrupted
274
+
275
+ **Solution**:
276
+ 1. Open Teams desktop app
277
+ 2. Make sure you're logged in (can see your teams)
278
+ 3. Run `agent-teams auth extract --debug` to see details
279
+
280
+ ### "Permission denied reading Teams data"
281
+
282
+ **Cause**: Insufficient file system permissions
283
+
284
+ **Solution** (macOS):
285
+ 1. Grant Terminal/iTerm full disk access in System Preferences
286
+ 2. Security & Privacy -> Privacy -> Full Disk Access
287
+ 3. Add your terminal application
288
+
289
+ ### "Token validation failed" / "401 Unauthorized"
290
+
291
+ **Cause**: Token expired (most likely) or invalidated
292
+
293
+ **Solution**:
294
+ ```bash
295
+ # Re-extract fresh credentials
296
+ agent-teams auth extract
297
+
298
+ # Test authentication
299
+ agent-teams auth status
300
+ ```
301
+
302
+ ### "Token expired" errors
303
+
304
+ **Cause**: Token is older than 60-90 minutes
305
+
306
+ **Solution**:
307
+ ```bash
308
+ # Simply re-extract - this is normal for Teams!
309
+ agent-teams auth extract
310
+ ```
311
+
312
+ **Prevention**: Build token refresh into your scripts (see common-patterns.md)
313
+
314
+ ## Security Considerations
315
+
316
+ ### What agent-teams Can Access
317
+
318
+ With extracted credentials, agent-teams has the same permissions as you in Teams:
319
+ - Read all channels you have access to
320
+ - Send messages as you
321
+ - Upload/download files
322
+ - Manage reactions
323
+ - Access user information
324
+ - View team member lists
325
+
326
+ ### What agent-teams Cannot Do
327
+
328
+ - Access channels you don't have permission for
329
+ - Perform admin operations (unless you're an admin)
330
+ - Access other users' private chats without existing conversation
331
+ - Manage team settings (not implemented)
332
+
333
+ ### Best Practices
334
+
335
+ 1. **Protect credentials.json**: Never commit to version control
336
+ 2. **Use team switching**: Keep different contexts separate
337
+ 3. **Handle token expiry**: Build refresh logic into all scripts
338
+ 4. **Re-extract frequently**: Tokens expire in 60-90 minutes
339
+ 5. **Revoke if compromised**: Sign out of Teams desktop app to invalidate tokens
340
+
341
+ ## Manual Token Management (Advanced)
342
+
343
+ If automatic extraction fails, you can manually create credentials:
344
+
345
+ ```bash
346
+ # Create config directory
347
+ mkdir -p ~/.config/agent-messenger
348
+
349
+ # Create credentials file
350
+ cat > ~/.config/agent-messenger/teams-credentials.json << 'EOF'
351
+ {
352
+ "token": "YOUR_SKYPETOKEN_ASM_HERE",
353
+ "token_extracted_at": "2024-01-15T10:00:00.000Z",
354
+ "current_team": "team-uuid-here",
355
+ "teams": {
356
+ "team-uuid-here": {
357
+ "team_id": "team-uuid-here",
358
+ "team_name": "My Team"
359
+ }
360
+ }
361
+ }
362
+ EOF
363
+
364
+ # Set secure permissions
365
+ chmod 600 ~/.config/agent-messenger/teams-credentials.json
366
+ ```
367
+
368
+ To find your token manually:
369
+ 1. Open Teams in browser (teams.microsoft.com)
370
+ 2. Open DevTools -> Application tab
371
+ 3. Go to Cookies -> teams.microsoft.com
372
+ 4. Find `skypetoken_asm` cookie
373
+ 5. Copy the value
374
+
375
+ **Warning**: Using user tokens for automation may violate Microsoft's Terms of Service. Use responsibly and at your own risk.