Files
wiseclaw/backend/app/tools/terminal.py

25 lines
722 B
Python

from typing import Any
from app.security import evaluate_terminal_command
from app.tools.base import Tool
class TerminalTool(Tool):
name = "terminal"
description = "Run terminal commands under WiseClaw policy."
def __init__(self, terminal_mode: int) -> None:
self.terminal_mode = terminal_mode
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
command = str(payload.get("command", "")).strip()
decision = evaluate_terminal_command(command, self.terminal_mode)
return {
"tool": self.name,
"status": "stub",
"command": command,
"decision": decision.decision,
"reason": decision.reason,
}