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
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,KAAK,UAAU,UAAU,CAAC,OAA6B;IACrD,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAA;QAC3C,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,CAAA;QACvC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QAEnD,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACrC,EAAE,EAAE,EAAE,CAAC,YAAY;YACnB,IAAI,EAAE,E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,CAAC;KAC5C,UAAU,CACT,IAAI,OAAO,CAAC,MAAM,CAAC;KAChB,WAAW,CAAC,qBAAqB,CAAC;KAClC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,UAAU,CAAC,CACtB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,qBAAqB,CAAC;KAClC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;KAChC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,SAAS,CAAC;KACnB,WAAW,CAAC,wBAAwB,CAAC;KACrC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,aAAa,CAAC,CACzB;KACA,UAAU,CACT,IAAI,OAAO,CAAC,QAAQ,CAAC;KAClB,WAAW,CAAC,kBAAkB,CAAC;KAC/B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;KAChC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAC9C,MAAM,CAAC,YAAY,CAAC,CACxB,CAAA"}
@@ -1,13 +0,0 @@
1
- import type { Config, WorkspaceCredentials } from '../types';
2
- export declare class CredentialManager {
3
- private configDir;
4
- private credentialsPath;
5
- constructor(configDir?: string);
6
- load(): Promise<Config>;
7
- save(config: Config): Promise<void>;
8
- getWorkspace(id?: string): Promise<WorkspaceCredentials | null>;
9
- setWorkspace(creds: WorkspaceCredentials): Promise<void>;
10
- removeWorkspace(id: string): Promise<void>;
11
- setCurrentWorkspace(id: string): Promise<void>;
12
- }
13
- //# sourceMappingURL=credential-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential-manager.d.ts","sourceRoot":"","sources":["../../src/lib/credential-manager.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE5D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,eAAe,CAAQ;gBAEnB,SAAS,CAAC,EAAE,MAAM;IAKxB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IAavB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASnC,YAAY,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAc/D,YAAY,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1C,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKrD"}
@@ -1,58 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { mkdir } from 'node:fs/promises';
3
- import { homedir } from 'node:os';
4
- import { join } from 'node:path';
5
- export class CredentialManager {
6
- configDir;
7
- credentialsPath;
8
- constructor(configDir) {
9
- this.configDir = configDir ?? join(homedir(), '.config', 'agent-slack');
10
- this.credentialsPath = join(this.configDir, 'credentials.json');
11
- }
12
- async load() {
13
- if (!existsSync(this.credentialsPath)) {
14
- return {
15
- current_workspace: null,
16
- workspaces: {},
17
- };
18
- }
19
- const file = Bun.file(this.credentialsPath);
20
- const content = await file.text();
21
- return JSON.parse(content);
22
- }
23
- async save(config) {
24
- await mkdir(this.configDir, { recursive: true });
25
- const file = Bun.file(this.credentialsPath);
26
- await Bun.write(file, JSON.stringify(config, null, 2));
27
- await Bun.spawn(['chmod', '0600', this.credentialsPath]).exited;
28
- }
29
- async getWorkspace(id) {
30
- const config = await this.load();
31
- if (id) {
32
- return config.workspaces[id] ?? null;
33
- }
34
- if (!config.current_workspace) {
35
- return null;
36
- }
37
- return config.workspaces[config.current_workspace] ?? null;
38
- }
39
- async setWorkspace(creds) {
40
- const config = await this.load();
41
- config.workspaces[creds.workspace_id] = creds;
42
- await this.save(config);
43
- }
44
- async removeWorkspace(id) {
45
- const config = await this.load();
46
- delete config.workspaces[id];
47
- if (config.current_workspace === id) {
48
- config.current_workspace = null;
49
- }
50
- await this.save(config);
51
- }
52
- async setCurrentWorkspace(id) {
53
- const config = await this.load();
54
- config.current_workspace = id;
55
- await this.save(config);
56
- }
57
- }
58
- //# sourceMappingURL=credential-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"credential-manager.js","sourceRoot":"","sources":["../../src/lib/credential-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,MAAM,OAAO,iBAAiB;IACpB,SAAS,CAAQ;IACjB,eAAe,CAAQ;IAE/B,YAAY,SAAkB;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,CAAA;QACvE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAA;IACjE,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YACtC,OAAO;gBACL,iBAAiB,EAAE,IAAI;gBACvB,UAAU,EAAE,EAAE;aACf,CAAA;QACH,CAAC;QAED,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;QAC3C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAW,CA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,CAAA;QAE5B,IAAI,MAAM,CAAC,iBAAiB,KAAK,EAAE,EAAE,CAAC;YACpC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAA;QACjC,CAAC;QAED,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,EAAU;QAClC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAA;QAChC,MAAM,CAAC,iBAAiB,GAAG,EAAE,CAAA;QAC7B,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzB,CAAC;CACF"}
@@ -1,3 +0,0 @@
1
- export { CredentialManager } from './credential-manager';
2
- export { SlackClient, SlackError } from './slack-client';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/lib/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { CredentialManager } from './credential-manager';
2
- export { SlackClient, SlackError } from './slack-client';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,26 +0,0 @@
1
- import type { ChannelRef, FileRef, MessageRef, SlackChannel, SlackFile, SlackMessage, SlackUser, UserRef } from '../types';
2
- export declare class RefManager {
3
- private channelRefs;
4
- private messageRefs;
5
- private userRefs;
6
- private fileRefs;
7
- private channelCounter;
8
- private messageCounter;
9
- private userCounter;
10
- private fileCounter;
11
- assignChannelRef(channel: SlackChannel): ChannelRef;
12
- assignMessageRef(message: SlackMessage): MessageRef;
13
- assignUserRef(user: SlackUser): UserRef;
14
- assignFileRef(file: SlackFile): FileRef;
15
- resolveRef(ref: string): {
16
- type: 'channel' | 'message' | 'user' | 'file';
17
- id: string;
18
- } | null;
19
- getChannelByRef(ref: ChannelRef): SlackChannel | null;
20
- getMessageByRef(ref: MessageRef): SlackMessage | null;
21
- getUserByRef(ref: UserRef): SlackUser | null;
22
- getFileByRef(ref: FileRef): SlackFile | null;
23
- clear(): void;
24
- serialize(): string;
25
- }
26
- //# sourceMappingURL=ref-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ref-manager.d.ts","sourceRoot":"","sources":["../../src/lib/ref-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,SAAS,EACT,OAAO,EACR,MAAM,UAAU,CAAA;AAEjB,qBAAa,UAAU;IACrB,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,WAAW,CAAkC;IACrD,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,QAAQ,CAA+B;IAE/C,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,WAAW,CAAI;IAEvB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU;IAOnD,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,UAAU;IAOnD,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAOvC,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAOvC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAoB7F,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI;IAIrD,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI;IAIrD,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAI5C,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI;IAI5C,KAAK,IAAI,IAAI;IAWb,SAAS,IAAI,MAAM;CAkBpB"}
@@ -1,92 +0,0 @@
1
- export class RefManager {
2
- channelRefs = new Map();
3
- messageRefs = new Map();
4
- userRefs = new Map();
5
- fileRefs = new Map();
6
- channelCounter = 1;
7
- messageCounter = 1;
8
- userCounter = 1;
9
- fileCounter = 1;
10
- assignChannelRef(channel) {
11
- const ref = `@c${this.channelCounter}`;
12
- this.channelRefs.set(ref, channel);
13
- this.channelCounter++;
14
- return ref;
15
- }
16
- assignMessageRef(message) {
17
- const ref = `@m${this.messageCounter}`;
18
- this.messageRefs.set(ref, message);
19
- this.messageCounter++;
20
- return ref;
21
- }
22
- assignUserRef(user) {
23
- const ref = `@u${this.userCounter}`;
24
- this.userRefs.set(ref, user);
25
- this.userCounter++;
26
- return ref;
27
- }
28
- assignFileRef(file) {
29
- const ref = `@f${this.fileCounter}`;
30
- this.fileRefs.set(ref, file);
31
- this.fileCounter++;
32
- return ref;
33
- }
34
- resolveRef(ref) {
35
- if (ref.startsWith('@c')) {
36
- const channel = this.channelRefs.get(ref);
37
- return channel ? { type: 'channel', id: channel.id } : null;
38
- }
39
- if (ref.startsWith('@m')) {
40
- const message = this.messageRefs.get(ref);
41
- return message ? { type: 'message', id: message.ts } : null;
42
- }
43
- if (ref.startsWith('@u')) {
44
- const user = this.userRefs.get(ref);
45
- return user ? { type: 'user', id: user.id } : null;
46
- }
47
- if (ref.startsWith('@f')) {
48
- const file = this.fileRefs.get(ref);
49
- return file ? { type: 'file', id: file.id } : null;
50
- }
51
- return null;
52
- }
53
- getChannelByRef(ref) {
54
- return this.channelRefs.get(ref) || null;
55
- }
56
- getMessageByRef(ref) {
57
- return this.messageRefs.get(ref) || null;
58
- }
59
- getUserByRef(ref) {
60
- return this.userRefs.get(ref) || null;
61
- }
62
- getFileByRef(ref) {
63
- return this.fileRefs.get(ref) || null;
64
- }
65
- clear() {
66
- this.channelRefs.clear();
67
- this.messageRefs.clear();
68
- this.userRefs.clear();
69
- this.fileRefs.clear();
70
- this.channelCounter = 1;
71
- this.messageCounter = 1;
72
- this.userCounter = 1;
73
- this.fileCounter = 1;
74
- }
75
- serialize() {
76
- const refs = {};
77
- for (const [ref, channel] of this.channelRefs) {
78
- refs[ref] = channel.id;
79
- }
80
- for (const [ref, message] of this.messageRefs) {
81
- refs[ref] = message.ts;
82
- }
83
- for (const [ref, user] of this.userRefs) {
84
- refs[ref] = user.id;
85
- }
86
- for (const [ref, file] of this.fileRefs) {
87
- refs[ref] = file.id;
88
- }
89
- return JSON.stringify(refs);
90
- }
91
- }
92
- //# sourceMappingURL=ref-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ref-manager.js","sourceRoot":"","sources":["../../src/lib/ref-manager.ts"],"names":[],"mappings":"AAWA,MAAM,OAAO,UAAU;IACb,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC7C,WAAW,GAAG,IAAI,GAAG,EAAwB,CAAA;IAC7C,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAA;IACvC,QAAQ,GAAG,IAAI,GAAG,EAAqB,CAAA;IAEvC,cAAc,GAAG,CAAC,CAAA;IAClB,cAAc,GAAG,CAAC,CAAA;IAClB,WAAW,GAAG,CAAC,CAAA;IACf,WAAW,GAAG,CAAC,CAAA;IAEvB,gBAAgB,CAAC,OAAqB;QACpC,MAAM,GAAG,GAAG,KAAK,IAAI,CAAC,cAAc,EAAgB,CAAA;QACpD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC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AAC,KAAK,EAAE,CAAA;QACxB,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAA;QACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;QACrB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;QACrB,IAAI,CAAC,cAAc,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,cAAc,GAAG,CAAC,CAAA;QACvB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAA;QACpB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAA;IACtB,CAAC;IAED,SAAS;QACP,MAAM,IAAI,GAA2B,EAAE,CAAA;QAEvC,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,EAAE,CAAA;QACxB,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,EAAE,CAAA;QACxB,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;QACrB,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAA;QACrB,CAAC;QAED,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAC7B,CAAC;CACF"}
@@ -1,37 +0,0 @@
1
- import type { SlackChannel, SlackFile, SlackMessage, SlackSearchResult, SlackUser } from '../types';
2
- export declare class SlackError extends Error {
3
- code: string;
4
- constructor(message: string, code: string);
5
- }
6
- export declare class SlackClient {
7
- private client;
8
- constructor(token: string, cookie: string);
9
- private withRetry;
10
- private sleep;
11
- private checkResponse;
12
- testAuth(): Promise<{
13
- user_id: string;
14
- team_id: string;
15
- user?: string;
16
- team?: string;
17
- }>;
18
- listChannels(): Promise<SlackChannel[]>;
19
- getChannel(id: string): Promise<SlackChannel>;
20
- sendMessage(channel: string, text: string, threadTs?: string): Promise<SlackMessage>;
21
- getMessages(channel: string, limit?: number): Promise<SlackMessage[]>;
22
- getMessage(channel: string, ts: string): Promise<SlackMessage | null>;
23
- updateMessage(channel: string, ts: string, text: string): Promise<SlackMessage>;
24
- deleteMessage(channel: string, ts: string): Promise<void>;
25
- addReaction(channel: string, ts: string, emoji: string): Promise<void>;
26
- removeReaction(channel: string, ts: string, emoji: string): Promise<void>;
27
- listUsers(): Promise<SlackUser[]>;
28
- getUser(id: string): Promise<SlackUser>;
29
- uploadFile(channels: string[], file: Buffer, filename: string): Promise<SlackFile>;
30
- listFiles(channel?: string): Promise<SlackFile[]>;
31
- searchMessages(query: string, options?: {
32
- sort?: 'score' | 'timestamp';
33
- sortDir?: 'asc' | 'desc';
34
- count?: number;
35
- }): Promise<SlackSearchResult[]>;
36
- }
37
- //# sourceMappingURL=slack-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"slack-client.d.ts","sourceRoot":"","sources":["../../src/lib/slack-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEnG,qBAAa,UAAW,SAAQ,KAAK;IACnC,IAAI,EAAE,MAAM,CAAA;gBAEA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAK1C;AAKD,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAW;gBAEb,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;YAa3B,SAAS;IAqBvB,OAAO,CAAC,KAAK;I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M,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAwBlF,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAqBjD,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GACvF,OAAO,CAAC,iBAAiB,EAAE,CAAC;CAwBhC"}
@@ -1,379 +0,0 @@
1
- import { WebClient } from '@slack/web-api';
2
- export class SlackError extends Error {
3
- code;
4
- constructor(message, code) {
5
- super(message);
6
- this.name = 'SlackError';
7
- this.code = code;
8
- }
9
- }
10
- const MAX_RETRIES = 3;
11
- const RATE_LIMIT_ERROR_CODE = 'slack_webapi_rate_limited_error';
12
- export class SlackClient {
13
- client;
14
- constructor(token, cookie) {
15
- if (!token) {
16
- throw new SlackError('Token is required', 'missing_token');
17
- }
18
- if (!cookie) {
19
- throw new SlackError('Cookie is required', 'missing_cookie');
20
- }
21
- this.client = new WebClient(token, {
22
- headers: { Cookie: `d=${cookie}` },
23
- });
24
- }
25
- async withRetry(operation) {
26
- let lastError;
27
- for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
28
- try {
29
- return await operation();
30
- }
31
- catch (error) {
32
- lastError = error;
33
- if (error.code === RATE_LIMIT_ERROR_CODE && attempt < MAX_RETRIES) {
34
- const retryAfter = error.retryAfter || 1;
35
- await this.sleep(retryAfter * 1000 * (attempt + 1));
36
- continue;
37
- }
38
- break;
39
- }
40
- }
41
- throw new SlackError(lastError?.message || 'Unknown error', lastError?.code || 'unknown_error');
42
- }
43
- sleep(ms) {
44
- return new Promise((resolve) => setTimeout(resolve, ms));
45
- }
46
- checkResponse(response) {
47
- if (!response.ok) {
48
- throw new SlackError(response.error || 'API call failed', response.error || 'api_error');
49
- }
50
- }
51
- async testAuth() {
52
- return this.withRetry(async () => {
53
- const response = await this.client.auth.test();
54
- this.checkResponse(response);
55
- return {
56
- user_id: response.user_id,
57
- team_id: response.team_id,
58
- user: response.user,
59
- team: response.team,
60
- };
61
- });
62
- }
63
- async listChannels() {
64
- return this.withRetry(async () => {
65
- const channels = [];
66
- let cursor;
67
- do {
68
- const response = await this.client.conversations.list({
69
- cursor,
70
- limit: 200,
71
- types: 'public_channel,private_channel',
72
- });
73
- this.checkResponse(response);
74
- if (response.channels) {
75
- for (const ch of response.channels) {
76
- channels.push({
77
- id: ch.id,
78
- name: ch.name,
79
- is_private: ch.is_private || false,
80
- is_archived: ch.is_archived || false,
81
- created: ch.created || 0,
82
- creator: ch.creator || '',
83
- topic: ch.topic
84
- ? {
85
- value: ch.topic.value || '',
86
- creator: ch.topic.creator || '',
87
- last_set: ch.topic.last_set || 0,
88
- }
89
- : undefined,
90
- purpose: ch.purpose
91
- ? {
92
- value: ch.purpose.value || '',
93
- creator: ch.purpose.creator || '',
94
- last_set: ch.purpose.last_set || 0,
95
- }
96
- : undefined,
97
- });
98
- }
99
- }
100
- cursor = response.response_metadata?.next_cursor;
101
- } while (cursor);
102
- return channels;
103
- });
104
- }
105
- async getChannel(id) {
106
- return this.withRetry(async () => {
107
- const response = await this.client.conversations.info({ channel: id });
108
- this.checkResponse(response);
109
- const ch = response.channel;
110
- return {
111
- id: ch.id,
112
- name: ch.name,
113
- is_private: ch.is_private || false,
114
- is_archived: ch.is_archived || false,
115
- created: ch.created || 0,
116
- creator: ch.creator || '',
117
- topic: ch.topic
118
- ? {
119
- value: ch.topic.value || '',
120
- creator: ch.topic.creator || '',
121
- last_set: ch.topic.last_set || 0,
122
- }
123
- : undefined,
124
- purpose: ch.purpose
125
- ? {
126
- value: ch.purpose.value || '',
127
- creator: ch.purpose.creator || '',
128
- last_set: ch.purpose.last_set || 0,
129
- }
130
- : undefined,
131
- };
132
- });
133
- }
134
- async sendMessage(channel, text, threadTs) {
135
- return this.withRetry(async () => {
136
- const response = await this.client.chat.postMessage({
137
- channel,
138
- text,
139
- thread_ts: threadTs,
140
- });
141
- this.checkResponse(response);
142
- const msg = response.message;
143
- return {
144
- ts: response.ts,
145
- text: msg.text || text,
146
- type: msg.type || 'message',
147
- user: msg.user,
148
- thread_ts: msg.thread_ts,
149
- };
150
- });
151
- }
152
- async getMessages(channel, limit = 20) {
153
- return this.withRetry(async () => {
154
- const response = await this.client.conversations.history({
155
- channel,
156
- limit,
157
- });
158
- this.checkResponse(response);
159
- return (response.messages || []).map((msg) => ({
160
- ts: msg.ts,
161
- text: msg.text || '',
162
- type: msg.type || 'message',
163
- user: msg.user,
164
- username: msg.username,
165
- thread_ts: msg.thread_ts,
166
- reply_count: msg.reply_count,
167
- replies: msg.replies,
168
- edited: msg.edited
169
- ? {
170
- user: msg.edited.user || '',
171
- ts: msg.edited.ts || '',
172
- }
173
- : undefined,
174
- }));
175
- });
176
- }
177
- async getMessage(channel, ts) {
178
- return this.withRetry(async () => {
179
- const response = await this.client.conversations.history({
180
- channel,
181
- oldest: ts,
182
- inclusive: true,
183
- limit: 1,
184
- });
185
- this.checkResponse(response);
186
- const msg = response.messages?.[0];
187
- if (!msg || msg.ts !== ts) {
188
- return null;
189
- }
190
- return {
191
- ts: msg.ts,
192
- text: msg.text || '',
193
- type: msg.type || 'message',
194
- user: msg.user,
195
- username: msg.username,
196
- thread_ts: msg.thread_ts,
197
- reply_count: msg.reply_count,
198
- replies: msg.replies,
199
- edited: msg.edited
200
- ? {
201
- user: msg.edited.user || '',
202
- ts: msg.edited.ts || '',
203
- }
204
- : undefined,
205
- };
206
- });
207
- }
208
- async updateMessage(channel, ts, text) {
209
- return this.withRetry(async () => {
210
- const response = await this.client.chat.update({
211
- channel,
212
- ts,
213
- text,
214
- });
215
- this.checkResponse(response);
216
- const msg = response.message;
217
- return {
218
- ts: response.ts,
219
- text: msg.text || text,
220
- type: 'message',
221
- user: msg.user,
222
- };
223
- });
224
- }
225
- async deleteMessage(channel, ts) {
226
- return this.withRetry(async () => {
227
- const response = await this.client.chat.delete({
228
- channel,
229
- ts,
230
- });
231
- this.checkResponse(response);
232
- });
233
- }
234
- async addReaction(channel, ts, emoji) {
235
- return this.withRetry(async () => {
236
- const response = await this.client.reactions.add({
237
- channel,
238
- timestamp: ts,
239
- name: emoji,
240
- });
241
- this.checkResponse(response);
242
- });
243
- }
244
- async removeReaction(channel, ts, emoji) {
245
- return this.withRetry(async () => {
246
- const response = await this.client.reactions.remove({
247
- channel,
248
- timestamp: ts,
249
- name: emoji,
250
- });
251
- this.checkResponse(response);
252
- });
253
- }
254
- async listUsers() {
255
- return this.withRetry(async () => {
256
- const users = [];
257
- let cursor;
258
- do {
259
- const response = await this.client.users.list({
260
- cursor,
261
- limit: 200,
262
- });
263
- this.checkResponse(response);
264
- if (response.members) {
265
- for (const member of response.members) {
266
- users.push({
267
- id: member.id,
268
- name: member.name,
269
- real_name: member.real_name || member.name || '',
270
- is_admin: member.is_admin || false,
271
- is_owner: member.is_owner || false,
272
- is_bot: member.is_bot || false,
273
- is_app_user: member.is_app_user || false,
274
- profile: member.profile
275
- ? {
276
- email: member.profile.email,
277
- phone: member.profile.phone,
278
- title: member.profile.title,
279
- status_text: member.profile.status_text,
280
- }
281
- : undefined,
282
- });
283
- }
284
- }
285
- cursor = response.response_metadata?.next_cursor;
286
- } while (cursor);
287
- return users;
288
- });
289
- }
290
- async getUser(id) {
291
- return this.withRetry(async () => {
292
- const response = await this.client.users.info({ user: id });
293
- this.checkResponse(response);
294
- const member = response.user;
295
- return {
296
- id: member.id,
297
- name: member.name,
298
- real_name: member.real_name || member.name || '',
299
- is_admin: member.is_admin || false,
300
- is_owner: member.is_owner || false,
301
- is_bot: member.is_bot || false,
302
- is_app_user: member.is_app_user || false,
303
- profile: member.profile
304
- ? {
305
- email: member.profile.email,
306
- phone: member.profile.phone,
307
- title: member.profile.title,
308
- status_text: member.profile.status_text,
309
- }
310
- : undefined,
311
- };
312
- });
313
- }
314
- async uploadFile(channels, file, filename) {
315
- return this.withRetry(async () => {
316
- const response = await this.client.files.uploadV2({
317
- channel_id: channels[0],
318
- file,
319
- filename,
320
- });
321
- this.checkResponse(response);
322
- const f = response.file;
323
- return {
324
- id: f.id,
325
- name: f.name,
326
- title: f.title || f.name || '',
327
- mimetype: f.mimetype || 'application/octet-stream',
328
- size: f.size || 0,
329
- url_private: f.url_private || '',
330
- created: f.created || 0,
331
- user: f.user || '',
332
- channels: f.channels,
333
- };
334
- });
335
- }
336
- async listFiles(channel) {
337
- return this.withRetry(async () => {
338
- const response = await this.client.files.list({
339
- channel,
340
- });
341
- this.checkResponse(response);
342
- return (response.files || []).map((f) => ({
343
- id: f.id,
344
- name: f.name,
345
- title: f.title || f.name || '',
346
- mimetype: f.mimetype || 'application/octet-stream',
347
- size: f.size || 0,
348
- url_private: f.url_private || '',
349
- created: f.created || 0,
350
- user: f.user || '',
351
- channels: f.channels,
352
- }));
353
- });
354
- }
355
- async searchMessages(query, options = {}) {
356
- return this.withRetry(async () => {
357
- const response = await this.client.search.messages({
358
- query,
359
- sort: options.sort || 'timestamp',
360
- sort_dir: options.sortDir || 'desc',
361
- count: options.count || 20,
362
- });
363
- this.checkResponse(response);
364
- const matches = response.messages?.matches || [];
365
- return matches.map((match) => ({
366
- ts: match.ts,
367
- text: match.text || '',
368
- user: match.user,
369
- username: match.username,
370
- channel: {
371
- id: match.channel?.id || '',
372
- name: match.channel?.name || '',
373
- },
374
- permalink: match.permalink || '',
375
- }));
376
- });
377
- }
378
- }
379
- //# sourceMappingURL=slack-client.js.map