namespace ClaudeDo.Worker.Runner;

public interface IInteractiveLaunchSpecService
{
    /// <summary>Builds a LaunchSpec for opening an interactive session in a task's worktree.
    /// Throws KeyNotFoundException if the task doesn't exist, InvalidOperationException
    /// if it's Running/Queued. If the task has no usable worktree yet, one is created on
    /// demand (same mechanism as an autonomous run) provided the task's list has a working
    /// directory pointing at a git repo -- otherwise throws InvalidOperationException. A task
    /// that has never run, or whose worktree was just created fresh, gets a fresh-start spec
    /// (no --resume); an existing worktree with a persisted SessionId gets --resume.</summary>
    Task<LaunchSpec> BuildForTaskAsync(string taskId, CancellationToken ct);

    /// <summary>Builds a LaunchSpec for an ad-hoc interactive session in an arbitrary directory --
    /// no task, no worktree, no session-skills seeding. Throws InvalidOperationException if the
    /// directory doesn't exist.</summary>
    Task<LaunchSpec> BuildForDirectoryAsync(string directory, CancellationToken ct);
}
