@bubblelab/bubble-core 0.1.10 → 0.1.11

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 (298) hide show
  1. package/dist/bubble-bundle.d.ts +759 -350
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +125 -35
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubble-flow/bubble-flow-class.d.ts +5 -0
  6. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -1
  7. package/dist/bubble-flow/bubble-flow-class.js +20 -0
  8. package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
  9. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -1
  10. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +6 -3
  11. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -1
  12. package/dist/bubbles/service-bubble/agi-inc.d.ts +1121 -0
  13. package/dist/bubbles/service-bubble/agi-inc.d.ts.map +1 -0
  14. package/dist/bubbles/service-bubble/agi-inc.js +730 -0
  15. package/dist/bubbles/service-bubble/agi-inc.js.map +1 -0
  16. package/dist/bubbles/service-bubble/ai-agent.d.ts +277 -65
  17. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
  18. package/dist/bubbles/service-bubble/ai-agent.js +533 -399
  19. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
  20. package/dist/bubbles/service-bubble/airtable.d.ts +1753 -0
  21. package/dist/bubbles/service-bubble/airtable.d.ts.map +1 -0
  22. package/dist/bubbles/service-bubble/airtable.js +1173 -0
  23. package/dist/bubbles/service-bubble/airtable.js.map +1 -0
  24. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +240 -0
  25. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts.map +1 -0
  26. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js +119 -0
  27. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js.map +1 -0
  28. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +4 -4
  29. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +14 -14
  30. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts +137 -0
  31. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts.map +1 -0
  32. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js +81 -0
  33. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js.map +1 -0
  34. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +6 -6
  35. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +32 -32
  36. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +488 -0
  37. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts.map +1 -0
  38. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js +463 -0
  39. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js.map +1 -0
  40. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +262 -0
  41. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts.map +1 -0
  42. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js +291 -0
  43. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js.map +1 -0
  44. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +12 -12
  45. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +1301 -170
  46. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts.map +1 -1
  47. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js +32 -0
  48. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js.map +1 -1
  49. package/dist/bubbles/service-bubble/apify/apify.d.ts +162 -17
  50. package/dist/bubbles/service-bubble/apify/apify.d.ts.map +1 -1
  51. package/dist/bubbles/service-bubble/apify/apify.js +205 -32
  52. package/dist/bubbles/service-bubble/apify/apify.js.map +1 -1
  53. package/dist/bubbles/service-bubble/eleven-labs.d.ts +421 -0
  54. package/dist/bubbles/service-bubble/eleven-labs.d.ts.map +1 -0
  55. package/dist/bubbles/service-bubble/eleven-labs.js +479 -0
  56. package/dist/bubbles/service-bubble/eleven-labs.js.map +1 -0
  57. package/dist/bubbles/service-bubble/firecrawl.d.ts +37748 -0
  58. package/dist/bubbles/service-bubble/firecrawl.d.ts.map +1 -0
  59. package/dist/bubbles/service-bubble/firecrawl.js +1489 -0
  60. package/dist/bubbles/service-bubble/firecrawl.js.map +1 -0
  61. package/dist/bubbles/service-bubble/followupboss.d.ts +6822 -0
  62. package/dist/bubbles/service-bubble/followupboss.d.ts.map +1 -0
  63. package/dist/bubbles/service-bubble/followupboss.js +1394 -0
  64. package/dist/bubbles/service-bubble/followupboss.js.map +1 -0
  65. package/dist/bubbles/service-bubble/github.d.ts +2399 -0
  66. package/dist/bubbles/service-bubble/github.d.ts.map +1 -0
  67. package/dist/bubbles/service-bubble/github.js +1052 -0
  68. package/dist/bubbles/service-bubble/github.js.map +1 -0
  69. package/dist/bubbles/service-bubble/gmail.d.ts +180 -180
  70. package/dist/bubbles/service-bubble/google-calendar.d.ts +60 -60
  71. package/dist/bubbles/service-bubble/google-drive.d.ts +37 -36
  72. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
  73. package/dist/bubbles/service-bubble/google-drive.js +35 -3
  74. package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
  75. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +943 -0
  76. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts.map +1 -0
  77. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts +31 -0
  78. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts.map +1 -0
  79. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js +184 -0
  80. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js.map +1 -0
  81. package/dist/bubbles/service-bubble/google-sheets/google-sheets.js +401 -0
  82. package/dist/bubbles/service-bubble/google-sheets/google-sheets.js.map +1 -0
  83. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +1024 -0
  84. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts.map +1 -0
  85. package/dist/bubbles/service-bubble/{google-sheets.js → google-sheets/google-sheets.schema.js} +45 -409
  86. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.js.map +1 -0
  87. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts +38 -0
  88. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts.map +1 -0
  89. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js +183 -0
  90. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js.map +1 -0
  91. package/dist/bubbles/service-bubble/google-sheets/index.d.ts +4 -0
  92. package/dist/bubbles/service-bubble/google-sheets/index.d.ts.map +1 -0
  93. package/dist/bubbles/service-bubble/google-sheets/index.js +4 -0
  94. package/dist/bubbles/service-bubble/google-sheets/index.js.map +1 -0
  95. package/dist/bubbles/service-bubble/hello-world.d.ts +4 -4
  96. package/dist/bubbles/service-bubble/http.d.ts +4 -4
  97. package/dist/bubbles/service-bubble/http.d.ts.map +1 -1
  98. package/dist/bubbles/service-bubble/http.js +7 -1
  99. package/dist/bubbles/service-bubble/http.js.map +1 -1
  100. package/dist/bubbles/service-bubble/insforge-db.d.ts +140 -0
  101. package/dist/bubbles/service-bubble/insforge-db.d.ts.map +1 -0
  102. package/dist/bubbles/service-bubble/insforge-db.js +260 -0
  103. package/dist/bubbles/service-bubble/insforge-db.js.map +1 -0
  104. package/dist/bubbles/service-bubble/notion/index.d.ts +3 -0
  105. package/dist/bubbles/service-bubble/notion/index.d.ts.map +1 -0
  106. package/dist/bubbles/service-bubble/notion/index.js +3 -0
  107. package/dist/bubbles/service-bubble/notion/index.js.map +1 -0
  108. package/dist/bubbles/service-bubble/notion/notion.d.ts +35405 -0
  109. package/dist/bubbles/service-bubble/notion/notion.d.ts.map +1 -0
  110. package/dist/bubbles/service-bubble/notion/notion.js +1492 -0
  111. package/dist/bubbles/service-bubble/notion/notion.js.map +1 -0
  112. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +1148 -0
  113. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts.map +1 -0
  114. package/dist/bubbles/service-bubble/notion/property-schemas.js +341 -0
  115. package/dist/bubbles/service-bubble/notion/property-schemas.js.map +1 -0
  116. package/dist/bubbles/service-bubble/postgresql.d.ts +12 -12
  117. package/dist/bubbles/service-bubble/resend.d.ts +34 -13
  118. package/dist/bubbles/service-bubble/resend.d.ts.map +1 -1
  119. package/dist/bubbles/service-bubble/resend.js +133 -2
  120. package/dist/bubbles/service-bubble/resend.js.map +1 -1
  121. package/dist/bubbles/service-bubble/slack.d.ts +241 -241
  122. package/dist/bubbles/service-bubble/slack.d.ts.map +1 -1
  123. package/dist/bubbles/service-bubble/slack.js +2 -2
  124. package/dist/bubbles/service-bubble/slack.js.map +1 -1
  125. package/dist/bubbles/service-bubble/storage.d.ts +25 -21
  126. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
  127. package/dist/bubbles/service-bubble/storage.js +43 -2
  128. package/dist/bubbles/service-bubble/storage.js.map +1 -1
  129. package/dist/bubbles/service-bubble/telegram.d.ts +7742 -0
  130. package/dist/bubbles/service-bubble/telegram.d.ts.map +1 -0
  131. package/dist/bubbles/service-bubble/telegram.js +1132 -0
  132. package/dist/bubbles/service-bubble/telegram.js.map +1 -0
  133. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +76 -20
  134. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -1
  135. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +12 -0
  136. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -1
  137. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +14 -14
  138. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +188 -0
  139. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts.map +1 -0
  140. package/dist/bubbles/tool-bubble/code-edit-tool.js +321 -0
  141. package/dist/bubbles/tool-bubble/code-edit-tool.js.map +1 -0
  142. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +8 -4
  143. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -1
  144. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +115 -10
  145. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -1
  146. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +455 -0
  147. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts.map +1 -0
  148. package/dist/bubbles/tool-bubble/google-maps-tool.js +205 -0
  149. package/dist/bubbles/tool-bubble/google-maps-tool.js.map +1 -0
  150. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +36 -36
  151. package/dist/bubbles/tool-bubble/instagram-tool.d.ts.map +1 -1
  152. package/dist/bubbles/tool-bubble/instagram-tool.js +2 -2
  153. package/dist/bubbles/tool-bubble/instagram-tool.js.map +1 -1
  154. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +824 -447
  155. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts.map +1 -1
  156. package/dist/bubbles/tool-bubble/linkedin-tool.js +232 -12
  157. package/dist/bubbles/tool-bubble/linkedin-tool.js.map +1 -1
  158. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
  159. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +66 -66
  160. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +17 -16
  161. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -1
  162. package/dist/bubbles/tool-bubble/research-agent-tool.js +26 -16
  163. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
  164. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +8 -8
  165. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +485 -0
  166. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts.map +1 -0
  167. package/dist/bubbles/tool-bubble/tiktok-tool.js +226 -0
  168. package/dist/bubbles/tool-bubble/tiktok-tool.js.map +1 -0
  169. package/dist/bubbles/tool-bubble/tool-template.d.ts +8 -8
  170. package/dist/bubbles/tool-bubble/twitter-tool.d.ts +947 -0
  171. package/dist/bubbles/tool-bubble/twitter-tool.d.ts.map +1 -0
  172. package/dist/bubbles/tool-bubble/twitter-tool.js +494 -0
  173. package/dist/bubbles/tool-bubble/twitter-tool.js.map +1 -0
  174. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +22 -16
  175. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -1
  176. package/dist/bubbles/tool-bubble/web-crawl-tool.js +58 -59
  177. package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -1
  178. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +8 -8
  179. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -1
  180. package/dist/bubbles/tool-bubble/web-extract-tool.js +17 -17
  181. package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -1
  182. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +15 -107
  183. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -1
  184. package/dist/bubbles/tool-bubble/web-scrape-tool.js +51 -72
  185. package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -1
  186. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +20 -9
  187. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -1
  188. package/dist/bubbles/tool-bubble/web-search-tool.js +45 -35
  189. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -1
  190. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +25 -25
  191. package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -1
  192. package/dist/bubbles/tool-bubble/youtube-tool.js +5 -5
  193. package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -1
  194. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +4 -4
  195. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +30 -30
  196. package/dist/bubbles/workflow-bubble/generate-document.workflow.js +1 -1
  197. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +22 -22
  198. package/dist/bubbles/workflow-bubble/parse-document.workflow.js +1 -1
  199. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +54 -54
  200. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -1
  201. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +4 -4
  202. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -1
  203. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +36 -36
  204. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +1 -1
  205. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +14 -14
  206. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -1
  207. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +6 -6
  208. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -1
  209. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +26 -26
  210. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -1
  211. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +24 -4
  212. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -1
  213. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +19 -19
  214. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -1
  215. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +8 -8
  216. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -1
  217. package/dist/bubbles.json +220 -72
  218. package/dist/index.d.ts +23 -4
  219. package/dist/index.d.ts.map +1 -1
  220. package/dist/index.js +16 -3
  221. package/dist/index.js.map +1 -1
  222. package/dist/logging/BubbleLogger.d.ts +45 -16
  223. package/dist/logging/BubbleLogger.d.ts.map +1 -1
  224. package/dist/logging/BubbleLogger.js +178 -77
  225. package/dist/logging/BubbleLogger.js.map +1 -1
  226. package/dist/logging/StreamingBubbleLogger.d.ts +13 -1
  227. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
  228. package/dist/logging/StreamingBubbleLogger.js +51 -8
  229. package/dist/logging/StreamingBubbleLogger.js.map +1 -1
  230. package/dist/logging/WebhookStreamLogger.d.ts +66 -0
  231. package/dist/logging/WebhookStreamLogger.d.ts.map +1 -0
  232. package/dist/logging/WebhookStreamLogger.js +291 -0
  233. package/dist/logging/WebhookStreamLogger.js.map +1 -0
  234. package/dist/types/available-tools.d.ts +1 -1
  235. package/dist/types/available-tools.d.ts.map +1 -1
  236. package/dist/types/available-tools.js +1 -0
  237. package/dist/types/available-tools.js.map +1 -1
  238. package/dist/types/base-bubble-class.d.ts +6 -4
  239. package/dist/types/base-bubble-class.d.ts.map +1 -1
  240. package/dist/types/base-bubble-class.js +35 -20
  241. package/dist/types/base-bubble-class.js.map +1 -1
  242. package/dist/types/bubble.d.ts +2 -0
  243. package/dist/types/bubble.d.ts.map +1 -1
  244. package/dist/types/service-bubble-class.d.ts +1 -1
  245. package/dist/types/service-bubble-class.d.ts.map +1 -1
  246. package/dist/types/service-bubble-class.js +2 -2
  247. package/dist/types/service-bubble-class.js.map +1 -1
  248. package/dist/types/tool-bubble-class.d.ts +1 -1
  249. package/dist/types/tool-bubble-class.d.ts.map +1 -1
  250. package/dist/types/tool-bubble-class.js +2 -2
  251. package/dist/types/tool-bubble-class.js.map +1 -1
  252. package/dist/types/workflow-bubble-class.d.ts +1 -1
  253. package/dist/types/workflow-bubble-class.d.ts.map +1 -1
  254. package/dist/types/workflow-bubble-class.js +2 -2
  255. package/dist/types/workflow-bubble-class.js.map +1 -1
  256. package/dist/utils/agent-formatter.d.ts +14 -2
  257. package/dist/utils/agent-formatter.d.ts.map +1 -1
  258. package/dist/utils/agent-formatter.js +174 -26
  259. package/dist/utils/agent-formatter.js.map +1 -1
  260. package/dist/utils/bubbleflow-validation.d.ts +7 -0
  261. package/dist/utils/bubbleflow-validation.d.ts.map +1 -1
  262. package/dist/utils/bubbleflow-validation.js +171 -6
  263. package/dist/utils/bubbleflow-validation.js.map +1 -1
  264. package/dist/utils/json-parsing.d.ts.map +1 -1
  265. package/dist/utils/json-parsing.js +146 -0
  266. package/dist/utils/json-parsing.js.map +1 -1
  267. package/dist/utils/safe-gemini-chat.d.ts +31 -0
  268. package/dist/utils/safe-gemini-chat.d.ts.map +1 -0
  269. package/dist/utils/safe-gemini-chat.js +93 -0
  270. package/dist/utils/safe-gemini-chat.js.map +1 -0
  271. package/dist/utils/schema-comparison.d.ts +92 -0
  272. package/dist/utils/schema-comparison.d.ts.map +1 -0
  273. package/dist/utils/schema-comparison.js +716 -0
  274. package/dist/utils/schema-comparison.js.map +1 -0
  275. package/dist/utils/zod-schema.d.ts +24 -0
  276. package/dist/utils/zod-schema.d.ts.map +1 -0
  277. package/dist/utils/zod-schema.js +56 -0
  278. package/dist/utils/zod-schema.js.map +1 -0
  279. package/package.json +5 -4
  280. package/dist/bubbles/service-bubble/google-sheets.d.ts +0 -1811
  281. package/dist/bubbles/service-bubble/google-sheets.d.ts.map +0 -1
  282. package/dist/bubbles/service-bubble/google-sheets.js.map +0 -1
  283. package/dist/bubbles/service-bubble/x-twitter.d.ts +0 -814
  284. package/dist/bubbles/service-bubble/x-twitter.d.ts.map +0 -1
  285. package/dist/bubbles/service-bubble/x-twitter.js +0 -445
  286. package/dist/bubbles/service-bubble/x-twitter.js.map +0 -1
  287. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +0 -125
  288. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +0 -1
  289. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +0 -808
  290. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +0 -1
  291. package/dist/test-gm.d.ts +0 -10
  292. package/dist/test-gm.d.ts.map +0 -1
  293. package/dist/test-gm.js +0 -95
  294. package/dist/test-gm.js.map +0 -1
  295. package/dist/utils/param-helper.d.ts +0 -2
  296. package/dist/utils/param-helper.d.ts.map +0 -1
  297. package/dist/utils/param-helper.js +0 -5
  298. package/dist/utils/param-helper.js.map +0 -1
@@ -0,0 +1,730 @@
1
+ import { z } from 'zod';
2
+ import { ServiceBubble } from '../../types/service-bubble-class.js';
3
+ import { CredentialType } from '@bubblelab/shared-schemas';
4
+ // AGI Agent API base URL
5
+ const AGI_API_BASE = 'https://api.agi.tech/v1';
6
+ // Session status enum
7
+ const SessionStatus = z.enum([
8
+ 'initializing',
9
+ 'ready',
10
+ 'running',
11
+ 'paused',
12
+ 'completed',
13
+ 'error',
14
+ 'terminated',
15
+ ]);
16
+ // Execution status enum
17
+ const ExecutionStatus = z.enum([
18
+ 'running',
19
+ 'waiting_for_input',
20
+ 'finished',
21
+ 'error',
22
+ ]);
23
+ // Agent model names
24
+ const AgentModel = z
25
+ .enum(['agi-0', 'agi-0-fast'])
26
+ .describe('Agent model to use: agi-0 (full-featured) or agi-0-fast (faster)');
27
+ // Snapshot mode enum
28
+ const SnapshotMode = z
29
+ .enum(['none', 'memory', 'filesystem'])
30
+ .describe('Snapshot mode: none (no snapshot), memory (faster), filesystem (more reliable)');
31
+ // Message schema
32
+ const AGIMessageSchema = z.object({
33
+ id: z.number().describe('Unique message ID'),
34
+ type: z
35
+ .enum(['THOUGHT', 'QUESTION', 'USER', 'DONE', 'ERROR', 'LOG'])
36
+ .describe('Message type'),
37
+ content: z
38
+ .union([z.string(), z.record(z.unknown())])
39
+ .describe('Message content'),
40
+ timestamp: z.string().describe('ISO 8601 timestamp'),
41
+ metadata: z.record(z.unknown()).optional().describe('Additional metadata'),
42
+ });
43
+ // Session schema
44
+ const AGISessionSchema = z.object({
45
+ session_id: z.string().uuid().describe('Unique session identifier'),
46
+ vnc_url: z.string().optional().describe('URL to view the browser'),
47
+ agent_name: z.string().describe('Agent model being used'),
48
+ status: SessionStatus.describe('Current session status'),
49
+ created_at: z.string().describe('ISO 8601 creation timestamp'),
50
+ });
51
+ // Define the parameters schema for different AGI operations
52
+ const AGIIncParamsSchema = z.discriminatedUnion('operation', [
53
+ // Create session operation
54
+ z.object({
55
+ operation: z
56
+ .literal('create_session')
57
+ .describe('Create a new agent session with a browser environment'),
58
+ agent_name: AgentModel.optional()
59
+ .default('agi-0')
60
+ .describe('Agent model to use'),
61
+ webhook_url: z
62
+ .string()
63
+ .url()
64
+ .optional()
65
+ .describe('URL to receive webhook notifications for session events'),
66
+ restore_from_session_id: z
67
+ .string()
68
+ .uuid()
69
+ .optional()
70
+ .describe('Restore session from a specific session snapshot'),
71
+ restore_default_environment_from_user_id: z
72
+ .string()
73
+ .optional()
74
+ .describe('Restore from user default environment snapshot'),
75
+ enable_memory_snapshot: z
76
+ .boolean()
77
+ .optional()
78
+ .default(true)
79
+ .describe('Enable memory snapshots for faster restoration'),
80
+ credentials: z
81
+ .record(z.nativeEnum(CredentialType), z.string())
82
+ .optional()
83
+ .describe('Object mapping credential types to values (injected at runtime)'),
84
+ }),
85
+ // List sessions operation
86
+ z.object({
87
+ operation: z
88
+ .literal('list_sessions')
89
+ .describe('Get all sessions for the authenticated user'),
90
+ credentials: z
91
+ .record(z.nativeEnum(CredentialType), z.string())
92
+ .optional()
93
+ .describe('Object mapping credential types to values (injected at runtime)'),
94
+ }),
95
+ // Get session operation
96
+ z.object({
97
+ operation: z
98
+ .literal('get_session')
99
+ .describe('Get details for a specific session'),
100
+ session_id: z
101
+ .string()
102
+ .uuid()
103
+ .min(1, 'Session ID is required')
104
+ .describe('The UUID of the session to retrieve'),
105
+ credentials: z
106
+ .record(z.nativeEnum(CredentialType), z.string())
107
+ .optional()
108
+ .describe('Object mapping credential types to values (injected at runtime)'),
109
+ }),
110
+ // Delete session operation
111
+ z.object({
112
+ operation: z
113
+ .literal('delete_session')
114
+ .describe('Delete a specific session and cleanup resources'),
115
+ session_id: z
116
+ .string()
117
+ .uuid()
118
+ .min(1, 'Session ID is required')
119
+ .describe('The UUID of the session to delete'),
120
+ save_snapshot_mode: SnapshotMode.optional()
121
+ .default('none')
122
+ .describe('Snapshot mode when deleting'),
123
+ save_as_default: z
124
+ .boolean()
125
+ .optional()
126
+ .default(false)
127
+ .describe('Set snapshot as user default environment'),
128
+ credentials: z
129
+ .record(z.nativeEnum(CredentialType), z.string())
130
+ .optional()
131
+ .describe('Object mapping credential types to values (injected at runtime)'),
132
+ }),
133
+ // Delete all sessions operation
134
+ z.object({
135
+ operation: z
136
+ .literal('delete_all_sessions')
137
+ .describe('Delete all sessions for the authenticated user'),
138
+ credentials: z
139
+ .record(z.nativeEnum(CredentialType), z.string())
140
+ .optional()
141
+ .describe('Object mapping credential types to values (injected at runtime)'),
142
+ }),
143
+ // Send message operation
144
+ z.object({
145
+ operation: z
146
+ .literal('send_message')
147
+ .describe('Send a message to the agent to start a task or respond'),
148
+ session_id: z
149
+ .string()
150
+ .uuid()
151
+ .min(1, 'Session ID is required')
152
+ .describe('The UUID of the session'),
153
+ message: z
154
+ .string()
155
+ .min(1, 'Message is required')
156
+ .max(10000, 'Message too long')
157
+ .describe('The message text to send to the agent'),
158
+ start_url: z
159
+ .string()
160
+ .url()
161
+ .optional()
162
+ .describe('Optional starting URL for the agent to navigate to'),
163
+ credentials: z
164
+ .record(z.nativeEnum(CredentialType), z.string())
165
+ .optional()
166
+ .describe('Object mapping credential types to values (injected at runtime)'),
167
+ }),
168
+ // Get execution status operation
169
+ z.object({
170
+ operation: z
171
+ .literal('get_status')
172
+ .describe('Get the current execution status of a session'),
173
+ session_id: z
174
+ .string()
175
+ .uuid()
176
+ .min(1, 'Session ID is required')
177
+ .describe('The UUID of the session'),
178
+ credentials: z
179
+ .record(z.nativeEnum(CredentialType), z.string())
180
+ .optional()
181
+ .describe('Object mapping credential types to values (injected at runtime)'),
182
+ }),
183
+ // Get messages operation
184
+ z.object({
185
+ operation: z
186
+ .literal('get_messages')
187
+ .describe('Poll for messages and updates from the agent'),
188
+ session_id: z
189
+ .string()
190
+ .uuid()
191
+ .min(1, 'Session ID is required')
192
+ .describe('The UUID of the session'),
193
+ after_id: z
194
+ .number()
195
+ .int()
196
+ .min(0)
197
+ .optional()
198
+ .default(0)
199
+ .describe('Return only messages with ID greater than this value'),
200
+ sanitize: z
201
+ .boolean()
202
+ .optional()
203
+ .default(true)
204
+ .describe('Filter out system messages and internal prompts'),
205
+ credentials: z
206
+ .record(z.nativeEnum(CredentialType), z.string())
207
+ .optional()
208
+ .describe('Object mapping credential types to values (injected at runtime)'),
209
+ }),
210
+ // Pause session operation
211
+ z.object({
212
+ operation: z
213
+ .literal('pause_session')
214
+ .describe('Temporarily pause task execution'),
215
+ session_id: z
216
+ .string()
217
+ .uuid()
218
+ .min(1, 'Session ID is required')
219
+ .describe('The UUID of the session to pause'),
220
+ credentials: z
221
+ .record(z.nativeEnum(CredentialType), z.string())
222
+ .optional()
223
+ .describe('Object mapping credential types to values (injected at runtime)'),
224
+ }),
225
+ // Resume session operation
226
+ z.object({
227
+ operation: z.literal('resume_session').describe('Resume a paused task'),
228
+ session_id: z
229
+ .string()
230
+ .uuid()
231
+ .min(1, 'Session ID is required')
232
+ .describe('The UUID of the session to resume'),
233
+ credentials: z
234
+ .record(z.nativeEnum(CredentialType), z.string())
235
+ .optional()
236
+ .describe('Object mapping credential types to values (injected at runtime)'),
237
+ }),
238
+ // Cancel session operation
239
+ z.object({
240
+ operation: z
241
+ .literal('cancel_session')
242
+ .describe('Cancel the current task execution'),
243
+ session_id: z
244
+ .string()
245
+ .uuid()
246
+ .min(1, 'Session ID is required')
247
+ .describe('The UUID of the session to cancel'),
248
+ credentials: z
249
+ .record(z.nativeEnum(CredentialType), z.string())
250
+ .optional()
251
+ .describe('Object mapping credential types to values (injected at runtime)'),
252
+ }),
253
+ // Navigate browser operation
254
+ z.object({
255
+ operation: z
256
+ .literal('navigate')
257
+ .describe('Navigate the browser to a specific URL'),
258
+ session_id: z
259
+ .string()
260
+ .uuid()
261
+ .min(1, 'Session ID is required')
262
+ .describe('The UUID of the session'),
263
+ url: z
264
+ .string()
265
+ .url()
266
+ .min(1, 'URL is required')
267
+ .max(2000, 'URL too long')
268
+ .describe('Absolute URL to navigate to'),
269
+ credentials: z
270
+ .record(z.nativeEnum(CredentialType), z.string())
271
+ .optional()
272
+ .describe('Object mapping credential types to values (injected at runtime)'),
273
+ }),
274
+ // Get screenshot operation
275
+ z.object({
276
+ operation: z
277
+ .literal('get_screenshot')
278
+ .describe('Capture a screenshot of the current browser state'),
279
+ session_id: z
280
+ .string()
281
+ .uuid()
282
+ .min(1, 'Session ID is required')
283
+ .describe('The UUID of the session'),
284
+ credentials: z
285
+ .record(z.nativeEnum(CredentialType), z.string())
286
+ .optional()
287
+ .describe('Object mapping credential types to values (injected at runtime)'),
288
+ }),
289
+ ]);
290
+ // Define result schemas for different operations
291
+ const AGIIncResultSchema = z.discriminatedUnion('operation', [
292
+ // Create session result
293
+ z.object({
294
+ operation: z.literal('create_session'),
295
+ ok: z.boolean().describe('Whether the API call was successful'),
296
+ session_id: z.string().uuid().optional().describe('Created session ID'),
297
+ vnc_url: z.string().optional().describe('URL to view the browser'),
298
+ agent_name: z.string().optional().describe('Agent model being used'),
299
+ status: SessionStatus.optional().describe('Session status'),
300
+ created_at: z.string().optional().describe('Creation timestamp'),
301
+ error: z.string().describe('Error message if operation failed'),
302
+ success: z.boolean().describe('Whether the operation was successful'),
303
+ }),
304
+ // List sessions result
305
+ z.object({
306
+ operation: z.literal('list_sessions'),
307
+ ok: z.boolean().describe('Whether the API call was successful'),
308
+ sessions: z
309
+ .array(AGISessionSchema)
310
+ .optional()
311
+ .describe('Array of sessions'),
312
+ error: z.string().describe('Error message if operation failed'),
313
+ success: z.boolean().describe('Whether the operation was successful'),
314
+ }),
315
+ // Get session result
316
+ z.object({
317
+ operation: z.literal('get_session'),
318
+ ok: z.boolean().describe('Whether the API call was successful'),
319
+ session: AGISessionSchema.optional().describe('Session details'),
320
+ error: z.string().describe('Error message if operation failed'),
321
+ success: z.boolean().describe('Whether the operation was successful'),
322
+ }),
323
+ // Delete session result
324
+ z.object({
325
+ operation: z.literal('delete_session'),
326
+ ok: z.boolean().describe('Whether the API call was successful'),
327
+ deleted: z.boolean().optional().describe('Whether session was deleted'),
328
+ message: z.string().optional().describe('Result message'),
329
+ error: z.string().describe('Error message if operation failed'),
330
+ success: z.boolean().describe('Whether the operation was successful'),
331
+ }),
332
+ // Delete all sessions result
333
+ z.object({
334
+ operation: z.literal('delete_all_sessions'),
335
+ ok: z.boolean().describe('Whether the API call was successful'),
336
+ deleted: z.boolean().optional().describe('Whether sessions were deleted'),
337
+ message: z.string().optional().describe('Result message'),
338
+ error: z.string().describe('Error message if operation failed'),
339
+ success: z.boolean().describe('Whether the operation was successful'),
340
+ }),
341
+ // Send message result
342
+ z.object({
343
+ operation: z.literal('send_message'),
344
+ ok: z.boolean().describe('Whether the API call was successful'),
345
+ message: z.string().optional().describe('Confirmation message'),
346
+ error: z.string().describe('Error message if operation failed'),
347
+ success: z.boolean().describe('Whether the operation was successful'),
348
+ }),
349
+ // Get status result
350
+ z.object({
351
+ operation: z.literal('get_status'),
352
+ ok: z.boolean().describe('Whether the API call was successful'),
353
+ status: ExecutionStatus.optional().describe('Current execution status'),
354
+ error: z.string().describe('Error message if operation failed'),
355
+ success: z.boolean().describe('Whether the operation was successful'),
356
+ }),
357
+ // Get messages result
358
+ z.object({
359
+ operation: z.literal('get_messages'),
360
+ ok: z.boolean().describe('Whether the API call was successful'),
361
+ messages: z
362
+ .array(AGIMessageSchema)
363
+ .optional()
364
+ .describe('Array of messages'),
365
+ status: ExecutionStatus.optional().describe('Current execution status'),
366
+ has_agent: z.boolean().optional().describe('Whether agent is connected'),
367
+ error: z.string().describe('Error message if operation failed'),
368
+ success: z.boolean().describe('Whether the operation was successful'),
369
+ }),
370
+ // Pause session result
371
+ z.object({
372
+ operation: z.literal('pause_session'),
373
+ ok: z.boolean().describe('Whether the API call was successful'),
374
+ message: z.string().optional().describe('Result message'),
375
+ error: z.string().describe('Error message if operation failed'),
376
+ success: z.boolean().describe('Whether the operation was successful'),
377
+ }),
378
+ // Resume session result
379
+ z.object({
380
+ operation: z.literal('resume_session'),
381
+ ok: z.boolean().describe('Whether the API call was successful'),
382
+ message: z.string().optional().describe('Result message'),
383
+ error: z.string().describe('Error message if operation failed'),
384
+ success: z.boolean().describe('Whether the operation was successful'),
385
+ }),
386
+ // Cancel session result
387
+ z.object({
388
+ operation: z.literal('cancel_session'),
389
+ ok: z.boolean().describe('Whether the API call was successful'),
390
+ message: z.string().optional().describe('Result message'),
391
+ error: z.string().describe('Error message if operation failed'),
392
+ success: z.boolean().describe('Whether the operation was successful'),
393
+ }),
394
+ // Navigate result
395
+ z.object({
396
+ operation: z.literal('navigate'),
397
+ ok: z.boolean().describe('Whether the API call was successful'),
398
+ current_url: z.string().optional().describe('Current URL after navigation'),
399
+ error: z.string().describe('Error message if operation failed'),
400
+ success: z.boolean().describe('Whether the operation was successful'),
401
+ }),
402
+ // Get screenshot result
403
+ z.object({
404
+ operation: z.literal('get_screenshot'),
405
+ ok: z.boolean().describe('Whether the API call was successful'),
406
+ screenshot: z
407
+ .string()
408
+ .optional()
409
+ .describe('Base64-encoded JPEG image as data URL'),
410
+ url: z.string().optional().describe('Current page URL'),
411
+ title: z.string().optional().describe('Current page title'),
412
+ error: z.string().describe('Error message if operation failed'),
413
+ success: z.boolean().describe('Whether the operation was successful'),
414
+ }),
415
+ ]);
416
+ export class AGIIncBubble extends ServiceBubble {
417
+ async testCredential() {
418
+ // Make a test API call to list sessions
419
+ try {
420
+ const response = await this.makeAGIApiCall('sessions', {}, 'GET');
421
+ return Array.isArray(response);
422
+ }
423
+ catch {
424
+ return false;
425
+ }
426
+ }
427
+ static type = 'service';
428
+ static service = 'agi-inc';
429
+ static authType = 'apikey';
430
+ static bubbleName = 'agi-inc';
431
+ static schema = AGIIncParamsSchema;
432
+ static resultSchema = AGIIncResultSchema;
433
+ static shortDescription = 'AGI Agent integration for browser automation and task execution';
434
+ static longDescription = `
435
+ AGI Agent Sessions API integration for creating browser agents that can perform tasks autonomously.
436
+ Use cases:
437
+ - Internet research and data extraction
438
+ - Form filling and web automation
439
+ - Making purchases with guest checkout
440
+ - General web automation tasks
441
+
442
+ Features:
443
+ - Create and manage browser sessions
444
+ - Send tasks and monitor progress
445
+ - Control execution (pause, resume, cancel)
446
+ - Capture screenshots
447
+ - Webhook support for real-time updates
448
+
449
+ Security Features:
450
+ - Bearer token authentication
451
+ - Rate limiting protection
452
+ - Session isolation
453
+ - Comprehensive error handling
454
+ `;
455
+ static alias = 'agi-inc';
456
+ constructor(params = {
457
+ operation: 'list_sessions',
458
+ }, context, instanceId) {
459
+ super(params, context, instanceId);
460
+ }
461
+ async performAction(context) {
462
+ void context;
463
+ const { operation } = this.params;
464
+ try {
465
+ const result = await (async () => {
466
+ switch (operation) {
467
+ case 'create_session':
468
+ return await this.createSession(this.params);
469
+ case 'list_sessions':
470
+ return await this.listSessions();
471
+ case 'get_session':
472
+ return await this.getSession(this.params);
473
+ case 'delete_session':
474
+ return await this.deleteSession(this.params);
475
+ case 'delete_all_sessions':
476
+ return await this.deleteAllSessions();
477
+ case 'send_message':
478
+ return await this.sendMessage(this.params);
479
+ case 'get_status':
480
+ return await this.getStatus(this.params);
481
+ case 'get_messages':
482
+ return await this.getMessages(this.params);
483
+ case 'pause_session':
484
+ return await this.pauseSession(this.params);
485
+ case 'resume_session':
486
+ return await this.resumeSession(this.params);
487
+ case 'cancel_session':
488
+ return await this.cancelSession(this.params);
489
+ case 'navigate':
490
+ return await this.navigate(this.params);
491
+ case 'get_screenshot':
492
+ return await this.getScreenshot(this.params);
493
+ default:
494
+ throw new Error(`Unsupported operation: ${operation}`);
495
+ }
496
+ })();
497
+ return result;
498
+ }
499
+ catch (error) {
500
+ const failedOperation = this.params.operation;
501
+ return {
502
+ success: false,
503
+ ok: false,
504
+ operation: failedOperation,
505
+ error: error instanceof Error
506
+ ? error.message
507
+ : 'Unknown error occurred in AGIIncBubble',
508
+ };
509
+ }
510
+ }
511
+ async createSession(params) {
512
+ const parsed = AGIIncParamsSchema.parse(params);
513
+ const { agent_name, webhook_url, restore_from_session_id, restore_default_environment_from_user_id, enable_memory_snapshot, } = parsed;
514
+ const body = {
515
+ agent_name,
516
+ };
517
+ if (webhook_url)
518
+ body.webhook_url = webhook_url;
519
+ if (restore_from_session_id)
520
+ body.restore_from_session_id = restore_from_session_id;
521
+ if (restore_default_environment_from_user_id)
522
+ body.restore_default_environment_from_user_id =
523
+ restore_default_environment_from_user_id;
524
+ if (enable_memory_snapshot !== undefined)
525
+ body.enable_memory_snapshot = enable_memory_snapshot;
526
+ const response = await this.makeAGIApiCall('sessions', body, 'POST');
527
+ return {
528
+ operation: 'create_session',
529
+ ok: true,
530
+ session_id: response.session_id,
531
+ vnc_url: response.vnc_url,
532
+ agent_name: response.agent_name,
533
+ status: response.status,
534
+ created_at: response.created_at,
535
+ error: '',
536
+ success: true,
537
+ };
538
+ }
539
+ async listSessions() {
540
+ const response = await this.makeAGIApiCall('sessions', {}, 'GET');
541
+ return {
542
+ operation: 'list_sessions',
543
+ ok: true,
544
+ sessions: Array.isArray(response)
545
+ ? z.array(AGISessionSchema).parse(response)
546
+ : undefined,
547
+ error: '',
548
+ success: true,
549
+ };
550
+ }
551
+ async getSession(params) {
552
+ const { session_id } = params;
553
+ const response = await this.makeAGIApiCall(`sessions/${session_id}`, {}, 'GET');
554
+ return {
555
+ operation: 'get_session',
556
+ ok: true,
557
+ session: AGISessionSchema.parse(response),
558
+ error: '',
559
+ success: true,
560
+ };
561
+ }
562
+ async deleteSession(params) {
563
+ const parsed = AGIIncParamsSchema.parse(params);
564
+ const { session_id, save_snapshot_mode, save_as_default } = parsed;
565
+ const queryParams = [];
566
+ if (save_snapshot_mode && save_snapshot_mode !== 'none') {
567
+ queryParams.push(`save_snapshot_mode=${save_snapshot_mode}`);
568
+ }
569
+ if (save_as_default) {
570
+ queryParams.push(`save_as_default=true`);
571
+ }
572
+ const endpoint = queryParams.length > 0
573
+ ? `sessions/${session_id}?${queryParams.join('&')}`
574
+ : `sessions/${session_id}`;
575
+ const response = await this.makeAGIApiCall(endpoint, {}, 'DELETE');
576
+ return {
577
+ operation: 'delete_session',
578
+ ok: true,
579
+ deleted: response.deleted,
580
+ message: response.message,
581
+ error: '',
582
+ success: true,
583
+ };
584
+ }
585
+ async deleteAllSessions() {
586
+ const response = await this.makeAGIApiCall('sessions', {}, 'DELETE');
587
+ return {
588
+ operation: 'delete_all_sessions',
589
+ ok: true,
590
+ deleted: response.deleted,
591
+ message: response.message,
592
+ error: '',
593
+ success: true,
594
+ };
595
+ }
596
+ async sendMessage(params) {
597
+ const { session_id, message, start_url } = params;
598
+ const body = { message };
599
+ if (start_url)
600
+ body.start_url = start_url;
601
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/message`, body, 'POST');
602
+ return {
603
+ operation: 'send_message',
604
+ ok: true,
605
+ message: response.message,
606
+ error: '',
607
+ success: true,
608
+ };
609
+ }
610
+ async getStatus(params) {
611
+ const { session_id } = params;
612
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/status`, {}, 'GET');
613
+ return {
614
+ operation: 'get_status',
615
+ ok: true,
616
+ status: response.status,
617
+ error: '',
618
+ success: true,
619
+ };
620
+ }
621
+ async getMessages(params) {
622
+ const parsed = AGIIncParamsSchema.parse(params);
623
+ const { session_id, after_id, sanitize } = parsed;
624
+ const queryParams = new URLSearchParams();
625
+ queryParams.set('after_id', after_id.toString());
626
+ queryParams.set('sanitize', sanitize.toString());
627
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/messages?${queryParams.toString()}`, {}, 'GET');
628
+ return {
629
+ operation: 'get_messages',
630
+ ok: true,
631
+ messages: response.messages
632
+ ? z.array(AGIMessageSchema).parse(response.messages)
633
+ : undefined,
634
+ status: response.status,
635
+ has_agent: response.has_agent,
636
+ error: '',
637
+ success: true,
638
+ };
639
+ }
640
+ async pauseSession(params) {
641
+ const { session_id } = params;
642
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/pause`, {}, 'POST');
643
+ return {
644
+ operation: 'pause_session',
645
+ ok: true,
646
+ message: response.message,
647
+ error: '',
648
+ success: true,
649
+ };
650
+ }
651
+ async resumeSession(params) {
652
+ const { session_id } = params;
653
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/resume`, {}, 'POST');
654
+ return {
655
+ operation: 'resume_session',
656
+ ok: true,
657
+ message: response.message,
658
+ error: '',
659
+ success: true,
660
+ };
661
+ }
662
+ async cancelSession(params) {
663
+ const { session_id } = params;
664
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/cancel`, {}, 'POST');
665
+ return {
666
+ operation: 'cancel_session',
667
+ ok: true,
668
+ message: response.message,
669
+ error: '',
670
+ success: true,
671
+ };
672
+ }
673
+ async navigate(params) {
674
+ const { session_id, url } = params;
675
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/navigate`, { url }, 'POST');
676
+ return {
677
+ operation: 'navigate',
678
+ ok: true,
679
+ current_url: response.current_url,
680
+ error: '',
681
+ success: true,
682
+ };
683
+ }
684
+ async getScreenshot(params) {
685
+ const { session_id } = params;
686
+ const response = await this.makeAGIApiCall(`sessions/${session_id}/screenshot`, {}, 'GET');
687
+ return {
688
+ operation: 'get_screenshot',
689
+ ok: true,
690
+ screenshot: response.screenshot,
691
+ url: response.url,
692
+ title: response.title,
693
+ error: '',
694
+ success: true,
695
+ };
696
+ }
697
+ chooseCredential() {
698
+ const { credentials } = this.params;
699
+ if (!credentials || typeof credentials !== 'object') {
700
+ throw new Error('No AGI API credentials provided');
701
+ }
702
+ return credentials[CredentialType.AGI_API_KEY];
703
+ }
704
+ async makeAGIApiCall(endpoint, body, method = 'POST') {
705
+ const url = `${AGI_API_BASE}/${endpoint}`;
706
+ const authToken = this.chooseCredential();
707
+ if (!authToken) {
708
+ throw new Error('AGI API key is required but was not provided');
709
+ }
710
+ const headers = {
711
+ Authorization: `Bearer ${authToken}`,
712
+ 'Content-Type': 'application/json',
713
+ };
714
+ const fetchConfig = {
715
+ method,
716
+ headers,
717
+ };
718
+ if (method !== 'GET' && Object.keys(body).length > 0) {
719
+ fetchConfig.body = JSON.stringify(body);
720
+ }
721
+ const response = await fetch(url, fetchConfig);
722
+ const data = await response.json();
723
+ if (!response.ok) {
724
+ const errorData = data;
725
+ throw new Error(`AGI API error: ${errorData.error || errorData.message || `HTTP ${response.status}`}`);
726
+ }
727
+ return data;
728
+ }
729
+ }
730
+ //# sourceMappingURL=agi-inc.js.map