Permission request
Default behavior (deny-all)
If permission_approve is set to "deny-all" (default) in config/copilot.php, all permission requests are automatically denied when you use Copilot::run() or Copilot::start().
This is a safe default when your main use case is text generation, where permissions are usually unnecessary.
Configurable values
PermissionHandler::approveAll()
UsePermissionHandler::approveAll() to auto-approve all requests.
PermissionHandler::approveSafety()
UsePermissionHandler::approveSafety() to deny only high-risk permissions (shell, write) and auto-approve others.
$request['kind'].
PermissionHandler::denyAll()
UsePermissionHandler::denyAll() to deny everything.
Direct client usage
When you useCopilotClient directly, specifying onPermissionRequest is required, just like the official SDK.
Custom handler
To control approval or rejection per request type, pass a closure.$request and $invocation are arrays like the examples below.
$request
Other than kind and toolCallId, fields vary by kind.
$invocation
Response
Return an array for the permission decision. Using thePermissionRequestResultKind class is convenient.
Protocol details
In Protocol v3 (current default), permission requests are broadcast as session events (permission.requested) instead of JSON-RPC requests.
The SDK handles this internally and responds through the session.permissions.handlePendingPermissionRequest RPC.
How you use SessionConfig does not change.
You only need to pass a handler to onPermissionRequest, and the SDK absorbs protocol differences.
PermissionRequestResultKind
You can return the['kind' => 'approve-once'] format directly, but it is easier to read with PermissionRequestResultKind.
Available methods
If you prefer
Laravel\Prompts\select over Laravel\Prompts\confirm, use PermissionRequestResultKind::select() for options.
no-result
If a handler cannot return a result (for example, in a non-interactive environment), you can returnno-result.
When no-result is returned, the RPC call is skipped and Copilot CLI applies its default deny behavior.
For the latest updates, see the GitHub repository.