pub enum PermissionResult {
Decision {
decision: PermissionDecision,
context: Option<PermissionDecisionContext>,
},
NoResult,
}Expand description
Decision returned by a PermissionHandler.
Either a concrete wire-level PermissionDecision (approve, reject,
approve-for-session, approve-permanently, user-not-available, …) with
optional telemetry context, or PermissionResult::NoResult, which tells
the SDK to suppress its response so another connected client can answer
instead.
use github_copilot_sdk::handler::PermissionResult;
fn is_decision(result: PermissionResult) -> bool {
match result {
PermissionResult::Decision { .. } => true,
PermissionResult::NoResult => false,
}
}Variants§
Decision
Send a permission decision on the wire.
Fields
decision: PermissionDecisionThe decision to send.
context: Option<PermissionDecisionContext>Optional context describing how and where the decision was reached.
NoResult
Decline to respond to this request, allowing another connected client to answer instead. The SDK suppresses the response.
Implementations§
Source§impl PermissionResult
impl PermissionResult
Sourcepub fn approve_once() -> Self
pub fn approve_once() -> Self
Approve this single request.
Sourcepub fn reject(feedback: impl Into<Option<String>>) -> Self
pub fn reject(feedback: impl Into<Option<String>>) -> Self
Reject the request, optionally forwarding feedback to the LLM.
Sourcepub fn user_not_available() -> Self
pub fn user_not_available() -> Self
Deny because no user is available to confirm.
Sourcepub fn no_result() -> Self
pub fn no_result() -> Self
Decline to respond, allowing another connected client to answer instead.
Sourcepub fn with_context(self, context: PermissionDecisionContext) -> Self
pub fn with_context(self, context: PermissionDecisionContext) -> Self
Attach provenance describing how and where this decision was made, so the runtime can attribute auto-approval telemetry.
It is a no-op on PermissionResult::NoResult.
let result = PermissionResult::approve_once().with_context(PermissionDecisionContext {
outcome: PermissionDecisionOutcome::AutoApproved,
source: PermissionDecisionSource::HostPolicy,
surface: PermissionDecisionSurface::Sdk,
});Trait Implementations§
Source§impl Clone for PermissionResult
impl Clone for PermissionResult
Source§fn clone(&self) -> PermissionResult
fn clone(&self) -> PermissionResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more