Initial commit

This commit is contained in:
AuroraCrimsonRose
2026-05-27 15:07:22 -05:00
commit cc64e8d41e
31 changed files with 2354 additions and 0 deletions

66
tools/subprocess.py Normal file
View File

@@ -0,0 +1,66 @@
from __future__ import annotations
from typing import Any
from core.subprocess import run_command
from core.tools.base import BaseTool, ToolContext
from core.tools.registry import registry
class SubprocessTool(BaseTool):
name = "subprocess"
description = "Run a subprocess command safely"
# =========================
# EXECUTE
# =========================
def execute(
self,
payload: dict[str, Any],
ctx: ToolContext
):
cmd = payload.get("cmd")
if not isinstance(cmd, list):
raise ValueError(
"cmd must be list[str]"
)
cwd = payload.get("cwd")
if cwd is not None and not isinstance(
cwd,
str
):
raise ValueError(
"cwd must be string"
)
timeout = payload.get(
"timeout",
60
)
if not isinstance(
timeout,
int
):
raise ValueError(
"timeout must be int"
)
return run_command(
cmd=cmd,
cwd=cwd,
timeout=timeout
)
# =========================
# SELF REGISTER
# =========================
registry.register(
SubprocessTool()
)