flujo-ai 3.18.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (487) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +252 -231
  3. package/.next/app-path-routes-manifest.json +13 -11
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/prerender-manifest.json +21 -21
  6. package/.next/react-loadable-manifest.json +11 -11
  7. package/.next/routes-manifest.json +8 -0
  8. package/.next/server/app/_not-found/page.js +2 -2
  9. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/.next/server/app/_not-found.html +1 -1
  11. package/.next/server/app/_not-found.rsc +2 -2
  12. package/.next/server/app/api/backup/route.js +1 -1
  13. package/.next/server/app/api/backup/route.js.nft.json +1 -1
  14. package/.next/server/app/api/backup/route_client-reference-manifest.js +1 -1
  15. package/.next/server/app/api/browse/route_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/cwd/route_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/encryption/secure/route.js +1 -1
  18. package/.next/server/app/api/encryption/secure/route.js.nft.json +1 -1
  19. package/.next/server/app/api/encryption/secure/route_client-reference-manifest.js +1 -1
  20. package/.next/server/app/api/env/route.js +2 -2
  21. package/.next/server/app/api/env/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/flow/[id]/route.js +1 -1
  23. package/.next/server/app/api/flow/[id]/route.js.nft.json +1 -1
  24. package/.next/server/app/api/flow/[id]/route_client-reference-manifest.js +1 -1
  25. package/.next/server/app/api/flow/compile/route.js +1 -1
  26. package/.next/server/app/api/flow/compile/route.js.nft.json +1 -1
  27. package/.next/server/app/api/flow/compile/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/flow/generate/route.js +1 -1
  29. package/.next/server/app/api/flow/generate/route.js.nft.json +1 -1
  30. package/.next/server/app/api/flow/generate/route_client-reference-manifest.js +1 -1
  31. package/.next/server/app/api/flow/improve/route.js +1 -1
  32. package/.next/server/app/api/flow/improve/route.js.nft.json +1 -1
  33. package/.next/server/app/api/flow/improve/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/flow/prompt-renderer/route.js +2 -2
  35. package/.next/server/app/api/flow/prompt-renderer/route.js.nft.json +1 -1
  36. package/.next/server/app/api/flow/prompt-renderer/route_client-reference-manifest.js +1 -1
  37. package/.next/server/app/api/flow/quick-chat/route.js +1 -1
  38. package/.next/server/app/api/flow/quick-chat/route.js.nft.json +1 -1
  39. package/.next/server/app/api/flow/quick-chat/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/flow/repair/route.js +1 -0
  41. package/.next/server/app/api/flow/repair/route.js.nft.json +1 -0
  42. package/.next/server/app/api/flow/repair/route_client-reference-manifest.js +1 -0
  43. package/.next/server/app/api/flow/route.js +1 -1
  44. package/.next/server/app/api/flow/route.js.nft.json +1 -1
  45. package/.next/server/app/api/flow/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/git/route.js +4 -4
  47. package/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/init/route.js +1 -1
  49. package/.next/server/app/api/init/route.js.nft.json +1 -1
  50. package/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
  51. package/.next/server/app/api/local-models/capability/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/local-models/pull/route_client-reference-manifest.js +1 -1
  53. package/.next/server/app/api/local-models/suggest/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/mcp/cancel/route.js +2 -2
  55. package/.next/server/app/api/mcp/cancel/route.js.nft.json +1 -1
  56. package/.next/server/app/api/mcp/cancel/route_client-reference-manifest.js +1 -1
  57. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js +1 -1
  58. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route.js.nft.json +1 -1
  59. package/.next/server/app/api/mcp/servers/[name]/prompts/get/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/mcp/servers/[name]/prompts/route.js +1 -1
  61. package/.next/server/app/api/mcp/servers/[name]/prompts/route.js.nft.json +1 -1
  62. package/.next/server/app/api/mcp/servers/[name]/prompts/route_client-reference-manifest.js +1 -1
  63. package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js +1 -1
  64. package/.next/server/app/api/mcp/servers/[name]/resources/read/route.js.nft.json +1 -1
  65. package/.next/server/app/api/mcp/servers/[name]/resources/read/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/mcp/servers/[name]/resources/route.js +1 -1
  67. package/.next/server/app/api/mcp/servers/[name]/resources/route.js.nft.json +1 -1
  68. package/.next/server/app/api/mcp/servers/[name]/resources/route_client-reference-manifest.js +1 -1
  69. package/.next/server/app/api/mcp/servers/[name]/route.js +1 -1
  70. package/.next/server/app/api/mcp/servers/[name]/route.js.nft.json +1 -1
  71. package/.next/server/app/api/mcp/servers/[name]/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/mcp/servers/[name]/status/route.js +1 -1
  73. package/.next/server/app/api/mcp/servers/[name]/status/route.js.nft.json +1 -1
  74. package/.next/server/app/api/mcp/servers/[name]/status/route_client-reference-manifest.js +1 -1
  75. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js +1 -1
  76. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route.js.nft.json +1 -1
  77. package/.next/server/app/api/mcp/servers/[name]/tools/[toolName]/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/mcp/servers/[name]/tools/route.js +1 -1
  79. package/.next/server/app/api/mcp/servers/[name]/tools/route.js.nft.json +1 -1
  80. package/.next/server/app/api/mcp/servers/[name]/tools/route_client-reference-manifest.js +1 -1
  81. package/.next/server/app/api/mcp/servers/route.js +1 -1
  82. package/.next/server/app/api/mcp/servers/route.js.nft.json +1 -1
  83. package/.next/server/app/api/mcp/servers/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/mcp/test-connection/route.js +1 -1
  85. package/.next/server/app/api/mcp/test-connection/route.js.nft.json +1 -1
  86. package/.next/server/app/api/mcp/test-connection/route_client-reference-manifest.js +1 -1
  87. package/.next/server/app/api/mcp/test-connection/stream/route.js +1 -1
  88. package/.next/server/app/api/mcp/test-connection/stream/route.js.nft.json +1 -1
  89. package/.next/server/app/api/mcp/test-connection/stream/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/mcp-registry/route.js +2 -1
  91. package/.next/server/app/api/mcp-registry/route.js.nft.json +1 -1
  92. package/.next/server/app/api/mcp-registry/route_client-reference-manifest.js +1 -1
  93. package/.next/server/app/api/mcp-registry/spotlight/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/model/[id]/route.js +1 -1
  95. package/.next/server/app/api/model/[id]/route.js.nft.json +1 -1
  96. package/.next/server/app/api/model/[id]/route_client-reference-manifest.js +1 -1
  97. package/.next/server/app/api/model/provider/route.js +2 -2
  98. package/.next/server/app/api/model/provider/route.js.nft.json +1 -1
  99. package/.next/server/app/api/model/provider/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/model/route.js +1 -1
  101. package/.next/server/app/api/model/route.js.nft.json +1 -1
  102. package/.next/server/app/api/model/route_client-reference-manifest.js +1 -1
  103. package/.next/server/app/api/model/test/route.js +2 -2
  104. package/.next/server/app/api/model/test/route.js.nft.json +1 -1
  105. package/.next/server/app/api/model/test/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/oauth/callback/route.js +2 -2
  107. package/.next/server/app/api/oauth/callback/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/oauth/initiate/route.js +2 -2
  109. package/.next/server/app/api/oauth/initiate/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/oauth/reset/route.js +2 -2
  111. package/.next/server/app/api/oauth/reset/route.js.nft.json +1 -1
  112. package/.next/server/app/api/oauth/reset/route_client-reference-manifest.js +1 -1
  113. package/.next/server/app/api/planned-executions/[id]/route.js +2 -2
  114. package/.next/server/app/api/planned-executions/[id]/route.js.nft.json +1 -1
  115. package/.next/server/app/api/planned-executions/[id]/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/planned-executions/[id]/run/route.js +2 -2
  117. package/.next/server/app/api/planned-executions/[id]/run/route.js.nft.json +1 -1
  118. package/.next/server/app/api/planned-executions/[id]/run/route_client-reference-manifest.js +1 -1
  119. package/.next/server/app/api/planned-executions/[id]/runs/route.js +2 -2
  120. package/.next/server/app/api/planned-executions/[id]/runs/route.js.nft.json +1 -1
  121. package/.next/server/app/api/planned-executions/[id]/runs/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/planned-executions/preview-schedule/route_client-reference-manifest.js +1 -1
  123. package/.next/server/app/api/planned-executions/route.js +1 -1
  124. package/.next/server/app/api/planned-executions/route.js.nft.json +1 -1
  125. package/.next/server/app/api/planned-executions/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/restore/route.js +1 -1
  127. package/.next/server/app/api/restore/route.js.nft.json +1 -1
  128. package/.next/server/app/api/restore/route_client-reference-manifest.js +1 -1
  129. package/.next/server/app/api/storage/route_client-reference-manifest.js +1 -1
  130. package/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
  131. package/.next/server/app/api/webhooks/[id]/route.js +1 -1
  132. package/.next/server/app/api/webhooks/[id]/route.js.nft.json +1 -1
  133. package/.next/server/app/api/webhooks/[id]/route_client-reference-manifest.js +1 -1
  134. package/.next/server/app/chat/page.js +8 -7
  135. package/.next/server/app/chat/page.js.nft.json +1 -1
  136. package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
  137. package/.next/server/app/chat.html +1 -1
  138. package/.next/server/app/chat.rsc +3 -3
  139. package/.next/server/app/docs/page.js +37 -6
  140. package/.next/server/app/docs/page.js.nft.json +1 -1
  141. package/.next/server/app/docs/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/docs.html +1 -1
  143. package/.next/server/app/docs.rsc +3 -3
  144. package/.next/server/app/executions/page.js +3 -5
  145. package/.next/server/app/executions/page.js.nft.json +1 -1
  146. package/.next/server/app/executions/page_client-reference-manifest.js +1 -1
  147. package/.next/server/app/executions.html +1 -1
  148. package/.next/server/app/executions.rsc +3 -3
  149. package/.next/server/app/flows/page.js +3 -3
  150. package/.next/server/app/flows/page.js.nft.json +1 -1
  151. package/.next/server/app/flows/page_client-reference-manifest.js +1 -1
  152. package/.next/server/app/flows.html +1 -1
  153. package/.next/server/app/flows.rsc +3 -3
  154. package/.next/server/app/index.html +1 -1
  155. package/.next/server/app/index.rsc +3 -3
  156. package/.next/server/app/mcp/page.js +6 -6
  157. package/.next/server/app/mcp/page.js.nft.json +1 -1
  158. package/.next/server/app/mcp/page_client-reference-manifest.js +1 -1
  159. package/.next/server/app/mcp-flows/route.js +1 -5
  160. package/.next/server/app/mcp-flows/route.js.nft.json +1 -1
  161. package/.next/server/app/mcp-flows/route_client-reference-manifest.js +1 -1
  162. package/.next/server/app/mcp-proxy/[server]/route.js +1 -1
  163. package/.next/server/app/mcp-proxy/[server]/route.js.nft.json +1 -1
  164. package/.next/server/app/mcp-proxy/[server]/route_client-reference-manifest.js +1 -1
  165. package/.next/server/app/mcp.html +1 -1
  166. package/.next/server/app/mcp.rsc +3 -3
  167. package/.next/server/app/models/page.js +2 -3
  168. package/.next/server/app/models/page.js.nft.json +1 -1
  169. package/.next/server/app/models/page_client-reference-manifest.js +1 -1
  170. package/.next/server/app/page.js +3 -2
  171. package/.next/server/app/page.js.nft.json +1 -1
  172. package/.next/server/app/page_client-reference-manifest.js +1 -1
  173. package/.next/server/app/settings/page.js +4 -3
  174. package/.next/server/app/settings/page.js.nft.json +1 -1
  175. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  176. package/.next/server/app/settings.html +1 -1
  177. package/.next/server/app/settings.rsc +3 -3
  178. package/.next/server/app/v1/chat/completions/route.js +1 -1
  179. package/.next/server/app/v1/chat/completions/route.js.nft.json +1 -1
  180. package/.next/server/app/v1/chat/completions/route_client-reference-manifest.js +1 -1
  181. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js +2 -2
  182. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route.js.nft.json +1 -1
  183. package/.next/server/app/v1/chat/conversations/[conversationId]/breakpoints/route_client-reference-manifest.js +1 -1
  184. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js +2 -2
  185. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route.js.nft.json +1 -1
  186. package/.next/server/app/v1/chat/conversations/[conversationId]/cancel/route_client-reference-manifest.js +1 -1
  187. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js +1 -1
  188. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route.js.nft.json +1 -1
  189. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/continue/route_client-reference-manifest.js +1 -1
  190. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js +1 -1
  191. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route.js.nft.json +1 -1
  192. package/.next/server/app/v1/chat/conversations/[conversationId]/debug/step/route_client-reference-manifest.js +1 -1
  193. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js +2 -2
  194. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route.js.nft.json +1 -1
  195. package/.next/server/app/v1/chat/conversations/[conversationId]/edit-state/route_client-reference-manifest.js +1 -1
  196. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js +3 -3
  197. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route.js.nft.json +1 -1
  198. package/.next/server/app/v1/chat/conversations/[conversationId]/events/route_client-reference-manifest.js +1 -1
  199. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route.js +1 -0
  200. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route.js.nft.json +1 -0
  201. package/.next/server/app/v1/chat/conversations/[conversationId]/resources/route_client-reference-manifest.js +1 -0
  202. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js +1 -1
  203. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route.js.nft.json +1 -1
  204. package/.next/server/app/v1/chat/conversations/[conversationId]/respond/route_client-reference-manifest.js +1 -1
  205. package/.next/server/app/v1/chat/conversations/[conversationId]/route.js +2 -2
  206. package/.next/server/app/v1/chat/conversations/[conversationId]/route.js.nft.json +1 -1
  207. package/.next/server/app/v1/chat/conversations/[conversationId]/route_client-reference-manifest.js +1 -1
  208. package/.next/server/app/v1/chat/conversations/route.js +2 -2
  209. package/.next/server/app/v1/chat/conversations/route.js.nft.json +1 -1
  210. package/.next/server/app/v1/chat/conversations/route_client-reference-manifest.js +1 -1
  211. package/.next/server/app/v1/models/route.js +2 -2
  212. package/.next/server/app/v1/models/route.js.nft.json +1 -1
  213. package/.next/server/app/v1/models/route_client-reference-manifest.js +1 -1
  214. package/.next/server/app-paths-manifest.json +13 -11
  215. package/.next/server/chunks/{2776.js → 1083.js} +2 -3
  216. package/.next/server/chunks/1119.js +1 -0
  217. package/.next/server/chunks/{7731.js → 1152.js} +2 -2
  218. package/.next/server/chunks/1197.js +2 -0
  219. package/.next/server/chunks/1373.js +1 -1
  220. package/.next/server/chunks/1491.js +1 -0
  221. package/.next/server/chunks/{8460.js → 1991.js} +1 -1
  222. package/.next/server/chunks/2246.js +1 -0
  223. package/.next/server/chunks/2261.js +1 -0
  224. package/.next/server/chunks/227.js +5 -0
  225. package/.next/server/chunks/2350.js +1 -1
  226. package/.next/server/chunks/2430.js +1 -0
  227. package/.next/server/chunks/264.js +1 -1
  228. package/.next/server/chunks/2859.js +3 -7
  229. package/.next/server/chunks/289.js +1 -0
  230. package/.next/server/chunks/3511.js +1 -0
  231. package/.next/server/chunks/{6069.js → 3574.js} +2 -2
  232. package/.next/server/chunks/3778.js +42 -0
  233. package/.next/server/chunks/{8367.js → 38.js} +2 -2
  234. package/.next/server/chunks/3953.js +1 -0
  235. package/.next/server/chunks/3984.js +4 -4
  236. package/.next/server/chunks/4028.js +1 -0
  237. package/.next/server/chunks/4045.js +1 -0
  238. package/.next/server/chunks/4265.js +1 -0
  239. package/.next/server/chunks/4436.js +1 -0
  240. package/.next/server/chunks/{8227.js → 4456.js} +2 -2
  241. package/.next/server/chunks/4498.js +40 -0
  242. package/.next/server/chunks/4637.js +70 -0
  243. package/.next/server/chunks/4671.js +1 -0
  244. package/.next/server/chunks/{1912.js → 4690.js} +2 -2
  245. package/.next/server/chunks/4949.js +1 -0
  246. package/.next/server/chunks/5625.js +28 -0
  247. package/.next/server/chunks/{805.js → 5662.js} +2 -2
  248. package/.next/server/chunks/5708.js +64 -0
  249. package/.next/server/chunks/5734.js +4 -4
  250. package/.next/server/chunks/62.js +1 -0
  251. package/.next/server/chunks/6532.js +52 -0
  252. package/.next/server/chunks/{6760.js → 6772.js} +1 -1
  253. package/.next/server/chunks/{6201.js → 6901.js} +3 -2
  254. package/.next/server/chunks/{9314.js → 6908.js} +3 -3
  255. package/.next/server/chunks/6981.js +1 -0
  256. package/.next/server/chunks/6996.js +3 -3
  257. package/.next/server/chunks/701.js +1 -1
  258. package/.next/server/chunks/7101.js +64 -0
  259. package/.next/server/chunks/7214.js +3 -3
  260. package/.next/server/chunks/724.js +3 -3
  261. package/.next/server/chunks/7362.js +4 -4
  262. package/.next/server/chunks/7463.js +6 -0
  263. package/.next/server/chunks/7506.js +1 -1
  264. package/.next/server/chunks/7635.js +1 -1
  265. package/.next/server/chunks/7821.js +1 -1
  266. package/.next/server/chunks/8739.js +2 -2
  267. package/.next/server/chunks/9509.js +2 -2
  268. package/.next/server/chunks/9632.js +1 -0
  269. package/.next/server/chunks/9957.js +1 -1
  270. package/.next/server/functions-config-manifest.json +3 -3
  271. package/.next/server/instrumentation.js.nft.json +1 -1
  272. package/.next/server/middleware-build-manifest.js +1 -1
  273. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  274. package/.next/server/pages/404.html +1 -1
  275. package/.next/server/pages/500.html +1 -1
  276. package/.next/server/server-reference-manifest.js +1 -1
  277. package/.next/server/server-reference-manifest.json +1 -1
  278. package/.next/static/chunks/1161-970b105d0ab11425.js +1 -0
  279. package/.next/static/chunks/1620-0d8ecd877f123f7b.js +1 -0
  280. package/.next/static/chunks/1871-14c3e63ca865d85e.js +1 -0
  281. package/.next/static/chunks/{1892-359187893bbc7f3a.js → 1892-5c1e38d89e0a5a9c.js} +1 -1
  282. package/.next/static/chunks/3217.058098140ec3f563.js +1 -0
  283. package/.next/static/chunks/3381-5fd2417957ca0881.js +1 -0
  284. package/.next/static/chunks/{3545.d3a512315a9fce3e.js → 3545.353a62a68d3b7fd1.js} +1 -1
  285. package/.next/static/chunks/{2084-2463e1d781bad2a6.js → 3648-733cf7ca4a5d1f19.js} +1 -1
  286. package/.next/static/chunks/3736-5e2b3f6cda1bb923.js +1 -0
  287. package/.next/static/chunks/3930-cc8d73c953811b97.js +1 -0
  288. package/.next/static/chunks/422-268783d9ad5897e1.js +1 -0
  289. package/.next/static/chunks/4365-5d0e3d01c1bc0fdc.js +1 -0
  290. package/.next/static/chunks/5134-e21bd33daaf14ecf.js +1 -0
  291. package/.next/static/chunks/5501-c400aaeaf57e6297.js +1 -0
  292. package/.next/static/chunks/5619-82fc5c3133837739.js +1 -0
  293. package/.next/static/chunks/6013-cb423bc438256acb.js +1 -0
  294. package/.next/static/chunks/6920-a83ad5c0d5a54cf3.js +1 -0
  295. package/.next/static/chunks/7258-e27017c1b98f43f9.js +1 -0
  296. package/.next/static/chunks/{7583.b6c2f8874b6b89cd.js → 7583.26a8c1f6e6823daf.js} +1 -1
  297. package/.next/static/chunks/7687-7edf1a6e1f063b08.js +1 -0
  298. package/.next/static/chunks/8066-c202a83aef15143a.js +1 -0
  299. package/.next/static/chunks/{8187.15bf331f5318c00f.js → 8187.fd653767df53db87.js} +1 -1
  300. package/.next/static/chunks/8755-9f375ec8740fecac.js +1 -0
  301. package/.next/static/chunks/{9164-a56181e5e93cc47e.js → 9164-f54d3531ca1df5f7.js} +1 -1
  302. package/.next/static/chunks/{9747-ffb8be5e59700c27.js → 9587-706bfd1a692c4660.js} +3 -3
  303. package/.next/static/chunks/app/api/backup/route-b296683a5faf800a.js +1 -0
  304. package/.next/static/chunks/app/api/browse/route-b296683a5faf800a.js +1 -0
  305. package/.next/static/chunks/app/api/cwd/route-b296683a5faf800a.js +1 -0
  306. package/.next/static/chunks/app/api/encryption/secure/route-b296683a5faf800a.js +1 -0
  307. package/.next/static/chunks/app/api/env/route-b296683a5faf800a.js +1 -0
  308. package/.next/static/chunks/app/api/flow/[id]/route-b296683a5faf800a.js +1 -0
  309. package/.next/static/chunks/app/api/flow/compile/route-b296683a5faf800a.js +1 -0
  310. package/.next/static/chunks/app/api/flow/generate/route-b296683a5faf800a.js +1 -0
  311. package/.next/static/chunks/app/api/flow/improve/route-b296683a5faf800a.js +1 -0
  312. package/.next/static/chunks/app/api/flow/prompt-renderer/route-b296683a5faf800a.js +1 -0
  313. package/.next/static/chunks/app/api/flow/quick-chat/route-b296683a5faf800a.js +1 -0
  314. package/.next/static/chunks/app/api/flow/repair/route-b296683a5faf800a.js +1 -0
  315. package/.next/static/chunks/app/api/flow/route-b296683a5faf800a.js +1 -0
  316. package/.next/static/chunks/app/api/git/route-b296683a5faf800a.js +1 -0
  317. package/.next/static/chunks/app/api/init/route-b296683a5faf800a.js +1 -0
  318. package/.next/static/chunks/app/api/local-models/capability/route-b296683a5faf800a.js +1 -0
  319. package/.next/static/chunks/app/api/local-models/pull/route-b296683a5faf800a.js +1 -0
  320. package/.next/static/chunks/app/api/local-models/suggest/route-b296683a5faf800a.js +1 -0
  321. package/.next/static/chunks/app/api/mcp/cancel/route-b296683a5faf800a.js +1 -0
  322. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/get/route-b296683a5faf800a.js +1 -0
  323. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/route-b296683a5faf800a.js +1 -0
  324. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/read/route-b296683a5faf800a.js +1 -0
  325. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/route-b296683a5faf800a.js +1 -0
  326. package/.next/static/chunks/app/api/mcp/servers/[name]/route-b296683a5faf800a.js +1 -0
  327. package/.next/static/chunks/app/api/mcp/servers/[name]/status/route-b296683a5faf800a.js +1 -0
  328. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/[toolName]/route-b296683a5faf800a.js +1 -0
  329. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/route-b296683a5faf800a.js +1 -0
  330. package/.next/static/chunks/app/api/mcp/servers/route-b296683a5faf800a.js +1 -0
  331. package/.next/static/chunks/app/api/mcp/test-connection/route-b296683a5faf800a.js +1 -0
  332. package/.next/static/chunks/app/api/mcp/test-connection/stream/route-b296683a5faf800a.js +1 -0
  333. package/.next/static/chunks/app/api/mcp-registry/route-b296683a5faf800a.js +1 -0
  334. package/.next/static/chunks/app/api/mcp-registry/spotlight/route-b296683a5faf800a.js +1 -0
  335. package/.next/static/chunks/app/api/model/[id]/route-b296683a5faf800a.js +1 -0
  336. package/.next/static/chunks/app/api/model/provider/route-b296683a5faf800a.js +1 -0
  337. package/.next/static/chunks/app/api/model/route-b296683a5faf800a.js +1 -0
  338. package/.next/static/chunks/app/api/model/test/route-b296683a5faf800a.js +1 -0
  339. package/.next/static/chunks/app/api/oauth/callback/route-b296683a5faf800a.js +1 -0
  340. package/.next/static/chunks/app/api/oauth/initiate/route-b296683a5faf800a.js +1 -0
  341. package/.next/static/chunks/app/api/oauth/reset/route-b296683a5faf800a.js +1 -0
  342. package/.next/static/chunks/app/api/planned-executions/[id]/route-b296683a5faf800a.js +1 -0
  343. package/.next/static/chunks/app/api/planned-executions/[id]/run/route-b296683a5faf800a.js +1 -0
  344. package/.next/static/chunks/app/api/planned-executions/[id]/runs/route-b296683a5faf800a.js +1 -0
  345. package/.next/static/chunks/app/api/planned-executions/preview-schedule/route-b296683a5faf800a.js +1 -0
  346. package/.next/static/chunks/app/api/planned-executions/route-b296683a5faf800a.js +1 -0
  347. package/.next/static/chunks/app/api/restore/route-b296683a5faf800a.js +1 -0
  348. package/.next/static/chunks/app/api/storage/route-b296683a5faf800a.js +1 -0
  349. package/.next/static/chunks/app/api/update/route-b296683a5faf800a.js +1 -0
  350. package/.next/static/chunks/app/api/webhooks/[id]/route-b296683a5faf800a.js +1 -0
  351. package/.next/static/chunks/app/chat/page-a67ad3683443e7ad.js +1 -0
  352. package/.next/static/chunks/app/docs/page-097827ec4dae1d30.js +1 -0
  353. package/.next/static/chunks/app/executions/page-cb0dcc66d84c9bf8.js +1 -0
  354. package/.next/static/chunks/app/flows/page-abdd0642e378c5da.js +1 -0
  355. package/.next/static/chunks/app/{layout-2878f13d7e253503.js → layout-64fc0ae7efe81e3c.js} +1 -1
  356. package/.next/static/chunks/app/mcp/page-7d3a269dce68b529.js +1 -0
  357. package/.next/static/chunks/app/mcp-flows/route-b296683a5faf800a.js +1 -0
  358. package/.next/static/chunks/app/mcp-proxy/[server]/route-b296683a5faf800a.js +1 -0
  359. package/.next/static/chunks/app/models/{error-2b00c98abf1e02cf.js → error-5732fbb053e182c5.js} +1 -1
  360. package/.next/static/chunks/app/models/page-616950f93a1e0027.js +1 -0
  361. package/.next/static/chunks/app/{page-6e18a8cd78b2050e.js → page-77e1ba238b0ee1d0.js} +1 -1
  362. package/.next/static/chunks/app/settings/{page-9430dfdaff87d70c.js → page-199d0ffae9ec7263.js} +1 -1
  363. package/.next/static/chunks/app/v1/chat/completions/route-b296683a5faf800a.js +1 -0
  364. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/breakpoints/route-b296683a5faf800a.js +1 -0
  365. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/cancel/route-b296683a5faf800a.js +1 -0
  366. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/continue/route-b296683a5faf800a.js +1 -0
  367. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/step/route-b296683a5faf800a.js +1 -0
  368. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/edit-state/route-b296683a5faf800a.js +1 -0
  369. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/events/route-b296683a5faf800a.js +1 -0
  370. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/resources/route-b296683a5faf800a.js +1 -0
  371. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/respond/route-b296683a5faf800a.js +1 -0
  372. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/route-b296683a5faf800a.js +1 -0
  373. package/.next/static/chunks/app/v1/chat/conversations/route-b296683a5faf800a.js +1 -0
  374. package/.next/static/chunks/app/v1/models/route-b296683a5faf800a.js +1 -0
  375. package/.next/static/chunks/webpack-ef5b2cef70829f42.js +1 -0
  376. package/.next/static/dvSaKx6-EfRNi7Xj-cSv_/_buildManifest.js +1 -0
  377. package/.next/trace +9 -7
  378. package/.next/types/app/api/flow/repair/route.ts +347 -0
  379. package/.next/types/app/v1/chat/conversations/[conversationId]/resources/route.ts +347 -0
  380. package/.next/types/routes.d.ts +3 -1
  381. package/.next/types/validator.ts +18 -0
  382. package/README.md +1 -1
  383. package/package.json +1 -1
  384. package/.next/server/chunks/1050.js +0 -1
  385. package/.next/server/chunks/1403.js +0 -8
  386. package/.next/server/chunks/2439.js +0 -52
  387. package/.next/server/chunks/2666.js +0 -1
  388. package/.next/server/chunks/3310.js +0 -35
  389. package/.next/server/chunks/453.js +0 -1
  390. package/.next/server/chunks/4681.js +0 -1
  391. package/.next/server/chunks/5311.js +0 -1
  392. package/.next/server/chunks/6037.js +0 -41
  393. package/.next/server/chunks/6390.js +0 -28
  394. package/.next/server/chunks/6936.js +0 -37
  395. package/.next/server/chunks/7186.js +0 -2
  396. package/.next/server/chunks/7982.js +0 -1
  397. package/.next/server/chunks/8342.js +0 -1
  398. package/.next/server/chunks/906.js +0 -35
  399. package/.next/server/chunks/9687.js +0 -1
  400. package/.next/server/chunks/9880.js +0 -1
  401. package/.next/server/chunks/9938.js +0 -1
  402. package/.next/static/Fdh7zqKv38txmpLAxepeR/_buildManifest.js +0 -1
  403. package/.next/static/chunks/1374-e084b3c40554288a.js +0 -1
  404. package/.next/static/chunks/2380-5696e0dc0469f6a5.js +0 -1
  405. package/.next/static/chunks/2709-29f91a54eef90221.js +0 -1
  406. package/.next/static/chunks/3217.1a7e24fd70294370.js +0 -1
  407. package/.next/static/chunks/4105-8fddb00196bf3c6d.js +0 -1
  408. package/.next/static/chunks/4244-6f399c7ff9980207.js +0 -1
  409. package/.next/static/chunks/4809-423a2a4a90d02f2c.js +0 -1
  410. package/.next/static/chunks/6084-68908a197e957e5f.js +0 -1
  411. package/.next/static/chunks/6509-3380826fd7c82b4e.js +0 -1
  412. package/.next/static/chunks/6582-6735fdd6b42b5c35.js +0 -1
  413. package/.next/static/chunks/690-391bc0f482a9f67c.js +0 -1
  414. package/.next/static/chunks/7290-fd5bb2c94fd7f605.js +0 -1
  415. package/.next/static/chunks/8098-297bf477152a565b.js +0 -1
  416. package/.next/static/chunks/924-64f908860caf1a35.js +0 -1
  417. package/.next/static/chunks/9286-6ea909e5bf70a97e.js +0 -1
  418. package/.next/static/chunks/9562-93cc45aef3630781.js +0 -1
  419. package/.next/static/chunks/9984-1ed094ea9f5b1f17.js +0 -1
  420. package/.next/static/chunks/app/api/backup/route-1691635994fcddb5.js +0 -1
  421. package/.next/static/chunks/app/api/browse/route-1691635994fcddb5.js +0 -1
  422. package/.next/static/chunks/app/api/cwd/route-1691635994fcddb5.js +0 -1
  423. package/.next/static/chunks/app/api/encryption/secure/route-1691635994fcddb5.js +0 -1
  424. package/.next/static/chunks/app/api/env/route-1691635994fcddb5.js +0 -1
  425. package/.next/static/chunks/app/api/flow/[id]/route-1691635994fcddb5.js +0 -1
  426. package/.next/static/chunks/app/api/flow/compile/route-1691635994fcddb5.js +0 -1
  427. package/.next/static/chunks/app/api/flow/generate/route-1691635994fcddb5.js +0 -1
  428. package/.next/static/chunks/app/api/flow/improve/route-1691635994fcddb5.js +0 -1
  429. package/.next/static/chunks/app/api/flow/prompt-renderer/route-1691635994fcddb5.js +0 -1
  430. package/.next/static/chunks/app/api/flow/quick-chat/route-1691635994fcddb5.js +0 -1
  431. package/.next/static/chunks/app/api/flow/route-1691635994fcddb5.js +0 -1
  432. package/.next/static/chunks/app/api/git/route-1691635994fcddb5.js +0 -1
  433. package/.next/static/chunks/app/api/init/route-1691635994fcddb5.js +0 -1
  434. package/.next/static/chunks/app/api/local-models/capability/route-1691635994fcddb5.js +0 -1
  435. package/.next/static/chunks/app/api/local-models/pull/route-1691635994fcddb5.js +0 -1
  436. package/.next/static/chunks/app/api/local-models/suggest/route-1691635994fcddb5.js +0 -1
  437. package/.next/static/chunks/app/api/mcp/cancel/route-1691635994fcddb5.js +0 -1
  438. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/get/route-1691635994fcddb5.js +0 -1
  439. package/.next/static/chunks/app/api/mcp/servers/[name]/prompts/route-1691635994fcddb5.js +0 -1
  440. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/read/route-1691635994fcddb5.js +0 -1
  441. package/.next/static/chunks/app/api/mcp/servers/[name]/resources/route-1691635994fcddb5.js +0 -1
  442. package/.next/static/chunks/app/api/mcp/servers/[name]/route-1691635994fcddb5.js +0 -1
  443. package/.next/static/chunks/app/api/mcp/servers/[name]/status/route-1691635994fcddb5.js +0 -1
  444. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/[toolName]/route-1691635994fcddb5.js +0 -1
  445. package/.next/static/chunks/app/api/mcp/servers/[name]/tools/route-1691635994fcddb5.js +0 -1
  446. package/.next/static/chunks/app/api/mcp/servers/route-1691635994fcddb5.js +0 -1
  447. package/.next/static/chunks/app/api/mcp/test-connection/route-1691635994fcddb5.js +0 -1
  448. package/.next/static/chunks/app/api/mcp/test-connection/stream/route-1691635994fcddb5.js +0 -1
  449. package/.next/static/chunks/app/api/mcp-registry/route-1691635994fcddb5.js +0 -1
  450. package/.next/static/chunks/app/api/mcp-registry/spotlight/route-1691635994fcddb5.js +0 -1
  451. package/.next/static/chunks/app/api/model/[id]/route-1691635994fcddb5.js +0 -1
  452. package/.next/static/chunks/app/api/model/provider/route-1691635994fcddb5.js +0 -1
  453. package/.next/static/chunks/app/api/model/route-1691635994fcddb5.js +0 -1
  454. package/.next/static/chunks/app/api/model/test/route-1691635994fcddb5.js +0 -1
  455. package/.next/static/chunks/app/api/oauth/callback/route-1691635994fcddb5.js +0 -1
  456. package/.next/static/chunks/app/api/oauth/initiate/route-1691635994fcddb5.js +0 -1
  457. package/.next/static/chunks/app/api/oauth/reset/route-1691635994fcddb5.js +0 -1
  458. package/.next/static/chunks/app/api/planned-executions/[id]/route-1691635994fcddb5.js +0 -1
  459. package/.next/static/chunks/app/api/planned-executions/[id]/run/route-1691635994fcddb5.js +0 -1
  460. package/.next/static/chunks/app/api/planned-executions/[id]/runs/route-1691635994fcddb5.js +0 -1
  461. package/.next/static/chunks/app/api/planned-executions/preview-schedule/route-1691635994fcddb5.js +0 -1
  462. package/.next/static/chunks/app/api/planned-executions/route-1691635994fcddb5.js +0 -1
  463. package/.next/static/chunks/app/api/restore/route-1691635994fcddb5.js +0 -1
  464. package/.next/static/chunks/app/api/storage/route-1691635994fcddb5.js +0 -1
  465. package/.next/static/chunks/app/api/update/route-1691635994fcddb5.js +0 -1
  466. package/.next/static/chunks/app/api/webhooks/[id]/route-1691635994fcddb5.js +0 -1
  467. package/.next/static/chunks/app/chat/page-6486974f4a6c7b57.js +0 -1
  468. package/.next/static/chunks/app/docs/page-5da72cc6db51f238.js +0 -1
  469. package/.next/static/chunks/app/executions/page-fe19f6a1bd3fe05c.js +0 -1
  470. package/.next/static/chunks/app/flows/page-3b84093cdf2aee84.js +0 -1
  471. package/.next/static/chunks/app/mcp/page-355386ec2a542e42.js +0 -1
  472. package/.next/static/chunks/app/mcp-flows/route-1691635994fcddb5.js +0 -1
  473. package/.next/static/chunks/app/mcp-proxy/[server]/route-1691635994fcddb5.js +0 -1
  474. package/.next/static/chunks/app/models/page-20c80d398bf83fc5.js +0 -1
  475. package/.next/static/chunks/app/v1/chat/completions/route-1691635994fcddb5.js +0 -1
  476. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/breakpoints/route-1691635994fcddb5.js +0 -1
  477. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/cancel/route-1691635994fcddb5.js +0 -1
  478. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/continue/route-1691635994fcddb5.js +0 -1
  479. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/debug/step/route-1691635994fcddb5.js +0 -1
  480. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/edit-state/route-1691635994fcddb5.js +0 -1
  481. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/events/route-1691635994fcddb5.js +0 -1
  482. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/respond/route-1691635994fcddb5.js +0 -1
  483. package/.next/static/chunks/app/v1/chat/conversations/[conversationId]/route-1691635994fcddb5.js +0 -1
  484. package/.next/static/chunks/app/v1/chat/conversations/route-1691635994fcddb5.js +0 -1
  485. package/.next/static/chunks/app/v1/models/route-1691635994fcddb5.js +0 -1
  486. package/.next/static/chunks/webpack-4880945dd240d429.js +0 -1
  487. /package/.next/static/{Fdh7zqKv38txmpLAxepeR → dvSaKx6-EfRNi7Xj-cSv_}/_ssgManifest.js +0 -0
@@ -0,0 +1,70 @@
1
+ "use strict";exports.id=4637,exports.ids=[4637],exports.modules={74637:(a,b,c)=>{let d;c.d(b,{internalCallTool:()=>a9,internalToolDefinitions:()=>aQ});var e=c(33873),f=c.n(e),g=c(29021),h=c(79646),i=c(18230);let j=(0,i.h)("utils/process/killProcessTree");var k=c(11659),l=c(12763),m=c(71188),n=c(67463),o=c(89850),p=c(8336),q=c(78606);function r(a,b,c,d){return"number"!=typeof a||Number.isNaN(a)?d:Math.max(b,Math.min(c,Math.floor(a)))}let s={type:"arrowclosed",width:20,height:20,color:"#1976d2"},t={stroke:"#1976d2",strokeWidth:2},u={type:"arrowclosed",width:20,height:20,color:"#009688"},v={stroke:"#009688",strokeWidth:2},w=new Set(["full-history","latest-message","isolated"]),x=new Set(["steps","final-only"]),y=new Set(["full-conversation","latest-message"]);function z(a){let b=(0,p.A$)(a);if(0===b.length)return{text:a,stripped:!1};let c="",d=0;for(let e of b)c+=a.slice(d,e.index)+e.name,d=e.index+e.fullMatch.length;return{text:c+=a.slice(d),stripped:!0}}function A(a,b){if(b.some(b=>b.id===a))return a;let c=a.toLowerCase(),d=b.find(a=>a.name.toLowerCase()===c);return d?d.id:null}var B=c(54898),C=c(99924);let D=(0,i.h)("backend/services/flow/generationContext");function E(a,b){let c=String(a).replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,b).trimEnd()}…`}async function F(){let a=await l.modelService.loadModels(),b=a.map(a=>({id:a.id,name:a.name,...a.displayName?{displayName:a.displayName}:{},...a.description?{description:E(a.description,100)}:{}})),c=[],d={};try{let a=await C.mcpService.loadServerConfigs();if(Array.isArray(a))for(let b of a){if(b.disabled)continue;let a=!1;try{let c=await C.mcpService.getServerStatus(b.name);a=c?.status==="connected"}catch(a){D.debug(`getServerStatus failed for ${b.name}; listing name only`,a)}if(!a){c.push({name:b.name,connected:!1});continue}let{tools:e}=await C.mcpService.listServerTools(b.name),f=(e??[]).filter(a=>a.name).map(a=>({name:a.name,...a.description?{description:E(a.description,100)}:{}}));d[b.name]=f.map(a=>a.name),c.push({name:b.name,connected:!0,tools:f})}}catch(a){D.warn("Could not load MCP servers for the authoring context",a)}let e=[];try{e=await k.flowService.loadFlows()}catch(a){D.warn("Could not load flows for the authoring context",a)}let f={models:b,servers:c,flows:e.map(a=>({id:a.id,name:a.name,...a.description?{description:E(a.description,300)}:{},nodeCount:a.nodes?.length??0}))};return{blocks:f,compile:{models:a.map(a=>({id:a.id,name:a.name,displayName:a.displayName})),servers:c.map(a=>({name:a.name})),serverTools:d,flows:e.map(a=>({id:a.id,name:a.name}))},catalog:function(a){let b=[];for(let c of(b.push("AVAILABLE MODELS (reference by id or name):"),0===a.models.length&&b.push(" (none configured)"),a.models)){let a=c.displayName&&c.displayName!==c.name?`"${c.displayName}" (${c.name})`:c.name,d=c.description?` — ${c.description}`:"";b.push(` - id: ${c.id} — ${a}${d}`)}for(let c of(b.push("",'AVAILABLE MCP SERVERS (attach to process nodes via "servers"):'),0===a.servers.length&&b.push(" (none configured)"),a.servers)){if(!c.connected){b.push(` - ${c.name} (offline — tools unknown; may still be used)`);continue}b.push(` - ${c.name}:`);let a=(c.tools??[]).slice(0,20);for(let c of a){let a=c.description?` — ${c.description}`:"";b.push(` - ${c.name}${a}`)}let d=(c.tools?.length??0)-a.length;d>0&&b.push(` - …and ${d} more`)}for(let c of(b.push("",'EXISTING FLOWS (usable as subflow targets via "flow"):'),0===a.flows.length&&b.push(" (none)"),a.flows.slice(0,15))){let a=c.description?` — ${c.description}`:` — ${c.nodeCount} nodes`;b.push(` - "${c.name}"${a}`)}return a.flows.length>15&&b.push(` - …and ${a.flows.length-15} more`),b.join("\n")}(f),validatorServers:c.map(a=>({name:a.name,status:a.connected?"connected":"disconnected"}))}}let G=(0,i.h)("backend/services/flow/compileFlow");async function H(a,b={}){if(!a||"object"!=typeof a||Array.isArray(a))return{success:!1,error:"The spec must be a JSON object (a FlowSpec)",statusCode:400};let c=await F(),d=c.compile;if(b.updateFlowId){let a=d.flows??[];if(!a.some(a=>a.id===b.updateFlowId))return{success:!1,error:`No flow with id "${b.updateFlowId}" to update`,statusCode:404};d={...d,flows:a.filter(a=>a.id!==b.updateFlowId)}}let e=function(a,b={},c={}){let d=[],e=(a,b,c)=>d.push({severity:"error",code:a,message:b,nodeKey:c}),f=(a,b,c)=>d.push({severity:"warning",code:a,message:b,nodeKey:c}),g=b.models??[],h=new Set((b.servers??[]).map(a=>a.name)),i=b.serverTools??{},j=r(c.maxDepth,0,3,3),k=r(c.maxFlows,1,8,8),l=[],m=[...(b.flows??[]).map(a=>a.name)],n=[],p=0;var B=function a(d,B,C){let D=Array.isArray(d?.nodes)?d.nodes:[],E=Array.isArray(d?.edges)?d.edges:[],G=function(a,b){let c=(a??"").trim().replace(/[^\w-]+/g,"_").replace(/^_+|_+$/g,"");c||(c="generated_flow");let d=new Set(b.map(a=>a.toLowerCase()));if(!d.has(c.toLowerCase()))return c;for(let a=2;;a++){let b=`${c}_${a}`;if(!d.has(b.toLowerCase()))return b}}(d?.name,m);m.push(G),p++;let H=(0,o.A)(),I=[...C,G],J=new Map,K=[],L=[];for(let c of D){let d=c?.key;if(!d||"string"!=typeof d){e("node-missing-key",'A node is missing its "key" — every node needs a unique key.');continue}if(J.has(d)){e("node-duplicate-key",`Duplicate node key "${d}" — keys must be unique; the later node was dropped.`,d);continue}let l=c.type;if("mcp"===l){e("mcp-node-not-allowed",`Node "${d}": do not emit "mcp" nodes — attach servers to a process node via its "servers" list instead.`,d);continue}if("start"!==l&&"process"!==l&&"finish"!==l&&"subflow"!==l&&"resource"!==l){e("unknown-node-type",`Node "${d}" has unknown type "${String(l)}".`,d);continue}let m={},q="string"==typeof c.prompt?c.prompt:void 0;if("start"===l){let{text:a,stripped:b}=z(q??"");b&&f("pill-stripped",`Node "${d}": binding pills are not supported in generated prompts and were replaced with plain names.`,d),m.promptTemplate=a}else if("process"===l){let{text:a,stripped:b}=z(q??"");if(b&&f("pill-stripped",`Node "${d}": binding pills are not supported in generated prompts and were replaced with plain names.`,d),m.promptTemplate=a,c.model){let a=function(a,b){if(b.some(b=>b.id===a))return a;let c=a.toLowerCase(),d=b.find(a=>a.displayName?.toLowerCase()===c);if(d)return d.id;let e=b.find(a=>a.name?.toLowerCase()===c);return e?e.id:null}(c.model,g);a?m.boundModel=a:(m.boundModel=c.model,f("model-unresolved",`Node "${d}": model "${c.model}" does not match any configured model (by id, display name, or name).`,d))}void 0!==c.inputMode&&(w.has(c.inputMode)?(m.inputMode=c.inputMode,"isolated"===c.inputMode&&"string"==typeof c.isolatedPrompt&&(m.isolatedPrompt=c.isolatedPrompt)):f("invalid-input-mode",`Node "${d}": inputMode "${String(c.inputMode)}" is not valid (full-history | latest-message | isolated); omitted.`,d)),void 0!==c.outputMode&&(y.has(c.outputMode)?m.outputMode=c.outputMode:f("invalid-output-mode",`Node "${d}": outputMode "${String(c.outputMode)}" is not valid on a process node (full-conversation | latest-message); omitted.`,d)),void 0!==c.maxTurns&&("number"!=typeof c.maxTurns||Number.isNaN(c.maxTurns)?f("invalid-max-turns",`Node "${d}": maxTurns "${String(c.maxTurns)}" is not a number; omitted.`,d):m.maxTurns=r(c.maxTurns,1,1e3,1)),"boolean"==typeof c.excludeModelPrompt&&(m.excludeModelPrompt=c.excludeModelPrompt),"boolean"==typeof c.excludeStartNodePrompt&&(m.excludeStartNodePrompt=c.excludeStartNodePrompt),"boolean"==typeof c.excludeSystemPrompt&&(m.excludeSystemPrompt=c.excludeSystemPrompt),Array.isArray(c.allowedTools)&&(m.allowedTools=c.allowedTools.filter(a=>"string"==typeof a&&a)),"string"==typeof c.captureVariable&&c.captureVariable.trim()&&(m.captureVariable=c.captureVariable.trim()),"string"==typeof c.captureResource&&c.captureResource.trim()&&(m.captureResource=c.captureResource.trim())}else if("subflow"===l){if(function(c,d,g,h,i){let l=Array.isArray(c.parallelFlows)&&c.parallelFlows.length>0,m=Array.isArray(c.parallelSubflowSpecs)&&c.parallelSubflowSpecs.length>0;if([void 0!==c.flow&&null!==c.flow?"flow":null,void 0!==c.subflowSpec&&null!==c.subflowSpec?"subflowSpec":null,l?"parallelFlows":null,m?"parallelSubflowSpecs":null,void 0!==c.generateSubflow&&null!==c.generateSubflow?"generateSubflow":null].filter(Boolean).length>1&&f("subflow-multiple-sources",`Node "${d}": a subflow node should have only one target source ("flow", "subflowSpec", "parallelFlows", "parallelSubflowSpecs", or "generateSubflow"); applying precedence flow > subflowSpec > parallelFlows > parallelSubflowSpecs > generateSubflow.`,d),!0===c.mapOverList){let a=void 0!==c.flow&&null!==c.flow||void 0!==c.subflowSpec&&null!==c.subflowSpec;(l||m)&&e("subflow-map-and-parallel",`Node "${d}": "mapOverList" runs a SINGLE child once per item and cannot be combined with "parallelFlows"/"parallelSubflowSpecs".`,d),a?(i.mapOverList=!0,void 0!==c.itemSplit&&("json-array"===c.itemSplit||"lines"===c.itemSplit?i.itemSplit=c.itemSplit:f("invalid-item-split",`Node "${d}": itemSplit "${String(c.itemSplit)}" is not valid (json-array | lines); using json-array.`,d)),!0===c.sequential&&(i.sequential=!0),F(c,i)):e("subflow-map-no-child",`Node "${d}": "mapOverList" needs a single child ("flow" or "subflowSpec") to run once per item.`,d)}if(c.flow){if(h.some(a=>a.toLowerCase()===c.flow.toLowerCase()))return e("subflow-cycle",`Node "${d}": flow "${c.flow}" refers to an ancestor flow, which would create a cycle.`,d);let a=A(c.flow,[...b.flows??[],...n]);return a?i.subflowId=a:e("subflow-unresolved",`Node "${d}": flow "${c.flow}" does not match any existing flow (by id or name).`,d)}if(c.subflowSpec){if(g+1>j)return e("subflow-too-deep",`Node "${d}": nested subflows may not go deeper than ${j} level(s); this inline subflow was not compiled.`,d);if(p>=k)return e("subflow-too-many",`Node "${d}": compiling this inline subflow would exceed the maximum of ${k} flows in one bundle; it was not compiled.`,d);let b=a(c.subflowSpec,g+1,h);return b?i.subflowId=b.id:e("subflow-child-empty",`Node "${d}": the inline "subflowSpec" produced no usable flow.`,d)}if(l){let a=[];for(let f of c.parallelFlows){if("string"!=typeof f||!f){e("parallel-flow-invalid",`Node "${d}": a "parallelFlows" entry is missing or not a string.`,d);continue}if(h.some(a=>a.toLowerCase()===f.toLowerCase())){e("subflow-cycle",`Node "${d}": parallel flow "${f}" refers to an ancestor flow, which would create a cycle.`,d);continue}let c=A(f,[...b.flows??[],...n]);c?a.includes(c)||a.push(c):e("parallel-flow-unresolved",`Node "${d}": parallel flow "${f}" does not match any existing flow (by id or name).`,d)}a.length>0?(i.parallelSubflowIds=a,F(c,i)):e("parallel-empty",`Node "${d}": "parallelFlows" resolved to no runnable lanes.`,d);return}if(m){let b=[];for(let f of c.parallelSubflowSpecs){if(!f||"object"!=typeof f){e("parallel-spec-invalid",`Node "${d}": a "parallelSubflowSpecs" entry is not a FlowSpec object.`,d);continue}if(g+1>j){e("subflow-too-deep",`Node "${d}": nested subflows may not go deeper than ${j} level(s); a parallel inline subflow was not compiled.`,d);continue}if(p>=k){e("subflow-too-many",`Node "${d}": compiling a parallel inline subflow would exceed the maximum of ${k} flows in one bundle; it was not compiled.`,d);continue}let c=a(f,g+1,h);c?b.push(c.id):e("subflow-child-empty",`Node "${d}": a "parallelSubflowSpecs" entry produced no usable flow.`,d)}b.length>0?(i.parallelSubflowIds=b,F(c,i)):e("parallel-empty",`Node "${d}": "parallelSubflowSpecs" produced no runnable lanes.`,d);return}if(void 0!==c.generateSubflow&&null!==c.generateSubflow)return e("subflow-generate-unsupported",`Node "${d}": "generateSubflow" is only available through the AI flow generator. Use "subflowSpec" for deterministic nested authoring, or "flow" to reference an existing flow.`,d);e("subflow-missing-flow",`Node "${d}": subflow nodes need a "flow" (existing flow), a "subflowSpec" (inline child), "parallelFlows"/"parallelSubflowSpecs" (concurrent children), or "generateSubflow".`,d)}(c,d,B,I,m),void 0!==c.inputMode&&(w.has(c.inputMode)?m.inputMode=c.inputMode:f("invalid-input-mode",`Node "${d}": inputMode "${String(c.inputMode)}" is not valid (full-history | latest-message | isolated); omitted.`,d)),void 0!==c.outputMode&&(x.has(c.outputMode)?m.outputMode=c.outputMode:f("invalid-output-mode",`Node "${d}": outputMode "${String(c.outputMode)}" is not valid (steps | final-only); omitted.`,d)),void 0!==q){let{text:a,stripped:b}=z(q);b&&f("pill-stripped",`Node "${d}": binding pills are not supported in generated prompts and were replaced with plain names.`,d),m.promptTemplate=a}"boolean"==typeof c.allowCallerPrompt&&(m.allowCallerPrompt=c.allowCallerPrompt),"string"==typeof c.captureVariable&&c.captureVariable.trim()&&(m.captureVariable=c.captureVariable.trim()),"string"==typeof c.captureResource&&c.captureResource.trim()&&(m.captureResource=c.captureResource.trim())}else if("resource"===l){let a="string"==typeof c.runName?c.runName.trim():"",b="string"==typeof c.server?c.server.trim():"",e="string"==typeof c.uri?c.uri.trim():"";a?(m.scope="run",m.runName=a,(b||e)&&f("resource-both-bindings",`Node "${d}": a resource node is EITHER a run artifact ("runName") or a static MCP resource ("server"+"uri"); kept the run artifact.`,d)):(m.scope="mcp",b&&(m.boundServer=b),e&&(m.uri=e),b&&e?h.has(b)||f("server-unknown",`Node "${d}": MCP server "${b}" is not configured in FLUJO.`,d):f("resource-missing-binding",`Node "${d}": a static resource node needs both "server" and "uri" (or a "runName" for a run artifact).`,d))}let s={id:(0,o.A)(),type:l,position:{x:0,y:0},data:{label:c.label||`${l.charAt(0).toUpperCase()}${l.slice(1)} Node`,type:l,...c.description?{description:c.description}:{},properties:m}};if(J.set(d,s),K.push(s),"process"===l&&Array.isArray(c.servers)){let a=new Set;for(let b of c.servers){let c,e=b?.name;if(!e||"string"!=typeof e){f("server-missing-name",`Node "${d}": a server reference is missing its "name"; skipped.`,d);continue}if(a.has(e))continue;a.add(e),h.has(e)||f("server-unknown",`Node "${d}": MCP server "${e}" is not configured in FLUJO.`,d);let g=i[e];if(Array.isArray(b.tools)){if(c=b.tools.filter(a=>"string"==typeof a&&a),g){let a=c.filter(a=>!g.includes(a));a.length>0&&f("tool-unknown",`Node "${d}": server "${e}" does not report tool(s): ${a.join(", ")}.`,d)}}else c=g?[...g]:[];let j={id:(0,o.A)(),type:"mcp",position:{x:0,y:0},data:{label:e,type:"mcp",properties:{boundServer:e,enabledTools:c}}};K.push(j),L.push({processKey:d,mcpNode:j})}}else"process"!==l&&Array.isArray(c.servers)&&c.servers.length>0&&f("servers-on-non-process",`Node "${d}": only process nodes can have "servers"; ignored.`,d)}if(0===J.size)return e("no-usable-nodes","No usable nodes — the spec must contain at least a start node and one step."),null;let M=[],N=new Set;for(let a of E){let b,c=a?.from,d=a?.to,g=c?J.get(c):void 0,h=d?J.get(d):void 0;if(!g||!h){e("edge-unknown-node",`Edge "${String(c)}" -> "${String(d)}" references a node key that does not exist (or was dropped).`);continue}if(g===h){e("edge-self-loop",`Edge "${c}" -> "${d}": a node cannot connect to itself.`);continue}if("resource"===g.type||"resource"===h.type){if(("resource"!==g.type||"process"!==h.type)&&("process"!==g.type||"resource"!==h.type)){e("resource-edge-invalid",`Edge "${c}" -> "${d}": resource nodes connect only to process nodes.`);continue}a.condition&&f("resource-edge-condition",`Edge "${c}" -> "${d}": conditions do not apply to resource wiring; dropped.`),!0===a.bidirectional&&f("resource-edge-bidirectional",`Edge "${c}" -> "${d}": resource wiring is directional (read vs write); "bidirectional" was ignored — add the opposite edge explicitly if the step both reads and writes.`);let b=`${c}->${d}`;if(N.has(b)){f("edge-duplicate",`Edge "${c}" -> "${d}" appears more than once; kept the first.`);continue}N.add(b),M.push(function(a,b){let c="resource"===a.type?"resource-out":"process-right-resource",d="resource"===b.type?"resource-in":"process-left-resource";return{id:`${a.id}:${c}->${b.id}:${d}`,source:a.id,sourceHandle:c,target:b.id,targetHandle:d,type:"resourceEdge",data:{edgeType:"resource"},animated:!1,markerEnd:{...u},style:{...v}}}(g,h));continue}if("start"===h.type){e("edge-into-start",`Edge "${c}" -> "${d}": nothing may connect INTO a start node.`);continue}if("finish"===g.type){e("edge-out-of-finish",`Edge "${c}" -> "${d}": nothing may connect OUT OF a finish node.`);continue}let i=`${c}->${d}`;if(N.has(i)){f("edge-duplicate",`Edge "${c}" -> "${d}" appears more than once; kept the first.`);continue}N.add(i);let j=!0===a.bidirectional;j&&("start"===g.type||"finish"===h.type)&&(f("bidirectional-illegal",`Edge "${c}" -> "${d}" cannot be bidirectional; downgraded to one-way.`),j=!1);let k=a.condition;k&&"object"==typeof k&&("process"!==g.type?f("edge-condition-non-process",`Edge "${c}" -> "${d}" has a condition but leaves a ${g.type} node; conditions only route from process nodes and were dropped.`):(0,q.C)(k.kind)?"string"!=typeof k.value||0===k.value.length?f("edge-condition-value",`Edge "${c}" -> "${d}" has a condition with no "value"; the condition was dropped.`):("regex"!==k.kind||(0,q.wM)(k.value)||f("edge-condition-regex",`Edge "${c}" -> "${d}" has a regex condition that does not compile; it is kept but will never match at runtime.`),b={kind:k.kind,value:k.value,..."last-message"===k.target?{target:"last-message"}:{},...!0===k.ignoreCase?{ignoreCase:!0}:{},...!0===k.negate?{negate:!0}:{}}):f("edge-condition-kind",`Edge "${c}" -> "${d}" has an unknown condition kind "${String(k.kind)}"; the condition was dropped.`)),M.push(function(a,b,c,d){let e=`${a.type}-bottom`,f=`${b.type}-top`;return{id:`${a.id}:${e}->${b.id}:${f}`,source:a.id,sourceHandle:e,target:b.id,targetHandle:f,type:"custom",data:{edgeType:"standard",...c?{bidirectional:!0}:{},...d?{condition:d}:{}},animated:!0}}(g,h,j,b))}for(let{processKey:a,mcpNode:b}of L){let c=J.get(a);M.push(function(a,b){let c="process-right-mcp",d="mcp-left";return{id:`${a.id}:${c}->${b.id}:${d}`,source:a.id,sourceHandle:c,target:b.id,targetHandle:d,type:"mcpEdge",data:{edgeType:"mcp"},animated:!1,markerEnd:{...s},markerStart:{...s},style:{...t}}}(c,b))}!function(a,b,c,d,e){let f=new Map;for(let a of c){let b=a.data?.edgeType;"mcp"!==b&&"resource"!==b&&(f.has(a.source)||f.set(a.source,[]),f.get(a.source).push(a.target))}let g=[...b.values()],h=g.filter(a=>"resource"===a.type),i=g.filter(a=>"resource"!==a.type),j=i.filter(a=>"start"===a.type),k=j.length>0?j:i.slice(0,1),l=new Map,m=k.map(a=>({id:a.id,depth:0}));for(let a of m)l.set(a.id,0);for(;m.length;){let{id:a,depth:b}=m.shift();for(let c of f.get(a)??[])l.has(c)||(l.set(c,b+1),m.push({id:c,depth:b+1}))}let n=0;for(let a of l.values())n=Math.max(n,a);for(let a of i)l.has(a.id)||l.set(a.id,n+1);let o=new Map;for(let[a,c]of b)o.set(c.id,a);let p=new Map;for(let a of i){let b=o.get(a.id),c=e&&b?e[b]:void 0;if(c&&"number"==typeof c.x&&"number"==typeof c.y){a.position={x:c.x,y:c.y};continue}let d=l.get(a.id),f=p.get(d)??0;p.set(d,f+1),a.position={x:250+280*f,y:150+170*d}}let q=new Map;for(let{processKey:a,mcpNode:c}of d){let d=b.get(a),e=q.get(a)??0;q.set(a,e+1),c.position={x:d.position.x+320,y:d.position.y+150*e}}let r=new Map(g.map(a=>[a.id,a])),s=new Map,t=0;for(let a of h){let b=o.get(a.id),d=e&&b?e[b]:void 0;if(d&&"number"==typeof d.x&&"number"==typeof d.y){a.position={x:d.x,y:d.y};continue}let f=c.find(b=>b.data?.edgeType==="resource"&&(b.source===a.id||b.target===a.id)),g=f?f.source===a.id?f.target:f.source:void 0,h=g?r.get(g):void 0;if(h){let b=s.get(h.id)??0;s.set(h.id,b+1),a.position={x:h.position.x-320,y:h.position.y+150*b}}else{let b=0;for(let a of i)b=Math.max(b,a.position.y);a.position={x:250+280*t,y:b+170},t++}}}(0,J,M,L,0===B?c.positions:void 0);let O={id:H,name:G,...d?.description?{description:d.description}:{},nodes:K,edges:M};return l.push(O),n.push({id:O.id,name:O.name}),O}(a,0,[]),C=l,D=d;let E=D.filter(a=>"error"===a.severity).length;return{flow:B,flows:C,issues:D,errorCount:E,warningCount:D.length-E};function F(a,b){void 0!==a.concurrencyLimit&&("number"!=typeof a.concurrencyLimit||Number.isNaN(a.concurrencyLimit)?f("invalid-concurrency-limit",`Node "${a.key}": concurrencyLimit "${String(a.concurrencyLimit)}" is not a number; using the runtime default.`,a.key):b.concurrencyLimit=Math.max(1,Math.floor(a.concurrencyLimit))),"string"==typeof a.joinSeparator&&(b.joinSeparator=a.joinSeparator),void 0!==a.errorStrategy&&("fail-fast"===a.errorStrategy||"collect-all"===a.errorStrategy?b.errorStrategy=a.errorStrategy:f("invalid-error-strategy",`Node "${a.key}": errorStrategy "${String(a.errorStrategy)}" is not valid (fail-fast | collect-all); using collect-all.`,a.key))}}(a,d);if(!e.flow)return{success:!1,error:"The spec could not be compiled into a flow",statusCode:422,issues:e.issues.map(a=>({severity:a.severity,code:a.code,message:a.message}))};b.updateFlowId&&(e.flow.id=b.updateFlowId);let f=e.flows.flatMap(a=>(0,B.nC)(a,{models:c.compile.models,servers:c.validatorServers,serverTools:c.compile.serverTools}).issues),g=function(a,b){let c=[...a.map(a=>({severity:a.severity,code:a.code,message:a.message})),...b.issues],d=c.filter(a=>"error"===a.severity).length;return{issues:c,errorCount:d,warningCount:c.length-d,isRunnable:0===d}}(e.issues,{issues:f,errorCount:0,warningCount:0,isRunnable:!0}),h=!1;if(b.save&&0===g.errorCount){for(let a of e.flows)await k.flowService.saveFlow(a);h=!0,G.info(`Compiled and saved ${e.flows.length} flow(s); root "${e.flow.name}" (${e.flow.id})`)}else b.save&&G.info(`Compiled flow "${e.flow.name}" has ${g.errorCount} error(s); NOT saved`);return{success:!0,flow:e.flow,flows:e.flows,validation:g,saved:h}}var I=c(37101),J=c(79111),K=c(34115);let L=(0,i.h)("backend/execution/flow/loadConversationState");async function M(a){if(I.FlowExecutor.conversationStates.has(a))return L.debug("Loaded state from memory",{conversationId:a}),I.FlowExecutor.conversationStates.get(a);let b=`conversations/${a}`;try{let c=await (0,J.YM)(b,void 0);if(c)return L.debug("Loaded state from storage",{conversationId:a}),await (0,K.jM)(c),I.FlowExecutor.conversationStates.set(a,c),c}catch(b){L.warn("Error loading conversation state from storage",{conversationId:a,error:b})}}var N=c(96249),O=c(63129);let P=`A FlowSpec is a JSON object describing a FLUJO flow semantically — node keys and edges, no coordinates, no ids, no layout:
2
+ {
3
+ "name": "short_flow_name", // letters/digits/_/- only
4
+ "description": "what the flow does",
5
+ "nodes": [ ... ],
6
+ "edges": [ ... ]
7
+ }
8
+
9
+ NODE TYPES:
10
+ - { "key": "unique_key", "type": "start", "label": "...", "prompt": "system-level instructions for the whole flow" }
11
+ - { "key": "...", "type": "process", "label": "...", "description": "what this step does",
12
+ "model": "<model id or name from the catalog>",
13
+ "prompt": "instructions for this step",
14
+ "servers": [ { "name": "<server name>", "tools": ["tool_a"] } ], // optional; omit "tools" to enable all
15
+ "inputMode": "full-history" | "latest-message" | "isolated", // optional, default full-history
16
+ "isolatedPrompt": "...", // only with inputMode "isolated"
17
+ "outputMode": "full-conversation" | "latest-message", // optional, default full-conversation; latest-message hides this step's tool calls/results from later steps (they see only its final response)
18
+ "maxTurns": 20, // optional; per-step cap on agentic tool-loop turns (retry-until-done in ONE node). Unset = model/system default (50)
19
+ "allowedTools": ["tool_a"], // optional; step-level tool allowlist (independent of servers[].tools)
20
+ "captureVariable": "NAME", // optional; save this step's output into a run variable other steps inject with \${var:NAME}
21
+ "captureResource": "NAME", // optional; ALSO save this step's output as a tracked run resource other steps inject with \${res:NAME} (see rule 9b)
22
+ "excludeModelPrompt": true|false, // optional; drop the model's base prompt
23
+ "excludeStartNodePrompt": true|false, // optional; drop the start node's prompt for this step
24
+ "excludeSystemPrompt": true|false } // optional; drop the workflow/handoff guidance block
25
+ - { "key": "...", "type": "subflow", "label": "...",
26
+ "flow": "<existing flow name or id>", // reference an EXISTING flow, OR:
27
+ "subflowSpec": { ...a nested FlowSpec... }, // define a brand-new child flow INLINE (compiled into its own flow and wired automatically), OR fan out concurrently:
28
+ "parallelFlows": ["flow_a", "flow_b"], // run several EXISTING child flows CONCURRENTLY, same input to each, outputs joined; OR:
29
+ "parallelSubflowSpecs": [ { ...FlowSpec... } ], // run several INLINE child flows concurrently
30
+ "mapOverList": true | false, // optional; run the SINGLE child ("flow"/"subflowSpec") ONCE PER ITEM parsed from the input; mutually exclusive with parallelFlows/parallelSubflowSpecs
31
+ "itemSplit": "json-array" | "lines", // optional (mapOverList only), how to split the input into items, default json-array
32
+ "sequential": true | false, // optional (mapOverList only), run items one at a time in order instead of concurrently, default false
33
+ "concurrencyLimit": 4, // optional (parallel / mapOverList), default 4
34
+ "joinSeparator": "\\n\\n---\\n\\n", // optional (parallel / mapOverList), string between joined lane outputs, default "\\n\\n"
35
+ "errorStrategy": "collect-all" | "fail-fast", // optional (parallel / mapOverList), default collect-all
36
+ "inputMode": "full-history" | "latest-message" | "isolated",
37
+ "allowCallerPrompt": true | false, // optional, only with inputMode "isolated"; when true a routing step may pass a "prompt" via its handoff tool that overrides the subflow's "prompt" (default)
38
+ "captureVariable": "NAME", // optional; save the subflow's output into a run variable other steps inject with \${var:NAME}
39
+ "captureResource": "NAME", // optional; ALSO save the subflow's output as a tracked run resource (\${res:NAME}, rule 9b)
40
+ "outputMode": "steps" | "final-only" }
41
+ - { "key": "...", "type": "finish", "label": "..." }
42
+ - { "key": "...", "type": "resource", "label": "...", // OPTIONAL/advanced (rule 9c): a data artifact shown in the graph
43
+ "server": "<server name>", "uri": "<resource uri>", // EITHER a static MCP resource…
44
+ "runName": "NAME" } // …OR a run artifact steps produce/consume
45
+
46
+ EDGES: { "from": "<node key>", "to": "<node key>", "bidirectional": true|false,
47
+ "condition": { "kind": "contains"|"regex"|"equals", "value": "...",
48
+ "target": "last-assistant"|"last-message", // optional, default last-assistant
49
+ "ignoreCase": true|false, "negate": true|false } } // condition optional; process-node edges only
50
+
51
+ RULES:
52
+ 1. Exactly ONE start node; at least one finish node reachable from it.
53
+ 2. Every process node MUST reference a configured model (by id, display name, or name).
54
+ 3. A process step uses MCP tools ONLY via its "servers" list — never emit nodes of type "mcp".
55
+ 4. Do not embed \${tool:...} or \${resource:...} references in prompts — tools are wired through "servers".
56
+ 5. Branching: give a process node multiple outgoing edges; its model decides where to hand off at runtime. "bidirectional": true lets the target hand back to the source (agent <-> agent).
57
+ 5b. Deterministic routing: give a process node's outgoing edges a "condition" to route WITHOUT the model — the engine takes the first outgoing edge whose predicate matches the last message (default the step's own last assistant message), and a bare (condition-less) edge is the fallback. Use this for reliable data-driven branches (e.g. output contains "FAIL" -> fix step, else -> publish) instead of relying on a small model to emit a handoff. Only process-node edges may carry a condition. Without any condition on a node, that node keeps model-decided handoff (rule 5). If the model still calls a handoff tool, that wins over the condition.
58
+ 6. A subflow node may have only ONE outgoing edge. Give it EITHER a "flow" (naming an existing flow) OR a "subflowSpec" (an inline nested FlowSpec that becomes its own child flow) — not both. A "subflowSpec" may itself contain subflow nodes with their own "subflowSpec" (bounded nesting), so you can author whole multi-level flows in one object.
59
+ 7. A subflow node may instead fan out to SEVERAL child flows CONCURRENTLY via "parallelFlows" (existing flows) or "parallelSubflowSpecs" (inline). The same input is sent to every lane and their outputs are joined. This is about multiple CHILDREN, not successors — the single-outgoing-edge rule (rule 6) still holds. Prefer "parallelFlows" for large fan-outs.
60
+ 8. A subflow node may instead run its SINGLE child flow ONCE PER ITEM via "mapOverList": true. The input is split into items by "itemSplit" ("json-array" default, or "lines"), each item is sent to its own child run, and the per-item outputs are joined (same pool/tuning as parallel). Use "sequential": true to run items in order. Mutually exclusive with "parallelFlows"/"parallelSubflowSpecs".
61
+ 9. Named variables (scratchpad): a step can save its output with "captureVariable": "NAME" (process or subflow) and any LATER step injects it with \${var:NAME} inside its "prompt" / "isolatedPrompt" / subflow prompt. This survives "latest-message"/"isolated" scoping, unlike conversation history — use it to carry a todo list, a file path, a diff, or a captured result across steps that don't share history. \${var:NAME} is run-scoped and plaintext; it is DISTINCT from \${global:VAR} (configured secrets/config, resolved only for tool args). Capture a subflow's output on the PARENT subflow node — a variable set inside a child flow is not visible to the parent.
62
+ 9b. Run resources (tracked data): "captureResource": "NAME" (process or subflow) ALSO saves the step's output as a run-scoped RESOURCE — an addressable artifact (flujo://run/... URI) with lineage (which step produced it, which steps read it), readable via the built-in "flujo" MCP server. A later step injects it with \${res:NAME} exactly like \${var:NAME}. Prefer "captureVariable" for short strings; use "captureResource" when the output is a large document/report/dataset worth tracking, or when other tools/agents should be able to read it back. Large or binary MCP tool results (screenshots, files) are auto-captured as run resources without any spec field.
63
+ 9c. Resource nodes are OPTIONAL/advanced — most flows should not use them; prefer rule 9b's captureResource/\${res:NAME}. Emit one only when the data artifact itself should be VISIBLE in the graph: an edge resource→process means the step READS the artifact (its contents are injected into the step's context); process→resource means the step's output is SAVED to it (run artifacts only, equivalent to captureResource with the node's runName). Resource edges are data wiring, not flow control — they never carry conditions and don't count as a step's successor.
64
+ 10. Keep flows minimal — only the steps the task needs. Write clear, specific prompts and labels; fill "description" on process nodes.`;var Q=c(12700),R=c(79861);let S=(0,i.h)("backend/services/mcp/quality/cache"),T="mcp-quality-cache";class U{constructor(a=Date.now()){this.entries={},this.dirty=!1,this.now=a}async load(){try{let a=await (0,J.YM)(T,{entries:{}});this.entries=a?.entries&&"object"==typeof a.entries?a.entries:{}}catch(a){S.warn("Failed to load quality cache; starting empty",a),this.entries={}}}get(a,b){let c=this.entries[`${a}::${b}`];if(c&&!(this.now-c.at>864e5))return c.signal}set(a,b,c){this.entries[`${a}::${b}`]={at:this.now,signal:c},this.dirty=!0}async flush(){let a=!1;for(let[b,c]of Object.entries(this.entries))this.now-c.at>864e5&&(delete this.entries[b],a=!0);if(this.dirty||a)try{await (0,J.VH)(T,{entries:this.entries})}catch(a){S.warn("Failed to persist quality cache",a)}}}function V(a){return!Number.isFinite(a)||a<0?0:a>1?1:a}function W(a,b){return!Number.isFinite(a)||a<=0?0:!Number.isFinite(b)||b<=1?+(a>0):V(Math.log10(a+1)/Math.log10(b+1))}let X=(0,i.h)("backend/services/mcp/quality/providers/githubStars"),Y="github",Z=new Map;function $(){return d??(process.env.GITHUB_TOKEN||void 0)}function _(a){let b,c=a.server.repository;if(c?.source&&"github"!==c.source.toLowerCase())return null;var d=c?.url;if(!d)return null;try{b=new URL(d.replace(/^git\+/,""))}catch{return null}if(!/(^|\.)github\.com$/i.test(b.hostname))return null;let e=b.pathname.replace(/\.git$/i,"").split("/").filter(Boolean);return e.length<2?null:`${e[0]}/${e[1]}`.toLowerCase()}async function aa(a,b){let c=new AbortController,d=()=>c.abort();b.addEventListener("abort",d,{once:!0});let e=setTimeout(()=>c.abort(),6e3);try{return await fetch(`https://api.github.com${a}`,{headers:function(){let a={Accept:"application/vnd.github+json","User-Agent":"FLUJO-mcp-quality","X-GitHub-Api-Version":"2022-11-28"},b=$();return b&&(a.Authorization=`Bearer ${b}`),a}(),signal:c.signal,cache:"no-store"})}catch(b){return X.warn(`GitHub request failed (${a})`,b instanceof Error?b.message:b),null}finally{clearTimeout(e),b.removeEventListener("abort",d)}}function ab(a){return(403===a.status||429===a.status)&&"0"===a.headers.get("x-ratelimit-remaining")}let ac=(0,i.h)("backend/services/mcp/quality/providers/npmDownloads"),ad="npm-downloads",ae=new Map;function af(a){for(let b of a.server.packages??[])if("npm"===b.registryType&&b.identifier)return b.identifier;return null}function ag(a){return a.startsWith("@")}async function ah(a,b){let c=new AbortController,d=()=>c.abort();b.addEventListener("abort",d,{once:!0});let e=setTimeout(()=>c.abort(),6e3);try{return await fetch(`https://api.npmjs.org${a}`,{signal:c.signal,cache:"no-store"})}catch(b){return ac.warn(`npm request failed (${a})`,b instanceof Error?b.message:b),null}finally{clearTimeout(e),b.removeEventListener("abort",d)}}let ai="registry-status",aj=[{id:Y,label:"GitHub Stars & Activity",defaultWeight:.5,isApplicable:a=>null!==_(a),cacheKey:a=>_(a),async prefetch(a,b,c){let d=`${a??""} mcp`.trim(),e=`/search/repositories?q=${encodeURIComponent(d)}&sort=stars&order=desc&per_page=50`,f=await aa(e,c);if(f&&f.ok)try{for(let a of(await f.json()).items??[])a.full_name&&Z.set(a.full_name.toLowerCase(),{stars:"number"==typeof a.stargazers_count?a.stargazers_count:0,pushedAtMs:a.pushed_at?Date.parse(a.pushed_at):null})}catch(a){X.warn("Failed to parse GitHub search response",a)}else if(f&&ab(f))return void X.warn("GitHub search rate-limited; ranking will degrade to other providers");if(!$())return;let g=3;for(let a of b){if(g<=0)break;let b=_(a);if(!b||Z.has(b))continue;g-=1;let d=await aa(`/repos/${b}`,c);if(d){if(ab(d))break;if(d.ok)try{let a=await d.json();Z.set(b,{stars:"number"==typeof a.stargazers_count?a.stargazers_count:0,pushedAtMs:a.pushed_at?Date.parse(a.pushed_at):null})}catch{}}}},async fetch(a){let b=_(a);if(!b)return null;let c=Z.get(b);if(!c)return null;let d=W(c.stars,5e4),e=function(a,b,c=30,d=730){if(!a||!Number.isFinite(a))return 0;let e=(b-a)/864e5;return e<=c?1:e>=d?0:V(1-(e-c)/(d-c))}(c.pushedAtMs,Date.now());return{providerId:Y,score:V(.7*d+.3*e),evidence:{repo:b,stars:c.stars,...c.pushedAtMs?{pushedAt:new Date(c.pushedAtMs).toISOString()}:{},starsScore:d,recencyScore:e}}}},{id:ad,label:"npm Weekly Downloads",defaultWeight:.35,isApplicable:a=>null!==af(a),cacheKey:a=>af(a),async prefetch(a,b,c){let d=b.map(af).filter(a=>!!a&&!ae.has(a)),e=d.filter(a=>!ag(a)),f=d.filter(ag);for(let a=0;a<e.length;a+=100){let b=e.slice(a,a+100),d=await ah(`/downloads/point/last-week/${b.join(",")}`,c);if(d&&d.ok)try{let a=await d.json();if(1===b.length)"number"==typeof a.downloads&&ae.set(b[0],a.downloads);else for(let c of b){let b=a[c];ae.set(c,b&&"number"==typeof b.downloads?b.downloads:0)}}catch(a){ac.warn("Failed to parse npm bulk downloads response",a)}}for(let a of f){let b=await ah(`/downloads/point/last-week/${a}`,c);if(b&&b.ok)try{let c=await b.json();"number"==typeof c.downloads&&ae.set(a,c.downloads)}catch{}}},async fetch(a){let b=af(a);if(!b)return null;let c=ae.get(b);return void 0===c?null:{providerId:ad,score:W(c,1e6),evidence:{package:b,weeklyDownloads:c}}}},{id:ai,label:"Registry Status",defaultWeight:.15,isApplicable:a=>!0,cacheKey:()=>null,fetch:async a=>({providerId:ai,score:+("active"===a.verificationStatus),evidence:{status:a.verificationStatus}})}];var ak=c(89392);let al=(0,i.h)("backend/services/mcp/quality/settings");function am(){return{providers:aj.map(a=>({id:a.id,enabled:!0,weight:a.defaultWeight})),minScore:0,worksGate:!0}}async function an(){try{let a=await (0,J.YM)(ak.Z.MCP_QUALITY_SETTINGS,am());return function(a){var b,c;let d=am(),e=a??{},f=new Map;if(Array.isArray(e.providers))for(let a of e.providers)a&&"string"==typeof a.id&&f.set(a.id,a);return{providers:d.providers.map(a=>{let b=f.get(a.id);return{id:a.id,enabled:"boolean"==typeof b?.enabled?b.enabled:a.enabled,weight:"number"==typeof b?.weight&&Number.isFinite(b.weight)&&b.weight>=0?b.weight:a.weight}}),minScore:(b=e.minScore,c=d.minScore,"number"==typeof b&&Number.isFinite(b)?Math.min(1,Math.max(0,b)):c),worksGate:"boolean"==typeof e.worksGate?e.worksGate:d.worksGate,..."string"==typeof e.githubToken&&e.githubToken.length>0?{githubToken:e.githubToken}:{}}}(a)}catch(a){return al.warn("Failed to load mcpQuality settings; using defaults",a),am()}}let ao=(0,i.h)("backend/services/mcp/quality/orchestrator");async function ap(a,b){let c=new AbortController,d=setTimeout(()=>c.abort(),b);try{return await a(c.signal)}finally{clearTimeout(d)}}async function aq(a,b,c={}){let e=c.topN??10;try{var f;let g=c.settings??await an(),h=aj.filter(a=>(function(a,b){let c=a.providers.find(a=>a.id===b);return!!c?.enabled})(g,a.id));if(0===h.length)return b.map(a=>({candidate:a,score:0,signals:[]}));d=(f=g.githubToken)&&f.length>0?f:void 0;let i=b.slice(0,e),j=b.slice(e),k=new U(c.now??Date.now());await k.load();let l=i.map(()=>[]);for(let b of h){let c=i.map((a,b)=>({c:a,i:b})).filter(({c:a})=>b.isApplicable(a)),d=[],e=[];for(let a of c){let c=b.cacheKey(a.c);if(c){let d=k.get(b.id,c);if(d){e.push({i:a.i,signal:d});continue}}d.push(a)}if(b.prefetch&&d.length>0)try{await ap(c=>b.prefetch(a,d.map(a=>a.c),c),12e3)}catch(a){ao.warn(`Provider "${b.id}" prefetch failed; degrading`,a)}for(let{c:a,i:c}of d)try{let d=await ap(c=>b.fetch(a,c),2e3);if(d){l[c].push(d);let e=b.cacheKey(a);e&&k.set(b.id,e,d)}}catch(c){ao.warn(`Provider "${b.id}" fetch failed for "${a.registryName}"`,c)}for(let{i:a,signal:b}of e)l[a].push(b)}await k.flush();let m=i.map((a,b)=>{let c=l[b],d=new Map(c.map(a=>[a.providerId,a])),e=h.filter(b=>b.isApplicable(a)).map(a=>({providerId:a.id,weight:function(a,b){let c=a.providers.find(a=>a.id===b);return c&&c.enabled?c.weight:0}(g,a.id),score:d.get(a.id)?.score??0})),{score:f}=function(a){let b=0,c=0;for(let d of a){let a=Number.isFinite(d.weight)&&d.weight>0?d.weight:0,e=V(d.score);b+=a,c+=a*e}return{score:b>0?c/b:0,breakdown:a}}(e);return{candidate:a,score:f,signals:c}}).map((a,b)=>({s:a,idx:b})).sort((a,b)=>b.s.score-a.s.score||a.idx-b.idx).map(a=>a.s),n=j.map(a=>({candidate:a,score:0,signals:[]}));return[...m,...n]}catch(a){return ao.warn("enrichAndRank failed; returning unranked candidates",a),b.map(a=>({candidate:a,score:0,signals:[]}))}}let ar=(0,i.h)("backend/services/mcp/registryInstall"),as="/v0.1/servers";function at(a){return{registryName:a.server.name,server:a.server,verificationStatus:(0,R.vf)(a)}}async function au(a,b=8){let c=await av(a,b);return(await aq(a,c.map(at))).map(a=>(function(a,b){let c=(0,R.AH)(a),d=c[0];return{name:a.name,...a.title?{title:a.title}:{},...a.description?{description:a.description}:{},installable:c.length>0,requiredEnv:d?(0,R.jg)(d):[],...b?{quality:function(a){let b=b=>a.signals.find(a=>a.providerId===b)?.evidence,c=b(Y),d=b(ad),e=b(ai);return{score:a.score,..."number"==typeof c?.stars?{stars:c.stars}:{},..."number"==typeof d?.weeklyDownloads?{weeklyDownloads:d.weeklyDownloads}:{},..."string"==typeof e?.status?{status:e.status}:{}}}(b)}:{}}})(a.candidate.server,a))}async function av(a,b){let c=new URL(Q.jD+as);c.searchParams.set("version","latest"),c.searchParams.set("limit",String(Math.min(Math.max(b,1),30))),a&&c.searchParams.set("search",a);let d=await (0,Q.Ws)(c,15e3);return Array.isArray(d?.servers)?d.servers:[]}async function aw(a){let b=new URL(Q.jD+as);b.searchParams.set("version","latest"),b.searchParams.set("limit","10"),b.searchParams.set("search",a);let c=await (0,Q.Ws)(b,15e3),d=Array.isArray(c?.servers)?c.servers:[];return d.find(b=>b.server?.name===a)??d[0]??null}async function ax(a,b,c){let d;if(!a||"string"!=typeof a)return{installed:!1,error:"A registry server name is required"};try{d=await aw(a)}catch(a){return{installed:!1,error:`Registry lookup failed: ${a instanceof Error?a.message:String(a)}`}}let e=d?.server??null;if(!e)return{installed:!1,error:`No registry entry found for "${a}"`};let f=(0,R.AH)(e)[0];if(!f)return{installed:!1,error:`"${e.name}" has no install method FLUJO supports (stdio package or HTTP remote)`};let g=(0,R.vf)(d),h=(0,R.O$)(a,e,f,g);if(c?.resolveOnly)return{installed:!1,serverName:h.serverName,plan:h};let i=(0,R.jg)(f,b);if(i.length>0)return{installed:!1,needsEnv:i,plan:h,error:`"${e.name}" requires values for: ${i.join(", ")}`};let j=(0,R.cy)((0,R.Yr)(e,f),b),k=j.name,l=await C.mcpService.loadServerConfigs();if(Array.isArray(l)&&l.some(a=>a.name===k)){ar.info(`installRegistryServer: "${k}" already configured; reusing`);let{tools:a,error:b}=await C.mcpService.listServerTools(k);return{installed:!0,alreadyExisted:!0,serverName:k,plan:h,tools:(a??[]).map(a=>({name:a.name,...a.description?{description:a.description}:{}})),...b?{error:b}:{}}}ar.info(`installRegistryServer: installing "${e.name}" as "${k}" (${f.kind})`);let m=await C.mcpService.updateServerConfig(k,j);if(!Array.isArray(m)&&m&&"success"in m&&!1===m.success)return{installed:!1,error:`Saving the server failed: ${m.error??"unknown error"}`};let{tools:n,error:o}=await C.mcpService.listServerTools(k),p=(n??[]).map(a=>({name:a.name,...a.description?{description:a.description}:{}}));if((c?.worksGate??(await an()).worksGate)&&0===p.length){ar.warn(`installRegistryServer: "${k}" exposed no tools${o?` (${o})`:""}; rolling back (works-gate)`);try{await C.mcpService.deleteServerConfig(k)}catch(a){ar.error(`installRegistryServer: rollback of "${k}" failed`,a)}return{installed:!1,worksGateRejected:!0,serverName:k,plan:h,error:o?`"${e.name}" failed to start: ${o}`:`"${e.name}" connected but exposed no tools — rejected by the works-gate. Try a different server.`}}return{installed:!0,serverName:k,plan:h,tools:p,...o?{error:o}:{}}}async function ay(a,b,c){let d;if(!a||"string"!=typeof a)return{installed:!1,error:"A capability search query is required"};try{d=await av(a,10)}catch(a){return{installed:!1,error:`Registry lookup failed: ${a instanceof Error?a.message:String(a)}`}}let e=await aq(a,d.map(at)),f=await an(),g=c?.minScore??f.minScore,h=c?.maxAttempts??3,i=[],j=0;for(let a of e){let d=a.candidate.registryName;if(a.score<g){i.push({name:d,score:a.score,reason:`below minScore ${g}`});break}if(0===(0,R.AH)(a.candidate.server).length){i.push({name:d,score:a.score,reason:"no supported install method"});continue}if(j>=h)break;j+=1;let e=await ax(d,b,{worksGate:!0});if(c?.onAttempt)try{await c.onAttempt(e.plan,e)}catch(a){ar.error("installBestForCapability: onAttempt hook failed",a)}if(e.installed)return{...e,attempts:i};let f=e.needsEnv?.length?`needs env: ${e.needsEnv.join(", ")}`:e.worksGateRejected?"works-gate rejected (no tools / failed to start)":e.error??"install failed";i.push({name:d,score:a.score,reason:f})}return{installed:!1,attempts:i,error:`No working server found for "${a}" among the top ${j} installable candidate(s).`}}let az={requireConsent:!0,namespaceAllowlist:[],trustBrainStem:!0};function aA(a){let{caller:b,settings:c,registryName:d,allowInstall:e}=a;if("generator"===b)return!0===e?{allowed:!0,reason:"generator-allowinstall",message:"Approved by the per-generation allowInstall opt-in."}:{allowed:!1,reason:"generator-not-allowed",message:"Installing is not allowed in this generation (allowInstall is off)."};if("authoring-tool"===b&&c.trustBrainStem)return{allowed:!0,reason:"brainstem-trusted",message:"Approved: the /mcp-flows authoring tool is trusted (mcpAutoInstall.trustBrainStem)."};if(!c.requireConsent)return{allowed:!0,reason:"consent-disabled",message:"Approved: consent is not required (mcpAutoInstall.requireConsent is off)."};let f=function(a){if("string"!=typeof a)return"";let b=a.indexOf("/");return b>0?a.slice(0,b):""}(d);return""!==f&&c.namespaceAllowlist.includes(f)?{allowed:!0,reason:"namespace-allowlisted",message:`Approved: namespace "${f}" is allowlisted.`}:{allowed:!1,reason:"consent-required",message:"Consent required: review the exact command and arguments, then approve this install (SEP-1024)."}}function aB(a,b,c,d,e){return{at:new Date().toISOString(),caller:b,registryName:a.registryName,resolvedName:a.resolvedName,serverName:a.serverName,transport:a.transport,...a.command?{command:a.command}:{},...a.args?{args:a.args}:{},...a.serverUrl?{serverUrl:a.serverUrl}:{},requiredEnvNames:a.requiredEnvNames,verificationStatus:a.verificationStatus,consent:{allowed:c.allowed,reason:c.reason},installed:d,...e?{error:e}:{}}}let aC=(0,i.h)("backend/services/mcp/autoInstall");async function aD(){try{let a=await (0,J.YM)(ak.Z.MCP_AUTO_INSTALL_SETTINGS,az)??{};return{requireConsent:"boolean"==typeof a.requireConsent?a.requireConsent:az.requireConsent,namespaceAllowlist:Array.isArray(a.namespaceAllowlist)?a.namespaceAllowlist.filter(a=>"string"==typeof a&&a.length>0):[],trustBrainStem:"boolean"==typeof a.trustBrainStem?a.trustBrainStem:az.trustBrainStem}}catch(a){return aC.warn("Failed to load mcpAutoInstall settings; using safe defaults",a),{...az}}}let aE="mcp-install-audit",aF=Promise.resolve();async function aG(){try{return await (0,J.YM)(aE,[])}catch(a){return aC.error("Failed to load MCP install audit log",a),[]}}async function aH(a){let b=aF.catch(()=>{}).then(async()=>{let b=await aG();b.push(a);let c=b.slice(-300);await (0,J.VH)(aE,c)}).catch(a=>{aC.error("Failed to append MCP install audit entry",a)});aF=b,await b}let aI=(0,i.h)("backend/services/mcp/flowAuthoringTools"),aJ=["list_flow_building_blocks","validate_flow_spec","create_flow","search_mcp_marketplace","install_mcp_server","install_best_mcp_server"];function aK(){return{type:"object",properties:{spec:{type:"object",description:"The FlowSpec object (see the tool description for the format)."}},required:["spec"]}}function aL(a,b=!1){return{content:[{type:"text",text:JSON.stringify(a,null,2)}],...b?{isError:!0}:{}}}async function aM(a,b){try{if("list_flow_building_blocks"===a){let a=await F();return aL(a.blocks)}if("search_mcp_marketplace"===a){let a="string"==typeof b?.query?b.query:"",c=await au(a);return aL(c)}if("install_mcp_server"===a){let a="string"==typeof b?.name?b.name:"",c=b?.env&&"object"==typeof b.env&&!Array.isArray(b.env)?b.env:void 0,d=await ax(a,c,{resolveOnly:!0});if(!d.plan)return aL(d,!0);let e=await aD(),f=aA({caller:"authoring-tool",settings:e,registryName:a}),g=(0,R.nO)(d.plan.verificationStatus)?void 0:`Unverified / self-asserted registry entry (status: ${d.plan.verificationStatus}). Registry entries are publisher-asserted — review the command before approving.`;if(await aH(aB(d.plan,"authoring-tool",f,!1)),!f.allowed)return aL({installed:!1,consentRequired:!0,message:f.message,plan:d.plan,...g?{verificationWarning:g}:{}});let h=await ax(a,c);return await aH(aB(h.plan??d.plan,"authoring-tool",f,h.installed,h.error)),aL({...h,...g?{verificationWarning:g}:{}},!h.installed)}if("install_best_mcp_server"===a){let a="string"==typeof b?.capability?b.capability:"",c=b?.env&&"object"==typeof b.env&&!Array.isArray(b.env)?b.env:void 0;if(!a)return aL({error:'Provide a "capability" search term.'},!0);let d=await aD(),e=aA({caller:"authoring-tool",settings:d,registryName:a});if(!e.allowed){let b=(await au(a)).find(a=>a.installable),d=b?await ax(b.name,c,{resolveOnly:!0}):null;return d?.plan&&await aH(aB(d.plan,"authoring-tool",e,!1)),aL({installed:!1,consentRequired:!0,message:e.message,...d?.plan?{plan:d.plan}:{}})}let f=await ay(a,c,{onAttempt:async(a,b)=>{a&&await aH(aB(a,"authoring-tool",e,b.installed,b.error))}}),g=f.installed&&!(0,R.nO)(f.plan?.verificationStatus)?`Installed an unverified / self-asserted registry entry (status: ${f.plan?.verificationStatus}).`:void 0;return aL({...f,...g?{verificationWarning:g}:{}},!f.installed)}if("validate_flow_spec"===a||"create_flow"===a){let c=function(a){let b=a?.spec;if("string"==typeof b)try{return JSON.parse(b)}catch{return null}return b??null}(b);if(!c)return aL({error:'Provide a "spec" argument: a FlowSpec object (or a JSON string of one).'},!0);let d=await H(c,{save:"create_flow"===a});if(!d.success)return aL({error:d.error,issues:d.issues??[]},!0);let e=d.flows.length,f=e>1?` (plus ${e-1} nested subflow flow(s))`:"",g={flowId:d.flow.id,flowName:d.flow.name,nodeCount:d.flow.nodes.length,edgeCount:d.flow.edges.length,...e>1?{flows:d.flows.map(a=>({id:a.id,name:a.name}))}:{},validation:d.validation,..."create_flow"===a?{saved:d.saved,...d.saved?{note:`Flow "${d.flow.name}"${f} was created. It is callable as a tool on this MCP server (after a fresh tools/list) and as model "flow-${d.flow.name}" on the OpenAI-compatible endpoint.`}:{note:"NOT saved: validation found errors. Fix the issues and call create_flow again."}}:{}};return aL(g,"create_flow"===a&&!d.saved)}return aL({error:`Unknown authoring tool: ${a}`},!0)}catch(b){return aI.error("authoringCallTool failed",{toolName:a,err:b}),aL({error:`Authoring tool failed: ${b instanceof Error?b.message:String(b)}`},!0)}}var aN=c(92018);let aO=(0,i.h)("backend/services/mcp/internalTools");function aP(a,b=!1){return{content:[{type:"text",text:"string"==typeof a?a:JSON.stringify(a,null,2)}],...b?{isError:!0}:{}}}function aQ(){return[{name:"list_flow_building_blocks",description:'List everything a FlowSpec may reference in this FLUJO instance: configured models (bind to process steps), MCP servers and their tools (attach via "servers"), and existing flows (usable as subflow targets). Call this before authoring a spec.',inputSchema:{type:"object",properties:{}}},{name:"validate_flow_spec",description:`Compile and validate a FlowSpec WITHOUT saving. Returns the compiled flow's validation result (errors block saving; warnings are advisory) so you can iterate until clean, then call create_flow.
65
+
66
+ ${P}`,inputSchema:aK()},{name:"create_flow",description:`Create a new FLUJO flow from a FlowSpec. The spec is compiled deterministically (layout, ids, and wiring are generated for you) and saved ONLY when validation finds zero errors — otherwise the issues are returned to fix. Use list_flow_building_blocks first to see the models, MCP servers/tools, and existing flows you may reference.
67
+
68
+ ${P}`,inputSchema:aK()},{name:"search_mcp_marketplace",description:"Search the public MCP server registry for new capabilities (voice, browsing, files, email, vision, …). The registry matches the query against server NAMES only (substring) — use short single terms and try several. Returns name, description, whether FLUJO can install it, and which env vars/keys it would require.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Short search term matched against server names."}},required:["query"]}},{name:"install_mcp_server",description:'Install an MCP server from the public registry (by the exact name returned by search_mcp_marketplace) and connect it — this DOWNLOADS AND RUNS a third-party package on the FLUJO host. Installs are gated by consent (SEP-1024): unless this trusted authoring tool is allowed via the mcpAutoInstall settings (trustBrainStem / requireConsent / namespaceAllowlist), the tool returns the exact resolved command + arguments with consentRequired=true INSTEAD of installing, and the caller must obtain explicit approval. Every attempt is written to an audit log (command, args, env NAMES, verification status — never secret values) before any spawn. Returns the FLUJO server name (reference it in FlowSpec "servers") and the tools it provides, or needsEnv when required keys are missing (supply values via the optional "env" argument), or the resolved plan when consent is required. First install can take minutes (package download).',inputSchema:{type:"object",properties:{name:{type:"string",description:'Exact registry name from search results, e.g. "ai.keenable/web-search".'},env:{type:"object",description:"Optional env var values for the server (e.g. required API keys).",additionalProperties:{type:"string"}}},required:["name"]}},{name:"install_best_mcp_server",description:"Install the BEST WORKING MCP server for a capability, unattended — the recommended way to acquire a capability when you don't already have a specific server name. Searches the registry, RANKS candidates by blended quality (GitHub stars + recent activity, npm weekly downloads, registry status), then installs best→worst until one actually boots and exposes tools (the \"works-gate\"): candidates that need unavailable keys, can't be installed, or start with zero tools are skipped automatically. Same consent/audit rules and third-party-code warning as install_mcp_server. Returns the installed server name + its tools and the list of candidates tried, or needsEnv/consentRequired. Prefer this over search+install for headless self-improvement; use install_mcp_server only when you must pin an exact server.",inputSchema:{type:"object",properties:{capability:{type:"string",description:'Short capability term matched against server names, e.g. "youtube", "email", "browser".'},env:{type:"object",description:"Optional env var values shared across attempted servers (e.g. an API key).",additionalProperties:{type:"string"}}},required:["capability"]}},{name:"execute_flow",description:"Run another FLUJO flow (by name or id) with the given input and return its final output. The run is ephemeral (no chat conversation is created). Use list_flow_building_blocks to see the available flows. Nested runs are limited in depth — a flow cannot recurse through itself indefinitely.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id."},input:{type:"string",description:"The message to send to the flow as the user turn."}},required:["flow","input"]}},{name:"read_flow",description:"Read a FLUJO flow's full definition (by name or id): its nodes with their prompts, bound models, attached MCP servers/tools and input/output modes, plus the control and MCP edges. Note this is the COMPILED flow (node ids, not FlowSpec keys) — to change it, author a fresh FlowSpec and call update_flow.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id."}},required:["flow"]}},{name:"update_flow",description:"REPLACE an existing FLUJO flow's definition (by name or id) with a newly compiled FlowSpec, keeping the flow's id — so planned executions, subflow nodes and conversations that reference it keep working. The spec format is the same as create_flow/validate_flow_spec (see those tool descriptions); saving is gated on zero validation errors. The replaced definition is archived automatically — list_flow_versions / revert_flow can restore it. Note that manual canvas edits made in the builder are part of what gets replaced. Use read_flow first to see what you are replacing.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id of the flow to replace."},spec:{type:"object",description:"The FlowSpec object (see the create_flow tool description for the format)."}},required:["flow","spec"]}},{name:"list_flow_versions",description:"List a flow's archived versions (by name or id), newest first. A version is created automatically whenever the flow's definition is overwritten (builder save, update_flow, revert_flow) and holds the definition that was replaced. Use read_flow_version to inspect one and revert_flow to restore one.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id."}},required:["flow"]}},{name:"read_flow_version",description:"Read one archived version of a flow (see list_flow_versions): the full definition it held before it was replaced, in the same format as read_flow.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id."},version:{type:"string",description:"The version id (see list_flow_versions)."}},required:["flow","version"]}},{name:"revert_flow",description:"Restore an archived version (see list_flow_versions) as the flow's CURRENT definition. The definition being reverted away from is archived first, so a revert can itself be undone. References by flow id keep working.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id."},version:{type:"string",description:"The version id to restore (see list_flow_versions)."}},required:["flow","version"]}},{name:"delete_flow",description:"PERMANENTLY delete a FLUJO flow (by name or id). This cannot be undone — the flow's version history is deleted with it. Verify the target with list_flow_building_blocks first.",inputSchema:{type:"object",properties:{flow:{type:"string",description:"Flow name or flow id."}},required:["flow"]}},{name:"list_mcp_servers",description:"List the MCP servers configured in this FLUJO instance with their transport, enabled/disabled state and live connection status. Config details (env vars, headers, credentials) are never included.",inputSchema:{type:"object",properties:{}}},{name:"list_mcp_server_tools",description:"List the tools of one configured MCP server (name, description, input schema). Use together with call_mcp_tool for servers that are not bound to this flow.",inputSchema:{type:"object",properties:{server:{type:"string",description:"The FLUJO server name (see list_mcp_servers)."}},required:["server"]}},{name:"call_mcp_tool",description:"Call a tool on any configured MCP server by server name + tool name. This lets you use servers that are not bound to the current flow. Check the tool's input schema with list_mcp_server_tools first.",inputSchema:{type:"object",properties:{server:{type:"string",description:"The FLUJO server name."},tool:{type:"string",description:"The tool name on that server."},args:{type:"object",description:"Arguments for the tool (per its input schema)."},timeout:{type:"number",description:"Optional timeout in seconds."}},required:["server","tool"]}},{name:"restart_mcp_server",description:"Force-reconnect a configured MCP server (tears the connection down and rebuilds it). Useful when a server is in an error state after a config or environment change.",inputSchema:{type:"object",properties:{server:{type:"string",description:"The FLUJO server name."}},required:["server"]}},{name:"set_mcp_server_enabled",description:"Enable or disable a configured MCP server. Disabling disconnects it and prevents any further use; enabling connects it.",inputSchema:{type:"object",properties:{server:{type:"string",description:"The FLUJO server name."},enabled:{type:"boolean",description:"true to enable + connect, false to disable + disconnect."}},required:["server","enabled"]}},{name:"list_models",description:"List the models configured in this FLUJO instance (id, name, display name, description, provider, base URL, context window). API keys are never included. Reference models by id or name in FlowSpecs.",inputSchema:{type:"object",properties:{}}},{name:"list_planned_executions",description:"List the planned (scheduled/triggered) executions in this FLUJO instance with their trigger type, enabled state, armed status and last run outcome.",inputSchema:{type:"object",properties:{}}},{name:"run_planned_execution",description:"Fire a planned execution immediately (by id, see list_planned_executions) and return the run record with its output.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The planned execution id."}},required:["id"]}},{name:"list_conversations",description:"List the chat conversations stored in this FLUJO instance (id, title, bound flow, status, created/updated timestamps), newest first. Use read_conversation to get a transcript.",inputSchema:{type:"object",properties:{limit:{type:"number",description:"Optional maximum number of conversations to return (newest first). Default: all."}}}},{name:"read_conversation",description:'Read one chat conversation\'s transcript by conversation id (see list_conversations). Returns the displayed messages: system prompts are excluded, nested subflow steps carry a "depth" marker, assistant tool calls are summarized. Long conversations return only the most recent messages — raise "limit" to get more.',inputSchema:{type:"object",properties:{conversation:{type:"string",description:"The conversation id."},limit:{type:"number",description:"Maximum number of most-recent messages to return (default 50). The total transcript size is capped regardless."}},required:["conversation"]}},{name:"terminal",description:'Run a shell command on the FLUJO host and return its combined stdout/stderr plus exit code. Runs through a shell, so pipes and chained commands (e.g. "npm install && npm run build") work. Use it to install dependencies, build a cloned MCP server, inspect the filesystem, or run diagnostics. Working directory defaults to the FLUJO data directory (where cloned servers live under mcp-servers/); pass "cwd" to run elsewhere. The command is killed if it exceeds the timeout, and very large output is truncated.',inputSchema:{type:"object",properties:{command:{type:"string",description:'The shell command line to execute, e.g. "npm install && npm run build".'},cwd:{type:"string",description:"Optional working directory. Relative paths resolve against the FLUJO data directory. Defaults to the data directory."},timeout:{type:"number",description:"Optional timeout in seconds (default 60, max 600). The command is killed if it runs longer."}},required:["command"]}}]}async function aR(a){let b=await k.flowService.loadFlows();return b.find(b=>b.id===a)??b.find(b=>b.name===a)}async function aS(a){let b=String(a?.flow??"").trim();if(!b)return aP({error:'Provide "flow": a flow name or id.'},!0);let c=await aR(b);if(!c)return aP({error:`No flow named or with id "${b}". Use list_flow_building_blocks to see the available flows.`},!0);let d=global.__flujo_internal_flow_depth??0;if(d>=4)return aP({error:`execute_flow nesting limit (4) reached — refusing to start "${c.name}" to prevent runaway recursion.`},!0);global.__flujo_internal_flow_depth=d+1;try{let b=await (0,n.runFlow)({flowId:c.id,prompt:String(a?.input??""),mode:"ephemeral",flujo:!0,requireApproval:!1});if(b.flowNotFound)return aP({error:`Flow not found: ${b.flowNotFound.name}`},!0);if("error"===b.status)return aP({error:b.error?.message??"Unknown error during flow execution."},!0);return aP(b.outputText??"")}finally{global.__flujo_internal_flow_depth=d}}async function aT(a){let b=String(a?.flow??"").trim();if(!b)return aP({error:'Provide "flow": a flow name or id.'},!0);let c=await aR(b);if(!c)return aP({error:`No flow named or with id "${b}".`},!0);let d=await k.flowService.deleteFlow(c.id);return d.success?aP({deleted:!0,flowId:c.id,flowName:c.name}):aP({error:d.error??`Failed to delete flow "${c.name}".`},!0)}function aU(a){let b=a.nodes.map(a=>{let{mcpNodes:b,...c}=a.data?.properties??{};return{id:a.id,type:a.type,label:a.data?.label,...a.data?.description?{description:a.data.description}:{},properties:c}}),c=a.edges.map(a=>{let b=a.data;return{from:a.source,to:a.target,type:b?.edgeType==="mcp"?"mcp":b?.edgeType==="resource"?"resource":"control",...b?.bidirectional?{bidirectional:!0}:{}}});return{id:a.id,name:a.name,...a.description?{description:a.description}:{},nodes:b,edges:c}}async function aV(a){let b=String(a?.flow??"").trim();if(!b)return aP({error:'Provide "flow": a flow name or id.'},!0);let c=await aR(b);return c?aP({...aU(c),note:"This is the compiled flow (node ids, not FlowSpec keys). To change it, author a fresh FlowSpec and call update_flow — it replaces the whole definition while keeping this flow id."}):aP({error:`No flow named or with id "${b}". Use list_flow_building_blocks to see the available flows.`},!0)}async function aW(a){let b=String(a?.flow??"").trim();if(!b)return aP({error:'Provide "flow": a flow name or id.'},!0);let c=await aR(b);if(!c)return aP({error:`No flow named or with id "${b}".`},!0);let d=await k.flowService.listFlowVersions(c.id);return aP({flowId:c.id,flowName:c.name,versions:d,...0===d.length?{note:"No archived versions yet — versions appear once the flow's definition is overwritten for the first time."}:{}})}async function aX(a){let b=String(a?.flow??"").trim(),c=String(a?.version??"").trim();if(!b||!c)return aP({error:'Provide "flow" (name or id) and "version" (see list_flow_versions).'},!0);let d=await aR(b);if(!d)return aP({error:`No flow named or with id "${b}".`},!0);let e=await k.flowService.getFlowVersion(d.id,c);return e?aP({versionId:e.versionId,savedAt:e.savedAt,...aU(e.flow)}):aP({error:`No version "${c}" of flow "${d.name}". Use list_flow_versions to see the archived versions.`},!0)}async function aY(a){let b=String(a?.flow??"").trim(),c=String(a?.version??"").trim();if(!b||!c)return aP({error:'Provide "flow" (name or id) and "version" (see list_flow_versions).'},!0);let d=await aR(b);if(!d)return aP({error:`No flow named or with id "${b}".`},!0);let e=await k.flowService.revertFlow(d.id,c);return e.success?aP({reverted:!0,flowId:d.id,versionId:c,note:"The definition that was just replaced has been archived too, so this revert can itself be undone via list_flow_versions / revert_flow."}):aP({error:e.error??`Failed to revert flow "${d.name}".`},!0)}async function aZ(a){let b=String(a?.flow??"").trim();if(!b)return aP({error:'Provide "flow": the name or id of the flow to replace.'},!0);let c=function(a){let b=a?.spec;if("string"==typeof b)try{return JSON.parse(b)}catch{return null}return b??null}(a);if(!c)return aP({error:'Provide a "spec" argument: a FlowSpec object (or a JSON string of one).'},!0);let d=await aR(b);if(!d)return aP({error:`No flow named or with id "${b}". Use list_flow_building_blocks to see the available flows.`},!0);let e=await H(c,{save:!0,updateFlowId:d.id});return e.success?aP({flowId:e.flow.id,flowName:e.flow.name,nodeCount:e.flow.nodes.length,edgeCount:e.flow.edges.length,validation:e.validation,saved:e.saved,...e.saved?{note:`Flow "${e.flow.name}" was replaced (id ${e.flow.id} kept — existing references keep working).`}:{note:"NOT saved: validation found errors. The existing flow is unchanged. Fix the issues and call update_flow again."}},!e.saved):aP({error:e.error,issues:e.issues??[]},!0)}async function a$(a){let b=await a.loadServerConfigs();return Array.isArray(b)?aP(await Promise.all(b.map(async b=>{let c="unknown";try{c=(await a.getServerStatus(b.name)).status}catch(a){aO.debug(`list_mcp_servers: getServerStatus failed for ${b.name}`,a)}return{name:b.name,transport:b.transport,enabled:!b.disabled,status:c,...b.builtIn?{builtIn:!0}:{}}}))):aP({error:b.error??"Failed to load server configs."},!0)}async function a_(a,b){let c=String(b?.server??"").trim();if(!c)return aP({error:'Provide "server": a FLUJO server name.'},!0);if(c===aN._)return aP(aQ().map(a=>({name:a.name,description:a.description,inputSchema:a.inputSchema})));let{tools:d,error:e}=await a.listServerTools(c);return e?aP({error:e},!0):aP(d.map(a=>({name:a.name,description:a.description,inputSchema:a.inputSchema})))}async function a0(a,b){let c=String(b?.server??"").trim(),d=String(b?.tool??"").trim();if(!c||!d)return aP({error:'Provide "server" and "tool".'},!0);if(c===aN._)return aP({error:`"${aN._}" is this server — call its tools directly instead of through call_mcp_tool.`},!0);let e=b?.args&&"object"==typeof b.args&&!Array.isArray(b.args)?b.args:{},f="number"==typeof b?.timeout?b.timeout:void 0,g=await a.callTool(c,d,e,f);if(!g.success)return aP({error:g.error??`Tool call failed on ${c}.`},!0);let h=g.data;return h&&Array.isArray(h.content)?h:aP(h??{ok:!0})}async function a1(a,b){let c=String(b?.server??"").trim();if(!c)return aP({error:'Provide "server": a FLUJO server name.'},!0);if(c===aN._)return aP({ok:!0,note:`"${aN._}" is the built-in server — it is always running.`});let d=await a.forceReconnect(c);if(!d.success)return aP({error:d.error??`Failed to restart ${c}.`},!0);let e=await a.getServerStatus(c);return aP({restarted:!0,server:c,status:e.status})}async function a2(a,b){let c=String(b?.server??"").trim(),d=b?.enabled;if(!c||"boolean"!=typeof d)return aP({error:'Provide "server" (string) and "enabled" (boolean).'},!0);if(c===aN._)return aP({error:`The built-in "${aN._}" server cannot be disabled.`},!0);let e=await a.updateServerConfig(c,{disabled:!d});return"error"in e?aP({error:e.error},!0):aP({server:c,enabled:d})}async function a3(){return aP((await l.modelService.loadModels()).map(a=>({id:a.id,name:a.name,...a.displayName?{displayName:a.displayName}:{},...a.description?{description:a.description}:{},...a.provider?{provider:a.provider}:{},...a.baseUrl?{baseUrl:a.baseUrl}:{},...a.contextWindow?{contextWindow:a.contextWindow}:{}})))}async function a4(){return aP((await (0,m.z)().list()).map(({execution:a,status:b,lastRun:c})=>({id:a.id,name:a.name,enabled:a.enabled,flowId:a.flowId,triggerType:a.trigger?.type,armed:b?.armed??!1,...c?{lastRun:{status:c.status,firedAt:c.firedAt,...c.error?{error:c.error}:{}}}:{}})))}async function a5(a){let b=String(a?.id??"").trim();if(!b)return aP({error:'Provide "id": a planned execution id (see list_planned_executions).'},!0);let{record:c,error:d}=await (0,m.z)().runNow(b);return d||!c?aP({error:d??"Run failed."},!0):aP({runId:c.runId,status:c.status,firedAt:c.firedAt,...c.finishedAt?{finishedAt:c.finishedAt}:{},...c.outputText?{outputText:c.outputText}:{},...c.error?{error:c.error}:{}})}async function a6(a){let b,c=f().join((0,O.ok)(),"db","conversations");try{b=await g.promises.readdir(c)}catch(a){if("ENOENT"===a.code)return aP([]);return aP({error:`Failed to list conversations: ${a instanceof Error?a.message:String(a)}`},!0)}let d=(await Promise.all(b.filter(a=>a.endsWith(".json")).map(async a=>{try{let b=await g.promises.readFile(f().join(c,a),"utf-8"),d=JSON.parse(b),e=d.conversationId||a.replace(/\.json$/,""),h=d.status;return"running"===h&&0===N.$.currentSeq(e)&&(h="error"),{id:e,title:d.title||"Untitled Conversation",flowId:d.flowId||null,...h?{status:h}:{},createdAt:d.createdAt||0,updatedAt:d.updatedAt||0}}catch(b){return aO.warn(`list_conversations: skipping unreadable conversation file ${a}`,b),null}}))).filter(a=>null!==a).sort((a,b)=>b.updatedAt-a.updatedAt),e="number"==typeof a?.limit&&a.limit>0?Math.floor(a.limit):void 0;return aP(e?d.slice(0,e):d)}async function a7(a){let b=String(a?.conversation??"").trim();if(!b)return aP({error:'Provide "conversation": a conversation id (see list_conversations).'},!0);await (0,K.u8)(b);let c=await M(b);if(!c)return aP({error:`No conversation with id "${b}". Use list_conversations to see the stored conversations.`},!0);let d=await (0,K.Os)(b),e=d?(0,K.cc)(d):[],f=e.length>0?e:(c.messages||[]).filter(a=>"system"!==a.role),g="number"==typeof a?.limit&&a.limit>0?Math.floor(a.limit):50,h=[],i=0;for(let a=f.length-1;a>=0&&h.length<g;a--){let b=function(a){let b="";"string"==typeof a.content?b=a.content:Array.isArray(a.content)&&(b=a.content.map(a=>"text"in a&&"string"==typeof a.text?a.text:"").filter(Boolean).join("\n"));let c={role:a.role,...b?{content:b}:{},...a.timestamp?{timestamp:a.timestamp}:{},...a.depth?{depth:a.depth}:{}};return"assistant"===a.role&&Array.isArray(a.tool_calls)&&a.tool_calls.length>0&&(c.toolCalls=a.tool_calls.map(a=>{let b="function"in a?a.function:void 0,c=b&&"string"==typeof b.arguments?b.arguments:void 0;return{id:a.id,...b?.name?{name:b.name}:{},...void 0!==c?{arguments:c.length>2e3?c.slice(0,2e3)+"…[truncated]":c}:{}}})),"tool"===a.role&&a.tool_call_id&&(c.toolCallId=a.tool_call_id),c}(f[a]),c=JSON.stringify(b).length;if(h.length>0&&i+c>1e5)break;h.push(b),i+=c}return h.reverse(),aP({id:c.conversationId||b,title:c.title||"Untitled Conversation",flowId:c.flowId||null,...c.status?{status:c.status}:{},createdAt:c.createdAt||0,updatedAt:c.updatedAt||0,totalMessages:f.length,...h.length<f.length?{note:`Returning the ${h.length} most recent of ${f.length} messages — raise "limit" to get more.`}:{},messages:h})}async function a8(a){let b=String(a?.command??"").trim();if(!b)return aP({error:'Provide "command": a shell command line to run.'},!0);let c=(0,O.ok)(),d="string"==typeof a?.cwd?a.cwd.trim():"",e=d?f().isAbsolute(d)?d:f().join(c,d):c,g=Math.min(1e3*("number"==typeof a?.timeout&&a.timeout>0?a.timeout:60),6e5);return await new Promise(a=>{let c,d,f="",i=!1,k=!1,l=!1,m=a=>{!i&&(f+=a).length>1e5&&(f=f.slice(0,1e5)+"\n…[output truncated]",i=!0)},n="win32"!==process.platform;try{c=(0,h.spawn)(b,{cwd:e,shell:!0,env:process.env,detached:n})}catch(b){a(aP({error:`Failed to start command: ${b instanceof Error?b.message:String(b)}`,cwd:e},!0));return}let o=setTimeout(()=>{l=!0,d=function(a,b=2e3){let c=a.pid;if(void 0===c)return()=>{};if("win32"===process.platform){try{(0,h.spawn)("taskkill",["/pid",String(c),"/T","/F"]).on("error",a=>j.debug(`taskkill failed for pid ${c}: ${a.message}`))}catch(a){j.debug(`taskkill spawn threw for pid ${c}: ${a instanceof Error?a.message:String(a)}`)}return()=>{}}try{process.kill(-c,"SIGTERM")}catch{}let d=setTimeout(()=>{try{process.kill(-c,"SIGKILL")}catch{}},b);return d.unref?.(),()=>clearTimeout(d)}(c)},g),p=b=>{k||(k=!0,clearTimeout(o),d?.(),a(b))};c.stdout?.on("data",a=>m(a.toString())),c.stderr?.on("data",a=>m(a.toString())),c.on("error",a=>{m(`
69
+ ${a.message}`),p(aP({error:`Command failed to start: ${a.message}`,cwd:e,output:f},!0))}),c.on("close",a=>{if(l)return void p(aP({timedOut:!0,cwd:e,exitCode:a,output:`${f}
70
+ [killed after ${g/1e3}s timeout]`},!0));p(aP({exitCode:a,cwd:e,output:f},0!==a))})})}async function a9(a,b,c){try{if(aJ.includes(b))return await aM(b,c);switch(b){case"execute_flow":return await aS(c);case"read_flow":return await aV(c);case"update_flow":return await aZ(c);case"list_flow_versions":return await aW(c);case"read_flow_version":return await aX(c);case"revert_flow":return await aY(c);case"delete_flow":return await aT(c);case"list_mcp_servers":return await a$(a);case"list_mcp_server_tools":return await a_(a,c);case"call_mcp_tool":return await a0(a,c);case"restart_mcp_server":return await a1(a,c);case"set_mcp_server_enabled":return await a2(a,c);case"list_models":return await a3();case"list_planned_executions":return await a4();case"run_planned_execution":return await a5(c);case"list_conversations":return await a6(c);case"read_conversation":return await a7(c);case"terminal":return await a8(c);default:return aP({error:`Unknown tool on the built-in FLUJO server: ${b}`},!0)}}catch(a){return aO.error("internalCallTool failed",{toolName:b,err:a}),aP({error:`Tool failed: ${a instanceof Error?a.message:String(a)}`},!0)}}}};
@@ -0,0 +1 @@
1
+ "use strict";exports.id=4671,exports.ids=[4671],exports.modules={84671:(a,b,c)=>{c.d(b,{nC:()=>l});var d=c(49181),e=c(45131),f=c(41527);function g(a){return a.data?.type??a.type??"unknown"}function h(a){return a.data?.label||a.id}function i(a){return a.data?.edgeType==="mcp"}function j(a){return a.data?.edgeType==="resource"}function k(a){return i(a)||j(a)}function l(a,b={}){let c=[],m=Array.isArray(a?.nodes)?a.nodes:[],n=Array.isArray(a?.edges)?a.edges:[],o=(a,b,d,e)=>c.push({severity:a,code:b,message:d,nodeId:e?.id,nodeLabel:e?h(e):void 0}),p=new Map((b.models??[]).map(a=>[a.id,a])),q=new Map((b.servers??[]).map(a=>[a.name,a])),r=!!b.models,s=!!b.servers,t=m.filter(a=>"start"===g(a)),u=m.filter(a=>"finish"===g(a)),v=m.filter(a=>"process"===g(a)),w=m.filter(a=>"mcp"===g(a));if(0===t.length)o("error","no-start-node","The flow has no Start node, so it has no entry point.");else if(t.length>1)for(let a of t.slice(1))o("error","multiple-start-nodes","The flow has more than one Start node; only one is allowed.",a);for(let a of(0===u.length&&o("warning","no-finish-node","The flow has no Finish node; it will run but never reaches a defined end."),v)){let b=a.data?.properties??{},c=b.boundModel;if(c){if(r&&!p.has(c)){let c="string"==typeof b.modelName&&b.modelName?` (was "${b.modelName}")`:"";o("error","process-model-missing",`Process node "${h(a)}" is bound to a model that no longer exists${c}.`,a)}}else o("error","process-missing-model",`Process node "${h(a)}" has no model bound.`,a)}for(let a of w){let b=(a.data?.properties??{}).boundServer;if(b){if(s&&!q.has(b))o("warning","mcp-server-missing",`MCP node "${h(a)}" is bound to server "${b}", which isn't in your current MCP server list. It may be offline (e.g. not connected), renamed, or removed — if it was renamed or removed, rebind this node.`,a);else if(s){let c=q.get(b);if(c.status&&"connected"!==c.status){let d="disabled"===c.status?"disabled":`not connected (${c.status})`;o("warning","mcp-server-disconnected",`MCP node "${h(a)}" is bound to server "${b}", which is currently ${d}. It will provide tools again once it reconnects.`,a)}}}else o("warning","mcp-missing-server",`MCP node "${h(a)}" is not bound to a server.`,a);n.some(b=>i(b)&&(b.source===a.id||b.target===a.id))||o("warning","mcp-node-unconnected",`MCP node "${h(a)}" is not connected to any Process node.`,a)}for(let a of m.filter(a=>"resource"===g(a))){let b=a.data?.properties??{},c="run"===b.scope?"run":"mcp",d="string"==typeof b.boundServer?b.boundServer:"",e="string"==typeof b.uri?b.uri:"",g="string"==typeof b.runName?b.runName.trim():"";"mcp"!==c||d&&e||o("warning","resource-missing-binding",`Resource node "${h(a)}" has no ${!d?"server":"resource URI"} bound; connected steps will receive nothing.`,a),"run"!==c||g||o("warning","resource-missing-binding",`Resource node "${h(a)}" is a run artifact with no name; give it a name so steps can produce/consume it.`,a),"run"===c&&g&&!(0,f.qW)(g)&&o("warning","resource-run-name",`Resource node "${h(a)}" is named "${g}", which is not a valid artifact name (letters, digits, _ and - only, not starting with a digit); it will be awkward to reference with \${res:...}.`,a),"mcp"===c&&d&&s&&!q.has(d)&&o("warning","resource-server-missing",`Resource node "${h(a)}" is bound to server "${d}", which isn't in your current MCP server list.`,a);let i=n.filter(b=>j(b)&&(b.source===a.id||b.target===a.id));0===i.length&&o("warning","resource-node-unconnected",`Resource node "${h(a)}" is not connected to any Process node.`,a);let k=i.filter(b=>b.target===a.id);"mcp"===c&&k.length>0&&o("error","resource-produce-static",`Resource node "${h(a)}" is a static MCP resource, but a step writes INTO it. Only run artifacts (scope "run") can be produced by a step — flip the edge or make this a run artifact.`,a),"run"===c&&k.length>1&&o("warning","resource-multiple-producers",`Resource node "${h(a)}" is produced by ${k.length} steps; the last writer wins. Consider one producer per artifact.`,a),"run"===c&&0===k.length&&i.length>0&&o("warning","resource-consumed-never-produced",`Resource node "${h(a)}" is consumed but no step in this flow produces it; it resolves to nothing unless an earlier run captured it.`,a)}if(t.length>0){let a=function(a){let b=new Map,c=(a,c)=>{b.has(a)||b.set(a,[]),b.get(a).push(c)};for(let b of a)!k(b)&&(c(b.source,b.target),b.data?.bidirectional&&c(b.target,b.source));return b}(n);for(let b of t)a.get(b.id)?.length||o("error","start-no-outgoing","The Start node is not connected to anything; the flow cannot run.",b);let b=function(a,b){let c=new Set(a),d=[...a];for(;d.length;){let a=d.shift();for(let e of b.get(a)??[])c.has(e)||(c.add(e),d.push(e))}return c}(t.map(a=>a.id),a);for(let a of[...v,...u])b.has(a.id)||o("warning","unreachable-node",`${"finish"===g(a)?"Finish":"Process"} node "${h(a)}" is not reachable from the Start node.`,a)}for(let a of m.filter(a=>"subflow"===g(a))){let b=n.filter(b=>!k(b)&&(b.source===a.id||b.target===a.id&&!!b.data?.bidirectional));b.length>1&&o("error","subflow-multiple-outgoing",`Subflow node "${h(a)}" has ${b.length} outgoing connections; a subflow can only have one (either A > B > C or a bidirectional A <> B).`,a);let c=a.data?.properties??{},d="string"==typeof c.subflowId&&c.subflowId?c.subflowId:void 0,e=Array.isArray(c.parallelSubflowIds)?c.parallelSubflowIds.filter(a=>"string"==typeof a&&!!a):[];d&&e.length>0&&o("error","subflow-both-targets",`Subflow node "${h(a)}" sets both a single "subflowId" and "parallelSubflowIds"; use one or the other.`,a);let f=!0===c.mapOverList;if(f&&e.length>0&&o("error","subflow-map-and-parallel",`Subflow node "${h(a)}" combines "mapOverList" with "parallelSubflowIds"; map-over-list runs a single child once per item and cannot be combined with parallel fan-out.`,a),f&&!d&&0===e.length&&o("error","subflow-map-no-child",`Subflow node "${h(a)}" has "mapOverList" but no child flow ("subflowId"); select a flow to run once per item.`,a),e.length>0){let b=c.concurrencyLimit;"number"==typeof b&&b<1&&o("warning","subflow-concurrency-limit",`Subflow node "${h(a)}" has a concurrencyLimit of ${b}; it must be at least 1 (the runtime default will be used).`,a)}}{let a=new Map(m.map(a=>[a.id,a])),b=new Set;for(let c of n){if(k(c))continue;let d=c.data?.condition;if(!d||"object"!=typeof d)continue;let f=a.get(c.source),i=f?g(f):"unknown";if("process"!==i){o("error","edge-condition-non-process",`An edge leaving ${"unknown"===i?"an unknown":`the ${i}`} node "${f?h(f):c.source}" has a routing condition, but only process nodes can route on a condition.`,f??void 0);continue}b.add(c.source),(0,e.C)(d.kind)?"string"!=typeof d.value||0===d.value.length?o("warning","edge-condition-value",`Process node "${h(f)}" has an outgoing edge condition with no "value"; it will never match.`,f):"regex"!==d.kind||(0,e.wM)(d.value)||o("warning","edge-condition-regex",`Process node "${h(f)}" has an outgoing edge with a regex condition that does not compile; it will never match.`,f):o("warning","edge-condition-kind",`Process node "${h(f)}" has an outgoing edge whose condition kind "${String(d.kind)}" is unknown; it will never match.`,f)}for(let c of b){let b=a.get(c);b&&(n.some(a=>!k(a)&&(a.source===c?!a.data?.condition:!!(a.target===c&&a.data?.bidirectional)))||o("warning","edge-condition-no-fallback",`Process node "${h(b)}" has conditioned outgoing edges but no bare fallback edge; if no condition matches, the flow ends here.`,b))}}{let a=new Set;for(let b of m){let c=b.data?.properties?.captureVariable;if("string"==typeof c&&c.trim()){let d=c.trim();a.add(d),(0,f.qW)(d)||o("warning","capture-var-name",`${"subflow"===g(b)?"Subflow":"Process"} node "${h(b)}" captures into "${d}", which is not a valid variable name (letters, digits, _ and - only, not starting with a digit); it will be awkward to reference with \${var:...}.`,b)}}let b=["promptTemplate","isolatedPrompt"],c=new Set;for(let d of m){let e=d.data?.properties??{};for(let g of b){let b=e[g];if("string"==typeof b&&b)for(let e of(0,f.T9)(b)){if(a.has(e))continue;let b=`${d.id}:${e}`;c.has(b)||(c.add(b),o("warning","var-ref-uncaptured",`${h(d)} references \${var:${e}} but no step in this flow captures "${e}" (via captureVariable). It resolves to empty unless supplied as a run input — check for a typo or a step ordered after this one.`,d))}}}}for(let a of v){let c=a.data?.properties?.promptTemplate;if("string"!=typeof c||!c)continue;let e=function(a,b,c){let d=new Map(b.map(a=>[a.id,a])),e=new Set;for(let b of c){if(!i(b))continue;let c=null;if(b.source===a?c=b.target:b.target===a&&(c=b.source),!c)continue;let f=d.get(c);if(!f||"mcp"!==g(f))continue;let h=f.data?.properties?.boundServer;"string"==typeof h&&h&&e.add(h)}return e}(a.id,m,n),f=new Set;for(let g of(0,d.A$)(c)){if("handoff"===g.server)continue;let c=`${g.kind}:${g.server}:${g.name}`;!f.has(c)&&(f.add(c),e.has(g.server)?"tool"===g.kind&&b.serverTools&&b.serverTools[g.server]&&!b.serverTools[g.server].includes(g.name)&&o("warning","tool-unavailable",`Process node "${h(a)}" references tool "${g.name}" which server "${g.server}" no longer provides.`,a):o("error","tool-pill-disconnected",`Process node "${h(a)}" references ${g.kind} "${g.name}" from server "${g.server}", but it is not connected to that server (the MCP node was removed or the server was renamed).`,a))}}let x=c.filter(a=>"error"===a.severity).length,y=c.length-x;return{issues:c,errorCount:x,warningCount:y,isRunnable:0===x}}}};