1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/// Canonical tool permission that can be mapped between agent schemas.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Permission {
/// Read files (Claude Code: `Read`, Copilot: `read`)
Read,
/// Write/create files (Claude Code: `Write`, Copilot: `write`)
Write,
/// Edit existing files (Claude Code: `Edit`, Copilot: `edit`)
Edit,
/// Execute shell commands with optional scope pattern
/// (Claude Code: `Bash(pattern)`, Copilot: `shell`)
Shell(Option<String>),
/// Search file contents (Claude Code: `Grep`, Copilot: `grep`)
Grep,
/// Find files by pattern (Claude Code: `Glob`, Copilot: `glob`)
Glob,
/// Fetch web content (Claude Code: `WebFetch`, Copilot: `web_fetch`)
WebFetch,
/// Search the web (Claude Code: `WebSearch`, Copilot: `web_search`)
WebSearch,
/// Read notebooks (Claude Code only)
NotebookRead,
/// Edit notebooks (Claude Code only)
NotebookEdit,
/// Read todos (Claude Code only)
TodoRead,
/// Write todos (Claude Code only)
TodoWrite,
/// List directory contents (Claude Code: `LS`)
ListDir,
/// Tool that doesn't map to a known canonical permission
Other(String),
}
impl std::fmt::Display for Permission {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Read => write!(f, "Read"),
Self::Write => write!(f, "Write"),
Self::Edit => write!(f, "Edit"),
Self::Shell(None) => write!(f, "Shell"),
Self::Shell(Some(p)) => write!(f, "Shell({p})"),
Self::Grep => write!(f, "Grep"),
Self::Glob => write!(f, "Glob"),
Self::WebFetch => write!(f, "WebFetch"),
Self::WebSearch => write!(f, "WebSearch"),
Self::NotebookRead => write!(f, "NotebookRead"),
Self::NotebookEdit => write!(f, "NotebookEdit"),
Self::TodoRead => write!(f, "TodoRead"),
Self::TodoWrite => write!(f, "TodoWrite"),
Self::ListDir => write!(f, "ListDir"),
Self::Other(s) => write!(f, "{s}"),
}
}
}