Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Cellm/AddIn/CellmAddIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
using Cellm.Models.Providers.OpenAi;
using Cellm.Models.Providers.OpenAiCompatible;
using Cellm.Models.Resilience;
using Cellm.Models.Tools;
using Cellm.Tools;
using Cellm.Tools.FileReader;
using Cellm.Tools.ModelContextProtocol;
using Cellm.User;
using Cellm.Users;
using ExcelDna.Integration;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Configuration;
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/AddIn/Ribbon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Cellm.Models.Providers.Ollama;
using Cellm.Models.Providers.OpenAi;
using Cellm.Models.Providers.OpenAiCompatible;
using Cellm.User;
using Cellm.Users;
using ExcelDna.Integration.CustomUI;
using Microsoft.Extensions.Caching.Hybrid;
using Microsoft.Extensions.DependencyInjection;
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/Behaviors/SentryBehavior.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cellm.AddIn;
using Cellm.Models.Prompts;
using Cellm.Models.Providers;
using Cellm.User;
using Cellm.Users;
using MediatR;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Logging;
Expand Down
8 changes: 6 additions & 2 deletions src/Cellm/Models/Behaviors/ToolBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
using Cellm.Models.Prompts;
using Cellm.Models.Providers;
using Cellm.Tools.ModelContextProtocol;
using Cellm.Users;
using MediatR;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using ModelContextProtocol.Client;

namespace Cellm.Models.Tools;
namespace Cellm.Models.Behaviors;

internal class ToolBehavior<TRequest, TResponse>(
Account account,
IOptionsMonitor<ProviderConfiguration> providerConfiguration,
IOptionsMonitor<ModelContextProtocolConfiguration> modelContextProtocolConfiguration,
IEnumerable<AIFunction> functions,
Expand All @@ -35,7 +37,9 @@ public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TRe
logger.LogDebug("Native tools disabled");
}

if (providerConfiguration.CurrentValue.EnableModelContextProtocolServers.Any(t => t.Value))
var enableModelContextProtocol = await account.HasEntitlementAsync(Entitlement.EnableModelContextProtocol);

if (providerConfiguration.CurrentValue.EnableModelContextProtocolServers.Any(t => t.Value) && enableModelContextProtocol)
{
logger.LogDebug("MCP tools enabled");

Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Models/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
using Cellm.Models.Providers.OpenAi;
using Cellm.Models.Providers.OpenAiCompatible;
using Cellm.Models.Resilience;
using Cellm.User;
using Cellm.Users;
using Microsoft.Extensions.AI;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
Expand Down
6 changes: 3 additions & 3 deletions src/Cellm/Users/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@

using System.Text;
using System.Text.Json;
using Cellm.User.Exceptions;
using Cellm.User.Models;
using Cellm.Users.Exceptions;
using Cellm.Users.Models;
using Microsoft.Extensions.Caching.Hybrid;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace Cellm.User;
namespace Cellm.Users;

internal class Account(
IOptionsMonitor<AccountConfiguration> accountConfiguration,
Expand Down
2 changes: 1 addition & 1 deletion src/Cellm/Users/AccountConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cellm.User;
namespace Cellm.Users;

internal class AccountConfiguration
{
Expand Down
3 changes: 2 additions & 1 deletion src/Cellm/Users/Entitlement.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cellm.User;
namespace Cellm.Users;

public enum Entitlement
{
Expand All @@ -9,6 +9,7 @@ public enum Entitlement
EnableOllamaProvider,
EnableOpenAiProvider,
EnableOpenAiCompatibleProvider,
EnableModelContextProtocol,
DisableTelemetry
}

2 changes: 1 addition & 1 deletion src/Cellm/Users/Exceptions/PermissionDeniedException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Cellm.AddIn.Exceptions;

namespace Cellm.User.Exceptions;
namespace Cellm.Users.Exceptions;

internal class PermissionDeniedException : CellmException
{
Expand Down
3 changes: 2 additions & 1 deletion src/Cellm/Users/Models/ActiveEntitlements.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Text.Json.Serialization;

namespace Cellm.User.Models;
namespace Cellm.Users.Models;

internal class ActiveEntitlements()
{
Expand All @@ -16,6 +16,7 @@ internal class ActiveEntitlements()
[JsonIgnore]
private readonly List<Entitlement> AnonymousEntitlements = [
Entitlement.EnableAnthropicProvider,
Entitlement.EnableModelContextProtocol,
Entitlement.EnableOllamaProvider,
Entitlement.EnableOpenAiProvider
];
Expand Down