/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ using System.Text.Json.Serialization; namespace GitHub.Copilot.Rpc; /// /// SDK-only value indicating the handler /// declines to respond to this permission request. The SDK then suppresses /// the response so another connected client can answer instead. /// public sealed class PermissionDecisionNoResult : PermissionDecision { /// [JsonIgnore] public override string Kind => "no-result"; } /// /// Static factories for the common variants /// returned by OnPermissionRequest handlers. Use these for quick /// discoverability via PermissionDecision.<dot>. For richer /// decisions (per-session, per-location, permanent) that need an /// Approval payload, instantiate the variant class directly. /// [JsonDerivedType(typeof(PermissionDecisionNoResult), "no-result")] public partial class PermissionDecision { /// Approve this single request. public static PermissionDecision ApproveOnce() => new PermissionDecisionApproveOnce(); /// Reject the request, optionally forwarding feedback to the LLM. public static PermissionDecision Reject(string? feedback = null) => new PermissionDecisionReject { Feedback = feedback }; /// Deny the request because no user is available to confirm it. public static PermissionDecision UserNotAvailable() => new PermissionDecisionUserNotAvailable(); /// /// Decline to respond to this permission request, allowing another /// connected client to answer instead. /// public static PermissionDecision NoResult() => new PermissionDecisionNoResult(); /// /// Optional provenance describing how and where this decision was made. /// This is never serialized as part of the decision itself: the SDK forwards /// it to the runtime as a sibling of result so that auto-approval /// telemetry can be attributed correctly. /// [JsonIgnore] public PermissionDecisionContext? DecisionContext { get; set; } }