@bubblelab/bubble-core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/LICENSE.txt +202 -0
  2. package/dist/bubble-bundle.d.ts +2021 -0
  3. package/dist/bubble-factory.d.ts +161 -0
  4. package/dist/bubble-factory.d.ts.map +1 -0
  5. package/dist/bubble-factory.js +426 -0
  6. package/dist/bubble-factory.js.map +1 -0
  7. package/dist/bubble-flow/bubble-flow-class.d.ts +19 -0
  8. package/dist/bubble-flow/bubble-flow-class.d.ts.map +1 -0
  9. package/dist/bubble-flow/bubble-flow-class.js +23 -0
  10. package/dist/bubble-flow/bubble-flow-class.js.map +1 -0
  11. package/dist/bubble-flow/sample/data-analyst-flow.d.ts +15 -0
  12. package/dist/bubble-flow/sample/data-analyst-flow.d.ts.map +1 -0
  13. package/dist/bubble-flow/sample/data-analyst-flow.js +63 -0
  14. package/dist/bubble-flow/sample/data-analyst-flow.js.map +1 -0
  15. package/dist/bubble-flow/sample/error-ts.d.ts +23 -0
  16. package/dist/bubble-flow/sample/error-ts.d.ts.map +1 -0
  17. package/dist/bubble-flow/sample/error-ts.js +31 -0
  18. package/dist/bubble-flow/sample/error-ts.js.map +1 -0
  19. package/dist/bubble-flow/sample/sanitytest.d.ts +10 -0
  20. package/dist/bubble-flow/sample/sanitytest.d.ts.map +1 -0
  21. package/dist/bubble-flow/sample/sanitytest.js +13 -0
  22. package/dist/bubble-flow/sample/sanitytest.js.map +1 -0
  23. package/dist/bubble-flow/sample/simple-webhook-2.d.ts +19 -0
  24. package/dist/bubble-flow/sample/simple-webhook-2.d.ts.map +1 -0
  25. package/dist/bubble-flow/sample/simple-webhook-2.js +23 -0
  26. package/dist/bubble-flow/sample/simple-webhook-2.js.map +1 -0
  27. package/dist/bubble-flow/sample/simple-webhook.d.ts +10 -0
  28. package/dist/bubble-flow/sample/simple-webhook.d.ts.map +1 -0
  29. package/dist/bubble-flow/sample/simple-webhook.js +18 -0
  30. package/dist/bubble-flow/sample/simple-webhook.js.map +1 -0
  31. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts +29 -0
  32. package/dist/bubble-flow/sample/simplified-data-analysis.flow.d.ts.map +1 -0
  33. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js +150 -0
  34. package/dist/bubble-flow/sample/simplified-data-analysis.flow.js.map +1 -0
  35. package/dist/bubble-flow/sample/slack-v0.1.d.ts +10 -0
  36. package/dist/bubble-flow/sample/slack-v0.1.d.ts.map +1 -0
  37. package/dist/bubble-flow/sample/slack-v0.1.js +59 -0
  38. package/dist/bubble-flow/sample/slack-v0.1.js.map +1 -0
  39. package/dist/bubble-flow/sample/slackagenttest.d.ts +10 -0
  40. package/dist/bubble-flow/sample/slackagenttest.d.ts.map +1 -0
  41. package/dist/bubble-flow/sample/slackagenttest.js +59 -0
  42. package/dist/bubble-flow/sample/slackagenttest.js.map +1 -0
  43. package/dist/bubble-trigger/index.d.ts +2 -0
  44. package/dist/bubble-trigger/index.d.ts.map +1 -0
  45. package/dist/bubble-trigger/index.js +2 -0
  46. package/dist/bubble-trigger/index.js.map +1 -0
  47. package/dist/bubble-trigger/types.d.ts +87 -0
  48. package/dist/bubble-trigger/types.d.ts.map +1 -0
  49. package/dist/bubble-trigger/types.js +14 -0
  50. package/dist/bubble-trigger/types.js.map +1 -0
  51. package/dist/bubbles/service-bubble/ai-agent.d.ts +428 -0
  52. package/dist/bubbles/service-bubble/ai-agent.d.ts.map +1 -0
  53. package/dist/bubbles/service-bubble/ai-agent.js +881 -0
  54. package/dist/bubbles/service-bubble/ai-agent.js.map +1 -0
  55. package/dist/bubbles/service-bubble/gmail.d.ts +3073 -0
  56. package/dist/bubbles/service-bubble/gmail.d.ts.map +1 -0
  57. package/dist/bubbles/service-bubble/gmail.js +908 -0
  58. package/dist/bubbles/service-bubble/gmail.js.map +1 -0
  59. package/dist/bubbles/service-bubble/google-calendar.d.ts +3377 -0
  60. package/dist/bubbles/service-bubble/google-calendar.d.ts.map +1 -0
  61. package/dist/bubbles/service-bubble/google-calendar.js +527 -0
  62. package/dist/bubbles/service-bubble/google-calendar.js.map +1 -0
  63. package/dist/bubbles/service-bubble/google-drive.d.ts +1152 -0
  64. package/dist/bubbles/service-bubble/google-drive.d.ts.map +1 -0
  65. package/dist/bubbles/service-bubble/google-drive.js +943 -0
  66. package/dist/bubbles/service-bubble/google-drive.js.map +1 -0
  67. package/dist/bubbles/service-bubble/google-sheets.d.ts +1811 -0
  68. package/dist/bubbles/service-bubble/google-sheets.d.ts.map +1 -0
  69. package/dist/bubbles/service-bubble/google-sheets.js +904 -0
  70. package/dist/bubbles/service-bubble/google-sheets.js.map +1 -0
  71. package/dist/bubbles/service-bubble/hello-world.d.ts +74 -0
  72. package/dist/bubbles/service-bubble/hello-world.d.ts.map +1 -0
  73. package/dist/bubbles/service-bubble/hello-world.js +67 -0
  74. package/dist/bubbles/service-bubble/hello-world.js.map +1 -0
  75. package/dist/bubbles/service-bubble/http.d.ts +134 -0
  76. package/dist/bubbles/service-bubble/http.d.ts.map +1 -0
  77. package/dist/bubbles/service-bubble/http.js +184 -0
  78. package/dist/bubbles/service-bubble/http.js.map +1 -0
  79. package/dist/bubbles/service-bubble/postgresql.d.ts +180 -0
  80. package/dist/bubbles/service-bubble/postgresql.d.ts.map +1 -0
  81. package/dist/bubbles/service-bubble/postgresql.js +448 -0
  82. package/dist/bubbles/service-bubble/postgresql.js.map +1 -0
  83. package/dist/bubbles/service-bubble/resend.d.ts +301 -0
  84. package/dist/bubbles/service-bubble/resend.d.ts.map +1 -0
  85. package/dist/bubbles/service-bubble/resend.js +253 -0
  86. package/dist/bubbles/service-bubble/resend.js.map +1 -0
  87. package/dist/bubbles/service-bubble/slack.d.ts +5869 -0
  88. package/dist/bubbles/service-bubble/slack.d.ts.map +1 -0
  89. package/dist/bubbles/service-bubble/slack.js +1536 -0
  90. package/dist/bubbles/service-bubble/slack.js.map +1 -0
  91. package/dist/bubbles/service-bubble/storage.d.ts +571 -0
  92. package/dist/bubbles/service-bubble/storage.d.ts.map +1 -0
  93. package/dist/bubbles/service-bubble/storage.js +504 -0
  94. package/dist/bubbles/service-bubble/storage.js.map +1 -0
  95. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts +308 -0
  96. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.d.ts.map +1 -0
  97. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js +285 -0
  98. package/dist/bubbles/tool-bubble/bubbleflow-validation-tool.js.map +1 -0
  99. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts +416 -0
  100. package/dist/bubbles/tool-bubble/chart-js-tool.d.ts.map +1 -0
  101. package/dist/bubbles/tool-bubble/chart-js-tool.js +570 -0
  102. package/dist/bubbles/tool-bubble/chart-js-tool.js.map +1 -0
  103. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts +99 -0
  104. package/dist/bubbles/tool-bubble/get-bubble-details-tool.d.ts.map +1 -0
  105. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js +645 -0
  106. package/dist/bubbles/tool-bubble/get-bubble-details-tool.js.map +1 -0
  107. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts +112 -0
  108. package/dist/bubbles/tool-bubble/list-bubbles-tool.d.ts.map +1 -0
  109. package/dist/bubbles/tool-bubble/list-bubbles-tool.js +82 -0
  110. package/dist/bubbles/tool-bubble/list-bubbles-tool.js.map +1 -0
  111. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts +413 -0
  112. package/dist/bubbles/tool-bubble/reddit-scrape-tool.d.ts.map +1 -0
  113. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js +327 -0
  114. package/dist/bubbles/tool-bubble/reddit-scrape-tool.js.map +1 -0
  115. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts +122 -0
  116. package/dist/bubbles/tool-bubble/research-agent-tool.d.ts.map +1 -0
  117. package/dist/bubbles/tool-bubble/research-agent-tool.js +343 -0
  118. package/dist/bubbles/tool-bubble/research-agent-tool.js.map +1 -0
  119. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts +131 -0
  120. package/dist/bubbles/tool-bubble/sql-query-tool.d.ts.map +1 -0
  121. package/dist/bubbles/tool-bubble/sql-query-tool.js +147 -0
  122. package/dist/bubbles/tool-bubble/sql-query-tool.js.map +1 -0
  123. package/dist/bubbles/tool-bubble/tool-template.d.ts +257 -0
  124. package/dist/bubbles/tool-bubble/tool-template.d.ts.map +1 -0
  125. package/dist/bubbles/tool-bubble/tool-template.js +238 -0
  126. package/dist/bubbles/tool-bubble/tool-template.js.map +1 -0
  127. package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts +8 -0
  128. package/dist/bubbles/tool-bubble/virtual-file-editor-example.d.ts.map +1 -0
  129. package/dist/bubbles/tool-bubble/virtual-file-editor-example.js +65 -0
  130. package/dist/bubbles/tool-bubble/virtual-file-editor-example.js.map +1 -0
  131. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts +125 -0
  132. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.d.ts.map +1 -0
  133. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js +169 -0
  134. package/dist/bubbles/tool-bubble/virtual-file-editor.tool.js.map +1 -0
  135. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts +218 -0
  136. package/dist/bubbles/tool-bubble/web-crawl-tool.d.ts.map +1 -0
  137. package/dist/bubbles/tool-bubble/web-crawl-tool.js +255 -0
  138. package/dist/bubbles/tool-bubble/web-crawl-tool.js.map +1 -0
  139. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts +134 -0
  140. package/dist/bubbles/tool-bubble/web-extract-tool.d.ts.map +1 -0
  141. package/dist/bubbles/tool-bubble/web-extract-tool.js +175 -0
  142. package/dist/bubbles/tool-bubble/web-extract-tool.js.map +1 -0
  143. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts +228 -0
  144. package/dist/bubbles/tool-bubble/web-scrape-tool.d.ts.map +1 -0
  145. package/dist/bubbles/tool-bubble/web-scrape-tool.js +214 -0
  146. package/dist/bubbles/tool-bubble/web-scrape-tool.js.map +1 -0
  147. package/dist/bubbles/tool-bubble/web-search-tool.d.ts +134 -0
  148. package/dist/bubbles/tool-bubble/web-search-tool.d.ts.map +1 -0
  149. package/dist/bubbles/tool-bubble/web-search-tool.js +155 -0
  150. package/dist/bubbles/tool-bubble/web-search-tool.js.map +1 -0
  151. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts +114 -0
  152. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.d.ts.map +1 -0
  153. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js +777 -0
  154. package/dist/bubbles/workflow-bubble/bubbleflow-generator.workflow.js.map +1 -0
  155. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts +97 -0
  156. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.d.ts.map +1 -0
  157. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js +327 -0
  158. package/dist/bubbles/workflow-bubble/bubblscript-generateor.workflow.js.map +1 -0
  159. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts +303 -0
  160. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.d.ts.map +1 -0
  161. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.js +297 -0
  162. package/dist/bubbles/workflow-bubble/database-analyzer.workflow.js.map +1 -0
  163. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts +157 -0
  164. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.d.ts.map +1 -0
  165. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js +310 -0
  166. package/dist/bubbles/workflow-bubble/file-editor-agent.workflow.js.map +1 -0
  167. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts +543 -0
  168. package/dist/bubbles/workflow-bubble/generate-document.workflow.d.ts.map +1 -0
  169. package/dist/bubbles/workflow-bubble/generate-document.workflow.js +628 -0
  170. package/dist/bubbles/workflow-bubble/generate-document.workflow.js.map +1 -0
  171. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts +679 -0
  172. package/dist/bubbles/workflow-bubble/parse-document.workflow.d.ts.map +1 -0
  173. package/dist/bubbles/workflow-bubble/parse-document.workflow.js +604 -0
  174. package/dist/bubbles/workflow-bubble/parse-document.workflow.js.map +1 -0
  175. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts +1011 -0
  176. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.d.ts.map +1 -0
  177. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js +841 -0
  178. package/dist/bubbles/workflow-bubble/pdf-form-operations.workflow.js.map +1 -0
  179. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts +883 -0
  180. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.d.ts.map +1 -0
  181. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js +781 -0
  182. package/dist/bubbles/workflow-bubble/pdf-ocr.workflow.js.map +1 -0
  183. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts +300 -0
  184. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.d.ts.map +1 -0
  185. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js +508 -0
  186. package/dist/bubbles/workflow-bubble/slack-data-assistant.workflow.js.map +1 -0
  187. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts +731 -0
  188. package/dist/bubbles/workflow-bubble/slack-formatter-agent.d.ts.map +1 -0
  189. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js +690 -0
  190. package/dist/bubbles/workflow-bubble/slack-formatter-agent.js.map +1 -0
  191. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts +401 -0
  192. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.d.ts.map +1 -0
  193. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js +382 -0
  194. package/dist/bubbles/workflow-bubble/slack-notifier.workflow.js.map +1 -0
  195. package/dist/bubbles/workflow-bubble/workflow-template.d.ts +144 -0
  196. package/dist/bubbles/workflow-bubble/workflow-template.d.ts.map +1 -0
  197. package/dist/bubbles/workflow-bubble/workflow-template.js +124 -0
  198. package/dist/bubbles/workflow-bubble/workflow-template.js.map +1 -0
  199. package/dist/index.d.ts +46 -0
  200. package/dist/index.d.ts.map +1 -0
  201. package/dist/index.js +53 -0
  202. package/dist/index.js.map +1 -0
  203. package/dist/logging/BubbleLogger.d.ts +146 -0
  204. package/dist/logging/BubbleLogger.d.ts.map +1 -0
  205. package/dist/logging/BubbleLogger.js +472 -0
  206. package/dist/logging/BubbleLogger.js.map +1 -0
  207. package/dist/logging/StreamingBubbleLogger.d.ts +85 -0
  208. package/dist/logging/StreamingBubbleLogger.d.ts.map +1 -0
  209. package/dist/logging/StreamingBubbleLogger.js +340 -0
  210. package/dist/logging/StreamingBubbleLogger.js.map +1 -0
  211. package/dist/types/ai-models.d.ts +4 -0
  212. package/dist/types/ai-models.d.ts.map +1 -0
  213. package/dist/types/ai-models.js +14 -0
  214. package/dist/types/ai-models.js.map +1 -0
  215. package/dist/types/available-tools.d.ts +4 -0
  216. package/dist/types/available-tools.d.ts.map +1 -0
  217. package/dist/types/available-tools.js +19 -0
  218. package/dist/types/available-tools.js.map +1 -0
  219. package/dist/types/base-bubble-class.d.ts +47 -0
  220. package/dist/types/base-bubble-class.d.ts.map +1 -0
  221. package/dist/types/base-bubble-class.js +212 -0
  222. package/dist/types/base-bubble-class.js.map +1 -0
  223. package/dist/types/bubble-errors.d.ts +44 -0
  224. package/dist/types/bubble-errors.d.ts.map +1 -0
  225. package/dist/types/bubble-errors.js +51 -0
  226. package/dist/types/bubble-errors.js.map +1 -0
  227. package/dist/types/bubble.d.ts +73 -0
  228. package/dist/types/bubble.d.ts.map +1 -0
  229. package/dist/types/bubble.js +2 -0
  230. package/dist/types/bubble.js.map +1 -0
  231. package/dist/types/credentials.d.ts +6 -0
  232. package/dist/types/credentials.d.ts.map +1 -0
  233. package/dist/types/credentials.js +6 -0
  234. package/dist/types/credentials.js.map +1 -0
  235. package/dist/types/service-bubble-class.d.ts +31 -0
  236. package/dist/types/service-bubble-class.d.ts.map +1 -0
  237. package/dist/types/service-bubble-class.js +36 -0
  238. package/dist/types/service-bubble-class.js.map +1 -0
  239. package/dist/types/streaming-events.d.ts +18 -0
  240. package/dist/types/streaming-events.d.ts.map +1 -0
  241. package/dist/types/streaming-events.js +5 -0
  242. package/dist/types/streaming-events.js.map +1 -0
  243. package/dist/types/tool-bubble-class.d.ts +19 -0
  244. package/dist/types/tool-bubble-class.d.ts.map +1 -0
  245. package/dist/types/tool-bubble-class.js +48 -0
  246. package/dist/types/tool-bubble-class.js.map +1 -0
  247. package/dist/types/workflow-bubble-class.d.ts +25 -0
  248. package/dist/types/workflow-bubble-class.d.ts.map +1 -0
  249. package/dist/types/workflow-bubble-class.js +30 -0
  250. package/dist/types/workflow-bubble-class.js.map +1 -0
  251. package/dist/utils/bubbleflow-parser.d.ts +32 -0
  252. package/dist/utils/bubbleflow-parser.d.ts.map +1 -0
  253. package/dist/utils/bubbleflow-parser.js +332 -0
  254. package/dist/utils/bubbleflow-parser.js.map +1 -0
  255. package/dist/utils/bubbleflow-validation.d.ts +9 -0
  256. package/dist/utils/bubbleflow-validation.d.ts.map +1 -0
  257. package/dist/utils/bubbleflow-validation.js +116 -0
  258. package/dist/utils/bubbleflow-validation.js.map +1 -0
  259. package/dist/utils/json-parsing.d.ts +20 -0
  260. package/dist/utils/json-parsing.d.ts.map +1 -0
  261. package/dist/utils/json-parsing.js +394 -0
  262. package/dist/utils/json-parsing.js.map +1 -0
  263. package/dist/utils/mock-data-generator.d.ts +43 -0
  264. package/dist/utils/mock-data-generator.d.ts.map +1 -0
  265. package/dist/utils/mock-data-generator.js +312 -0
  266. package/dist/utils/mock-data-generator.js.map +1 -0
  267. package/dist/utils/param-helper.d.ts +2 -0
  268. package/dist/utils/param-helper.d.ts.map +1 -0
  269. package/dist/utils/param-helper.js +5 -0
  270. package/dist/utils/param-helper.js.map +1 -0
  271. package/dist/utils/source-bubble-parser.d.ts +31 -0
  272. package/dist/utils/source-bubble-parser.d.ts.map +1 -0
  273. package/dist/utils/source-bubble-parser.js +231 -0
  274. package/dist/utils/source-bubble-parser.js.map +1 -0
  275. package/package.json +63 -0
@@ -0,0 +1,25 @@
1
+ import type { IWorkflowBubble, BubbleOperationResult, ServiceBubbleParams, BubbleContext } from './bubble.js';
2
+ import { BaseBubble } from './base-bubble-class.js';
3
+ /**
4
+ * WorkflowBubble - Higher-level abstraction that orchestrates ServiceBubbles
5
+ * to create common, reusable workflow patterns.
6
+ *
7
+ * Key principles:
8
+ * - User-friendly parameter names with clear purpose
9
+ * - TypeScript type safety with helpful intellisense
10
+ * - Composable patterns that reduce BubbleFlow complexity
11
+ * - Error handling and validation at workflow level
12
+ */
13
+ export declare abstract class WorkflowBubble<TParams extends ServiceBubbleParams = ServiceBubbleParams, TResult extends BubbleOperationResult = BubbleOperationResult> extends BaseBubble<TParams, TResult> implements IWorkflowBubble<TResult> {
14
+ readonly type: "workflow";
15
+ constructor(params: unknown, context?: BubbleContext);
16
+ /**
17
+ * Get the current parameters
18
+ */
19
+ get currentParams(): TParams;
20
+ /**
21
+ * Get the current context
22
+ */
23
+ get currentContext(): BubbleContext | undefined;
24
+ }
25
+ //# sourceMappingURL=workflow-bubble-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-bubble-class.d.ts","sourceRoot":"","sources":["../../src/types/workflow-bubble-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;;;;;;GASG;AACH,8BAAsB,cAAc,CAChC,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EACzD,OAAO,SAAS,qBAAqB,GAAG,qBAAqB,CAE/D,SAAQ,UAAU,CAAC,OAAO,EAAE,OAAO,CACnC,YAAW,eAAe,CAAC,OAAO,CAAC;IAEnC,SAAgB,IAAI,EAAG,UAAU,CAAU;gBAE/B,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,aAAa;IAIpD;;OAEG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,aAAa,GAAG,SAAS,CAE9C;CACF"}
@@ -0,0 +1,30 @@
1
+ import { BaseBubble } from './base-bubble-class.js';
2
+ /**
3
+ * WorkflowBubble - Higher-level abstraction that orchestrates ServiceBubbles
4
+ * to create common, reusable workflow patterns.
5
+ *
6
+ * Key principles:
7
+ * - User-friendly parameter names with clear purpose
8
+ * - TypeScript type safety with helpful intellisense
9
+ * - Composable patterns that reduce BubbleFlow complexity
10
+ * - Error handling and validation at workflow level
11
+ */
12
+ export class WorkflowBubble extends BaseBubble {
13
+ type = 'workflow';
14
+ constructor(params, context) {
15
+ super(params, context);
16
+ }
17
+ /**
18
+ * Get the current parameters
19
+ */
20
+ get currentParams() {
21
+ return this.params;
22
+ }
23
+ /**
24
+ * Get the current context
25
+ */
26
+ get currentContext() {
27
+ return this.context;
28
+ }
29
+ }
30
+ //# sourceMappingURL=workflow-bubble-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-bubble-class.js","sourceRoot":"","sources":["../../src/types/workflow-bubble-class.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,OAAgB,cAIpB,SAAQ,UAA4B;IAGpB,IAAI,GAAG,UAAmB,CAAC;IAE3C,YAAY,MAAe,EAAE,OAAuB;QAClD,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ import type { BubbleFactory } from '../bubble-factory.js';
2
+ import type { BubbleName, ParsedBubble, BubbleParameter } from '@bubblelab/shared-schemas';
3
+ export interface BubbleFlowParseResult {
4
+ success: boolean;
5
+ bubbles: Record<string, ParsedBubble>;
6
+ errors?: string[];
7
+ }
8
+ /**
9
+ * Parses a BubbleFlow TypeScript code and extracts all bubble instantiations
10
+ * with their parameters using the BubbleRegistry for accurate mapping.
11
+ */
12
+ export declare function parseBubbleFlow(code: string, bubbleFactory: BubbleFactory): BubbleFlowParseResult;
13
+ /**
14
+ * Reconstructs a BubbleFlow code string from parsed bubbles and parameters.
15
+ */
16
+ export declare function reconstructBubbleFlow(originalCode: string, bubbleParameters: Record<string, ParsedBubble>, bubbleFactory: BubbleFactory): {
17
+ success: boolean;
18
+ code?: string;
19
+ errors?: string[];
20
+ };
21
+ /**
22
+ * Validates bubble parameters against their schema from the BubbleRegistry
23
+ */
24
+ export declare function validateBubbleParameters(bubbleName: BubbleName, bubbleFactory: BubbleFactory, _parameters: BubbleParameter[]): {
25
+ valid: boolean;
26
+ errors?: string[];
27
+ };
28
+ /**
29
+ * Gets available parameter schema for a bubble from the registry
30
+ */
31
+ export declare function getBubbleParameterSchema(bubbleName: BubbleName, bubbleFactory: BubbleFactory): unknown;
32
+ //# sourceMappingURL=bubbleflow-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubbleflow-parser.d.ts","sourceRoot":"","sources":["../../src/utils/bubbleflow-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,aAAa,GAC3B,qBAAqB,CA+FvB;AAyLD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EAC9C,aAAa,EAAE,aAAa,GAC3B;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA2HxD;AA+BD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,EAE5B,WAAW,EAAE,eAAe,EAAE,GAC7B;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CASvC;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,GAC3B,OAAO,CAET"}
@@ -0,0 +1,332 @@
1
+ import * as ts from 'typescript';
2
+ import { BubbleParameterType } from '@bubblelab/shared-schemas';
3
+ /**
4
+ * Parses a BubbleFlow TypeScript code and extracts all bubble instantiations
5
+ * with their parameters using the BubbleRegistry for accurate mapping.
6
+ */
7
+ export function parseBubbleFlow(code, bubbleFactory) {
8
+ try {
9
+ // First, try to create the source file and check for basic syntax errors
10
+ const sourceFile = ts.createSourceFile('temp.ts', code, ts.ScriptTarget.ES2022, true);
11
+ // Check if there are any parse diagnostics
12
+ const syntaxDiagnostics = sourceFile.parseDiagnostics;
13
+ if (syntaxDiagnostics && syntaxDiagnostics.length > 0) {
14
+ const errors = syntaxDiagnostics.map((diagnostic) => {
15
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
16
+ return `Syntax error: ${message}`;
17
+ });
18
+ return {
19
+ success: false,
20
+ bubbles: {},
21
+ errors,
22
+ };
23
+ }
24
+ const bubbles = {};
25
+ const errors = [];
26
+ // Build reverse lookup map from class names to bubble names using BubbleRegistry
27
+ const classNameToBubbleName = buildClassNameLookup(bubbleFactory);
28
+ function visit(node) {
29
+ // Look for variable declarations with bubble instantiations
30
+ if (ts.isVariableDeclaration(node) && node.initializer) {
31
+ const variableName = node.name.getText(sourceFile);
32
+ const bubbleInfo = extractBubbleFromExpression(node.initializer, sourceFile, classNameToBubbleName);
33
+ if (bubbleInfo) {
34
+ bubbles[variableName] = {
35
+ variableName,
36
+ ...bubbleInfo,
37
+ };
38
+ }
39
+ }
40
+ // Look for expression statements with anonymous bubble instantiations
41
+ if (ts.isExpressionStatement(node)) {
42
+ const bubbleInfo = extractBubbleFromExpression(node.expression, sourceFile, classNameToBubbleName);
43
+ if (bubbleInfo) {
44
+ // Generate a synthetic variable name for anonymous calls
45
+ const syntheticName = `_anonymous_${bubbleInfo.className}_${Object.keys(bubbles).length}`;
46
+ bubbles[syntheticName] = {
47
+ variableName: syntheticName,
48
+ ...bubbleInfo,
49
+ };
50
+ }
51
+ }
52
+ // Note: We now parse both variable declarations and anonymous expression statements
53
+ // Method calls like 'await postgres.action()' are NOT parsed as they are usage, not instantiation
54
+ ts.forEachChild(node, visit);
55
+ }
56
+ visit(sourceFile);
57
+ return {
58
+ success: errors.length === 0,
59
+ bubbles,
60
+ errors: errors.length > 0 ? errors : undefined,
61
+ };
62
+ }
63
+ catch (error) {
64
+ return {
65
+ success: false,
66
+ bubbles: {},
67
+ errors: [
68
+ `Parse error: ${error instanceof Error ? error.message : String(error)}`,
69
+ ],
70
+ };
71
+ }
72
+ }
73
+ function buildClassNameLookup(bubbleFactory) {
74
+ const lookup = new Map();
75
+ // Get all registered bubbles and their metadata
76
+ const allBubbles = bubbleFactory.getAll();
77
+ const bubbleNames = bubbleFactory.list();
78
+ bubbleNames.forEach((bubbleName, index) => {
79
+ const bubbleClass = allBubbles[index];
80
+ if (bubbleClass) {
81
+ // Extract the class name from the constructor
82
+ const className = bubbleClass.name;
83
+ lookup.set(className, { bubbleName, className });
84
+ }
85
+ });
86
+ return lookup;
87
+ }
88
+ function extractBubbleFromExpression(expression, sourceFile, classNameLookup) {
89
+ // Handle await expressions only if they contain instantiations
90
+ if (ts.isAwaitExpression(expression)) {
91
+ const awaitResult = extractBubbleFromExpression(expression.expression, sourceFile, classNameLookup);
92
+ if (awaitResult) {
93
+ awaitResult.hasAwait = true;
94
+ }
95
+ return awaitResult;
96
+ }
97
+ // Handle direct new expressions
98
+ if (ts.isNewExpression(expression)) {
99
+ const result = extractBubbleFromNewExpression(expression, sourceFile, classNameLookup);
100
+ if (result) {
101
+ result.hasAwait = false;
102
+ result.hasActionCall = false;
103
+ }
104
+ return result;
105
+ }
106
+ // Handle call expressions (like .action())
107
+ if (ts.isCallExpression(expression) &&
108
+ ts.isPropertyAccessExpression(expression.expression)) {
109
+ const propertyAccess = expression.expression;
110
+ if (propertyAccess.name.text === 'action' &&
111
+ ts.isNewExpression(propertyAccess.expression)) {
112
+ const result = extractBubbleFromNewExpression(propertyAccess.expression, sourceFile, classNameLookup);
113
+ if (result) {
114
+ result.hasAwait = false;
115
+ result.hasActionCall = true;
116
+ }
117
+ return result;
118
+ }
119
+ }
120
+ return null;
121
+ }
122
+ function extractBubbleFromNewExpression(newExpr, sourceFile, classNameLookup) {
123
+ if (!newExpr.expression || !ts.isIdentifier(newExpr.expression)) {
124
+ return null;
125
+ }
126
+ const className = newExpr.expression.text;
127
+ // Look up the bubble info using the registry
128
+ const bubbleInfo = classNameLookup.get(className);
129
+ if (!bubbleInfo) {
130
+ return null; // Not a registered bubble
131
+ }
132
+ const parameters = [];
133
+ // Extract parameters from the constructor call
134
+ if (newExpr.arguments && newExpr.arguments.length > 0) {
135
+ const firstArg = newExpr.arguments[0];
136
+ if (ts.isObjectLiteralExpression(firstArg)) {
137
+ firstArg.properties.forEach((prop) => {
138
+ if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
139
+ const paramName = prop.name.text;
140
+ const paramValue = extractParameterValue(prop.initializer, sourceFile);
141
+ parameters.push({
142
+ name: paramName,
143
+ ...paramValue,
144
+ });
145
+ }
146
+ });
147
+ }
148
+ }
149
+ return {
150
+ bubbleName: bubbleInfo.bubbleName,
151
+ className: bubbleInfo.className,
152
+ parameters,
153
+ hasAwait: false, // Will be set by calling functions
154
+ hasActionCall: false, // Will be set by calling functions
155
+ };
156
+ }
157
+ function extractParameterValue(expression, sourceFile) {
158
+ const valueText = expression.getText(sourceFile);
159
+ // Check if it's an environment variable access - need to handle non-null assertion
160
+ if (ts.isNonNullExpression(expression)) {
161
+ const innerExpression = expression.expression;
162
+ if (ts.isPropertyAccessExpression(innerExpression)) {
163
+ const fullText = innerExpression.getText(sourceFile);
164
+ if (fullText.startsWith('process.env.')) {
165
+ return { value: valueText, type: BubbleParameterType.ENV };
166
+ }
167
+ }
168
+ }
169
+ // Check direct property access (without non-null assertion)
170
+ if (ts.isPropertyAccessExpression(expression) ||
171
+ ts.isElementAccessExpression(expression)) {
172
+ const fullText = expression.getText(sourceFile);
173
+ if (fullText.startsWith('process.env.')) {
174
+ return { value: fullText, type: BubbleParameterType.ENV };
175
+ }
176
+ }
177
+ // Check TypeScript syntax kinds for type detection
178
+ if (ts.isStringLiteral(expression) || ts.isTemplateExpression(expression)) {
179
+ return { value: valueText, type: BubbleParameterType.STRING };
180
+ }
181
+ if (ts.isNumericLiteral(expression)) {
182
+ return { value: valueText, type: BubbleParameterType.NUMBER };
183
+ }
184
+ if (expression.kind === ts.SyntaxKind.TrueKeyword ||
185
+ expression.kind === ts.SyntaxKind.FalseKeyword) {
186
+ return { value: valueText, type: BubbleParameterType.BOOLEAN };
187
+ }
188
+ if (ts.isArrayLiteralExpression(expression)) {
189
+ return { value: valueText, type: BubbleParameterType.ARRAY };
190
+ }
191
+ if (ts.isObjectLiteralExpression(expression)) {
192
+ return { value: valueText, type: BubbleParameterType.OBJECT };
193
+ }
194
+ return { value: valueText, type: BubbleParameterType.UNKNOWN };
195
+ }
196
+ /**
197
+ * Reconstructs a BubbleFlow code string from parsed bubbles and parameters.
198
+ */
199
+ export function reconstructBubbleFlow(originalCode, bubbleParameters, bubbleFactory) {
200
+ try {
201
+ const sourceFile = ts.createSourceFile('temp.ts', originalCode, ts.ScriptTarget.ES2022, true);
202
+ const errors = [];
203
+ let modifiedCode = originalCode;
204
+ const modifications = [];
205
+ const classNameLookup = buildClassNameLookup(bubbleFactory);
206
+ function visit(node) {
207
+ // Look for variable declarations with bubble instantiations
208
+ if (ts.isVariableDeclaration(node) && node.initializer) {
209
+ const variableName = node.name.getText(sourceFile);
210
+ const newBubbleParams = bubbleParameters[variableName];
211
+ if (newBubbleParams) {
212
+ const bubbleInfo = extractBubbleFromExpression(node.initializer, sourceFile, classNameLookup);
213
+ if (bubbleInfo) {
214
+ // Validate bubble name matches
215
+ if (bubbleInfo.bubbleName !== newBubbleParams.bubbleName) {
216
+ errors.push(`Bubble name mismatch for variable '${variableName}': expected '${bubbleInfo.bubbleName}', got '${newBubbleParams.bubbleName}'`);
217
+ return;
218
+ }
219
+ // Generate new bubble instantiation
220
+ const newBubbleCode = generateBubbleInstantiation(newBubbleParams);
221
+ const bubbleStart = node.initializer.getStart(sourceFile);
222
+ const bubbleEnd = node.initializer.getEnd();
223
+ modifications.push({
224
+ start: bubbleStart,
225
+ end: bubbleEnd,
226
+ replacement: newBubbleCode,
227
+ });
228
+ }
229
+ }
230
+ }
231
+ // Look for expression statements with anonymous bubble instantiations
232
+ if (ts.isExpressionStatement(node)) {
233
+ const bubbleInfo = extractBubbleFromExpression(node.expression, sourceFile, classNameLookup);
234
+ if (bubbleInfo) {
235
+ // Generate synthetic name to match what parseBubbleFlow creates
236
+ const syntheticName = `_anonymous_${bubbleInfo.className}_`;
237
+ // Find matching bubble parameters by checking if any key starts with our synthetic pattern
238
+ const matchingEntry = Object.entries(bubbleParameters).find(([key]) => key.startsWith(syntheticName));
239
+ if (matchingEntry) {
240
+ const [, newBubbleParams] = matchingEntry;
241
+ // Validate bubble name matches
242
+ if (bubbleInfo.bubbleName !== newBubbleParams.bubbleName) {
243
+ errors.push(`Bubble name mismatch for anonymous call: expected '${bubbleInfo.bubbleName}', got '${newBubbleParams.bubbleName}'`);
244
+ return;
245
+ }
246
+ // Generate new bubble instantiation
247
+ const newBubbleCode = generateBubbleInstantiation(newBubbleParams);
248
+ const bubbleStart = node.expression.getStart(sourceFile);
249
+ const bubbleEnd = node.expression.getEnd();
250
+ modifications.push({
251
+ start: bubbleStart,
252
+ end: bubbleEnd,
253
+ replacement: newBubbleCode,
254
+ });
255
+ }
256
+ }
257
+ }
258
+ ts.forEachChild(node, visit);
259
+ }
260
+ visit(sourceFile);
261
+ if (errors.length > 0) {
262
+ return { success: false, errors };
263
+ }
264
+ // Apply modifications in reverse order to maintain positions
265
+ modifications.sort((a, b) => b.start - a.start);
266
+ for (const mod of modifications) {
267
+ modifiedCode =
268
+ modifiedCode.slice(0, mod.start) +
269
+ mod.replacement +
270
+ modifiedCode.slice(mod.end);
271
+ }
272
+ return { success: true, code: modifiedCode };
273
+ }
274
+ catch (error) {
275
+ return {
276
+ success: false,
277
+ errors: [
278
+ `Reconstruction error: ${error instanceof Error ? error.message : String(error)}`,
279
+ ],
280
+ };
281
+ }
282
+ }
283
+ function generateBubbleInstantiation(bubble) {
284
+ const paramStrings = bubble.parameters.map((param) => {
285
+ // Handle case where value might be an object (like credentials)
286
+ const valueStr = typeof param.value === 'string'
287
+ ? param.value
288
+ : JSON.stringify(param.value);
289
+ return `${param.name}: ${valueStr}`;
290
+ });
291
+ const hasParams = bubble.parameters.length > 0;
292
+ const paramsString = hasParams ? `{\n ${paramStrings.join(',\n ')}\n}` : '';
293
+ // Reconstruct based on original pattern
294
+ if (bubble.hasAwait && bubble.hasActionCall) {
295
+ // Original: await new BubbleName({...}).action()
296
+ return `await new ${bubble.className}(${paramsString}).action()`;
297
+ }
298
+ else if (bubble.hasAwait && !bubble.hasActionCall) {
299
+ // Original: await new BubbleName({...})
300
+ return `await new ${bubble.className}(${paramsString})`;
301
+ }
302
+ else if (!bubble.hasAwait && bubble.hasActionCall) {
303
+ // Original: new BubbleName({...}).action()
304
+ return `new ${bubble.className}(${paramsString}).action()`;
305
+ }
306
+ else {
307
+ // Original: new BubbleName({...})
308
+ return `new ${bubble.className}(${paramsString})`;
309
+ }
310
+ }
311
+ /**
312
+ * Validates bubble parameters against their schema from the BubbleRegistry
313
+ */
314
+ export function validateBubbleParameters(bubbleName, bubbleFactory,
315
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
316
+ _parameters // intentionally unused, reserved for future validation
317
+ ) {
318
+ const bubbleMetadata = bubbleFactory.getMetadata(bubbleName);
319
+ if (!bubbleMetadata) {
320
+ return { valid: false, errors: [`Unknown bubble: ${bubbleName}`] };
321
+ }
322
+ // For now, return success - full schema validation would require
323
+ // evaluating the parameter values in context
324
+ return { valid: true };
325
+ }
326
+ /**
327
+ * Gets available parameter schema for a bubble from the registry
328
+ */
329
+ export function getBubbleParameterSchema(bubbleName, bubbleFactory) {
330
+ return bubbleFactory.getMetadata(bubbleName);
331
+ }
332
+ //# sourceMappingURL=bubbleflow-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubbleflow-parser.js","sourceRoot":"","sources":["../../src/utils/bubbleflow-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAOjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAQhE;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAY,EACZ,aAA4B;IAE5B,IAAI,CAAC;QACH,yEAAyE;QACzE,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,SAA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CAAC,EAAE,CAAC;IACrE,CAAC;IAED,iEAAiE;IACjE,6CAA6C;IAC7C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CACtC,UAAsB,EACtB,aAA4B;IAE5B,OAAO,aAAa,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { BubbleFactory } from '../bubble-factory.js';
2
+ import type { ParsedBubble } from '@bubblelab/shared-schemas';
3
+ export interface ValidationResult {
4
+ valid: boolean;
5
+ errors?: string[];
6
+ bubbleParameters?: Record<string, ParsedBubble>;
7
+ }
8
+ export declare function validateBubbleFlow(code: string, bubbleFactory: BubbleFactory): Promise<ValidationResult>;
9
+ //# sourceMappingURL=bubbleflow-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubbleflow-validation.d.ts","sourceRoot":"","sources":["../../src/utils/bubbleflow-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACjD;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,gBAAgB,CAAC,CA4G3B"}
@@ -0,0 +1,116 @@
1
+ import * as ts from 'typescript';
2
+ import { parseBubbleFlow } from './bubbleflow-parser.js';
3
+ export async function validateBubbleFlow(code, bubbleFactory) {
4
+ try {
5
+ // Create a temporary file name for the validation
6
+ const fileName = 'temp-bubble-flow.ts';
7
+ // Get TypeScript compiler options (similar to bubble-core config)
8
+ const compilerOptions = {
9
+ target: ts.ScriptTarget.ES2022,
10
+ module: ts.ModuleKind.ESNext,
11
+ moduleResolution: ts.ModuleResolutionKind.Bundler,
12
+ allowSyntheticDefaultImports: true,
13
+ esModuleInterop: true,
14
+ strict: true,
15
+ noImplicitAny: true,
16
+ skipLibCheck: true,
17
+ verbatimModuleSyntax: true,
18
+ paths: {
19
+ '@bubblelab/bubble-core': ['../../packages/bubble-core/src'],
20
+ },
21
+ baseUrl: '.',
22
+ };
23
+ // Create a program with the code
24
+ const sourceFile = ts.createSourceFile(fileName, code, ts.ScriptTarget.ES2022, true);
25
+ // Create program
26
+ const host = ts.createCompilerHost(compilerOptions);
27
+ // Override getSourceFile to return our code
28
+ const originalGetSourceFile = host.getSourceFile;
29
+ host.getSourceFile = (name, languageVersion, onError, shouldCreateNewSourceFile) => {
30
+ if (name === fileName) {
31
+ return sourceFile;
32
+ }
33
+ return originalGetSourceFile.call(host, name, languageVersion, onError, shouldCreateNewSourceFile);
34
+ };
35
+ const program = ts.createProgram([fileName], compilerOptions, host);
36
+ // Get diagnostics
37
+ const diagnostics = ts.getPreEmitDiagnostics(program);
38
+ if (diagnostics.length > 0) {
39
+ const errors = diagnostics.map((diagnostic) => {
40
+ if (diagnostic.file && diagnostic.start !== undefined) {
41
+ const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
42
+ const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
43
+ return `Line ${line + 1}, Column ${character + 1}: ${message}`;
44
+ }
45
+ return ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
46
+ });
47
+ return {
48
+ valid: false,
49
+ errors,
50
+ };
51
+ }
52
+ // Additional validation: Check if it extends BubbleFlow
53
+ const hasValidBubbleFlow = validateBubbleFlowClass(sourceFile);
54
+ if (!hasValidBubbleFlow.valid) {
55
+ return hasValidBubbleFlow;
56
+ }
57
+ // Parse bubble parameters after successful validation
58
+ const parseResult = parseBubbleFlow(code, bubbleFactory);
59
+ if (!parseResult.success) {
60
+ // This shouldn't happen if TypeScript validation passed, but handle it
61
+ return {
62
+ valid: false,
63
+ errors: parseResult.errors || ['Failed to parse bubble parameters'],
64
+ };
65
+ }
66
+ return {
67
+ valid: true,
68
+ bubbleParameters: parseResult.bubbles,
69
+ };
70
+ }
71
+ catch (error) {
72
+ return {
73
+ valid: false,
74
+ errors: [
75
+ `Validation error: ${error instanceof Error ? error.message : String(error)}`,
76
+ ],
77
+ };
78
+ }
79
+ }
80
+ function validateBubbleFlowClass(sourceFile) {
81
+ let hasBubbleFlowClass = false;
82
+ let hasHandleMethod = false;
83
+ function visit(node) {
84
+ if (ts.isClassDeclaration(node) && node.heritageClauses) {
85
+ // Check if class extends BubbleFlow
86
+ const extendsClause = node.heritageClauses.find((clause) => clause.token === ts.SyntaxKind.ExtendsKeyword);
87
+ if (extendsClause &&
88
+ extendsClause.types.some((type) => ts.isIdentifier(type.expression) &&
89
+ type.expression.text === 'BubbleFlow')) {
90
+ hasBubbleFlowClass = true;
91
+ // Check for handle method
92
+ node.members.forEach((member) => {
93
+ if (ts.isMethodDeclaration(member) &&
94
+ ts.isIdentifier(member.name) &&
95
+ member.name.text === 'handle') {
96
+ hasHandleMethod = true;
97
+ }
98
+ });
99
+ }
100
+ }
101
+ ts.forEachChild(node, visit);
102
+ }
103
+ visit(sourceFile);
104
+ const errors = [];
105
+ if (!hasBubbleFlowClass) {
106
+ errors.push('Code must contain a class that extends BubbleFlow');
107
+ }
108
+ if (!hasHandleMethod) {
109
+ errors.push('BubbleFlow class must have a handle method');
110
+ }
111
+ return {
112
+ valid: errors.length === 0,
113
+ errors: errors.length > 0 ? errors : undefined,
114
+ };
115
+ }
116
+ //# sourceMappingURL=bubbleflow-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bubbleflow-validation.js","sourceRoot":"","sources":["../../src/utils/bubbleflow-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YA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M,CAAC,IAAI,CAAC;wBAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EAC7B,CAAC;wBACD,eAAe,GAAG,IAAI,CAAC;oBACzB,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,CAAC;IAElB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,MAAM,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;KAC/C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * JSON parsing utilities extracted from AI Agent for reusability and testing
3
+ */
4
+ /**
5
+ * Extract JSON from mixed text/JSON responses with robust cleanup
6
+ */
7
+ export declare function extractAndCleanJSON(input: string): string | null;
8
+ /**
9
+ * Post-process potentially malformed JSON string to fix common issues
10
+ */
11
+ export declare function postProcessJSON(jsonString: string): string;
12
+ /**
13
+ * Multi-stage JSON parsing approach with various fallback strategies
14
+ */
15
+ export declare function parseJsonWithFallbacks(finalResponse: string): {
16
+ response: string;
17
+ success: boolean;
18
+ error?: string;
19
+ };
20
+ //# sourceMappingURL=json-parsing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-parsing.d.ts","sourceRoot":"","sources":["../../src/utils/json-parsing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoMH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8ChE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAuG1D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAsEA"}