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
15 changes: 0 additions & 15 deletions src/Orbit.Api/Controllers/GamificationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Orbit.Api.Extensions;
using Orbit.Application.Gamification.Commands;
using Orbit.Application.Gamification.Queries;

namespace Orbit.Api.Controllers;
Expand Down Expand Up @@ -51,18 +50,4 @@ public async Task<IActionResult> GetStreakInfo(CancellationToken cancellationTok
? Ok(result.Value)
: BadRequest(new { error = result.Error });
}

[HttpPost("streak/freeze")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status400BadRequest)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
public async Task<IActionResult> ActivateStreakFreeze(CancellationToken cancellationToken)
{
var command = new ActivateStreakFreezeCommand(HttpContext.GetUserId());
var result = await mediator.Send(command, cancellationToken);

return result.IsSuccess
? Ok(result.Value)
: BadRequest(new { error = result.Error });
}
}
2 changes: 1 addition & 1 deletion src/Orbit.Api/Extensions/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public static WebApplicationBuilder AddOrbitAiServices(this WebApplicationBuilde
builder.Services.AddScoped<IAiTool, GetUserFactsTool>();
builder.Services.AddScoped<IAiTool, DeleteUserFactsTool>();
builder.Services.AddScoped<IAiTool, GetGamificationOverviewTool>();
builder.Services.AddScoped<IAiTool, ActivateStreakFreezeTool>();
builder.Services.AddScoped<IAiTool, GetReferralOverviewTool>();
builder.Services.AddScoped<IAiTool, GetSubscriptionOverviewTool>();
builder.Services.AddScoped<IAiTool, ManageSubscriptionTool>();
Expand Down Expand Up @@ -345,6 +344,7 @@ public static WebApplicationBuilder AddOrbitInfrastructure(this WebApplicationBu
builder.Services.AddHostedService<SlipAlertSchedulerService>();
builder.Services.AddHostedService<AccountDeletionService>();
builder.Services.AddHostedService<HabitDueDateAdvancementService>();
builder.Services.AddHostedService<StreakFreezeAutoActivationService>();
builder.Services.AddHostedService<DataEncryptionMigrationService>();
builder.Services.AddHostedService<SyncCleanupService>();
builder.Services.AddHostedService<CalendarAutoSyncService>();
Expand Down
19 changes: 0 additions & 19 deletions src/Orbit.Api/Mcp/Tools/GamificationTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Security.Claims;
using MediatR;
using ModelContextProtocol.Server;
using Orbit.Application.Gamification.Commands;
using Orbit.Application.Gamification.Queries;

namespace Orbit.Api.Mcp.Tools;
Expand Down Expand Up @@ -91,24 +90,6 @@ public async Task<string> GetStreakInfo(
(s.RecentFreezeDates.Count > 0 ? $"Recent freeze dates: {string.Join(", ", s.RecentFreezeDates)}" : "");
}

[McpServerTool(Name = "activate_streak_freeze"), Description("Activate a streak freeze to protect the current streak. Limited to 2 per month.")]
public async Task<string> ActivateStreakFreeze(
ClaimsPrincipal user,
CancellationToken cancellationToken = default)
{
var userId = GetUserId(user);
var command = new ActivateStreakFreezeCommand(userId);
var result = await mediator.Send(command, cancellationToken);

if (result.IsFailure)
return $"Error: {result.Error}";

var r = result.Value;
return $"Streak freeze activated for {r.FrozenDate}\n" +
$"Current streak preserved: {r.CurrentStreak} days\n" +
$"Freezes remaining this month: {r.FreezesRemainingThisMonth}";
}

private static Guid GetUserId(ClaimsPrincipal user)
{
var claim = user.FindFirst(ClaimTypes.NameIdentifier)?.Value
Expand Down
21 changes: 0 additions & 21 deletions src/Orbit.Application/Chat/Tools/Implementations/PlatformTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using Orbit.Application.ApiKeys.Commands;
using Orbit.Application.ApiKeys.Queries;
using Orbit.Application.Chat.Tools;
using Orbit.Application.Gamification.Commands;
using Orbit.Application.Gamification.Queries;
using Orbit.Application.Referrals.Queries;
using Orbit.Application.Subscriptions.Commands;
Expand Down Expand Up @@ -67,26 +66,6 @@ public async Task<ToolResult> ExecuteAsync(JsonElement args, Guid userId, Cancel
}
}

public class ActivateStreakFreezeTool(IMediator mediator) : IAiTool
{
public string Name => "activate_streak_freeze";
public string Description => "Activate one available streak freeze for the user.";

public object GetParameterSchema() => new
{
type = JsonSchemaTypes.Object,
properties = new { }
};

public async Task<ToolResult> ExecuteAsync(JsonElement args, Guid userId, CancellationToken ct)
{
var result = await mediator.Send(new ActivateStreakFreezeCommand(userId), ct);
return result.IsSuccess
? new ToolResult(true, EntityId: userId.ToString(), EntityName: "Activated streak freeze", Payload: result.Value)
: new ToolResult(false, EntityId: userId.ToString(), Error: result.Error);
}
}

public class GetReferralOverviewTool(IMediator mediator) : IAiTool
{
public string Name => "get_referral_overview";
Expand Down

This file was deleted.

This file was deleted.

22 changes: 22 additions & 0 deletions src/Orbit.Domain/Entities/SentStreakFreezeAlert.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Orbit.Domain.Common;

namespace Orbit.Domain.Entities;

public class SentStreakFreezeAlert : Entity
{
public Guid UserId { get; private set; }
public DateOnly FrozenDate { get; private set; }
public DateTime SentAtUtc { get; private set; }

private SentStreakFreezeAlert() { }

public static SentStreakFreezeAlert Create(Guid userId, DateOnly frozenDate)
{
return new SentStreakFreezeAlert
{
UserId = userId,
FrozenDate = frozenDate,
SentAtUtc = DateTime.UtcNow
};
}
}
3 changes: 0 additions & 3 deletions src/Orbit.Domain/Models/AgentContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ public static class AgentCapabilityIds
public const string CalendarRead = "calendar.read";
public const string CalendarSyncManage = "calendar.sync.manage";
public const string GamificationRead = "gamification.read";
public const string GamificationWrite = "gamification.write";
public const string ChecklistTemplatesRead = "checklist-templates.read";
public const string ChecklistTemplatesWrite = "checklist-templates.write";
public const string UserFactsRead = "user-facts.read";
Expand Down Expand Up @@ -305,7 +304,6 @@ public static class AgentScopes
public const string ReadCalendar = "read_calendar";
public const string ManageCalendarSync = "manage_calendar_sync";
public const string ReadGamification = "read_gamification";
public const string WriteGamification = "write_gamification";
public const string ReadChecklistTemplates = "read_checklist_templates";
public const string WriteChecklistTemplates = "write_checklist_templates";
public const string ReadUserFacts = "read_user_facts";
Expand Down Expand Up @@ -344,7 +342,6 @@ public static class AgentScopes
ReadCalendar,
ManageCalendarSync,
ReadGamification,
WriteGamification,
ReadChecklistTemplates,
WriteChecklistTemplates,
ReadUserFacts,
Expand Down
Loading
Loading