@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,157 @@
1
+ /**
2
+ * FILE EDITOR AGENT WORKFLOW
3
+ *
4
+ * A minimalistic agentic file editor that uses AI with the virtual-file-editor-tool
5
+ * to iteratively edit code files through natural language instructions.
6
+ *
7
+ * The workflow maintains file state across tool calls using the config mechanism,
8
+ * allowing the AI agent to build up complex edits incrementally.
9
+ */
10
+ import { z } from 'zod';
11
+ import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
12
+ import type { BubbleContext } from '../../types/bubble.js';
13
+ import { CredentialType } from '@bubblelab/shared-schemas';
14
+ /**
15
+ * Schema for file content representation
16
+ * Each file is represented as a JavaScript object where keys are class/function names
17
+ * and values are arrays of lines (indexed by line number)
18
+ */
19
+ /**
20
+ * Parameters schema for file editor agent
21
+ */
22
+ declare const FileEditorAgentParamsSchema: z.ZodObject<{
23
+ files: z.ZodArray<z.ZodString, "many">;
24
+ validationFunction: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodString, "many">, z.ZodNumber], z.ZodUnknown>, z.ZodPromise<z.ZodObject<{
25
+ validated: z.ZodBoolean;
26
+ message: z.ZodString;
27
+ }, "strip", z.ZodTypeAny, {
28
+ message: string;
29
+ validated: boolean;
30
+ }, {
31
+ message: string;
32
+ validated: boolean;
33
+ }>>>>;
34
+ tools: z.ZodDefault<z.ZodArray<z.ZodEnum<["web-search-tool", "web-scrape-tool", "web-crawl-tool", "web-extract-tool", "research-agent-tool", "reddit-scrape-tool", "list-bubbles-tool", "get-bubble-details-tool", "bubbleflow-validation-tool", "virtual-file-editor-tool", "chart-js-tool", "sql-query-tool"]>, "many">>;
35
+ instruction: z.ZodString;
36
+ maxIterations: z.ZodDefault<z.ZodNumber>;
37
+ model: z.ZodDefault<z.ZodEnum<["openai/gpt-5", "openai/gpt-5-mini", "openai/gpt-o4-mini", "google/gemini-2.5-pro", "google/gemini-2.5-flash", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash-image-preview"]>>;
38
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
39
+ }, "strip", z.ZodTypeAny, {
40
+ model: "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-o4-mini" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview";
41
+ tools: ("virtual-file-editor-tool" | "get-bubble-details-tool" | "list-bubbles-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool")[];
42
+ maxIterations: number;
43
+ files: string[];
44
+ instruction: string;
45
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
46
+ validationFunction?: ((args_0: string[], args_1: number, ...args: unknown[]) => Promise<{
47
+ message: string;
48
+ validated: boolean;
49
+ }>) | undefined;
50
+ }, {
51
+ files: string[];
52
+ instruction: string;
53
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
54
+ model?: "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-o4-mini" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | undefined;
55
+ tools?: ("virtual-file-editor-tool" | "get-bubble-details-tool" | "list-bubbles-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool")[] | undefined;
56
+ maxIterations?: number | undefined;
57
+ validationFunction?: ((args_0: string[], args_1: number, ...args: unknown[]) => Promise<{
58
+ message: string;
59
+ validated: boolean;
60
+ }>) | undefined;
61
+ }>;
62
+ /**
63
+ * Result schema for file editor agent
64
+ */
65
+ declare const FileEditorAgentResultSchema: z.ZodObject<{
66
+ iterationsUsed: z.ZodNumber;
67
+ success: z.ZodBoolean;
68
+ fileContent: z.ZodArray<z.ZodString, "many">;
69
+ message: z.ZodString;
70
+ error: z.ZodString;
71
+ }, "strip", z.ZodTypeAny, {
72
+ message: string;
73
+ success: boolean;
74
+ error: string;
75
+ fileContent: string[];
76
+ iterationsUsed: number;
77
+ }, {
78
+ message: string;
79
+ success: boolean;
80
+ error: string;
81
+ fileContent: string[];
82
+ iterationsUsed: number;
83
+ }>;
84
+ type FileEditorAgentParams = z.output<typeof FileEditorAgentParamsSchema>;
85
+ type FileEditorAgentResult = z.output<typeof FileEditorAgentResultSchema>;
86
+ export declare class FileEditorAgentWorkflow extends WorkflowBubble<FileEditorAgentParams, FileEditorAgentResult> {
87
+ static readonly type: "workflow";
88
+ static readonly bubbleName = "file-editor-agent";
89
+ static readonly schema: z.ZodObject<{
90
+ files: z.ZodArray<z.ZodString, "many">;
91
+ validationFunction: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodString, "many">, z.ZodNumber], z.ZodUnknown>, z.ZodPromise<z.ZodObject<{
92
+ validated: z.ZodBoolean;
93
+ message: z.ZodString;
94
+ }, "strip", z.ZodTypeAny, {
95
+ message: string;
96
+ validated: boolean;
97
+ }, {
98
+ message: string;
99
+ validated: boolean;
100
+ }>>>>;
101
+ tools: z.ZodDefault<z.ZodArray<z.ZodEnum<["web-search-tool", "web-scrape-tool", "web-crawl-tool", "web-extract-tool", "research-agent-tool", "reddit-scrape-tool", "list-bubbles-tool", "get-bubble-details-tool", "bubbleflow-validation-tool", "virtual-file-editor-tool", "chart-js-tool", "sql-query-tool"]>, "many">>;
102
+ instruction: z.ZodString;
103
+ maxIterations: z.ZodDefault<z.ZodNumber>;
104
+ model: z.ZodDefault<z.ZodEnum<["openai/gpt-5", "openai/gpt-5-mini", "openai/gpt-o4-mini", "google/gemini-2.5-pro", "google/gemini-2.5-flash", "google/gemini-2.5-flash-lite", "google/gemini-2.5-flash-image-preview"]>>;
105
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodNativeEnum<typeof CredentialType>, z.ZodString>>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ model: "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-o4-mini" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview";
108
+ tools: ("virtual-file-editor-tool" | "get-bubble-details-tool" | "list-bubbles-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool")[];
109
+ maxIterations: number;
110
+ files: string[];
111
+ instruction: string;
112
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
113
+ validationFunction?: ((args_0: string[], args_1: number, ...args: unknown[]) => Promise<{
114
+ message: string;
115
+ validated: boolean;
116
+ }>) | undefined;
117
+ }, {
118
+ files: string[];
119
+ instruction: string;
120
+ credentials?: Partial<Record<CredentialType, string>> | undefined;
121
+ model?: "openai/gpt-5" | "openai/gpt-5-mini" | "openai/gpt-o4-mini" | "google/gemini-2.5-pro" | "google/gemini-2.5-flash" | "google/gemini-2.5-flash-lite" | "google/gemini-2.5-flash-image-preview" | undefined;
122
+ tools?: ("virtual-file-editor-tool" | "get-bubble-details-tool" | "list-bubbles-tool" | "sql-query-tool" | "chart-js-tool" | "web-search-tool" | "web-scrape-tool" | "web-crawl-tool" | "web-extract-tool" | "research-agent-tool" | "reddit-scrape-tool" | "bubbleflow-validation-tool")[] | undefined;
123
+ maxIterations?: number | undefined;
124
+ validationFunction?: ((args_0: string[], args_1: number, ...args: unknown[]) => Promise<{
125
+ message: string;
126
+ validated: boolean;
127
+ }>) | undefined;
128
+ }>;
129
+ static readonly resultSchema: z.ZodObject<{
130
+ iterationsUsed: z.ZodNumber;
131
+ success: z.ZodBoolean;
132
+ fileContent: z.ZodArray<z.ZodString, "many">;
133
+ message: z.ZodString;
134
+ error: z.ZodString;
135
+ }, "strip", z.ZodTypeAny, {
136
+ message: string;
137
+ success: boolean;
138
+ error: string;
139
+ fileContent: string[];
140
+ iterationsUsed: number;
141
+ }, {
142
+ message: string;
143
+ success: boolean;
144
+ error: string;
145
+ fileContent: string[];
146
+ iterationsUsed: number;
147
+ }>;
148
+ static readonly shortDescription = "Agentic file editor using AI with virtual-file-editor-tool";
149
+ static readonly longDescription = "\n A minimalistic workflow that uses an AI agent with the virtual-file-editor-tool\n to iteratively edit code files based on natural language instructions.\n \n How it works:\n 1. Takes file content as a JS object (class/function names \u2192 line arrays)\n 2. AI agent uses virtual-file-editor-tool to make edits\n 3. File state persists across tool calls via config\n 4. Returns edited files in the same object format\n \n Use cases:\n - Refactoring code based on natural language instructions\n - Making systematic changes across multiple classes/functions\n - Applying code transformations iteratively\n ";
150
+ static readonly alias = "file-editor";
151
+ constructor(params: z.input<typeof FileEditorAgentParamsSchema>, context?: BubbleContext);
152
+ private formatFileContent;
153
+ private testValidationFunction;
154
+ protected performAction(_context?: BubbleContext): Promise<FileEditorAgentResult>;
155
+ }
156
+ export {};
157
+ //# sourceMappingURL=file-editor-agent.workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-editor-agent.workflow.d.ts","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/file-editor-agent.workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAK3D;;;;GAIG;AAEH;;GAEG;AACH,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC/B,CAAC;AAEH;;GAEG;AACH,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;EAM/B,CAAC;AAEH,KAAK,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC1E,KAAK,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE1E,qBAAa,uBAAwB,SAAQ,cAAc,CACzD,qBAAqB,EACrB,qBAAqB,CACtB;IACC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IAC3C,MAAM,CAAC,QAAQ,CAAC,UAAU,uBAAuB;IACjD,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAA+B;IACrD,MAAM,CAAC,QAAQ,CAAC,YAAY;;;;;;;;;;;;;;;;;;OAA+B;IAC3D,MAAM,CAAC,QAAQ,CAAC,gBAAgB,gEAC+B;IAC/D,MAAM,CAAC,QAAQ,CAAC,eAAe,8oBAc7B;IACF,MAAM,CAAC,QAAQ,CAAC,KAAK,iBAAiB;gBAGpC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,EACnD,OAAO,CAAC,EAAE,aAAa;IAMzB,OAAO,CAAC,iBAAiB;YAKX,sBAAsB;cAgBpB,aAAa,CAC3B,QAAQ,CAAC,EAAE,aAAa,GACvB,OAAO,CAAC,qBAAqB,CAAC;CAoQlC"}
@@ -0,0 +1,310 @@
1
+ /**
2
+ * FILE EDITOR AGENT WORKFLOW
3
+ *
4
+ * A minimalistic agentic file editor that uses AI with the virtual-file-editor-tool
5
+ * to iteratively edit code files through natural language instructions.
6
+ *
7
+ * The workflow maintains file state across tool calls using the config mechanism,
8
+ * allowing the AI agent to build up complex edits incrementally.
9
+ */
10
+ import { z } from 'zod';
11
+ import { WorkflowBubble } from '../../types/workflow-bubble-class.js';
12
+ import { CredentialType } from '@bubblelab/shared-schemas';
13
+ import { AvailableModels } from '../../types/ai-models.js';
14
+ import { AIAgentBubble } from '../service-bubble/ai-agent.js';
15
+ import { AvailableTools } from '../../types/available-tools.js';
16
+ /**
17
+ * Schema for file content representation
18
+ * Each file is represented as a JavaScript object where keys are class/function names
19
+ * and values are arrays of lines (indexed by line number)
20
+ */
21
+ /**
22
+ * Parameters schema for file editor agent
23
+ */
24
+ const FileEditorAgentParamsSchema = z.object({
25
+ files: z.array(z.string()).describe('File content as array of lines'),
26
+ validationFunction: z
27
+ .function()
28
+ .args(z.array(z.string()), z.number())
29
+ .returns(z.promise(z.object({
30
+ validated: z.boolean(),
31
+ message: z.string(),
32
+ })))
33
+ .optional()
34
+ .describe('Async function to validate the file'),
35
+ tools: z
36
+ .array(AvailableTools)
37
+ .default([])
38
+ .describe('Array of tools the AI agent can use. Start and end lines are inclusive.'),
39
+ instruction: z
40
+ .string()
41
+ .min(1, 'Instruction is required')
42
+ .describe('Natural language instruction for what edits to make'),
43
+ maxIterations: z
44
+ .number()
45
+ .min(1)
46
+ .max(100)
47
+ .default(10)
48
+ .describe('Maximum number of edit iterations'),
49
+ model: AvailableModels.default('google/gemini-2.5-flash').describe('AI model to use for the editing agent'),
50
+ credentials: z
51
+ .record(z.nativeEnum(CredentialType), z.string())
52
+ .optional()
53
+ .describe('Credentials (injected at runtime)'),
54
+ });
55
+ /**
56
+ * Result schema for file editor agent
57
+ */
58
+ const FileEditorAgentResultSchema = z.object({
59
+ iterationsUsed: z.number().describe('Number of iterations used'),
60
+ success: z.boolean(),
61
+ fileContent: z.array(z.string()).describe('File content as array of lines'),
62
+ message: z.string().describe('Message from the agent'),
63
+ error: z.string(),
64
+ });
65
+ export class FileEditorAgentWorkflow extends WorkflowBubble {
66
+ static type = 'workflow';
67
+ static bubbleName = 'file-editor-agent';
68
+ static schema = FileEditorAgentParamsSchema;
69
+ static resultSchema = FileEditorAgentResultSchema;
70
+ static shortDescription = 'Agentic file editor using AI with virtual-file-editor-tool';
71
+ static longDescription = `
72
+ A minimalistic workflow that uses an AI agent with the virtual-file-editor-tool
73
+ to iteratively edit code files based on natural language instructions.
74
+
75
+ How it works:
76
+ 1. Takes file content as a JS object (class/function names → line arrays)
77
+ 2. AI agent uses virtual-file-editor-tool to make edits
78
+ 3. File state persists across tool calls via config
79
+ 4. Returns edited files in the same object format
80
+
81
+ Use cases:
82
+ - Refactoring code based on natural language instructions
83
+ - Making systematic changes across multiple classes/functions
84
+ - Applying code transformations iteratively
85
+ `;
86
+ static alias = 'file-editor';
87
+ constructor(params, context) {
88
+ super(params, context);
89
+ console.log('[file-editor-agent] context is :', context);
90
+ }
91
+ formatFileContent(fileContent) {
92
+ // Add line numbers to the file content
93
+ return fileContent.map((line, index) => `${index + 1}: ${line}`).join('\n');
94
+ }
95
+ async testValidationFunction(_fileContent, iterationsUsed) {
96
+ if (iterationsUsed === 3) {
97
+ return {
98
+ validated: true,
99
+ message: 'File is valid',
100
+ };
101
+ }
102
+ return {
103
+ validated: false,
104
+ message: 'Types annotations are missing',
105
+ };
106
+ }
107
+ async performAction(_context) {
108
+ // State that will be updated by the hook
109
+ let currentFiles = this.params.files;
110
+ let currentValidation = await (this.params.validationFunction?.(currentFiles, 0) || this.testValidationFunction(currentFiles, 0));
111
+ let iterationCount = 0;
112
+ const buildSystemPrompt = (files, validation) => {
113
+ return `
114
+ ═══════════════════════════════════════════════════════════
115
+ CURRENT FILE STATE (with line numbers):
116
+ ═══════════════════════════════════════════════════════════
117
+ ${this.formatFileContent(files)}
118
+
119
+ ═══════════════════════════════════════════════════════════
120
+ VALIDATION FEEDBACK:
121
+ ═══════════════════════════════════════════════════════════
122
+ Status: ${validation.validated ? 'āœ… VALID' : 'āŒ INVALID'}
123
+ Message: ${validation.message}
124
+ ═══════════════════════════════════════════════════════════
125
+
126
+ CRITICAL INSTRUCTIONS:
127
+ - YOU MUST use tools to gather context and complete your task.
128
+ - You then use the virtual-file-editor-tool to fix the validation errors shown above
129
+ - Do NOT respond with text explanations - you MUST call the tool
130
+ - To MODIFY an existing line: { op: "replace", startLine: N, endLine: N, text: "new content" }
131
+ - To ADD a new line before line N: { op: "insert", startLine: N, text: "new line" }
132
+ - To DELETE lines: { op: "delete", startLine: N, endLine: M }
133
+ - Make ONE precise edit per tool call
134
+ - The file has validation ERRORS - you MUST fix them using the tool`;
135
+ };
136
+ // Create a shared config object that will be updated by the hook
137
+ // This ensures the tool always has access to the latest file state
138
+ const sharedToolConfig = {
139
+ codeLines: currentFiles,
140
+ };
141
+ const fileEditingAgent = new AIAgentBubble({
142
+ name: 'File Editing Agent',
143
+ systemPrompt: `You are a code editor AI. Your instructions are: ${this.params.instruction}`,
144
+ message: `${buildSystemPrompt(currentFiles, currentValidation)}
145
+ YOUR TASK: Use tools to gather context and fix the validation error. Call the tool immediately - do not respond with explanations.`,
146
+ model: {
147
+ model: this.params.model,
148
+ temperature: 0.7,
149
+ maxTokens: 40000,
150
+ },
151
+ beforeToolCall: async (hookContext) => {
152
+ if (hookContext.toolName === 'virtual-file-editor-tool') {
153
+ // Preserve the model-planned edit while injecting the latest file state by reference
154
+ const original = hookContext.toolInput;
155
+ const edit = original && typeof original === 'object' && 'edit' in original
156
+ ? original.edit
157
+ : original;
158
+ // CRITICAL: Update the shared config's codeLines to the latest state
159
+ // This ensures the tool always gets the most recent file content
160
+ sharedToolConfig.codeLines = currentFiles;
161
+ // Return updated toolInput with the shared config reference
162
+ const toolInputReturn = {
163
+ messages: hookContext.messages,
164
+ toolInput: {
165
+ edit,
166
+ config: sharedToolConfig, // Always pass the same reference
167
+ },
168
+ };
169
+ // Log formatted info for debugging
170
+ console.log('\n' + '─'.repeat(60));
171
+ console.log('ITERATION:', iterationCount + 1);
172
+ console.log('─'.repeat(60));
173
+ // Display current tool call
174
+ console.log('\nšŸ”§ TOOL CALL:');
175
+ console.log('Tool:', hookContext.toolName);
176
+ console.log('Args:', JSON.stringify(edit, null, 2));
177
+ // Show CURRENT file state (this is the source of truth)
178
+ console.log('\nšŸ“„ CURRENT FILE STATE (being passed to tool):');
179
+ console.log(this.formatFileContent(currentFiles));
180
+ // Show current validation status
181
+ console.log('\nšŸ“‹ CURRENT VALIDATION:');
182
+ console.log('Status:', currentValidation.validated ? 'āœ… PASSED' : 'āŒ FAILED');
183
+ console.log('Message:', currentValidation.message);
184
+ console.log('─'.repeat(60) + '\n');
185
+ return toolInputReturn;
186
+ }
187
+ return {
188
+ messages: hookContext.messages,
189
+ toolInput: hookContext.toolInput,
190
+ };
191
+ },
192
+ afterToolCall: async (hookContext) => {
193
+ // Only process virtual-file-editor-tool calls
194
+ if (hookContext.toolName === 'virtual-file-editor-tool') {
195
+ // Step 1: Extract updated file from tool output
196
+ const toolResult = hookContext.toolOutput;
197
+ if (toolResult.success && toolResult.data?.updatedCodeLines) {
198
+ const previousLineCount = currentFiles.length;
199
+ currentFiles = toolResult.data.updatedCodeLines;
200
+ // Update the shared config so next tool call has the latest state
201
+ sharedToolConfig.codeLines = currentFiles;
202
+ console.log('\nāœ… TOOL RESULT:');
203
+ console.log('Success: true');
204
+ console.log('Lines: ', previousLineCount, '→', currentFiles.length);
205
+ console.log('\nšŸ“„ UPDATED FILE:');
206
+ console.log(this.formatFileContent(currentFiles));
207
+ }
208
+ else {
209
+ console.warn('\nāš ļø TOOL EXECUTION FAILED:', toolResult && 'error' in toolResult
210
+ ? toolResult.error
211
+ : 'Unknown error');
212
+ }
213
+ // Step 2: Run validation on updated file
214
+ iterationCount++;
215
+ currentValidation = await (this.params.validationFunction?.(currentFiles, iterationCount) || this.testValidationFunction(currentFiles, iterationCount));
216
+ // Log validation result
217
+ console.log('\nšŸ“Š VALIDATION AFTER EDIT:');
218
+ console.log('Status:', currentValidation.validated ? 'āœ… PASSED' : 'āŒ FAILED');
219
+ if (!currentValidation.validated) {
220
+ console.log('Errors:', currentValidation.message);
221
+ }
222
+ // Step 3: Simplify tool output message
223
+ const simplifiedToolMessage = currentValidation.validated
224
+ ? `āœ…āœ…āœ… VALIDATION PASSED! āœ…āœ…āœ…
225
+
226
+ The file is now VALID and all errors are fixed!
227
+
228
+ ⛔⛔⛔ CRITICAL: DO NOT MAKE ANY MORE TOOL CALLS ⛔⛔⛔
229
+ ⛔⛔⛔ STOP IMMEDIATELY - YOUR TASK IS COMPLETE ⛔⛔⛔
230
+
231
+ Respond with ONLY a text summary (no tools).`
232
+ : `Edit applied. Validation still failing: ${currentValidation.message}
233
+
234
+ You MUST continue using virtual-file-editor-tool to fix the remaining errors.`;
235
+ // Step 4: Update system prompt with new file state + validation
236
+ // If validation passed, tell AI to stop
237
+ const updatedSystemPrompt = currentValidation.validated
238
+ ? `⛔⛔⛔ STOP - VALIDATION PASSED ⛔⛔⛔
239
+
240
+ ALL ERRORS ARE FIXED. The file is now valid.
241
+
242
+ FINAL FILE (with line numbers):
243
+ ${this.formatFileContent(currentFiles)}
244
+
245
+ If the core implementation is done,
246
+ ā›” DO NOT call any more tools
247
+ ā›” DO NOT make any more edits
248
+ "`
249
+ : buildSystemPrompt(currentFiles, currentValidation);
250
+ // Update the first message (system prompt) and ONLY the LAST tool message
251
+ const updatedMessages = hookContext.messages.map((msg, idx) => {
252
+ if (idx === 0) {
253
+ // Update system prompt
254
+ msg.content = updatedSystemPrompt;
255
+ }
256
+ else if (msg.getType() === 'tool' &&
257
+ idx === hookContext.messages.length - 1 &&
258
+ hookContext.toolName === 'virtual-file-editor-tool') {
259
+ // Only simplify the LATEST tool message (the one we just added)
260
+ msg.content = simplifiedToolMessage;
261
+ }
262
+ else if (msg.getType() === 'ai' && msg.tool_calls) {
263
+ // Strip 'config' from all AI messages' tool_calls to avoid context bloat
264
+ // The system prompt is the source of truth for current file state
265
+ const aiMsg = msg;
266
+ if (aiMsg.tool_calls && Array.isArray(aiMsg.tool_calls)) {
267
+ aiMsg.tool_calls = aiMsg.tool_calls.map((tc) => {
268
+ if (tc.name === 'virtual-file-editor-tool' &&
269
+ tc.args?.config) {
270
+ // Remove config but keep edit
271
+ const { config, ...argsWithoutConfig } = tc.args;
272
+ return { ...tc, args: argsWithoutConfig };
273
+ }
274
+ return tc;
275
+ });
276
+ }
277
+ }
278
+ return msg;
279
+ });
280
+ return updatedMessages;
281
+ }
282
+ // For other tools, pass through unchanged
283
+ return hookContext.messages;
284
+ },
285
+ tools: [
286
+ {
287
+ name: 'virtual-file-editor-tool',
288
+ credentials: this.params.credentials || {},
289
+ config: sharedToolConfig, // Use shared config object
290
+ },
291
+ ...this.params.tools.map((tool) => ({
292
+ name: tool,
293
+ credentials: this.params.credentials || {},
294
+ config: {},
295
+ })),
296
+ ],
297
+ credentials: this.params.credentials,
298
+ maxIterations: this.params.maxIterations,
299
+ }, this.context);
300
+ const agentResult = await fileEditingAgent.action();
301
+ return {
302
+ iterationsUsed: iterationCount,
303
+ fileContent: currentFiles,
304
+ message: agentResult.data?.response || 'No response from agent',
305
+ success: currentValidation.validated,
306
+ error: currentValidation.validated ? '' : currentValidation.message,
307
+ };
308
+ }
309
+ }
310
+ //# sourceMappingURL=file-editor-agent.workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-editor-agent.workflow.js","sourceRoot":"","sources":["../../../src/bubbles/workflow-bubble/file-editor-agent.workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;;GAIG;AAEH;;GA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