* fix - supressed warning IL2072
Changed DropInDescriptor from Record to Class to be able to add the suggested DynamicallyAccesedMembers decorator.
* Add Unconfigure method to DropIn class and interface
The `DropIn` class in `DropIn.cs` now includes a new `Unconfigure` method. This method handles the unconfiguration process when a drop-in is deleted. It retrieves the `ILogger<DropIn>` and `IActivityRegistry` services from the `IServiceProvider`, removes the `SampleActivity` from the activity registry, and logs the outcome.
The `IDropIn` interface in `IDropIn.cs` has been updated to include the new `Unconfigure` method, ensuring that it is called when the drop-in is deleted.
Additional using directives have been added to `DropIn.cs` for `Elsa.Workflows`, and `Microsoft.Extensions.Logging`.
* Refactor AssemblyLoader to use memory stream for loading
Modified the `LoadPath` method in the `AssemblyLoader` class to load assemblies from a memory stream instead of directly from the file. This change prevents file locking issues by copying the file contents to a memory stream and then loading the assembly from this stream.
* Dispose packageReader after loading assembly
Ensure the packageReader is disposed of after loading the assembly from the memory stream. This change adds a call to `packageReader.Dispose()` to close the package reader and the associated `.nupkg` file, which helps in releasing resources and preventing potential file locks or memory leaks.
* Add drop-in unloading on file deletion
Updated DropInDirectoryMonitorHostedService to handle unloading of drop-ins when files are deleted. Added `_debouncedUnloader` and `_installedDropIns` fields. Modified constructor to initialize these fields. Updated `ExecuteAsync` to call `LoadDropInAssemblyAsync` initially and handle file deletion events. Added `OnDeleted` method to manage file deletions and invoke the debounced unloader. Enhanced `LoadDropInAssemblyAsync` to track loaded drop-ins. Introduced `UnloadDropInAssemblyAsync` to remove drop-ins on file deletion.
* Load assembly from MemoryStream instead of FileStream
Modified the assembly loading process to use a MemoryStream
instead of a FileStream. This change ensures that the
FileStream is properly closed before the assembly is loaded,
improving resource management and preventing potential file
access issues.
* Improve logging and error handling in DropIn services
Removed logging from DropIn.Unconfigure method and added
ILogger dependency to DropInDirectoryMonitorHostedService.
Updated csproj to include Microsoft.Extensions.Logging.Abstractions.
Enhanced error handling in UnloadDropInAssemblyAsync method.
Minor formatting improvements for readability.
Added a missing period at the end of the FactChecker persona description. Ensures consistency in text descriptions across appsettings.json configuration.
Upgraded Elsa.Studio, Elsa.Studio.Core.BlazorWasm, and Elsa.Studio.Login.BlazorWasm packages from version 3.3.0-preview.508 to 3.3.0-preview.524. Ensures we are using the latest preview features and fixes.
Renamed methods and namespaces for clarity in `AgentsFeature` and extensions. Enhanced functionality of SEO Specialist and added new role for social media in sample app settings. Re-enabled persistence and API usage in Elsa server configuration.
Updated the `Kind` property of `activityDescriptor` to `Job` instead of `Task`. This change ensures the correct categorization and functionality within the agent activity provider.
Removed several unused `using` statements within multiple files to clean up the codebase. Additionally, enhanced the configuration for the `Agent` module in `appsettings.json` and enabled agent-related features in `Program.cs`.
Update the PromptTemplate to focus on text interpretation and simplify the example JSON format. Adjust the OutputVariable description to specify it as a URL to the created artwork.
* Remove `ServiceProfileConfig` and `SkillConfig`
Refactored the codebase to eliminate `ServiceProfileConfig` and `SkillConfig` in favor of simplifying configurations. Updated related entities and settings to consistently use `ServiceConfig` and `AgentConfig`. Refined function execution to enhance overall system coherence and maintainability.
* Refactor agent management and plugin system
This update eliminates AgentManager and related classes, introducing new management interfaces and memory-based stores. The plugin system is refactored with better separation of concerns and the addition of provider interfaces.
* Add new Agents features and services
Introduced AgentsFeature for API endpoints, AgentManagementFeature for agent management, and AgentActivitiesFeature for activities. Updated service configurations and migrated files for cleaner and more maintainable code structure.
* Rename execute endpoints to invoke
Renamed the 'Execute' endpoints and related paths to 'Invoke' for better semantic clarity. Adjusted the namespace and updated the route configuration accordingly to reflect this change.
* Add permissions configuration to Agents Invoke endpoint
This commit adds a call to `ConfigurePermissions("agents:invoke")` in the Agents Invoke endpoint configuration. This change ensures that proper permissions are checked when this endpoint is accessed.
* Rename Management to Persistence with EF Core support
Renamed various files and classes from Management to Persistence. Introduced Entity Framework Core (EF Core) support for agents, including implementation of APIs for API key, service, and agent definitions. The changes also updated project configurations and added necessary database context and entity configurations.
* Add EntityFrameworkCore project for Agents persistence
Introduce a new Entity Framework Core provider to manage the persistence layer of the Agents module. The project includes references to the base persistence and common Entity Framework projects.
* Remove redundant exception handlers and add new SQLite migration.
Deleted unnecessary `DbExceptionTransformer` and `RethrowDbExceptionHandler` classes to streamline error handling. Introduced a new SQLite migration for the Agents module to create necessary database tables and indices. Also modified `Store` and `EntityStore` to utilize a service provider for exception handling.
* Add Sqlite configuration extension and sample updates
Introduce a new extension method for configuring EF Core to use Sqlite in the Elsa.Agents module. Updated the sample project to use a configurable Sqlite connection string and adjusted the appsettings.json accordingly. Also added necessary folder structure in the project file.
* Add agent, service, and API key CRUD operations
Introduced CRUD functionalities for agent, service, and API key entities. Added endpoint handlers, filtering capabilities, and memory/EF core stores to support these operations. Updated configuration mappings as well.
* Add Agent API endpoints and DTOs
Added CRUD endpoints for agents in Elsa.Agents.Api along with the required DTOs and Request models. These endpoints include create, read, update, delete, and list functionalities, facilitating the management of agent entities.
* Add support for agent service providers and discovery
Introduce interfaces and implementations for agent service providers and service discovery. Updated `KernelFactory` to integrate the new service discovery mechanism and restructured plugin discoverer naming for consistency.
* Add agent management features
Introduce agent management components, including pages for listing and handling agent workflows, dialogs for creating agents with Blazor components, and backend API endpoints for generating unique agent names. This enhances functionality for managing agent workflows within the application.
* Refactor exception handling and simplify event handling logic
Replaced DataProcessingDbExceptionHandler with DbExceptionTransformer for handling PostgreSQL exceptions. Streamlined event completion logic by renaming method and ensuring input retrieval before setting the result.
* Add bulk delete endpoint for agents
Introduced new API endpoint for bulk deleting agents. Implemented request and response models, and updated persistence layer to handle bulk operations. Also reorganized project structure for better modularity.
* Refactor API Key models and endpoint classes
Consolidate API Key request models into unified models and update endpoints to use these new models. Add new transformation methods to entity classes. Enhance configuration classes and streamline the dependency injection process.
* Refactor and streamline bulk delete and service APIs
Refactored the bulk delete endpoints for API keys, services, and agents, consolidating request and response models. Added new service input and model classes and updated the corresponding stores to support bulk deletions. Simplified the endpoint logic to use these new models and enhanced filtering capabilities.
* Set default values for AgentInputModel properties
Updated properties in `AgentInputModel` to use initialized default values instead of `default!`. This change ensures that string and object properties are instantiated properly, improving code stability and preventing potential null reference exceptions.
* Add plugin listing endpoint and related models
Introduced a new endpoint to list all registered plugins in the system. Added necessary models and methods for plugin description and retrieval, along with appropriate documentation comments.
* Refactor agent management to use `IAgentManager`.
Created new notifications for agent lifecycle events and introduced an `AgentManager` service for agent CRUD operations. Updated APIs and other components to use the new `IAgentManager` service instead of direct store access for a more cohesive architecture.
* Update agent activity descriptor names
Changed the activity descriptor names to use PascalCase for consistency and readability. Also added display names for input variables to improve user interfaces.
* Add overloaded RefreshDescriptorsAsync for single activity provider
Introduced a new overloaded method in IActivityRegistry and ActivityRegistry to refresh activity descriptors using a single IActivityProvider. Updated RefreshActivityRegistry to use the new method, ensuring more flexibility in descriptor refresh operations.
* Sample to provide a ExpressionDescriptorProvider
* fix variable accessor in VariableExpressionHandler
* remove Variable Expression to use default one
* Change the Variable Expression Provider to handle Variable Expression correctly
* need to check on UI Side and Server side is valid JSON is sent. For example, if a use change from a literal value to a Variable value, the value is sent to the API and result in an exception, we cannot handle invalid json without using Try/Catch
---------
Co-authored-by: Jérémie DEVILLARD <jdevillard@users.noreply.github.com>
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
* Set event payload when event bookmark resumes
* Refactor to move common code into a function
* Typo in event input workflow key
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Refactor DataProcessingException to remove unique key logic and create a dedicated UniqueKeyConstraintViolationException. Update DbExceptionTransformer to use the new exception for unique key violations, improving code clarity and separation of concerns.
Removed the `ConverterHelper` and `ExpandoObjectConverter` classes, along with their integration in `JintJavaScriptEvaluator`. Updated unit tests to skip unsupported functionality and added references to related issues for context.
Changed the fallback version in the GitHub Actions packages workflow from 3.2.0-rc5 to 3.2.0-rc6. This ensures that the workflows use the updated release candidate version for deployments.
Upgraded Elsa.Studio, Elsa.Studio.Core.BlazorWasm, and Elsa.Studio.Login.BlazorWasm to the latest preview version 3.3.0-preview.508. This ensures we are using the most recent features and fixes available in the preview release.
Reorder parameters in StartWorkflowAsync and ResumeWorkflowAsync for consistency. Update FindBookmarksAsync and ExecuteWorkflowAsync to include workflowInstanceId and correlationId, improving workflow lookup and execution logic.
* Modified POST execute API to show body in Swagger and resolved type-casting error in GET execute API
Modified the POST execute API to display the body in Swagger documentation and resolved the type-casting error in the GET execute API
* Added IExecutionRequest interface defines a contract for Request classes
* Moved the serialization logic into request classes
* Add missing import and reformat ActivityHandle property
Included the Elsa.Workflows.Models import in Models.cs to fix missing reference. Removed redundant ActivityHandle assignment in EndpointBase.cs to improve clarity and reduce redundancy.
* Added support to retrieve the workflow details(i.e., WorkflowDefinitionId, WorkflowDefinitionVersionId, WorkflowDefinitionVersion, WorkflowInstanceId) through Liquid script
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Introduce tests for resuming specific HTTP workflow instances. Enhanced `HttpWorkflowsMiddleware` to handle workflow instance IDs and correlation IDs for more precise control over workflow activation and resumption.
Introduce tests for resuming specific HTTP workflow instances. Enhanced `HttpWorkflowsMiddleware` to handle workflow instance IDs and correlation IDs for more precise control over workflow activation and resumption.
* Modified POST execute API to show body in Swagger and resolved type-casting error in GET execute API
Modified the POST execute API to display the body in Swagger documentation and resolved the type-casting error in the GET execute API
* Added IExecutionRequest interface defines a contract for Request classes
* Moved the serialization logic into request classes
* Add missing import and reformat ActivityHandle property
Included the Elsa.Workflows.Models import in Models.cs to fix missing reference. Removed redundant ActivityHandle assignment in EndpointBase.cs to improve clarity and reduce redundancy.
---------
Co-authored-by: Sipke Schoorstra <sipkeschoorstra@outlook.com>
Included Kubernetes YAML files for elsa-server, postgres, plant-uml, and trace-lens projects in the solution. This update ensures that essential configuration files for deployments, services, and roles are managed within the project structure.
Corrected paths in build.sh and build.ps1 to reference correct directories. Added "nuke" project to Elsa.sln for organizing build scripts under solution items.
Removed the 'nuke' project entry from the solution file and adjusted related NUKE tool directory paths within the build project file. These changes streamline the configuration and ensure the NUKE scripts are correctly located in the new directory structure.
Changed the `NukeRootDirectory` and `NukeScriptDirectory` paths to ensure correct directory structure. This update aims to resolve any discrepancies in the build process by pointing to the appropriate directories.
Changed the NukeScriptDirectory path to point one level up to streamline the directory structure. This minor adjustment helps in maintaining consistency across the project configuration.
Adjusted the indentation for the Release configuration of project {99F2B1DA-2F69-4D70-A2A3-AC985AD91EC4} in the solution file Elsa.sln. This change ensures proper alignment and readability of the project's configuration settings.
Refactor InputFunctionsDefinitionProvider to remove unused parameter. Simplify JintJavaScriptEvaluator object wrapping configuration and update Jint package to version 4.0.1. Add type Random to ConfigureEngineWithCommonTypes and enhance error handling in TaskReporter.
Replaced IWorkflowDispatcher in TaskReporter with IWorkflowInbox to streamline task reporting. This fixes race conditions when the workflow is attempted to be resumed before it committed its bookmarks.
* Add handlers and improve JavaScript engine configuration
Added several new handlers for configuring the JavaScript engine with common types, functions, variable accessors, and input/output accessors. Refactored the JintJavaScriptEvaluator for better clarity and modularity by breaking down configuration steps into separate methods. Also replaced `IsInsideCompositeActivity` with `IsContainedWithinCompositeActivity` for better semantic consistency.
* Refactor to use primary constructor syntax for TypeDefinitionProviders
Updated CommonTypeDefinitionProvider, VariableTypeDefinitionProvider, and ActivityOutputFunctionsDefinitionProvider to use primary constructors for dependency injection. This change reduces redundancy and simplifies the code structure for better readability and maintainability.
* Add byte conversion functions to JavaScript engine
Introduced functions for converting bytes to/from strings and Base64. Updated CommonFunctionsDefinitionProvider and ConfigureEngineWithCommonFunctions to incorporate these new functions. This enhances the JavaScript engine's ability to handle byte array manipulations.
* Add tests for JavaScript byte and string conversions.
Introduce integration tests to verify byte array to string, string to byte array, byte array to Base64, and Base64 to byte array conversions using JavaScript functions. Ensure accurate transformation of data within different encoding scenarios.
* Add meaningful summaries to Jint engine configuration handlers
Updated comment summaries in four handler classes to provide clear and concise descriptions of their purpose. This helps improve code readability and understanding for future developers.
* Rename and merge variable and input/output handlers
Merged the variable accessor logic into the input/output handler and renamed the class to reflect its broader functionality. This consolidation ensures the accessors are registered in the right order.
* Add string base64 conversion functions
Introduced `stringToBase64` and `stringFromBase64` functions to handle base64 encoding and decoding of strings. Updated corresponding provider, handler, and added tests to ensure functionality.
Introduced `ConverterHelper` and `ExpandoObjectConverter` to handle conversions from .NET dynamic objects to JavaScript objects. Updated integration tests to validate the conversion and sorting functionalities.
Fixes#5895
* Add optional refresh parameter
Renamed several `RefreshDescriptors` methods to `RefreshDescriptorsAsync` to reflect their asynchronous nature consistently. Added an optional refresh parameter in the `ListActivityDescriptorsRequest` class and updated related endpoints to handle this parameter, triggering a registry refresh if necessary.
* Update version to 3.2.0-rc5 in GitHub Actions
Modified the `packages.yml` workflow to change the version from `3.2.0-rc4` to `3.2.0-rc5` for non-tagged releases. This ensures version consistency with the new release candidate.
Changed class names, properties, and variables from Model to ServiceProfile for improved semantics and readability. Updated corresponding filenames and configuration settings to maintain consistency.
Included the TenantId property in the workflow definition to support tenant-specific workflows. Skipped a multitenancy test due to the current issue where not all workflows are assigned the Tenant1 tenant.
* Enhance logging and state handling in workflows
Added debug logging in `BookmarkResumer` and `StoreBookmarkQueue` to track workflow resumptions and queue additions. Updated `ICommitStateHandler` to include `WorkflowState` parameter and modified related implementations. Adjusted logging configuration in sample app and removed unused service import.
* Add CustomProperties entry for RootType in AgentActivity
This change ensures that the `RootType` property is set to `AgentActivity` inside the `AgentActivityProvider`. It enhances the descriptor's metadata, enabling clearer classification and potentially improving integration with other components.
* Update RemoveBookmarksAsync to use BookmarkIds instead of Hashes
Modified RemoveBookmarksAsync to filter bookmarks by BookmarkIds rather than Hashes for improved accuracy. Updated filter creation logic to accommodate the new identifier field.
* Fix commit state handler call in WorkflowRunner
Add workflowState as an argument to commitStateHandler.CommitAsync. This ensures that the commitStateHandler has the necessary context to commit properly and maintains consistency in workflow state changes.
Refactored multiple persistence feature classes to implement the self-referencing generic type parameter in the `PersistenceFeatureBase` class. This ensures that each feature correctly references its own type, enhancing type safety and overall code maintainability.