Skip to content

Agent Zero AI framework

removed bundles, tests

frdel040de30ef286
diff --git a/bundle/bundle.py b/bundle/bundle.py
deleted file mode 100644
index f83866d6a..000000000
--- a/bundle/bundle.py
+++ /dev/null
@@ -1,226 +0,0 @@
-import os
-import subprocess
-import sys
-import site
-import shutil
-from pathlib import Path
-import pathspec
-import importlib
-import importlib.metadata as metadata
-import py7zr
-import zipfile
-
-def get_package_data_folder(package_name):
- """Return the package path if it contains data files."""
- try:
- package = importlib.import_module(package_name)
- package_path = os.path.dirname(package.__file__) # type: ignore
- if not package_path.endswith("site-packages"):
- has_data = any(
- file.endswith((".json", ".txt", ".csv", ".yml", ".yaml"))
- for root, dirs, files in os.walk(package_path)
- for file in files
- )
- if has_data:
- return package_path
- except ImportError:
- print(f"Warning: Unable to import {package_name}. Skipping data folder discovery for this package.")
- return None
-
-def get_add_data_args():
- """Return an array of --add-data arguments for PyInstaller, one per package."""
- add_data_args = []
- installed_packages = [dist.metadata["Name"] for dist in metadata.distributions()]
- for package in installed_packages:
- package_data_folder = get_package_data_folder(package)
- if package_data_folder:
- add_data_args.append(f"--add-data={package_data_folder}{os.pathsep}{package}")
- return add_data_args
-
-def get_site_packages_path():
- """Get the path to the site-packages directory of the current environment."""
- if hasattr(site, "getsitepackages"):
- paths = site.getsitepackages()
- else:
- paths = [site.getusersitepackages()]
- if paths:
- return paths[0]
- else:
- raise RuntimeError("Couldn't determine the site-packages path.")
-
-def parse_gitignore(gitignore_path):
- """Parse .gitignore file and return a PathSpec object."""
- if not os.path.exists(gitignore_path):
- return pathspec.PathSpec.from_lines("gitwildmatch", [])
- with open(gitignore_path, "r") as f:
- return pathspec.PathSpec.from_lines("gitwildmatch", f)
-
-def copy_project_files(src_dir, dst_dir, spec):
- """Copy project files respecting .gitignore rules using pathspec."""
- src_path = Path(src_dir)
- for root, dirs, files in os.walk(src_dir):
- rel_root = Path(root).relative_to(src_path)
- for file in files:
- rel_path = rel_root / file
- if not spec.match_file(str(rel_path)):
- src_file = src_path / rel_path
- dst_file = Path(dst_dir) / rel_path
- dst_file.parent.mkdir(parents=True, exist_ok=True)
- shutil.copy2(src_file, dst_file)
-
-def cleanup_directories(bundle_name, build_dir, dist_dir, keep_dist=False):
- """Remove build directory and .spec file. Optionally keep dist."""
- if not keep_dist and os.path.exists(dist_dir):
- shutil.rmtree(dist_dir)
- if os.path.exists(build_dir):
- shutil.rmtree(build_dir)
- spec_file = f"{bundle_name}.spec"
- if os.path.exists(spec_file):
- os.remove(spec_file)
-
-def compress_internal_folder(dist_dir, exe_name):
- """Compress the _internal folder using zipfile."""
- try:
- internal_path = Path(dist_dir) / exe_name / "_internal"
- archive_path = internal_path.parent / "_internal.zip"
-
- if not internal_path.exists():
- print("Warning: _internal folder not found")
- return False
-
- # Remove existing archive if it exists
- if archive_path.exists():
- archive_path.unlink()
-
- print(f"Compressing _internal folder to: {archive_path}")
-
- # Create the zip archive
- with zipfile.ZipFile(archive_path, 'w', zipfile.ZIP_STORED) as archive:
- for root, dirs, files in os.walk(internal_path):
- for file in files:
- file_path = Path(root) / file
- archive.write(file_path, arcname=file_path.relative_to(internal_path.parent))
-
- # Remove the original _internal folder
- shutil.rmtree(internal_path)
- print("_internal folder compressed and removed successfully")
- return True
-
- except Exception as e:
- print(f"Error during _internal compression: {e}")
- return False
-
-def compress_dist_folder(dist_dir, exe_name):
- """Compress the dist folder using py7zr library."""
- try:
- archive_path = Path(dist_dir) / f"{exe_name}.7z"
- files_path = Path(dist_dir) / exe_name
-
-
- # Remove existing archive if it exists
- if archive_path.exists():
- archive_path.unlink()
-
- print(f"Compressing dist folder to: {archive_path}")
-
- # Create the 7z archive with maximum compression
- with py7zr.SevenZipFile(archive_path, 'w', filters=[{'id': py7zr.FILTER_LZMA2, 'preset': 2}]) as archive:
- archive.writeall(files_path, arcname=files_path.name)
-
- print("Compression completed successfully")
- return str(archive_path)
-
- except Exception as e:
- print(f"Error during compression: {e}")
- return None
-
-def build_executable(script_path, exe_name=None, compress=False):
- """Run PyInstaller with the correct site-packages path, clean, and additional data."""
- try:
- # Resolve the absolute path to the script, relative to the current file location (__file__)
- bundling_script_dir = Path(__file__).parent.resolve()
- script_path = (bundling_script_dir / script_path).resolve()
- script_name = script_path.name # run_bundle.py
- project_dir = script_path.parent # Folder containing run_bundle.py
-
- # Define build and dist paths under the /bundle directory (bundling_script_dir)
- build_dir = bundling_script_dir / "build"
- dist_dir = bundling_script_dir / "dist"
-
- # Initial cleanup
- cleanup_directories(exe_name, build_dir, dist_dir, keep_dist=False)
-
- site_packages_path = get_site_packages_path()
- print(f"Using site-packages path: {site_packages_path}")
- print(f"Bundling project from: {project_dir}")
- print(f"Build directory: {build_dir}")
- print(f"Dist directory: {dist_dir}")
-
- # Parse .gitignore in the project directory
- gitignore_path = project_dir / ".gitignore"
- spec = parse_gitignore(gitignore_path)
-
- # Create a temporary directory for project files inside build
- temp_project_dir = build_dir / "temp_project"
- os.makedirs(temp_project_dir, exist_ok=True)
-
- # Copy project files respecting .gitignore
- copy_project_files(project_dir, temp_project_dir, spec)
-
- # Construct the PyInstaller command
- pyinstaller_command = [
- "pyinstaller",
- "--clean",
- "--noconfirm",
- "--onedir",
- f"--paths={site_packages_path}",
- f"--workpath={build_dir}", # Specify the build directory under /bundle
- f"--distpath={dist_dir}", # Specify the dist directory under /bundle
- ]
-
- # Add data arguments
- pyinstaller_command.extend(get_add_data_args())
-
- # Add custom name if provided
- if exe_name:
- pyinstaller_command.append(f"--name={exe_name}")
- else:
- exe_name = os.path.splitext(script_name)[0]
-
- # Add the script path (in the temp_project directory)
- pyinstaller_command.append(os.path.join(temp_project_dir, script_name))
-
- # Run the PyInstaller command
- print("Running PyInstaller...")
- subprocess.run(pyinstaller_command, check=True)
-
- # Post-processing: Create a folder for project files inside dist/
- project_files_dir = dist_dir / exe_name / f"{exe_name}-files"
- os.makedirs(project_files_dir, exist_ok=True)
-
- # Copy project files to the dist folder
- copy_project_files(temp_project_dir, project_files_dir, spec)
-
- print(f"PyInstaller finished successfully.")
- print(f"Executable created at: '{dist_dir}/{exe_name}'")
- print(f"Project files copied to: '{project_files_dir}'")
-
- # Compress the _internal folder first
- # compress_internal_folder(dist_dir, exe_name)
-
- # Compress the dist folder if requested
- if compress:
- archive_path = compress_dist_folder(dist_dir, exe_name)
- if archive_path:
- print(f"Created compressed archive at: {archive_path}")
-
- # Final cleanup (keeping dist folder)
- cleanup_directories(exe_name, build_dir, dist_dir, keep_dist=True)
-
- except subprocess.CalledProcessError as e:
- print(f"Error during PyInstaller execution: {e}")
- except Exception as e:
- print(f"Error: {e}")
-
-if __name__ == "__main__":
- build_executable("../run_bundle.py", "agent-zero", compress=False)
\ No newline at end of file
diff --git a/bundle/mac_pkg_scripts/postinstall b/bundle/mac_pkg_scripts/postinstall
deleted file mode 100755
index 72019f97d..000000000
--- a/bundle/mac_pkg_scripts/postinstall
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/bin/bash
-
-# Define the source path in the user's Library/Application Support
-SOURCE_PATH="$HOME/Library/Application Support/agent-zero/install"
-
-# Prompt the user to select a folder using an AppleScript dialog
-TARGET_FOLDER=$(osascript <<EOT
- tell application "System Events"
- activate
- set chosenFolder to choose folder with prompt "Please select a folder for the installation:"
- return POSIX path of chosenFolder
- end tell
-EOT
-)
-
-# Check if the user selected a folder
-if [ -n "$TARGET_FOLDER" ]; then
- echo "Installing files to $TARGET_FOLDER"
-
- # Move the installed files to the selected folder
- mv "$SOURCE_PATH"/* "$TARGET_FOLDER"
-
- # Check if the move operation was successful
- if [ $? -eq 0 ]; then
- echo "Files successfully moved to $TARGET_FOLDER"
-
- # Remove the agent-zero folder in Library/Application Support
- rm -rf "$SOURCE_PATH"
- echo "$SOURCE_PATH folder removed."
- else
- echo "Error moving files. Exiting."
- exit 1
- fi
-else
- echo "No folder selected. Exiting installation."
- exit 1
-fi
-
-exit 0
diff --git a/bundle/macos_bundle.sh b/bundle/macos_bundle.sh
deleted file mode 100755
index 77695047b..000000000
--- a/bundle/macos_bundle.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# 1. Remove conda environment if it exists
-echo "Removing conda environment 'az-bundle' if it exists..."
-conda env remove -n az-bundle -y || echo "Conda environment 'az-bundle' does not exist."
-
-# 2. Create new environment with Python 3.12 and activate it
-echo "Creating new conda environment 'az-bundle' with Python 3.12..."
-conda create -n az-bundle python=3.12 -y
-if [ $? -ne 0 ]; then
- echo "Error creating conda environment."
- exit 1
-fi
-
-echo "Activating conda environment 'az-bundle'..."
-source $(conda info --base)/etc/profile.d/conda.sh
-conda activate az-bundle
-if [ $? -ne 0 ]; then
- echo "Error activating conda environment."
- exit 1
-fi
-
-# 3. Purge folder ./agent-zero-git (retry mechanism in case of failure)
-if [ -d "agent-zero-git" ]; then
- echo "Deleting agent-zero-git folder..."
- rm -rf agent-zero-git
- if [ -d "agent-zero-git" ]; then
- echo "Error: Unable to delete agent-zero-git folder, retrying..."
- sleep 3
- rm -rf agent-zero-git
- fi
- if [ -d "agent-zero-git" ]; then
- echo "Error: Failed to purge agent-zero-git folder after retry."
- exit 1
- fi
-fi
-
-# 4. Clone the repository (testing branch)
-echo "Cloning the repository (testing branch)..."
-git clone --branch testing https://github.com/frdel/agent-zero agent-zero-git
-if [ $? -ne 0 ]; then
- echo "Error cloning the repository."
- exit 1
-fi
-
-# 5. Change directory to agent-zero
-# cd agent-zero || { echo "Error changing directory"; exit 1; }
-
-# 6. Install requirements
-echo "Installing requirements from requirements.txt..."
-pip install -r ./agent-zero-git/requirements.txt
-if [ $? -ne 0 ]; then
- echo "Error installing requirements."
- exit 1
-fi
-
-pip install -r ./agent-zero-git/bundle/requirements.txt
-if [ $? -ne 0 ]; then
- echo "Error installing requirements."
- exit 1
-fi
-
-# 7. Install specific version of pefile
-# skip
-
-# 8. Run bundle.py
-echo "Running bundle.py..."
-python ./agent-zero-git/bundle/bundle.py
-if [ $? -ne 0 ]; then
- echo "Error running bundle.py."
- exit 1
-fi
-
-# # 9. Move the generated 7z file to the script directory and remove agent-zero folder
-# BUNDLE_FILE="bundle/dist/agent-zero.7z"
-# if [ -f "$BUNDLE_FILE" ]; then
-# SCRIPT_DIR=$(dirname "$0")
-# echo "Moving $BUNDLE_FILE to $SCRIPT_DIR..."
-# mv "$BUNDLE_FILE" "$SCRIPT_DIR"
-# if [ $? -ne 0 ]; then
-# echo "Error moving $BUNDLE_FILE to $SCRIPT_DIR."
-# exit 1
-# fi
-# else
-# echo "Error: $BUNDLE_FILE not found."
-# exit 1
-# fi
-
-# 9. Create macOS package
-echo "Creating macOS package..."
-pkgbuild --root ./agent-zero-git/bundle/dist/agent-zero \
- --identifier frdel.agent-zero \
- --install-location "$HOME/Library/Application Support/agent-zero/install" \
- --scripts ./agent-zero-git/bundle/mac_pkg_scripts \
- --ownership preserve \
- agent-zero-preinstalled-mac-m1.pkg
-
-if [ $? -ne 0 ]; then
- echo "Error creating macOS package."
- exit 1
-fi
-
-# 10. Remove the agent-zero-git folder
-echo "Deleting agent-zero-git folder..."
-cd ..
-rm -rf agent-zero-git
-if [ -d "agent-zero-git" ]; then
- echo "Error: Failed to delete agent-zero-git folder."
- exit 1
-fi
-
-echo "Script completed."
diff --git a/bundle/requirements.txt b/bundle/requirements.txt
deleted file mode 100644
index 0fe15e181..000000000
--- a/bundle/requirements.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-pathspec==0.12.1
-py7zr==0.22.0
-pyinstaller==6.10.0
\ No newline at end of file
diff --git a/bundle/windows_bundle.bat b/bundle/windows_bundle.bat
deleted file mode 100644
index 2308d884d..000000000
--- a/bundle/windows_bundle.bat
+++ /dev/null
@@ -1,124 +0,0 @@
-@echo off
-setlocal enabledelayedexpansion
-
-:: Check if conda is recognized
-where conda >nul 2>nul
-if %errorlevel% neq 0 (
- echo Conda not found in PATH. Checking known location...
-
- set "CONDA_PATH=C:\Users\%USERNAME%\miniconda3"
- if exist "!CONDA_PATH!\Scripts\conda.exe" (
- echo Found Conda at !CONDA_PATH!
- set "PATH=!CONDA_PATH!;!CONDA_PATH!\Scripts;!CONDA_PATH!\Library\bin;%PATH%"
- echo Added Conda to PATH
- ) else (
- echo Conda installation not found at !CONDA_PATH!
- echo Please install Conda or add it to PATH manually.
- pause
- exit /b 1
- )
-)
-
-:: Verify conda is now accessible
-where conda >nul 2>nul
-if %errorlevel% neq 0 (
- echo Failed to add Conda to PATH. Please add it manually.
- pause
- exit /b 1
-)
-
-:: Initialize conda shell (if not done before)
-call conda init bash >nul 2>nul
-if %errorlevel% neq 0 (
- echo Error running 'conda init'. Please check your conda installation.
- pause
- exit /b 1
-)
-
-:: 1. Remove conda environment if it exists
-conda env remove -n az-bundle -y 2>nul
-if %errorlevel% neq 0 (
- echo Error removing conda environment
- pause
-)
-
-:: 2. Create new environment with Python 3.12 and activate it
-conda create -n az-bundle python=3.12 -y
-if %errorlevel% neq 0 (
- echo Error creating conda environment
- pause
-) else (
- call conda.bat activate az-bundle
- if %errorlevel% neq 0 (
- echo Error activating conda environment
- pause
- )
-)
-
-:: 3. Purge folder ./agent-zero (retry mechanism in case of failure)
-if exist agent-zero-git (
- echo Deleting agent-zero-git folder...
- rmdir /s /q agent-zero-git
- if exist agent-zero-git (
- echo Error: Unable to delete agent-zero-git folder, retrying...
- timeout /t 3 /nobreak >nul
- rmdir /s /q agent-zero-git
- )
- if exist agent-zero-git (
- echo Error: Failed to purge agent-zero-git folder after retry.
- pause
- )
-)
-
-:: 4. Clone the repository (testing branch)
-echo Cloning the repository (testing branch)...
-git clone --branch testing https://github.com/frdel/agent-zero agent-zero-git
-if %ERRORLEVEL% neq 0 (
- echo Error cloning the repository
- pause
-)
-
-@REM :: 5. Change directory to agent-zero
-@REM cd agent-zero
-@REM if %errorlevel% neq 0 (
-@REM echo Error changing directory
-@REM pause
-@REM )
-
-:: 6. Install requirements
-pip install -r ./agent-zero-git/requirements.txt
-if %errorlevel% neq 0 (
- echo Error installing project requirements
- pause
-)
-
-pip install -r ./agent-zero-git/bundle/requirements.txt
-if %errorlevel% neq 0 (
- echo Error installing bundle requirements
- pause
-)
-
-:: 7. Install specific version of pefile
-pip install pefile==2023.2.7
-if %errorlevel% neq 0 (
- echo Error installing pefile
- pause
-)
-
-:: 8. Run bundle.py
-python ./agent-zero-git/bundle/bundle.py
-if %errorlevel% neq 0 (
- echo Error running bundle.py
- pause
-)
-
-:: 9. Create Windows self-extracting archive with 7-Zip
-echo Creating Windows self-extracting archive...
-"C:\Program Files\7-Zip\7z.exe" a -sfx"C:\Program Files\7-Zip\7z.sfx" agent-zero-preinstalled-win-x86.exe ".\agent-zero-git\bundle\dist\agent-zero" -mx=7
-if %errorlevel% neq 0 (
- echo Error creating Windows self-extracting archive.
- pause
-)
-
-echo Script completed
-pause
diff --git a/docker/run/docker_manager_mac_linux.sh b/docker/run/docker_manager_mac_linux.sh
deleted file mode 100644
index e941ff4f0..000000000
--- a/docker/run/docker_manager_mac_linux.sh
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/bin/bash
-
-# Constants
-IMAGE_NAME="frdel/agent-zero-run"
-DEFAULT_CONTAINER_NAME="agent-zero"
-BASE_PORT=50080
-
-# Global variable for container IDs
-container_ids=()
-
-# Function to list unique containers based on the specified image
-list_containers() {
- echo
- echo "Listing all containers using image '$IMAGE_NAME':"
- container_ids=() # Reset global array for each list update
- container_list=$(docker ps -a --filter "ancestor=$IMAGE_NAME" --format "{{.ID}} {{.Names}} {{.Ports}}" | sort -u -k2,2)
-
- if [ -z "$container_list" ]; then
- echo "No containers found for image '$IMAGE_NAME'."
- return 1
- fi
-
- index=1
- printed_ids=()
- while IFS= read -r line; do
- container_id=$(echo "$line" | awk '{print $1}')
- container_name=$(echo "$line" | awk '{print $2}')
- ports=$(echo "$line" | awk '{print substr($0, index($0,$3))}')
-
- # Extract the mapped port using sed
- mapped_port=$(echo "$ports" | sed -n 's/.*0.0.0.0:\([0-9]*\)->80.*/\1/p')
- container_url="http://localhost:${mapped_port}"
-
- # Check if this ID has already been printed and mapped_port is valid
- if [[ ! " ${printed_ids[@]} " =~ " ${container_id} " ]] && [ -n "$mapped_port" ]; then
- printed_ids+=("$container_id")
- container_ids+=("$container_id") # Store container ID in global array
- printf "%2d. [%s] %s - URL: %s\n" "$index" "$container_id" "$container_name" "$container_url"
- index=$((index + 1))
- fi
- done <<< "$container_list"
- return 0
-}
-
-
-
-# Function to select an action for an existing container
-manage_container() {
- container_id=$1
- while true; do
- echo -e "\nSelect an action for container ID: $container_id"
- echo "1. Restart"
- echo "2. Remove"
- echo "3. View Logs"
- echo "0. Back"
- read -p "Choose an action (0-3): " action
- case $action in
- 1)
- docker restart "$container_id"
- echo "Container restarted."
- ;;
- 2)
- docker rm -f "$container_id"
- echo "Container removed."
- return # Go back to the list screen after removing
- ;;
- 3)
- echo -e "\n--- Logs for container ID: $container_id ---"
- docker logs "$container_id"
- echo -e "\n--- End of logs ---"
- ;;
- 0)
- return
- ;;
- *)
- echo "Invalid selection. Please choose 0, 1, 2, or 3."
- ;;
- esac
- done
-}
-
-# Function to create a new container
-create_container() {
- # Generate the default container name
- container_count=$(docker ps -a --filter "name=$DEFAULT_CONTAINER_NAME" --format "{{.Names}}" | wc -l)
- default_name="$DEFAULT_CONTAINER_NAME-$(($container_count + 1))"
-
- # Prompt for the container name
- read -p "Enter container name or leave empty for '$default_name': " name
- name=${name:-"$default_name"}
-
- # Calculate default port based on the container count
- default_port=$((BASE_PORT + container_count + 1))
- read -p "Enter web port or leave empty for '$default_port': " web_port
- web_port=${web_port:-$default_port}
-
- # Prompt for the data folder
- read -p "Enter data folder or leave empty for '$(pwd)/agent-zero': " data_folder
- data_folder=${data_folder:-$(pwd)/agent-zero}
-
- # Run the container with the specified name, port mapping, and data folder
- container_id=$(docker run -d -p "$web_port:80" --name "$name" -v "$data_folder:/a0" "$IMAGE_NAME:latest")
- echo -e "\nContainer '$name' created with ID '$container_id', data folder '$data_folder', and web port '$web_port' mapped to port 80."
-}
-
-# Main program loop
-echo -e "\nWelcome to Agent Zero Docker Management Script.\n"
-while true; do
- list_containers
- if [ $? -ne 0 ]; then
- echo -e "\nNo containers available. Would you like to create a new one? (y/n)"
- read -p "> " create_new
- if [ "$create_new" == "y" ]; then
- create_container
- else
- exit 0
- fi
- else
- echo -e "\nChoose a container by line number, type 'n' to create a new one, or 'r' to refresh the list:"
- read -p "> " choice
-
- # Refresh the list if the user inputs 'r'
- if [ "$choice" == "r" ]; then
- continue
- fi
-
- # Match choice to the actual container list
- if [[ $choice =~ ^[0-9]+$ ]] && ((choice >= 1 && choice <= ${#container_ids[@]})); then
- selected_container_id="${container_ids[$((choice - 1))]}"
- manage_container "$selected_container_id"
- elif [ "$choice" == "n" ]; then
- create_container
- else
- echo "Invalid choice, please enter a valid line number, 'n' to create a new container, or 'r' to refresh the list."
- fi
- fi
-done
diff --git a/run_bundle.py b/run_bundle.py
deleted file mode 100644
index 97a6e9e14..000000000
--- a/run_bundle.py
+++ /dev/null
@@ -1,78 +0,0 @@
-def post_install():
- # if "_internal.zip" exists, unzip and remove
- import os
- if os.path.exists("_internal.zip"):
- import zipfile
- print("\nDecompressing internal binaries...\n")
- with zipfile.ZipFile("_internal.zip", 'r') as zip_ref:
- zip_ref.extractall("_internal")
- os.remove("_internal.zip")
-
-def run_bundle():
- print("\nImporting dependencies, this may take a while...\n")
-
- # dependencies to bundle
- import ansio
- import bs4
- import docker
- import duckduckgo_search
- import faiss
- from flask import Flask
- import flask_basicauth
- import inputimeout
- import langchain.embeddings
- import langchain_anthropic
- import langchain_community
- import langchain_google_genai
- import langchain_groq
- import langchain_huggingface
- import langchain_mistralai
- import langchain_ollama
- import langchain_openai
- import lxml_html_clean
- import emoji
- from emoji import unicode_codes
- import markdown
- import newspaper
- import paramiko
- import pypdf
- import dotenv
- import sentence_transformers
- from tiktoken import model, registry
- from tiktoken_ext import openai_public
- import unstructured
- import unstructured_client
- import webcolors
-
-
-
- # but do not bundle project files, these are to be imported at runtime
-
-
-
- import sys
- import os
- import importlib.util
-
- # Add the project_files directory to the Python path
- project_files_dir = os.path.join(os.path.dirname(sys.executable), 'agent-zero-files')
- sys.path.insert(0, project_files_dir)
-
- # Dynamically load the 'run_ui' module
- module_name = "run_ui"
- module_path = os.path.join(project_files_dir, f"{module_name}.py")
-
- # Load the module at runtime
- spec = importlib.util.spec_from_file_location(module_name, module_path)
- if spec and spec.loader:
- run_ui = importlib.util.module_from_spec(spec)
- spec.loader.exec_module(run_ui)
-
- # Now you can call the function in the dynamically imported module
- run_ui.run() # Call the 'run' function from run_ui
- else:
- raise Exception(f"Could not load {module_name} from {module_path}")
-
-
-# post_install()
-run_bundle()
\ No newline at end of file
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/tests/helpers/__init__.py b/tests/helpers/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/tests/helpers/test_json_parse_dirty.py b/tests/helpers/test_json_parse_dirty.py
deleted file mode 100644
index 41724bd08..000000000
--- a/tests/helpers/test_json_parse_dirty.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import unittest
-from python.helpers.extract_tools import extract_json_object_string
-from python.helpers.dirty_json import DirtyJson
-from typing import Any
-
-
-def json_parse_dirty(json: str) -> dict[str, Any] | None:
- ext_json = extract_json_object_string(json)
- if ext_json:
- data = DirtyJson.parse_string(ext_json)
- if isinstance(data, dict):
- return data
- return None
-
-
-class TestJsonParseDirty(unittest.TestCase):
- def test_valid_json(self):
- json_string = '{"key": "value"}'
- expected_output = {"key": "value"}
- self.assertEqual(json_parse_dirty(json_string), expected_output)
-
- def test_invalid_json(self):
- json_string = 'invalid json'
- self.assertIsNone(json_parse_dirty(json_string))
-
- def test_partial_json(self):
- json_string = 'some text before {"key": "value"} some text after'
- expected_output = {"key": "value"}
- self.assertEqual(json_parse_dirty(json_string), expected_output)
-
- def test_no_closing_brace(self):
- json_string = '{"key": "value"'
- expected_output = {"key": "value"}
- self.assertEqual(json_parse_dirty(json_string), expected_output)
-
- def test_no_opening_brace(self):
- json_string = '"key": "value"}'
- self.assertIsNone(json_parse_dirty(json_string))
-
- def test_agent_response(self):
- json_string = ('{"thoughts": ["The user wants to save the source code of their Hello, World! application to a '
- 'file.", "I can use the code_execution_tool with terminal runtime to achieve this."], '
- '"tool_name": "code_execution_tool", "tool_args": {"runtime": "terminal", "code": "echo '
- '\'print(\'Hello, World!\')\' > hello_world.py"}}')
- expected_result = {
- "thoughts": [
- "The user wants to save the source code of their Hello, World! application to a file.",
- "I can use the code_execution_tool with terminal runtime to achieve this."
- ],
- "tool_name": "code_execution_tool",
- "tool_args": {
- "runtime": "terminal",
- "code": "echo \'print(\'Hello, World!\')\' > hello_world.py"
- }
- }
- self.assertEqual(json_parse_dirty(json_string), expected_result)
-
-
-if __name__ == '__main__':
- unittest.main()
\ No newline at end of file