@decaf-ts/as-graph 0.0.0-stage → 0.2.1
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/LICENSE.md +21 -0
- package/README.md +525 -2
- package/assets/i18n/en.json +683 -0
- package/dist/as-graph.cjs +2 -0
- package/dist/as-graph.cjs.map +1 -0
- package/dist/as-graph.js +2 -0
- package/dist/as-graph.js.map +1 -0
- package/lib/cjs/engine/auth/GraphAuth.cjs +130 -0
- package/lib/cjs/engine/auth/GraphAuth.cjs.map +1 -0
- package/lib/cjs/engine/auth/GraphAuthValidator.cjs +79 -0
- package/lib/cjs/engine/auth/GraphAuthValidator.cjs.map +1 -0
- package/lib/cjs/engine/auth/GraphNamespace.cjs +104 -0
- package/lib/cjs/engine/auth/GraphNamespace.cjs.map +1 -0
- package/lib/cjs/engine/auth/index.cjs +25 -0
- package/lib/cjs/engine/auth/index.cjs.map +1 -0
- package/lib/cjs/engine/catalog/GraphBuiltInRegistrations.cjs +57 -0
- package/lib/cjs/engine/catalog/GraphBuiltInRegistrations.cjs.map +1 -0
- package/lib/cjs/engine/catalog/GraphCatalogueErrors.cjs +29 -0
- package/lib/cjs/engine/catalog/GraphCatalogueErrors.cjs.map +1 -0
- package/lib/cjs/engine/catalog/GraphNodeCatalogue.cjs +331 -0
- package/lib/cjs/engine/catalog/GraphNodeCatalogue.cjs.map +1 -0
- package/lib/cjs/engine/catalog/GraphNodeManifestResolver.cjs +192 -0
- package/lib/cjs/engine/catalog/GraphNodeManifestResolver.cjs.map +1 -0
- package/lib/cjs/engine/catalog/GraphNodeMethodRegistry.cjs +64 -0
- package/lib/cjs/engine/catalog/GraphNodeMethodRegistry.cjs.map +1 -0
- package/lib/cjs/engine/catalog/GraphNodeRegistration.cjs +17 -0
- package/lib/cjs/engine/catalog/GraphNodeRegistration.cjs.map +1 -0
- package/lib/cjs/engine/catalog/index.cjs +27 -0
- package/lib/cjs/engine/catalog/index.cjs.map +1 -0
- package/lib/cjs/engine/constants.cjs +78 -0
- package/lib/cjs/engine/constants.cjs.map +1 -0
- package/lib/cjs/engine/decorators.cjs +4 -0
- package/lib/cjs/engine/decorators.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphBreakSignal.cjs +37 -0
- package/lib/cjs/engine/errors/GraphBreakSignal.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphCycleError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphCycleError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphExecutionError.cjs +28 -0
- package/lib/cjs/engine/errors/GraphExecutionError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphInputError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphInputError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphLoopLimitError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphLoopLimitError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphPinningError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphPinningError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphPortError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphPortError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphRunCancelledError.cjs +18 -0
- package/lib/cjs/engine/errors/GraphRunCancelledError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphStoreError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphStoreError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphTopologyError.cjs +20 -0
- package/lib/cjs/engine/errors/GraphTopologyError.cjs.map +1 -0
- package/lib/cjs/engine/errors/GraphWorkflowErrors.cjs +23 -0
- package/lib/cjs/engine/errors/GraphWorkflowErrors.cjs.map +1 -0
- package/lib/cjs/engine/errors/index.cjs +33 -0
- package/lib/cjs/engine/errors/index.cjs.map +1 -0
- package/lib/cjs/engine/events/GraphExecutionEventEmitter.cjs +40 -0
- package/lib/cjs/engine/events/GraphExecutionEventEmitter.cjs.map +1 -0
- package/lib/cjs/engine/events/GraphExecutionEventFactory.cjs +45 -0
- package/lib/cjs/engine/events/GraphExecutionEventFactory.cjs.map +1 -0
- package/lib/cjs/engine/events/GraphExecutionObserver.cjs +4 -0
- package/lib/cjs/engine/events/GraphExecutionObserver.cjs.map +1 -0
- package/lib/cjs/engine/events/index.cjs +26 -0
- package/lib/cjs/engine/events/index.cjs.map +1 -0
- package/lib/cjs/engine/execution/CodeSandboxEvaluator.cjs +4 -0
- package/lib/cjs/engine/execution/CodeSandboxEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionContext.cjs +159 -0
- package/lib/cjs/engine/execution/GraphExecutionContext.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +1042 -0
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionFrame.cjs +50 -0
- package/lib/cjs/engine/execution/GraphExecutionFrame.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionResult.cjs +30 -0
- package/lib/cjs/engine/execution/GraphExecutionResult.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphNodeExecutor.cjs +4 -0
- package/lib/cjs/engine/execution/GraphNodeExecutor.cjs.map +1 -0
- package/lib/cjs/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs +574 -0
- package/lib/cjs/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/execution/index.cjs +30 -0
- package/lib/cjs/engine/execution/index.cjs.map +1 -0
- package/lib/cjs/engine/index.cjs +85 -0
- package/lib/cjs/engine/index.cjs.map +1 -0
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs +116 -0
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/loops/ConditionExpressionEvaluator.cjs +87 -0
- package/lib/cjs/engine/loops/ConditionExpressionEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs +110 -0
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/loops/GraphLoopExecutionContext.cjs +16 -0
- package/lib/cjs/engine/loops/GraphLoopExecutionContext.cjs.map +1 -0
- package/lib/cjs/engine/loops/index.cjs +27 -0
- package/lib/cjs/engine/loops/index.cjs.map +1 -0
- package/lib/cjs/engine/pinning/GraphPinningDependencyResolver.cjs +28 -0
- package/lib/cjs/engine/pinning/GraphPinningDependencyResolver.cjs.map +1 -0
- package/lib/cjs/engine/pinning/GraphPinningMetadata.cjs +20 -0
- package/lib/cjs/engine/pinning/GraphPinningMetadata.cjs.map +1 -0
- package/lib/cjs/engine/pinning/GraphPinningPolicy.cjs +34 -0
- package/lib/cjs/engine/pinning/GraphPinningPolicy.cjs.map +1 -0
- package/lib/cjs/engine/pinning/GraphPinningService.cjs +220 -0
- package/lib/cjs/engine/pinning/GraphPinningService.cjs.map +1 -0
- package/lib/cjs/engine/pinning/index.cjs +27 -0
- package/lib/cjs/engine/pinning/index.cjs.map +1 -0
- package/lib/cjs/engine/planning/GraphExecutionPlan.cjs +4 -0
- package/lib/cjs/engine/planning/GraphExecutionPlan.cjs.map +1 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanEdge.cjs +4 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanEdge.cjs.map +1 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanLayer.cjs +4 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanLayer.cjs.map +1 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanNode.cjs +4 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanNode.cjs.map +1 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanner.cjs +212 -0
- package/lib/cjs/engine/planning/GraphExecutionPlanner.cjs.map +1 -0
- package/lib/cjs/engine/planning/GraphTopology.cjs +57 -0
- package/lib/cjs/engine/planning/GraphTopology.cjs.map +1 -0
- package/lib/cjs/engine/planning/index.cjs +29 -0
- package/lib/cjs/engine/planning/index.cjs.map +1 -0
- package/lib/cjs/engine/registry/GraphNodeExecutorRegistry.cjs +100 -0
- package/lib/cjs/engine/registry/GraphNodeExecutorRegistry.cjs.map +1 -0
- package/lib/cjs/engine/registry/GraphNodeExecutorResolver.cjs +59 -0
- package/lib/cjs/engine/registry/GraphNodeExecutorResolver.cjs.map +1 -0
- package/lib/cjs/engine/registry/index.cjs +25 -0
- package/lib/cjs/engine/registry/index.cjs.map +1 -0
- package/lib/cjs/engine/runs/GraphRunConverters.cjs +58 -0
- package/lib/cjs/engine/runs/GraphRunConverters.cjs.map +1 -0
- package/lib/cjs/engine/runs/GraphRunEventPublisher.cjs +69 -0
- package/lib/cjs/engine/runs/GraphRunEventPublisher.cjs.map +1 -0
- package/lib/cjs/engine/runs/GraphRunExecutor.cjs +291 -0
- package/lib/cjs/engine/runs/GraphRunExecutor.cjs.map +1 -0
- package/lib/cjs/engine/runs/GraphRunFingerprint.cjs +29 -0
- package/lib/cjs/engine/runs/GraphRunFingerprint.cjs.map +1 -0
- package/lib/cjs/engine/runs/GraphRunService.cjs +329 -0
- package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunEventStore.cjs +69 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunEventStore.cjs.map +1 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs +59 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs.map +1 -0
- package/lib/cjs/engine/runs/index.cjs +29 -0
- package/lib/cjs/engine/runs/index.cjs.map +1 -0
- package/lib/cjs/engine/runs/ownership.cjs +123 -0
- package/lib/cjs/engine/runs/ownership.cjs.map +1 -0
- package/lib/cjs/engine/runs/types.cjs +4 -0
- package/lib/cjs/engine/runs/types.cjs.map +1 -0
- package/lib/cjs/engine/services/GraphEnvironment.cjs +32 -0
- package/lib/cjs/engine/services/GraphEnvironment.cjs.map +1 -0
- package/lib/cjs/engine/services/GraphRunModelService.cjs +111 -0
- package/lib/cjs/engine/services/GraphRunModelService.cjs.map +1 -0
- package/lib/cjs/engine/services/GraphWorkflowService.cjs +408 -0
- package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -0
- package/lib/cjs/engine/snapshots/GraphExecutionSnapshotMapper.cjs +53 -0
- package/lib/cjs/engine/snapshots/GraphExecutionSnapshotMapper.cjs.map +1 -0
- package/lib/cjs/engine/snapshots/index.cjs +24 -0
- package/lib/cjs/engine/snapshots/index.cjs.map +1 -0
- package/lib/cjs/engine/store/GraphCachedValue.cjs +4 -0
- package/lib/cjs/engine/store/GraphCachedValue.cjs.map +1 -0
- package/lib/cjs/engine/store/GraphValueKey.cjs +4 -0
- package/lib/cjs/engine/store/GraphValueKey.cjs.map +1 -0
- package/lib/cjs/engine/store/GraphValueModel.cjs +96 -0
- package/lib/cjs/engine/store/GraphValueModel.cjs.map +1 -0
- package/lib/cjs/engine/store/GraphValueRepository.cjs +244 -0
- package/lib/cjs/engine/store/GraphValueRepository.cjs.map +1 -0
- package/lib/cjs/engine/store/index.cjs +28 -0
- package/lib/cjs/engine/store/index.cjs.map +1 -0
- package/lib/cjs/engine/types.cjs +4 -0
- package/lib/cjs/engine/types.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphConnectionPolicyValidator.cjs +142 -0
- package/lib/cjs/engine/validation/GraphConnectionPolicyValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphCredentialReferenceValidator.cjs +160 -0
- package/lib/cjs/engine/validation/GraphCredentialReferenceValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphEdgeInstanceValidator.cjs +166 -0
- package/lib/cjs/engine/validation/GraphEdgeInstanceValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphLooseNodeValidation.cjs +36 -0
- package/lib/cjs/engine/validation/GraphLooseNodeValidation.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs +86 -0
- package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphParameterValidator.cjs +465 -0
- package/lib/cjs/engine/validation/GraphParameterValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphPortSchemaResolver.cjs +58 -0
- package/lib/cjs/engine/validation/GraphPortSchemaResolver.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphResolvedWorkflow.cjs +4 -0
- package/lib/cjs/engine/validation/GraphResolvedWorkflow.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphValidationErrors.cjs +50 -0
- package/lib/cjs/engine/validation/GraphValidationErrors.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphValidationIssue.cjs +4 -0
- package/lib/cjs/engine/validation/GraphValidationIssue.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphValueValidator.cjs +52 -0
- package/lib/cjs/engine/validation/GraphValueValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphWorkflowBoundaryValidation.cjs +171 -0
- package/lib/cjs/engine/validation/GraphWorkflowBoundaryValidation.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphWorkflowDocumentLimits.cjs +12 -0
- package/lib/cjs/engine/validation/GraphWorkflowDocumentLimits.cjs.map +1 -0
- package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs +518 -0
- package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs.map +1 -0
- package/lib/cjs/engine/validation/index.cjs +39 -0
- package/lib/cjs/engine/validation/index.cjs.map +1 -0
- package/lib/cjs/index.cjs +31 -0
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/log/GraphRunLogger.cjs +184 -0
- package/lib/cjs/log/GraphRunLogger.cjs.map +1 -0
- package/lib/cjs/log/LogParameters.cjs +115 -0
- package/lib/cjs/log/LogParameters.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +295 -0
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs +113 -0
- package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs +288 -0
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphRunController.cjs +487 -0
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +271 -0
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -0
- package/lib/cjs/nest/graph/index.cjs +30 -0
- package/lib/cjs/nest/graph/index.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingDates.cjs +53 -0
- package/lib/cjs/nest/graph/servingDates.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingErrors.cjs +65 -0
- package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -0
- package/lib/cjs/nest/index.cjs +28 -0
- package/lib/cjs/nest/index.cjs.map +1 -0
- package/lib/cjs/node/agents/agent/node.cjs +121 -0
- package/lib/cjs/node/agents/agent/node.cjs.map +1 -0
- package/lib/cjs/node/base.cjs +138 -0
- package/lib/cjs/node/base.cjs.map +1 -0
- package/lib/cjs/node/boundary/input/node.cjs +70 -0
- package/lib/cjs/node/boundary/input/node.cjs.map +1 -0
- package/lib/cjs/node/boundary/output/node.cjs +73 -0
- package/lib/cjs/node/boundary/output/node.cjs.map +1 -0
- package/lib/cjs/node/flow/break/node.cjs +80 -0
- package/lib/cjs/node/flow/break/node.cjs.map +1 -0
- package/lib/cjs/node/flow/error-boundary/node.cjs +143 -0
- package/lib/cjs/node/flow/error-boundary/node.cjs.map +1 -0
- package/lib/cjs/node/flow/human-approval/node.cjs +94 -0
- package/lib/cjs/node/flow/human-approval/node.cjs.map +1 -0
- package/lib/cjs/node/flow/if/node.cjs +148 -0
- package/lib/cjs/node/flow/if/node.cjs.map +1 -0
- package/lib/cjs/node/flow/loop/foreach/node.cjs +247 -0
- package/lib/cjs/node/flow/loop/foreach/node.cjs.map +1 -0
- package/lib/cjs/node/flow/loop/loop-metadata.cjs +83 -0
- package/lib/cjs/node/flow/loop/loop-metadata.cjs.map +1 -0
- package/lib/cjs/node/flow/loop/until/node.cjs +198 -0
- package/lib/cjs/node/flow/loop/until/node.cjs.map +1 -0
- package/lib/cjs/node/flow/loop/while/node.cjs +197 -0
- package/lib/cjs/node/flow/loop/while/node.cjs.map +1 -0
- package/lib/cjs/node/flow/switch/node.cjs +221 -0
- package/lib/cjs/node/flow/switch/node.cjs.map +1 -0
- package/lib/cjs/node/index.cjs +158 -0
- package/lib/cjs/node/index.cjs.map +1 -0
- package/lib/cjs/node/manifests.cjs +260 -0
- package/lib/cjs/node/manifests.cjs.map +1 -0
- package/lib/cjs/node/triggers/chat/node.cjs +82 -0
- package/lib/cjs/node/triggers/chat/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/event/node.cjs +67 -0
- package/lib/cjs/node/triggers/event/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/form/node.cjs +80 -0
- package/lib/cjs/node/triggers/form/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/manual/node.cjs +71 -0
- package/lib/cjs/node/triggers/manual/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/schedule/node.cjs +80 -0
- package/lib/cjs/node/triggers/schedule/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/webhook/node.cjs +84 -0
- package/lib/cjs/node/triggers/webhook/node.cjs.map +1 -0
- package/lib/cjs/node/utility/code/node.cjs +223 -0
- package/lib/cjs/node/utility/code/node.cjs.map +1 -0
- package/lib/cjs/node/utility/delay/node.cjs +81 -0
- package/lib/cjs/node/utility/delay/node.cjs.map +1 -0
- package/lib/cjs/node/utility/log/node.cjs +98 -0
- package/lib/cjs/node/utility/log/node.cjs.map +1 -0
- package/lib/cjs/node/utility/map/node.cjs +75 -0
- package/lib/cjs/node/utility/map/node.cjs.map +1 -0
- package/lib/cjs/node/utility/utility-log/node.cjs +96 -0
- package/lib/cjs/node/utility/utility-log/node.cjs.map +1 -0
- package/lib/cjs/ram/GraphRunEventModel.cjs +134 -0
- package/lib/cjs/ram/GraphRunEventModel.cjs.map +1 -0
- package/lib/cjs/ram/GraphRunEventStore.cjs +141 -0
- package/lib/cjs/ram/GraphRunEventStore.cjs.map +1 -0
- package/lib/cjs/ram/GraphRunStore.cjs +112 -0
- package/lib/cjs/ram/GraphRunStore.cjs.map +1 -0
- package/lib/cjs/ram/index.cjs +57 -0
- package/lib/cjs/ram/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/GraphExecutionStateMapper.cjs +97 -0
- package/lib/cjs/shared/graph/GraphExecutionStateMapper.cjs.map +1 -0
- package/lib/cjs/shared/graph/GraphResolution.cjs +21 -0
- package/lib/cjs/shared/graph/GraphResolution.cjs.map +1 -0
- package/lib/cjs/shared/graph/GraphRunModel.cjs +140 -0
- package/lib/cjs/shared/graph/GraphRunModel.cjs.map +1 -0
- package/lib/cjs/shared/graph/GraphWorkflowModel.cjs +66 -0
- package/lib/cjs/shared/graph/GraphWorkflowModel.cjs.map +1 -0
- package/lib/cjs/shared/graph/auth.cjs +106 -0
- package/lib/cjs/shared/graph/auth.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphConnectionPolicy.cjs +24 -0
- package/lib/cjs/shared/graph/catalog/GraphConnectionPolicy.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphCredentialReference.cjs +19 -0
- package/lib/cjs/shared/graph/catalog/GraphCredentialReference.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphCredentialRequirement.cjs +20 -0
- package/lib/cjs/shared/graph/catalog/GraphCredentialRequirement.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphDynamicPortRule.cjs +42 -0
- package/lib/cjs/shared/graph/catalog/GraphDynamicPortRule.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphIconReference.cjs +26 -0
- package/lib/cjs/shared/graph/catalog/GraphIconReference.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +390 -0
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeCapability.cjs +34 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeCapability.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeDisplayManifest.cjs +15 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeDisplayManifest.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeManifest.cjs +33 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeManifest.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeManifestSerialization.cjs +65 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeManifestSerialization.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeMethodManifest.cjs +40 -0
- package/lib/cjs/shared/graph/catalog/GraphNodeMethodManifest.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphNodePolicyManifest.cjs +18 -0
- package/lib/cjs/shared/graph/catalog/GraphNodePolicyManifest.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterBase.cjs +4 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterBase.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterDefinition.cjs +40 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterDefinition.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterOption.cjs +26 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterOption.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterValidation.cjs +72 -0
- package/lib/cjs/shared/graph/catalog/GraphParameterValidation.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphPortManifest.cjs +32 -0
- package/lib/cjs/shared/graph/catalog/GraphPortManifest.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphPortManifestElement.cjs +19 -0
- package/lib/cjs/shared/graph/catalog/GraphPortManifestElement.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphResourceLocatorMode.cjs +30 -0
- package/lib/cjs/shared/graph/catalog/GraphResourceLocatorMode.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphValueSchema.cjs +36 -0
- package/lib/cjs/shared/graph/catalog/GraphValueSchema.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs +186 -0
- package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/GraphVisibilityExpression.cjs +70 -0
- package/lib/cjs/shared/graph/catalog/GraphVisibilityExpression.cjs.map +1 -0
- package/lib/cjs/shared/graph/catalog/index.cjs +43 -0
- package/lib/cjs/shared/graph/catalog/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/category-styles.cjs +38 -0
- package/lib/cjs/shared/graph/category-styles.cjs.map +1 -0
- package/lib/cjs/shared/graph/constants.cjs +333 -0
- package/lib/cjs/shared/graph/constants.cjs.map +1 -0
- package/lib/cjs/shared/graph/decorators.cjs +205 -0
- package/lib/cjs/shared/graph/decorators.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphDecoratedWorkflowCompiler.cjs +407 -0
- package/lib/cjs/shared/graph/document/GraphDecoratedWorkflowCompiler.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphEdgeInstance.cjs +4 -0
- package/lib/cjs/shared/graph/document/GraphEdgeInstance.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphEndpoint.cjs +39 -0
- package/lib/cjs/shared/graph/document/GraphEndpoint.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphErrorBoundaryConfiguration.cjs +4 -0
- package/lib/cjs/shared/graph/document/GraphErrorBoundaryConfiguration.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphFlowBuilder.cjs +771 -0
- package/lib/cjs/shared/graph/document/GraphFlowBuilder.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphJsonValue.cjs +103 -0
- package/lib/cjs/shared/graph/document/GraphJsonValue.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphLoopConfiguration.cjs +4 -0
- package/lib/cjs/shared/graph/document/GraphLoopConfiguration.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphNodeBinding.cjs +35 -0
- package/lib/cjs/shared/graph/document/GraphNodeBinding.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphNodeDerivation.cjs +153 -0
- package/lib/cjs/shared/graph/document/GraphNodeDerivation.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphNodeInstance.cjs +4 -0
- package/lib/cjs/shared/graph/document/GraphNodeInstance.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphValueTemplate.cjs +97 -0
- package/lib/cjs/shared/graph/document/GraphValueTemplate.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocument.cjs +27 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocument.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocumentBuilder.cjs +439 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocumentBuilder.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocumentReader.cjs +119 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocumentReader.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocumentSerializer.cjs +82 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowDocumentSerializer.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowUiState.cjs +4 -0
- package/lib/cjs/shared/graph/document/GraphWorkflowUiState.cjs.map +1 -0
- package/lib/cjs/shared/graph/document/index.cjs +37 -0
- package/lib/cjs/shared/graph/document/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/index.cjs +39 -0
- package/lib/cjs/shared/graph/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/overrides/Metadata.cjs +23 -0
- package/lib/cjs/shared/graph/overrides/Metadata.cjs.map +1 -0
- package/lib/cjs/shared/graph/overrides/Rendering.cjs +4 -0
- package/lib/cjs/shared/graph/overrides/Rendering.cjs.map +1 -0
- package/lib/cjs/shared/graph/overrides/index.cjs +24 -0
- package/lib/cjs/shared/graph/overrides/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/overrides/overrides.cjs +20 -0
- package/lib/cjs/shared/graph/overrides/overrides.cjs.map +1 -0
- package/lib/cjs/shared/graph/reader.cjs +392 -0
- package/lib/cjs/shared/graph/reader.cjs.map +1 -0
- package/lib/cjs/shared/graph/registry.cjs +67 -0
- package/lib/cjs/shared/graph/registry.cjs.map +1 -0
- package/lib/cjs/shared/graph/snapshot.cjs +4 -0
- package/lib/cjs/shared/graph/snapshot.cjs.map +1 -0
- package/lib/cjs/shared/graph/types.cjs +7 -0
- package/lib/cjs/shared/graph/types.cjs.map +1 -0
- package/lib/cjs/shared/index.cjs +30 -0
- package/lib/cjs/shared/index.cjs.map +1 -0
- package/lib/cjs/shared/ui/GraphNodeView.cjs +114 -0
- package/lib/cjs/shared/ui/GraphNodeView.cjs.map +1 -0
- package/lib/cjs/shared/ui/GraphRunView.cjs +96 -0
- package/lib/cjs/shared/ui/GraphRunView.cjs.map +1 -0
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs +78 -0
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs.map +1 -0
- package/lib/cjs/shared/ui/constants.cjs +73 -0
- package/lib/cjs/shared/ui/constants.cjs.map +1 -0
- package/lib/cjs/shared/ui/index.cjs +32 -0
- package/lib/cjs/shared/ui/index.cjs.map +1 -0
- package/lib/cjs/shared/ui/types.cjs +4 -0
- package/lib/cjs/shared/ui/types.cjs.map +1 -0
- package/lib/esm/engine/auth/GraphAuth.js +123 -0
- package/lib/esm/engine/auth/GraphAuth.js.map +1 -0
- package/lib/esm/engine/auth/GraphAuthValidator.js +74 -0
- package/lib/esm/engine/auth/GraphAuthValidator.js.map +1 -0
- package/lib/esm/engine/auth/GraphNamespace.js +93 -0
- package/lib/esm/engine/auth/GraphNamespace.js.map +1 -0
- package/lib/esm/engine/auth/index.js +8 -0
- package/lib/esm/engine/auth/index.js.map +1 -0
- package/lib/esm/engine/catalog/GraphBuiltInRegistrations.js +52 -0
- package/lib/esm/engine/catalog/GraphBuiltInRegistrations.js.map +1 -0
- package/lib/esm/engine/catalog/GraphCatalogueErrors.js +22 -0
- package/lib/esm/engine/catalog/GraphCatalogueErrors.js.map +1 -0
- package/lib/esm/engine/catalog/GraphNodeCatalogue.js +322 -0
- package/lib/esm/engine/catalog/GraphNodeCatalogue.js.map +1 -0
- package/lib/esm/engine/catalog/GraphNodeManifestResolver.js +185 -0
- package/lib/esm/engine/catalog/GraphNodeManifestResolver.js.map +1 -0
- package/lib/esm/engine/catalog/GraphNodeMethodRegistry.js +59 -0
- package/lib/esm/engine/catalog/GraphNodeMethodRegistry.js.map +1 -0
- package/lib/esm/engine/catalog/GraphNodeRegistration.js +12 -0
- package/lib/esm/engine/catalog/GraphNodeRegistration.js.map +1 -0
- package/lib/esm/engine/catalog/index.js +10 -0
- package/lib/esm/engine/catalog/index.js.map +1 -0
- package/lib/esm/engine/constants.js +82 -0
- package/lib/esm/engine/constants.js.map +1 -0
- package/lib/esm/engine/decorators.js +2 -0
- package/lib/esm/engine/decorators.js.map +1 -0
- package/lib/esm/engine/errors/GraphBreakSignal.js +32 -0
- package/lib/esm/engine/errors/GraphBreakSignal.js.map +1 -0
- package/lib/esm/engine/errors/GraphCycleError.js +15 -0
- package/lib/esm/engine/errors/GraphCycleError.js.map +1 -0
- package/lib/esm/engine/errors/GraphExecutionError.js +23 -0
- package/lib/esm/engine/errors/GraphExecutionError.js.map +1 -0
- package/lib/esm/engine/errors/GraphInputError.js +15 -0
- package/lib/esm/engine/errors/GraphInputError.js.map +1 -0
- package/lib/esm/engine/errors/GraphLoopLimitError.js +15 -0
- package/lib/esm/engine/errors/GraphLoopLimitError.js.map +1 -0
- package/lib/esm/engine/errors/GraphPinningError.js +15 -0
- package/lib/esm/engine/errors/GraphPinningError.js.map +1 -0
- package/lib/esm/engine/errors/GraphPortError.js +15 -0
- package/lib/esm/engine/errors/GraphPortError.js.map +1 -0
- package/lib/esm/engine/errors/GraphRunCancelledError.js +13 -0
- package/lib/esm/engine/errors/GraphRunCancelledError.js.map +1 -0
- package/lib/esm/engine/errors/GraphStoreError.js +15 -0
- package/lib/esm/engine/errors/GraphStoreError.js.map +1 -0
- package/lib/esm/engine/errors/GraphTopologyError.js +15 -0
- package/lib/esm/engine/errors/GraphTopologyError.js.map +1 -0
- package/lib/esm/engine/errors/GraphWorkflowErrors.js +18 -0
- package/lib/esm/engine/errors/GraphWorkflowErrors.js.map +1 -0
- package/lib/esm/engine/errors/index.js +16 -0
- package/lib/esm/engine/errors/index.js.map +1 -0
- package/lib/esm/engine/events/GraphExecutionEventEmitter.js +35 -0
- package/lib/esm/engine/events/GraphExecutionEventEmitter.js.map +1 -0
- package/lib/esm/engine/events/GraphExecutionEventFactory.js +40 -0
- package/lib/esm/engine/events/GraphExecutionEventFactory.js.map +1 -0
- package/lib/esm/engine/events/GraphExecutionObserver.js +2 -0
- package/lib/esm/engine/events/GraphExecutionObserver.js.map +1 -0
- package/lib/esm/engine/events/index.js +9 -0
- package/lib/esm/engine/events/index.js.map +1 -0
- package/lib/esm/engine/execution/CodeSandboxEvaluator.js +18 -0
- package/lib/esm/engine/execution/CodeSandboxEvaluator.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionContext.js +154 -0
- package/lib/esm/engine/execution/GraphExecutionContext.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionEngine.js +1037 -0
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionFrame.js +45 -0
- package/lib/esm/engine/execution/GraphExecutionFrame.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionResult.js +26 -0
- package/lib/esm/engine/execution/GraphExecutionResult.js.map +1 -0
- package/lib/esm/engine/execution/GraphNodeExecutor.js +2 -0
- package/lib/esm/engine/execution/GraphNodeExecutor.js.map +1 -0
- package/lib/esm/engine/execution/IsolatedVmCodeSandboxEvaluator.js +533 -0
- package/lib/esm/engine/execution/IsolatedVmCodeSandboxEvaluator.js.map +1 -0
- package/lib/esm/engine/execution/index.js +13 -0
- package/lib/esm/engine/execution/index.js.map +1 -0
- package/lib/esm/engine/index.js +68 -0
- package/lib/esm/engine/index.js.map +1 -0
- package/lib/esm/engine/loops/ConditionEvaluator.js +108 -0
- package/lib/esm/engine/loops/ConditionEvaluator.js.map +1 -0
- package/lib/esm/engine/loops/ConditionExpressionEvaluator.js +82 -0
- package/lib/esm/engine/loops/ConditionExpressionEvaluator.js.map +1 -0
- package/lib/esm/engine/loops/GraphConditionEvaluator.js +105 -0
- package/lib/esm/engine/loops/GraphConditionEvaluator.js.map +1 -0
- package/lib/esm/engine/loops/GraphLoopExecutionContext.js +11 -0
- package/lib/esm/engine/loops/GraphLoopExecutionContext.js.map +1 -0
- package/lib/esm/engine/loops/index.js +10 -0
- package/lib/esm/engine/loops/index.js.map +1 -0
- package/lib/esm/engine/pinning/GraphPinningDependencyResolver.js +23 -0
- package/lib/esm/engine/pinning/GraphPinningDependencyResolver.js.map +1 -0
- package/lib/esm/engine/pinning/GraphPinningMetadata.js +15 -0
- package/lib/esm/engine/pinning/GraphPinningMetadata.js.map +1 -0
- package/lib/esm/engine/pinning/GraphPinningPolicy.js +29 -0
- package/lib/esm/engine/pinning/GraphPinningPolicy.js.map +1 -0
- package/lib/esm/engine/pinning/GraphPinningService.js +215 -0
- package/lib/esm/engine/pinning/GraphPinningService.js.map +1 -0
- package/lib/esm/engine/pinning/index.js +10 -0
- package/lib/esm/engine/pinning/index.js.map +1 -0
- package/lib/esm/engine/planning/GraphExecutionPlan.js +2 -0
- package/lib/esm/engine/planning/GraphExecutionPlan.js.map +1 -0
- package/lib/esm/engine/planning/GraphExecutionPlanEdge.js +9 -0
- package/lib/esm/engine/planning/GraphExecutionPlanEdge.js.map +1 -0
- package/lib/esm/engine/planning/GraphExecutionPlanLayer.js +2 -0
- package/lib/esm/engine/planning/GraphExecutionPlanLayer.js.map +1 -0
- package/lib/esm/engine/planning/GraphExecutionPlanNode.js +2 -0
- package/lib/esm/engine/planning/GraphExecutionPlanNode.js.map +1 -0
- package/lib/esm/engine/planning/GraphExecutionPlanner.js +203 -0
- package/lib/esm/engine/planning/GraphExecutionPlanner.js.map +1 -0
- package/lib/esm/engine/planning/GraphTopology.js +52 -0
- package/lib/esm/engine/planning/GraphTopology.js.map +1 -0
- package/lib/esm/engine/planning/index.js +12 -0
- package/lib/esm/engine/planning/index.js.map +1 -0
- package/lib/esm/engine/registry/GraphNodeExecutorRegistry.js +91 -0
- package/lib/esm/engine/registry/GraphNodeExecutorRegistry.js.map +1 -0
- package/lib/esm/engine/registry/GraphNodeExecutorResolver.js +50 -0
- package/lib/esm/engine/registry/GraphNodeExecutorResolver.js.map +1 -0
- package/lib/esm/engine/registry/index.js +8 -0
- package/lib/esm/engine/registry/index.js.map +1 -0
- package/lib/esm/engine/runs/GraphRunConverters.js +53 -0
- package/lib/esm/engine/runs/GraphRunConverters.js.map +1 -0
- package/lib/esm/engine/runs/GraphRunEventPublisher.js +64 -0
- package/lib/esm/engine/runs/GraphRunEventPublisher.js.map +1 -0
- package/lib/esm/engine/runs/GraphRunExecutor.js +286 -0
- package/lib/esm/engine/runs/GraphRunExecutor.js.map +1 -0
- package/lib/esm/engine/runs/GraphRunFingerprint.js +25 -0
- package/lib/esm/engine/runs/GraphRunFingerprint.js.map +1 -0
- package/lib/esm/engine/runs/GraphRunService.js +324 -0
- package/lib/esm/engine/runs/GraphRunService.js.map +1 -0
- package/lib/esm/engine/runs/InMemoryGraphRunEventStore.js +64 -0
- package/lib/esm/engine/runs/InMemoryGraphRunEventStore.js.map +1 -0
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js +54 -0
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js.map +1 -0
- package/lib/esm/engine/runs/index.js +12 -0
- package/lib/esm/engine/runs/index.js.map +1 -0
- package/lib/esm/engine/runs/ownership.js +116 -0
- package/lib/esm/engine/runs/ownership.js.map +1 -0
- package/lib/esm/engine/runs/types.js +2 -0
- package/lib/esm/engine/runs/types.js.map +1 -0
- package/lib/esm/engine/services/GraphEnvironment.js +28 -0
- package/lib/esm/engine/services/GraphEnvironment.js.map +1 -0
- package/lib/esm/engine/services/GraphRunModelService.js +102 -0
- package/lib/esm/engine/services/GraphRunModelService.js.map +1 -0
- package/lib/esm/engine/services/GraphWorkflowService.js +398 -0
- package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -0
- package/lib/esm/engine/snapshots/GraphExecutionSnapshotMapper.js +48 -0
- package/lib/esm/engine/snapshots/GraphExecutionSnapshotMapper.js.map +1 -0
- package/lib/esm/engine/snapshots/index.js +7 -0
- package/lib/esm/engine/snapshots/index.js.map +1 -0
- package/lib/esm/engine/store/GraphCachedValue.js +2 -0
- package/lib/esm/engine/store/GraphCachedValue.js.map +1 -0
- package/lib/esm/engine/store/GraphValueKey.js +7 -0
- package/lib/esm/engine/store/GraphValueKey.js.map +1 -0
- package/lib/esm/engine/store/GraphValueModel.js +87 -0
- package/lib/esm/engine/store/GraphValueModel.js.map +1 -0
- package/lib/esm/engine/store/GraphValueRepository.js +233 -0
- package/lib/esm/engine/store/GraphValueRepository.js.map +1 -0
- package/lib/esm/engine/store/index.js +11 -0
- package/lib/esm/engine/store/index.js.map +1 -0
- package/lib/esm/engine/types.js +2 -0
- package/lib/esm/engine/types.js.map +1 -0
- package/lib/esm/engine/validation/GraphConnectionPolicyValidator.js +137 -0
- package/lib/esm/engine/validation/GraphConnectionPolicyValidator.js.map +1 -0
- package/lib/esm/engine/validation/GraphCredentialReferenceValidator.js +155 -0
- package/lib/esm/engine/validation/GraphCredentialReferenceValidator.js.map +1 -0
- package/lib/esm/engine/validation/GraphEdgeInstanceValidator.js +161 -0
- package/lib/esm/engine/validation/GraphEdgeInstanceValidator.js.map +1 -0
- package/lib/esm/engine/validation/GraphLooseNodeValidation.js +32 -0
- package/lib/esm/engine/validation/GraphLooseNodeValidation.js.map +1 -0
- package/lib/esm/engine/validation/GraphNodeInstanceValidator.js +81 -0
- package/lib/esm/engine/validation/GraphNodeInstanceValidator.js.map +1 -0
- package/lib/esm/engine/validation/GraphParameterValidator.js +458 -0
- package/lib/esm/engine/validation/GraphParameterValidator.js.map +1 -0
- package/lib/esm/engine/validation/GraphPortSchemaResolver.js +53 -0
- package/lib/esm/engine/validation/GraphPortSchemaResolver.js.map +1 -0
- package/lib/esm/engine/validation/GraphResolvedWorkflow.js +2 -0
- package/lib/esm/engine/validation/GraphResolvedWorkflow.js.map +1 -0
- package/lib/esm/engine/validation/GraphValidationErrors.js +43 -0
- package/lib/esm/engine/validation/GraphValidationErrors.js.map +1 -0
- package/lib/esm/engine/validation/GraphValidationIssue.js +2 -0
- package/lib/esm/engine/validation/GraphValidationIssue.js.map +1 -0
- package/lib/esm/engine/validation/GraphValueValidator.js +47 -0
- package/lib/esm/engine/validation/GraphValueValidator.js.map +1 -0
- package/lib/esm/engine/validation/GraphWorkflowBoundaryValidation.js +166 -0
- package/lib/esm/engine/validation/GraphWorkflowBoundaryValidation.js.map +1 -0
- package/lib/esm/engine/validation/GraphWorkflowDocumentLimits.js +8 -0
- package/lib/esm/engine/validation/GraphWorkflowDocumentLimits.js.map +1 -0
- package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js +512 -0
- package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js.map +1 -0
- package/lib/esm/engine/validation/index.js +22 -0
- package/lib/esm/engine/validation/index.js.map +1 -0
- package/lib/esm/index.js +14 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/log/GraphRunLogger.js +179 -0
- package/lib/esm/log/GraphRunLogger.js.map +1 -0
- package/lib/esm/log/LogParameters.js +111 -0
- package/lib/esm/log/LogParameters.js.map +1 -0
- package/lib/esm/nest/graph/GraphExecutionModule.js +287 -0
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -0
- package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js +106 -0
- package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js.map +1 -0
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js +279 -0
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js.map +1 -0
- package/lib/esm/nest/graph/GraphRunController.js +478 -0
- package/lib/esm/nest/graph/GraphRunController.js.map +1 -0
- package/lib/esm/nest/graph/GraphWorkflowController.js +262 -0
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -0
- package/lib/esm/nest/graph/index.js +13 -0
- package/lib/esm/nest/graph/index.js.map +1 -0
- package/lib/esm/nest/graph/servingDates.js +49 -0
- package/lib/esm/nest/graph/servingDates.js.map +1 -0
- package/lib/esm/nest/graph/servingErrors.js +60 -0
- package/lib/esm/nest/graph/servingErrors.js.map +1 -0
- package/lib/esm/nest/index.js +11 -0
- package/lib/esm/nest/index.js.map +1 -0
- package/lib/esm/node/agents/agent/node.js +112 -0
- package/lib/esm/node/agents/agent/node.js.map +1 -0
- package/lib/esm/node/base.js +132 -0
- package/lib/esm/node/base.js.map +1 -0
- package/lib/esm/node/boundary/input/node.js +61 -0
- package/lib/esm/node/boundary/input/node.js.map +1 -0
- package/lib/esm/node/boundary/output/node.js +64 -0
- package/lib/esm/node/boundary/output/node.js.map +1 -0
- package/lib/esm/node/flow/break/node.js +71 -0
- package/lib/esm/node/flow/break/node.js.map +1 -0
- package/lib/esm/node/flow/error-boundary/node.js +134 -0
- package/lib/esm/node/flow/error-boundary/node.js.map +1 -0
- package/lib/esm/node/flow/human-approval/node.js +85 -0
- package/lib/esm/node/flow/human-approval/node.js.map +1 -0
- package/lib/esm/node/flow/if/node.js +139 -0
- package/lib/esm/node/flow/if/node.js.map +1 -0
- package/lib/esm/node/flow/loop/foreach/node.js +238 -0
- package/lib/esm/node/flow/loop/foreach/node.js.map +1 -0
- package/lib/esm/node/flow/loop/loop-metadata.js +78 -0
- package/lib/esm/node/flow/loop/loop-metadata.js.map +1 -0
- package/lib/esm/node/flow/loop/until/node.js +189 -0
- package/lib/esm/node/flow/loop/until/node.js.map +1 -0
- package/lib/esm/node/flow/loop/while/node.js +188 -0
- package/lib/esm/node/flow/loop/while/node.js.map +1 -0
- package/lib/esm/node/flow/switch/node.js +212 -0
- package/lib/esm/node/flow/switch/node.js.map +1 -0
- package/lib/esm/node/index.js +140 -0
- package/lib/esm/node/index.js.map +1 -0
- package/lib/esm/node/manifests.js +256 -0
- package/lib/esm/node/manifests.js.map +1 -0
- package/lib/esm/node/triggers/chat/node.js +73 -0
- package/lib/esm/node/triggers/chat/node.js.map +1 -0
- package/lib/esm/node/triggers/event/node.js +58 -0
- package/lib/esm/node/triggers/event/node.js.map +1 -0
- package/lib/esm/node/triggers/form/node.js +71 -0
- package/lib/esm/node/triggers/form/node.js.map +1 -0
- package/lib/esm/node/triggers/manual/node.js +62 -0
- package/lib/esm/node/triggers/manual/node.js.map +1 -0
- package/lib/esm/node/triggers/schedule/node.js +71 -0
- package/lib/esm/node/triggers/schedule/node.js.map +1 -0
- package/lib/esm/node/triggers/webhook/node.js +75 -0
- package/lib/esm/node/triggers/webhook/node.js.map +1 -0
- package/lib/esm/node/utility/code/node.js +213 -0
- package/lib/esm/node/utility/code/node.js.map +1 -0
- package/lib/esm/node/utility/delay/node.js +72 -0
- package/lib/esm/node/utility/delay/node.js.map +1 -0
- package/lib/esm/node/utility/log/node.js +89 -0
- package/lib/esm/node/utility/log/node.js.map +1 -0
- package/lib/esm/node/utility/map/node.js +66 -0
- package/lib/esm/node/utility/map/node.js.map +1 -0
- package/lib/esm/node/utility/utility-log/node.js +87 -0
- package/lib/esm/node/utility/utility-log/node.js.map +1 -0
- package/lib/esm/ram/GraphRunEventModel.js +123 -0
- package/lib/esm/ram/GraphRunEventModel.js.map +1 -0
- package/lib/esm/ram/GraphRunEventStore.js +131 -0
- package/lib/esm/ram/GraphRunEventStore.js.map +1 -0
- package/lib/esm/ram/GraphRunStore.js +102 -0
- package/lib/esm/ram/GraphRunStore.js.map +1 -0
- package/lib/esm/ram/index.js +39 -0
- package/lib/esm/ram/index.js.map +1 -0
- package/lib/esm/shared/graph/GraphExecutionStateMapper.js +91 -0
- package/lib/esm/shared/graph/GraphExecutionStateMapper.js.map +1 -0
- package/lib/esm/shared/graph/GraphResolution.js +17 -0
- package/lib/esm/shared/graph/GraphResolution.js.map +1 -0
- package/lib/esm/shared/graph/GraphRunModel.js +131 -0
- package/lib/esm/shared/graph/GraphRunModel.js.map +1 -0
- package/lib/esm/shared/graph/GraphWorkflowModel.js +57 -0
- package/lib/esm/shared/graph/GraphWorkflowModel.js.map +1 -0
- package/lib/esm/shared/graph/auth.js +97 -0
- package/lib/esm/shared/graph/auth.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphConnectionPolicy.js +20 -0
- package/lib/esm/shared/graph/catalog/GraphConnectionPolicy.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphCredentialReference.js +13 -0
- package/lib/esm/shared/graph/catalog/GraphCredentialReference.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphCredentialRequirement.js +16 -0
- package/lib/esm/shared/graph/catalog/GraphCredentialRequirement.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphDynamicPortRule.js +36 -0
- package/lib/esm/shared/graph/catalog/GraphDynamicPortRule.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphIconReference.js +22 -0
- package/lib/esm/shared/graph/catalog/GraphIconReference.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +386 -0
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphNodeCapability.js +28 -0
- package/lib/esm/shared/graph/catalog/GraphNodeCapability.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphNodeDisplayManifest.js +11 -0
- package/lib/esm/shared/graph/catalog/GraphNodeDisplayManifest.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphNodeManifest.js +27 -0
- package/lib/esm/shared/graph/catalog/GraphNodeManifest.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphNodeManifestSerialization.js +57 -0
- package/lib/esm/shared/graph/catalog/GraphNodeManifestSerialization.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphNodeMethodManifest.js +34 -0
- package/lib/esm/shared/graph/catalog/GraphNodeMethodManifest.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphNodePolicyManifest.js +14 -0
- package/lib/esm/shared/graph/catalog/GraphNodePolicyManifest.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphParameterBase.js +2 -0
- package/lib/esm/shared/graph/catalog/GraphParameterBase.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphParameterDefinition.js +34 -0
- package/lib/esm/shared/graph/catalog/GraphParameterDefinition.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphParameterOption.js +21 -0
- package/lib/esm/shared/graph/catalog/GraphParameterOption.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphParameterValidation.js +65 -0
- package/lib/esm/shared/graph/catalog/GraphParameterValidation.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphPortManifest.js +26 -0
- package/lib/esm/shared/graph/catalog/GraphPortManifest.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphPortManifestElement.js +15 -0
- package/lib/esm/shared/graph/catalog/GraphPortManifestElement.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphResourceLocatorMode.js +24 -0
- package/lib/esm/shared/graph/catalog/GraphResourceLocatorMode.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphValueSchema.js +30 -0
- package/lib/esm/shared/graph/catalog/GraphValueSchema.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js +178 -0
- package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js.map +1 -0
- package/lib/esm/shared/graph/catalog/GraphVisibilityExpression.js +65 -0
- package/lib/esm/shared/graph/catalog/GraphVisibilityExpression.js.map +1 -0
- package/lib/esm/shared/graph/catalog/index.js +26 -0
- package/lib/esm/shared/graph/catalog/index.js.map +1 -0
- package/lib/esm/shared/graph/category-styles.js +34 -0
- package/lib/esm/shared/graph/category-styles.js.map +1 -0
- package/lib/esm/shared/graph/constants.js +354 -0
- package/lib/esm/shared/graph/constants.js.map +1 -0
- package/lib/esm/shared/graph/decorators.js +194 -0
- package/lib/esm/shared/graph/decorators.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphDecoratedWorkflowCompiler.js +401 -0
- package/lib/esm/shared/graph/document/GraphDecoratedWorkflowCompiler.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphEdgeInstance.js +2 -0
- package/lib/esm/shared/graph/document/GraphEdgeInstance.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphEndpoint.js +33 -0
- package/lib/esm/shared/graph/document/GraphEndpoint.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphErrorBoundaryConfiguration.js +2 -0
- package/lib/esm/shared/graph/document/GraphErrorBoundaryConfiguration.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphFlowBuilder.js +766 -0
- package/lib/esm/shared/graph/document/GraphFlowBuilder.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphJsonValue.js +94 -0
- package/lib/esm/shared/graph/document/GraphJsonValue.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphLoopConfiguration.js +2 -0
- package/lib/esm/shared/graph/document/GraphLoopConfiguration.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphNodeBinding.js +30 -0
- package/lib/esm/shared/graph/document/GraphNodeBinding.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphNodeDerivation.js +143 -0
- package/lib/esm/shared/graph/document/GraphNodeDerivation.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphNodeInstance.js +2 -0
- package/lib/esm/shared/graph/document/GraphNodeInstance.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphValueTemplate.js +88 -0
- package/lib/esm/shared/graph/document/GraphValueTemplate.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocument.js +23 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocument.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocumentBuilder.js +433 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocumentBuilder.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocumentReader.js +103 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocumentReader.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocumentSerializer.js +75 -0
- package/lib/esm/shared/graph/document/GraphWorkflowDocumentSerializer.js.map +1 -0
- package/lib/esm/shared/graph/document/GraphWorkflowUiState.js +2 -0
- package/lib/esm/shared/graph/document/GraphWorkflowUiState.js.map +1 -0
- package/lib/esm/shared/graph/document/index.js +20 -0
- package/lib/esm/shared/graph/document/index.js.map +1 -0
- package/lib/esm/shared/graph/index.js +22 -0
- package/lib/esm/shared/graph/index.js.map +1 -0
- package/lib/esm/shared/graph/overrides/Metadata.js +20 -0
- package/lib/esm/shared/graph/overrides/Metadata.js.map +1 -0
- package/lib/esm/shared/graph/overrides/Rendering.js +2 -0
- package/lib/esm/shared/graph/overrides/Rendering.js.map +1 -0
- package/lib/esm/shared/graph/overrides/index.js +7 -0
- package/lib/esm/shared/graph/overrides/index.js.map +1 -0
- package/lib/esm/shared/graph/overrides/overrides.js +17 -0
- package/lib/esm/shared/graph/overrides/overrides.js.map +1 -0
- package/lib/esm/shared/graph/reader.js +376 -0
- package/lib/esm/shared/graph/reader.js.map +1 -0
- package/lib/esm/shared/graph/registry.js +59 -0
- package/lib/esm/shared/graph/registry.js.map +1 -0
- package/lib/esm/shared/graph/snapshot.js +2 -0
- package/lib/esm/shared/graph/snapshot.js.map +1 -0
- package/lib/esm/shared/graph/types.js +2 -0
- package/lib/esm/shared/graph/types.js.map +1 -0
- package/lib/esm/shared/index.js +13 -0
- package/lib/esm/shared/index.js.map +1 -0
- package/lib/esm/shared/ui/GraphNodeView.js +107 -0
- package/lib/esm/shared/ui/GraphNodeView.js.map +1 -0
- package/lib/esm/shared/ui/GraphRunView.js +90 -0
- package/lib/esm/shared/ui/GraphRunView.js.map +1 -0
- package/lib/esm/shared/ui/GraphWorkflowView.js +72 -0
- package/lib/esm/shared/ui/GraphWorkflowView.js.map +1 -0
- package/lib/esm/shared/ui/constants.js +69 -0
- package/lib/esm/shared/ui/constants.js.map +1 -0
- package/lib/esm/shared/ui/index.js +15 -0
- package/lib/esm/shared/ui/index.js.map +1 -0
- package/lib/esm/shared/ui/types.js +2 -0
- package/lib/esm/shared/ui/types.js.map +1 -0
- package/lib/types/engine/auth/GraphAuth.d.cts +84 -0
- package/lib/types/engine/auth/GraphAuth.d.mts +84 -0
- package/lib/types/engine/auth/GraphAuthValidator.d.cts +57 -0
- package/lib/types/engine/auth/GraphAuthValidator.d.mts +57 -0
- package/lib/types/engine/auth/GraphNamespace.d.cts +38 -0
- package/lib/types/engine/auth/GraphNamespace.d.mts +38 -0
- package/lib/types/engine/auth/index.d.cts +7 -0
- package/lib/types/engine/auth/index.d.mts +7 -0
- package/lib/types/engine/catalog/GraphBuiltInRegistrations.d.cts +26 -0
- package/lib/types/engine/catalog/GraphBuiltInRegistrations.d.mts +26 -0
- package/lib/types/engine/catalog/GraphCatalogueErrors.d.cts +13 -0
- package/lib/types/engine/catalog/GraphCatalogueErrors.d.mts +13 -0
- package/lib/types/engine/catalog/GraphNodeCatalogue.d.cts +86 -0
- package/lib/types/engine/catalog/GraphNodeCatalogue.d.mts +86 -0
- package/lib/types/engine/catalog/GraphNodeManifestResolver.d.cts +57 -0
- package/lib/types/engine/catalog/GraphNodeManifestResolver.d.mts +57 -0
- package/lib/types/engine/catalog/GraphNodeMethodRegistry.d.cts +22 -0
- package/lib/types/engine/catalog/GraphNodeMethodRegistry.d.mts +22 -0
- package/lib/types/engine/catalog/GraphNodeRegistration.d.cts +68 -0
- package/lib/types/engine/catalog/GraphNodeRegistration.d.mts +68 -0
- package/lib/types/engine/catalog/index.d.cts +9 -0
- package/lib/types/engine/catalog/index.d.mts +9 -0
- package/lib/types/engine/constants.d.cts +79 -0
- package/lib/types/engine/constants.d.mts +79 -0
- package/lib/types/engine/decorators.d.cts +6 -0
- package/lib/types/engine/decorators.d.mts +6 -0
- package/lib/types/engine/errors/GraphBreakSignal.d.cts +28 -0
- package/lib/types/engine/errors/GraphBreakSignal.d.mts +28 -0
- package/lib/types/engine/errors/GraphCycleError.d.cts +12 -0
- package/lib/types/engine/errors/GraphCycleError.d.mts +12 -0
- package/lib/types/engine/errors/GraphExecutionError.d.cts +19 -0
- package/lib/types/engine/errors/GraphExecutionError.d.mts +19 -0
- package/lib/types/engine/errors/GraphInputError.d.cts +12 -0
- package/lib/types/engine/errors/GraphInputError.d.mts +12 -0
- package/lib/types/engine/errors/GraphLoopLimitError.d.cts +12 -0
- package/lib/types/engine/errors/GraphLoopLimitError.d.mts +12 -0
- package/lib/types/engine/errors/GraphPinningError.d.cts +12 -0
- package/lib/types/engine/errors/GraphPinningError.d.mts +12 -0
- package/lib/types/engine/errors/GraphPortError.d.cts +12 -0
- package/lib/types/engine/errors/GraphPortError.d.mts +12 -0
- package/lib/types/engine/errors/GraphRunCancelledError.d.cts +9 -0
- package/lib/types/engine/errors/GraphRunCancelledError.d.mts +9 -0
- package/lib/types/engine/errors/GraphStoreError.d.cts +12 -0
- package/lib/types/engine/errors/GraphStoreError.d.mts +12 -0
- package/lib/types/engine/errors/GraphTopologyError.d.cts +12 -0
- package/lib/types/engine/errors/GraphTopologyError.d.mts +12 -0
- package/lib/types/engine/errors/GraphWorkflowErrors.d.cts +14 -0
- package/lib/types/engine/errors/GraphWorkflowErrors.d.mts +14 -0
- package/lib/types/engine/errors/index.d.cts +15 -0
- package/lib/types/engine/errors/index.d.mts +15 -0
- package/lib/types/engine/events/GraphExecutionEventEmitter.d.cts +26 -0
- package/lib/types/engine/events/GraphExecutionEventEmitter.d.mts +26 -0
- package/lib/types/engine/events/GraphExecutionEventFactory.d.cts +29 -0
- package/lib/types/engine/events/GraphExecutionEventFactory.d.mts +29 -0
- package/lib/types/engine/events/GraphExecutionObserver.d.cts +17 -0
- package/lib/types/engine/events/GraphExecutionObserver.d.mts +17 -0
- package/lib/types/engine/events/index.d.cts +8 -0
- package/lib/types/engine/events/index.d.mts +8 -0
- package/lib/types/engine/execution/CodeSandboxEvaluator.d.cts +84 -0
- package/lib/types/engine/execution/CodeSandboxEvaluator.d.mts +84 -0
- package/lib/types/engine/execution/GraphExecutionContext.d.cts +94 -0
- package/lib/types/engine/execution/GraphExecutionContext.d.mts +94 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +352 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +352 -0
- package/lib/types/engine/execution/GraphExecutionFrame.d.cts +50 -0
- package/lib/types/engine/execution/GraphExecutionFrame.d.mts +50 -0
- package/lib/types/engine/execution/GraphExecutionResult.d.cts +13 -0
- package/lib/types/engine/execution/GraphExecutionResult.d.mts +13 -0
- package/lib/types/engine/execution/GraphNodeExecutor.d.cts +31 -0
- package/lib/types/engine/execution/GraphNodeExecutor.d.mts +31 -0
- package/lib/types/engine/execution/IsolatedVmCodeSandboxEvaluator.d.cts +160 -0
- package/lib/types/engine/execution/IsolatedVmCodeSandboxEvaluator.d.mts +160 -0
- package/lib/types/engine/execution/index.d.cts +12 -0
- package/lib/types/engine/execution/index.d.mts +12 -0
- package/lib/types/engine/index.d.cts +61 -0
- package/lib/types/engine/index.d.mts +61 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.cts +87 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.mts +87 -0
- package/lib/types/engine/loops/ConditionExpressionEvaluator.d.cts +36 -0
- package/lib/types/engine/loops/ConditionExpressionEvaluator.d.mts +36 -0
- package/lib/types/engine/loops/GraphConditionEvaluator.d.cts +62 -0
- package/lib/types/engine/loops/GraphConditionEvaluator.d.mts +62 -0
- package/lib/types/engine/loops/GraphLoopExecutionContext.d.cts +15 -0
- package/lib/types/engine/loops/GraphLoopExecutionContext.d.mts +15 -0
- package/lib/types/engine/loops/index.d.cts +9 -0
- package/lib/types/engine/loops/index.d.mts +9 -0
- package/lib/types/engine/pinning/GraphPinningDependencyResolver.d.cts +21 -0
- package/lib/types/engine/pinning/GraphPinningDependencyResolver.d.mts +21 -0
- package/lib/types/engine/pinning/GraphPinningMetadata.d.cts +14 -0
- package/lib/types/engine/pinning/GraphPinningMetadata.d.mts +14 -0
- package/lib/types/engine/pinning/GraphPinningPolicy.d.cts +20 -0
- package/lib/types/engine/pinning/GraphPinningPolicy.d.mts +20 -0
- package/lib/types/engine/pinning/GraphPinningService.d.cts +70 -0
- package/lib/types/engine/pinning/GraphPinningService.d.mts +70 -0
- package/lib/types/engine/pinning/index.d.cts +9 -0
- package/lib/types/engine/pinning/index.d.mts +9 -0
- package/lib/types/engine/planning/GraphExecutionPlan.d.cts +25 -0
- package/lib/types/engine/planning/GraphExecutionPlan.d.mts +25 -0
- package/lib/types/engine/planning/GraphExecutionPlanEdge.d.cts +26 -0
- package/lib/types/engine/planning/GraphExecutionPlanEdge.d.mts +26 -0
- package/lib/types/engine/planning/GraphExecutionPlanLayer.d.cts +13 -0
- package/lib/types/engine/planning/GraphExecutionPlanLayer.d.mts +13 -0
- package/lib/types/engine/planning/GraphExecutionPlanNode.d.cts +28 -0
- package/lib/types/engine/planning/GraphExecutionPlanNode.d.mts +28 -0
- package/lib/types/engine/planning/GraphExecutionPlanner.d.cts +61 -0
- package/lib/types/engine/planning/GraphExecutionPlanner.d.mts +61 -0
- package/lib/types/engine/planning/GraphTopology.d.cts +23 -0
- package/lib/types/engine/planning/GraphTopology.d.mts +23 -0
- package/lib/types/engine/planning/index.d.cts +11 -0
- package/lib/types/engine/planning/index.d.mts +11 -0
- package/lib/types/engine/registry/GraphNodeExecutorRegistry.d.cts +44 -0
- package/lib/types/engine/registry/GraphNodeExecutorRegistry.d.mts +44 -0
- package/lib/types/engine/registry/GraphNodeExecutorResolver.d.cts +26 -0
- package/lib/types/engine/registry/GraphNodeExecutorResolver.d.mts +26 -0
- package/lib/types/engine/registry/index.d.cts +7 -0
- package/lib/types/engine/registry/index.d.mts +7 -0
- package/lib/types/engine/runs/GraphRunConverters.d.cts +6 -0
- package/lib/types/engine/runs/GraphRunConverters.d.mts +6 -0
- package/lib/types/engine/runs/GraphRunEventPublisher.d.cts +26 -0
- package/lib/types/engine/runs/GraphRunEventPublisher.d.mts +26 -0
- package/lib/types/engine/runs/GraphRunExecutor.d.cts +75 -0
- package/lib/types/engine/runs/GraphRunExecutor.d.mts +75 -0
- package/lib/types/engine/runs/GraphRunFingerprint.d.cts +8 -0
- package/lib/types/engine/runs/GraphRunFingerprint.d.mts +8 -0
- package/lib/types/engine/runs/GraphRunService.d.cts +141 -0
- package/lib/types/engine/runs/GraphRunService.d.mts +141 -0
- package/lib/types/engine/runs/InMemoryGraphRunEventStore.d.cts +28 -0
- package/lib/types/engine/runs/InMemoryGraphRunEventStore.d.mts +28 -0
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.cts +41 -0
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.mts +41 -0
- package/lib/types/engine/runs/index.d.cts +11 -0
- package/lib/types/engine/runs/index.d.mts +11 -0
- package/lib/types/engine/runs/ownership.d.cts +110 -0
- package/lib/types/engine/runs/ownership.d.mts +110 -0
- package/lib/types/engine/runs/types.d.cts +94 -0
- package/lib/types/engine/runs/types.d.mts +94 -0
- package/lib/types/engine/services/GraphEnvironment.d.cts +40 -0
- package/lib/types/engine/services/GraphEnvironment.d.mts +40 -0
- package/lib/types/engine/services/GraphRunModelService.d.cts +50 -0
- package/lib/types/engine/services/GraphRunModelService.d.mts +50 -0
- package/lib/types/engine/services/GraphWorkflowService.d.cts +152 -0
- package/lib/types/engine/services/GraphWorkflowService.d.mts +152 -0
- package/lib/types/engine/snapshots/GraphExecutionSnapshotMapper.d.cts +10 -0
- package/lib/types/engine/snapshots/GraphExecutionSnapshotMapper.d.mts +10 -0
- package/lib/types/engine/snapshots/index.d.cts +6 -0
- package/lib/types/engine/snapshots/index.d.mts +6 -0
- package/lib/types/engine/store/GraphCachedValue.d.cts +20 -0
- package/lib/types/engine/store/GraphCachedValue.d.mts +20 -0
- package/lib/types/engine/store/GraphValueKey.d.cts +18 -0
- package/lib/types/engine/store/GraphValueKey.d.mts +18 -0
- package/lib/types/engine/store/GraphValueModel.d.cts +33 -0
- package/lib/types/engine/store/GraphValueModel.d.mts +33 -0
- package/lib/types/engine/store/GraphValueRepository.d.cts +89 -0
- package/lib/types/engine/store/GraphValueRepository.d.mts +89 -0
- package/lib/types/engine/store/index.d.cts +10 -0
- package/lib/types/engine/store/index.d.mts +10 -0
- package/lib/types/engine/types.d.cts +238 -0
- package/lib/types/engine/types.d.mts +238 -0
- package/lib/types/engine/validation/GraphConnectionPolicyValidator.d.cts +32 -0
- package/lib/types/engine/validation/GraphConnectionPolicyValidator.d.mts +32 -0
- package/lib/types/engine/validation/GraphCredentialReferenceValidator.d.cts +62 -0
- package/lib/types/engine/validation/GraphCredentialReferenceValidator.d.mts +62 -0
- package/lib/types/engine/validation/GraphEdgeInstanceValidator.d.cts +32 -0
- package/lib/types/engine/validation/GraphEdgeInstanceValidator.d.mts +32 -0
- package/lib/types/engine/validation/GraphLooseNodeValidation.d.cts +21 -0
- package/lib/types/engine/validation/GraphLooseNodeValidation.d.mts +21 -0
- package/lib/types/engine/validation/GraphNodeInstanceValidator.d.cts +38 -0
- package/lib/types/engine/validation/GraphNodeInstanceValidator.d.mts +38 -0
- package/lib/types/engine/validation/GraphParameterValidator.d.cts +120 -0
- package/lib/types/engine/validation/GraphParameterValidator.d.mts +120 -0
- package/lib/types/engine/validation/GraphPortSchemaResolver.d.cts +39 -0
- package/lib/types/engine/validation/GraphPortSchemaResolver.d.mts +39 -0
- package/lib/types/engine/validation/GraphResolvedWorkflow.d.cts +66 -0
- package/lib/types/engine/validation/GraphResolvedWorkflow.d.mts +66 -0
- package/lib/types/engine/validation/GraphValidationErrors.d.cts +34 -0
- package/lib/types/engine/validation/GraphValidationErrors.d.mts +34 -0
- package/lib/types/engine/validation/GraphValidationIssue.d.cts +39 -0
- package/lib/types/engine/validation/GraphValidationIssue.d.mts +39 -0
- package/lib/types/engine/validation/GraphValueValidator.d.cts +27 -0
- package/lib/types/engine/validation/GraphValueValidator.d.mts +27 -0
- package/lib/types/engine/validation/GraphWorkflowBoundaryValidation.d.cts +29 -0
- package/lib/types/engine/validation/GraphWorkflowBoundaryValidation.d.mts +29 -0
- package/lib/types/engine/validation/GraphWorkflowDocumentLimits.d.cts +33 -0
- package/lib/types/engine/validation/GraphWorkflowDocumentLimits.d.mts +33 -0
- package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.cts +165 -0
- package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.mts +165 -0
- package/lib/types/engine/validation/index.d.cts +21 -0
- package/lib/types/engine/validation/index.d.mts +21 -0
- package/lib/types/index.d.cts +13 -0
- package/lib/types/index.d.mts +13 -0
- package/lib/types/log/GraphRunLogger.d.cts +96 -0
- package/lib/types/log/GraphRunLogger.d.mts +96 -0
- package/lib/types/log/LogParameters.d.cts +7 -0
- package/lib/types/log/LogParameters.d.mts +7 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +139 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +139 -0
- package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.cts +76 -0
- package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.mts +76 -0
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.cts +118 -0
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.mts +118 -0
- package/lib/types/nest/graph/GraphRunController.d.cts +173 -0
- package/lib/types/nest/graph/GraphRunController.d.mts +173 -0
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +121 -0
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +121 -0
- package/lib/types/nest/graph/index.d.cts +12 -0
- package/lib/types/nest/graph/index.d.mts +12 -0
- package/lib/types/nest/graph/servingDates.d.cts +35 -0
- package/lib/types/nest/graph/servingDates.d.mts +35 -0
- package/lib/types/nest/graph/servingErrors.d.cts +42 -0
- package/lib/types/nest/graph/servingErrors.d.mts +42 -0
- package/lib/types/nest/index.d.cts +10 -0
- package/lib/types/nest/index.d.mts +10 -0
- package/lib/types/node/agents/agent/node.d.cts +51 -0
- package/lib/types/node/agents/agent/node.d.mts +51 -0
- package/lib/types/node/base.d.cts +131 -0
- package/lib/types/node/base.d.mts +131 -0
- package/lib/types/node/boundary/input/node.d.cts +20 -0
- package/lib/types/node/boundary/input/node.d.mts +20 -0
- package/lib/types/node/boundary/output/node.d.cts +20 -0
- package/lib/types/node/boundary/output/node.d.mts +20 -0
- package/lib/types/node/flow/break/node.d.cts +22 -0
- package/lib/types/node/flow/break/node.d.mts +22 -0
- package/lib/types/node/flow/error-boundary/node.d.cts +40 -0
- package/lib/types/node/flow/error-boundary/node.d.mts +40 -0
- package/lib/types/node/flow/human-approval/node.d.cts +32 -0
- package/lib/types/node/flow/human-approval/node.d.mts +32 -0
- package/lib/types/node/flow/if/node.d.cts +46 -0
- package/lib/types/node/flow/if/node.d.mts +46 -0
- package/lib/types/node/flow/loop/foreach/node.d.cts +43 -0
- package/lib/types/node/flow/loop/foreach/node.d.mts +43 -0
- package/lib/types/node/flow/loop/loop-metadata.d.cts +61 -0
- package/lib/types/node/flow/loop/loop-metadata.d.mts +61 -0
- package/lib/types/node/flow/loop/until/node.d.cts +41 -0
- package/lib/types/node/flow/loop/until/node.d.mts +41 -0
- package/lib/types/node/flow/loop/while/node.d.cts +40 -0
- package/lib/types/node/flow/loop/while/node.d.mts +40 -0
- package/lib/types/node/flow/switch/node.d.cts +47 -0
- package/lib/types/node/flow/switch/node.d.mts +47 -0
- package/lib/types/node/index.d.cts +90 -0
- package/lib/types/node/index.d.mts +90 -0
- package/lib/types/node/manifests.d.cts +23 -0
- package/lib/types/node/manifests.d.mts +23 -0
- package/lib/types/node/triggers/chat/node.d.cts +29 -0
- package/lib/types/node/triggers/chat/node.d.mts +29 -0
- package/lib/types/node/triggers/event/node.d.cts +22 -0
- package/lib/types/node/triggers/event/node.d.mts +22 -0
- package/lib/types/node/triggers/form/node.d.cts +24 -0
- package/lib/types/node/triggers/form/node.d.mts +24 -0
- package/lib/types/node/triggers/manual/node.d.cts +23 -0
- package/lib/types/node/triggers/manual/node.d.mts +23 -0
- package/lib/types/node/triggers/schedule/node.d.cts +24 -0
- package/lib/types/node/triggers/schedule/node.d.mts +24 -0
- package/lib/types/node/triggers/webhook/node.d.cts +24 -0
- package/lib/types/node/triggers/webhook/node.d.mts +24 -0
- package/lib/types/node/utility/code/node.d.cts +101 -0
- package/lib/types/node/utility/code/node.d.mts +101 -0
- package/lib/types/node/utility/delay/node.d.cts +28 -0
- package/lib/types/node/utility/delay/node.d.mts +28 -0
- package/lib/types/node/utility/log/node.d.cts +32 -0
- package/lib/types/node/utility/log/node.d.mts +32 -0
- package/lib/types/node/utility/map/node.d.cts +24 -0
- package/lib/types/node/utility/map/node.d.mts +24 -0
- package/lib/types/node/utility/utility-log/node.d.cts +32 -0
- package/lib/types/node/utility/utility-log/node.d.mts +32 -0
- package/lib/types/ram/GraphRunEventModel.d.cts +34 -0
- package/lib/types/ram/GraphRunEventModel.d.mts +34 -0
- package/lib/types/ram/GraphRunEventStore.d.cts +64 -0
- package/lib/types/ram/GraphRunEventStore.d.mts +64 -0
- package/lib/types/ram/GraphRunStore.d.cts +51 -0
- package/lib/types/ram/GraphRunStore.d.mts +51 -0
- package/lib/types/ram/index.d.cts +34 -0
- package/lib/types/ram/index.d.mts +34 -0
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.cts +66 -0
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.mts +66 -0
- package/lib/types/shared/graph/GraphResolution.d.cts +59 -0
- package/lib/types/shared/graph/GraphResolution.d.mts +59 -0
- package/lib/types/shared/graph/GraphRunModel.d.cts +32 -0
- package/lib/types/shared/graph/GraphRunModel.d.mts +32 -0
- package/lib/types/shared/graph/GraphWorkflowModel.d.cts +29 -0
- package/lib/types/shared/graph/GraphWorkflowModel.d.mts +29 -0
- package/lib/types/shared/graph/auth.d.cts +40 -0
- package/lib/types/shared/graph/auth.d.mts +40 -0
- package/lib/types/shared/graph/catalog/GraphConnectionPolicy.d.cts +16 -0
- package/lib/types/shared/graph/catalog/GraphConnectionPolicy.d.mts +16 -0
- package/lib/types/shared/graph/catalog/GraphCredentialReference.d.cts +13 -0
- package/lib/types/shared/graph/catalog/GraphCredentialReference.d.mts +13 -0
- package/lib/types/shared/graph/catalog/GraphCredentialRequirement.d.cts +14 -0
- package/lib/types/shared/graph/catalog/GraphCredentialRequirement.d.mts +14 -0
- package/lib/types/shared/graph/catalog/GraphDynamicPortRule.d.cts +45 -0
- package/lib/types/shared/graph/catalog/GraphDynamicPortRule.d.mts +45 -0
- package/lib/types/shared/graph/catalog/GraphIconReference.d.cts +19 -0
- package/lib/types/shared/graph/catalog/GraphIconReference.d.mts +19 -0
- package/lib/types/shared/graph/catalog/GraphManifestCompiler.d.cts +23 -0
- package/lib/types/shared/graph/catalog/GraphManifestCompiler.d.mts +23 -0
- package/lib/types/shared/graph/catalog/GraphNodeCapability.d.cts +18 -0
- package/lib/types/shared/graph/catalog/GraphNodeCapability.d.mts +18 -0
- package/lib/types/shared/graph/catalog/GraphNodeDisplayManifest.d.cts +40 -0
- package/lib/types/shared/graph/catalog/GraphNodeDisplayManifest.d.mts +40 -0
- package/lib/types/shared/graph/catalog/GraphNodeManifest.d.cts +45 -0
- package/lib/types/shared/graph/catalog/GraphNodeManifest.d.mts +45 -0
- package/lib/types/shared/graph/catalog/GraphNodeManifestSerialization.d.cts +22 -0
- package/lib/types/shared/graph/catalog/GraphNodeManifestSerialization.d.mts +22 -0
- package/lib/types/shared/graph/catalog/GraphNodeMethodManifest.d.cts +27 -0
- package/lib/types/shared/graph/catalog/GraphNodeMethodManifest.d.mts +27 -0
- package/lib/types/shared/graph/catalog/GraphNodePolicyManifest.d.cts +46 -0
- package/lib/types/shared/graph/catalog/GraphNodePolicyManifest.d.mts +46 -0
- package/lib/types/shared/graph/catalog/GraphParameterBase.d.cts +17 -0
- package/lib/types/shared/graph/catalog/GraphParameterBase.d.mts +17 -0
- package/lib/types/shared/graph/catalog/GraphParameterDefinition.d.cts +119 -0
- package/lib/types/shared/graph/catalog/GraphParameterDefinition.d.mts +119 -0
- package/lib/types/shared/graph/catalog/GraphParameterOption.d.cts +19 -0
- package/lib/types/shared/graph/catalog/GraphParameterOption.d.mts +19 -0
- package/lib/types/shared/graph/catalog/GraphParameterValidation.d.cts +46 -0
- package/lib/types/shared/graph/catalog/GraphParameterValidation.d.mts +46 -0
- package/lib/types/shared/graph/catalog/GraphPortManifest.d.cts +42 -0
- package/lib/types/shared/graph/catalog/GraphPortManifest.d.mts +42 -0
- package/lib/types/shared/graph/catalog/GraphPortManifestElement.d.cts +14 -0
- package/lib/types/shared/graph/catalog/GraphPortManifestElement.d.mts +14 -0
- package/lib/types/shared/graph/catalog/GraphResourceLocatorMode.d.cts +27 -0
- package/lib/types/shared/graph/catalog/GraphResourceLocatorMode.d.mts +27 -0
- package/lib/types/shared/graph/catalog/GraphValueSchema.d.cts +85 -0
- package/lib/types/shared/graph/catalog/GraphValueSchema.d.mts +85 -0
- package/lib/types/shared/graph/catalog/GraphValueSchemaDerivation.d.cts +24 -0
- package/lib/types/shared/graph/catalog/GraphValueSchemaDerivation.d.mts +24 -0
- package/lib/types/shared/graph/catalog/GraphVisibilityExpression.d.cts +35 -0
- package/lib/types/shared/graph/catalog/GraphVisibilityExpression.d.mts +35 -0
- package/lib/types/shared/graph/catalog/index.d.cts +25 -0
- package/lib/types/shared/graph/catalog/index.d.mts +25 -0
- package/lib/types/shared/graph/category-styles.d.cts +8 -0
- package/lib/types/shared/graph/category-styles.d.mts +8 -0
- package/lib/types/shared/graph/constants.d.cts +640 -0
- package/lib/types/shared/graph/constants.d.mts +640 -0
- package/lib/types/shared/graph/decorators.d.cts +118 -0
- package/lib/types/shared/graph/decorators.d.mts +118 -0
- package/lib/types/shared/graph/document/GraphDecoratedWorkflowCompiler.d.cts +56 -0
- package/lib/types/shared/graph/document/GraphDecoratedWorkflowCompiler.d.mts +56 -0
- package/lib/types/shared/graph/document/GraphEdgeInstance.d.cts +15 -0
- package/lib/types/shared/graph/document/GraphEdgeInstance.d.mts +15 -0
- package/lib/types/shared/graph/document/GraphEndpoint.d.cts +34 -0
- package/lib/types/shared/graph/document/GraphEndpoint.d.mts +34 -0
- package/lib/types/shared/graph/document/GraphErrorBoundaryConfiguration.d.cts +14 -0
- package/lib/types/shared/graph/document/GraphErrorBoundaryConfiguration.d.mts +14 -0
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.cts +277 -0
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.mts +277 -0
- package/lib/types/shared/graph/document/GraphJsonValue.d.cts +41 -0
- package/lib/types/shared/graph/document/GraphJsonValue.d.mts +41 -0
- package/lib/types/shared/graph/document/GraphLoopConfiguration.d.cts +30 -0
- package/lib/types/shared/graph/document/GraphLoopConfiguration.d.mts +30 -0
- package/lib/types/shared/graph/document/GraphNodeBinding.d.cts +47 -0
- package/lib/types/shared/graph/document/GraphNodeBinding.d.mts +47 -0
- package/lib/types/shared/graph/document/GraphNodeDerivation.d.cts +59 -0
- package/lib/types/shared/graph/document/GraphNodeDerivation.d.mts +59 -0
- package/lib/types/shared/graph/document/GraphNodeInstance.d.cts +52 -0
- package/lib/types/shared/graph/document/GraphNodeInstance.d.mts +52 -0
- package/lib/types/shared/graph/document/GraphValueTemplate.d.cts +75 -0
- package/lib/types/shared/graph/document/GraphValueTemplate.d.mts +75 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocument.d.cts +53 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocument.d.mts +53 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocumentBuilder.d.cts +146 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocumentBuilder.d.mts +146 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocumentReader.d.cts +62 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocumentReader.d.mts +62 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocumentSerializer.d.cts +17 -0
- package/lib/types/shared/graph/document/GraphWorkflowDocumentSerializer.d.mts +17 -0
- package/lib/types/shared/graph/document/GraphWorkflowUiState.d.cts +49 -0
- package/lib/types/shared/graph/document/GraphWorkflowUiState.d.mts +49 -0
- package/lib/types/shared/graph/document/index.d.cts +19 -0
- package/lib/types/shared/graph/document/index.d.mts +19 -0
- package/lib/types/shared/graph/index.d.cts +21 -0
- package/lib/types/shared/graph/index.d.mts +21 -0
- package/lib/types/shared/graph/overrides/Metadata.d.cts +43 -0
- package/lib/types/shared/graph/overrides/Metadata.d.mts +43 -0
- package/lib/types/shared/graph/overrides/Rendering.d.cts +8 -0
- package/lib/types/shared/graph/overrides/Rendering.d.mts +8 -0
- package/lib/types/shared/graph/overrides/index.d.cts +6 -0
- package/lib/types/shared/graph/overrides/index.d.mts +6 -0
- package/lib/types/shared/graph/overrides/overrides.d.cts +1 -0
- package/lib/types/shared/graph/overrides/overrides.d.mts +1 -0
- package/lib/types/shared/graph/reader.d.cts +75 -0
- package/lib/types/shared/graph/reader.d.mts +75 -0
- package/lib/types/shared/graph/registry.d.cts +40 -0
- package/lib/types/shared/graph/registry.d.mts +40 -0
- package/lib/types/shared/graph/snapshot.d.cts +36 -0
- package/lib/types/shared/graph/snapshot.d.mts +36 -0
- package/lib/types/shared/graph/types.d.cts +304 -0
- package/lib/types/shared/graph/types.d.mts +304 -0
- package/lib/types/shared/index.d.cts +12 -0
- package/lib/types/shared/index.d.mts +12 -0
- package/lib/types/shared/ui/GraphNodeView.d.cts +48 -0
- package/lib/types/shared/ui/GraphNodeView.d.mts +48 -0
- package/lib/types/shared/ui/GraphRunView.d.cts +88 -0
- package/lib/types/shared/ui/GraphRunView.d.mts +88 -0
- package/lib/types/shared/ui/GraphWorkflowView.d.cts +18 -0
- package/lib/types/shared/ui/GraphWorkflowView.d.mts +18 -0
- package/lib/types/shared/ui/constants.d.cts +55 -0
- package/lib/types/shared/ui/constants.d.mts +55 -0
- package/lib/types/shared/ui/index.d.cts +14 -0
- package/lib/types/shared/ui/index.d.mts +14 -0
- package/lib/types/shared/ui/types.d.cts +200 -0
- package/lib/types/shared/ui/types.d.mts +200 -0
- package/package.json +158 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e,t;e=this,t=function(e,t,o,n,r,a,i,s,d,l,c,u,p){"use strict";function h(e){var t=Object.create(null);return e&&Object.keys(e).forEach(o=>{if("default"!==o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}),t.default=e,Object.freeze(t)}var f,g,m=h(l),y=h(c),w=h(u);r.ValidationKeys.REQUIRED,r.ValidationKeys.MIN,r.ValidationKeys.MIN_LENGTH,r.ValidationKeys.MAX,r.ValidationKeys.MAX_LENGTH,r.ValidationKeys.PATTERN,r.ValidationKeys.URL,r.ValidationKeys.STEP,r.ValidationKeys.DATE,r.ValidationKeys.EMAIL,r.ValidationKeys.PASSWORD,r.ValidationKeys.EQUALS,r.ValidationKeys.DIFF,r.ValidationKeys.LESS_THAN,r.ValidationKeys.LESS_THAN_OR_EQUAL,r.ValidationKeys.GREATER_THAN,r.ValidationKeys.GREATER_THAN_OR_EQUAL,(e=>{e.GRAPH="graph",e.NODE="graph.node",e.EDGE="graph.edge",e.PORT="graph.port",e.STATE="graph.state"})(f||(f={})),(e=>{e.INPUT="input",e.OUTPUT="output",e.CONNECTION="connection"})(g||(g={}));const _={};function b(e,t={}){let o=e.width??96,n=e.height??96;for(const r of e.sizeRules??[]){if("parameterCount"!==r.type)continue;const e=t[r.parameter]??0;e>0&&("width"===r.dimension?o+=e*r.perItem:n+=e*r.perItem)}return{width:o,height:n}}function v(e,t){_[e]=t}function N(e,t,o){const n=t?_[t]:void 0;return n?.color?n.color:e||"#64748b"}function I(e,t,o){const n=t?_[t]:void 0;return n?.icon?n.icon:e||"ti-pointer"}const E=["skip","passThroughFirstInput","emitDefaults"];function A(e){return E.includes(e)}var O,x,k,D;(e=>{e.PENDING="pending",e.PLANNING="planning",e.RUNNING="running",e.SUCCEEDED="succeeded",e.FAILED="failed",e.SKIPPED="skipped",e.CANCELLED="cancelled",e.CACHED="cached"})(O||(O={})),(e=>{e.IDLE="idle",e.RUNNING="running",e.BLOCKED="blocked",e.SUCCEEDED="succeeded",e.FAILED="failed",e.SKIPPED="skipped"})(x||(x={})),(e=>{e.NODE_ID="nodeId",e.WORKFLOW_ID="workflowId",e.RUN_ID="runId",e.USER="user",e.ROLES="roles",e.NAMESPACES="namespaces",e.ORGANIZATION="organization",e.IP="ip"})(k||(k={})),(e=>{e.WORKFLOW_STARTED="workflow.started",e.WORKFLOW_PLANNED="workflow.planned",e.WORKFLOW_COMPLETED="workflow.completed",e.WORKFLOW_FAILED="workflow.failed",e.WORKFLOW_CANCELLED="workflow.cancelled",e.NODE_QUEUED="node.queued",e.NODE_STARTED="node.started",e.NODE_OUTPUT="node.output",e.NODE_COMPLETED="node.completed",e.NODE_FAILED="node.failed",e.NODE_SKIPPED="node.skipped",e.NODE_CACHE_HIT="node.cacheHit",e.NODE_PINNED="node.pinned",e.NODE_UNPINNED="node.unpinned",e.NODE_STATE_CHANGED="node.stateChanged",e.EDGE_VALUE_ROUTED="edge.valueRouted",e.EDGE_STATE_CHANGED="edge.stateChanged",e.GRAPH_RUN_LOG="graph.run.log",e.LOOP_STARTED="loop.started",e.LOOP_ITERATION_STARTED="loop.iteration.started",e.LOOP_ITERATION_COMPLETED="loop.iteration.completed",e.LOOP_CONDITION_EVALUATED="loop.condition.evaluated",e.LOOP_COMPLETED="loop.completed",e.LOOP_LIMIT_REACHED="loop.limitReached",e.VALIDATION_STARTED="validation.started",e.VALIDATION_FAILED="validation.failed",e.VALIDATION_COMPLETED="validation.completed",e.STORE_READ="store.read",e.STORE_WRITE="store.write",e.STORE_DELETE="store.delete"})(D||(D={}));const S={maxRequestBytes:4e6,maxConcurrentRuns:32,maxEventsPerRun:1e4,maxEventPayloadBytes:256e3,executionTimeoutMs:6e5,eventReplayWindowMs:3e5},P=[D.WORKFLOW_COMPLETED,D.WORKFLOW_FAILED,D.WORKFLOW_CANCELLED];function R(e){return P.includes(e)}function C(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}function T(e){const t=n.Metadata.constr(e);if("function"==typeof t)return t;const o=e.constructor;return"function"==typeof o?o:e}function $(e){if(null!=e)return"string"==typeof e?e:e+""}function G(e,t,o){return $(e?.props?.label??e?.props?.name)??$(t?.name)??o??""}function L(e,t,o){const a=V(e,t);if(a?.model&&"function"==typeof a.model&&r.Model.isModel(a.model))return a.model;const i=n.Metadata.type(e,t);if("function"==typeof i&&r.Model.isModel(i))return i;const s=n.Metadata.getPropDesignTypes?.(e,t)?.designTypes||[];for(const e of s)if("function"==typeof e&&r.Model.isModel(e))return e;const d=o?.[r.ValidationKeys.TYPE]?.customTypes||[];for(const e of d)if("function"==typeof e&&r.Model.isModel(e))return e}function M(e,t){const o=[t,e.path??e.property].filter(Boolean).join(".");return{...e,path:o,children:e.children?.map(e=>M(e,o))}}function F(e){const t=T(e);return n.Metadata.get(t,f.NODE)}function V(e,t){const o=T(e);return n.Metadata.get(o,n.Metadata.key(f.PORT,t+""))}function j(e,t,o,r=new Set){const a=V(e,t);if(!a?.schema)return;const i=L(e,t,n.Metadata.validationFor(e,t));if(!i)return;if(r.has(i))return[];const s=new Set(r);return s.add(e),s.add(i),q(i,s).filter(e=>e.direction===o)}function U(e,t,o=new Set){const a=V(e,t);if(!a)return;const i=n.Metadata.validationFor(e,t),s=L(e,t,i);if(a.schema&&s)return;const d=r.Model.uiElementOf(e,t)||void 0,l=r.Model.uiDecorationOf(e,t,"uiprop"),c=n.Metadata.type(e,t),u=$(a.type??i?.[r.ValidationKeys.TYPE]?.customTypes?.[0]?.name??d?.props?.type??l?.type??c?.name),p=(a.expand||s&&!o.has(s))&&s?(()=>{const n=new Set(o);return n.add(e),n.add(s),q(s,n).map(e=>M(e,t))})():void 0;return{property:t,path:t,direction:a.direction,name:t,label:G(d,l,t),type:u?.toLowerCase(),required:!!i?.[r.ValidationKeys.REQUIRED],hidden:!!r.Model.uiIsHidden(e,t),designType:c?.name,element:d,prop:l,validation:i,graph:a,connectionRules:a.connectionRules,composite:!!p?.length,children:p,model:s?.name}}function B(e){return q(T(e))}function q(e,t=new Set){const o=n.Metadata.properties(e)||[],r=[];for(const n of o){const o=n+"",a=V(e,o);if(a?.schema){const n=j(e,o,a.direction,t);if(n){r.push(...n);continue}}const i=U(e,o,t);i&&r.push(i)}return r}function W(e){return e.flatMap(e=>e.children&&e.children.length?W(e.children):[e])}function H(e){const t=T(e),o=r.Model.uiModelOf(t),a=F(t)||{},i=o?.tag||t.name,s=B(t),d=((e,t)=>{const o=t.portGroups||[],r=new Map(o.map(e=>[e.property,e])),a=[],i=n.Metadata.properties(e)||[];for(const t of i){const o=t+"",i=V(e,o);if(!i?.schema)continue;if(!L(e,o,n.Metadata.validationFor(e,o)))continue;const s=r.get(o);a.push(s?{...s,toggle:s.toggle??"all"}:{property:o,toggle:"all"})}for(const e of o)a.some(t=>t.property===e.property)||a.push(e);return a.length?a:void 0})(t,a),l=a.namespaces?.length?a.namespaces:(e=>{if(null==e)return[];let t,o=e;try{o=n.Metadata.constr(e)}catch{o=e}try{t=n.Metadata.get(o,"auth-namespace")}catch{t=void 0}return C(t)??[]})(t),c=l.length?l:void 0;return{name:t.name,tag:i,kind:a.kind||i,category:a.category,color:a.color,effectiveColor:N(a.color,a.category),group:a.group,height:a.height,icon:a.icon,effectiveIcon:I(a.icon,a.category),labels:a.labels||[],maxChildren:a.maxChildren,minWidth:a.minWidth,width:a.width,shape:a.shape,cornerRadius:a.cornerRadius,sizeRules:a.sizeRules,props:o?.props,ui:o,graph:a,ports:s,portGroups:d,namespaces:c}}const K=new Set,z=new Set;function J(e,t,r){return n.Decoration.for(f.NODE).define({decorator:(e,t,r)=>{const a={kind:t?.kind||e,...t};return t=>{const i=n.apply(o.uimodel(e,r),n.metadata(f.NODE,a))(t);var s;return s=t,K.add(s),i}},args:[e,t,r]}).apply()}function X(e,t){return n.Decoration.for(f.PORT).define({decorator:(e,t)=>(o,r)=>{const a={direction:e,...t};return n.apply(n.propMetadata(n.Metadata.key(f.PORT,r),a))(o,r)},args:[e,t]}).apply()}function Y(e){return X(g.INPUT,{...e,schema:!0})}function Q(e){return X(g.OUTPUT,{...e,schema:!0})}function Z(e){return X(g.CONNECTION,e)}o.RenderingEngine.prototype.renderAsNode=(e,t,...o)=>H(e),n.Metadata.nodes=(()=>[...K]).bind(n.Metadata),n.Metadata.workflows=(()=>[...z]).bind(n.Metadata);const ee=["__proto__","prototype","constructor"];function te(e){return ee.includes(e)}function oe(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function ne(e){return null===e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e}function re(e){return!!ne(e)||(Array.isArray(e)?e.every(e=>re(e)):!!oe(e)&&Reflect.ownKeys(e).every(t=>"string"==typeof t&&!te(t)&&re(e[t])))}function ae(e){if(void 0===e)return!1;if("number"==typeof e)return Number.isFinite(e);if("function"==typeof e)return!1;if(re(e))return!0;if(Array.isArray(e))return e.every(e=>ae(e));if(oe(e)){const t=Reflect.ownKeys(e);for(const o of t){if("string"!=typeof o)return!1;if(te(o))return!1;if(!ae(e[o]))return!1}return!0}return!1}function ie(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>ie(e));const t={};for(const[o,n]of Object.entries(e))t[o]=ie(n);return t}const se={string:"string",char:"string",text:"string",textarea:"string",radio:"string",select:"string",number:"number",integer:"number",float:"number",double:"number",decimal:"number",boolean:"boolean",bool:"boolean",checkbox:"boolean",array:"array",list:"array",set:"array",object:"object",model:"model",any:"any",unknown:"any",enum:"enum"},de={date:"date",datetime:"date-time","date-time":"date-time",duration:"duration"};function le(e){return e?se[e.toLowerCase()]??"any":"any"}function ce(e,t){const o=e[t];if(o&&"object"==typeof o)return o.value}function ue(e,t){const o=ce(e,t);return"number"==typeof o&&Number.isFinite(o)?o:void 0}function pe(e,t,o){const n=e??{},a=(e=>{const t=ce(e,r.ValidationKeys.ENUM);if(Array.isArray(t)&&t.every(ne))return t})(n);if(a)return{type:"enum",values:a};const i=(e=>{const t=e[r.ValidationKeys.TYPE],o=t?.customTypes?.[0],n="function"==typeof o?o.name:o?.name;if(n)return n})(n)??o;return i?{type:"model",name:i}:((e,t)=>{switch(le(e)){case"string":{const t=(e=>{if(e)return de[e.toLowerCase()]})(e);return void 0!==t?{type:"string",format:t}:{type:"string"}}case"number":{const o={type:"number"};e&&"integer"===e.toLowerCase()&&(o.integer=!0);const n=ue(t,r.ValidationKeys.MIN),a=ue(t,r.ValidationKeys.MAX);return void 0!==n&&(o.min=n),void 0!==a&&(o.max=a),o}case"boolean":return{type:"boolean"};case"array":return((e,t)=>{const o={type:"array",items:he(e,t)},n=ue(e,r.ValidationKeys.MIN),a=ue(e,r.ValidationKeys.MAX);return void 0!==n&&(o.minItems=n),void 0!==a&&(o.maxItems=a),o})(t,e);case"object":return{type:"object",properties:{}};case"enum":return{type:"enum",values:[]};case"model":return{type:"model",name:e??"any"};default:return{type:"any"}}})(t,n)}function he(e,t){if((e=>{const t=e[r.ValidationKeys.LIST];return!!t?.clazz?.length})(e))return{type:"model",name:fe(e)};const o=ce(e,r.ValidationKeys.TYPE);if("string"==typeof o){const e=le(o);return"model"===e?{type:"model",name:o}:{type:e}}if(t&&"array"!==t){const e=le(t);return"model"===e?{type:"model",name:t}:{type:e}}return{type:"any"}}function fe(e){const t=e[r.ValidationKeys.LIST],o=t?.clazz?.[0];if("function"!=typeof o)return"any";if(o.name)return o.name;try{const e=o();if("function"==typeof e&&e.name)return e.name}catch{return"any"}return"any"}function ge(e){return"workflow"===e.scope}function me(e){return"node"===e.scope}function ye(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"workflow"===t.scope?"string"==typeof t.port&&2===Reflect.ownKeys(t).length:"node"===t.scope&&"string"==typeof t.nodeId&&"string"==typeof t.port&&3===Reflect.ownKeys(t).length}function we(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e.mode;if("edge"===t)return 1===Reflect.ownKeys(e).length;if("literal"===t){const t=e.value;return 2===Object.keys(e).length&&re(t)}return"expression"===t&&2===Object.keys(e).length&&"string"==typeof e.expression}const _e=["any","string","number","boolean","array","object","enum","model"];function be(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&(e=>_e.includes(e))(e.type)}function ve(e,t={seen:[]}){if(t.seen.includes(e))throw new a.ValidationError(`Document '${(e=>{const t=e?.id;return"string"==typeof t?t:"<unnamed document>"})(e)}' contains a loop body that references itself (cyclic document)`);if("string"!=typeof e.id||!e.id)throw new a.ValidationError("Document 'id' is required and must be a non-empty string");if("string"!=typeof e.name||!e.name)throw new a.ValidationError("Document 'name' is required and must be a non-empty string");const o=new Set;for(const t of[...e.inputs,...e.outputs]){if("string"!=typeof t.id||!t.id)throw new a.ValidationError("Workflow port 'id' is required and must be a non-empty string");if(o.has(t.id))throw new a.ValidationError(`Workflow port '${t.id}' is declared more than once; workflow port ids must be unique`);if(void 0!==t.schema&&!be(t.schema))throw new a.ValidationError(`Workflow port '${t.id}' schema must be a valid GraphValueSchema`);o.add(t.id)}const n={seen:[...t.seen,e]},r=new Set;for(const t of e.nodes)Ne(t,r);for(const t of e.nodes)t.loop&&Ie(t,t.loop,n),t.errorBoundary&&Ee(t,t.errorBoundary,n);const i=new Set;for(const t of e.edges)Oe(t,i);for(const t of e.edges)xe(t.source,0,o,r,`Edge '${t.id}' source`),xe(t.target,0,o,r,`Edge '${t.id}' target`);if(void 0!==e.settings&&!ae(e.settings))throw new a.ValidationError("Document settings must be JSON-safe (a map of JSON-safe values)");if(void 0!==e.metadata&&!ae(e.metadata))throw new a.ValidationError("Document metadata must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed");if(void 0!==e.ui&&!ae(e.ui))throw new a.ValidationError("Document ui must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed")}function Ne(e,t){if("string"!=typeof e.id||!e.id)throw new a.ValidationError("Node 'id' is required and must be a non-empty string");if(t.has(e.id))throw new a.ValidationError(`Node id '${e.id}' is declared more than once; node ids must be unique`);if("string"!=typeof e.kind||!e.kind)throw new a.ValidationError(`Node '${e.id}' must declare a non-empty string 'kind'`);if(void 0===e.parameters||null===e.parameters)throw new a.ValidationError(`Node '${e.id}' parameters must be present (an empty object when there are none)`);if(t.add(e.id),e.inputBindings)for(const[t,o]of Object.entries(e.inputBindings)){if(te(t))throw new a.ValidationError(`Node '${e.id}' input binding key '${t}' is not allowed (unsafe prototype-pollutant key)`);if(!we(o))throw new a.ValidationError(`Node '${e.id}' input binding for '${t}' must be a valid GraphInputBinding (edge, literal, or expression)`);if("literal"===o.mode&&!ae(o.value))throw new a.ValidationError(`Node '${e.id}' literal binding for '${t}' must contain JSON-safe values`);if("expression"===o.mode&&!o.expression)throw new a.ValidationError(`Node '${e.id}' expression binding for '${t}' must contain a non-empty expression`)}if(e.outputBindings)for(const[t,o]of Object.entries(e.outputBindings)){if(te(t))throw new a.ValidationError(`Node '${e.id}' output binding key '${t}' is not allowed (unsafe prototype-pollutant key)`);if(!o||"object"!=typeof o||Array.isArray(o))throw new a.ValidationError(`Node '${e.id}' output binding for '${t}' must be an object with enabled and alias settings`)}if(!ae(e.parameters))throw new a.ValidationError(`Node '${e.id}' parameters must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`);if(void 0!==e.state){if(!e.state||"object"!=typeof e.state||Array.isArray(e.state))throw new a.ValidationError(`Node '${e.id}' state must be an object when present`);if(!ae(e.state))throw new a.ValidationError(`Node '${e.id}' state must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`)}}function Ie(e,t,o){if(!t.body||"object"!=typeof t.body)throw new a.ValidationError(`Node '${e.id}' loop configuration requires a body document`);if(ve(t.body,o),!(void 0===t.maxIterations||Number.isFinite(t.maxIterations)&&t.maxIterations>0))throw new a.ValidationError(`Node '${e.id}' loop maxIterations must be a positive number`);if(void 0!==t.timeoutMs&&("number"!=typeof t.timeoutMs||0>=t.timeoutMs))throw new a.ValidationError(`Node '${e.id}' loop timeoutMs must be a positive number in milliseconds`);if(void 0!==t.concurrency&&("number"!=typeof t.concurrency||0>=t.concurrency))throw new a.ValidationError(`Node '${e.id}' loop concurrency must be a positive number`);for(const o of[t.inputMappings,t.outputMappings])if(o)for(const[t,n]of Object.entries(o)){if(te(t))throw new a.ValidationError(`Node '${e.id}' loop mapping key '${t}' is not allowed (unsafe prototype-pollutant key)`);Ae(n,e.id,t)}}function Ee(e,t,o){if(!t.try||"object"!=typeof t.try)throw new a.ValidationError(`Node '${e.id}' error-boundary configuration requires a try body document`);ve(t.try,o);for(const[n,r]of[["catch",t.catch],["finally",t.finally]])if(void 0!==r){if(!r||"object"!=typeof r)throw new a.ValidationError(`Node '${e.id}' error-boundary ${n} body must be a document`);ve(r,o)}}function Ae(e,t,o){if(!e||"object"!=typeof e)throw new a.ValidationError(`Node '${t}' loop mapping '${o}' must reference a workflow port, node port, literal, or expression`);switch(e.source){case"workflow":if("string"!=typeof e.port||!e.port)throw new a.ValidationError(`Node '${t}' loop mapping '${o}' referencing a workflow must reference a port identifier`);break;case"node":if("string"!=typeof e.nodeId||!e.nodeId||"string"!=typeof e.port||!e.port)throw new a.ValidationError(`Node '${t}' loop mapping '${o}' referencing a node must reference a node id and a port`);break;case"literal":if(!ae(e.value))throw new a.ValidationError(`Node '${t}' loop mapping '${o}' literal references must be JSON-safe values`);break;case"expression":if("string"!=typeof e.expression||!e.expression)throw new a.ValidationError(`Node '${t}' loop mapping '${o}' expression references must be non-empty expressions`);break;default:throw new a.ValidationError(`Node '${t}' loop mapping '${o}' must use a workflow, node, literal, or expression reference source`)}}function Oe(e,t){if("string"!=typeof e.id||!e.id)throw new a.ValidationError("Edge 'id' is required and must be a non-empty string");if(t.has(e.id))throw new a.ValidationError(`Edge id '${e.id}' is declared more than once; edge ids must be unique`);if(!ye(e.source))throw new a.ValidationError(`Edge '${e.id}' source endpoint is not a valid GraphEndpoint`);if(!ye(e.target))throw new a.ValidationError(`Edge '${e.id}' target endpoint is not a valid GraphEndpoint`);if("data"!==e.type&&"connection"!==e.type)throw new a.ValidationError(`Edge '${e.id}' type '${e.type+""}' is not a valid edge type (data or connection are allowed)`);if(t.add(e.id),!ae(e))throw new a.ValidationError(`Edge '${e.id}' contains values that are not JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`)}function xe(e,t,o,n,r){if(ge(e)){if(!o.has(e.port))throw new a.ValidationError(`${r} references workflow port '${e.port}' which is not declared on the document`)}else if(me(e)){if(!n.has(e.nodeId))throw new a.ValidationError(`${r} references node '${e.nodeId}' which is not part of the document`);if("string"!=typeof e.port||!e.port)throw new a.ValidationError(r+" node endpoints must reference a non-empty port identifier")}}const ke=["expression","template"],De=["javascript","typescript","json","text"];function Se(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return!(!(e=>ke.includes(e))(t.mode)||"string"!=typeof t.expression||!t.expression||void 0!==t.language&&!(e=>De.includes(e))(t.language)||void 0!==t.metadata&&!re(t.metadata))}function Pe(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.name&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.nodes)&&Array.isArray(t.edges)}function Re(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.type&&(void 0===t.required||"boolean"==typeof t.required)&&(void 0===t.displayName||"string"==typeof t.displayName)&&(void 0===t.allowedOperations||Array.isArray(t.allowedOperations)&&t.allowedOperations.every(e=>"string"==typeof e))}const Ce=["trigger","loop","branching","stateful","retryable","cancellable","parallel","resource"];function Te(e){return Ce.includes(e)}function $e(e){if(!(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.kind&&"object"==typeof t.display&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.parameters)})(e))throw new a.ValidationError("Graph node manifest does not conform to the required shape");if(!ae(e))throw new a.ValidationError("Graph node manifest contains values that are not JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys or unsafe prototype keys are not allowed on manifests")}const Ge=["loadOptions","listSearch","resourceLocator","resourceMapping","validateParameter","action"];function Le(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.name&&(e=>Ge.includes(e))(t.type)&&(void 0===t.parameter||"string"==typeof t.parameter)&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every(e=>"string"==typeof e))}function Me(e){const t=e.element?.props?.value,o=t??e.prop?.value??e.validation?.defaultValue;if(void 0!==o&&"function"!=typeof o&&ae(o))try{return JSON.parse(JSON.stringify(o))}catch{return}}function Fe(e){if(e.type&&e.type in de)return{type:"string",format:de[e.type]};const t=(e=>{for(const t of[e.graph?.type,e.element?.props?.type,e.prop?.type])if("string"==typeof t&&"any"!==le(t))return t})(e);return t?pe((e=>{if(!e)return;const t=Object.entries(e).filter(([e])=>e!==r.ValidationKeys.TYPE);return Object.fromEntries(t)})(e.validation),t):pe(e.validation,e.type,e.model)}function Ve(e){const t={};for(const[o,n]of Object.entries(e.graph?.metadata??{}))ae(n)&&(t[o]=JSON.parse(JSON.stringify(n)));return Object.keys(t).length?t:void 0}function je(e){switch(e){case"output":return"output";case"connection":return"connection";default:return"input"}}function Ue(e){const t=e.graph?.handle;return"connection"!==e.direction&&"string"==typeof t&&t?t:e.path??e.property}function Be(e,t){const o={id:Ue(e),label:e.label,direction:je(e.direction),schema:Fe(e)};e.required&&(o.required=!0),e.hidden&&(o.hidden=!0);const n=e.graph?.category;"string"==typeof n&&(o.category=n),!0===e.graph?.userControlled&&(o.configurable=!0);const r=e.graph?.handle;"string"==typeof r&&(o.handle=r);const a=Ze(e.graph?.connectionRules)??t;a&&(o.connectionPolicy=a);const i=(e=>{const t=e.element;if(!t||!ae(t))return;const o=t.tag;if("string"!=typeof o)return;const n=t.props;return{tag:o,serialize:!0===t.serialize,props:n&&"object"==typeof n&&!Array.isArray(n)?ie(n):{}}})(e);i&&(o.element=i);const s=Ve(e);return s&&(o.metadata=s),o}function qe(e){const t={type:"string",id:Ue(e),label:e.label,required:e.required};if(e.hidden)return((e,t)=>{const o={...t,type:"hidden"},n=Me(e);return void 0!==n&&(o.defaultValue=n),We(o)})(e,t);const o=Me(e);void 0!==o&&(t.defaultValue=o);const n=(e=>{const t=e.element?.props?.placeholder??e.prop?.placeholder;return"string"==typeof t?t:void 0})(e);n&&(t.placeholder=n);const r=Ve(e);if(r&&(t.metadata=r),(e=>{const t=ze(e);return"code"===t||"code-editor"===t})(e))return We({...t,type:"code",language:Ye(e)});const a=Fe(e);switch(a.type){case"number":{const o={...t,type:"number",integer:a.integer,min:a.min,max:a.max},n=Ke(e.validation?.step);return void 0!==n&&(o.step=n),We(o)}case"boolean":return We({...t,type:"boolean"});case"enum":return We({...t,type:"options",options:a.values.map(e=>({value:e,label:e+""}))});case"array":{const e={...t,type:"collection"};return void 0!==a.maxItems&&(e.maxItems=a.maxItems),We(e)}case"object":case"model":return We({...t,type:"object"});default:return We({...t,type:"string",multiline:!!Je(e)||void 0,pattern:He(e.validation?.pattern),minLength:Ke(e.validation?.minlength),maxLength:Ke(e.validation?.maxlength)})}}function We(e){const t=e;for(const e of Object.keys(t))void 0===t[e]&&delete t[e];return e}function He(e){const t=e?.value;return"string"==typeof t?t:void 0}function Ke(e){const t=e?.value;return"number"==typeof t&&Number.isFinite(t)?t:void 0}function ze(e){const t=e.element?.tag;return"string"==typeof t&&t?t:void 0}function Je(e){return"textarea"===ze(e)||"textarea"===(e=>{const t=e.element?.props?.type;return"string"==typeof t?t:void 0})(e)}const Xe=["javascript","typescript","json","text"];function Ye(e){const t=e.element?.props?.language;return"string"==typeof t&&Xe.includes(t)?t:"javascript"}function Qe(e,t){const o={name:t.name??e.name},n=e.graph?.metadata?.description??void 0;"string"==typeof n&&n&&(o.description=n);const r=t.category??e.category;"string"==typeof r&&r&&(o.category=r),"string"==typeof e.group&&e.group&&(o.group=e.group),Array.isArray(e.labels)&&(o.labels=e.labels.slice());const a=((e,t)=>{if(t.icon)return t.icon;const o=e.effectiveIcon??e.icon;return"string"==typeof o?{type:"catalogue",name:o}:{type:"catalogue",name:"ph:circuitry"}})(e,t);return a&&(o.icon=a),"string"==typeof e.color&&e.color&&(o.color=e.color),"number"==typeof e.width&&Number.isFinite(e.width)&&(o.width=e.width),"number"==typeof e.minWidth&&Number.isFinite(e.minWidth)&&(o.minWidth=e.minWidth),"number"==typeof e.height&&Number.isFinite(e.height)&&(o.height=e.height),"string"==typeof e.shape&&(o.shape=e.shape),"number"==typeof e.cornerRadius&&Number.isFinite(e.cornerRadius)&&(o.cornerRadius=e.cornerRadius),Array.isArray(e.sizeRules)&&(o.sizeRules=e.sizeRules),o}function Ze(e){if(!e)return;const t=e,o={};"boolean"==typeof t.allowSelf&&(o.allowSelf=t.allowSelf),"boolean"==typeof t.allowMultiple&&(o.allowMultiple=t.allowMultiple);const n=t.allowedKinds;Array.isArray(n)&&n.every(e=>"string"==typeof e)&&(o.allowedNodeKinds=n);const r=t.blockedKinds;Array.isArray(r)&&r.every(e=>"string"==typeof e)&&(o.blockedNodeKinds=r);const a=t.maxConnections;return"number"==typeof a&&Number.isFinite(a)&&(o.maxConnections=a),Object.keys(o).length?o:void 0}function et(e,t={}){const o="function"==typeof e?e:e.constructor;if(!F(o))throw new a.ValidationError(`Node '${o?.name??e+""}' is not decorated with @node and cannot produce a manifest`);const n=H(o),r=W(B(o)),i=[],s=[],d=[],l=[],c=Ze(n.graph?.connectionRules);for(const e of r)("connection"===e.direction?d:"output"===e.direction?s:i).push(Be(e,c)),"input"===e.direction&&l.push(qe(e));const u={kind:t.kind??n.kind??n.name,display:Qe(n,t),inputs:i,outputs:s,parameters:l};return d.length&&(u.connections=d),n.namespaces?.length&&(u.namespaces=n.namespaces.slice()),$e(u),u}let tt=class extends s.BaseModel{constructor(e){super(e)}};i.__decorate([s.pk({type:String,generated:!1}),n.description("Unique graph run id"),o.uielement("ngx-decaf-crud-field",{label:"graph.run.id.label",readonly:!0}),i.__metadata("design:type",String)],tt.prototype,"runId",void 0),i.__decorate([s.column(),r.required(),s.index(),n.description("Workflow document id the run executes"),o.uilistprop("workflowId"),o.uielement("ngx-decaf-crud-field",{label:"graph.run.workflowId.label"}),i.__metadata("design:type",String)],tt.prototype,"workflowId",void 0),i.__decorate([s.column(),n.description("Owning user; absent for anonymous callers"),o.uielement("ngx-decaf-crud-field",{label:"graph.run.owner.label"}),i.__metadata("design:type",String)],tt.prototype,"owner",void 0),i.__decorate([s.column(),r.required(),r.type(String),s.index(),n.description("Current run lifecycle status"),o.uilistprop("status"),o.uielement("ngx-decaf-crud-field",{label:"graph.run.status.label",readonly:!0}),i.__metadata("design:type",String)],tt.prototype,"status",void 0),i.__decorate([s.column(),n.description("Fingerprint of the executed document"),o.uielement("ngx-decaf-crud-field",{label:"graph.run.fingerprint.label",readonly:!0}),i.__metadata("design:type",String)],tt.prototype,"documentFingerprint",void 0),i.__decorate([s.column(),n.prop(),n.description("Workflow input values keyed by input port id"),i.__metadata("design:type",Object)],tt.prototype,"inputs",void 0),i.__decorate([s.column(),n.prop(),n.description("Execution result, present on successful completion"),i.__metadata("design:type",Object)],tt.prototype,"result",void 0),i.__decorate([s.column(),n.prop(),n.description("Structured error payload, present on failure"),i.__metadata("design:type",Object)],tt.prototype,"error",void 0),i.__decorate([r.date(),s.column(),n.description("Run creation timestamp"),i.__metadata("design:type",Date)],tt.prototype,"createdAt",void 0),i.__decorate([r.date(),s.column(),n.description("Execution start timestamp, once it has started"),i.__metadata("design:type",Date)],tt.prototype,"startedAt",void 0),i.__decorate([r.date(),s.column(),n.description("Terminal-state timestamp, once the run has finished"),i.__metadata("design:type",Date)],tt.prototype,"finishedAt",void 0),tt=i.__decorate([o.uilistmodel("ngx-decaf-list-item",{icon:"ti-player-play"}),o.uimodel("ngx-decaf-crud-form"),n.description("Persistable graph run lifecycle record"),s.table("graph_run"),r.model(),i.__metadata("design:paramtypes",[Object])],tt);let ot=class extends s.BaseModel{constructor(e){super(e)}};i.__decorate([s.pk({type:String,generated:!1}),i.__metadata("design:type",String)],ot.prototype,"workflowId",void 0),i.__decorate([s.column(),i.__metadata("design:type",String)],ot.prototype,"name",void 0),i.__decorate([s.column(),i.__metadata("design:type",Object)],ot.prototype,"document",void 0),i.__decorate([s.column(),i.__metadata("design:type",String)],ot.prototype,"owner",void 0),i.__decorate([s.column(),i.__metadata("design:type",Object)],ot.prototype,"snapshot",void 0),ot=i.__decorate([s.table("graph_workflow"),r.model(),i.__metadata("design:paramtypes",[Object])],ot),v("Trigger",{color:"#3b82f6",icon:"ti-bolt"}),v("Flow Control",{color:"#f59e0b",icon:"ti-arrows-split-2"}),v("Utility",{color:"#0d9488",icon:"ti-tool"}),v("Loop",{color:"#eab308",icon:"ti-repeat"}),v("Workflow",{color:"#f97316",icon:"ti-sitemap"}),v("Pipeline",{color:"#0ea5e9",icon:"ti-git-merge"}),v("Node",{color:"#8b5cf6",icon:"ti-point-filled"}),v("Agent",{color:"#7c3aed",icon:"ti-robot"}),v("model",{color:"#3b82f6",icon:"ti-cpu"}),v("memory",{color:"#10b981",icon:"ti-database"}),v("workspace",{color:"#f59e0b",icon:"ti-folder"});const nt=new Set;function rt(e,t){return e.config[t]}function at(e){return Array.isArray(e)?e.map(e=>e+"").join(", "):e+""}(()=>{const e=[{key:k.NODE_ID,shouldInclude:e=>null!=rt(e,k.NODE_ID),render:e=>rt(e,k.NODE_ID)+""},{key:k.WORKFLOW_ID,shouldInclude:e=>null!=rt(e,k.WORKFLOW_ID),render:e=>rt(e,k.WORKFLOW_ID)+""},{key:k.RUN_ID,shouldInclude:e=>null!=rt(e,k.RUN_ID),render:e=>rt(e,k.RUN_ID)+""},{key:k.USER,shouldInclude:e=>null!=rt(e,k.USER),render:e=>rt(e,k.USER)+""},{key:k.ROLES,shouldInclude(e){const t=rt(e,k.ROLES);return Array.isArray(t)&&t.length>0},render:e=>at(rt(e,k.ROLES))},{key:k.NAMESPACES,shouldInclude(e){const t=rt(e,k.NAMESPACES);return Array.isArray(t)&&t.length>0},render:e=>at(rt(e,k.NAMESPACES))},{key:k.ORGANIZATION,shouldInclude:e=>null!=rt(e,k.ORGANIZATION),render:e=>rt(e,k.ORGANIZATION)+""},{key:k.IP,shouldInclude:e=>null!=rt(e,k.IP),render:e=>rt(e,k.IP)+""}];for(const o of e)nt.has(o.key)||(t.logParameterRegistry.register(o),nt.add(o.key))})();const it="$workflow",st=1e3,dt=1e4,lt=3e4;var ct,ut;e.GraphPinningStrategy=void 0,(ct=e.GraphPinningStrategy||(e.GraphPinningStrategy={})).MANUAL="manual",ct.AUTOMATIC="automatic",ct.DISABLED="disabled",e.GraphConditionType=void 0,(ut=e.GraphConditionType||(e.GraphConditionType={})).TRUTHY="truthy",ut.FALSY="falsy",ut.EQUALS="equals",ut.NOT_EQUALS="notEquals",ut.GREATER_THAN="greaterThan",ut.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",ut.LESS_THAN="lessThan",ut.LESS_THAN_OR_EQUAL="lessThanOrEqual",ut.EXISTS="exists",ut.CUSTOM="custom";class pt extends a.InternalError{constructor(e,t="GRAPH_EXECUTION_ERROR",o){super(e,pt.name,500),this.graphCode=t,this.details=o,this.name=this.constructor.name}}class ht extends pt{constructor(e){super("Graph workflow contains an unsupported cycle","GRAPH_CYCLE_ERROR",e)}}class ft extends pt{constructor(e,t){super(e,"GRAPH_INPUT_ERROR",t)}}class gt extends pt{constructor(e,t){super(e,"GRAPH_LOOP_LIMIT_ERROR",t)}}class mt extends pt{constructor(e,t){super(e,"GRAPH_PINNING_ERROR",t)}}class yt extends pt{constructor(e,t){super(e,"GRAPH_STORE_ERROR",t)}}class wt extends pt{constructor(e,t){super(e,"GRAPH_TOPOLOGY_ERROR",t)}}class _t extends pt{constructor(e){super("Break signal","GRAPH_BREAK_SIGNAL",{value:e}),this.isBreakSignal=!0,this.name="GraphBreakSignal"}}class bt extends pt{constructor(e){super(`Graph run '${e}' was cancelled`,"GRAPH_RUN_CANCELLED",{runId:e}),this.name=bt.name}}class vt extends a.ValidationError{constructor(e){super(`Graph workflow document rejected with ${e.length} issue(s): ${e.map(e=>`${e.code} at ${e.path} (${e.message})`).join("; ")}`),this.name=vt.name,this.issues=e}}class Nt{constructor(){this.observers=new Set}observe(e){return this.observers.add(e),()=>this.unObserve(e)}unObserve(e){this.observers.delete(e)}async updateObservers(e){await Promise.all(Array.from(this.observers).map(async t=>{try{await Promise.resolve(t.refresh(e))}catch{}}))}}class It{constructor(){this.sequence=0}create(e){return{...e,id:this.createEventId(),sequence:++this.sequence,timestamp:new Date}}createEventId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new pt("Cannot generate a graph event id: crypto.randomUUID is unavailable in this runtime","GRAPH_EVENT_ID_ERROR",{runtime:typeof globalThis.crypto});return e.randomUUID()}}function Et(e){if("string"!=typeof e)return;const t=e.trim();if(!t)return;const o=t.split(".");if(3!==o.length)return;const n=o[0].trim(),r=o[2].trim(),a=o[1].split(",").map(e=>e.trim()).filter(e=>e.length>0);return n&&r&&0!==a.length?{organization:n,departments:a,role:r}:void 0}function At(e){return`${e.organization}.${e.departments.join(",")}.${e.role}`}function Ot(e){if(!e||"string"!=typeof e.namespace||!e.parts)return!1;const t=Et(e.namespace);return!!t&&At(t)===At(e.parts)}function xt(e,t){const o="string"==typeof e?e.trim():"";if(o){if(t)for(const e of t)if(e&&e.namespace===o&&Ot(e))return e.parts;return Et(o)}}function kt(e,t,o={},n){const r=xt(e,n),a=xt(t,n);return!(!r||!a)&&r.organization===a.organization&&r.role===a.role&&("exact"===(o.mode??"inherit")?r.departments.length===a.departments.length&&r.departments.every((e,t)=>e===a.departments[t]):r.departments.length<=a.departments.length&&r.departments.every((e,t)=>e===a.departments[t]))}function Dt(e,t,o={},n){return e.filter(e=>!t.some(t=>kt(t,e,o,n)))}function St(e){return e.filter(e=>void 0===Et(e))}function Pt(e,t){const o=new Set;for(const n of e){const e=xt(n,t);e&&o.add(e.role)}return[...o]}function Rt(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}function Ct(e,t){try{const o=e.cache;if(o&&void 0!==o[t]&&null!==o[t])return o[t]}catch{}try{return e.get(t)}catch{return}}function Tt(e){if(!e)return{};const t={},o=e.user;"string"==typeof o&&o&&(t.user=o);const n=e.organization;"string"==typeof n&&n&&(t.organization=n);const r=e.ip;"string"==typeof r&&r&&(t.ip=r);const a=Rt(e.roles);a&&(t.roles=a);const i=Rt(e.namespaces);return i&&(t.namespaces=i,t.namespaceCache=Gt(i)),t}function $t(e){return e?Tt({user:Ct(e,"user"),organization:Ct(e,"organization"),ip:Ct(e,"ip"),roles:Ct(e,"roles"),namespaces:Ct(e,"namespaces")}):{}}function Gt(e){const t=[];for(const o of e){const e=Et(o);e&&t.push({namespace:o,parts:e})}return t}function Lt(...e){const t={};for(const o of e)o&&(void 0!==o.user&&(t.user=o.user),void 0!==o.organization&&(t.organization=o.organization),void 0!==o.ip&&(t.ip=o.ip),void 0!==o.roles&&(t.roles=o.roles),void 0!==o.namespaces&&(t.namespaces=o.namespaces),void 0!==o.namespaces?t.namespaceCache=o.namespaceCache??Gt(o.namespaces):void 0!==o.namespaceCache&&(t.namespaceCache=o.namespaceCache));return t}class Mt{constructor(e={}){this.options=e}get enabled(){return!0===this.options.enabled}validate(e,o,n,r){if(!this.enabled)return;const a=r??this.options.logger??t.Logging.for("GraphAuth"),i=e.id||e.name||o.workflowId,s=(e=>{if(!e||"object"!=typeof e)return;const t=e.auth;return t&&"object"==typeof t&&!Array.isArray(t)?(e=>{if(!e)return;const t=C(e.namespaces),o=C(e.roles);if(!t&&!o)return;const n={};return t&&(n.namespaces=t),o&&(n.roles=o),n})(t):void 0})(e.metadata);this.assertGranted(`workflow '${i}'`,s?.namespaces??[],n,s?.roles??[],a);for(const e of o.nodes)this.assertGranted(`node '${e.id}'`,e.manifest.namespaces??[],n,[],a)}assertGranted(e,t,o,n,r){const a=o.namespaces??[],i=Dt(t,a,this.options.match,o.namespaceCache),d=Pt(a,o.namespaceCache),l=n.filter(e=>!d.includes(e));if(0===i.length&&0===l.length)return;const c=[...new Set([...St(t),...St(a)])],u=[];throw i.length&&u.push("namespace(s) "+i.join(", ")),l.length&&u.push("role(s) "+l.join(", ")),r.warn(`Graph access denied for ${e} for user ${o.user??"anonymous"}: missing ${u.join(" and ")}${c.length?`; malformed namespace(s) ${c.join(", ")} failed closed`:""}`),new s.ForbiddenError(`Access to ${e} requires ${u.join(" and ")}`)}}class Ft{constructor(e){this.baseOptions=e,this.inner=t.Logging.for("GraphRun").for(this.attributeConfig(e))}attributeConfig(e){return{[k.NODE_ID]:e.nodeId,[k.WORKFLOW_ID]:e.workflowId,[k.RUN_ID]:e.runId,[k.USER]:e.user??null,[k.ROLES]:e.roles,[k.NAMESPACES]:e.namespaces,[k.ORGANIZATION]:e.organization,[k.IP]:e.ip}}emit(e,t,o){const n="string"==typeof t?t:t instanceof Error?t.message:t+"",r={level:e,message:n,timestamp:(new Date).toISOString(),runId:this.baseOptions.runId,workflowId:this.baseOptions.workflowId,nodeId:this.baseOptions.nodeId,user:this.baseOptions.user??null};void 0!==this.baseOptions.roles&&(r.roles=this.baseOptions.roles),void 0!==this.baseOptions.namespaces&&(r.namespaces=this.baseOptions.namespaces),void 0!==this.baseOptions.organization&&(r.organization=this.baseOptions.organization),void 0!==this.baseOptions.ip&&(r.ip=this.baseOptions.ip),void 0!==o&&(r.payload=o),this.baseOptions.forward({type:D.GRAPH_RUN_LOG,payload:r}).catch(()=>{}),{benchmark:(e,t)=>this.inner.benchmark(e,t),fatal:(e,t)=>this.inner.fatal(e,t),critical:(e,t)=>this.inner.critical(e,t),silly:(e,t)=>this.inner.silly(e,t),trace:(e,t)=>this.inner.trace(e,t),verbose:(e,t)=>this.inner.verbose(e,t),info:(e,t)=>this.inner.info(e,t),warn:(e,t)=>this.inner.warn(e,t),error:(e,t)=>this.inner.error(e,t),debug:(e,t)=>this.inner.debug(e,t)}[e](n,o)}benchmark(e,t){this.emit("benchmark",e,t)}fatal(e,t,o){this.emit("fatal",e,t??o)}critical(e,t,o){this.emit("critical",e,t??o)}silly(e,t,o){this.emit("silly",e,"object"==typeof t?t:o)}trace(e,t){this.emit("trace",e,t)}verbose(e,t,o){this.emit("verbose",e,"object"==typeof t?t:o)}info(e,t){this.emit("info",e,t)}error(e,t,o){this.emit("error",e,t??o)}warn(e,t){this.emit("warn",e,t)}debug(e,t){this.emit("debug",e,t)}action(e,t,o){this.inner.action(e,t,o)}setConfig(){}for(e,t,...o){return this}clear(){return this}get root(){return this.inner.root}}function Vt(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}class jt extends s.Context{constructor(e,t,o,n,r,a,i,s,d={},l,c,u){super(),this.runId=e,this.parentRunId=t,this.workflowId=o,this.document=n,this.node=r,this.manifest=a,this.path=i,this.emitFn=s,this.metadata=d,this.engine=l,this.abortSignal=c,this.limits=u;const p=Tt(d);this.accumulate({...p,operation:"execute"});const h="string"==typeof d?.user?d.user:null;this.runLogger=new Ft({runId:e,workflowId:o,nodeId:r.id,user:h,roles:Vt(d?.roles),namespaces:Vt(d?.namespaces),organization:"string"==typeof d?.organization?d.organization:void 0,ip:"string"==typeof d?.ip?d.ip:void 0,forward:async e=>{await this.emit(e)}})}get logger(){return this.runLogger}get auth(){return $t(this)}async emit(e){await this.emitFn({...e,runId:this.runId,parentRunId:this.parentRunId,workflowId:this.workflowId,nodeId:this.node.id,path:e.path??this.path})}async progress(e){await this.emit({type:D.NODE_OUTPUT,payload:e})}async log(e,t){await this.emit({type:D.NODE_OUTPUT,payload:{message:e,payload:t}})}}class Ut{constructor(e,t,o,n){this.nodeResults=new Map,this.events=[],this.activeDataEdges=new Set,this.runId=e,this.plan=t,this.valueStore=o,this.eventFactory=n,this.startedAt=new Date}recordNodeResult(e){this.nodeResults.set(e.nodeId,e)}activateDataEdge(e){this.activeDataEdges.add(e)}isDataEdgeActive(e){return this.activeDataEdges.has(e)}appendEvent(e){this.events.push(e)}finish(){this.finishedAt=new Date}}function Bt(e,t,o,n,r){const a=e.valueStore.getWorkflowValues(),i={};for(const[t,o]of e.nodeResults)i[t]=o;const s=[...e.events];return{runId:e.runId,workflowId:t.id||t.name,status:n,document:t,inputs:{...o},outputs:a,nodeResults:i,events:s,startedAt:e.startedAt,finishedAt:e.finishedAt,metadata:r}}class qt{constructor(e){this.catalogue=e}async resolveNodes(e,t,o,...n){const r=new Map;for(const[a,i]of e.entries()){const e=`nodes[${a}]`;if(this.catalogue.has(i.kind,...n))try{const e=await this.catalogue.resolveManifest(i.kind,i,o,...n),t=this.catalogue.getExecutor(i.kind,...n);r.set(i.id,{instance:i,manifest:e,executor:t})}catch(o){t.push({code:"kind.resolution-failed",path:e+".kind",message:`Node '${i.id}' kind '${i.kind}' failed to resolve: ${o.message}`,nodeId:i.id,details:{kind:i.kind}})}else t.push({code:"kind.unknown",path:e+".kind",message:`Node '${i.id}' references kind '${i.kind}' which is not registered in the backend catalogue`,nodeId:i.id,details:{kind:i.kind}})}return r}validateEffectivePorts(e,t,o,n){const r=!0===t.policies?.allowUndeclaredParameters,a=new Set(t.inputs.map(e=>e.id)),i=new Set(t.outputs.map(e=>e.id));for(const i of Object.keys(e.inputBindings??{}))r||a.has(i)||o.push({code:"binding.unknown-port",path:`${n}.inputBindings.${i}`,message:`Node '${e.id}' input binding '${i}' does not refer to an effective input port of kind '${t.kind}'`,nodeId:e.id,details:{effectiveInputs:[...a]}});for(const a of Object.keys(e.outputBindings??{}))r||i.has(a)||o.push({code:"binding.unknown-port",path:`${n}.outputBindings.${a}`,message:`Node '${e.id}' output binding '${a}' does not refer to an effective output port of kind '${t.kind}'`,nodeId:e.id,details:{effectiveOutputs:[...i]}})}}function Wt(e,t,o="$"){const n=new Set;for(const t of e.edges)"node"===t.source.scope&&n.add(t.source.nodeId),"node"===t.target.scope&&n.add(t.target.nodeId);for(const r of e.nodes){n.has(r.id)||t.push({code:"topology.loose-node",path:`${o}.nodes[${r.id}]`,message:`Node '${r.id}' is connected to nothing; every node must participate in at least one edge`,nodeId:r.id});const e=r.loop?.body;e&&Wt(e,t,`${o}.nodes[${r.id}].loop.body`)}}function Ht(e,t){if(!t)return{valid:!0};switch(t.type){case"any":default:return{valid:!0};case"string":return"string"!=typeof e?Kt("string"):{valid:!0};case"number":return"number"==typeof e&&Number.isFinite(e)?t.integer&&!Number.isInteger(e)?{valid:!1,message:"expected an integer number"}:void 0!==t.min&&e<t.min?{valid:!1,message:"expected a number >= "+t.min}:void 0!==t.max&&e>t.max?{valid:!1,message:"expected a number <= "+t.max}:{valid:!0}:Kt("number");case"boolean":return"boolean"!=typeof e?Kt("boolean"):{valid:!0};case"array":if(!Array.isArray(e))return Kt("array");if(void 0!==t.minItems&&e.length<t.minItems)return{valid:!1,message:`expected at least ${t.minItems} items`};if(void 0!==t.maxItems&&e.length>t.maxItems)return{valid:!1,message:`expected at most ${t.maxItems} items`};for(const o of e){const e=Ht(o,t.items);if(!e.valid)return e}return{valid:!0};case"object":case"model":{if(null===e||"object"!=typeof e||Array.isArray(e))return Kt(t.type);const o=t,n=o.properties;if(!n)return{valid:!0};for(const[t,o]of Object.entries(n))if(t in e){const n=Ht(e[t],o);if(!n.valid)return{valid:!1,message:`property '${t}': ${n.message}`}}if(o.required)for(const t of o.required)if(!(t in e))return{valid:!1,message:`missing required property '${t}'`};if(!1===o.additionalProperties)for(const t of Object.keys(e))if(!(t in n))return{valid:!1,message:`unexpected property '${t}'`};return{valid:!0}}case"enum":return t.values.some(t=>t===e)?{valid:!0}:{valid:!1,message:"value is not one of the enum values"}}}function Kt(e){return{valid:!1,message:`expected a ${e} value`}}function zt(e){if("string"==typeof e)return e.length>0;if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.credentialId&&t.credentialId.length>0&&(void 0===t.credentialType||"string"==typeof t.credentialType)}const Jt=new Set(["loop"]),Xt=["secret","secrets","password","passwd","token","accessToken","refreshToken","apiKey","api_key","privateKey","credentials"];class Yt{validate(e,t,o,n,r){this.validateParameters(e,t,o,n,r),this.validateMetadataKeys(e,t,o,n),this.validateDisabledBehavior(e,o,n),this.validateBindingShapes(e,t,o,n)}validateParameters(e,t,o,n,r){const a=!0===t.policies?.allowUndeclaredParameters,i=new Map(t.parameters.map(e=>[e.id,e]));for(const[r,s]of Object.entries(e.parameters??{})){const d=i.get(r);if(!d){a||o.push({code:"parameter.undeclared",path:`${n}.parameters.${r}`,message:`Node '${e.id}' sets parameter '${r}' which is not declared by kind '${t.kind}'`,nodeId:e.id,details:{kind:t.kind}});continue}if(void 0===s){o.push({code:"parameter.invalid",path:`${n}.parameters.${r}`,message:`Node '${e.id}' parameter '${r}' must not be undefined`,nodeId:e.id});continue}const l=this.checkParameterValue(s,d);l.valid||o.push({code:"parameter.type-mismatch",path:`${n}.parameters.${r}`,message:`Node '${e.id}' parameter '${r}' is invalid: ${l.message}`,nodeId:e.id,details:{expectedType:d.type}})}for(const a of t.parameters)void 0===(e.parameters??{})[a.id]&&(this.isParameterSatisfiedByInput(e,a.id,r)||(!0===a.required||(a.validation??[]).some(e=>"required"===e.kind))&&void 0===a.defaultValue&&o.push({code:"parameter.required-missing",path:`${n}.parameters.${a.id}`,message:`Node '${e.id}' is missing required parameter '${a.id}' declared by kind '${t.kind}'`,nodeId:e.id}))}isParameterSatisfiedByInput(e,t,o){return void 0!==(e.inputBindings??{})[t]||!0===o?.has(t)}checkParameterValue(e,t){if(Se(e))return{valid:!0};switch(t.type){case"string":case"code":case"expression":return"string"!=typeof e?Kt("string"):{valid:!0};case"number":return"number"==typeof e&&Number.isFinite(e)?{valid:!0}:Kt("number");case"boolean":return"boolean"!=typeof e?Kt("boolean"):{valid:!0};case"options":{const o=t.options;return o&&o.length&&!o.some(t=>t.value===e)?{valid:!1,message:"value is not one of the declared options"}:{valid:!0}}case"collection":return Array.isArray(e)?{valid:!0}:Kt("array");case"object":case"resourceLocator":return null===e||"object"!=typeof e||Array.isArray(e)?Kt("object"):{valid:!0};case"credential":return zt(e)?t.credentialType&&"object"==typeof e&&void 0!==e.credentialType&&e.credentialType!==t.credentialType?{valid:!1,message:`credential type '${e.credentialType}' does not match the declared type '${t.credentialType}'`}:{valid:!0}:{valid:!1,message:"credential parameters must hold a credential reference (credentialId), never a secret"};default:return{valid:!0}}}validateMetadataKeys(e,t,o,n){const r=t.metadata?.allowedInstanceMetadataKeys;for(const a of Object.keys(e.metadata??{}))Jt.has(a)?o.push({code:"metadata.key-not-allowed",path:`${n}.metadata.${a}`,message:`Node '${e.id}' metadata key '${a}' is reserved and must not be set directly`,nodeId:e.id}):Array.isArray(r)&&!r.includes(a)&&o.push({code:"metadata.key-not-allowed",path:`${n}.metadata.${a}`,message:`Node '${e.id}' metadata key '${a}' is not in the allowed metadata keys of kind '${t.kind}'`,nodeId:e.id})}validateDisabledBehavior(e,t,o){!0!==e.disabled&&!1!==e.disabled&&void 0!==e.disabled&&t.push({code:"disabled.invalid",path:o+".disabled",message:`Node '${e.id}' disabled flag must be a boolean`,nodeId:e.id});const n=(e.metadata??{}).disabledBehavior;void 0===n||A(n)||t.push({code:"disabled.invalid-behavior",path:o+".metadata.disabledBehavior",message:`Node '${e.id}' disabled behavior '${n+""}' is not one of: ${E.join(", ")}`,nodeId:e.id})}validateBindingShapes(e,t,o,n){for(const[r,a]of Object.entries(e.inputBindings??{})){if("literal"===a.mode){const i=t.inputs.find(e=>e.id===r);if(i?.schema){const t=Ht(a.value,i.schema);t.valid||o.push({code:"binding.literal-invalid",path:`${n}.inputBindings.${r}`,message:`Node '${e.id}' literal binding for '${r}' is schema-invalid: ${t.message}`,nodeId:e.id})}}"expression"!==a.mode||"string"==typeof a.expression&&a.expression.trim()||o.push({code:"binding.expression-invalid",path:`${n}.inputBindings.${r}`,message:`Node '${e.id}' expression binding for '${r}' must contain a non-empty expression`,nodeId:e.id})}}validateBindingSatisfaction(e,t,o,n,r,a={}){const i=new Set(o.filter(e=>"data"===e.type).map(e=>e.targetPort)),s=new Set(Object.entries(e.inputBindings??{}).map(([e])=>e));for(const t of i){const o=(e.inputBindings??{})[t];o&&"literal"===o.mode&&!0!==a.allowLiteralAndEdgeBindings&&n.push({code:"binding.conflict",path:`${r}.inputBindings.${t}`,message:`Node '${e.id}' input '${t}' has both an incoming edge and a literal binding`,nodeId:e.id})}for(const o of t.inputs)!0===o.required&&(i.has(o.id)||s.has(o.id)||void 0===(e.parameters??{})[o.id]&&n.push({code:"topology.required-input-unsatisfiable",path:r+".parameters",message:`Node '${e.id}' required input '${o.id}' has no incoming edge or binding`,nodeId:e.id,details:{port:o.id}}))}static disabledBehaviorOf(e,t){const o=(e.metadata??{}).disabledBehavior;if(A(o))return o;const n=t?.disabledBehavior;return A(n)?n:"skip"}}class Qt{resolveEdges(e,t,o){const n=new Set(e.inputs.map(e=>e.id)),r=new Set(e.outputs.map(e=>e.id)),a=[];for(const[i,s]of(e.edges??[]).entries()){const e=`edges[${i}]`,d=this.resolveEndpoint(s,"source",t,n,r,o,e),l=this.resolveEndpoint(s,"target",t,n,r,o,e);if(!d||!l)continue;if(!this.validateDirectionAndType(s,d,l,t,o,e))continue;const c={id:s.id,type:s.type,sourceNodeId:d.nodeId,sourcePort:d.port,targetNodeId:l.nodeId,targetPort:l.port,metadata:s.metadata,edge:s};void 0!==s.label&&(c.label=s.label),a.push(c)}return a}resolveEndpoint(e,t,o,n,r,a,i){const s=e[t];return ge(s)?("source"===t?n.has(s.port):r.has(s.port))?{nodeId:it,port:s.port}:void a.push({code:"edge.unknown-port",path:`${i}.${t}`,message:`Edge '${e.id}' ${t} references workflow port '${s.port}' which is not declared on the document boundary`,edgeId:e.id,details:{scope:"workflow",port:s.port}}):me(s)?o.get(s.nodeId)?{nodeId:s.nodeId,port:s.port}:void a.push({code:"edge.unknown-node",path:`${i}.${t}`,message:`Edge '${e.id}' ${t} references node '${s.nodeId}' which is not part of the document or did not resolve`,edgeId:e.id,nodeId:s.nodeId}):void a.push({code:"edge.invalid-endpoint",path:`${i}.${t}`,message:`Edge '${e.id}' ${t} endpoint is not a valid GraphEndpoint`,edgeId:e.id})}validateDirectionAndType(e,t,o,n,r,a){let i=!0;const s=t.nodeId===it?void 0:n.get(t.nodeId),d=o.nodeId===it?void 0:n.get(o.nodeId),l=e=>!0===e?.manifest.policies?.allowUndeclaredParameters;if("data"===e.type)!s||l(s)||this.hasPortDirection(s,t.port,"output")||(this.pushPortIssue(e,"source",t,s,r,a),i=!1),!d||l(d)||this.hasPortDirection(d,o.port,"input")||(this.pushPortIssue(e,"target",o,d,r,a),i=!1);else{if(!s||!d)return r.push({code:"edge.boundary-routing",path:a,message:`Connection edge '${e.id}' must connect two node connection ports; the workflow boundary only routes data`,edgeId:e.id}),!1;if(!(l(s)||l(d)||this.hasPortDirection(s,t.port,"connection")&&this.hasPortDirection(d,o.port,"connection")))return r.push({code:"edge.type-mismatch",path:a,message:`Connection edge '${e.id}' endpoints must both be connection ports`,edgeId:e.id,details:{sourcePort:t.port,targetPort:o.port}}),!1}return i}hasPortDirection(e,t,o){return("input"===o?e.manifest.inputs:"output"===o?e.manifest.outputs:e.manifest.connections??[]).some(e=>e.id===t)}pushPortIssue(e,t,o,n,r,a){const i="source"===t?"output":"input";r.push({code:"data"===e.type?"edge.invalid-direction":"edge.type-mismatch",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} port '${o.port}' on node '${o.nodeId}' is not an ${i} port of kind '${n.manifest.kind}'`,edgeId:e.id,nodeId:o.nodeId,details:{port:o.port,expected:i}})}}class Zt{validate(e,t){this.validateDuplicates(e.edges,t),this.validatePolicies(e,t)}validateDuplicates(e,t){const o=new Map;for(const n of e){const e=`${n.sourceNodeId}:${n.sourcePort}->${n.targetNodeId}:${n.targetPort}`,r=o.get(e);r?t.push({code:"connection.duplicate-edge",path:`edges[${n.id}]`,message:`Edge '${n.id}' duplicates the routing of edge '${r.id}' (${e})`,edgeId:n.id,details:{duplicateOf:r.id,routing:e}}):o.set(e,n)}}validatePolicies(e,t){const o=new Map;for(const t of e.edges){if("connection"!==t.type)continue;const e=`${t.targetNodeId}:${t.targetPort}`,n=o.get(e)??[];n.push(t),o.set(e,n)}for(const o of e.edges){if("connection"!==o.type)continue;const n=e.nodeById.get(o.targetNodeId),r=n?.manifest.connections?.find(e=>e.id===o.targetPort)?.connectionPolicy;this.validateEdgePolicy(o,e.nodeById,r,t)}for(const[n,r]of o){const o=n.lastIndexOf(":"),a=n.slice(0,o),i=n.slice(o+1),s=e.nodeById.get(a),d=s?.manifest.connections?.find(e=>e.id===i)?.connectionPolicy;if(!d)continue;const l=void 0!==d.maxConnections?d.maxConnections:!1===d.allowMultiple?1:1/0;r.length>l&&t.push({code:"connection.max-connections",path:`edges[${r[r.length-1].id}]`,message:`Connection port '${i}' on node '${a}' accepts at most ${l} connection(s) but has ${r.length}`,nodeId:a,edgeId:r[r.length-1].id,details:{port:i,max:l,actual:r.length}})}}validateEdgePolicy(e,t,o,n){if(e.sourceNodeId===e.targetNodeId&&!o?.allowSelf)return void n.push({code:"connection.self-connection",path:`edges[${e.id}]`,message:`Edge '${e.id}' connects node '${e.sourceNodeId}' to itself, which the target port policy does not allow`,edgeId:e.id,nodeId:e.sourceNodeId});if(!o)return;const r=t.get(e.sourceNodeId),a=r?.manifest.kind;if(!o.allowedNodeKinds?.length||a&&o.allowedNodeKinds.includes(a)||n.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source kind '${a??"unknown"}' is not in the allowed node kinds of target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{allowedNodeKinds:o.allowedNodeKinds}}),a&&o.blockedNodeKinds?.includes(a)&&n.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source kind '${a}' is blocked by target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{blockedNodeKinds:o.blockedNodeKinds}}),o.allowedPortCategories?.length){const t=r?.manifest.connections?.find(t=>t.id===e.sourcePort)?.category;t&&o.allowedPortCategories.includes(t)||n.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source port '${e.sourcePort}' category '${t??"unknown"}' is not in the allowed port categories of target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{allowedPortCategories:o.allowedPortCategories}})}}}class eo{constructor(e){this.authorizer=e}async validate(e,t,o,n){const r=this.collectReferences(e,t);for(const a of t.credentials??[]){const i=r.find(e=>void 0===e.credentialType||e.credentialType===a.type);if(i){if(this.checkType(i,a))o.push({code:"credential.type-mismatch",path:n,message:`Node '${e.id}' credential '${i.credentialId}' has type '${i.credentialType}' but kind '${t.kind}' requires '${a.type}'`,nodeId:e.id,details:{credentialType:i.credentialType??"",requiredType:a.type}});else if(this.authorizer){if(!await this.authorizer.hasCredential(i)){o.push({code:"credential.not-found",path:n,message:`Node '${e.id}' references credential '${i.credentialId}' which does not exist`,nodeId:e.id,details:{credentialId:i.credentialId}});continue}await this.authorizer.authorize(i,a)||o.push({code:"credential.unauthorized",path:n,message:`Node '${e.id}' is not authorized to use credential '${i.credentialId}'`,nodeId:e.id,details:{credentialId:i.credentialId}})}}else!1!==a.required&&o.push({code:"credential.missing",path:n,message:`Node '${e.id}' does not provide the required credential of type '${a.type}'`,nodeId:e.id,details:{credentialType:a.type}})}this.scanPlainSecrets(e,o,n)}collectReferences(e,t){const o=[];for(const n of t.parameters){if("credential"!==n.type)continue;const t=(e.parameters??{})[n.id];zt(t)&&o.push(this.normalize(t,n.credentialType))}const n=(e.metadata??{}).credentials;if(n&&"object"==typeof n&&!Array.isArray(n))for(const e of Object.values(n))zt(e)&&o.push(this.normalize(e));return o}normalize(e,t){return"string"==typeof e?{credentialId:e,credentialType:t??""}:{credentialId:e.credentialId,credentialType:e.credentialType??t??""}}checkType(e,t){return void 0!==e.credentialType&&e.credentialType!==t.type}scanPlainSecrets(e,t,o){const n=new Set(Xt);for(const[r,a]of Object.entries(e.parameters??{}))this.scanPlainSecretValue(a,[r],e,o+".parameters",n,t);for(const[r,a]of Object.entries(e.metadata??{}))this.scanPlainSecretValue(a,[r],e,o+".metadata",n,t)}scanPlainSecretValue(e,t,o,n,r,a,i=0){const s=t[t.length-1];if(r.has(s))a.push({code:"credential.plain-secret",path:`${n}.${t.join(".")}`,message:`Node '${o.id}' carries plain secret material in '${t.join(".")}'; workflow documents may only hold credential references`,nodeId:o.id});else if(8>i&&null!==e)if(Array.isArray(e))for(const s of e)this.scanPlainSecretValue(s,[...t,"[]"],o,n,r,a,i+1);else if("object"==typeof e)for(const[s,d]of Object.entries(e))this.scanPlainSecretValue(d,[...t,s],o,n,r,a,i+1)}}class to extends a.ValidationError{constructor(e,t=[]){super(e),this.issues=t,this.name=to.name}}class oo extends a.ValidationError{constructor(e,t){super(e),this.edgeId=t,this.name=oo.name}}class no extends s.AuthorizationError{constructor(e){super(e),this.name=no.name}}const ro={maxDocumentBytes:2e6,maxNestingDepth:10,maxNodes:500,maxEdges:1e3},ao=["node","definition","executor","execute","ports","component"];function io(e){if(!e||"object"!=typeof e)return!1;const t=e;return Pe(t.document)&&Array.isArray(t.nodes)&&Array.isArray(t.edges)&&t.nodeById instanceof Map&&t.incomingByNode instanceof Map&&t.outgoingByNode instanceof Map&&t.nodes.every(e=>null!==e&&"object"==typeof e&&"object"==typeof e.instance&&"object"==typeof e.manifest&&"object"==typeof e.executor)}function so(e,t){const o=[];for(const n of Object.keys(e))ao.includes(n)&&o.push({code:"document.forbidden-field",path:`${t}.${n}`,message:`Field '${n}' is not accepted in a canonical workflow document: node, definition, executor, execute, ports and component fields are rejected`,details:{field:n}});return o}class lo{constructor(e){this.options=e,this.parameterValidator=new Yt,this.edgeValidator=new Qt,this.connectionPolicyValidator=new Zt,this.nodeValidator=new qt(e.catalogue),this.credentialValidator=new eo(e.credentialAuthorizer)}async validateOrThrow(e,...t){const o=await this.validate(e,0,...t);if(!o.valid||!o.resolved)throw new to(`Graph workflow document '${e.id}' failed validation with ${o.issues.length} issue(s)`,o.issues);return o.resolved}async validate(e,t=0,...o){const n=[],r={...ro,...this.options.limits};if(!await this.validateStructure(e,r,t,n,...o))return{valid:!1,issues:n};const a=await this.nodeValidator.resolveNodes(e.nodes,n,this.options.resolutionContext,...o),i=e.nodes.filter(e=>a.has(e.id)).map(e=>a.get(e.id)),s=(e=>{const t=new Map;for(const o of e.edges??[]){if("data"!==o.type)continue;const e=o.target;if("node"!==e.scope)continue;const n=t.get(e.nodeId)??new Set;n.add(e.port),t.set(e.nodeId,n)}return t})(e);for(const e of i)this.parameterValidator.validate(e.instance,e.manifest,n,`nodes[${e.instance.id}]`,s.get(e.instance.id));for(const e of i)this.nodeValidator.validateEffectivePorts(e.instance,e.manifest,n,`nodes[${e.instance.id}]`);const d=this.edgeValidator.resolveEdges(e,a,n),l=new Map,c=new Map;for(const e of d){if(e.targetNodeId!==it){const t=l.get(e.targetNodeId)??[];t.push(e),l.set(e.targetNodeId,t)}if(e.sourceNodeId!==it){const t=c.get(e.sourceNodeId)??[];t.push(e),c.set(e.sourceNodeId,t)}}this.connectionPolicyValidator.validate({edges:d,nodeById:a},n),this.validateAcyclicity(i,d,e,n),Wt(e,n);for(const e of i)this.parameterValidator.validateBindingSatisfaction(e.instance,e.manifest,l.get(e.instance.id)??[],n,`nodes[${e.instance.id}]`,{allowLiteralAndEdgeBindings:this.options.allowLiteralAndEdgeBindings});this.validateRequiredWorkflowOutputs(e,c,n);for(const e of i)await this.credentialValidator.validate(e.instance,e.manifest,n,`nodes[${e.instance.id}]`);return this.validateCapabilities(i,n),n.length>0?{valid:!1,issues:n}:{valid:!0,issues:n,resolved:{document:e,nodes:i,edges:d,nodeById:a,incomingByNode:l,outgoingByNode:c}}}async validateStructure(e,t,o,n,...r){if(!Pe(e))return n.push({code:"document.shape",path:"$",message:"Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays"}),!1;if(e.id&&e.id.trim()||n.push({code:"document.empty-id",path:"$.id",message:"Workflow document id must be a non-empty string"}),!ae(e))return n.push({code:"document.json-unsafe",path:"$",message:"Document contains JSON-unsafe values: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys are rejected"}),!1;n.push(...so(e,"$"));for(const t of[...e.inputs,...e.outputs])n.push(...so(t,"ports"));for(const t of e.nodes)n.push(...so(t,`nodes[${t.id}]`));for(const t of e.edges)n.push(...so(t,`edges[${t.id}]`));this.validateUniqueIds(e,n),this.validateLimits(e,t,o,n);try{ve(e)}catch(e){n.push({code:"document.structure",path:"$",message:e instanceof Error?e.message:e+""})}return await this.validateNestedBodies(e,o,n,...r),!0}validateUniqueIds(e,t){const o=new Set,n=new Set;for(const[r,a]of[["input",e.inputs],["output",e.outputs]]){const e="input"===r?o:n;for(const o of a)e.has(o.id)?t.push({code:"document.duplicate-port-id",path:`${"input"===r?"inputs":"outputs"}[${o.id}]`,message:`Workflow ${r} port '${o.id}' is declared more than once; workflow port ids must be unique`}):e.add(o.id)}const r=new Set;for(const o of e.nodes)r.has(o.id)?t.push({code:"document.duplicate-node-id",path:`nodes[${o.id}]`,message:`Node '${o.id}' is declared more than once; node ids must be unique`,nodeId:o.id}):r.add(o.id);const a=new Set;for(const o of e.edges)a.has(o.id)?t.push({code:"document.duplicate-edge-id",path:`edges[${o.id}]`,message:`Edge '${o.id}' is declared more than once; edge ids must be unique`,edgeId:o.id}):a.add(o.id)}validateLimits(e,t,o,n){e.nodes.length>t.maxNodes&&n.push({code:"document.limit.nodes",path:"$.nodes",message:`Document declares ${e.nodes.length} nodes; at most ${t.maxNodes} are allowed`,details:{count:e.nodes.length,limit:t.maxNodes}}),e.edges.length>t.maxEdges&&n.push({code:"document.limit.edges",path:"$.edges",message:`Document declares ${e.edges.length} edges; at most ${t.maxEdges} are allowed`,details:{count:e.edges.length,limit:t.maxEdges}}),o>t.maxNestingDepth&&n.push({code:"document.limit.depth",path:"$",message:`Document nests loop bodies ${o} levels deep; at most ${t.maxNestingDepth} levels are allowed`,details:{depth:o,limit:t.maxNestingDepth}});const r=Buffer.byteLength(JSON.stringify(e),"utf8");r>t.maxDocumentBytes&&n.push({code:"document.limit.size",path:"$",message:`Document serializes to ${r} bytes; at most ${t.maxDocumentBytes} bytes are allowed`,details:{bytes:r,limit:t.maxDocumentBytes}})}async validateNestedBodies(e,t,o,...n){for(const r of e.nodes){const e=[["loop.body",r.loop?.body],["errorBoundary.try",r.errorBoundary?.try],["errorBoundary.catch",r.errorBoundary?.catch],["errorBoundary.finally",r.errorBoundary?.finally]];for(const[a,i]of e){if(!i)continue;const e=await this.validate(i,t+1,...n);for(const t of e.issues)o.push({...t,path:`nodes[${r.id}].${a}.${t.path}`,nodeId:t.nodeId??r.id})}}}validateAcyclicity(e,t,o,n){const r=new Set(e.map(e=>e.instance.id)),a=new Map(e.map(e=>[e.instance.id,0]));for(const e of t)r.has(e.sourceNodeId)&&a.has(e.targetNodeId)&&a.set(e.targetNodeId,(a.get(e.targetNodeId)??0)+1);const i=[...a.entries()].filter(([,e])=>0===e).map(([e])=>e),s=[];for(;i.length>0;){const e=i.shift();s.push(e);for(const o of t){if(o.sourceNodeId!==e)continue;if(!a.has(o.targetNodeId))continue;const t=(a.get(o.targetNodeId)??1)-1;a.set(o.targetNodeId,t),0===t&&i.push(o.targetNodeId)}}if(s.length!==a.size){const e=[...a.keys()].filter(e=>!s.includes(e));n.push({code:"topology.cycle",path:"$.edges",message:`Workflow '${o.id}' contains an unsupported cycle involving node(s): ${e.join(", ")}`,details:{cyclicNodes:e}})}}validateRequiredWorkflowOutputs(e,t,o){const n=new Set;for(const e of t.values())for(const t of e)t.targetNodeId===it&&n.add(t.targetPort);for(const t of e.outputs)!0===t.required&&void 0===t.defaultValue&&(n.has(t.id)||o.push({code:"topology.required-output-unsatisfiable",path:`outputs[${t.id}]`,message:`Required workflow output '${t.id}' has no incoming edge from any node`}))}validateCapabilities(e,t){for(const o of e){const e=o.manifest;for(const n of e.capabilities??[])Te(n)||t.push({code:"capability.invalid",path:`nodes[${o.instance.id}]`,message:`Kind '${e.kind}' declares unknown capability '${n+""}'`,nodeId:o.instance.id,details:{capability:n+""}});!0!==e.policies?.allowUndeclaredParameters&&o.instance.loop&&((e.capabilities??[]).includes("loop")||t.push({code:"capability.loop-not-supported",path:`nodes[${o.instance.id}].loop`,message:`Node '${o.instance.id}' carries loop configuration but kind '${e.kind}' does not declare the 'loop' capability`,nodeId:o.instance.id}))}}}function co(e){return[e.namespace??"default",e.workflowId,e.nodeId,e.version??"default",e.fingerprint].join(":")}function uo(t){return new e.GraphValueModel({id:co(t.key),workflowId:t.key.workflowId,nodeId:t.key.nodeId,fingerprint:t.key.fingerprint,...void 0!==t.key.namespace?{namespace:t.key.namespace}:{},...void 0!==t.key.version?{version:t.key.version}:{},pinned:t.pinned,outputs:t.outputs,createdAt:new Date(t.createdAt),updatedAt:new Date(t.updatedAt),...t.expiresAt?{expiresAt:new Date(t.expiresAt)}:{},...t.metadata?{metadata:t.metadata}:{}})}function po(e){return{key:{workflowId:e.workflowId,nodeId:e.nodeId,fingerprint:e.fingerprint,...void 0!==e.namespace?{namespace:e.namespace}:{},...void 0!==e.version?{version:e.version}:{}},outputs:e.outputs,pinned:e.pinned,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString(),...e.expiresAt?{expiresAt:e.expiresAt.toISOString()}:{},...e.metadata?{metadata:e.metadata}:{}}}function ho(t){return new(0,s.Repository.forModel(e.GraphValueModel,t.alias).constructor)(t)}e.GraphExecutionPlanner=class extends s.Service{constructor(){super()}async plan(e,...t){const{log:o}=(await this.logCtx(t,"plan",!0)).for(this.plan);if(o.debug(`Planning resolved workflow '${e?.document?.id??"unknown"}'`),!io(e))throw new wt("GraphExecutionPlanner.plan accepts only a GraphResolvedWorkflow produced by the nine-stage validation gate; raw workflow definitions and inline node definitions are rejected",{received:(n=e,n&&"object"==typeof n?{reason:"input is not a GraphResolvedWorkflow",looksLikeWorkflowDefinition:"nodes"in n&&"relations"in n&&!("nodeById"in n),hasResolvedNodes:Array.isArray(n.nodes)}:{reason:"input is not an object"})});var n;const r=this.buildPlanNodes(e),a=this.buildPlanEdges(e),i=this.buildIncomingMap(a),s=this.buildOutgoingMap(a),d=this.topologicalLayers(r,a);return{resolved:e,workflowId:e.document.id||e.document.name,nodes:r,edges:a,layers:d,incomingByNode:i,outgoingByNode:s}}buildPlanNodes(e){return e.nodes.map(e=>({id:e.instance.id,kind:e.manifest.kind,instance:e.instance,manifest:e.manifest,executor:e.executor,inputPorts:e.manifest.inputs.map(e=>e.id),outputPorts:e.manifest.outputs.map(e=>e.id),connectionPorts:(e.manifest.connections??[]).map(e=>e.id),metadata:e.instance.metadata}))}buildPlanEdges(e){return e.edges.map(e=>({id:e.id,type:e.type,sourceNodeId:e.sourceNodeId,sourcePort:e.sourcePort,targetNodeId:e.targetNodeId,targetPort:e.targetPort,...void 0!==e.label?{label:e.label}:{},metadata:e.metadata}))}buildIncomingMap(e){const t=new Map;for(const o of e){if(o.targetNodeId===it)continue;const e=t.get(o.targetNodeId)??[];e.push(o),t.set(o.targetNodeId,e)}return t}buildOutgoingMap(e){const t=new Map;for(const o of e){if(o.sourceNodeId===it)continue;const e=t.get(o.sourceNodeId)??[];e.push(o),t.set(o.sourceNodeId,e)}return t}topologicalLayers(e,t){const o=e.filter(e=>e.id!==it),n=new Set(o.map(e=>e.id)),r=t.filter(e=>n.has(e.sourceNodeId)&&n.has(e.targetNodeId)),a=new Map;for(const e of o)a.set(e.id,0);for(const e of r)a.set(e.targetNodeId,(a.get(e.targetNodeId)??0)+1);const i=[],s=new Set;let d=o.filter(e=>0===(a.get(e.id)??0)),l=0;for(;d.length>0;){const e={index:l++,nodes:d};i.push(e);const t=[];for(const e of d){s.add(e.id);const n=r.filter(t=>t.sourceNodeId===e.id);for(const e of n){const n=(a.get(e.targetNodeId)??1)-1;if(a.set(e.targetNodeId,n),0===n&&!s.has(e.targetNodeId)){const n=o.find(t=>t.id===e.targetNodeId);n&&t.push(n)}}}d=t}if(s.size!==o.length){const e=o.filter(e=>!s.has(e.id)).map(e=>e.id);throw new ht({unplannedNodes:e,workflowId:o[0]?.manifest.kind})}return i}},e.GraphExecutionPlanner=i.__decorate([s.service(),i.__metadata("design:paramtypes",[])],e.GraphExecutionPlanner),e.GraphValueModel=class extends s.BaseModel{constructor(e){super(e)}},i.__decorate([s.pk({type:String,generated:!1}),i.__metadata("design:type",String)],e.GraphValueModel.prototype,"id",void 0),i.__decorate([s.column(),s.index(),i.__metadata("design:type",String)],e.GraphValueModel.prototype,"workflowId",void 0),i.__decorate([s.column(),s.index(),i.__metadata("design:type",String)],e.GraphValueModel.prototype,"nodeId",void 0),i.__decorate([s.column(),i.__metadata("design:type",String)],e.GraphValueModel.prototype,"fingerprint",void 0),i.__decorate([s.column(),i.__metadata("design:type",String)],e.GraphValueModel.prototype,"namespace",void 0),i.__decorate([s.column(),i.__metadata("design:type",String)],e.GraphValueModel.prototype,"version",void 0),i.__decorate([s.column(),i.__metadata("design:type",Boolean)],e.GraphValueModel.prototype,"pinned",void 0),i.__decorate([s.column(),i.__metadata("design:type",Object)],e.GraphValueModel.prototype,"outputs",void 0),i.__decorate([s.column(),i.__metadata("design:type",Date)],e.GraphValueModel.prototype,"createdAt",void 0),i.__decorate([s.column(),i.__metadata("design:type",Date)],e.GraphValueModel.prototype,"updatedAt",void 0),i.__decorate([s.column(),i.__metadata("design:type",Date)],e.GraphValueModel.prototype,"expiresAt",void 0),i.__decorate([s.column(),i.__metadata("design:type",Object)],e.GraphValueModel.prototype,"metadata",void 0),e.GraphValueModel=i.__decorate([s.table("graph_value"),r.model(),i.__metadata("design:paramtypes",[Object])],e.GraphValueModel),e.GraphValueRepository=class extends s.Repository{constructor(t){super(t,e.GraphValueModel,!0),this.runtimeValues=new Map}seedWorkflowInputs(e){this.runtimeValues.set(it,{...e})}setNodeOutputs(e,t){this.runtimeValues.set(e,{...t})}getPort(e,t){return this.runtimeValues.get(e)?.[t]}hasPort(e,t){return Object.prototype.hasOwnProperty.call(this.runtimeValues.get(e)??{},t)}setWorkflowOutput(e,t){const o=this.runtimeValues.get(it)??{};o[e]=t,this.runtimeValues.set(it,o)}getWorkflowValues(){return{...this.runtimeValues.get(it)??{}}}snapshot(){return Object.fromEntries(this.runtimeValues.entries())}async readCached(e,...t){try{return po(await this.read(co(e),...t))}catch{return}}async writeCached(e,t,...o){const n=co(e);let r;try{r=await this.read(n,...o)}catch{r=void 0}r?await this.update(Object.assign(r,uo(t)),...o):await this.create(uo(t),...o)}async deleteCached(e,...t){try{await this.delete(co(e),...t)}catch{}}async hasCached(e,...t){return void 0!==await this.readCached(e,...t)}async listCached(e,...t){return(await this.select().execute(...t)).map(e=>po(e)).filter(t=>((e,t)=>!(void 0!==t.workflowId&&e.workflowId!==t.workflowId||void 0!==t.nodeId&&e.nodeId!==t.nodeId||void 0!==t.namespace&&e.namespace!==t.namespace||void 0!==t.version&&e.version!==t.version||void 0!==t.fingerprint&&e.fingerprint!==t.fingerprint))(t.key,e))}async clearRun(e,...t){const o=await this.select().execute(...t);for(const e of o)await this.delete(e.id,...t)}readRuntimeValues(e){return this.runtimeValues.get(e)}writeRuntimeValues(e,t){this.runtimeValues.set(e,{...t})}getAdapter(){return this.adapter}},e.GraphValueRepository=i.__decorate([s.repository(e.GraphValueModel,n.DefaultFlavour),i.__metadata("design:paramtypes",[Function])],e.GraphValueRepository);class fo{static upstreamNodes(e,t,o=!1){const n=new Set,r=[e];for(;r.length;){const e=r.pop(),a=t.get(e)??[];for(const e of a)!o&&this.isBoundary(e.sourceNodeId)||n.has(e.sourceNodeId)||(n.add(e.sourceNodeId),r.push(e.sourceNodeId))}return n}static downstreamNodes(e,t,o=!1){const n=new Set,r=[e];for(;r.length;){const e=r.pop(),a=t.get(e)??[];for(const e of a)!o&&this.isBoundary(e.targetNodeId)||n.has(e.targetNodeId)||(n.add(e.targetNodeId),r.push(e.targetNodeId))}return n}static isBoundary(e){return"$workflow"===e}}class go{constructor(e,t,o){this.store=e,this.policy=t,this.dependencyResolver=o}async pinNode(e){const t=e.plan,o=e.includeDependencies??1?this.dependencyResolver.getPinSet(t,e.nodeId):new Set([e.nodeId]);for(const e of o){const o=t.nodes.find(t=>t.id===e);if(!o)throw new mt(`Node '${e}' not found in plan`);if(!this.policy.canPin(o))throw new mt(`Node '${e}' is not pinnable`,{nodeId:e})}const n=this.topologicalOrder(t,o);for(const o of n){const n=t.nodes.find(e=>e.id===o),r=e.result.nodeResults[o];if(!r||!r.outputs)throw new mt(`Node '${o}' has no completed output to pin`);const a=r.inputs??{},i=this.dependencyFingerprints(t,o,e.result),s=this.createValueKey(e.document.id,n,a,i),d=(new Date).toISOString(),l={key:s,outputs:r.outputs,pinned:!0,createdAt:d,updatedAt:d,metadata:{...e.result.metadata,nodeId:o}};await this.store.writeCached(s,l)}}async unpinNode(e){const t={workflowId:e.document.id,nodeId:e.nodeId,fingerprint:e.fingerprint,namespace:e.namespace};await this.store.deleteCached(t)}async readPinnedValue(e,t,o,n,r){const a=this.createValueKey(e,t,o,n,r),i=await this.store.readCached(a);if(i&&i.pinned){if(i.expiresAt&&new Date(i.expiresAt)<new Date)return;return i}}createValueKey(e,t,o,n,r){return{workflowId:e,nodeId:t.id,fingerprint:this.computeFingerprint(e,t,o,n),namespace:r}}computeFingerprint(e,t,o,n){const r={workflowId:e,nodeId:t.id,nodeKind:t.kind,parameters:this.stableSerialize(t.instance.parameters??{}),inputBindings:this.stableSerialize(t.instance.inputBindings??{}),metadata:this.stableSerialize(this.relevantMetadata(t)),inputs:this.stableSerialize(o),dependencyFingerprints:this.stableSerialize(n)},a=this.stableSerialize(r);return this.simpleHash(a)}relevantMetadata(e){const t={...e.metadata??{}};return delete t.ui,delete t.position,delete t.visual,t}topologicalOrder(e,t){const o=[],n=new Set,r=a=>{if(n.has(a))return;n.add(a);const i=fo.upstreamNodes(a,e.incomingByNode,!1);for(const e of i)t.has(e)&&r(e);o.push(a)};for(const e of t)r(e);return o}dependencyFingerprints(e,t,o){const n=this.dependencyResolver.getDependencies(e,t),r={};for(const t of n){const n=e.nodes.find(e=>e.id===t);if(n){const a=o.nodeResults[t],i=a?.inputs??{},s=this.dependencyFingerprints(e,t,o);r[t]=this.computeFingerprint(e.workflowId,n,i,s)}}return r}stableSerialize(e){return null===e||"object"!=typeof e?JSON.stringify(e):Array.isArray(e)?`[${e.map(e=>this.stableSerialize(e)).join(",")}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${this.stableSerialize(e[t])}`).join(",")}}`}simpleHash(e){let t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o),t|=0;return`fp_${Math.abs(t).toString(16).padStart(8,"0")}_${e.length}`}}const mo={enabled:!0,strategy:"manual",includeDependencies:!0};function yo(e){return!0===e?.enabled&&"disabled"!==e.strategy}class wo{canPin(e){return yo(this.getPinningMetadata(e))}shouldUsePinnedValue(e){const t=this.getPinningMetadata(e);return!0===t.enabled&&"disabled"!==t.strategy}shouldAutoPin(e){const t=this.getPinningMetadata(e);return!0===t.enabled&&"automatic"===t.strategy}getPinningMetadata(e){const t=e.manifest.metadata?.pinnable??e.metadata?.pinnable;return t?{...mo,...t}:{...mo,enabled:!1}}}class _o{getDependencies(e,t){return fo.upstreamNodes(t,e.incomingByNode,!1)}getPinSet(e,t){const o=this.getDependencies(e,t);return o.add(t),o}}class bo extends s.ClientBasedService{constructor(){super()}async initialize(...t){const o=t[0];if(!o||"object"!=typeof o||!o.registry)return this._config=void 0,this._client=void 0,{config:void 0,client:void 0};const n=o.catalogue??o.registry.catalog,r=o.valueAdapter??s.Adapter.current;if(!r)throw new pt("GraphExecutionEngine requires a Decaf adapter for cached/pinned values: pass `valueAdapter` or configure one via `Adapter.setCurrent(...)`","GRAPH_VALUE_ADAPTER_MISSING");const a={registry:o.registry,catalogue:n,planner:o.planner??new e.GraphExecutionPlanner,valueAdapter:r,eventEmitter:o.eventEmitter??new Nt,documentValidator:o.documentValidator??new lo({catalogue:n,limits:o.documentLimits,credentialAuthorizer:o.credentialAuthorizer}),authValidator:new Mt({enabled:!0===o.authEnabled,...o.authMatch?{match:o.authMatch}:{}}),...o.codeSandboxEvaluator?{codeSandboxEvaluator:o.codeSandboxEvaluator}:{}};return this._config=o,this._client=a,await(o.onEngineCreated?.(this)),{config:o,client:a}}get codeSandboxEvaluator(){return this.client.codeSandboxEvaluator}get emitter(){return this.client.eventEmitter}get planner(){return this.client.planner}get valueAdapter(){return this.client.valueAdapter}get defaultOptions(){return this.config.defaultOptions??{}}get documentValidator(){return this.client.documentValidator}observe(e){return this.emitter.observe(e)}unObserve(e){this.emitter.unObserve(e)}async dispatchEvent(e){await this.emitter.updateObservers(e)}async execute(e,t={},o={},...n){const{log:r,ctx:a}=(await this.logCtx(n,"execute",!0)).for(this.execute);r.debug(`Executing workflow '${e.id||e.name}'`);const i=this.mergeOptions(o);this.assertNotAborted(i);const s=Lt($t(a),i.auth);i.auth=s,i.metadata={...i.metadata??{},...s};const d=i.runId??this.generateRunId(),l=i.path??[],c=new It,u=ho(this.valueAdapter);u.seedWorkflowInputs(this.withWorkflowInputDefaults(e,t));const p=async t=>{await this.emitEvent(m,{type:t.type??D.NODE_OUTPUT,runId:d,parentRunId:i.parentRunId,workflowId:e.id||e.name,nodeId:t.nodeId,path:t.path??l,...t})},h=async t=>{const o=c.create({id:"",sequence:0,timestamp:new Date,runId:d,parentRunId:i.parentRunId,workflowId:e.id||e.name,path:l,...t});await this.emitter.updateObservers(o)};await h({type:D.VALIDATION_STARTED,status:O.PLANNING});const f=await this.documentValidator.validate(e,0,a);if(!f.valid||!f.resolved)throw await h({type:D.VALIDATION_FAILED,status:O.FAILED,payload:{issues:f.issues}}),new to(`Graph workflow document '${e.id}' failed validation with ${f.issues.length} issue(s)`,f.issues);await h({type:D.VALIDATION_COMPLETED,status:O.PLANNING,payload:{issues:f.issues.length}}),this.assertNotAborted(i);const g=await this.planner.plan(f.resolved);this.client.authValidator.validate(e,g,s,r),r.debug(`Authorized workflow '${e.id||e.name}' for user ${s.user??"anonymous"}`);const m=new Ut(d,g,u,c);await this.emitEvent(m,{type:D.WORKFLOW_STARTED,runId:d,parentRunId:i.parentRunId,workflowId:g.workflowId,path:l,status:O.RUNNING,payload:{inputs:t}}),await this.emitEvent(m,{type:D.WORKFLOW_PLANNED,runId:d,parentRunId:i.parentRunId,workflowId:g.workflowId,path:l,status:O.PLANNING,payload:{layers:g.layers.length,nodes:g.nodes.length}});try{for(const e of g.layers)this.assertNotAborted(i),await this.executeLayer(m,g,e.nodes,i,p);this.assertNotAborted(i);const o=[...m.nodeResults.values()].find(e=>e.status===O.FAILED);if(o?.error)throw new pt(o.error.message,o.error.code??"GRAPH_EXECUTION_ERROR",o.error.details);return m.finish(),await this.emitEvent(m,{type:D.WORKFLOW_COMPLETED,runId:d,parentRunId:i.parentRunId,workflowId:g.workflowId,path:l,status:O.SUCCEEDED,payload:{outputs:u.getWorkflowValues()}}),Bt(m,e,t,O.SUCCEEDED,i.metadata)}catch(o){if(o instanceof _t)throw m.finish(),o;m.finish();const n=this.toErrorPayload(o);return o instanceof bt||!0===i.abortSignal?.aborted?(await this.emitEvent(m,{type:D.WORKFLOW_CANCELLED,runId:d,parentRunId:i.parentRunId,workflowId:g.workflowId,path:l,status:O.CANCELLED,error:n}),Bt(m,e,t,O.CANCELLED,i.metadata)):(await this.emitEvent(m,{type:D.WORKFLOW_FAILED,runId:d,parentRunId:i.parentRunId,workflowId:g.workflowId,path:l,status:O.FAILED,error:n}),Bt(m,e,t,O.FAILED,i.metadata))}}async pinNode(e){const t=this.createPinningService();await t.pinNode(e),await this.emitPinningEvent(e.nodeId,D.NODE_PINNED)}async unpinNode(e){const t=this.createPinningService();await t.unpinNode(e),await this.emitPinningEvent(e.nodeId,D.NODE_UNPINNED)}createPinningService(){const e=ho(this.valueAdapter);return new go(e,new wo,new _o)}async emitPinningEvent(e,t){const o=(new It).create({id:"",sequence:0,timestamp:new Date,runId:"pinning",workflowId:"",type:t,nodeId:e,path:[]});await this.emitter.updateObservers(o)}withWorkflowInputDefaults(e,t){const o={...t};for(const t of e.inputs)void 0===o[t.id]&&void 0!==t.defaultValue&&(o[t.id]=t.defaultValue);return o}async executeLayer(e,t,o,n,r){const a=Math.max(1,n.concurrency??4),i=[...o];for(;i.length>0;){const o=i.splice(0,a);await Promise.all(o.map(o=>this.executeNode(e,t,o,n,r)))}}async executeNode(e,t,o,n,r){if(this.assertNotAborted(n),!this.isNodeActivated(e,t,o))return void await this.skipInactiveNode(e,t,o,n);if(!0===o.instance.disabled)return void await this.executeDisabledNode(e,t,o,n);const a=new Date,i=[...n.path??[],o.id];await this.emitEvent(e,{type:D.NODE_STARTED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:i,status:O.RUNNING}),this.emitNodeStateChanged(e,t,o,i,x.RUNNING,O.RUNNING);const s=await this.resolveNodeInputs(e,t,o,n);if(n.usePinnedValues){const n=await this.tryPinnedValue(e,t,o,s);if(n){e.valueStore.setNodeOutputs(o.id,n.outputs),this.routeOutgoingEdges(e,t,o,n.outputs);const r=new Date,d={nodeId:o.id,status:O.CACHED,inputs:s,outputs:n.outputs,startedAt:a,finishedAt:r,fromCache:!0,pinned:!0,events:[]};return e.recordNodeResult(d),await this.emitEvent(e,{type:D.NODE_CACHE_HIT,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:i,status:O.CACHED,payload:{outputs:n.outputs}}),await this.emitEvent(e,{type:D.NODE_COMPLETED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:i,status:O.SUCCEEDED,payload:{outputs:n.outputs,fromCache:!0}}),void this.emitNodeStateChanged(e,t,o,i,x.SUCCEEDED,O.SUCCEEDED)}}try{const d=new jt(e.runId,n.parentRunId,t.workflowId,t.resolved.document,o.instance,o.manifest,i,r,n.metadata,this,n.abortSignal,this.executionLimits(n)),l=await this.resolveNodeParameters(o,s,n),c={nodeId:o.id,kind:o.kind,inputs:s,parameters:l,credentials:this.collectCredentials(o),metadata:o.instance.metadata},u=await this.invokeExecutor(o,c,d),p=this.validateNodeOutputs(o,u??{});e.valueStore.setNodeOutputs(o.id,p),this.routeOutgoingEdges(e,t,o,p);const h=new Date,f={nodeId:o.id,status:O.SUCCEEDED,inputs:s,outputs:p,startedAt:a,finishedAt:h,events:[]};e.recordNodeResult(f),await this.emitEvent(e,{type:D.NODE_COMPLETED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:i,status:O.SUCCEEDED,payload:{outputs:p}}),this.emitNodeStateChanged(e,t,o,i,x.SUCCEEDED,O.SUCCEEDED)}catch(r){if(r instanceof _t)throw r;const d=new Date,l=this.toErrorPayload(r),c={nodeId:o.id,status:O.FAILED,inputs:s,error:l,startedAt:a,finishedAt:d,events:[]};if(e.recordNodeResult(c),await this.emitEvent(e,{type:D.NODE_FAILED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:i,status:O.FAILED,error:l}),this.emitNodeStateChanged(e,t,o,i,x.FAILED,O.FAILED),n.failFast??1)throw r}}isNodeActivated(e,t,o){const n=(t.incomingByNode.get(o.id)??[]).filter(e=>"data"===e.type);return 0===n.length||n.some(t=>t.sourceNodeId===it||e.isDataEdgeActive(t.id))}async skipInactiveNode(e,t,o,n){const r=new Date,a=[...n.path??[],o.id];await this.emitEvent(e,{type:D.NODE_SKIPPED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:O.SKIPPED,payload:{reason:"branchNotSelected"}});const i={nodeId:o.id,status:O.SKIPPED,inputs:{},startedAt:r,finishedAt:new Date,events:[]};e.recordNodeResult(i),this.emitNodeStateChanged(e,t,o,a,x.SKIPPED,O.SKIPPED)}async executeDisabledNode(e,t,o,n){const r=new Date,a=[...n.path??[],o.id],i=Yt.disabledBehaviorOf(o.instance,t.resolved.document.settings);if(await this.emitEvent(e,{type:D.NODE_SKIPPED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:O.SKIPPED,payload:{disabled:!0,behavior:i}}),"skip"===i){const n={nodeId:o.id,status:O.SKIPPED,inputs:{},startedAt:r,finishedAt:new Date,events:[]};return e.recordNodeResult(n),void this.emitNodeStateChanged(e,t,o,a,x.SKIPPED,O.SKIPPED)}const s=await this.resolveNodeInputs(e,t,o,n);let d;if("passThroughFirstInput"===i){const n=(t.incomingByNode.get(o.id)??[]).find(e=>"data"===e.type),r=o.manifest.outputs[0]?.id??"value",a=n?e.valueStore.getPort(n.sourceNodeId,n.sourcePort):Object.values(s)[0];d={[r]:a}}else{d={};for(const e of o.manifest.outputs)d[e.id]=e.metadata?.defaultValue}e.valueStore.setNodeOutputs(o.id,d),this.routeOutgoingEdges(e,t,o,d);const l={nodeId:o.id,status:O.SUCCEEDED,inputs:s,outputs:d,startedAt:r,finishedAt:new Date,events:[]};e.recordNodeResult(l),this.emitNodeStateChanged(e,t,o,a,x.SUCCEEDED,O.SUCCEEDED)}async invokeExecutor(e,t,o){return await e.executor.execute(t,o)}validateNodeOutputs(e,t){const o=e.manifest;if(!0===o.policies?.allowUnknownOutputs)return t;const n=new Set(o.outputs.map(e=>e.id)),r=Object.keys(t).filter(e=>!n.has(e));if(r.length>0)throw new pt(`Node '${e.id}' of kind '${e.kind}' produced unknown output(s): ${r.join(", ")}`,"GRAPH_OUTPUT_VALIDATION_FAILED",{nodeId:e.id,unknownOutputs:r});const a=o.outputs.filter(e=>!0===e.required&&!(e.id in t)).map(e=>e.id);if(a.length>0)throw new pt(`Node '${e.id}' of kind '${e.kind}' did not produce required output(s): ${a.join(", ")}`,"GRAPH_OUTPUT_VALIDATION_FAILED",{nodeId:e.id,missingRequired:a});return t}collectCredentials(e){const t={};for(const o of e.manifest.parameters){if("credential"!==o.type)continue;const n=(e.instance.parameters??{})[o.id];"string"==typeof n&&n.length>0?t[o.id]={credentialId:n,credentialType:o.credentialType??""}:zt(n)&&(t[o.id]={credentialId:n.credentialId,credentialType:n.credentialType})}const o=(e.instance.metadata??{}).credentials;if(o&&"object"==typeof o&&!Array.isArray(o))for(const[e,n]of Object.entries(o)){const o=n;"string"==typeof o&&o.length>0?t[e]={credentialId:o,credentialType:""}:zt(o)&&(t[e]={credentialId:o.credentialId,credentialType:o.credentialType})}return t}async resolveNodeInputs(e,t,o,n){const r={},a=(t.incomingByNode.get(o.id)??[]).filter(e=>"data"===e.type),i=new Map;for(const e of a){const t=i.get(e.targetPort)??[];t.push(e),i.set(e.targetPort,t)}for(const[t,o]of i)if(1===o.length)r[t]=e.valueStore.getPort(o[0].sourceNodeId,o[0].sourcePort);else{let n,a=!1;for(const t of o){const o=e.valueStore.getPort(t.sourceNodeId,t.sourcePort);r[t.sourcePort]=o,void 0!==o&&(n=o,a=!0)}a&&void 0===r[t]&&(r[t]=n)}const s=o.instance.inputBindings??{};for(const e of o.manifest.inputs){const t=s[e.id];if("literal"===t?.mode)r[e.id]=t.value;else if("expression"===t?.mode)r[e.id]=await this.evaluateExpressionBinding(o,t.expression,r,n);else if(void 0===r[e.id]){const t=e.metadata?.defaultValue;void 0!==t&&(r[e.id]=t)}}return r}async resolveNodeParameters(e,t,o){const n=e.instance.parameters??{},r={};for(const[a,i]of Object.entries(n))r[a]=Se(i)?await this.evaluateValueTemplate(i,e,t,o):i;return r}async evaluateValueTemplate(e,t,o,n){const r=this.codeSandboxEvaluator;if(!r)throw new pt(`Value template on node '${t.id}' requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator`,"GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{nodeId:t.id});const a=e.language??("expression"===e.mode?"javascript":"text"),i="template"===e.mode?(e=>`\`${e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\{\{\s*([\s\S]*?)\s*\}\}/g,(e,t)=>`\${${t}}`)}\``)(e.expression):e.expression,s=n.metadata;return await r.evaluate({code:i,language:"typescript"===a?"typescript":"javascript",input:o,vars:s?.vars??void 0,item:s?.item,index:s?.index,abortSignal:n.abortSignal})}async evaluateExpressionBinding(e,t,o,n){const r=this.codeSandboxEvaluator;if(!r)throw new pt(`Expression binding on node '${e.id}' requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator`,"GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{nodeId:e.id,expression:t});const a=n.metadata;return await r.evaluate({code:t,language:"javascript",input:o,vars:a?.vars??void 0,item:a?.item,index:a?.index,abortSignal:n.abortSignal})}async tryPinnedValue(e,t,o,n){if(!(new wo).shouldUsePinnedValue(o))return;const r=this.createPinningService(),a=this.computeDependencyFingerprints(e,t,o.id);return r.readPinnedValue(t.workflowId,o,n,a)}computeDependencyFingerprints(e,t,o){const n=this.createPinningService(),r=(new _o).getDependencies(t,o),a={};for(const o of r){const r=t.nodes.find(e=>e.id===o);if(r){const i=e.nodeResults.get(o),s=i?.inputs??{},d=this.computeDependencyFingerprints(e,t,o);a[o]=n.computeFingerprint(t.workflowId,r,s,d)}}return a}routeOutgoingEdges(e,t,o,n){const r=(t.outgoingByNode.get(o.id)??[]).filter(e=>"data"===e.type);for(const a of r){if(!Object.prototype.hasOwnProperty.call(n,a.sourcePort))continue;const r=n[a.sourcePort];e.activateDataEdge(a.id),a.targetNodeId===it&&e.valueStore.setWorkflowOutput(a.targetPort,r),this.emitEdgeStateChanged(e,t,o,a,x.SUCCEEDED,O.SUCCEEDED),this.emitEvent(e,{type:D.EDGE_VALUE_ROUTED,runId:e.runId,workflowId:t.workflowId,edgeId:a.id,nodeId:o.id,path:[],payload:{edge:a,value:r}}).catch(()=>{})}}async emitEvent(e,t){const o=e.eventFactory.create({id:"",sequence:0,timestamp:new Date,...t});e.appendEvent(o),await this.emitter.updateObservers(o)}emitNodeStateChanged(e,t,o,n,r,a){this.emitEvent(e,{type:D.NODE_STATE_CHANGED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:n,status:a,payload:{nodeId:o.id,state:r,runId:e.runId,workflowId:t.workflowId,status:a}}).catch(()=>{})}emitEdgeStateChanged(e,t,o,n,r,a){this.emitEvent(e,{type:D.EDGE_STATE_CHANGED,runId:e.runId,workflowId:t.workflowId,edgeId:n.id,nodeId:o.id,path:[],status:a,payload:{edgeId:n.id,state:r,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,status:a}}).catch(()=>{})}mergeOptions(e){return{concurrency:4,failFast:!0,validateInputs:!0,validateOutputs:!0,maxLoopIterations:st,maxForeachIterations:dt,usePinnedValues:!0,writeThroughCache:!1,path:[],metadata:{},...this.defaultOptions,...e}}executionLimits(e){return{maxLoopIterations:e.maxLoopIterations??st,maxForeachIterations:e.maxForeachIterations??dt}}assertNotAborted(e){if(!0===e.abortSignal?.aborted)throw new bt(e.runId??"unknown")}generateRunId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new pt("Cannot generate a graph run id: crypto.randomUUID is unavailable in this runtime","GRAPH_RUN_ID_ERROR",{runtime:typeof globalThis.crypto});return e.randomUUID()}toErrorPayload(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}}const vo=new Set(["process","require","module","exports","global","globalThis","Function","eval","fetch","XMLHttpRequest","WebSocket","Worker","Deno","Bun","__dispatch"]);class No extends s.ClientBasedService{constructor(){super()}async initialize(...e){const t=e[0]??{},o=t&&"object"==typeof t?t:{};return this._config=o,this._client=d,{config:o,client:d}}get defaultTimeoutMs(){return this.config.timeoutMs??1e3}get defaultMemoryMb(){return this.config.memoryMb??32}async evaluate(e,...t){(await this.logCtx(t,"evaluate",!0)).for(this.evaluate);const o=e.code;if(!o||"string"!=typeof o||0===o.trim().length)throw new pt("Code sandbox received empty code","GRAPH_CODE_SANDBOX_EMPTY_CODE");const n=((e,t)=>"javascript"===t?e:w.transpileModule(e,{compilerOptions:{target:w.ScriptTarget.ES2022,module:w.ModuleKind.None,strict:!0,noEmitHelpers:!0,importHelpers:!1}}).outputText.replace(/^"use strict";\s*/,""))(o,e.language??"javascript");(e=>{if(e.length>1e5)throw new pt("Code exceeds the maximum length of 100000 characters","GRAPH_CODE_SANDBOX_CODE_TOO_LONG",{length:e.length});let t;try{t=m.parse(`async function __validate() {\n${e}\n}`,{ecmaVersion:"latest",sourceType:"script"})}catch{try{t=m.parse(e,{ecmaVersion:"latest",sourceType:"module"})}catch(t){throw new pt("Code failed to parse: "+t.message,"GRAPH_CODE_SANDBOX_PARSE_ERROR",{code:e,error:t.message})}}y.full(t,e=>{const t=e;if("ImportDeclaration"===t.type)throw new pt("Imports are not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"import"});if("ExportNamedDeclaration"===t.type||"ExportDefaultDeclaration"===t.type)throw new pt("Exports are not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"export"});if("Identifier"===t.type&&"string"==typeof t.name&&vo.has(t.name))throw new pt(`Identifier "${t.name}" is not allowed in Code nodes.`,"GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:t.name});if("NewExpression"===t.type&&"Function"===t.callee?.name)throw new pt("new Function() is not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"Function"});if("CallExpression"===t.type&&"eval"===t.callee?.name)throw new pt("eval() is not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"eval"})})})(n);const r=!(e=>/\breturn\b[\s;]/.test(e))(n),a=r?n.replace(/[\s;]+$/,""):n,i={$input:e.input??{},$vars:e.vars??{},$item:e.item,$index:e.index,$node:e.nodes??{},$output:void 0},s=Object.keys(i),l=r?`return (${a});`:a,c=`"use strict";\nasync function __userFunction(${s.join(", ")}) {\n${l}\n}\n__userFunction(${s.join(", ")}).then(function(__r) { return JSON.stringify({ v: __r }); });`,u=new d.Isolate({memoryLimit:this.defaultMemoryMb}),p=await u.createContext();try{const t=p.global;e.logger&&await this.injectConsole(p,e.logger);for(const[e,o]of Object.entries(i))await t.set(e,new d.ExternalCopy(void 0===o?null:o).copyInto());let o;try{o=await u.compileScript(c,{filename:"graph-code-node.js"})}catch(e){if(!r)throw new pt("Code failed to compile: "+e.message,"GRAPH_CODE_SANDBOX_COMPILE_ERROR",{code:n,error:e.message});{const e=a,t=`"use strict";\nasync function __userFunction(${s.join(", ")}) {\n${e}\n}\n__userFunction(${s.join(", ")}).then(function(__r) { return JSON.stringify({ v: __r }); });`;try{o=await u.compileScript(t,{filename:"graph-code-node.js"})}catch(e){throw new pt("Code failed to compile: "+e.message,"GRAPH_CODE_SANDBOX_COMPILE_ERROR",{code:n,error:e.message})}}}const l=e.timeoutMs??this.defaultTimeoutMs;let h;try{h=await this.runBounded(o,p,l,e.abortSignal)}catch(e){if(e instanceof pt)throw e;const t=e.message;if(t.includes("timed out")||t.includes("timeout"))throw new pt(`Code execution timed out after ${l} ms`,"GRAPH_CODE_SANDBOX_TIMEOUT",{timeoutMs:l});if(t.includes("memory")||t.includes("heap"))throw new pt(`Code exceeded the memory limit of ${this.defaultMemoryMb} MB`,"GRAPH_CODE_SANDBOX_MEMORY_LIMIT",{memoryMb:this.defaultMemoryMb});throw new pt("Code execution failed: "+t,"GRAPH_CODE_SANDBOX_RUNTIME_ERROR",{code:n,error:t})}if("string"!=typeof h)throw new pt("Code sandbox returned an unexpected non-string result","GRAPH_CODE_SANDBOX_UNEXPECTED_RESULT",{result:h});return JSON.parse(h).v}finally{p.release(),u.dispose()}}async runBounded(e,t,o,n){const r=e.run(t,{timeout:o,promise:!0});r.catch(()=>{});const a=[r];let i,s;try{return a.push(new Promise((e,t)=>{i=setTimeout(()=>{t(new pt(`Code execution timed out after ${o} ms`,"GRAPH_CODE_SANDBOX_TIMEOUT",{timeoutMs:o}))},o+100)})),n&&a.push(new Promise((e,t)=>{const r=()=>{const e="timeout"===n.reason;t(new pt(e?`Code execution timed out after ${o} ms`:"Code execution aborted",e?"GRAPH_CODE_SANDBOX_TIMEOUT":"GRAPH_CODE_SANDBOX_ABORTED",{timeoutMs:o,reason:n.reason}))};n.aborted?r():(n.addEventListener("abort",r,{once:!0}),s=()=>n.removeEventListener("abort",r))})),await Promise.race(a)}finally{i&&clearTimeout(i),s?.()}}async injectConsole(e,t){const o=new d.Reference((e,o)=>{let n;try{n=JSON.parse(o)}catch{n=[o]}const r=n.map(e=>"string"==typeof e?e:JSON.stringify(e)).join(" "),a=1===n.length?n[0]:n;switch(e){case"log":case"info":default:t.info(r,a);break;case"warn":t.warn(r,a);break;case"error":t.error(r,a);break;case"debug":case"dir":case"dirxml":case"table":t.debug(r,a);break;case"trace":t.trace(r,a);break;case"group":case"groupCollapsed":t.debug("[group] "+r,a);break;case"groupEnd":t.debug("[groupEnd]",void 0);break;case"time":case"timeEnd":case"timeLog":case"count":case"countReset":t.debug(`[${e}] ${r}`,a);break;case"assert":n[0]||t.error("Assertion failed: "+r,a);case"clear":}});await e.evalClosure("\n function __ser() {\n var out = [];\n for (var i = 0; i < arguments.length; i++) {\n var a = arguments[i];\n try { out.push(typeof a === 'object' ? JSON.parse(JSON.stringify(a)) : a); }\n catch (e) { out.push(String(a)); }\n }\n return JSON.stringify(out);\n }\n function __call(level) {\n return function() {\n $0.applySync(undefined, [level, __ser.apply(null, arguments)]);\n };\n }\n globalThis.console = {\n log: __call('log'),\n info: __call('info'),\n warn: __call('warn'),\n error: __call('error'),\n debug: __call('debug'),\n trace: __call('trace'),\n dir: __call('dir'),\n dirxml: __call('dirxml'),\n table: __call('table'),\n group: __call('group'),\n groupCollapsed: __call('groupCollapsed'),\n groupEnd: __call('groupEnd'),\n time: __call('time'),\n timeEnd: __call('timeEnd'),\n timeLog: __call('timeLog'),\n assert: __call('assert'),\n count: __call('count'),\n countReset: __call('countReset'),\n clear: __call('clear')\n };\n ",[o]),o.release()}}class Io extends a.InternalError{constructor(e){super(e,Io.name,500)}}class Eo extends a.NotFoundError{constructor(e){super(e),this.name=Eo.name}}class Ao extends a.NotFoundError{constructor(e){super(e),this.name=Ao.name}}class Oo{constructor(e,t,o={}){this.kind=e,this.declarations=new Map,this.implementations=new Map;for(const e of t){if("string"!=typeof e?.name||!e.name)throw new Io(`Method declaration for kind '${this.kind}' is missing a name`);if(this.declarations.has(e.name))throw new Io(`Kind '${this.kind}' declares duplicate method '${e.name}'`);this.declarations.set(e.name,e)}for(const[e,t]of Object.entries(o)){if("function"!=typeof t)throw new Io(`Method implementation '${e}' for kind '${this.kind}' is not a function`);if(!this.declarations.has(e))throw new Io(`Kind '${this.kind}' implements method '${e}' which is not declared by its manifest`);this.implementations.set(e,t)}for(const e of this.declarations.keys())if(!this.implementations.has(e))throw new Io(`Kind '${this.kind}' declares method '${e}' with no implementation`)}has(e){return this.declarations.has(e)}getDeclaration(e){const t=this.declarations.get(e);if(!t)throw new Ao(`Kind '${this.kind}' does not declare method '${e}'`);return t}get(e){return this.getDeclaration(e),this.implementations.get(e)}list(){return[...this.declarations.values()].sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)}}function xo(e,t){if(!t)return;let o=e;for(const e of t.split(".")){if(!o||"object"!=typeof o)return;o=o[e]}return o}function ko(e,t,o){const n=xo(t,e.itemIdPath),r=e.itemLabelPath?xo(t,e.itemLabelPath):void 0;return{id:"string"==typeof n&&n||"number"==typeof n&&Number.isFinite(n)&&n+""||o+"",label:"string"==typeof r?r:void 0}}function Do(e,t){switch(t){case"input":return e.inputs;case"output":return e.outputs;default:return e.connections}}function So(e,t){const o={inputs:[],outputs:[],connections:[]},n={input:new Set((e.inputs??[]).map(e=>e.id)),output:new Set((e.outputs??[]).map(e=>e.id)),connection:new Set((e.connections??[]).map(e=>e.id))},r=(e,t)=>{const o=n[e];return!o.has(t)&&(o.add(t),!0)};for(const n of e.dynamicPorts??[])if("repeatFromParameter"===n.type){const e=t[n.parameter];if(!Array.isArray(e))continue;const a=Do(o,n.direction);e.forEach((e,t)=>{const{id:o,label:i}=ko(n,e,t),s=(d={id:o,index:t,label:i??o},n.portIdTemplate.replaceAll("${id}",d.id).replaceAll("${index}",d.index+"").replaceAll("${label}",d.label));var d;if(!r(n.direction,s))return;const l=n.defaultPort?ie(n.defaultPort):{id:s,label:i??s,direction:n.direction};l.id=s,l.direction=n.direction,i&&(l.label=i),a.push(l)})}else if("togglePort"===n.type){if(t[n.parameter]!==n.equals)continue;const e=ie(n.port);if(!r(e.direction,e.id))continue;Do(o,e.direction).push(e)}return o}function Po(e,t){const o=So(e,t),n={kind:e.kind,display:e.display,inputs:[...e.inputs,...o.inputs],outputs:[...e.outputs,...o.outputs],parameters:e.parameters},r=[...e.connections??[],...o.connections];return r.length&&(n.connections=r),e.dynamicPorts?.length&&(n.dynamicPorts=e.dynamicPorts),e.credentials?.length&&(n.credentials=e.credentials),e.capabilities?.length&&(n.capabilities=e.capabilities),e.policies&&(n.policies=e.policies),e.metadata&&(n.metadata=e.metadata),e.namespaces?.length&&(n.namespaces=e.namespaces),ie(n)}class Ro{async resolve(e,t,o,n,r){if(o){const a=await o(n,r);if(!(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.kind&&"object"==typeof t.display&&null!==t.display&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.parameters)})(a))throw new Io(`resolveManifest provider for kind '${e}' returned a value that does not conform to GraphResolvedNodeManifest`);if(!ae(a))throw new Io(`resolveManifest provider for kind '${e}' returned a non-JSON-safe resolved manifest`);const i=ie(a);return!i.namespaces?.length&&t.namespaces?.length&&(i.namespaces=t.namespaces.slice()),i}return Po(t,n.parameters??{})}}const Co=["edge","literal","expression"];function To(e){return Co.includes(e)}function $o(e,t,o){if("string"!=typeof o||!o)throw new Io(`Manifest for kind '${e}' has a ${t} with an empty port id`);if(te(o))throw new Io(`Manifest for kind '${e}' has a ${t} with unsafe port id '${o}'`)}function Go(e){return e}function Lo(e){if(!e)return;const t={...e.metadata??{},...e.parameters??{},...e.state??{}};return e.loop&&(t.loop=e.loop),t}e.GraphNodeCatalogue=class extends s.Service{constructor(){super(),this.entries=new Map,this.resolver=new Ro,this.fallbackContext=new s.Context}withContext(e){return e[e.length-1]instanceof s.Context?e:[this.fallbackContext]}register(e,t={},...o){const{log:n}=this.logCtx(this.withContext(o),"register").for(this.register);n.debug(`Registering graph node kind '${e?.manifest?.kind??"unknown"}'`),(e=>{if(!e||"object"!=typeof e)throw new Io("Graph node registration is required");if(!e.manifest||"object"!=typeof e.manifest)throw new Io("Graph node registration is missing a manifest");if(!e.executor||"function"!=typeof e.executor.execute)throw new Io(`Graph node registration for kind '${e.manifest?.kind+""}' is missing an executor`)})(e);const r=e.manifest;if("string"!=typeof r.kind||!r.kind.trim())throw new Io("Graph node manifest kind is required and must be a non-empty string");const a=r.kind;if(this.entries.has(a)&&!t.replace)throw new Io(`Graph node kind '${a}' is already registered; pass { replace: true } to replace it`);try{$e(r)}catch(e){throw new Io(`Manifest for kind '${a}' is not JSON-serializable: ${e.message}`)}((e,t)=>{const o=[["input",t.inputs],["output",t.outputs],["connection",t.connections??[]]];for(const[t,n]of o){const o=new Set;for(const r of n){if($o(e,t+" port",r?.id),o.has(r.id))throw new Io(`Manifest for kind '${e}' declares duplicate static ${t} port id '${r.id}'`);if(o.add(r.id),void 0!==r.defaultMode&&!To(r.defaultMode))throw new Io(`Manifest for kind '${e}' declares invalid default binding mode '${r.defaultMode+""}' on ${t} port '${r.id}'`)}}})(a,r);const i=((e,t)=>{const o=new Set;for(const n of t.parameters){const t=n?.id;if("string"!=typeof t||!t)throw new Io(`Manifest for kind '${e}' has a parameter with an empty id`);if(te(t))throw new Io(`Manifest for kind '${e}' has a parameter with unsafe id '${t}'`);if(o.has(t))throw new Io(`Manifest for kind '${e}' declares duplicate parameter id '${t}'`);o.add(t)}return o})(a,r);((e,t,o)=>{for(const n of t.dynamicPorts??[]){if(!n||"string"!=typeof n.parameter||!n.parameter)throw new Io(`Manifest for kind '${e}' has a dynamic-port rule without a parameter reference`);if(!o.has(n.parameter))throw new Io(`Manifest for kind '${e}' has a dynamic-port rule referencing missing parameter '${n.parameter}'`);if("togglePort"===n.type){if(!n.port)throw new Io(`Manifest for kind '${e}' has a togglePort rule without a port`);$o(e,"togglePort rule port",n.port.id)}if("repeatFromParameter"===n.type&&"string"!=typeof n.portIdTemplate)throw new Io(`Manifest for kind '${e}' has a repeatFromParameter rule without a portIdTemplate`)}})(a,r,i),((e,t)=>{for(const o of t.credentials??[]){if(!Re(o))throw new Io(`Manifest for kind '${e}' has a malformed credential requirement`);if(!o.type)throw new Io(`Manifest for kind '${e}' has a credential requirement with an empty type`)}})(a,r),((e,t)=>{for(const o of t.methods??[])if(!Le(o))throw new Io(`Manifest for kind '${e}' has a malformed method declaration`)})(a,r);const s=new Oo(a,r.methods??[],e.methods??{});return this.entries.set(a,{registration:e,methods:s,placeholderManifest:!1}),this}registerExecutor(e,t,...o){const{log:n}=this.logCtx(this.withContext(o),"registerExecutor").for(this.registerExecutor);if(n.debug(`Registering graph executor for kind '${e}'`),"string"!=typeof e||!e.trim())throw new Io("Graph executor kind is required");if(!t||"function"!=typeof t.execute)throw new Io(`Executor registered for kind '${e}' is missing an execute method`);const r=this.entries.get(e);if(r)return r.registration={...r.registration,executor:t},this;const a={kind:e,display:{name:e},inputs:[],outputs:[],parameters:[],policies:{allowUndeclaredParameters:!0,allowUnknownOutputs:!0}};return this.entries.set(e,{registration:{manifest:a,executor:t},methods:new Oo(e,[],{}),placeholderManifest:!0}),this}unregister(e,...t){const{log:o}=this.logCtx(this.withContext(t),"unregister").for(this.unregister);return o.debug(`Unregistering graph node kind '${e}'`),this.entries.delete(e),this}has(e,...t){return this.logCtx(this.withContext(t),"has").for(this.has),this.entries.has(e)}entry(e){const t=this.entries.get(e);if(!t)throw new Eo(`No graph node kind '${e}' is registered in the catalogue`);return t}getManifest(e,...t){return this.logCtx(this.withContext(t),"getManifest").for(this.getManifest),ie(this.entry(e).registration.manifest)}getExecutor(e,...t){return this.logCtx(this.withContext(t),"getExecutor").for(this.getExecutor),this.entry(e).registration.executor}getMethodDeclaration(e,t,...o){return this.logCtx(this.withContext(o),"getMethodDeclaration").for(this.getMethodDeclaration),this.entry(e).methods.getDeclaration(t)}getMethod(e,t,...o){return this.logCtx(this.withContext(o),"getMethod").for(this.getMethod),this.entry(e).methods.getDeclaration(t),this.entry(e).methods.get(t)}listMethodDeclarations(e,...t){return this.logCtx(this.withContext(t),"listMethodDeclarations").for(this.listMethodDeclarations),this.entry(e).methods.list()}listManifests(e,...t){this.logCtx(this.withContext(t),"listManifests").for(this.listManifests);const o=[...this.entries.keys()].sort(),n=e?.categories?.length?new Set(e.categories):void 0,r=e?.kinds?.length?new Set(e.kinds):void 0,a=[];for(const e of o){if(r&&!r.has(e))continue;const o=this.getManifest(e,...t);n&&!n.has(o.display.category??"")||a.push(o)}return a}listKinds(...e){return this.logCtx(this.withContext(e),"listKinds").for(this.listKinds),[...this.entries.keys()].sort()}get size(){return this.entries.size}async resolveManifest(e,t,o,...n){this.logCtx(this.withContext(n),"resolveManifest").for(this.resolveManifest);const r=this.entry(e);return this.resolver.resolve(e,r.registration.manifest,r.registration.resolveManifest,t,o)}},e.GraphNodeCatalogue=i.__decorate([s.service(),i.__metadata("design:paramtypes",[])],e.GraphNodeCatalogue),e.GraphNodeExecutorRegistry=class extends s.Service{constructor(t=new e.GraphNodeCatalogue){super(),this.catalogue=t}get catalog(){return this.catalogue}register(e,t,...o){const{log:n}=this.logCtx(o,"register").for(this.register);if(n.debug(`Registering graph executor for kind '${e}'`),!e)throw new pt("Graph executor kind is required");return this.catalogue.registerExecutor(e,t,...o),this}unregister(e,...t){const{log:o}=this.logCtx(t,"unregister").for(this.unregister);return o.debug(`Unregistering graph executor for kind '${e}'`),this.catalogue.unregister(e,...t),this}has(e,...t){return this.logCtx(t,"has").for(this.has),this.catalogue.has(e,...t)}resolve(e,...t){this.logCtx(t,"resolve").for(this.resolve);try{return this.catalogue.getExecutor(e,...t)}catch(t){if(t instanceof Eo)throw new pt(`No graph executor registered for kind '${e}'`,"GRAPH_EXECUTOR_NOT_FOUND",{kind:e});throw t}}},e.GraphNodeExecutorRegistry=i.__decorate([s.service(),i.__metadata("design:paramtypes",[e.GraphNodeCatalogue])],e.GraphNodeExecutorRegistry),e.GraphNodeExecutorResolver=class extends s.Service{constructor(e,t){super(),this.registry=e,this.defaultExecutor=t}resolve(e,...t){const{log:o}=this.logCtx(t,"resolve").for(this.resolve);return o.debug(`Resolving graph executor for kind '${e}'`),this.registry.has(e,...t)?this.registry.resolve(e,...t):this.defaultExecutor?this.defaultExecutor:this.registry.resolve(e,...t)}},e.GraphNodeExecutorResolver=i.__decorate([s.service(),i.__metadata("design:paramtypes",[Function,Object])],e.GraphNodeExecutorResolver);class Mo extends r.Model{constructor(e){super(),r.Model.fromModel(this,e)}execute(e,t){throw new pt(`Graph node kind '${this.constructor.name}' does not implement execute`,"GRAPH_NODE_EXECUTE_NOT_IMPLEMENTED",{kind:this.constructor.name})}static applyMetadata(e){return null}static instantiate(e){return new this(e)}}function Fo(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}e.BreakFlowNode=class extends Mo{execute(e,t){throw new _t(e.inputs.value)}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.break.fields.value.label",placeholder:"graph.node.flow_control.break.fields.value.placeholder",type:"textarea"}),Y({handle:"value"}),i.__metadata("design:type",Object)],e.BreakFlowNode.prototype,"value",void 0),e.BreakFlowNode=i.__decorate([J("core.flow.break",{kind:"core.flow.break",category:"Flow Control",color:"#f59e0b",icon:"ti-square-arrow-right",width:96,height:96,labels:["flow","break","loop","control"],metadata:{title:"graph.node.flow_control.break.name",description:"graph.node.flow_control.break.description"}}),r.model()],e.BreakFlowNode),e.ErrorBoundaryFlowNode=class extends Mo{async execute(e,t){const o=t.node.errorBoundary;if(!o?.try)return{result:e.inputs.value??e.inputs};const n=t.engine;if(!n)throw new pt("errorBoundary node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");try{const r=await n.execute(o.try,e.inputs,{parentRunId:t.runId,path:[...t.path,"try"]}),a=Object.values(r.nodeResults).find(e=>e.status===O.FAILED);if(a)throw new pt(a.error?.message??"error boundary try body failed",a.error?.code??"GRAPH_ERROR_BOUNDARY",a.error?.details);return{result:r.outputs.result??r.outputs}}catch(r){let a=r;if(o.catch){const i=await n.execute(o.catch,{...e.inputs,error:Fo(r)},{parentRunId:t.runId,path:[...t.path,"catch"]});a=i.outputs.error??i.outputs}return{error:a}}finally{o.finally&&await n.execute(o.finally,e.inputs,{parentRunId:t.runId,path:[...t.path,"finally"]})}}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.error_boundary.fields.value.label",placeholder:"graph.node.flow_control.error_boundary.fields.value.placeholder",type:"textarea"}),Y({handle:"value"}),i.__metadata("design:type",Object)],e.ErrorBoundaryFlowNode.prototype,"value",void 0),i.__decorate([Q({handle:"result"}),i.__metadata("design:type",Object)],e.ErrorBoundaryFlowNode.prototype,"result",void 0),i.__decorate([Q({handle:"error"}),i.__metadata("design:type",Object)],e.ErrorBoundaryFlowNode.prototype,"error",void 0),e.ErrorBoundaryFlowNode=i.__decorate([J("core.flow.errorBoundary",{kind:"core.flow.errorBoundary",category:"Flow Control",color:"#f59e0b",icon:"ti-shield-check",width:96,height:96,labels:["flow","error","try-catch"],metadata:{title:"graph.node.flow_control.error_boundary.name",description:"graph.node.flow_control.error_boundary.description",finally:!1}}),r.model()],e.ErrorBoundaryFlowNode),e.HumanApprovalFlowNode=class extends Mo{execute(e){const t=e.inputs.value??e.inputs;return!1===this.approved?{rejected:t}:{approved:t}}},i.__decorate([r.required(),Y({handle:"value"}),i.__metadata("design:type",Object)],e.HumanApprovalFlowNode.prototype,"value",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.human_approval.fields.message.label",placeholder:"graph.node.flow_control.human_approval.fields.message.placeholder",type:"textarea"}),Y({handle:"message",userControlled:!0}),i.__metadata("design:type",String)],e.HumanApprovalFlowNode.prototype,"message",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.human_approval.fields.approved.label",type:"checkbox"}),Y({handle:"approved",userControlled:!0}),i.__metadata("design:type",Boolean)],e.HumanApprovalFlowNode.prototype,"approved",void 0),i.__decorate([Q({handle:"approved"}),i.__metadata("design:type",Object)],e.HumanApprovalFlowNode.prototype,"approvedOut",void 0),i.__decorate([Q({handle:"rejected"}),i.__metadata("design:type",Object)],e.HumanApprovalFlowNode.prototype,"rejectedOut",void 0),e.HumanApprovalFlowNode=i.__decorate([J("core.flow.humanApproval",{kind:"core.flow.humanApproval",category:"Flow Control",color:"#f59e0b",icon:"ti-user-check",width:96,height:96,labels:["flow","approval","suspend"],metadata:{title:"graph.node.flow_control.human_approval.name",description:"graph.node.flow_control.human_approval.description",approvers:[],timeoutMs:864e5}}),r.model()],e.HumanApprovalFlowNode);class Vo{evaluate(e,t){switch(e.op){case"eq":return this.resolveValue(e.left,t)===this.resolveValue(e.right,t);case"neq":return this.resolveValue(e.left,t)!==this.resolveValue(e.right,t);case"gt":return Number(this.resolveValue(e.left,t))>Number(this.resolveValue(e.right,t));case"gte":return Number(this.resolveValue(e.left,t))>=Number(this.resolveValue(e.right,t));case"lt":return Number(this.resolveValue(e.left,t))<Number(this.resolveValue(e.right,t));case"lte":return Number(this.resolveValue(e.left,t))<=Number(this.resolveValue(e.right,t));case"and":return e.conditions.every(e=>this.evaluate(e,t));case"or":return e.conditions.some(e=>this.evaluate(e,t));case"not":return!this.evaluate(e.condition,t);case"exists":return void 0!==this.resolveValue(e.value,t)&&null!==this.resolveValue(e.value,t);default:throw new pt(`Unknown ConditionExpression op '${e.op}'`,"GRAPH_UNKNOWN_CONDITION_OP",{expr:e})}}resolveValue(e,t){if("const"in e)return e.const;if("path"in e&&!("step"in e))return this.resolvePath(e.path,t);if("step"in e&&"path"in e){const o=t?.nodes;if(o&&"object"==typeof o){const t=o[e.step];return this.resolvePath(e.path,t)}return this.resolvePath(e.path,t)}throw new pt("Invalid ExprValue: must have `const`, `path`, or `step`+`path`","GRAPH_INVALID_EXPR_VALUE",{ref:e})}resolvePath(e,t){if(!e)return t;const o=e.split(".");let n=t;for(const e of o){if(null==n)return;n=n[e]}return n}}function jo(e){return"object"==typeof e&&null!==e&&"type"in e&&"code"===e.type}function Uo(e){return"object"==typeof e&&null!==e&&"op"in e&&"string"==typeof e.op}async function Bo(e,t,o){const n=o.engine?.codeSandboxEvaluator;if(!n)throw new pt("Code conditions require a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{code:e.code});await o.log("Evaluating code condition",{language:e.language??"javascript"});const r=o.metadata;return!!await n.evaluate({code:e.code,language:e.language,input:t,vars:r?.vars??void 0,item:r?.item,index:r?.index,nodes:r?.nodes??void 0,logger:o.logger,abortSignal:o.abortSignal})}function qo(e,t,o){if(Uo(e))return(new Vo).evaluate(e,t);throw((e,t)=>new pt(`Unknown ${t??"flow"} condition type \u2014 must be ConditionExpression (op) or CodeCondition (type: 'code')`,"GRAPH_UNKNOWN_CONDITION_TYPE",{condition:e}))(e,o)}async function Wo(e,t,o){return jo(e)?Bo(e,t.input,o):qo(e,t.state,t.label)}e.IfFlowNode=class extends Mo{execute(e,t){const o=e.inputs,n=o.value??o;if(!this.condition)throw new pt("If node has no condition configured","GRAPH_IF_NO_CONDITION",{input:o});if(jo(this.condition))return Bo(this.condition,o,t).then(e=>this.route(e,n));const r=qo(this.condition,((e,t)=>t===e||"object"!=typeof t||null===t||Array.isArray(t)?e:{...t,...e})(o,n),"if");return this.route(r,n)}route(e,t){if(e)return{then:t};if(!0===this.else)return{else:t};throw new pt("If node condition evaluated to false and the else branch is disabled","GRAPH_IF_ELSE_DISABLED",{condition:this.condition})}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.value.label",placeholder:"graph.node.flow_control.if.fields.value.placeholder",type:"textarea"}),Y({handle:"value"}),i.__metadata("design:type",Object)],e.IfFlowNode.prototype,"value",void 0),i.__decorate([r.required(),Q({handle:"then"}),i.__metadata("design:type",Object)],e.IfFlowNode.prototype,"then",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.condition.label",placeholder:"graph.node.flow_control.if.fields.condition.placeholder",type:"code"}),Y({handle:"condition",userControlled:!0,type:"object"}),i.__metadata("design:type",Object)],e.IfFlowNode.prototype,"condition",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.else.label",type:"checkbox"}),Y({handle:"else",userControlled:!0}),i.__metadata("design:type",Boolean)],e.IfFlowNode.prototype,"else",void 0),e.IfFlowNode=i.__decorate([J("core.flow.if",{kind:"core.flow.if",category:"Flow Control",color:"#f59e0b",icon:"ti-arrows-split-2",width:96,height:96,labels:["flow","conditional","branch"],metadata:{title:"graph.node.flow_control.if.name",description:"graph.node.flow_control.if.description"}}),r.model()],e.IfFlowNode),e.SwitchFlowNode=class extends Mo{async execute(e,t){const o=((e,t)=>{const o={cases:t.cases??[],defaultPort:t.defaultPort??"default",hasDefault:!0===t.hasDefault},n=e.node.metadata?.switch;return n&&Array.isArray(n.cases)?{cases:n.cases,defaultPort:n.defaultPort??o.defaultPort,hasDefault:!0===n.hasDefault||o.hasDefault}:o})(t,this),n=o.cases,r=e.inputs,a=r.value??r,i=((e,t)=>t===e||"object"!=typeof t||null===t||Array.isArray(t)?e:{...t,...e})(r,a);for(const e of n)if(await Wo(e.condition,{input:r,state:i,label:"switch case"},t))return{[e.outputPort]:a};if(!0!==o.hasDefault)throw new pt("No switch case matched and default port is not enabled","GRAPH_SWITCH_NO_MATCH",{cases:n.map(e=>e.id)});const s=o.defaultPort??"default";return{[s]:a}}static applyMetadata(e){const t=H(this),o=e.defaultPort??"default",n=!0===e.hasDefault,r=t.ports.filter(t=>!e.cases.some(e=>e.outputPort===t.property)),a=r.filter(e=>e.property!==o),i=r.find(e=>e.property===o),s=[...a,...e.cases.map(e=>({property:e.outputPort,name:e.label,direction:g.OUTPUT,label:e.label,required:!1,hidden:!1,path:e.outputPort}))];return n&&i&&s.push(i),{ports:s,size:b(t,{cases:e.cases.length}),dataPatch:{switchMetadata:e}}}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.value.label",placeholder:"graph.node.flow_control.switch.fields.value.placeholder",type:"textarea"}),Y({handle:"value"}),i.__metadata("design:type",Object)],e.SwitchFlowNode.prototype,"value",void 0),i.__decorate([r.required(),Q({handle:"default"}),i.__metadata("design:type",Object)],e.SwitchFlowNode.prototype,"default",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.cases.label",type:"collection"}),i.__metadata("design:type",Object)],e.SwitchFlowNode.prototype,"cases",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.hasDefault.label",type:"checkbox"}),i.__metadata("design:type",Boolean)],e.SwitchFlowNode.prototype,"hasDefault",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.defaultPort.label",type:"text"}),i.__metadata("design:type",String)],e.SwitchFlowNode.prototype,"defaultPort",void 0),e.SwitchFlowNode=i.__decorate([J("core.flow.switch",{kind:"core.flow.switch",category:"Flow Control",color:"#f59e0b",icon:"ti-arrows-shuffle",width:120,height:140,sizeRules:[{type:"parameterCount",parameter:"cases",dimension:"height",perItem:24}],labels:["flow","switch","multi-branch"],metadata:{title:"graph.node.flow_control.switch.name",description:"graph.node.flow_control.switch.description"}}),r.model()],e.SwitchFlowNode);const Ho={maxDocumentBytes:2e6,maxNestingDepth:10,maxNodes:500,maxEdges:1e3},Ko=t.LoggedEnvironment.accumulate({graph:{workflows:{limits:{...Ho},allowAnonymousAccess:!1},execution:{maxCodeTimeoutMs:lt}}});function zo(e,t){const o="number"==typeof e?e:Number(e);return Number.isFinite(o)&&o>0?Math.min(Math.floor(o),t):1e3}const Jo=["javascript","typescript"],Xo="javascript";e.CodeInputSchema=class extends r.Model{constructor(){super(...arguments),this.language=Xo}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.code.fields.language.label",type:"select"}),r.option([...Jo]),r.type(String),i.__metadata("design:type",String)],e.CodeInputSchema.prototype,"language",void 0),i.__decorate([r.required(),o.uielement("code-editor",{label:"graph.node.utility.code.fields.code.label",placeholder:"graph.node.utility.code.fields.code.placeholder"}),Y({handle:"code"}),i.__metadata("design:type",String)],e.CodeInputSchema.prototype,"code",void 0),i.__decorate([o.hidden(),Y({handle:"data"}),i.__metadata("design:type",Object)],e.CodeInputSchema.prototype,"data",void 0),e.CodeInputSchema=i.__decorate([r.model()],e.CodeInputSchema),e.CodeNode=class extends Mo{async execute(e,t){const o=e.inputs,n=this.input,r=o.code??e.parameters?.code??n?.code??this.defaultCode,a=n?.language??Xo;if(!r||"string"!=typeof r||0===r.trim().length)throw new ft("Code node has no code to execute (input.code is empty)",{input:o});const i=t.engine?.codeSandboxEvaluator;if(!i)throw new pt("Code node execution requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{code:r});const s=Ko.graph.execution?.maxCodeTimeoutMs??lt,d=zo(this.timeoutMs,s),l=t.metadata,c={code:r,language:a,input:o,vars:l?.vars??void 0,item:l?.item,index:l?.index,nodes:l?.nodes??void 0,logger:t.logger,timeoutMs:d,abortSignal:t.abortSignal};await t.log("Executing code node",{language:a,length:r.length,timeoutMs:d});const u=await i.evaluate(c);return await t.log("Code node executed",{hasResult:void 0!==u}),{result:u}}},i.__decorate([r.required(),Y({handle:"input",model:e.CodeInputSchema}),i.__metadata("design:type",e.CodeInputSchema)],e.CodeNode.prototype,"input",void 0),i.__decorate([r.min(1),r.max(lt),o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.code.fields.timeoutMs.label",type:"number"}),Y({handle:"timeoutMs"}),i.__metadata("design:type",Number)],e.CodeNode.prototype,"timeoutMs",void 0),i.__decorate([o.uielement("code-editor",{label:"graph.node.utility.code.fields.defaultCode.label",placeholder:"graph.node.utility.code.fields.defaultCode.placeholder"}),Y({handle:"defaultCode",userControlled:!0}),i.__metadata("design:type",String)],e.CodeNode.prototype,"defaultCode",void 0),i.__decorate([r.required(),Q({handle:"result"}),i.__metadata("design:type",Object)],e.CodeNode.prototype,"result",void 0),e.CodeNode=i.__decorate([J("core.utility.code",{kind:"core.utility.code",category:"Utility",color:"#0d9488",icon:"ti-code",width:96,height:96,labels:["utility","code","sandbox","transform"],metadata:{title:"graph.node.utility.code.name",description:"graph.node.utility.code.description"}}),r.model()],e.CodeNode),e.DelayFlowNode=class extends Mo{execute(e){return{value:e.inputs.value??e.inputs}}},i.__decorate([r.required(),Y({handle:"value"}),i.__metadata("design:type",Object)],e.DelayFlowNode.prototype,"value",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.delay.fields.timeoutMs.label",type:"number"}),Y({handle:"timeoutMs"}),i.__metadata("design:type",Number)],e.DelayFlowNode.prototype,"timeoutMs",void 0),i.__decorate([r.required(),Q({handle:"value"}),i.__metadata("design:type",Object)],e.DelayFlowNode.prototype,"valueOut",void 0),e.DelayFlowNode=i.__decorate([J("core.flow.delay",{kind:"core.flow.delay",category:"Utility",color:"#0d9488",icon:"ti-clock-hour-4",width:96,height:96,labels:["flow","delay","wait"],metadata:{title:"graph.node.utility.delay.name",description:"graph.node.utility.delay.description"}}),r.model()],e.DelayFlowNode),e.LogFlowNode=class extends Mo{execute(e,t){const o=e.inputs.value,n=this.level??"info";return t.logger[n](this.message??"Log node",{value:o}),{value:o}}},i.__decorate([r.required(),Y({handle:"value"}),i.__metadata("design:type",Object)],e.LogFlowNode.prototype,"value",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.log.fields.message.label",placeholder:"graph.node.utility.log.fields.message.placeholder",type:"textarea"}),Y({handle:"message"}),i.__metadata("design:type",String)],e.LogFlowNode.prototype,"message",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.log.fields.level.label",placeholder:"graph.node.utility.log.fields.level.placeholder",type:"text"}),Y({handle:"level",userControlled:!0}),i.__metadata("design:type",String)],e.LogFlowNode.prototype,"level",void 0),i.__decorate([r.required(),Q({handle:"value"}),i.__metadata("design:type",Object)],e.LogFlowNode.prototype,"valueOut",void 0),e.LogFlowNode=i.__decorate([J("core.flow.log",{kind:"core.flow.log",category:"Utility",color:"#0d9488",icon:"ti-terminal",width:96,height:96,labels:["flow","log","debug","utility"],metadata:{title:"graph.node.utility.log.name",description:"graph.node.utility.log.description"}}),r.model()],e.LogFlowNode),e.MapNode=class extends Mo{execute(e){return{result:{mapped:e.inputs.value??e.inputs}}}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.map.fields.value.label",placeholder:"graph.node.utility.map.fields.value.placeholder",type:"textarea"}),Y({handle:"value"}),i.__metadata("design:type",Object)],e.MapNode.prototype,"value",void 0),i.__decorate([r.required(),Q({handle:"result"}),i.__metadata("design:type",Object)],e.MapNode.prototype,"result",void 0),e.MapNode=i.__decorate([J("core.utility.map",{kind:"core.utility.map",category:"Utility",color:"#0d9488",icon:"ti-arrows-right-left",width:96,height:96,labels:["utility","map","transform"],metadata:{title:"graph.node.utility.map.name",description:"graph.node.utility.map.description",mapper:{}}}),r.model()],e.MapNode),e.UtilityLogNode=class extends Mo{execute(e,t){const o=e.inputs.value,n=this.level??"info";return t.logger[n](this.message??"Log node",{value:o}),{value:o}}},i.__decorate([r.required(),Y({handle:"value"}),i.__metadata("design:type",Object)],e.UtilityLogNode.prototype,"value",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.utility_log.fields.message.label",placeholder:"graph.node.utility.utility_log.fields.message.placeholder",type:"textarea"}),Y({handle:"message"}),i.__metadata("design:type",String)],e.UtilityLogNode.prototype,"message",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.utility.utility_log.fields.level.label",placeholder:"graph.node.utility.utility_log.fields.level.placeholder"}),Y({handle:"level",userControlled:!0,type:"string"}),i.__metadata("design:type",String)],e.UtilityLogNode.prototype,"level",void 0),i.__decorate([r.required(),Q({handle:"value"}),i.__metadata("design:type",Object)],e.UtilityLogNode.prototype,"valueOut",void 0),e.UtilityLogNode=i.__decorate([J("core.utility.log",{kind:"core.utility.log",category:"Utility",color:"#0d9488",icon:"ti-terminal",width:96,height:96,labels:["utility","log","debug","observability"],metadata:{title:"graph.node.utility.utility_log.name",description:"graph.node.utility.utility_log.description"}}),r.model()],e.UtilityLogNode),e.ChatTriggerNode=class extends Mo{execute(e){return{message:e.inputs.message??null,sessionId:e.inputs.sessionId??null,userId:e.inputs.userId??null}}},i.__decorate([r.required(),Q({handle:"message"}),i.__metadata("design:type",String)],e.ChatTriggerNode.prototype,"message",void 0),i.__decorate([r.required(),Q({handle:"sessionId"}),i.__metadata("design:type",String)],e.ChatTriggerNode.prototype,"sessionId",void 0),i.__decorate([r.required(),Q({handle:"userId"}),i.__metadata("design:type",String)],e.ChatTriggerNode.prototype,"userId",void 0),e.ChatTriggerNode=i.__decorate([J("core.trigger.chat",{kind:"core.trigger.chat",category:"Trigger",color:"#3b82f6",icon:"ti-message-circle",width:96,height:96,labels:["trigger","chat","entrypoint"],metadata:{title:"graph.node.trigger.chat.name",description:"graph.node.trigger.chat.description",trigger:{type:"chat"}}}),r.model()],e.ChatTriggerNode),e.EventTriggerNode=class extends Mo{execute(e){return{payload:e.inputs.payload??null}}},i.__decorate([r.required(),Q({handle:"payload"}),i.__metadata("design:type",Object)],e.EventTriggerNode.prototype,"payload",void 0),e.EventTriggerNode=i.__decorate([J("core.trigger.event",{kind:"core.trigger.event",category:"Trigger",color:"#3b82f6",icon:"ti-broadcast",width:96,height:96,labels:["trigger","event","bus"],metadata:{title:"graph.node.trigger.event.name",description:"graph.node.trigger.event.description",trigger:{type:"event",topic:"default"}}}),r.model()],e.EventTriggerNode),e.FormTriggerNode=class extends Mo{execute(e){return{payload:e.inputs.payload??null}}},i.__decorate([r.required(),Y({handle:"schema"}),o.uielement("ngx-decaf-model-builder",{label:"graph.node.trigger.form.fields.schema.label",placeholder:"graph.node.trigger.form.fields.schema.placeholder"}),i.__metadata("design:type",Object)],e.FormTriggerNode.prototype,"schema",void 0),i.__decorate([r.required(),Q({handle:"payload"}),i.__metadata("design:type",Object)],e.FormTriggerNode.prototype,"payload",void 0),e.FormTriggerNode=i.__decorate([J("core.trigger.form",{kind:"core.trigger.form",category:"Trigger",color:"#3b82f6",icon:"ti-forms",width:96,height:96,labels:["trigger","form","public"],metadata:{title:"graph.node.trigger.form.name",description:"graph.node.trigger.form.description",trigger:{type:"form",fields:[]}}}),r.model()],e.FormTriggerNode),e.ManualTriggerNode=class extends Mo{execute(e){return{payload:e.inputs.payload??null}}},i.__decorate([r.required(),Q({handle:"payload"}),i.__metadata("design:type",Object)],e.ManualTriggerNode.prototype,"payload",void 0),e.ManualTriggerNode=i.__decorate([J("core.trigger.manual",{kind:"core.trigger.manual",category:"Trigger",color:"#3b82f6",icon:"ti-hand-click",width:96,height:96,labels:["trigger","manual","entrypoint"],metadata:{title:"graph.node.trigger.manual.name",description:"graph.node.trigger.manual.description",trigger:{type:"manual",inputSchema:{}}}}),r.model()],e.ManualTriggerNode),e.ScheduleTriggerNode=class extends Mo{execute(e){return{payload:e.inputs.payload??null}}},i.__decorate([r.required(),Y({handle:"cron"}),o.uielement("app-cron-selector-field",{label:"graph.node.trigger.schedule.fields.cron.label",placeholder:"graph.node.trigger.schedule.fields.cron.placeholder"}),i.__metadata("design:type",String)],e.ScheduleTriggerNode.prototype,"cron",void 0),i.__decorate([r.required(),Q({handle:"payload"}),i.__metadata("design:type",Object)],e.ScheduleTriggerNode.prototype,"payload",void 0),e.ScheduleTriggerNode=i.__decorate([J("core.trigger.schedule",{kind:"core.trigger.schedule",category:"Trigger",color:"#3b82f6",icon:"ti-calendar-time",width:96,height:96,labels:["trigger","schedule","cron"],metadata:{title:"graph.node.trigger.schedule.name",description:"graph.node.trigger.schedule.description",trigger:{type:"schedule",schedule:"0 * * * *",timezone:"UTC"}}}),r.model()],e.ScheduleTriggerNode),e.WebhookTriggerNode=class extends Mo{execute(e){return{payload:e.inputs.payload??null}}},i.__decorate([r.required(),Y({handle:"schema"}),o.uielement("ngx-decaf-model-builder",{label:"graph.node.trigger.webhook.fields.schema.label",placeholder:"graph.node.trigger.webhook.fields.schema.placeholder"}),i.__metadata("design:type",Object)],e.WebhookTriggerNode.prototype,"schema",void 0),i.__decorate([r.required(),Q({handle:"payload"}),i.__metadata("design:type",Object)],e.WebhookTriggerNode.prototype,"payload",void 0),e.WebhookTriggerNode=i.__decorate([J("core.trigger.webhook",{kind:"core.trigger.webhook",category:"Trigger",color:"#3b82f6",icon:"ti-webhook",width:96,height:96,labels:["trigger","webhook","http"],metadata:{title:"graph.node.trigger.webhook.name",description:"graph.node.trigger.webhook.description",trigger:{type:"webhook",path:"/webhook",method:"POST",auth:"none",responseMode:"onReceived"}}}),r.model()],e.WebhookTriggerNode),e.AgentNode=class extends Mo{execute(e){return{response:"[Agent response] "+(e.inputs.prompt??""),actions:[]}}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.prompt.label",placeholder:"graph.node.agent.agent.fields.prompt.placeholder",type:"textarea"}),Y({handle:"prompt"}),i.__metadata("design:type",String)],e.AgentNode.prototype,"prompt",void 0),i.__decorate([r.required(),Q({handle:"response"}),i.__metadata("design:type",String)],e.AgentNode.prototype,"response",void 0),i.__decorate([r.required(),Q({handle:"actions"}),i.__metadata("design:type",Array)],e.AgentNode.prototype,"actions",void 0),i.__decorate([Z({category:"model",handle:"model"}),i.__metadata("design:type",Object)],e.AgentNode.prototype,"model",void 0),i.__decorate([Z({category:"memory",handle:"memory"}),i.__metadata("design:type",Object)],e.AgentNode.prototype,"memory",void 0),i.__decorate([Z({category:"workspace",handle:"workspace"}),i.__metadata("design:type",Object)],e.AgentNode.prototype,"workspace",void 0),e.AgentNode=i.__decorate([J("core.agent",{kind:"core.agent",category:"Agent",width:140,height:120,labels:["agent","ai","orchestrator"],metadata:{title:"graph.node.agent.agent.name",description:"graph.node.agent.agent.description",shape:"rectangle"}}),r.model()],e.AgentNode);const Yo=[e.AgentNode];function Qo(e,t,o,n){const r=t??o;if(null==e)return Math.min(o,r);const a=Number(e);if(!Number.isFinite(a)||0>=a)throw new ft(n+" loop maxIterations must be a positive finite number");return Math.min(Math.floor(a),r)}function Zo(e,t,o){const n=t.node.loop,r=t.metadata?.loop;if(!n?.body&&!r?.body)throw new ft(o+" node is missing loop configuration (instance.loop.body)");const a=t=>{const o=e[t]??n?.[t]??r?.[t],a=Number(o);return void 0!==o&&Number.isFinite(a)?a:void 0},i=t=>{const o=e[t]??r?.[t];return"string"==typeof o?o:void 0};return{body:n?.body??r?.body,maxIterations:a("maxIterations"),timeoutMs:a("timeoutMs"),concurrency:a("concurrency"),condition:e.condition??r?.condition,inputPort:i("inputPort"),outputPort:i("outputPort"),itemPort:i("itemPort"),resultPort:i("resultPort"),statePort:i("statePort"),slice:a("slice")}}e.GraphForeachLoopNode=class extends Mo{async execute(e,t){const o=Zo(this,t,"foreach"),n=e.inputs,r=n.items,a=Qo(o.maxIterations,t.limits?.maxForeachIterations,1e3,"foreach");if(!Array.isArray(r))throw new ft("foreach input 'items' must be an array");const i=t.engine;if(!i)throw new pt("foreach node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");const s=Number(n.slice??o.slice??1),d=Number.isFinite(s)&&s>0?Math.floor(s):1,l=d>1?Math.ceil(r.length/d):r.length;if(l>a)throw new gt(`foreach exceeded max iterations (${l} > ${a})`);const c=o.itemPort??"item",u=o.resultPort??"result",p=o.statePort??"state",h=o.body,f=[];let g=n.state,m=!1;await t.emit({type:D.LOOP_STARTED});for(let e=0;l>e;e++){await t.emit({type:D.LOOP_ITERATION_STARTED,iteration:e});const o=d>1?r.slice(e*d,e*d+d):r[e],n={[c]:o,index:e};d>1&&(n.slice=o),void 0!==g&&(n[p]=g);try{const r=await i.execute(h,n,{parentRunId:t.runId,path:[...t.path,"iteration:"+e],metadata:{item:o,index:e,slice:d},auth:t.auth},t);f.push(r.outputs[u]),void 0!==r.outputs[p]&&(g=r.outputs[p])}catch(o){if(o instanceof _t){const n=o.details?.value;void 0!==n&&f.push(n),m=!0,await t.emit({type:D.LOOP_ITERATION_COMPLETED,iteration:e,metadata:{broken:!0}});break}throw o}await t.emit({type:D.LOOP_ITERATION_COMPLETED,iteration:e})}await t.emit({type:D.LOOP_COMPLETED,metadata:{broken:m}});const y={results:f,completed:f,iterations:f.length,broken:m};return void 0!==g&&(y[p]=g),y}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.items.label",placeholder:"graph.node.loop.foreach.fields.items.placeholder",type:"textarea"}),Y({handle:"items"}),i.__metadata("design:type",Array)],e.GraphForeachLoopNode.prototype,"items",void 0),i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.slice.label",placeholder:"graph.node.loop.foreach.fields.slice.placeholder",type:"number"}),Y({handle:"slice"}),i.__metadata("design:type",Number)],e.GraphForeachLoopNode.prototype,"slice",void 0),i.__decorate([r.required(),Q({handle:"item"}),i.__metadata("design:type",Object)],e.GraphForeachLoopNode.prototype,"item",void 0),i.__decorate([r.required(),Z({handle:"loop",connectionRules:{allowSelf:!0,maxConnections:1}}),i.__metadata("design:type",Object)],e.GraphForeachLoopNode.prototype,"loop",void 0),i.__decorate([r.required(),Q({handle:"completed"}),i.__metadata("design:type",Array)],e.GraphForeachLoopNode.prototype,"completed",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.maxIterations.label",type:"number"}),Y({handle:"maxIterations",userControlled:!0}),i.__metadata("design:type",Number)],e.GraphForeachLoopNode.prototype,"maxIterations",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.condition.label",type:"code"}),Y({handle:"condition",userControlled:!0}),i.__metadata("design:type",Object)],e.GraphForeachLoopNode.prototype,"condition",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.itemPort.label",type:"text"}),Y({handle:"itemPort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphForeachLoopNode.prototype,"itemPort",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.resultPort.label",type:"text"}),Y({handle:"resultPort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphForeachLoopNode.prototype,"resultPort",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.statePort.label",type:"text"}),Y({handle:"statePort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphForeachLoopNode.prototype,"statePort",void 0),e.GraphForeachLoopNode=i.__decorate([J("graph-foreach-loop-node",{kind:"core.loop.foreach",category:"Loop",color:"#eab308",icon:"ti-repeat",width:120,height:140,labels:["loop","iteration","foreach"],metadata:{title:"graph.node.loop.foreach.name",description:"graph.node.loop.foreach.description",loop:{maxIterations:100,itemPort:"item",resultPort:"result",slice:1}}}),r.model()],e.GraphForeachLoopNode);class en{constructor(){this.expressionEvaluator=new Vo}evaluate(t,o){if(this.isConditionExpression(t))return this.expressionEvaluator.evaluate(t,o);const n=this.resolveValue(t.left,o),r=t.right;switch(t.type){case e.GraphConditionType.TRUTHY:return!!n;case e.GraphConditionType.FALSY:return!n;case e.GraphConditionType.EQUALS:return n===r;case e.GraphConditionType.NOT_EQUALS:return n!==r;case e.GraphConditionType.GREATER_THAN:return Number(n)>Number(r);case e.GraphConditionType.GREATER_THAN_OR_EQUAL:return Number(n)>=Number(r);case e.GraphConditionType.LESS_THAN:return Number(r)>Number(n);case e.GraphConditionType.LESS_THAN_OR_EQUAL:return Number(r)>=Number(n);case e.GraphConditionType.EXISTS:return null!=n;case e.GraphConditionType.CUSTOM:throw new pt("Custom condition evaluators are not supported in v1","GRAPH_CUSTOM_CONDITION_UNSUPPORTED");default:throw new pt(`Unknown condition type '${t.type}'`,"GRAPH_UNKNOWN_CONDITION_TYPE",{condition:t})}}async evaluateAsync(e,t,o,n){return jo(e)?Bo(e,n,o):this.evaluate(e,t)}resolveValue(e,t){if(!e)return t;const o=e.split(".");let n=t;for(const e of o){if(null==n)return;n=n[e]}return n}isConditionExpression(e){return"string"==typeof e.op}}function tn(e,t,o,n={}){return{id:e,label:t,direction:o,...n}}function on(e){const t=e,o=F(t),n=o?.metadata?.title;return et(t,n?{name:n}:{})}e.GraphUntilLoopNode=class extends Mo{async execute(e,t){const o=Zo(this,t,"until"),n=e.inputs,r=Qo(o.maxIterations,t.limits?.maxLoopIterations,100,"until"),a=o.condition;if(!a)throw new ft("until node is missing a condition");const i=o.statePort??"state",s=o.inputPort??i,d=o.outputPort??i,l=o.body,c=t.engine;if(!c)throw new pt("until node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");let u=n.state,p=0;await t.emit({type:D.LOOP_STARTED});let h=!1;do{if(p>=r)throw await t.emit({type:D.LOOP_LIMIT_REACHED,iteration:p}),new gt(`until loop exceeded max iterations (${r})`);await t.emit({type:D.LOOP_ITERATION_STARTED,iteration:p}),u=(await c.execute(l,{[s]:u,iteration:p},{parentRunId:t.runId,path:[...t.path,"iteration:"+p],auth:t.auth},t)).outputs[d],await t.emit({type:D.LOOP_ITERATION_COMPLETED,iteration:p});const e=await(new en).evaluateAsync(a,u,t,{...n,state:u});await t.emit({type:D.LOOP_CONDITION_EVALUATED,iteration:p,payload:{result:e}}),p++,h=e}while(!h);return await t.emit({type:D.LOOP_COMPLETED}),{state:u,iterations:p}}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.state.label",placeholder:"graph.node.loop.until.fields.state.placeholder",type:"textarea"}),Y({handle:"state"}),i.__metadata("design:type",Object)],e.GraphUntilLoopNode.prototype,"state",void 0),i.__decorate([r.required(),Q({handle:"state"}),i.__metadata("design:type",Object)],e.GraphUntilLoopNode.prototype,"stateOut",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.maxIterations.label",type:"number"}),Y({handle:"maxIterations",userControlled:!0}),i.__metadata("design:type",Number)],e.GraphUntilLoopNode.prototype,"maxIterations",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.condition.label",type:"code"}),Y({handle:"condition",userControlled:!0}),i.__metadata("design:type",Object)],e.GraphUntilLoopNode.prototype,"condition",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.statePort.label",type:"text"}),Y({handle:"statePort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphUntilLoopNode.prototype,"statePort",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.inputPort.label",type:"text"}),Y({handle:"inputPort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphUntilLoopNode.prototype,"inputPort",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.outputPort.label",type:"text"}),Y({handle:"outputPort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphUntilLoopNode.prototype,"outputPort",void 0),e.GraphUntilLoopNode=i.__decorate([J("graph-until-loop-node",{kind:"core.loop.until",category:"Loop",color:"#eab308",icon:"ti-player-stop",width:96,height:96,labels:["loop","conditional","until"],metadata:{title:"graph.node.loop.until.name",description:"graph.node.loop.until.description",loop:{maxIterations:50,statePort:"state",condition:{type:"greaterThanOrEqual",left:"iteration",right:2}}}}),r.model()],e.GraphUntilLoopNode),e.GraphWhileLoopNode=class extends Mo{async execute(e,t){const o=Zo(this,t,"while"),n=e.inputs,r=Qo(o.maxIterations,t.limits?.maxLoopIterations,100,"while"),a=o.condition;if(!a)throw new ft("while node is missing a condition");const i=o.statePort??"state",s=o.inputPort??i,d=o.outputPort??i,l=o.body,c=t.engine;if(!c)throw new pt("while node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");let u=n.state,p=0;for(await t.emit({type:D.LOOP_STARTED});await(new en).evaluateAsync(a,u,t,{...n,state:u});){if(p>=r)throw await t.emit({type:D.LOOP_LIMIT_REACHED,iteration:p}),new gt(`while loop exceeded max iterations (${r})`);await t.emit({type:D.LOOP_CONDITION_EVALUATED,iteration:p,payload:{result:!0}}),await t.emit({type:D.LOOP_ITERATION_STARTED,iteration:p}),u=(await c.execute(l,{[s]:u,iteration:p},{parentRunId:t.runId,path:[...t.path,"iteration:"+p],auth:t.auth},t)).outputs[d],await t.emit({type:D.LOOP_ITERATION_COMPLETED,iteration:p}),p++}return await t.emit({type:D.LOOP_COMPLETED}),{state:u,iterations:p}}},i.__decorate([r.required(),o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.state.label",placeholder:"graph.node.loop.while.fields.state.placeholder",type:"textarea"}),Y({handle:"state"}),i.__metadata("design:type",Object)],e.GraphWhileLoopNode.prototype,"state",void 0),i.__decorate([r.required(),Q({handle:"state"}),i.__metadata("design:type",Object)],e.GraphWhileLoopNode.prototype,"stateOut",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.maxIterations.label",type:"number"}),Y({handle:"maxIterations",userControlled:!0}),i.__metadata("design:type",Number)],e.GraphWhileLoopNode.prototype,"maxIterations",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.condition.label",type:"code"}),Y({handle:"condition",userControlled:!0}),i.__metadata("design:type",Object)],e.GraphWhileLoopNode.prototype,"condition",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.statePort.label",type:"text"}),Y({handle:"statePort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphWhileLoopNode.prototype,"statePort",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.inputPort.label",type:"text"}),Y({handle:"inputPort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphWhileLoopNode.prototype,"inputPort",void 0),i.__decorate([o.uielement("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.outputPort.label",type:"text"}),Y({handle:"outputPort",userControlled:!0}),i.__metadata("design:type",String)],e.GraphWhileLoopNode.prototype,"outputPort",void 0),e.GraphWhileLoopNode=i.__decorate([J("graph-while-loop-node",{kind:"core.loop.while",category:"Loop",color:"#eab308",icon:"ti-arrows-loop",width:96,height:96,labels:["loop","conditional","while"],metadata:{title:"graph.node.loop.while.name",description:"graph.node.loop.while.description",loop:{maxIterations:50,statePort:"state",condition:{type:"lessThan",left:"iteration",right:3}}}}),r.model()],e.GraphWhileLoopNode),e.GraphInputValueNode=class extends Mo{execute(e){const t=e.inputs;return{value:t?.value??null}}},i.__decorate([Q({handle:"value",connectionRules:{allowMultiple:!0}}),i.__metadata("design:type",Object)],e.GraphInputValueNode.prototype,"value",void 0),e.GraphInputValueNode=i.__decorate([J("graph-input-value-node",{kind:"value",category:"Boundary",color:"#0f766e",icon:"ti-circle-plus",labels:["workflow","input","value"],metadata:{title:"graph.node.boundary.input.name",description:"graph.node.boundary.input.description"}}),r.model()],e.GraphInputValueNode),e.GraphOutputValueNode=class extends Mo{execute(e){return{}}},i.__decorate([r.required(),Y({handle:"value"}),i.__metadata("design:type",Object)],e.GraphOutputValueNode.prototype,"value",void 0),e.GraphOutputValueNode=i.__decorate([J("graph-output-value-node",{kind:"result",category:"Boundary",color:"#0f766e",icon:"ti-circle-minus",width:96,height:96,labels:["workflow","output","value"],metadata:{title:"graph.node.boundary.output.name",description:"graph.node.boundary.output.description"}}),r.model()],e.GraphOutputValueNode);const nn={kind:"core.loop.foreach",capabilities:["loop"],display:{name:"graph.node.loop.foreach.name",description:"graph.node.loop.foreach.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-repeat"},width:120,height:140,labels:["loop","iteration","foreach"]},inputs:[tn("items","graph.node.loop.foreach.ports.input.items.label","input",{required:!0,schema:{type:"array",items:{type:"any"}}}),tn("slice","graph.node.loop.foreach.ports.input.slice.label","input",{schema:{type:"number",integer:!0,min:1}}),tn("state","graph.node.loop.foreach.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[tn("results","graph.node.loop.foreach.ports.output.results.label","output",{schema:{type:"array",items:{type:"any"}}}),tn("completed","graph.node.loop.foreach.ports.output.completed.label","output",{schema:{type:"array",items:{type:"any"}}}),tn("iterations","graph.node.loop.foreach.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}}),tn("broken","graph.node.loop.foreach.ports.output.broken.label","output",{schema:{type:"boolean"}}),tn("state","graph.node.loop.foreach.ports.output.state.label","output",{schema:{type:"any"}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.foreach.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.foreach.fields.condition.label"},{type:"string",id:"itemPort",label:"graph.node.loop.foreach.fields.itemPort.label"},{type:"string",id:"resultPort",label:"graph.node.loop.foreach.fields.resultPort.label"},{type:"string",id:"statePort",label:"graph.node.loop.foreach.fields.statePort.label"},{type:"number",id:"slice",label:"graph.node.loop.foreach.fields.slice.label",integer:!0,min:1}]},rn={kind:"core.loop.while",capabilities:["loop"],display:{name:"graph.node.loop.while.name",description:"graph.node.loop.while.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-arrows-loop"},width:120,height:140,labels:["loop","conditional","while"]},inputs:[tn("state","graph.node.loop.while.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[tn("state","graph.node.loop.while.ports.output.state.label","output",{schema:{type:"any"}}),tn("iterations","graph.node.loop.while.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.while.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.while.fields.condition.label",required:!0},{type:"string",id:"statePort",label:"graph.node.loop.while.fields.statePort.label"},{type:"string",id:"inputPort",label:"graph.node.loop.while.fields.inputPort.label"},{type:"string",id:"outputPort",label:"graph.node.loop.while.fields.outputPort.label"}]},an={kind:"core.loop.until",capabilities:["loop"],display:{name:"graph.node.loop.until.name",description:"graph.node.loop.until.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-player-stop"},width:120,height:140,labels:["loop","conditional","until"]},inputs:[tn("state","graph.node.loop.until.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[tn("state","graph.node.loop.until.ports.output.state.label","output",{schema:{type:"any"}}),tn("iterations","graph.node.loop.until.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.until.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.until.fields.condition.label",required:!0},{type:"string",id:"statePort",label:"graph.node.loop.until.fields.statePort.label"},{type:"string",id:"inputPort",label:"graph.node.loop.until.fields.inputPort.label"},{type:"string",id:"outputPort",label:"graph.node.loop.until.fields.outputPort.label"}]},sn=[on(e.GraphInputValueNode),on(e.GraphOutputValueNode),on(e.ManualTriggerNode),on(e.WebhookTriggerNode),on(e.ScheduleTriggerNode),on(e.EventTriggerNode),on(e.FormTriggerNode),on(e.ChatTriggerNode),(dn=on(e.IfFlowNode),{...dn,dynamicPorts:[{type:"togglePort",parameter:"else",equals:!0,port:{id:"else",label:"graph.node.flow_control.if.ports.output.else.label",direction:"output",schema:{type:"any"}}}]}),(e=>({...e,outputs:[],parameters:[...e.parameters,{type:"collection",id:"cases",label:"graph.node.flow_control.switch.fields.cases.label",required:!0,itemIdPath:"outputPort",itemLabelPath:"label"},{type:"boolean",id:"hasDefault",label:"graph.node.flow_control.switch.fields.hasDefault.label",defaultValue:!1},{type:"object",id:"switch",label:"graph.node.flow_control.switch.fields.switch.label",required:!1}],dynamicPorts:[{type:"repeatFromParameter",parameter:"cases",itemIdPath:"outputPort",itemLabelPath:"label",direction:"output",portIdTemplate:"${id}",defaultPort:{id:"case",label:"graph.node.flow_control.switch.ports.output.case.label",direction:"output",schema:{type:"any"}}},{type:"togglePort",parameter:"hasDefault",equals:!0,port:{id:"default",label:"graph.node.flow_control.switch.ports.output.default.label",direction:"output",schema:{type:"any"}}}]}))(on(e.SwitchFlowNode)),on(e.MapNode),on(e.DelayFlowNode),on(e.ErrorBoundaryFlowNode),on(e.HumanApprovalFlowNode),on(e.CodeNode),on(e.LogFlowNode),on(e.UtilityLogNode),on(e.BreakFlowNode),on(e.AgentNode),nn,rn,an];var dn;const ln=Object.fromEntries(sn.map(e=>[e.kind,e])),cn=[e.ManualTriggerNode,e.WebhookTriggerNode,e.ScheduleTriggerNode,e.EventTriggerNode,e.FormTriggerNode,e.ChatTriggerNode],un=[e.IfFlowNode,e.SwitchFlowNode,e.DelayFlowNode,e.ErrorBoundaryFlowNode,e.HumanApprovalFlowNode,e.LogFlowNode,e.BreakFlowNode],pn=[e.CodeNode,e.MapNode,e.UtilityLogNode],hn=[e.GraphForeachLoopNode,e.GraphWhileLoopNode,e.GraphUntilLoopNode],fn=[e.GraphInputValueNode,e.GraphOutputValueNode],gn={value:e.GraphInputValueNode,result:e.GraphOutputValueNode,"core.trigger.manual":e.ManualTriggerNode,"core.trigger.webhook":e.WebhookTriggerNode,"core.trigger.schedule":e.ScheduleTriggerNode,"core.trigger.event":e.EventTriggerNode,"core.trigger.form":e.FormTriggerNode,"core.trigger.chat":e.ChatTriggerNode,"core.flow.if":e.IfFlowNode,"core.flow.switch":e.SwitchFlowNode,"core.utility.map":e.MapNode,"core.flow.delay":e.DelayFlowNode,"core.flow.errorBoundary":e.ErrorBoundaryFlowNode,"core.flow.humanApproval":e.HumanApprovalFlowNode,"core.utility.code":e.CodeNode,"core.flow.log":e.LogFlowNode,"core.utility.log":e.UtilityLogNode,"core.flow.break":e.BreakFlowNode,"core.agent":e.AgentNode,"core.loop.foreach":e.GraphForeachLoopNode,"core.loop.while":e.GraphWhileLoopNode,"core.loop.until":e.GraphUntilLoopNode};function mn(e){return{execute:(t,o)=>e.instantiate({...Lo(o.node),...t.parameters,...o.node.state??{}}).execute(t,o)}}function yn(){const e=[];for(const[t,o]of Object.entries(ln)){const n=gn[t];n&&e.push(Go({manifest:o,executor:mn(n)}))}return e}const wn=["node","definition","executor","execute","ports","component"];function _n(e,t,o,n){return{code:e,path:t,message:o,...void 0!==n?.nodeId?{nodeId:n.nodeId}:{},...void 0!==n?.edgeId?{edgeId:n.edgeId}:{},...n?.details?{details:n.details}:{}}}function bn(e,t){const o=[];for(const n of Object.keys(e))wn.includes(n)&&o.push(_n("document.forbidden-field",`${t}.${n}`,`Field '${n}' is not accepted in a canonical workflow document: node, definition, executor, execute, ports and component fields are rejected at the boundary`,{details:{field:n}}));return o}function vn(e,t){t.push(...bn(e,"$")),e.inputs.forEach((e,o)=>t.push(...bn(e,`inputs[${o}]`))),e.outputs.forEach((e,o)=>t.push(...bn(e,`outputs[${o}]`)));for(const o of e.nodes)t.push(...bn(o,`nodes[${o.id}]`)),o.loop&&(t.push(...bn(o.loop,`nodes[${o.id}].loop`)),vn(o.loop.body,t));for(const o of e.edges)t.push(...bn(o,`edges[${o.id}]`))}function Nn(e,t){const o=[];e.nodes.length>t.maxNodes&&o.push(_n("document.limit.nodes","$.nodes",`Document declares ${e.nodes.length} nodes; at most ${t.maxNodes} are allowed`,{details:{count:e.nodes.length,limit:t.maxNodes}})),e.edges.length>t.maxEdges&&o.push(_n("document.limit.edges","$.edges",`Document declares ${e.edges.length} edges; at most ${t.maxEdges} are allowed`,{details:{count:e.edges.length,limit:t.maxEdges}}));const n=In(e);n>t.maxNestingDepth&&o.push(_n("document.limit.depth","$.nodes",`Document nests loop bodies ${n} levels deep; at most ${t.maxNestingDepth} levels are allowed`,{details:{depth:n,limit:t.maxNestingDepth}}));const r=Buffer.byteLength(JSON.stringify(e),"utf8");return r>t.maxDocumentBytes&&o.push(_n("document.limit.size","$",`Document serializes to ${r} bytes; at most ${t.maxDocumentBytes} bytes are allowed`,{details:{bytes:r,limit:t.maxDocumentBytes}})),o}function In(e,t=0){let o=t;for(const n of e.nodes)n.loop?.body&&(o=Math.max(o,In(n.loop.body,t+1)));return o}async function En(e,t,...o){const n=[];for(const r of e.nodes)t.has(r.kind,...o)||n.push(_n("node.unknown-kind",`nodes[${r.id}].kind`,`Node '${r.id}' references kind '${r.kind}' which is not registered in the backend catalogue`,{nodeId:r.id,details:{kind:r.kind}})),r.loop?.body&&n.push(...await En(r.loop.body,t,...o));return n}async function An(e,t={},...o){const n={...Ho,...t.limits},r=[];if(!Pe(e))return r.push(_n("document.shape","$","Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays")),{valid:!1,issues:r};if(!ae(e))return r.push(_n("document.json-unsafe","$","Document contains JSON-unsafe values: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected")),{valid:!1,issues:r};vn(e,r),r.push(...(e=>{const t=[],o=new Set;for(const n of[...e.inputs,...e.outputs])o.has(n.id)?t.push(_n("document.duplicate-port-id",`ports[${n.id}]`,`Workflow port '${n.id}' is declared more than once; workflow port ids must be unique`)):o.add(n.id);const n=new Set;for(const o of e.nodes)n.has(o.id)?t.push(_n("document.duplicate-node-id",`nodes[${o.id}]`,`Node '${o.id}' is declared more than once; node ids must be unique`,{nodeId:o.id})):n.add(o.id);const r=new Set;for(const o of e.edges)r.has(o.id)?t.push(_n("document.duplicate-edge-id",`edges[${o.id}]`,`Edge '${o.id}' is declared more than once; edge ids must be unique`,{edgeId:o.id})):r.add(o.id);return t})(e)),r.push(...Nn(e,n)),Wt(e,r);try{ve(e)}catch(e){const t=e instanceof a.ValidationError?e.message:e+"";r.push(_n("document.structure","$",t))}return t.catalogue&&r.push(...await En(e,t.catalogue,...o)),{valid:0===r.length,issues:r}}function On(e,t,o={}){const n=e?.owner??null;return!n||n===t||(null==t||""===t)&&!0===o.allowAnonymousAccess}function xn(e,t){return(e?.owner??null)===(t??null)}function kn(e,t,o){if(!xn(e,t))throw new s.ForbiddenError(`${o.resourceKind} '${o.resourceId}' is owned by another user`)}function Dn(e,t,o){if(!On(e,t,o))throw new s.ForbiddenError(`${o.resourceKind} '${o.resourceId}' is owned by another user`)}function Sn(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>Sn(e)).join(",")}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${Sn(t[e])}`).join(",")}}`}function Pn(e){return p.createHash("sha256").update(Sn(e)).digest("hex")}function Rn(e){return new tt({runId:e.runId,workflowId:e.workflowId,...e.ownerUser?{owner:e.ownerUser}:{},status:e.status,...e.documentFingerprint?{documentFingerprint:e.documentFingerprint}:{},...void 0!==e.result?{result:Cn(e.result)}:{},...e.error?{error:Cn(e.error)}:{},createdAt:new Date(e.createdAt),...e.startedAt?{startedAt:new Date(e.startedAt)}:{},...e.finishedAt?{finishedAt:new Date(e.finishedAt)}:{}})}function Cn(e){if(null!=e)return JSON.parse(JSON.stringify(e))}class Tn{constructor(e,t={}){this.sequences=new Map,this.chains=new Map,this.store=e,this.limits={...S,...t}}async publish(e){const t=e.runId,o=(this.sequences.get(t)??0)+1;this.sequences.set(t,o);const n={...e,payload:this.limitPayload(e.payload),sequence:o,timestamp:(new Date).toISOString()},r=(this.chains.get(t)??Promise.resolve()).then(()=>this.store.append(n));return this.chains.set(t,r.catch(()=>{})),await r,n}lastSequence(e){return this.sequences.get(e)??0}release(e){this.sequences.delete(e),this.chains.delete(e)}limitPayload(e){if(void 0===e)return;let t;try{t=JSON.stringify(e)}catch{return{nonSerializable:!0}}return t.length>this.limits.maxEventPayloadBytes?{truncated:!0,reason:"event payload exceeds the configured byte limit",bytes:t.length}:e}}class $n{constructor(e,t,o,n={},r={}){this.controllers=new Map,this.completions=new Map,this.timeouts=new Map,this.engine=e,this.runStore=t,this.publisher=o,this.hooks=n,this.limits={...S,...r}}begin(e){const t=this.controllers.get(e);if(t)return t;const o=new AbortController;return this.controllers.set(e,o),o}abort(e,t){const o=this.controllers.get(e);return!!o&&(o.signal.aborted||o.abort(t),!0)}isAborted(e){return!0===this.controllers.get(e)?.signal.aborted}abortReason(e){const t=this.controllers.get(e)?.signal;if(t?.aborted)return"timeout"===t.reason?"timeout":"user"}waitFor(e){return this.completions.get(e)}schedule(e,t,o,...n){const r=this.completions.get(e.runId);if(r)return r;const a=this.runExecution({...e},t,o,...n).catch(async t=>{const o=Gn(t);try{await this.emitTerminal({...e},D.WORKFLOW_FAILED,o)}catch{}return await this.finalize({...e},"failed",void 0,o,...n)});return this.completions.set(e.runId,a),a}release(e){this.controllers.delete(e),this.completions.delete(e);const t=this.timeouts.get(e);t&&(clearTimeout(t),this.timeouts.delete(e)),this.publisher.release(e)}armTimeout(e){const t=setTimeout(()=>{this.timeouts.delete(e),this.abort(e,"timeout")},this.limits.executionTimeoutMs);this.timeouts.set(e,t)}async runExecution(e,t,o,...n){const r=e.runId;let a,i,s=!1;const d=this.engine.observe({refresh:async t=>{t.runId===r&&(t.error&&(a=t.error),R((await this.publisher.publish(this.envelopeOf(e,t))).type)?s=!0:t.type===D.WORKFLOW_STARTED&&"validating"===e.status&&(e.status="running",await this.persist(e,...n)))}});this.armTimeout(r);try{if(this.isAborted(r)){const t={name:"GraphRunCancelledError",message:`Graph run '${r}' was cancelled before execution started`,code:"GRAPH_RUN_CANCELLED"};return a=t,await this.emitTerminal(e,D.WORKFLOW_CANCELLED,t),s=!0,await this.finalize(e,"cancelled",void 0,t,...n)}let d,l;e.status="validating",e.startedAt=(new Date).toISOString(),await this.persist(e,...n);try{({document:d,fingerprint:l}=await t(...n)),e.documentFingerprint=l,await this.persist(e,...n)}catch(t){const o=Gn(t);return a=o,s||(await this.emitTerminal(e,D.WORKFLOW_FAILED,o),s=!0),await this.finalize(e,"failed",void 0,o,...n)}if(this.isAborted(r)){const t={name:"GraphRunCancelledError",message:`Graph run '${r}' was cancelled before execution started`,code:"GRAPH_RUN_CANCELLED"};return a=t,s||(await this.emitTerminal(e,D.WORKFLOW_CANCELLED,t),s=!0),await this.finalize(e,"cancelled",void 0,t,...n)}try{i=await this.engine.execute(d,o,{runId:r,abortSignal:this.controllers.get(r)?.signal,metadata:{documentFingerprint:l}},...n)}catch(e){a=Gn(e)}const c=this.abortReason(r);let u,p;return"timeout"===c?(u="failed",p=a??{name:"GraphRunTimeoutError",message:`Graph run '${r}' exceeded the configured execution timeout of ${this.limits.executionTimeoutMs}ms`,code:"GRAPH_RUN_TIMEOUT"}):"user"===c?(u="cancelled",p=a):i?.status===O.SUCCEEDED?u="succeeded":i?.status===O.CANCELLED?(u="cancelled",p=a):(u="failed",p=a??Gn(new pt(i?`Graph run '${r}' failed`:`Graph run '${r}' failed without a result`,"GRAPH_RUN_FAILED",{runId:r}))),s||await this.emitTerminal(e,"succeeded"===u?D.WORKFLOW_COMPLETED:"cancelled"===u?D.WORKFLOW_CANCELLED:D.WORKFLOW_FAILED,p),await this.finalize(e,u,i,p,...n)}finally{d();const e=this.timeouts.get(r);e&&(clearTimeout(e),this.timeouts.delete(r))}}async emitTerminal(e,t,o){await this.publisher.publish({runId:e.runId,workflowId:e.workflowId,type:t,error:o})}async finalize(e,t,o,n,...r){e.status=t,o&&(e.result=o),n&&(e.error=n),e.startedAt||(e.startedAt=(new Date).toISOString()),e.finishedAt=(new Date).toISOString(),await this.persist(e,...r);try{await(this.hooks.onRunCompleted?.(e,o))}catch{}return e}async persist(e,...t){await this.runStore.saveRun({...e},...t)}envelopeOf(e,t){return{runId:e.runId,workflowId:t.workflowId??e.workflowId,type:t.type,nodeId:t.nodeId,edgeId:t.edgeId,payload:void 0===t.payload?void 0:re(t.payload)?t.payload:{nonSerializable:!0},error:t.error,parentRunId:t.parentRunId,path:t.path}}}function Gn(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}function Ln(e){if(!e)return;let t;try{t=e.cache?.user}catch{t=void 0}if(null==t)try{t=e.get("user")}catch{t=void 0}return"string"==typeof t&&t.length>0?t:void 0}function Mn(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&Pe(e.document)&&!Pe(e)}function Fn(e){return JSON.parse(JSON.stringify(e))}function Vn(e){if(null==e)return 0;let t;try{t=e.getTime()}catch{return 0}return Number.isFinite(t)?t:0}e.GraphWorkflowService=class extends s.ModelService{constructor(e){super(ot),this.catalogue=e}get limits(){return{...Ho,...Ko.graph.workflows.limits??{}}}get allowAnonymousAccess(){return!0===Ko.graph.workflows.allowAnonymousAccess}async saveDocument(e,t,...o){const{ctx:n,ctxArgs:r}=(await this.logCtx(o,"saveDocument",!0)).for(this.saveDocument);if(!Pe(t))throw new a.ValidationError("Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays");if(t.id!==e)throw new a.ValidationError(`Document id '${t.id}' does not match the workflow id '${e}' from the request path`);const i=await this.validateDocument(t,n);if(!i.valid)throw new vt(i.issues);const s=Ln(n);let d;try{d=await this.read(e,...r)}catch{d=null}d&&this.assertWriteOwnership(e,d,s);const l=new Date;if(d)return d.name=t.name,d.document=Fn(t),d.updatedAt=l,this.update(d,...r);const c=new ot({workflowId:e,name:t.name,document:Fn(t),...s?{owner:s}:{},updatedAt:l});return this.create(c,...r)}async getDocument(e,...t){const{ctx:o,ctxArgs:n}=(await this.logCtx(t,"getDocument",!0)).for(this.getDocument);let r;try{r=await this.read(e,...n)}catch{r=null}if(!r)throw new a.NotFoundError(`No graph workflow found for workflowId '${e}'`);if(this.assertOwnership(e,r,Ln(o)),r.document)return Fn(r.document);throw new a.NotFoundError(`Graph workflow '${e}' has no canonical document; legacy definition/state snapshots are no longer supported (DECAF-50 \xa74.26 R2-2)`)}async listWorkflows(...e){const{ctx:t,ctxArgs:o}=(await this.logCtx(e,"listWorkflows",!0)).for(this.listWorkflows),n=await this.listBy("workflowId",s.OrderDirection.ASC,...o),r=Ln(t);return n.filter(e=>On(e,r,{allowAnonymousAccess:this.allowAnonymousAccess})).sort((e,t)=>Vn(t.updatedAt)-Vn(e.updatedAt))}async assertAccess(e,...t){const{ctx:o,ctxArgs:n}=(await this.logCtx(t,"assertAccess",!0)).for(this.assertAccess);let r;try{r=await this.read(e,...n)}catch{r=null}if(!r)throw new a.NotFoundError(`No graph workflow found for workflowId '${e}'`);return this.assertOwnership(e,r,Ln(o)),r}async validateDocument(e,...t){const{ctx:o}=(await this.logCtx(t,"validateDocument",!0)).for(this.validateDocument);return await An(e,{limits:this.limits,...this.catalogue?{catalogue:this.catalogue}:{}},o)}async saveSnapshot(e,t,...o){const{ctx:n,ctxArgs:r}=(await this.logCtx(o,"saveSnapshot",!0)).for(this.saveSnapshot);if(!ae(t))throw new a.ValidationError("Workflow snapshot payload must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected");if(!Mn(t))throw new a.ValidationError("Workflow snapshots must wrap a canonical GraphWorkflowDocument ({ document, editor?, metadata? }): legacy definition/state snapshots are no longer accepted; save canonical documents via PUT /graph/workflows/{workflowId}");const i=Ln(n);let s;try{s=await this.read(e,...r)}catch{s=null}s&&this.assertWriteOwnership(e,s,i);const d=new Date;if(s)return s.snapshot=t,await this.applyCanonicalWrapper(s,t,n),s.updatedAt=d,this.update(s,...r);const l=new ot({workflowId:e,snapshot:t,...i?{owner:i}:{},updatedAt:d});return await this.applyCanonicalWrapper(l,t,n),this.create(l,...r)}async loadSnapshot(e,...t){const{ctx:o,ctxArgs:n}=(await this.logCtx(t,"loadSnapshot",!0)).for(this.loadSnapshot);try{const t=await this.read(e,...n);return this.assertOwnership(e,t,Ln(o)),t}catch{return null}}assertOwnership(e,t,o){Dn(t??null,o??null,{allowAnonymousAccess:this.allowAnonymousAccess,resourceKind:"Graph workflow",resourceId:e})}assertWriteOwnership(e,t,o){kn(t??null,o??null,{resourceKind:"Graph workflow",resourceId:e})}async applyCanonicalWrapper(e,t,o){if(!Mn(t))return;if(t.document.id!==e.workflowId)throw new a.ValidationError(`Document id '${t.document.id}' does not match the workflow id '${e.workflowId}' from the request path`);const n=await An(t.document,{limits:this.limits,...this.catalogue?{catalogue:this.catalogue}:{}},o);if(!n.valid)throw new vt(n.issues);e.document=Fn(t.document),e.name=t.document.name}},e.GraphWorkflowService=i.__decorate([s.service(ot),i.__metadata("design:paramtypes",[Function])],e.GraphWorkflowService),e.GraphRunModelService=class extends s.ModelService{constructor(){super(tt)}async saveRun(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"saveRun",!0)).for(this.saveRun),n=Rn(e);let r;try{r=await super.read(e.runId,...o)}catch{r=null}if(r)return r.workflowId=n.workflowId,r.owner=n.owner,r.status=n.status,r.documentFingerprint=n.documentFingerprint,r.result=n.result,r.error=n.error,r.startedAt=n.startedAt,r.finishedAt=n.finishedAt,void await this.update(r,...o);await this.create(n,...o)}async readRun(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"readRun",!0)).for(this.readRun);try{return(e=>{const t=e.result;return{runId:e.runId,workflowId:e.workflowId,ownerUser:e.owner??null,status:(o=e.status,"string"==typeof o&&["queued","validating","running","succeeded","failed","cancelled"].includes(o)?e.status:"failed"),createdAt:e.createdAt.toISOString(),...e.startedAt?{startedAt:e.startedAt.toISOString()}:{},...e.finishedAt?{finishedAt:e.finishedAt.toISOString()}:{},...t?{result:t}:{},...e.error?{error:e.error}:{},...e.documentFingerprint?{documentFingerprint:e.documentFingerprint}:{}};var o})(await super.read(e,...o))}catch{return null}}async listRuns(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"listRuns",!0)).for(this.listRuns);return await this.findBy("workflowId",e,...o)}},e.GraphRunModelService=i.__decorate([s.service(tt),i.__metadata("design:paramtypes",[])],e.GraphRunModelService),e.ConditionExpressionEvaluator=Vo,e.DEFAULT_GRAPH_WORKFLOW_DOCUMENT_LIMITS=Ho,e.DEFAULT_GRAPH_WORKFLOW_VALIDATION_LIMITS=ro,e.DEFAULT_PINNING_METADATA=mo,e.GRAPH_AGENT_NODES=Yo,e.GRAPH_BOUNDARY_NODES=fn,e.GRAPH_BUILT_IN_NODE_CLASSES_BY_KIND=gn,e.GRAPH_BUILT_IN_NODE_MANIFESTS=sn,e.GRAPH_BUILT_IN_NODE_MANIFESTS_BY_KIND=ln,e.GRAPH_CODE_DEFAULT_LANGUAGE=Xo,e.GRAPH_CODE_DEFAULT_TIMEOUT_MS=1e3,e.GRAPH_CODE_LANGUAGES=Jo,e.GRAPH_CODE_MAX_TIMEOUT_MS=lt,e.GRAPH_DEFAULT_CONCURRENCY=4,e.GRAPH_DEFAULT_MAX_FOREACH_ITERATIONS=1e3,e.GRAPH_DEFAULT_MAX_LOOP_ITERATIONS=100,e.GRAPH_DOCUMENT_FORBIDDEN_FIELD_KEYS=ao,e.GRAPH_FLOW_CONTROL_NODES=un,e.GRAPH_LOOP_KIND={FOREACH:"core.loop.foreach",WHILE:"core.loop.while",UNTIL:"core.loop.until"},e.GRAPH_LOOP_NODES=hn,e.GRAPH_MAX_FOREACH_ITERATIONS=dt,e.GRAPH_MAX_LOOP_ITERATIONS=st,e.GRAPH_PINNING_METADATA_KEY="graph.pinnable",e.GRAPH_PLAIN_SECRET_KEYS=Xt,e.GRAPH_TRIGGER_NODES=cn,e.GRAPH_UTILITY_NODES=pn,e.GRAPH_WORKFLOW_BOUNDARY=it,e.GRAPH_WORKFLOW_FORBIDDEN_FIELD_KEYS=wn,e.GraphAuthValidator=Mt,e.GraphBreakSignal=_t,e.GraphConditionEvaluator=en,e.GraphConnectionPolicyValidator=Zt,e.GraphConnectionValidationError=oo,e.GraphCredentialAuthorizationError=no,e.GraphCredentialReferenceValidator=eo,e.GraphCycleError=ht,e.GraphDocumentValidationError=to,e.GraphEdgeInstanceValidator=Qt,e.GraphEnvironment=Ko,e.GraphExecutionContext=jt,e.GraphExecutionEngine=bo,e.GraphExecutionError=pt,e.GraphExecutionEventEmitter=Nt,e.GraphExecutionEventFactory=It,e.GraphExecutionFrame=Ut,e.GraphExecutionSnapshotMapper=class{map(e){const t={};for(const[o,n]of Object.entries(e.nodeResults))t[o]={status:n.status,startedAt:n.startedAt?.toISOString(),finishedAt:n.finishedAt?.toISOString(),error:n.error,outputs:n.outputs,fromCache:n.fromCache,pinned:n.pinned};const o={};for(const t of e.events)t.edgeId&&"edge.valueRouted"===t.type&&(o[t.edgeId]={status:O.SUCCEEDED,lastValue:t.payload?.value,updatedAt:t.timestamp.toISOString()});const n=[...e.events];return{runId:e.runId,status:e.status,nodes:t,edges:o,outputs:e.outputs,events:n}}},e.GraphInputError=ft,e.GraphLoopExecutionContext=class{constructor(e,t){this.iteration=e,this.metadata=t}},e.GraphLoopLimitError=gt,e.GraphNode=Mo,e.GraphNodeInstanceValidator=qt,e.GraphNodeManifestResolver=Ro,e.GraphNodeMethodNotFoundError=Ao,e.GraphNodeMethodRegistry=Oo,e.GraphNodeNotFoundError=Eo,e.GraphNodeRegistrationError=Io,e.GraphParameterValidator=Yt,e.GraphPinningDependencyResolver=_o,e.GraphPinningError=mt,e.GraphPinningPolicy=wo,e.GraphPinningService=go,e.GraphPortError=class extends pt{constructor(e,t){super(e,"GRAPH_PORT_ERROR",t)}},e.GraphPortSchemaResolver=class{resolve(e){const t=this.createValidator(e);return{name:e.name,required:e.required,validate:t}}resolveAll(e){const t={};for(const o of e)t[o.name]=this.resolve(o);return t}createValidator(e){switch((e.type??e.designType??"").toLowerCase()){case"string":return e=>"string"==typeof e;case"number":return e=>"number"==typeof e;case"boolean":return e=>"boolean"==typeof e;case"date":return e=>e instanceof Date||"string"==typeof e&&!isNaN(Date.parse(e));case"array":return e=>Array.isArray(e);case"bigint":return e=>"bigint"==typeof e;default:return()=>!0}}},e.GraphRunCancelledError=bt,e.GraphRunEventPublisher=Tn,e.GraphRunExecutor=$n,e.GraphRunService=class{constructor(e,t,o,n={}){this.activeByCaller=new Map,this.callerKeysByRun=new Map,this.releaseTimers=new Map,this.engine=e,this.runStore=t,this.eventStore=o,this.publisher=new Tn(o,n.limits),this.executor=new $n(e,t,this.publisher,{onRunCompleted:n.onRunCompleted},n.limits),this.options={...n,limits:{...S,...n.limits}}}get limits(){return this.options.limits}async createRun(e,t,o,...n){this.validateCreateRequest(e);const r=e.workflowId??e.workflow?.id??"";if(!r)throw new a.ValidationError("Graph run request must carry a workflow document with an id or a saved workflowId");if(e.workflowId&&!this.options.documentResolver)throw new a.ValidationError("Graph run requests by workflowId require a document resolver");const i=o??t??"anonymous",s=this.activeByCaller.get(i)??new Set;if(s.size>=this.options.limits.maxConcurrentRuns)throw new a.ValidationError(`Graph run rejected: the configured limit of ${this.options.limits.maxConcurrentRuns} concurrent runs per caller is exhausted`);const d=this.generateRunId(),l={runId:d,workflowId:r,ownerUser:t,status:"queued",createdAt:(new Date).toISOString()};this.executor.begin(d),await this.runStore.saveRun({...l},...n);const c=this.documentProviderFor(e,t);return s.add(d),this.activeByCaller.set(i,s),this.callerKeysByRun.set(d,i),this.executor.schedule(l,c,e.inputs??{},...n).catch(()=>{}).finally(()=>this.finishActiveRun(d)),l}async getRun(e,t,...o){const n=await this.runStore.readRun(e,...o);if(!n)throw new a.NotFoundError(`No graph run found for runId '${e}'`);return this.assertOwnership(n,t),n}async listRunsByWorkflow(e,t,...o){return(await this.runStore.listRuns(e,...o)).filter(e=>On({owner:e.owner},t,{allowAnonymousAccess:!0===this.options.allowAnonymousAccess})).sort((e,t)=>{const o=e.updatedAt instanceof Date?e.updatedAt.getTime():NaN,n=t.updatedAt instanceof Date?t.updatedAt.getTime():NaN;return(Number.isFinite(n)?n:0)-(Number.isFinite(o)?o:0)})}async cancelRun(e,t,...o){const n=await this.runStore.readRun(e,...o);if(!n)throw new a.NotFoundError(`No graph run found for runId '${e}'`);return this.assertWriteOwnership(n,t),"succeeded"===(r=n.status)||"failed"===r||"cancelled"===r||(this.executor.abort(e,"user"),n.status="cancelled",n.finishedAt=(new Date).toISOString(),await this.runStore.saveRun({...n},...o)),n;var r}async listEvents(e,t,o,...n){return await this.getRun(e,o,...n),this.eventStore.listAfter(e,t)}async subscribeEvents(e,t,o,...n){return await this.getRun(e,t,...n),this.eventStore.subscribe(e,o)}subscribeRunEvents(e,t){return this.eventStore.subscribe(e.runId,t)}async waitForRun(e,t,...o){const n=this.executor.waitFor(e);return n&&await n,this.getRun(e,t,...o)}async executeAndWait(e,t,o,...n){const r=await this.createRun(e,t,o,...n);return this.waitForRun(r.runId,t,...n)}release(e){this.finishActiveRun(e);const t=this.releaseTimers.get(e);t&&(clearTimeout(t),this.releaseTimers.delete(e)),this.executor.release(e),this.eventStore.release?.(e)}finishActiveRun(e){const t=this.callerKeysByRun.get(e);if(void 0!==t){this.callerKeysByRun.delete(e);const o=this.activeByCaller.get(t);o&&(o.delete(e),0===o.size&&this.activeByCaller.delete(t))}if(this.releaseTimers.has(e))return;const o=setTimeout(()=>{this.releaseTimers.delete(e),this.release(e)},this.options.limits.eventReplayWindowMs);o.unref?.(),this.releaseTimers.set(e,o)}validateCreateRequest(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new a.ValidationError("Graph run request must be an object carrying either a workflow document or a workflowId plus inputs");const t=void 0!==e.workflow,o=void 0!==e.workflowId;if(t&&o)throw new a.ValidationError("Graph run request is ambiguous: supply either an unsaved workflow document or a saved workflowId, not both");if(!t&&!o)throw new a.ValidationError("Graph run request must supply either an unsaved workflow document or a saved workflowId");if(t&&!Pe(e.workflow))throw new a.ValidationError("Graph run request carries a payload that is not a canonical GraphWorkflowDocument");if(void 0!==e.inputs&&!ae(e.inputs))throw new a.ValidationError("Graph run inputs must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected");const n=(e=>{try{return JSON.stringify(e)?.length??0}catch{return Number.MAX_SAFE_INTEGER}})(e);if(n>this.options.limits.maxRequestBytes)throw new a.ValidationError(`Graph run request of ${n} bytes exceeds the configured limit of ${this.options.limits.maxRequestBytes} bytes`)}documentProviderFor(e,t){if(e.workflow){const t=e.workflow;return async()=>({document:t,fingerprint:Pn(t)})}const o=e.workflowId;return async(...e)=>{const n=this.options.documentResolver;if(!n)throw new a.ValidationError("Graph run requests by workflowId require a document resolver");const r=await n.resolve(o,t,...e);return{document:r,fingerprint:Pn(r)}}}assertOwnership(e,t){Dn({owner:e.ownerUser},t,{allowAnonymousAccess:!0===this.options.allowAnonymousAccess,resourceKind:"Graph run",resourceId:e.runId})}assertWriteOwnership(e,t){kn({owner:e.ownerUser},t,{resourceKind:"Graph run",resourceId:e.runId})}generateRunId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new yt("Cannot generate a graph run id: crypto.randomUUID is unavailable in this runtime",{runtime:typeof globalThis.crypto});return e.randomUUID()}},e.GraphStoreError=yt,e.GraphTopology=fo,e.GraphTopologyError=wt,e.GraphValueValidator=class{constructor(e){this.resolver=e}validateWorkflowInputs(e,t){this.validatePorts(e.inputs,t,"workflow input")}validateWorkflowOutputs(e,t){this.validatePorts(e.outputs,t,"workflow output")}validateNodeInputs(e,t){const o=(e.ports??[]).filter(e=>"input"===e.direction);this.validatePorts(o,t,`node '${e.name}' input`)}validateNodeOutputs(e,t){const o=(e.ports??[]).filter(e=>"output"===e.direction);this.validatePorts(o,t,`node '${e.name}' output`)}validatePorts(e,t,o){if(e)for(const n of e){const e=Object.prototype.hasOwnProperty.call(t,n.name);if(n.required&&!e)throw new ft(`Missing required ${o} port '${n.name}'`);if(e&&!this.resolver.resolve(n).validate(t[n.name]))throw new ft(`Invalid value for ${o} port '${n.name}'`)}}},e.GraphWorkflowDocumentRejectedError=vt,e.GraphWorkflowDocumentValidator=lo,e.InMemoryGraphRunEventStore=class{constructor(e={}){this.events=new Map,this.listeners=new Map,this.limits={...S,...e}}async append(e){let t=this.events.get(e.runId);t||(t=[],this.events.set(e.runId,t)),t.push(e),this.enforceRetention(t);for(const t of this.listeners.get(e.runId)??[])try{t(e)}catch{}}async listAfter(e,t){const o=this.events.get(e);return o?o.filter(e=>e.sequence>t):[]}subscribe(e,t){let o=this.listeners.get(e);return o||(o=new Set,this.listeners.set(e,o)),o.add(t),()=>{o.delete(t),0===o.size&&this.listeners.delete(e)}}release(e){this.events.delete(e),this.listeners.delete(e)}enforceRetention(e){const t=this.limits.maxEventsPerRun;for(;e.length>t;){const t=e.findIndex(e=>!R(e.type));if(-1===t)break;e.splice(t,1)}}},e.InMemoryGraphRunStore=class{constructor(){this.runs=new Map}async saveRun(e){this.runs.set(e.runId,{...e})}async readRun(e){const t=this.runs.get(e);return t?{...t}:null}async listRuns(e){return[...this.runs.values()].filter(t=>t.workflowId===e).map(e=>Rn(e))}release(e){this.runs.delete(e)}},e.IsolatedVmCodeSandboxEvaluator=No,e.assertGraphResourceOwnership=Dn,e.assertGraphResourceWriteOwnership=kn,e.buildGraphExecutionResult=Bt,e.builtInGraphNodeRegistrations=yn,e.canAccessGraphResource=On,e.canAccessGraphResourcePayload=xn,e.checkGraphValueAgainstSchema=Ht,e.clampGraphCodeTimeoutMs=zo,e.collectLooseNodeIssues=Wt,e.composeGraphNamespace=At,e.createGraphValueRepository=ho,e.declaredGraphNodeMethods=e=>e.methods??[],e.decomposeGraphNamespace=Et,e.decomposeGraphNamespaces=Gt,e.defineGraphNode=Go,e.evaluateCodeCondition=Bo,e.evaluateCondition=Wo,e.evaluateConditionSync=qo,e.findMalformedGraphNamespaces=St,e.findUngrantedGraphNamespaces=Dt,e.graphAuthDataFromRecord=Tt,e.graphAuthDataOf=$t,e.graphNamespaceCovers=kt,e.graphNamespacePartsOf=xt,e.graphNodeConfig=Lo,e.graphRolesFromNamespaces=Pt,e.graphRunDocumentFingerprint=Pn,e.graphWorkflowOwnerOf=Ln,e.isCodeCondition=jo,e.isConditionExpression=Uo,e.isGraphCredentialReferenceLike=zt,e.isGraphNamespaceCacheEntryValid=Ot,e.isGraphResolvedWorkflow=io,e.isPinnable=yo,e.mergeGraphAuthData=Lt,e.registerBuiltInGraphNodes=(e,...t)=>{for(const o of yn())e.register(o,{},...t);return e},e.resolveGraphDynamicPorts=So,e.resolveGraphNodeManifest=Po,e.serializeGraphValueKey=co,e.validateGraphWorkflowDocumentAtBoundary=An},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@decaf-ts/logging"),require("@decaf-ts/ui-decorators"),require("@decaf-ts/decoration"),require("@decaf-ts/decorator-validation"),require("@decaf-ts/db-decorators"),require("tslib"),require("@decaf-ts/core"),require("isolated-vm"),require("acorn"),require("acorn-walk"),require("typescript"),require("node:crypto")):"function"==typeof define&&define.amd?define(["exports","@decaf-ts/logging","@decaf-ts/ui-decorators","@decaf-ts/decoration","@decaf-ts/decorator-validation","@decaf-ts/db-decorators","tslib","@decaf-ts/core","isolated-vm","acorn","acorn-walk","typescript","node:crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["as-graph"]={},e.decafTsLogging,e.decafTsUiDecorators,e.decafTsDecoration,e.decafTsDecoratorValidation,e.decafTsDbDecorators,e.tslib,e.decafTsCore,e.isolatedVm,e.acorn,e.acornWalk,e.typescript,e.node_crypto);
|
|
2
|
+
//# sourceMappingURL=as-graph.cjs.map
|