@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,192 @@
1
+ "use strict";
2
+ /**
3
+ * DAG step-appender functions for building iteration, normal, and signal
4
+ * activities. Extracted from dag.ts to keep each file under 300 lines.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.appendIterationStep = appendIterationStep;
8
+ exports.appendNormalStep = appendNormalStep;
9
+ exports.appendSignalStep = appendSignalStep;
10
+ const utils_1 = require("./utils");
11
+ const wiring_1 = require("./wiring");
12
+ const iteration_1 = require("./iteration");
13
+ const transform_1 = require("./transform");
14
+ const defaults_1 = require("../../../../modules/defaults");
15
+ // ── Step appenders ───────────────────────────────────────────────────────────
16
+ /** Append an iteration pattern (hook -> worker -> cycle -> done) to the DAG. */
17
+ function appendIterationStep(dag, iterSpec, prefix, graphTopic, idx, step, triggerInputKeys, steps, sessionFields, plan) {
18
+ const iterResult = (0, iteration_1.buildIterationActivities)(iterSpec, prefix, graphTopic, idx, step, dag.stepIndexToActivityId, dag.triggerId, triggerInputKeys, steps, sessionFields, plan);
19
+ Object.assign(dag.activities, iterResult.activities);
20
+ Object.assign(dag.transitions, iterResult.transitions);
21
+ dag.manifest.push(...iterResult.manifest);
22
+ dag.transitions[dag.prevActivityId] = [{ to: iterResult.pivotId }];
23
+ dag.prevActivityId = iterResult.doneId;
24
+ dag.prevResult = step.result;
25
+ dag.lastPivotId = iterResult.pivotId;
26
+ dag.stepIndexToActivityId.set(idx, iterResult.pivotId);
27
+ }
28
+ /** Append a normal (non-iteration) step activity to the DAG. */
29
+ function appendNormalStep(dag, idx, step, prefix, graphTopic, plan, steps, triggerInputKeys, collapsedToCoreIndex) {
30
+ const actId = `${prefix}_a${idx + 1}`;
31
+ dag.stepIndexToActivityId.set(idx, actId);
32
+ dag.lastPivotId = null;
33
+ const workflowName = step.kind === 'llm' ? 'interpret' : step.toolName;
34
+ const topic = graphTopic;
35
+ const title = step.kind === 'llm'
36
+ ? 'LLM Interpret'
37
+ : step.toolName.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
38
+ // Insert any transform (reshape) activities before this step
39
+ if (plan) {
40
+ dag.prevActivityId = (0, transform_1.insertTransformActivities)(idx, plan, steps, prefix, graphTopic, dag.triggerId, triggerInputKeys, dag.stepIndexToActivityId, collapsedToCoreIndex, dag.activities, dag.transitions, dag.manifest, dag.prevActivityId);
41
+ }
42
+ // Wire input mappings from upstream steps (may include @pipe objects for derivations)
43
+ const inputMappings = (0, wiring_1.wireStepInputs)(idx, step, plan, dag.stepIndexToActivityId, dag.triggerId, triggerInputKeys, steps, prefix, dag.prevActivityId, dag.prevResult, collapsedToCoreIndex);
44
+ // Build the activity definition
45
+ const resultSchema = step.result ? (0, utils_1.inferSchema)(step.result) : { type: 'object' };
46
+ const outputFields = extractOutputFields(step);
47
+ const jobMaps = buildJobMaps(idx, steps.length, outputFields);
48
+ // Thread _scope from trigger through every activity for IAM context
49
+ inputMappings._scope = `{${dag.triggerId}.output.data._scope}`;
50
+ // Set workflowName for singleton consumer dispatch routing
51
+ inputMappings.workflowName = workflowName;
52
+ dag.activities[actId] = {
53
+ title,
54
+ type: 'worker',
55
+ topic,
56
+ input: {
57
+ schema: { type: 'object' },
58
+ ...(Object.keys(inputMappings).length > 0 ? { maps: inputMappings } : {}),
59
+ },
60
+ output: { schema: resultSchema },
61
+ ...(jobMaps ? { job: { maps: jobMaps } } : {}),
62
+ };
63
+ // Build manifest entry
64
+ dag.manifest.push(buildManifestEntry(actId, title, step, topic, workflowName, inputMappings, outputFields));
65
+ // Transition from previous step
66
+ dag.transitions[dag.prevActivityId] = [{ to: actId }];
67
+ dag.prevActivityId = actId;
68
+ dag.prevResult = step.result;
69
+ }
70
+ /**
71
+ * Append a signal step pair (escalation worker + hook) to the DAG.
72
+ *
73
+ * The escalation worker creates the escalation via the human-queue MCP tool.
74
+ * The hook pauses until the escalation is resolved and a signal arrives.
75
+ * A hooks section entry routes the external signal to the waiting hook.
76
+ */
77
+ function appendSignalStep(dag, idx, step, prefix, graphTopic, plan, steps, triggerInputKeys, collapsedToCoreIndex) {
78
+ // The step before this signal step is the escalation tool call.
79
+ // The signal step itself represents the pause/resume point.
80
+ const hookId = `${prefix}_wait${idx + 1}`;
81
+ dag.stepIndexToActivityId.set(idx, hookId);
82
+ dag.lastPivotId = null;
83
+ const signalSchema = step.signalSchema || { type: 'object', properties: {} };
84
+ const outputFields = signalSchema.properties
85
+ ? Object.keys(signalSchema.properties)
86
+ : [];
87
+ // Build job maps: map each signal field from hook data to job state
88
+ const jobMaps = {};
89
+ for (const field of outputFields) {
90
+ jobMaps[field] = `{$self.hook.data.${field}}`;
91
+ }
92
+ // Hook topic: scoped per graph, per activity for multiple hooks
93
+ const hookTopic = `escalation.resolved.${graphTopic}.${hookId}`;
94
+ // The hook activity -- pauses until signal arrives
95
+ dag.activities[hookId] = {
96
+ title: 'Wait for Human Input',
97
+ type: 'hook',
98
+ hook: signalSchema,
99
+ output: {
100
+ schema: signalSchema,
101
+ },
102
+ ...(Object.keys(jobMaps).length > 0 ? { job: { maps: jobMaps } } : {}),
103
+ };
104
+ // Find the escalation worker that precedes this signal step.
105
+ // It's the previous activity in the DAG -- its output.data.escalationId
106
+ // is used as the match condition for routing signals.
107
+ const escalationActId = dag.prevActivityId;
108
+ // Patch the preceding escalation worker to persist escalationId to the job hash.
109
+ // Without job.maps, the hook's match condition can't resolve {a1.output.data.escalationId}.
110
+ const prevActivity = dag.activities[escalationActId];
111
+ if (prevActivity && prevActivity.type === 'worker') {
112
+ prevActivity.job = {
113
+ ...(prevActivity.job || {}),
114
+ maps: {
115
+ ...(prevActivity.job?.maps || {}),
116
+ escalationId: '{$self.output.data.escalationId}',
117
+ signalId: '{$self.output.data.signalId}',
118
+ },
119
+ };
120
+ }
121
+ // Hook rules: route signals to this hook with job ID match.
122
+ // Use {$job.metadata.jid} (always available) as the match key.
123
+ // The signal must include the job_id in its payload for routing.
124
+ dag.hooks[hookTopic] = [{
125
+ to: hookId,
126
+ conditions: {
127
+ match: [{
128
+ expected: '{$job.metadata.jid}',
129
+ actual: '{$self.hook.data.job_id}',
130
+ }],
131
+ },
132
+ }];
133
+ // Manifest entry
134
+ dag.manifest.push({
135
+ activity_id: hookId,
136
+ title: 'Wait for Human Input',
137
+ type: 'hook',
138
+ tool_source: 'signal',
139
+ topic: graphTopic,
140
+ hook_topic: hookTopic,
141
+ signal_schema: signalSchema,
142
+ input_mappings: {},
143
+ output_fields: outputFields,
144
+ });
145
+ // Transition from previous step (the escalation worker) to the hook
146
+ dag.transitions[dag.prevActivityId] = [{ to: hookId }];
147
+ dag.prevActivityId = hookId;
148
+ dag.prevResult = step.result;
149
+ }
150
+ // ── Internal helpers ─────────────────────────────────────────────────────────
151
+ function extractOutputFields(step) {
152
+ if (step.result && typeof step.result === 'object' && !Array.isArray(step.result)) {
153
+ return Object.keys(step.result);
154
+ }
155
+ return [];
156
+ }
157
+ function buildJobMaps(stepIdx, totalSteps, outputFields) {
158
+ if (stepIdx !== totalSteps - 1)
159
+ return undefined;
160
+ if (outputFields.length > 0) {
161
+ return outputFields.reduce((acc, field) => {
162
+ acc[field] = `{$self.output.data.${field}}`;
163
+ return acc;
164
+ }, {});
165
+ }
166
+ // Final step with no structured output fields (e.g., string result) --
167
+ // persist the raw response so the workflow result isn't null
168
+ return { response: '{$self.output.data.response}' };
169
+ }
170
+ function buildManifestEntry(actId, title, step, topic, workflowName, inputMappings, outputFields) {
171
+ const promptTemplate = step.kind === 'llm' && step.promptMessages
172
+ ? step.promptMessages.map((m) => `[${m.role}]\n${m.content}`).join('\n\n')
173
+ : undefined;
174
+ return {
175
+ activity_id: actId,
176
+ title,
177
+ type: 'worker',
178
+ tool_source: step.source,
179
+ topic,
180
+ workflow_name: workflowName,
181
+ ...(step.kind === 'tool' ? {
182
+ mcp_server_id: step.source === 'mcp' ? step.mcpServerId : 'db',
183
+ mcp_tool_name: step.toolName,
184
+ tool_arguments: Object.keys(step.arguments).length > 0
185
+ ? (0, utils_1.capToolArguments)(step.arguments) : undefined,
186
+ } : {}),
187
+ input_mappings: inputMappings,
188
+ output_fields: outputFields,
189
+ ...(promptTemplate ? { prompt_template: promptTemplate } : {}),
190
+ ...(step.kind === 'llm' ? { model: defaults_1.LLM_MODEL_SECONDARY } : {}),
191
+ };
192
+ }
@@ -4,22 +4,13 @@
4
4
  * Encapsulates the mutable state of DAG assembly (activities, transitions,
5
5
  * manifest) behind semantic operations so the main build() function reads
6
6
  * as a high-level pipeline.
7
+ *
8
+ * Step-appender functions (appendIterationStep, appendNormalStep,
9
+ * appendSignalStep) live in dag-assembly.ts.
7
10
  */
8
- import type { ExtractedStep, EnhancedCompilationPlan, IterationSpec } from '../../types';
9
11
  import type { DagBuilder } from '../../types';
12
+ export { appendIterationStep, appendNormalStep, appendSignalStep, } from './dag-assembly';
10
13
  /** Create the DAG with its trigger activity. */
11
14
  export declare function initializeDag(prefix: string, graphTopic: string, inputSchema: Record<string, unknown>): DagBuilder;
12
- /** Append an iteration pattern (hook → worker → cycle → done) to the DAG. */
13
- export declare function appendIterationStep(dag: DagBuilder, iterSpec: IterationSpec, prefix: string, graphTopic: string, idx: number, step: ExtractedStep, triggerInputKeys: Set<string>, steps: ExtractedStep[], sessionFields: string[], plan: EnhancedCompilationPlan | null): void;
14
- /** Append a normal (non-iteration) step activity to the DAG. */
15
- export declare function appendNormalStep(dag: DagBuilder, idx: number, step: ExtractedStep, prefix: string, graphTopic: string, plan: EnhancedCompilationPlan | null, steps: ExtractedStep[], triggerInputKeys: Set<string>, collapsedToCoreIndex: Map<number, number>): void;
16
- /**
17
- * Append a signal step pair (escalation worker + hook) to the DAG.
18
- *
19
- * The escalation worker creates the escalation via the human-queue MCP tool.
20
- * The hook pauses until the escalation is resolved and a signal arrives.
21
- * A hooks section entry routes the external signal to the waiting hook.
22
- */
23
- export declare function appendSignalStep(dag: DagBuilder, idx: number, step: ExtractedStep, prefix: string, graphTopic: string, plan: EnhancedCompilationPlan | null, steps: ExtractedStep[], triggerInputKeys: Set<string>, collapsedToCoreIndex: Map<number, number>): void;
24
15
  /** Assemble the DAG into a HotMesh YAML document. */
25
16
  export declare function serializeToYaml(appId: string, graphTopic: string, inputSchema: Record<string, unknown>, outputSchema: Record<string, unknown>, dag: DagBuilder): string;
@@ -5,20 +5,22 @@
5
5
  * Encapsulates the mutable state of DAG assembly (activities, transitions,
6
6
  * manifest) behind semantic operations so the main build() function reads
7
7
  * as a high-level pipeline.
8
+ *
9
+ * Step-appender functions (appendIterationStep, appendNormalStep,
10
+ * appendSignalStep) live in dag-assembly.ts.
8
11
  */
9
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.appendSignalStep = exports.appendNormalStep = exports.appendIterationStep = void 0;
10
14
  exports.initializeDag = initializeDag;
11
- exports.appendIterationStep = appendIterationStep;
12
- exports.appendNormalStep = appendNormalStep;
13
- exports.appendSignalStep = appendSignalStep;
14
15
  exports.serializeToYaml = serializeToYaml;
15
16
  // eslint-disable-next-line @typescript-eslint/no-var-requires
16
17
  const yaml = require('js-yaml');
17
18
  const defaults_1 = require("../../../../modules/defaults");
18
- const utils_1 = require("./utils");
19
- const wiring_1 = require("./wiring");
20
- const iteration_1 = require("./iteration");
21
- const transform_1 = require("./transform");
19
+ // Re-export step appenders so existing import sites continue to work
20
+ var dag_assembly_1 = require("./dag-assembly");
21
+ Object.defineProperty(exports, "appendIterationStep", { enumerable: true, get: function () { return dag_assembly_1.appendIterationStep; } });
22
+ Object.defineProperty(exports, "appendNormalStep", { enumerable: true, get: function () { return dag_assembly_1.appendNormalStep; } });
23
+ Object.defineProperty(exports, "appendSignalStep", { enumerable: true, get: function () { return dag_assembly_1.appendSignalStep; } });
22
24
  // ── DAG lifecycle ────────────────────────────────────────────────────────────
23
25
  /** Create the DAG with its trigger activity. */
24
26
  function initializeDag(prefix, graphTopic, inputSchema) {
@@ -51,141 +53,6 @@ function initializeDag(prefix, graphTopic, inputSchema) {
51
53
  triggerId,
52
54
  };
53
55
  }
54
- // ── Step appenders ───────────────────────────────────────────────────────────
55
- /** Append an iteration pattern (hook → worker → cycle → done) to the DAG. */
56
- function appendIterationStep(dag, iterSpec, prefix, graphTopic, idx, step, triggerInputKeys, steps, sessionFields, plan) {
57
- const iterResult = (0, iteration_1.buildIterationActivities)(iterSpec, prefix, graphTopic, idx, step, dag.stepIndexToActivityId, dag.triggerId, triggerInputKeys, steps, sessionFields, plan);
58
- Object.assign(dag.activities, iterResult.activities);
59
- Object.assign(dag.transitions, iterResult.transitions);
60
- dag.manifest.push(...iterResult.manifest);
61
- dag.transitions[dag.prevActivityId] = [{ to: iterResult.pivotId }];
62
- dag.prevActivityId = iterResult.doneId;
63
- dag.prevResult = step.result;
64
- dag.lastPivotId = iterResult.pivotId;
65
- dag.stepIndexToActivityId.set(idx, iterResult.pivotId);
66
- }
67
- /** Append a normal (non-iteration) step activity to the DAG. */
68
- function appendNormalStep(dag, idx, step, prefix, graphTopic, plan, steps, triggerInputKeys, collapsedToCoreIndex) {
69
- const actId = `${prefix}_a${idx + 1}`;
70
- dag.stepIndexToActivityId.set(idx, actId);
71
- dag.lastPivotId = null;
72
- const workflowName = step.kind === 'llm' ? 'interpret' : step.toolName;
73
- const topic = graphTopic;
74
- const title = step.kind === 'llm'
75
- ? 'LLM Interpret'
76
- : step.toolName.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
77
- // Insert any transform (reshape) activities before this step
78
- if (plan) {
79
- dag.prevActivityId = (0, transform_1.insertTransformActivities)(idx, plan, steps, prefix, graphTopic, dag.triggerId, triggerInputKeys, dag.stepIndexToActivityId, collapsedToCoreIndex, dag.activities, dag.transitions, dag.manifest, dag.prevActivityId);
80
- }
81
- // Wire input mappings from upstream steps (may include @pipe objects for derivations)
82
- const inputMappings = (0, wiring_1.wireStepInputs)(idx, step, plan, dag.stepIndexToActivityId, dag.triggerId, triggerInputKeys, steps, prefix, dag.prevActivityId, dag.prevResult, collapsedToCoreIndex);
83
- // Build the activity definition
84
- const resultSchema = step.result ? (0, utils_1.inferSchema)(step.result) : { type: 'object' };
85
- const outputFields = extractOutputFields(step);
86
- const jobMaps = buildJobMaps(idx, steps.length, outputFields);
87
- // Thread _scope from trigger through every activity for IAM context
88
- inputMappings._scope = `{${dag.triggerId}.output.data._scope}`;
89
- // Set workflowName for singleton consumer dispatch routing
90
- inputMappings.workflowName = workflowName;
91
- dag.activities[actId] = {
92
- title,
93
- type: 'worker',
94
- topic,
95
- input: {
96
- schema: { type: 'object' },
97
- ...(Object.keys(inputMappings).length > 0 ? { maps: inputMappings } : {}),
98
- },
99
- output: { schema: resultSchema },
100
- ...(jobMaps ? { job: { maps: jobMaps } } : {}),
101
- };
102
- // Build manifest entry
103
- dag.manifest.push(buildManifestEntry(actId, title, step, topic, workflowName, inputMappings, outputFields));
104
- // Transition from previous step
105
- dag.transitions[dag.prevActivityId] = [{ to: actId }];
106
- dag.prevActivityId = actId;
107
- dag.prevResult = step.result;
108
- }
109
- /**
110
- * Append a signal step pair (escalation worker + hook) to the DAG.
111
- *
112
- * The escalation worker creates the escalation via the human-queue MCP tool.
113
- * The hook pauses until the escalation is resolved and a signal arrives.
114
- * A hooks section entry routes the external signal to the waiting hook.
115
- */
116
- function appendSignalStep(dag, idx, step, prefix, graphTopic, plan, steps, triggerInputKeys, collapsedToCoreIndex) {
117
- // The step before this signal step is the escalation tool call.
118
- // The signal step itself represents the pause/resume point.
119
- const hookId = `${prefix}_wait${idx + 1}`;
120
- dag.stepIndexToActivityId.set(idx, hookId);
121
- dag.lastPivotId = null;
122
- const signalSchema = step.signalSchema || { type: 'object', properties: {} };
123
- const outputFields = signalSchema.properties
124
- ? Object.keys(signalSchema.properties)
125
- : [];
126
- // Build job maps: map each signal field from hook data to job state
127
- const jobMaps = {};
128
- for (const field of outputFields) {
129
- jobMaps[field] = `{$self.hook.data.${field}}`;
130
- }
131
- // Hook topic: scoped per graph, per activity for multiple hooks
132
- const hookTopic = `escalation.resolved.${graphTopic}.${hookId}`;
133
- // The hook activity — pauses until signal arrives
134
- dag.activities[hookId] = {
135
- title: 'Wait for Human Input',
136
- type: 'hook',
137
- hook: signalSchema,
138
- output: {
139
- schema: signalSchema,
140
- },
141
- ...(Object.keys(jobMaps).length > 0 ? { job: { maps: jobMaps } } : {}),
142
- };
143
- // Find the escalation worker that precedes this signal step.
144
- // It's the previous activity in the DAG — its output.data.escalationId
145
- // is used as the match condition for routing signals.
146
- const escalationActId = dag.prevActivityId;
147
- // Patch the preceding escalation worker to persist escalationId to the job hash.
148
- // Without job.maps, the hook's match condition can't resolve {a1.output.data.escalationId}.
149
- const prevActivity = dag.activities[escalationActId];
150
- if (prevActivity && prevActivity.type === 'worker') {
151
- prevActivity.job = {
152
- ...(prevActivity.job || {}),
153
- maps: {
154
- ...(prevActivity.job?.maps || {}),
155
- escalationId: '{$self.output.data.escalationId}',
156
- signalId: '{$self.output.data.signalId}',
157
- },
158
- };
159
- }
160
- // Hook rules: route signals to this hook with job ID match.
161
- // Use {$job.metadata.jid} (always available) as the match key.
162
- // The signal must include the job_id in its payload for routing.
163
- dag.hooks[hookTopic] = [{
164
- to: hookId,
165
- conditions: {
166
- match: [{
167
- expected: '{$job.metadata.jid}',
168
- actual: '{$self.hook.data.job_id}',
169
- }],
170
- },
171
- }];
172
- // Manifest entry
173
- dag.manifest.push({
174
- activity_id: hookId,
175
- title: 'Wait for Human Input',
176
- type: 'hook',
177
- tool_source: 'signal',
178
- topic: graphTopic,
179
- hook_topic: hookTopic,
180
- signal_schema: signalSchema,
181
- input_mappings: {},
182
- output_fields: outputFields,
183
- });
184
- // Transition from previous step (the escalation worker) to the hook
185
- dag.transitions[dag.prevActivityId] = [{ to: hookId }];
186
- dag.prevActivityId = hookId;
187
- dag.prevResult = step.result;
188
- }
189
56
  // ── Serialization ────────────────────────────────────────────────────────────
190
57
  /** Assemble the DAG into a HotMesh YAML document. */
191
58
  function serializeToYaml(appId, graphTopic, inputSchema, outputSchema, dag) {
@@ -214,46 +81,3 @@ function serializeToYaml(appId, graphTopic, inputSchema, outputSchema, dag) {
214
81
  sortKeys: false,
215
82
  });
216
83
  }
217
- // ── Internal helpers ─────────────────────────────────────────────────────────
218
- function extractOutputFields(step) {
219
- if (step.result && typeof step.result === 'object' && !Array.isArray(step.result)) {
220
- return Object.keys(step.result);
221
- }
222
- return [];
223
- }
224
- function buildJobMaps(stepIdx, totalSteps, outputFields) {
225
- if (stepIdx !== totalSteps - 1)
226
- return undefined;
227
- if (outputFields.length > 0) {
228
- return outputFields.reduce((acc, field) => {
229
- acc[field] = `{$self.output.data.${field}}`;
230
- return acc;
231
- }, {});
232
- }
233
- // Final step with no structured output fields (e.g., string result) —
234
- // persist the raw response so the workflow result isn't null
235
- return { response: '{$self.output.data.response}' };
236
- }
237
- function buildManifestEntry(actId, title, step, topic, workflowName, inputMappings, outputFields) {
238
- const promptTemplate = step.kind === 'llm' && step.promptMessages
239
- ? step.promptMessages.map((m) => `[${m.role}]\n${m.content}`).join('\n\n')
240
- : undefined;
241
- return {
242
- activity_id: actId,
243
- title,
244
- type: 'worker',
245
- tool_source: step.source,
246
- topic,
247
- workflow_name: workflowName,
248
- ...(step.kind === 'tool' ? {
249
- mcp_server_id: step.source === 'mcp' ? step.mcpServerId : 'db',
250
- mcp_tool_name: step.toolName,
251
- tool_arguments: Object.keys(step.arguments).length > 0
252
- ? (0, utils_1.capToolArguments)(step.arguments) : undefined,
253
- } : {}),
254
- input_mappings: inputMappings,
255
- output_fields: outputFields,
256
- ...(promptTemplate ? { prompt_template: promptTemplate } : {}),
257
- ...(step.kind === 'llm' ? { model: defaults_1.LLM_MODEL_SECONDARY } : {}),
258
- };
259
- }
@@ -6,7 +6,8 @@
6
6
  * Falls back to mechanical heuristics when no plan is available.
7
7
  */
8
8
  import type { PipelineContext } from '../../types';
9
- export { capToolArguments, sanitizeName } from './utils';
9
+ export { capToolArguments } from './utils';
10
+ export { sanitizeToolName } from '../../../../modules/utils';
10
11
  /**
11
12
  * Build pipeline stage: construct the HotMesh YAML DAG.
12
13
  *
@@ -7,7 +7,7 @@
7
7
  * Falls back to mechanical heuristics when no plan is available.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.sanitizeName = exports.capToolArguments = void 0;
10
+ exports.sanitizeToolName = exports.capToolArguments = void 0;
11
11
  exports.build = build;
12
12
  const input_analyzer_1 = require("../../input-analyzer");
13
13
  const utils_1 = require("./utils");
@@ -17,7 +17,8 @@ const dag_1 = require("./dag");
17
17
  // Re-export public utilities used by other modules
18
18
  var utils_2 = require("./utils");
19
19
  Object.defineProperty(exports, "capToolArguments", { enumerable: true, get: function () { return utils_2.capToolArguments; } });
20
- Object.defineProperty(exports, "sanitizeName", { enumerable: true, get: function () { return utils_2.sanitizeName; } });
20
+ var utils_3 = require("../../../../modules/utils");
21
+ Object.defineProperty(exports, "sanitizeToolName", { enumerable: true, get: function () { return utils_3.sanitizeToolName; } });
21
22
  /**
22
23
  * Build pipeline stage: construct the HotMesh YAML DAG.
23
24
  *
@@ -8,8 +8,6 @@
8
8
  export declare function keysRelated(a: string, b: string): boolean;
9
9
  /** Cap `limit` in tool arguments to avoid sending huge payloads to downstream LLM steps. */
10
10
  export declare function capToolArguments(args: Record<string, unknown>): Record<string, unknown>;
11
- /** Sanitize a name for use in HotMesh app IDs and topics. */
12
- export declare function sanitizeName(name: string): string;
13
11
  /** Convert a snake_case/camelCase field name to a readable label. */
14
12
  export declare function humanize(name: string): string;
15
13
  /**
@@ -5,7 +5,6 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.keysRelated = keysRelated;
7
7
  exports.capToolArguments = capToolArguments;
8
- exports.sanitizeName = sanitizeName;
9
8
  exports.humanize = humanize;
10
9
  exports.inferSchema = inferSchema;
11
10
  exports.buildInputMappings = buildInputMappings;
@@ -35,13 +34,6 @@ function capToolArguments(args) {
35
34
  }
36
35
  return capped;
37
36
  }
38
- /** Sanitize a name for use in HotMesh app IDs and topics. */
39
- function sanitizeName(name) {
40
- return name
41
- .toLowerCase()
42
- .replace(/[^a-z0-9]+/g, '-')
43
- .replace(/^-|-$/g, '');
44
- }
45
37
  /** Convert a snake_case/camelCase field name to a readable label. */
46
38
  function humanize(name) {
47
39
  return name
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Raw LLM prompt template strings for the yaml-workflow pipeline.
3
+ *
4
+ * Extracted from prompts.ts so the large template constants live in a
5
+ * dedicated data file, keeping prompt builder logic separate.
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}";
8
+ 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.";
9
+ 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}).";
10
+ export declare const EXTRACT_DEFAULT_USER_TEMPLATE = "{dataRef}\n\nData:\n{input_data}\n\nProvide a concise analysis.";