← All source files

V16 / 6df58cd3ed86

ProviderClient.Projects.cs

Lilith/Core/Projects/ProviderClient.Projects.cs

Unchanged from the preceding version
CS
namespace Lilith.Core.Providers;

public abstract partial class ProviderClient
{
    internal bool HasProjectFrameCapture => ResearchBrowserFrameCaptured is not null;
    internal void CaptureProjectFrame(Lilith.Core.WebResearch.ResearchBrowserFrame frame)
    {
        if (ResearchBrowserFrameCaptured is not { } handlers) return;
        foreach (var observer in handlers.GetInvocationList().Cast<Action<Lilith.Core.WebResearch.ResearchBrowserFrame>>())
            try { observer(frame); } catch (Exception ex) { Logger.WriteWarning("Project", "Browser capture observer failed: " + ex.Message); }
    }
    internal string? ProjectExecutionId { get; private set; }
    public async Task<string> ApproveProjectTestingAsync(string id, CancellationToken ct = default)
    {
        using var operation = EnterOperation();
        var store = new Lilith.Core.Projects.ProjectDraftStore(Workspace ?? throw new InvalidOperationException("Workspace unavailable."));
        _ = store.Load(id);
        ProjectExecutionId = id;
        try { return await RunScenarioCoreAsync("project_test", new Dictionary<string, string> { ["id"] = id }, ct); }
        finally { ProjectExecutionId = null; }
    }
    public async Task<string> PrepareProjectPublicationAsync(string id, CancellationToken ct = default)
    {
        using var operation = EnterOperation();
        var store = new Lilith.Core.Projects.ProjectDraftStore(Workspace ?? throw new InvalidOperationException("Workspace unavailable."));
        return (await Lilith.Core.Projects.ProjectQualification.PublishAsync(store, id, ct)).ToReply();
    }
}