| | | 1 | | namespace Elsa.AI.Abstractions.Models; |
| | | 2 | | |
| | | 3 | | public record AIToolDefinition |
| | | 4 | | { |
| | | 5 | | public string Name { get; init; } = ""; |
| | | 6 | | public string DisplayName { get; init; } = ""; |
| | | 7 | | public string Description { get; init; } = ""; |
| | | 8 | | public JsonObject Schema { get; init; } = []; |
| | | 9 | | public AIToolMutability Mutability { get; init; } = AIToolMutability.ReadOnly; |
| | | 10 | | public AIToolDangerLevel DangerLevel { get; init; } = AIToolDangerLevel.Low; |
| | | 11 | | public ICollection<string> Permissions { get; init; } = []; |
| | | 12 | | public AITenantBehavior TenantBehavior { get; init; } = AITenantBehavior.TenantScoped; |
| | | 13 | | public AIToolAuditBehavior AuditBehavior { get; init; } = AIToolAuditBehavior.RecordInvocation; |
| | | 14 | | public ICollection<string> AgentScopes { get; init; } = []; |
| | | 15 | | public ICollection<string> TenantIds { get; init; } = []; |
| | | 16 | | public ICollection<string> ActorIds { get; init; } = []; |
| | | 17 | | public string? Provider { get; init; } |
| | | 18 | | public bool EnabledByDefault { get; init; } |
| | | 19 | | public bool IsEnabled { get; init; } |
| | | 20 | | } |
| | | 21 | | |
| | | 22 | | public record AIToolInvocation |
| | | 23 | | { |
| | | 24 | | public string Id { get; init; } = default!; |
| | | 25 | | public string ConversationId { get; init; } = default!; |
| | | 26 | | public string ToolName { get; init; } = default!; |
| | | 27 | | public JsonObject Arguments { get; init; } = []; |
| | | 28 | | public AIToolAuthorizationResult AuthorizationResult { get; init; } = AIToolAuthorizationResult.NotEvaluated; |
| | | 29 | | public DateTimeOffset StartedAt { get; init; } |
| | | 30 | | public DateTimeOffset? CompletedAt { get; init; } |
| | | 31 | | public AIToolInvocationStatus Status { get; init; } = AIToolInvocationStatus.Pending; |
| | | 32 | | public string? ResultSummary { get; init; } |
| | | 33 | | public string? Error { get; init; } |
| | | 34 | | public string? TraceId { get; init; } |
| | | 35 | | public string? TenantId { get; init; } |
| | | 36 | | public string ActorId { get; init; } = default!; |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | public record AIToolResult |
| | | 40 | | { |
| | 76 | 41 | | public AIToolInvocationStatus Status { get; init; } = AIToolInvocationStatus.Completed; |
| | 88 | 42 | | public string Summary { get; init; } = ""; |
| | 71 | 43 | | public JsonObject Data { get; init; } = []; |
| | 28 | 44 | | public string? Error { get; init; } |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | public record AIToolExecutionContext |
| | | 48 | | { |
| | | 49 | | public string ConversationId { get; init; } = default!; |
| | | 50 | | public string? TenantId { get; init; } |
| | | 51 | | public string ActorId { get; init; } = default!; |
| | | 52 | | public string? Agent { get; init; } |
| | | 53 | | public JsonObject Arguments { get; init; } = []; |
| | | 54 | | } |
| | | 55 | | |
| | | 56 | | public record AIToolQuery |
| | | 57 | | { |
| | | 58 | | public string? Agent { get; init; } |
| | | 59 | | public AIToolMutability? Mutability { get; init; } |
| | | 60 | | public AIToolDangerLevel? DangerLevel { get; init; } |
| | | 61 | | public string? TenantId { get; init; } |
| | | 62 | | public string? ActorId { get; init; } |
| | | 63 | | public ICollection<string> UserPermissions { get; init; } = []; |
| | | 64 | | } |
| | | 65 | | |
| | | 66 | | public enum AIToolMutability |
| | | 67 | | { |
| | | 68 | | ReadOnly, |
| | | 69 | | Proposal, |
| | | 70 | | Administrative |
| | | 71 | | } |
| | | 72 | | |
| | | 73 | | public enum AIToolDangerLevel |
| | | 74 | | { |
| | | 75 | | Low, |
| | | 76 | | Medium, |
| | | 77 | | High, |
| | | 78 | | Critical |
| | | 79 | | } |
| | | 80 | | |
| | | 81 | | public enum AITenantBehavior |
| | | 82 | | { |
| | | 83 | | TenantScoped, |
| | | 84 | | HostScoped, |
| | | 85 | | CrossTenantDenied |
| | | 86 | | } |
| | | 87 | | |
| | | 88 | | public enum AIToolAuditBehavior |
| | | 89 | | { |
| | | 90 | | None, |
| | | 91 | | RecordInvocation, |
| | | 92 | | RecordInvocationAndResult |
| | | 93 | | } |
| | | 94 | | |
| | | 95 | | public enum AIToolAuthorizationResult |
| | | 96 | | { |
| | | 97 | | NotEvaluated, |
| | | 98 | | Allowed, |
| | | 99 | | Denied |
| | | 100 | | } |
| | | 101 | | |
| | | 102 | | public enum AIToolInvocationStatus |
| | | 103 | | { |
| | | 104 | | Pending, |
| | | 105 | | Running, |
| | | 106 | | Completed, |
| | | 107 | | Failed, |
| | | 108 | | Denied |
| | | 109 | | } |