mirror of
https://github.com/openai/codex.git
synced 2026-11-19 22:30:42 +00:00
feat(tui): preselect suggested permission scope
Thread `suggestedScope` through the app-server permission approval request and use it when constructing TUI approval requests. This keeps the protocol backward compatible by defaulting the field to `turn` when older clients omit it. Add focused app-server and TUI coverage, plus a snapshot for the session-suggested approval overlay so reviewers can see the preselected session row.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use codex_protocol::request_permissions::PermissionGrantScope;
|
||||
use core_test_support::responses;
|
||||
use serde_json::json;
|
||||
use std::path::Path;
|
||||
@@ -84,7 +85,10 @@ pub fn create_request_user_input_sse_response(call_id: &str) -> anyhow::Result<S
|
||||
]))
|
||||
}
|
||||
|
||||
pub fn create_request_permissions_sse_response(call_id: &str) -> anyhow::Result<String> {
|
||||
pub fn create_request_permissions_sse_response(
|
||||
call_id: &str,
|
||||
scope: PermissionGrantScope,
|
||||
) -> anyhow::Result<String> {
|
||||
let tool_call_arguments = serde_json::to_string(&json!({
|
||||
"reason": "Select a workspace root",
|
||||
"permissions": {
|
||||
@@ -94,7 +98,8 @@ pub fn create_request_permissions_sse_response(call_id: &str) -> anyhow::Result<
|
||||
"../shared"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"scope": scope,
|
||||
}))?;
|
||||
|
||||
Ok(responses::sse(vec![
|
||||
|
||||
Reference in New Issue
Block a user