@5ss/ai-tools 2.11.1

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 (342) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/LICENSE +21 -0
  3. package/README.md +221 -0
  4. package/dist/ai-sdk/index.d.ts +15 -0
  5. package/dist/ai-sdk/index.d.ts.map +1 -0
  6. package/dist/ai-sdk/index.js +24 -0
  7. package/dist/ai-sdk/index.js.map +1 -0
  8. package/dist/artifact-D064mHfK.js +44 -0
  9. package/dist/artifact-D064mHfK.js.map +1 -0
  10. package/dist/artifacts-O8g-40Pw.js +404 -0
  11. package/dist/artifacts-O8g-40Pw.js.map +1 -0
  12. package/dist/aws-json-CecFqzqX.js +23 -0
  13. package/dist/aws-json-CecFqzqX.js.map +1 -0
  14. package/dist/aws-service-msttbPrz.js +58 -0
  15. package/dist/aws-service-msttbPrz.js.map +1 -0
  16. package/dist/batch-BMM5dXqL.d.ts +22 -0
  17. package/dist/batch-BMM5dXqL.d.ts.map +1 -0
  18. package/dist/batch-Co1ujeAW.js +67 -0
  19. package/dist/batch-Co1ujeAW.js.map +1 -0
  20. package/dist/bedrock-agentcore-browser-a_qOs-NR.js +182 -0
  21. package/dist/bedrock-agentcore-browser-a_qOs-NR.js.map +1 -0
  22. package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js +357 -0
  23. package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js.map +1 -0
  24. package/dist/bytes-BxpimpQx.js +45 -0
  25. package/dist/bytes-BxpimpQx.js.map +1 -0
  26. package/dist/client-CCKGsTeI.js +743 -0
  27. package/dist/client-CCKGsTeI.js.map +1 -0
  28. package/dist/cloudflare/index.d.ts +37 -0
  29. package/dist/cloudflare/index.d.ts.map +1 -0
  30. package/dist/cloudflare/index.js +41 -0
  31. package/dist/cloudflare/index.js.map +1 -0
  32. package/dist/cloudflare-browser-B6Yolpin.js +428 -0
  33. package/dist/cloudflare-browser-B6Yolpin.js.map +1 -0
  34. package/dist/cloudflare-email-Dy0KHeDf.js +197 -0
  35. package/dist/cloudflare-email-Dy0KHeDf.js.map +1 -0
  36. package/dist/cloudflare-sandbox-Dp_uNaqW.js +982 -0
  37. package/dist/cloudflare-sandbox-Dp_uNaqW.js.map +1 -0
  38. package/dist/content-type-CORxaxcv.js +49 -0
  39. package/dist/content-type-CORxaxcv.js.map +1 -0
  40. package/dist/core/index.d.ts +4 -0
  41. package/dist/core/index.js +204 -0
  42. package/dist/core/index.js.map +1 -0
  43. package/dist/define-CvpJ_pNP.js +115 -0
  44. package/dist/define-CvpJ_pNP.js.map +1 -0
  45. package/dist/errors-DoSpNHvs.js +20 -0
  46. package/dist/errors-DoSpNHvs.js.map +1 -0
  47. package/dist/errors-aKhko9T1.d.ts +18 -0
  48. package/dist/errors-aKhko9T1.d.ts.map +1 -0
  49. package/dist/eventbridge-scheduler-Bh6GqZY2.js +349 -0
  50. package/dist/eventbridge-scheduler-Bh6GqZY2.js.map +1 -0
  51. package/dist/framework-context-DVIIY8ZO.js +24 -0
  52. package/dist/framework-context-DVIIY8ZO.js.map +1 -0
  53. package/dist/gotenberg-NuJjxyln.js +291 -0
  54. package/dist/gotenberg-NuJjxyln.js.map +1 -0
  55. package/dist/http/index.d.ts +47 -0
  56. package/dist/http/index.d.ts.map +1 -0
  57. package/dist/http/index.js +3 -0
  58. package/dist/http-service-DDNCO1s4.js +254 -0
  59. package/dist/http-service-DDNCO1s4.js.map +1 -0
  60. package/dist/http-service-T7E5UjP8.d.ts +80 -0
  61. package/dist/http-service-T7E5UjP8.d.ts.map +1 -0
  62. package/dist/imessage-BSAFOI8Z.js +154 -0
  63. package/dist/imessage-BSAFOI8Z.js.map +1 -0
  64. package/dist/index-BU4gmYO8.d.ts +254 -0
  65. package/dist/index-BU4gmYO8.d.ts.map +1 -0
  66. package/dist/index-CCivzmxO.d.ts +188 -0
  67. package/dist/index-CCivzmxO.d.ts.map +1 -0
  68. package/dist/index-CLmTrcu5.d.ts +22 -0
  69. package/dist/index-CLmTrcu5.d.ts.map +1 -0
  70. package/dist/index-CZX5OeOF.d.ts +235 -0
  71. package/dist/index-CZX5OeOF.d.ts.map +1 -0
  72. package/dist/index-CdFmEfZO.d.ts +359 -0
  73. package/dist/index-CdFmEfZO.d.ts.map +1 -0
  74. package/dist/index-Cuh6eMWc.d.ts +285 -0
  75. package/dist/index-Cuh6eMWc.d.ts.map +1 -0
  76. package/dist/index-DuOGj7vc.d.ts +107 -0
  77. package/dist/index-DuOGj7vc.d.ts.map +1 -0
  78. package/dist/index-ccZ1XOHw.d.ts +69 -0
  79. package/dist/index-ccZ1XOHw.d.ts.map +1 -0
  80. package/dist/index-n8JTpNf1.d.ts +247 -0
  81. package/dist/index-n8JTpNf1.d.ts.map +1 -0
  82. package/dist/index-pwW1OsOx.d.ts +134 -0
  83. package/dist/index-pwW1OsOx.d.ts.map +1 -0
  84. package/dist/index-zK1ZwS4m.d.ts +347 -0
  85. package/dist/index-zK1ZwS4m.d.ts.map +1 -0
  86. package/dist/limits-hjrO8zUG.js +80 -0
  87. package/dist/limits-hjrO8zUG.js.map +1 -0
  88. package/dist/mastra/index.d.ts +14 -0
  89. package/dist/mastra/index.d.ts.map +1 -0
  90. package/dist/mastra/index.js +26 -0
  91. package/dist/mastra/index.js.map +1 -0
  92. package/dist/mastra-vector-Dhc6XZ8l.js +234 -0
  93. package/dist/mastra-vector-Dhc6XZ8l.js.map +1 -0
  94. package/dist/mcp/index.d.ts +80 -0
  95. package/dist/mcp/index.d.ts.map +1 -0
  96. package/dist/mcp/index.js +97 -0
  97. package/dist/mcp/index.js.map +1 -0
  98. package/dist/modules/artifacts/index.d.ts +337 -0
  99. package/dist/modules/artifacts/index.d.ts.map +1 -0
  100. package/dist/modules/artifacts/index.js +348 -0
  101. package/dist/modules/artifacts/index.js.map +1 -0
  102. package/dist/modules/browser/index.d.ts +516 -0
  103. package/dist/modules/browser/index.d.ts.map +1 -0
  104. package/dist/modules/browser/index.js +475 -0
  105. package/dist/modules/browser/index.js.map +1 -0
  106. package/dist/modules/calendar/index.d.ts +93 -0
  107. package/dist/modules/calendar/index.d.ts.map +1 -0
  108. package/dist/modules/calendar/index.js +131 -0
  109. package/dist/modules/calendar/index.js.map +1 -0
  110. package/dist/modules/code-sandbox/index.d.ts +317 -0
  111. package/dist/modules/code-sandbox/index.d.ts.map +1 -0
  112. package/dist/modules/code-sandbox/index.js +537 -0
  113. package/dist/modules/code-sandbox/index.js.map +1 -0
  114. package/dist/modules/content-type/index.d.ts +22 -0
  115. package/dist/modules/content-type/index.d.ts.map +1 -0
  116. package/dist/modules/content-type/index.js +66 -0
  117. package/dist/modules/content-type/index.js.map +1 -0
  118. package/dist/modules/crypto/index.d.ts +115 -0
  119. package/dist/modules/crypto/index.d.ts.map +1 -0
  120. package/dist/modules/crypto/index.js +139 -0
  121. package/dist/modules/crypto/index.js.map +1 -0
  122. package/dist/modules/document/index.d.ts +575 -0
  123. package/dist/modules/document/index.d.ts.map +1 -0
  124. package/dist/modules/document/index.js +444 -0
  125. package/dist/modules/document/index.js.map +1 -0
  126. package/dist/modules/document-extract/index.d.ts +438 -0
  127. package/dist/modules/document-extract/index.d.ts.map +1 -0
  128. package/dist/modules/document-extract/index.js +127 -0
  129. package/dist/modules/document-extract/index.js.map +1 -0
  130. package/dist/modules/document-render/index.d.ts +336 -0
  131. package/dist/modules/document-render/index.d.ts.map +1 -0
  132. package/dist/modules/document-render/index.js +155 -0
  133. package/dist/modules/document-render/index.js.map +1 -0
  134. package/dist/modules/email/index.d.ts +311 -0
  135. package/dist/modules/email/index.d.ts.map +1 -0
  136. package/dist/modules/email/index.js +167 -0
  137. package/dist/modules/email/index.js.map +1 -0
  138. package/dist/modules/email-message/index.d.ts +95 -0
  139. package/dist/modules/email-message/index.d.ts.map +1 -0
  140. package/dist/modules/email-message/index.js +264 -0
  141. package/dist/modules/email-message/index.js.map +1 -0
  142. package/dist/modules/file-convert/index.d.ts +273 -0
  143. package/dist/modules/file-convert/index.d.ts.map +1 -0
  144. package/dist/modules/file-convert/index.js +103 -0
  145. package/dist/modules/file-convert/index.js.map +1 -0
  146. package/dist/modules/files/index.d.ts +452 -0
  147. package/dist/modules/files/index.d.ts.map +1 -0
  148. package/dist/modules/files/index.js +733 -0
  149. package/dist/modules/files/index.js.map +1 -0
  150. package/dist/modules/image/index.d.ts +342 -0
  151. package/dist/modules/image/index.d.ts.map +1 -0
  152. package/dist/modules/image/index.js +281 -0
  153. package/dist/modules/image/index.js.map +1 -0
  154. package/dist/modules/messaging/index.d.ts +608 -0
  155. package/dist/modules/messaging/index.d.ts.map +1 -0
  156. package/dist/modules/messaging/index.js +1067 -0
  157. package/dist/modules/messaging/index.js.map +1 -0
  158. package/dist/modules/pdf/index.d.ts +287 -0
  159. package/dist/modules/pdf/index.d.ts.map +1 -0
  160. package/dist/modules/pdf/index.js +259 -0
  161. package/dist/modules/pdf/index.js.map +1 -0
  162. package/dist/modules/presentation/index.d.ts +247 -0
  163. package/dist/modules/presentation/index.d.ts.map +1 -0
  164. package/dist/modules/presentation/index.js +12657 -0
  165. package/dist/modules/presentation/index.js.map +1 -0
  166. package/dist/modules/queue/index.d.ts +129 -0
  167. package/dist/modules/queue/index.d.ts.map +1 -0
  168. package/dist/modules/queue/index.js +131 -0
  169. package/dist/modules/queue/index.js.map +1 -0
  170. package/dist/modules/rag/index.d.ts +250 -0
  171. package/dist/modules/rag/index.d.ts.map +1 -0
  172. package/dist/modules/rag/index.js +366 -0
  173. package/dist/modules/rag/index.js.map +1 -0
  174. package/dist/modules/scheduler/index.d.ts +216 -0
  175. package/dist/modules/scheduler/index.d.ts.map +1 -0
  176. package/dist/modules/scheduler/index.js +153 -0
  177. package/dist/modules/scheduler/index.js.map +1 -0
  178. package/dist/modules/skills/index.d.ts +205 -0
  179. package/dist/modules/skills/index.d.ts.map +1 -0
  180. package/dist/modules/skills/index.js +203 -0
  181. package/dist/modules/skills/index.js.map +1 -0
  182. package/dist/modules/tasks/index.d.ts +287 -0
  183. package/dist/modules/tasks/index.d.ts.map +1 -0
  184. package/dist/modules/tasks/index.js +207 -0
  185. package/dist/modules/tasks/index.js.map +1 -0
  186. package/dist/modules/vector-store/index.d.ts +3 -0
  187. package/dist/modules/vector-store/index.js +3 -0
  188. package/dist/modules/web-fetch/index.d.ts +99 -0
  189. package/dist/modules/web-fetch/index.d.ts.map +1 -0
  190. package/dist/modules/web-fetch/index.js +242 -0
  191. package/dist/modules/web-fetch/index.js.map +1 -0
  192. package/dist/object-artifact-store-CMTzCm_G.d.ts +7 -0
  193. package/dist/object-artifact-store-CMTzCm_G.d.ts.map +1 -0
  194. package/dist/object-artifact-store-wZ2j9cto.js +28 -0
  195. package/dist/object-artifact-store-wZ2j9cto.js.map +1 -0
  196. package/dist/pinecone-umY4t6OF.js +190 -0
  197. package/dist/pinecone-umY4t6OF.js.map +1 -0
  198. package/dist/provider-CgDAlg6K.js +34 -0
  199. package/dist/provider-CgDAlg6K.js.map +1 -0
  200. package/dist/qdrant-DMp4NhKR.js +253 -0
  201. package/dist/qdrant-DMp4NhKR.js.map +1 -0
  202. package/dist/resend-BAC38_dA.js +155 -0
  203. package/dist/resend-BAC38_dA.js.map +1 -0
  204. package/dist/s3-CsOaPWMP.js +955 -0
  205. package/dist/s3-CsOaPWMP.js.map +1 -0
  206. package/dist/schemas-ChOAhdo9.js +192 -0
  207. package/dist/schemas-ChOAhdo9.js.map +1 -0
  208. package/dist/slack-Di5BBNpt.js +1455 -0
  209. package/dist/slack-Di5BBNpt.js.map +1 -0
  210. package/dist/sqs-DCwS1i2N.js +225 -0
  211. package/dist/sqs-DCwS1i2N.js.map +1 -0
  212. package/dist/supabase-vector-Dpp9mmJR.js +218 -0
  213. package/dist/supabase-vector-Dpp9mmJR.js.map +1 -0
  214. package/dist/tanstack/index.d.ts +15 -0
  215. package/dist/tanstack/index.d.ts.map +1 -0
  216. package/dist/tanstack/index.js +28 -0
  217. package/dist/tanstack/index.js.map +1 -0
  218. package/dist/teams-DYAHNb39.js +835 -0
  219. package/dist/teams-DYAHNb39.js.map +1 -0
  220. package/dist/telegram-DDXWzkfL.js +734 -0
  221. package/dist/telegram-DDXWzkfL.js.map +1 -0
  222. package/dist/textract-CPLiB22H.js +554 -0
  223. package/dist/textract-CPLiB22H.js.map +1 -0
  224. package/dist/transport-B4vn-XiQ.js +157 -0
  225. package/dist/transport-B4vn-XiQ.js.map +1 -0
  226. package/dist/transport-i96ACAI_.d.ts +46 -0
  227. package/dist/transport-i96ACAI_.d.ts.map +1 -0
  228. package/dist/types-Ccb0DXY9.d.ts +150 -0
  229. package/dist/types-Ccb0DXY9.d.ts.map +1 -0
  230. package/dist/unique-EwBH1JPB.js +19 -0
  231. package/dist/unique-EwBH1JPB.js.map +1 -0
  232. package/dist/vector-store-C3nEO80e.js +193 -0
  233. package/dist/vector-store-C3nEO80e.js.map +1 -0
  234. package/dist/vendors/amazon-sp-api/index.d.ts +526 -0
  235. package/dist/vendors/amazon-sp-api/index.d.ts.map +1 -0
  236. package/dist/vendors/amazon-sp-api/index.js +975 -0
  237. package/dist/vendors/amazon-sp-api/index.js.map +1 -0
  238. package/dist/vendors/bedrock-agentcore-browser/index.d.ts +2 -0
  239. package/dist/vendors/bedrock-agentcore-browser/index.js +2 -0
  240. package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts +228 -0
  241. package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts.map +1 -0
  242. package/dist/vendors/bedrock-agentcore-code-interpreter/index.js +2 -0
  243. package/dist/vendors/cloudflare-browser/index.d.ts +2 -0
  244. package/dist/vendors/cloudflare-browser/index.js +2 -0
  245. package/dist/vendors/cloudflare-email/index.d.ts +260 -0
  246. package/dist/vendors/cloudflare-email/index.d.ts.map +1 -0
  247. package/dist/vendors/cloudflare-email/index.js +3 -0
  248. package/dist/vendors/cloudflare-sandbox/index.d.ts +565 -0
  249. package/dist/vendors/cloudflare-sandbox/index.d.ts.map +1 -0
  250. package/dist/vendors/cloudflare-sandbox/index.js +2 -0
  251. package/dist/vendors/eventbridge-scheduler/index.d.ts +2 -0
  252. package/dist/vendors/eventbridge-scheduler/index.js +2 -0
  253. package/dist/vendors/gotenberg/index.d.ts +306 -0
  254. package/dist/vendors/gotenberg/index.d.ts.map +1 -0
  255. package/dist/vendors/gotenberg/index.js +2 -0
  256. package/dist/vendors/imessage/index.d.ts +420 -0
  257. package/dist/vendors/imessage/index.d.ts.map +1 -0
  258. package/dist/vendors/imessage/index.js +4 -0
  259. package/dist/vendors/katana/index.d.ts +1570 -0
  260. package/dist/vendors/katana/index.d.ts.map +1 -0
  261. package/dist/vendors/katana/index.js +1639 -0
  262. package/dist/vendors/katana/index.js.map +1 -0
  263. package/dist/vendors/mastra-vector/index.d.ts +120 -0
  264. package/dist/vendors/mastra-vector/index.d.ts.map +1 -0
  265. package/dist/vendors/mastra-vector/index.js +3 -0
  266. package/dist/vendors/pinecone/index.d.ts +75 -0
  267. package/dist/vendors/pinecone/index.d.ts.map +1 -0
  268. package/dist/vendors/pinecone/index.js +3 -0
  269. package/dist/vendors/qdrant/index.d.ts +75 -0
  270. package/dist/vendors/qdrant/index.d.ts.map +1 -0
  271. package/dist/vendors/qdrant/index.js +3 -0
  272. package/dist/vendors/resend/index.d.ts +3 -0
  273. package/dist/vendors/resend/index.js +3 -0
  274. package/dist/vendors/s3/index.d.ts +2 -0
  275. package/dist/vendors/s3/index.js +2 -0
  276. package/dist/vendors/slack/index.d.ts +576 -0
  277. package/dist/vendors/slack/index.d.ts.map +1 -0
  278. package/dist/vendors/slack/index.js +3 -0
  279. package/dist/vendors/sqs/index.d.ts +2 -0
  280. package/dist/vendors/sqs/index.js +2 -0
  281. package/dist/vendors/supabase-vector/index.d.ts +89 -0
  282. package/dist/vendors/supabase-vector/index.d.ts.map +1 -0
  283. package/dist/vendors/supabase-vector/index.js +3 -0
  284. package/dist/vendors/teams/index.d.ts +303 -0
  285. package/dist/vendors/teams/index.d.ts.map +1 -0
  286. package/dist/vendors/teams/index.js +3 -0
  287. package/dist/vendors/telegram/index.d.ts +319 -0
  288. package/dist/vendors/telegram/index.d.ts.map +1 -0
  289. package/dist/vendors/telegram/index.js +3 -0
  290. package/dist/vendors/textract/index.d.ts +2 -0
  291. package/dist/vendors/textract/index.js +2 -0
  292. package/dist/vendors/woocommerce/index.d.ts +1700 -0
  293. package/dist/vendors/woocommerce/index.d.ts.map +1 -0
  294. package/dist/vendors/woocommerce/index.js +1427 -0
  295. package/dist/vendors/woocommerce/index.js.map +1 -0
  296. package/dist/with-auth-CpKqTrGK.js +240 -0
  297. package/dist/with-auth-CpKqTrGK.js.map +1 -0
  298. package/logos/LUCIDE-ATTRIBUTION.txt +4 -0
  299. package/logos/README.md +89 -0
  300. package/logos/amazon.svg +6 -0
  301. package/logos/artifacts.svg +9 -0
  302. package/logos/browser.svg +9 -0
  303. package/logos/calendar.svg +15 -0
  304. package/logos/cloudflare-browser.svg +5 -0
  305. package/logos/cloudflare-email.svg +5 -0
  306. package/logos/cloudflare.svg +4 -0
  307. package/logos/code-sandbox.svg +8 -0
  308. package/logos/content-type.svg +10 -0
  309. package/logos/crypto.svg +7 -0
  310. package/logos/document-extract.svg +12 -0
  311. package/logos/document-render.svg +8 -0
  312. package/logos/document.svg +10 -0
  313. package/logos/email-message.svg +8 -0
  314. package/logos/email.svg +7 -0
  315. package/logos/file-convert.svg +9 -0
  316. package/logos/files.svg +6 -0
  317. package/logos/gotenberg.svg +340 -0
  318. package/logos/image.svg +8 -0
  319. package/logos/imessage.svg +7 -0
  320. package/logos/katana.svg +13 -0
  321. package/logos/mastra.svg +7 -0
  322. package/logos/messaging.svg +7 -0
  323. package/logos/pack-logos.json +48 -0
  324. package/logos/pdf.svg +10 -0
  325. package/logos/pinecone.svg +25 -0
  326. package/logos/presentation.svg +8 -0
  327. package/logos/qdrant.svg +4 -0
  328. package/logos/queue.svg +11 -0
  329. package/logos/rag.svg +18 -0
  330. package/logos/resend.svg +5 -0
  331. package/logos/scheduler.svg +7 -0
  332. package/logos/skills.svg +10 -0
  333. package/logos/slack.svg +14 -0
  334. package/logos/supabase.svg +4 -0
  335. package/logos/tasks.svg +10 -0
  336. package/logos/teams.svg +6 -0
  337. package/logos/telegram.svg +10 -0
  338. package/logos/textract.svg +5 -0
  339. package/logos/vector-store.svg +8 -0
  340. package/logos/web-fetch.svg +8 -0
  341. package/logos/woocommerce.svg +4 -0
  342. package/package.json +373 -0
@@ -0,0 +1,835 @@
1
+ import { t as ToolError } from "./errors-DoSpNHvs.js";
2
+ import { n as defineModule, r as defineTool } from "./define-CvpJ_pNP.js";
3
+ import { n as requireAuth } from "./provider-CgDAlg6K.js";
4
+ import { t as HttpService } from "./http-service-DDNCO1s4.js";
5
+ import { n as bytesToBase64, t as base64ToBytes } from "./bytes-BxpimpQx.js";
6
+ import { isPlainObject, isString, trimEnd } from "es-toolkit";
7
+ import { z } from "zod";
8
+ //#region src/vendors/teams/contracts.ts
9
+ /** Practical upper bound for data-URI attachments (small files only). */
10
+ const MAX_MEDIA_BYTES = 4 * 1024 * 1024;
11
+ const teamsChatActionSchema = z.enum([
12
+ "typing",
13
+ "upload_photo",
14
+ "record_video",
15
+ "upload_video",
16
+ "record_voice",
17
+ "upload_voice",
18
+ "upload_document",
19
+ "choose_sticker",
20
+ "find_location",
21
+ "record_video_note",
22
+ "upload_video_note"
23
+ ]);
24
+ const teamsAuthSchema = z.object({
25
+ app_id: z.string().min(1).describe("Microsoft Bot Framework application (client) id"),
26
+ app_password: z.string().min(1).describe("Microsoft Bot Framework application credential"),
27
+ tenant_id: z.string().min(1).optional().describe("Azure AD tenant id; omit for multi-tenant botframework.com token endpoint")
28
+ });
29
+ const serviceUrlField = z.string().min(1).describe("Bot Framework service URL for this conversation (from inbound activity.serviceUrl)");
30
+ const teamsSendTextInputSchema = z.object({
31
+ chat_id: z.string().min(1).describe("Teams conversation id"),
32
+ text: z.string().min(1).max(28e3).describe("Message text"),
33
+ reply_to_message_id: z.string().min(1).optional().describe("Optional activity id to reply to"),
34
+ service_url: serviceUrlField,
35
+ reply_markup: z.unknown().optional().describe("Optional Bot Framework attachments array or channel-native markup")
36
+ });
37
+ const teamsMessageOutputSchema = z.object({ message_id: z.string().describe("Bot Framework activity id as string") });
38
+ const teamsEditTextInputSchema = z.object({
39
+ chat_id: z.string().min(1).describe("Teams conversation id"),
40
+ message_id: z.string().min(1).describe("Activity id to edit"),
41
+ text: z.string().min(1).max(28e3).describe("Replacement text"),
42
+ service_url: serviceUrlField,
43
+ reply_markup: z.unknown().optional().describe("Optional Bot Framework attachments array or channel-native markup")
44
+ });
45
+ const teamsSendChatActionInputSchema = z.object({
46
+ chat_id: z.string().min(1).describe("Teams conversation id"),
47
+ action: teamsChatActionSchema.describe("Chat action; Teams maps all values to a typing activity"),
48
+ service_url: serviceUrlField
49
+ });
50
+ const teamsSetReactionInputSchema = z.object({
51
+ chat_id: z.string().min(1).describe("Teams chat or conversation id (Graph chat id when using Graph reactions)"),
52
+ message_id: z.string().min(1).describe("Message / activity id"),
53
+ emoji: z.string().min(1).max(32).describe("Emoji or short name (like, heart, …); Graph setReaction when tenant_id is bound"),
54
+ team_id: z.string().min(1).optional().describe("Team id for channel-message Graph path"),
55
+ channel_id: z.string().min(1).optional().describe("Channel id for channel-message Graph path")
56
+ });
57
+ const teamsClearReactionInputSchema = z.object({
58
+ chat_id: z.string().min(1).describe("Teams chat or conversation id"),
59
+ message_id: z.string().min(1).describe("Message / activity id"),
60
+ emoji: z.string().min(1).max(32).optional().describe("Same emoji/short name as setReaction; required for Graph unsetReaction"),
61
+ team_id: z.string().min(1).optional().describe("Team id for channel-message Graph path"),
62
+ channel_id: z.string().min(1).optional().describe("Channel id for channel-message Graph path")
63
+ });
64
+ const teamsSendMediaInputSchema = z.object({
65
+ chat_id: z.string().min(1).describe("Teams conversation id"),
66
+ kind: z.enum(["photo", "document"]).describe("Media kind"),
67
+ body_base64: z.string().min(1).describe("File body as base64"),
68
+ file_name: z.string().min(1).describe("File name including extension"),
69
+ caption: z.string().max(4e3).optional().describe("Optional caption text"),
70
+ content_type: z.string().optional().describe("Optional content type for the attachment"),
71
+ service_url: serviceUrlField,
72
+ reply_to_message_id: z.string().min(1).optional().describe("Optional activity id to reply to")
73
+ });
74
+ const teamsDownloadFileInputSchema = z.object({
75
+ file_id: z.string().min(1).describe("Content URL of the file to download"),
76
+ file_name: z.string().min(1).optional().describe("Preferred file name for the download result"),
77
+ service_url: z.string().min(1).optional().describe("Optional service URL (unused when file_id is an absolute content URL)")
78
+ });
79
+ const teamsDownloadFileOutputSchema = z.object({
80
+ file_name: z.string(),
81
+ file_size: z.number().optional(),
82
+ body_base64: z.string().describe("Downloaded file body as base64")
83
+ });
84
+ const teamsAnswerCallbackInputSchema = z.object({
85
+ callback_query_id: z.string().min(1).describe("Invoke reply path (absolute URL) or invoke activity id; non-URL values no-op"),
86
+ text: z.string().max(200).optional().describe("Optional notification text"),
87
+ show_alert: z.boolean().optional().describe("When true, prefer an alert-style presentation when supported"),
88
+ service_url: z.string().min(1).optional().describe("Optional service URL when replying via connector path")
89
+ });
90
+ const teamsGetBotOutputSchema = z.object({
91
+ bot_id: z.string(),
92
+ username: z.string(),
93
+ display_name: z.string()
94
+ });
95
+ const teamsOkOutputSchema = z.object({ ok: z.boolean() });
96
+ //#endregion
97
+ //#region src/vendors/teams/domain.ts
98
+ /**
99
+ * Microsoft Teams / Bot Framework payload shaping + parse.
100
+ * No HTTP — client owns transport.
101
+ *
102
+ * Reactions: Microsoft Graph setReaction / unsetReaction when host binds tenant_id
103
+ * (app-only Graph token). Without tenant_id the client keeps successful no-ops so
104
+ * seam presentation paths do not hard-fail.
105
+ */
106
+ var TeamsClientError = class extends ToolError {
107
+ failureKind;
108
+ constructor(input) {
109
+ super(input.message, {
110
+ code: "upstream",
111
+ retryable: input.failureKind === "outcome_unknown",
112
+ cause: input.cause,
113
+ details: {
114
+ method: input.method,
115
+ failure_kind: input.failureKind,
116
+ status: input.status
117
+ }
118
+ });
119
+ this.name = "TeamsClientError";
120
+ this.failureKind = input.failureKind;
121
+ }
122
+ };
123
+ function isTeamsDefiniteRejection(error) {
124
+ return error instanceof TeamsClientError && error.failureKind === "definite_rejection";
125
+ }
126
+ function isTeamsOutcomeUnknown(error) {
127
+ return error instanceof TeamsClientError && error.failureKind === "outcome_unknown";
128
+ }
129
+ /** Network / abort / transport failures (and non-classified ToolError) before a parseable response. */
130
+ function throwTeamsTransportError(method, error) {
131
+ if (error instanceof TeamsClientError) throw error;
132
+ if (error instanceof ToolError) {
133
+ const status = error.details?.["status"];
134
+ if (typeof status === "number" && isDefiniteStatus(status)) throw new TeamsClientError({
135
+ message: error.message,
136
+ failureKind: "definite_rejection",
137
+ method,
138
+ status,
139
+ cause: error
140
+ });
141
+ }
142
+ throw new TeamsClientError({
143
+ message: error instanceof Error ? error.message : `${method} request failed`,
144
+ failureKind: "outcome_unknown",
145
+ method,
146
+ cause: error
147
+ });
148
+ }
149
+ function isDefiniteStatus(status) {
150
+ return status === 400 || status === 401 || status === 403 || status === 404;
151
+ }
152
+ function botframeworkTokenUrl(tenantId) {
153
+ const tenant = tenantId && tenantId.length > 0 ? tenantId : "botframework.com";
154
+ return `https://login.microsoftonline.com/${encodeURIComponent(tenant)}/oauth2/v2.0/token`;
155
+ }
156
+ function botframeworkTokenBody(auth) {
157
+ return new URLSearchParams({
158
+ grant_type: "client_credentials",
159
+ client_id: auth.app_id,
160
+ client_secret: auth.app_password,
161
+ scope: "https://api.botframework.com/.default"
162
+ }).toString();
163
+ }
164
+ /** App-only Graph token (same client credentials; requires a real Azure AD tenant_id). */
165
+ function graphTokenBody(auth) {
166
+ return new URLSearchParams({
167
+ grant_type: "client_credentials",
168
+ client_id: auth.app_id,
169
+ client_secret: auth.app_password,
170
+ scope: "https://graph.microsoft.com/.default"
171
+ }).toString();
172
+ }
173
+ /**
174
+ * Graph reaction URL.
175
+ * Channel path when team_id + channel_id are set; otherwise chat path using chat_id.
176
+ */
177
+ function graphReactionUrl(input) {
178
+ const messageId = encodeURIComponent(input.message_id);
179
+ if (input.team_id && input.channel_id) return `https://graph.microsoft.com/v1.0/teams/${encodeURIComponent(input.team_id)}/channels/${encodeURIComponent(input.channel_id)}/messages/${messageId}/${input.op}`;
180
+ return `https://graph.microsoft.com/v1.0/chats/${encodeURIComponent(input.chat_id)}/messages/${messageId}/${input.op}`;
181
+ }
182
+ /** Map free-form emoji / short name to a Graph reactionType string (unicode preferred). */
183
+ function toGraphReactionType(emoji) {
184
+ const trimmed = emoji.trim();
185
+ switch (trimmed.toLowerCase().replace(/^:|:$/g, "")) {
186
+ case "like":
187
+ case "thumbsup":
188
+ case "+1": return "👍";
189
+ case "heart":
190
+ case "love": return "❤️";
191
+ case "laugh":
192
+ case "joy": return "😂";
193
+ case "surprised":
194
+ case "open_mouth": return "😲";
195
+ case "sad":
196
+ case "cry": return "😢";
197
+ case "angry": return "😠";
198
+ default: return trimmed;
199
+ }
200
+ }
201
+ function parseAccessToken(data) {
202
+ if (!isPlainObject(data) || !isString(data["access_token"]) || data["access_token"].length === 0) throw new ToolError("Teams token endpoint did not return an access_token", { code: "bad_auth" });
203
+ const expiresIn = typeof data["expires_in"] === "number" && Number.isFinite(data["expires_in"]) && data["expires_in"] > 0 ? data["expires_in"] : 3600;
204
+ return {
205
+ access_token: data["access_token"],
206
+ expires_in: expiresIn
207
+ };
208
+ }
209
+ /** Absolute connector path under a conversation service URL. */
210
+ function connectorPath(serviceUrl, path) {
211
+ return `${trimEnd(serviceUrl, "/")}${path.startsWith("/") ? path : `/${path}`}`;
212
+ }
213
+ function conversationActivitiesPath(serviceUrl, chatId) {
214
+ return connectorPath(serviceUrl, `/v3/conversations/${encodeURIComponent(chatId)}/activities`);
215
+ }
216
+ function conversationActivityPath(serviceUrl, chatId, messageId) {
217
+ return connectorPath(serviceUrl, `/v3/conversations/${encodeURIComponent(chatId)}/activities/${encodeURIComponent(messageId)}`);
218
+ }
219
+ /** Map non-2xx connector responses into TeamsClientError. */
220
+ function throwForStatus(label, status, data) {
221
+ let message = `${label} failed with HTTP ${status}`;
222
+ if (isPlainObject(data)) {
223
+ const error = data["error"];
224
+ if (isPlainObject(error) && isString(error["message"]) && error["message"].length > 0) message = error["message"];
225
+ else if (isString(data["message"]) && data["message"].length > 0) message = data["message"];
226
+ }
227
+ throw new TeamsClientError({
228
+ message,
229
+ failureKind: isDefiniteStatus(status) ? "definite_rejection" : "outcome_unknown",
230
+ method: label,
231
+ status
232
+ });
233
+ }
234
+ function parseActivityId(value) {
235
+ if (isPlainObject(value) && isString(value["id"]) && value["id"].length > 0) return { message_id: value["id"] };
236
+ if (isString(value) && value.length > 0) return { message_id: value };
237
+ throw new ToolError("Teams connector returned an invalid activity id", { code: "upstream" });
238
+ }
239
+ function attachmentsFromReplyMarkup(replyMarkup) {
240
+ if (Array.isArray(replyMarkup)) return replyMarkup;
241
+ }
242
+ function buildMessageActivity(input) {
243
+ const fromMarkup = attachmentsFromReplyMarkup(input.reply_markup);
244
+ const attachments = input.attachments ?? fromMarkup;
245
+ return {
246
+ type: "message",
247
+ ...input.text && { text: input.text },
248
+ ...input.reply_to_message_id && { replyToId: input.reply_to_message_id },
249
+ ...attachments && attachments.length > 0 && { attachments }
250
+ };
251
+ }
252
+ function buildTypingActivity() {
253
+ return { type: "typing" };
254
+ }
255
+ function buildMediaActivity(input) {
256
+ const contentType = input.content_type ?? "application/octet-stream";
257
+ let bytes;
258
+ try {
259
+ bytes = base64ToBytes(input.body_base64);
260
+ } catch (error) {
261
+ throw new ToolError("Invalid base64 body", {
262
+ code: "bad_input",
263
+ cause: error
264
+ });
265
+ }
266
+ if (bytes.byteLength === 0) throw new ToolError("Media body must not be empty", { code: "bad_input" });
267
+ if (bytes.byteLength > 4194304) throw new ToolError("Media exceeds 4 MiB data-URI limit", {
268
+ code: "too_large",
269
+ details: {
270
+ max_bytes: MAX_MEDIA_BYTES,
271
+ content_length: bytes.byteLength
272
+ }
273
+ });
274
+ return {
275
+ type: "message",
276
+ ...input.caption && { text: input.caption },
277
+ ...input.reply_to_message_id && { replyToId: input.reply_to_message_id },
278
+ attachments: [{
279
+ contentType,
280
+ contentUrl: `data:${contentType};base64,${input.body_base64}`,
281
+ name: input.file_name
282
+ }]
283
+ };
284
+ }
285
+ function parseDownload(input, bytes) {
286
+ const fromUrl = (() => {
287
+ try {
288
+ const last = new URL(input.file_id).pathname.split("/").filter(Boolean).pop();
289
+ return last && last.length > 0 ? decodeURIComponent(last) : void 0;
290
+ } catch {
291
+ return;
292
+ }
293
+ })();
294
+ return {
295
+ file_name: input.file_name ?? fromUrl ?? "download",
296
+ file_size: bytes.byteLength,
297
+ body_base64: bytesToBase64(bytes)
298
+ };
299
+ }
300
+ function botIdentityFromAuth(appId) {
301
+ return {
302
+ bot_id: appId,
303
+ username: "teams-bot",
304
+ display_name: "Teams Bot"
305
+ };
306
+ }
307
+ function isAbsoluteHttpUrl(value) {
308
+ try {
309
+ const url = new URL(value);
310
+ return url.protocol === "http:" || url.protocol === "https:";
311
+ } catch {
312
+ return false;
313
+ }
314
+ }
315
+ /** Optional invoke-response body when answering via a reply path. */
316
+ function buildInvokeResponseBody(input) {
317
+ return {
318
+ type: "invokeResponse",
319
+ value: {
320
+ status: 200,
321
+ body: {
322
+ ...input.text && { text: input.text },
323
+ ...input.show_alert !== void 0 && { showAlert: input.show_alert }
324
+ }
325
+ }
326
+ };
327
+ }
328
+ //#endregion
329
+ //#region src/vendors/teams/client.ts
330
+ /**
331
+ * Microsoft Teams / Bot Framework vendor client.
332
+ * Host: `new TeamsClient(auth)`. Agent tools: `fromContext(ctx)`.
333
+ *
334
+ * Connector base is per-conversation (`service_url` on method input).
335
+ * Access tokens are cached on the instance with ~60s skew.
336
+ */
337
+ var TeamsClient = class TeamsClient {
338
+ #auth;
339
+ #http;
340
+ #accessToken;
341
+ #accessTokenExpiresAt = 0;
342
+ #graphToken;
343
+ #graphTokenExpiresAt = 0;
344
+ constructor(auth, options = {}) {
345
+ const parsed = teamsAuthSchema.safeParse(auth);
346
+ if (!parsed.success) throw new ToolError("Invalid Teams auth credentials", {
347
+ code: "bad_auth",
348
+ details: { issues: parsed.error.issues.map((issue) => issue.message) }
349
+ });
350
+ this.#auth = parsed.data;
351
+ this.#http = new HttpService({
352
+ ...options,
353
+ label: "Teams"
354
+ });
355
+ }
356
+ static fromContext(ctx) {
357
+ const auth = requireAuth(ctx, teamsAuthSchema);
358
+ return new TeamsClient(auth, {
359
+ ...ctx.fetch && { fetch: ctx.fetch },
360
+ ...ctx.signal && { signal: ctx.signal }
361
+ });
362
+ }
363
+ async #ensureAccessToken() {
364
+ const now = Date.now();
365
+ if (this.#accessToken && now < this.#accessTokenExpiresAt - 6e4) return this.#accessToken;
366
+ try {
367
+ const { data } = await this.#http.post(botframeworkTokenUrl(this.#auth.tenant_id), botframeworkTokenBody(this.#auth), {
368
+ label: "Teams token",
369
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
370
+ });
371
+ const token = parseAccessToken(data);
372
+ this.#accessToken = token.access_token;
373
+ this.#accessTokenExpiresAt = now + token.expires_in * 1e3;
374
+ return token.access_token;
375
+ } catch (error) {
376
+ throwTeamsTransportError("Teams token", error);
377
+ }
378
+ }
379
+ async #postActivity(label, url, body, headers) {
380
+ try {
381
+ return await this.#http.post(url, body, {
382
+ label,
383
+ headers,
384
+ noThrow: true
385
+ });
386
+ } catch (error) {
387
+ throwTeamsTransportError(label, error);
388
+ }
389
+ }
390
+ async #putActivity(label, url, body, headers) {
391
+ try {
392
+ return await this.#http.put(url, body, {
393
+ label,
394
+ headers,
395
+ noThrow: true
396
+ });
397
+ } catch (error) {
398
+ throwTeamsTransportError(label, error);
399
+ }
400
+ }
401
+ async #authHeaders() {
402
+ return {
403
+ Authorization: `Bearer ${await this.#ensureAccessToken()}`,
404
+ "Content-Type": "application/json"
405
+ };
406
+ }
407
+ /** POST {service_url}/v3/conversations/{chat_id}/activities — type message */
408
+ async sendText(input) {
409
+ const headers = await this.#authHeaders();
410
+ const url = conversationActivitiesPath(input.service_url, input.chat_id);
411
+ const body = buildMessageActivity({
412
+ text: input.text,
413
+ ...input.reply_to_message_id && { reply_to_message_id: input.reply_to_message_id },
414
+ ...input.reply_markup !== void 0 && { reply_markup: input.reply_markup }
415
+ });
416
+ const res = await this.#postActivity("Teams sendText", url, body, headers);
417
+ if (!res.ok) throwForStatus("Teams sendText", res.status, res.data);
418
+ return parseActivityId(res.data);
419
+ }
420
+ /** PUT {service_url}/v3/conversations/{chat_id}/activities/{message_id} */
421
+ async editText(input) {
422
+ const headers = await this.#authHeaders();
423
+ const url = conversationActivityPath(input.service_url, input.chat_id, input.message_id);
424
+ const body = buildMessageActivity({
425
+ text: input.text,
426
+ ...input.reply_markup !== void 0 && { reply_markup: input.reply_markup }
427
+ });
428
+ const res = await this.#putActivity("Teams editText", url, body, headers);
429
+ if (!res.ok) throwForStatus("Teams editText", res.status, res.data);
430
+ if (res.data === void 0 || res.data === null || res.data === "") return { message_id: input.message_id };
431
+ try {
432
+ return parseActivityId(res.data);
433
+ } catch {
434
+ return { message_id: input.message_id };
435
+ }
436
+ }
437
+ /** POST typing activity (all ChannelTransport actions map to typing). */
438
+ async sendChatAction(input) {
439
+ const headers = await this.#authHeaders();
440
+ const url = conversationActivitiesPath(input.service_url, input.chat_id);
441
+ const res = await this.#postActivity("Teams sendChatAction", url, buildTypingActivity(), headers);
442
+ if (!res.ok) throwForStatus("Teams sendChatAction", res.status, res.data);
443
+ }
444
+ /**
445
+ * Add a reaction via Microsoft Graph when `tenant_id` is bound on auth.
446
+ * Without `tenant_id`, succeeds as a no-op (Bot Framework has no reaction write).
447
+ * Channel messages: pass `team_id` + `channel_id`; otherwise uses chat path with `chat_id`.
448
+ */
449
+ async setReaction(input) {
450
+ if (!this.#auth.tenant_id) return;
451
+ await this.#graphReaction("setReaction", input);
452
+ }
453
+ /**
454
+ * Remove a reaction via Graph when `tenant_id` is bound. Requires `emoji` matching setReaction.
455
+ * Without `tenant_id`, succeeds as a no-op.
456
+ */
457
+ async clearReaction(input) {
458
+ if (!this.#auth.tenant_id) return;
459
+ if (!input.emoji) throw new ToolError("Teams clearReaction requires emoji when using Graph reactions (tenant_id bound)", { code: "bad_input" });
460
+ await this.#graphReaction("unsetReaction", {
461
+ chat_id: input.chat_id,
462
+ message_id: input.message_id,
463
+ emoji: input.emoji,
464
+ ...input.team_id && { team_id: input.team_id },
465
+ ...input.channel_id && { channel_id: input.channel_id }
466
+ });
467
+ }
468
+ async #ensureGraphToken() {
469
+ const tenantId = this.#auth.tenant_id;
470
+ if (!tenantId) throw new ToolError("Teams Graph reactions require tenant_id on auth", { code: "bad_auth" });
471
+ const now = Date.now();
472
+ if (this.#graphToken && now < this.#graphTokenExpiresAt - 6e4) return this.#graphToken;
473
+ try {
474
+ const { data } = await this.#http.post(botframeworkTokenUrl(tenantId), graphTokenBody(this.#auth), {
475
+ label: "Teams Graph token",
476
+ headers: { "Content-Type": "application/x-www-form-urlencoded" }
477
+ });
478
+ const token = parseAccessToken(data);
479
+ this.#graphToken = token.access_token;
480
+ this.#graphTokenExpiresAt = now + token.expires_in * 1e3;
481
+ return token.access_token;
482
+ } catch (error) {
483
+ throwTeamsTransportError("Teams Graph token", error);
484
+ }
485
+ }
486
+ async #graphReaction(op, input) {
487
+ const token = await this.#ensureGraphToken();
488
+ const url = graphReactionUrl({
489
+ chat_id: input.chat_id,
490
+ message_id: input.message_id,
491
+ op,
492
+ ...input.team_id && { team_id: input.team_id },
493
+ ...input.channel_id && { channel_id: input.channel_id }
494
+ });
495
+ const label = op === "setReaction" ? "Teams Graph setReaction" : "Teams Graph unsetReaction";
496
+ let res;
497
+ try {
498
+ res = await this.#http.post(url, { reactionType: toGraphReactionType(input.emoji) }, {
499
+ label,
500
+ noThrow: true,
501
+ headers: {
502
+ Authorization: `Bearer ${token}`,
503
+ "Content-Type": "application/json; charset=utf-8"
504
+ }
505
+ });
506
+ } catch (error) {
507
+ throwTeamsTransportError(label, error);
508
+ }
509
+ if (!res.ok) throwForStatus(label, res.status, res.data);
510
+ }
511
+ /** POST message with data-URI attachment (small files). */
512
+ async sendMedia(input) {
513
+ const headers = await this.#authHeaders();
514
+ const url = conversationActivitiesPath(input.service_url, input.chat_id);
515
+ const body = buildMediaActivity(input);
516
+ const res = await this.#postActivity("Teams sendMedia", url, body, headers);
517
+ if (!res.ok) throwForStatus("Teams sendMedia", res.status, res.data);
518
+ return parseActivityId(res.data);
519
+ }
520
+ /** GET content URL (file_id) with bearer token; return body_base64. */
521
+ async downloadFile(input) {
522
+ const token = await this.#ensureAccessToken();
523
+ let res;
524
+ try {
525
+ res = await this.#http.bytes("GET", input.file_id, {
526
+ label: "Teams downloadFile",
527
+ headers: { Authorization: `Bearer ${token}` },
528
+ noThrow: true
529
+ });
530
+ } catch (error) {
531
+ throwTeamsTransportError("Teams downloadFile", error);
532
+ }
533
+ if (!res.ok) throw new TeamsClientError({
534
+ message: `Teams downloadFile failed with HTTP ${res.status}`,
535
+ failureKind: res.status === 400 || res.status === 401 || res.status === 403 || res.status === 404 ? "definite_rejection" : "outcome_unknown",
536
+ method: "Teams downloadFile",
537
+ status: res.status
538
+ });
539
+ return parseDownload(input, res.bytes);
540
+ }
541
+ /**
542
+ * Answer an invoke callback. When `callback_query_id` is an absolute HTTP(S)
543
+ * reply path, POST an invokeResponse there. Otherwise succeed as a no-op
544
+ * (host may have already completed the HTTP invoke response).
545
+ */
546
+ async answerCallback(input) {
547
+ if (!isAbsoluteHttpUrl(input.callback_query_id)) return;
548
+ const headers = await this.#authHeaders();
549
+ const body = buildInvokeResponseBody({
550
+ ...input.text && { text: input.text },
551
+ ...input.show_alert !== void 0 && { show_alert: input.show_alert }
552
+ });
553
+ const res = await this.#postActivity("Teams answerCallback", input.callback_query_id, body, headers);
554
+ if (!res.ok) throwForStatus("Teams answerCallback", res.status, res.data);
555
+ }
556
+ /** Identity from bound auth (no connector call). */
557
+ async getBot() {
558
+ return botIdentityFromAuth(this.#auth.app_id);
559
+ }
560
+ };
561
+ //#endregion
562
+ //#region src/vendors/teams/module.ts
563
+ const emptyInputSchema = z.object({}).describe("No input fields");
564
+ const teamsSendTextTool = defineTool({
565
+ id: "teams-send-text",
566
+ name: "teamsSendText",
567
+ description: "Send a text message to a Microsoft Teams conversation via Bot Framework. Requires service_url from the inbound activity. Returns the new activity message_id.",
568
+ inputSchema: teamsSendTextInputSchema,
569
+ outputSchema: teamsMessageOutputSchema,
570
+ sideEffect: "send",
571
+ runtime: "both",
572
+ execute: async (input, ctx) => TeamsClient.fromContext(ctx).sendText(input)
573
+ });
574
+ const teamsEditTextTool = defineTool({
575
+ id: "teams-edit-text",
576
+ name: "teamsEditText",
577
+ description: "Edit the text of an existing Teams activity. Used for progressive live updates and corrections. Requires service_url.",
578
+ inputSchema: teamsEditTextInputSchema,
579
+ outputSchema: teamsMessageOutputSchema,
580
+ sideEffect: "write",
581
+ runtime: "both",
582
+ execute: async (input, ctx) => TeamsClient.fromContext(ctx).editText(input)
583
+ });
584
+ const teamsSendChatActionTool = defineTool({
585
+ id: "teams-send-chat-action",
586
+ name: "teamsSendChatAction",
587
+ description: "Show a typing indicator in a Teams conversation (Bot Framework typing activity). All action values map to typing. Requires service_url.",
588
+ inputSchema: teamsSendChatActionInputSchema,
589
+ outputSchema: teamsOkOutputSchema,
590
+ sideEffect: "none",
591
+ runtime: "both",
592
+ execute: async (input, ctx) => {
593
+ await TeamsClient.fromContext(ctx).sendChatAction(input);
594
+ return { ok: true };
595
+ }
596
+ });
597
+ const teamsSetReactionTool = defineTool({
598
+ id: "teams-set-reaction",
599
+ name: "teamsSetReaction",
600
+ description: "Set a reaction on a Teams message. Bot Framework reaction support is limited; this call succeeds as a presentation no-op so channel seams stay uniform.",
601
+ inputSchema: teamsSetReactionInputSchema,
602
+ outputSchema: teamsOkOutputSchema,
603
+ sideEffect: "write",
604
+ runtime: "both",
605
+ execute: async (input, ctx) => {
606
+ await TeamsClient.fromContext(ctx).setReaction(input);
607
+ return { ok: true };
608
+ }
609
+ });
610
+ const teamsClearReactionTool = defineTool({
611
+ id: "teams-clear-reaction",
612
+ name: "teamsClearReaction",
613
+ description: "Clear reactions on a Teams message. Bot Framework reaction support is limited; this call succeeds as a presentation no-op.",
614
+ inputSchema: teamsClearReactionInputSchema,
615
+ outputSchema: teamsOkOutputSchema,
616
+ sideEffect: "write",
617
+ runtime: "both",
618
+ execute: async (input, ctx) => {
619
+ await TeamsClient.fromContext(ctx).clearReaction(input);
620
+ return { ok: true };
621
+ }
622
+ });
623
+ const teamsSendMediaTool = defineTool({
624
+ id: "teams-send-media",
625
+ name: "teamsSendMedia",
626
+ description: "Send one photo or document to a Teams conversation as a Bot Framework data-URI attachment (small files). Requires service_url.",
627
+ inputSchema: teamsSendMediaInputSchema,
628
+ outputSchema: teamsMessageOutputSchema,
629
+ sideEffect: "send",
630
+ runtime: "both",
631
+ execute: async (input, ctx) => TeamsClient.fromContext(ctx).sendMedia(input)
632
+ });
633
+ const teamsDownloadFileTool = defineTool({
634
+ id: "teams-download-file",
635
+ name: "teamsDownloadFile",
636
+ description: "Download a Teams/Bot Framework file by content URL (file_id) and return the body as base64 with optional size and name.",
637
+ inputSchema: teamsDownloadFileInputSchema,
638
+ outputSchema: teamsDownloadFileOutputSchema,
639
+ sideEffect: "read",
640
+ runtime: "both",
641
+ execute: async (input, ctx) => TeamsClient.fromContext(ctx).downloadFile(input)
642
+ });
643
+ const teamsAnswerCallbackTool = defineTool({
644
+ id: "teams-answer-callback",
645
+ name: "teamsAnswerCallback",
646
+ description: "Acknowledge a Teams invoke. When callback_query_id is an absolute reply URL, POSTs an invokeResponse; otherwise succeeds as a no-op.",
647
+ inputSchema: teamsAnswerCallbackInputSchema,
648
+ outputSchema: teamsOkOutputSchema,
649
+ sideEffect: "write",
650
+ runtime: "both",
651
+ execute: async (input, ctx) => {
652
+ await TeamsClient.fromContext(ctx).answerCallback(input);
653
+ return { ok: true };
654
+ }
655
+ });
656
+ const teamsGetBotTool = defineTool({
657
+ id: "teams-get-bot",
658
+ name: "teamsGetBot",
659
+ description: "Return the current Microsoft Teams bot identity, including bot_id, username, and display_name.",
660
+ inputSchema: emptyInputSchema,
661
+ outputSchema: teamsGetBotOutputSchema,
662
+ sideEffect: "read",
663
+ runtime: "both",
664
+ execute: async (_input, ctx) => TeamsClient.fromContext(ctx).getBot()
665
+ });
666
+ const teamsModule = defineModule({
667
+ id: "teams",
668
+ title: "Microsoft Teams",
669
+ description: "Microsoft Teams tools for text, media, typing, file download, invoke callbacks, and bot identity. Conversation actions require service_url from the active conversation; reaction actions report unsupported behavior.",
670
+ runtime: "both",
671
+ auth: {
672
+ type: "custom",
673
+ schema: teamsAuthSchema
674
+ },
675
+ categories: ["messaging", "chat"],
676
+ classification: "pii",
677
+ tags: ["teams", "bot-framework"],
678
+ tools: [
679
+ teamsSendTextTool,
680
+ teamsEditTextTool,
681
+ teamsSendChatActionTool,
682
+ teamsSetReactionTool,
683
+ teamsClearReactionTool,
684
+ teamsSendMediaTool,
685
+ teamsDownloadFileTool,
686
+ teamsAnswerCallbackTool,
687
+ teamsGetBotTool
688
+ ]
689
+ });
690
+ //#endregion
691
+ //#region src/vendors/teams/webhook.ts
692
+ /**
693
+ * Host-owned Bot Framework JWT validation is authoritative.
694
+ * This helper only checks that an Authorization Bearer token is present
695
+ * (length > 0 after the scheme). Do not treat a true result as cryptographic
696
+ * authenticity.
697
+ */
698
+ function verifyTeamsAuthHeader(headerValue) {
699
+ if (!headerValue) return false;
700
+ const match = /^Bearer\s+(\S+)$/i.exec(headerValue.trim());
701
+ return Boolean(match?.[1] && match[1].length > 0);
702
+ }
703
+ /** True when value looks like a Bot Framework activity object. */
704
+ function isTeamsActivity(value) {
705
+ if (!isPlainObject(value)) return false;
706
+ if (!isString(value["type"]) || value["type"].length === 0) return false;
707
+ const conversation = value["conversation"];
708
+ return isPlainObject(conversation) && isString(conversation["id"]) && conversation["id"].length > 0;
709
+ }
710
+ /**
711
+ * Parse one raw Bot Framework Activity into a normalized inbound event.
712
+ * Returns ok:false for payloads the pack does not surface.
713
+ */
714
+ function parseTeamsActivity(body, options) {
715
+ if (!isPlainObject(body)) return {
716
+ ok: false,
717
+ reason: "activity_not_object"
718
+ };
719
+ if (!isString(body["type"]) || body["type"].length === 0) return {
720
+ ok: false,
721
+ reason: "missing_type"
722
+ };
723
+ const conversation = body["conversation"];
724
+ if (!isPlainObject(conversation) || !isString(conversation["id"]) || conversation["id"].length === 0) return {
725
+ ok: false,
726
+ reason: "missing_conversation"
727
+ };
728
+ const receivedAt = options?.received_at ?? (/* @__PURE__ */ new Date()).toISOString();
729
+ const rawType = body["type"];
730
+ const activityId = isString(body["id"]) && body["id"].length > 0 ? body["id"] : void 0;
731
+ const eventId = activityId ?? `${rawType}:${conversation["id"]}:${receivedAt}`;
732
+ const serviceUrl = isString(body["serviceUrl"]) && body["serviceUrl"].length > 0 ? body["serviceUrl"] : void 0;
733
+ const from = body["from"];
734
+ const userId = isPlainObject(from) && isString(from["id"]) ? from["id"] : void 0;
735
+ const username = isPlainObject(from) && isString(from["name"]) ? from["name"] : void 0;
736
+ const text = firstString(body["text"], body["summary"]);
737
+ const replyTo = isString(body["replyToId"]) && body["replyToId"].length > 0 ? body["replyToId"] : void 0;
738
+ const media = collectMedia(body);
739
+ const conversationType = isString(conversation["conversationType"]) && conversation["conversationType"].length > 0 ? conversation["conversationType"] : void 0;
740
+ if (rawType === "invoke") {
741
+ const callbackData = encodeCallbackData(body["value"]);
742
+ return {
743
+ ok: true,
744
+ event: {
745
+ channel: "teams",
746
+ event_id: eventId,
747
+ chat_id: conversation["id"],
748
+ raw_type: "invoke",
749
+ received_at: receivedAt,
750
+ callback_query_id: activityId ?? eventId,
751
+ ...userId && { user_id: userId },
752
+ ...username && { username },
753
+ ...activityId && { message_id: activityId },
754
+ ...callbackData && { callback_data: callbackData },
755
+ ...serviceUrl && { service_url: serviceUrl },
756
+ ...conversationType && { chat_type: conversationType }
757
+ }
758
+ };
759
+ }
760
+ if (rawType === "message" || rawType === "messageUpdate") {
761
+ if (!text && media.length === 0) return {
762
+ ok: false,
763
+ reason: "empty_message"
764
+ };
765
+ return {
766
+ ok: true,
767
+ event: {
768
+ channel: "teams",
769
+ event_id: eventId,
770
+ chat_id: conversation["id"],
771
+ raw_type: rawType,
772
+ received_at: receivedAt,
773
+ ...userId && { user_id: userId },
774
+ ...username && { username },
775
+ ...activityId && { message_id: activityId },
776
+ ...text && { text },
777
+ ...media.length > 0 && { media },
778
+ ...replyTo && { reply_to: replyTo },
779
+ ...serviceUrl && { service_url: serviceUrl },
780
+ ...conversationType && { chat_type: conversationType }
781
+ }
782
+ };
783
+ }
784
+ return {
785
+ ok: true,
786
+ event: {
787
+ channel: "teams",
788
+ event_id: eventId,
789
+ chat_id: conversation["id"],
790
+ raw_type: rawType,
791
+ received_at: receivedAt,
792
+ ...userId && { user_id: userId },
793
+ ...username && { username },
794
+ ...activityId && { message_id: activityId },
795
+ ...text && { text },
796
+ ...serviceUrl && { service_url: serviceUrl },
797
+ ...conversationType && { chat_type: conversationType }
798
+ }
799
+ };
800
+ }
801
+ function firstString(...values) {
802
+ for (const value of values) if (isString(value) && value.length > 0) return value;
803
+ }
804
+ function encodeCallbackData(value) {
805
+ if (isString(value) && value.length > 0) return value;
806
+ if (isPlainObject(value)) try {
807
+ return JSON.stringify(value);
808
+ } catch {
809
+ return;
810
+ }
811
+ }
812
+ function collectMedia(activity) {
813
+ const out = [];
814
+ const attachments = activity["attachments"];
815
+ if (!Array.isArray(attachments)) return out;
816
+ for (const item of attachments) {
817
+ if (!isPlainObject(item)) continue;
818
+ const contentType = isString(item["contentType"]) ? item["contentType"] : void 0;
819
+ const contentUrl = isString(item["contentUrl"]) ? item["contentUrl"] : void 0;
820
+ const name = isString(item["name"]) ? item["name"] : void 0;
821
+ if (!contentUrl && !contentType && !name) continue;
822
+ const kind = contentType && contentType.startsWith("image/") ? "photo" : contentType && contentType.startsWith("audio/") ? "audio" : contentType && contentType.startsWith("video/") ? "video" : "document";
823
+ out.push({
824
+ kind,
825
+ ...contentUrl && { ref: contentUrl },
826
+ ...contentType && { media_type: contentType },
827
+ ...name && { file_name: name }
828
+ });
829
+ }
830
+ return out;
831
+ }
832
+ //#endregion
833
+ export { teamsSendTextInputSchema as A, teamsDownloadFileOutputSchema as C, teamsOkOutputSchema as D, teamsMessageOutputSchema as E, teamsSendChatActionInputSchema as O, teamsDownloadFileInputSchema as S, teamsGetBotOutputSchema as T, isTeamsOutcomeUnknown as _, teamsClearReactionTool as a, teamsAuthSchema as b, teamsGetBotTool as c, teamsSendMediaTool as d, teamsSendTextTool as f, isTeamsDefiniteRejection as g, TeamsClientError as h, teamsAnswerCallbackTool as i, teamsSetReactionInputSchema as j, teamsSendMediaInputSchema as k, teamsModule as l, TeamsClient as m, parseTeamsActivity as n, teamsDownloadFileTool as o, teamsSetReactionTool as p, verifyTeamsAuthHeader as r, teamsEditTextTool as s, isTeamsActivity as t, teamsSendChatActionTool as u, MAX_MEDIA_BYTES as v, teamsEditTextInputSchema as w, teamsClearReactionInputSchema as x, teamsAnswerCallbackInputSchema as y };
834
+
835
+ //# sourceMappingURL=teams-DYAHNb39.js.map