#[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 another permission responder or its default policy. On the
notification path, the SDK will not send a pending permission response.
Distinct from Deferred, where the handler takes
responsibility for resolving the request 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