@superblocksteam/vite-plugin-file-sync 2.0.59-next.1 → 2.0.59-next.3

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 (279) hide show
  1. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  2. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +10 -1
  3. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  4. package/dist/ai-service/agent/subagents/apis/examples.d.ts.map +1 -1
  5. package/dist/ai-service/agent/subagents/apis/examples.js +137 -10
  6. package/dist/ai-service/agent/subagents/apis/examples.js.map +1 -1
  7. package/dist/ai-service/agent/subagents/apis/static-analysis.d.ts.map +1 -1
  8. package/dist/ai-service/agent/subagents/apis/static-analysis.js +14 -7
  9. package/dist/ai-service/agent/subagents/apis/static-analysis.js.map +1 -1
  10. package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
  11. package/dist/ai-service/agent/tool-message-utils.js +6 -2
  12. package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
  13. package/dist/ai-service/agent/tools/apis/analysis.d.ts +9 -0
  14. package/dist/ai-service/agent/tools/apis/analysis.d.ts.map +1 -0
  15. package/dist/ai-service/agent/tools/apis/analysis.js +357 -0
  16. package/dist/ai-service/agent/tools/apis/analysis.js.map +1 -0
  17. package/dist/ai-service/agent/{subagents → tools}/apis/api-executor.d.ts +35 -10
  18. package/dist/ai-service/agent/tools/apis/api-executor.d.ts.map +1 -0
  19. package/dist/ai-service/agent/{subagents → tools}/apis/api-executor.js +179 -94
  20. package/dist/ai-service/agent/tools/apis/api-executor.js.map +1 -0
  21. package/dist/ai-service/agent/tools/apis/api-source.d.ts +19 -0
  22. package/dist/ai-service/agent/tools/apis/api-source.d.ts.map +1 -0
  23. package/dist/ai-service/agent/tools/apis/api-source.js +73 -0
  24. package/dist/ai-service/agent/tools/apis/api-source.js.map +1 -0
  25. package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.d.ts +51 -0
  26. package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.d.ts.map +1 -0
  27. package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.js +510 -0
  28. package/dist/ai-service/agent/tools/apis/api-validation-orchestrator.js.map +1 -0
  29. package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts +32 -0
  30. package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -0
  31. package/dist/ai-service/agent/tools/apis/build-api-artifact.js +313 -0
  32. package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -0
  33. package/dist/ai-service/agent/tools/apis/build-api.d.ts +1 -10
  34. package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
  35. package/dist/ai-service/agent/tools/apis/build-api.js +26 -238
  36. package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
  37. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +11 -0
  38. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -0
  39. package/dist/ai-service/agent/tools/apis/get-api-docs.js +1809 -0
  40. package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -0
  41. package/dist/ai-service/agent/tools/apis/integration-types.d.ts +37 -0
  42. package/dist/ai-service/agent/tools/apis/integration-types.d.ts.map +1 -0
  43. package/dist/ai-service/agent/tools/apis/integration-types.js +697 -0
  44. package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -0
  45. package/dist/ai-service/agent/tools/apis/test-api.d.ts +25 -0
  46. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -0
  47. package/dist/ai-service/agent/tools/apis/test-api.js +194 -0
  48. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -0
  49. package/dist/ai-service/agent/tools/apis/write-api.d.ts +11 -0
  50. package/dist/ai-service/agent/tools/apis/write-api.d.ts.map +1 -0
  51. package/dist/ai-service/agent/tools/apis/write-api.js +41 -0
  52. package/dist/ai-service/agent/tools/apis/write-api.js.map +1 -0
  53. package/dist/ai-service/agent/tools/build-read-files.js +2 -2
  54. package/dist/ai-service/agent/tools/build-read-files.js.map +1 -1
  55. package/dist/ai-service/agent/tools.d.ts +2 -5
  56. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  57. package/dist/ai-service/agent/tools.js +51 -22
  58. package/dist/ai-service/agent/tools.js.map +1 -1
  59. package/dist/ai-service/agent/tools2/access-control.d.ts +1 -0
  60. package/dist/ai-service/agent/tools2/access-control.d.ts.map +1 -1
  61. package/dist/ai-service/agent/tools2/access-control.js +15 -13
  62. package/dist/ai-service/agent/tools2/access-control.js.map +1 -1
  63. package/dist/ai-service/agent/tools2/registry.d.ts +2 -1
  64. package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
  65. package/dist/ai-service/agent/tools2/registry.js +4 -3
  66. package/dist/ai-service/agent/tools2/registry.js.map +1 -1
  67. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +2 -1
  68. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
  69. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +103 -88
  70. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
  71. package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
  72. package/dist/ai-service/agent/tools2/tools/grep-metadata.js +25 -4
  73. package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
  74. package/dist/ai-service/agent/tools2/types.d.ts +1 -1
  75. package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
  76. package/dist/ai-service/agent/tools2/types.js.map +1 -1
  77. package/dist/ai-service/agent/tools2/utils.d.ts.map +1 -1
  78. package/dist/ai-service/agent/tools2/utils.js +4 -1
  79. package/dist/ai-service/agent/tools2/utils.js.map +1 -1
  80. package/dist/ai-service/agent/utils.d.ts +1 -3
  81. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  82. package/dist/ai-service/agent/utils.js +44 -4
  83. package/dist/ai-service/agent/utils.js.map +1 -1
  84. package/dist/ai-service/app-interface/shell.d.ts +5 -0
  85. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  86. package/dist/ai-service/app-interface/shell.js +17 -2
  87. package/dist/ai-service/app-interface/shell.js.map +1 -1
  88. package/dist/ai-service/chat/chat-session-store.d.ts +7 -0
  89. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  90. package/dist/ai-service/chat/chat-session-store.js +26 -0
  91. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  92. package/dist/ai-service/const.d.ts +2 -1
  93. package/dist/ai-service/const.d.ts.map +1 -1
  94. package/dist/ai-service/const.js +1 -0
  95. package/dist/ai-service/const.js.map +1 -1
  96. package/dist/ai-service/index.d.ts +5 -1
  97. package/dist/ai-service/index.d.ts.map +1 -1
  98. package/dist/ai-service/index.js +55 -7
  99. package/dist/ai-service/index.js.map +1 -1
  100. package/dist/ai-service/integrations/metadata-storage/index.d.ts +10 -0
  101. package/dist/ai-service/integrations/metadata-storage/index.d.ts.map +1 -1
  102. package/dist/ai-service/integrations/metadata-storage/local.d.ts +4 -2
  103. package/dist/ai-service/integrations/metadata-storage/local.d.ts.map +1 -1
  104. package/dist/ai-service/integrations/metadata-storage/local.js +35 -9
  105. package/dist/ai-service/integrations/metadata-storage/local.js.map +1 -1
  106. package/dist/ai-service/integrations/store.d.ts +27 -2
  107. package/dist/ai-service/integrations/store.d.ts.map +1 -1
  108. package/dist/ai-service/integrations/store.js +129 -62
  109. package/dist/ai-service/integrations/store.js.map +1 -1
  110. package/dist/ai-service/llm/client.d.ts +123 -0
  111. package/dist/ai-service/llm/client.d.ts.map +1 -0
  112. package/dist/ai-service/llm/client.js +168 -0
  113. package/dist/ai-service/llm/client.js.map +1 -0
  114. package/dist/ai-service/llm/context/context-handle.d.ts +4 -4
  115. package/dist/ai-service/llm/context/context-handle.d.ts.map +1 -1
  116. package/dist/ai-service/llm/context/context-handle.js +7 -3
  117. package/dist/ai-service/llm/context/context-handle.js.map +1 -1
  118. package/dist/ai-service/llm/context/context.d.ts +28 -0
  119. package/dist/ai-service/llm/context/context.d.ts.map +1 -1
  120. package/dist/ai-service/llm/context/context.js +117 -0
  121. package/dist/ai-service/llm/context/context.js.map +1 -1
  122. package/dist/ai-service/llm/context/manager.d.ts +22 -2
  123. package/dist/ai-service/llm/context/manager.d.ts.map +1 -1
  124. package/dist/ai-service/llm/context/manager.js +86 -13
  125. package/dist/ai-service/llm/context/manager.js.map +1 -1
  126. package/dist/ai-service/llm/context/storage/index.d.ts +1 -0
  127. package/dist/ai-service/llm/context/storage/index.d.ts.map +1 -1
  128. package/dist/ai-service/llm/context/storage/local.d.ts +1 -0
  129. package/dist/ai-service/llm/context/storage/local.d.ts.map +1 -1
  130. package/dist/ai-service/llm/context/storage/local.js +13 -1
  131. package/dist/ai-service/llm/context/storage/local.js.map +1 -1
  132. package/dist/ai-service/llm/error.d.ts +14 -4
  133. package/dist/ai-service/llm/error.d.ts.map +1 -1
  134. package/dist/ai-service/llm/error.js +49 -4
  135. package/dist/ai-service/llm/error.js.map +1 -1
  136. package/dist/ai-service/llm/interaction/adapters/vercel.d.ts +67 -0
  137. package/dist/ai-service/llm/interaction/adapters/vercel.d.ts.map +1 -0
  138. package/dist/ai-service/llm/interaction/adapters/vercel.js +110 -0
  139. package/dist/ai-service/llm/interaction/adapters/vercel.js.map +1 -0
  140. package/dist/ai-service/llm/interaction/compose.d.ts +71 -0
  141. package/dist/ai-service/llm/interaction/compose.d.ts.map +1 -0
  142. package/dist/ai-service/llm/interaction/compose.js +88 -0
  143. package/dist/ai-service/llm/interaction/compose.js.map +1 -0
  144. package/dist/ai-service/llm/interaction/index.d.ts +68 -0
  145. package/dist/ai-service/llm/interaction/index.d.ts.map +1 -0
  146. package/dist/ai-service/llm/interaction/index.js +70 -0
  147. package/dist/ai-service/llm/interaction/index.js.map +1 -0
  148. package/dist/ai-service/llm/interaction/middleware.d.ts +52 -0
  149. package/dist/ai-service/llm/interaction/middleware.d.ts.map +1 -0
  150. package/dist/ai-service/llm/interaction/middleware.js +17 -0
  151. package/dist/ai-service/llm/interaction/middleware.js.map +1 -0
  152. package/dist/ai-service/llm/interaction/middlewares/llmobs.d.ts +45 -0
  153. package/dist/ai-service/llm/interaction/middlewares/llmobs.d.ts.map +1 -0
  154. package/dist/ai-service/llm/interaction/middlewares/llmobs.js +85 -0
  155. package/dist/ai-service/llm/interaction/middlewares/llmobs.js.map +1 -0
  156. package/dist/ai-service/llm/interaction/middlewares/logging.d.ts +88 -0
  157. package/dist/ai-service/llm/interaction/middlewares/logging.d.ts.map +1 -0
  158. package/dist/ai-service/llm/interaction/middlewares/logging.js +238 -0
  159. package/dist/ai-service/llm/interaction/middlewares/logging.js.map +1 -0
  160. package/dist/ai-service/llm/interaction/middlewares/profiler.d.ts +47 -0
  161. package/dist/ai-service/llm/interaction/middlewares/profiler.d.ts.map +1 -0
  162. package/dist/ai-service/llm/interaction/middlewares/profiler.js +183 -0
  163. package/dist/ai-service/llm/interaction/middlewares/profiler.js.map +1 -0
  164. package/dist/ai-service/llm/interaction/middlewares/stream-retry.d.ts +121 -0
  165. package/dist/ai-service/llm/interaction/middlewares/stream-retry.d.ts.map +1 -0
  166. package/dist/ai-service/llm/interaction/middlewares/stream-retry.js +291 -0
  167. package/dist/ai-service/llm/interaction/middlewares/stream-retry.js.map +1 -0
  168. package/dist/ai-service/llm/interaction/provider.d.ts +158 -0
  169. package/dist/ai-service/llm/interaction/provider.d.ts.map +1 -0
  170. package/dist/ai-service/llm/interaction/provider.js +15 -0
  171. package/dist/ai-service/llm/interaction/provider.js.map +1 -0
  172. package/dist/ai-service/llm/interaction/stream-lifecycle.d.ts +48 -0
  173. package/dist/ai-service/llm/interaction/stream-lifecycle.d.ts.map +1 -0
  174. package/dist/ai-service/llm/interaction/stream-lifecycle.js +131 -0
  175. package/dist/ai-service/llm/interaction/stream-lifecycle.js.map +1 -0
  176. package/dist/ai-service/llm/provider.d.ts +1 -2
  177. package/dist/ai-service/llm/provider.d.ts.map +1 -1
  178. package/dist/ai-service/llm/provider.js +3 -6
  179. package/dist/ai-service/llm/provider.js.map +1 -1
  180. package/dist/ai-service/llmobs/helpers.d.ts +7 -8
  181. package/dist/ai-service/llmobs/helpers.d.ts.map +1 -1
  182. package/dist/ai-service/llmobs/helpers.js +8 -48
  183. package/dist/ai-service/llmobs/helpers.js.map +1 -1
  184. package/dist/ai-service/llmobs/middleware/stream-text.d.ts +19 -21
  185. package/dist/ai-service/llmobs/middleware/stream-text.d.ts.map +1 -1
  186. package/dist/ai-service/llmobs/middleware/stream-text.js +98 -106
  187. package/dist/ai-service/llmobs/middleware/stream-text.js.map +1 -1
  188. package/dist/ai-service/llmobs/types.d.ts +14 -1
  189. package/dist/ai-service/llmobs/types.d.ts.map +1 -1
  190. package/dist/ai-service/state-machine/clark-fsm.d.ts +75 -5
  191. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  192. package/dist/ai-service/state-machine/clark-fsm.js +100 -0
  193. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  194. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  195. package/dist/ai-service/state-machine/handlers/agent-planning.js +4 -0
  196. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  197. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  198. package/dist/ai-service/state-machine/handlers/llm-generating.js +91 -456
  199. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  200. package/dist/ai-service/state-machine/handlers/runtime-reviewing.js +1 -1
  201. package/dist/ai-service/state-machine/handlers/runtime-reviewing.js.map +1 -1
  202. package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
  203. package/dist/ai-service/state-machine/helpers/peer.js +15 -0
  204. package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
  205. package/dist/ai-service/state-machine/mocks.d.ts.map +1 -1
  206. package/dist/ai-service/state-machine/mocks.js +1 -0
  207. package/dist/ai-service/state-machine/mocks.js.map +1 -1
  208. package/dist/ai-service/template-renderer.js +1 -1
  209. package/dist/ai-service/template-renderer.js.map +1 -1
  210. package/dist/ai-service/types.d.ts +30 -0
  211. package/dist/ai-service/types.d.ts.map +1 -1
  212. package/dist/binding-extraction/extract-identifiers.d.ts +14 -0
  213. package/dist/binding-extraction/extract-identifiers.d.ts.map +1 -1
  214. package/dist/binding-extraction/extract-identifiers.js +46 -1
  215. package/dist/binding-extraction/extract-identifiers.js.map +1 -1
  216. package/dist/binding-extraction/js-identifiers.d.ts +14 -0
  217. package/dist/binding-extraction/js-identifiers.d.ts.map +1 -1
  218. package/dist/binding-extraction/js-identifiers.js +168 -0
  219. package/dist/binding-extraction/js-identifiers.js.map +1 -1
  220. package/dist/binding-extraction/python-identifiers.d.ts +5 -0
  221. package/dist/binding-extraction/python-identifiers.d.ts.map +1 -1
  222. package/dist/binding-extraction/python-identifiers.js +76 -7
  223. package/dist/binding-extraction/python-identifiers.js.map +1 -1
  224. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  225. package/dist/file-sync-vite-plugin.js +73 -3
  226. package/dist/file-sync-vite-plugin.js.map +1 -1
  227. package/dist/file-system-manager.d.ts.map +1 -1
  228. package/dist/file-system-manager.js +6 -4
  229. package/dist/file-system-manager.js.map +1 -1
  230. package/dist/index.d.ts +1 -1
  231. package/dist/index.d.ts.map +1 -1
  232. package/dist/index.js +1 -1
  233. package/dist/index.js.map +1 -1
  234. package/dist/lock-service/activity-tracker.d.ts +14 -2
  235. package/dist/lock-service/activity-tracker.d.ts.map +1 -1
  236. package/dist/lock-service/activity-tracker.js +43 -6
  237. package/dist/lock-service/activity-tracker.js.map +1 -1
  238. package/dist/lock-service/index.d.ts +13 -2
  239. package/dist/lock-service/index.d.ts.map +1 -1
  240. package/dist/lock-service/index.js +130 -44
  241. package/dist/lock-service/index.js.map +1 -1
  242. package/dist/parsing/jsx.d.ts.map +1 -1
  243. package/dist/parsing/jsx.js +78 -66
  244. package/dist/parsing/jsx.js.map +1 -1
  245. package/dist/socket-manager.js +1 -1
  246. package/dist/socket-manager.js.map +1 -1
  247. package/dist/sync-service/list-dir.d.ts.map +1 -1
  248. package/dist/sync-service/list-dir.js +41 -18
  249. package/dist/sync-service/list-dir.js.map +1 -1
  250. package/dist/vite-plugin-yaml-types.d.ts.map +1 -1
  251. package/dist/vite-plugin-yaml-types.js +2 -4
  252. package/dist/vite-plugin-yaml-types.js.map +1 -1
  253. package/package.json +7 -7
  254. package/dist/ai-service/agent/subagents/apis/api-executor.d.ts.map +0 -1
  255. package/dist/ai-service/agent/subagents/apis/api-executor.js.map +0 -1
  256. package/dist/ai-service/agent/subagents/apis/context.d.ts +0 -12
  257. package/dist/ai-service/agent/subagents/apis/context.d.ts.map +0 -1
  258. package/dist/ai-service/agent/subagents/apis/context.js +0 -18
  259. package/dist/ai-service/agent/subagents/apis/context.js.map +0 -1
  260. package/dist/ai-service/agent/subagents/apis/generate-api-source.d.ts +0 -40
  261. package/dist/ai-service/agent/subagents/apis/generate-api-source.d.ts.map +0 -1
  262. package/dist/ai-service/agent/subagents/apis/generate-api-source.js +0 -516
  263. package/dist/ai-service/agent/subagents/apis/generate-api-source.js.map +0 -1
  264. package/dist/ai-service/agent/subagents/apis/state.d.ts +0 -49
  265. package/dist/ai-service/agent/subagents/apis/state.d.ts.map +0 -1
  266. package/dist/ai-service/agent/subagents/apis/state.js +0 -25
  267. package/dist/ai-service/agent/subagents/apis/state.js.map +0 -1
  268. package/dist/ai-service/agent/subagents/apis/system-prompt.d.ts +0 -3
  269. package/dist/ai-service/agent/subagents/apis/system-prompt.d.ts.map +0 -1
  270. package/dist/ai-service/agent/subagents/apis/system-prompt.js +0 -1704
  271. package/dist/ai-service/agent/subagents/apis/system-prompt.js.map +0 -1
  272. package/dist/ai-service/agent/tools/apis/finalize-api.d.ts +0 -11
  273. package/dist/ai-service/agent/tools/apis/finalize-api.d.ts.map +0 -1
  274. package/dist/ai-service/agent/tools/apis/finalize-api.js +0 -133
  275. package/dist/ai-service/agent/tools/apis/finalize-api.js.map +0 -1
  276. package/dist/ai-service/llm/middleware/retry.d.ts +0 -112
  277. package/dist/ai-service/llm/middleware/retry.d.ts.map +0 -1
  278. package/dist/ai-service/llm/middleware/retry.js +0 -239
  279. package/dist/ai-service/llm/middleware/retry.js.map +0 -1
@@ -0,0 +1,313 @@
1
+ import yaml from "yaml";
2
+ import { extractInputsWithTypesFromApi, } from "../../../../binding-extraction/extract-identifiers.js";
3
+ import { getErrorMeta, getLogger, getPrefixedLogger, } from "../../../../util/logger.js";
4
+ import { Paths } from "../../../const.js";
5
+ import { ApiBuilderTypeScriptError } from "../../../transform/api-builder/shared.js";
6
+ import { ApiBuilderToYamlTransformer } from "../../../transform/api-builder/to-yaml-transformer.js";
7
+ import { applyFileTransformations, renderPath, } from "../../../transform/shared.js";
8
+ import { safeJsonStringify } from "../../../util/safe-stringify.js";
9
+ import { apiStaticAnalysis } from "../../subagents/apis/static-analysis.js";
10
+ import { readApiSource } from "./api-source.js";
11
+ /**
12
+ * Integration output type definitions.
13
+ * Source of truth for what each integration returns.
14
+ */
15
+ const INTEGRATION_OUTPUT_TYPES = {
16
+ // SQL Databases - return arrays of rows directly
17
+ postgres: "any[]",
18
+ postgresql: "any[]",
19
+ mysql: "any[]",
20
+ mariadb: "any[]",
21
+ mssql: "any[]",
22
+ snowflake: "any[]",
23
+ redshift: "any[]",
24
+ bigquery: "any[]",
25
+ databricks: "any[]",
26
+ athena: "any[]",
27
+ // NoSQL Databases
28
+ mongodb: "any[]",
29
+ dynamodb: "{ Items?: any[]; Count?: number; ScannedCount?: number }",
30
+ cosmosdb: "{ resources: any[]; headers: Record<string, string> }",
31
+ // REST APIs
32
+ restapiintegration: "{ data: any; status: number; headers: Record<string, string> }",
33
+ openapi: "{ data: any; status: number; headers: Record<string, string> }",
34
+ // GraphQL
35
+ graphql: "{ data: any; errors?: any[] }",
36
+ // JavaScript/Python
37
+ javascript: "any",
38
+ python: "any",
39
+ // Messaging
40
+ kafka: "{ success: boolean; partition?: number; offset?: string }",
41
+ email: "{ success: boolean; messageId?: string }",
42
+ // Other
43
+ redis: "any",
44
+ s3: "{ ETag?: string; Location?: string; Key?: string; Bucket?: string }",
45
+ };
46
+ /**
47
+ * Get the output type for a specific block.
48
+ * Control flow blocks return their last child's output.
49
+ */
50
+ function getBlockOutputType(block) {
51
+ // Handle control flow blocks
52
+ if (block.condition) {
53
+ // Conditional returns the output of whichever branch executes
54
+ // For type purposes, we need to handle all possible branches
55
+ const types = [];
56
+ if (block.condition.if?.blocks?.length > 0) {
57
+ const lastIfBlock = block.condition.if.blocks[block.condition.if.blocks.length - 1];
58
+ types.push(getBlockOutputType(lastIfBlock));
59
+ }
60
+ block.condition.elif?.forEach((elif) => {
61
+ if (elif.blocks?.length > 0) {
62
+ const lastElifBlock = elif.blocks[elif.blocks.length - 1];
63
+ types.push(getBlockOutputType(lastElifBlock));
64
+ }
65
+ });
66
+ if (block.condition.else?.blocks?.length > 0) {
67
+ const lastElseBlock = block.condition.else.blocks[block.condition.else.blocks.length - 1];
68
+ types.push(getBlockOutputType(lastElseBlock));
69
+ }
70
+ // If all branches have the same type, use that; otherwise union
71
+ const uniqueTypes = [...new Set(types)];
72
+ if (uniqueTypes.length === 0)
73
+ return "void";
74
+ if (uniqueTypes.length === 1)
75
+ return uniqueTypes[0] || "void";
76
+ return uniqueTypes.join(" | ");
77
+ }
78
+ if (block.loop) {
79
+ // Loop returns array of outputs from last block in loop body
80
+ if (block.loop.blocks?.length > 0) {
81
+ const lastLoopBlock = block.loop.blocks[block.loop.blocks.length - 1];
82
+ const itemType = getBlockOutputType(lastLoopBlock);
83
+ return `Array<${itemType}>`;
84
+ }
85
+ return "any[]";
86
+ }
87
+ if (block.trycatch) {
88
+ // TryCatch returns output of try block (or catch if try fails)
89
+ const types = [];
90
+ if (block.trycatch.try?.blocks?.length > 0) {
91
+ const lastTryBlock = block.trycatch.try.blocks[block.trycatch.try.blocks.length - 1];
92
+ types.push(getBlockOutputType(lastTryBlock));
93
+ }
94
+ if (block.trycatch.catch?.blocks?.length > 0) {
95
+ const lastCatchBlock = block.trycatch.catch.blocks[block.trycatch.catch.blocks.length - 1];
96
+ types.push(getBlockOutputType(lastCatchBlock));
97
+ }
98
+ const uniqueTypes = [...new Set(types)];
99
+ if (uniqueTypes.length === 0)
100
+ return "void";
101
+ if (uniqueTypes.length === 1)
102
+ return uniqueTypes[0] || "void";
103
+ return uniqueTypes.join(" | ");
104
+ }
105
+ // Handle step blocks (integrations)
106
+ if (block.step) {
107
+ const integration = block.step.integration;
108
+ // Map integration ID to type
109
+ if (integration === "javascript" || integration === "python") {
110
+ // For code blocks, try to infer from return statement if possible
111
+ // For now, default to any
112
+ return "any";
113
+ }
114
+ // Check if it's a database integration ID (UUID format)
115
+ if (/^[0-9a-f-]{36}$/i.test(integration)) {
116
+ // This is likely a database integration
117
+ // We need to check what type it is from the block config
118
+ if (block.step.postgres || block.step.postgresql) {
119
+ return INTEGRATION_OUTPUT_TYPES.postgresql || "any[]";
120
+ }
121
+ if (block.step.mysql) {
122
+ return INTEGRATION_OUTPUT_TYPES.mysql || "any[]";
123
+ }
124
+ if (block.step.snowflake) {
125
+ return INTEGRATION_OUTPUT_TYPES.snowflake || "any[]";
126
+ }
127
+ // Default for unknown database - returns array of rows
128
+ return "any[]";
129
+ }
130
+ // Look up in our type map
131
+ return INTEGRATION_OUTPUT_TYPES[integration.toLowerCase()] || "any";
132
+ }
133
+ // Handle other block types
134
+ if (block.return) {
135
+ return "any"; // Return block output is whatever data it returns
136
+ }
137
+ if (block.throw) {
138
+ return "never"; // Throw block never returns normally
139
+ }
140
+ return "void";
141
+ }
142
+ /**
143
+ * Determine the output type of an API based on its last block.
144
+ * The API response is always the output of the last block executed.
145
+ */
146
+ function determineApiOutputType(apiJson) {
147
+ if (!apiJson.blocks || apiJson.blocks.length === 0) {
148
+ return "void";
149
+ }
150
+ // Get the last block
151
+ const lastBlock = apiJson.blocks[apiJson.blocks.length - 1];
152
+ return getBlockOutputType(lastBlock);
153
+ }
154
+ /**
155
+ * Generate TypeScript interface for API inputs with proper types.
156
+ */
157
+ function generateInputInterface(apiName, inputs) {
158
+ const capitalizedName = apiName.charAt(0).toUpperCase() + apiName.slice(1);
159
+ if (inputs.length === 0) {
160
+ return `export interface ${capitalizedName}Input {}`;
161
+ }
162
+ const properties = inputs
163
+ .map((input) => {
164
+ const optionalMarker = input.optional ? "?" : "";
165
+ return ` ${input.name}${optionalMarker}: ${input.type};`;
166
+ })
167
+ .join("\n");
168
+ return `export interface ${capitalizedName}Input {\n${properties}\n}`;
169
+ }
170
+ /**
171
+ * Generate TypeScript type for API response.
172
+ */
173
+ function generateResponseType(apiName, outputType) {
174
+ const capitalizedName = apiName.charAt(0).toUpperCase() + apiName.slice(1);
175
+ return `export type ${capitalizedName}Response = ${outputType};`;
176
+ }
177
+ /**
178
+ * Generate complete types.d.ts file content.
179
+ */
180
+ function generateTypesFile(apiName, inputs, outputType) {
181
+ return `// Auto-generated by Superblocks
182
+ // Input/output types for ${apiName}
183
+
184
+ ${generateInputInterface(apiName, inputs)}
185
+
186
+ ${generateResponseType(apiName, outputType)}
187
+ `;
188
+ }
189
+ /**
190
+ * Compile an API source file, validate it, and persist the generated YAML artifact.
191
+ *
192
+ * @param params - Build parameters including identifiers and shared services.
193
+ * @returns The generated API YAML artifact and whether the API is newly created.
194
+ * @throws Error when the API source is missing, compilation fails, or persistence is not possible.
195
+ */
196
+ export const buildApiArtifact = async (params) => {
197
+ const { apiName, services, scopeUpdateQueue } = params;
198
+ const logger = params.logger ?? getPrefixedLogger(`[buildApiArtifact-${apiName}]`);
199
+ const apiSource = await readApiSource(services, apiName);
200
+ if (apiSource === undefined) {
201
+ throw new Error(`API source for ${apiName} not found. Ensure the API has been created and source code is available.`);
202
+ }
203
+ const isNewApi = !(await services.appShell.pathExists(renderPath(Paths.ApiYamls, { apiName })));
204
+ let apiYaml;
205
+ try {
206
+ [apiYaml] = await applyFileTransformations([apiSource], [
207
+ new ApiBuilderToYamlTransformer({
208
+ templateRenderer: services.templateRenderer,
209
+ skipCleanup: true,
210
+ }),
211
+ ]);
212
+ }
213
+ catch (error) {
214
+ if (error instanceof ApiBuilderTypeScriptError) {
215
+ logger.error(`TypeScript compilation failed: `, safeJsonStringify({
216
+ error: error.message,
217
+ apiSource: apiSource.content.slice(0, 500),
218
+ }));
219
+ throw new Error(`Unable to generate valid API code. This usually means there are syntax errors or issues with integration types. Review the API structure and ensure correct usage of integration methods. Consider checking integration metadata if you haven't already. Error: TypeScript compilation failed with message: ${error.message}`);
220
+ }
221
+ throw error;
222
+ }
223
+ const analysisWarnings = apiStaticAnalysis(apiSource.content);
224
+ if (analysisWarnings.length > 0) {
225
+ logger.warn("Static analysis warnings", {
226
+ warnings: analysisWarnings,
227
+ apiSource: apiSource.content.slice(0, 300),
228
+ });
229
+ throw new Error(`The API code has semantic issues that need to be fixed:\n\n${analysisWarnings.join("\n\n")}`);
230
+ }
231
+ if (apiYaml === undefined) {
232
+ throw new Error("Failed to generate API YAML. Try again.");
233
+ }
234
+ // Parse the YAML to extract inputs and generate types
235
+ let inputInterface;
236
+ let responseType;
237
+ try {
238
+ // Parse the YAML content
239
+ const apiData = yaml.parse(apiYaml.content);
240
+ // Validate that step blocks use the right plugin for the integration
241
+ validateBlockFieldNames(apiData, services.integrationStore);
242
+ // Convert to format expected by extractInputsWithTypesFromApi
243
+ const apiPb = { apiPb: apiData };
244
+ // Extract inputs with type information using the robust AST-based function
245
+ // Pass the original TypeScript source so it can extract type annotations
246
+ const inputs = await extractInputsWithTypesFromApi(apiPb, apiSource.content);
247
+ // Determine output type
248
+ const outputType = determineApiOutputType(apiData);
249
+ // Generate TypeScript interface strings
250
+ inputInterface = generateInputInterface(apiName, inputs);
251
+ responseType = generateResponseType(apiName, outputType);
252
+ // Generate complete types.d.ts content
253
+ const typesContent = generateTypesFile(apiName, inputs, outputType);
254
+ // Save files
255
+ await scopeUpdateQueue.enqueue(async () => {
256
+ // Save the API YAML
257
+ await services.draftInterface.createDraftFile(apiYaml.filePath, apiYaml.content);
258
+ // Save the types.d.ts file in the location expected by vite-plugin-yaml-types
259
+ const typesPath = renderPath(Paths.ApiYamls, { apiName }).replace("api.yaml", "types.d.ts");
260
+ await services.draftInterface.createDraftFile(typesPath, typesContent);
261
+ });
262
+ }
263
+ catch (error) {
264
+ logger.error("Failed to build API or generate types", getErrorMeta(error));
265
+ throw new Error(`Failed to build API: ${error instanceof Error ? error.message : String(error)}`);
266
+ }
267
+ return {
268
+ apiYaml,
269
+ isNewApi,
270
+ inputInterface,
271
+ responseType,
272
+ };
273
+ };
274
+ /**
275
+ * Validate that blocks use the correct plugin field name matching the integration's plugin.id.
276
+ */
277
+ export function validateBlockFieldNames(api, integrationStore) {
278
+ const logger = getLogger();
279
+ for (const block of api.blocks || []) {
280
+ if (!block.step)
281
+ continue;
282
+ const integrationId = block.step.integration;
283
+ if (!integrationId)
284
+ continue;
285
+ // Skip built-in plugins that don't have integrations in the store
286
+ if (integrationId === "javascript" || integrationId === "python") {
287
+ continue;
288
+ }
289
+ // Get the integration header to find the actual plugin type
290
+ const integrationHeader = integrationStore.getHeader(integrationId);
291
+ if (!integrationHeader) {
292
+ logger.warn(`Integration "${integrationId}" not found in store for block "${block.name}"`);
293
+ continue;
294
+ }
295
+ const expectedPluginId = integrationHeader.plugin.id;
296
+ // Check if the correct field name is used
297
+ if (!(expectedPluginId in block.step)) {
298
+ // Find what field they're actually using
299
+ const usedFields = Object.keys(block.step).filter((key) => key !== "integration" && typeof block.step[key] === "object");
300
+ throw new Error(`Block "${block.name}" uses incorrect field name. ` +
301
+ `The field name must match the integration's plugin ID.\n\n` +
302
+ `Expected field name: "${expectedPluginId}"\n` +
303
+ (usedFields.length > 0
304
+ ? `Used field name: "${usedFields[0]}"\n\n`
305
+ : `No plugin configuration field found\n\n`) +
306
+ `The integration "${integrationId}" is of type "${expectedPluginId}", ` +
307
+ `so your step configuration must use:\n` +
308
+ `${expectedPluginId}: { ... }\n\n` +
309
+ `This ensures proper routing and validation of your API calls.`);
310
+ }
311
+ }
312
+ }
313
+ //# sourceMappingURL=build-api-artifact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-api-artifact.js","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/build-api-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACL,6BAA6B,GAE9B,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EACL,YAAY,EACZ,SAAS,EACT,iBAAiB,GAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EACL,wBAAwB,EACxB,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAShD;;;GAGG;AACH,MAAM,wBAAwB,GAA2B;IACvD,iDAAiD;IACjD,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,OAAO;IAClB,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,OAAO;IACnB,MAAM,EAAE,OAAO;IAEf,kBAAkB;IAClB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,0DAA0D;IACpE,QAAQ,EAAE,uDAAuD;IAEjE,YAAY;IACZ,kBAAkB,EAChB,gEAAgE;IAClE,OAAO,EAAE,gEAAgE;IAEzE,UAAU;IAC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C;QAErD,0CAA0C;QAC1C,IAAI,CAAC,CAAC,gBAAgB,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;YACtC,yCAAyC;YACzC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAC/C,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,KAAK,aAAa,IAAI,OAAQ,KAAK,CAAC,IAAY,CAAC,GAAG,CAAC,KAAK,QAAQ,CACxE,CAAC;YAEF,MAAM,IAAI,KAAK,CACb,UAAU,KAAK,CAAC,IAAI,+BAA+B;gBACjD,4DAA4D;gBAC5D,yBAAyB,gBAAgB,KAAK;gBAC9C,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;oBACpB,CAAC,CAAC,qBAAqB,UAAU,CAAC,CAAC,CAAC,OAAO;oBAC3C,CAAC,CAAC,yCAAyC,CAAC;gBAC9C,oBAAoB,aAAa,iBAAiB,gBAAgB,KAAK;gBACvE,wCAAwC;gBACxC,GAAG,gBAAgB,eAAe;gBAClC,+DAA+D,CAClE,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,18 +1,9 @@
1
1
  export declare const extractIntegrationIdsFromSource: (source: string) => string[];
2
2
  export declare const buildApiToolFactory: import("../../tools2/types.js").ToolFactory<import("../../tools2/types.js").Tool<{
3
- description: string;
4
3
  apiName: string;
5
- apiSource: string;
6
- inputs?: Record<string, any> | undefined;
7
4
  }, {
8
5
  message: string;
9
6
  apiName: string;
10
- } | {
11
- execution: {
12
- message: string;
13
- outputs: string;
14
- };
15
- message: string;
16
- apiName: string;
7
+ isNewApi: boolean;
17
8
  }>>;
18
9
  //# sourceMappingURL=build-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-api.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/build-api.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,+BAA+B,GAAI,QAAQ,MAAM,KAAG,MAAM,EAWtE,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;GAyS/B,CAAC"}
1
+ {"version":3,"file":"build-api.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/agent/tools/apis/build-api.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,+BAA+B,GAAI,QAAQ,MAAM,KAAG,MAAM,EAWtE,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;;;GA+C/B,CAAC"}
@@ -1,18 +1,7 @@
1
- import { AiEntityType } from "@superblocksteam/library-shared/types";
2
- import yaml from "yaml";
3
1
  import { z } from "zod";
4
- import { getErrorMeta, getPrefixedLogger } from "../../../../util/logger.js";
5
- import { Paths } from "../../../const.js";
6
- import { ApiBuilderTypeScriptError } from "../../../transform/api-builder/shared.js";
7
- import { ApiBuilderToYamlTransformer } from "../../../transform/api-builder/to-yaml-transformer.js";
8
- import { applyFileTransformations, renderPath, } from "../../../transform/shared.js";
9
- import { safeJsonStringify } from "../../../util/safe-stringify.js";
10
- import { ApiExecutor } from "../../subagents/apis/api-executor.js";
11
- import { ApiGenerationContext } from "../../subagents/apis/context.js";
12
- import { apiStaticAnalysis } from "../../subagents/apis/static-analysis.js";
13
- import { createToolFactory, ToolCategory, } from "../../tools2/types.js";
14
- const MAX_BUILD_ATTEMPTS = 10;
15
- const MAX_OUTPUT_SAMPLE_LENGTH = 500;
2
+ import { getPrefixedLogger } from "../../../../util/logger.js";
3
+ import { createToolFactory, ToolCategory } from "../../tools2/types.js";
4
+ import { buildApiArtifact } from "./build-api-artifact.js";
16
5
  const integrationConstructorRegex = /new\s+[\w$.]+\s*\(\s*(["'`])(?:\\.|(?!\1).)*?\1\s*,\s*(["'`])((?:\\.|(?!\2).)*?)\2/g;
17
6
  export const extractIntegrationIdsFromSource = (source) => {
18
7
  integrationConstructorRegex.lastIndex = 0;
@@ -26,241 +15,40 @@ export const extractIntegrationIdsFromSource = (source) => {
26
15
  }
27
16
  return Array.from(ids);
28
17
  };
29
- export const buildApiToolFactory = createToolFactory("buildApi", (clark, services) => {
18
+ export const buildApiToolFactory = createToolFactory("buildApi", (_clark, services, scopeUpdateQueue) => {
30
19
  return {
31
20
  category: ToolCategory.API,
32
21
  description: `
33
- Compile the API source code. Provide the inputs of the API required to test the API works after it is built.
22
+ Compile, validate, and save the API. This tool performs the following steps:
23
+ 1. Reads the API source from file
24
+ 2. Compiles to Superblocks API YAML and validates syntax
25
+ 3. Performs static analysis to catch common mistakes
26
+ 4. Validates proto compatibility
34
27
 
35
28
  IMPORTANT Before using an integration, you MUST call the grepMetadata tool to get the correct schema/table structure. Do NOT make up column names or table structures.
36
29
  `,
37
30
  inputSchema: z.object({
38
- apiSource: z.string().describe("The source code of the API"),
39
31
  apiName: z.string().describe("The name of the API"),
40
- description: z
41
- .string()
42
- .min(1)
43
- .describe(`
44
- A concise plain-English description of what the API does, framed as a request for permission.
45
-
46
- Always include the API name and the names of integrations used. Focus on the domain names for resources.
47
-
48
- DO NOT explain why or include context.
49
-
50
- Examples: "Create getRecentCommitsApi to retrieve recent commits from GitHub?", "Create getJiraIssuesApi to pull issues from Jira?", "Create updateOrdersApi to update the Orders table in DemoOrders?".`),
51
- inputs: z
52
- .record(z.string(), z.any())
53
- .optional()
54
- .describe("Test API inputs. Must be provided if the API uses bindings."),
55
32
  }),
56
- extractEntities: (input) => {
57
- const integrationIds = extractIntegrationIdsFromSource(input.apiSource);
58
- return integrationIds.map((integrationId) => ({
59
- type: AiEntityType.INTEGRATION,
60
- id: integrationId,
61
- }));
62
- },
63
- formatInput: (input) => {
64
- const integrationIds = extractIntegrationIdsFromSource(input.apiSource);
65
- const targets = integrationIds.map((id) => services.integrationStore.getEntityTag(id) ?? id);
66
- return {
67
- targets,
68
- summary: input.description,
69
- };
70
- },
71
- execute: async ({ apiSource, apiName, inputs }, options) => {
72
- const context = ApiGenerationContext.from(options?.experimental_context);
73
- let id = apiName;
74
- if (context && context.id) {
75
- id = context.id;
76
- }
33
+ execute: async ({ apiName }) => {
77
34
  const logger = getPrefixedLogger(`[buildApi-${apiName}]`);
78
- const stateMap = clark.context.apiGenStateMap;
79
- if (!stateMap) {
80
- throw new Error("Unexpected state: API generation state map is not initialized.");
81
- }
82
- let state = stateMap.get(id);
83
- if (!state) {
84
- throw new Error(`No API generation state found for API ${apiName}.`);
85
- }
86
- if (state.status === "ready") {
87
- state = {
88
- ...state,
89
- status: "building",
90
- attempts: 0,
91
- };
92
- stateMap.set(id, state);
93
- }
94
- else if (state.status === "building") {
95
- state.attempts++;
96
- }
97
- else if (state.status === "built") {
98
- throw new Error(`API ${apiName} is already built. Must call finalizeApi.`);
99
- }
100
- else {
101
- throw new Error(`API ${apiName} is in unexpected state: ${state.status}.`);
102
- }
103
- if (state.attempts > MAX_BUILD_ATTEMPTS) {
104
- const error = new Error("Unable to build the API after multiple attempts. The API structure may be fundamentally incompatible with the requirements. Consider simplifying the approach or checking if all required integrations are properly configured.");
105
- const currentState = stateMap.get(id);
106
- state = {
107
- ...state,
108
- status: "failed",
109
- error: state.lastError || error,
110
- errorContext: {
111
- phase: "building",
112
- attemptNumber: state.attempts,
113
- lastToolCalled: currentState?.status === "building"
114
- ? currentState.lastToolCalled
115
- : undefined,
116
- lastToolError: currentState?.status === "building"
117
- ? currentState.lastToolError
118
- : undefined,
119
- suggestion: "Try a simpler API structure or verify integration configurations",
120
- },
121
- };
122
- stateMap.set(id, state);
123
- throw error;
124
- }
125
- const processApiSource = async () => {
126
- const generatedArtifact = {
127
- type: "file",
128
- filePath: renderPath(Paths.GeneratedApis, {
129
- apiName,
130
- }) + ".ts",
131
- content: apiSource,
132
- };
133
- const success = {
134
- message: "API compiled successfully",
135
- apiName,
136
- };
137
- let apiYaml;
138
- try {
139
- [apiYaml] = await applyFileTransformations([generatedArtifact], [
140
- new ApiBuilderToYamlTransformer({
141
- templateRenderer: services.templateRenderer,
142
- skipCleanup: true,
143
- }),
144
- ]);
145
- }
146
- catch (error) {
147
- if (error instanceof ApiBuilderTypeScriptError) {
148
- // Log technical details for debugging
149
- logger.error("TypeScript compilation failed", {
150
- error: error.message,
151
- apiSource: apiSource.slice(0, 500),
152
- });
153
- // Return user-friendly error for the subagent LLM
154
- throw new Error(`Unable to generate valid API code. This usually means there are syntax errors or issues with integration types. Review the API structure and ensure correct usage of integration methods. Consider checking integration metadata if you haven't already. Error: Typescript compilation failed with message: ${error.message}`);
155
- }
156
- throw error;
157
- }
158
- // At this point we know the apiSource is valid TypeScript.
159
- // Now do some static analysis to ensure it's semantically valid
160
- // We do this against the TS source instead of the YAML because
161
- // it's easier to provide better errors to the LLM, which is dealing in TS
162
- const analysisWarnings = apiStaticAnalysis(apiSource);
163
- if (analysisWarnings.length > 0) {
164
- // Log detailed warnings
165
- logger.warn("Static analysis warnings", {
166
- warnings: analysisWarnings,
167
- apiSource: apiSource.slice(0, 300),
168
- });
169
- throw new Error(`The API code has semantic issues that need to be fixed:\n\n${analysisWarnings.join("\n\n")}`);
170
- }
171
- if (apiYaml === undefined) {
172
- throw new Error("Failed to generate API YAML. Try again.");
173
- }
174
- const successState = {
175
- ...state,
176
- status: "built",
177
- apiYaml,
178
- };
179
- if (!clark.context.llmConfig?.customerDataAccessEnabled) {
180
- logger.info("Customer data access is disabled, skipping API execution validation");
181
- stateMap.set(id, successState);
182
- return success;
183
- }
184
- const editorClient = clark.context.peer;
185
- if (!editorClient) {
186
- logger.warn("No editor client available, skipping API execution validation");
187
- stateMap.set(id, successState);
188
- return success;
189
- }
190
- let parsedApi;
191
- try {
192
- // Parse with a reviver to clean up backticks from all strings
193
- parsedApi = yaml.parse(apiYaml.content, (_key, value) => {
194
- if (typeof value === "string" &&
195
- value.startsWith("`") &&
196
- value.endsWith("`")) {
197
- return value.slice(1, -1);
198
- }
199
- return value;
200
- });
201
- }
202
- catch (error) {
203
- logger.error("Parsing failed", getErrorMeta(error));
204
- throw new Error(`Failed to parse generated API YAML: ${error instanceof Error ? error.message : String(error)}`);
205
- }
206
- logger.info("Parsed API", safeJsonStringify(parsedApi, 2));
207
- const executor = new ApiExecutor(editorClient, services.integrationStore);
208
- const result = await executor.execute(parsedApi, inputs);
209
- if (!result.success) {
210
- // Log technical error details
211
- logger.error("API execution failed", {
212
- error: result.error,
213
- errorDetails: result.errorDetails,
214
- });
215
- // Return user-friendly error for the subagent LLM
216
- const { errorDetails } = result;
217
- let friendlyMessage = `The API failed during execution: ${result.error ?? ""} ${safeJsonStringify(result.errorDetails)} `;
218
- if (errorDetails) {
219
- switch (errorDetails.type) {
220
- case "validation":
221
- friendlyMessage += `There's a validation error - check that all required parameters are provided and data types are correct.`;
222
- break;
223
- case "execution":
224
- friendlyMessage += `The integration returned an error. This might be due to incorrect query syntax, missing permissions, or invalid data references.`;
225
- break;
226
- case "proto":
227
- friendlyMessage += `There's an incompatibility with the API structure. Try simplifying the API or checking the integration configuration.`;
228
- break;
229
- default:
230
- friendlyMessage += `${result.error}`;
231
- }
232
- if (errorDetails.suggestion) {
233
- friendlyMessage += `\n\nSuggestion: ${errorDetails.suggestion}`;
234
- }
235
- }
236
- throw new Error(friendlyMessage);
237
- }
238
- const { outputs } = result;
239
- if (!outputs) {
240
- throw new Error(`Execution failed: no outputs in response`);
241
- }
242
- // take a small sample of outputs, don't want to blow up context
243
- const sample = safeJsonStringify(outputs).slice(0, MAX_OUTPUT_SAMPLE_LENGTH) +
244
- "...[TRUNCATED]";
245
- stateMap.set(id, successState);
246
- return {
247
- ...success,
248
- execution: {
249
- message: "Verify the output sample matches your expectations; if not, there may be a bug",
250
- outputs: sample,
251
- },
252
- };
35
+ const { isNewApi, inputInterface, responseType } = await buildApiArtifact({
36
+ apiName,
37
+ services,
38
+ scopeUpdateQueue,
39
+ logger,
40
+ });
41
+ let message = `API ${apiName} has been successfully compiled, validated, and saved.`;
42
+ message += `\n\nGenerated TypeScript types:`;
43
+ message += `\n${inputInterface}`;
44
+ message += `\n${responseType}`;
45
+ message += `\n\nTypes saved to apis/${apiName}.d.ts`;
46
+ message += `\n\nThe API is now available in the application. You MUST call testApi to execute and verify the API behavior before moving on to other work`;
47
+ return {
48
+ message,
49
+ apiName,
50
+ isNewApi,
253
51
  };
254
- try {
255
- return await processApiSource();
256
- }
257
- catch (error) {
258
- stateMap.set(id, {
259
- ...state,
260
- lastError: error,
261
- });
262
- throw error;
263
- }
264
52
  },
265
53
  };
266
54
  });