@bubblelab/bubble-core 0.1.9 → 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 (355) hide show
  1. package/dist/bubble-bundle.d.ts +633 -1658
  2. package/dist/bubble-factory.d.ts.map +1 -1
  3. package/dist/bubble-factory.js +165 -43
  4. package/dist/bubble-factory.js.map +1 -1
  5. package/dist/bubble-flow/bubble-flow-class.d.ts +22 -1
  6. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -1
  7. package/dist/bubble-flow/bubble-flow-class.js +36 -0
  8. package/dist/bubble-flow/bubble-flow-class.js.map +1 -1
  9. package/dist/bubble-flow/sample/data-analyst-flow.d.ts +1 -1
  10. package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -1
  11. package/dist/bubble-flow/sample/error-ts.d.ts +1 -1
  12. package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -1
  13. package/dist/bubble-flow/sample/sanitytest.d.ts +1 -1
  14. package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -1
  15. package/dist/bubble-flow/sample/simple-webhook-2.d.ts +1 -1
  16. package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -1
  17. package/dist/bubble-flow/sample/simple-webhook.d.ts +1 -1
  18. package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -1
  19. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +1 -1
  20. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -1
  21. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +6 -3
  22. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -1
  23. package/dist/bubble-flow/sample/slack-v0.1.d.ts +1 -1
  24. package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -1
  25. package/dist/bubble-flow/sample/slackagenttest.d.ts +1 -1
  26. package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -1
  27. package/dist/bubbles/service-bubble/agi-inc.d.ts +1121 -0
  28. package/dist/bubbles/service-bubble/agi-inc.d.ts.map +1 -0
  29. package/dist/bubbles/service-bubble/agi-inc.js +730 -0
  30. package/dist/bubbles/service-bubble/agi-inc.js.map +1 -0
  31. package/dist/bubbles/service-bubble/ai-agent.d.ts +297 -85
  32. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -1
  33. package/dist/bubbles/service-bubble/ai-agent.js +535 -399
  34. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -1
  35. package/dist/bubbles/service-bubble/airtable.d.ts +1753 -0
  36. package/dist/bubbles/service-bubble/airtable.d.ts.map +1 -0
  37. package/dist/bubbles/service-bubble/airtable.js +1173 -0
  38. package/dist/bubbles/service-bubble/airtable.js.map +1 -0
  39. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts +240 -0
  40. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.d.ts.map +1 -0
  41. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js +119 -0
  42. package/dist/bubbles/service-bubble/apify/actors/google-maps-scraper.js.map +1 -0
  43. package/dist/bubbles/service-bubble/apify/actors/instagram-hashtag-scraper.d.ts +38 -38
  44. package/dist/bubbles/service-bubble/apify/actors/instagram-scraper.d.ts +56 -56
  45. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts +137 -0
  46. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.d.ts.map +1 -0
  47. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js +81 -0
  48. package/dist/bubbles/service-bubble/apify/actors/linkedin-jobs-scraper.js.map +1 -0
  49. package/dist/bubbles/service-bubble/apify/actors/linkedin-posts-search.d.ts +27 -27
  50. package/dist/bubbles/service-bubble/apify/actors/linkedin-profile-posts.d.ts +38 -38
  51. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts +488 -0
  52. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.d.ts.map +1 -0
  53. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js +463 -0
  54. package/dist/bubbles/service-bubble/apify/actors/tiktok-scraper.js.map +1 -0
  55. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts +262 -0
  56. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.d.ts.map +1 -0
  57. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js +291 -0
  58. package/dist/bubbles/service-bubble/apify/actors/twitter-scraper.js.map +1 -0
  59. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts +184 -0
  60. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.d.ts.map +1 -0
  61. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js +145 -0
  62. package/dist/bubbles/service-bubble/apify/actors/youtube-scraper.js.map +1 -0
  63. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts +52 -0
  64. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.d.ts.map +1 -0
  65. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js +29 -0
  66. package/dist/bubbles/service-bubble/apify/actors/youtube-transcript-scraper.js.map +1 -0
  67. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts +1483 -123
  68. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.d.ts.map +1 -1
  69. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js +48 -0
  70. package/dist/bubbles/service-bubble/apify/apify-scraper.schema.js.map +1 -1
  71. package/dist/bubbles/service-bubble/apify/apify.d.ts +156 -11
  72. package/dist/bubbles/service-bubble/apify/apify.d.ts.map +1 -1
  73. package/dist/bubbles/service-bubble/apify/apify.js +205 -32
  74. package/dist/bubbles/service-bubble/apify/apify.js.map +1 -1
  75. package/dist/bubbles/service-bubble/apify/index.d.ts +2 -0
  76. package/dist/bubbles/service-bubble/apify/index.d.ts.map +1 -1
  77. package/dist/bubbles/service-bubble/apify/index.js +3 -0
  78. package/dist/bubbles/service-bubble/apify/index.js.map +1 -1
  79. package/dist/bubbles/service-bubble/apify/types.js +1 -2
  80. package/dist/bubbles/service-bubble/apify/types.js.map +1 -1
  81. package/dist/bubbles/service-bubble/eleven-labs.d.ts +421 -0
  82. package/dist/bubbles/service-bubble/eleven-labs.d.ts.map +1 -0
  83. package/dist/bubbles/service-bubble/eleven-labs.js +479 -0
  84. package/dist/bubbles/service-bubble/eleven-labs.js.map +1 -0
  85. package/dist/bubbles/service-bubble/firecrawl.d.ts +37748 -0
  86. package/dist/bubbles/service-bubble/firecrawl.d.ts.map +1 -0
  87. package/dist/bubbles/service-bubble/firecrawl.js +1489 -0
  88. package/dist/bubbles/service-bubble/firecrawl.js.map +1 -0
  89. package/dist/bubbles/service-bubble/followupboss.d.ts +6822 -0
  90. package/dist/bubbles/service-bubble/followupboss.d.ts.map +1 -0
  91. package/dist/bubbles/service-bubble/followupboss.js +1394 -0
  92. package/dist/bubbles/service-bubble/followupboss.js.map +1 -0
  93. package/dist/bubbles/service-bubble/github.d.ts +2399 -0
  94. package/dist/bubbles/service-bubble/github.d.ts.map +1 -0
  95. package/dist/bubbles/service-bubble/github.js +1052 -0
  96. package/dist/bubbles/service-bubble/github.js.map +1 -0
  97. package/dist/bubbles/service-bubble/gmail.d.ts +726 -232
  98. package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -1
  99. package/dist/bubbles/service-bubble/gmail.js +435 -7
  100. package/dist/bubbles/service-bubble/gmail.js.map +1 -1
  101. package/dist/bubbles/service-bubble/google-calendar.d.ts +8 -8
  102. package/dist/bubbles/service-bubble/google-drive.d.ts +270 -40
  103. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -1
  104. package/dist/bubbles/service-bubble/google-drive.js +100 -78
  105. package/dist/bubbles/service-bubble/google-drive.js.map +1 -1
  106. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts +943 -0
  107. package/dist/bubbles/service-bubble/google-sheets/google-sheets.d.ts.map +1 -0
  108. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts +31 -0
  109. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.d.ts.map +1 -0
  110. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js +184 -0
  111. package/dist/bubbles/service-bubble/google-sheets/google-sheets.integration.flow.js.map +1 -0
  112. package/dist/bubbles/service-bubble/google-sheets/google-sheets.js +401 -0
  113. package/dist/bubbles/service-bubble/google-sheets/google-sheets.js.map +1 -0
  114. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts +1024 -0
  115. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.d.ts.map +1 -0
  116. package/dist/bubbles/service-bubble/{google-sheets.js → google-sheets/google-sheets.schema.js} +45 -409
  117. package/dist/bubbles/service-bubble/google-sheets/google-sheets.schema.js.map +1 -0
  118. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts +38 -0
  119. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.d.ts.map +1 -0
  120. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js +183 -0
  121. package/dist/bubbles/service-bubble/google-sheets/google-sheets.utils.js.map +1 -0
  122. package/dist/bubbles/service-bubble/google-sheets/index.d.ts +4 -0
  123. package/dist/bubbles/service-bubble/google-sheets/index.d.ts.map +1 -0
  124. package/dist/bubbles/service-bubble/google-sheets/index.js +4 -0
  125. package/dist/bubbles/service-bubble/google-sheets/index.js.map +1 -0
  126. package/dist/bubbles/service-bubble/hello-world.js +2 -2
  127. package/dist/bubbles/service-bubble/hello-world.js.map +1 -1
  128. package/dist/bubbles/service-bubble/http.d.ts +6 -6
  129. package/dist/bubbles/service-bubble/http.d.ts.map +1 -1
  130. package/dist/bubbles/service-bubble/http.js +7 -1
  131. package/dist/bubbles/service-bubble/http.js.map +1 -1
  132. package/dist/bubbles/service-bubble/insforge-db.d.ts +140 -0
  133. package/dist/bubbles/service-bubble/insforge-db.d.ts.map +1 -0
  134. package/dist/bubbles/service-bubble/insforge-db.js +260 -0
  135. package/dist/bubbles/service-bubble/insforge-db.js.map +1 -0
  136. package/dist/bubbles/service-bubble/notion/index.d.ts +3 -0
  137. package/dist/bubbles/service-bubble/notion/index.d.ts.map +1 -0
  138. package/dist/bubbles/service-bubble/notion/index.js +3 -0
  139. package/dist/bubbles/service-bubble/notion/index.js.map +1 -0
  140. package/dist/bubbles/service-bubble/notion/notion.d.ts +35405 -0
  141. package/dist/bubbles/service-bubble/notion/notion.d.ts.map +1 -0
  142. package/dist/bubbles/service-bubble/notion/notion.js +1492 -0
  143. package/dist/bubbles/service-bubble/notion/notion.js.map +1 -0
  144. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts +1148 -0
  145. package/dist/bubbles/service-bubble/notion/property-schemas.d.ts.map +1 -0
  146. package/dist/bubbles/service-bubble/notion/property-schemas.js +341 -0
  147. package/dist/bubbles/service-bubble/notion/property-schemas.js.map +1 -0
  148. package/dist/bubbles/service-bubble/postgresql.d.ts +8 -8
  149. package/dist/bubbles/service-bubble/resend.d.ts +30 -9
  150. package/dist/bubbles/service-bubble/resend.d.ts.map +1 -1
  151. package/dist/bubbles/service-bubble/resend.js +133 -2
  152. package/dist/bubbles/service-bubble/resend.js.map +1 -1
  153. package/dist/bubbles/service-bubble/slack.d.ts +525 -525
  154. package/dist/bubbles/service-bubble/slack.d.ts.map +1 -1
  155. package/dist/bubbles/service-bubble/slack.js +2 -2
  156. package/dist/bubbles/service-bubble/slack.js.map +1 -1
  157. package/dist/bubbles/service-bubble/storage.d.ts +21 -17
  158. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -1
  159. package/dist/bubbles/service-bubble/storage.js +59 -7
  160. package/dist/bubbles/service-bubble/storage.js.map +1 -1
  161. package/dist/bubbles/service-bubble/telegram.d.ts +7742 -0
  162. package/dist/bubbles/service-bubble/telegram.d.ts.map +1 -0
  163. package/dist/bubbles/service-bubble/telegram.js +1132 -0
  164. package/dist/bubbles/service-bubble/telegram.js.map +1 -0
  165. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +60 -4
  166. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -1
  167. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +12 -0
  168. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -1
  169. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +4 -4
  170. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts +188 -0
  171. package/dist/bubbles/tool-bubble/code-edit-tool.d.ts.map +1 -0
  172. package/dist/bubbles/tool-bubble/code-edit-tool.js +321 -0
  173. package/dist/bubbles/tool-bubble/code-edit-tool.js.map +1 -0
  174. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +8 -4
  175. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -1
  176. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +132 -19
  177. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -1
  178. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts +455 -0
  179. package/dist/bubbles/tool-bubble/google-maps-tool.d.ts.map +1 -0
  180. package/dist/bubbles/tool-bubble/google-maps-tool.js +205 -0
  181. package/dist/bubbles/tool-bubble/google-maps-tool.js.map +1 -0
  182. package/dist/bubbles/tool-bubble/instagram-tool.d.ts +90 -90
  183. package/dist/bubbles/tool-bubble/instagram-tool.d.ts.map +1 -1
  184. package/dist/bubbles/tool-bubble/instagram-tool.js +2 -2
  185. package/dist/bubbles/tool-bubble/instagram-tool.js.map +1 -1
  186. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts +808 -431
  187. package/dist/bubbles/tool-bubble/linkedin-tool.d.ts.map +1 -1
  188. package/dist/bubbles/tool-bubble/linkedin-tool.js +232 -12
  189. package/dist/bubbles/tool-bubble/linkedin-tool.js.map +1 -1
  190. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +4 -4
  191. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +21 -16
  192. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -1
  193. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +97 -22
  194. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -1
  195. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +17 -16
  196. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -1
  197. package/dist/bubbles/tool-bubble/research-agent-tool.js +27 -17
  198. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -1
  199. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +4 -4
  200. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts +485 -0
  201. package/dist/bubbles/tool-bubble/tiktok-tool.d.ts.map +1 -0
  202. package/dist/bubbles/tool-bubble/tiktok-tool.js +226 -0
  203. package/dist/bubbles/tool-bubble/tiktok-tool.js.map +1 -0
  204. package/dist/bubbles/tool-bubble/twitter-tool.d.ts +947 -0
  205. package/dist/bubbles/tool-bubble/twitter-tool.d.ts.map +1 -0
  206. package/dist/bubbles/tool-bubble/twitter-tool.js +494 -0
  207. package/dist/bubbles/tool-bubble/twitter-tool.js.map +1 -0
  208. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +32 -26
  209. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -1
  210. package/dist/bubbles/tool-bubble/web-crawl-tool.js +58 -59
  211. package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -1
  212. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +4 -4
  213. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -1
  214. package/dist/bubbles/tool-bubble/web-extract-tool.js +17 -17
  215. package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -1
  216. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +23 -115
  217. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -1
  218. package/dist/bubbles/tool-bubble/web-scrape-tool.js +51 -72
  219. package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -1
  220. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +18 -6
  221. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -1
  222. package/dist/bubbles/tool-bubble/web-search-tool.js +46 -32
  223. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -1
  224. package/dist/bubbles/tool-bubble/youtube-tool.d.ts +394 -0
  225. package/dist/bubbles/tool-bubble/youtube-tool.d.ts.map +1 -0
  226. package/dist/bubbles/tool-bubble/youtube-tool.js +352 -0
  227. package/dist/bubbles/tool-bubble/youtube-tool.js.map +1 -0
  228. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +78 -78
  229. package/dist/bubbles/workflow-bubble/generate-document.workflow.js +1 -1
  230. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +62 -62
  231. package/dist/bubbles/workflow-bubble/parse-document.workflow.js +1 -1
  232. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +80 -80
  233. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -1
  234. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +4 -4
  235. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -1
  236. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +52 -52
  237. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -1
  238. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +2 -2
  239. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -1
  240. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +32 -32
  241. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -1
  242. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +6 -6
  243. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -1
  244. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +46 -46
  245. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -1
  246. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +24 -4
  247. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -1
  248. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +27 -27
  249. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -1
  250. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +8 -8
  251. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -1
  252. package/dist/bubbles.json +251 -88
  253. package/dist/index.d.ts +27 -6
  254. package/dist/index.d.ts.map +1 -1
  255. package/dist/index.js +18 -4
  256. package/dist/index.js.map +1 -1
  257. package/dist/logging/BubbleLogger.d.ts +45 -16
  258. package/dist/logging/BubbleLogger.d.ts.map +1 -1
  259. package/dist/logging/BubbleLogger.js +197 -89
  260. package/dist/logging/BubbleLogger.js.map +1 -1
  261. package/dist/logging/StreamingBubbleLogger.d.ts +13 -1
  262. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -1
  263. package/dist/logging/StreamingBubbleLogger.js +56 -13
  264. package/dist/logging/StreamingBubbleLogger.js.map +1 -1
  265. package/dist/logging/WebhookStreamLogger.d.ts +66 -0
  266. package/dist/logging/WebhookStreamLogger.d.ts.map +1 -0
  267. package/dist/logging/WebhookStreamLogger.js +291 -0
  268. package/dist/logging/WebhookStreamLogger.js.map +1 -0
  269. package/dist/types/available-tools.d.ts +1 -1
  270. package/dist/types/available-tools.d.ts.map +1 -1
  271. package/dist/types/available-tools.js +1 -0
  272. package/dist/types/available-tools.js.map +1 -1
  273. package/dist/types/base-bubble-class.d.ts +7 -5
  274. package/dist/types/base-bubble-class.d.ts.map +1 -1
  275. package/dist/types/base-bubble-class.js +63 -40
  276. package/dist/types/base-bubble-class.js.map +1 -1
  277. package/dist/types/bubble.d.ts +3 -10
  278. package/dist/types/bubble.d.ts.map +1 -1
  279. package/dist/types/bubble.js +1 -1
  280. package/dist/types/bubble.js.map +1 -1
  281. package/dist/types/service-bubble-class.d.ts +2 -2
  282. package/dist/types/service-bubble-class.d.ts.map +1 -1
  283. package/dist/types/service-bubble-class.js +2 -2
  284. package/dist/types/service-bubble-class.js.map +1 -1
  285. package/dist/types/tool-bubble-class.d.ts +2 -2
  286. package/dist/types/tool-bubble-class.d.ts.map +1 -1
  287. package/dist/types/tool-bubble-class.js +2 -4
  288. package/dist/types/tool-bubble-class.js.map +1 -1
  289. package/dist/types/workflow-bubble-class.d.ts +2 -2
  290. package/dist/types/workflow-bubble-class.d.ts.map +1 -1
  291. package/dist/types/workflow-bubble-class.js +2 -2
  292. package/dist/types/workflow-bubble-class.js.map +1 -1
  293. package/dist/utils/agent-formatter.d.ts +14 -2
  294. package/dist/utils/agent-formatter.d.ts.map +1 -1
  295. package/dist/utils/agent-formatter.js +176 -28
  296. package/dist/utils/agent-formatter.js.map +1 -1
  297. package/dist/utils/bubbleflow-validation.d.ts +7 -0
  298. package/dist/utils/bubbleflow-validation.d.ts.map +1 -1
  299. package/dist/utils/bubbleflow-validation.js +257 -35
  300. package/dist/utils/bubbleflow-validation.js.map +1 -1
  301. package/dist/utils/error-sanitizer.d.ts +12 -0
  302. package/dist/utils/error-sanitizer.d.ts.map +1 -0
  303. package/dist/utils/error-sanitizer.js +77 -0
  304. package/dist/utils/error-sanitizer.js.map +1 -0
  305. package/dist/utils/json-parsing.d.ts.map +1 -1
  306. package/dist/utils/json-parsing.js +146 -0
  307. package/dist/utils/json-parsing.js.map +1 -1
  308. package/dist/utils/safe-gemini-chat.d.ts +31 -0
  309. package/dist/utils/safe-gemini-chat.d.ts.map +1 -0
  310. package/dist/utils/safe-gemini-chat.js +93 -0
  311. package/dist/utils/safe-gemini-chat.js.map +1 -0
  312. package/dist/utils/schema-comparison.d.ts +92 -0
  313. package/dist/utils/schema-comparison.d.ts.map +1 -0
  314. package/dist/utils/schema-comparison.js +716 -0
  315. package/dist/utils/schema-comparison.js.map +1 -0
  316. package/dist/utils/zod-schema.d.ts +24 -0
  317. package/dist/utils/zod-schema.d.ts.map +1 -0
  318. package/dist/utils/zod-schema.js +56 -0
  319. package/dist/utils/zod-schema.js.map +1 -0
  320. package/package.json +7 -6
  321. package/dist/bubble-trigger/index.d.ts +0 -2
  322. package/dist/bubble-trigger/index.d.ts.map +0 -1
  323. package/dist/bubble-trigger/index.js +0 -2
  324. package/dist/bubble-trigger/index.js.map +0 -1
  325. package/dist/bubble-trigger/types.d.ts +0 -87
  326. package/dist/bubble-trigger/types.d.ts.map +0 -1
  327. package/dist/bubble-trigger/types.js +0 -14
  328. package/dist/bubble-trigger/types.js.map +0 -1
  329. package/dist/bubbles/service-bubble/apify/api-scraper.schema.d.ts +0 -370
  330. package/dist/bubbles/service-bubble/apify/api-scraper.schema.d.ts.map +0 -1
  331. package/dist/bubbles/service-bubble/apify/api-scraper.schema.js +0 -14
  332. package/dist/bubbles/service-bubble/apify/api-scraper.schema.js.map +0 -1
  333. package/dist/bubbles/service-bubble/apify.d.ts +0 -136
  334. package/dist/bubbles/service-bubble/apify.d.ts.map +0 -1
  335. package/dist/bubbles/service-bubble/apify.js +0 -282
  336. package/dist/bubbles/service-bubble/apify.js.map +0 -1
  337. package/dist/bubbles/service-bubble/google-sheets.d.ts +0 -1811
  338. package/dist/bubbles/service-bubble/google-sheets.d.ts.map +0 -1
  339. package/dist/bubbles/service-bubble/google-sheets.js.map +0 -1
  340. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +0 -114
  341. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +0 -1
  342. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +0 -782
  343. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +0 -1
  344. package/dist/types/ai-models.d.ts +0 -4
  345. package/dist/types/ai-models.d.ts.map +0 -1
  346. package/dist/types/ai-models.js +0 -20
  347. package/dist/types/ai-models.js.map +0 -1
  348. package/dist/types/api-scraper.schema.d.ts +0 -453
  349. package/dist/types/api-scraper.schema.d.ts.map +0 -1
  350. package/dist/types/api-scraper.schema.js +0 -160
  351. package/dist/types/api-scraper.schema.js.map +0 -1
  352. package/dist/utils/param-helper.d.ts +0 -2
  353. package/dist/utils/param-helper.d.ts.map +0 -1
  354. package/dist/utils/param-helper.js +0 -5
  355. package/dist/utils/param-helper.js.map +0 -1
@@ -1,782 +0,0 @@
1
- /**
2
- * SIMPLE BUBBLEFLOW GENERATOR WORKFLOW
3
- *
4
- * A simplified BubbleFlow generator that uses AI agent with tools to generate
5
- * and validate BubbleFlow code from natural language prompts.
6
- *
7
- * Much simpler than the complex workflow - just AI + validation tool!
8
- */
9
- import { z } from 'zod';
10
- import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
11
- import { CredentialType } from '@bubblelab/shared-schemas';
12
- import { AIAgentBubble, } from '../service-bubble/ai-agent.js';
13
- import { ToolMessage } from '@langchain/core/messages';
14
- import { BubbleFactory } from '../../bubble-factory.js';
15
- /**
16
- * Parameters schema for the simple BubbleFlow generator
17
- */
18
- const BubbleFlowGeneratorParamsSchema = z.object({
19
- prompt: z
20
- .string()
21
- .min(1, 'Prompt is required')
22
- .describe('Natural language description of the desired BubbleFlow'),
23
- credentials: z
24
- .record(z.nativeEnum(CredentialType), z.string())
25
- .optional()
26
- .describe('Credentials for AI agent operations'),
27
- });
28
- /**
29
- * Result schema
30
- */
31
- const BubbleFlowGeneratorResultSchema = z.object({
32
- generatedCode: z
33
- .string()
34
- .describe('The generated BubbleFlow TypeScript code'),
35
- isValid: z.boolean().describe('Whether the generated code is valid'),
36
- success: z.boolean(),
37
- error: z.string(),
38
- toolCalls: z.array(z.any()).describe('The tool calls made by the AI agent'),
39
- summary: z
40
- .string()
41
- .default('')
42
- .describe('High-level instructions for using the validated flow'),
43
- inputsSchema: z
44
- .string()
45
- .default('')
46
- .describe('JSON Schema (string) representing the inputs of the flow'),
47
- });
48
- // Shared constants and prompts
49
- const AI_MODEL_CONFIG = {
50
- model: 'google/gemini-2.5-pro',
51
- temperature: 0.3,
52
- };
53
- const MAX_ITERATIONS = 20;
54
- const TOOL_NAMES = {
55
- VALIDATION: 'bubbleflow-validation-tool',
56
- BUBBLE_DETAILS: 'get-bubble-details-tool',
57
- LIST_BUBBLES: 'list-bubbles-tool',
58
- };
59
- const SYSTEM_PROMPT_BASE = `You are an expert TypeScript developer who specializes in creating BubbleFlow workflows. Generate clean, well-structured code that follows best practices.
60
-
61
- WORKFLOW:
62
- 1. First identify bubbles needed from the available list
63
- 2. Use get-bubble-details-tool for each bubble to understand proper usage
64
- 3. Write code using exact patterns from bubble details
65
- 4. Use bubbleflow-validation iteratively until valid
66
- 5. Do not provide a response until your code is fully validated`;
67
- const CRITICAL_INSTRUCTIONS = `CRITICAL INSTRUCTIONS:
68
- 1. Start with the exact boilerplate template above (it has all the correct imports and class structure), come up with a name for the flow based on the user's request, export class [name] extends BubbleFlow
69
- 2. Properly type the payload import and output interface based on the user's request, create typescript interfaces for them
70
- 2. BEFORE writing any code, identify which bubbles you plan to use from the available list
71
- 3. For EACH bubble you plan to use, ALWAYS call get-bubble-details-tool first to understand:
72
- - The correct input parameters and their types
73
- - The expected output structure in result.data
74
- - How to properly handle success/error cases
75
- 4. Replace the handle method with logic that fulfills the user's request
76
- 5. Use the exact parameter structures shown in the bubble details
77
- 6. If deterministic tool calls and branch logic are possible, there is no need to use AI agent.
78
- 7. Access bubble outputs safely using result.data with null checking (e.g., result.data?.someProperty or check if result.data exists first)
79
- 9. Return meaningful data from the handle method
80
- 10. DO NOT include credentials in bubble parameters - credentials are handled automatically
81
- 11. CRITICAL: Always use the pattern: const result = await new SomeBubble({params}).action() - NEVER use runBubble, this.runBubble, or any other method
82
- 12. When using AI Agent, ensure your prompt includes comprehensive context and explicitly pass in all relevant information needed for the task. Be thorough in providing complete data rather than expecting the AI to infer or assume missing details (unless the information must be retrieved from an online source)
83
- 13. When generating and dealing with images, process them one at a time to ensure proper handling and avoid overwhelming the system
84
- 14. When dealing with other async operations in for loops, batch the requests 5 at a time at most and use Promise.all to handle them efficiently. Always declare bubble instances separately outside of callbacks, loops, or maps before calling .action() - avoid instantiating bubbles directly within map(), forEach(), or other callback functions.
85
-
86
- CRITICAL: You MUST use get-bubble-details-tool for every bubble before using it in your code!`;
87
- const VALIDATION_PROCESS = `CRITICAL VALIDATION PROCESS:
88
- 1. After generating the initial code, ALWAYS use the bubbleflow-validation to validate it
89
- 2. If validation fails, you MUST analyze ALL errors carefully and fix EVERY single one
90
- 3. Use the bubbleflow-validation again to validate the fixed code
91
- 4. If there are still errors, fix them ALL and validate again
92
- 5. Repeat this validation-fix cycle until the code passes validation with NO ERRORS (valid: true)
93
- 6. Do NOT stop until you get a successful validation result with valid: true and no errors
94
- 7. NEVER provide code that has validation errors - keep fixing until it's completely error-free
95
- 8. IMPORTANT: Use .action() on the to call the bubble, (this is the only way to run a bubble) - NEVER use runBubble() or any other method
96
-
97
- Only return the final TypeScript code that passes validation. No explanations or markdown formatting.`;
98
- /**
99
- * Simple BubbleFlow Generator using AI agent with tools
100
- */
101
- export class BubbleFlowGeneratorWorkflow extends WorkflowBubble {
102
- static type = 'workflow';
103
- static bubbleName = 'bubbleflow-generator';
104
- static schema = BubbleFlowGeneratorParamsSchema;
105
- static resultSchema = BubbleFlowGeneratorResultSchema;
106
- static shortDescription = 'Generate BubbleFlow code from natural language';
107
- static longDescription = `
108
- Simple BubbleFlow generator that uses AI with validation tools.
109
-
110
- Just provide a natural language prompt describing what you want your BubbleFlow to do,
111
- and it will generate complete TypeScript code with proper validation.
112
-
113
- Example prompts:
114
- - "Create a flow that queries my database and sends results to Slack"
115
- - "Build a workflow that processes user data with AI and stores it"
116
- - "Make a flow that analyzes text and generates a summary"
117
- `;
118
- static alias = 'generate-flow';
119
- bubbleFactory;
120
- constructor(params, context) {
121
- super(params, context);
122
- this.bubbleFactory = new BubbleFactory();
123
- }
124
- async runValidationAgent(code, credentials, streamingCallback) {
125
- const validationAgent = new AIAgentBubble({
126
- name: 'Validation Agent',
127
- message: `You are a validationAgent. Validate the provided BubbleFlow TypeScript code using the bubbleflow-validation tool. ` +
128
- `If validation fails, fix the code and validate again until it passes with valid: true. ` +
129
- `Return ONLY the final validated TypeScript code with no markdown. If needed, use the list-bubbles-tool to get the list of available bubbles and bubble details to get the correct parameters and usage.\n\n` +
130
- `CODE:\n\n\n` +
131
- code,
132
- systemPrompt: `You must use the bubbleflow-validation tool to validate code. Repeat validation/fix until valid. ` +
133
- `Do not explain anything. Output only the final TypeScript code when validation passes.`,
134
- model: AI_MODEL_CONFIG,
135
- tools: [
136
- {
137
- name: TOOL_NAMES.VALIDATION,
138
- credentials: credentials || {},
139
- },
140
- {
141
- name: TOOL_NAMES.BUBBLE_DETAILS,
142
- credentials: credentials || {},
143
- },
144
- {
145
- name: TOOL_NAMES.LIST_BUBBLES,
146
- credentials: credentials || {},
147
- },
148
- ],
149
- maxIterations: 10,
150
- credentials,
151
- }, this.context);
152
- const validationRun = streamingCallback
153
- ? await validationAgent.actionWithStreaming(streamingCallback)
154
- : await validationAgent.action();
155
- let validatedCode = code;
156
- let isValid = false;
157
- let validationError = 'Validation agent failed';
158
- // Handle both streaming (direct response) and non-streaming (wrapped in data) results
159
- const isStreamingResult = 'response' in validationRun;
160
- const response = isStreamingResult
161
- ? validationRun.response
162
- : validationRun.data?.response;
163
- const toolCalls = isStreamingResult
164
- ? validationRun.toolCalls
165
- : validationRun.data?.toolCalls;
166
- if (validationRun.success && response) {
167
- validatedCode = response
168
- .replace(/```typescript/g, '')
169
- .replace(/```/g, '')
170
- .trim();
171
- if (toolCalls && toolCalls.length > 0) {
172
- const lastToolCall = toolCalls[toolCalls.length - 1];
173
- if ((lastToolCall.tool === TOOL_NAMES.VALIDATION ||
174
- lastToolCall.tool === 'bubbleflow-validation') &&
175
- lastToolCall.output) {
176
- try {
177
- let validationContent;
178
- if (lastToolCall.output instanceof ToolMessage) {
179
- const content = lastToolCall.output.content;
180
- validationContent =
181
- typeof content === 'string' ? content : JSON.stringify(content);
182
- }
183
- else if (typeof lastToolCall.output === 'object' &&
184
- lastToolCall.output !== null &&
185
- 'content' in lastToolCall.output) {
186
- const content = lastToolCall.output.content;
187
- validationContent =
188
- typeof content === 'string' ? content : JSON.stringify(content);
189
- }
190
- else if (typeof lastToolCall.output === 'string') {
191
- validationContent = lastToolCall.output;
192
- }
193
- else {
194
- validationContent = JSON.stringify(lastToolCall.output);
195
- }
196
- const validationResult = JSON.parse(validationContent);
197
- isValid = validationResult.valid === true;
198
- validationError =
199
- validationResult.error ||
200
- (validationResult.errors && validationResult.errors.join('; ')) ||
201
- '';
202
- }
203
- catch (e) {
204
- isValid = true;
205
- validationError = '';
206
- }
207
- }
208
- }
209
- }
210
- return {
211
- validatedCode,
212
- isValid,
213
- validationError,
214
- toolCalls,
215
- };
216
- }
217
- async runSummarizeAgent(validatedCode, credentials, streamingCallback) {
218
- const summarizeAgent = new AIAgentBubble({
219
- name: 'Flow Summary Agent',
220
- message: `You are summarizeAgent. Analyze the provided validated BubbleFlow TypeScript code and:
221
- 1) Output a concise human-readable summary of what a user needs to do to use this flow (credentials, setup, trigger, expected outputs).
222
- 2) Extract and output a JSON Schema describing the input payload (types and required fields) of the flow. under the key inputsSchema.\n\nReturn a JSON object of the shape: { "summary": string, "inputsSchema": string } where inputsSchema is a JSON Schema string.\n\nCODE:\n\n\n` +
223
- validatedCode,
224
- systemPrompt: `Return only a strict JSON object with keys summary and inputsSchema. inputsSchema must be a JSON Schema string for the flow's input. Do not include markdown. For the input schema, directly use the schema payload: CustomWebhookPayload, don't add any other fields that the user is to provide at minimum, don't worry about any fields of WebhookEvent.`,
225
- model: {
226
- jsonMode: true,
227
- },
228
- tools: [],
229
- maxIterations: 5,
230
- credentials,
231
- }, this.context);
232
- console.log('[BubbleFlowGenerator] Starting summarizeAgent...');
233
- const summarizeRun = streamingCallback
234
- ? await summarizeAgent.actionWithStreaming(streamingCallback)
235
- : await summarizeAgent.action();
236
- let summary = '';
237
- let inputsSchema = '';
238
- console.log('[BubbleFlowGenerator] SummarizeAgent result:', {
239
- success: summarizeRun.success,
240
- hasResponse: !!('response' in summarizeRun
241
- ? summarizeRun.response
242
- : summarizeRun.data?.response),
243
- error: summarizeRun.error,
244
- });
245
- // Handle both streaming (direct response) and non-streaming (wrapped in data) results
246
- const isStreamingResult = 'response' in summarizeRun;
247
- const response = isStreamingResult
248
- ? summarizeRun.response
249
- : summarizeRun.data?.response;
250
- if (summarizeRun.success && response) {
251
- try {
252
- const raw = response.trim();
253
- console.log('[BubbleFlowGenerator] Raw summarizeAgent response:', raw);
254
- const parsed = JSON.parse(raw);
255
- console.log('[BubbleFlowGenerator] Parsed summarizeAgent response:', parsed);
256
- summary = typeof parsed.summary === 'string' ? parsed.summary : '';
257
- inputsSchema =
258
- typeof parsed.inputsSchema === 'string' ? parsed.inputsSchema : '';
259
- console.log('[BubbleFlowGenerator] Extracted summary and schema:', {
260
- summary,
261
- inputsSchema,
262
- });
263
- }
264
- catch (parseError) {
265
- console.error('[BubbleFlowGenerator] Failed to parse summarizeAgent response:', parseError);
266
- summary = '';
267
- inputsSchema = '';
268
- }
269
- }
270
- else {
271
- console.log('[BubbleFlowGenerator] SummarizeAgent failed or no response:', {
272
- success: summarizeRun.success,
273
- response: response,
274
- error: summarizeRun.error,
275
- });
276
- }
277
- return { summary, inputsSchema };
278
- }
279
- createSystemPrompt(boilerplate, bubbleDescriptions) {
280
- return `${SYSTEM_PROMPT_BASE}
281
-
282
- Here's the boilerplate template you should use as a starting point:
283
- \`\`\`typescript
284
- ${boilerplate}
285
- \`\`\`
286
-
287
- Available bubbles in the system:
288
- ${bubbleDescriptions}
289
-
290
- ${CRITICAL_INSTRUCTIONS}
291
-
292
- ${VALIDATION_PROCESS}`;
293
- }
294
- createStreamingSystemPrompt(boilerplate, bubbleDescriptions) {
295
- return `${SYSTEM_PROMPT_BASE}
296
-
297
- Here's the boilerplate template you should use as a starting point:
298
- \`\`\`typescript
299
- ${boilerplate}
300
- \`\`\`
301
-
302
- Available bubbles in the system:
303
- ${bubbleDescriptions}
304
-
305
- ${CRITICAL_INSTRUCTIONS}
306
-
307
- ${VALIDATION_PROCESS}`;
308
- }
309
- async performAction(context) {
310
- void context;
311
- console.log('[BubbleFlowGenerator] Starting generation process...');
312
- console.log('[BubbleFlowGenerator] Prompt:', this.params.prompt);
313
- try {
314
- console.log('[BubbleFlowGenerator] Registering defaults...');
315
- await this.bubbleFactory.registerDefaults();
316
- // Get available bubbles info
317
- console.log('[BubbleFlowGenerator] Getting available bubbles...');
318
- const availableBubbles = this.bubbleFactory.listBubblesForCodeGenerator();
319
- console.log('[BubbleFlowGenerator] Available bubbles:', availableBubbles);
320
- const bubbleDescriptions = availableBubbles
321
- .map((name) => {
322
- const metadata = this.bubbleFactory.getMetadata(name);
323
- return `- ${name}: ${metadata?.shortDescription || 'No description'}`;
324
- })
325
- .join('\n');
326
- // Get boilerplate template
327
- console.log('[BubbleFlowGenerator] Generating boilerplate template...');
328
- const boilerplate = this.bubbleFactory.generateBubbleFlowBoilerplate();
329
- // Create AI agent with validation tool attached
330
- console.log('[BubbleFlowGenerator] Creating AI agent with validation tool...');
331
- const aiAgent = new AIAgentBubble({
332
- name: 'Bubble Flow Generator Agent',
333
- message: `Generate a complete BubbleFlow TypeScript class based on this request: "${this.params.prompt}"`,
334
- systemPrompt: this.createSystemPrompt(boilerplate, bubbleDescriptions),
335
- model: AI_MODEL_CONFIG,
336
- tools: [
337
- {
338
- name: TOOL_NAMES.VALIDATION,
339
- credentials: this.params.credentials || {},
340
- },
341
- {
342
- name: TOOL_NAMES.BUBBLE_DETAILS,
343
- credentials: this.params.credentials || {},
344
- },
345
- ],
346
- maxIterations: MAX_ITERATIONS,
347
- credentials: this.params.credentials,
348
- }, this.context);
349
- // Generate the code
350
- console.log('[BubbleFlowGenerator] Starting AI agent execution...');
351
- const result = await aiAgent.action();
352
- console.log('[BubbleFlowGenerator] AI agent execution completed');
353
- console.log('[BubbleFlowGenerator] Result success:', result.success);
354
- console.log('[BubbleFlowGenerator] Result error:', result.error);
355
- console.log('[BubbleFlowGenerator] Response length:', result.data?.response?.length || 0);
356
- if (!result.success || !result.data?.response) {
357
- console.log('[BubbleFlowGenerator] AI agent failed or no response');
358
- return {
359
- toolCalls: [],
360
- generatedCode: '',
361
- isValid: false,
362
- success: false,
363
- error: result.error || 'Failed to generate code',
364
- summary: '',
365
- inputsSchema: '',
366
- };
367
- }
368
- console.log('[BubbleFlowGenerator] Processing AI response...');
369
- const generatedCode = result.data.response
370
- .replace(/```typescript/g, '')
371
- .replace(/```/g, '')
372
- .trim();
373
- // Check if the AI made any tool calls and get validation from the last one
374
- let isValid = true;
375
- let validationError = '';
376
- let needsValidationAgent = false;
377
- if (result.data.toolCalls && result.data.toolCalls.length > 0) {
378
- console.log('[BubbleFlowGenerator] Found', result.data.toolCalls.length, 'tool calls');
379
- // Get the last tool call (should be the validation)
380
- const lastToolCall = result.data.toolCalls[result.data.toolCalls.length - 1];
381
- console.log('[BubbleFlowGenerator] Last tool call:', lastToolCall.tool);
382
- if ((lastToolCall.tool === TOOL_NAMES.VALIDATION ||
383
- lastToolCall.tool === 'bubbleflow-validation') &&
384
- lastToolCall.output) {
385
- console.log('[BubbleFlowGenerator] Using validation tool result');
386
- try {
387
- // Handle ToolMessage object with content property
388
- let validationContent;
389
- if (lastToolCall.output instanceof ToolMessage) {
390
- const content = lastToolCall.output.content;
391
- validationContent =
392
- typeof content === 'string' ? content : JSON.stringify(content);
393
- }
394
- else if (typeof lastToolCall.output === 'object' &&
395
- lastToolCall.output !== null &&
396
- 'content' in lastToolCall.output) {
397
- const content = lastToolCall.output.content;
398
- validationContent =
399
- typeof content === 'string' ? content : JSON.stringify(content);
400
- }
401
- else if (typeof lastToolCall.output === 'string') {
402
- validationContent = lastToolCall.output;
403
- }
404
- else {
405
- console.log('[BubbleFlowGenerator] Unexpected output type:', typeof lastToolCall.output);
406
- validationContent = JSON.stringify(lastToolCall.output);
407
- }
408
- const validationResult = JSON.parse(validationContent);
409
- isValid = validationResult.valid === true;
410
- validationError =
411
- validationResult.error ||
412
- (validationResult.errors && validationResult.errors.join('; ')) ||
413
- '';
414
- console.log('[BubbleFlowGenerator] Validation result from tool:', {
415
- valid: isValid,
416
- error: validationError,
417
- });
418
- // If validation ran but code is still invalid, trigger validationAgent to self-heal
419
- if (!isValid) {
420
- needsValidationAgent = true;
421
- }
422
- }
423
- catch (parseError) {
424
- console.log('[BubbleFlowGenerator] Failed to parse validation output:', parseError);
425
- // Fallback to assuming valid if we can't parse
426
- isValid = true;
427
- }
428
- }
429
- else {
430
- console.log('[BubbleFlowGenerator] No validation tool call found from AI agent - will run validationAgent');
431
- needsValidationAgent = true;
432
- }
433
- }
434
- else {
435
- console.log('[BubbleFlowGenerator] No tool calls found - will run validationAgent');
436
- needsValidationAgent = true;
437
- }
438
- if (needsValidationAgent) {
439
- console.log('[BubbleFlowGenerator] Spawning validationAgent to validate code...');
440
- const { validatedCode, isValid: validated, validationError: vErr, } = await this.runValidationAgent(generatedCode, this.params.credentials);
441
- isValid = validated;
442
- validationError = vErr;
443
- const { summary, inputsSchema } = isValid
444
- ? await this.runSummarizeAgent(validatedCode, this.params.credentials)
445
- : { summary: '', inputsSchema: '' };
446
- return {
447
- toolCalls: result.data.toolCalls,
448
- generatedCode: validatedCode,
449
- isValid,
450
- success: true,
451
- error: validationError,
452
- summary,
453
- inputsSchema,
454
- };
455
- }
456
- console.log('[BubbleFlowGenerator] Generation completed');
457
- console.log('[BubbleFlowGenerator] Validation status:', isValid);
458
- console.log('[BubbleFlowGenerator] Validation error:', validationError);
459
- // Always return success=true if we got code, but include validation status
460
- // This allows the IDE to display the code even if validation failed
461
- const { summary, inputsSchema } = isValid
462
- ? await this.runSummarizeAgent(generatedCode, this.params.credentials)
463
- : { summary: '', inputsSchema: '' };
464
- return {
465
- toolCalls: result.data.toolCalls,
466
- generatedCode,
467
- isValid,
468
- success: true, // Always true if we have code
469
- error: validationError, // Include validation error for reference
470
- summary,
471
- inputsSchema,
472
- };
473
- }
474
- catch (error) {
475
- console.error('[BubbleFlowGenerator] Error during generation:', error);
476
- return {
477
- toolCalls: [],
478
- generatedCode: '',
479
- isValid: false,
480
- success: false,
481
- error: error instanceof Error
482
- ? error.message
483
- : 'Unknown error during generation',
484
- summary: '',
485
- inputsSchema: '',
486
- };
487
- }
488
- }
489
- /**
490
- * Execute the workflow with streaming support for real-time code generation feedback
491
- */
492
- async actionWithStreaming(streamingCallback, context) {
493
- void context;
494
- console.log('[BubbleFlowGenerator] Starting streaming generation process...');
495
- console.log('[BubbleFlowGenerator] Prompt:', this.params.prompt);
496
- try {
497
- await streamingCallback({
498
- type: 'start',
499
- data: {
500
- message: `Generating BubbleFlow code for: ${this.params.prompt}`,
501
- maxIterations: MAX_ITERATIONS,
502
- timestamp: new Date().toISOString(),
503
- },
504
- });
505
- console.log('[BubbleFlowGenerator] Registering defaults...');
506
- await this.bubbleFactory.registerDefaults();
507
- // Get available bubbles info
508
- console.log('[BubbleFlowGenerator] Getting available bubbles...');
509
- const availableBubbles = this.bubbleFactory.listBubblesForCodeGenerator();
510
- console.log('[BubbleFlowGenerator] Available bubbles:', availableBubbles);
511
- await streamingCallback({
512
- type: 'tool_start',
513
- data: {
514
- tool: 'bubble-discovery',
515
- input: { action: 'listing_available_bubbles' },
516
- callId: 'discovery-1',
517
- },
518
- });
519
- const bubbleDescriptions = availableBubbles
520
- .map((name) => {
521
- const metadata = this.bubbleFactory.getMetadata(name);
522
- return `- ${name}: ${metadata?.shortDescription || 'No description'}`;
523
- })
524
- .join('\n');
525
- await streamingCallback({
526
- type: 'tool_complete',
527
- data: {
528
- callId: 'discovery-1',
529
- tool: 'bubble-discovery',
530
- output: {
531
- availableBubbles: availableBubbles.length,
532
- descriptions: bubbleDescriptions,
533
- },
534
- duration: 100,
535
- },
536
- });
537
- // Get boilerplate template
538
- console.log('[BubbleFlowGenerator] Generating boilerplate template...');
539
- const boilerplate = this.bubbleFactory.generateBubbleFlowBoilerplate();
540
- await streamingCallback({
541
- type: 'tool_start',
542
- data: {
543
- tool: 'template-generation',
544
- input: { action: 'generating_boilerplate' },
545
- callId: 'template-1',
546
- },
547
- });
548
- await streamingCallback({
549
- type: 'tool_complete',
550
- data: {
551
- tool: 'template-generation',
552
- callId: 'template-1',
553
- output: { templateGenerated: true, length: boilerplate.length },
554
- duration: 50,
555
- },
556
- });
557
- // Create AI agent with validation tool attached
558
- console.log('[BubbleFlowGenerator] Creating AI agent with validation tool...');
559
- const aiAgent = new AIAgentBubble({
560
- name: 'Bubble Flow Generator Agent',
561
- message: `Generate a complete BubbleFlow TypeScript class based on this request: "${this.params.prompt}"`,
562
- systemPrompt: this.createStreamingSystemPrompt(boilerplate, bubbleDescriptions),
563
- model: AI_MODEL_CONFIG,
564
- tools: [
565
- {
566
- name: TOOL_NAMES.VALIDATION,
567
- credentials: this.params.credentials || {},
568
- },
569
- {
570
- name: TOOL_NAMES.BUBBLE_DETAILS,
571
- credentials: this.params.credentials || {},
572
- },
573
- ],
574
- maxIterations: MAX_ITERATIONS,
575
- credentials: this.params.credentials,
576
- }, this.context);
577
- // Generate the code with streaming
578
- console.log('[BubbleFlowGenerator] Starting AI agent execution with streaming...');
579
- const result = await aiAgent.actionWithStreaming(streamingCallback);
580
- console.log('[BubbleFlowGenerator] AI agent execution completed');
581
- console.log('[BubbleFlowGenerator] Result success:', result.success);
582
- if (!result.success || !result.response) {
583
- console.log('[BubbleFlowGenerator] AI agent failed or no response');
584
- return {
585
- toolCalls: result.toolCalls,
586
- generatedCode: '',
587
- isValid: false,
588
- success: false,
589
- error: result.error || 'Failed to generate code',
590
- summary: '',
591
- inputsSchema: '',
592
- };
593
- }
594
- const generatedCode = result.response
595
- .replace(/```typescript/g, '')
596
- .replace(/```/g, '')
597
- .trim();
598
- // Check validation status from tool calls
599
- let isValid = true;
600
- let validationError = '';
601
- console.log('[BubbleFlowGenerator] Checking validation status...');
602
- let needsValidationAgent = false;
603
- if (result.toolCalls && result.toolCalls.length > 0) {
604
- // Get the last tool call (should be the validation)
605
- const lastToolCall = result.toolCalls[result.toolCalls.length - 1];
606
- if ((lastToolCall.tool === TOOL_NAMES.VALIDATION ||
607
- lastToolCall.tool === 'bubbleflow-validation') &&
608
- lastToolCall.output) {
609
- try {
610
- // Handle ToolMessage object with content property
611
- let validationContent;
612
- if (lastToolCall.output instanceof ToolMessage) {
613
- const content = lastToolCall.output.content;
614
- validationContent =
615
- typeof content === 'string' ? content : JSON.stringify(content);
616
- }
617
- else if (typeof lastToolCall.output === 'object' &&
618
- lastToolCall.output !== null &&
619
- 'content' in lastToolCall.output) {
620
- const content = lastToolCall.output.content;
621
- validationContent =
622
- typeof content === 'string' ? content : JSON.stringify(content);
623
- }
624
- else if (typeof lastToolCall.output === 'string') {
625
- validationContent = lastToolCall.output;
626
- }
627
- else {
628
- console.log('[BubbleFlowGenerator] Unexpected output type:', typeof lastToolCall.output);
629
- validationContent = JSON.stringify(lastToolCall.output);
630
- }
631
- const validationResult = JSON.parse(validationContent);
632
- console.log('[BubbleFlowGenerator] Parsed validation result:', validationResult);
633
- isValid = validationResult.valid === true;
634
- validationError =
635
- validationResult.error ||
636
- (validationResult.errors && validationResult.errors.join('; ')) ||
637
- '';
638
- if (!isValid) {
639
- needsValidationAgent = true;
640
- }
641
- }
642
- catch (parseError) {
643
- console.log('Failed to parse validation output:', parseError);
644
- console.log('Raw output:', lastToolCall.output);
645
- isValid = true; // Fallback
646
- }
647
- }
648
- else {
649
- // No validation tool call found - run a dedicated validationAgent
650
- console.log('[BubbleFlowGenerator] No validation tool call found - will run validationAgent');
651
- needsValidationAgent = true;
652
- }
653
- }
654
- else {
655
- console.log('[BubbleFlowGenerator] No tool calls found - will run validationAgent');
656
- needsValidationAgent = true;
657
- }
658
- if (needsValidationAgent) {
659
- await streamingCallback({
660
- type: 'tool_start',
661
- data: {
662
- tool: 'validation-agent',
663
- input: { action: 'validating_generated_code' },
664
- callId: 'validation-agent-1',
665
- },
666
- });
667
- const { validatedCode, isValid: validated, validationError: vErr, } = await this.runValidationAgent(generatedCode, this.params.credentials, streamingCallback);
668
- await streamingCallback({
669
- type: 'tool_complete',
670
- data: {
671
- tool: 'validation-agent',
672
- callId: 'validation-agent-1',
673
- output: { success: validated },
674
- duration: 100,
675
- },
676
- });
677
- isValid = validated;
678
- validationError = vErr;
679
- let summary = '';
680
- let inputsSchema = '';
681
- if (isValid) {
682
- await streamingCallback({
683
- type: 'tool_start',
684
- data: {
685
- tool: 'summary-agent',
686
- input: { action: 'generating_summary_and_schema' },
687
- callId: 'summary-agent-1',
688
- },
689
- });
690
- const summaryResult = await this.runSummarizeAgent(validatedCode, this.params.credentials, streamingCallback);
691
- summary = summaryResult.summary;
692
- inputsSchema = summaryResult.inputsSchema;
693
- await streamingCallback({
694
- type: 'tool_complete',
695
- data: {
696
- callId: 'summary-agent-1',
697
- tool: 'summary-agent',
698
- output: {
699
- summaryGenerated: !!summary,
700
- schemaGenerated: !!inputsSchema,
701
- },
702
- duration: 100,
703
- },
704
- });
705
- }
706
- return {
707
- toolCalls: result.toolCalls,
708
- generatedCode: validatedCode,
709
- isValid,
710
- success: true,
711
- error: validationError,
712
- summary,
713
- inputsSchema,
714
- };
715
- }
716
- console.log('[BubbleFlowGenerator] Streaming generation completed');
717
- console.log('[BubbleFlowGenerator] Validation status:', isValid);
718
- console.log('[BubbleFlowGenerator] Validation error:', validationError);
719
- // Note: Bubble parameters extraction is now handled at the route level
720
- let summary = '';
721
- let inputsSchema = '';
722
- if (isValid) {
723
- await streamingCallback({
724
- type: 'tool_start',
725
- data: {
726
- tool: 'summary-agent',
727
- input: { action: 'generating_summary_and_schema' },
728
- callId: 'summary-agent-final',
729
- },
730
- });
731
- const summaryResult = await this.runSummarizeAgent(generatedCode, this.params.credentials, streamingCallback);
732
- summary = summaryResult.summary;
733
- inputsSchema = summaryResult.inputsSchema;
734
- await streamingCallback({
735
- type: 'tool_complete',
736
- data: {
737
- callId: 'summary-agent-final',
738
- tool: 'summary-agent',
739
- output: {
740
- summaryGenerated: !!summary,
741
- schemaGenerated: !!inputsSchema,
742
- },
743
- duration: 100,
744
- },
745
- });
746
- }
747
- return {
748
- toolCalls: result.toolCalls,
749
- generatedCode,
750
- isValid,
751
- success: true,
752
- error: validationError,
753
- summary,
754
- inputsSchema,
755
- };
756
- }
757
- catch (error) {
758
- console.error('[BubbleFlowGenerator] Error during streaming generation:', error);
759
- await streamingCallback({
760
- type: 'error',
761
- data: {
762
- error: error instanceof Error
763
- ? error.message
764
- : 'Unknown error during generation',
765
- recoverable: true, // Mark workflow errors as recoverable
766
- },
767
- });
768
- return {
769
- toolCalls: [],
770
- generatedCode: '',
771
- isValid: false,
772
- success: false,
773
- error: error instanceof Error
774
- ? error.message
775
- : 'Unknown error during generation',
776
- summary: '',
777
- inputsSchema: '',
778
- };
779
- }
780
- }
781
- }
782
- //# sourceMappingURL=bubbleflow-generator.workflow.js.map