Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,22 @@ import time
|
|
| 9 |
import zipfile
|
| 10 |
import shutil
|
| 11 |
import traceback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
"""
|
| 14 |
Clawdbot Unified Command Center
|
|
@@ -179,11 +195,13 @@ def execute_tool(tool_name: str, args: dict) -> dict:
|
|
| 179 |
# BYPASS GATE: Execute immediately
|
| 180 |
result = ctx.write_file(args.get('path', ''), args.get('content', ''))
|
| 181 |
return {"status": "executed", "tool": tool_name, "result": result}
|
|
|
|
|
|
|
|
|
|
| 182 |
elif tool_name == 'shell_execute':
|
| 183 |
# BYPASS GATE: Execute immediately
|
| 184 |
result = ctx.shell_execute(args.get('command', ''))
|
| 185 |
return {"status": "executed", "tool": tool_name, "result": result}
|
| 186 |
-
|
| 187 |
elif tool_name == 'create_shadow_branch':
|
| 188 |
return {"status": "staged", "tool": tool_name, "args": args, "description": "🛡️ Create shadow branch"}
|
| 189 |
return {"status": "error", "result": f"Unknown tool: {tool_name}"}
|
|
|
|
| 9 |
import zipfile
|
| 10 |
import shutil
|
| 11 |
import traceback
|
| 12 |
+
import logging
|
| 13 |
+
|
| 14 |
+
# Configure Logging to file AND console
|
| 15 |
+
logging.basicConfig(
|
| 16 |
+
level=logging.INFO,
|
| 17 |
+
format='%(asctime)s - %(levelname)s - %(message)s',
|
| 18 |
+
handlers=[
|
| 19 |
+
logging.FileHandler("clawdbot_system.log"),
|
| 20 |
+
logging.StreamHandler()
|
| 21 |
+
]
|
| 22 |
+
)
|
| 23 |
+
logger = logging.getLogger("Clawdbot")
|
| 24 |
+
|
| 25 |
+
def log_action(action: str, details: str):
|
| 26 |
+
"""Records critical system events."""
|
| 27 |
+
logger.info(f"ACTION: {action} | DETAILS: {details}")
|
| 28 |
|
| 29 |
"""
|
| 30 |
Clawdbot Unified Command Center
|
|
|
|
| 195 |
# BYPASS GATE: Execute immediately
|
| 196 |
result = ctx.write_file(args.get('path', ''), args.get('content', ''))
|
| 197 |
return {"status": "executed", "tool": tool_name, "result": result}
|
| 198 |
+
elif tool_name == 'write_file':
|
| 199 |
+
log_action("WRITE_ATTEMPT", f"Writing to {args.get('path')}")
|
| 200 |
+
# ... existing write logic ...
|
| 201 |
elif tool_name == 'shell_execute':
|
| 202 |
# BYPASS GATE: Execute immediately
|
| 203 |
result = ctx.shell_execute(args.get('command', ''))
|
| 204 |
return {"status": "executed", "tool": tool_name, "result": result}
|
|
|
|
| 205 |
elif tool_name == 'create_shadow_branch':
|
| 206 |
return {"status": "staged", "tool": tool_name, "args": args, "description": "🛡️ Create shadow branch"}
|
| 207 |
return {"status": "error", "result": f"Unknown tool: {tool_name}"}
|