THED2 commited on
Commit
b85e67b
·
verified ·
1 Parent(s): c3685cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -24,6 +24,7 @@ class ChatRequest(BaseModel):
24
 
25
  def execute_in_sandbox(command: str):
26
  try:
 
27
  full_command = f"cd /tmp && {command}"
28
 
29
  result = subprocess.run(
@@ -31,7 +32,7 @@ def execute_in_sandbox(command: str):
31
  shell=True,
32
  capture_output=True,
33
  text=True,
34
- timeout=900
35
  )
36
  return {
37
  "stdout": result.stdout,
@@ -46,13 +47,18 @@ async def agent_chat(request: ChatRequest):
46
  user_prompt = request.message
47
 
48
  system_instruction = (
49
- "You are an AI Agent Builder operating inside a limited Linux sandbox. "
50
- "You CANNOT use 'sudo' or root commands. Always use `/tmp` for your file operations. "
51
- "IMPORTANT SYSTEM INFO: Java JDK, xz-utils, git, curl, and unzip are ALREADY fully installed and available in the system path. "
52
- "Do NOT attempt to download or extract Java manually. You can directly use 'java -version'. "
53
- "To build Flutter apps, you only need to curl the stable Flutter tar.xz into `/tmp`, extract it, set up the android-cmdline-tools/sdkmanager inside `/tmp`, and run the build. "
54
- "Always clean up heavy deployment folders from `/tmp` AFTER successfully uploading the compiled APK to gofile.io to save disk space. "
55
- "If you want to execute any bash setup, return the exact script inside a triple backtick block starting with 'bash'."
 
 
 
 
 
56
  )
57
 
58
  try:
 
24
 
25
  def execute_in_sandbox(command: str):
26
  try:
27
+ # Saari commands hamesha /tmp folder me execute hongi jahan explicit write permissions hain
28
  full_command = f"cd /tmp && {command}"
29
 
30
  result = subprocess.run(
 
32
  shell=True,
33
  capture_output=True,
34
  text=True,
35
+ timeout=600 # 10 minutes max timeout per execution
36
  )
37
  return {
38
  "stdout": result.stdout,
 
47
  user_prompt = request.message
48
 
49
  system_instruction = (
50
+ "You are an expert AI Agent Builder operating inside a fully equipped Linux sandbox.\n\n"
51
+ "YOUR DEVELOPMENT ENVIRONMENT capabilities:\n"
52
+ "- **Python 3** is installed. You can write and execute python scripts (`python3 script.py`).\n"
53
+ "- **Flutter & Dart SDK** are pre-installed globally. You can run `flutter create` and `flutter build apk --release`.\n"
54
+ "- **Android Native Build System** is pre-installed. Full OpenJDK 17, Android SDK (API 34), and Build-Tools (34.0.0) are ready. You can create Native Android apps (using gradle wrappers) and build them directly.\n"
55
+ "- You CANNOT use 'sudo'. Perform all workspace creation inside the `/tmp` directory.\n\n"
56
+ "GOFILE.IO UPLOAD RULES:\n"
57
+ "To upload a compiled file or APK, you MUST follow these exact steps in your bash script:\n"
58
+ "1. Fetch an active server name: SERVER_NAME=$(curl -s https://api.gofile.io/getServer | grep -oP '\"server\":\"\\K[^\"]+')\n"
59
+ "2. Upload using that server: UPLOAD_RESPONSE=$(curl -F \"file=@path_to_your_file\" https://${SERVER_NAME}.gofile.io/uploadFile)\n"
60
+ "3. Extract download link: DOWNLOAD_LINK=$(echo \"${UPLOAD_RESPONSE}\" | grep -oP '\"downloadPage\":\"\\K[^\"]+')\n\n"
61
+ "If you want to create a project, write python scripts, or build an APK, output the exact script inside a triple backtick block starting with 'bash'."
62
  )
63
 
64
  try: