feat: backend servis iskeletini ve yönetim uçlarını ekle

This commit is contained in:
2026-03-21 11:53:04 +03:00
parent df1924b772
commit 62add37d9d
29 changed files with 953 additions and 0 deletions

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,18 @@
from typing import Any
from app.tools.base import Tool
class AppleNotesTool(Tool):
name = "apple_notes"
description = "Create notes in Apple Notes through AppleScript."
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
title = str(payload.get("title", "")).strip()
return {
"tool": self.name,
"status": "stub",
"title": title,
"message": "Apple Notes integration is not wired yet.",
}

12
backend/app/tools/base.py Normal file
View File

@@ -0,0 +1,12 @@
from abc import ABC, abstractmethod
from typing import Any
class Tool(ABC):
name: str
description: str
@abstractmethod
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
raise NotImplementedError

View File

@@ -0,0 +1,18 @@
from typing import Any
from app.tools.base import Tool
class BraveSearchTool(Tool):
name = "brave_search"
description = "Search the web with Brave Search."
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
query = str(payload.get("query", "")).strip()
return {
"tool": self.name,
"status": "stub",
"query": query,
"message": "Brave Search integration is not wired yet.",
}

View File

@@ -0,0 +1,21 @@
from pathlib import Path
from typing import Any
from app.tools.base import Tool
class FilesTool(Tool):
name = "files"
description = "Read and write files within allowed paths."
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
action = str(payload.get("action", "read")).strip()
path = Path(str(payload.get("path", "")).strip()).expanduser()
return {
"tool": self.name,
"status": "stub",
"action": action,
"path": str(path),
"message": "File integration is not wired yet.",
}

View File

@@ -0,0 +1,18 @@
from typing import Any
from app.tools.base import Tool
class SearXNGSearchTool(Tool):
name = "searxng_search"
description = "Search the web through a SearXNG instance."
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
query = str(payload.get("query", "")).strip()
return {
"tool": self.name,
"status": "stub",
"query": query,
"message": "SearXNG integration is not wired yet.",
}

View 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,
}

View File

@@ -0,0 +1,18 @@
from typing import Any
from app.tools.base import Tool
class WebFetchTool(Tool):
name = "web_fetch"
description = "Fetch a webpage and return simplified content."
async def run(self, payload: dict[str, Any]) -> dict[str, Any]:
url = str(payload.get("url", "")).strip()
return {
"tool": self.name,
"status": "stub",
"url": url,
"message": "Web fetch integration is not wired yet.",
}