Skip to content

Agent Zero AI framework

Open agent permissions from slash commands

Alessandroa4f7a1352a5e
diff --git a/plugins/_commands/AGENTS.md b/plugins/_commands/AGENTS.md
index 3c5c051fa..258633425 100644
--- a/plugins/_commands/AGENTS.md
+++ b/plugins/_commands/AGENTS.md
@@ -35,6 +35,8 @@
- `/stop` uses the same shared cancellation operation as the composer Stop button, including progress cleanup and terminal logging.
- `/profile` opens Manage agents without arguments, keeps existing profile
selection, and creates through Agent Editor when given a name and instructions.
+- `/permissions` opens Edit agent for the current WebUI profile; the A0 Connector
+ owns its separate Textual permissions screen for the same command name.
- Built-in `/computer-use on|off` emits a bounded `computer_use` effect. WebUI
only directs the user to Host access in A0 Launcher or the same command in A0
CLI; it never changes a Launcher gateway lease from Agent Zero page content.
diff --git a/plugins/_commands/commands/connector_commands.py b/plugins/_commands/commands/connector_commands.py
index d72708a40..876eda2f1 100644
--- a/plugins/_commands/commands/connector_commands.py
+++ b/plugins/_commands/commands/connector_commands.py
@@ -35,6 +35,8 @@ def run(payload: dict[str, Any]) -> dict[str, Any]:
return _handle_project(context, raw_args)
if command == "profile":
return _handle_profile(context, raw_args, arguments)
+ if command == "permissions":
+ return _handle_permissions(context)
if command == "plugins":
return _effects({"type": "open_modal", "path": "/components/plugins/list/plugin-list.html"})
if command == "compact":
@@ -152,6 +154,29 @@ def _handle_profile(
)
+def _handle_permissions(context: AgentContext | None) -> dict[str, Any]:
+ error = _require_context(context)
+ if error:
+ return _effects(_toast(error, level="error"))
+ profile_id = str(getattr(context.config, "profile", "") or "").strip()
+ if not profile_id:
+ return _effects(_toast("The current agent profile is unavailable.", level="error"))
+ if profile_id == "default":
+ return _effects(
+ _toast(
+ "The Default utility profile has no editable permissions.",
+ level="error",
+ )
+ )
+ return _effects(
+ {
+ "type": "open_agent_editor",
+ "view": "edit",
+ "profile_id": profile_id,
+ }
+ )
+
+
def _handle_models(context: AgentContext | None, raw_args: str) -> dict[str, Any]:
return _effects({"type": "open_plugin_config", "plugin": "_model_config"})
diff --git a/plugins/_commands/commands/permissions.command.yaml b/plugins/_commands/commands/permissions.command.yaml
new file mode 100644
index 000000000..0a6d54aee
--- /dev/null
+++ b/plugins/_commands/commands/permissions.command.yaml
@@ -0,0 +1,4 @@
+name: permissions
+description: Edit permissions for the current agent profile.
+type: script
+script_path: connector_commands.py
diff --git a/plugins/_commands/tests/test_commands_plugin.py b/plugins/_commands/tests/test_commands_plugin.py
index cc7c47d05..b155b7d84 100644
--- a/plugins/_commands/tests/test_commands_plugin.py
+++ b/plugins/_commands/tests/test_commands_plugin.py
@@ -310,6 +310,52 @@ def test_profile_command_opens_agent_manager() -> None:
}
+def test_permissions_command_edits_the_current_agent(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ context = SimpleNamespace(config=SimpleNamespace(profile="developer"))
+ monkeypatch.setattr(connector_commands, "_context", lambda _context_id: context)
+ result = connector_commands.run(
+ {
+ "invocation": {"command_name": "permissions", "raw_arguments": ""},
+ "context": {"context_id": "ctx-1"},
+ }
+ )
+
+ assert result == {
+ "text": "",
+ "effects": [
+ {
+ "type": "open_agent_editor",
+ "view": "edit",
+ "profile_id": "developer",
+ }
+ ],
+ }
+
+
+def test_permissions_command_refuses_the_internal_default(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ context = SimpleNamespace(config=SimpleNamespace(profile="default"))
+ monkeypatch.setattr(connector_commands, "_context", lambda _context_id: context)
+
+ result = connector_commands.run(
+ {
+ "invocation": {"command_name": "permissions", "raw_arguments": ""},
+ "context": {"context_id": "ctx-1"},
+ }
+ )
+
+ assert result["effects"] == [
+ {
+ "type": "toast",
+ "message": "The Default utility profile has no editable permissions.",
+ "level": "error",
+ }
+ ]
+
+
def test_profile_command_quick_creates_with_the_agent_editor(
monkeypatch: pytest.MonkeyPatch,
) -> None:
diff --git a/plugins/_commands/tests/test_plugin_command_discovery.py b/plugins/_commands/tests/test_plugin_command_discovery.py
index 2ee1386cd..0f09bacd9 100644
--- a/plugins/_commands/tests/test_plugin_command_discovery.py
+++ b/plugins/_commands/tests/test_plugin_command_discovery.py
@@ -155,7 +155,15 @@ def test_builtin_commands_use_canonical_names_only():
discovered = commands_helper._discover_builtin_commands()
names = {command["name"] for command in discovered}
- assert {"attach", "computer-use", "models", "plugins", "project", "stop"} <= names
+ assert {
+ "attach",
+ "computer-use",
+ "models",
+ "permissions",
+ "plugins",
+ "project",
+ "stop",
+ } <= names
assert {
"computer",
"cu",