feat: backend servis iskeletini ve yönetim uçlarını ekle
This commit is contained in:
24
backend/app/tools/terminal.py
Normal file
24
backend/app/tools/terminal.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user