// Copyright (c) Microsoft. All rights reserved. using Microsoft.Extensions.AI; namespace Harness.Shared.Console; /// /// Represents an action returned by an observer at the end of an agent turn. /// Subtypes describe either a question to ask the user () /// or a message to add directly to the next agent input (). /// public abstract record FollowUpAction; /// /// Represents a question that should be presented to the user. The /// delegate is invoked with the user's answer and the /// UX state driver, and returns an optional to add to the /// next agent invocation. /// /// The question text shown to the user. /// /// Invoked with the user's answer and the UX state driver. The driver lets the /// continuation write output (e.g., an action label like "Approved") in addition /// to producing an optional for the next agent invocation. /// public abstract record FollowUpQuestion( string Prompt, Func> Continuation) : FollowUpAction; /// /// A free-form text question. The user may type any response. /// /// The question text shown to the user. /// Continuation that builds the response message. public sealed record TextFollowUpQuestion( string Prompt, Func> Continuation) : FollowUpQuestion(Prompt, Continuation); /// /// A choice question. The user picks from , optionally with /// the ability to enter custom text when is true. /// /// The question text shown to the user. /// The list of pre-defined choices. /// If true, the user may type a custom response in addition to the listed choices. /// Continuation that builds the response message. public sealed record ChoiceFollowUpQuestion( string Prompt, IReadOnlyList Choices, bool AllowCustomText, Func> Continuation) : FollowUpQuestion(Prompt, Continuation); /// /// A message to add directly to the next agent invocation without prompting the user. /// /// The chat message to add. public sealed record FollowUpMessage(ChatMessage Message) : FollowUpAction;