Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 84 additions & 2 deletions src/fast_agent/acp/slash_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __init__(
"status": AvailableCommand(
name="status",
description="Show fast-agent diagnostics",
input=AvailableCommandInput(root=CommandInputHint(hint="[system]")),
input=AvailableCommandInput(root=CommandInputHint(hint="[system|auth|authreset]")),
),
"tools": AvailableCommand(
name="tools",
Expand Down Expand Up @@ -173,10 +173,14 @@ async def execute_command(self, command_name: str, arguments: str) -> str:

async def _handle_status(self, arguments: str | None = None) -> str:
"""Handle the /status command."""
# Check if the user wants to see the system prompt
# Check for subcommands
normalized = (arguments or "").strip().lower()
if normalized == "system":
return self._handle_status_system()
if normalized == "auth":
return self._handle_status_auth()
if normalized == "authreset":
return self._handle_status_authreset()

# Get fast-agent version
try:
Expand Down Expand Up @@ -410,6 +414,84 @@ def _handle_status_system(self) -> str:

return "\n".join(lines)

def _handle_status_auth(self) -> str:
"""Handle the /status auth command to show permissions from auths.md."""
heading = "# permissions"
auths_path = Path("./.fast-agent/auths.md")
resolved_path = auths_path.resolve()

if not auths_path.exists():
return "\n".join(
[
heading,
"",
"No permissions set",
"",
f"Path: `{resolved_path}`",
]
)

try:
content = auths_path.read_text(encoding="utf-8")
return "\n".join(
[
heading,
"",
content.strip() if content.strip() else "No permissions set",
"",
f"Path: `{resolved_path}`",
]
)
except Exception as exc:
return "\n".join(
[
heading,
"",
f"Failed to read permissions file: {exc}",
"",
f"Path: `{resolved_path}`",
]
)

def _handle_status_authreset(self) -> str:
"""Handle the /status authreset command to remove the auths.md file."""
heading = "# reset permissions"
auths_path = Path("./.fast-agent/auths.md")
resolved_path = auths_path.resolve()

if not auths_path.exists():
return "\n".join(
[
heading,
"",
"No permissions file exists.",
"",
f"Path: `{resolved_path}`",
]
)

try:
auths_path.unlink()
return "\n".join(
[
heading,
"",
"Permissions file removed successfully.",
"",
f"Path: `{resolved_path}`",
]
)
except Exception as exc:
return "\n".join(
[
heading,
"",
f"Failed to remove permissions file: {exc}",
"",
f"Path: `{resolved_path}`",
]
)

async def _handle_tools(self) -> str:
"""List available MCP tools for the current agent."""
heading = "# tools"
Expand Down
Loading