@hotmeshio/long-tail 0.1.5 → 0.1.6
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.
- package/README.md +34 -4
- package/build/lib/db/migrate.js +3 -6
- package/{lib → build/lib}/db/schemas/001_schema.sql +3 -0
- package/{lib → build/lib}/db/schemas/011_system_workflow_configs.sql +7 -0
- package/build/lib/db/schemas/016_streamable_http.sql +7 -0
- package/build/routes/docs.js +25 -7
- package/build/routes/insight.js +63 -0
- package/build/routes/mcp.js +23 -1
- package/build/routes/yaml-workflows/cron.d.ts +2 -0
- package/build/routes/yaml-workflows/cron.js +117 -0
- package/build/routes/yaml-workflows/crud.js +38 -0
- package/build/routes/yaml-workflows/deployment.js +9 -34
- package/build/routes/yaml-workflows/index.js +4 -1
- package/build/services/cron/index.d.ts +17 -0
- package/build/services/cron/index.js +94 -1
- package/build/services/insight/index.d.ts +11 -0
- package/build/services/insight/index.js +30 -0
- package/build/services/mcp/client/connection.d.ts +9 -0
- package/build/services/mcp/client/connection.js +49 -1
- package/build/services/mcp/db-server/schemas.d.ts +2 -2
- package/build/services/mcp/db.d.ts +1 -1
- package/build/services/mcp/db.js +10 -0
- package/build/services/mcp/playwright-server/schemas.d.ts +4 -4
- package/build/services/mcp/sql.d.ts +1 -1
- package/build/services/mcp/sql.js +2 -2
- package/build/services/mcp/types.d.ts +3 -1
- package/build/services/yaml-workflow/db.d.ts +3 -0
- package/build/services/yaml-workflow/db.js +24 -0
- package/build/services/yaml-workflow/invoke.d.ts +19 -0
- package/build/services/yaml-workflow/invoke.js +80 -0
- package/build/services/yaml-workflow/pipeline/build/dag.js +1 -1
- package/build/services/yaml-workflow/pipeline/build/wiring.d.ts +1 -1
- package/build/services/yaml-workflow/pipeline/build/wiring.js +89 -2
- package/build/services/yaml-workflow/pipeline/prompts.d.ts +1 -1
- package/build/services/yaml-workflow/pipeline/prompts.js +44 -1
- package/build/services/yaml-workflow/sql.d.ts +3 -0
- package/build/services/yaml-workflow/sql.js +16 -1
- package/build/services/yaml-workflow/types.d.ts +13 -1
- package/build/services/yaml-workflow/workers/callbacks.js +9 -1
- package/build/services/yaml-workflow/workers/register.js +29 -1
- package/build/system/index.js +6 -0
- package/build/system/mcp-servers/admin/schemas.d.ts +12 -12
- package/build/system/mcp-servers/db-query/schemas.d.ts +2 -2
- package/build/system/mcp-servers/playwright/schemas.d.ts +18 -18
- package/build/system/mcp-servers/playwright-cli/schemas.d.ts +34 -34
- package/build/system/mcp-servers/playwright-cli/tools-capture.js +5 -1
- package/build/system/mcp-servers/vision.js +54 -17
- package/build/system/seed/server-definitions.d.ts +7 -0
- package/build/system/seed/server-definitions.js +5 -2
- package/build/system/seed/tool-manifests-workflows.d.ts +7 -0
- package/build/system/seed/tool-manifests-workflows.js +10 -3
- package/build/system/workflows/mcp-workflow-builder/activities/caches.d.ts +5 -0
- package/build/system/workflows/mcp-workflow-builder/activities/caches.js +8 -0
- package/build/system/workflows/mcp-workflow-builder/activities/index.d.ts +2 -0
- package/build/system/workflows/mcp-workflow-builder/activities/index.js +7 -0
- package/build/system/workflows/mcp-workflow-builder/activities/llm.d.ts +2 -0
- package/build/system/workflows/mcp-workflow-builder/activities/llm.js +25 -0
- package/build/system/workflows/mcp-workflow-builder/activities/tool-loader.d.ts +5 -0
- package/build/system/workflows/mcp-workflow-builder/activities/tool-loader.js +8 -0
- package/build/system/workflows/mcp-workflow-builder/index.d.ts +16 -0
- package/build/system/workflows/mcp-workflow-builder/index.js +229 -0
- package/build/system/workflows/mcp-workflow-builder/prompts.d.ts +8 -0
- package/build/system/workflows/mcp-workflow-builder/prompts.js +247 -0
- package/build/system/workflows/shared/tool-loader.js +3 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/mcp.d.ts +4 -3
- package/build/types/yaml-workflow.d.ts +6 -2
- package/dashboard/dist/assets/AdminDashboard-BXkKGkb5.js +2 -0
- package/dashboard/dist/assets/{AdminDashboard-CTyAMUJR.js.map → AdminDashboard-BXkKGkb5.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-DcH592mc.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-DcH592mc.js.map +1 -0
- package/dashboard/dist/assets/BotPicker-A6LtzyuO.js +2 -0
- package/dashboard/dist/assets/{BotPicker-C51nKFEu.js.map → BotPicker-A6LtzyuO.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-BSyfd8uL.js → CollapsibleSection-C7nL2_mv.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-BSyfd8uL.js.map → CollapsibleSection-C7nL2_mv.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-CBdhia5T.js → ConfirmDeleteModal-CWFwJrSl.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-CBdhia5T.js.map → ConfirmDeleteModal-CWFwJrSl.js.map} +1 -1
- package/dashboard/dist/assets/{CopyableId-dGlewBCS.js → CopyableId-DbZ5c3jh.js} +2 -2
- package/dashboard/dist/assets/{CopyableId-dGlewBCS.js.map → CopyableId-DbZ5c3jh.js.map} +1 -1
- package/dashboard/dist/assets/CredentialsPage-ClWkmLPu.js +2 -0
- package/dashboard/dist/assets/CredentialsPage-ClWkmLPu.js.map +1 -0
- package/dashboard/dist/assets/{CustomDurationPicker-BataWFj8.js → CustomDurationPicker-CtH2hReF.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BataWFj8.js.map → CustomDurationPicker-CtH2hReF.js.map} +1 -1
- package/dashboard/dist/assets/{DataTable-B3uf5CCo.js → DataTable-CM5ZcpPi.js} +2 -2
- package/dashboard/dist/assets/{DataTable-B3uf5CCo.js.map → DataTable-CM5ZcpPi.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-G5oSwTpT.js → ElapsedCell-CwqavyeC.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-G5oSwTpT.js.map → ElapsedCell-CwqavyeC.js.map} +1 -1
- package/dashboard/dist/assets/{EmptyState-BChBJNGS.js → EmptyState-BBn78pmm.js} +2 -2
- package/dashboard/dist/assets/{EmptyState-BChBJNGS.js.map → EmptyState-BBn78pmm.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-CxUv8xjG.js → EscalationsOverview-BcJ2E3X7.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-CxUv8xjG.js.map → EscalationsOverview-BcJ2E3X7.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-CVt8B0BZ.js → EventTable-C1en_KZ0.js} +2 -2
- package/dashboard/dist/assets/{EventTable-CVt8B0BZ.js.map → EventTable-C1en_KZ0.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-CShf0oe7.js → FilterBar-CZTlrLQT.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-CShf0oe7.js.map → FilterBar-CZTlrLQT.js.map} +1 -1
- package/dashboard/dist/assets/ListToolbar-Cdbsapig.js +2 -0
- package/dashboard/dist/assets/ListToolbar-Cdbsapig.js.map +1 -0
- package/dashboard/dist/assets/{McpOverview-CbaZRnJl.js → McpOverview-CSpEJxKa.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-CbaZRnJl.js.map → McpOverview-CSpEJxKa.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryDetailPage-DhqEI180.js +5 -0
- package/dashboard/dist/assets/McpQueryDetailPage-DhqEI180.js.map +1 -0
- package/dashboard/dist/assets/McpQueryPage-CIiVMlqo.js +2 -0
- package/dashboard/dist/assets/McpQueryPage-CIiVMlqo.js.map +1 -0
- package/dashboard/dist/assets/McpRunDetailPage-9xdxgG4d.js +2 -0
- package/dashboard/dist/assets/McpRunDetailPage-9xdxgG4d.js.map +1 -0
- package/dashboard/dist/assets/McpRunsPage-wWLqHsd4.js +2 -0
- package/dashboard/dist/assets/McpRunsPage-wWLqHsd4.js.map +1 -0
- package/dashboard/dist/assets/{Modal-CI5RBPOQ.js → Modal-kB_P7ZOr.js} +2 -2
- package/dashboard/dist/assets/{Modal-CI5RBPOQ.js.map → Modal-kB_P7ZOr.js.map} +1 -1
- package/dashboard/dist/assets/OperatorDashboard-jc0vrgDI.js +2 -0
- package/dashboard/dist/assets/OperatorDashboard-jc0vrgDI.js.map +1 -0
- package/dashboard/dist/assets/{PageHeader-SMD9qtOO.js → PageHeader-NkOeBR05.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-SMD9qtOO.js.map → PageHeader-NkOeBR05.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-TikLQsTp.js → PageHeaderWithStats-ywNhrmFK.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-TikLQsTp.js.map → PageHeaderWithStats-ywNhrmFK.js.map} +1 -1
- package/dashboard/dist/assets/{PriorityBadge-CQ0EsLTA.js → PriorityBadge-B2MQbSxy.js} +2 -2
- package/dashboard/dist/assets/{PriorityBadge-CQ0EsLTA.js.map → PriorityBadge-B2MQbSxy.js.map} +1 -1
- package/dashboard/dist/assets/ProcessDetailPage-B7z7IdqE.js +2 -0
- package/dashboard/dist/assets/ProcessDetailPage-B7z7IdqE.js.map +1 -0
- package/dashboard/dist/assets/ProcessesListPage-C-uHadO6.js +2 -0
- package/dashboard/dist/assets/ProcessesListPage-C-uHadO6.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-Crj4TH5p.js → RolePill-C1dgC-fK.js} +2 -2
- package/dashboard/dist/assets/{RolePill-Crj4TH5p.js.map → RolePill-C1dgC-fK.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-C_RInUwS.js → RolesPage-BSxrD1vm.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-C_RInUwS.js.map → RolesPage-BSxrD1vm.js.map} +1 -1
- package/dashboard/dist/assets/{RowActions-Cp5HyK_w.js → RowActions-lYaHGI-v.js} +2 -2
- package/dashboard/dist/assets/{RowActions-Cp5HyK_w.js.map → RowActions-lYaHGI-v.js.map} +1 -1
- package/dashboard/dist/assets/RunAsSelector-CJDnyp93.js +2 -0
- package/dashboard/dist/assets/RunAsSelector-CJDnyp93.js.map +1 -0
- package/dashboard/dist/assets/{StatCard-BKZLSgNV.js → StatCard-v2TiITVr.js} +2 -2
- package/dashboard/dist/assets/{StatCard-BKZLSgNV.js.map → StatCard-v2TiITVr.js.map} +1 -1
- package/dashboard/dist/assets/{StatusBadge-BYNGGZK5.js → StatusBadge-DWlxevgG.js} +2 -2
- package/dashboard/dist/assets/{StatusBadge-BYNGGZK5.js.map → StatusBadge-DWlxevgG.js.map} +1 -1
- package/dashboard/dist/assets/StepIndicator-CRM4ft28.js +2 -0
- package/dashboard/dist/assets/StepIndicator-CRM4ft28.js.map +1 -0
- package/dashboard/dist/assets/{StickyPagination-CTosgiU2.js → StickyPagination-CF0EToEU.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-CTosgiU2.js.map → StickyPagination-CF0EToEU.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-ylG5Ps1s.js → SwimlaneTimeline-CNlj7fgg.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-ylG5Ps1s.js.map → SwimlaneTimeline-CNlj7fgg.js.map} +1 -1
- package/dashboard/dist/assets/TagInput-CH8qMGhC.js +2 -0
- package/dashboard/dist/assets/TagInput-CH8qMGhC.js.map +1 -0
- package/dashboard/dist/assets/{TaskDetailPage-C9pDGdD2.js → TaskDetailPage-CdWo-6mu.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-C9pDGdD2.js.map → TaskDetailPage-CdWo-6mu.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-BtJbZTT0.js → TaskQueuePill-BPj4ogVG.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-BtJbZTT0.js.map → TaskQueuePill-BPj4ogVG.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-DtFLUEhg.js → TasksListPage-CtRkMpKU.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-DtFLUEhg.js.map → TasksListPage-CtRkMpKU.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-WuM6xImZ.js → TimeAgo-Di1a3X5P.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-WuM6xImZ.js.map → TimeAgo-Di1a3X5P.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-IVL_-Upy.js → TimestampCell-CqrXql-S.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-IVL_-Upy.js.map → TimestampCell-CqrXql-S.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-DU9qeg13.js → UserName-BUFYCnRa.js} +2 -2
- package/dashboard/dist/assets/{UserName-DU9qeg13.js.map → UserName-BUFYCnRa.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-25iusMml.js +2 -0
- package/dashboard/dist/assets/WorkflowExecutionPage-25iusMml.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowPill-Diw8iWBP.js → WorkflowPill-DPKOcbf4.js} +2 -2
- package/dashboard/dist/assets/{WorkflowPill-Diw8iWBP.js.map → WorkflowPill-DPKOcbf4.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-BgxslssH.js +2 -0
- package/dashboard/dist/assets/WorkflowsDashboard-BgxslssH.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsOverview-CPuvA4t3.js → WorkflowsOverview-Doe5L-Re.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CPuvA4t3.js.map → WorkflowsOverview-Doe5L-Re.js.map} +1 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-BliAckJ6.js +2 -0
- package/dashboard/dist/assets/YamlWorkflowsPage-BliAckJ6.js.map +1 -0
- package/dashboard/dist/assets/{bots-BPiZXf2h.js → bots-Bi2_O1Ts.js} +2 -2
- package/dashboard/dist/assets/{bots-BPiZXf2h.js.map → bots-Bi2_O1Ts.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-DTY_OKRh.js → escalation-Ck1KlLkT.js} +2 -2
- package/dashboard/dist/assets/{escalation-DTY_OKRh.js.map → escalation-Ck1KlLkT.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-C91fHSkp.js → escalation-columns-ohDsj2eJ.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-C91fHSkp.js.map → escalation-columns-ohDsj2eJ.js.map} +1 -1
- package/dashboard/dist/assets/helpers-BoD2SgUY.js +2 -0
- package/dashboard/dist/assets/helpers-BoD2SgUY.js.map +1 -0
- package/dashboard/dist/assets/{index-D_qEAYrg.js → index-BEtLIsML.js} +2 -2
- package/dashboard/dist/assets/{index-D_qEAYrg.js.map → index-BEtLIsML.js.map} +1 -1
- package/dashboard/dist/assets/index-Bn2xHDr8.js +5 -0
- package/dashboard/dist/assets/index-Bn2xHDr8.js.map +1 -0
- package/dashboard/dist/assets/index-BpT-6WgJ.js +2 -0
- package/dashboard/dist/assets/{index-BtOwLI0K.js.map → index-BpT-6WgJ.js.map} +1 -1
- package/dashboard/dist/assets/index-CZrJ09p-.js +2 -0
- package/dashboard/dist/assets/index-CZrJ09p-.js.map +1 -0
- package/dashboard/dist/assets/index-D3NyVADW.js +2 -0
- package/dashboard/dist/assets/index-D3NyVADW.js.map +1 -0
- package/dashboard/dist/assets/index-D7zYZOnH.js +2 -0
- package/dashboard/dist/assets/{index-CDWOfCmi.js.map → index-D7zYZOnH.js.map} +1 -1
- package/dashboard/dist/assets/index-DOkHXmyf.js +17 -0
- package/dashboard/dist/assets/index-DOkHXmyf.js.map +1 -0
- package/dashboard/dist/assets/{index-DSzSoku1.js → index-DYyLF-Qb.js} +91 -93
- package/dashboard/dist/assets/index-DYyLF-Qb.js.map +1 -0
- package/dashboard/dist/assets/index-Dk2Q51o0.js +2 -0
- package/dashboard/dist/assets/index-Dk2Q51o0.js.map +1 -0
- package/dashboard/dist/assets/index-FuohTtaM.js +6 -0
- package/dashboard/dist/assets/index-FuohTtaM.js.map +1 -0
- package/dashboard/dist/assets/index-PyCTS05D.css +1 -0
- package/dashboard/dist/assets/mcp-CJtYjA7A.js +2 -0
- package/dashboard/dist/assets/mcp-CJtYjA7A.js.map +1 -0
- package/dashboard/dist/assets/mcp-query-jQJQrs_7.js +2 -0
- package/dashboard/dist/assets/mcp-query-jQJQrs_7.js.map +1 -0
- package/dashboard/dist/assets/{mcp-runs-DmXYJD19.js → mcp-runs-DUWm9Z4V.js} +2 -2
- package/dashboard/dist/assets/{mcp-runs-DmXYJD19.js.map → mcp-runs-DUWm9Z4V.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-DoGa7jc7.js → namespaces-BM5P2qmL.js} +2 -2
- package/dashboard/dist/assets/{namespaces-DoGa7jc7.js.map → namespaces-BM5P2qmL.js.map} +1 -1
- package/dashboard/dist/assets/{roles-wCdQ2Z7k.js → roles-lv0shpjJ.js} +2 -2
- package/dashboard/dist/assets/{roles-wCdQ2Z7k.js.map → roles-lv0shpjJ.js.map} +1 -1
- package/dashboard/dist/assets/{settings-DDe_L7JT.js → settings-Wlq92mRo.js} +2 -2
- package/dashboard/dist/assets/{settings-DDe_L7JT.js.map → settings-Wlq92mRo.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-3Hih8Bt7.js → tasks-BFGm4PuE.js} +2 -2
- package/dashboard/dist/assets/{tasks-3Hih8Bt7.js.map → tasks-BFGm4PuE.js.map} +1 -1
- package/dashboard/dist/assets/useEventHooks-DIE6ue4x.js +2 -0
- package/dashboard/dist/assets/useEventHooks-DIE6ue4x.js.map +1 -0
- package/dashboard/dist/assets/useExpandedRows-Cg9iq6Vy.js +2 -0
- package/dashboard/dist/assets/useExpandedRows-Cg9iq6Vy.js.map +1 -0
- package/dashboard/dist/assets/{useYamlActivityEvents-B5dHec6Y.js → useYamlActivityEvents-DCwSO73t.js} +2 -2
- package/dashboard/dist/assets/useYamlActivityEvents-DCwSO73t.js.map +1 -0
- package/dashboard/dist/assets/{users-BTagPmGW.js → users-tA5-K0wA.js} +2 -2
- package/dashboard/dist/assets/{users-BTagPmGW.js.map → users-tA5-K0wA.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DCLlGYO9.js → vendor-icons-BiIug1SK.js} +121 -66
- package/dashboard/dist/assets/vendor-icons-BiIug1SK.js.map +1 -0
- package/dashboard/dist/assets/{workflows-B20dR3NE.js → workflows-CfLc15Wr.js} +2 -2
- package/dashboard/dist/assets/{workflows-B20dR3NE.js.map → workflows-CfLc15Wr.js.map} +1 -1
- package/dashboard/dist/assets/yaml-workflows-D7JXNqbM.js +2 -0
- package/dashboard/dist/assets/{yaml-workflows-CaLPMQha.js.map → yaml-workflows-D7JXNqbM.js.map} +1 -1
- package/dashboard/dist/index.html +3 -3
- package/docs/api/mcp-servers.md +60 -2
- package/docs/architecture.md +3 -3
- package/docs/dashboard.md +1 -1
- package/docs/escalation-strategies.md +2 -3
- package/docs/mcp.md +301 -31
- package/package.json +4 -4
- package/dashboard/dist/assets/AdminDashboard-CTyAMUJR.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-BMXV3Q4l.js +0 -2
- package/dashboard/dist/assets/AvailableEscalationsPage-BMXV3Q4l.js.map +0 -1
- package/dashboard/dist/assets/BotPicker-C51nKFEu.js +0 -2
- package/dashboard/dist/assets/CredentialsPage-CoBNFSAu.js +0 -2
- package/dashboard/dist/assets/CredentialsPage-CoBNFSAu.js.map +0 -1
- package/dashboard/dist/assets/McpQueryDetailPage-CGoR9XK6.js +0 -5
- package/dashboard/dist/assets/McpQueryDetailPage-CGoR9XK6.js.map +0 -1
- package/dashboard/dist/assets/McpQueryPage-BjXoYQuU.js +0 -2
- package/dashboard/dist/assets/McpQueryPage-BjXoYQuU.js.map +0 -1
- package/dashboard/dist/assets/McpRunDetailPage-DLkA5Aar.js +0 -2
- package/dashboard/dist/assets/McpRunDetailPage-DLkA5Aar.js.map +0 -1
- package/dashboard/dist/assets/McpRunsPage-DCh9n11D.js +0 -2
- package/dashboard/dist/assets/McpRunsPage-DCh9n11D.js.map +0 -1
- package/dashboard/dist/assets/OperatorDashboard-Dc80suXd.js +0 -2
- package/dashboard/dist/assets/OperatorDashboard-Dc80suXd.js.map +0 -1
- package/dashboard/dist/assets/ProcessDetailPage-B2GKuGzk.js +0 -2
- package/dashboard/dist/assets/ProcessDetailPage-B2GKuGzk.js.map +0 -1
- package/dashboard/dist/assets/ProcessesListPage-CTjI3Wn6.js +0 -2
- package/dashboard/dist/assets/ProcessesListPage-CTjI3Wn6.js.map +0 -1
- package/dashboard/dist/assets/RefreshButton-BcQDObrv.js +0 -2
- package/dashboard/dist/assets/RefreshButton-BcQDObrv.js.map +0 -1
- package/dashboard/dist/assets/RunAsSelector-BhyWtofX.js +0 -2
- package/dashboard/dist/assets/RunAsSelector-BhyWtofX.js.map +0 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-DOocX81f.js +0 -2
- package/dashboard/dist/assets/WorkflowExecutionPage-DOocX81f.js.map +0 -1
- package/dashboard/dist/assets/WorkflowsDashboard-DDtUIrTy.js +0 -2
- package/dashboard/dist/assets/WorkflowsDashboard-DDtUIrTy.js.map +0 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-DlwwkluN.js +0 -2
- package/dashboard/dist/assets/YamlWorkflowsPage-DlwwkluN.js.map +0 -1
- package/dashboard/dist/assets/helpers-DBUZ9pnG.js +0 -2
- package/dashboard/dist/assets/helpers-DBUZ9pnG.js.map +0 -1
- package/dashboard/dist/assets/index-BOeA-gfK.js +0 -17
- package/dashboard/dist/assets/index-BOeA-gfK.js.map +0 -1
- package/dashboard/dist/assets/index-BZ6K_kmL.js +0 -3
- package/dashboard/dist/assets/index-BZ6K_kmL.js.map +0 -1
- package/dashboard/dist/assets/index-Bpm0yeoi.js +0 -2
- package/dashboard/dist/assets/index-Bpm0yeoi.js.map +0 -1
- package/dashboard/dist/assets/index-BtOwLI0K.js +0 -2
- package/dashboard/dist/assets/index-CBF3ZvRZ.js +0 -6
- package/dashboard/dist/assets/index-CBF3ZvRZ.js.map +0 -1
- package/dashboard/dist/assets/index-CDWOfCmi.js +0 -2
- package/dashboard/dist/assets/index-Ce6sL__n.js +0 -2
- package/dashboard/dist/assets/index-Ce6sL__n.js.map +0 -1
- package/dashboard/dist/assets/index-DSzSoku1.js.map +0 -1
- package/dashboard/dist/assets/index-gCy9XX3W.css +0 -1
- package/dashboard/dist/assets/mcp-BzVpaaKF.js +0 -2
- package/dashboard/dist/assets/mcp-BzVpaaKF.js.map +0 -1
- package/dashboard/dist/assets/mcp-query-wTuxTTCV.js +0 -2
- package/dashboard/dist/assets/mcp-query-wTuxTTCV.js.map +0 -1
- package/dashboard/dist/assets/useNatsEvents-DeGKHFTX.js +0 -2
- package/dashboard/dist/assets/useNatsEvents-DeGKHFTX.js.map +0 -1
- package/dashboard/dist/assets/useYamlActivityEvents-B5dHec6Y.js.map +0 -1
- package/dashboard/dist/assets/vendor-icons-DCLlGYO9.js.map +0 -1
- package/dashboard/dist/assets/yaml-workflows-CaLPMQha.js +0 -2
- package/lib/db/README.md +0 -8
- /package/{lib → build/lib}/db/schemas/002_seed.sql +0 -0
- /package/{lib → build/lib}/db/schemas/003_workflow_discovery.sql +0 -0
- /package/{lib → build/lib}/db/schemas/004_query_router.sql +0 -0
- /package/{lib → build/lib}/db/schemas/005_triage_router.sql +0 -0
- /package/{lib → build/lib}/db/schemas/006_oauth.sql +0 -0
- /package/{lib → build/lib}/db/schemas/007_security.sql +0 -0
- /package/{lib → build/lib}/db/schemas/008_bot_accounts.sql +0 -0
- /package/{lib → build/lib}/db/schemas/009_audit_trail.sql +0 -0
- /package/{lib → build/lib}/db/schemas/010_credential_providers.sql +0 -0
- /package/{lib → build/lib}/db/schemas/012_drop_modality.sql +0 -0
- /package/{lib → build/lib}/db/schemas/013_execute_as.sql +0 -0
- /package/{lib → build/lib}/db/schemas/014_ephemeral_credentials.sql +0 -0
- /package/{lib → build/lib}/db/schemas/015_knowledge.sql +0 -0
|
@@ -4,6 +4,91 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.wireStepInputs = wireStepInputs;
|
|
7
|
+
/**
|
|
8
|
+
* HotMesh @pipe sub-pipe for today's date as YYYY-MM-DD.
|
|
9
|
+
* Must be used as a ROW-LEVEL entry in a parent @pipe, never inside an array row.
|
|
10
|
+
*/
|
|
11
|
+
const DATE_SUB_PIPE = {
|
|
12
|
+
'@pipe': [
|
|
13
|
+
['{@date.now}'],
|
|
14
|
+
['{@date.toISOString}', 0, 10],
|
|
15
|
+
['{@string.substring}'],
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Convert a scalar derivation spec into a HotMesh @pipe expression.
|
|
20
|
+
* Uses fan-out/fan-in pattern: sub-pipes as row-level siblings, NOT nested inside array rows.
|
|
21
|
+
*/
|
|
22
|
+
function buildDerivationPipe(sourceRef, derivation) {
|
|
23
|
+
if (!derivation)
|
|
24
|
+
return sourceRef;
|
|
25
|
+
switch (derivation.strategy) {
|
|
26
|
+
case 'concat': {
|
|
27
|
+
const parts = derivation.parts || ['{value}'];
|
|
28
|
+
const hasDate = parts.some((p) => p === '{date}');
|
|
29
|
+
if (!hasDate) {
|
|
30
|
+
// Simple concat — no sub-pipes needed
|
|
31
|
+
const args = parts.map((p) => p === '{value}' ? sourceRef : p);
|
|
32
|
+
if (args.length === 1 && args[0] === sourceRef)
|
|
33
|
+
return sourceRef;
|
|
34
|
+
return { '@pipe': [args, ['{@string.concat}']] };
|
|
35
|
+
}
|
|
36
|
+
// Fan-out/fan-in: each part that needs computation gets its own sub-pipe row
|
|
37
|
+
const rows = [];
|
|
38
|
+
for (const p of parts) {
|
|
39
|
+
if (p === '{value}') {
|
|
40
|
+
rows.push({ '@pipe': [[sourceRef]] });
|
|
41
|
+
}
|
|
42
|
+
else if (p === '{date}') {
|
|
43
|
+
rows.push(DATE_SUB_PIPE);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
rows.push({ '@pipe': [[p]] });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
rows.push(['{@string.concat}']);
|
|
50
|
+
return { '@pipe': rows };
|
|
51
|
+
}
|
|
52
|
+
case 'template': {
|
|
53
|
+
const tpl = derivation.template || '{value}';
|
|
54
|
+
const segments = tpl.split(/(\{value\}|\{date\})/).filter(Boolean);
|
|
55
|
+
const hasDate = segments.includes('{date}');
|
|
56
|
+
if (!hasDate) {
|
|
57
|
+
const args = segments.map((s) => s === '{value}' ? sourceRef : s);
|
|
58
|
+
if (args.length === 1 && args[0] === sourceRef)
|
|
59
|
+
return sourceRef;
|
|
60
|
+
return { '@pipe': [args, ['{@string.concat}']] };
|
|
61
|
+
}
|
|
62
|
+
const rows = [];
|
|
63
|
+
for (const s of segments) {
|
|
64
|
+
if (s === '{value}') {
|
|
65
|
+
rows.push({ '@pipe': [[sourceRef]] });
|
|
66
|
+
}
|
|
67
|
+
else if (s === '{date}') {
|
|
68
|
+
rows.push(DATE_SUB_PIPE);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
rows.push({ '@pipe': [[s]] });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
rows.push(['{@string.concat}']);
|
|
75
|
+
return { '@pipe': rows };
|
|
76
|
+
}
|
|
77
|
+
case 'prefix': {
|
|
78
|
+
const concatParts = [];
|
|
79
|
+
if (derivation.prefix)
|
|
80
|
+
concatParts.push(derivation.prefix);
|
|
81
|
+
concatParts.push(sourceRef);
|
|
82
|
+
if (derivation.suffix)
|
|
83
|
+
concatParts.push(derivation.suffix);
|
|
84
|
+
if (concatParts.length === 1)
|
|
85
|
+
return sourceRef;
|
|
86
|
+
return { '@pipe': [concatParts, ['{@string.concat}']] };
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
return sourceRef;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
7
92
|
/**
|
|
8
93
|
* Build input mappings for a step using the compilation plan's data flow edges.
|
|
9
94
|
* Falls back to mechanical backward-scan when no plan is available.
|
|
@@ -30,14 +115,16 @@ function wireStepInputs(stepIdx, step, plan, stepIndexToActivityId, triggerId, t
|
|
|
30
115
|
inputMappings[edge.toField] = `{${transformActId}.output.data.${edge.toField}}`;
|
|
31
116
|
}
|
|
32
117
|
else if (edge.fromStep === 'trigger') {
|
|
33
|
-
|
|
118
|
+
const rawRef = `{${triggerId}.output.data.${edge.fromField}}`;
|
|
119
|
+
inputMappings[edge.toField] = buildDerivationPipe(rawRef, edge.derivation);
|
|
34
120
|
}
|
|
35
121
|
else {
|
|
36
122
|
// Remap the source step from collapsed to core index
|
|
37
123
|
const remappedFrom = collapsedToCoreIndex?.get(edge.fromStep) ?? edge.fromStep;
|
|
38
124
|
const sourceActId = stepIndexToActivityId.get(remappedFrom);
|
|
39
125
|
if (sourceActId) {
|
|
40
|
-
|
|
126
|
+
const rawRef = `{${sourceActId}.output.data.${edge.fromField}}`;
|
|
127
|
+
inputMappings[edge.toField] = buildDerivationPipe(rawRef, edge.derivation);
|
|
41
128
|
}
|
|
42
129
|
}
|
|
43
130
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Consolidates all system/user prompt strings used by compile, validate,
|
|
5
5
|
* and extract stages so they can be reviewed and tuned in one place.
|
|
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### 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\"\n - source_key: which source field to derive from\n - prefix/suffix/template: string manipulation params\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### 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### 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 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 ISO date, YYYY-MM-DD).\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
8
|
/**
|
|
9
9
|
* Build the retry hint injected into the compile stage when
|
|
10
10
|
* user feedback or a prior deployment error triggers recompilation.
|
|
@@ -96,6 +96,13 @@ Specify directed edges showing how data flows between steps:
|
|
|
96
96
|
|
|
97
97
|
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.
|
|
98
98
|
|
|
99
|
+
### Chain Analysis to Downstream Steps
|
|
100
|
+
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:
|
|
101
|
+
- Step produces \`description\` → downstream step takes \`value\` → edge with from_field: "description", to_field: "value"
|
|
102
|
+
- Step produces \`analysis.summary\` → downstream step takes \`content\` → edge with appropriate field mapping
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
99
106
|
### Data Flow Transforms (CRITICAL for array reshaping)
|
|
100
107
|
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.
|
|
101
108
|
|
|
@@ -106,10 +113,20 @@ Add a transform with:
|
|
|
106
113
|
- \`field_map\`: maps target keys → source keys (e.g., \`{"url": "href"}\`). Use null for keys not in the source.
|
|
107
114
|
- \`defaults\`: static values to inject (e.g., \`{"wait_ms": 3000, "full_page": true}\`)
|
|
108
115
|
- \`derivations\`: for computed keys (null in field_map), how to derive them from source data
|
|
109
|
-
- strategy: "slugify" (lowercase, replace spaces/special with hyphens), "prefix", "template"
|
|
116
|
+
- strategy: "slugify" (lowercase, replace spaces/special with hyphens), "prefix", "template", "concat"
|
|
110
117
|
- source_key: which source field to derive from
|
|
111
118
|
- prefix/suffix/template: string manipulation params
|
|
112
119
|
|
|
120
|
+
Available derivation strategies:
|
|
121
|
+
- **slugify**: Lowercase, replace spaces/special chars with hyphens. Optionally add prefix/suffix.
|
|
122
|
+
- **prefix**: Prepend a static string.
|
|
123
|
+
- **template**: Format string with \`{value}\` (source field) and \`{date}\` (today's ISO date, YYYY-MM-DD).
|
|
124
|
+
- **concat**: Join multiple parts. Each part can use \`{value}\` and \`{date}\` placeholders.
|
|
125
|
+
Example: \`{ "strategy": "concat", "parts": ["{value}", "-", "{date}"] }\` produces \`my-slug-2026-04-17\`.
|
|
126
|
+
- **passthrough**: No transformation.
|
|
127
|
+
|
|
128
|
+
Use these when the workflow needs runtime-computed values (date-stamped filenames, slugified URLs, templated paths).
|
|
129
|
+
|
|
113
130
|
Example edge with transform:
|
|
114
131
|
\`\`\`
|
|
115
132
|
{
|
|
@@ -132,6 +149,27 @@ Example edge with transform:
|
|
|
132
149
|
|
|
133
150
|
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.
|
|
134
151
|
|
|
152
|
+
### Scalar Derivations on Data Flow Edges
|
|
153
|
+
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.
|
|
154
|
+
|
|
155
|
+
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.
|
|
156
|
+
|
|
157
|
+
Add a \`derivation\` field to the data_flow edge:
|
|
158
|
+
\`\`\`
|
|
159
|
+
{
|
|
160
|
+
"from_step": "trigger", "from_field": "key", "to_step": 3, "to_field": "key",
|
|
161
|
+
"is_session_wire": false,
|
|
162
|
+
"derivation": { "strategy": "concat", "parts": ["{value}", "-", "{date}"] }
|
|
163
|
+
}
|
|
164
|
+
\`\`\`
|
|
165
|
+
|
|
166
|
+
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).
|
|
167
|
+
|
|
168
|
+
Use derivations when:
|
|
169
|
+
- The user wants date-stamped keys, filenames, or identifiers
|
|
170
|
+
- A value needs a prefix/suffix added at runtime
|
|
171
|
+
- Two values need to be concatenated
|
|
172
|
+
|
|
135
173
|
### Input Classification
|
|
136
174
|
- **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.
|
|
137
175
|
- **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.
|
|
@@ -145,6 +183,11 @@ Flatten nested objects containing dynamic values. E.g., \`login: {url, username,
|
|
|
145
183
|
|
|
146
184
|
**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.
|
|
147
185
|
|
|
186
|
+
### Prompt-Mentioned Values Are Dynamic
|
|
187
|
+
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).
|
|
188
|
+
|
|
189
|
+
This is the most common compilation error: treating the user's specific request values as universal defaults. When in doubt, make it dynamic.
|
|
190
|
+
|
|
148
191
|
### Data Flow Wiring Precision
|
|
149
192
|
- **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.
|
|
150
193
|
- **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.
|
|
@@ -15,5 +15,8 @@ export declare const DISCOVER_WORKFLOWS = "\n SELECT *,\n ts_rank_cd(search_
|
|
|
15
15
|
export declare const GET_VERSION_SNAPSHOT = "\n SELECT * FROM lt_yaml_workflow_versions\n WHERE workflow_id = $1 AND version = $2";
|
|
16
16
|
export declare const UPDATE_STATUS_BASE = "UPDATE lt_yaml_workflows SET status = $2";
|
|
17
17
|
export declare const UPDATE_STATUS_SUFFIX = " WHERE id = $1 RETURNING *";
|
|
18
|
+
export declare const UPDATE_CRON_SCHEDULE = "\n UPDATE lt_yaml_workflows\n SET cron_schedule = $2, cron_envelope = $3, execute_as = $4\n WHERE id = $1\n RETURNING *";
|
|
19
|
+
export declare const CLEAR_CRON_SCHEDULE = "\n UPDATE lt_yaml_workflows\n SET cron_schedule = NULL, cron_envelope = NULL, execute_as = NULL\n WHERE id = $1\n RETURNING *";
|
|
20
|
+
export declare const GET_CRON_SCHEDULED_WORKFLOWS = "\n SELECT * FROM lt_yaml_workflows\n WHERE cron_schedule IS NOT NULL AND status = 'active'\n ORDER BY name";
|
|
18
21
|
export declare const FIND_BY_TAGS_ANY = "\n SELECT * FROM lt_yaml_workflows\n WHERE status = 'active' AND tags && $1::text[]\n ORDER BY name";
|
|
19
22
|
export declare const FIND_BY_TAGS_ALL = "\n SELECT * FROM lt_yaml_workflows\n WHERE status = 'active' AND tags @> $1::text[]\n ORDER BY name";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// ─── YAML workflow CRUD ─────────────────────────────────────────────────────
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.FIND_BY_TAGS_ALL = exports.FIND_BY_TAGS_ANY = exports.UPDATE_STATUS_SUFFIX = exports.UPDATE_STATUS_BASE = exports.GET_VERSION_SNAPSHOT = exports.DISCOVER_WORKFLOWS = exports.LIST_VERSIONS = exports.COUNT_VERSIONS = exports.CREATE_VERSION_SNAPSHOT = exports.MARK_APP_ID_CONTENT_DEPLOYED = exports.MARK_CONTENT_DEPLOYED = exports.GET_DISTINCT_APP_IDS = exports.LIST_BY_APP_ID = exports.GET_ACTIVE_YAML_WORKFLOWS = exports.DELETE_YAML_WORKFLOW = exports.UPDATE_YAML_WORKFLOW_VERSION = exports.GET_YAML_WORKFLOW_BY_NAME = exports.GET_YAML_WORKFLOW = exports.CREATE_YAML_WORKFLOW = void 0;
|
|
4
|
+
exports.FIND_BY_TAGS_ALL = exports.FIND_BY_TAGS_ANY = exports.GET_CRON_SCHEDULED_WORKFLOWS = exports.CLEAR_CRON_SCHEDULE = exports.UPDATE_CRON_SCHEDULE = exports.UPDATE_STATUS_SUFFIX = exports.UPDATE_STATUS_BASE = exports.GET_VERSION_SNAPSHOT = exports.DISCOVER_WORKFLOWS = exports.LIST_VERSIONS = exports.COUNT_VERSIONS = exports.CREATE_VERSION_SNAPSHOT = exports.MARK_APP_ID_CONTENT_DEPLOYED = exports.MARK_CONTENT_DEPLOYED = exports.GET_DISTINCT_APP_IDS = exports.LIST_BY_APP_ID = exports.GET_ACTIVE_YAML_WORKFLOWS = exports.DELETE_YAML_WORKFLOW = exports.UPDATE_YAML_WORKFLOW_VERSION = exports.GET_YAML_WORKFLOW_BY_NAME = exports.GET_YAML_WORKFLOW = exports.CREATE_YAML_WORKFLOW = void 0;
|
|
5
5
|
exports.CREATE_YAML_WORKFLOW = `
|
|
6
6
|
INSERT INTO lt_yaml_workflows
|
|
7
7
|
(name, description, app_id, app_version, source_workflow_id,
|
|
@@ -72,6 +72,21 @@ exports.GET_VERSION_SNAPSHOT = `
|
|
|
72
72
|
// ─── Status updates ─────────────────────────────────────────────────────────
|
|
73
73
|
exports.UPDATE_STATUS_BASE = `UPDATE lt_yaml_workflows SET status = $2`;
|
|
74
74
|
exports.UPDATE_STATUS_SUFFIX = ` WHERE id = $1 RETURNING *`;
|
|
75
|
+
// ─── Cron scheduling ────────────────────────────────────────────────────────
|
|
76
|
+
exports.UPDATE_CRON_SCHEDULE = `
|
|
77
|
+
UPDATE lt_yaml_workflows
|
|
78
|
+
SET cron_schedule = $2, cron_envelope = $3, execute_as = $4
|
|
79
|
+
WHERE id = $1
|
|
80
|
+
RETURNING *`;
|
|
81
|
+
exports.CLEAR_CRON_SCHEDULE = `
|
|
82
|
+
UPDATE lt_yaml_workflows
|
|
83
|
+
SET cron_schedule = NULL, cron_envelope = NULL, execute_as = NULL
|
|
84
|
+
WHERE id = $1
|
|
85
|
+
RETURNING *`;
|
|
86
|
+
exports.GET_CRON_SCHEDULED_WORKFLOWS = `
|
|
87
|
+
SELECT * FROM lt_yaml_workflows
|
|
88
|
+
WHERE cron_schedule IS NOT NULL AND status = 'active'
|
|
89
|
+
ORDER BY name`;
|
|
75
90
|
// ─── Tag-based lookup ────────────────────────────────────────────────────────
|
|
76
91
|
exports.FIND_BY_TAGS_ANY = `
|
|
77
92
|
SELECT * FROM lt_yaml_workflows
|
|
@@ -108,12 +108,24 @@ export interface DataFlowEdge {
|
|
|
108
108
|
/** For computed fields (null in fieldMap): derivation hint. */
|
|
109
109
|
derivations?: Record<string, {
|
|
110
110
|
sourceKey: string;
|
|
111
|
-
strategy: 'slugify' | 'prefix' | 'template' | 'passthrough';
|
|
111
|
+
strategy: 'slugify' | 'prefix' | 'template' | 'passthrough' | 'concat';
|
|
112
112
|
prefix?: string;
|
|
113
113
|
suffix?: string;
|
|
114
114
|
template?: string;
|
|
115
|
+
parts?: string[];
|
|
115
116
|
}>;
|
|
116
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* Scalar derivation applied to the wired value before it reaches the consumer.
|
|
120
|
+
* Generates a HotMesh @pipe expression in the YAML input maps.
|
|
121
|
+
*/
|
|
122
|
+
derivation?: {
|
|
123
|
+
strategy: 'concat' | 'template' | 'prefix' | 'slugify' | 'passthrough';
|
|
124
|
+
parts?: string[];
|
|
125
|
+
template?: string;
|
|
126
|
+
prefix?: string;
|
|
127
|
+
suffix?: string;
|
|
128
|
+
};
|
|
117
129
|
}
|
|
118
130
|
/** Per-step semantic annotation from the LLM. */
|
|
119
131
|
export interface StepSpec {
|
|
@@ -130,8 +130,16 @@ function applyDerivation(value, spec) {
|
|
|
130
130
|
result = (spec.prefix || '') + result + (spec.suffix || '');
|
|
131
131
|
break;
|
|
132
132
|
case 'template':
|
|
133
|
-
result = (spec.template || '{value}')
|
|
133
|
+
result = (spec.template || '{value}')
|
|
134
|
+
.replace(/\{value\}/g, result)
|
|
135
|
+
.replace(/\{date\}/g, new Date().toISOString().slice(0, 10));
|
|
134
136
|
break;
|
|
137
|
+
case 'concat': {
|
|
138
|
+
const parts = spec.parts || ['{value}'];
|
|
139
|
+
result = parts.map((p) => p.replace(/\{value\}/g, result)
|
|
140
|
+
.replace(/\{date\}/g, new Date().toISOString().slice(0, 10))).join('');
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
135
143
|
case 'passthrough':
|
|
136
144
|
break;
|
|
137
145
|
}
|
|
@@ -54,6 +54,11 @@ const registeredTopics = new Set();
|
|
|
54
54
|
* - 'llm' -> callLLM() with prompt template interpolation
|
|
55
55
|
*/
|
|
56
56
|
async function registerWorkersForWorkflow(workflow) {
|
|
57
|
+
const defaultRetry = {
|
|
58
|
+
maximumAttempts: 3,
|
|
59
|
+
backoffCoefficient: 2,
|
|
60
|
+
maximumInterval: 30,
|
|
61
|
+
};
|
|
57
62
|
const workerConfigs = [];
|
|
58
63
|
// Clear previously registered workers for this workflow so redeployments
|
|
59
64
|
// pick up updated manifests (e.g., new hook_topic bindings).
|
|
@@ -94,6 +99,7 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
94
99
|
topic: activity.topic,
|
|
95
100
|
workflowName: activity.workflow_name,
|
|
96
101
|
connection: (0, db_1.getConnection)(),
|
|
102
|
+
retry: defaultRetry,
|
|
97
103
|
callback: wrap((0, callbacks_1.buildTransformCallback)(activity)),
|
|
98
104
|
});
|
|
99
105
|
}
|
|
@@ -103,6 +109,7 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
103
109
|
topic: activity.topic,
|
|
104
110
|
workflowName: activity.workflow_name,
|
|
105
111
|
connection: (0, db_1.getConnection)(),
|
|
112
|
+
retry: defaultRetry,
|
|
106
113
|
callback: wrap((0, callbacks_1.buildLlmCallback)(activity)),
|
|
107
114
|
});
|
|
108
115
|
}
|
|
@@ -116,6 +123,7 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
116
123
|
topic: activity.topic,
|
|
117
124
|
workflowName: activity.workflow_name,
|
|
118
125
|
connection: (0, db_1.getConnection)(),
|
|
126
|
+
retry: defaultRetry,
|
|
119
127
|
callback: wrap(async (data) => {
|
|
120
128
|
const args = (data.data || {});
|
|
121
129
|
let mergedArgs = toolArgs ? { ...toolArgs, ...args } : args;
|
|
@@ -136,6 +144,11 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
136
144
|
continue;
|
|
137
145
|
const storedArgs = activity.tool_arguments;
|
|
138
146
|
const yamlHookTopic = hookTopicByEscalationTool.get(activity.activity_id);
|
|
147
|
+
// Identify keys that are wired via input_mappings. When a wired key
|
|
148
|
+
// resolves to nothing (upstream step failed/returned null), we must
|
|
149
|
+
// NOT fall back to stored tool_arguments — that would leak hardcoded
|
|
150
|
+
// values from the original execution trace.
|
|
151
|
+
const wiredKeys = new Set(Object.keys(activity.input_mappings || {}).filter(k => k !== '_scope' && k !== 'workflowName'));
|
|
139
152
|
if (toolName === 'escalate_and_wait') {
|
|
140
153
|
logger_1.loggerRegistry.info(`[yaml-workflow] escalate_and_wait worker: activityId=${activity.activity_id}, hookTopic=${yamlHookTopic || 'NONE'}, mapKeys=[${[...hookTopicByEscalationTool.keys()].join(',')}]`);
|
|
141
154
|
}
|
|
@@ -143,13 +156,20 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
143
156
|
topic: activity.topic,
|
|
144
157
|
workflowName: activity.workflow_name,
|
|
145
158
|
connection: (0, db_1.getConnection)(),
|
|
159
|
+
retry: defaultRetry,
|
|
146
160
|
callback: wrap(async (data) => {
|
|
147
161
|
const args = (data.data || {});
|
|
162
|
+
// Start from stored defaults, then strip any wired keys that
|
|
163
|
+
// didn't arrive (upstream failure) so stale defaults don't leak.
|
|
148
164
|
const mergedArgs = storedArgs ? { ...storedArgs } : {};
|
|
165
|
+
for (const wk of wiredKeys) {
|
|
166
|
+
if (!(wk in args))
|
|
167
|
+
delete mergedArgs[wk];
|
|
168
|
+
}
|
|
149
169
|
for (const [key, value] of Object.entries(args)) {
|
|
150
170
|
if (key === '_scope' || key === 'workflowName')
|
|
151
171
|
continue;
|
|
152
|
-
if (value !== undefined
|
|
172
|
+
if (value !== undefined) {
|
|
153
173
|
mergedArgs[key] = value;
|
|
154
174
|
}
|
|
155
175
|
}
|
|
@@ -172,6 +192,9 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
172
192
|
if (result && typeof result === 'object' && 'error' in result) {
|
|
173
193
|
logger_1.loggerRegistry.error(`[yaml-workflow:worker] ${toolName} error: ${JSON.stringify(result).slice(0, 200)}`);
|
|
174
194
|
}
|
|
195
|
+
if (result == null) {
|
|
196
|
+
logger_1.loggerRegistry.warn(`[yaml-workflow:worker] ${toolName} returned null/undefined`);
|
|
197
|
+
}
|
|
175
198
|
return { metadata: { ...data.metadata }, data: result };
|
|
176
199
|
}),
|
|
177
200
|
});
|
|
@@ -186,6 +209,11 @@ async function registerWorkersForWorkflow(workflow) {
|
|
|
186
209
|
guid: `compiled::${workflow.graph_topic}-${hotmesh_1.HotMesh.guid()}`,
|
|
187
210
|
engine: {
|
|
188
211
|
connection: (0, db_1.getConnection)(),
|
|
212
|
+
retry: {
|
|
213
|
+
maximumAttempts: 3,
|
|
214
|
+
backoffCoefficient: 2,
|
|
215
|
+
maximumInterval: '30s',
|
|
216
|
+
},
|
|
189
217
|
},
|
|
190
218
|
workers: workerConfigs,
|
|
191
219
|
});
|
package/build/system/index.js
CHANGED
|
@@ -77,6 +77,12 @@ function getSystemWorkers() {
|
|
|
77
77
|
workers.push({ taskQueue: 'long-tail-system', workflow: mcpDeterministic });
|
|
78
78
|
}
|
|
79
79
|
catch { /* not available */ }
|
|
80
|
+
// ── Workflow builder (direct YAML construction) ──
|
|
81
|
+
try {
|
|
82
|
+
const { mcpWorkflowBuilder } = require('./workflows/mcp-workflow-builder');
|
|
83
|
+
workers.push({ taskQueue: 'long-tail-system', workflow: mcpWorkflowBuilder });
|
|
84
|
+
}
|
|
85
|
+
catch { /* not available */ }
|
|
80
86
|
}
|
|
81
87
|
return workers;
|
|
82
88
|
}
|
|
@@ -27,10 +27,10 @@ export declare const findTasksSchema: z.ZodObject<{
|
|
|
27
27
|
}, {
|
|
28
28
|
status?: string | undefined;
|
|
29
29
|
workflow_type?: string | undefined;
|
|
30
|
-
limit?: number | undefined;
|
|
31
30
|
workflow_id?: string | undefined;
|
|
32
|
-
|
|
31
|
+
limit?: number | undefined;
|
|
33
32
|
offset?: number | undefined;
|
|
33
|
+
origin_id?: string | undefined;
|
|
34
34
|
}>;
|
|
35
35
|
export declare const getProcessDetailSchema: z.ZodObject<{
|
|
36
36
|
origin_id: z.ZodString;
|
|
@@ -57,9 +57,9 @@ export declare const findEscalationsSchema: z.ZodObject<{
|
|
|
57
57
|
role?: string | undefined;
|
|
58
58
|
status?: "pending" | "resolved" | undefined;
|
|
59
59
|
type?: string | undefined;
|
|
60
|
-
priority?: number | undefined;
|
|
61
60
|
limit?: number | undefined;
|
|
62
61
|
offset?: number | undefined;
|
|
62
|
+
priority?: number | undefined;
|
|
63
63
|
}>;
|
|
64
64
|
export declare const getEscalationStatsSchema: z.ZodObject<{
|
|
65
65
|
period: z.ZodOptional<z.ZodString>;
|
|
@@ -180,12 +180,12 @@ export declare const listMcpServersSchema: z.ZodObject<{
|
|
|
180
180
|
limit: number;
|
|
181
181
|
offset: number;
|
|
182
182
|
status?: string | undefined;
|
|
183
|
-
search?: string | undefined;
|
|
184
183
|
tags?: string | undefined;
|
|
184
|
+
search?: string | undefined;
|
|
185
185
|
}, {
|
|
186
186
|
status?: string | undefined;
|
|
187
|
-
search?: string | undefined;
|
|
188
187
|
tags?: string | undefined;
|
|
188
|
+
search?: string | undefined;
|
|
189
189
|
limit?: number | undefined;
|
|
190
190
|
offset?: number | undefined;
|
|
191
191
|
}>;
|
|
@@ -199,14 +199,14 @@ export declare const updateMcpServerSchema: z.ZodObject<{
|
|
|
199
199
|
id: string;
|
|
200
200
|
name?: string | undefined;
|
|
201
201
|
description?: string | undefined;
|
|
202
|
-
auto_connect?: boolean | undefined;
|
|
203
202
|
tags?: string[] | undefined;
|
|
203
|
+
auto_connect?: boolean | undefined;
|
|
204
204
|
}, {
|
|
205
205
|
id: string;
|
|
206
206
|
name?: string | undefined;
|
|
207
207
|
description?: string | undefined;
|
|
208
|
-
auto_connect?: boolean | undefined;
|
|
209
208
|
tags?: string[] | undefined;
|
|
209
|
+
auto_connect?: boolean | undefined;
|
|
210
210
|
}>;
|
|
211
211
|
export declare const connectMcpServerSchema: z.ZodObject<{
|
|
212
212
|
id: z.ZodString;
|
|
@@ -233,15 +233,15 @@ export declare const listYamlWorkflowsSchema: z.ZodObject<{
|
|
|
233
233
|
limit: number;
|
|
234
234
|
offset: number;
|
|
235
235
|
status?: string | undefined;
|
|
236
|
-
search?: string | undefined;
|
|
237
236
|
app_id?: string | undefined;
|
|
238
237
|
source_workflow_id?: string | undefined;
|
|
238
|
+
search?: string | undefined;
|
|
239
239
|
}, {
|
|
240
240
|
status?: string | undefined;
|
|
241
|
-
search?: string | undefined;
|
|
242
|
-
limit?: number | undefined;
|
|
243
241
|
app_id?: string | undefined;
|
|
244
242
|
source_workflow_id?: string | undefined;
|
|
243
|
+
search?: string | undefined;
|
|
244
|
+
limit?: number | undefined;
|
|
245
245
|
offset?: number | undefined;
|
|
246
246
|
}>;
|
|
247
247
|
export declare const getYamlWorkflowSchema: z.ZodObject<{
|
|
@@ -266,8 +266,8 @@ export declare const createYamlWorkflowSchema: z.ZodObject<{
|
|
|
266
266
|
workflow_id: string;
|
|
267
267
|
workflow_name: string;
|
|
268
268
|
description?: string | undefined;
|
|
269
|
-
tags?: string[] | undefined;
|
|
270
269
|
app_id?: string | undefined;
|
|
270
|
+
tags?: string[] | undefined;
|
|
271
271
|
compilation_feedback?: string | undefined;
|
|
272
272
|
}, {
|
|
273
273
|
name: string;
|
|
@@ -275,8 +275,8 @@ export declare const createYamlWorkflowSchema: z.ZodObject<{
|
|
|
275
275
|
workflow_id: string;
|
|
276
276
|
workflow_name: string;
|
|
277
277
|
description?: string | undefined;
|
|
278
|
-
tags?: string[] | undefined;
|
|
279
278
|
app_id?: string | undefined;
|
|
279
|
+
tags?: string[] | undefined;
|
|
280
280
|
compilation_feedback?: string | undefined;
|
|
281
281
|
}>;
|
|
282
282
|
export declare const deployYamlWorkflowSchema: z.ZodObject<{
|
|
@@ -14,8 +14,8 @@ export declare const findTasksSchema: z.ZodObject<{
|
|
|
14
14
|
}, {
|
|
15
15
|
status?: "pending" | "in_progress" | "completed" | "needs_intervention" | "failed" | undefined;
|
|
16
16
|
workflow_type?: string | undefined;
|
|
17
|
-
limit?: number | undefined;
|
|
18
17
|
workflow_id?: string | undefined;
|
|
18
|
+
limit?: number | undefined;
|
|
19
19
|
origin_id?: string | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export declare const findEscalationsSchema: z.ZodObject<{
|
|
@@ -34,8 +34,8 @@ export declare const findEscalationsSchema: z.ZodObject<{
|
|
|
34
34
|
role?: string | undefined;
|
|
35
35
|
status?: "pending" | "resolved" | undefined;
|
|
36
36
|
type?: string | undefined;
|
|
37
|
-
priority?: number | undefined;
|
|
38
37
|
limit?: number | undefined;
|
|
38
|
+
priority?: number | undefined;
|
|
39
39
|
}>;
|
|
40
40
|
export declare const getProcessSummarySchema: z.ZodObject<{
|
|
41
41
|
workflow_type: z.ZodOptional<z.ZodString>;
|