in src/smolagents/remote_executors.py [0:0]
def _start_deno_server(self):
"""Start the Deno server that will run our JavaScript code."""
cmd = [self.deno_path, "run"] + self.deno_permissions + [self.runner_path]
# Start the server process
self.server_process = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
# Wait for the server to start
time.sleep(2) # Give the server time to start
# Check if the server started successfully
if self.server_process.poll() is not None:
stderr = self.server_process.stderr.read()
raise RuntimeError(f"Failed to start Deno server: {stderr}")
self.server_url = "http://localhost:8000" # TODO: Another port?
# Test the connection
try:
response = requests.get(self.server_url)
if response.status_code != 200:
raise RuntimeError(f"Server responded with status code {response.status_code}: {response.text}")
except requests.RequestException as e:
raise RuntimeError(f"Failed to connect to Deno server: {e}")