@hotmeshio/long-tail 0.1.13 → 0.1.15

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 (424) hide show
  1. package/README.md +15 -0
  2. package/build/api/escalations/bulk.d.ts +78 -0
  3. package/build/api/escalations/bulk.js +279 -0
  4. package/build/api/escalations/claim.d.ts +30 -0
  5. package/build/api/escalations/claim.js +121 -0
  6. package/build/api/escalations/create.d.ts +29 -0
  7. package/build/api/escalations/create.js +101 -0
  8. package/build/api/escalations/helpers.d.ts +10 -0
  9. package/build/api/escalations/helpers.js +80 -0
  10. package/build/api/escalations/index.d.ts +6 -0
  11. package/build/api/escalations/index.js +26 -0
  12. package/build/api/escalations/list.d.ts +75 -0
  13. package/build/api/escalations/list.js +170 -0
  14. package/build/api/escalations/resolve.d.ts +18 -0
  15. package/build/api/escalations/resolve.js +243 -0
  16. package/build/api/escalations/single.d.ts +37 -0
  17. package/build/api/escalations/single.js +123 -0
  18. package/build/api/files.d.ts +16 -0
  19. package/build/api/files.js +61 -0
  20. package/build/api/knowledge.d.ts +36 -0
  21. package/build/api/knowledge.js +112 -0
  22. package/build/api/mcp/index.d.ts +2 -0
  23. package/build/api/mcp/index.js +16 -0
  24. package/build/api/{mcp.d.ts → mcp/servers.d.ts} +1 -33
  25. package/build/api/{mcp.js → mcp/servers.js} +4 -65
  26. package/build/api/mcp/tools.d.ts +33 -0
  27. package/build/api/mcp/tools.js +64 -0
  28. package/build/api/mcp-runs.d.ts +2 -0
  29. package/build/api/mcp-runs.js +2 -0
  30. package/build/api/settings.js +9 -1
  31. package/build/api/workflow-sets.d.ts +11 -0
  32. package/build/api/workflow-sets.js +62 -0
  33. package/build/api/workflows/config.d.ts +64 -0
  34. package/build/api/workflows/config.js +142 -0
  35. package/build/api/workflows/discovery.d.ts +29 -0
  36. package/build/api/workflows/discovery.js +153 -0
  37. package/build/api/workflows/index.d.ts +3 -0
  38. package/build/api/workflows/index.js +18 -0
  39. package/build/api/workflows/invocation.d.ts +67 -0
  40. package/build/api/workflows/invocation.js +188 -0
  41. package/build/api/yaml-workflows/cron.d.ts +39 -0
  42. package/build/api/yaml-workflows/cron.js +127 -0
  43. package/build/api/{yaml-workflows.d.ts → yaml-workflows/crud.d.ts} +22 -137
  44. package/build/api/{yaml-workflows.js → yaml-workflows/crud.js} +86 -358
  45. package/build/api/yaml-workflows/deploy.d.ts +71 -0
  46. package/build/api/yaml-workflows/deploy.js +223 -0
  47. package/build/api/yaml-workflows/helpers.d.ts +2 -0
  48. package/build/api/yaml-workflows/helpers.js +8 -0
  49. package/build/api/yaml-workflows/index.d.ts +4 -0
  50. package/build/api/yaml-workflows/index.js +27 -0
  51. package/build/api/yaml-workflows/versions.d.ts +43 -0
  52. package/build/api/yaml-workflows/versions.js +124 -0
  53. package/build/bin/ltc.d.ts +2 -0
  54. package/build/bin/ltc.js +220 -0
  55. package/build/examples/seed-data.d.ts +55 -0
  56. package/build/examples/seed-data.js +161 -0
  57. package/build/examples/seed.js +7 -164
  58. package/build/lib/cli/auth.d.ts +23 -0
  59. package/build/lib/cli/auth.js +167 -0
  60. package/build/lib/cli/client.d.ts +6 -0
  61. package/build/lib/cli/client.js +31 -0
  62. package/build/lib/cli/commands/escalations.d.ts +19 -0
  63. package/build/lib/cli/commands/escalations.js +69 -0
  64. package/build/lib/cli/commands/knowledge.d.ts +18 -0
  65. package/build/lib/cli/commands/knowledge.js +87 -0
  66. package/build/lib/cli/commands/mcp.d.ts +8 -0
  67. package/build/lib/cli/commands/mcp.js +33 -0
  68. package/build/lib/cli/commands/pipelines.d.ts +16 -0
  69. package/build/lib/cli/commands/pipelines.js +67 -0
  70. package/build/lib/cli/commands/status.d.ts +1 -0
  71. package/build/lib/cli/commands/status.js +28 -0
  72. package/build/lib/cli/commands/users.d.ts +7 -0
  73. package/build/lib/cli/commands/users.js +25 -0
  74. package/build/lib/cli/commands/workflows.d.ts +16 -0
  75. package/build/lib/cli/commands/workflows.js +104 -0
  76. package/build/lib/cli/compile.d.ts +2 -0
  77. package/build/lib/cli/compile.js +165 -0
  78. package/build/lib/cli/format.d.ts +23 -0
  79. package/build/lib/cli/format.js +94 -0
  80. package/build/lib/cli/init.d.ts +1 -0
  81. package/build/lib/cli/init.js +61 -0
  82. package/build/lib/cli/output.d.ts +27 -0
  83. package/build/lib/cli/output.js +126 -0
  84. package/build/lib/cli/scanner.d.ts +10 -0
  85. package/build/lib/cli/scanner.js +164 -0
  86. package/build/lib/cli/types.d.ts +16 -0
  87. package/build/lib/cli/types.js +2 -0
  88. package/build/lib/logger/index.d.ts +0 -9
  89. package/build/lib/logger/index.js +9 -4
  90. package/build/lib/storage/index.js +2 -2
  91. package/build/lib/storage/local.d.ts +15 -0
  92. package/build/lib/storage/local.js +63 -0
  93. package/build/lib/storage/mime.d.ts +4 -0
  94. package/build/lib/storage/mime.js +31 -0
  95. package/build/lib/storage/s3.d.ts +16 -0
  96. package/build/lib/storage/s3.js +70 -0
  97. package/build/lib/storage/types.d.ts +18 -0
  98. package/build/modules/utils.d.ts +73 -0
  99. package/build/modules/utils.js +84 -0
  100. package/build/routes/file-browser.d.ts +2 -0
  101. package/build/routes/file-browser.js +126 -0
  102. package/build/routes/files.js +25 -17
  103. package/build/routes/index.js +4 -0
  104. package/build/routes/knowledge.d.ts +2 -0
  105. package/build/routes/knowledge.js +141 -0
  106. package/build/routes/mcp-runs.js +2 -0
  107. package/build/routes/workflow-sets.js +9 -0
  108. package/build/routes/yaml-workflows/crud.js +9 -0
  109. package/build/routes/yaml-workflows/deployment.js +8 -0
  110. package/build/sdk/index.d.ts +17 -0
  111. package/build/sdk/index.js +19 -0
  112. package/build/services/insight/index.d.ts +13 -0
  113. package/build/services/insight/index.js +4 -7
  114. package/build/services/insight/prompts.d.ts +1 -1
  115. package/build/services/insight/prompts.js +1 -1
  116. package/build/services/mcp/client/connection-dispatch.d.ts +18 -0
  117. package/build/services/mcp/client/connection-dispatch.js +78 -0
  118. package/build/services/mcp/client/connection-lifecycle.d.ts +48 -0
  119. package/build/services/mcp/client/connection-lifecycle.js +296 -0
  120. package/build/services/mcp/client/connection-test.d.ts +10 -0
  121. package/build/services/mcp/client/connection-test.js +49 -0
  122. package/build/services/mcp/client/connection.d.ts +3 -68
  123. package/build/services/mcp/client/connection.js +15 -393
  124. package/build/services/mcp/server-lifecycle.d.ts +27 -0
  125. package/build/services/mcp/server-lifecycle.js +49 -0
  126. package/build/services/mcp/server-tools.d.ts +13 -0
  127. package/build/services/mcp/server-tools.js +287 -0
  128. package/build/services/mcp/server.d.ts +2 -26
  129. package/build/services/mcp/server.js +7 -315
  130. package/build/services/mcp-runs/queries.d.ts +2 -0
  131. package/build/services/mcp-runs/queries.js +11 -1
  132. package/build/services/mcp-runs/sql.d.ts +1 -1
  133. package/build/services/mcp-runs/sql.js +2 -2
  134. package/build/services/workflow-sets/db.d.ts +1 -0
  135. package/build/services/workflow-sets/db.js +6 -0
  136. package/build/services/workflow-sets/index.d.ts +1 -1
  137. package/build/services/workflow-sets/index.js +2 -1
  138. package/build/services/workflow-sets/sql.d.ts +1 -0
  139. package/build/services/workflow-sets/sql.js +6 -1
  140. package/build/services/yaml-workflow/builder-regenerate.d.ts +25 -0
  141. package/build/services/yaml-workflow/builder-regenerate.js +111 -0
  142. package/build/services/yaml-workflow/db-versions.d.ts +17 -0
  143. package/build/services/yaml-workflow/db-versions.js +76 -0
  144. package/build/services/yaml-workflow/db.d.ts +14 -12
  145. package/build/services/yaml-workflow/db.js +32 -70
  146. package/build/services/yaml-workflow/deployer-helpers.js +48 -17
  147. package/build/services/yaml-workflow/durable-compiler/index.d.ts +22 -0
  148. package/build/services/yaml-workflow/durable-compiler/index.js +168 -0
  149. package/build/services/yaml-workflow/durable-compiler/parser.d.ts +12 -0
  150. package/build/services/yaml-workflow/durable-compiler/parser.js +110 -0
  151. package/build/services/yaml-workflow/durable-compiler/prompts.d.ts +18 -0
  152. package/build/services/yaml-workflow/durable-compiler/prompts.js +570 -0
  153. package/build/services/yaml-workflow/durable-compiler/types.d.ts +51 -0
  154. package/build/services/yaml-workflow/durable-compiler/types.js +5 -0
  155. package/build/services/yaml-workflow/generator.js +4 -4
  156. package/build/services/yaml-workflow/pipeline/build/dag-assembly.d.ts +17 -0
  157. package/build/services/yaml-workflow/pipeline/build/dag-assembly.js +192 -0
  158. package/build/services/yaml-workflow/pipeline/build/dag.d.ts +4 -13
  159. package/build/services/yaml-workflow/pipeline/build/dag.js +9 -185
  160. package/build/services/yaml-workflow/pipeline/build/index.d.ts +2 -1
  161. package/build/services/yaml-workflow/pipeline/build/index.js +3 -2
  162. package/build/services/yaml-workflow/pipeline/build/utils.d.ts +0 -2
  163. package/build/services/yaml-workflow/pipeline/build/utils.js +0 -8
  164. package/build/services/yaml-workflow/pipeline/prompt-templates.d.ts +10 -0
  165. package/build/services/yaml-workflow/pipeline/prompt-templates.js +270 -0
  166. package/build/services/yaml-workflow/pipeline/prompts.d.ts +3 -6
  167. package/build/services/yaml-workflow/pipeline/prompts.js +8 -263
  168. package/build/services/yaml-workflow/sql.d.ts +2 -1
  169. package/build/services/yaml-workflow/sql.js +10 -3
  170. package/build/start/workers.js +6 -5
  171. package/build/system/activities/file-storage.d.ts +4 -0
  172. package/build/system/activities/file-storage.js +7 -1
  173. package/build/system/activities/knowledge.d.ts +23 -0
  174. package/build/system/activities/knowledge.js +50 -10
  175. package/build/system/activities/schema-exchange.d.ts +50 -0
  176. package/build/system/activities/schema-exchange.js +210 -0
  177. package/build/system/activities/sql.d.ts +4 -1
  178. package/build/system/activities/sql.js +37 -2
  179. package/build/system/index.js +1 -0
  180. package/build/system/mcp-servers/file-storage.js +3 -1
  181. package/build/system/mcp-servers/human-queue-schemas.d.ts +91 -0
  182. package/build/system/mcp-servers/human-queue-schemas.js +42 -0
  183. package/build/system/mcp-servers/human-queue.d.ts +2 -6
  184. package/build/system/mcp-servers/human-queue.js +9 -51
  185. package/build/system/mcp-servers/knowledge.js +69 -6
  186. package/build/system/mcp-servers/schema-exchange.d.ts +4 -0
  187. package/build/system/mcp-servers/schema-exchange.js +93 -0
  188. package/build/system/mcp-servers/workflow-compiler.js +54 -0
  189. package/build/system/seed/server-definitions.d.ts +112 -1
  190. package/build/system/seed/server-definitions.js +37 -0
  191. package/build/system/seed/tool-manifests-data.d.ts +87 -0
  192. package/build/system/seed/tool-manifests-data.js +37 -1
  193. package/build/system/seed/tool-manifests-knowledge.d.ts +9 -1
  194. package/build/system/seed/tool-manifests-knowledge.js +6 -5
  195. package/build/system/workflows/mcp-triage/activities-proxy.d.ts +21 -0
  196. package/build/system/workflows/mcp-triage/activities-proxy.js +70 -0
  197. package/build/system/workflows/mcp-triage/index.js +17 -75
  198. package/build/system/workflows/mcp-workflow-builder/prompts.d.ts +1 -1
  199. package/build/system/workflows/mcp-workflow-builder/prompts.js +21 -20
  200. package/build/system/workflows/mcp-workflow-planner/activities/persist.d.ts +2 -1
  201. package/build/system/workflows/mcp-workflow-planner/activities/persist.js +4 -3
  202. package/build/system/workflows/mcp-workflow-planner/index.js +41 -5
  203. package/build/system/workflows/mcp-workflow-planner/prompts.d.ts +1 -1
  204. package/build/system/workflows/mcp-workflow-planner/prompts.js +3 -3
  205. package/build/tsconfig.tsbuildinfo +1 -1
  206. package/dashboard/dist/assets/{AdminDashboard-DUrSBQOl.js → AdminDashboard-NLryl1_B.js} +2 -2
  207. package/dashboard/dist/assets/{AdminDashboard-DUrSBQOl.js.map → AdminDashboard-NLryl1_B.js.map} +1 -1
  208. package/dashboard/dist/assets/AvailableEscalationsPage-6vexlrk3.js +2 -0
  209. package/dashboard/dist/assets/AvailableEscalationsPage-6vexlrk3.js.map +1 -0
  210. package/dashboard/dist/assets/{BotPicker-Cg5iNEkm.js → BotPicker-DWhn0tr1.js} +2 -2
  211. package/dashboard/dist/assets/{BotPicker-Cg5iNEkm.js.map → BotPicker-DWhn0tr1.js.map} +1 -1
  212. package/dashboard/dist/assets/{CollapsibleSection-Kd9UIyeU.js → CollapsibleSection-CgYgQiOc.js} +2 -2
  213. package/dashboard/dist/assets/{CollapsibleSection-Kd9UIyeU.js.map → CollapsibleSection-CgYgQiOc.js.map} +1 -1
  214. package/dashboard/dist/assets/{ConfirmDeleteModal-DZMgmlof.js → ConfirmDeleteModal-DCKAPXD3.js} +2 -2
  215. package/dashboard/dist/assets/{ConfirmDeleteModal-DZMgmlof.js.map → ConfirmDeleteModal-DCKAPXD3.js.map} +1 -1
  216. package/dashboard/dist/assets/{CopyableId-cPFTRm8q.js → CopyableId-DXkaAOYk.js} +2 -2
  217. package/dashboard/dist/assets/{CopyableId-cPFTRm8q.js.map → CopyableId-DXkaAOYk.js.map} +1 -1
  218. package/dashboard/dist/assets/CredentialsPage-B361BOfU.js +2 -0
  219. package/dashboard/dist/assets/{CredentialsPage-DJablIbs.js.map → CredentialsPage-B361BOfU.js.map} +1 -1
  220. package/dashboard/dist/assets/{CustomDurationPicker-NgIP6YDW.js → CustomDurationPicker-D2G1ldiF.js} +2 -2
  221. package/dashboard/dist/assets/{CustomDurationPicker-NgIP6YDW.js.map → CustomDurationPicker-D2G1ldiF.js.map} +1 -1
  222. package/dashboard/dist/assets/{DataTable-CTRhTAfT.js → DataTable-DXSUbA26.js} +2 -2
  223. package/dashboard/dist/assets/{DataTable-CTRhTAfT.js.map → DataTable-DXSUbA26.js.map} +1 -1
  224. package/dashboard/dist/assets/{ElapsedCell-HcSJ_MMs.js → ElapsedCell-CQGqkXP_.js} +2 -2
  225. package/dashboard/dist/assets/{ElapsedCell-HcSJ_MMs.js.map → ElapsedCell-CQGqkXP_.js.map} +1 -1
  226. package/dashboard/dist/assets/{EmptyState-joNbd4gg.js → EmptyState-Dep92Wkg.js} +2 -2
  227. package/dashboard/dist/assets/{EmptyState-joNbd4gg.js.map → EmptyState-Dep92Wkg.js.map} +1 -1
  228. package/dashboard/dist/assets/{EscalationsOverview-DpXDnQux.js → EscalationsOverview-DVEFVjs7.js} +2 -2
  229. package/dashboard/dist/assets/{EscalationsOverview-DpXDnQux.js.map → EscalationsOverview-DVEFVjs7.js.map} +1 -1
  230. package/dashboard/dist/assets/{EventTable-CYem3v8n.js → EventTable-BMJAPkMi.js} +2 -2
  231. package/dashboard/dist/assets/{EventTable-CYem3v8n.js.map → EventTable-BMJAPkMi.js.map} +1 -1
  232. package/dashboard/dist/assets/{FilterBar-BiO8SOzc.js → FilterBar-DbVbCzH2.js} +2 -2
  233. package/dashboard/dist/assets/{FilterBar-BiO8SOzc.js.map → FilterBar-DbVbCzH2.js.map} +1 -1
  234. package/dashboard/dist/assets/{ListToolbar-6yRDh2e9.js → ListToolbar-0XNuXj0M.js} +2 -2
  235. package/dashboard/dist/assets/{ListToolbar-6yRDh2e9.js.map → ListToolbar-0XNuXj0M.js.map} +1 -1
  236. package/dashboard/dist/assets/{McpOverview-CUgSxkQe.js → McpOverview-CeYnCzBN.js} +2 -2
  237. package/dashboard/dist/assets/{McpOverview-CUgSxkQe.js.map → McpOverview-CeYnCzBN.js.map} +1 -1
  238. package/dashboard/dist/assets/McpQueryDetailPage-t3qW3QNa.js +5 -0
  239. package/dashboard/dist/assets/McpQueryDetailPage-t3qW3QNa.js.map +1 -0
  240. package/dashboard/dist/assets/McpQueryPage-CfUcdzaj.js +2 -0
  241. package/dashboard/dist/assets/{McpQueryPage-lV6kfDG5.js.map → McpQueryPage-CfUcdzaj.js.map} +1 -1
  242. package/dashboard/dist/assets/McpRunDetailPage-CZtodW_Z.js +2 -0
  243. package/dashboard/dist/assets/McpRunDetailPage-CZtodW_Z.js.map +1 -0
  244. package/dashboard/dist/assets/McpRunsPage-Dzgq7HGt.js +2 -0
  245. package/dashboard/dist/assets/McpRunsPage-Dzgq7HGt.js.map +1 -0
  246. package/dashboard/dist/assets/{Modal-BuTvD0pz.js → Modal-yyhUeKoA.js} +2 -2
  247. package/dashboard/dist/assets/{Modal-BuTvD0pz.js.map → Modal-yyhUeKoA.js.map} +1 -1
  248. package/dashboard/dist/assets/OperatorDashboard-Ceh7OQtZ.js +2 -0
  249. package/dashboard/dist/assets/{OperatorDashboard-C9SSV96T.js.map → OperatorDashboard-Ceh7OQtZ.js.map} +1 -1
  250. package/dashboard/dist/assets/{PageHeader-BcTVF9ul.js → PageHeader-CZ9a8cpr.js} +2 -2
  251. package/dashboard/dist/assets/{PageHeader-BcTVF9ul.js.map → PageHeader-CZ9a8cpr.js.map} +1 -1
  252. package/dashboard/dist/assets/{PageHeaderWithStats-BI7JG5x6.js → PageHeaderWithStats-BJuNs5NM.js} +2 -2
  253. package/dashboard/dist/assets/{PageHeaderWithStats-BI7JG5x6.js.map → PageHeaderWithStats-BJuNs5NM.js.map} +1 -1
  254. package/dashboard/dist/assets/{PriorityBadge-DqVaOU65.js → PriorityBadge-BrPikMFy.js} +2 -2
  255. package/dashboard/dist/assets/{PriorityBadge-DqVaOU65.js.map → PriorityBadge-BrPikMFy.js.map} +1 -1
  256. package/dashboard/dist/assets/{ProcessDetailPage-hFMhf9qa.js → ProcessDetailPage-2miaYd8G.js} +2 -2
  257. package/dashboard/dist/assets/{ProcessDetailPage-hFMhf9qa.js.map → ProcessDetailPage-2miaYd8G.js.map} +1 -1
  258. package/dashboard/dist/assets/{ProcessesListPage-ByVoBCQ3.js → ProcessesListPage-DqpRDqjk.js} +2 -2
  259. package/dashboard/dist/assets/{ProcessesListPage-ByVoBCQ3.js.map → ProcessesListPage-DqpRDqjk.js.map} +1 -1
  260. package/dashboard/dist/assets/{RolePill-D9ZIkYiu.js → RolePill-DxbJMfJu.js} +2 -2
  261. package/dashboard/dist/assets/{RolePill-D9ZIkYiu.js.map → RolePill-DxbJMfJu.js.map} +1 -1
  262. package/dashboard/dist/assets/{RolesPage-SMedMuqa.js → RolesPage-CYHRo21-.js} +2 -2
  263. package/dashboard/dist/assets/{RolesPage-SMedMuqa.js.map → RolesPage-CYHRo21-.js.map} +1 -1
  264. package/dashboard/dist/assets/{RowActions-yDhwwDbU.js → RowActions-DurFwIwe.js} +2 -2
  265. package/dashboard/dist/assets/{RowActions-yDhwwDbU.js.map → RowActions-DurFwIwe.js.map} +1 -1
  266. package/dashboard/dist/assets/RunAsSelector-CNKraP6u.js +2 -0
  267. package/dashboard/dist/assets/RunAsSelector-CNKraP6u.js.map +1 -0
  268. package/dashboard/dist/assets/{StatCard-BrBnQFxh.js → StatCard-CKplpK3w.js} +2 -2
  269. package/dashboard/dist/assets/{StatCard-BrBnQFxh.js.map → StatCard-CKplpK3w.js.map} +1 -1
  270. package/dashboard/dist/assets/{StatusBadge-xgb-lZku.js → StatusBadge-Dm0V1dNN.js} +2 -2
  271. package/dashboard/dist/assets/{StatusBadge-xgb-lZku.js.map → StatusBadge-Dm0V1dNN.js.map} +1 -1
  272. package/dashboard/dist/assets/{StepIndicator-B9ps2SvM.js → StepIndicator-Dicx0WTZ.js} +2 -2
  273. package/dashboard/dist/assets/{StepIndicator-B9ps2SvM.js.map → StepIndicator-Dicx0WTZ.js.map} +1 -1
  274. package/dashboard/dist/assets/{StickyPagination-DTIjBKN3.js → StickyPagination-B2jYvU3-.js} +2 -2
  275. package/dashboard/dist/assets/{StickyPagination-DTIjBKN3.js.map → StickyPagination-B2jYvU3-.js.map} +1 -1
  276. package/dashboard/dist/assets/SwimlaneTimeline-ClwumkT1.js +2 -0
  277. package/dashboard/dist/assets/SwimlaneTimeline-ClwumkT1.js.map +1 -0
  278. package/dashboard/dist/assets/{TagInput-CdNUuqk4.js → TagInput-CypDZ6Kl.js} +2 -2
  279. package/dashboard/dist/assets/{TagInput-CdNUuqk4.js.map → TagInput-CypDZ6Kl.js.map} +1 -1
  280. package/dashboard/dist/assets/{TaskDetailPage-C-nzaNea.js → TaskDetailPage-DooDNJGT.js} +2 -2
  281. package/dashboard/dist/assets/{TaskDetailPage-C-nzaNea.js.map → TaskDetailPage-DooDNJGT.js.map} +1 -1
  282. package/dashboard/dist/assets/{TaskQueuePill-Lvr2-NzS.js → TaskQueuePill-C1hZ-j31.js} +2 -2
  283. package/dashboard/dist/assets/{TaskQueuePill-Lvr2-NzS.js.map → TaskQueuePill-C1hZ-j31.js.map} +1 -1
  284. package/dashboard/dist/assets/{TasksListPage-DSUmD84y.js → TasksListPage-D7CdkAeg.js} +2 -2
  285. package/dashboard/dist/assets/{TasksListPage-DSUmD84y.js.map → TasksListPage-D7CdkAeg.js.map} +1 -1
  286. package/dashboard/dist/assets/{TimeAgo-BZdLdrIh.js → TimeAgo-B5LXB2aj.js} +2 -2
  287. package/dashboard/dist/assets/{TimeAgo-BZdLdrIh.js.map → TimeAgo-B5LXB2aj.js.map} +1 -1
  288. package/dashboard/dist/assets/{TimestampCell-QX_0i5FK.js → TimestampCell-Crb9b0Gw.js} +2 -2
  289. package/dashboard/dist/assets/{TimestampCell-QX_0i5FK.js.map → TimestampCell-Crb9b0Gw.js.map} +1 -1
  290. package/dashboard/dist/assets/{UserName-DyZMXcBm.js → UserName-OPg-nkRa.js} +2 -2
  291. package/dashboard/dist/assets/{UserName-DyZMXcBm.js.map → UserName-OPg-nkRa.js.map} +1 -1
  292. package/dashboard/dist/assets/{WorkflowExecutionPage-DjVxfZaF.js → WorkflowExecutionPage-CcLVrs9b.js} +2 -2
  293. package/dashboard/dist/assets/{WorkflowExecutionPage-DjVxfZaF.js.map → WorkflowExecutionPage-CcLVrs9b.js.map} +1 -1
  294. package/dashboard/dist/assets/WorkflowPill-CCV4MMj7.js +2 -0
  295. package/dashboard/dist/assets/WorkflowPill-CCV4MMj7.js.map +1 -0
  296. package/dashboard/dist/assets/{WorkflowsDashboard-DZjuiFZ0.js → WorkflowsDashboard-DB1SncBi.js} +2 -2
  297. package/dashboard/dist/assets/{WorkflowsDashboard-DZjuiFZ0.js.map → WorkflowsDashboard-DB1SncBi.js.map} +1 -1
  298. package/dashboard/dist/assets/{WorkflowsOverview-CLnLRpOu.js → WorkflowsOverview-DvShiYJV.js} +2 -2
  299. package/dashboard/dist/assets/{WorkflowsOverview-CLnLRpOu.js.map → WorkflowsOverview-DvShiYJV.js.map} +1 -1
  300. package/dashboard/dist/assets/YamlWorkflowsPage-DCBoMeGI.js +2 -0
  301. package/dashboard/dist/assets/YamlWorkflowsPage-DCBoMeGI.js.map +1 -0
  302. package/dashboard/dist/assets/{bots-DIM6lBoY.js → bots-Dqos20NE.js} +2 -2
  303. package/dashboard/dist/assets/{bots-DIM6lBoY.js.map → bots-Dqos20NE.js.map} +1 -1
  304. package/dashboard/dist/assets/{escalation-JOTuOqjq.js → escalation-A0CsbvNV.js} +2 -2
  305. package/dashboard/dist/assets/{escalation-JOTuOqjq.js.map → escalation-A0CsbvNV.js.map} +1 -1
  306. package/dashboard/dist/assets/escalation-columns-BpBJN6k4.js +2 -0
  307. package/dashboard/dist/assets/{escalation-columns-Cyg58nkg.js.map → escalation-columns-BpBJN6k4.js.map} +1 -1
  308. package/dashboard/dist/assets/{helpers-B1BDxBZd.js → helpers-CmznCuAx.js} +2 -2
  309. package/dashboard/dist/assets/{helpers-B1BDxBZd.js.map → helpers-CmznCuAx.js.map} +1 -1
  310. package/dashboard/dist/assets/index-BIeYV5QK.js +2 -0
  311. package/dashboard/dist/assets/index-BIeYV5QK.js.map +1 -0
  312. package/dashboard/dist/assets/index-BYwD3kHN.js +5 -0
  313. package/dashboard/dist/assets/index-BYwD3kHN.js.map +1 -0
  314. package/dashboard/dist/assets/index-C5TUqJu0.css +1 -0
  315. package/dashboard/dist/assets/index-C8-UaN4N.js +2 -0
  316. package/dashboard/dist/assets/{index-Cg5nfiYX.js.map → index-C8-UaN4N.js.map} +1 -1
  317. package/dashboard/dist/assets/index-CAj5LT9H.js +15 -0
  318. package/dashboard/dist/assets/index-CAj5LT9H.js.map +1 -0
  319. package/dashboard/dist/assets/index-CjxHCVxl.js +2 -0
  320. package/dashboard/dist/assets/{index-Cf60K3x9.js.map → index-CjxHCVxl.js.map} +1 -1
  321. package/dashboard/dist/assets/index-Cr0Rqsj7.js +2 -0
  322. package/dashboard/dist/assets/index-Cr0Rqsj7.js.map +1 -0
  323. package/dashboard/dist/assets/index-DZHNte4o.js +2 -0
  324. package/dashboard/dist/assets/{index-Di12t56M.js.map → index-DZHNte4o.js.map} +1 -1
  325. package/dashboard/dist/assets/{index-Ds0JoXS2.js → index-VnYkWW8r.js} +2 -2
  326. package/dashboard/dist/assets/{index-Ds0JoXS2.js.map → index-VnYkWW8r.js.map} +1 -1
  327. package/dashboard/dist/assets/{index-BcR6PfpY.js → index-XGOmZ117.js} +2 -2
  328. package/dashboard/dist/assets/{index-BcR6PfpY.js.map → index-XGOmZ117.js.map} +1 -1
  329. package/dashboard/dist/assets/index-ZjOUzWhc.js +2 -0
  330. package/dashboard/dist/assets/index-ZjOUzWhc.js.map +1 -0
  331. package/dashboard/dist/assets/{index-BYZX9tOb.js → index-puKKZ5l8.js} +77 -77
  332. package/dashboard/dist/assets/index-puKKZ5l8.js.map +1 -0
  333. package/dashboard/dist/assets/{index-BizfauqT.js → index-t5frSddy.js} +4 -4
  334. package/dashboard/dist/assets/{index-BizfauqT.js.map → index-t5frSddy.js.map} +1 -1
  335. package/dashboard/dist/assets/{mcp-B_xbczAt.js → mcp-DrWymhSu.js} +2 -2
  336. package/dashboard/dist/assets/{mcp-B_xbczAt.js.map → mcp-DrWymhSu.js.map} +1 -1
  337. package/dashboard/dist/assets/mcp-query-BhUxVEMS.js +2 -0
  338. package/dashboard/dist/assets/mcp-query-BhUxVEMS.js.map +1 -0
  339. package/dashboard/dist/assets/mcp-runs-DUfz4mLd.js +2 -0
  340. package/dashboard/dist/assets/mcp-runs-DUfz4mLd.js.map +1 -0
  341. package/dashboard/dist/assets/{namespaces-C3WtdO_9.js → namespaces-Cm6AY5sh.js} +2 -2
  342. package/dashboard/dist/assets/{namespaces-C3WtdO_9.js.map → namespaces-Cm6AY5sh.js.map} +1 -1
  343. package/dashboard/dist/assets/{roles-BDAsPpZG.js → roles-2v1Kc7BJ.js} +2 -2
  344. package/dashboard/dist/assets/{roles-BDAsPpZG.js.map → roles-2v1Kc7BJ.js.map} +1 -1
  345. package/dashboard/dist/assets/{settings-Ife_UwAp.js → settings-DTQNp6tH.js} +2 -2
  346. package/dashboard/dist/assets/{settings-Ife_UwAp.js.map → settings-DTQNp6tH.js.map} +1 -1
  347. package/dashboard/dist/assets/{tasks-BquNDHDI.js → tasks-CS1rgG1s.js} +2 -2
  348. package/dashboard/dist/assets/{tasks-BquNDHDI.js.map → tasks-CS1rgG1s.js.map} +1 -1
  349. package/dashboard/dist/assets/useEventHooks-BjXX8x3a.js +2 -0
  350. package/dashboard/dist/assets/{useEventHooks-anv_B2Yy.js.map → useEventHooks-BjXX8x3a.js.map} +1 -1
  351. package/dashboard/dist/assets/useFilterParams-CGRYFw_A.js +2 -0
  352. package/dashboard/dist/assets/useFilterParams-CGRYFw_A.js.map +1 -0
  353. package/dashboard/dist/assets/useYamlActivityEvents-BeR-nVWQ.js +2 -0
  354. package/dashboard/dist/assets/useYamlActivityEvents-BeR-nVWQ.js.map +1 -0
  355. package/dashboard/dist/assets/{users-CFcxB4v6.js → users-DYsdQ7Md.js} +2 -2
  356. package/dashboard/dist/assets/{users-CFcxB4v6.js.map → users-DYsdQ7Md.js.map} +1 -1
  357. package/dashboard/dist/assets/{vendor-icons-T4r2DSPD.js → vendor-icons-CWl44VA6.js} +132 -82
  358. package/dashboard/dist/assets/vendor-icons-CWl44VA6.js.map +1 -0
  359. package/dashboard/dist/assets/{workflows-CeRci9z3.js → workflows-2QAXh3UD.js} +2 -2
  360. package/dashboard/dist/assets/{workflows-CeRci9z3.js.map → workflows-2QAXh3UD.js.map} +1 -1
  361. package/dashboard/dist/assets/yaml-workflows-sx8-UEE3.js +2 -0
  362. package/dashboard/dist/assets/yaml-workflows-sx8-UEE3.js.map +1 -0
  363. package/dashboard/dist/index.html +3 -3
  364. package/docs/api/http/file-browser.md +101 -0
  365. package/docs/api/http/knowledge.md +203 -0
  366. package/docs/api/http/settings.md +6 -4
  367. package/docs/api/sdk/files.md +68 -0
  368. package/docs/api/sdk/knowledge.md +126 -0
  369. package/docs/api/sdk/settings.md +3 -2
  370. package/docs/cli.md +171 -0
  371. package/docs/compilation.md +16 -0
  372. package/docs/compiler.md +311 -0
  373. package/docs/events.md +19 -0
  374. package/docs/schema-exchange.md +173 -0
  375. package/docs/self-test.md +106 -0
  376. package/docs/workflows.md +19 -0
  377. package/package.json +15 -2
  378. package/build/api/escalations.d.ts +0 -271
  379. package/build/api/escalations.js +0 -932
  380. package/build/api/workflows.d.ts +0 -158
  381. package/build/api/workflows.js +0 -414
  382. package/dashboard/dist/assets/AvailableEscalationsPage-Dbd1qUK_.js +0 -2
  383. package/dashboard/dist/assets/AvailableEscalationsPage-Dbd1qUK_.js.map +0 -1
  384. package/dashboard/dist/assets/CredentialsPage-DJablIbs.js +0 -2
  385. package/dashboard/dist/assets/McpQueryDetailPage-BWbinTM_.js +0 -5
  386. package/dashboard/dist/assets/McpQueryDetailPage-BWbinTM_.js.map +0 -1
  387. package/dashboard/dist/assets/McpQueryPage-lV6kfDG5.js +0 -2
  388. package/dashboard/dist/assets/McpRunDetailPage-D6gaxH3_.js +0 -2
  389. package/dashboard/dist/assets/McpRunDetailPage-D6gaxH3_.js.map +0 -1
  390. package/dashboard/dist/assets/McpRunsPage-DKvTklh9.js +0 -2
  391. package/dashboard/dist/assets/McpRunsPage-DKvTklh9.js.map +0 -1
  392. package/dashboard/dist/assets/OperatorDashboard-C9SSV96T.js +0 -2
  393. package/dashboard/dist/assets/SwimlaneTimeline-RK4Yu66z.js +0 -2
  394. package/dashboard/dist/assets/SwimlaneTimeline-RK4Yu66z.js.map +0 -1
  395. package/dashboard/dist/assets/WorkflowPill-CZqGslD6.js +0 -2
  396. package/dashboard/dist/assets/WorkflowPill-CZqGslD6.js.map +0 -1
  397. package/dashboard/dist/assets/YamlWorkflowsPage-VjdhnLmO.js +0 -2
  398. package/dashboard/dist/assets/YamlWorkflowsPage-VjdhnLmO.js.map +0 -1
  399. package/dashboard/dist/assets/escalation-columns-Cyg58nkg.js +0 -2
  400. package/dashboard/dist/assets/helpers-BCix9c_m.js +0 -2
  401. package/dashboard/dist/assets/helpers-BCix9c_m.js.map +0 -1
  402. package/dashboard/dist/assets/index-BUK3qR-1.js +0 -2
  403. package/dashboard/dist/assets/index-BUK3qR-1.js.map +0 -1
  404. package/dashboard/dist/assets/index-BYZX9tOb.js.map +0 -1
  405. package/dashboard/dist/assets/index-Cf60K3x9.js +0 -2
  406. package/dashboard/dist/assets/index-Cg5nfiYX.js +0 -2
  407. package/dashboard/dist/assets/index-D1wVX50Z.js +0 -15
  408. package/dashboard/dist/assets/index-D1wVX50Z.js.map +0 -1
  409. package/dashboard/dist/assets/index-DDYFpi4l.js +0 -5
  410. package/dashboard/dist/assets/index-DDYFpi4l.js.map +0 -1
  411. package/dashboard/dist/assets/index-DcIKW-cZ.css +0 -1
  412. package/dashboard/dist/assets/index-Di12t56M.js +0 -2
  413. package/dashboard/dist/assets/mcp-query-B8-P_QoG.js +0 -2
  414. package/dashboard/dist/assets/mcp-query-B8-P_QoG.js.map +0 -1
  415. package/dashboard/dist/assets/mcp-runs-CWeZinoF.js +0 -2
  416. package/dashboard/dist/assets/mcp-runs-CWeZinoF.js.map +0 -1
  417. package/dashboard/dist/assets/useEventHooks-anv_B2Yy.js +0 -2
  418. package/dashboard/dist/assets/useFilterParams-BUyLHcx_.js +0 -2
  419. package/dashboard/dist/assets/useFilterParams-BUyLHcx_.js.map +0 -1
  420. package/dashboard/dist/assets/useYamlActivityEvents-DN-PTgVx.js +0 -2
  421. package/dashboard/dist/assets/useYamlActivityEvents-DN-PTgVx.js.map +0 -1
  422. package/dashboard/dist/assets/vendor-icons-T4r2DSPD.js.map +0 -1
  423. package/dashboard/dist/assets/yaml-workflows-DLwd2BOX.js +0 -2
  424. package/dashboard/dist/assets/yaml-workflows-DLwd2BOX.js.map +0 -1
@@ -0,0 +1,270 @@
1
+ "use strict";
2
+ /**
3
+ * Raw LLM prompt template strings for the yaml-workflow pipeline.
4
+ *
5
+ * Extracted from prompts.ts so the large template constants live in a
6
+ * dedicated data file, keeping prompt builder logic separate.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EXTRACT_DEFAULT_USER_TEMPLATE = exports.EXTRACT_DEFAULT_SYSTEM_PROMPT = exports.VALIDATION_PROMPT = exports.COMPILATION_PROMPT = void 0;
10
+ // ── Compile stage ─────────────────────────────────────────────────────────────
11
+ exports.COMPILATION_PROMPT = `You are a workflow compiler. You analyze MCP tool execution traces and produce a COMPILATION PLAN — a complete specification for building a deterministic YAML DAG workflow.
12
+
13
+ Given:
14
+ 1. The user's ORIGINAL PROMPT — the single most important signal for understanding intent
15
+ 2. EXECUTION STEPS — tool calls with arguments, result structure samples, and server IDs
16
+ 3. PATTERN ANNOTATIONS — pre-detected iteration candidates from static analysis
17
+ 4. NAIVE INPUT CLASSIFICATION — initial argument classification
18
+
19
+ Your job: produce a plan that makes the workflow truly reusable and deterministic.
20
+
21
+ ## Critical: Understand Intent
22
+
23
+ The original prompt describes what the user wanted. The execution trace shows HOW an LLM accomplished it, but may include exploratory detours. Your compilation captures INTENT, not a blind replay.
24
+
25
+ For example, if the prompt says "login to site X and take screenshots of all pages":
26
+ - INTENT: login → discover pages → iterate and screenshot each one
27
+ - Execution may have included probing steps — exclude those
28
+ - Deterministic version: accept credentials → login → extract links → iterate taking screenshots
29
+
30
+ ## Critical: Preserve Discovery Steps
31
+
32
+ Many workflows follow a "discover then act" pattern: one step DISCOVERS data (e.g., extract navigation links, query a database, list files) and a later step ACTS on that data (e.g., screenshot each page, process each record, transform each file).
33
+
34
+ **NEVER collapse discovery + action into a single step with the discovered data as a user input.** If the execution trace shows:
35
+ 1. Step A: extract_content → produces \`links: [{text, href}, ...]\`
36
+ 2. Step B: capture_pages(pages=[...array built from step A's links...])
37
+
38
+ The compiled workflow MUST keep BOTH steps: A produces the array, B consumes it. Do NOT make the array a trigger input — it was runtime-discovered, not user-provided.
39
+
40
+ **How to detect**: If a step's argument contains a large array of items that closely mirrors a prior step's output array (same URLs, same items, possibly reshaped), that array was DERIVED from the prior step. Keep both steps and wire them with a data_flow edge (with a transform if formats differ).
41
+
42
+ ## Rules
43
+
44
+ ### Step Dispositions
45
+ - **core**: Directly serves the workflow intent. Produces data consumed by later steps. **Discovery steps that produce arrays consumed by later action steps are ALWAYS core.**
46
+ - **exploratory**: Probing/debugging/discovery steps that don't produce data needed by the workflow. Exclude these:
47
+ - Checking if compiled workflows exist (list_workflows, list_yaml_workflows)
48
+ - Listing files to see what exists (list_files, read_file)
49
+ - Initial tool calls that failed and were retried with different parameters
50
+ - Any step whose result is not consumed by a subsequent core step
51
+ - **NEVER mark a discovery step as exploratory if its output was used to build arguments for a later step**
52
+
53
+ ### Signal Steps (Human-in-the-Loop)
54
+ Steps with kind "signal" represent a durable pause where the workflow waits for human input (e.g., credentials, approval). These are ALWAYS core — they are essential to the workflow's data flow. The signal step receives data from a human and makes it available to subsequent steps. Do NOT mark signal steps as exploratory. The escalation tool call (escalate_and_wait) that precedes a signal step is also always core.
55
+
56
+ **Signal data flow**: The signal step result contains the human response fields (e.g., password). These MUST be wired via data_flow edges to every downstream step that needs them. Add a data_flow edge from the signal step index to the consuming step with the matching field name.
57
+
58
+ **Credentials from signals**: When the signal provides a credential (format: password in the schema), downstream tools that need it should receive it as a separate named input argument. The runtime exchanges ephemeral credential tokens automatically. For tools with complex stored arguments (like run_script steps arrays), wire the credential as a top-level argument name — the runtime merges it with stored defaults.
59
+
60
+ ### Iteration Specifications
61
+ When the execution shows repeated tool calls with varying arguments (the pattern detector may have already collapsed these):
62
+ - Identify the SOURCE: which prior step's result contains the array being iterated. This is the step that PRODUCED the list of items — look for a step whose result contains an array field with items matching the iteration's varying values. For example, if the iteration visits multiple URLs, find the step that returned those URLs (e.g., extract_content with links).
63
+ - The source is NEVER a step that doesn't have the array in its output. Double-check: does the source step's resultKeys include the source_field?
64
+ - Specify the source_field: the dot-path to the array (e.g., "links", "results.pages")
65
+ - List varying_keys (change per item) vs constant_args (shared)
66
+ - **KEY MAPPINGS are critical**: array items often use different key names than the tool expects.
67
+ E.g., extract_content returns \`links: [{text, href}, ...]\` but the screenshot tool wants \`url\`.
68
+ Map: \`{ "url": "href" }\` — tool arg name → array item key name.
69
+ Use null for keys that are COMPUTED at runtime, not sourced from the array.
70
+ For example, screenshot_path is often derived from the link text or URL — it's not a field in the source array directly:
71
+ \`{ "screenshot_path": null }\` — the value must be computed or provided by the trigger.
72
+
73
+ ### Tool Simplification for Iterations (CRITICAL)
74
+ The iteration pattern works by extracting individual values from array items and passing them as simple key=value arguments to the iterated tool. This means:
75
+
76
+ **The iterated tool MUST accept simple, flat arguments** (url, path, page_id — not complex nested structures like a \`steps\` array).
77
+
78
+ If the execution used a complex multi-step scripting tool (e.g., \`run_script\` with a \`steps: [{action, url}, {action, path}]\` array) for each iteration, you MUST replace it with a simpler tool from the same server that accepts flat arguments. Check the server's tool inventory for a simpler alternative.
79
+
80
+ For example:
81
+ - \`run_script(steps=[navigate, wait, screenshot])\` per page → replace with \`capture_page(url, path, full_page, wait_ms)\` (1 call, flat args)
82
+ - \`run_script(steps=[navigate, fill, click])\` per item → replace with \`submit_form(url, fields)\` (1 call, flat args)
83
+
84
+ When replacing: use the same server_id but the simpler tool_name. The varying_keys and key_mappings should map directly to the simple tool's argument names.
85
+
86
+ **If no simpler tool alternative exists**, use a data_flow edge with a transform to feed the array into a batch/composite tool that accepts the full array (like \`capture_authenticated_pages\` which takes a \`pages\` array).
87
+
88
+ ### Data Flow Graph
89
+ Specify directed edges showing how data flows between steps:
90
+ - from_step: "trigger" (user input) or step index number
91
+ - from_field: the output field name (or trigger input key)
92
+ - to_step: the consuming step index
93
+ - to_field: the argument key name
94
+ - is_session_wire: true for session handles (page_id, _handle, session_id)
95
+
96
+ Session handles are critical — they maintain authenticated browser sessions, database connections, etc. They must be threaded from their producer through ALL subsequent steps that need them.
97
+
98
+ ### Chain Analysis to Downstream Steps
99
+ When a step produces a meaningful result (analysis, extraction, description, computed value) and a later step consumes related data (saving, storing, forwarding, reporting), there MUST be a data_flow edge connecting them. Match by semantic intent, not just field name:
100
+ - Step produces \`description\` → downstream step takes \`value\` → edge with from_field: "description", to_field: "value"
101
+ - Step produces \`analysis.summary\` → downstream step takes \`content\` → edge with appropriate field mapping
102
+
103
+ If the original execution trace shows that a step's output was used (even indirectly) as input to a later step, the compiled version must preserve that data chain. A broken chain means the downstream step receives no data — the worst possible compilation error.
104
+
105
+ ### Data Flow Transforms (CRITICAL for array reshaping)
106
+ When a source step produces an array of objects in one format but the consuming step expects a DIFFERENT format, add a \`transform\` to the data_flow edge. Compare the source step's result structure with the consuming step's actual arguments from the trace.
107
+
108
+ **Choosing the correct source field**: When a step produces multiple output fields, check the result sample to determine which field actually contains an ARRAY OF OBJECTS suitable for iteration/reshaping. Prefer structured array fields over raw/unstructured fields. Check the Tool-Specific Compilation Hints section (if present) for guidance on which fields to use for specific tools.
109
+
110
+ For example: extract_content returns \`links: [{text, href}]\` but capture tool expects \`pages: [{url, screenshot_path, wait_ms, full_page}]\`.
111
+ Add a transform with:
112
+ - \`field_map\`: maps target keys → source keys (e.g., \`{"url": "href"}\`). Use null for keys not in the source.
113
+ - \`defaults\`: static values to inject (e.g., \`{"wait_ms": 3000, "full_page": true}\`)
114
+ - \`derivations\`: for computed keys (null in field_map), how to derive them from source data
115
+ - strategy: "slugify" (lowercase, replace spaces/special with hyphens), "prefix", "template", "concat"
116
+ - source_key: which source field to derive from
117
+ - prefix/suffix/template: string manipulation params
118
+
119
+ Available derivation strategies:
120
+ - **slugify**: Lowercase, replace spaces/special chars with hyphens. Optionally add prefix/suffix.
121
+ - **prefix**: Prepend a static string.
122
+ - **template**: Format string with \`{value}\` (source field) and \`{date}\` (today's date as YYYY-MM-DD via @date.yyyymmdd).
123
+ - **concat**: Join multiple parts. Each part can use \`{value}\` and \`{date}\` placeholders.
124
+ Example: \`{ "strategy": "concat", "parts": ["{value}", "-", "{date}"] }\` produces \`my-slug-2026-04-17\`.
125
+ - **passthrough**: No transformation.
126
+
127
+ Use these when the workflow needs runtime-computed values (date-stamped filenames, slugified URLs, templated paths).
128
+
129
+ Example edge with transform:
130
+ \`\`\`
131
+ {
132
+ "from_step": 1, "from_field": "links", "to_step": 2, "to_field": "pages",
133
+ "is_session_wire": false,
134
+ "transform": {
135
+ "field_map": { "url": "href", "screenshot_path": null },
136
+ "defaults": { "wait_ms": 3000, "full_page": true },
137
+ "derivations": {
138
+ "screenshot_path": {
139
+ "source_key": "href",
140
+ "strategy": "slugify",
141
+ "prefix": "screenshots/",
142
+ "suffix": ".png"
143
+ }
144
+ }
145
+ }
146
+ }
147
+ \`\`\`
148
+
149
+ IMPORTANT: Check EVERY array-typed data_flow edge. Compare the source step's result item keys with the consuming step's argument item keys. If they differ, add a transform. Look at the actual tool_arguments in the execution trace to determine the correct field_map, defaults, and derivations.
150
+
151
+ ### Scalar Derivations on Data Flow Edges
152
+ When a scalar value needs runtime transformation before reaching its consumer, add a \`derivation\` to the data_flow edge (NOT a \`transform\` — transforms are for array reshaping). Derivations generate runtime expressions for string manipulation.
153
+
154
+ Common use case: the user's prompt mentions a pattern like "save with key slug-{date}" or "name it {something}-{today's date}". The trigger provides the base value, and the derivation appends or formats it at runtime.
155
+
156
+ Add a \`derivation\` field to the data_flow edge:
157
+ \`\`\`
158
+ {
159
+ "from_step": "trigger", "from_field": "key", "to_step": 3, "to_field": "key",
160
+ "is_session_wire": false,
161
+ "derivation": { "strategy": "concat", "parts": ["{value}", "-", "{date}"] }
162
+ }
163
+ \`\`\`
164
+
165
+ This produces a runtime-computed key like \`my-slug-2026-04-17\`. The \`{value}\` placeholder is the source field value; \`{date}\` is today's ISO date (YYYY-MM-DD).
166
+
167
+ Use derivations when:
168
+ - The user wants date-stamped keys, filenames, or identifiers
169
+ - A value needs a prefix/suffix added at runtime
170
+ - Two values need to be concatenated
171
+
172
+ ### Input Classification
173
+ - **dynamic**: Simple values callers MUST provide: URLs, credentials, file paths, queries, search terms. These are always scalar strings, numbers, or booleans — NEVER complex objects or arrays.
174
+ - **fixed**: Implementation details with sensible defaults: selectors, timeouts, boolean flags, AND complex structured arguments like \`steps\` arrays, \`login\` objects, or \`pages\` arrays. These are baked into stored tool_arguments.
175
+
176
+ **Complex tool arguments (arrays of objects, nested structures) are ALWAYS fixed.** They represent the implementation recipe, not user input. For example:
177
+ - A \`steps\` array describing browser actions (navigate, fill, click, screenshot) → **fixed**
178
+ - A \`login\` object with selectors and credentials → flatten the credentials (username, password) as dynamic, but the selectors as fixed
179
+ - A \`pages\` array of URLs to capture → **fixed** if hardcoded from the trace, or a data_flow edge if discovered at runtime
180
+
181
+ Flatten nested objects containing dynamic values. E.g., \`login: {url, username, password}\` → separate \`login_url\`, \`username\`, \`password\` fields. But NEVER expose the full nested object or array as a trigger input.
182
+
183
+ **Arrays that were DISCOVERED at runtime (by a prior step) are NOT inputs.** They flow between steps via data_flow edges. Only make an array a trigger input if the user explicitly provided it in their prompt. If the array was produced by a discovery step (extract_content, query, list), keep the discovery step as core and wire its output to the consuming step.
184
+
185
+ ### Prompt-Mentioned Values Are Dynamic
186
+ If a scalar value (URL, domain name, file path, key name, slug, query string) appears verbatim or closely paraphrased in the user's original prompt, classify it as **dynamic**. The user explicitly chose that value for this execution and will want to change it next time. Only classify a prompt-mentioned value as fixed if it is unambiguously an implementation constant (a CSS selector, a timeout, a boolean flag).
187
+
188
+ This is the most common compilation error: treating the user's specific request values as universal defaults. When in doubt, make it dynamic.
189
+
190
+ ### Data Flow Wiring Precision
191
+ - **Only wire inputs that semantically match.** A directory name (e.g., \`screenshot_dir = "screenshots"\`) must NOT be wired to a file path argument (e.g., \`screenshot_path\` which expects \`"screenshots/home.png"\`). If a tool argument needs a specific file path but the trigger only provides a directory, leave that argument unwired — the stored tool_arguments default will provide the correct value.
192
+ - **Trigger inputs should map to the EXACT tool argument they represent.** Don't reuse a trigger input for a different-purpose argument just because the names are vaguely related.
193
+ - **When in doubt, don't wire.** An unwired argument falls back to the stored tool_arguments default from the original execution — this is always correct. An incorrectly wired argument overrides the correct default with a wrong value.
194
+
195
+ ### Session Fields and Threading Rules
196
+ List all fields that represent session tokens/handles that must flow through the DAG (e.g., page_id, _handle, session_id).
197
+
198
+ **Critical**: When a login/setup step produces a page_id or _handle, ALL subsequent browser/page steps must receive that session wire — including steps inside iterations. The data_flow graph must include session wire edges from the producing step to EVERY downstream step that operates on the same session, not just the immediately next one. For iterations: wire the session from the setup step directly to the iteration body step.
199
+
200
+ **COMPLETENESS REQUIREMENT**: For EACH step that uses a session field (check the step's argumentKeys — if it includes page_id, _handle, or session_id), you MUST emit a data_flow edge wiring that field from its producer. If step 0 produces _handle and steps 1, 2, and 3 all use it, you need THREE edges: 0→1, 0→2, 0→3. Do NOT assume downstream steps will "inherit" session fields — each consumer needs an explicit edge.
201
+
202
+ ### Data Flow Completeness Check
203
+ Before finalizing the plan, verify:
204
+ 1. Every step that has a session field in its argumentKeys has a corresponding is_session_wire edge
205
+ 2. Every step that consumes data from a prior step has a data_flow edge for that field
206
+ 3. Every dynamic trigger input is wired to at least one step via a data_flow edge from "trigger"
207
+ 4. Transform edges include the source field AND the consuming step can access all fields it needs
208
+
209
+ ## Output Format
210
+
211
+ Return a JSON object (no markdown fences):
212
+ {
213
+ "intent": "Brief generic description of what this workflow does",
214
+ "description": "Suggested workflow description for discovery",
215
+ "steps": [
216
+ { "index": 0, "purpose": "Navigate to the target site", "disposition": "core" },
217
+ { "index": 1, "purpose": "Extract navigation links from the page", "disposition": "core" },
218
+ { "index": 2, "purpose": "List files to check directory structure", "disposition": "exploratory" }
219
+ ],
220
+ "core_step_indices": [0, 1, 3],
221
+ "inputs": [
222
+ { "key": "base_url", "type": "string", "classification": "dynamic", "description": "The base URL of the site" },
223
+ { "key": "username", "type": "string", "classification": "dynamic", "description": "Login username" },
224
+ { "key": "timeout", "type": "number", "classification": "fixed", "description": "Page load timeout", "default": 30000 }
225
+ ],
226
+ "iterations": [
227
+ {
228
+ "body_step_index": 3,
229
+ "tool_name": "screenshot",
230
+ "server_id": "playwright",
231
+ "source_step_index": 1,
232
+ "source_field": "links",
233
+ "varying_keys": ["url", "screenshot_path"],
234
+ "constant_args": { "full_page": true },
235
+ "key_mappings": { "url": "href", "screenshot_path": null }
236
+ }
237
+ ],
238
+ "data_flow": [
239
+ { "from_step": "trigger", "from_field": "base_url", "to_step": 0, "to_field": "url", "is_session_wire": false },
240
+ { "from_step": 0, "from_field": "page_id", "to_step": 1, "to_field": "page_id", "is_session_wire": true },
241
+ { "from_step": 0, "from_field": "_handle", "to_step": 1, "to_field": "_handle", "is_session_wire": true }
242
+ ],
243
+ "session_fields": ["page_id", "_handle"]
244
+ }`;
245
+ // ── Validate stage ────────────────────────────────────────────────────────────
246
+ exports.VALIDATION_PROMPT = `You are a YAML workflow validator. Given a workflow intent, activity manifest, and generated YAML DAG, identify data flow issues.
247
+
248
+ Check for:
249
+ 1. Missing input wiring: a step needs data but no prior step provides it and it's not in the trigger
250
+ 2. Broken iteration sources: a cycle references an array field that doesn't exist in the source step's output
251
+ 3. Lost session handles: a session field (page_id, _handle) is produced by an early step (e.g., login) but not threaded to later browser/page steps that need it — including steps inside iteration loops
252
+ 4. Unparameterized hardcoded values: URLs, credentials, or paths that should be dynamic inputs but are baked in
253
+ 5. Iteration array source: verify the referenced items field in a cycle hook actually exists in the source activity's output fields
254
+ 6. Trigger completeness: every dynamic input in the trigger schema should be referenced by at least one activity's input maps
255
+
256
+ IGNORE these internal fields — they are injected by the build system and are always correct:
257
+ - "workflowName" in input maps: internal dispatch routing field, always a literal string — NOT a hardcoded value bug
258
+ - "_scope" in input maps: internal IAM context field, always wired from trigger — NOT a missing trigger input
259
+
260
+ Return a JSON object:
261
+ {
262
+ "issues": ["description of issue 1", "description of issue 2"],
263
+ "valid": true
264
+ }
265
+
266
+ If no issues, return { "issues": [], "valid": true }.
267
+ Be concise. Only report real problems, not style suggestions.`;
268
+ // ── Extract stage ─────────────────────────────────────────────────────────────
269
+ exports.EXTRACT_DEFAULT_SYSTEM_PROMPT = 'You are a data analysis assistant. Interpret the provided data and return a structured JSON response with: title, summary, sections (array of {heading, content}), and metrics (array of {label, value}).';
270
+ exports.EXTRACT_DEFAULT_USER_TEMPLATE = '{dataRef}\n\nData:\n{input_data}\n\nProvide a concise analysis.';
@@ -1,15 +1,12 @@
1
1
  /**
2
2
  * Externalized LLM prompt constants for the yaml-workflow pipeline.
3
3
  *
4
- * Consolidates all system/user prompt strings used by compile, validate,
5
- * and extract stages so they can be reviewed and tuned in one place.
4
+ * Template strings live in prompt-templates.ts. This file re-exports them
5
+ * and provides builder functions that compose prompts at runtime.
6
6
  */
7
- export declare const COMPILATION_PROMPT = "You are a workflow compiler. You analyze MCP tool execution traces and produce a COMPILATION PLAN \u2014 a complete specification for building a deterministic YAML DAG workflow.\n\nGiven:\n1. The user's ORIGINAL PROMPT \u2014 the single most important signal for understanding intent\n2. EXECUTION STEPS \u2014 tool calls with arguments, result structure samples, and server IDs\n3. PATTERN ANNOTATIONS \u2014 pre-detected iteration candidates from static analysis\n4. NAIVE INPUT CLASSIFICATION \u2014 initial argument classification\n\nYour job: produce a plan that makes the workflow truly reusable and deterministic.\n\n## Critical: Understand Intent\n\nThe original prompt describes what the user wanted. The execution trace shows HOW an LLM accomplished it, but may include exploratory detours. Your compilation captures INTENT, not a blind replay.\n\nFor example, if the prompt says \"login to site X and take screenshots of all pages\":\n- INTENT: login \u2192 discover pages \u2192 iterate and screenshot each one\n- Execution may have included probing steps \u2014 exclude those\n- Deterministic version: accept credentials \u2192 login \u2192 extract links \u2192 iterate taking screenshots\n\n## Critical: Preserve Discovery Steps\n\nMany workflows follow a \"discover then act\" pattern: one step DISCOVERS data (e.g., extract navigation links, query a database, list files) and a later step ACTS on that data (e.g., screenshot each page, process each record, transform each file).\n\n**NEVER collapse discovery + action into a single step with the discovered data as a user input.** If the execution trace shows:\n1. Step A: extract_content \u2192 produces `links: [{text, href}, ...]`\n2. Step B: capture_pages(pages=[...array built from step A's links...])\n\nThe compiled workflow MUST keep BOTH steps: A produces the array, B consumes it. Do NOT make the array a trigger input \u2014 it was runtime-discovered, not user-provided.\n\n**How to detect**: If a step's argument contains a large array of items that closely mirrors a prior step's output array (same URLs, same items, possibly reshaped), that array was DERIVED from the prior step. Keep both steps and wire them with a data_flow edge (with a transform if formats differ).\n\n## Rules\n\n### Step Dispositions\n- **core**: Directly serves the workflow intent. Produces data consumed by later steps. **Discovery steps that produce arrays consumed by later action steps are ALWAYS core.**\n- **exploratory**: Probing/debugging/discovery steps that don't produce data needed by the workflow. Exclude these:\n - Checking if compiled workflows exist (list_workflows, list_yaml_workflows)\n - Listing files to see what exists (list_files, read_file)\n - Initial tool calls that failed and were retried with different parameters\n - Any step whose result is not consumed by a subsequent core step\n - **NEVER mark a discovery step as exploratory if its output was used to build arguments for a later step**\n\n### Signal Steps (Human-in-the-Loop)\nSteps with kind \"signal\" represent a durable pause where the workflow waits for human input (e.g., credentials, approval). These are ALWAYS core \u2014 they are essential to the workflow's data flow. The signal step receives data from a human and makes it available to subsequent steps. Do NOT mark signal steps as exploratory. The escalation tool call (escalate_and_wait) that precedes a signal step is also always core.\n\n**Signal data flow**: The signal step result contains the human response fields (e.g., password). These MUST be wired via data_flow edges to every downstream step that needs them. Add a data_flow edge from the signal step index to the consuming step with the matching field name.\n\n**Credentials from signals**: When the signal provides a credential (format: password in the schema), downstream tools that need it should receive it as a separate named input argument. The runtime exchanges ephemeral credential tokens automatically. For tools with complex stored arguments (like run_script steps arrays), wire the credential as a top-level argument name \u2014 the runtime merges it with stored defaults.\n\n### Iteration Specifications\nWhen the execution shows repeated tool calls with varying arguments (the pattern detector may have already collapsed these):\n- Identify the SOURCE: which prior step's result contains the array being iterated. This is the step that PRODUCED the list of items \u2014 look for a step whose result contains an array field with items matching the iteration's varying values. For example, if the iteration visits multiple URLs, find the step that returned those URLs (e.g., extract_content with links).\n- The source is NEVER a step that doesn't have the array in its output. Double-check: does the source step's resultKeys include the source_field?\n- Specify the source_field: the dot-path to the array (e.g., \"links\", \"results.pages\")\n- List varying_keys (change per item) vs constant_args (shared)\n- **KEY MAPPINGS are critical**: array items often use different key names than the tool expects.\n E.g., extract_content returns `links: [{text, href}, ...]` but the screenshot tool wants `url`.\n Map: `{ \"url\": \"href\" }` \u2014 tool arg name \u2192 array item key name.\n Use null for keys that are COMPUTED at runtime, not sourced from the array.\n For example, screenshot_path is often derived from the link text or URL \u2014 it's not a field in the source array directly:\n `{ \"screenshot_path\": null }` \u2014 the value must be computed or provided by the trigger.\n\n### Tool Simplification for Iterations (CRITICAL)\nThe iteration pattern works by extracting individual values from array items and passing them as simple key=value arguments to the iterated tool. This means:\n\n**The iterated tool MUST accept simple, flat arguments** (url, path, page_id \u2014 not complex nested structures like a `steps` array).\n\nIf the execution used a complex multi-step scripting tool (e.g., `run_script` with a `steps: [{action, url}, {action, path}]` array) for each iteration, you MUST replace it with a simpler tool from the same server that accepts flat arguments. Check the server's tool inventory for a simpler alternative.\n\nFor example:\n- `run_script(steps=[navigate, wait, screenshot])` per page \u2192 replace with `capture_page(url, path, full_page, wait_ms)` (1 call, flat args)\n- `run_script(steps=[navigate, fill, click])` per item \u2192 replace with `submit_form(url, fields)` (1 call, flat args)\n\nWhen replacing: use the same server_id but the simpler tool_name. The varying_keys and key_mappings should map directly to the simple tool's argument names.\n\n**If no simpler tool alternative exists**, use a data_flow edge with a transform to feed the array into a batch/composite tool that accepts the full array (like `capture_authenticated_pages` which takes a `pages` array).\n\n### Data Flow Graph\nSpecify directed edges showing how data flows between steps:\n- from_step: \"trigger\" (user input) or step index number\n- from_field: the output field name (or trigger input key)\n- to_step: the consuming step index\n- to_field: the argument key name\n- is_session_wire: true for session handles (page_id, _handle, session_id)\n\nSession handles are critical \u2014 they maintain authenticated browser sessions, database connections, etc. They must be threaded from their producer through ALL subsequent steps that need them.\n\n### Chain Analysis to Downstream Steps\nWhen a step produces a meaningful result (analysis, extraction, description, computed value) and a later step consumes related data (saving, storing, forwarding, reporting), there MUST be a data_flow edge connecting them. Match by semantic intent, not just field name:\n- Step produces `description` \u2192 downstream step takes `value` \u2192 edge with from_field: \"description\", to_field: \"value\"\n- Step produces `analysis.summary` \u2192 downstream step takes `content` \u2192 edge with appropriate field mapping\n\nIf the original execution trace shows that a step's output was used (even indirectly) as input to a later step, the compiled version must preserve that data chain. A broken chain means the downstream step receives no data \u2014 the worst possible compilation error.\n\n### Data Flow Transforms (CRITICAL for array reshaping)\nWhen a source step produces an array of objects in one format but the consuming step expects a DIFFERENT format, add a `transform` to the data_flow edge. Compare the source step's result structure with the consuming step's actual arguments from the trace.\n\n**Choosing the correct source field**: When a step produces multiple output fields, check the result sample to determine which field actually contains an ARRAY OF OBJECTS suitable for iteration/reshaping. Prefer structured array fields over raw/unstructured fields. Check the Tool-Specific Compilation Hints section (if present) for guidance on which fields to use for specific tools.\n\nFor example: extract_content returns `links: [{text, href}]` but capture tool expects `pages: [{url, screenshot_path, wait_ms, full_page}]`.\nAdd a transform with:\n- `field_map`: maps target keys \u2192 source keys (e.g., `{\"url\": \"href\"}`). Use null for keys not in the source.\n- `defaults`: static values to inject (e.g., `{\"wait_ms\": 3000, \"full_page\": true}`)\n- `derivations`: for computed keys (null in field_map), how to derive them from source data\n - strategy: \"slugify\" (lowercase, replace spaces/special with hyphens), \"prefix\", \"template\", \"concat\"\n - source_key: which source field to derive from\n - prefix/suffix/template: string manipulation params\n\nAvailable derivation strategies:\n- **slugify**: Lowercase, replace spaces/special chars with hyphens. Optionally add prefix/suffix.\n- **prefix**: Prepend a static string.\n- **template**: Format string with `{value}` (source field) and `{date}` (today's date as YYYY-MM-DD via @date.yyyymmdd).\n- **concat**: Join multiple parts. Each part can use `{value}` and `{date}` placeholders.\n Example: `{ \"strategy\": \"concat\", \"parts\": [\"{value}\", \"-\", \"{date}\"] }` produces `my-slug-2026-04-17`.\n- **passthrough**: No transformation.\n\nUse these when the workflow needs runtime-computed values (date-stamped filenames, slugified URLs, templated paths).\n\nExample edge with transform:\n```\n{\n \"from_step\": 1, \"from_field\": \"links\", \"to_step\": 2, \"to_field\": \"pages\",\n \"is_session_wire\": false,\n \"transform\": {\n \"field_map\": { \"url\": \"href\", \"screenshot_path\": null },\n \"defaults\": { \"wait_ms\": 3000, \"full_page\": true },\n \"derivations\": {\n \"screenshot_path\": {\n \"source_key\": \"href\",\n \"strategy\": \"slugify\",\n \"prefix\": \"screenshots/\",\n \"suffix\": \".png\"\n }\n }\n }\n}\n```\n\nIMPORTANT: Check EVERY array-typed data_flow edge. Compare the source step's result item keys with the consuming step's argument item keys. If they differ, add a transform. Look at the actual tool_arguments in the execution trace to determine the correct field_map, defaults, and derivations.\n\n### Scalar Derivations on Data Flow Edges\nWhen a scalar value needs runtime transformation before reaching its consumer, add a `derivation` to the data_flow edge (NOT a `transform` \u2014 transforms are for array reshaping). Derivations generate runtime expressions for string manipulation.\n\nCommon use case: the user's prompt mentions a pattern like \"save with key slug-{date}\" or \"name it {something}-{today's date}\". The trigger provides the base value, and the derivation appends or formats it at runtime.\n\nAdd a `derivation` field to the data_flow edge:\n```\n{\n \"from_step\": \"trigger\", \"from_field\": \"key\", \"to_step\": 3, \"to_field\": \"key\",\n \"is_session_wire\": false,\n \"derivation\": { \"strategy\": \"concat\", \"parts\": [\"{value}\", \"-\", \"{date}\"] }\n}\n```\n\nThis produces a runtime-computed key like `my-slug-2026-04-17`. The `{value}` placeholder is the source field value; `{date}` is today's ISO date (YYYY-MM-DD).\n\nUse derivations when:\n- The user wants date-stamped keys, filenames, or identifiers\n- A value needs a prefix/suffix added at runtime\n- Two values need to be concatenated\n\n### Input Classification\n- **dynamic**: Simple values callers MUST provide: URLs, credentials, file paths, queries, search terms. These are always scalar strings, numbers, or booleans \u2014 NEVER complex objects or arrays.\n- **fixed**: Implementation details with sensible defaults: selectors, timeouts, boolean flags, AND complex structured arguments like `steps` arrays, `login` objects, or `pages` arrays. These are baked into stored tool_arguments.\n\n**Complex tool arguments (arrays of objects, nested structures) are ALWAYS fixed.** They represent the implementation recipe, not user input. For example:\n- A `steps` array describing browser actions (navigate, fill, click, screenshot) \u2192 **fixed**\n- A `login` object with selectors and credentials \u2192 flatten the credentials (username, password) as dynamic, but the selectors as fixed\n- A `pages` array of URLs to capture \u2192 **fixed** if hardcoded from the trace, or a data_flow edge if discovered at runtime\n\nFlatten nested objects containing dynamic values. E.g., `login: {url, username, password}` \u2192 separate `login_url`, `username`, `password` fields. But NEVER expose the full nested object or array as a trigger input.\n\n**Arrays that were DISCOVERED at runtime (by a prior step) are NOT inputs.** They flow between steps via data_flow edges. Only make an array a trigger input if the user explicitly provided it in their prompt. If the array was produced by a discovery step (extract_content, query, list), keep the discovery step as core and wire its output to the consuming step.\n\n### Prompt-Mentioned Values Are Dynamic\nIf a scalar value (URL, domain name, file path, key name, slug, query string) appears verbatim or closely paraphrased in the user's original prompt, classify it as **dynamic**. The user explicitly chose that value for this execution and will want to change it next time. Only classify a prompt-mentioned value as fixed if it is unambiguously an implementation constant (a CSS selector, a timeout, a boolean flag).\n\nThis is the most common compilation error: treating the user's specific request values as universal defaults. When in doubt, make it dynamic.\n\n### Data Flow Wiring Precision\n- **Only wire inputs that semantically match.** A directory name (e.g., `screenshot_dir = \"screenshots\"`) must NOT be wired to a file path argument (e.g., `screenshot_path` which expects `\"screenshots/home.png\"`). If a tool argument needs a specific file path but the trigger only provides a directory, leave that argument unwired \u2014 the stored tool_arguments default will provide the correct value.\n- **Trigger inputs should map to the EXACT tool argument they represent.** Don't reuse a trigger input for a different-purpose argument just because the names are vaguely related.\n- **When in doubt, don't wire.** An unwired argument falls back to the stored tool_arguments default from the original execution \u2014 this is always correct. An incorrectly wired argument overrides the correct default with a wrong value.\n\n### Session Fields and Threading Rules\nList all fields that represent session tokens/handles that must flow through the DAG (e.g., page_id, _handle, session_id).\n\n**Critical**: When a login/setup step produces a page_id or _handle, ALL subsequent browser/page steps must receive that session wire \u2014 including steps inside iterations. The data_flow graph must include session wire edges from the producing step to EVERY downstream step that operates on the same session, not just the immediately next one. For iterations: wire the session from the setup step directly to the iteration body step.\n\n**COMPLETENESS REQUIREMENT**: For EACH step that uses a session field (check the step's argumentKeys \u2014 if it includes page_id, _handle, or session_id), you MUST emit a data_flow edge wiring that field from its producer. If step 0 produces _handle and steps 1, 2, and 3 all use it, you need THREE edges: 0\u21921, 0\u21922, 0\u21923. Do NOT assume downstream steps will \"inherit\" session fields \u2014 each consumer needs an explicit edge.\n\n### Data Flow Completeness Check\nBefore finalizing the plan, verify:\n1. Every step that has a session field in its argumentKeys has a corresponding is_session_wire edge\n2. Every step that consumes data from a prior step has a data_flow edge for that field\n3. Every dynamic trigger input is wired to at least one step via a data_flow edge from \"trigger\"\n4. Transform edges include the source field AND the consuming step can access all fields it needs\n\n## Output Format\n\nReturn a JSON object (no markdown fences):\n{\n \"intent\": \"Brief generic description of what this workflow does\",\n \"description\": \"Suggested workflow description for discovery\",\n \"steps\": [\n { \"index\": 0, \"purpose\": \"Navigate to the target site\", \"disposition\": \"core\" },\n { \"index\": 1, \"purpose\": \"Extract navigation links from the page\", \"disposition\": \"core\" },\n { \"index\": 2, \"purpose\": \"List files to check directory structure\", \"disposition\": \"exploratory\" }\n ],\n \"core_step_indices\": [0, 1, 3],\n \"inputs\": [\n { \"key\": \"base_url\", \"type\": \"string\", \"classification\": \"dynamic\", \"description\": \"The base URL of the site\" },\n { \"key\": \"username\", \"type\": \"string\", \"classification\": \"dynamic\", \"description\": \"Login username\" },\n { \"key\": \"timeout\", \"type\": \"number\", \"classification\": \"fixed\", \"description\": \"Page load timeout\", \"default\": 30000 }\n ],\n \"iterations\": [\n {\n \"body_step_index\": 3,\n \"tool_name\": \"screenshot\",\n \"server_id\": \"playwright\",\n \"source_step_index\": 1,\n \"source_field\": \"links\",\n \"varying_keys\": [\"url\", \"screenshot_path\"],\n \"constant_args\": { \"full_page\": true },\n \"key_mappings\": { \"url\": \"href\", \"screenshot_path\": null }\n }\n ],\n \"data_flow\": [\n { \"from_step\": \"trigger\", \"from_field\": \"base_url\", \"to_step\": 0, \"to_field\": \"url\", \"is_session_wire\": false },\n { \"from_step\": 0, \"from_field\": \"page_id\", \"to_step\": 1, \"to_field\": \"page_id\", \"is_session_wire\": true },\n { \"from_step\": 0, \"from_field\": \"_handle\", \"to_step\": 1, \"to_field\": \"_handle\", \"is_session_wire\": true }\n ],\n \"session_fields\": [\"page_id\", \"_handle\"]\n}";
7
+ export { COMPILATION_PROMPT, VALIDATION_PROMPT, EXTRACT_DEFAULT_SYSTEM_PROMPT, EXTRACT_DEFAULT_USER_TEMPLATE, } from './prompt-templates';
8
8
  /**
9
9
  * Build the retry hint injected into the compile stage when
10
10
  * user feedback or a prior deployment error triggers recompilation.
11
11
  */
12
12
  export declare function buildRecompilationHint(feedback: string, priorYaml?: string): string;
13
- export declare const VALIDATION_PROMPT = "You are a YAML workflow validator. Given a workflow intent, activity manifest, and generated YAML DAG, identify data flow issues.\n\nCheck for:\n1. Missing input wiring: a step needs data but no prior step provides it and it's not in the trigger\n2. Broken iteration sources: a cycle references an array field that doesn't exist in the source step's output\n3. Lost session handles: a session field (page_id, _handle) is produced by an early step (e.g., login) but not threaded to later browser/page steps that need it \u2014 including steps inside iteration loops\n4. Unparameterized hardcoded values: URLs, credentials, or paths that should be dynamic inputs but are baked in\n5. Iteration array source: verify the referenced items field in a cycle hook actually exists in the source activity's output fields\n6. Trigger completeness: every dynamic input in the trigger schema should be referenced by at least one activity's input maps\n\nIGNORE these internal fields \u2014 they are injected by the build system and are always correct:\n- \"workflowName\" in input maps: internal dispatch routing field, always a literal string \u2014 NOT a hardcoded value bug\n- \"_scope\" in input maps: internal IAM context field, always wired from trigger \u2014 NOT a missing trigger input\n\nReturn a JSON object:\n{\n \"issues\": [\"description of issue 1\", \"description of issue 2\"],\n \"valid\": true\n}\n\nIf no issues, return { \"issues\": [], \"valid\": true }.\nBe concise. Only report real problems, not style suggestions.";
14
- export declare const EXTRACT_DEFAULT_SYSTEM_PROMPT = "You are a data analysis assistant. Interpret the provided data and return a structured JSON response with: title, summary, sections (array of {heading, content}), and metrics (array of {label, value}).";
15
- export declare const EXTRACT_DEFAULT_USER_TEMPLATE = "{dataRef}\n\nData:\n{input_data}\n\nProvide a concise analysis.";