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

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 (339) hide show
  1. package/dist/ai-service/agent/middleware.d.ts +0 -14
  2. package/dist/ai-service/agent/middleware.d.ts.map +1 -1
  3. package/dist/ai-service/agent/middleware.js +0 -40
  4. package/dist/ai-service/agent/middleware.js.map +1 -1
  5. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  6. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +18 -67
  7. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  8. package/dist/ai-service/agent/subagents/apis/static-analysis.d.ts.map +1 -1
  9. package/dist/ai-service/agent/subagents/apis/static-analysis.js +5 -11
  10. package/dist/ai-service/agent/subagents/apis/static-analysis.js.map +1 -1
  11. package/dist/ai-service/agent/subagents/testing/prompt-builder.d.ts.map +1 -1
  12. package/dist/ai-service/agent/subagents/testing/prompt-builder.js +0 -15
  13. package/dist/ai-service/agent/subagents/testing/prompt-builder.js.map +1 -1
  14. package/dist/ai-service/agent/tool-message-utils.d.ts.map +1 -1
  15. package/dist/ai-service/agent/tool-message-utils.js +0 -3
  16. package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
  17. package/dist/ai-service/agent/tools/apis/api-source.d.ts +24 -0
  18. package/dist/ai-service/agent/tools/apis/api-source.d.ts.map +1 -0
  19. package/dist/ai-service/agent/tools/apis/api-source.js +108 -0
  20. package/dist/ai-service/agent/tools/apis/api-source.js.map +1 -0
  21. package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -1
  22. package/dist/ai-service/agent/tools/apis/build-api-artifact.js +3 -11
  23. package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -1
  24. package/dist/ai-service/agent/tools/apis/build-api.d.ts.map +1 -1
  25. package/dist/ai-service/agent/tools/apis/build-api.js +0 -6
  26. package/dist/ai-service/agent/tools/apis/build-api.js.map +1 -1
  27. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts.map +1 -1
  28. package/dist/ai-service/agent/tools/apis/get-api-docs.js +3 -99
  29. package/dist/ai-service/agent/tools/apis/get-api-docs.js.map +1 -1
  30. package/dist/ai-service/agent/tools/apis/integration-types.d.ts.map +1 -1
  31. package/dist/ai-service/agent/tools/apis/integration-types.js +17 -69
  32. package/dist/ai-service/agent/tools/apis/integration-types.js.map +1 -1
  33. package/dist/ai-service/agent/tools/apis/test-api.d.ts +1 -1
  34. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
  35. package/dist/ai-service/agent/tools/apis/test-api.js +45 -26
  36. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
  37. package/dist/ai-service/agent/tools/apis/write-api.d.ts +2 -2
  38. package/dist/ai-service/agent/tools/apis/write-api.d.ts.map +1 -1
  39. package/dist/ai-service/agent/tools/apis/write-api.js +2 -8
  40. package/dist/ai-service/agent/tools/apis/write-api.js.map +1 -1
  41. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  42. package/dist/ai-service/agent/tools/build-capture-screenshot.js +0 -3
  43. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  44. package/dist/ai-service/agent/tools/build-debug.d.ts.map +1 -1
  45. package/dist/ai-service/agent/tools/build-debug.js +6 -58
  46. package/dist/ai-service/agent/tools/build-debug.js.map +1 -1
  47. package/dist/ai-service/agent/tools/build-delete-file.d.ts +1 -1
  48. package/dist/ai-service/agent/tools/build-delete-file.d.ts.map +1 -1
  49. package/dist/ai-service/agent/tools/build-delete-file.js +196 -27
  50. package/dist/ai-service/agent/tools/build-delete-file.js.map +1 -1
  51. package/dist/ai-service/agent/tools/build-edit-file.d.ts +1 -1
  52. package/dist/ai-service/agent/tools/build-edit-file.d.ts.map +1 -1
  53. package/dist/ai-service/agent/tools/build-edit-file.js +22 -12
  54. package/dist/ai-service/agent/tools/build-edit-file.js.map +1 -1
  55. package/dist/ai-service/agent/tools/build-finalize.d.ts.map +1 -1
  56. package/dist/ai-service/agent/tools/build-finalize.js +0 -3
  57. package/dist/ai-service/agent/tools/build-finalize.js.map +1 -1
  58. package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
  59. package/dist/ai-service/agent/tools/build-install-packages.js +0 -15
  60. package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
  61. package/dist/ai-service/agent/tools/build-list-files.d.ts +1 -1
  62. package/dist/ai-service/agent/tools/build-list-files.d.ts.map +1 -1
  63. package/dist/ai-service/agent/tools/build-list-files.js +14 -6
  64. package/dist/ai-service/agent/tools/build-list-files.js.map +1 -1
  65. package/dist/ai-service/agent/tools/build-manage-checklist.d.ts.map +1 -1
  66. package/dist/ai-service/agent/tools/build-manage-checklist.js +0 -9
  67. package/dist/ai-service/agent/tools/build-manage-checklist.js.map +1 -1
  68. package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts +2 -2
  69. package/dist/ai-service/agent/tools/build-multi-edit-file.d.ts.map +1 -1
  70. package/dist/ai-service/agent/tools/build-multi-edit-file.js +25 -8
  71. package/dist/ai-service/agent/tools/build-multi-edit-file.js.map +1 -1
  72. package/dist/ai-service/agent/tools/build-read-file.d.ts +4 -10
  73. package/dist/ai-service/agent/tools/build-read-file.d.ts.map +1 -1
  74. package/dist/ai-service/agent/tools/build-read-file.js +77 -75
  75. package/dist/ai-service/agent/tools/build-read-file.js.map +1 -1
  76. package/dist/ai-service/agent/tools/build-reload-file.d.ts.map +1 -1
  77. package/dist/ai-service/agent/tools/build-reload-file.js +0 -5
  78. package/dist/ai-service/agent/tools/build-reload-file.js.map +1 -1
  79. package/dist/ai-service/agent/tools/build-rename-file.d.ts +1 -1
  80. package/dist/ai-service/agent/tools/build-rename-file.d.ts.map +1 -1
  81. package/dist/ai-service/agent/tools/build-rename-file.js +50 -3
  82. package/dist/ai-service/agent/tools/build-rename-file.js.map +1 -1
  83. package/dist/ai-service/agent/tools/build-validate-icons.d.ts.map +1 -1
  84. package/dist/ai-service/agent/tools/build-validate-icons.js +0 -8
  85. package/dist/ai-service/agent/tools/build-validate-icons.js.map +1 -1
  86. package/dist/ai-service/agent/tools/build-write-file.d.ts +2 -2
  87. package/dist/ai-service/agent/tools/build-write-file.d.ts.map +1 -1
  88. package/dist/ai-service/agent/tools/build-write-file.js +17 -7
  89. package/dist/ai-service/agent/tools/build-write-file.js.map +1 -1
  90. package/dist/ai-service/agent/tools/get-console-logs.d.ts.map +1 -1
  91. package/dist/ai-service/agent/tools/get-console-logs.js +0 -6
  92. package/dist/ai-service/agent/tools/get-console-logs.js.map +1 -1
  93. package/dist/ai-service/agent/tools/get-runtime-errors.d.ts.map +1 -1
  94. package/dist/ai-service/agent/tools/get-runtime-errors.js +0 -4
  95. package/dist/ai-service/agent/tools/get-runtime-errors.js.map +1 -1
  96. package/dist/ai-service/agent/tools/index.d.ts +0 -1
  97. package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
  98. package/dist/ai-service/agent/tools/index.js +0 -1
  99. package/dist/ai-service/agent/tools/index.js.map +1 -1
  100. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
  101. package/dist/ai-service/agent/tools/integrations/execute-request.js +9 -56
  102. package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
  103. package/dist/ai-service/agent/tools/integrations/metadata.d.ts.map +1 -1
  104. package/dist/ai-service/agent/tools/integrations/metadata.js +0 -6
  105. package/dist/ai-service/agent/tools/integrations/metadata.js.map +1 -1
  106. package/dist/ai-service/agent/tools/integrations/run-code.d.ts.map +1 -1
  107. package/dist/ai-service/agent/tools/integrations/run-code.js +0 -9
  108. package/dist/ai-service/agent/tools/integrations/run-code.js.map +1 -1
  109. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  110. package/dist/ai-service/agent/tools.js +6 -27
  111. package/dist/ai-service/agent/tools.js.map +1 -1
  112. package/dist/ai-service/agent/tools2/registry.d.ts +0 -15
  113. package/dist/ai-service/agent/tools2/registry.d.ts.map +1 -1
  114. package/dist/ai-service/agent/tools2/registry.js +0 -30
  115. package/dist/ai-service/agent/tools2/registry.js.map +1 -1
  116. package/dist/ai-service/agent/tools2/tools/ask-multi-choice.d.ts.map +1 -1
  117. package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js +1 -11
  118. package/dist/ai-service/agent/tools2/tools/ask-multi-choice.js.map +1 -1
  119. package/dist/ai-service/agent/tools2/tools/edit.d.ts +1 -4
  120. package/dist/ai-service/agent/tools2/tools/edit.d.ts.map +1 -1
  121. package/dist/ai-service/agent/tools2/tools/edit.js +8 -10
  122. package/dist/ai-service/agent/tools2/tools/edit.js.map +1 -1
  123. package/dist/ai-service/agent/tools2/tools/end-test-run.d.ts.map +1 -1
  124. package/dist/ai-service/agent/tools2/tools/end-test-run.js +0 -5
  125. package/dist/ai-service/agent/tools2/tools/end-test-run.js.map +1 -1
  126. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts +0 -2
  127. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
  128. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +0 -24
  129. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
  130. package/dist/ai-service/agent/tools2/tools/glob.d.ts +1 -4
  131. package/dist/ai-service/agent/tools2/tools/glob.d.ts.map +1 -1
  132. package/dist/ai-service/agent/tools2/tools/glob.js +85 -25
  133. package/dist/ai-service/agent/tools2/tools/glob.js.map +1 -1
  134. package/dist/ai-service/agent/tools2/tools/grep-metadata.d.ts.map +1 -1
  135. package/dist/ai-service/agent/tools2/tools/grep-metadata.js +0 -9
  136. package/dist/ai-service/agent/tools2/tools/grep-metadata.js.map +1 -1
  137. package/dist/ai-service/agent/tools2/tools/grep.d.ts +1 -1
  138. package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
  139. package/dist/ai-service/agent/tools2/tools/grep.js +5 -22
  140. package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
  141. package/dist/ai-service/agent/tools2/tools/list-attachments.d.ts.map +1 -1
  142. package/dist/ai-service/agent/tools2/tools/list-attachments.js +0 -4
  143. package/dist/ai-service/agent/tools2/tools/list-attachments.js.map +1 -1
  144. package/dist/ai-service/agent/tools2/tools/ls.d.ts +1 -8
  145. package/dist/ai-service/agent/tools2/tools/ls.d.ts.map +1 -1
  146. package/dist/ai-service/agent/tools2/tools/ls.js +83 -102
  147. package/dist/ai-service/agent/tools2/tools/ls.js.map +1 -1
  148. package/dist/ai-service/agent/tools2/tools/read.d.ts +2 -5
  149. package/dist/ai-service/agent/tools2/tools/read.d.ts.map +1 -1
  150. package/dist/ai-service/agent/tools2/tools/read.js +12 -24
  151. package/dist/ai-service/agent/tools2/tools/read.js.map +1 -1
  152. package/dist/ai-service/agent/tools2/tools/start-test-run.d.ts.map +1 -1
  153. package/dist/ai-service/agent/tools2/tools/start-test-run.js +0 -13
  154. package/dist/ai-service/agent/tools2/tools/start-test-run.js.map +1 -1
  155. package/dist/ai-service/agent/tools2/tools/update-test-case-status.d.ts.map +1 -1
  156. package/dist/ai-service/agent/tools2/tools/update-test-case-status.js +0 -6
  157. package/dist/ai-service/agent/tools2/tools/update-test-case-status.js.map +1 -1
  158. package/dist/ai-service/agent/tools2/tools/write.d.ts +1 -4
  159. package/dist/ai-service/agent/tools2/tools/write.d.ts.map +1 -1
  160. package/dist/ai-service/agent/tools2/tools/write.js +4 -9
  161. package/dist/ai-service/agent/tools2/tools/write.js.map +1 -1
  162. package/dist/ai-service/agent/tools2/types.d.ts +0 -25
  163. package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
  164. package/dist/ai-service/agent/tools2/types.js.map +1 -1
  165. package/dist/ai-service/app-interface/linter.d.ts +1 -4
  166. package/dist/ai-service/app-interface/linter.d.ts.map +1 -1
  167. package/dist/ai-service/app-interface/linter.js +6 -10
  168. package/dist/ai-service/app-interface/linter.js.map +1 -1
  169. package/dist/ai-service/app-interface/shell.d.ts +1 -205
  170. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  171. package/dist/ai-service/app-interface/shell.js +14 -474
  172. package/dist/ai-service/app-interface/shell.js.map +1 -1
  173. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  174. package/dist/ai-service/chat/chat-session-store.js +0 -8
  175. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  176. package/dist/ai-service/features.d.ts +0 -8
  177. package/dist/ai-service/features.d.ts.map +1 -1
  178. package/dist/ai-service/features.js +0 -8
  179. package/dist/ai-service/features.js.map +1 -1
  180. package/dist/ai-service/index.d.ts +1 -1
  181. package/dist/ai-service/index.d.ts.map +1 -1
  182. package/dist/ai-service/index.js +24 -26
  183. package/dist/ai-service/index.js.map +1 -1
  184. package/dist/ai-service/judge/judge-executor.d.ts.map +1 -1
  185. package/dist/ai-service/judge/judge-executor.js +0 -4
  186. package/dist/ai-service/judge/judge-executor.js.map +1 -1
  187. package/dist/ai-service/llm/client.d.ts +3 -19
  188. package/dist/ai-service/llm/client.d.ts.map +1 -1
  189. package/dist/ai-service/llm/client.js +12 -131
  190. package/dist/ai-service/llm/client.js.map +1 -1
  191. package/dist/ai-service/llm/context/context.d.ts +1 -4
  192. package/dist/ai-service/llm/context/context.d.ts.map +1 -1
  193. package/dist/ai-service/llm/context/context.js +5 -27
  194. package/dist/ai-service/llm/context/context.js.map +1 -1
  195. package/dist/ai-service/llm/context/internal-types.d.ts +0 -5
  196. package/dist/ai-service/llm/context/internal-types.d.ts.map +1 -1
  197. package/dist/ai-service/llm/context/internal-types.js +0 -5
  198. package/dist/ai-service/llm/context/internal-types.js.map +1 -1
  199. package/dist/ai-service/llm/context/levels/l1.d.ts +3 -4
  200. package/dist/ai-service/llm/context/levels/l1.d.ts.map +1 -1
  201. package/dist/ai-service/llm/context/levels/l1.js +8 -9
  202. package/dist/ai-service/llm/context/levels/l1.js.map +1 -1
  203. package/dist/ai-service/llm/context/serialization.d.ts +0 -8
  204. package/dist/ai-service/llm/context/serialization.d.ts.map +1 -1
  205. package/dist/ai-service/llm/context/utils/content-compaction.d.ts +5 -7
  206. package/dist/ai-service/llm/context/utils/content-compaction.d.ts.map +1 -1
  207. package/dist/ai-service/llm/context/utils/content-compaction.js +6 -27
  208. package/dist/ai-service/llm/context/utils/content-compaction.js.map +1 -1
  209. package/dist/ai-service/llm/error.d.ts +0 -1
  210. package/dist/ai-service/llm/error.d.ts.map +1 -1
  211. package/dist/ai-service/llm/error.js +3 -29
  212. package/dist/ai-service/llm/error.js.map +1 -1
  213. package/dist/ai-service/llm/stream/config.d.ts +5 -14
  214. package/dist/ai-service/llm/stream/config.d.ts.map +1 -1
  215. package/dist/ai-service/llm/stream/config.js +5 -17
  216. package/dist/ai-service/llm/stream/config.js.map +1 -1
  217. package/dist/ai-service/llm/stream/errors.d.ts.map +1 -1
  218. package/dist/ai-service/llm/stream/errors.js +4 -7
  219. package/dist/ai-service/llm/stream/errors.js.map +1 -1
  220. package/dist/ai-service/llm/stream/index.d.ts +2 -4
  221. package/dist/ai-service/llm/stream/index.d.ts.map +1 -1
  222. package/dist/ai-service/llm/stream/index.js +2 -4
  223. package/dist/ai-service/llm/stream/index.js.map +1 -1
  224. package/dist/ai-service/llm/stream/orchestrator.d.ts +1 -1
  225. package/dist/ai-service/llm/stream/orchestrator.d.ts.map +1 -1
  226. package/dist/ai-service/llm/stream/orchestrator.js +11 -5
  227. package/dist/ai-service/llm/stream/orchestrator.js.map +1 -1
  228. package/dist/ai-service/llm/stream/retry-engine.d.ts.map +1 -1
  229. package/dist/ai-service/llm/stream/retry-engine.js +3 -3
  230. package/dist/ai-service/llm/stream/retry-engine.js.map +1 -1
  231. package/dist/ai-service/mcp/adapter/mcp-tool-adapter.d.ts +0 -8
  232. package/dist/ai-service/mcp/adapter/mcp-tool-adapter.d.ts.map +1 -1
  233. package/dist/ai-service/mcp/adapter/mcp-tool-adapter.js +0 -108
  234. package/dist/ai-service/mcp/adapter/mcp-tool-adapter.js.map +1 -1
  235. package/dist/ai-service/mcp/embedded-playwright-mcp-server.d.ts.map +1 -1
  236. package/dist/ai-service/mcp/embedded-playwright-mcp-server.js +133 -360
  237. package/dist/ai-service/mcp/embedded-playwright-mcp-server.js.map +1 -1
  238. package/dist/ai-service/state-machine/clark-fsm.d.ts +1 -2
  239. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  240. package/dist/ai-service/state-machine/clark-fsm.js +8 -29
  241. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  242. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  243. package/dist/ai-service/state-machine/handlers/agent-planning.js +6 -17
  244. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  245. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  246. package/dist/ai-service/state-machine/handlers/llm-generating.js +1 -9
  247. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  248. package/dist/ai-service/state-machine/helpers/file-read-tracker.d.ts +7 -0
  249. package/dist/ai-service/state-machine/helpers/file-read-tracker.d.ts.map +1 -0
  250. package/dist/ai-service/state-machine/helpers/file-read-tracker.js +26 -0
  251. package/dist/ai-service/state-machine/helpers/file-read-tracker.js.map +1 -0
  252. package/dist/ai-service/template-renderer.d.ts.map +1 -1
  253. package/dist/ai-service/template-renderer.js +1 -4
  254. package/dist/ai-service/template-renderer.js.map +1 -1
  255. package/dist/ai-service/transform/api-builder/shared.js +2 -2
  256. package/dist/ai-service/transform/api-builder/shared.js.map +1 -1
  257. package/dist/components-manager.d.ts.map +1 -1
  258. package/dist/components-manager.js +12 -17
  259. package/dist/components-manager.js.map +1 -1
  260. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  261. package/dist/file-sync-vite-plugin.js +12 -22
  262. package/dist/file-sync-vite-plugin.js.map +1 -1
  263. package/dist/file-system-manager.d.ts +6 -0
  264. package/dist/file-system-manager.d.ts.map +1 -1
  265. package/dist/file-system-manager.js +144 -119
  266. package/dist/file-system-manager.js.map +1 -1
  267. package/dist/parsing/util.d.ts.map +1 -1
  268. package/dist/parsing/util.js +1 -5
  269. package/dist/parsing/util.js.map +1 -1
  270. package/dist/socket-manager.d.ts.map +1 -1
  271. package/dist/socket-manager.js +11 -5
  272. package/dist/socket-manager.js.map +1 -1
  273. package/dist/source-tracker.d.ts +0 -4
  274. package/dist/source-tracker.d.ts.map +1 -1
  275. package/dist/source-tracker.js +8 -15
  276. package/dist/source-tracker.js.map +1 -1
  277. package/dist/sync-service/index.d.ts.map +1 -1
  278. package/dist/sync-service/index.js +8 -13
  279. package/dist/sync-service/index.js.map +1 -1
  280. package/dist/util/logger.d.ts.map +1 -1
  281. package/dist/util/logger.js +0 -16
  282. package/dist/util/logger.js.map +1 -1
  283. package/dist/util.d.ts +1 -1
  284. package/dist/util.d.ts.map +1 -1
  285. package/dist/util.js +2 -4
  286. package/dist/util.js.map +1 -1
  287. package/package.json +16 -10
  288. package/dist/ai-service/agent/tools/clear-error-cache.d.ts +0 -10
  289. package/dist/ai-service/agent/tools/clear-error-cache.d.ts.map +0 -1
  290. package/dist/ai-service/agent/tools/clear-error-cache.js +0 -38
  291. package/dist/ai-service/agent/tools/clear-error-cache.js.map +0 -1
  292. package/dist/ai-service/app-interface/constants.d.ts +0 -77
  293. package/dist/ai-service/app-interface/constants.d.ts.map +0 -1
  294. package/dist/ai-service/app-interface/constants.js +0 -129
  295. package/dist/ai-service/app-interface/constants.js.map +0 -1
  296. package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts +0 -87
  297. package/dist/ai-service/app-interface/filesystem/draft-manager.d.ts.map +0 -1
  298. package/dist/ai-service/app-interface/filesystem/draft-manager.js +0 -91
  299. package/dist/ai-service/app-interface/filesystem/draft-manager.js.map +0 -1
  300. package/dist/ai-service/app-interface/filesystem/handlers/api-handler.d.ts +0 -35
  301. package/dist/ai-service/app-interface/filesystem/handlers/api-handler.d.ts.map +0 -1
  302. package/dist/ai-service/app-interface/filesystem/handlers/api-handler.js +0 -236
  303. package/dist/ai-service/app-interface/filesystem/handlers/api-handler.js.map +0 -1
  304. package/dist/ai-service/app-interface/filesystem/handlers/index.d.ts +0 -5
  305. package/dist/ai-service/app-interface/filesystem/handlers/index.d.ts.map +0 -1
  306. package/dist/ai-service/app-interface/filesystem/handlers/index.js +0 -5
  307. package/dist/ai-service/app-interface/filesystem/handlers/index.js.map +0 -1
  308. package/dist/ai-service/app-interface/filesystem/index.d.ts +0 -12
  309. package/dist/ai-service/app-interface/filesystem/index.d.ts.map +0 -1
  310. package/dist/ai-service/app-interface/filesystem/index.js +0 -11
  311. package/dist/ai-service/app-interface/filesystem/index.js.map +0 -1
  312. package/dist/ai-service/app-interface/filesystem/validation.d.ts +0 -71
  313. package/dist/ai-service/app-interface/filesystem/validation.d.ts.map +0 -1
  314. package/dist/ai-service/app-interface/filesystem/validation.js +0 -170
  315. package/dist/ai-service/app-interface/filesystem/validation.js.map +0 -1
  316. package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts +0 -108
  317. package/dist/ai-service/app-interface/filesystem/virtual-file-system.d.ts.map +0 -1
  318. package/dist/ai-service/app-interface/filesystem/virtual-file-system.js +0 -157
  319. package/dist/ai-service/app-interface/filesystem/virtual-file-system.js.map +0 -1
  320. package/dist/ai-service/app-interface/filesystem/virtual-fs-types.d.ts +0 -126
  321. package/dist/ai-service/app-interface/filesystem/virtual-fs-types.d.ts.map +0 -1
  322. package/dist/ai-service/app-interface/filesystem/virtual-fs-types.js +0 -9
  323. package/dist/ai-service/app-interface/filesystem/virtual-fs-types.js.map +0 -1
  324. package/dist/ai-service/security/index.d.ts +0 -8
  325. package/dist/ai-service/security/index.d.ts.map +0 -1
  326. package/dist/ai-service/security/index.js +0 -8
  327. package/dist/ai-service/security/index.js.map +0 -1
  328. package/dist/ai-service/security/safety-classifier.d.ts +0 -103
  329. package/dist/ai-service/security/safety-classifier.d.ts.map +0 -1
  330. package/dist/ai-service/security/safety-classifier.js +0 -168
  331. package/dist/ai-service/security/safety-classifier.js.map +0 -1
  332. package/dist/ai-service/security/secret-scanner.d.ts +0 -145
  333. package/dist/ai-service/security/secret-scanner.d.ts.map +0 -1
  334. package/dist/ai-service/security/secret-scanner.js +0 -344
  335. package/dist/ai-service/security/secret-scanner.js.map +0 -1
  336. package/dist/ensure-app-provider.d.ts +0 -2
  337. package/dist/ensure-app-provider.d.ts.map +0 -1
  338. package/dist/ensure-app-provider.js +0 -209
  339. package/dist/ensure-app-provider.js.map +0 -1
@@ -1,13 +1,15 @@
1
1
  import fs from "fs/promises";
2
- import nodePath from "node:path";
2
+ import path from "node:path";
3
3
  import * as t from "@babel/types";
4
4
  import { PROCESSED_TRANSACTIONS_ATTRIBUTE, ROOT_WIDGET_ATTRIBUTE, SOURCE_ID_ATTRIBUTE, WIDGET_DISABLE_DND, } from "@superblocksteam/library-shared";
5
5
  import { addTracingToMethods, TracedEventEmitter, } from "@superblocksteam/shared";
6
6
  import { readAppApiYamlFile, writeApiFiles, } from "@superblocksteam/util";
7
7
  import { glob } from "glob";
8
8
  import { isEqual, debounce } from "lodash-es";
9
- import { normalizePath } from "vite";
10
9
  import yaml from "yaml";
10
+ import { Paths } from "./ai-service/const.js";
11
+ import { YamlToApiBuilderTransformer } from "./ai-service/transform/api-builder/to-sdk-transformer.js";
12
+ import { applyFileTransformations, renderPath, } from "./ai-service/transform/shared.js";
11
13
  import { generateJSXAttribute } from "./codegen.js";
12
14
  import { ComponentsManager } from "./components-manager.js";
13
15
  import { addLegacyCustomComponentVariables, modifyLegacyCustomComponentElements, modifyLegacyCustomComponentImports, } from "./custom-components.js";
@@ -114,13 +116,13 @@ export class FileSystemManager extends TracedEventEmitter {
114
116
  if (!this.rootDir) {
115
117
  throw new Error("Root directory not set");
116
118
  }
117
- return nodePath.join(this.rootDir, "App.tsx");
119
+ return path.join(this.rootDir, "App.tsx");
118
120
  }
119
121
  get rootScopeFilePath() {
120
122
  if (!this.rootDir) {
121
123
  throw new Error("Root directory not set");
122
124
  }
123
- return nodePath.join(this.rootDir, SCOPE_FILE);
125
+ return path.join(this.rootDir, SCOPE_FILE);
124
126
  }
125
127
  // MARK: core setup/init
126
128
  async watch(watcher, rootPath) {
@@ -128,7 +130,7 @@ export class FileSystemManager extends TracedEventEmitter {
128
130
  this.rootDir = rootPath;
129
131
  this.watcher = watcher;
130
132
  // APIs and pages are in the pages subfolder
131
- const fileNames = await readFiles(nodePath.join(rootPath));
133
+ const fileNames = await readFiles(path.join(rootPath));
132
134
  // this reads all files excluding ignore list in the root path. Should we read all files in pages and add root.tsx and App.tsx instead?
133
135
  const tsxFiles = fileNames.filter((f) => f.endsWith(".tsx") && !f.includes(`${getLegacyComponentsFolder()}/`));
134
136
  const yamlFiles = fileNames.filter((f) => f.endsWith(".yaml"));
@@ -166,7 +168,7 @@ export class FileSystemManager extends TracedEventEmitter {
166
168
  // We only want to load the typescript files here, before the source tracker is initialized
167
169
  // API setup needs to be deferred until we've parsed the scope files (which is done in the source tracker)
168
170
  if (type === "tsx" || type === "ts") {
169
- this.tsFiles[normalizePath(path)] = content;
171
+ this.tsFiles[path] = content;
170
172
  }
171
173
  });
172
174
  try {
@@ -285,22 +287,21 @@ export class FileSystemManager extends TracedEventEmitter {
285
287
  if (!this.sourceTracker) {
286
288
  throw new Error("Source tracker not initialized");
287
289
  }
288
- const normalizedPath = normalizePath(filePath);
289
290
  const files = this.sourceTracker.getCurrentFiles();
290
- if (!files[normalizedPath]) {
291
- throw new Error("File not found in source tracker " + normalizedPath);
291
+ if (!files[filePath]) {
292
+ throw new Error("File not found in source tracker " + filePath);
292
293
  }
293
- let ast = files[normalizedPath].ast;
294
+ let ast = files[filePath].ast;
294
295
  if (!ast) {
295
- throw new Error("No AST found for file in source tracker " + normalizedPath);
296
+ throw new Error("No AST found for file in source tracker " + filePath);
296
297
  }
297
- if (normalizedPath in this.tsFiles &&
298
- this.tsFiles[normalizedPath] &&
299
- files[normalizedPath].code !== this.tsFiles[normalizedPath]) {
298
+ if (filePath in this.tsFiles &&
299
+ this.tsFiles[filePath] &&
300
+ files[filePath].code !== this.tsFiles[filePath]) {
300
301
  getLogger().error("File code mismatch in source tracker, this should never happen: " +
301
302
  filePath);
302
- await this.handleNonVisualChangeByDeletingIds(filePath, this.tsFiles[normalizedPath]);
303
- const newAst = this.sourceTracker.getCurrentFiles()[normalizedPath]?.ast;
303
+ await this.handleNonVisualChangeByDeletingIds(filePath, this.tsFiles[filePath]);
304
+ const newAst = this.sourceTracker.getCurrentFiles()[filePath]?.ast;
304
305
  if (!newAst) {
305
306
  throw new Error("No AST found for file in source tracker after mismatch:" + filePath);
306
307
  }
@@ -455,49 +456,46 @@ export class FileSystemManager extends TracedEventEmitter {
455
456
  return;
456
457
  }
457
458
  const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
458
- // Normalize both paths for comparison (Windows compatibility)
459
- const normalizedFilePath = normalizePath(filePath);
460
- const normalizedRootPath = normalizePath(rootPath);
461
459
  // Only handle files we care about and that are in our root path
462
- if (!fileType || !normalizedFilePath.startsWith(normalizedRootPath)) {
460
+ if (!fileType || !filePath.startsWith(rootPath)) {
463
461
  return;
464
462
  }
465
463
  // Queue the operation based on the event type
466
464
  switch (event) {
467
465
  case "add": {
468
- const file = await readFile(normalizedFilePath);
466
+ const file = await readFile(filePath);
469
467
  if (typeof file !== "string")
470
468
  return;
471
469
  switch (fileType.type) {
472
470
  case "api":
473
471
  case "python-api-step":
474
472
  case "js-api-step": {
475
- await this.processApiFileUpdates(normalizedFilePath, fileType);
473
+ await this.processApiFileUpdates(filePath, fileType);
476
474
  break;
477
475
  }
478
476
  case "ts":
479
477
  case "tsx":
480
- if (!(normalizedFilePath in this.tsFiles)) {
481
- this.tsFiles[normalizedFilePath] = file;
482
- await this.handleNonVisualChangeByDeletingIds(normalizedFilePath, file);
483
- this.emit("fileChanged", normalizedFilePath, file, true);
478
+ if (!(filePath in this.tsFiles)) {
479
+ this.tsFiles[filePath] = file;
480
+ await this.handleNonVisualChangeByDeletingIds(filePath, file);
481
+ this.emit("fileChanged", filePath, file, true);
484
482
  return;
485
483
  }
486
484
  }
487
485
  break;
488
486
  }
489
487
  case "change": {
490
- const fileType = SUPPORTED_FILETYPES.find((f) => normalizedFilePath.endsWith(f.extension));
491
- if (!fileType || !normalizedFilePath.startsWith(rootPath)) {
488
+ const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
489
+ if (!fileType || !filePath.startsWith(rootPath)) {
492
490
  return;
493
491
  }
494
- const data = await readFile(normalizedFilePath);
492
+ const data = await readFile(filePath);
495
493
  if (typeof data !== "string")
496
494
  return;
497
495
  // Handle router file changes
498
- if (this.routerFilePath && normalizedFilePath === this.routerFilePath) {
496
+ if (this.routerFilePath && filePath === this.routerFilePath) {
499
497
  logger.info("Router file changed, emitting routerChange event");
500
- this.emit("routerChange", normalizedFilePath);
498
+ this.emit("routerChange", filePath);
501
499
  return;
502
500
  }
503
501
  switch (fileType.type) {
@@ -505,18 +503,17 @@ export class FileSystemManager extends TracedEventEmitter {
505
503
  case "tsx":
506
504
  case "scope":
507
505
  {
508
- if (!(normalizedFilePath in this.tsFiles &&
509
- this.tsFiles[normalizedFilePath] === data)) {
510
- logger.info(`File changed: ${normalizedFilePath} updating AST tracker`);
511
- this.tsFiles[normalizedFilePath] = data;
506
+ if (!(filePath in this.tsFiles && this.tsFiles[filePath] === data)) {
507
+ logger.info(`File changed: ${filePath} updating AST tracker`);
508
+ this.tsFiles[filePath] = data;
512
509
  // only update the source tracker if the file is different
513
- await this.handleNonVisualChangeByDeletingIds(normalizedFilePath, data);
514
- this.emit("fileChanged", normalizedFilePath, data, true);
510
+ await this.handleNonVisualChangeByDeletingIds(filePath, data);
511
+ this.emit("fileChanged", filePath, data, true);
515
512
  }
516
513
  else {
517
- logger.info(`File unchanged from last tracked state: ${normalizedFilePath}`);
518
- this.emit("fileChanged", normalizedFilePath, data, false);
519
- this.sourceTracker?.updateFileContents(normalizedFilePath, data);
514
+ logger.info(`File unchanged from last tracked state: ${filePath}`);
515
+ this.emit("fileChanged", filePath, data, false);
516
+ this.sourceTracker?.updateFileContents(filePath, data);
520
517
  }
521
518
  }
522
519
  break;
@@ -524,17 +521,16 @@ export class FileSystemManager extends TracedEventEmitter {
524
521
  case "python-api-step":
525
522
  case "js-api-step":
526
523
  {
527
- await this.processApiFileUpdates(normalizedFilePath, fileType);
524
+ await this.processApiFileUpdates(filePath, fileType);
528
525
  }
529
526
  break;
530
527
  }
531
528
  break;
532
529
  }
533
530
  case "unlink": {
534
- if (normalizedFilePath in this.tsFiles) {
535
- await this.deleteTsFile(normalizedFilePath);
536
- if (this.routerFilePath &&
537
- normalizedFilePath === this.routerFilePath) {
531
+ if (filePath in this.tsFiles) {
532
+ await this.deleteTsFile(filePath);
533
+ if (this.routerFilePath && filePath === this.routerFilePath) {
538
534
  logger.warn("Router file was deleted, attempting to find new router file");
539
535
  try {
540
536
  this.routerFilePath = await findRouterFile(rootPath);
@@ -548,19 +544,18 @@ export class FileSystemManager extends TracedEventEmitter {
548
544
  }
549
545
  }
550
546
  }
551
- else if (normalizedFilePath in this.apiFiles) {
552
- await this.removeApiData(normalizedFilePath);
547
+ else if (filePath in this.apiFiles) {
548
+ await this.removeApiData(filePath);
553
549
  }
554
550
  break;
555
551
  }
556
552
  }
557
553
  };
558
554
  async deleteTsFile(filePath) {
559
- const normalizedPath = normalizePath(filePath);
560
- delete this.tsFiles[normalizedPath];
561
- this.sourceTracker?.removeFile(normalizedPath);
562
- if (isPageFilePath(normalizedPath)) {
563
- this.emit("deletePage", normalizedPath);
555
+ delete this.tsFiles[filePath];
556
+ this.sourceTracker?.removeFile(filePath);
557
+ if (isPageFilePath(filePath)) {
558
+ this.emit("deletePage", filePath);
564
559
  }
565
560
  }
566
561
  getTsFilePaths() {
@@ -576,14 +571,65 @@ export class FileSystemManager extends TracedEventEmitter {
576
571
  setTemplateRenderer(templateRenderer) {
577
572
  this.templateRenderer = templateRenderer;
578
573
  }
574
+ /**
575
+ * Generate TypeScript source from YAML and write to scratch directory
576
+ * This is called when YAML changes (e.g., UI edits) to keep TS in sync.
577
+ */
578
+ syncTsFromYaml = debounce((apiName) => {
579
+ return this.fsOperationQueue.enqueue(() => this._syncTsFromYaml(apiName));
580
+ }, 250, { leading: true, trailing: true, maxWait: 500 });
581
+ async _syncTsFromYaml(apiName) {
582
+ const logger = getLogger();
583
+ // Skip if we don't have templateRenderer
584
+ if (!this.templateRenderer || !this.rootDir) {
585
+ logger.warn(`Skipping YAML→TS sync for ${apiName}: templateRenderer or rootDir not available`);
586
+ return;
587
+ }
588
+ logger.info(`Starting YAML→TS sync for: ${apiName}`);
589
+ try {
590
+ const yamlPath = renderPath(Paths.ApiYamls, { apiName });
591
+ logger.debug(`Syncing TS source from YAML for API: ${apiName}`);
592
+ // Create file artifact for transformation
593
+ const yamlArtifact = {
594
+ type: "file",
595
+ filePath: yamlPath,
596
+ content: "", // Transformer just needs the path
597
+ };
598
+ // Transform YAML to TS
599
+ const outputs = await applyFileTransformations([yamlArtifact], [
600
+ new YamlToApiBuilderTransformer({
601
+ appRootDirPath: this.rootDir,
602
+ entityNames: [], // Empty for now, could be enhanced later
603
+ skipCleanup: true,
604
+ templateRenderer: this.templateRenderer,
605
+ }),
606
+ ]);
607
+ const tsArtifact = outputs[0];
608
+ if (!tsArtifact) {
609
+ logger.warn(`No TS artifact generated for ${apiName}`);
610
+ return;
611
+ }
612
+ logger.debug(`Generated TS source for ${apiName}, writing to scratch`, tsArtifact.content);
613
+ // Write to scratch directory
614
+ const apiTsFilePath = `${renderPath(Paths.GeneratedApis, { apiName })}.ts`;
615
+ const scratchPath = renderPath(Paths.Scratch, { path: apiTsFilePath });
616
+ const fullPath = path.join(this.rootDir, scratchPath);
617
+ await fs.mkdir(path.dirname(fullPath), { recursive: true });
618
+ await fs.writeFile(fullPath, tsArtifact.content, { encoding: "utf-8" });
619
+ logger.info(`✓ Synced TS source to scratch for ${apiName}`);
620
+ }
621
+ catch (error) {
622
+ logger.error(`Failed to sync TS from YAML for ${apiName}`, getErrorMeta(error));
623
+ // Don't throw - sync failure shouldn't break the API update
624
+ }
625
+ }
579
626
  // MARK: fs read/write
580
627
  async writeFile(path, content, kind) {
581
628
  getLogger().info(`Writing file: ${path}, kind: ${kind ?? "other"}`);
582
629
  switch (kind) {
583
630
  case "ts": {
584
631
  // happens eagerly regardless of error - possible desync
585
- const normalizedPath = normalizePath(path);
586
- this.tsFiles[normalizedPath] = content;
632
+ this.tsFiles[path] = content;
587
633
  // TODO(george): as an optimization, we could update the memory snapshot of the file that SyncService is holding
588
634
  await this.fsOperationQueue.enqueue(async () => {
589
635
  const dir = path.substring(0, path.lastIndexOf("/"));
@@ -595,8 +641,7 @@ export class FileSystemManager extends TracedEventEmitter {
595
641
  break;
596
642
  }
597
643
  case "api": {
598
- const normalizedPath = normalizePath(path);
599
- const currentApiFile = this.apiFiles[normalizedPath];
644
+ const currentApiFile = this.apiFiles[path];
600
645
  const apiPb = yaml.parse(content);
601
646
  // We don't need ID, organization, or trigger data in code-mode APIs
602
647
  if (apiPb.metadata) {
@@ -610,15 +655,14 @@ export class FileSystemManager extends TracedEventEmitter {
610
655
  const scopeId = getScopeIdFromName("App");
611
656
  // Update in-memory state before writing to disk (similar to TS files)
612
657
  // This allows the file watcher to detect no change and skip duplicate events
613
- this.apiFiles[normalizedPath] = {
658
+ this.apiFiles[path] = {
614
659
  apiPb: yaml.parse(JSON.stringify(apiPb)),
615
660
  stepPathMap,
616
661
  scopeId,
617
662
  };
618
663
  // TODO(george): as an optimization, we could update the memory snapshot of the file that SyncService is holding
619
- const apiDir = nodePath.dirname(path);
620
664
  await this.fsOperationQueue.enqueue(async () => {
621
- await writeApiFiles({ apiPb }, "api", apiDir, false, [], [], { extractLargeSourceFiles: true, minLinesForExtraction: 1 }, new Set(Object.keys(this.apiFiles)), stepPathMap);
665
+ await writeApiFiles({ apiPb }, "api", path.split("/").slice(0, -1).join("/"), false, [], [], { extractLargeSourceFiles: true, minLinesForExtraction: 1 }, new Set(Object.keys(this.apiFiles)), stepPathMap);
622
666
  });
623
667
  break;
624
668
  }
@@ -635,7 +679,7 @@ export class FileSystemManager extends TracedEventEmitter {
635
679
  }
636
680
  }
637
681
  readFile(path) {
638
- return this.tsFiles[normalizePath(path)];
682
+ return this.tsFiles[path];
639
683
  }
640
684
  async setFileContents(path, contents) {
641
685
  const logger = getLogger();
@@ -660,15 +704,14 @@ export class FileSystemManager extends TracedEventEmitter {
660
704
  }
661
705
  getLocalBindingEntities(path) {
662
706
  const logger = getLogger();
663
- const normalizedPath = normalizePath(path);
664
707
  const files = this.sourceTracker?.getCurrentFiles();
665
- if (!files || !files[normalizedPath]) {
666
- logger.warn(`File not found in source tracker for local binding entities: ${normalizedPath}`);
708
+ if (!files || !files[path]) {
709
+ logger.warn(`File not found in source tracker for local binding entities: ${path}`);
667
710
  return [];
668
711
  }
669
- const ast = files[normalizedPath].ast;
712
+ const ast = files[path].ast;
670
713
  if (!ast) {
671
- logger.warn(`No AST found for file in source tracker for local binding entities: ${normalizedPath}`);
714
+ logger.warn(`No AST found for file in source tracker for local binding entities: ${path}`);
672
715
  return [];
673
716
  }
674
717
  const localBindingEntities = new Set();
@@ -687,7 +730,7 @@ export class FileSystemManager extends TracedEventEmitter {
687
730
  return Array.from(localBindingEntities);
688
731
  }
689
732
  getPageRootNodes(filePath) {
690
- const scopeFilePath = normalizePath(nodePath.join(nodePath.dirname(filePath), "index.tsx"));
733
+ const scopeFilePath = path.join(path.dirname(filePath), "index.tsx");
691
734
  return this.getRootNodesForFile(scopeFilePath);
692
735
  }
693
736
  getAppRootNodes() {
@@ -707,8 +750,8 @@ export class FileSystemManager extends TracedEventEmitter {
707
750
  let resolvedPath = await getFullImportPath(localPath);
708
751
  // Fallback: manually resolve relative paths if Vite resolver fails
709
752
  if (!resolvedPath && localPath.startsWith(".")) {
710
- const currentDir = nodePath.dirname(filePath);
711
- const potentialPath = nodePath.resolve(currentDir, localPath);
753
+ const currentDir = path.dirname(filePath);
754
+ const potentialPath = path.resolve(currentDir, localPath);
712
755
  // Try with different extensions
713
756
  const extensions = [
714
757
  "/index.tsx",
@@ -738,24 +781,22 @@ export class FileSystemManager extends TracedEventEmitter {
738
781
  return importedFiles;
739
782
  }
740
783
  async getRootNodesForFile(filePath) {
741
- const normalizedPath = normalizePath(filePath);
742
- const currentFile = this.sourceTracker?.getCurrentFiles()[normalizedPath];
784
+ const currentFile = this.sourceTracker?.getCurrentFiles()[filePath];
743
785
  if (!currentFile) {
744
786
  return undefined;
745
787
  }
746
788
  const allFiles = this.sourceTracker?.getCurrentFiles() ?? {};
747
789
  // Collect all imported files recursively (including transitive imports)
748
- const importedNamesToFiles = await this.collectAllImports(normalizedPath, allFiles);
790
+ const importedNamesToFiles = await this.collectAllImports(filePath, allFiles);
749
791
  // Get roots from imported files (custom components)
750
792
  const importedRoots = Object.entries(importedNamesToFiles).flatMap(([filePath, file]) => getRootNodes(filePath, file));
751
793
  // Get roots from the current file
752
- const roots = getRootNodes(normalizedPath, currentFile);
794
+ const roots = getRootNodes(filePath, currentFile);
753
795
  return [...roots, ...importedRoots];
754
796
  }
755
797
  getScope(filePath, fallback) {
756
798
  // Since we no longer use scope.ts files, generate scope info from file path. Pages retain page scope, everything else is App.
757
- const normalizedPath = normalizePath(filePath);
758
- const scopeName = getScopeNameFromPath(normalizedPath);
799
+ const scopeName = getScopeNameFromPath(filePath);
759
800
  if (!scopeName) {
760
801
  if (fallback) {
761
802
  return {
@@ -931,8 +972,8 @@ export class FileSystemManager extends TracedEventEmitter {
931
972
  if (!this.rootDir) {
932
973
  throw new Error("Root directory not set");
933
974
  }
934
- // no leading slash, normalize to forward slashes for routes (Windows compatibility)
935
- return normalizePath(nodePath.relative(nodePath.join(this.rootDir, PAGES_DIRECTORY), filePath));
975
+ // no leading slash
976
+ return path.relative(path.join(this.rootDir, PAGES_DIRECTORY), filePath);
936
977
  }
937
978
  // MARK: API operations
938
979
  handleUpdateApi = async (payload) => {
@@ -949,8 +990,7 @@ export class FileSystemManager extends TracedEventEmitter {
949
990
  throw new Error("Root directory not set");
950
991
  }
951
992
  const apiFilePath = getApiFilePath(this.rootDir, apiName);
952
- const normalizedApiFilePath = normalizePath(apiFilePath);
953
- const apiDir = nodePath.dirname(normalizedApiFilePath);
993
+ const apiDir = path.dirname(apiFilePath);
954
994
  try {
955
995
  const stats = await fs.stat(apiDir);
956
996
  if (!stats.isDirectory()) {
@@ -977,12 +1017,11 @@ export class FileSystemManager extends TracedEventEmitter {
977
1017
  const deletedApis = [];
978
1018
  for (const { apiName } of apis) {
979
1019
  const apiFilePath = getApiFilePath(rootDir, apiName);
980
- const normalizedApiFilePath = normalizePath(apiFilePath);
981
- const api = this.apiFiles[normalizedApiFilePath];
1020
+ const api = this.apiFiles[apiFilePath];
982
1021
  if (!api || !this.sourceTracker) {
983
1022
  continue;
984
1023
  }
985
- const apiDir = nodePath.dirname(apiFilePath);
1024
+ const apiDir = path.dirname(apiFilePath);
986
1025
  try {
987
1026
  await this.fsOperationQueue.enqueue(async () => {
988
1027
  const stats = await fs.stat(apiDir);
@@ -990,7 +1029,7 @@ export class FileSystemManager extends TracedEventEmitter {
990
1029
  await fs.rmdir(apiDir, { recursive: true });
991
1030
  }
992
1031
  });
993
- delete this.apiFiles[normalizedApiFilePath];
1032
+ delete this.apiFiles[apiFilePath];
994
1033
  const scopeId = this.sourceTracker.deleteApi({
995
1034
  apiName,
996
1035
  });
@@ -1015,16 +1054,15 @@ export class FileSystemManager extends TracedEventEmitter {
1015
1054
  if (!this.rootDir) {
1016
1055
  throw new Error("Root directory not set");
1017
1056
  }
1018
- const existingApiFolder = nodePath.join(this.rootDir, "apis", oldName);
1019
- const newApiFolder = nodePath.join(this.rootDir, "apis", newName);
1020
- const apiFilePath = nodePath.join(existingApiFolder, "api.yaml");
1021
- const normalizedApiFilePath = normalizePath(apiFilePath);
1022
- const apiDef = this.apiFiles[normalizedApiFilePath];
1057
+ const existingApiFolder = path.join(this.rootDir, "apis", oldName);
1058
+ const newApiFolder = path.join(this.rootDir, "apis", newName);
1059
+ const apiFilePath = path.join(existingApiFolder, "api.yaml");
1060
+ const apiDef = this.apiFiles[apiFilePath];
1023
1061
  if (!apiDef) {
1024
1062
  throw new Error(`API ${oldName} not found`);
1025
1063
  }
1026
1064
  const otherAPIs = structuredClone(Object.keys(this.apiFiles)
1027
- .filter((path) => path !== normalizedApiFilePath)
1065
+ .filter((path) => path !== apiFilePath)
1028
1066
  .map((path) => ({
1029
1067
  api: { apiPb: this.apiFiles[path]?.apiPb },
1030
1068
  filePath: path,
@@ -1039,9 +1077,9 @@ export class FileSystemManager extends TracedEventEmitter {
1039
1077
  apiDef.apiPb.metadata.name = newName;
1040
1078
  await fs.rename(existingApiFolder, newApiFolder);
1041
1079
  const scopeId = getScopeIdFromName("App");
1042
- delete this.apiFiles[normalizedApiFilePath];
1080
+ delete this.apiFiles[apiFilePath];
1043
1081
  // not waiting because we are queueing the write further down
1044
- void this.writeFile(nodePath.join(newApiFolder, "api.yaml"), yaml.stringify(apiDef.apiPb), "api");
1082
+ void this.writeFile(path.join(newApiFolder, "api.yaml"), yaml.stringify(apiDef.apiPb), "api");
1045
1083
  this.watcher?.add(existingApiFolder);
1046
1084
  this.watcher?.add(newApiFolder);
1047
1085
  const changes = (await this.sourceTracker?.getAndFlushChanges()) ?? [];
@@ -1069,12 +1107,11 @@ export class FileSystemManager extends TracedEventEmitter {
1069
1107
  }));
1070
1108
  };
1071
1109
  async removeApiData(filePath) {
1072
- const normalizedPath = normalizePath(filePath);
1073
- const api = this.apiFiles[normalizedPath];
1110
+ const api = this.apiFiles[filePath];
1074
1111
  if (!api) {
1075
1112
  return;
1076
1113
  }
1077
- delete this.apiFiles[normalizedPath];
1114
+ delete this.apiFiles[filePath];
1078
1115
  this.sourceTracker?.deleteApi({
1079
1116
  apiName: api.apiPb.metadata.name,
1080
1117
  });
@@ -1133,10 +1170,9 @@ export class FileSystemManager extends TracedEventEmitter {
1133
1170
  let yamlPath = filePath;
1134
1171
  if (fileType.type === "python-api-step" ||
1135
1172
  fileType.type === "js-api-step") {
1136
- const apiFolderPath = nodePath.dirname(filePath);
1137
- yamlPath = nodePath.join(apiFolderPath, "api.yaml");
1173
+ const apiFolderPath = filePath.split("/").slice(0, -1).join("/");
1174
+ yamlPath = path.join(apiFolderPath, "api.yaml");
1138
1175
  }
1139
- const normalizedYamlPath = normalizePath(yamlPath);
1140
1176
  const logger = getLogger();
1141
1177
  logger.info(`Processing API file update: ${yamlPath}`);
1142
1178
  try {
@@ -1147,9 +1183,9 @@ export class FileSystemManager extends TracedEventEmitter {
1147
1183
  }
1148
1184
  logger.info(`API structure is valid: ${yamlPath}`);
1149
1185
  const parsedData = { apiPb: apiContent?.api };
1150
- if (normalizedYamlPath in this.apiFiles &&
1151
- isEqual(this.apiFiles[normalizedYamlPath]?.apiPb, parsedData.apiPb)) {
1152
- logger.info(`No changes detected in API: ${normalizedYamlPath}`);
1186
+ if (yamlPath in this.apiFiles &&
1187
+ isEqual(this.apiFiles[yamlPath]?.apiPb, parsedData.apiPb)) {
1188
+ logger.info(`No changes detected in API: ${yamlPath}`);
1153
1189
  return;
1154
1190
  }
1155
1191
  const { updatedApi, isNewApi } = this.updateInternalApiData({
@@ -1215,35 +1251,28 @@ export class MockFileSyncManager extends FileSystemManager {
1215
1251
  }
1216
1252
  async writeFile(path, content, kind) {
1217
1253
  await this.fsOperationQueue.enqueue(async () => {
1218
- const normalizedPath = normalizePath(path);
1219
1254
  if (kind === "ts") {
1220
- this.tsFiles[normalizedPath] = content;
1255
+ this.tsFiles[path] = content;
1221
1256
  }
1222
1257
  else {
1223
- this.apiFiles[normalizedPath] = {
1258
+ this.apiFiles[path] = {
1224
1259
  apiPb: yaml.parse(content),
1225
1260
  stepPathMap: {},
1226
1261
  scopeId: getScopeIdFromName("App"),
1227
1262
  };
1228
1263
  }
1229
1264
  // Notify subscribers
1230
- this.emit("fileChanged", normalizedPath, content, true);
1265
+ this.emit("fileChanged", path, content, true);
1231
1266
  });
1232
1267
  }
1233
1268
  // Helper methods for testing
1234
1269
  mockFileChange(path, content) {
1235
- const normalizedPath = normalizePath(path);
1236
- this.tsFiles[normalizedPath] = content;
1237
- this.emit("fileChanged", normalizedPath, content, true);
1270
+ this.tsFiles[path] = content;
1271
+ this.emit("fileChanged", path, content, true);
1238
1272
  }
1239
1273
  handleUpdateApi = async (payload) => {
1240
1274
  const apiName = payload.api.apiPb.metadata.name;
1241
- if (!this.rootDir) {
1242
- throw new Error("Root directory not set");
1243
- }
1244
- const apiFilePath = getApiFilePath(this.rootDir, apiName);
1245
- const normalizedApiFilePath = normalizePath(apiFilePath);
1246
- this.apiFiles[normalizedApiFilePath] = {
1275
+ this.apiFiles[apiName] = {
1247
1276
  ...payload.api,
1248
1277
  stepPathMap: {},
1249
1278
  scopeId: payload.scopeId,
@@ -1274,9 +1303,7 @@ async function readFile(path) {
1274
1303
  }
1275
1304
  }
1276
1305
  async function readFiles(dir) {
1277
- const files = await glob("**/*.{tsx,yaml,ts}", {
1278
- cwd: dir,
1279
- absolute: true,
1306
+ return await glob(path.join(dir, "**/*.{tsx,yaml,ts}"), {
1280
1307
  ignore: [
1281
1308
  "node_modules/**",
1282
1309
  "dist/**",
@@ -1285,10 +1312,8 @@ async function readFiles(dir) {
1285
1312
  `./${getLegacyComponentsFolder()}/**`,
1286
1313
  ],
1287
1314
  });
1288
- // Normalize paths to use forward slashes on all platforms (Windows returns backslashes)
1289
- return files.map((file) => normalizePath(file));
1290
1315
  }
1291
- const getMergedApiContent = async (filePath) => {
1292
- return readAppApiYamlFile(nodePath.dirname(filePath));
1316
+ const getMergedApiContent = async (path) => {
1317
+ return readAppApiYamlFile(path.split("/").slice(0, -1).join("/"));
1293
1318
  };
1294
1319
  //# sourceMappingURL=file-system-manager.js.map