Agent panel: ask before plugins, libraries and the share server; fmt

- The Ask gate missed `plugins.*` (runLast runs a plugin) and `libraries.*`
  (only `plugin.`/`library.` were matched), and `pref.publishServer`, which
  changes where shared files are sent.
- The Auto mode's doc said the automation roots confine file access; a
  window opened normally has none, so say when they apply.
- rustfmt the same-layer exceptions in xtask/src/layers.rs.
This commit is contained in:
bflatastic
2026-12-01 20:55:56 +07:00
parent 51124d3bd5
commit 428ebb70a5
4 changed files with 19 additions and 5 deletions
+2 -1
View File
@@ -91,7 +91,8 @@ pub enum Permission {
/// waits for the person's Allow.
#[default]
AskFiles,
/// Everything runs at once. The automation roots still confine file access.
/// Everything runs at once. File access is confined only when the app was started with
/// automation roots; a window opened normally has none.
Auto,
}
+8 -2
View File
@@ -702,8 +702,11 @@ fn command_reason(cmd: &str) -> Option<String> {
if cmd.starts_with("collab.") {
return Some("reaches a collaboration server".into());
}
if cmd.starts_with("plugin.") || cmd.starts_with("library.") {
return Some("installs or reaches a plugin or library server".into());
if ["plugin.", "plugins.", "library.", "libraries."].iter().any(|p| cmd.starts_with(p)) {
return Some("installs or runs a plugin, or reaches a library server".into());
}
if cmd == "pref.publishServer" {
return Some("changes where shared files are sent".into());
}
if cmd.starts_with("font.download") {
return Some("downloads a font".into());
@@ -770,6 +773,9 @@ mod tests {
assert!(approval("run_command", &json!({"command": "file.save"})).is_some());
assert!(approval("run_command", &json!({"command": "collab.host"})).is_some());
assert!(approval("save_file", &json!({})).is_some());
for cmd in ["plugins.runLast", "libraries.publish", "pref.publishServer"] {
assert!(approval("run_command", &json!({"command": cmd})).is_some(), "{cmd}");
}
assert!(approval("screenshot", &json!({})).is_none());
// Pages and the canvas are the agent's to read and change.
for cmd in
+1 -1
View File
@@ -205,7 +205,7 @@ images; Anthropic: `tool_result` blocks, images inside them).
Two permission modes, toggled in the composer:
| Mode | Canvas edits | Files, network, plugins, fonts |
| Mode | Canvas edits | Files, network, plugins, fonts, the share server |
|---|---|---|
| **Ask** (default) | run at once | ask: a card names the tool and why |
| **Auto** | run at once | run at once |
+8 -1
View File
@@ -74,5 +74,12 @@ pub fn check(root: &std::path::Path) -> bool {
fn same_layer_ok(from: &str, to: &str) -> bool {
// Within L0: color uses geom types; within L2: text/layout/pathops/collab are independent;
// within L6 the MCP server joins live sessions through collab-net.
matches!((from, to), ("figcraft-color", "figcraft-geom") | ("figcraft-render", "figcraft-format") | ("figcraft-mcp", "figcraft-collab-net") | ("figcraft-agent", "figcraft-mcp") | ("figcraft-ui-egui", "figcraft-agent"))
matches!(
(from, to),
("figcraft-color", "figcraft-geom")
| ("figcraft-render", "figcraft-format")
| ("figcraft-mcp", "figcraft-collab-net")
| ("figcraft-agent", "figcraft-mcp")
| ("figcraft-ui-egui", "figcraft-agent")
)
}