@open-mercato/core 0.7.1-develop.7193.1.910a5b0a1e → 0.7.1-develop.7194.1.ab4fc81f82
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/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/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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/run-execution.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Run execution overlay (spec \u00A78.3) \u2014 PURE.\n *\n * Answers one question for every surface that paints a finished or in-flight\n * run: which steps ran, how long each took, which routes were taken, and where\n * the instance is now. The instance detail page, the run Gantt and the Studio's\n * \"Show last run\" overlay all read this, so they can never disagree about what\n * a run did.\n *\n * No React, no ORM, no DI, no registry imports \u2014 the same rule\n * `lib/error-routing.ts` and `lib/context-ledger.ts` follow.\n *\n * Two inputs, deliberately ranked:\n *\n * - `StepInstance` rows are AUTHORITATIVE for step state. One row per step\n * execution carries the status, both timestamps, the measured duration and\n * the attempt count with no inference. There are also far fewer of them than\n * there are events, which matters: the detail page reads the newest 100\n * events, so on a long run the STEP_ENTERED of an early step falls off the\n * page and an event-only derivation paints a completed step as never-run.\n * - `WorkflowEvent` rows are the fallback for step state and the ONLY source\n * for the taken path \u2014 a transition leaves no row of its own.\n */\n\nimport type { StepRunStatus } from './status-colors'\n\n/** Step-status vocabulary written by the engine, plus the legacy PascalCase spellings. */\nconst STEP_ENTERED_EVENT_TYPES = new Set(['STEP_ENTERED', 'StepEntered'])\nconst STEP_COMPLETED_EVENT_TYPES = new Set(['STEP_COMPLETED', 'STEP_EXITED', 'StepExited'])\nconst STEP_FAILED_EVENT_TYPES = new Set(['STEP_FAILED', 'StepFailed'])\nconst STEP_SKIPPED_EVENT_TYPES = new Set(['STEP_SKIPPED', 'StepSkipped'])\nconst TRANSITION_EXECUTED_EVENT_TYPES = new Set(['TRANSITION_EXECUTED', 'TransitionExecuted'])\n\n/**\n * Events that RESOLVE a park. A step can park more than once in a run (a loop,\n * a retry, a rerun-from-step), so evidence is cleared as soon as the thing it\n * described came back \u2014 otherwise a step that waited for a signal on its first\n * pass keeps claiming to wait for it on its second.\n */\nconst WAIT_RESOLVED_EVENT_TYPES = new Set([\n 'ACTIVITY_COMPLETED',\n 'ACTIVITY_FAILED',\n 'SIGNAL_RECEIVED',\n 'TIMER_FIRED',\n 'CONDITION_MET',\n 'CONDITION_TIMED_OUT',\n 'USER_TASK_COMPLETED',\n 'PARALLEL_JOIN_COMPLETED',\n])\n\nconst BRANCH_SETTLED_EVENT_TYPES = new Set([\n 'PARALLEL_BRANCH_COMPLETED',\n 'PARALLEL_BRANCH_FAILED',\n 'PARALLEL_BRANCH_CANCELLED',\n])\n\nexport type RunEventInput = {\n eventType: string\n eventData?: Record<string, unknown> | null\n occurredAt: string | Date\n /**\n * The engine stamps every step-scoped event with the `StepInstance` row it\n * belongs to, but only some of them repeat the definition `stepId` inside\n * `eventData`. Carrying the id here is what lets the park events\n * (`SIGNAL_AWAITING`, `TIMER_AWAITING`, `USER_TASK_CREATED`, \u2026) be attributed\n * to a step at all \u2014 they name the row, never the step.\n */\n stepInstanceId?: string | null\n}\n\nexport type RunStepInstanceInput = {\n id?: string\n stepId: string\n stepName?: string\n stepType?: string\n status: string\n branchInstanceId?: string | null\n inputData?: unknown\n outputData?: unknown\n errorData?: unknown\n enteredAt?: string | Date | null\n exitedAt?: string | Date | null\n executionTimeMs?: number | null\n retryCount?: number | null\n}\n\nexport type StepRunState = {\n stepId: string\n status: StepRunStatus\n startedAt: Date | null\n completedAt: Date | null\n /** Measured by the engine when available, otherwise derived from the timestamps. */\n durationMs: number | null\n /** 1 for a step that ran once; `retryCount + 1` when the engine recorded retries. */\n attempts: number\n}\n\nexport type TakenRoute = {\n transitionId: string | null\n fromStepId: string\n toStepId: string\n at: Date\n}\n\n/**\n * What a non-terminal step is doing or waiting for, read off the events the\n * engine ALREADY writes when it parks (spec \u00A7Part 2). Nothing here is a new\n * column and nothing here is a new event: `SIGNAL_AWAITING`, `TIMER_AWAITING`,\n * `CONDITION_AWAITING`, `USER_TASK_CREATED`, `ACTIVITY_QUEUED` and\n * `PARALLEL_FORK_OPENED` are all durable rows today.\n *\n * `StepInstance.outputData` \u2014 which carries the same facts on the return value\n * of `enterStep` \u2014 is deliberately NOT read: `exitStep` writes it on the\n * COMPLETED path only, so on a parked step it is null. The events are the only\n * place the park survives.\n */\nexport type StepWaitEvidence =\n | { kind: 'asyncActivity'; activityName: string | null }\n /**\n * The agent job is on the dedicated `workflow-invoke-agent` queue and the step\n * is parked on the proposal-ready signal WAITING FOR THE AGENT ITSELF.\n * `INVOKE_AGENT` is not async-capable in the registry's sense\n * (`async: { capable: false, reason: 'parksOnDedicatedQueue' }`), so it never\n * logs `ACTIVITY_QUEUED` \u2014 the park event is the only trace, and its absence\n * of a `proposalId` is what says the agent has not answered yet.\n */\n | { kind: 'agentRunning'; agentId: string | null }\n /**\n * The agent answered and its proposal was routed to a human.\n * `lib/agent-disposition-task.ts` writes a real `UserTask` and logs\n * `USER_TASK_CREATED` carrying the `proposalId` against the SAME step\n * instance \u2014 which is the only durable thing that distinguishes \"the agent is\n * still running\" from \"a person has not decided yet\". The invoke-agent\n * worker's own `user_task` branch logs nothing.\n */\n | { kind: 'agentDisposition'; proposalId: string | null }\n | { kind: 'subWorkflow'; childInstanceId: string | null }\n | { kind: 'signal'; signalName: string | null }\n | { kind: 'timer'; fireAt: Date | null }\n | { kind: 'condition'; deadlineAt: Date | null }\n | {\n kind: 'userTask'\n /**\n * The authored ROLE QUEUE, which is definition data every viewer of the\n * run already sees on the canvas. The individual assignee is deliberately\n * absent \u2014 see `hasAssignee`.\n */\n roleQueue: string | null\n /**\n * Whether an individual was resolved. The id itself is NOT carried: the\n * \u00A76.4 visibility model decides who may see a task's owner, and this line\n * must not become a way around it. The run APIs expose an opaque user id\n * and no display name, so there is nothing honest to render either way.\n */\n hasAssignee: boolean\n }\n | { kind: 'fork'; branchTotal: number; branchesSettled: number }\n\n/**\n * The engine-owned `metadata.attention` marker (the `failureQueue` directive\n * and the agent-review breach escalation both write it). Instance-level, so it\n * describes the step the run is parked on.\n */\nexport type RunAttention = { reason: string | null }\n\nexport type RunExecution = {\n stepStates: Map<string, StepRunState>\n routes: TakenRoute[]\n takenTransitionIds: Set<string>\n /** `from->to` pairs, so a route whose transition id was never recorded still paints. */\n takenStepPairs: Set<string>\n /**\n * Carried on the overlay so `resolveNodeRunStatus` can answer the START/END\n * conventions without every caller having to remember to pass them. A caller\n * that forgets is not obviously wrong \u2014 it just silently paints the END node\n * as never-reached on a completed run.\n */\n currentStepId: string | null\n instanceStatus: string | null\n /** Per-step park evidence, keyed by definition `stepId`. */\n waits: Map<string, StepWaitEvidence>\n attention: RunAttention | null\n}\n\nexport type RunExecutionInput = {\n events?: readonly RunEventInput[]\n stepInstances?: readonly RunStepInstanceInput[]\n currentStepId?: string | null\n instanceStatus?: string | null\n /** `instance.metadata.attention` verbatim; anything unshaped is ignored. */\n attention?: unknown\n}\n\nfunction toDate(value: string | Date | null | undefined): Date | null {\n if (!value) return null\n const parsed = value instanceof Date ? value : new Date(value)\n return Number.isNaN(parsed.getTime()) ? null : parsed\n}\n\nfunction readStringField(data: Record<string, unknown> | null | undefined, key: string): string | null {\n const value = data?.[key]\n return typeof value === 'string' && value.length > 0 ? value : null\n}\n\nexport function stepPairKey(fromStepId: string, toStepId: string): string {\n return `${fromStepId}->${toStepId}`\n}\n\n/** Map the persisted `StepInstance.status` onto the canvas run vocabulary. */\nexport function stepInstanceStatusToRunStatus(status: string): StepRunStatus {\n switch (status) {\n case 'COMPLETED':\n return 'completed'\n case 'FAILED':\n return 'failed'\n case 'SKIPPED':\n return 'skipped'\n case 'ACTIVE':\n return 'active'\n case 'CANCELLED':\n return 'skipped'\n default:\n return 'pending'\n }\n}\n\n/**\n * A step can execute more than once in one run \u2014 a loop, a retry after a\n * failure route, or a rerun-from-step. The LATEST execution is the one the\n * canvas paints, so states are merged rather than overwritten blindly.\n */\nfunction isNewerExecution(candidate: StepRunState, existing: StepRunState): boolean {\n const candidateAt = candidate.completedAt ?? candidate.startedAt\n const existingAt = existing.completedAt ?? existing.startedAt\n if (!existingAt) return true\n if (!candidateAt) return false\n return candidateAt.getTime() >= existingAt.getTime()\n}\n\nfunction stateFromStepInstance(stepInstance: RunStepInstanceInput): StepRunState {\n const startedAt = toDate(stepInstance.enteredAt)\n const completedAt = toDate(stepInstance.exitedAt)\n const measured =\n typeof stepInstance.executionTimeMs === 'number' && Number.isFinite(stepInstance.executionTimeMs)\n ? stepInstance.executionTimeMs\n : null\n const derived = startedAt && completedAt ? completedAt.getTime() - startedAt.getTime() : null\n const retries =\n typeof stepInstance.retryCount === 'number' && Number.isFinite(stepInstance.retryCount)\n ? Math.max(stepInstance.retryCount, 0)\n : 0\n return {\n stepId: stepInstance.stepId,\n status: stepInstanceStatusToRunStatus(stepInstance.status),\n startedAt,\n completedAt,\n durationMs: measured ?? derived,\n attempts: retries + 1,\n }\n}\n\nfunction mergeState(target: Map<string, StepRunState>, candidate: StepRunState): void {\n const existing = target.get(candidate.stepId)\n if (!existing || isNewerExecution(candidate, existing)) {\n target.set(candidate.stepId, candidate)\n }\n}\n\nfunction applyEvent(target: Map<string, StepRunState>, event: RunEventInput): void {\n const stepId = readStringField(event.eventData, 'stepId')\n if (!stepId) return\n const occurredAt = toDate(event.occurredAt)\n const existing = target.get(stepId)\n const base: StepRunState = existing ?? {\n stepId,\n status: 'pending',\n startedAt: null,\n completedAt: null,\n durationMs: null,\n attempts: 1,\n }\n\n if (STEP_ENTERED_EVENT_TYPES.has(event.eventType)) {\n // A re-entry starts a fresh execution: the previous terminal timestamps do\n // not describe the attempt now running.\n target.set(stepId, {\n ...base,\n startedAt: occurredAt,\n completedAt: null,\n durationMs: null,\n status: 'active',\n })\n return\n }\n\n const terminalStatus: StepRunStatus | null = STEP_COMPLETED_EVENT_TYPES.has(event.eventType)\n ? 'completed'\n : STEP_FAILED_EVENT_TYPES.has(event.eventType)\n ? 'failed'\n : STEP_SKIPPED_EVENT_TYPES.has(event.eventType)\n ? 'skipped'\n : null\n if (!terminalStatus) return\n\n const startedAt = base.startedAt\n target.set(stepId, {\n ...base,\n status: terminalStatus,\n completedAt: occurredAt,\n durationMs: startedAt && occurredAt ? occurredAt.getTime() - startedAt.getTime() : base.durationMs,\n })\n}\n\n/**\n * Paint the step the instance is parked on from the LIVE instance status: a\n * failed instance shows its current step red, a paused/waiting one yellow, an\n * otherwise-running one blue. Never overrides a step that already reached a\n * terminal state of its own.\n */\nfunction applyLiveInstanceStatus(\n stepStates: Map<string, StepRunState>,\n currentStepId: string | null | undefined,\n instanceStatus: string | null | undefined\n): void {\n if (!currentStepId) return\n const existing = stepStates.get(currentStepId)\n if (existing && (existing.status === 'completed' || existing.status === 'failed' || existing.status === 'skipped')) {\n return\n }\n const liveStatus: StepRunStatus =\n instanceStatus === 'FAILED'\n ? 'failed'\n : instanceStatus === 'PAUSED' || instanceStatus === 'WAITING_FOR_ACTIVITIES'\n ? 'paused'\n : 'active'\n stepStates.set(currentStepId, {\n stepId: currentStepId,\n status: liveStatus,\n startedAt: existing?.startedAt ?? null,\n completedAt: null,\n durationMs: existing?.durationMs ?? null,\n attempts: existing?.attempts ?? 1,\n })\n}\n\nfunction readBooleanish(data: Record<string, unknown> | null | undefined, key: string): boolean {\n const value = data?.[key]\n if (Array.isArray(value)) return value.length > 0\n return typeof value === 'string' ? value.length > 0 : Boolean(value)\n}\n\nfunction readRoleQueue(data: Record<string, unknown> | null | undefined): string | null {\n const value = data?.assignedToRoles\n if (Array.isArray(value)) {\n const named = value.filter((entry): entry is string => typeof entry === 'string' && entry.length > 0)\n return named.length > 0 ? named.join(', ') : null\n }\n return typeof value === 'string' && value.length > 0 ? value : null\n}\n\n/**\n * Turn one park event into evidence. Returns `null` for anything that is not a\n * park, so the caller can leave whatever it already had in place.\n */\nfunction waitEvidenceFromEvent(event: RunEventInput): StepWaitEvidence | null {\n const data = event.eventData ?? null\n switch (event.eventType) {\n case 'ACTIVITY_QUEUED':\n return {\n kind: 'asyncActivity',\n activityName: readStringField(data, 'activityName') ?? readStringField(data, 'activityType'),\n }\n case 'SIGNAL_AWAITING': {\n // One event type, three genuinely different situations. The engine\n // distinguishes them with `reason` (INVOKE_AGENT / SUB_WORKFLOW) plus the\n // ids it carries, and the presentation states differ, so they cannot be\n // collapsed into \"waiting for a signal\".\n const reason = readStringField(data, 'reason')\n const childInstanceId = readStringField(data, 'childInstanceId')\n if (reason === 'SUB_WORKFLOW' || childInstanceId) {\n return { kind: 'subWorkflow', childInstanceId }\n }\n const proposalId = readStringField(data, 'proposalId')\n if (reason === 'INVOKE_AGENT') {\n // A `proposalId` at park time means the agent already ran inline (the\n // parallel-branch fallback path); its absence \u2014 the instance-level path \u2014\n // means the job was only just enqueued.\n return proposalId\n ? { kind: 'agentDisposition', proposalId }\n : { kind: 'agentRunning', agentId: readStringField(data, 'agentId') }\n }\n return { kind: 'signal', signalName: readStringField(data, 'signalName') }\n }\n case 'TIMER_AWAITING':\n return { kind: 'timer', fireAt: toDate(readStringField(data, 'fireAt')) }\n case 'CONDITION_AWAITING':\n return { kind: 'condition', deadlineAt: toDate(readStringField(data, 'deadlineAt')) }\n case 'USER_TASK_CREATED': {\n // The agent-disposition review is a REAL user task, so it arrives here \u2014\n // and its `proposalId` is what tells the two apart.\n const proposalId = readStringField(data, 'proposalId')\n if (proposalId) return { kind: 'agentDisposition', proposalId }\n return {\n kind: 'userTask',\n roleQueue: readRoleQueue(data),\n hasAssignee: readBooleanish(data, 'assignedTo'),\n }\n }\n default:\n return null\n }\n}\n\n/**\n * Fork progress is a TALLY over events, not a read of `WorkflowBranchInstance`:\n * the branch rows have no read surface, but `PARALLEL_FORK_OPENED` names every\n * branch key and each branch logs its own settle event. Counting them answers\n * \"n of m branches still running\" from evidence that is already durable.\n */\ntype ForkTally = { stepId: string; branchKeys: Set<string>; settled: Set<string> }\n\nexport function deriveRunExecution(input: RunExecutionInput): RunExecution {\n const stepStates = new Map<string, StepRunState>()\n const routes: TakenRoute[] = []\n const takenTransitionIds = new Set<string>()\n const takenStepPairs = new Set<string>()\n const waits = new Map<string, StepWaitEvidence>()\n const stepIdByStepInstanceId = new Map<string, string>()\n let forkTally: ForkTally | null = null\n // Steps whose LATEST attempt only \"completed\" by advancing down an error /\n // guardrailBlocked outcome route (\u00A77.2) or a \u00A75.9 error route. The engine\n // records such a step as COMPLETED (it advanced), but its agent/activity did\n // not succeed \u2014 so the run view must not paint it a green \"done\". Re-entry\n // clears the flag, so a successful re-run (retry) shows green again.\n const erroredRoutedSteps = new Set<string>()\n\n for (const stepInstance of input.stepInstances ?? []) {\n if (stepInstance.id) stepIdByStepInstanceId.set(stepInstance.id, stepInstance.stepId)\n }\n\n // Events come back newest-first from the API; replay them oldest-first so a\n // later terminal event wins over an earlier entry for the same step.\n const orderedEvents = [...(input.events ?? [])].sort((left, right) => {\n const leftAt = toDate(left.occurredAt)?.getTime() ?? 0\n const rightAt = toDate(right.occurredAt)?.getTime() ?? 0\n return leftAt - rightAt\n })\n\n for (const event of orderedEvents) {\n applyEvent(stepStates, event)\n\n const eventStepId =\n readStringField(event.eventData, 'stepId')\n ?? (event.stepInstanceId ? stepIdByStepInstanceId.get(event.stepInstanceId) ?? null : null)\n\n if (eventStepId) {\n // A re-entry starts a fresh attempt, so anything the previous one parked\n // on no longer describes this step.\n if (STEP_ENTERED_EVENT_TYPES.has(event.eventType) || WAIT_RESOLVED_EVENT_TYPES.has(event.eventType)) {\n waits.delete(eventStepId)\n }\n const evidence = waitEvidenceFromEvent(event)\n if (evidence) waits.set(eventStepId, evidence)\n }\n\n // Track error/guardrailBlocked routing so a routed-but-failed step is not\n // painted as a clean completion below. A fresh attempt (STEP_ENTERED) clears\n // it, so only the latest attempt's outcome counts.\n if (eventStepId && STEP_ENTERED_EVENT_TYPES.has(event.eventType)) {\n erroredRoutedSteps.delete(eventStepId)\n } else if (event.eventType === 'OUTCOME_ROUTED') {\n const outcome = readStringField(event.eventData, 'outcome')\n const routedStepId = readStringField(event.eventData, 'stepId')\n if (routedStepId && (outcome === 'error' || outcome === 'guardrailBlocked')) {\n erroredRoutedSteps.add(routedStepId)\n }\n } else if (event.eventType === 'ERROR_ROUTED') {\n const failedStepId = readStringField(event.eventData, 'failedStepId')\n if (failedStepId) erroredRoutedSteps.add(failedStepId)\n }\n\n if (event.eventType === 'PARALLEL_FORK_OPENED') {\n const forkStepId = readStringField(event.eventData, 'forkStepId')\n const branchKeys = event.eventData?.branchKeys\n if (forkStepId && Array.isArray(branchKeys)) {\n forkTally = {\n stepId: forkStepId,\n branchKeys: new Set(branchKeys.filter((key): key is string => typeof key === 'string')),\n settled: new Set<string>(),\n }\n }\n } else if (BRANCH_SETTLED_EVENT_TYPES.has(event.eventType) && forkTally) {\n const branchKey = readStringField(event.eventData, 'branchKey')\n if (branchKey && forkTally.branchKeys.has(branchKey)) forkTally.settled.add(branchKey)\n } else if (event.eventType === 'PARALLEL_JOIN_COMPLETED' && forkTally) {\n waits.delete(forkTally.stepId)\n forkTally = null\n }\n\n if (!TRANSITION_EXECUTED_EVENT_TYPES.has(event.eventType)) continue\n const fromStepId = readStringField(event.eventData, 'fromStepId')\n const toStepId = readStringField(event.eventData, 'toStepId')\n if (!fromStepId || !toStepId) continue\n const transitionId = readStringField(event.eventData, 'transitionId')\n routes.push({\n transitionId,\n fromStepId,\n toStepId,\n at: toDate(event.occurredAt) ?? new Date(0),\n })\n if (transitionId) takenTransitionIds.add(transitionId)\n takenStepPairs.add(stepPairKey(fromStepId, toStepId))\n }\n\n // Step instances are authoritative and overwrite whatever the events implied.\n for (const stepInstance of input.stepInstances ?? []) {\n mergeState(stepStates, stateFromStepInstance(stepInstance))\n }\n\n // A step whose latest attempt exited only by routing an error/guardrailBlocked\n // outcome (or a \u00A75.9 error route) is recorded COMPLETED by the engine, but its\n // work failed \u2014 repaint it errored so the run view never shows a green \"done\"\n // for a step whose agent/activity failed. Runs AFTER the authoritative pass;\n // only flips a currently-completed step (a live/failed one already tells the\n // truth), and a successful re-run cleared the flag so it stays green.\n for (const stepId of erroredRoutedSteps) {\n const existing = stepStates.get(stepId)\n if (existing && existing.status === 'completed') {\n stepStates.set(stepId, { ...existing, status: 'failed' })\n }\n }\n\n applyLiveInstanceStatus(stepStates, input.currentStepId, input.instanceStatus)\n\n if (forkTally && forkTally.branchKeys.size > forkTally.settled.size) {\n waits.set(forkTally.stepId, {\n kind: 'fork',\n branchTotal: forkTally.branchKeys.size,\n branchesSettled: forkTally.settled.size,\n })\n }\n\n return {\n stepStates,\n routes,\n takenTransitionIds,\n takenStepPairs,\n currentStepId: input.currentStepId ?? null,\n instanceStatus: input.instanceStatus ?? null,\n waits,\n attention: readAttention(input.attention),\n }\n}\n\nfunction readAttention(value: unknown): RunAttention | null {\n if (!value || typeof value !== 'object') return null\n const reason = (value as Record<string, unknown>).reason\n return { reason: typeof reason === 'string' && reason.length > 0 ? reason : null }\n}\n\nexport type GraphNodeDescriptor = {\n id: string\n type?: string\n}\n\n/**\n * Resolve the status the canvas paints for one node, including the START/END\n * conventions a step-less node has no execution record for.\n */\nexport function resolveNodeRunStatus(\n execution: RunExecution,\n node: GraphNodeDescriptor,\n options: { currentStepId?: string | null; instanceStatus?: string | null } = {}\n): StepRunStatus {\n const recorded = execution.stepStates.get(node.id)\n if (recorded) return recorded.status\n\n const currentStepId = options.currentStepId ?? execution.currentStepId\n const instanceStatus = options.instanceStatus ?? execution.instanceStatus\n const isCurrentStep = currentStepId === node.id\n if (node.type === 'start') {\n return isCurrentStep ? 'active' : 'completed'\n }\n if (node.type === 'end') {\n return isCurrentStep || instanceStatus === 'COMPLETED' ? 'completed' : 'pending'\n }\n return 'pending'\n}\n\n/** Did this route carry the run? Matched by transition id first, endpoints second. */\nexport function isRouteTaken(\n execution: RunExecution,\n route: { transitionId?: string | null; fromStepId?: string | null; toStepId?: string | null }\n): boolean {\n if (route.transitionId && execution.takenTransitionIds.has(route.transitionId)) return true\n if (!route.fromStepId || !route.toStepId) return false\n return execution.takenStepPairs.has(stepPairKey(route.fromStepId, route.toStepId))\n}\n"],
|
|
5
|
+
"mappings": "AA2BA,MAAM,2BAA2B,oBAAI,IAAI,CAAC,gBAAgB,aAAa,CAAC;AACxE,MAAM,6BAA6B,oBAAI,IAAI,CAAC,kBAAkB,eAAe,YAAY,CAAC;AAC1F,MAAM,0BAA0B,oBAAI,IAA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AAM,gBAAgB,UAAU,mBAAmB,IAAI,MAAM,YAAY,EAAG,QAAO;AACvF,MAAI,CAAC,MAAM,cAAc,CAAC,MAAM,SAAU,QAAO;AACjD,SAAO,UAAU,eAAe,IAAI,YAAY,MAAM,YAAY,MAAM,QAAQ,CAAC;AACnF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { stepInstanceStatusToRunStatus } from "./run-execution.js";
|
|
2
|
+
import { toMillis } from "./run-duration.js";
|
|
3
|
+
const MIN_COLLAPSIBLE_MS = 1e3;
|
|
4
|
+
const COLLAPSE_FACTOR = 4;
|
|
5
|
+
function median(values) {
|
|
6
|
+
if (values.length === 0) return 0;
|
|
7
|
+
const ordered = [...values].sort((left, right) => left - right);
|
|
8
|
+
const middle = Math.floor(ordered.length / 2);
|
|
9
|
+
return ordered.length % 2 === 0 ? (ordered[middle - 1] + ordered[middle]) / 2 : ordered[middle];
|
|
10
|
+
}
|
|
11
|
+
function resolveCollapseThreshold(sliceDurations) {
|
|
12
|
+
const positive = sliceDurations.filter((duration) => duration > 0);
|
|
13
|
+
if (positive.length === 0) return Number.POSITIVE_INFINITY;
|
|
14
|
+
return Math.max(MIN_COLLAPSIBLE_MS, median(positive) * COLLAPSE_FACTOR);
|
|
15
|
+
}
|
|
16
|
+
function buildSlices(boundaries) {
|
|
17
|
+
const rawDurations = [];
|
|
18
|
+
for (let index = 1; index < boundaries.length; index += 1) {
|
|
19
|
+
rawDurations.push(boundaries[index] - boundaries[index - 1]);
|
|
20
|
+
}
|
|
21
|
+
const threshold = resolveCollapseThreshold(rawDurations);
|
|
22
|
+
const slices = [];
|
|
23
|
+
let renderedStart = 0;
|
|
24
|
+
for (let index = 1; index < boundaries.length; index += 1) {
|
|
25
|
+
const startMs = boundaries[index - 1];
|
|
26
|
+
const endMs = boundaries[index];
|
|
27
|
+
const durationMs = endMs - startMs;
|
|
28
|
+
const collapsed = durationMs > threshold;
|
|
29
|
+
const weight = collapsed ? threshold : durationMs;
|
|
30
|
+
slices.push({ startMs, endMs, durationMs, weight, collapsed, renderedStart });
|
|
31
|
+
renderedStart += weight;
|
|
32
|
+
}
|
|
33
|
+
return slices;
|
|
34
|
+
}
|
|
35
|
+
function renderedTotal(slices) {
|
|
36
|
+
return slices.reduce((total, slice) => total + slice.weight, 0);
|
|
37
|
+
}
|
|
38
|
+
function projectToRendered(slices, atMs) {
|
|
39
|
+
if (slices.length === 0) return 0;
|
|
40
|
+
if (atMs <= slices[0].startMs) return 0;
|
|
41
|
+
const last = slices[slices.length - 1];
|
|
42
|
+
if (atMs >= last.endMs) return last.renderedStart + last.weight;
|
|
43
|
+
for (const slice of slices) {
|
|
44
|
+
if (atMs >= slice.startMs && atMs <= slice.endMs) {
|
|
45
|
+
if (slice.durationMs === 0) return slice.renderedStart;
|
|
46
|
+
const progress = (atMs - slice.startMs) / slice.durationMs;
|
|
47
|
+
return slice.renderedStart + progress * slice.weight;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return last.renderedStart + last.weight;
|
|
51
|
+
}
|
|
52
|
+
function assignLanes(seeds) {
|
|
53
|
+
const laneByKey = /* @__PURE__ */ new Map();
|
|
54
|
+
const groups = /* @__PURE__ */ new Map();
|
|
55
|
+
const groupOrder = [];
|
|
56
|
+
for (const seed of seeds) {
|
|
57
|
+
const groupKey = seed.branchInstanceId ?? "__main__";
|
|
58
|
+
const existing = groups.get(groupKey);
|
|
59
|
+
if (existing) {
|
|
60
|
+
existing.push(seed);
|
|
61
|
+
} else {
|
|
62
|
+
groups.set(groupKey, [seed]);
|
|
63
|
+
groupOrder.push(groupKey);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let nextLaneBase = 0;
|
|
67
|
+
for (const groupKey of groupOrder) {
|
|
68
|
+
const groupSeeds = groups.get(groupKey) ?? [];
|
|
69
|
+
const laneEnds = [];
|
|
70
|
+
for (const seed of groupSeeds) {
|
|
71
|
+
let lane = laneEnds.findIndex((endMs) => endMs <= seed.startMs);
|
|
72
|
+
if (lane === -1) {
|
|
73
|
+
lane = laneEnds.length;
|
|
74
|
+
laneEnds.push(seed.endMs);
|
|
75
|
+
} else {
|
|
76
|
+
laneEnds[lane] = seed.endMs;
|
|
77
|
+
}
|
|
78
|
+
laneByKey.set(seed.key, nextLaneBase + lane);
|
|
79
|
+
}
|
|
80
|
+
nextLaneBase += Math.max(laneEnds.length, 1);
|
|
81
|
+
}
|
|
82
|
+
return laneByKey;
|
|
83
|
+
}
|
|
84
|
+
function buildRunGantt(input) {
|
|
85
|
+
const now = input.now ?? Date.now();
|
|
86
|
+
const seeds = [];
|
|
87
|
+
for (const [index, stepInstance] of input.stepInstances.entries()) {
|
|
88
|
+
const startMs2 = toMillis(stepInstance.enteredAt);
|
|
89
|
+
if (startMs2 === null) continue;
|
|
90
|
+
const recordedEnd = toMillis(stepInstance.exitedAt);
|
|
91
|
+
const running = recordedEnd === null;
|
|
92
|
+
const endMs2 = Math.max(recordedEnd ?? now, startMs2);
|
|
93
|
+
seeds.push({
|
|
94
|
+
key: stepInstance.id ?? `${stepInstance.stepId}-${index}`,
|
|
95
|
+
stepId: stepInstance.stepId,
|
|
96
|
+
stepName: stepInstance.stepName || stepInstance.stepId,
|
|
97
|
+
stepType: stepInstance.stepType || "",
|
|
98
|
+
status: stepInstanceStatusToRunStatus(stepInstance.status),
|
|
99
|
+
branchInstanceId: stepInstance.branchInstanceId ?? null,
|
|
100
|
+
startMs: startMs2,
|
|
101
|
+
endMs: endMs2,
|
|
102
|
+
running
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
seeds.sort((left, right) => left.startMs - right.startMs || left.endMs - right.endMs);
|
|
106
|
+
const instanceStart = toMillis(input.instanceStartedAt);
|
|
107
|
+
const instanceEnd = toMillis(input.instanceCompletedAt);
|
|
108
|
+
const candidateStarts = seeds.map((seed) => seed.startMs);
|
|
109
|
+
const candidateEnds = seeds.map((seed) => seed.endMs);
|
|
110
|
+
if (instanceStart !== null) candidateStarts.push(instanceStart);
|
|
111
|
+
if (instanceEnd !== null) candidateEnds.push(instanceEnd);
|
|
112
|
+
if (candidateStarts.length === 0) {
|
|
113
|
+
return {
|
|
114
|
+
bars: [],
|
|
115
|
+
laneCount: 0,
|
|
116
|
+
startMs: 0,
|
|
117
|
+
endMs: 0,
|
|
118
|
+
totalDurationMs: 0,
|
|
119
|
+
collapsedSegments: [],
|
|
120
|
+
collapsedDurationMs: 0
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
const startMs = Math.min(...candidateStarts);
|
|
124
|
+
const endMs = Math.max(...candidateEnds, startMs);
|
|
125
|
+
const boundarySet = /* @__PURE__ */ new Set([startMs, endMs]);
|
|
126
|
+
for (const seed of seeds) {
|
|
127
|
+
boundarySet.add(seed.startMs);
|
|
128
|
+
boundarySet.add(seed.endMs);
|
|
129
|
+
}
|
|
130
|
+
const boundaries = [...boundarySet].sort((left, right) => left - right);
|
|
131
|
+
const slices = buildSlices(boundaries);
|
|
132
|
+
const total = renderedTotal(slices);
|
|
133
|
+
const toRatio = (atMs) => total > 0 ? projectToRendered(slices, atMs) / total : 0;
|
|
134
|
+
const laneByKey = assignLanes(seeds);
|
|
135
|
+
const bars = seeds.map((seed) => {
|
|
136
|
+
const offsetRatio = toRatio(seed.startMs);
|
|
137
|
+
const endRatio = toRatio(seed.endMs);
|
|
138
|
+
const spansCollapsedWait = slices.some(
|
|
139
|
+
(slice) => slice.collapsed && slice.startMs >= seed.startMs && slice.endMs <= seed.endMs
|
|
140
|
+
);
|
|
141
|
+
return {
|
|
142
|
+
key: seed.key,
|
|
143
|
+
stepId: seed.stepId,
|
|
144
|
+
stepName: seed.stepName,
|
|
145
|
+
stepType: seed.stepType,
|
|
146
|
+
status: seed.status,
|
|
147
|
+
branchInstanceId: seed.branchInstanceId,
|
|
148
|
+
lane: laneByKey.get(seed.key) ?? 0,
|
|
149
|
+
startMs: seed.startMs,
|
|
150
|
+
endMs: seed.endMs,
|
|
151
|
+
durationMs: seed.endMs - seed.startMs,
|
|
152
|
+
offsetRatio,
|
|
153
|
+
widthRatio: Math.max(endRatio - offsetRatio, 0),
|
|
154
|
+
spansCollapsedWait,
|
|
155
|
+
running: seed.running
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
const collapsedSegments = slices.filter((slice) => slice.collapsed).map((slice) => ({
|
|
159
|
+
startMs: slice.startMs,
|
|
160
|
+
endMs: slice.endMs,
|
|
161
|
+
skippedMs: slice.durationMs - slice.weight,
|
|
162
|
+
offsetRatio: total > 0 ? slice.renderedStart / total : 0,
|
|
163
|
+
widthRatio: total > 0 ? slice.weight / total : 0
|
|
164
|
+
}));
|
|
165
|
+
return {
|
|
166
|
+
bars,
|
|
167
|
+
laneCount: bars.reduce((highest, bar) => Math.max(highest, bar.lane + 1), 0),
|
|
168
|
+
startMs,
|
|
169
|
+
endMs,
|
|
170
|
+
totalDurationMs: endMs - startMs,
|
|
171
|
+
collapsedSegments,
|
|
172
|
+
collapsedDurationMs: collapsedSegments.reduce((total_, segment) => total_ + segment.skippedMs, 0)
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
COLLAPSE_FACTOR,
|
|
177
|
+
MIN_COLLAPSIBLE_MS,
|
|
178
|
+
buildRunGantt
|
|
179
|
+
};
|
|
180
|
+
//# sourceMappingURL=run-gantt.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/run-gantt.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Run Gantt model (spec \u00A78.3) \u2014 PURE.\n *\n * > \"**Timeline** \u2014 a true clock-time **Gantt** (bars per step/activity/task/\n * > signal, parallel branches as overlapping lanes, with collapsed-wait\n * > rendering so a 3-day task deadline doesn't flatten the rest; this is what\n * > makes latency and human-wait visible)\"\n *\n * Two problems the naive version does not solve.\n *\n * **Collapsed waits.** A run that spends 1s executing and three days waiting\n * for an approval is 99.999% wait on a linear axis: every automated step\n * collapses to a sub-pixel sliver and the chart shows nothing. So the axis is\n * PIECEWISE-LINEAR. The run is cut at every start and end into slices; a slice\n * longer than the collapse threshold is rendered at the threshold's width and\n * flagged, so the wait is visible AS a wait without eating the chart. Time is\n * still monotonic and every bar keeps its true duration in `durationMs` \u2014 the\n * compression is a rendering decision, never a reported number.\n *\n * **Lanes.** Parallel branches genuinely overlap in clock time, so they cannot\n * share a row. Bars are grouped by `branchInstanceId` (the engine's own branch\n * token) and packed greedily inside each group, which keeps one branch reading\n * top-to-bottom instead of scattering it across the chart.\n */\n\nimport type { StepRunStatus } from './status-colors'\nimport { stepInstanceStatusToRunStatus, type RunStepInstanceInput } from './run-execution'\nimport { toMillis } from './run-duration'\n\n/** A slice shorter than this is never compressed \u2014 sub-second runs stay linear. */\nexport const MIN_COLLAPSIBLE_MS = 1000\n\n/**\n * How many times the typical slice a slice must exceed before it is treated as\n * a wait rather than work. Four is deliberately conservative: it collapses the\n * three-day approval and leaves an ordinary slow HTTP call alone.\n */\nexport const COLLAPSE_FACTOR = 4\n\nexport type GanttBar = {\n key: string\n stepId: string\n stepName: string\n stepType: string\n status: StepRunStatus\n branchInstanceId: string | null\n lane: number\n startMs: number\n endMs: number\n /** TRUE elapsed time. Never the compressed one. */\n durationMs: number\n /** Position across the rendered (compressed) axis, 0..1. */\n offsetRatio: number\n widthRatio: number\n /** The bar spans at least one collapsed slice, i.e. most of it is waiting. */\n spansCollapsedWait: boolean\n /** The step had not finished when the model was built. */\n running: boolean\n}\n\nexport type GanttCollapsedSegment = {\n startMs: number\n endMs: number\n skippedMs: number\n offsetRatio: number\n widthRatio: number\n}\n\nexport type GanttModel = {\n bars: GanttBar[]\n laneCount: number\n startMs: number\n endMs: number\n /** True wall-clock span of the run. */\n totalDurationMs: number\n collapsedSegments: GanttCollapsedSegment[]\n /** Sum of everything the collapsed segments hide, for the \"N hidden\" caption. */\n collapsedDurationMs: number\n}\n\ntype Slice = {\n startMs: number\n endMs: number\n durationMs: number\n weight: number\n collapsed: boolean\n renderedStart: number\n}\n\nfunction median(values: readonly number[]): number {\n if (values.length === 0) return 0\n const ordered = [...values].sort((left, right) => left - right)\n const middle = Math.floor(ordered.length / 2)\n return ordered.length % 2 === 0 ? (ordered[middle - 1] + ordered[middle]) / 2 : ordered[middle]\n}\n\nfunction resolveCollapseThreshold(sliceDurations: readonly number[]): number {\n const positive = sliceDurations.filter((duration) => duration > 0)\n if (positive.length === 0) return Number.POSITIVE_INFINITY\n return Math.max(MIN_COLLAPSIBLE_MS, median(positive) * COLLAPSE_FACTOR)\n}\n\nfunction buildSlices(boundaries: readonly number[]): Slice[] {\n const rawDurations: number[] = []\n for (let index = 1; index < boundaries.length; index += 1) {\n rawDurations.push(boundaries[index] - boundaries[index - 1])\n }\n const threshold = resolveCollapseThreshold(rawDurations)\n\n const slices: Slice[] = []\n let renderedStart = 0\n for (let index = 1; index < boundaries.length; index += 1) {\n const startMs = boundaries[index - 1]\n const endMs = boundaries[index]\n const durationMs = endMs - startMs\n const collapsed = durationMs > threshold\n const weight = collapsed ? threshold : durationMs\n slices.push({ startMs, endMs, durationMs, weight, collapsed, renderedStart })\n renderedStart += weight\n }\n return slices\n}\n\nfunction renderedTotal(slices: readonly Slice[]): number {\n return slices.reduce((total, slice) => total + slice.weight, 0)\n}\n\n/** Map a wall-clock instant onto the compressed axis, in rendered units. */\nfunction projectToRendered(slices: readonly Slice[], atMs: number): number {\n if (slices.length === 0) return 0\n if (atMs <= slices[0].startMs) return 0\n const last = slices[slices.length - 1]\n if (atMs >= last.endMs) return last.renderedStart + last.weight\n\n for (const slice of slices) {\n if (atMs >= slice.startMs && atMs <= slice.endMs) {\n if (slice.durationMs === 0) return slice.renderedStart\n const progress = (atMs - slice.startMs) / slice.durationMs\n return slice.renderedStart + progress * slice.weight\n }\n }\n return last.renderedStart + last.weight\n}\n\ntype BarSeed = {\n key: string\n stepId: string\n stepName: string\n stepType: string\n status: StepRunStatus\n branchInstanceId: string | null\n startMs: number\n endMs: number\n running: boolean\n}\n\n/**\n * Lanes per branch: every bar carrying the same `branchInstanceId` is packed\n * into that branch's own block of lanes, so a parallel branch reads as one\n * band rather than being scattered across the chart by a global packer.\n */\nfunction assignLanes(seeds: readonly BarSeed[]): Map<string, number> {\n const laneByKey = new Map<string, number>()\n const groups = new Map<string, BarSeed[]>()\n const groupOrder: string[] = []\n\n for (const seed of seeds) {\n const groupKey = seed.branchInstanceId ?? '__main__'\n const existing = groups.get(groupKey)\n if (existing) {\n existing.push(seed)\n } else {\n groups.set(groupKey, [seed])\n groupOrder.push(groupKey)\n }\n }\n\n let nextLaneBase = 0\n for (const groupKey of groupOrder) {\n const groupSeeds = groups.get(groupKey) ?? []\n const laneEnds: number[] = []\n for (const seed of groupSeeds) {\n let lane = laneEnds.findIndex((endMs) => endMs <= seed.startMs)\n if (lane === -1) {\n lane = laneEnds.length\n laneEnds.push(seed.endMs)\n } else {\n laneEnds[lane] = seed.endMs\n }\n laneByKey.set(seed.key, nextLaneBase + lane)\n }\n nextLaneBase += Math.max(laneEnds.length, 1)\n }\n\n return laneByKey\n}\n\nexport type BuildGanttInput = {\n stepInstances: readonly RunStepInstanceInput[]\n /** Instance start, so the axis begins where the run began even if step 1 is late. */\n instanceStartedAt?: string | Date | null\n instanceCompletedAt?: string | Date | null\n /** Injected for determinism \u2014 an unfinished step is measured against this. */\n now?: number\n}\n\nexport function buildRunGantt(input: BuildGanttInput): GanttModel {\n const now = input.now ?? Date.now()\n\n const seeds: BarSeed[] = []\n for (const [index, stepInstance] of input.stepInstances.entries()) {\n const startMs = toMillis(stepInstance.enteredAt)\n if (startMs === null) continue\n const recordedEnd = toMillis(stepInstance.exitedAt)\n const running = recordedEnd === null\n const endMs = Math.max(recordedEnd ?? now, startMs)\n seeds.push({\n key: stepInstance.id ?? `${stepInstance.stepId}-${index}`,\n stepId: stepInstance.stepId,\n stepName: stepInstance.stepName || stepInstance.stepId,\n stepType: stepInstance.stepType || '',\n status: stepInstanceStatusToRunStatus(stepInstance.status),\n branchInstanceId: stepInstance.branchInstanceId ?? null,\n startMs,\n endMs,\n running,\n })\n }\n\n seeds.sort((left, right) => left.startMs - right.startMs || left.endMs - right.endMs)\n\n const instanceStart = toMillis(input.instanceStartedAt)\n const instanceEnd = toMillis(input.instanceCompletedAt)\n\n const candidateStarts = seeds.map((seed) => seed.startMs)\n const candidateEnds = seeds.map((seed) => seed.endMs)\n if (instanceStart !== null) candidateStarts.push(instanceStart)\n if (instanceEnd !== null) candidateEnds.push(instanceEnd)\n\n if (candidateStarts.length === 0) {\n return {\n bars: [],\n laneCount: 0,\n startMs: 0,\n endMs: 0,\n totalDurationMs: 0,\n collapsedSegments: [],\n collapsedDurationMs: 0,\n }\n }\n\n const startMs = Math.min(...candidateStarts)\n const endMs = Math.max(...candidateEnds, startMs)\n\n const boundarySet = new Set<number>([startMs, endMs])\n for (const seed of seeds) {\n boundarySet.add(seed.startMs)\n boundarySet.add(seed.endMs)\n }\n const boundaries = [...boundarySet].sort((left, right) => left - right)\n\n const slices = buildSlices(boundaries)\n const total = renderedTotal(slices)\n const toRatio = (atMs: number) => (total > 0 ? projectToRendered(slices, atMs) / total : 0)\n\n const laneByKey = assignLanes(seeds)\n\n const bars: GanttBar[] = seeds.map((seed) => {\n const offsetRatio = toRatio(seed.startMs)\n const endRatio = toRatio(seed.endMs)\n const spansCollapsedWait = slices.some(\n (slice) => slice.collapsed && slice.startMs >= seed.startMs && slice.endMs <= seed.endMs\n )\n return {\n key: seed.key,\n stepId: seed.stepId,\n stepName: seed.stepName,\n stepType: seed.stepType,\n status: seed.status,\n branchInstanceId: seed.branchInstanceId,\n lane: laneByKey.get(seed.key) ?? 0,\n startMs: seed.startMs,\n endMs: seed.endMs,\n durationMs: seed.endMs - seed.startMs,\n offsetRatio,\n widthRatio: Math.max(endRatio - offsetRatio, 0),\n spansCollapsedWait,\n running: seed.running,\n }\n })\n\n const collapsedSegments: GanttCollapsedSegment[] = slices\n .filter((slice) => slice.collapsed)\n .map((slice) => ({\n startMs: slice.startMs,\n endMs: slice.endMs,\n skippedMs: slice.durationMs - slice.weight,\n offsetRatio: total > 0 ? slice.renderedStart / total : 0,\n widthRatio: total > 0 ? slice.weight / total : 0,\n }))\n\n return {\n bars,\n laneCount: bars.reduce((highest, bar) => Math.max(highest, bar.lane + 1), 0),\n startMs,\n endMs,\n totalDurationMs: endMs - startMs,\n collapsedSegments,\n collapsedDurationMs: collapsedSegments.reduce((total_, segment) => total_ + segment.skippedMs, 0),\n }\n}\n"],
|
|
5
|
+
"mappings": "AA0BA,SAAS,qCAAgE;AACzE,SAAS,gBAAgB;AAGlB,MAAM,qBAAqB;AAO3B,MAAM,kBAAkB;AAoD/B,SAAS,OAAO,QAAmC;AACjD,MAAI,OAAO,WAAW,EAAG,QAAO;AAChC,QAAM,UAAU,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,MAAM,UAAU,OAAO,KAAK;AAC9D,QAAM,SAAS,KAAK,MAAM,QAAQ,SAAS,CAAC;AAC5C,SAAO,QAAQ,SAAS,MAAM,KAAK,QAAQ,SAAS,CAAC,IAAI,QAAQ,MAAM,KAAK,IAAI,QAAQ,MAAM;AAChG;AAEA,SAAS,yBAAyB,gBAA2C;AAC3E,QAAM,WAAW,eAAe,OAAO,CAAC,aAAa,WAAW,CAAC;AACjE,MAAI,SAAS,WAAW,EAAG,QAAO,OAAO;AACzC,SAAO,KAAK,IAAI,oBAAoB,OAAO,QAAQ,IAAI,eAAe;AACxE;AAEA,SAAS,YAAY,YAAwC;AAC3D,QAAM,eAAyB,CAAC;AAChC,WAAS,QAAQ,GAAG,QAAQ,WAAW,QAAQ,SAAS,GAAG;AACzD,iBAAa,KAAK,WAAW,KAAK,IAAI,WAAW,QAAQ,CAAC,CAAC;AAAA,EAC7D;AACA,QAAM,YAAY,yBAAyB,YAAY;AAEvD,QAAM,SAAkB,CAAC;AACzB,MAAI,gBAAgB;AACpB,WAAS,QAAQ,GAAG,QAAQ,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+
RUN_OUTCOME_SKIPPED_STEP_STATUS,
|
|
7
|
+
RUN_OUTCOME_WARNING_EVENT_TYPES
|
|
8
|
+
} from "./run-outcome.js";
|
|
9
|
+
async function collectRunOutcomeEvidence(em, instance, terminalStatus) {
|
|
10
|
+
if (terminalStatus !== "COMPLETED") {
|
|
11
|
+
return { terminalStatus, ...EMPTY_RUN_OUTCOME_EVIDENCE };
|
|
12
|
+
}
|
|
13
|
+
const scope = {
|
|
14
|
+
workflowInstanceId: instance.id,
|
|
15
|
+
tenantId: instance.tenantId,
|
|
16
|
+
organizationId: instance.organizationId
|
|
17
|
+
};
|
|
18
|
+
const [failedSteps, failureEvents, skippedSteps, warningEvents] = await Promise.all([
|
|
19
|
+
em.count(StepInstance, { ...scope, status: RUN_OUTCOME_FAILED_STEP_STATUS }),
|
|
20
|
+
em.count(WorkflowEvent, { ...scope, eventType: { $in: [...RUN_OUTCOME_FAILURE_EVENT_TYPES] } }),
|
|
21
|
+
em.count(StepInstance, { ...scope, status: RUN_OUTCOME_SKIPPED_STEP_STATUS }),
|
|
22
|
+
em.count(WorkflowEvent, { ...scope, eventType: { $in: [...RUN_OUTCOME_WARNING_EVENT_TYPES] } })
|
|
23
|
+
]);
|
|
24
|
+
return {
|
|
25
|
+
terminalStatus,
|
|
26
|
+
failureEvidenceCount: failedSteps + failureEvents,
|
|
27
|
+
warningEvidenceCount: skippedSteps + warningEvents
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
collectRunOutcomeEvidence
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=run-outcome-evidence.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/run-outcome-evidence.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Workflows Module \u2014 Run Outcome Evidence (the data-access half).\n *\n * Counts what the run RECORDED about itself so `resolveRunOutcome`\n * (`lib/run-outcome.ts`, pure) can reach a verdict. Nothing here decides\n * anything: the vocabulary and the precedence both live in the pure module, and\n * this file only turns rows into the counts that module asks for.\n *\n * Every query carries `tenantId` AND `organizationId` on top of the instance id.\n * The instance id alone would already be unique, but a scoped query cannot be\n * turned into a cross-tenant read by a later refactor that widens it.\n */\n\nimport type { EntityManager } from '@mikro-orm/core'\nimport { StepInstance, WorkflowEvent, type WorkflowInstance } from '../data/entities'\nimport {\n EMPTY_RUN_OUTCOME_EVIDENCE,\n RUN_OUTCOME_FAILED_STEP_STATUS,\n RUN_OUTCOME_FAILURE_EVENT_TYPES,\n RUN_OUTCOME_SKIPPED_STEP_STATUS,\n RUN_OUTCOME_WARNING_EVENT_TYPES,\n type RunOutcomeEvidence,\n} from './run-outcome'\n\n/**\n * Count the run's recorded failure and warning evidence.\n *\n * Short-circuits for every terminal status except `COMPLETED`: `cancelled`,\n * `compensated` and `failure` are decided by the lifecycle alone, so querying\n * for evidence that cannot change the verdict would add four round trips to\n * every failing run's termination path.\n */\nexport async function collectRunOutcomeEvidence(\n em: EntityManager,\n instance: Pick<WorkflowInstance, 'id' | 'tenantId' | 'organizationId'>,\n terminalStatus: string,\n): Promise<RunOutcomeEvidence> {\n if (terminalStatus !== 'COMPLETED') {\n return { terminalStatus, ...EMPTY_RUN_OUTCOME_EVIDENCE }\n }\n\n const scope = {\n workflowInstanceId: instance.id,\n tenantId: instance.tenantId,\n organizationId: instance.organizationId,\n }\n\n const [failedSteps, failureEvents, skippedSteps, warningEvents] = await Promise.all([\n em.count(StepInstance, { ...scope, status: RUN_OUTCOME_FAILED_STEP_STATUS }),\n em.count(WorkflowEvent, { ...scope, eventType: { $in: [...RUN_OUTCOME_FAILURE_EVENT_TYPES] } }),\n em.count(StepInstance, { ...scope, status: RUN_OUTCOME_SKIPPED_STEP_STATUS }),\n em.count(WorkflowEvent, { ...scope, eventType: { $in: [...RUN_OUTCOME_WARNING_EVENT_TYPES] } }),\n ])\n\n return {\n terminalStatus,\n failureEvidenceCount: failedSteps + failureEvents,\n warningEvidenceCount: skippedSteps + warningEvents,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAcA,SAAS,cAAc,qBAA4C;AACnE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAUP,eAAsB,0BACpB,IACA,UACA,gBAC6B;AAC7B,MAAI,mBAAmB,aAAa;AAClC,WAAO,EAAE,gBAAgB,GAAG,2BAA2B;AAAA,EACzD;AAEA,QAAM,QAAQ;AAAA,IACZ,oBAAoB,SAAS;AAAA,IAC7B,UAAU,SAAS;AAAA,IACnB,gBAAgB,SAAS;AAAA,EAC3B;AAEA,QAAM,CAAC,aAAa,eAAe,cAAc,aAAa,IAAI,MAAM,QAAQ,IAAI;AAAA,IAClF,GAAG,MAAM,cAAc,EAAE,GAAG,OAAO,QAAQ,+BAA+B,CAAC;AAAA,IAC3E,GAAG,MAAM,eAAe,EAAE,GAAG,OAAO,WAAW,EAAE,KAAK,CAAC,GAAG,+BAA+B,EAAE,EAAE,CAAC;AAAA,IAC9F,GAAG,MAAM,cAAc,EAAE,GAAG,OAAO,QAAQ,gCAAgC,CAAC;AAAA,IAC5E,GAAG,MAAM,eAAe,EAAE,GAAG,OAAO,WAAW,EAAE,KAAK,CAAC,GAAG,+BAA+B,EAAE,EAAE,CAAC;AAAA,EAChG,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,sBAAsB,cAAc;AAAA,IACpC,sBAAsB,eAAe;AAAA,EACvC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const WORKFLOW_RUN_OUTCOMES = [
|
|
2
|
+
"success",
|
|
3
|
+
"success_with_warnings",
|
|
4
|
+
"partial_failure",
|
|
5
|
+
"failure",
|
|
6
|
+
"cancelled",
|
|
7
|
+
"compensated"
|
|
8
|
+
];
|
|
9
|
+
const RUN_OUTCOME_FAILED_STEP_STATUS = "FAILED";
|
|
10
|
+
const RUN_OUTCOME_SKIPPED_STEP_STATUS = "SKIPPED";
|
|
11
|
+
const RUN_OUTCOME_FAILURE_EVENT_TYPES = ["ACTIVITY_FAILED"];
|
|
12
|
+
const RUN_OUTCOME_WARNING_EVENT_TYPES = ["STEP_SKIPPED"];
|
|
13
|
+
const EMPTY_RUN_OUTCOME_EVIDENCE = {
|
|
14
|
+
failureEvidenceCount: 0,
|
|
15
|
+
warningEvidenceCount: 0
|
|
16
|
+
};
|
|
17
|
+
function resolveRunOutcome(evidence) {
|
|
18
|
+
if (evidence.terminalStatus === "CANCELLED") return "cancelled";
|
|
19
|
+
if (evidence.terminalStatus === "COMPENSATED") return "compensated";
|
|
20
|
+
if (evidence.terminalStatus !== "COMPLETED") return "failure";
|
|
21
|
+
if (evidence.failureEvidenceCount > 0) return "partial_failure";
|
|
22
|
+
if (evidence.warningEvidenceCount > 0) return "success_with_warnings";
|
|
23
|
+
return "success";
|
|
24
|
+
}
|
|
25
|
+
function isDegradedRunOutcome(outcome) {
|
|
26
|
+
return outcome === "partial_failure";
|
|
27
|
+
}
|
|
28
|
+
const WORKFLOW_ATTENTION_OUTCOMES = ["partial_failure"];
|
|
29
|
+
function isRetryableRunOutcome(outcome) {
|
|
30
|
+
return outcome === "failure";
|
|
31
|
+
}
|
|
32
|
+
function isWorkflowRunOutcome(value) {
|
|
33
|
+
return typeof value === "string" && WORKFLOW_RUN_OUTCOMES.includes(value);
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
EMPTY_RUN_OUTCOME_EVIDENCE,
|
|
37
|
+
RUN_OUTCOME_FAILED_STEP_STATUS,
|
|
38
|
+
RUN_OUTCOME_FAILURE_EVENT_TYPES,
|
|
39
|
+
RUN_OUTCOME_SKIPPED_STEP_STATUS,
|
|
40
|
+
RUN_OUTCOME_WARNING_EVENT_TYPES,
|
|
41
|
+
WORKFLOW_ATTENTION_OUTCOMES,
|
|
42
|
+
WORKFLOW_RUN_OUTCOMES,
|
|
43
|
+
isDegradedRunOutcome,
|
|
44
|
+
isRetryableRunOutcome,
|
|
45
|
+
isWorkflowRunOutcome,
|
|
46
|
+
resolveRunOutcome
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=run-outcome.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/run-outcome.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Workflows Module \u2014 Run Outcome (pure)\n *\n * The run's **verdict**, alongside \u2014 never instead of \u2014 its lifecycle `status`.\n *\n * `status` answers *did it reach the end?* and drives control flow (is this run\n * active? may the executor advance it? can it be retried?). It is untouched by\n * this module. `outcome` answers the other question the same enum used to be\n * asked to answer on its own: *did everything it attempted actually happen?*\n * Conflating the two is why a run that swallowed three failed writes reported\n * the same `COMPLETED` as a clean one.\n *\n * | outcome | meaning |\n * |-------------------------|---------------------------------------------------------------|\n * | `success` | Reached END. Nothing failed, nothing was suppressed. |\n * | `success_with_warnings` | Reached END and did everything asked, but something is worth reading. |\n * | `partial_failure` | Reached END, but at least one activity or step failed and was tolerated. |\n * | `failure` | Did not reach END. |\n * | `cancelled` | A human stopped it. |\n * | `compensated` | Rolled back. |\n *\n * **The invariant this module exists for:**\n *\n * > A run that suppressed at least one failure MUST NOT be `success`.\n *\n * It holds by construction \u2014 `resolveRunOutcome` consults\n * `failureEvidenceCount` before it can ever return `success`, and it is the ONE\n * decision point, so no exit point can assemble a friendlier verdict of its own.\n *\n * PURE: no ORM, DI, React or registry imports, exactly like `lib/error-routing.ts`,\n * `lib/breach-routing.ts` and `lib/outcome-routing.ts`. The impure half \u2014\n * counting the recorded evidence \u2014 lives in `lib/run-outcome-evidence.ts`.\n */\n\nexport const WORKFLOW_RUN_OUTCOMES = [\n 'success',\n 'success_with_warnings',\n 'partial_failure',\n 'failure',\n 'cancelled',\n 'compensated',\n] as const\n\nexport type WorkflowRunOutcome = (typeof WORKFLOW_RUN_OUTCOMES)[number]\n\n/**\n * `StepInstance.status` values that ARE recorded failure evidence.\n *\n * A step row only becomes FAILED through `markStepInstanceFailed`, which the\n * enabling fix made unconditional \u2014 a tolerated failure is recorded exactly like\n * a fatal one, because tolerating a failure is a routing decision, not a reason\n * to forget it happened.\n */\nexport const RUN_OUTCOME_FAILED_STEP_STATUS = 'FAILED'\n\n/** `StepInstance.status` value that is a warning rather than a failure. */\nexport const RUN_OUTCOME_SKIPPED_STEP_STATUS = 'SKIPPED'\n\n/**\n * Event types that are failure evidence a step row does NOT already carry.\n *\n * `ACTIVITY_FAILED` is the one that matters: a transition's activities run\n * LEAVING their source step, whose row has already exited COMPLETED, so a\n * transition-level `continueOnActivityFailure` (the shipped `order-approval`\n * shape) leaves no failed step row anywhere \u2014 only this event. `STEP_FAILED` is\n * deliberately absent: it is one-to-one with a FAILED row and counting both\n * would double-count the same failure.\n */\nexport const RUN_OUTCOME_FAILURE_EVENT_TYPES = ['ACTIVITY_FAILED'] as const\n\n/** Event types that are warning evidence a step row does not already carry. */\nexport const RUN_OUTCOME_WARNING_EVENT_TYPES = ['STEP_SKIPPED'] as const\n\n/**\n * What the run recorded about itself, already counted.\n *\n * Counts rather than rows because the decision is a `> 0` test and the collector\n * answers it with `COUNT(*)`; the numbers are evidence for the verdict, not a\n * reported metric.\n *\n * **Known imprecision, deliberately not papered over:** a run that failed, was\n * retried and then completed still carries its pre-retry `ACTIVITY_FAILED`\n * rows, so it reports `partial_failure`. The engine records no attempt boundary\n * to subtract them by, and over-reporting a degraded run is the safe direction\n * for a change whose whole purpose is to stop under-reporting one.\n */\nexport type RunOutcomeEvidence = {\n /** The status the run is terminating with. */\n terminalStatus: string\n /** FAILED step rows plus `ACTIVITY_FAILED` events. */\n failureEvidenceCount: number\n /** SKIPPED step rows plus `STEP_SKIPPED` events. */\n warningEvidenceCount: number\n}\n\nexport const EMPTY_RUN_OUTCOME_EVIDENCE: Omit<RunOutcomeEvidence, 'terminalStatus'> = {\n failureEvidenceCount: 0,\n warningEvidenceCount: 0,\n}\n\n/**\n * The single decision point. Terminal status first, because `cancelled`,\n * `compensated` and `failure` are facts about the lifecycle that no amount of\n * evidence can argue with; only a run that actually reached END is judged on\n * what it recorded.\n */\nexport function resolveRunOutcome(evidence: RunOutcomeEvidence): WorkflowRunOutcome {\n if (evidence.terminalStatus === 'CANCELLED') return 'cancelled'\n if (evidence.terminalStatus === 'COMPENSATED') return 'compensated'\n if (evidence.terminalStatus !== 'COMPLETED') return 'failure'\n if (evidence.failureEvidenceCount > 0) return 'partial_failure'\n if (evidence.warningEvidenceCount > 0) return 'success_with_warnings'\n return 'success'\n}\n\n/** True for a verdict an operator must look at even though the run reached END. */\nexport function isDegradedRunOutcome(outcome: WorkflowRunOutcome | null | undefined): boolean {\n return outcome === 'partial_failure'\n}\n\n/**\n * Outcomes the needs-attention / failure queue must include.\n *\n * A `partial_failure` is precisely the run nobody looks at because it said\n * COMPLETED \u2014 which is the failure this whole change exists to remove.\n */\nexport const WORKFLOW_ATTENTION_OUTCOMES = ['partial_failure'] as const\n\n/**\n * `partial_failure` is NOT retryable as a whole run (maintainer decision,\n * 2026-07-30). It reached END, so replaying the graph would re-run every part\n * that already succeeded \u2014 duplicating their effects to re-attempt the parts\n * that did not. Recovery is rerun-from-step on the specific failed step, which\n * is what that feature is for and what the enabling fix unblocked.\n */\nexport function isRetryableRunOutcome(outcome: WorkflowRunOutcome | null | undefined): boolean {\n return outcome === 'failure'\n}\n\nexport function isWorkflowRunOutcome(value: unknown): value is WorkflowRunOutcome {\n return typeof value === 'string' && (WORKFLOW_RUN_OUTCOMES as readonly string[]).includes(value)\n}\n"],
|
|
5
|
+
"mappings": "AAkCO,MAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAYO,MAAM,iCAAiC;AAGvC,MAAM,kCAAkC;AAYxC,MAAM,kCAAkC,CAAC,iBAAiB;AAG1D,MAAM,kCAAkC,CAAC,cAAc;AAwBvD,MAAM,6BAAyE;AAAA,EACpF,sBAAsB;AAAA,EACtB,sBAAsB;AACxB;AAQO,SAAS,kBAAkB,UAAkD;AAClF,MAAI,SAAS,mBAAmB,YAAa,QAAO;AACpD,MAAI,SAAS,mBAAmB,cAAe,QAAO;AACtD,MAAI,SAAS,mBAAmB,YAAa,QAAO;AACpD,MAAI,SAAS,uBAAuB,EAAG,QAAO;AAC9C,MAAI,SAAS,uBAAuB,EAAG,QAAO;AAC9C,SAAO;AACT;AAGO,SAAS,qBAAqB,SAAyD;AAC5F,SAAO,YAAY;AACrB;AAQO,MAAM,8BAA8B,CAAC,iBAAiB;AAStD,SAAS,sBAAsB,SAAyD;AAC7F,SAAO,YAAY;AACrB;AAEO,SAAS,qBAAqB,OAA6C;AAChF,SAAO,OAAO,UAAU,YAAa,sBAA4C,SAAS,KAAK;AACjG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const PLACEHOLDER_DATE_SAMPLE = "2026-01-01T00:00:00.000Z";
|
|
2
|
+
function isPlainObject(value) {
|
|
3
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
function placeholderValueFor(entry) {
|
|
6
|
+
switch (entry.type) {
|
|
7
|
+
case "text":
|
|
8
|
+
return "text";
|
|
9
|
+
case "number":
|
|
10
|
+
return 0;
|
|
11
|
+
case "boolean":
|
|
12
|
+
return false;
|
|
13
|
+
case "date":
|
|
14
|
+
return PLACEHOLDER_DATE_SAMPLE;
|
|
15
|
+
case "select":
|
|
16
|
+
return entry.options && entry.options.length > 0 ? entry.options[0] : "option";
|
|
17
|
+
case "object":
|
|
18
|
+
return {};
|
|
19
|
+
default:
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function assignAtPath(target, path, value) {
|
|
24
|
+
const segments = path.split(".").filter((segment) => segment.length > 0);
|
|
25
|
+
if (segments.length === 0) return;
|
|
26
|
+
let cursor = target;
|
|
27
|
+
for (const segment of segments.slice(0, -1)) {
|
|
28
|
+
const existing = cursor[segment];
|
|
29
|
+
if (isPlainObject(existing)) {
|
|
30
|
+
cursor = existing;
|
|
31
|
+
} else {
|
|
32
|
+
const created = {};
|
|
33
|
+
cursor[segment] = created;
|
|
34
|
+
cursor = created;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const leaf = segments[segments.length - 1];
|
|
38
|
+
const current = cursor[leaf];
|
|
39
|
+
if (isPlainObject(current) && isPlainObject(value)) return;
|
|
40
|
+
cursor[leaf] = value;
|
|
41
|
+
}
|
|
42
|
+
function buildPlaceholderFromLedger(entries) {
|
|
43
|
+
const placeholder = {};
|
|
44
|
+
for (const entry of entries) {
|
|
45
|
+
assignAtPath(placeholder, entry.path, placeholderValueFor(entry));
|
|
46
|
+
}
|
|
47
|
+
return placeholder;
|
|
48
|
+
}
|
|
49
|
+
function resolveStepSample({
|
|
50
|
+
stepId,
|
|
51
|
+
samples,
|
|
52
|
+
testOutputs,
|
|
53
|
+
ledgerEntries
|
|
54
|
+
}) {
|
|
55
|
+
const pinned = samples ? samples[stepId] : void 0;
|
|
56
|
+
if (pinned !== void 0) {
|
|
57
|
+
return { data: pinned.data, source: "pin" };
|
|
58
|
+
}
|
|
59
|
+
if (testOutputs && Object.prototype.hasOwnProperty.call(testOutputs, stepId)) {
|
|
60
|
+
return { data: testOutputs[stepId], source: "test" };
|
|
61
|
+
}
|
|
62
|
+
if (ledgerEntries && ledgerEntries.length > 0) {
|
|
63
|
+
return { data: buildPlaceholderFromLedger(ledgerEntries), source: "placeholder" };
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
buildPlaceholderFromLedger,
|
|
69
|
+
resolveStepSample
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=sample-resolver.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/workflows/lib/sample-resolver.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Workflows Module - per-step sample resolution (spec\n * 2026-07-26-workflows-ux-redesign.md section 3.6).\n *\n * Pure, dependency-free precedence chain for the context sample shown next to\n * a step in the editor and used to seed Test-step runs:\n *\n * 1. explicit pin \u2014 `metadata.editor.samples[stepId]` written by the user\n * 2. in-memory test output \u2014 the last Test-step result for the step\n * 3. ledger-derived placeholder \u2014 synthesized from the step's ledger\n * entries so the preview always has an honest, typed shape\n *\n * Returns null when none of the three sources can produce anything. No React,\n * no ORM, no DI \u2014 loadable from the browser bundle and server routes alike.\n */\n\nexport type ResolvedSampleSource = 'pin' | 'test' | 'placeholder'\n\nexport interface ResolvedStepSample {\n data: unknown\n source: ResolvedSampleSource\n}\n\nexport interface PinnedSampleEnvelope {\n pinnedAt: string\n source: 'manual' | 'test'\n data: unknown\n}\n\nexport interface SampleLedgerEntry {\n path: string\n type: string\n options?: string[]\n}\n\nexport interface ResolveStepSampleInput {\n stepId: string\n samples?: Record<string, PinnedSampleEnvelope> | null\n testOutputs?: Record<string, unknown> | null\n ledgerEntries?: SampleLedgerEntry[] | null\n}\n\nconst PLACEHOLDER_DATE_SAMPLE = '2026-01-01T00:00:00.000Z'\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction placeholderValueFor(entry: SampleLedgerEntry): unknown {\n switch (entry.type) {\n case 'text':\n return 'text'\n case 'number':\n return 0\n case 'boolean':\n return false\n case 'date':\n return PLACEHOLDER_DATE_SAMPLE\n case 'select':\n return entry.options && entry.options.length > 0 ? entry.options[0] : 'option'\n case 'object':\n return {}\n default:\n return null\n }\n}\n\nfunction assignAtPath(target: Record<string, unknown>, path: string, value: unknown): void {\n const segments = path.split('.').filter((segment) => segment.length > 0)\n if (segments.length === 0) return\n let cursor = target\n for (const segment of segments.slice(0, -1)) {\n const existing = cursor[segment]\n if (isPlainObject(existing)) {\n cursor = existing\n } else {\n const created: Record<string, unknown> = {}\n cursor[segment] = created\n cursor = created\n }\n }\n const leaf = segments[segments.length - 1]\n const current = cursor[leaf]\n if (isPlainObject(current) && isPlainObject(value)) return\n cursor[leaf] = value\n}\n\nexport function buildPlaceholderFromLedger(entries: SampleLedgerEntry[]): Record<string, unknown> {\n const placeholder: Record<string, unknown> = {}\n for (const entry of entries) {\n assignAtPath(placeholder, entry.path, placeholderValueFor(entry))\n }\n return placeholder\n}\n\nexport function resolveStepSample({\n stepId,\n samples,\n testOutputs,\n ledgerEntries,\n}: ResolveStepSampleInput): ResolvedStepSample | null {\n const pinned = samples ? samples[stepId] : undefined\n if (pinned !== undefined) {\n return { data: pinned.data, source: 'pin' }\n }\n if (testOutputs && Object.prototype.hasOwnProperty.call(testOutputs, stepId)) {\n return { data: testOutputs[stepId], source: 'test' }\n }\n if (ledgerEntries && ledgerEntries.length > 0) {\n return { data: buildPlaceholderFromLedger(ledgerEntries), source: 'placeholder' }\n }\n return null\n}\n"],
|
|
5
|
+
"mappings": "AA0CA,MAAM,0BAA0B;AAEhC,SAAS,cAAc,OAAkD;AACvE,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,oBAAoB,OAAmC;AAC9D,UAAQ,MAAM,MAAM;AAAA,IAClB,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO,MAAM,WAAW,MAAM,QAAQ,SAAS,IAAI,MAAM,QAAQ,CAAC,IAAI;AAAA,IACxE,KAAK;AACH,aAAO,CAAC;AAAA,IACV;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,aAAa,QAAiC,MAAc,OAAsB;AACzF,QAAM,WAAW,KAAK,MAAM,GAAG,EAAE,OAAO,CAAC,YAAY,QAAQ,SAAS,CAAC;AACvE,MAAI,SAAS,WAAW,EAAG;AAC3B,MAAI,SAAS;AACb,aAAW,WAAW,SAAS,MAAM,GAAG,EAAE,GAAG;AAC3C,UAAM,WAAW,OAAO,OAAO;AAC/B,QAAI,cAAc,QAAQ,GAAG;AAC3B,eAAS;AAAA,IACX,OAAO;AACL,YAAM,UAAmC,CAAC;AAC1C,aAAO,OAAO,IAAI;AAClB,eAAS;AAAA,IACX;AAAA,EACF;AACA,QAAM,OAAO,SAAS,SAAS,SAAS,CAAC;AACzC,QAAM,UAAU,OAAO,IAAI;AAC3B,MAAI,cAAc,OAAO,KAAK,cAAc,KAAK,EAAG;AACpD,SAAO,IAAI,IAAI;AACjB;AAEO,SAAS,2BAA2B,SAAuD;AAChG,QAAM,cAAuC,CAAC;AAC9C,aAAW,SAAS,SAAS;AAC3B,iBAAa,aAAa,MAAM,MAAM,oBAAoB,KAAK,CAAC;AAAA,EAClE;AACA,SAAO;AACT;AAEO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAsD;AACpD,QAAM,SAAS,UAAU,QAAQ,MAAM,IAAI;AAC3C,MAAI,WAAW,QAAW;AACxB,WAAO,EAAE,MAAM,OAAO,MAAM,QAAQ,MAAM;AAAA,EAC5C;AACA,MAAI,eAAe,OAAO,UAAU,eAAe,KAAK,aAAa,MAAM,GAAG;AAC5E,WAAO,EAAE,MAAM,YAAY,MAAM,GAAG,QAAQ,OAAO;AAAA,EACrD;AACA,MAAI,iBAAiB,cAAc,SAAS,GAAG;AAC7C,WAAO,EAAE,MAAM,2BAA2B,aAAa,GAAG,QAAQ,cAAc;AAAA,EAClF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -32,7 +32,7 @@ async function seedWorkflowDefinition(em, scope, fileName) {
|
|
|
32
32
|
workflowId,
|
|
33
33
|
tenantId: scope.tenantId,
|
|
34
34
|
organizationId: scope.organizationId
|
|
35
|
-
});
|
|
35
|
+
}, { orderBy: { version: "DESC" } });
|
|
36
36
|
if (existing) {
|
|
37
37
|
const seedStepCount = seed.definition.steps.length;
|
|
38
38
|
const existingStepCount = existing.definition.steps.length;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/workflows/lib/seeds.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport * as fs from 'fs'\nimport * as path from 'path'\nimport { fileURLToPath } from 'node:url'\nimport { WorkflowDefinition, type WorkflowDefinitionData } from '../data/entities'\nimport { BusinessRule, type RuleType } from '@open-mercato/core/modules/business_rules/data/entities'\nimport {\n invalidateBusinessRuleDiscoveryCache,\n type RuleDiscoveryCache,\n} from '@open-mercato/core/modules/business_rules/lib/rule-engine'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nconst __esmDirname = path.dirname(fileURLToPath(import.meta.url))\n\nexport type WorkflowSeedScope = { tenantId: string; organizationId: string }\n\ntype WorkflowSeedDefinition = {\n workflowId: string\n workflowName: string\n description?: string | null\n version?: number\n definition: WorkflowDefinitionData\n metadata?: Record<string, unknown> | null\n enabled?: boolean\n effectiveFrom?: string | null\n effectiveTo?: string | null\n createdBy?: string | null\n updatedBy?: string | null\n}\n\ntype GuardRuleSeed = {\n ruleId: string\n ruleName: string\n ruleType: RuleType\n entityType: string\n conditionExpression: unknown\n eventType?: string | null\n ruleCategory?: string | null\n description?: string | null\n successActions?: unknown\n failureActions?: unknown\n enabled?: boolean\n priority?: number\n version?: number\n effectiveFrom?: string | null\n effectiveTo?: string | null\n createdBy?: string | null\n updatedBy?: string | null\n tagsJson?: string[]\n labelsJson?: Record<string, string>\n}\n\nfunction readExampleJson<T>(fileName: string): T {\n const candidates = [\n path.join(__esmDirname, '..', 'examples', fileName),\n path.join(process.cwd(), 'packages', 'core', 'src', 'modules', 'workflows', 'examples', fileName),\n path.join(process.cwd(), 'src', 'modules', 'workflows', 'examples', fileName),\n ]\n const filePath = candidates.find((candidate) => fs.existsSync(candidate))\n if (!filePath) {\n throw new Error(`Missing workflow seed file: ${fileName}`)\n }\n return JSON.parse(fs.readFileSync(filePath, 'utf8')) as T\n}\n\nfunction requireString(value: unknown, label: string): string {\n if (typeof value === 'string' && value.trim().length > 0) return value\n throw new Error(`Invalid ${label} in workflow seed data.`)\n}\n\nasync function seedWorkflowDefinition(\n em: EntityManager,\n scope: WorkflowSeedScope,\n fileName: string,\n): Promise<boolean> {\n const seed = readExampleJson<WorkflowSeedDefinition>(fileName)\n const workflowId = requireString(seed.workflowId, 'workflowId')\n\n const existing = await em.findOne(WorkflowDefinition, {\n workflowId,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n\n if (existing) {\n // Check if the definition needs to be updated by comparing steps and transitions\n const seedStepCount = seed.definition.steps.length\n const existingStepCount = existing.definition.steps.length\n const seedTransitionCount = seed.definition.transitions.length\n const existingTransitionCount = existing.definition.transitions.length\n\n // Check for preConditions on transitions\n const seedHasTransitionPreConditions = seed.definition.transitions.some(\n (t: any) => t.preConditions && t.preConditions.length > 0\n )\n const existingHasTransitionPreConditions = existing.definition.transitions.some(\n (t: any) => t.preConditions && t.preConditions.length > 0\n )\n\n // Check for preConditions on START step\n const seedStartStep = seed.definition.steps.find((s: any) => s.stepType === 'START')\n const existingStartStep = existing.definition.steps.find((s: any) => s.stepType === 'START')\n const seedHasStartPreConditions = seedStartStep?.preConditions && seedStartStep.preConditions.length > 0\n const existingHasStartPreConditions = existingStartStep?.preConditions && existingStartStep.preConditions.length > 0\n\n // Update if structure has changed\n const needsUpdate =\n seedStepCount !== existingStepCount ||\n seedTransitionCount !== existingTransitionCount ||\n (seedHasStartPreConditions && !existingHasStartPreConditions) ||\n (seedHasTransitionPreConditions && !existingHasTransitionPreConditions)\n\n if (needsUpdate) {\n logger.info('Updating seeded workflow', {\n component: 'seed',\n workflowId,\n existingStepCount,\n seedStepCount,\n existingTransitionCount,\n seedTransitionCount,\n })\n existing.definition = seed.definition\n await em.flush()\n return true\n }\n\n return false\n }\n\n const workflow = em.create(WorkflowDefinition, {\n ...seed,\n workflowId,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n em.persist(workflow)\n await em.flush()\n return true\n}\n\nasync function seedGuardRules(\n em: EntityManager,\n scope: WorkflowSeedScope,\n fileName: string,\n cache?: RuleDiscoveryCache | null,\n): Promise<{ seeded: number; skipped: number; updated: number }> {\n const seeds = readExampleJson<GuardRuleSeed[]>(fileName)\n if (!Array.isArray(seeds)) {\n throw new Error('Invalid guard rules seed data.')\n }\n\n let seeded = 0\n let skipped = 0\n let updated = 0\n for (const rule of seeds) {\n const ruleId = requireString(rule.ruleId, 'ruleId')\n const existing = await em.findOne(BusinessRule, {\n ruleId,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n if (existing) {\n // Check if entityType or eventType needs updating\n const needsUpdate = existing.entityType !== rule.entityType || existing.eventType !== rule.eventType\n if (needsUpdate) {\n logger.info('Updating seeded business rule', {\n component: 'seed',\n ruleId,\n entityType: rule.entityType,\n eventType: rule.eventType,\n })\n existing.entityType = rule.entityType\n existing.eventType = rule.eventType ?? null\n updated += 1\n } else {\n skipped += 1\n }\n continue\n }\n const entry = em.create(BusinessRule, {\n ruleId,\n ruleName: rule.ruleName,\n ruleType: rule.ruleType,\n entityType: rule.entityType,\n conditionExpression: rule.conditionExpression,\n eventType: rule.eventType,\n ruleCategory: rule.ruleCategory,\n description: rule.description,\n successActions: rule.successActions,\n failureActions: rule.failureActions,\n enabled: rule.enabled,\n priority: rule.priority,\n version: rule.version,\n effectiveFrom: rule.effectiveFrom,\n effectiveTo: rule.effectiveTo,\n createdBy: rule.createdBy,\n updatedBy: rule.updatedBy,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n em.persist(entry)\n seeded += 1\n }\n if (seeded > 0 || updated > 0) {\n await em.flush()\n await invalidateBusinessRuleDiscoveryCache(cache, scope.tenantId, scope.organizationId)\n }\n return { seeded, skipped, updated }\n}\n\nexport async function seedExampleWorkflows(\n em: EntityManager,\n scope: WorkflowSeedScope,\n options: { cache?: RuleDiscoveryCache | null } = {},\n): Promise<void> {\n // workflows.checkout-demo and workflows.simple-approval are now code-defined\n // (see packages/core/src/modules/workflows/workflows.ts). Seeding DB rows for\n // them would shadow the code definitions in the merge layer, so they are no\n // longer seeded here. Existing tenants are migrated via Migration20260428102318.\n await seedGuardRules(em, scope, 'guard-rules-example.json', options.cache)\n await seedWorkflowDefinition(em, scope, 'sales-pipeline-definition.json')\n await seedGuardRules(em, scope, 'order-approval-guard-rules.json', options.cache)\n}\n"],
|
|
5
|
-
"mappings": "AACA,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,qBAAqB;AAC9B,SAAS,0BAAuD;AAChE,SAAS,oBAAmC;AAC5C;AAAA,EACE;AAAA,OAEK;AACP,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAEvC,MAAM,eAAe,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAwChE,SAAS,gBAAmB,UAAqB;AAC/C,QAAM,aAAa;AAAA,IACjB,KAAK,KAAK,cAAc,MAAM,YAAY,QAAQ;AAAA,IAClD,KAAK,KAAK,QAAQ,IAAI,GAAG,YAAY,QAAQ,OAAO,WAAW,aAAa,YAAY,QAAQ;AAAA,IAChG,KAAK,KAAK,QAAQ,IAAI,GAAG,OAAO,WAAW,aAAa,YAAY,QAAQ;AAAA,EAC9E;AACA,QAAM,WAAW,WAAW,KAAK,CAAC,cAAc,GAAG,WAAW,SAAS,CAAC;AACxE,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,+BAA+B,QAAQ,EAAE;AAAA,EAC3D;AACA,SAAO,KAAK,MAAM,GAAG,aAAa,UAAU,MAAM,CAAC;AACrD;AAEA,SAAS,cAAc,OAAgB,OAAuB;AAC5D,MAAI,OAAO,UAAU,YAAY,MAAM,KAAK,EAAE,SAAS,EAAG,QAAO;AACjE,QAAM,IAAI,MAAM,WAAW,KAAK,yBAAyB;AAC3D;AAEA,eAAe,uBACb,IACA,OACA,UACkB;AAClB,QAAM,OAAO,gBAAwC,QAAQ;AAC7D,QAAM,aAAa,cAAc,KAAK,YAAY,YAAY;
|
|
4
|
+
"sourcesContent": ["import type { EntityManager } from '@mikro-orm/postgresql'\nimport * as fs from 'fs'\nimport * as path from 'path'\nimport { fileURLToPath } from 'node:url'\nimport { WorkflowDefinition, type WorkflowDefinitionData } from '../data/entities'\nimport { BusinessRule, type RuleType } from '@open-mercato/core/modules/business_rules/data/entities'\nimport {\n invalidateBusinessRuleDiscoveryCache,\n type RuleDiscoveryCache,\n} from '@open-mercato/core/modules/business_rules/lib/rule-engine'\nimport { createLogger } from '@open-mercato/shared/lib/logger'\n\nconst logger = createLogger('workflows')\n\nconst __esmDirname = path.dirname(fileURLToPath(import.meta.url))\n\nexport type WorkflowSeedScope = { tenantId: string; organizationId: string }\n\ntype WorkflowSeedDefinition = {\n workflowId: string\n workflowName: string\n description?: string | null\n version?: number\n definition: WorkflowDefinitionData\n metadata?: Record<string, unknown> | null\n enabled?: boolean\n effectiveFrom?: string | null\n effectiveTo?: string | null\n createdBy?: string | null\n updatedBy?: string | null\n}\n\ntype GuardRuleSeed = {\n ruleId: string\n ruleName: string\n ruleType: RuleType\n entityType: string\n conditionExpression: unknown\n eventType?: string | null\n ruleCategory?: string | null\n description?: string | null\n successActions?: unknown\n failureActions?: unknown\n enabled?: boolean\n priority?: number\n version?: number\n effectiveFrom?: string | null\n effectiveTo?: string | null\n createdBy?: string | null\n updatedBy?: string | null\n tagsJson?: string[]\n labelsJson?: Record<string, string>\n}\n\nfunction readExampleJson<T>(fileName: string): T {\n const candidates = [\n path.join(__esmDirname, '..', 'examples', fileName),\n path.join(process.cwd(), 'packages', 'core', 'src', 'modules', 'workflows', 'examples', fileName),\n path.join(process.cwd(), 'src', 'modules', 'workflows', 'examples', fileName),\n ]\n const filePath = candidates.find((candidate) => fs.existsSync(candidate))\n if (!filePath) {\n throw new Error(`Missing workflow seed file: ${fileName}`)\n }\n return JSON.parse(fs.readFileSync(filePath, 'utf8')) as T\n}\n\nfunction requireString(value: unknown, label: string): string {\n if (typeof value === 'string' && value.trim().length > 0) return value\n throw new Error(`Invalid ${label} in workflow seed data.`)\n}\n\nasync function seedWorkflowDefinition(\n em: EntityManager,\n scope: WorkflowSeedScope,\n fileName: string,\n): Promise<boolean> {\n const seed = readExampleJson<WorkflowSeedDefinition>(fileName)\n const workflowId = requireString(seed.workflowId, 'workflowId')\n\n // Version-aware: pin to the latest version so re-seeding never updates an\n // older coexisting version row (workflowId is no longer unique per tenant).\n const existing = await em.findOne(WorkflowDefinition, {\n workflowId,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n }, { orderBy: { version: 'DESC' } })\n\n if (existing) {\n // Check if the definition needs to be updated by comparing steps and transitions\n const seedStepCount = seed.definition.steps.length\n const existingStepCount = existing.definition.steps.length\n const seedTransitionCount = seed.definition.transitions.length\n const existingTransitionCount = existing.definition.transitions.length\n\n // Check for preConditions on transitions\n const seedHasTransitionPreConditions = seed.definition.transitions.some(\n (t: any) => t.preConditions && t.preConditions.length > 0\n )\n const existingHasTransitionPreConditions = existing.definition.transitions.some(\n (t: any) => t.preConditions && t.preConditions.length > 0\n )\n\n // Check for preConditions on START step\n const seedStartStep = seed.definition.steps.find((s: any) => s.stepType === 'START')\n const existingStartStep = existing.definition.steps.find((s: any) => s.stepType === 'START')\n const seedHasStartPreConditions = seedStartStep?.preConditions && seedStartStep.preConditions.length > 0\n const existingHasStartPreConditions = existingStartStep?.preConditions && existingStartStep.preConditions.length > 0\n\n // Update if structure has changed\n const needsUpdate =\n seedStepCount !== existingStepCount ||\n seedTransitionCount !== existingTransitionCount ||\n (seedHasStartPreConditions && !existingHasStartPreConditions) ||\n (seedHasTransitionPreConditions && !existingHasTransitionPreConditions)\n\n if (needsUpdate) {\n logger.info('Updating seeded workflow', {\n component: 'seed',\n workflowId,\n existingStepCount,\n seedStepCount,\n existingTransitionCount,\n seedTransitionCount,\n })\n existing.definition = seed.definition\n await em.flush()\n return true\n }\n\n return false\n }\n\n const workflow = em.create(WorkflowDefinition, {\n ...seed,\n workflowId,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n em.persist(workflow)\n await em.flush()\n return true\n}\n\nasync function seedGuardRules(\n em: EntityManager,\n scope: WorkflowSeedScope,\n fileName: string,\n cache?: RuleDiscoveryCache | null,\n): Promise<{ seeded: number; skipped: number; updated: number }> {\n const seeds = readExampleJson<GuardRuleSeed[]>(fileName)\n if (!Array.isArray(seeds)) {\n throw new Error('Invalid guard rules seed data.')\n }\n\n let seeded = 0\n let skipped = 0\n let updated = 0\n for (const rule of seeds) {\n const ruleId = requireString(rule.ruleId, 'ruleId')\n const existing = await em.findOne(BusinessRule, {\n ruleId,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n if (existing) {\n // Check if entityType or eventType needs updating\n const needsUpdate = existing.entityType !== rule.entityType || existing.eventType !== rule.eventType\n if (needsUpdate) {\n logger.info('Updating seeded business rule', {\n component: 'seed',\n ruleId,\n entityType: rule.entityType,\n eventType: rule.eventType,\n })\n existing.entityType = rule.entityType\n existing.eventType = rule.eventType ?? null\n updated += 1\n } else {\n skipped += 1\n }\n continue\n }\n const entry = em.create(BusinessRule, {\n ruleId,\n ruleName: rule.ruleName,\n ruleType: rule.ruleType,\n entityType: rule.entityType,\n conditionExpression: rule.conditionExpression,\n eventType: rule.eventType,\n ruleCategory: rule.ruleCategory,\n description: rule.description,\n successActions: rule.successActions,\n failureActions: rule.failureActions,\n enabled: rule.enabled,\n priority: rule.priority,\n version: rule.version,\n effectiveFrom: rule.effectiveFrom,\n effectiveTo: rule.effectiveTo,\n createdBy: rule.createdBy,\n updatedBy: rule.updatedBy,\n tenantId: scope.tenantId,\n organizationId: scope.organizationId,\n })\n em.persist(entry)\n seeded += 1\n }\n if (seeded > 0 || updated > 0) {\n await em.flush()\n await invalidateBusinessRuleDiscoveryCache(cache, scope.tenantId, scope.organizationId)\n }\n return { seeded, skipped, updated }\n}\n\nexport async function seedExampleWorkflows(\n em: EntityManager,\n scope: WorkflowSeedScope,\n options: { cache?: RuleDiscoveryCache | null } = {},\n): Promise<void> {\n // workflows.checkout-demo and workflows.simple-approval are now code-defined\n // (see packages/core/src/modules/workflows/workflows.ts). Seeding DB rows for\n // them would shadow the code definitions in the merge layer, so they are no\n // longer seeded here. Existing tenants are migrated via Migration20260428102318.\n await seedGuardRules(em, scope, 'guard-rules-example.json', options.cache)\n await seedWorkflowDefinition(em, scope, 'sales-pipeline-definition.json')\n await seedGuardRules(em, scope, 'order-approval-guard-rules.json', options.cache)\n}\n"],
|
|
5
|
+
"mappings": "AACA,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,SAAS,qBAAqB;AAC9B,SAAS,0BAAuD;AAChE,SAAS,oBAAmC;AAC5C;AAAA,EACE;AAAA,OAEK;AACP,SAAS,oBAAoB;AAE7B,MAAM,SAAS,aAAa,WAAW;AAEvC,MAAM,eAAe,KAAK,QAAQ,cAAc,YAAY,GAAG,CAAC;AAwChE,SAAS,gBAAmB,UAAqB;AAC/C,QAAM,aAAa;AAAA,IACjB,KAAK,KAAK,cAAc,MAAM,YAAY,QAAQ;AAAA,IAClD,KAAK,KAAK,QAAQ,IAAI,GAAG,YAAY,QAAQ,OAAO,WAAW,aAAa,YAAY,QAAQ;AAAA,IAChG,KAAK,KAAK,QAAQ,IAAI,GAAG,OAAO,WAAW,aAAa,YAAY,QAAQ;AAAA,EAC9E;AACA,QAAM,WAAW,WAAW,KAAK,CAAC,cAAc,GAAG,WAAW,SAAS,CAAC;AACxE,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,MAAM,+BAA+B,QAAQ,EAAE;AAAA,EAC3D;AACA,SAAO,KAAK,MAAM,GAAG,aAAa,UAAU,MAAM,CAAC;AACrD;AAEA,SAAS,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