V18 / PROJECTS

project_preview_start_operation

Application-bound scenario operation. Named XML inputs control execution; this is not a main-agent tool.

See source registrationIntroduced in V16V18

What it does

Read the exact source snapshot below for its parameters, behavior, and registration.

Read the implementation

This page describes the selected release. The source link points to the same exact commit; it cannot silently open a newer implementation.

Lilith/Core/Projects/WebsitePreviewOperations.cs ↗

Implementation code

Read the implementation from this version's exact source snapshot. Helper links below stay on the same release.

Lilith/Core/Projects/WebsitePreviewOperations.cs

C#
using Lilith.Core.Commands;

namespace Lilith.Core.Projects;

internal static class WebsitePreviewOperations
{
    internal static readonly string[] Names = ["project_preview_start_operation","project_preview_capture_operation"];
    internal static Task<string> ExecuteAsync(ProviderClient provider,string name,IReadOnlyDictionary<string,string> inputs,CancellationToken ct)
    {
        ct.ThrowIfCancellationRequested();
        return name switch
        {
            "project_preview_start_operation" => Task.FromResult(provider.StartWebsitePreview(inputs.GetValueOrDefault("name", ""),inputs.GetValueOrDefault("draft_id", ""))),
            "project_preview_capture_operation" => provider.CaptureStartedWebsiteAsync(ct),
            _ => throw new ArgumentException("Unknown preview operation.")
        };
    }
}
public static class WebsitePreviewCommands
{
    public static void Register(ChatCommandRegistry commands,Func<ProviderClient> provider) =>
        commands.RegisterAsync("project-screenshots","Explicitly approve running one managed website to capture Desktop/Tablet/Mobile images: NAME [DRAFT_ID].",async c =>
        {
            var args = c.Arguments.Split(' ',StringSplitOptions.RemoveEmptyEntries);
            if (args.Length is < 1 or > 2) throw new ArgumentException("Use /project-screenshots NAME [DRAFT_ID]. This executes that website's JavaScript.");
            return new(true,await provider().CaptureWebsiteScreenshotsAsync(args[0],args.Length == 2 ? args[1] : "",c.CancellationToken));
        });
}

Scenarios using this tool