feat(tui): open permission picker for conversational requests

Add a `request_permission_preset` tool that lets the model route user
requests for sandbox or approval mode changes into the existing picker.
The picker opens with the requested preset selected and reports the final
user choice back to the active turn.

Wire the request through protocol, app-server, core, tools, and TUI
handling so accepted picker choices update the effective permissions while
Full Access still uses the existing confirmation flow.
This commit is contained in:
Felipe Coury
2026-04-12 14:20:25 -03:00
parent 46ab9974dc
commit 13bdd524f2
58 changed files with 2416 additions and 26 deletions

View File

@@ -3260,6 +3260,90 @@
],
"type": "string"
},
"PermissionPresetApprovalDecision": {
"enum": [
"accepted",
"declined"
],
"type": "string"
},
"PermissionPresetId": {
"enum": [
"auto",
"full-access",
"read-only",
"guardian-approvals"
],
"type": "string"
},
"PermissionPresetRequestApprovalParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"approvalPolicy": {
"$ref": "#/definitions/v2/AskForApproval"
},
"approvalsReviewer": {
"$ref": "#/definitions/v2/ApprovalsReviewer"
},
"description": {
"type": "string"
},
"itemId": {
"type": "string"
},
"label": {
"type": "string"
},
"preset": {
"$ref": "#/definitions/PermissionPresetId"
},
"reason": {
"type": [
"string",
"null"
]
},
"sandboxPolicy": {
"$ref": "#/definitions/v2/SandboxPolicy"
},
"threadId": {
"type": "string"
},
"turnId": {
"type": "string"
}
},
"required": [
"approvalPolicy",
"approvalsReviewer",
"description",
"itemId",
"label",
"preset",
"sandboxPolicy",
"threadId",
"turnId"
],
"title": "PermissionPresetRequestApprovalParams",
"type": "object"
},
"PermissionPresetRequestApprovalResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"decision": {
"$ref": "#/definitions/PermissionPresetApprovalDecision"
},
"preset": {
"$ref": "#/definitions/PermissionPresetId"
}
},
"required": [
"decision",
"preset"
],
"title": "PermissionPresetRequestApprovalResponse",
"type": "object"
},
"PermissionsRequestApprovalParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
@@ -4619,6 +4703,31 @@
"title": "Item/permissions/requestApprovalRequest",
"type": "object"
},
{
"description": "Request the client to open its permission preset picker.",
"properties": {
"id": {
"$ref": "#/definitions/v2/RequestId"
},
"method": {
"enum": [
"item/permissionPreset/requestApproval"
],
"title": "Item/permissionPreset/requestApprovalRequestMethod",
"type": "string"
},
"params": {
"$ref": "#/definitions/PermissionPresetRequestApprovalParams"
}
},
"required": [
"id",
"method",
"params"
],
"title": "Item/permissionPreset/requestApprovalRequest",
"type": "object"
},
{
"description": "Execute a dynamic tool call on the client.",
"properties": {