@hotmeshio/long-tail 0.1.5 → 0.1.7
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 +78 -8
- package/build/api/auth.d.ts +5 -0
- package/build/api/auth.js +42 -0
- package/build/api/bot-accounts.d.ts +50 -0
- package/build/api/bot-accounts.js +215 -0
- package/build/api/controlplane.d.ts +20 -0
- package/build/api/controlplane.js +110 -0
- package/build/api/dba.d.ts +15 -0
- package/build/api/dba.js +68 -0
- package/build/api/escalations.d.ts +70 -0
- package/build/api/escalations.js +656 -0
- package/build/api/exports.d.ts +32 -0
- package/build/api/exports.js +146 -0
- package/build/api/index.d.ts +18 -0
- package/build/api/index.js +54 -0
- package/build/api/insight.d.ts +29 -0
- package/build/api/insight.js +90 -0
- package/build/api/maintenance.d.ts +7 -0
- package/build/api/maintenance.js +28 -0
- package/build/api/mcp-runs.d.ts +16 -0
- package/build/api/mcp-runs.js +62 -0
- package/build/api/mcp.d.ts +52 -0
- package/build/api/mcp.js +212 -0
- package/build/api/namespaces.d.ts +7 -0
- package/build/{routes/escalations/helpers.js → api/namespaces.js} +24 -12
- package/build/api/roles.d.ts +25 -0
- package/build/api/roles.js +159 -0
- package/build/api/settings.d.ts +2 -0
- package/build/api/settings.js +35 -0
- package/build/api/tasks.d.ts +27 -0
- package/build/api/tasks.js +96 -0
- package/build/api/users.d.ts +44 -0
- package/build/api/users.js +162 -0
- package/build/api/workflow-sets.d.ts +26 -0
- package/build/api/workflow-sets.js +119 -0
- package/build/api/workflows.d.ts +48 -0
- package/build/api/workflows.js +298 -0
- package/build/api/yaml-workflows.d.ts +87 -0
- package/build/api/yaml-workflows.js +556 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +6 -1
- package/build/lib/db/migrate.js +3 -6
- package/{lib → build/lib}/db/schemas/001_schema.sql +3 -0
- package/build/lib/db/schemas/004_workflow_sets.sql +29 -0
- package/build/lib/db/schemas/005_unique_graph_topic.sql +7 -0
- package/{lib → build/lib}/db/schemas/011_system_workflow_configs.sql +14 -0
- package/build/lib/db/schemas/016_streamable_http.sql +7 -0
- package/build/lib/events/callback.d.ts +41 -0
- package/build/lib/events/callback.js +98 -0
- package/build/modules/config.js +1 -1
- package/build/routes/auth.js +37 -36
- package/build/routes/bot-accounts.js +34 -164
- package/build/routes/controlplane.js +20 -60
- package/build/routes/dba.js +18 -28
- package/build/routes/docs.js +25 -7
- package/build/routes/escalations/bulk.js +17 -192
- package/build/routes/escalations/list.js +29 -75
- package/build/routes/escalations/resolve.js +3 -193
- package/build/routes/escalations/single.js +13 -122
- package/build/routes/exports.js +44 -95
- package/build/routes/index.js +2 -0
- package/build/routes/insight.js +61 -40
- package/build/routes/maintenance.js +41 -17
- package/build/routes/mcp-runs.js +52 -60
- package/build/routes/mcp.js +55 -161
- package/build/routes/namespaces.js +9 -20
- package/build/routes/roles.js +23 -97
- package/build/routes/settings.js +37 -25
- package/build/routes/tasks.js +28 -64
- package/build/routes/users.js +24 -113
- package/build/routes/workflow-sets.d.ts +2 -0
- package/build/routes/workflow-sets.js +98 -0
- package/build/routes/workflows/config.js +23 -57
- package/build/routes/workflows/discovery.js +11 -85
- package/build/routes/workflows/invocation.js +16 -84
- package/build/routes/yaml-workflows/cron.d.ts +2 -0
- package/build/routes/yaml-workflows/cron.js +68 -0
- package/build/routes/yaml-workflows/crud.js +38 -193
- package/build/routes/yaml-workflows/deployment.js +15 -140
- package/build/routes/yaml-workflows/index.js +4 -1
- package/build/routes/yaml-workflows/versions.js +20 -58
- package/build/sdk/index.d.ts +327 -0
- package/build/sdk/index.js +298 -0
- package/build/services/controlplane/index.d.ts +1 -2
- package/build/services/controlplane/index.js +3 -3
- package/build/services/controlplane/sql.d.ts +2 -2
- package/build/services/controlplane/sql.js +4 -5
- package/build/services/controlplane/types.d.ts +1 -0
- package/build/services/cron/index.d.ts +17 -0
- package/build/services/cron/index.js +94 -1
- package/build/services/export/index.js +6 -1
- package/build/services/hotmesh-utils.js +2 -4
- package/build/services/insight/index.d.ts +18 -0
- package/build/services/insight/index.js +60 -0
- package/build/services/mcp/client/connection.d.ts +9 -0
- package/build/services/mcp/client/connection.js +49 -1
- package/build/services/mcp/client/tools.js +13 -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/mcp-runs/sql.js +1 -1
- package/build/services/workflow-sets/db.d.ts +16 -0
- package/build/services/workflow-sets/db.js +78 -0
- package/build/services/workflow-sets/index.d.ts +1 -0
- package/build/services/workflow-sets/index.js +11 -0
- package/build/services/workflow-sets/sql.d.ts +6 -0
- package/build/services/workflow-sets/sql.js +24 -0
- package/build/services/yaml-workflow/db-utils.d.ts +1 -0
- package/build/services/yaml-workflow/db-utils.js +4 -0
- package/build/services/yaml-workflow/db.d.ts +8 -0
- package/build/services/yaml-workflow/db.js +41 -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 +102 -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 +5 -1
- package/build/services/yaml-workflow/sql.js +23 -3
- package/build/services/yaml-workflow/types.d.ts +16 -1
- package/build/services/yaml-workflow/workers/callbacks.js +16 -2
- package/build/services/yaml-workflow/workers/register.js +36 -1
- package/build/start/adapters.js +4 -0
- package/build/system/index.js +12 -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/knowledge.js +1 -1
- 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 +6 -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 +8 -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 +11 -0
- package/build/system/workflows/mcp-workflow-builder/activities/tool-loader.js +34 -0
- package/build/system/workflows/mcp-workflow-builder/index.d.ts +16 -0
- package/build/system/workflows/mcp-workflow-builder/index.js +253 -0
- package/build/system/workflows/mcp-workflow-builder/prompts.d.ts +8 -0
- package/build/system/workflows/mcp-workflow-builder/prompts.js +316 -0
- package/build/system/workflows/mcp-workflow-planner/activities/analyze.d.ts +11 -0
- package/build/system/workflows/mcp-workflow-planner/activities/analyze.js +36 -0
- package/build/system/workflows/mcp-workflow-planner/activities/index.d.ts +3 -0
- package/build/system/workflows/mcp-workflow-planner/activities/index.js +12 -0
- package/build/system/workflows/mcp-workflow-planner/activities/persist.d.ts +19 -0
- package/build/system/workflows/mcp-workflow-planner/activities/persist.js +55 -0
- package/build/system/workflows/mcp-workflow-planner/activities/plan.d.ts +10 -0
- package/build/system/workflows/mcp-workflow-planner/activities/plan.js +43 -0
- package/build/system/workflows/mcp-workflow-planner/index.d.ts +7 -0
- package/build/system/workflows/mcp-workflow-planner/index.js +152 -0
- package/build/system/workflows/mcp-workflow-planner/prompts.d.ts +7 -0
- package/build/system/workflows/mcp-workflow-planner/prompts.js +77 -0
- package/build/system/workflows/shared/tool-loader.js +3 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/mcp.d.ts +4 -3
- package/build/types/sdk.d.ts +27 -0
- package/build/types/sdk.js +2 -0
- package/build/types/workflow-set.d.ts +44 -0
- package/build/types/workflow-set.js +5 -0
- package/build/types/yaml-workflow.d.ts +6 -2
- package/dashboard/dist/assets/AdminDashboard-DRjkRSjJ.js +2 -0
- package/dashboard/dist/assets/{AdminDashboard-CTyAMUJR.js.map → AdminDashboard-DRjkRSjJ.js.map} +1 -1
- package/dashboard/dist/assets/AvailableEscalationsPage-CnivX4Tz.js +2 -0
- package/dashboard/dist/assets/AvailableEscalationsPage-CnivX4Tz.js.map +1 -0
- package/dashboard/dist/assets/BotPicker-DwwaBhTH.js +2 -0
- package/dashboard/dist/assets/{BotPicker-C51nKFEu.js.map → BotPicker-DwwaBhTH.js.map} +1 -1
- package/dashboard/dist/assets/{CollapsibleSection-BSyfd8uL.js → CollapsibleSection-DQpaVA0M.js} +2 -2
- package/dashboard/dist/assets/{CollapsibleSection-BSyfd8uL.js.map → CollapsibleSection-DQpaVA0M.js.map} +1 -1
- package/dashboard/dist/assets/{ConfirmDeleteModal-CBdhia5T.js → ConfirmDeleteModal-B7JoDNvt.js} +2 -2
- package/dashboard/dist/assets/{ConfirmDeleteModal-CBdhia5T.js.map → ConfirmDeleteModal-B7JoDNvt.js.map} +1 -1
- package/dashboard/dist/assets/{CopyableId-dGlewBCS.js → CopyableId-AqoZayBG.js} +2 -2
- package/dashboard/dist/assets/{CopyableId-dGlewBCS.js.map → CopyableId-AqoZayBG.js.map} +1 -1
- package/dashboard/dist/assets/CredentialsPage-qGw1kQzi.js +2 -0
- package/dashboard/dist/assets/CredentialsPage-qGw1kQzi.js.map +1 -0
- package/dashboard/dist/assets/{CustomDurationPicker-BataWFj8.js → CustomDurationPicker-D1HUQcd0.js} +2 -2
- package/dashboard/dist/assets/{CustomDurationPicker-BataWFj8.js.map → CustomDurationPicker-D1HUQcd0.js.map} +1 -1
- package/dashboard/dist/assets/{DataTable-B3uf5CCo.js → DataTable-DKvSKoVG.js} +2 -2
- package/dashboard/dist/assets/{DataTable-B3uf5CCo.js.map → DataTable-DKvSKoVG.js.map} +1 -1
- package/dashboard/dist/assets/{ElapsedCell-G5oSwTpT.js → ElapsedCell-B0yrReGQ.js} +2 -2
- package/dashboard/dist/assets/{ElapsedCell-G5oSwTpT.js.map → ElapsedCell-B0yrReGQ.js.map} +1 -1
- package/dashboard/dist/assets/{EmptyState-BChBJNGS.js → EmptyState-X0fIzYID.js} +2 -2
- package/dashboard/dist/assets/{EmptyState-BChBJNGS.js.map → EmptyState-X0fIzYID.js.map} +1 -1
- package/dashboard/dist/assets/{EscalationsOverview-CxUv8xjG.js → EscalationsOverview-BQAT9W7r.js} +2 -2
- package/dashboard/dist/assets/{EscalationsOverview-CxUv8xjG.js.map → EscalationsOverview-BQAT9W7r.js.map} +1 -1
- package/dashboard/dist/assets/{EventTable-CVt8B0BZ.js → EventTable-CX1KNLhZ.js} +2 -2
- package/dashboard/dist/assets/{EventTable-CVt8B0BZ.js.map → EventTable-CX1KNLhZ.js.map} +1 -1
- package/dashboard/dist/assets/{FilterBar-CShf0oe7.js → FilterBar-DMTvuQy-.js} +2 -2
- package/dashboard/dist/assets/{FilterBar-CShf0oe7.js.map → FilterBar-DMTvuQy-.js.map} +1 -1
- package/dashboard/dist/assets/ListToolbar-DTOSxoEy.js +2 -0
- package/dashboard/dist/assets/ListToolbar-DTOSxoEy.js.map +1 -0
- package/dashboard/dist/assets/{McpOverview-CbaZRnJl.js → McpOverview-BaKTIWrG.js} +2 -2
- package/dashboard/dist/assets/{McpOverview-CbaZRnJl.js.map → McpOverview-BaKTIWrG.js.map} +1 -1
- package/dashboard/dist/assets/McpQueryDetailPage-CC08T5k8.js +5 -0
- package/dashboard/dist/assets/McpQueryDetailPage-CC08T5k8.js.map +1 -0
- package/dashboard/dist/assets/McpQueryPage-CVfF9dYg.js +2 -0
- package/dashboard/dist/assets/McpQueryPage-CVfF9dYg.js.map +1 -0
- package/dashboard/dist/assets/McpRunDetailPage-CKs1RWeV.js +2 -0
- package/dashboard/dist/assets/McpRunDetailPage-CKs1RWeV.js.map +1 -0
- package/dashboard/dist/assets/McpRunsPage-CcPD_tY1.js +2 -0
- package/dashboard/dist/assets/McpRunsPage-CcPD_tY1.js.map +1 -0
- package/dashboard/dist/assets/{Modal-CI5RBPOQ.js → Modal-_2AbWxJT.js} +2 -2
- package/dashboard/dist/assets/{Modal-CI5RBPOQ.js.map → Modal-_2AbWxJT.js.map} +1 -1
- package/dashboard/dist/assets/OperatorDashboard-BGiRaRDr.js +2 -0
- package/dashboard/dist/assets/OperatorDashboard-BGiRaRDr.js.map +1 -0
- package/dashboard/dist/assets/{PageHeader-SMD9qtOO.js → PageHeader-DVr5Qyzm.js} +2 -2
- package/dashboard/dist/assets/{PageHeader-SMD9qtOO.js.map → PageHeader-DVr5Qyzm.js.map} +1 -1
- package/dashboard/dist/assets/{PageHeaderWithStats-TikLQsTp.js → PageHeaderWithStats-D0KRASML.js} +2 -2
- package/dashboard/dist/assets/{PageHeaderWithStats-TikLQsTp.js.map → PageHeaderWithStats-D0KRASML.js.map} +1 -1
- package/dashboard/dist/assets/{PriorityBadge-CQ0EsLTA.js → PriorityBadge-Bx2559OU.js} +2 -2
- package/dashboard/dist/assets/{PriorityBadge-CQ0EsLTA.js.map → PriorityBadge-Bx2559OU.js.map} +1 -1
- package/dashboard/dist/assets/ProcessDetailPage-69I--sry.js +2 -0
- package/dashboard/dist/assets/ProcessDetailPage-69I--sry.js.map +1 -0
- package/dashboard/dist/assets/ProcessesListPage-BDpUbua2.js +2 -0
- package/dashboard/dist/assets/ProcessesListPage-BDpUbua2.js.map +1 -0
- package/dashboard/dist/assets/{RolePill-Crj4TH5p.js → RolePill-CcAqEaSt.js} +2 -2
- package/dashboard/dist/assets/{RolePill-Crj4TH5p.js.map → RolePill-CcAqEaSt.js.map} +1 -1
- package/dashboard/dist/assets/{RolesPage-C_RInUwS.js → RolesPage-Cl23Hjet.js} +2 -2
- package/dashboard/dist/assets/{RolesPage-C_RInUwS.js.map → RolesPage-Cl23Hjet.js.map} +1 -1
- package/dashboard/dist/assets/{RowActions-Cp5HyK_w.js → RowActions-B4mqIt3Z.js} +2 -2
- package/dashboard/dist/assets/{RowActions-Cp5HyK_w.js.map → RowActions-B4mqIt3Z.js.map} +1 -1
- package/dashboard/dist/assets/{StatCard-BKZLSgNV.js → StatCard-Cz_2OjAZ.js} +2 -2
- package/dashboard/dist/assets/{StatCard-BKZLSgNV.js.map → StatCard-Cz_2OjAZ.js.map} +1 -1
- package/dashboard/dist/assets/{StatusBadge-BYNGGZK5.js → StatusBadge-Wi2FJZsn.js} +2 -2
- package/dashboard/dist/assets/{StatusBadge-BYNGGZK5.js.map → StatusBadge-Wi2FJZsn.js.map} +1 -1
- package/dashboard/dist/assets/StepIndicator-PW5NRDMb.js +2 -0
- package/dashboard/dist/assets/StepIndicator-PW5NRDMb.js.map +1 -0
- package/dashboard/dist/assets/{StickyPagination-CTosgiU2.js → StickyPagination-Bl2Uzz65.js} +2 -2
- package/dashboard/dist/assets/{StickyPagination-CTosgiU2.js.map → StickyPagination-Bl2Uzz65.js.map} +1 -1
- package/dashboard/dist/assets/{SwimlaneTimeline-ylG5Ps1s.js → SwimlaneTimeline-CUPqMd0z.js} +2 -2
- package/dashboard/dist/assets/{SwimlaneTimeline-ylG5Ps1s.js.map → SwimlaneTimeline-CUPqMd0z.js.map} +1 -1
- package/dashboard/dist/assets/TagInput-BLtf86Ly.js +2 -0
- package/dashboard/dist/assets/TagInput-BLtf86Ly.js.map +1 -0
- package/dashboard/dist/assets/{TaskDetailPage-C9pDGdD2.js → TaskDetailPage-BXJFX74D.js} +2 -2
- package/dashboard/dist/assets/{TaskDetailPage-C9pDGdD2.js.map → TaskDetailPage-BXJFX74D.js.map} +1 -1
- package/dashboard/dist/assets/{TaskQueuePill-BtJbZTT0.js → TaskQueuePill-CWYj3xKe.js} +2 -2
- package/dashboard/dist/assets/{TaskQueuePill-BtJbZTT0.js.map → TaskQueuePill-CWYj3xKe.js.map} +1 -1
- package/dashboard/dist/assets/{TasksListPage-DtFLUEhg.js → TasksListPage-C3cX94Mw.js} +2 -2
- package/dashboard/dist/assets/{TasksListPage-DtFLUEhg.js.map → TasksListPage-C3cX94Mw.js.map} +1 -1
- package/dashboard/dist/assets/{TimeAgo-WuM6xImZ.js → TimeAgo-B_5yDDHV.js} +2 -2
- package/dashboard/dist/assets/{TimeAgo-WuM6xImZ.js.map → TimeAgo-B_5yDDHV.js.map} +1 -1
- package/dashboard/dist/assets/{TimestampCell-IVL_-Upy.js → TimestampCell-DRX724uU.js} +2 -2
- package/dashboard/dist/assets/{TimestampCell-IVL_-Upy.js.map → TimestampCell-DRX724uU.js.map} +1 -1
- package/dashboard/dist/assets/{UserName-DU9qeg13.js → UserName-Ca8FA469.js} +2 -2
- package/dashboard/dist/assets/{UserName-DU9qeg13.js.map → UserName-Ca8FA469.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowExecutionPage-BBYWEV2P.js +2 -0
- package/dashboard/dist/assets/WorkflowExecutionPage-BBYWEV2P.js.map +1 -0
- package/dashboard/dist/assets/WorkflowPill-BXifAuLi.js +2 -0
- package/dashboard/dist/assets/{WorkflowPill-Diw8iWBP.js.map → WorkflowPill-BXifAuLi.js.map} +1 -1
- package/dashboard/dist/assets/WorkflowsDashboard-Drl3juz9.js +2 -0
- package/dashboard/dist/assets/WorkflowsDashboard-Drl3juz9.js.map +1 -0
- package/dashboard/dist/assets/{WorkflowsOverview-CPuvA4t3.js → WorkflowsOverview-03IRrDLg.js} +2 -2
- package/dashboard/dist/assets/{WorkflowsOverview-CPuvA4t3.js.map → WorkflowsOverview-03IRrDLg.js.map} +1 -1
- package/dashboard/dist/assets/YamlWorkflowsPage-DC2cLxVi.js +2 -0
- package/dashboard/dist/assets/YamlWorkflowsPage-DC2cLxVi.js.map +1 -0
- package/dashboard/dist/assets/{bots-BPiZXf2h.js → bots-DZEXcgiJ.js} +2 -2
- package/dashboard/dist/assets/{bots-BPiZXf2h.js.map → bots-DZEXcgiJ.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-DTY_OKRh.js → escalation-Cw48lNaF.js} +2 -2
- package/dashboard/dist/assets/{escalation-DTY_OKRh.js.map → escalation-Cw48lNaF.js.map} +1 -1
- package/dashboard/dist/assets/{escalation-columns-C91fHSkp.js → escalation-columns-NINpo3qf.js} +2 -2
- package/dashboard/dist/assets/{escalation-columns-C91fHSkp.js.map → escalation-columns-NINpo3qf.js.map} +1 -1
- package/dashboard/dist/assets/helpers-Cuu3xKfr.js +2 -0
- package/dashboard/dist/assets/helpers-Cuu3xKfr.js.map +1 -0
- package/dashboard/dist/assets/helpers-fk_qr729.js +2 -0
- package/dashboard/dist/assets/helpers-fk_qr729.js.map +1 -0
- package/dashboard/dist/assets/index-B98ipWxE.js +2 -0
- package/dashboard/dist/assets/{index-CDWOfCmi.js.map → index-B98ipWxE.js.map} +1 -1
- package/dashboard/dist/assets/{index-D_qEAYrg.js → index-BIG3KooI.js} +2 -2
- package/dashboard/dist/assets/{index-D_qEAYrg.js.map → index-BIG3KooI.js.map} +1 -1
- package/dashboard/dist/assets/{index-DSzSoku1.js → index-BwN3KP_L.js} +91 -93
- package/dashboard/dist/assets/index-BwN3KP_L.js.map +1 -0
- package/dashboard/dist/assets/index-Bxe8h1x4.js +17 -0
- package/dashboard/dist/assets/index-Bxe8h1x4.js.map +1 -0
- package/dashboard/dist/assets/index-CNI7k7oB.js +6 -0
- package/dashboard/dist/assets/index-CNI7k7oB.js.map +1 -0
- package/dashboard/dist/assets/index-CORHB0WC.js +2 -0
- package/dashboard/dist/assets/index-CORHB0WC.js.map +1 -0
- package/dashboard/dist/assets/index-DcIKW-cZ.css +1 -0
- package/dashboard/dist/assets/index-Dj-z-x8M.js +2 -0
- package/dashboard/dist/assets/index-Dj-z-x8M.js.map +1 -0
- package/dashboard/dist/assets/index-DwRytW9O.js +5 -0
- package/dashboard/dist/assets/index-DwRytW9O.js.map +1 -0
- package/dashboard/dist/assets/index-aRvL-dXp.js +2 -0
- package/dashboard/dist/assets/index-aRvL-dXp.js.map +1 -0
- package/dashboard/dist/assets/index-b03HlbnH.js +2 -0
- package/dashboard/dist/assets/{index-BtOwLI0K.js.map → index-b03HlbnH.js.map} +1 -1
- package/dashboard/dist/assets/mcp-BZoFryNc.js +2 -0
- package/dashboard/dist/assets/mcp-BZoFryNc.js.map +1 -0
- package/dashboard/dist/assets/mcp-query-wiw1kwm8.js +2 -0
- package/dashboard/dist/assets/mcp-query-wiw1kwm8.js.map +1 -0
- package/dashboard/dist/assets/{mcp-runs-DmXYJD19.js → mcp-runs-BaEKnf5v.js} +2 -2
- package/dashboard/dist/assets/{mcp-runs-DmXYJD19.js.map → mcp-runs-BaEKnf5v.js.map} +1 -1
- package/dashboard/dist/assets/{namespaces-DoGa7jc7.js → namespaces-BwnZI4_A.js} +2 -2
- package/dashboard/dist/assets/{namespaces-DoGa7jc7.js.map → namespaces-BwnZI4_A.js.map} +1 -1
- package/dashboard/dist/assets/{roles-wCdQ2Z7k.js → roles-Bgn1K8zU.js} +2 -2
- package/dashboard/dist/assets/{roles-wCdQ2Z7k.js.map → roles-Bgn1K8zU.js.map} +1 -1
- package/dashboard/dist/assets/{settings-DDe_L7JT.js → settings-CizYiutL.js} +2 -2
- package/dashboard/dist/assets/{settings-DDe_L7JT.js.map → settings-CizYiutL.js.map} +1 -1
- package/dashboard/dist/assets/{tasks-3Hih8Bt7.js → tasks-Bmte_hc4.js} +2 -2
- package/dashboard/dist/assets/{tasks-3Hih8Bt7.js.map → tasks-Bmte_hc4.js.map} +1 -1
- package/dashboard/dist/assets/useEventHooks-CUCxpiI2.js +2 -0
- package/dashboard/dist/assets/useEventHooks-CUCxpiI2.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-Cum02Ej9.js} +2 -2
- package/dashboard/dist/assets/useYamlActivityEvents-Cum02Ej9.js.map +1 -0
- package/dashboard/dist/assets/{users-BTagPmGW.js → users-NSDgTt-z.js} +2 -2
- package/dashboard/dist/assets/{users-BTagPmGW.js.map → users-NSDgTt-z.js.map} +1 -1
- package/dashboard/dist/assets/{vendor-icons-DCLlGYO9.js → vendor-icons-D1DdudfH.js} +141 -66
- package/dashboard/dist/assets/vendor-icons-D1DdudfH.js.map +1 -0
- package/dashboard/dist/assets/{workflows-B20dR3NE.js → workflows-k0XRdGXx.js} +2 -2
- package/dashboard/dist/assets/{workflows-B20dR3NE.js.map → workflows-k0XRdGXx.js.map} +1 -1
- package/dashboard/dist/assets/yaml-workflows-DAre8I78.js +2 -0
- package/dashboard/dist/assets/yaml-workflows-DAre8I78.js.map +1 -0
- 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/epic-integration.md +224 -0
- package/docs/escalation-strategies.md +2 -3
- package/docs/events.md +28 -0
- package/docs/mcp.md +301 -31
- package/docs/sdk.md +177 -0
- package/docs/story.md +157 -0
- package/docs/workflow-builder.md +371 -0
- package/package.json +5 -4
- package/build/routes/escalations/helpers.d.ts +0 -5
- package/build/routes/resolve.d.ts +0 -9
- package/build/routes/resolve.js +0 -19
- package/build/routes/yaml-workflows/helpers.d.ts +0 -2
- package/build/routes/yaml-workflows/helpers.js +0 -8
- 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/WorkflowPill-Diw8iWBP.js +0 -2
- 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/dashboard/dist/assets/yaml-workflows-CaLPMQha.js.map +0 -1
- package/docs/img/01-login.png +0 -0
- package/docs/img/02-dashboard-home.png +0 -0
- package/docs/img/03-processes-list.png +0 -0
- package/docs/img/04-escalations-list.png +0 -0
- package/docs/img/05-mcp-servers.png +0 -0
- package/docs/img/06-mcp-pipelines.png +0 -0
- package/docs/img/07-workflows-list.png +0 -0
- package/docs/img/compilation/01-query-submit.png +0 -0
- package/docs/img/compilation/02-mcp-servers.png +0 -0
- package/docs/img/compilation/03-query-completed.png +0 -0
- package/docs/img/compilation/04-wizard-original.png +0 -0
- package/docs/img/compilation/05-wizard-timeline.png +0 -0
- package/docs/img/compilation/06-wizard-profile.png +0 -0
- package/docs/img/compilation/07-wizard-deploy.png +0 -0
- package/docs/img/compilation/08-wizard-test-modal.png +0 -0
- package/docs/img/compilation/09-wizard-test-compare.png +0 -0
- package/docs/img/compilation/10-wizard-verify.png +0 -0
- 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
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.mcpWorkflowBuilder = mcpWorkflowBuilder;
|
|
37
|
+
const hotmesh_1 = require("@hotmeshio/hotmesh");
|
|
38
|
+
const activities = __importStar(require("./activities"));
|
|
39
|
+
const prompts_1 = require("./prompts");
|
|
40
|
+
const { loadBuilderTools, loadReferenceSection, callBuilderLLM, } = hotmesh_1.Durable.workflow.proxyActivities({
|
|
41
|
+
activities,
|
|
42
|
+
retry: {
|
|
43
|
+
maximumAttempts: 3,
|
|
44
|
+
backoffCoefficient: 2,
|
|
45
|
+
maximumInterval: '10 seconds',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const MAX_BUILD_ATTEMPTS = 3;
|
|
49
|
+
const MAX_CLARIFICATION_ROUNDS = 3;
|
|
50
|
+
/**
|
|
51
|
+
* Fix known @pipe anti-patterns in generated YAML.
|
|
52
|
+
*
|
|
53
|
+
* LLMs consistently produce two broken patterns:
|
|
54
|
+
* 1. ['{@date.toISOString}'] then [0, 10] then ['{@string.substring}']
|
|
55
|
+
* → should be ['{@date.toISOString}', 0, 10] then ['{@string.substring}']
|
|
56
|
+
* 2. Bare static rows like ['.png'] after sub-pipes
|
|
57
|
+
* → should be wrapped in '@pipe': [['.png']]
|
|
58
|
+
*
|
|
59
|
+
* This runs deterministically on the YAML string before deployment.
|
|
60
|
+
*/
|
|
61
|
+
function fixPipePatterns(yaml) {
|
|
62
|
+
// Fix pattern 1: function row followed by bare args row followed by another function
|
|
63
|
+
// ['{@date.toISOString}'] → ['{@date.toISOString}', 0, 10]
|
|
64
|
+
// [0, 10] ['{@string.substring}']
|
|
65
|
+
// ['{@string.substring}']
|
|
66
|
+
yaml = yaml.replace(/(\['\{@date\.toISOString\}'\])\s*\n(\s*)- \[0, 10\]\s*\n(\s*)- \['\{@string\.substring\}'\]/g, "['{@date.toISOString}', 0, 10]\n$2- ['{@string.substring}']");
|
|
67
|
+
// Fix field name mismatches the LLM consistently gets wrong
|
|
68
|
+
// Vision: image_path → image (the tool parameter name)
|
|
69
|
+
yaml = yaml.replace(/(\s+)image_path: /g, '$1image: ');
|
|
70
|
+
// Knowledge: content: '{...}' → data: '{...}' (store_knowledge field)
|
|
71
|
+
yaml = yaml.replace(/(\s+)content: '(\{[^}]+\.output\.data\.[^}]+\})'/g, "$1data: '$2'");
|
|
72
|
+
// Vision output: .analysis} → .description} (analyze_image returns description)
|
|
73
|
+
yaml = yaml.replace(/\.analysis\}/g, '.description}');
|
|
74
|
+
return yaml;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* MCP Workflow Builder — constructs HotMesh YAML DAGs directly.
|
|
78
|
+
*
|
|
79
|
+
* Unlike mcpQuery (which executes tools then compiles traces), this workflow
|
|
80
|
+
* reasons about tool schemas and builds the YAML declaratively. The LLM
|
|
81
|
+
* knows HotMesh's activity types, mapping syntax, and @pipe operators.
|
|
82
|
+
*
|
|
83
|
+
* Supports conversational clarification: when the prompt is ambiguous,
|
|
84
|
+
* the LLM returns questions instead of YAML. The user answers, and the
|
|
85
|
+
* exchange continues until the LLM has enough to build.
|
|
86
|
+
*
|
|
87
|
+
* Returns the generated YAML, input schema, and activity manifest —
|
|
88
|
+
* ready for deployment via the existing yaml-workflow infrastructure.
|
|
89
|
+
*/
|
|
90
|
+
async function mcpWorkflowBuilder(envelope) {
|
|
91
|
+
const prompt = (envelope.data?.prompt || envelope.data?.question);
|
|
92
|
+
const tags = envelope.data?.tags;
|
|
93
|
+
const feedback = envelope.data?.feedback;
|
|
94
|
+
const priorYaml = envelope.data?.prior_yaml;
|
|
95
|
+
const answers = envelope.data?.answers;
|
|
96
|
+
const priorQuestions = envelope.data?.prior_questions;
|
|
97
|
+
const compositionContext = envelope.data?.composition_context;
|
|
98
|
+
if (!prompt) {
|
|
99
|
+
return {
|
|
100
|
+
type: 'return',
|
|
101
|
+
data: {
|
|
102
|
+
title: 'No prompt provided',
|
|
103
|
+
summary: 'Describe the workflow you want to build.',
|
|
104
|
+
result: null,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// 1. Discover available MCP tools
|
|
109
|
+
const raw = await loadBuilderTools(tags);
|
|
110
|
+
// 2. Build system prompt with HotMesh spec + tool inventory
|
|
111
|
+
const serverSection = [
|
|
112
|
+
raw.strategy ? `${raw.strategy}\n` : '',
|
|
113
|
+
`## Available MCP Servers & Tools\n\n${raw.inventory}`,
|
|
114
|
+
].filter(Boolean).join('\n');
|
|
115
|
+
// 3. Load composition references if this workflow is part of a plan
|
|
116
|
+
const compositionSections = [];
|
|
117
|
+
if (compositionContext) {
|
|
118
|
+
if (compositionContext.requires_await) {
|
|
119
|
+
const awaitRef = await loadReferenceSection('await');
|
|
120
|
+
if (awaitRef)
|
|
121
|
+
compositionSections.push(awaitRef);
|
|
122
|
+
}
|
|
123
|
+
if (compositionContext.requires_signal) {
|
|
124
|
+
const signalRef = await loadReferenceSection('signal');
|
|
125
|
+
if (signalRef)
|
|
126
|
+
compositionSections.push(signalRef);
|
|
127
|
+
}
|
|
128
|
+
if (compositionContext.sibling_schemas?.length) {
|
|
129
|
+
const siblings = compositionContext.sibling_schemas
|
|
130
|
+
.map(s => `- **${s.name}** (topic: \`${s.graph_topic}\`)\n Input: \`${JSON.stringify(s.input_schema)}\`\n Output: \`${JSON.stringify(s.output_schema)}\``)
|
|
131
|
+
.join('\n');
|
|
132
|
+
compositionSections.push(`## Sibling Workflows in This Plan\n\nThis workflow is part of a multi-workflow set. The following sibling workflows exist in the same namespace and can be invoked using \`type: await\` activities:\n\n${siblings}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const fullInventory = compositionSections.length
|
|
136
|
+
? `${serverSection}\n\n${compositionSections.join('\n\n')}`
|
|
137
|
+
: serverSection;
|
|
138
|
+
const messages = [
|
|
139
|
+
{
|
|
140
|
+
role: 'system',
|
|
141
|
+
content: (0, prompts_1.BUILDER_SYSTEM_PROMPT)(fullInventory),
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
// If refining a prior attempt, inject context
|
|
145
|
+
if (feedback && priorYaml) {
|
|
146
|
+
messages.push({
|
|
147
|
+
role: 'user',
|
|
148
|
+
content: `Build a workflow for: ${prompt}`,
|
|
149
|
+
});
|
|
150
|
+
messages.push({
|
|
151
|
+
role: 'assistant',
|
|
152
|
+
content: `Here is the prior YAML that needs fixing:\n\`\`\`yaml\n${priorYaml.slice(0, 3000)}\n\`\`\``,
|
|
153
|
+
});
|
|
154
|
+
messages.push({
|
|
155
|
+
role: 'user',
|
|
156
|
+
content: `${prompts_1.REFINE_PROMPT}\n\nExecution feedback:\n${feedback}`,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
else if (answers && priorQuestions?.length) {
|
|
160
|
+
// Continuing a clarification conversation
|
|
161
|
+
messages.push({
|
|
162
|
+
role: 'user',
|
|
163
|
+
content: `Build a workflow for: ${prompt}`,
|
|
164
|
+
});
|
|
165
|
+
messages.push({
|
|
166
|
+
role: 'assistant',
|
|
167
|
+
content: JSON.stringify({ clarification_needed: true, questions: priorQuestions }),
|
|
168
|
+
});
|
|
169
|
+
messages.push({
|
|
170
|
+
role: 'user',
|
|
171
|
+
content: `Here are my answers:\n${answers}\n\nNow build the workflow YAML.`,
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
messages.push({
|
|
176
|
+
role: 'user',
|
|
177
|
+
content: `Build a workflow for: ${prompt}`,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
// 3. Ask the LLM to construct the YAML (with retry on parse failure)
|
|
181
|
+
for (let attempt = 0; attempt < MAX_BUILD_ATTEMPTS; attempt++) {
|
|
182
|
+
const response = await callBuilderLLM(messages, undefined);
|
|
183
|
+
const content = response.content || '';
|
|
184
|
+
// Parse the JSON response
|
|
185
|
+
const cleaned = content
|
|
186
|
+
.replace(/^```(?:json)?\s*/m, '')
|
|
187
|
+
.replace(/\s*```$/m, '')
|
|
188
|
+
.trim();
|
|
189
|
+
try {
|
|
190
|
+
const result = JSON.parse(cleaned);
|
|
191
|
+
// Clarification response — LLM needs more info before building
|
|
192
|
+
if (result.clarification_needed && Array.isArray(result.questions)) {
|
|
193
|
+
return {
|
|
194
|
+
type: 'return',
|
|
195
|
+
data: {
|
|
196
|
+
title: 'Clarification Needed',
|
|
197
|
+
summary: 'The builder needs more information before constructing the workflow.',
|
|
198
|
+
clarification_needed: true,
|
|
199
|
+
questions: result.questions,
|
|
200
|
+
tools_identified: result.tools_identified || [],
|
|
201
|
+
},
|
|
202
|
+
milestones: [
|
|
203
|
+
{ name: 'workflow_builder', value: 'clarification' },
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (!result.yaml || !result.name) {
|
|
208
|
+
messages.push({ role: 'assistant', content });
|
|
209
|
+
messages.push({
|
|
210
|
+
role: 'user',
|
|
211
|
+
content: 'Response is missing required fields. Return a JSON object with: name, description, yaml, input_schema, activity_manifest, tags, sample_inputs. Or if you need more information, return { "clarification_needed": true, "questions": ["..."] }.',
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
// Fix known @pipe anti-patterns before returning
|
|
216
|
+
const fixedYaml = fixPipePatterns(result.yaml);
|
|
217
|
+
return {
|
|
218
|
+
type: 'return',
|
|
219
|
+
data: {
|
|
220
|
+
title: `Workflow: ${result.name}`,
|
|
221
|
+
summary: result.description || 'Workflow built successfully.',
|
|
222
|
+
name: result.name,
|
|
223
|
+
description: result.description,
|
|
224
|
+
yaml: fixedYaml,
|
|
225
|
+
input_schema: result.input_schema,
|
|
226
|
+
activity_manifest: result.activity_manifest,
|
|
227
|
+
tags: result.tags,
|
|
228
|
+
sample_inputs: result.sample_inputs,
|
|
229
|
+
build_attempts: attempt + 1,
|
|
230
|
+
},
|
|
231
|
+
milestones: [
|
|
232
|
+
{ name: 'workflow_builder', value: 'completed' },
|
|
233
|
+
{ name: 'build_attempts', value: String(attempt + 1) },
|
|
234
|
+
],
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
messages.push({ role: 'assistant', content });
|
|
239
|
+
messages.push({
|
|
240
|
+
role: 'user',
|
|
241
|
+
content: 'Invalid JSON. Return a single JSON object (no markdown fences) with: name, description, yaml, input_schema, activity_manifest, tags, sample_inputs.',
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
type: 'return',
|
|
247
|
+
data: {
|
|
248
|
+
title: 'Build Failed',
|
|
249
|
+
summary: 'Could not generate valid workflow YAML after multiple attempts.',
|
|
250
|
+
result: null,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Externalized prompts for the workflow builder.
|
|
3
|
+
*
|
|
4
|
+
* The system prompt teaches the LLM how to construct HotMesh YAML DAGs
|
|
5
|
+
* directly from tool schemas — no execution trace needed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function BUILDER_SYSTEM_PROMPT(toolInventory: string): string;
|
|
8
|
+
export declare const REFINE_PROMPT = "The workflow was tested and produced errors or incorrect results. Review the execution trace below and fix the YAML.\n\nCommon issues:\n- Missing .png extension on screenshot paths\n- Field name mismatch between output and input (e.g., producer outputs \"path\" but consumer expects \"image\")\n- Missing _scope or workflowName in input.maps\n- Wrong activity ID references in mappings\n- Missing job.maps on the final activity\n\nReturn the same JSON format as before with corrected yaml, activity_manifest, etc.";
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Externalized prompts for the workflow builder.
|
|
4
|
+
*
|
|
5
|
+
* The system prompt teaches the LLM how to construct HotMesh YAML DAGs
|
|
6
|
+
* directly from tool schemas — no execution trace needed.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.REFINE_PROMPT = void 0;
|
|
10
|
+
exports.BUILDER_SYSTEM_PROMPT = BUILDER_SYSTEM_PROMPT;
|
|
11
|
+
function BUILDER_SYSTEM_PROMPT(toolInventory) {
|
|
12
|
+
return `You are a HotMesh workflow builder. Given a natural language description and a set of available MCP tools, you construct a deterministic YAML DAG workflow.
|
|
13
|
+
|
|
14
|
+
You do NOT execute tools. You reason about their input/output schemas and build the YAML declaratively.
|
|
15
|
+
|
|
16
|
+
## HotMesh YAML Structure
|
|
17
|
+
|
|
18
|
+
A workflow is a YAML document with this shape:
|
|
19
|
+
|
|
20
|
+
\`\`\`yaml
|
|
21
|
+
app:
|
|
22
|
+
id: longtail
|
|
23
|
+
version: '1'
|
|
24
|
+
graphs:
|
|
25
|
+
- subscribes: <workflow-topic>
|
|
26
|
+
expire: 300
|
|
27
|
+
input:
|
|
28
|
+
schema:
|
|
29
|
+
type: object
|
|
30
|
+
properties:
|
|
31
|
+
<trigger inputs the user provides at runtime>
|
|
32
|
+
required: [<required input keys>]
|
|
33
|
+
output:
|
|
34
|
+
schema:
|
|
35
|
+
type: object
|
|
36
|
+
activities:
|
|
37
|
+
<activity definitions>
|
|
38
|
+
transitions:
|
|
39
|
+
<activity-id>:
|
|
40
|
+
- to: <next-activity-id>
|
|
41
|
+
\`\`\`
|
|
42
|
+
|
|
43
|
+
## Activity Types
|
|
44
|
+
|
|
45
|
+
### trigger
|
|
46
|
+
Entry point. Receives user input. Always the first activity.
|
|
47
|
+
\`\`\`yaml
|
|
48
|
+
trigger_x8kf:
|
|
49
|
+
title: Trigger
|
|
50
|
+
type: trigger
|
|
51
|
+
output:
|
|
52
|
+
schema:
|
|
53
|
+
type: object
|
|
54
|
+
\`\`\`
|
|
55
|
+
|
|
56
|
+
### worker
|
|
57
|
+
Executes an MCP tool. Receives data via input.maps, produces output. Same suffix as the trigger.
|
|
58
|
+
\`\`\`yaml
|
|
59
|
+
capture_x8kf:
|
|
60
|
+
title: Capture Page
|
|
61
|
+
type: worker
|
|
62
|
+
topic: <same as subscribes>
|
|
63
|
+
input:
|
|
64
|
+
schema:
|
|
65
|
+
type: object
|
|
66
|
+
maps:
|
|
67
|
+
url: '{trigger_x8kf.output.data.url}'
|
|
68
|
+
screenshot_path:
|
|
69
|
+
'@pipe':
|
|
70
|
+
- ['{trigger_x8kf.output.data.slug}', '.png']
|
|
71
|
+
- ['{@string.concat}']
|
|
72
|
+
workflowName: capture_page
|
|
73
|
+
output:
|
|
74
|
+
schema:
|
|
75
|
+
type: object
|
|
76
|
+
\`\`\`
|
|
77
|
+
|
|
78
|
+
### hook
|
|
79
|
+
Durable pause point with three modes:
|
|
80
|
+
- **Web hook**: Pauses until an external signal arrives. Define \`hook: { type: object, properties: {...} }\` for the expected signal schema. Receives signal data via \`{$self.hook.data.*}\`. Requires a matching entry in the graph-level \`hooks:\` section.
|
|
81
|
+
- **Sleep**: Pauses for a duration. \`sleep: 5\` pauses 5 seconds. Supports @pipe expressions for dynamic delays.
|
|
82
|
+
- **Cycle pivot**: When \`cycle: true\`, becomes an iteration anchor that a cycle activity can loop back to.
|
|
83
|
+
- **Passthrough**: No hook/sleep config — acts as a data-mapping convergence point, executes immediately.
|
|
84
|
+
|
|
85
|
+
### cycle
|
|
86
|
+
Loop back to a hook ancestor marked \`cycle: true\`. Each iteration runs in isolated state, but \`job.maps\` accumulates across iterations.
|
|
87
|
+
|
|
88
|
+
## Data Mapping Rules
|
|
89
|
+
|
|
90
|
+
### Simple reference (wire one activity's output to another's input):
|
|
91
|
+
\`\`\`yaml
|
|
92
|
+
field_name: '{sourceActivity.output.data.fieldName}'
|
|
93
|
+
\`\`\`
|
|
94
|
+
|
|
95
|
+
### @pipe — Reverse Polish Notation (operands THEN operator)
|
|
96
|
+
|
|
97
|
+
@pipe uses **stack-machine / RPN evaluation**: each row is evaluated top-to-bottom. A row is either OPERANDS (data for the next function) or an OPERATOR (a function that consumes the row above it). The rule is simple and absolute:
|
|
98
|
+
|
|
99
|
+
> **ALL operands for a function must appear on the single row ABOVE the function row.**
|
|
100
|
+
|
|
101
|
+
A function row contains ONLY the function reference: \`['{@string.substring}']\`. It receives its arguments from the row immediately above it. The first element on the operands row is typically a dynamic reference that resolves at runtime; the remaining elements are literal values.
|
|
102
|
+
|
|
103
|
+
#### Simple pipe (no extra args):
|
|
104
|
+
\`\`\`yaml
|
|
105
|
+
field_name:
|
|
106
|
+
'@pipe':
|
|
107
|
+
- ['{source.output.data.value}', '-suffix'] # operands: value, suffix
|
|
108
|
+
- ['{@string.concat}'] # operator: concat(value, suffix) → "hello-suffix"
|
|
109
|
+
- ['{@string.toLowerCase}'] # operator: toLowerCase("hello-suffix")
|
|
110
|
+
\`\`\`
|
|
111
|
+
When a function takes only one argument (the result of the prior row), it needs no separate operands row — it just consumes what's above.
|
|
112
|
+
|
|
113
|
+
#### Multi-arg function (THIS IS THE PATTERN LLMs GET WRONG):
|
|
114
|
+
\`\`\`yaml
|
|
115
|
+
date_substring:
|
|
116
|
+
'@pipe':
|
|
117
|
+
- ['{@date.now}'] # operator: date.now() → 1713528000000
|
|
118
|
+
- ['{@date.toISOString}', 0, 10] # operands: [isoString, 0, 10] for substring
|
|
119
|
+
- ['{@string.substring}'] # operator: substring(isoString, 0, 10) → "2026-04-19"
|
|
120
|
+
\`\`\`
|
|
121
|
+
Row 2 is the OPERANDS row for substring. It contains THREE values:
|
|
122
|
+
1. \`{@date.toISOString}\` — resolves dynamically (converts epoch → "2026-04-19T12:00:00.000Z")
|
|
123
|
+
2. \`0\` — start index (literal)
|
|
124
|
+
3. \`10\` — end index (literal)
|
|
125
|
+
|
|
126
|
+
Row 3 is the OPERATOR row: \`substring\` consumes all three values from row 2.
|
|
127
|
+
|
|
128
|
+
**COMMON MISTAKE** (NEVER DO THIS):
|
|
129
|
+
\`\`\`yaml
|
|
130
|
+
# WRONG — puts args on the operator row instead of the operands row above it
|
|
131
|
+
- ['{@date.toISOString}']
|
|
132
|
+
- ['{@string.substring}', 0, 10] # ← BROKEN: 0, 10 must be on the row ABOVE
|
|
133
|
+
\`\`\`
|
|
134
|
+
\`\`\`yaml
|
|
135
|
+
# ALSO WRONG — splits operands across two rows
|
|
136
|
+
- ['{@date.toISOString}']
|
|
137
|
+
- [0, 10] # ← BROKEN: operands separated from the dynamic value
|
|
138
|
+
- ['{@string.substring}']
|
|
139
|
+
\`\`\`
|
|
140
|
+
The ONLY correct form: all operands together on ONE row, operator alone on the NEXT row.
|
|
141
|
+
|
|
142
|
+
**PREFERRED for dates**: Use \`{@date.yyyymmdd}\` which returns "YYYY-MM-DD" directly — no pipe needed:
|
|
143
|
+
\`\`\`yaml
|
|
144
|
+
today: '{@date.yyyymmdd}'
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
### Nested @pipe (fan-out/fan-in):
|
|
148
|
+
Sub-pipes must be ROW-LEVEL entries in the parent pipe array — each is a separate row, NOT an element inside another row's array. Sub-pipes resolve first, then their results become args to the final function row.
|
|
149
|
+
\`\`\`yaml
|
|
150
|
+
dated_key:
|
|
151
|
+
'@pipe':
|
|
152
|
+
- '@pipe':
|
|
153
|
+
- ['{trigger_x8kf.output.data.slug}', '-']
|
|
154
|
+
- ['{@string.concat}']
|
|
155
|
+
- '@pipe':
|
|
156
|
+
- ['{@date.now}']
|
|
157
|
+
- ['{@date.toISOString}', 0, 10]
|
|
158
|
+
- ['{@string.substring}']
|
|
159
|
+
- ['{@string.concat}']
|
|
160
|
+
\`\`\`
|
|
161
|
+
This produces \`my-slug-2026-04-19\`. Sub-pipe 1: \`slug + "-"\`. Sub-pipe 2: today as YYYY-MM-DD (RPN: operands then operator). Final row: concat all sub-pipe results.
|
|
162
|
+
|
|
163
|
+
CRITICAL RULES for nested @pipe:
|
|
164
|
+
1. Never put a nested \`@pipe\` object INSIDE an array row. Each sub-pipe must be its own row in the parent.
|
|
165
|
+
2. Maximum nesting depth is 2 levels (parent @pipe containing sub-pipe rows). Never nest a @pipe inside a @pipe inside a @pipe.
|
|
166
|
+
3. For multi-part string building (e.g., domain/key/date.png), use a SINGLE flat @pipe with multiple sub-pipe rows — one per part — then a final \`['{@string.concat}']\` row. EVERY row must be either a sub-pipe object OR a function call array. Static values MUST be wrapped in a sub-pipe:
|
|
167
|
+
\`\`\`yaml
|
|
168
|
+
path:
|
|
169
|
+
'@pipe':
|
|
170
|
+
- '@pipe':
|
|
171
|
+
- ['{trigger_x8kf.output.data.domain}', '/', '{trigger_x8kf.output.data.key}', '/']
|
|
172
|
+
- ['{@string.concat}']
|
|
173
|
+
- '@pipe':
|
|
174
|
+
- ['{@date.now}']
|
|
175
|
+
- ['{@date.toISOString}', 0, 10]
|
|
176
|
+
- ['{@string.substring}']
|
|
177
|
+
- '@pipe':
|
|
178
|
+
- ['.png']
|
|
179
|
+
- ['{@string.concat}']
|
|
180
|
+
\`\`\`
|
|
181
|
+
This resolves: sub-pipe1 → "research/google/", sub-pipe2 → "2026-04-19", sub-pipe3 → ".png", then concat all → "research/google/2026-04-19.png".
|
|
182
|
+
|
|
183
|
+
IMPORTANT: A bare array like \`['.png']\` as a row after sub-pipes will CRASH — HotMesh interprets it as a function call. Always wrap static values in \`'@pipe': - [value]\`.
|
|
184
|
+
|
|
185
|
+
### Available @pipe operators (every JS method is exposed):
|
|
186
|
+
- **@string**: charAt, concat, endsWith, includes, indexOf, lastIndexOf, padEnd, padStart, repeat, replace, search, slice, split, startsWith, substring, toLowerCase, toUpperCase, trim, trimEnd, trimStart
|
|
187
|
+
- **@date**: now, toISOString, toDateString, yyyymmdd (returns "YYYY-MM-DD" directly — preferred for date strings), getFullYear, getMonth, getDate, getDay, getHours, getMinutes, getSeconds, getTime, fromISOString, parse, UTC, toLocaleDateString, setFullYear, setMonth, setDate (full JS Date API)
|
|
188
|
+
- **@math**: add, subtract, multiply, divide, abs, ceil, floor, round, trunc, pow, sqrt, max, min, random
|
|
189
|
+
- **@number**: gt, gte, lt, lte, isFinite, isInteger, isEven, isOdd, isNaN, parseFloat, parseInt, toFixed, toExponential, toPrecision
|
|
190
|
+
- **@array**: get, length, concat, indexOf, join, lastIndexOf, pop, push, reverse, shift, slice, sort, splice, unshift
|
|
191
|
+
- **@object**: get, set, create, keys, values, entries, fromEntries, assign, hasOwnProperty, freeze
|
|
192
|
+
- **@conditional**: ternary, equality, strict_equality, inequality, strict_inequality, greater_than, less_than, greater_than_or_equal, less_than_or_equal, nullish
|
|
193
|
+
- **@json**: parse, stringify
|
|
194
|
+
- **@logical**: and, or
|
|
195
|
+
- **@bitwise**: and, or, xor, leftShift, rightShift
|
|
196
|
+
|
|
197
|
+
### Three mapping directions per activity:
|
|
198
|
+
- **input.maps**: Wire data INTO this activity from trigger or upstream activities
|
|
199
|
+
- **output.maps**: Transform this activity's own output before downstream consumption
|
|
200
|
+
- **job.maps**: Promote data to shared workflow state (use on LAST activity for workflow result)
|
|
201
|
+
|
|
202
|
+
## Construction Rules
|
|
203
|
+
|
|
204
|
+
1. **Trigger first**: Every workflow starts with a trigger activity
|
|
205
|
+
2. **Worker per tool**: Each MCP tool call is a worker activity
|
|
206
|
+
3. **Collision-proof activity IDs**: Multiple workflows share the same app namespace. Activity IDs MUST be globally unique within the app. Use a descriptive name with a shared 4-char random suffix appended to every activity in the flow: \`trigger_x8kf\`, \`capture_x8kf\`, \`analyze_x8kf\`, \`store_x8kf\`. The suffix is the same for all activities in one workflow but unique across workflows. NEVER use bare names like \`trigger\`, \`capture\`, \`analyze\` — they WILL collide with other workflows in the same app.
|
|
207
|
+
4. **workflowName**: Every worker MUST have \`workflowName: '<tool_name>'\` in its input.maps — this routes to the correct MCP tool handler
|
|
208
|
+
5. **_scope threading**: Every worker MUST have \`_scope: '{trigger_x8kf.output.data._scope}'\` (using YOUR trigger's ID) for IAM context
|
|
209
|
+
6. **Wire outputs forward**: Use \`{prevActivity.output.data.fieldName}\` to pass data between steps
|
|
210
|
+
7. **Use @pipe for transforms**: When a value needs runtime computation (date stamp, string concat, slugify), use @pipe — never hardcode computed values
|
|
211
|
+
8. **Simple fields stay simple**: If a field just passes a trigger value through (domain, key, url), use a plain reference like \`'{trigger_x8kf.output.data.domain}'\` — NEVER wrap it in @pipe. Only use @pipe when actual transformation is needed.
|
|
212
|
+
9. **File extensions**: Screenshot paths MUST include .png extension. Use @pipe concat if deriving from a slug
|
|
213
|
+
10. **job.maps on last activity**: The final activity should have job.maps to promote output fields to the workflow result
|
|
214
|
+
11. **Linear transitions**: Chain activities with transitions unless branching or iteration is needed
|
|
215
|
+
12. **Conditional transitions**: For branching, use multi-target transitions with conditions:
|
|
216
|
+
\`\`\`yaml
|
|
217
|
+
transitions:
|
|
218
|
+
check_x8kf:
|
|
219
|
+
- to: handle_error_x8kf
|
|
220
|
+
conditions:
|
|
221
|
+
code: 500
|
|
222
|
+
- to: proceed_x8kf
|
|
223
|
+
\`\`\`
|
|
224
|
+
Conditions can match on \`code\` (HTTP status) or \`match\` (field comparisons). The first matching condition wins; the last entry (no conditions) is the default.
|
|
225
|
+
13. **Trigger stats for idempotency**: Use \`stats.id\` and \`stats.key\` on the trigger when the workflow needs custom job IDs or indexed lookups:
|
|
226
|
+
\`\`\`yaml
|
|
227
|
+
trigger_x8kf:
|
|
228
|
+
type: trigger
|
|
229
|
+
stats:
|
|
230
|
+
id: '{$self.input.data.workflowId}'
|
|
231
|
+
key: '{$self.input.data.entityId}'
|
|
232
|
+
\`\`\`
|
|
233
|
+
|
|
234
|
+
## Activity Manifest
|
|
235
|
+
|
|
236
|
+
Along with the YAML, produce an activity_manifest array describing each activity. Note how all activity IDs share the same random suffix (\`_x8kf\`) for collision-proofing while remaining human-readable:
|
|
237
|
+
\`\`\`json
|
|
238
|
+
[
|
|
239
|
+
{
|
|
240
|
+
"activity_id": "trigger_x8kf",
|
|
241
|
+
"title": "Trigger",
|
|
242
|
+
"type": "trigger",
|
|
243
|
+
"tool_source": "trigger",
|
|
244
|
+
"topic": "<workflow-topic>",
|
|
245
|
+
"input_mappings": {},
|
|
246
|
+
"output_fields": ["url", "slug"]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"activity_id": "capture_x8kf",
|
|
250
|
+
"title": "Capture Page",
|
|
251
|
+
"type": "worker",
|
|
252
|
+
"tool_source": "mcp",
|
|
253
|
+
"topic": "<workflow-topic>",
|
|
254
|
+
"workflow_name": "capture_page",
|
|
255
|
+
"mcp_server_id": "long-tail-playwright-cli",
|
|
256
|
+
"mcp_tool_name": "capture_page",
|
|
257
|
+
"tool_arguments": {},
|
|
258
|
+
"input_mappings": { "url": "{trigger_x8kf.output.data.url}" },
|
|
259
|
+
"output_fields": ["page_id", "path", "url", "title"]
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
\`\`\`
|
|
263
|
+
|
|
264
|
+
## Clarification Protocol
|
|
265
|
+
|
|
266
|
+
If the user's description is ambiguous or missing critical details, ask clarifying questions BEFORE building. Return:
|
|
267
|
+
{
|
|
268
|
+
"clarification_needed": true,
|
|
269
|
+
"questions": [
|
|
270
|
+
"Which tools should capture the screenshot — capture_page (simple URL+screenshot) or login_and_capture (authenticated)?",
|
|
271
|
+
"What fields should the user provide at runtime? (e.g., URL, domain, key)",
|
|
272
|
+
"Should the analysis description be stored as-is or with additional metadata?"
|
|
273
|
+
],
|
|
274
|
+
"tools_identified": ["capture_page", "analyze_image", "store_knowledge"]
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
Ask for clarification when:
|
|
278
|
+
- The prompt doesn't specify which tools to use and multiple options exist
|
|
279
|
+
- Input/output expectations are unclear (what does the user provide vs what is derived?)
|
|
280
|
+
- The data flow between steps is ambiguous (e.g., should the screenshot path be user-provided or auto-derived?)
|
|
281
|
+
- File naming conventions aren't specified (date-stamped? slugified?)
|
|
282
|
+
|
|
283
|
+
Do NOT ask for clarification when:
|
|
284
|
+
- The prompt is specific enough to build (mentions tools, inputs, and expected behavior)
|
|
285
|
+
- The user has already answered prior questions (answers are provided)
|
|
286
|
+
- Only one reasonable tool choice exists for each step
|
|
287
|
+
|
|
288
|
+
When the user provides answers to your questions, build the workflow immediately.
|
|
289
|
+
|
|
290
|
+
## Output Format
|
|
291
|
+
|
|
292
|
+
CRITICAL: The "name" field MUST match the "subscribes" topic in the YAML exactly. Use lowercase with dots as separators (e.g. "screenshot.analyze.store", "capture.page", "daily.report"). Dashes and underscores are also allowed but dots are preferred. The name and subscribes topic MUST be identical.
|
|
293
|
+
|
|
294
|
+
Return a JSON object (no markdown fences):
|
|
295
|
+
{
|
|
296
|
+
"name": "screenshot.analyze.store",
|
|
297
|
+
"description": "What this workflow does",
|
|
298
|
+
"yaml": "<the complete YAML string>",
|
|
299
|
+
"input_schema": { <JSON Schema for trigger inputs> },
|
|
300
|
+
"activity_manifest": [ <manifest entries> ],
|
|
301
|
+
"tags": ["relevant", "tags"],
|
|
302
|
+
"sample_inputs": { <example trigger values for testing> }
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
${toolInventory}`;
|
|
306
|
+
}
|
|
307
|
+
exports.REFINE_PROMPT = `The workflow was tested and produced errors or incorrect results. Review the execution trace below and fix the YAML.
|
|
308
|
+
|
|
309
|
+
Common issues:
|
|
310
|
+
- Missing .png extension on screenshot paths
|
|
311
|
+
- Field name mismatch between output and input (e.g., producer outputs "path" but consumer expects "image")
|
|
312
|
+
- Missing _scope or workflowName in input.maps
|
|
313
|
+
- Wrong activity ID references in mappings
|
|
314
|
+
- Missing job.maps on the final activity
|
|
315
|
+
|
|
316
|
+
Return the same JSON format as before with corrected yaml, activity_manifest, etc.`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analyze a specification to determine whether it requires plan mode.
|
|
3
|
+
* Returns structural signals extracted from the input.
|
|
4
|
+
*/
|
|
5
|
+
export interface SpecAnalysis {
|
|
6
|
+
requires_plan: boolean;
|
|
7
|
+
signal_count: number;
|
|
8
|
+
char_count: number;
|
|
9
|
+
signals_found: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function analyzeSpecification(specification: string): Promise<SpecAnalysis>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Analyze a specification to determine whether it requires plan mode.
|
|
4
|
+
* Returns structural signals extracted from the input.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.analyzeSpecification = analyzeSpecification;
|
|
8
|
+
const PLAN_SIGNALS = [
|
|
9
|
+
/\bworkflow[s]?\b/gi,
|
|
10
|
+
/\bstep\s+\d/gi,
|
|
11
|
+
/\bphase\s+\d/gi,
|
|
12
|
+
/\bfirst\b.*\bthen\b/gi,
|
|
13
|
+
/\bcompos/gi,
|
|
14
|
+
/\borchestrat/gi,
|
|
15
|
+
/\bpipeline/gi,
|
|
16
|
+
/\bsub-?process/gi,
|
|
17
|
+
/\bplan\b/gi,
|
|
18
|
+
];
|
|
19
|
+
const MIN_PLAN_LENGTH = 500;
|
|
20
|
+
async function analyzeSpecification(specification) {
|
|
21
|
+
const charCount = specification.length;
|
|
22
|
+
const signalsFound = [];
|
|
23
|
+
for (const pattern of PLAN_SIGNALS) {
|
|
24
|
+
const matches = specification.match(pattern);
|
|
25
|
+
if (matches?.length) {
|
|
26
|
+
signalsFound.push(matches[0]);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const requiresPlan = charCount >= MIN_PLAN_LENGTH && signalsFound.length >= 2;
|
|
30
|
+
return {
|
|
31
|
+
requires_plan: requiresPlan,
|
|
32
|
+
signal_count: signalsFound.length,
|
|
33
|
+
char_count: charCount,
|
|
34
|
+
signals_found: signalsFound,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deploySetNamespaces = exports.updateSetStatus = exports.persistBuiltWorkflow = exports.persistPlan = exports.generatePlan = exports.analyzeSpecification = void 0;
|
|
4
|
+
var analyze_1 = require("./analyze");
|
|
5
|
+
Object.defineProperty(exports, "analyzeSpecification", { enumerable: true, get: function () { return analyze_1.analyzeSpecification; } });
|
|
6
|
+
var plan_1 = require("./plan");
|
|
7
|
+
Object.defineProperty(exports, "generatePlan", { enumerable: true, get: function () { return plan_1.generatePlan; } });
|
|
8
|
+
var persist_1 = require("./persist");
|
|
9
|
+
Object.defineProperty(exports, "persistPlan", { enumerable: true, get: function () { return persist_1.persistPlan; } });
|
|
10
|
+
Object.defineProperty(exports, "persistBuiltWorkflow", { enumerable: true, get: function () { return persist_1.persistBuiltWorkflow; } });
|
|
11
|
+
Object.defineProperty(exports, "updateSetStatus", { enumerable: true, get: function () { return persist_1.updateSetStatus; } });
|
|
12
|
+
Object.defineProperty(exports, "deploySetNamespaces", { enumerable: true, get: function () { return persist_1.deploySetNamespaces; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence activities for the workflow planner.
|
|
3
|
+
* These are side-effect functions that update the database.
|
|
4
|
+
*/
|
|
5
|
+
import type { PlanItem, LTWorkflowSetStatus } from '../../../../types/workflow-set';
|
|
6
|
+
export declare function persistPlan(setId: string, planItems: PlanItem[]): Promise<void>;
|
|
7
|
+
export interface BuiltWorkflowData {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
yaml_content: string;
|
|
11
|
+
input_schema: Record<string, unknown>;
|
|
12
|
+
output_schema: Record<string, unknown>;
|
|
13
|
+
activity_manifest: unknown[];
|
|
14
|
+
tags: string[];
|
|
15
|
+
graph_topic: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function persistBuiltWorkflow(setId: string, planItem: PlanItem, builderOutput: BuiltWorkflowData): Promise<string>;
|
|
18
|
+
export declare function updateSetStatus(setId: string, status: LTWorkflowSetStatus): Promise<void>;
|
|
19
|
+
export declare function deploySetNamespaces(namespaces: string[]): Promise<void>;
|