@open-mercato/core 0.7.1-develop.7193.1.910a5b0a1e → 0.7.1-develop.7195.1.b5efd1d51a
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/.turbo/turbo-build.log +2 -2
- package/AGENTS.md +4 -3
- package/agentic/standalone-guide.md +1 -1
- package/build.mjs +16 -0
- package/dist/bootstrap.js +7 -3
- package/dist/bootstrap.js.map +2 -2
- package/dist/generated/entities/action_log/index.js +2 -0
- package/dist/generated/entities/action_log/index.js.map +2 -2
- package/dist/generated/entities/user/index.js +2 -0
- package/dist/generated/entities/user/index.js.map +2 -2
- package/dist/generated/entities/user_task/index.js +14 -0
- package/dist/generated/entities/user_task/index.js.map +2 -2
- package/dist/generated/entities/workflow_definition/index.js +6 -0
- package/dist/generated/entities/workflow_definition/index.js.map +2 -2
- package/dist/generated/entities/workflow_definition_draft/index.js +25 -0
- package/dist/generated/entities/workflow_definition_draft/index.js.map +7 -0
- package/dist/generated/entities/workflow_definition_metric_rollup/index.js +23 -0
- package/dist/generated/entities/workflow_definition_metric_rollup/index.js.map +7 -0
- package/dist/generated/entities/workflow_instance/index.js +4 -0
- package/dist/generated/entities/workflow_instance/index.js.map +2 -2
- package/dist/generated/entities.ids.generated.js +4 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +39 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/workflowsFixtures.js +477 -2
- package/dist/helpers/integration/workflowsFixtures.js.map +2 -2
- package/dist/helpers/integration/workflowsUi.js +148 -0
- package/dist/helpers/integration/workflowsUi.js.map +7 -0
- package/dist/modules/attachments/lib/createFromBuffer.js +79 -0
- package/dist/modules/attachments/lib/createFromBuffer.js.map +7 -0
- package/dist/modules/audit_logs/data/entities.js +5 -0
- package/dist/modules/audit_logs/data/entities.js.map +2 -2
- package/dist/modules/audit_logs/data/validators.js +1 -0
- package/dist/modules/audit_logs/data/validators.js.map +2 -2
- package/dist/modules/audit_logs/lib/projections.js +2 -1
- package/dist/modules/audit_logs/lib/projections.js.map +2 -2
- package/dist/modules/audit_logs/migrations/Migration20260625120000.js +15 -0
- package/dist/modules/audit_logs/migrations/Migration20260625120000.js.map +7 -0
- package/dist/modules/audit_logs/services/actionLogService.js +3 -0
- package/dist/modules/audit_logs/services/actionLogService.js.map +2 -2
- package/dist/modules/auth/data/entities.js +6 -0
- package/dist/modules/auth/data/entities.js.map +2 -2
- package/dist/modules/auth/lib/executionPrincipal.js +140 -0
- package/dist/modules/auth/lib/executionPrincipal.js.map +7 -0
- package/dist/modules/auth/migrations/Migration20260625050000.js +13 -0
- package/dist/modules/auth/migrations/Migration20260625050000.js.map +7 -0
- package/dist/modules/business_rules/components/InlineRuleEditor.js +154 -0
- package/dist/modules/business_rules/components/InlineRuleEditor.js.map +7 -0
- package/dist/modules/business_rules/data/validators.js +6 -0
- package/dist/modules/business_rules/data/validators.js.map +2 -2
- package/dist/modules/business_rules/lib/rule-engine.js +5 -3
- package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
- package/dist/modules/catalog/commands/products.js +5 -0
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/workflows.js +19 -0
- package/dist/modules/catalog/workflows.js.map +7 -0
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.js +3 -1
- package/dist/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/cli.js +80 -0
- package/dist/modules/customer_accounts/cli.js.map +7 -0
- package/dist/modules/customer_accounts/lib/customerRoleAclSync.js +59 -0
- package/dist/modules/customer_accounts/lib/customerRoleAclSync.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +4 -2
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/customers/commands/deals.js +4 -0
- package/dist/modules/customers/commands/deals.js.map +2 -2
- package/dist/modules/customers/components/detail/ChangelogEntryRow.js +1 -1
- package/dist/modules/customers/components/detail/ChangelogEntryRow.js.map +2 -2
- package/dist/modules/customers/components/detail/utils.js +2 -0
- package/dist/modules/customers/components/detail/utils.js.map +2 -2
- package/dist/modules/customers/events.js +13 -2
- package/dist/modules/customers/events.js.map +2 -2
- package/dist/modules/customers/lib/link-workflow-task-handler.js +64 -0
- package/dist/modules/customers/lib/link-workflow-task-handler.js.map +7 -0
- package/dist/modules/customers/lib/todoCompatibility.js +1 -1
- package/dist/modules/customers/lib/todoCompatibility.js.map +2 -2
- package/dist/modules/customers/lib/workflowTaskLink.js +9 -0
- package/dist/modules/customers/lib/workflowTaskLink.js.map +7 -0
- package/dist/modules/customers/subscribers/link-workflow-task.js +12 -0
- package/dist/modules/customers/subscribers/link-workflow-task.js.map +7 -0
- package/dist/modules/customers/workflows.js +29 -0
- package/dist/modules/customers/workflows.js.map +7 -0
- package/dist/modules/entities/api/records.js +13 -33
- package/dist/modules/entities/api/records.js.map +3 -3
- package/dist/modules/entities/lib/entityClassification.js +60 -0
- package/dist/modules/entities/lib/entityClassification.js.map +7 -0
- package/dist/modules/sales/commands/documents.js +31 -0
- package/dist/modules/sales/commands/documents.js.map +2 -2
- package/dist/modules/sales/events.js +12 -1
- package/dist/modules/sales/events.js.map +2 -2
- package/dist/modules/sales/workflows.js +12 -1
- package/dist/modules/sales/workflows.js.map +2 -2
- package/dist/modules/seeds/cli.js +199 -0
- package/dist/modules/seeds/cli.js.map +7 -0
- package/dist/modules/seeds/examples/sample-seed.json +26 -0
- package/dist/modules/seeds/index.js +12 -0
- package/dist/modules/seeds/index.js.map +7 -0
- package/dist/modules/workflows/acl.js +96 -0
- package/dist/modules/workflows/acl.js.map +2 -2
- package/dist/modules/workflows/ai-agents.js +50 -0
- package/dist/modules/workflows/ai-agents.js.map +7 -0
- package/dist/modules/workflows/ai-tools/authoring-pack.js +582 -0
- package/dist/modules/workflows/ai-tools/authoring-pack.js.map +7 -0
- package/dist/modules/workflows/ai-tools/types.js +43 -0
- package/dist/modules/workflows/ai-tools/types.js.map +7 -0
- package/dist/modules/workflows/ai-tools.js +10 -0
- package/dist/modules/workflows/ai-tools.js.map +7 -0
- package/dist/modules/workflows/api/command-settings/route.js +137 -0
- package/dist/modules/workflows/api/command-settings/route.js.map +7 -0
- package/dist/modules/workflows/api/commands/route.js +72 -0
- package/dist/modules/workflows/api/commands/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/callers/route.js +76 -0
- package/dist/modules/workflows/api/definitions/[id]/callers/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/context-schema/route.js +134 -0
- package/dist/modules/workflows/api/definitions/[id]/context-schema/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js +5 -1
- package/dist/modules/workflows/api/definitions/[id]/customize/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/draft/route.js +286 -0
- package/dist/modules/workflows/api/definitions/[id]/draft/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/publish/route.js +207 -0
- package/dist/modules/workflows/api/definitions/[id]/publish/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js +5 -0
- package/dist/modules/workflows/api/definitions/[id]/reset-to-code/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/[id]/route.js +93 -9
- package/dist/modules/workflows/api/definitions/[id]/route.js.map +3 -3
- package/dist/modules/workflows/api/definitions/[id]/test-step/route.js +210 -0
- package/dist/modules/workflows/api/definitions/[id]/test-step/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/generate/route.js +233 -0
- package/dist/modules/workflows/api/definitions/generate/route.js.map +7 -0
- package/dist/modules/workflows/api/definitions/route.js +61 -113
- package/dist/modules/workflows/api/definitions/route.js.map +2 -2
- package/dist/modules/workflows/api/definitions/serialize.js +9 -0
- package/dist/modules/workflows/api/definitions/serialize.js.map +2 -2
- package/dist/modules/workflows/api/endpoints/route.js +69 -0
- package/dist/modules/workflows/api/endpoints/route.js.map +7 -0
- package/dist/modules/workflows/api/functions/route.js +73 -0
- package/dist/modules/workflows/api/functions/route.js.map +7 -0
- package/dist/modules/workflows/api/grantable-features/route.js +75 -0
- package/dist/modules/workflows/api/grantable-features/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/[id]/context/route.js +180 -0
- package/dist/modules/workflows/api/instances/[id]/context/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/[id]/rerun-step/route.js +184 -0
- package/dist/modules/workflows/api/instances/[id]/rerun-step/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/[id]/retry/route.js +12 -2
- package/dist/modules/workflows/api/instances/[id]/retry/route.js.map +2 -2
- package/dist/modules/workflows/api/instances/[id]/step-through/route.js +148 -0
- package/dist/modules/workflows/api/instances/[id]/step-through/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/[id]/steps/route.js +123 -0
- package/dist/modules/workflows/api/instances/[id]/steps/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/[id]/would-do/route.js +172 -0
- package/dist/modules/workflows/api/instances/[id]/would-do/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/bulk-replay/route.js +117 -0
- package/dist/modules/workflows/api/instances/bulk-replay/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/failure-queue/route.js +165 -0
- package/dist/modules/workflows/api/instances/failure-queue/route.js.map +7 -0
- package/dist/modules/workflows/api/instances/route.js +94 -3
- package/dist/modules/workflows/api/instances/route.js.map +2 -2
- package/dist/modules/workflows/api/metrics/definitions/route.js +188 -0
- package/dist/modules/workflows/api/metrics/definitions/route.js.map +7 -0
- package/dist/modules/workflows/api/openapi.js +415 -4
- package/dist/modules/workflows/api/openapi.js.map +2 -2
- package/dist/modules/workflows/api/portal/tasks/[id]/complete/route.js +132 -0
- package/dist/modules/workflows/api/portal/tasks/[id]/complete/route.js.map +7 -0
- package/dist/modules/workflows/api/portal/tasks/[id]/route.js +97 -0
- package/dist/modules/workflows/api/portal/tasks/[id]/route.js.map +7 -0
- package/dist/modules/workflows/api/portal/tasks/route.js +126 -0
- package/dist/modules/workflows/api/portal/tasks/route.js.map +7 -0
- package/dist/modules/workflows/api/rule-usage/route.js +80 -0
- package/dist/modules/workflows/api/rule-usage/route.js.map +7 -0
- package/dist/modules/workflows/api/task-settings/route.js +107 -0
- package/dist/modules/workflows/api/task-settings/route.js.map +7 -0
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js +27 -16
- package/dist/modules/workflows/api/tasks/[id]/claim/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js +40 -16
- package/dist/modules/workflows/api/tasks/[id]/complete/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/reassign/route.js +150 -0
- package/dist/modules/workflows/api/tasks/[id]/reassign/route.js.map +7 -0
- package/dist/modules/workflows/api/tasks/[id]/route.js +39 -6
- package/dist/modules/workflows/api/tasks/[id]/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/[id]/unclaim/route.js +100 -0
- package/dist/modules/workflows/api/tasks/[id]/unclaim/route.js.map +7 -0
- package/dist/modules/workflows/api/tasks/route.js +37 -6
- package/dist/modules/workflows/api/tasks/route.js.map +2 -2
- package/dist/modules/workflows/api/tasks/serialize.js +83 -0
- package/dist/modules/workflows/api/tasks/serialize.js.map +7 -0
- package/dist/modules/workflows/api/templates/route.js +69 -0
- package/dist/modules/workflows/api/templates/route.js.map +7 -0
- package/dist/modules/workflows/api/work-inbox/next/route.js +129 -0
- package/dist/modules/workflows/api/work-inbox/next/route.js.map +7 -0
- package/dist/modules/workflows/api/work-inbox/route.js +119 -0
- package/dist/modules/workflows/api/work-inbox/route.js.map +7 -0
- package/dist/modules/workflows/backend/config/workflows/page.js +10 -0
- package/dist/modules/workflows/backend/config/workflows/page.js.map +7 -0
- package/dist/modules/workflows/backend/config/workflows/page.meta.js +35 -0
- package/dist/modules/workflows/backend/config/workflows/page.meta.js.map +7 -0
- package/dist/modules/workflows/backend/definitions/[id]/page.js +6 -271
- package/dist/modules/workflows/backend/definitions/[id]/page.js.map +3 -3
- package/dist/modules/workflows/backend/definitions/create/page.js +7 -56
- package/dist/modules/workflows/backend/definitions/create/page.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/create/page.meta.js +1 -1
- package/dist/modules/workflows/backend/definitions/create/page.meta.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/page.js +131 -51
- package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +2606 -677
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +3 -3
- package/dist/modules/workflows/backend/instances/[id]/page.js +532 -421
- package/dist/modules/workflows/backend/instances/[id]/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/[id]/page.meta.js +1 -1
- package/dist/modules/workflows/backend/instances/[id]/page.meta.js.map +1 -1
- package/dist/modules/workflows/backend/instances/failure-queue/page.js +211 -0
- package/dist/modules/workflows/backend/instances/failure-queue/page.js.map +7 -0
- package/dist/modules/workflows/backend/instances/failure-queue/page.meta.js +20 -0
- package/dist/modules/workflows/backend/instances/failure-queue/page.meta.js.map +7 -0
- package/dist/modules/workflows/backend/instances/page.js +159 -22
- package/dist/modules/workflows/backend/instances/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/page.meta.js +1 -1
- package/dist/modules/workflows/backend/instances/page.meta.js.map +1 -1
- package/dist/modules/workflows/backend/tasks/[id]/page.js +553 -392
- package/dist/modules/workflows/backend/tasks/[id]/page.js.map +3 -3
- package/dist/modules/workflows/backend/tasks/page.js +8 -250
- package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
- package/dist/modules/workflows/backend/tasks/page.meta.js +1 -0
- package/dist/modules/workflows/backend/tasks/page.meta.js.map +2 -2
- package/dist/modules/workflows/backend/work-inbox/page.js +399 -0
- package/dist/modules/workflows/backend/work-inbox/page.js.map +7 -0
- package/dist/modules/workflows/backend/work-inbox/page.meta.js +19 -0
- package/dist/modules/workflows/backend/work-inbox/page.meta.js.map +7 -0
- package/dist/modules/workflows/cli.js +1 -1
- package/dist/modules/workflows/cli.js.map +2 -2
- package/dist/modules/workflows/commands/tasks.js +81 -0
- package/dist/modules/workflows/commands/tasks.js.map +7 -0
- package/dist/modules/workflows/components/ActivitiesEditor.js +281 -287
- package/dist/modules/workflows/components/ActivitiesEditor.js.map +2 -2
- package/dist/modules/workflows/components/ActivityEditDialog.js +220 -0
- package/dist/modules/workflows/components/ActivityEditDialog.js.map +7 -0
- package/dist/modules/workflows/components/AgentSelector.js +115 -0
- package/dist/modules/workflows/components/AgentSelector.js.map +7 -0
- package/dist/modules/workflows/components/AnnotationEditDialog.js +110 -0
- package/dist/modules/workflows/components/AnnotationEditDialog.js.map +7 -0
- package/dist/modules/workflows/components/BusinessRuleUsagePanel.js +71 -0
- package/dist/modules/workflows/components/BusinessRuleUsagePanel.js.map +7 -0
- package/dist/modules/workflows/components/BusinessRulesSelector.js +151 -93
- package/dist/modules/workflows/components/BusinessRulesSelector.js.map +2 -2
- package/dist/modules/workflows/components/ConfigJsonTextarea.js +85 -0
- package/dist/modules/workflows/components/ConfigJsonTextarea.js.map +7 -0
- package/dist/modules/workflows/components/ContextSchemaEditor.js +150 -0
- package/dist/modules/workflows/components/ContextSchemaEditor.js.map +7 -0
- package/dist/modules/workflows/components/DefinitionErrorHandlerField.js +102 -0
- package/dist/modules/workflows/components/DefinitionErrorHandlerField.js.map +7 -0
- package/dist/modules/workflows/components/DefinitionMetadataDrawer.js +377 -0
- package/dist/modules/workflows/components/DefinitionMetadataDrawer.js.map +7 -0
- package/dist/modules/workflows/components/DefinitionMetricsCells.js +132 -0
- package/dist/modules/workflows/components/DefinitionMetricsCells.js.map +7 -0
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js +307 -216
- package/dist/modules/workflows/components/DefinitionTriggersEditor.js.map +2 -2
- package/dist/modules/workflows/components/EdgeEditDialog.js +11 -18
- package/dist/modules/workflows/components/EdgeEditDialog.js.map +2 -2
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js +112 -72
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js.map +2 -2
- package/dist/modules/workflows/components/InputDataPanel.js +128 -0
- package/dist/modules/workflows/components/InputDataPanel.js.map +7 -0
- package/dist/modules/workflows/components/InspectorPanel.js +161 -0
- package/dist/modules/workflows/components/InspectorPanel.js.map +7 -0
- package/dist/modules/workflows/components/NodeEditDialog.js +363 -41
- package/dist/modules/workflows/components/NodeEditDialog.js.map +2 -2
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js +714 -159
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js.map +2 -2
- package/dist/modules/workflows/components/StepsEditor.js.map +2 -2
- package/dist/modules/workflows/components/TemplateGalleryDialog.js +148 -0
- package/dist/modules/workflows/components/TemplateGalleryDialog.js.map +7 -0
- package/dist/modules/workflows/components/TransitionsEditor.js +80 -74
- package/dist/modules/workflows/components/TransitionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/TriggersDialog.js +53 -0
- package/dist/modules/workflows/components/TriggersDialog.js.map +7 -0
- package/dist/modules/workflows/components/TriggersEditor.js +331 -0
- package/dist/modules/workflows/components/TriggersEditor.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowAiDraftDialog.js +278 -0
- package/dist/modules/workflows/components/WorkflowAiDraftDialog.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowCodeView.js +173 -0
- package/dist/modules/workflows/components/WorkflowCodeView.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowCommandPalette.js +62 -0
- package/dist/modules/workflows/components/WorkflowCommandPalette.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowCompensationGhostEdge.js +70 -0
- package/dist/modules/workflows/components/WorkflowCompensationGhostEdge.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowDataMappingEdge.js +36 -0
- package/dist/modules/workflows/components/WorkflowDataMappingEdge.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowGraph.js +4 -2
- package/dist/modules/workflows/components/WorkflowGraph.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowGraphImpl.js +324 -86
- package/dist/modules/workflows/components/WorkflowGraphImpl.js.map +3 -3
- package/dist/modules/workflows/components/WorkflowIconPicker.js +109 -0
- package/dist/modules/workflows/components/WorkflowIconPicker.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowLegend.js +45 -29
- package/dist/modules/workflows/components/WorkflowLegend.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowNodeCard.js +221 -22
- package/dist/modules/workflows/components/WorkflowNodeCard.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowRouteChips.js +111 -0
- package/dist/modules/workflows/components/WorkflowRouteChips.js.map +7 -0
- package/dist/modules/workflows/components/WorkflowSelector.js +108 -88
- package/dist/modules/workflows/components/WorkflowSelector.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowTransitionEdge.js +61 -11
- package/dist/modules/workflows/components/WorkflowTransitionEdge.js.map +2 -2
- package/dist/modules/workflows/components/WorkflowTransitionLabel.js +15 -5
- package/dist/modules/workflows/components/WorkflowTransitionLabel.js.map +2 -2
- package/dist/modules/workflows/components/fields/ActivityArrayEditor.js +88 -21
- package/dist/modules/workflows/components/fields/ActivityArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/ActivityConfigFields.js +615 -0
- package/dist/modules/workflows/components/fields/ActivityConfigFields.js.map +7 -0
- package/dist/modules/workflows/components/fields/ActivityTestPanel.js +191 -0
- package/dist/modules/workflows/components/fields/ActivityTestPanel.js.map +7 -0
- package/dist/modules/workflows/components/fields/AgentInvokeConfigField.js +488 -0
- package/dist/modules/workflows/components/fields/AgentInvokeConfigField.js.map +7 -0
- package/dist/modules/workflows/components/fields/AgentReviewOnBreachField.js +61 -0
- package/dist/modules/workflows/components/fields/AgentReviewOnBreachField.js.map +7 -0
- package/dist/modules/workflows/components/fields/BranchingRoutesEditor.js +227 -0
- package/dist/modules/workflows/components/fields/BranchingRoutesEditor.js.map +7 -0
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js +37 -4
- package/dist/modules/workflows/components/fields/BusinessRuleConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/CommandPicker.js +111 -0
- package/dist/modules/workflows/components/fields/CommandPicker.js.map +7 -0
- package/dist/modules/workflows/components/fields/EndpointPicker.js +235 -0
- package/dist/modules/workflows/components/fields/EndpointPicker.js.map +7 -0
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js +2 -2
- package/dist/modules/workflows/components/fields/FormFieldArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/FunctionPicker.js +55 -0
- package/dist/modules/workflows/components/fields/FunctionPicker.js.map +7 -0
- package/dist/modules/workflows/components/fields/MappingArrayEditor.js +38 -15
- package/dist/modules/workflows/components/fields/MappingArrayEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/PortFieldArrayEditor.js +206 -0
- package/dist/modules/workflows/components/fields/PortFieldArrayEditor.js.map +7 -0
- package/dist/modules/workflows/components/fields/RolesMultiSelect.js +53 -0
- package/dist/modules/workflows/components/fields/RolesMultiSelect.js.map +7 -0
- package/dist/modules/workflows/components/fields/RouteOrderEditor.js +130 -0
- package/dist/modules/workflows/components/fields/RouteOrderEditor.js.map +7 -0
- package/dist/modules/workflows/components/fields/SchemaBuilderDialog.js +104 -0
- package/dist/modules/workflows/components/fields/SchemaBuilderDialog.js.map +7 -0
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js +2 -2
- package/dist/modules/workflows/components/fields/StartPreConditionsEditor.js.map +2 -2
- package/dist/modules/workflows/components/fields/TaskAssignmentField.js +210 -0
- package/dist/modules/workflows/components/fields/TaskAssignmentField.js.map +7 -0
- package/dist/modules/workflows/components/fields/TaskDeadlineFields.js +126 -0
- package/dist/modules/workflows/components/fields/TaskDeadlineFields.js.map +7 -0
- package/dist/modules/workflows/components/fields/TaskDecisionsField.js +218 -0
- package/dist/modules/workflows/components/fields/TaskDecisionsField.js.map +7 -0
- package/dist/modules/workflows/components/fields/TaskEntityBindingsField.js +114 -0
- package/dist/modules/workflows/components/fields/TaskEntityBindingsField.js.map +7 -0
- package/dist/modules/workflows/components/fields/TemplateTextControl.js +64 -0
- package/dist/modules/workflows/components/fields/TemplateTextControl.js.map +7 -0
- package/dist/modules/workflows/components/fields/VariablePickerButton.js +121 -0
- package/dist/modules/workflows/components/fields/VariablePickerButton.js.map +7 -0
- package/dist/modules/workflows/components/fields/ledgerDropTarget.js +35 -0
- package/dist/modules/workflows/components/fields/ledgerDropTarget.js.map +7 -0
- package/dist/modules/workflows/components/fields/useActivityTypeOptions.js +16 -0
- package/dist/modules/workflows/components/fields/useActivityTypeOptions.js.map +7 -0
- package/dist/modules/workflows/components/formConfig.js +39 -10
- package/dist/modules/workflows/components/formConfig.js.map +2 -2
- package/dist/modules/workflows/components/mobile/MobileDefinitionDetail.js.map +2 -2
- package/dist/modules/workflows/components/mobile/MobileMetadataSheet.js.map +2 -2
- package/dist/modules/workflows/components/mobile/MobileTaskForm.js +29 -2
- package/dist/modules/workflows/components/mobile/MobileTaskForm.js.map +2 -2
- package/dist/modules/workflows/components/mobile/MobileVisualEditor.js +64 -65
- package/dist/modules/workflows/components/mobile/MobileVisualEditor.js.map +2 -2
- package/dist/modules/workflows/components/nodes/AnnotationGroupNode.js +64 -0
- package/dist/modules/workflows/components/nodes/AnnotationGroupNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/AutomatedNode.js +24 -16
- package/dist/modules/workflows/components/nodes/AutomatedNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/EndNode.js +13 -12
- package/dist/modules/workflows/components/nodes/EndNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/ErrorOutputHandle.js +29 -0
- package/dist/modules/workflows/components/nodes/ErrorOutputHandle.js.map +7 -0
- package/dist/modules/workflows/components/nodes/IfElseNode.js +51 -0
- package/dist/modules/workflows/components/nodes/IfElseNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/InvokeAgentNode.js +122 -0
- package/dist/modules/workflows/components/nodes/InvokeAgentNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/NodeOutcomeRows.js +100 -0
- package/dist/modules/workflows/components/nodes/NodeOutcomeRows.js.map +7 -0
- package/dist/modules/workflows/components/nodes/ParallelForkNode.js +18 -14
- package/dist/modules/workflows/components/nodes/ParallelForkNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/ParallelJoinNode.js +18 -14
- package/dist/modules/workflows/components/nodes/ParallelJoinNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/StartNode.js +66 -15
- package/dist/modules/workflows/components/nodes/StartNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/StickyNoteNode.js +54 -0
- package/dist/modules/workflows/components/nodes/StickyNoteNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/SubWorkflowNode.js +107 -41
- package/dist/modules/workflows/components/nodes/SubWorkflowNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/SwitchNode.js +51 -0
- package/dist/modules/workflows/components/nodes/SwitchNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/TriggerCap.js +65 -0
- package/dist/modules/workflows/components/nodes/TriggerCap.js.map +7 -0
- package/dist/modules/workflows/components/nodes/TriggerNode.js +111 -0
- package/dist/modules/workflows/components/nodes/TriggerNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/UserTaskNode.js +43 -17
- package/dist/modules/workflows/components/nodes/UserTaskNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/WaitForConditionNode.js +53 -0
- package/dist/modules/workflows/components/nodes/WaitForConditionNode.js.map +7 -0
- package/dist/modules/workflows/components/nodes/WaitForSignalNode.js +21 -15
- package/dist/modules/workflows/components/nodes/WaitForSignalNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/WaitForTimerNode.js +21 -15
- package/dist/modules/workflows/components/nodes/WaitForTimerNode.js.map +2 -2
- package/dist/modules/workflows/components/nodes/index.js +14 -0
- package/dist/modules/workflows/components/nodes/index.js.map +2 -2
- package/dist/modules/workflows/components/portal/PortalTaskForm.js +196 -0
- package/dist/modules/workflows/components/portal/PortalTaskForm.js.map +7 -0
- package/dist/modules/workflows/components/run/AgentActivityPanel.js +22 -0
- package/dist/modules/workflows/components/run/AgentActivityPanel.js.map +7 -0
- package/dist/modules/workflows/components/run/RerunStepDialog.js +106 -0
- package/dist/modules/workflows/components/run/RerunStepDialog.js.map +7 -0
- package/dist/modules/workflows/components/run/RunEventBadge.js +30 -0
- package/dist/modules/workflows/components/run/RunEventBadge.js.map +7 -0
- package/dist/modules/workflows/components/run/RunGantt.js +130 -0
- package/dist/modules/workflows/components/run/RunGantt.js.map +7 -0
- package/dist/modules/workflows/components/run/RunStatusBadge.js +82 -0
- package/dist/modules/workflows/components/run/RunStatusBadge.js.map +7 -0
- package/dist/modules/workflows/components/run/RunStepInspector.js +116 -0
- package/dist/modules/workflows/components/run/RunStepInspector.js.map +7 -0
- package/dist/modules/workflows/components/run/WouldDoReport.js +52 -0
- package/dist/modules/workflows/components/run/WouldDoReport.js.map +7 -0
- package/dist/modules/workflows/components/run/useAgentLabels.js +28 -0
- package/dist/modules/workflows/components/run/useAgentLabels.js.map +7 -0
- package/dist/modules/workflows/components/run/useLastRunOverlay.js +89 -0
- package/dist/modules/workflows/components/run/useLastRunOverlay.js.map +7 -0
- package/dist/modules/workflows/components/run/useLiveAgentActions.js +41 -0
- package/dist/modules/workflows/components/run/useLiveAgentActions.js.map +7 -0
- package/dist/modules/workflows/components/run/useLiveRunUpdates.js +57 -0
- package/dist/modules/workflows/components/run/useLiveRunUpdates.js.map +7 -0
- package/dist/modules/workflows/components/settings/CommandSettingsPageClient.js +156 -0
- package/dist/modules/workflows/components/settings/CommandSettingsPageClient.js.map +7 -0
- package/dist/modules/workflows/components/work-inbox/EntityContextPanel.js +72 -0
- package/dist/modules/workflows/components/work-inbox/EntityContextPanel.js.map +7 -0
- package/dist/modules/workflows/components/work-inbox/ReassignTaskDialog.js +156 -0
- package/dist/modules/workflows/components/work-inbox/ReassignTaskDialog.js.map +7 -0
- package/dist/modules/workflows/components/work-inbox/StatusChip.js +46 -0
- package/dist/modules/workflows/components/work-inbox/StatusChip.js.map +7 -0
- package/dist/modules/workflows/components/work-inbox/TaskActionNotice.js +53 -0
- package/dist/modules/workflows/components/work-inbox/TaskActionNotice.js.map +7 -0
- package/dist/modules/workflows/components/work-inbox/TaskFormFields.js +261 -0
- package/dist/modules/workflows/components/work-inbox/TaskFormFields.js.map +7 -0
- package/dist/modules/workflows/components/work-inbox/WorkInboxEmptyState.js +27 -0
- package/dist/modules/workflows/components/work-inbox/WorkInboxEmptyState.js.map +7 -0
- package/dist/modules/workflows/data/activity-config-schemas.js +191 -0
- package/dist/modules/workflows/data/activity-config-schemas.js.map +7 -0
- package/dist/modules/workflows/data/activity-config-warnings.js +42 -0
- package/dist/modules/workflows/data/activity-config-warnings.js.map +7 -0
- package/dist/modules/workflows/data/branching-route-warnings.js +65 -0
- package/dist/modules/workflows/data/branching-route-warnings.js.map +7 -0
- package/dist/modules/workflows/data/entities.js +144 -4
- package/dist/modules/workflows/data/entities.js.map +2 -2
- package/dist/modules/workflows/data/metrics-validators.js +35 -0
- package/dist/modules/workflows/data/metrics-validators.js.map +7 -0
- package/dist/modules/workflows/data/task-primitives.js +14 -0
- package/dist/modules/workflows/data/task-primitives.js.map +7 -0
- package/dist/modules/workflows/data/validators.js +504 -61
- package/dist/modules/workflows/data/validators.js.map +3 -3
- package/dist/modules/workflows/di.js +16 -1
- package/dist/modules/workflows/di.js.map +2 -2
- package/dist/modules/workflows/events.js +66 -8
- package/dist/modules/workflows/events.js.map +2 -2
- package/dist/modules/workflows/examples/oze-residential-install-60-nodes.json +1545 -0
- package/dist/modules/workflows/examples/sales-pipeline-definition.json +35 -35
- package/dist/modules/workflows/examples/templates/lead-to-install.json +160 -0
- package/dist/modules/workflows/examples/templates/order-approval.json +230 -0
- package/dist/modules/workflows/examples/templates/task-escalation.json +110 -0
- package/dist/modules/workflows/examples/templates/webhook-integration.json +113 -0
- package/dist/modules/workflows/extension-points.js +1 -1
- package/dist/modules/workflows/extension-points.js.map +2 -2
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/[id]/page.js +144 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/[id]/page.js.map +7 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/[id]/page.meta.js +12 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/[id]/page.meta.js.map +7 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/page.js +114 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/page.js.map +7 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/page.meta.js +18 -0
- package/dist/modules/workflows/frontend/[orgSlug]/portal/tasks/page.meta.js.map +7 -0
- package/dist/modules/workflows/lib/activity-executor.js +505 -137
- package/dist/modules/workflows/lib/activity-executor.js.map +3 -3
- package/dist/modules/workflows/lib/activity-queue-types.js +3 -1
- package/dist/modules/workflows/lib/activity-queue-types.js.map +2 -2
- package/dist/modules/workflows/lib/activity-registry-bootstrap.js +2 -0
- package/dist/modules/workflows/lib/activity-registry-bootstrap.js.map +7 -0
- package/dist/modules/workflows/lib/activity-registry.js +27 -0
- package/dist/modules/workflows/lib/activity-registry.js.map +7 -0
- package/dist/modules/workflows/lib/activity-types.js +291 -0
- package/dist/modules/workflows/lib/activity-types.js.map +7 -0
- package/dist/modules/workflows/lib/activity-worker-handler.js +456 -32
- package/dist/modules/workflows/lib/activity-worker-handler.js.map +3 -3
- package/dist/modules/workflows/lib/advanced-config.js +31 -0
- package/dist/modules/workflows/lib/advanced-config.js.map +7 -0
- package/dist/modules/workflows/lib/agent-disposition-task.js +198 -0
- package/dist/modules/workflows/lib/agent-disposition-task.js.map +7 -0
- package/dist/modules/workflows/lib/agent-outcome-paths.js +82 -0
- package/dist/modules/workflows/lib/agent-outcome-paths.js.map +7 -0
- package/dist/modules/workflows/lib/agent-result-mapping.js +54 -0
- package/dist/modules/workflows/lib/agent-result-mapping.js.map +7 -0
- package/dist/modules/workflows/lib/agent-review-inspector.js +61 -0
- package/dist/modules/workflows/lib/agent-review-inspector.js.map +7 -0
- package/dist/modules/workflows/lib/agent-review.js +66 -0
- package/dist/modules/workflows/lib/agent-review.js.map +7 -0
- package/dist/modules/workflows/lib/ai-authoring.js +155 -0
- package/dist/modules/workflows/lib/ai-authoring.js.map +7 -0
- package/dist/modules/workflows/lib/ai-draft-runner.js +43 -0
- package/dist/modules/workflows/lib/ai-draft-runner.js.map +7 -0
- package/dist/modules/workflows/lib/annotation-events.js +10 -0
- package/dist/modules/workflows/lib/annotation-events.js.map +7 -0
- package/dist/modules/workflows/lib/branching-routes.js +182 -0
- package/dist/modules/workflows/lib/branching-routes.js.map +7 -0
- package/dist/modules/workflows/lib/breach-routing.js +50 -0
- package/dist/modules/workflows/lib/breach-routing.js.map +7 -0
- package/dist/modules/workflows/lib/bulk-replay.js +101 -0
- package/dist/modules/workflows/lib/bulk-replay.js.map +7 -0
- package/dist/modules/workflows/lib/business-rule-usage.js +91 -0
- package/dist/modules/workflows/lib/business-rule-usage.js.map +7 -0
- package/dist/modules/workflows/lib/caller-graph.js +53 -0
- package/dist/modules/workflows/lib/caller-graph.js.map +7 -0
- package/dist/modules/workflows/lib/code-view-apply.js +86 -0
- package/dist/modules/workflows/lib/code-view-apply.js.map +7 -0
- package/dist/modules/workflows/lib/collect-validation-issues.js +164 -0
- package/dist/modules/workflows/lib/collect-validation-issues.js.map +7 -0
- package/dist/modules/workflows/lib/compensation-ghosts.js +72 -0
- package/dist/modules/workflows/lib/compensation-ghosts.js.map +7 -0
- package/dist/modules/workflows/lib/component-guard.js +7 -0
- package/dist/modules/workflows/lib/component-guard.js.map +7 -0
- package/dist/modules/workflows/lib/condition-handler.js +443 -0
- package/dist/modules/workflows/lib/condition-handler.js.map +7 -0
- package/dist/modules/workflows/lib/context-ledger.js +448 -0
- package/dist/modules/workflows/lib/context-ledger.js.map +7 -0
- package/dist/modules/workflows/lib/crud-form-dialogs-flag.js +8 -0
- package/dist/modules/workflows/lib/crud-form-dialogs-flag.js.map +7 -0
- package/dist/modules/workflows/lib/data-edge-mapping.js +63 -0
- package/dist/modules/workflows/lib/data-edge-mapping.js.map +7 -0
- package/dist/modules/workflows/lib/definition-context-schema.js +56 -0
- package/dist/modules/workflows/lib/definition-context-schema.js.map +7 -0
- package/dist/modules/workflows/lib/definition-edit-safety.js +123 -0
- package/dist/modules/workflows/lib/definition-edit-safety.js.map +7 -0
- package/dist/modules/workflows/lib/definition-error-body.js +33 -0
- package/dist/modules/workflows/lib/definition-error-body.js.map +7 -0
- package/dist/modules/workflows/lib/definition-evaluation.js +79 -0
- package/dist/modules/workflows/lib/definition-evaluation.js.map +7 -0
- package/dist/modules/workflows/lib/definition-grant.js +90 -0
- package/dist/modules/workflows/lib/definition-grant.js.map +7 -0
- package/dist/modules/workflows/lib/definition-json-locations.js +139 -0
- package/dist/modules/workflows/lib/definition-json-locations.js.map +7 -0
- package/dist/modules/workflows/lib/definition-payload.js +31 -0
- package/dist/modules/workflows/lib/definition-payload.js.map +7 -0
- package/dist/modules/workflows/lib/draft-restore.js +49 -0
- package/dist/modules/workflows/lib/draft-restore.js.map +7 -0
- package/dist/modules/workflows/lib/dry-run.js +106 -0
- package/dist/modules/workflows/lib/dry-run.js.map +7 -0
- package/dist/modules/workflows/lib/duration.js +66 -17
- package/dist/modules/workflows/lib/duration.js.map +2 -2
- package/dist/modules/workflows/lib/edge-reattachment.js +79 -0
- package/dist/modules/workflows/lib/edge-reattachment.js.map +7 -0
- package/dist/modules/workflows/lib/edgeFormTransforms.js +7 -11
- package/dist/modules/workflows/lib/edgeFormTransforms.js.map +2 -2
- package/dist/modules/workflows/lib/editor-annotations.js +195 -0
- package/dist/modules/workflows/lib/editor-annotations.js.map +7 -0
- package/dist/modules/workflows/lib/editor-commands.js +103 -0
- package/dist/modules/workflows/lib/editor-commands.js.map +7 -0
- package/dist/modules/workflows/lib/editor-history.js +51 -0
- package/dist/modules/workflows/lib/editor-history.js.map +7 -0
- package/dist/modules/workflows/lib/endpoint-catalog.js +181 -0
- package/dist/modules/workflows/lib/endpoint-catalog.js.map +7 -0
- package/dist/modules/workflows/lib/endpoint-path.js +90 -0
- package/dist/modules/workflows/lib/endpoint-path.js.map +7 -0
- package/dist/modules/workflows/lib/engine-version.js +42 -0
- package/dist/modules/workflows/lib/engine-version.js.map +7 -0
- package/dist/modules/workflows/lib/error-handler.js +132 -0
- package/dist/modules/workflows/lib/error-handler.js.map +7 -0
- package/dist/modules/workflows/lib/error-routing.js +104 -0
- package/dist/modules/workflows/lib/error-routing.js.map +7 -0
- package/dist/modules/workflows/lib/event-logger.js +23 -0
- package/dist/modules/workflows/lib/event-logger.js.map +2 -2
- package/dist/modules/workflows/lib/expression-refs.js +168 -0
- package/dist/modules/workflows/lib/expression-refs.js.map +7 -0
- package/dist/modules/workflows/lib/failure-grouping.js +62 -0
- package/dist/modules/workflows/lib/failure-grouping.js.map +7 -0
- package/dist/modules/workflows/lib/find-definition.js +1 -0
- package/dist/modules/workflows/lib/find-definition.js.map +2 -2
- package/dist/modules/workflows/lib/flow-logic-warnings.js +338 -0
- package/dist/modules/workflows/lib/flow-logic-warnings.js.map +7 -0
- package/dist/modules/workflows/lib/graph-utils.js +328 -77
- package/dist/modules/workflows/lib/graph-utils.js.map +2 -2
- package/dist/modules/workflows/lib/icon-search.js +32 -0
- package/dist/modules/workflows/lib/icon-search.js.map +7 -0
- package/dist/modules/workflows/lib/insert-at-cursor.js +26 -0
- package/dist/modules/workflows/lib/insert-at-cursor.js.map +7 -0
- package/dist/modules/workflows/lib/instance-date-filter.js +28 -0
- package/dist/modules/workflows/lib/instance-date-filter.js.map +7 -0
- package/dist/modules/workflows/lib/interpolation-pipeline.js +271 -0
- package/dist/modules/workflows/lib/interpolation-pipeline.js.map +7 -0
- package/dist/modules/workflows/lib/ledger-drag.js +28 -0
- package/dist/modules/workflows/lib/ledger-drag.js.map +7 -0
- package/dist/modules/workflows/lib/ledger-entry-display.js +66 -0
- package/dist/modules/workflows/lib/ledger-entry-display.js.map +7 -0
- package/dist/modules/workflows/lib/ledger-schema-flatten.js +82 -0
- package/dist/modules/workflows/lib/ledger-schema-flatten.js.map +7 -0
- package/dist/modules/workflows/lib/metrics/definition-metrics.js +110 -0
- package/dist/modules/workflows/lib/metrics/definition-metrics.js.map +7 -0
- package/dist/modules/workflows/lib/metrics/metrics-display.js +26 -0
- package/dist/modules/workflows/lib/metrics/metrics-display.js.map +7 -0
- package/dist/modules/workflows/lib/metrics/rollup-schedule.js +7 -0
- package/dist/modules/workflows/lib/metrics/rollup-schedule.js.map +7 -0
- package/dist/modules/workflows/lib/metrics/rollup-service.js +160 -0
- package/dist/modules/workflows/lib/metrics/rollup-service.js.map +7 -0
- package/dist/modules/workflows/lib/node-config-summary.js +128 -0
- package/dist/modules/workflows/lib/node-config-summary.js.map +7 -0
- package/dist/modules/workflows/lib/node-geometry.js +53 -0
- package/dist/modules/workflows/lib/node-geometry.js.map +7 -0
- package/dist/modules/workflows/lib/node-nudge.js +44 -0
- package/dist/modules/workflows/lib/node-nudge.js.map +7 -0
- package/dist/modules/workflows/lib/node-outcome-rows.js +88 -0
- package/dist/modules/workflows/lib/node-outcome-rows.js.map +7 -0
- package/dist/modules/workflows/lib/node-placement.js +55 -0
- package/dist/modules/workflows/lib/node-placement.js.map +7 -0
- package/dist/modules/workflows/lib/node-type-icons.js +54 -13
- package/dist/modules/workflows/lib/node-type-icons.js.map +2 -2
- package/dist/modules/workflows/lib/nodeFormTransforms.js +329 -19
- package/dist/modules/workflows/lib/nodeFormTransforms.js.map +2 -2
- package/dist/modules/workflows/lib/outcome-routing.js +158 -0
- package/dist/modules/workflows/lib/outcome-routing.js.map +7 -0
- package/dist/modules/workflows/lib/owned-definition.js +107 -0
- package/dist/modules/workflows/lib/owned-definition.js.map +7 -0
- package/dist/modules/workflows/lib/owned-node-changes.js +10 -0
- package/dist/modules/workflows/lib/owned-node-changes.js.map +7 -0
- package/dist/modules/workflows/lib/palette-drag.js +36 -0
- package/dist/modules/workflows/lib/palette-drag.js.map +7 -0
- package/dist/modules/workflows/lib/palette-drop.js +45 -0
- package/dist/modules/workflows/lib/palette-drop.js.map +7 -0
- package/dist/modules/workflows/lib/parallel-handler.js +57 -2
- package/dist/modules/workflows/lib/parallel-handler.js.map +2 -2
- package/dist/modules/workflows/lib/port-contract.js +54 -0
- package/dist/modules/workflows/lib/port-contract.js.map +7 -0
- package/dist/modules/workflows/lib/portal-task-access.js +89 -0
- package/dist/modules/workflows/lib/portal-task-access.js.map +7 -0
- package/dist/modules/workflows/lib/rerun-from-step.js +65 -0
- package/dist/modules/workflows/lib/rerun-from-step.js.map +7 -0
- package/dist/modules/workflows/lib/route-chip-events.js +23 -0
- package/dist/modules/workflows/lib/route-chip-events.js.map +7 -0
- package/dist/modules/workflows/lib/route-chips.js +91 -0
- package/dist/modules/workflows/lib/route-chips.js.map +7 -0
- package/dist/modules/workflows/lib/route-edge.js +17 -0
- package/dist/modules/workflows/lib/route-edge.js.map +7 -0
- package/dist/modules/workflows/lib/route-kinds.js +67 -0
- package/dist/modules/workflows/lib/route-kinds.js.map +7 -0
- package/dist/modules/workflows/lib/route-priority.js +104 -0
- package/dist/modules/workflows/lib/route-priority.js.map +7 -0
- package/dist/modules/workflows/lib/run-duration.js +44 -0
- package/dist/modules/workflows/lib/run-duration.js.map +7 -0
- package/dist/modules/workflows/lib/run-event-tone.js +25 -0
- package/dist/modules/workflows/lib/run-event-tone.js.map +7 -0
- package/dist/modules/workflows/lib/run-execution.js +305 -0
- package/dist/modules/workflows/lib/run-execution.js.map +7 -0
- package/dist/modules/workflows/lib/run-gantt.js +180 -0
- package/dist/modules/workflows/lib/run-gantt.js.map +7 -0
- package/dist/modules/workflows/lib/run-outcome-evidence.js +33 -0
- package/dist/modules/workflows/lib/run-outcome-evidence.js.map +7 -0
- package/dist/modules/workflows/lib/run-outcome.js +48 -0
- package/dist/modules/workflows/lib/run-outcome.js.map +7 -0
- package/dist/modules/workflows/lib/sample-resolver.js +71 -0
- package/dist/modules/workflows/lib/sample-resolver.js.map +7 -0
- package/dist/modules/workflows/lib/seeds.js +1 -1
- package/dist/modules/workflows/lib/seeds.js.map +2 -2
- package/dist/modules/workflows/lib/server-output-contract.js +65 -0
- package/dist/modules/workflows/lib/server-output-contract.js.map +7 -0
- package/dist/modules/workflows/lib/set-variable.js +47 -0
- package/dist/modules/workflows/lib/set-variable.js.map +7 -0
- package/dist/modules/workflows/lib/signal-handler.js +63 -4
- package/dist/modules/workflows/lib/signal-handler.js.map +2 -2
- package/dist/modules/workflows/lib/start-fixtures.js +42 -0
- package/dist/modules/workflows/lib/start-fixtures.js.map +7 -0
- package/dist/modules/workflows/lib/status-colors.js +153 -22
- package/dist/modules/workflows/lib/status-colors.js.map +2 -2
- package/dist/modules/workflows/lib/step-handler.js +529 -53
- package/dist/modules/workflows/lib/step-handler.js.map +3 -3
- package/dist/modules/workflows/lib/step-presentation.js +147 -0
- package/dist/modules/workflows/lib/step-presentation.js.map +7 -0
- package/dist/modules/workflows/lib/step-through.js +26 -0
- package/dist/modules/workflows/lib/step-through.js.map +7 -0
- package/dist/modules/workflows/lib/step-type-conversion.js +167 -0
- package/dist/modules/workflows/lib/step-type-conversion.js.map +7 -0
- package/dist/modules/workflows/lib/subgraph-clipboard.js +114 -0
- package/dist/modules/workflows/lib/subgraph-clipboard.js.map +7 -0
- package/dist/modules/workflows/lib/task-decision-context.js +38 -0
- package/dist/modules/workflows/lib/task-decision-context.js.map +7 -0
- package/dist/modules/workflows/lib/task-decisions.js +49 -0
- package/dist/modules/workflows/lib/task-decisions.js.map +7 -0
- package/dist/modules/workflows/lib/task-entity-access.js +62 -0
- package/dist/modules/workflows/lib/task-entity-access.js.map +7 -0
- package/dist/modules/workflows/lib/task-entity-aliases.js +39 -0
- package/dist/modules/workflows/lib/task-entity-aliases.js.map +7 -0
- package/dist/modules/workflows/lib/task-entity-types.js +36 -0
- package/dist/modules/workflows/lib/task-entity-types.js.map +7 -0
- package/dist/modules/workflows/lib/task-form-registry.js +33 -0
- package/dist/modules/workflows/lib/task-form-registry.js.map +7 -0
- package/dist/modules/workflows/lib/task-form-schema.js +75 -0
- package/dist/modules/workflows/lib/task-form-schema.js.map +7 -0
- package/dist/modules/workflows/lib/task-handler.js +251 -32
- package/dist/modules/workflows/lib/task-handler.js.map +2 -2
- package/dist/modules/workflows/lib/task-inspector-config.js +182 -0
- package/dist/modules/workflows/lib/task-inspector-config.js.map +7 -0
- package/dist/modules/workflows/lib/task-list-query.js +19 -0
- package/dist/modules/workflows/lib/task-list-query.js.map +7 -0
- package/dist/modules/workflows/lib/task-notifications.js +119 -0
- package/dist/modules/workflows/lib/task-notifications.js.map +7 -0
- package/dist/modules/workflows/lib/task-permission-settings.js +43 -0
- package/dist/modules/workflows/lib/task-permission-settings.js.map +7 -0
- package/dist/modules/workflows/lib/task-presets.js +35 -0
- package/dist/modules/workflows/lib/task-presets.js.map +7 -0
- package/dist/modules/workflows/lib/task-quick-action.js +45 -0
- package/dist/modules/workflows/lib/task-quick-action.js.map +7 -0
- package/dist/modules/workflows/lib/task-resolution.js +120 -0
- package/dist/modules/workflows/lib/task-resolution.js.map +7 -0
- package/dist/modules/workflows/lib/task-sla.js +357 -0
- package/dist/modules/workflows/lib/task-sla.js.map +7 -0
- package/dist/modules/workflows/lib/task-visibility-request.js +266 -0
- package/dist/modules/workflows/lib/task-visibility-request.js.map +7 -0
- package/dist/modules/workflows/lib/task-visibility.js +194 -0
- package/dist/modules/workflows/lib/task-visibility.js.map +7 -0
- package/dist/modules/workflows/lib/timer-handler.js +3 -1
- package/dist/modules/workflows/lib/timer-handler.js.map +2 -2
- package/dist/modules/workflows/lib/transition-handler.js +148 -20
- package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
- package/dist/modules/workflows/lib/trigger-node.js +121 -0
- package/dist/modules/workflows/lib/trigger-node.js.map +7 -0
- package/dist/modules/workflows/lib/visual-editor-navigation.js +14 -0
- package/dist/modules/workflows/lib/visual-editor-navigation.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/empty-state.js +52 -0
- package/dist/modules/workflows/lib/work-inbox/empty-state.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/entity-links.js +63 -0
- package/dist/modules/workflows/lib/work-inbox/entity-links.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/navigation.js +11 -0
- package/dist/modules/workflows/lib/work-inbox/navigation.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/presentation.js +90 -0
- package/dist/modules/workflows/lib/work-inbox/presentation.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/provider.js +118 -0
- package/dist/modules/workflows/lib/work-inbox/provider.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/query.js +70 -0
- package/dist/modules/workflows/lib/work-inbox/query.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/service.js +56 -0
- package/dist/modules/workflows/lib/work-inbox/service.js.map +7 -0
- package/dist/modules/workflows/lib/work-inbox/user-task-source.js +149 -0
- package/dist/modules/workflows/lib/work-inbox/user-task-source.js.map +7 -0
- package/dist/modules/workflows/lib/workflow-command-enablement.js +57 -0
- package/dist/modules/workflows/lib/workflow-command-enablement.js.map +7 -0
- package/dist/modules/workflows/lib/workflow-command-settings.js +54 -0
- package/dist/modules/workflows/lib/workflow-command-settings.js.map +7 -0
- package/dist/modules/workflows/lib/workflow-executor.js +658 -6
- package/dist/modules/workflows/lib/workflow-executor.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-function-registry.js +40 -0
- package/dist/modules/workflows/lib/workflow-function-registry.js.map +7 -0
- package/dist/modules/workflows/lib/workflow-safe-commands.js +11 -1
- package/dist/modules/workflows/lib/workflow-safe-commands.js.map +2 -2
- package/dist/modules/workflows/lib/workflow-templates.js +69 -0
- package/dist/modules/workflows/lib/workflow-templates.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260626214855_workflows.js +15 -0
- package/dist/modules/workflows/migrations/Migration20260626214855_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260626222424_workflows.js +17 -0
- package/dist/modules/workflows/migrations/Migration20260626222424_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260727074335_workflows.js +15 -0
- package/dist/modules/workflows/migrations/Migration20260727074335_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260728104038_workflows.js +13 -0
- package/dist/modules/workflows/migrations/Migration20260728104038_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260728163001_workflows.js +15 -0
- package/dist/modules/workflows/migrations/Migration20260728163001_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260729061736_workflows.js +13 -0
- package/dist/modules/workflows/migrations/Migration20260729061736_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260729192652_workflows.js +12 -0
- package/dist/modules/workflows/migrations/Migration20260729192652_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260730085000_workflows.js +13 -0
- package/dist/modules/workflows/migrations/Migration20260730085000_workflows.js.map +7 -0
- package/dist/modules/workflows/migrations/Migration20260730092706_workflows.js +13 -0
- package/dist/modules/workflows/migrations/Migration20260730092706_workflows.js.map +7 -0
- package/dist/modules/workflows/notifications.js +38 -10
- package/dist/modules/workflows/notifications.js.map +2 -2
- package/dist/modules/workflows/setup.js +81 -1
- package/dist/modules/workflows/setup.js.map +2 -2
- package/dist/modules/workflows/subscribers/task-assigned-notification.js +19 -27
- package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +2 -2
- package/dist/modules/workflows/subscribers/task-deadline-breached-notification.js +24 -0
- package/dist/modules/workflows/subscribers/task-deadline-breached-notification.js.map +7 -0
- package/dist/modules/workflows/subscribers/task-reminder-notification.js +24 -0
- package/dist/modules/workflows/subscribers/task-reminder-notification.js.map +7 -0
- package/dist/modules/workflows/widgets/injection/pending-work/widget.client.js +73 -0
- package/dist/modules/workflows/widgets/injection/pending-work/widget.client.js.map +7 -0
- package/dist/modules/workflows/widgets/injection/pending-work/widget.js +17 -0
- package/dist/modules/workflows/widgets/injection/pending-work/widget.js.map +7 -0
- package/dist/modules/workflows/widgets/injection-table.js +26 -0
- package/dist/modules/workflows/widgets/injection-table.js.map +2 -2
- package/dist/modules/workflows/workers/workflow-activities.worker.js +61 -39
- package/dist/modules/workflows/workers/workflow-activities.worker.js.map +2 -2
- package/dist/modules/workflows/workers/workflow-definition-metric-rollup.worker.js +40 -0
- package/dist/modules/workflows/workers/workflow-definition-metric-rollup.worker.js.map +7 -0
- package/dist/modules/workflows/workers/workflow-instance-bulk-replay.js +43 -0
- package/dist/modules/workflows/workers/workflow-instance-bulk-replay.js.map +7 -0
- package/dist/modules/workflows/workers/workflow-invoke-agent.worker.js +30 -0
- package/dist/modules/workflows/workers/workflow-invoke-agent.worker.js.map +7 -0
- package/generated/entities/action_log/index.ts +1 -0
- package/generated/entities/user/index.ts +1 -0
- package/generated/entities/user_task/index.ts +7 -0
- package/generated/entities/workflow_definition/index.ts +3 -0
- package/generated/entities/workflow_definition_draft/index.ts +11 -0
- package/generated/entities/workflow_definition_metric_rollup/index.ts +10 -0
- package/generated/entities/workflow_instance/index.ts +2 -0
- package/generated/entities.ids.generated.ts +4 -1
- package/generated/entity-fields-registry.ts +39 -0
- package/jest.setup.ts +13 -0
- package/package.json +8 -7
- package/src/bootstrap.ts +13 -3
- package/src/helpers/integration/workflowsFixtures.ts +765 -5
- package/src/helpers/integration/workflowsUi.ts +318 -0
- package/src/modules/attachments/lib/createFromBuffer.ts +120 -0
- package/src/modules/audit_logs/data/entities.ts +12 -0
- package/src/modules/audit_logs/data/validators.ts +1 -0
- package/src/modules/audit_logs/lib/projections.ts +5 -1
- package/src/modules/audit_logs/migrations/.snapshot-open-mercato.json +26 -0
- package/src/modules/audit_logs/migrations/Migration20260625120000.ts +15 -0
- package/src/modules/audit_logs/services/actionLogService.ts +3 -0
- package/src/modules/auth/data/entities.ts +21 -0
- package/src/modules/auth/i18n/de.json +31 -0
- package/src/modules/auth/i18n/en.json +31 -0
- package/src/modules/auth/i18n/es.json +31 -0
- package/src/modules/auth/i18n/ko.json +31 -0
- package/src/modules/auth/i18n/pl.json +31 -0
- package/src/modules/auth/lib/executionPrincipal.ts +235 -0
- package/src/modules/auth/migrations/.snapshot-open-mercato.json +16 -0
- package/src/modules/auth/migrations/Migration20260625050000.ts +21 -0
- package/src/modules/business_rules/components/InlineRuleEditor.tsx +231 -0
- package/src/modules/business_rules/data/validators.ts +6 -0
- package/src/modules/business_rules/i18n/de.json +4 -0
- package/src/modules/business_rules/i18n/en.json +4 -0
- package/src/modules/business_rules/i18n/es.json +4 -0
- package/src/modules/business_rules/i18n/ko.json +4 -0
- package/src/modules/business_rules/i18n/pl.json +4 -0
- package/src/modules/business_rules/lib/rule-engine.ts +15 -1
- package/src/modules/catalog/commands/products.ts +12 -0
- package/src/modules/catalog/i18n/de.json +1 -0
- package/src/modules/catalog/i18n/en.json +1 -0
- package/src/modules/catalog/i18n/es.json +1 -0
- package/src/modules/catalog/i18n/ko.json +1 -0
- package/src/modules/catalog/i18n/pl.json +1 -0
- package/src/modules/catalog/workflows.ts +35 -0
- package/src/modules/customer_accounts/AGENTS.md +11 -0
- package/src/modules/customer_accounts/backend/customer_accounts/roles/[id]/page.tsx +2 -0
- package/src/modules/customer_accounts/cli.ts +96 -0
- package/src/modules/customer_accounts/i18n/de.json +5 -0
- package/src/modules/customer_accounts/i18n/en.json +5 -0
- package/src/modules/customer_accounts/i18n/es.json +5 -0
- package/src/modules/customer_accounts/i18n/ko.json +5 -0
- package/src/modules/customer_accounts/i18n/pl.json +5 -0
- package/src/modules/customer_accounts/lib/customerRoleAclSync.ts +92 -0
- package/src/modules/customer_accounts/setup.ts +15 -3
- package/src/modules/customers/commands/deals.ts +5 -0
- package/src/modules/customers/components/detail/ChangelogEntryRow.tsx +4 -2
- package/src/modules/customers/components/detail/utils.ts +2 -0
- package/src/modules/customers/events.ts +21 -3
- package/src/modules/customers/i18n/de.json +4 -0
- package/src/modules/customers/i18n/en.json +4 -0
- package/src/modules/customers/i18n/es.json +4 -0
- package/src/modules/customers/i18n/ko.json +4 -0
- package/src/modules/customers/i18n/pl.json +4 -0
- package/src/modules/customers/lib/link-workflow-task-handler.ts +136 -0
- package/src/modules/customers/lib/todoCompatibility.ts +4 -1
- package/src/modules/customers/lib/workflowTaskLink.ts +23 -0
- package/src/modules/customers/subscribers/link-workflow-task.ts +19 -0
- package/src/modules/customers/workflows.ts +57 -0
- package/src/modules/entities/api/records.ts +18 -62
- package/src/modules/entities/lib/entityClassification.ts +102 -0
- package/src/modules/sales/commands/documents.ts +46 -0
- package/src/modules/sales/events.ts +20 -2
- package/src/modules/sales/i18n/de.json +2 -1
- package/src/modules/sales/i18n/en.json +2 -1
- package/src/modules/sales/i18n/es.json +2 -1
- package/src/modules/sales/i18n/ko.json +2 -1
- package/src/modules/sales/i18n/pl.json +2 -1
- package/src/modules/sales/workflows.ts +12 -1
- package/src/modules/seeds/README.md +86 -0
- package/src/modules/seeds/cli.ts +220 -0
- package/src/modules/seeds/examples/sample-seed.json +26 -0
- package/src/modules/seeds/index.ts +11 -0
- package/src/modules/workflows/AGENTS.md +851 -10
- package/src/modules/workflows/acl.ts +96 -0
- package/src/modules/workflows/ai-agents.ts +80 -0
- package/src/modules/workflows/ai-tools/authoring-pack.ts +798 -0
- package/src/modules/workflows/ai-tools/types.ts +117 -0
- package/src/modules/workflows/ai-tools.ts +20 -0
- package/src/modules/workflows/api/command-settings/route.ts +171 -0
- package/src/modules/workflows/api/commands/route.ts +109 -0
- package/src/modules/workflows/api/definitions/[id]/callers/route.ts +95 -0
- package/src/modules/workflows/api/definitions/[id]/context-schema/route.ts +187 -0
- package/src/modules/workflows/api/definitions/[id]/customize/route.ts +6 -1
- package/src/modules/workflows/api/definitions/[id]/draft/route.ts +395 -0
- package/src/modules/workflows/api/definitions/[id]/publish/route.ts +250 -0
- package/src/modules/workflows/api/definitions/[id]/reset-to-code/route.ts +5 -0
- package/src/modules/workflows/api/definitions/[id]/route.ts +107 -7
- package/src/modules/workflows/api/definitions/[id]/test-step/route.ts +288 -0
- package/src/modules/workflows/api/definitions/generate/route.ts +335 -0
- package/src/modules/workflows/api/definitions/route.ts +88 -113
- package/src/modules/workflows/api/definitions/serialize.ts +9 -0
- package/src/modules/workflows/api/endpoints/route.ts +88 -0
- package/src/modules/workflows/api/functions/route.ts +91 -0
- package/src/modules/workflows/api/grantable-features/route.ts +102 -0
- package/src/modules/workflows/api/instances/[id]/context/route.ts +214 -0
- package/src/modules/workflows/api/instances/[id]/rerun-step/route.ts +226 -0
- package/src/modules/workflows/api/instances/[id]/retry/route.ts +18 -2
- package/src/modules/workflows/api/instances/[id]/step-through/route.ts +195 -0
- package/src/modules/workflows/api/instances/[id]/steps/route.ts +160 -0
- package/src/modules/workflows/api/instances/[id]/would-do/route.ts +216 -0
- package/src/modules/workflows/api/instances/bulk-replay/route.ts +141 -0
- package/src/modules/workflows/api/instances/failure-queue/route.ts +197 -0
- package/src/modules/workflows/api/instances/route.ts +135 -3
- package/src/modules/workflows/api/metrics/definitions/route.ts +262 -0
- package/src/modules/workflows/api/openapi.ts +549 -2
- package/src/modules/workflows/api/portal/tasks/[id]/complete/route.ts +160 -0
- package/src/modules/workflows/api/portal/tasks/[id]/route.ts +124 -0
- package/src/modules/workflows/api/portal/tasks/route.ts +157 -0
- package/src/modules/workflows/api/rule-usage/route.ts +94 -0
- package/src/modules/workflows/api/task-settings/route.ts +138 -0
- package/src/modules/workflows/api/tasks/[id]/claim/route.ts +42 -17
- package/src/modules/workflows/api/tasks/[id]/complete/route.ts +47 -15
- package/src/modules/workflows/api/tasks/[id]/reassign/route.ts +197 -0
- package/src/modules/workflows/api/tasks/[id]/route.ts +57 -6
- package/src/modules/workflows/api/tasks/[id]/unclaim/route.ts +132 -0
- package/src/modules/workflows/api/tasks/route.ts +60 -5
- package/src/modules/workflows/api/tasks/serialize.ts +119 -0
- package/src/modules/workflows/api/templates/route.ts +87 -0
- package/src/modules/workflows/api/work-inbox/next/route.ts +170 -0
- package/src/modules/workflows/api/work-inbox/route.ts +153 -0
- package/src/modules/workflows/backend/config/workflows/page.meta.ts +33 -0
- package/src/modules/workflows/backend/config/workflows/page.tsx +12 -0
- package/src/modules/workflows/backend/definitions/[id]/page.tsx +19 -343
- package/src/modules/workflows/backend/definitions/create/page.meta.ts +1 -1
- package/src/modules/workflows/backend/definitions/create/page.tsx +19 -59
- package/src/modules/workflows/backend/definitions/page.tsx +156 -76
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +3129 -584
- package/src/modules/workflows/backend/instances/[id]/page.meta.ts +1 -1
- package/src/modules/workflows/backend/instances/[id]/page.tsx +711 -539
- package/src/modules/workflows/backend/instances/failure-queue/page.meta.ts +16 -0
- package/src/modules/workflows/backend/instances/failure-queue/page.tsx +311 -0
- package/src/modules/workflows/backend/instances/page.meta.ts +1 -1
- package/src/modules/workflows/backend/instances/page.tsx +218 -38
- package/src/modules/workflows/backend/tasks/[id]/page.tsx +639 -400
- package/src/modules/workflows/backend/tasks/page.meta.ts +7 -0
- package/src/modules/workflows/backend/tasks/page.tsx +20 -333
- package/src/modules/workflows/backend/work-inbox/page.meta.ts +15 -0
- package/src/modules/workflows/backend/work-inbox/page.tsx +506 -0
- package/src/modules/workflows/cli.ts +1 -1
- package/src/modules/workflows/commands/tasks.ts +146 -0
- package/src/modules/workflows/components/ActivitiesEditor.tsx +91 -114
- package/src/modules/workflows/components/ActivityEditDialog.tsx +244 -0
- package/src/modules/workflows/components/AgentSelector.tsx +200 -0
- package/src/modules/workflows/components/AnnotationEditDialog.tsx +157 -0
- package/src/modules/workflows/components/BusinessRuleUsagePanel.tsx +106 -0
- package/src/modules/workflows/components/BusinessRulesSelector.tsx +71 -17
- package/src/modules/workflows/components/ConfigJsonTextarea.tsx +111 -0
- package/src/modules/workflows/components/ContextSchemaEditor.tsx +165 -0
- package/src/modules/workflows/components/DefinitionErrorHandlerField.tsx +133 -0
- package/src/modules/workflows/components/DefinitionMetadataDrawer.tsx +456 -0
- package/src/modules/workflows/components/DefinitionMetricsCells.tsx +212 -0
- package/src/modules/workflows/components/DefinitionTriggersEditor.tsx +196 -95
- package/src/modules/workflows/components/EdgeEditDialog.tsx +15 -16
- package/src/modules/workflows/components/EdgeEditDialogCrudForm.tsx +130 -80
- package/src/modules/workflows/components/InputDataPanel.tsx +177 -0
- package/src/modules/workflows/components/InspectorPanel.tsx +250 -0
- package/src/modules/workflows/components/NodeEditDialog.tsx +444 -38
- package/src/modules/workflows/components/NodeEditDialogCrudForm.tsx +848 -178
- package/src/modules/workflows/components/StepsEditor.tsx +9 -2
- package/src/modules/workflows/components/TemplateGalleryDialog.tsx +205 -0
- package/src/modules/workflows/components/TransitionsEditor.tsx +98 -89
- package/src/modules/workflows/components/TriggersDialog.tsx +83 -0
- package/src/modules/workflows/components/TriggersEditor.tsx +363 -0
- package/src/modules/workflows/components/WorkflowAiDraftDialog.tsx +383 -0
- package/src/modules/workflows/components/WorkflowCodeView.tsx +257 -0
- package/src/modules/workflows/components/WorkflowCommandPalette.tsx +82 -0
- package/src/modules/workflows/components/WorkflowCompensationGhostEdge.tsx +78 -0
- package/src/modules/workflows/components/WorkflowDataMappingEdge.tsx +46 -0
- package/src/modules/workflows/components/WorkflowGraph.tsx +54 -1
- package/src/modules/workflows/components/WorkflowGraphImpl.tsx +463 -37
- package/src/modules/workflows/components/WorkflowIconPicker.tsx +144 -0
- package/src/modules/workflows/components/WorkflowLegend.tsx +59 -33
- package/src/modules/workflows/components/WorkflowNodeCard.tsx +355 -28
- package/src/modules/workflows/components/WorkflowRouteChips.tsx +145 -0
- package/src/modules/workflows/components/WorkflowSelector.tsx +33 -14
- package/src/modules/workflows/components/WorkflowTransitionEdge.tsx +83 -10
- package/src/modules/workflows/components/WorkflowTransitionLabel.tsx +13 -2
- package/src/modules/workflows/components/fields/ActivityArrayEditor.tsx +120 -30
- package/src/modules/workflows/components/fields/ActivityConfigFields.tsx +675 -0
- package/src/modules/workflows/components/fields/ActivityTestPanel.tsx +250 -0
- package/src/modules/workflows/components/fields/AgentInvokeConfigField.tsx +580 -0
- package/src/modules/workflows/components/fields/AgentReviewOnBreachField.tsx +88 -0
- package/src/modules/workflows/components/fields/BranchingRoutesEditor.tsx +323 -0
- package/src/modules/workflows/components/fields/BusinessRuleConditionsEditor.tsx +36 -4
- package/src/modules/workflows/components/fields/CommandPicker.tsx +158 -0
- package/src/modules/workflows/components/fields/EndpointPicker.tsx +330 -0
- package/src/modules/workflows/components/fields/FormFieldArrayEditor.tsx +2 -2
- package/src/modules/workflows/components/fields/FunctionPicker.tsx +68 -0
- package/src/modules/workflows/components/fields/MappingArrayEditor.tsx +46 -12
- package/src/modules/workflows/components/fields/PortFieldArrayEditor.tsx +255 -0
- package/src/modules/workflows/components/fields/RolesMultiSelect.tsx +68 -0
- package/src/modules/workflows/components/fields/RouteOrderEditor.tsx +169 -0
- package/src/modules/workflows/components/fields/SchemaBuilderDialog.tsx +139 -0
- package/src/modules/workflows/components/fields/StartPreConditionsEditor.tsx +2 -2
- package/src/modules/workflows/components/fields/TaskAssignmentField.tsx +355 -0
- package/src/modules/workflows/components/fields/TaskDeadlineFields.tsx +172 -0
- package/src/modules/workflows/components/fields/TaskDecisionsField.tsx +294 -0
- package/src/modules/workflows/components/fields/TaskEntityBindingsField.tsx +156 -0
- package/src/modules/workflows/components/fields/TemplateTextControl.tsx +85 -0
- package/src/modules/workflows/components/fields/VariablePickerButton.tsx +177 -0
- package/src/modules/workflows/components/fields/ledgerDropTarget.ts +55 -0
- package/src/modules/workflows/components/fields/useActivityTypeOptions.ts +19 -0
- package/src/modules/workflows/components/formConfig.tsx +84 -10
- package/src/modules/workflows/components/mobile/MobileDefinitionDetail.tsx +5 -0
- package/src/modules/workflows/components/mobile/MobileMetadataSheet.tsx +10 -0
- package/src/modules/workflows/components/mobile/MobileTaskForm.tsx +55 -19
- package/src/modules/workflows/components/mobile/MobileVisualEditor.tsx +49 -40
- package/src/modules/workflows/components/nodes/AnnotationGroupNode.tsx +81 -0
- package/src/modules/workflows/components/nodes/AutomatedNode.tsx +34 -17
- package/src/modules/workflows/components/nodes/EndNode.tsx +15 -14
- package/src/modules/workflows/components/nodes/ErrorOutputHandle.tsx +32 -0
- package/src/modules/workflows/components/nodes/IfElseNode.tsx +64 -0
- package/src/modules/workflows/components/nodes/InvokeAgentNode.tsx +180 -0
- package/src/modules/workflows/components/nodes/NodeOutcomeRows.tsx +143 -0
- package/src/modules/workflows/components/nodes/ParallelForkNode.tsx +28 -15
- package/src/modules/workflows/components/nodes/ParallelJoinNode.tsx +28 -15
- package/src/modules/workflows/components/nodes/StartNode.tsx +78 -18
- package/src/modules/workflows/components/nodes/StickyNoteNode.tsx +65 -0
- package/src/modules/workflows/components/nodes/SubWorkflowNode.tsx +124 -23
- package/src/modules/workflows/components/nodes/SwitchNode.tsx +64 -0
- package/src/modules/workflows/components/nodes/TriggerCap.tsx +103 -0
- package/src/modules/workflows/components/nodes/TriggerNode.tsx +151 -0
- package/src/modules/workflows/components/nodes/UserTaskNode.tsx +67 -22
- package/src/modules/workflows/components/nodes/WaitForConditionNode.tsx +74 -0
- package/src/modules/workflows/components/nodes/WaitForSignalNode.tsx +31 -17
- package/src/modules/workflows/components/nodes/WaitForTimerNode.tsx +31 -16
- package/src/modules/workflows/components/nodes/index.ts +17 -0
- package/src/modules/workflows/components/portal/PortalTaskForm.tsx +280 -0
- package/src/modules/workflows/components/run/AgentActivityPanel.tsx +48 -0
- package/src/modules/workflows/components/run/RerunStepDialog.tsx +133 -0
- package/src/modules/workflows/components/run/RunEventBadge.tsx +37 -0
- package/src/modules/workflows/components/run/RunGantt.tsx +180 -0
- package/src/modules/workflows/components/run/RunStatusBadge.tsx +112 -0
- package/src/modules/workflows/components/run/RunStepInspector.tsx +176 -0
- package/src/modules/workflows/components/run/WouldDoReport.tsx +93 -0
- package/src/modules/workflows/components/run/useAgentLabels.ts +42 -0
- package/src/modules/workflows/components/run/useLastRunOverlay.ts +150 -0
- package/src/modules/workflows/components/run/useLiveAgentActions.ts +70 -0
- package/src/modules/workflows/components/run/useLiveRunUpdates.ts +89 -0
- package/src/modules/workflows/components/settings/CommandSettingsPageClient.tsx +228 -0
- package/src/modules/workflows/components/work-inbox/EntityContextPanel.tsx +179 -0
- package/src/modules/workflows/components/work-inbox/ReassignTaskDialog.tsx +203 -0
- package/src/modules/workflows/components/work-inbox/StatusChip.tsx +61 -0
- package/src/modules/workflows/components/work-inbox/TaskActionNotice.tsx +77 -0
- package/src/modules/workflows/components/work-inbox/TaskFormFields.tsx +322 -0
- package/src/modules/workflows/components/work-inbox/WorkInboxEmptyState.tsx +43 -0
- package/src/modules/workflows/data/activity-config-schemas.ts +249 -0
- package/src/modules/workflows/data/activity-config-warnings.ts +71 -0
- package/src/modules/workflows/data/branching-route-warnings.ts +129 -0
- package/src/modules/workflows/data/entities.ts +397 -4
- package/src/modules/workflows/data/metrics-validators.ts +51 -0
- package/src/modules/workflows/data/task-primitives.ts +36 -0
- package/src/modules/workflows/data/types.ts +81 -2
- package/src/modules/workflows/data/validators.ts +729 -60
- package/src/modules/workflows/di.ts +22 -0
- package/src/modules/workflows/events.ts +68 -8
- package/src/modules/workflows/examples/oze-residential-install-60-nodes.json +1545 -0
- package/src/modules/workflows/examples/sales-pipeline-definition.json +35 -35
- package/src/modules/workflows/examples/templates/lead-to-install.json +160 -0
- package/src/modules/workflows/examples/templates/order-approval.json +230 -0
- package/src/modules/workflows/examples/templates/task-escalation.json +110 -0
- package/src/modules/workflows/examples/templates/webhook-integration.json +113 -0
- package/src/modules/workflows/extension-points.ts +1 -1
- package/src/modules/workflows/frontend/[orgSlug]/portal/tasks/[id]/page.meta.ts +21 -0
- package/src/modules/workflows/frontend/[orgSlug]/portal/tasks/[id]/page.tsx +212 -0
- package/src/modules/workflows/frontend/[orgSlug]/portal/tasks/page.meta.ts +25 -0
- package/src/modules/workflows/frontend/[orgSlug]/portal/tasks/page.tsx +185 -0
- package/src/modules/workflows/i18n/de.json +1083 -24
- package/src/modules/workflows/i18n/en.json +1081 -22
- package/src/modules/workflows/i18n/es.json +1083 -24
- package/src/modules/workflows/i18n/ko.json +1072 -13
- package/src/modules/workflows/i18n/pl.json +1082 -23
- package/src/modules/workflows/lib/activity-executor.ts +855 -186
- package/src/modules/workflows/lib/activity-queue-types.ts +120 -1
- package/src/modules/workflows/lib/activity-registry-bootstrap.ts +7 -0
- package/src/modules/workflows/lib/activity-registry.ts +89 -0
- package/src/modules/workflows/lib/activity-types.ts +415 -0
- package/src/modules/workflows/lib/activity-worker-handler.ts +744 -35
- package/src/modules/workflows/lib/advanced-config.ts +41 -0
- package/src/modules/workflows/lib/agent-disposition-task.ts +343 -0
- package/src/modules/workflows/lib/agent-outcome-paths.ts +153 -0
- package/src/modules/workflows/lib/agent-result-mapping.ts +88 -0
- package/src/modules/workflows/lib/agent-review-inspector.ts +125 -0
- package/src/modules/workflows/lib/agent-review.ts +171 -0
- package/src/modules/workflows/lib/ai-authoring.ts +402 -0
- package/src/modules/workflows/lib/ai-draft-runner.ts +105 -0
- package/src/modules/workflows/lib/annotation-events.ts +15 -0
- package/src/modules/workflows/lib/branching-routes.ts +280 -0
- package/src/modules/workflows/lib/breach-routing.ts +142 -0
- package/src/modules/workflows/lib/bulk-replay.ts +185 -0
- package/src/modules/workflows/lib/business-rule-usage.ts +154 -0
- package/src/modules/workflows/lib/caller-graph.ts +104 -0
- package/src/modules/workflows/lib/code-view-apply.ts +178 -0
- package/src/modules/workflows/lib/collect-validation-issues.ts +239 -0
- package/src/modules/workflows/lib/compensation-ghosts.ts +134 -0
- package/src/modules/workflows/lib/component-guard.ts +13 -0
- package/src/modules/workflows/lib/condition-handler.ts +658 -0
- package/src/modules/workflows/lib/context-ledger.ts +814 -0
- package/src/modules/workflows/lib/crud-form-dialogs-flag.ts +5 -0
- package/src/modules/workflows/lib/data-edge-mapping.ts +112 -0
- package/src/modules/workflows/lib/definition-context-schema.ts +103 -0
- package/src/modules/workflows/lib/definition-edit-safety.ts +228 -0
- package/src/modules/workflows/lib/definition-error-body.ts +43 -0
- package/src/modules/workflows/lib/definition-evaluation.ts +156 -0
- package/src/modules/workflows/lib/definition-grant.ts +211 -0
- package/src/modules/workflows/lib/definition-json-locations.ts +226 -0
- package/src/modules/workflows/lib/definition-payload.ts +81 -0
- package/src/modules/workflows/lib/draft-restore.ts +72 -0
- package/src/modules/workflows/lib/dry-run.ts +203 -0
- package/src/modules/workflows/lib/duration.ts +138 -24
- package/src/modules/workflows/lib/edge-reattachment.ts +186 -0
- package/src/modules/workflows/lib/edgeFormTransforms.ts +15 -14
- package/src/modules/workflows/lib/editor-annotations.ts +301 -0
- package/src/modules/workflows/lib/editor-commands.ts +205 -0
- package/src/modules/workflows/lib/editor-history.ts +151 -0
- package/src/modules/workflows/lib/endpoint-catalog.ts +283 -0
- package/src/modules/workflows/lib/endpoint-path.ts +134 -0
- package/src/modules/workflows/lib/engine-version.ts +67 -0
- package/src/modules/workflows/lib/error-handler.ts +192 -0
- package/src/modules/workflows/lib/error-routing.ts +236 -0
- package/src/modules/workflows/lib/event-logger.ts +27 -0
- package/src/modules/workflows/lib/expression-refs.ts +291 -0
- package/src/modules/workflows/lib/failure-grouping.ts +134 -0
- package/src/modules/workflows/lib/find-definition.ts +4 -0
- package/src/modules/workflows/lib/flow-logic-warnings.ts +591 -0
- package/src/modules/workflows/lib/graph-utils.ts +620 -110
- package/src/modules/workflows/lib/icon-search.ts +65 -0
- package/src/modules/workflows/lib/insert-at-cursor.ts +53 -0
- package/src/modules/workflows/lib/instance-date-filter.ts +56 -0
- package/src/modules/workflows/lib/interpolation-pipeline.ts +351 -0
- package/src/modules/workflows/lib/ledger-drag.ts +61 -0
- package/src/modules/workflows/lib/ledger-entry-display.ts +89 -0
- package/src/modules/workflows/lib/ledger-schema-flatten.ts +137 -0
- package/src/modules/workflows/lib/metrics/definition-metrics.ts +268 -0
- package/src/modules/workflows/lib/metrics/metrics-display.ts +57 -0
- package/src/modules/workflows/lib/metrics/rollup-schedule.ts +26 -0
- package/src/modules/workflows/lib/metrics/rollup-service.ts +292 -0
- package/src/modules/workflows/lib/node-config-summary.ts +235 -0
- package/src/modules/workflows/lib/node-geometry.ts +168 -0
- package/src/modules/workflows/lib/node-nudge.ts +63 -0
- package/src/modules/workflows/lib/node-outcome-rows.ts +195 -0
- package/src/modules/workflows/lib/node-placement.ts +104 -0
- package/src/modules/workflows/lib/node-type-icons.ts +71 -10
- package/src/modules/workflows/lib/nodeFormTransforms.ts +519 -28
- package/src/modules/workflows/lib/outcome-routing.ts +346 -0
- package/src/modules/workflows/lib/owned-definition.ts +188 -0
- package/src/modules/workflows/lib/owned-node-changes.ts +29 -0
- package/src/modules/workflows/lib/palette-drag.ts +68 -0
- package/src/modules/workflows/lib/palette-drop.ts +114 -0
- package/src/modules/workflows/lib/parallel-handler.ts +79 -2
- package/src/modules/workflows/lib/port-contract.ts +107 -0
- package/src/modules/workflows/lib/portal-task-access.ts +220 -0
- package/src/modules/workflows/lib/rerun-from-step.ts +140 -0
- package/src/modules/workflows/lib/route-chip-events.ts +45 -0
- package/src/modules/workflows/lib/route-chips.ts +177 -0
- package/src/modules/workflows/lib/route-edge.ts +57 -0
- package/src/modules/workflows/lib/route-kinds.ts +166 -0
- package/src/modules/workflows/lib/route-priority.ts +197 -0
- package/src/modules/workflows/lib/run-duration.ts +70 -0
- package/src/modules/workflows/lib/run-event-tone.ts +46 -0
- package/src/modules/workflows/lib/run-execution.ts +598 -0
- package/src/modules/workflows/lib/run-gantt.ts +311 -0
- package/src/modules/workflows/lib/run-outcome-evidence.ts +60 -0
- package/src/modules/workflows/lib/run-outcome.ts +142 -0
- package/src/modules/workflows/lib/sample-resolver.ts +113 -0
- package/src/modules/workflows/lib/seeds.ts +3 -1
- package/src/modules/workflows/lib/server-output-contract.ts +120 -0
- package/src/modules/workflows/lib/set-variable.ts +94 -0
- package/src/modules/workflows/lib/signal-handler.ts +134 -4
- package/src/modules/workflows/lib/start-fixtures.ts +93 -0
- package/src/modules/workflows/lib/status-colors.ts +220 -21
- package/src/modules/workflows/lib/step-handler.ts +744 -68
- package/src/modules/workflows/lib/step-presentation.ts +295 -0
- package/src/modules/workflows/lib/step-through.ts +71 -0
- package/src/modules/workflows/lib/step-type-conversion.ts +263 -0
- package/src/modules/workflows/lib/subgraph-clipboard.ts +214 -0
- package/src/modules/workflows/lib/task-decision-context.ts +76 -0
- package/src/modules/workflows/lib/task-decisions.ts +117 -0
- package/src/modules/workflows/lib/task-entity-access.ts +181 -0
- package/src/modules/workflows/lib/task-entity-aliases.ts +77 -0
- package/src/modules/workflows/lib/task-entity-types.ts +66 -0
- package/src/modules/workflows/lib/task-form-registry.ts +123 -0
- package/src/modules/workflows/lib/task-form-schema.ts +129 -0
- package/src/modules/workflows/lib/task-handler.ts +492 -51
- package/src/modules/workflows/lib/task-inspector-config.ts +348 -0
- package/src/modules/workflows/lib/task-list-query.ts +46 -0
- package/src/modules/workflows/lib/task-notifications.ts +218 -0
- package/src/modules/workflows/lib/task-permission-settings.ts +117 -0
- package/src/modules/workflows/lib/task-presets.ts +95 -0
- package/src/modules/workflows/lib/task-quick-action.ts +111 -0
- package/src/modules/workflows/lib/task-resolution.ts +270 -0
- package/src/modules/workflows/lib/task-sla.ts +628 -0
- package/src/modules/workflows/lib/task-visibility-request.ts +668 -0
- package/src/modules/workflows/lib/task-visibility.ts +627 -0
- package/src/modules/workflows/lib/timer-handler.ts +8 -1
- package/src/modules/workflows/lib/transition-handler.ts +228 -20
- package/src/modules/workflows/lib/trigger-node.ts +272 -0
- package/src/modules/workflows/lib/visual-editor-navigation.ts +29 -0
- package/src/modules/workflows/lib/work-inbox/empty-state.ts +150 -0
- package/src/modules/workflows/lib/work-inbox/entity-links.ts +99 -0
- package/src/modules/workflows/lib/work-inbox/navigation.ts +28 -0
- package/src/modules/workflows/lib/work-inbox/presentation.ts +163 -0
- package/src/modules/workflows/lib/work-inbox/provider.ts +390 -0
- package/src/modules/workflows/lib/work-inbox/query.ts +103 -0
- package/src/modules/workflows/lib/work-inbox/service.ts +122 -0
- package/src/modules/workflows/lib/work-inbox/user-task-source.ts +240 -0
- package/src/modules/workflows/lib/workflow-command-enablement.ts +188 -0
- package/src/modules/workflows/lib/workflow-command-settings.ts +124 -0
- package/src/modules/workflows/lib/workflow-executor.ts +1036 -10
- package/src/modules/workflows/lib/workflow-function-registry.ts +44 -0
- package/src/modules/workflows/lib/workflow-safe-commands.ts +42 -1
- package/src/modules/workflows/lib/workflow-templates.ts +91 -0
- package/src/modules/workflows/migrations/.snapshot-open-mercato.json +2321 -698
- package/src/modules/workflows/migrations/Migration20260626214855_workflows.ts +15 -0
- package/src/modules/workflows/migrations/Migration20260626222424_workflows.ts +17 -0
- package/src/modules/workflows/migrations/Migration20260727074335_workflows.ts +15 -0
- package/src/modules/workflows/migrations/Migration20260728104038_workflows.ts +13 -0
- package/src/modules/workflows/migrations/Migration20260728163001_workflows.ts +36 -0
- package/src/modules/workflows/migrations/Migration20260729061736_workflows.ts +13 -0
- package/src/modules/workflows/migrations/Migration20260729192652_workflows.ts +11 -0
- package/src/modules/workflows/migrations/Migration20260730085000_workflows.ts +13 -0
- package/src/modules/workflows/migrations/Migration20260730092706_workflows.ts +13 -0
- package/src/modules/workflows/notifications.ts +40 -10
- package/src/modules/workflows/setup.ts +128 -0
- package/src/modules/workflows/subscribers/task-assigned-notification.ts +36 -45
- package/src/modules/workflows/subscribers/task-deadline-breached-notification.ts +31 -0
- package/src/modules/workflows/subscribers/task-reminder-notification.ts +31 -0
- package/src/modules/workflows/widgets/injection/pending-work/widget.client.tsx +119 -0
- package/src/modules/workflows/widgets/injection/pending-work/widget.ts +27 -0
- package/src/modules/workflows/widgets/injection-table.ts +52 -2
- package/src/modules/workflows/workers/workflow-activities.worker.ts +95 -42
- package/src/modules/workflows/workers/workflow-definition-metric-rollup.worker.ts +71 -0
- package/src/modules/workflows/workers/workflow-instance-bulk-replay.ts +51 -0
- package/src/modules/workflows/workers/workflow-invoke-agent.worker.ts +72 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ZodType } from "zod";
|
|
2
|
+
import "./activity-registry-bootstrap.js";
|
|
3
|
+
import { getActivityType } from "./activity-registry.js";
|
|
4
|
+
import {
|
|
5
|
+
bindAgentOutcomeSchemaResolver,
|
|
6
|
+
bindCallApiResponseSchemaResolver
|
|
7
|
+
} from "./activity-types.js";
|
|
8
|
+
import { findEndpointResponseSchema } from "./endpoint-catalog.js";
|
|
9
|
+
import { flattenSchemaToContract } from "./ledger-schema-flatten.js";
|
|
10
|
+
bindCallApiResponseSchemaResolver((endpoint, method) => findEndpointResponseSchema(endpoint, method) ?? "unknown");
|
|
11
|
+
let agentOutcomeContracts = null;
|
|
12
|
+
let agentOutcomeWarmup = null;
|
|
13
|
+
bindAgentOutcomeSchemaResolver((agentId) => agentOutcomeContracts?.get(agentId) ?? "unknown");
|
|
14
|
+
function toAgentOutcomeContract(snapshot) {
|
|
15
|
+
const { agentId, resultKind, schema } = snapshot;
|
|
16
|
+
if (typeof agentId !== "string" || agentId.length === 0) return null;
|
|
17
|
+
if (resultKind !== "research" && resultKind !== "proposal") return null;
|
|
18
|
+
if (!(schema instanceof ZodType)) return null;
|
|
19
|
+
return { resultKind, schema };
|
|
20
|
+
}
|
|
21
|
+
async function loadAgentOutcomeContracts(container) {
|
|
22
|
+
let bridge;
|
|
23
|
+
try {
|
|
24
|
+
bridge = container.resolve("agentWorkflowBridge");
|
|
25
|
+
} catch {
|
|
26
|
+
bridge = void 0;
|
|
27
|
+
}
|
|
28
|
+
if (!bridge || typeof bridge.listAgentOutcomeContracts !== "function") {
|
|
29
|
+
agentOutcomeContracts = /* @__PURE__ */ new Map();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
33
|
+
try {
|
|
34
|
+
for (const snapshot of await bridge.listAgentOutcomeContracts()) {
|
|
35
|
+
const contract = toAgentOutcomeContract(snapshot);
|
|
36
|
+
if (contract && typeof snapshot.agentId === "string") resolved.set(snapshot.agentId, contract);
|
|
37
|
+
}
|
|
38
|
+
} catch {
|
|
39
|
+
agentOutcomeContracts = /* @__PURE__ */ new Map();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
agentOutcomeContracts = resolved;
|
|
43
|
+
}
|
|
44
|
+
async function ensureWorkflowAgentOutcomeContracts(container) {
|
|
45
|
+
if (!agentOutcomeWarmup) agentOutcomeWarmup = loadAgentOutcomeContracts(container);
|
|
46
|
+
await agentOutcomeWarmup;
|
|
47
|
+
}
|
|
48
|
+
function clearWorkflowAgentOutcomeContractsForTests() {
|
|
49
|
+
agentOutcomeContracts = null;
|
|
50
|
+
agentOutcomeWarmup = null;
|
|
51
|
+
}
|
|
52
|
+
const resolveServerOutputContract = (activityType, config) => {
|
|
53
|
+
const entry = getActivityType(activityType);
|
|
54
|
+
const contract = entry?.outputContract;
|
|
55
|
+
if (typeof contract !== "function") return "unknown";
|
|
56
|
+
const resolved = contract(config);
|
|
57
|
+
if (!(resolved instanceof ZodType)) return "unknown";
|
|
58
|
+
return flattenSchemaToContract(resolved);
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
clearWorkflowAgentOutcomeContractsForTests,
|
|
62
|
+
ensureWorkflowAgentOutcomeContracts,
|
|
63
|
+
resolveServerOutputContract
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=server-output-contract.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/server-output-contract.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Workflows Module - server-side output-contract resolver.\n *\n * NOT pure: this is the concrete implementation server callers (the\n * context-schema API route) inject into `computeContextLedger`'s\n * `resolveOutputContract` seam. It is only meaningful in the server runtime,\n * where the activity registry is bootstrapped (guaranteed by the bootstrap\n * import below) and the command registry holds the loaded command handlers \u2014\n * `commandRegistry.outputSchemaOf` is sync over already-registered handlers,\n * so UPDATE_ENTITY's outputContract resolves a real Zod schema there and\n * degrades honestly to 'unknown' elsewhere. The browser-side ledger never\n * resolves contracts locally; it consumes the resolved entries from the\n * context-schema API response.\n *\n * A registry entry's `outputContract` yields `ZodTypeAny | 'unknown'`\n * (activity-registry.ts); the instanceof guard also keeps third-party entries\n * honest at runtime before flattening.\n */\n\nimport { ZodType } from 'zod'\nimport './activity-registry-bootstrap'\nimport { getActivityType } from './activity-registry'\nimport {\n bindAgentOutcomeSchemaResolver,\n bindCallApiResponseSchemaResolver,\n type AgentOutcomeContract,\n} from './activity-types'\nimport { findEndpointResponseSchema } from './endpoint-catalog'\nimport { flattenSchemaToContract } from './ledger-schema-flatten'\nimport type { ResolveOutputContract } from './context-ledger'\n\n/**\n * CALL_API's registry outputContract reaches the server-only endpoint\n * catalog through this binding (mirroring bindActivityExecutor). The sync\n * lookup reads the per-process catalog cache, so callers that want CALL_API\n * contracts resolved must `await ensureWorkflowEndpointCatalog()` first \u2014\n * the context-schema route does; unwarmed processes degrade to 'unknown'.\n */\nbindCallApiResponseSchemaResolver((endpoint, method) => findEndpointResponseSchema(endpoint, method) ?? 'unknown')\n\n/**\n * INVOKE_AGENT's registry outputContract reaches the OPTIONAL agent_orchestrator\n * peer the same way the executor does: through DI, never an import. The peer's\n * `agentWorkflowBridge` service may expose `listAgentOutcomeContracts()` (an\n * additive, optional method \u2014 an older peer without it is simply a peer without\n * agent typing); this module caches the returned OUTCOME schemas per process and\n * the bound resolver reads that cache synchronously. Callers that want agent\n * contracts resolved must `await ensureWorkflowAgentOutcomeContracts(container)`\n * first \u2014 the context-schema route does; unwarmed processes, an absent peer, and\n * a failing lookup all degrade to 'unknown' without throwing.\n */\ntype AgentOutcomeContractSnapshot = {\n agentId?: unknown\n resultKind?: unknown\n schema?: unknown\n}\n\ntype AgentOutcomeBridgeLike = {\n listAgentOutcomeContracts?: () => Promise<AgentOutcomeContractSnapshot[]>\n}\n\ntype ServiceContainer = {\n resolve: <T>(name: string) => T\n}\n\nlet agentOutcomeContracts: Map<string, AgentOutcomeContract> | null = null\nlet agentOutcomeWarmup: Promise<void> | null = null\n\nbindAgentOutcomeSchemaResolver((agentId) => agentOutcomeContracts?.get(agentId) ?? 'unknown')\n\nfunction toAgentOutcomeContract(snapshot: AgentOutcomeContractSnapshot): AgentOutcomeContract | null {\n const { agentId, resultKind, schema } = snapshot\n if (typeof agentId !== 'string' || agentId.length === 0) return null\n if (resultKind !== 'research' && resultKind !== 'proposal') return null\n if (!(schema instanceof ZodType)) return null\n return { resultKind, schema }\n}\n\nasync function loadAgentOutcomeContracts(container: ServiceContainer): Promise<void> {\n let bridge: AgentOutcomeBridgeLike | undefined\n try {\n bridge = container.resolve<AgentOutcomeBridgeLike>('agentWorkflowBridge')\n } catch {\n bridge = undefined\n }\n if (!bridge || typeof bridge.listAgentOutcomeContracts !== 'function') {\n agentOutcomeContracts = new Map()\n return\n }\n const resolved = new Map<string, AgentOutcomeContract>()\n try {\n for (const snapshot of await bridge.listAgentOutcomeContracts()) {\n const contract = toAgentOutcomeContract(snapshot)\n if (contract && typeof snapshot.agentId === 'string') resolved.set(snapshot.agentId, contract)\n }\n } catch {\n agentOutcomeContracts = new Map()\n return\n }\n agentOutcomeContracts = resolved\n}\n\nexport async function ensureWorkflowAgentOutcomeContracts(container: ServiceContainer): Promise<void> {\n if (!agentOutcomeWarmup) agentOutcomeWarmup = loadAgentOutcomeContracts(container)\n await agentOutcomeWarmup\n}\n\nexport function clearWorkflowAgentOutcomeContractsForTests(): void {\n agentOutcomeContracts = null\n agentOutcomeWarmup = null\n}\n\nexport const resolveServerOutputContract: ResolveOutputContract = (activityType, config) => {\n const entry = getActivityType(activityType)\n const contract = entry?.outputContract\n if (typeof contract !== 'function') return 'unknown'\n const resolved = contract(config)\n if (!(resolved instanceof ZodType)) return 'unknown'\n return flattenSchemaToContract(resolved)\n}\n"],
|
|
5
|
+
"mappings": "AAmBA,SAAS,eAAe;AACxB,OAAO;AACP,SAAS,uBAAuB;AAChC;AAAA,EACE;A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AO;AACxB,MAAI,OAAO,aAAa,WAAY,QAAO;AAC3C,QAAM,WAAW,SAAS,MAAM;AAChC,MAAI,EAAE,oBAAoB,SAAU,QAAO;AAC3C,SAAO,wBAAwB,QAAQ;AACzC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function isPlainObject(value) {
|
|
2
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3
|
+
}
|
|
4
|
+
function isSetVariableOutput(output) {
|
|
5
|
+
if (!isPlainObject(output)) return false;
|
|
6
|
+
const assignments = output.assignments;
|
|
7
|
+
return Array.isArray(assignments) && assignments.every((assignment) => {
|
|
8
|
+
if (!isPlainObject(assignment) || typeof assignment.path !== "string") return false;
|
|
9
|
+
const segments = splitAssignmentPath(assignment.path);
|
|
10
|
+
return segments !== null && segments.length > 0;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
const FORBIDDEN_ASSIGNMENT_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
14
|
+
function splitAssignmentPath(path) {
|
|
15
|
+
const segments = path.split(".").map((segment) => segment.trim()).filter((segment) => segment.length > 0);
|
|
16
|
+
if (segments.some((segment) => FORBIDDEN_ASSIGNMENT_SEGMENTS.has(segment))) return null;
|
|
17
|
+
return segments;
|
|
18
|
+
}
|
|
19
|
+
function buildSetVariableContextPatch(baseContext, assignments) {
|
|
20
|
+
const patch = {};
|
|
21
|
+
for (const assignment of assignments) {
|
|
22
|
+
const segments = splitAssignmentPath(assignment.path);
|
|
23
|
+
if (segments === null || segments.length === 0) continue;
|
|
24
|
+
const [rootKey, ...nestedSegments] = segments;
|
|
25
|
+
if (nestedSegments.length === 0) {
|
|
26
|
+
patch[rootKey] = assignment.value;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const currentRoot = rootKey in patch ? patch[rootKey] : baseContext[rootKey];
|
|
30
|
+
const clonedRoot = isPlainObject(currentRoot) ? { ...currentRoot } : {};
|
|
31
|
+
let cursor = clonedRoot;
|
|
32
|
+
for (const segment of nestedSegments.slice(0, -1)) {
|
|
33
|
+
const nextValue = cursor[segment];
|
|
34
|
+
cursor[segment] = isPlainObject(nextValue) ? { ...nextValue } : {};
|
|
35
|
+
cursor = cursor[segment];
|
|
36
|
+
}
|
|
37
|
+
cursor[nestedSegments[nestedSegments.length - 1]] = assignment.value;
|
|
38
|
+
patch[rootKey] = clonedRoot;
|
|
39
|
+
}
|
|
40
|
+
return patch;
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
buildSetVariableContextPatch,
|
|
44
|
+
isSetVariableOutput,
|
|
45
|
+
splitAssignmentPath
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=set-variable.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/set-variable.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Workflows Module - SET_VARIABLE context assignment helpers\n *\n * Pure path-application logic for the SET_VARIABLE activity type. The engine\n * merges sync activity outputs into workflow context under a namespaced key\n * (activityName || activityType); SET_VARIABLE instead lands each assignment\n * at its dot path in top-level context (spec 2026-07-26-workflows-ux-redesign\n * section 3.2). Both sync merge points \u2014 the intra-transition merge in\n * activity-executor's executeActivities and the persistence merge in\n * transition-handler \u2014 detect SET_VARIABLE outputs with `isSetVariableOutput`\n * and apply `buildSetVariableContextPatch` instead of namespacing.\n *\n * Kept in its own pure module (no React, no ORM, no container) so\n * transition-handler tests exercise the real path application even when the\n * whole activity-executor module is mocked.\n */\n\nexport interface SetVariableAssignment {\n path: string\n value?: unknown\n}\n\nexport interface SetVariableOutput {\n assignments: SetVariableAssignment[]\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nexport function isSetVariableOutput(output: unknown): output is SetVariableOutput {\n if (!isPlainObject(output)) return false\n const assignments = output.assignments\n return (\n Array.isArray(assignments) &&\n assignments.every((assignment) => {\n if (!isPlainObject(assignment) || typeof assignment.path !== 'string') return false\n const segments = splitAssignmentPath(assignment.path)\n return segments !== null && segments.length > 0\n })\n )\n}\n\nconst FORBIDDEN_ASSIGNMENT_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype'])\n\n/**\n * Splits a dot path into trimmed, non-empty segments. Returns `null` when any\n * segment is a prototype-pollution vector (`__proto__`, `constructor`,\n * `prototype`) \u2014 such an assignment is never legitimate, so callers reject the\n * whole assignment instead of applying it.\n */\nexport function splitAssignmentPath(path: string): string[] | null {\n const segments = path\n .split('.')\n .map((segment) => segment.trim())\n .filter((segment) => segment.length > 0)\n if (segments.some((segment) => FORBIDDEN_ASSIGNMENT_SEGMENTS.has(segment))) return null\n return segments\n}\n\n/**\n * Build a shallow top-level patch that lands every assignment at its dot\n * path. Nested paths clone the existing objects along the way (the base is\n * never mutated) and preserve sibling keys; missing or non-object\n * intermediates become fresh objects. Later assignments in the same batch see\n * earlier ones. The result spreads into the engine's existing shallow context\n * merge without clobbering untouched top-level keys.\n */\nexport function buildSetVariableContextPatch(\n baseContext: Record<string, unknown>,\n assignments: SetVariableAssignment[],\n): Record<string, unknown> {\n const patch: Record<string, unknown> = {}\n for (const assignment of assignments) {\n const segments = splitAssignmentPath(assignment.path)\n if (segments === null || segments.length === 0) continue\n const [rootKey, ...nestedSegments] = segments\n if (nestedSegments.length === 0) {\n patch[rootKey] = assignment.value\n continue\n }\n const currentRoot = rootKey in patch ? patch[rootKey] : baseContext[rootKey]\n const clonedRoot: Record<string, unknown> = isPlainObject(currentRoot) ? { ...currentRoot } : {}\n let cursor = clonedRoot\n for (const segment of nestedSegments.slice(0, -1)) {\n const nextValue = cursor[segment]\n cursor[segment] = isPlainObject(nextValue) ? { ...nextValue } : {}\n cursor = cursor[segment] as Record<string, unknown>\n }\n cursor[nestedSegments[nestedSegments.length - 1]] = assignment.value\n patch[root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,MAAM,GAAG,EAAE,GAAG;AACjD,YAAM,YAAY,OAAO,OAAO;AAChC,aAAO,OAAO,IAAI,cAAc,SAAS,IAAI,EAAE,GAAG,UAAU,IAAI,CAAC;AACjE,eAAS,OAAO,OAAO;AAAA,IACzB;AACA,WAAO,eAAe,eAAe,SAAS,CAAC,CAAC,IAAI,WAAW;AAC/D,UAAM,OAAO,IAAI;AAAA,EACnB;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { findOneWithDecryption, findWithDecryption } from "@open-mercato/shared/lib/encryption/find";
|
|
2
2
|
import { WorkflowInstance, WorkflowBranchInstance, WorkflowDefinition, StepInstance } from "../data/entities.js";
|
|
3
|
+
import { INVOKE_AGENT_SIGNAL_NAME, SUB_WORKFLOW_SIGNAL_NAME } from "./activity-executor.js";
|
|
3
4
|
import { resolveCodeDefinitionForInstance } from "./find-definition.js";
|
|
5
|
+
import {
|
|
6
|
+
WORKFLOW_AGENT_OUTCOME_CONTEXT_KEY,
|
|
7
|
+
buildAgentOutcomeContextEntry,
|
|
8
|
+
mapDispositionToAgentOutcome
|
|
9
|
+
} from "./outcome-routing.js";
|
|
4
10
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
5
11
|
const logger = createLogger("workflows");
|
|
6
12
|
class SignalError extends Error {
|
|
@@ -12,7 +18,16 @@ class SignalError extends Error {
|
|
|
12
18
|
}
|
|
13
19
|
}
|
|
14
20
|
async function sendSignal(em, container, options) {
|
|
15
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
instanceId,
|
|
23
|
+
signalName,
|
|
24
|
+
payload,
|
|
25
|
+
agentOutcome,
|
|
26
|
+
agentProposalId,
|
|
27
|
+
userId,
|
|
28
|
+
tenantId,
|
|
29
|
+
organizationId
|
|
30
|
+
} = options;
|
|
16
31
|
const eventLogger = container.resolve("eventLogger");
|
|
17
32
|
const stepHandler = container.resolve("stepHandler");
|
|
18
33
|
const transitionHandler = container.resolve("transitionHandler");
|
|
@@ -126,14 +141,17 @@ async function sendSignal(em, container, options) {
|
|
|
126
141
|
const currentStep = definition.definition.steps.find(
|
|
127
142
|
(s) => s.stepId === instance.currentStepId
|
|
128
143
|
);
|
|
129
|
-
|
|
144
|
+
const isInvokeAgentStep = !!currentStep && Array.isArray(currentStep.activities) && currentStep.activities.some((a) => a?.activityType === "INVOKE_AGENT");
|
|
145
|
+
const isSubWorkflowStep = !!currentStep && currentStep.stepType === "SUB_WORKFLOW";
|
|
146
|
+
const stepCanReceiveSignal = !!currentStep && (currentStep.stepType === "WAIT_FOR_SIGNAL" || !!currentStep.signalConfig?.signalName || isInvokeAgentStep || isSubWorkflowStep);
|
|
147
|
+
if (!stepCanReceiveSignal) {
|
|
130
148
|
throw new SignalError(
|
|
131
149
|
"Workflow is not waiting for signal",
|
|
132
150
|
"NOT_WAITING_FOR_SIGNAL",
|
|
133
151
|
{ instanceId, currentStepId: instance.currentStepId }
|
|
134
152
|
);
|
|
135
153
|
}
|
|
136
|
-
const expectedSignalName = currentStep.signalConfig?.signalName || currentStep.stepId;
|
|
154
|
+
const expectedSignalName = currentStep.signalConfig?.signalName || (isInvokeAgentStep ? INVOKE_AGENT_SIGNAL_NAME : isSubWorkflowStep ? SUB_WORKFLOW_SIGNAL_NAME : currentStep.stepId);
|
|
137
155
|
if (expectedSignalName !== signalName) {
|
|
138
156
|
throw new SignalError(
|
|
139
157
|
"Signal name mismatch",
|
|
@@ -150,6 +168,22 @@ async function sendSignal(em, container, options) {
|
|
|
150
168
|
[`signal_${signalName}_receivedAt`]: now.toISOString()
|
|
151
169
|
};
|
|
152
170
|
}
|
|
171
|
+
if (isInvokeAgentStep && instance.currentStepId) {
|
|
172
|
+
const resolvedOutcome = agentOutcome ?? mapDispositionToAgentOutcome(
|
|
173
|
+
payload?.disposition
|
|
174
|
+
);
|
|
175
|
+
if (resolvedOutcome) {
|
|
176
|
+
const proposalId = agentProposalId ?? payload?.agentProposalId ?? payload?.proposalId;
|
|
177
|
+
instance.context = {
|
|
178
|
+
...instance.context,
|
|
179
|
+
[WORKFLOW_AGENT_OUTCOME_CONTEXT_KEY]: buildAgentOutcomeContextEntry(
|
|
180
|
+
instance.currentStepId,
|
|
181
|
+
resolvedOutcome,
|
|
182
|
+
typeof proposalId === "string" ? proposalId : void 0
|
|
183
|
+
)
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
153
187
|
instance.updatedAt = now;
|
|
154
188
|
await eventLogger.logWorkflowEvent(em, {
|
|
155
189
|
workflowInstanceId: instance.id,
|
|
@@ -181,6 +215,29 @@ async function sendSignal(em, container, options) {
|
|
|
181
215
|
payload
|
|
182
216
|
});
|
|
183
217
|
}
|
|
218
|
+
instance.status = "RUNNING";
|
|
219
|
+
await em.flush();
|
|
220
|
+
const { dispatchAgentOutcomeForCurrentStep } = await import("./workflow-executor.js");
|
|
221
|
+
const outcomeDispatch = await dispatchAgentOutcomeForCurrentStep(
|
|
222
|
+
em,
|
|
223
|
+
container,
|
|
224
|
+
instance,
|
|
225
|
+
definition.definition,
|
|
226
|
+
{ workflowContext: instance.context, userId }
|
|
227
|
+
);
|
|
228
|
+
if (outcomeDispatch && outcomeDispatch.kind !== "default") {
|
|
229
|
+
if (outcomeDispatch.kind === "failed") {
|
|
230
|
+
await workflowExecutor.completeWorkflow(em, container, instance.id, "FAILED", {
|
|
231
|
+
error: outcomeDispatch.error
|
|
232
|
+
});
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (outcomeDispatch.kind === "parked") return;
|
|
236
|
+
if (outcomeDispatch.paused) return;
|
|
237
|
+
await em.flush();
|
|
238
|
+
await workflowExecutor.executeWorkflow(em, container, instance.id, { userId });
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
184
241
|
const autoTransitions = (definition.definition.transitions || []).filter(
|
|
185
242
|
(t) => t.fromStepId === instance.currentStepId && t.trigger === "auto"
|
|
186
243
|
);
|
|
@@ -205,13 +262,15 @@ async function sendSignal(em, container, options) {
|
|
|
205
262
|
await em.flush();
|
|
206
263
|
return;
|
|
207
264
|
}
|
|
265
|
+
instance.status = "RUNNING";
|
|
266
|
+
await em.flush();
|
|
208
267
|
const transitionResult = await transitionHandler.executeTransition(
|
|
209
268
|
em,
|
|
210
269
|
container,
|
|
211
270
|
instance,
|
|
212
271
|
instance.currentStepId,
|
|
213
272
|
firstValidTransition.transition.toStepId,
|
|
214
|
-
transitionContext
|
|
273
|
+
{ ...transitionContext, transitionId: firstValidTransition.transition.transitionId }
|
|
215
274
|
);
|
|
216
275
|
if (!transitionResult.success) {
|
|
217
276
|
throw new SignalError(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/workflows/lib/signal-handler.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Signal Handler Service\n *\n * Receives external signals and resumes workflows waiting for them.\n */\n\nimport { EntityManager } from '@mikro-orm/core'\nimport type { EntityManager as PostgreSqlEntityManager } from '@mikro-orm/postgresql'\nimport type { AwilixContainer } from 'awilix'\nimport { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { WorkflowInstance, WorkflowBranchInstance, WorkflowDefinition, StepInstance } from '../data/entities'\nimport type * as eventLoggerModule from './event-logger'\nimport type * as stepHandlerModule from './step-handler'\nimport type * as transitionHandlerModule from './transition-handler'\nimport type * as workflowExecutorModule from './workflow-executor'\nimport { resolveCodeDefinitionForInstance } from './find-definition'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nexport interface SendSignalOptions {\n /**\n * Workflow instance ID\n */\n instanceId: string\n\n /**\n * Signal name to match against WAIT_FOR_SIGNAL step config\n */\n signalName: string\n\n /**\n * Optional payload to merge into workflow context\n */\n payload?: Record<string, any>\n\n /**\n * User ID sending the signal\n */\n userId?: string\n\n /**\n * Tenant/org scope\n */\n tenantId: string\n organizationId: string\n}\n\nexport class SignalError extends Error {\n constructor(\n message: string,\n public code: string,\n public details?: any\n ) {\n super(message)\n this.name = 'SignalError'\n }\n}\n\n/**\n * Send signal to workflow instance and resume execution\n */\nexport async function sendSignal(\n em: EntityManager,\n container: AwilixContainer,\n options: SendSignalOptions\n): Promise<void> {\n const { instanceId, signalName, payload, userId, tenantId, organizationId } = options\n\n const eventLogger = container.resolve<typeof eventLoggerModule>('eventLogger')\n const stepHandler = container.resolve<typeof stepHandlerModule>('stepHandler')\n const transitionHandler = container.resolve<typeof transitionHandlerModule>('transitionHandler')\n const workflowExecutor = container.resolve<typeof workflowExecutorModule>('workflowExecutor')\n\n // Fetch workflow instance\n const instance = await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowInstance,\n {\n id: instanceId,\n tenantId,\n organizationId,\n },\n undefined,\n { tenantId, organizationId },\n )\n\n if (!instance) {\n throw new SignalError(\n 'Workflow instance not found',\n 'INSTANCE_NOT_FOUND',\n { instanceId }\n )\n }\n\n // Branch-scoped signal: a FORKED instance routes the signal to the branch\n // paused at a matching WAIT_FOR_SIGNAL step.\n if (instance.status === 'FORKED') {\n const branchDefinition = (await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowDefinition,\n { id: instance.definitionId, tenantId: instance.tenantId, organizationId: instance.organizationId, deletedAt: null },\n undefined,\n { tenantId: instance.tenantId, organizationId: instance.organizationId },\n )) ?? resolveCodeDefinitionForInstance(instance)\n if (!branchDefinition) {\n throw new SignalError('Workflow definition not found', 'DEFINITION_NOT_FOUND', { definitionId: instance.definitionId })\n }\n\n const pausedBranches = await em.find(WorkflowBranchInstance, {\n workflowInstanceId: instanceId,\n status: 'PAUSED',\n tenantId,\n organizationId,\n })\n\n let targetBranch: WorkflowBranchInstance | null = null\n for (const candidate of pausedBranches) {\n const step = branchDefinition.definition.steps.find((s: any) => s.stepId === candidate.currentStepId)\n if (step?.stepType === 'WAIT_FOR_SIGNAL') {\n const candidateSignal = step.signalConfig?.signalName || step.stepId\n if (candidateSignal === signalName) {\n targetBranch = candidate\n break\n }\n }\n }\n\n if (!targetBranch) {\n throw new SignalError('No parallel branch awaiting this signal', 'NO_BRANCH_AWAITING_SIGNAL', { instanceId, signalName })\n }\n\n const branchStepInstance = await em.findOne(StepInstance, {\n workflowInstanceId: instanceId,\n branchInstanceId: targetBranch.id,\n stepId: targetBranch.currentStepId,\n status: 'ACTIVE',\n })\n\n await eventLogger.logWorkflowEvent(em, {\n workflowInstanceId: instanceId,\n stepInstanceId: branchStepInstance?.id,\n branchInstanceId: targetBranch.id,\n eventType: 'SIGNAL_RECEIVED',\n eventData: { signalName, branch: true },\n userId,\n tenantId,\n organizationId,\n })\n\n const { resumeBranch } = await import('./parallel-handler')\n const resumed = await resumeBranch(em, {\n instanceId,\n branchInstanceId: targetBranch.id,\n tenantId,\n organizationId,\n contextMerge: payload,\n exitStepInstanceId: branchStepInstance?.id ?? null,\n exitOutput: { signalName, payload },\n })\n if (resumed) {\n await workflowExecutor.executeWorkflow(em, container, instanceId, { userId })\n }\n return\n }\n\n // Verify workflow is paused\n if (instance.status !== 'PAUSED') {\n throw new SignalError(\n 'Workflow is not paused',\n 'WORKFLOW_NOT_PAUSED',\n { instanceId, status: instance.status }\n )\n }\n\n // Load workflow definition with tenant/org scope to check current step\n const definition = (await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowDefinition,\n {\n id: instance.definitionId,\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n deletedAt: null,\n },\n undefined,\n { tenantId: instance.tenantId, organizationId: instance.organizationId },\n )) ?? resolveCodeDefinitionForInstance(instance)\n if (!definition) {\n throw new SignalError(\n 'Workflow definition not found',\n 'DEFINITION_NOT_FOUND',\n { definitionId: instance.definitionId }\n )\n }\n\n // Find current step\n const currentStep = definition.definition.steps.find(\n (s: any) => s.stepId === instance.currentStepId\n )\n\n if (!currentStep || currentStep.stepType !== 'WAIT_FOR_SIGNAL') {\n throw new SignalError(\n 'Workflow is not waiting for signal',\n 'NOT_WAITING_FOR_SIGNAL',\n { instanceId, currentStepId: instance.currentStepId }\n )\n }\n\n // Check signal name matches\n const expectedSignalName = currentStep.signalConfig?.signalName || currentStep.stepId\n if (expectedSignalName !== signalName) {\n throw new SignalError(\n 'Signal name mismatch',\n 'SIGNAL_NAME_MISMATCH',\n { expected: expectedSignalName, received: signalName }\n )\n }\n\n const now = new Date()\n\n // Merge signal payload into workflow context\n if (payload) {\n instance.context = {\n ...instance.context,\n ...payload,\n [`signal_${signalName}_payload`]: payload,\n [`signal_${signalName}_receivedAt`]: now.toISOString(),\n }\n }\n\n instance.updatedAt = now\n\n // Log signal received event\n await eventLogger.logWorkflowEvent(em, {\n workflowInstanceId: instance.id,\n eventType: 'SIGNAL_RECEIVED',\n eventData: {\n signalName,\n payload,\n },\n userId,\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n })\n\n // Find active step instance and exit it\n const stepInstance = await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n StepInstance,\n {\n workflowInstanceId: instance.id,\n stepId: instance.currentStepId,\n status: 'ACTIVE',\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n },\n undefined,\n { tenantId: instance.tenantId, organizationId: instance.organizationId },\n )\n\n if (stepInstance) {\n await stepHandler.exitStep(em, stepInstance, {\n signalName,\n payload,\n })\n }\n\n // Find automatic transitions from current step\n const autoTransitions = (definition.definition.transitions || []).filter(\n (t: any) => t.fromStepId === instance.currentStepId && t.trigger === 'auto'\n )\n\n if (autoTransitions.length === 0) {\n // No automatic transitions, mark as RUNNING but stay at current step\n instance.status = 'RUNNING'\n await em.flush()\n return\n }\n\n // Find valid transitions\n const transitionContext = {\n workflowContext: instance.context,\n userId,\n }\n\n const validTransitions = await transitionHandler.findValidTransitions(\n em,\n instance,\n instance.currentStepId,\n transitionContext\n )\n\n const firstValidTransition = validTransitions.find((t) => t.isValid)\n\n if (!firstValidTransition || !firstValidTransition.transition) {\n // No valid transitions, mark as RUNNING anyway\n instance.status = 'RUNNING'\n await em.flush()\n return\n }\n\n // Execute transition to next step\n const transitionResult = await transitionHandler.executeTransition(\n em,\n container,\n instance,\n instance.currentStepId,\n firstValidTransition.transition.toStepId,\n transitionContext\n )\n\n if (!transitionResult.success) {\n throw new SignalError(\n 'Transition failed after signal',\n 'TRANSITION_FAILED',\n { error: transitionResult.error }\n )\n }\n\n // Resume workflow execution\n await workflowExecutor.executeWorkflow(em, container, instance.id, { userId })\n}\n\n/**\n * Send signal by correlation key (finds all waiting instances)\n */\nexport async function sendSignalByCorrelationKey(\n em: EntityManager,\n container: AwilixContainer,\n options: Omit<SendSignalOptions, 'instanceId'> & { correlationKey: string }\n): Promise<number> {\n const { correlationKey, signalName, payload, userId, tenantId, organizationId } = options\n\n // Find all paused instances with this correlation key\n const instances = await findWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowInstance,\n {\n correlationKey,\n status: 'PAUSED',\n tenantId,\n organizationId,\n },\n undefined,\n { tenantId, organizationId },\n )\n\n let signalsProcessed = 0\n\n for (const instance of instances) {\n try {\n await sendSignal(em, container, {\n instanceId: instance.id,\n signalName,\n payload,\n userId,\n tenantId,\n organizationId,\n })\n signalsProcessed++\n } catch (error) {\n // Log error but continue processing other instances\n logger.error('Failed to send signal to instance', { instanceId: instance.id, err: error })\n }\n }\n\n return signalsProcessed\n}\n"],
|
|
5
|
-
"mappings": "AASA,SAAS,uBAAuB,0BAA0B;AAC1D,SAAS,kBAAkB,wBAAwB,oBAAoB,oBAAoB;
|
|
4
|
+
"sourcesContent": ["/**\n * Signal Handler Service\n *\n * Receives external signals and resumes workflows waiting for them.\n */\n\nimport { EntityManager } from '@mikro-orm/core'\nimport type { EntityManager as PostgreSqlEntityManager } from '@mikro-orm/postgresql'\nimport type { AwilixContainer } from 'awilix'\nimport { findOneWithDecryption, findWithDecryption } from '@open-mercato/shared/lib/encryption/find'\nimport { WorkflowInstance, WorkflowBranchInstance, WorkflowDefinition, StepInstance } from '../data/entities'\nimport { INVOKE_AGENT_SIGNAL_NAME, SUB_WORKFLOW_SIGNAL_NAME } from './activity-executor'\nimport type * as eventLoggerModule from './event-logger'\nimport type * as stepHandlerModule from './step-handler'\nimport type * as transitionHandlerModule from './transition-handler'\nimport type * as workflowExecutorModule from './workflow-executor'\nimport { resolveCodeDefinitionForInstance } from './find-definition'\nimport {\n WORKFLOW_AGENT_OUTCOME_CONTEXT_KEY,\n buildAgentOutcomeContextEntry,\n mapDispositionToAgentOutcome,\n type AgentOutcomeKind,\n} from './outcome-routing'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nexport interface SendSignalOptions {\n /**\n * Workflow instance ID\n */\n instanceId: string\n\n /**\n * Signal name to match against WAIT_FOR_SIGNAL step config\n */\n signalName: string\n\n /**\n * Optional payload to merge into workflow context\n */\n payload?: Record<string, any>\n\n /** Engine-owned outcome metadata kept separate from author-visible mappings. */\n agentOutcome?: AgentOutcomeKind\n\n /** Proposal identifier associated with `agentOutcome`, when present. */\n agentProposalId?: string\n\n /**\n * User ID sending the signal\n */\n userId?: string\n\n /**\n * Tenant/org scope\n */\n tenantId: string\n organizationId: string\n}\n\nexport class SignalError extends Error {\n constructor(\n message: string,\n public code: string,\n public details?: any\n ) {\n super(message)\n this.name = 'SignalError'\n }\n}\n\n/**\n * Send signal to workflow instance and resume execution\n */\nexport async function sendSignal(\n em: EntityManager,\n container: AwilixContainer,\n options: SendSignalOptions\n): Promise<void> {\n const {\n instanceId,\n signalName,\n payload,\n agentOutcome,\n agentProposalId,\n userId,\n tenantId,\n organizationId,\n } = options\n\n const eventLogger = container.resolve<typeof eventLoggerModule>('eventLogger')\n const stepHandler = container.resolve<typeof stepHandlerModule>('stepHandler')\n const transitionHandler = container.resolve<typeof transitionHandlerModule>('transitionHandler')\n const workflowExecutor = container.resolve<typeof workflowExecutorModule>('workflowExecutor')\n\n // Fetch workflow instance\n const instance = await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowInstance,\n {\n id: instanceId,\n tenantId,\n organizationId,\n },\n undefined,\n { tenantId, organizationId },\n )\n\n if (!instance) {\n throw new SignalError(\n 'Workflow instance not found',\n 'INSTANCE_NOT_FOUND',\n { instanceId }\n )\n }\n\n // Branch-scoped signal: a FORKED instance routes the signal to the branch\n // paused at a matching WAIT_FOR_SIGNAL step.\n if (instance.status === 'FORKED') {\n const branchDefinition = (await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowDefinition,\n { id: instance.definitionId, tenantId: instance.tenantId, organizationId: instance.organizationId, deletedAt: null },\n undefined,\n { tenantId: instance.tenantId, organizationId: instance.organizationId },\n )) ?? resolveCodeDefinitionForInstance(instance)\n if (!branchDefinition) {\n throw new SignalError('Workflow definition not found', 'DEFINITION_NOT_FOUND', { definitionId: instance.definitionId })\n }\n\n const pausedBranches = await em.find(WorkflowBranchInstance, {\n workflowInstanceId: instanceId,\n status: 'PAUSED',\n tenantId,\n organizationId,\n })\n\n let targetBranch: WorkflowBranchInstance | null = null\n for (const candidate of pausedBranches) {\n const step = branchDefinition.definition.steps.find((s: any) => s.stepId === candidate.currentStepId)\n if (step?.stepType === 'WAIT_FOR_SIGNAL') {\n const candidateSignal = step.signalConfig?.signalName || step.stepId\n if (candidateSignal === signalName) {\n targetBranch = candidate\n break\n }\n }\n }\n\n if (!targetBranch) {\n throw new SignalError('No parallel branch awaiting this signal', 'NO_BRANCH_AWAITING_SIGNAL', { instanceId, signalName })\n }\n\n const branchStepInstance = await em.findOne(StepInstance, {\n workflowInstanceId: instanceId,\n branchInstanceId: targetBranch.id,\n stepId: targetBranch.currentStepId,\n status: 'ACTIVE',\n })\n\n await eventLogger.logWorkflowEvent(em, {\n workflowInstanceId: instanceId,\n stepInstanceId: branchStepInstance?.id,\n branchInstanceId: targetBranch.id,\n eventType: 'SIGNAL_RECEIVED',\n eventData: { signalName, branch: true },\n userId,\n tenantId,\n organizationId,\n })\n\n const { resumeBranch } = await import('./parallel-handler')\n const resumed = await resumeBranch(em, {\n instanceId,\n branchInstanceId: targetBranch.id,\n tenantId,\n organizationId,\n contextMerge: payload,\n exitStepInstanceId: branchStepInstance?.id ?? null,\n exitOutput: { signalName, payload },\n })\n if (resumed) {\n await workflowExecutor.executeWorkflow(em, container, instanceId, { userId })\n }\n return\n }\n\n // Verify workflow is paused\n if (instance.status !== 'PAUSED') {\n throw new SignalError(\n 'Workflow is not paused',\n 'WORKFLOW_NOT_PAUSED',\n { instanceId, status: instance.status }\n )\n }\n\n // Load workflow definition with tenant/org scope to check current step\n const definition = (await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowDefinition,\n {\n id: instance.definitionId,\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n deletedAt: null,\n },\n undefined,\n { tenantId: instance.tenantId, organizationId: instance.organizationId },\n )) ?? resolveCodeDefinitionForInstance(instance)\n if (!definition) {\n throw new SignalError(\n 'Workflow definition not found',\n 'DEFINITION_NOT_FOUND',\n { definitionId: instance.definitionId }\n )\n }\n\n // Find current step\n const currentStep = definition.definition.steps.find(\n (s: any) => s.stepId === instance.currentStepId\n )\n\n // A dedicated WAIT_FOR_SIGNAL step \u2014 OR any step that parked while declaring a\n // `signalConfig.signalName` (e.g. an AUTOMATED step whose INVOKE_AGENT activity\n // routed its proposal to a human) \u2014 can be resumed by a matching signal. The\n // resume path below (merge payload \u2192 exit step \u2192 run auto transitions) is\n // step-type-agnostic, so widening this guard is additive and safe.\n //\n // INVOKE_AGENT steps run their agent asynchronously (off the workflow\n // transaction) and park on `agent_orchestrator.proposal.ready`; recognize them\n // even when the definition omits an explicit `signalConfig.signalName` (e.g.\n // seeded blueprints not re-saved through the visual editor) so the activity\n // worker can resume them after the agent completes.\n const isInvokeAgentStep =\n !!currentStep &&\n Array.isArray(currentStep.activities) &&\n currentStep.activities.some((a: any) => a?.activityType === 'INVOKE_AGENT')\n // SUB_WORKFLOW steps park while their child instance runs its own async/agent\n // steps and resume on SUB_WORKFLOW_SIGNAL_NAME once the child terminates;\n // recognize them even without an explicit signalConfig.signalName.\n const isSubWorkflowStep = !!currentStep && currentStep.stepType === 'SUB_WORKFLOW'\n const stepCanReceiveSignal =\n !!currentStep &&\n (currentStep.stepType === 'WAIT_FOR_SIGNAL' ||\n !!currentStep.signalConfig?.signalName ||\n isInvokeAgentStep ||\n isSubWorkflowStep)\n if (!stepCanReceiveSignal) {\n throw new SignalError(\n 'Workflow is not waiting for signal',\n 'NOT_WAITING_FOR_SIGNAL',\n { instanceId, currentStepId: instance.currentStepId }\n )\n }\n\n // Check signal name matches\n const expectedSignalName =\n currentStep.signalConfig?.signalName ||\n (isInvokeAgentStep\n ? INVOKE_AGENT_SIGNAL_NAME\n : isSubWorkflowStep\n ? SUB_WORKFLOW_SIGNAL_NAME\n : currentStep.stepId)\n if (expectedSignalName !== signalName) {\n throw new SignalError(\n 'Signal name mismatch',\n 'SIGNAL_NAME_MISMATCH',\n { expected: expectedSignalName, received: signalName }\n )\n }\n\n const now = new Date()\n\n // Merge signal payload into workflow context\n if (payload) {\n instance.context = {\n ...instance.context,\n ...payload,\n [`signal_${signalName}_payload`]: payload,\n [`signal_${signalName}_receivedAt`]: now.toISOString(),\n }\n }\n\n // Outcome routing (spec 7.2). The signal is how EVERY resolved disposition\n // reaches a parked agent step \u2014 the activity worker's auto_approved and\n // researcher resumes and the human dispose path alike \u2014 so this is the one\n // place the disposition has to be translated into the engine-owned outcome\n // marker the executor routes on. Recorded regardless of who sent the signal;\n // the author-visible `disposition` key stays untouched and unread by routing.\n if (isInvokeAgentStep && instance.currentStepId) {\n const resolvedOutcome = agentOutcome ?? mapDispositionToAgentOutcome(\n (payload as Record<string, unknown> | undefined)?.disposition,\n )\n if (resolvedOutcome) {\n const proposalId = agentProposalId\n ?? (payload as Record<string, unknown> | undefined)?.agentProposalId\n ?? (payload as Record<string, unknown> | undefined)?.proposalId\n instance.context = {\n ...instance.context,\n [WORKFLOW_AGENT_OUTCOME_CONTEXT_KEY]: buildAgentOutcomeContextEntry(\n instance.currentStepId,\n resolvedOutcome,\n typeof proposalId === 'string' ? proposalId : undefined,\n ),\n }\n }\n }\n\n instance.updatedAt = now\n\n // Log signal received event\n await eventLogger.logWorkflowEvent(em, {\n workflowInstanceId: instance.id,\n eventType: 'SIGNAL_RECEIVED',\n eventData: {\n signalName,\n payload,\n },\n userId,\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n })\n\n // Find active step instance and exit it\n const stepInstance = await findOneWithDecryption(\n em as PostgreSqlEntityManager,\n StepInstance,\n {\n workflowInstanceId: instance.id,\n stepId: instance.currentStepId,\n status: 'ACTIVE',\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n },\n undefined,\n { tenantId: instance.tenantId, organizationId: instance.organizationId },\n )\n\n if (stepInstance) {\n await stepHandler.exitStep(em, stepInstance, {\n signalName,\n payload,\n })\n }\n\n // Outcome routing (spec 7.2). A resumed agent step is advanced HERE, not by\n // the executor loop, so the wired outcome route has to be honoured here too \u2014\n // routing it in only one of the two places would silently send every\n // human-dispositioned proposal down the happy path.\n //\n // Resume from the paused wait BEFORE dispatching, exactly as the ordinary\n // resume path below does. On this path the instance is PAUSED by definition \u2014\n // it is parked on the very signal being delivered \u2014 and two things depended on\n // that being cleared first: the executor's defence-in-depth PAUSED guard stops\n // a routed run at its first step, and `instance.status === 'PAUSED'` below\n // could never mean \"this dispatch parked the run\" while the pre-existing pause\n // was still set. Every routed outcome therefore returned early and the run sat\n // on its route target, PAUSED, forever (TC-WF-051, TC-WF-052).\n instance.status = 'RUNNING'\n await em.flush()\n\n // Imported lazily rather than read off the DI-resolved executor: the resolved\n // service is the module, and reaching for a named export on it couples this\n // path to every test double that stubs only the two methods it needed.\n const { dispatchAgentOutcomeForCurrentStep } = await import('./workflow-executor')\n const outcomeDispatch = await dispatchAgentOutcomeForCurrentStep(\n em,\n container,\n instance,\n definition.definition,\n { workflowContext: instance.context, userId },\n )\n if (outcomeDispatch && outcomeDispatch.kind !== 'default') {\n if (outcomeDispatch.kind === 'failed') {\n await workflowExecutor.completeWorkflow(em, container, instance.id, 'FAILED', {\n error: outcomeDispatch.error,\n })\n return\n }\n if (outcomeDispatch.kind === 'parked') return\n // `paused` is the dispatch's own report that IT parked the run (a\n // step-through release, a wait step on the far side of the route).\n if (outcomeDispatch.paused) return\n await em.flush()\n await workflowExecutor.executeWorkflow(em, container, instance.id, { userId })\n return\n }\n\n // Find automatic transitions from current step\n const autoTransitions = (definition.definition.transitions || []).filter(\n (t: any) => t.fromStepId === instance.currentStepId && t.trigger === 'auto'\n )\n\n if (autoTransitions.length === 0) {\n // No automatic transitions, mark as RUNNING but stay at current step\n instance.status = 'RUNNING'\n await em.flush()\n return\n }\n\n // Find valid transitions\n const transitionContext = {\n workflowContext: instance.context,\n userId,\n }\n\n const validTransitions = await transitionHandler.findValidTransitions(\n em,\n instance,\n instance.currentStepId,\n transitionContext\n )\n\n const firstValidTransition = validTransitions.find((t) => t.isValid)\n\n if (!firstValidTransition || !firstValidTransition.transition) {\n // No valid transitions, mark as RUNNING anyway\n instance.status = 'RUNNING'\n await em.flush()\n return\n }\n\n // Resume from the paused wait: flip to RUNNING before executing the transition\n // and re-entering executeWorkflow. Without this the executor's defense-in-depth\n // PAUSED check stops the run after the first traversed step, so an intermediate\n // AUTOMATED step (e.g. an emit-event \"flag\") between the waiting step and END\n // leaves the instance permanently parked \u2014 and any parent sub-workflow waiting on\n // its completion never resumes. The no-transition branches above already do this.\n instance.status = 'RUNNING'\n await em.flush()\n\n // Execute transition to next step\n const transitionResult = await transitionHandler.executeTransition(\n em,\n container,\n instance,\n instance.currentStepId,\n firstValidTransition.transition.toStepId,\n { ...transitionContext, transitionId: firstValidTransition.transition.transitionId },\n )\n\n if (!transitionResult.success) {\n throw new SignalError(\n 'Transition failed after signal',\n 'TRANSITION_FAILED',\n { error: transitionResult.error }\n )\n }\n\n // Resume workflow execution\n await workflowExecutor.executeWorkflow(em, container, instance.id, { userId })\n}\n\n/**\n * Send signal by correlation key (finds all waiting instances)\n */\nexport async function sendSignalByCorrelationKey(\n em: EntityManager,\n container: AwilixContainer,\n options: Omit<SendSignalOptions, 'instanceId'> & { correlationKey: string }\n): Promise<number> {\n const { correlationKey, signalName, payload, userId, tenantId, organizationId } = options\n\n // Find all paused instances with this correlation key\n const instances = await findWithDecryption(\n em as PostgreSqlEntityManager,\n WorkflowInstance,\n {\n correlationKey,\n status: 'PAUSED',\n tenantId,\n organizationId,\n },\n undefined,\n { tenantId, organizationId },\n )\n\n let signalsProcessed = 0\n\n for (const instance of instances) {\n try {\n await sendSignal(em, container, {\n instanceId: instance.id,\n signalName,\n payload,\n userId,\n tenantId,\n organizationId,\n })\n signalsProcessed++\n } catch (error) {\n // Log error but continue processing other instances\n logger.error('Failed to send signal to instance', { instanceId: instance.id, err: error })\n }\n }\n\n return signalsProcessed\n}\n"],
|
|
5
|
+
"mappings": "AASA,SAAS,uBAAuB,0BAA0B;AAC1D,SAAS,kBAAkB,wBAAwB,oBAAoB,oBAAoB;AAC3F,SAAS,0BAA0B,gCAAgC;AAKnE,SAAS,wCAAwC;AACjD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAoChC,MAAM,oBAAoB,MAAM;AAAA,EACrC,YACE,SACO,MACA,SACP;AACA,UAAM,OAAO;AAHN;AACA;AAGP,SAAK,OAAO;AAAA,EACd;AACF;AAKA,eAAsB,WACpB,IACA,WACA,SACe;AACf,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,cAAc,UAAU,QAAkC,aAAa;AAC7E,QAAM,cAAc,UAAU,QAAkC,aAAa;AAC7E,QAAM,oBAAoB,UAAU,QAAwC,mBAAmB;AAC/F,QAAM,mBAAmB,UAAU,QAAuC,kBAAkB;AAG5F,QAAM,WAAW,MAAM;AAAA,IACrB;AAAA,IACA;AAAA,IACA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AC9B,YAAY,SAAS;AAAA,QACrB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AACD;AAAA,IACF,SAAS,OAAO;AAEd,aAAO,MAAM,qCAAqC,EAAE,YAAY,SAAS,IAAI,KAAK,MAAM,CAAC;AAAA,IAC3F;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const WORKFLOW_START_FIXTURES_MAX_CHARS = 65536;
|
|
2
|
+
const WORKFLOW_START_FIXTURE_NAME_MAX = 80;
|
|
3
|
+
const WORKFLOW_START_FIXTURES_MAX_COUNT = 25;
|
|
4
|
+
function normalizeName(name) {
|
|
5
|
+
return name.trim();
|
|
6
|
+
}
|
|
7
|
+
function upsertStartFixture(fixtures, name, context, savedAt) {
|
|
8
|
+
const trimmed = normalizeName(name);
|
|
9
|
+
if (!trimmed) return { ok: false, reason: "emptyName" };
|
|
10
|
+
if (trimmed.length > WORKFLOW_START_FIXTURE_NAME_MAX) return { ok: false, reason: "nameTooLong" };
|
|
11
|
+
const next = { ...fixtures ?? {} };
|
|
12
|
+
const isNew = !(trimmed in next);
|
|
13
|
+
if (isNew && Object.keys(next).length >= WORKFLOW_START_FIXTURES_MAX_COUNT) {
|
|
14
|
+
return { ok: false, reason: "tooMany" };
|
|
15
|
+
}
|
|
16
|
+
next[trimmed] = { name: trimmed, savedAt, context };
|
|
17
|
+
if (JSON.stringify(next).length > WORKFLOW_START_FIXTURES_MAX_CHARS) {
|
|
18
|
+
return { ok: false, reason: "tooLarge" };
|
|
19
|
+
}
|
|
20
|
+
return { ok: true, fixtures: next };
|
|
21
|
+
}
|
|
22
|
+
function removeStartFixture(fixtures, name) {
|
|
23
|
+
const next = { ...fixtures ?? {} };
|
|
24
|
+
delete next[normalizeName(name)];
|
|
25
|
+
return next;
|
|
26
|
+
}
|
|
27
|
+
function listStartFixtures(fixtures) {
|
|
28
|
+
const entries = Object.values(fixtures ?? {});
|
|
29
|
+
return [...entries].sort((left, right) => {
|
|
30
|
+
if (left.savedAt !== right.savedAt) return left.savedAt < right.savedAt ? 1 : -1;
|
|
31
|
+
return left.name.localeCompare(right.name);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
WORKFLOW_START_FIXTURES_MAX_CHARS,
|
|
36
|
+
WORKFLOW_START_FIXTURES_MAX_COUNT,
|
|
37
|
+
WORKFLOW_START_FIXTURE_NAME_MAX,
|
|
38
|
+
listStartFixtures,
|
|
39
|
+
removeStartFixture,
|
|
40
|
+
upsertStartFixture
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=start-fixtures.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/start-fixtures.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Workflows Module \u2014 Start fixtures (spec section 8.1)\n *\n * *\"fixtures (named start contexts \u2014 \"happy path\", \"missing phone\")\"*.\n *\n * Fixtures are deliberately a DIFFERENT thing from pinned samples (section 3.6),\n * and the spec says so: a sample is per-STEP data feeding previews and the\n * ledger, a fixture is a whole START context. Conflating them would make \"which\n * one wins\" a question with no answer. They share a home\n * (`metadata.editor.*`) and a cap discipline, nothing else.\n *\n * Like samples, fixture data is stored VERBATIM and is neither redacted nor\n * encrypted \u2014 keep the warning copy wherever a fixture is saved.\n *\n * PURE: no ORM, no DI, no React.\n */\n\nexport const WORKFLOW_START_FIXTURES_MAX_CHARS = 65536\nexport const WORKFLOW_START_FIXTURE_NAME_MAX = 80\nexport const WORKFLOW_START_FIXTURES_MAX_COUNT = 25\n\nexport type WorkflowStartFixture = {\n name: string\n savedAt: string\n context: Record<string, unknown>\n}\n\nexport type WorkflowStartFixtures = Record<string, WorkflowStartFixture>\n\nexport type FixtureWriteResult =\n | { ok: true; fixtures: WorkflowStartFixtures }\n | { ok: false; reason: 'emptyName' | 'nameTooLong' | 'tooMany' | 'tooLarge' }\n\nfunction normalizeName(name: string): string {\n return name.trim()\n}\n\n/**\n * Add or replace a fixture.\n *\n * Every limit is checked against the RESULT, not the input, so replacing an\n * existing fixture with a smaller one always succeeds even when the collection\n * is already at its cap \u2014 the alternative would strand an author who is trying\n * to shrink their way back under it.\n */\nexport function upsertStartFixture(\n fixtures: WorkflowStartFixtures | null | undefined,\n name: string,\n context: Record<string, unknown>,\n savedAt: string,\n): FixtureWriteResult {\n const trimmed = normalizeName(name)\n if (!trimmed) return { ok: false, reason: 'emptyName' }\n if (trimmed.length > WORKFLOW_START_FIXTURE_NAME_MAX) return { ok: false, reason: 'nameTooLong' }\n\n const next: WorkflowStartFixtures = { ...(fixtures ?? {}) }\n const isNew = !(trimmed in next)\n if (isNew && Object.keys(next).length >= WORKFLOW_START_FIXTURES_MAX_COUNT) {\n return { ok: false, reason: 'tooMany' }\n }\n\n next[trimmed] = { name: trimmed, savedAt, context }\n\n if (JSON.stringify(next).length > WORKFLOW_START_FIXTURES_MAX_CHARS) {\n return { ok: false, reason: 'tooLarge' }\n }\n\n return { ok: true, fixtures: next }\n}\n\nexport function removeStartFixture(\n fixtures: WorkflowStartFixtures | null | undefined,\n name: string,\n): WorkflowStartFixtures {\n const next: WorkflowStartFixtures = { ...(fixtures ?? {}) }\n delete next[normalizeName(name)]\n return next\n}\n\n/**\n * List fixtures for display, newest save first, name as the stable tiebreaker\n * (never a bare `.sort()` \u2014 an unordered picker reshuffles under the author's\n * cursor between renders).\n */\nexport function listStartFixtures(\n fixtures: WorkflowStartFixtures | null | undefined,\n): WorkflowStartFixture[] {\n const entries = Object.values(fixtures ?? {})\n return [...entries].sort((left, right) => {\n if (left.savedAt !== right.savedAt) return left.savedAt < right.savedAt ? 1 : -1\n return left.name.localeCompare(right.name)\n })\n}\n"],
|
|
5
|
+
"mappings": "AAiBO,MAAM,oCAAoC;AAC1C,MAAM,kCAAkC;AACxC,MAAM,oCAAo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-
text: "text-
|
|
6
|
-
icon: "text-
|
|
7
|
-
hex: "
|
|
3
|
+
bg: "bg-status-success-bg",
|
|
4
|
+
border: "border-status-success-border",
|
|
5
|
+
text: "text-status-success-text",
|
|
6
|
+
icon: "text-status-success-icon",
|
|
7
|
+
hex: "var(--status-success-icon)"
|
|
8
8
|
},
|
|
9
9
|
in_progress: {
|
|
10
|
-
bg: "bg-
|
|
11
|
-
border: "border-
|
|
12
|
-
text: "text-
|
|
13
|
-
icon: "text-
|
|
14
|
-
hex: "
|
|
10
|
+
bg: "bg-status-info-bg",
|
|
11
|
+
border: "border-status-info-border",
|
|
12
|
+
text: "text-status-info-text",
|
|
13
|
+
icon: "text-status-info-icon",
|
|
14
|
+
hex: "var(--status-info-icon)"
|
|
15
15
|
},
|
|
16
16
|
pending: {
|
|
17
|
-
bg: "bg-
|
|
18
|
-
border: "border-
|
|
19
|
-
text: "text-
|
|
20
|
-
icon: "text-
|
|
21
|
-
hex: "
|
|
17
|
+
bg: "bg-status-warning-bg",
|
|
18
|
+
border: "border-status-warning-border",
|
|
19
|
+
text: "text-status-warning-text",
|
|
20
|
+
icon: "text-status-warning-icon",
|
|
21
|
+
hex: "var(--status-warning-icon)"
|
|
22
|
+
},
|
|
23
|
+
failed: {
|
|
24
|
+
bg: "bg-status-error-bg",
|
|
25
|
+
border: "border-status-error-border",
|
|
26
|
+
text: "text-status-error-text",
|
|
27
|
+
icon: "text-status-error-icon",
|
|
28
|
+
hex: "var(--status-error-icon)"
|
|
29
|
+
},
|
|
30
|
+
paused: {
|
|
31
|
+
bg: "bg-status-warning-bg",
|
|
32
|
+
border: "border-status-warning-border",
|
|
33
|
+
text: "text-status-warning-text",
|
|
34
|
+
icon: "text-status-warning-icon",
|
|
35
|
+
hex: "var(--status-warning-icon)"
|
|
22
36
|
},
|
|
23
37
|
not_started: {
|
|
24
38
|
bg: "bg-muted",
|
|
25
39
|
border: "border-border",
|
|
26
40
|
text: "text-foreground",
|
|
27
41
|
icon: "text-muted-foreground",
|
|
28
|
-
hex: "
|
|
42
|
+
hex: "var(--muted-foreground)"
|
|
43
|
+
},
|
|
44
|
+
error: {
|
|
45
|
+
bg: "bg-status-error-bg",
|
|
46
|
+
border: "border-status-error-border",
|
|
47
|
+
text: "text-status-error-text",
|
|
48
|
+
icon: "text-status-error-icon",
|
|
49
|
+
hex: "var(--status-error-icon)"
|
|
50
|
+
},
|
|
51
|
+
working: {
|
|
52
|
+
bg: "bg-status-info-bg",
|
|
53
|
+
border: "border-status-info-border",
|
|
54
|
+
text: "text-status-info-text",
|
|
55
|
+
icon: "text-status-info-icon",
|
|
56
|
+
hex: "var(--status-info-icon)"
|
|
57
|
+
},
|
|
58
|
+
waiting: {
|
|
59
|
+
bg: "bg-status-warning-bg",
|
|
60
|
+
border: "border-status-warning-border",
|
|
61
|
+
text: "text-status-warning-text",
|
|
62
|
+
icon: "text-status-warning-icon",
|
|
63
|
+
hex: "var(--status-warning-icon)"
|
|
64
|
+
},
|
|
65
|
+
// "Destructive-adjacent" (spec Part 2): a parked run is not a failed run, so
|
|
66
|
+
// it does not get `failed`'s glyph — but it does need a human, so it borrows
|
|
67
|
+
// the error tokens rather than sitting quietly in amber next to a timer.
|
|
68
|
+
needs_attention: {
|
|
69
|
+
bg: "bg-status-error-bg",
|
|
70
|
+
border: "border-status-error-border",
|
|
71
|
+
text: "text-status-error-text",
|
|
72
|
+
icon: "text-status-error-icon",
|
|
73
|
+
hex: "var(--status-error-icon)"
|
|
29
74
|
}
|
|
30
75
|
};
|
|
76
|
+
function toWorkflowStatus(status) {
|
|
77
|
+
if (!status || status === "pending") return "not_started";
|
|
78
|
+
if (status === "running" || status === "in_progress" || status === "active") return "in_progress";
|
|
79
|
+
if (status === "completed") return "completed";
|
|
80
|
+
if (status === "failed" || status === "error") return "failed";
|
|
81
|
+
if (status === "working") return "working";
|
|
82
|
+
if (status === "waiting") return "waiting";
|
|
83
|
+
if (status === "needs_attention") return "needs_attention";
|
|
84
|
+
if (status === "waiting_for_activities") return "working";
|
|
85
|
+
if (status === "paused") return "paused";
|
|
86
|
+
return "not_started";
|
|
87
|
+
}
|
|
31
88
|
const EDGE_COLORS = {
|
|
32
89
|
completed: {
|
|
33
|
-
stroke: "
|
|
34
|
-
strokeClass: "stroke-
|
|
35
|
-
|
|
90
|
+
stroke: "var(--status-success-icon)",
|
|
91
|
+
strokeClass: "stroke-status-success-icon",
|
|
92
|
+
strokeWidth: 2,
|
|
93
|
+
dashed: false,
|
|
94
|
+
dashArray: void 0
|
|
36
95
|
},
|
|
37
96
|
pending: {
|
|
38
|
-
stroke: "
|
|
97
|
+
stroke: "color-mix(in oklab, var(--muted-foreground) 70%, transparent)",
|
|
39
98
|
strokeClass: "stroke-muted-foreground",
|
|
40
|
-
|
|
99
|
+
strokeWidth: 1.5,
|
|
100
|
+
dashed: false,
|
|
101
|
+
dashArray: void 0
|
|
102
|
+
},
|
|
103
|
+
error: {
|
|
104
|
+
stroke: "var(--status-error-icon)",
|
|
105
|
+
strokeClass: "stroke-status-error-icon",
|
|
106
|
+
strokeWidth: 2,
|
|
107
|
+
dashed: true,
|
|
108
|
+
dashArray: "8,4"
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const STEP_STATUS_STYLES = {
|
|
112
|
+
completed: {
|
|
113
|
+
backgroundColor: "var(--status-success-bg)",
|
|
114
|
+
color: "var(--status-success-text)",
|
|
115
|
+
borderColor: "var(--status-success-border)",
|
|
116
|
+
borderWidth: "3px",
|
|
117
|
+
borderRadius: "16px"
|
|
118
|
+
},
|
|
119
|
+
active: {
|
|
120
|
+
backgroundColor: "var(--status-info-bg)",
|
|
121
|
+
color: "var(--status-info-text)",
|
|
122
|
+
borderColor: "var(--status-info-border)",
|
|
123
|
+
borderWidth: "3px",
|
|
124
|
+
borderRadius: "16px",
|
|
125
|
+
boxShadow: "0 0 0 3px var(--status-info-border)"
|
|
126
|
+
},
|
|
127
|
+
failed: {
|
|
128
|
+
backgroundColor: "var(--status-error-bg)",
|
|
129
|
+
color: "var(--status-error-text)",
|
|
130
|
+
borderColor: "var(--status-error-border)",
|
|
131
|
+
borderWidth: "3px",
|
|
132
|
+
borderRadius: "16px"
|
|
133
|
+
},
|
|
134
|
+
skipped: {
|
|
135
|
+
backgroundColor: "var(--status-warning-bg)",
|
|
136
|
+
color: "var(--status-warning-text)",
|
|
137
|
+
borderColor: "var(--status-warning-border)",
|
|
138
|
+
borderWidth: "3px",
|
|
139
|
+
borderRadius: "16px"
|
|
140
|
+
},
|
|
141
|
+
paused: {
|
|
142
|
+
backgroundColor: "var(--status-warning-bg)",
|
|
143
|
+
color: "var(--status-warning-text)",
|
|
144
|
+
borderColor: "var(--status-warning-icon)",
|
|
145
|
+
borderWidth: "3px",
|
|
146
|
+
borderRadius: "16px"
|
|
147
|
+
},
|
|
148
|
+
pending: {
|
|
149
|
+
backgroundColor: "var(--status-neutral-bg)",
|
|
150
|
+
color: "var(--status-neutral-text)",
|
|
151
|
+
borderColor: "var(--status-neutral-border)",
|
|
152
|
+
borderWidth: "2px",
|
|
153
|
+
borderRadius: "8px"
|
|
41
154
|
}
|
|
42
155
|
};
|
|
156
|
+
const PRESENTATION_STEP_STYLES = {
|
|
157
|
+
working: STEP_STATUS_STYLES.active,
|
|
158
|
+
waiting: STEP_STATUS_STYLES.paused,
|
|
159
|
+
attention: {
|
|
160
|
+
backgroundColor: "var(--status-warning-bg)",
|
|
161
|
+
color: "var(--status-error-text)",
|
|
162
|
+
borderColor: "var(--status-error-icon)",
|
|
163
|
+
borderWidth: "3px",
|
|
164
|
+
borderRadius: "16px"
|
|
165
|
+
},
|
|
166
|
+
completed: STEP_STATUS_STYLES.completed,
|
|
167
|
+
failed: STEP_STATUS_STYLES.failed,
|
|
168
|
+
skipped: STEP_STATUS_STYLES.skipped,
|
|
169
|
+
not_started: STEP_STATUS_STYLES.pending
|
|
170
|
+
};
|
|
43
171
|
export {
|
|
44
172
|
EDGE_COLORS,
|
|
45
|
-
|
|
173
|
+
PRESENTATION_STEP_STYLES,
|
|
174
|
+
STATUS_COLORS,
|
|
175
|
+
STEP_STATUS_STYLES,
|
|
176
|
+
toWorkflowStatus
|
|
46
177
|
};
|
|
47
178
|
//# sourceMappingURL=status-colors.js.map
|