#[non_exhaustive]pub enum PermissionResult {
Approved,
Denied,
Deferred,
Custom(Value),
UserNotAvailable,
NoResult,
}Expand description
Result of a permission request.
#[non_exhaustive] so future variants can be added without a major
version bump. Match arms must include a _ fallback.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Approved
Permission granted.
Denied
Permission denied.
Deferred
Defer the response. The handler will resolve this request itself
later — typically after a UI prompt — by calling
session.permissions.handlePendingPermissionRequest directly. The
SDK will not send a response for this request.
Notification path only (permission.requested). On the direct
RPC path (permission.request), Deferred falls back to
Approved because that path must return a value
to satisfy the JSON-RPC reply contract.
Custom(Value)
Provide the full response payload. The SDK passes the value as-is
in the result field of handlePendingPermissionRequest
(notification path) or as the JSON-RPC result directly (direct
RPC path).
Use this for response shapes beyond { "kind": "approve-once" }
or { "kind": "reject" } — for example, “approve and remember”
with allowlist data.
UserNotAvailable
No user is available to respond — for example, headless agents
without an interactive session. Sent as
{ "kind": "user-not-available" }.
NoResult
The handler has no result to provide and the CLI should fall back
to its default policy. Sent as { "kind": "no-result" }. Distinct
from Deferred, which suppresses the reply
entirely so the handler can resolve later out-of-band.
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