exxec 0.3.6__tar.gz → 0.3.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {exxec-0.3.6 → exxec-0.3.7}/PKG-INFO +1 -1
- {exxec-0.3.6 → exxec-0.3.7}/pyproject.toml +5 -1
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/__init__.py +3 -2
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/acp_provider/process_manager.py +1 -1
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/acp_provider/provider.py +1 -1
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/daytona_provider/process_manager.py +6 -15
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/microsandbox_provider/provider.py +1 -1
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/modal_provider/provider.py +4 -12
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/modal_provider/pty_manager.py +1 -6
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/remote_callable.py +1 -1
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/srt_provider/__init__.py +1 -2
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/srt_provider/provider.py +6 -7
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/vercel_provider/process_manager.py +3 -5
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec_config/configs.py +9 -10
- exxec-0.3.6/src/exxec/srt_provider/config.py +0 -79
- {exxec-0.3.6 → exxec-0.3.7}/LICENSE +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/README.md +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/acp_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/base.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/beam_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/beam_provider/helpers.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/beam_provider/process_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/beam_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/daytona_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/daytona_provider/helpers.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/daytona_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/daytona_provider/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/docker_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/docker_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/docker_provider/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/e2b_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/e2b_provider/process_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/e2b_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/e2b_provider/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/events.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/local_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/local_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/local_provider/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/local_provider/utils.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/log.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/microsandbox_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/mock_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/mock_provider/process_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/mock_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/mock_provider/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/modal_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/models.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/parse_output.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/pep723.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/process_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/py.typed +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/pyodide_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/pyodide_provider/filesystem.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/pyodide_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/pyodide_provider/pyodide_server.ts +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/ssh_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/ssh_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/ssh_provider/pty_manager.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/vercel_provider/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec/vercel_provider/provider.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec_config/__init__.py +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec_config/py.typed +0 -0
- {exxec-0.3.6 → exxec-0.3.7}/src/exxec_config/srt_sandbox_config.py +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[project]
|
|
4
4
|
name = "exxec"
|
|
5
|
-
version = "0.3.
|
|
5
|
+
version = "0.3.7"
|
|
6
6
|
description = "Execution environments"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
requires-python = ">=3.13"
|
|
@@ -287,6 +287,10 @@ preview = true
|
|
|
287
287
|
python-version = "3.13"
|
|
288
288
|
python-platform = "all"
|
|
289
289
|
|
|
290
|
+
[tool.ty.rules]
|
|
291
|
+
unresolved-import = "ignore"
|
|
292
|
+
unused-type-ignore-comment = "ignore"
|
|
293
|
+
|
|
290
294
|
[tool.uv]
|
|
291
295
|
default-groups = ["dev", "lint", "docs"]
|
|
292
296
|
# Override to resolve beam-client (<14) vs daytona (>=15) websockets conflict
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
from importlib.metadata import version
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
__version__ = version("exxec")
|
|
8
9
|
__title__ = "Exxec"
|
|
9
10
|
__author__ = "Philipp Temminghoff"
|
|
@@ -23,7 +24,7 @@ from exxec.docker_provider import DockerExecutionEnvironment, DockerPtyManager
|
|
|
23
24
|
from exxec.local_provider import LocalExecutionEnvironment, LocalPtyManager
|
|
24
25
|
from exxec.pyodide_provider import PyodideExecutionEnvironment
|
|
25
26
|
from exxec.e2b_provider import E2bExecutionEnvironment, E2BPtyManager
|
|
26
|
-
from exxec.srt_provider import SRTExecutionEnvironment
|
|
27
|
+
from exxec.srt_provider import SRTExecutionEnvironment
|
|
27
28
|
from exxec.microsandbox_provider import MicrosandboxExecutionEnvironment
|
|
28
29
|
from exxec.modal_provider import ModalExecutionEnvironment, ModalPtyManager
|
|
29
30
|
from exxec.vercel_provider import DEFAULT_TIMEOUT_SECONDS, VercelExecutionEnvironment, VercelRuntime
|
|
@@ -36,6 +37,7 @@ from exxec.ssh_provider import SshExecutionEnvironment, SshPtyManager
|
|
|
36
37
|
from exxec.pty_manager import BasePtyManager, PtyInfo, PtyManagerProtocol, PtySize
|
|
37
38
|
|
|
38
39
|
if TYPE_CHECKING:
|
|
40
|
+
from exxec_config.srt_sandbox_config import SandboxConfig
|
|
39
41
|
from exxec_config import ExecutionEnvironmentStr
|
|
40
42
|
from contextlib import AbstractAsyncContextManager
|
|
41
43
|
|
|
@@ -317,7 +319,6 @@ __all__ = [
|
|
|
317
319
|
"PtySize",
|
|
318
320
|
"PyodideExecutionEnvironment",
|
|
319
321
|
"SRTExecutionEnvironment",
|
|
320
|
-
"SandboxConfig",
|
|
321
322
|
"ServerInfo",
|
|
322
323
|
"SshExecutionEnvironment",
|
|
323
324
|
"SshPtyManager",
|
|
@@ -17,7 +17,7 @@ if TYPE_CHECKING:
|
|
|
17
17
|
from contextlib import AbstractAsyncContextManager
|
|
18
18
|
|
|
19
19
|
from acp import TerminalHandle
|
|
20
|
-
from acp.acp_requests import ACPRequests
|
|
20
|
+
from acp.agent.acp_requests import ACPRequests
|
|
21
21
|
from anyenv.process_manager import ProcessManagerProtocol
|
|
22
22
|
from fsspec.asyn import AsyncFileSystem # type: ignore[import-untyped]
|
|
23
23
|
|
|
@@ -63,6 +63,8 @@ class DaytonaTerminalManager(ProcessManagerProtocol):
|
|
|
63
63
|
output_limit: int | None = None,
|
|
64
64
|
) -> str:
|
|
65
65
|
"""Create a new terminal session using Daytona's session management."""
|
|
66
|
+
from daytona.common.process import SessionExecuteRequest
|
|
67
|
+
|
|
66
68
|
terminal_id = f"daytona_term_{uuid.uuid4().hex[:8]}"
|
|
67
69
|
args = args or []
|
|
68
70
|
full_command = f"{command} {' '.join(args)}" if args else command
|
|
@@ -78,14 +80,10 @@ class DaytonaTerminalManager(ProcessManagerProtocol):
|
|
|
78
80
|
)
|
|
79
81
|
|
|
80
82
|
self._terminals[terminal_id] = terminal
|
|
81
|
-
|
|
82
83
|
try:
|
|
83
84
|
await self.sandbox.process.create_session(session_id)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
request = SessionExecuteRequest(command=full_command, runAsync=True) # ty: ignore[unknown-argument]
|
|
85
|
+
request = SessionExecuteRequest(command=full_command, run_async=True)
|
|
87
86
|
response = await self.sandbox.process.execute_session_command(session_id, request)
|
|
88
|
-
|
|
89
87
|
terminal.set_command_id(str(response.cmd_id))
|
|
90
88
|
asyncio.create_task(self._collect_output(terminal)) # noqa: RUF006
|
|
91
89
|
msg = "Created Daytona terminal %s (session %s, command %s): %s"
|
|
@@ -145,7 +143,6 @@ class DaytonaTerminalManager(ProcessManagerProtocol):
|
|
|
145
143
|
output = terminal.get_output()
|
|
146
144
|
terminal.is_running()
|
|
147
145
|
exit_code = terminal.get_exit_code()
|
|
148
|
-
|
|
149
146
|
return ProcessOutput(stdout=output, stderr="", combined=output, exit_code=exit_code)
|
|
150
147
|
|
|
151
148
|
def get_terminal(self, terminal_id: str) -> DaytonaTerminal:
|
|
@@ -258,14 +255,11 @@ class DaytonaTerminalManager(ProcessManagerProtocol):
|
|
|
258
255
|
terminal_id = f"daytona_conn_{uuid.uuid4().hex[:8]}"
|
|
259
256
|
|
|
260
257
|
try:
|
|
261
|
-
# Get session info
|
|
262
258
|
session = await self.sandbox.process.get_session(session_id)
|
|
263
|
-
|
|
264
259
|
# Create terminal for the existing session
|
|
265
260
|
# Use the last command if available
|
|
266
261
|
last_command = session.commands[-1] if session.commands else None
|
|
267
262
|
command_text = last_command.command if last_command else "unknown"
|
|
268
|
-
|
|
269
263
|
terminal = DaytonaTerminal(
|
|
270
264
|
terminal_id=terminal_id,
|
|
271
265
|
command=command_text,
|
|
@@ -280,7 +274,6 @@ class DaytonaTerminalManager(ProcessManagerProtocol):
|
|
|
280
274
|
terminal.set_exit_code(int(last_command.exit_code))
|
|
281
275
|
|
|
282
276
|
self._terminals[terminal_id] = terminal
|
|
283
|
-
|
|
284
277
|
# Start collecting output if command is still running
|
|
285
278
|
if terminal.is_running():
|
|
286
279
|
asyncio.create_task(self._collect_output(terminal)) # noqa: RUF006
|
|
@@ -298,20 +291,18 @@ class DaytonaTerminalManager(ProcessManagerProtocol):
|
|
|
298
291
|
self, terminal_id: str, command: str, run_async: bool = True
|
|
299
292
|
) -> str:
|
|
300
293
|
"""Execute a new command in an existing terminal session."""
|
|
294
|
+
from daytona.common.process import SessionExecuteRequest
|
|
295
|
+
|
|
301
296
|
terminal = self.get_terminal(terminal_id)
|
|
297
|
+
request = SessionExecuteRequest(command=command, run_async=run_async)
|
|
302
298
|
try:
|
|
303
|
-
from daytona.common.process import SessionExecuteRequest
|
|
304
|
-
|
|
305
|
-
request = SessionExecuteRequest(command=command, runAsync=run_async) # ty: ignore[unknown-argument]
|
|
306
299
|
response = await self.sandbox.process.execute_session_command(
|
|
307
300
|
terminal.session_id, request
|
|
308
301
|
)
|
|
309
|
-
|
|
310
302
|
# Update terminal with new command info
|
|
311
303
|
terminal.set_command_id(str(response.cmd_id))
|
|
312
304
|
terminal._completed = False
|
|
313
305
|
terminal._exit_code = None
|
|
314
|
-
|
|
315
306
|
# Start collecting output for the new command
|
|
316
307
|
if run_async:
|
|
317
308
|
asyncio.create_task(self._collect_output(terminal)) # noqa: RUF006
|
|
@@ -129,7 +129,7 @@ class MicrosandboxExecutionEnvironment(ExecutionEnvironment):
|
|
|
129
129
|
case _:
|
|
130
130
|
sandbox_class = PythonSandbox
|
|
131
131
|
# Create sandbox with context manager
|
|
132
|
-
self.sandbox = await sandbox_class.create(
|
|
132
|
+
self.sandbox = await sandbox_class.create(
|
|
133
133
|
server_url=self.server_url, # pyright: ignore[reportArgumentType] # ty: ignore[invalid-argument-type]
|
|
134
134
|
namespace=self.namespace,
|
|
135
135
|
api_key=self.api_key,
|
|
@@ -228,12 +228,8 @@ class ModalExecutionEnvironment(ExecutionEnvironment):
|
|
|
228
228
|
# Write script to sandbox using filesystem API
|
|
229
229
|
with await sandbox.open.aio(script_path, "w") as f:
|
|
230
230
|
await f.write.aio(script_content)
|
|
231
|
-
|
|
232
|
-
process = await sandbox.exec.aio(
|
|
233
|
-
*command,
|
|
234
|
-
timeout=self.timeout,
|
|
235
|
-
env=self.get_env(), # type: ignore[arg-type]
|
|
236
|
-
)
|
|
231
|
+
cmd = _get_execution_command(self.language, script_path)
|
|
232
|
+
process = await sandbox.exec.aio(*cmd, timeout=self.timeout, env=self.get_env()) # type: ignore[arg-type]
|
|
237
233
|
await process.wait.aio()
|
|
238
234
|
stdout = await process.stdout.read.aio() if process.stdout else ""
|
|
239
235
|
stderr = await process.stderr.read.aio() if process.stderr else ""
|
|
@@ -310,12 +306,8 @@ class ModalExecutionEnvironment(ExecutionEnvironment):
|
|
|
310
306
|
script_path = get_script_path(self.language)
|
|
311
307
|
with await sandbox.open.aio(script_path, "w") as f:
|
|
312
308
|
await f.write.aio(script_content)
|
|
313
|
-
|
|
314
|
-
process = await sandbox.exec.aio(
|
|
315
|
-
*exec_command,
|
|
316
|
-
timeout=self.timeout,
|
|
317
|
-
env=self.get_env(), # type: ignore[arg-type]
|
|
318
|
-
)
|
|
309
|
+
exec_cmd = _get_execution_command(self.language, script_path)
|
|
310
|
+
process = await sandbox.exec.aio(*exec_cmd, timeout=self.timeout, env=self.get_env()) # type: ignore[arg-type]
|
|
319
311
|
|
|
320
312
|
async for line in process.stdout:
|
|
321
313
|
yield OutputEvent(process_id=process_id, data=line.rstrip("\n\r"), stream="stdout")
|
|
@@ -98,12 +98,7 @@ class ModalPtyManager(BasePtyManager):
|
|
|
98
98
|
exec_args = args
|
|
99
99
|
|
|
100
100
|
# Create process with PTY enabled
|
|
101
|
-
process = await self._sandbox.exec.aio(
|
|
102
|
-
exec_cmd,
|
|
103
|
-
*exec_args,
|
|
104
|
-
pty=True,
|
|
105
|
-
env=env, # type: ignore[arg-type]
|
|
106
|
-
)
|
|
101
|
+
process = await self._sandbox.exec.aio(exec_cmd, *exec_args, pty=True, env=env) # type: ignore[arg-type]
|
|
107
102
|
|
|
108
103
|
# Modal doesn't expose PID directly
|
|
109
104
|
info = PtyInfo(
|
|
@@ -87,7 +87,7 @@ def infer_package_dependencies(import_path: str) -> list[str]:
|
|
|
87
87
|
"""
|
|
88
88
|
if not import_path:
|
|
89
89
|
return []
|
|
90
|
-
root_module = import_path.split(".")[0]
|
|
90
|
+
root_module = import_path.split(".", maxsplit=1)[0]
|
|
91
91
|
packages = []
|
|
92
92
|
try:
|
|
93
93
|
# Try to find which package provides this module
|
|
@@ -10,7 +10,7 @@ import tempfile
|
|
|
10
10
|
from typing import TYPE_CHECKING
|
|
11
11
|
|
|
12
12
|
from exxec.local_provider import LocalExecutionEnvironment
|
|
13
|
-
from
|
|
13
|
+
from exxec_config import SandboxConfig
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
@@ -38,7 +38,7 @@ class SRTExecutionEnvironment(LocalExecutionEnvironment):
|
|
|
38
38
|
*,
|
|
39
39
|
lifespan_handler: AbstractAsyncContextManager[ServerInfo] | None = None,
|
|
40
40
|
dependencies: list[str] | None = None,
|
|
41
|
-
|
|
41
|
+
default_command_timeout: float | None = None,
|
|
42
42
|
executable: str | None = None,
|
|
43
43
|
language: Language = "python",
|
|
44
44
|
cwd: str | None = None,
|
|
@@ -51,7 +51,7 @@ class SRTExecutionEnvironment(LocalExecutionEnvironment):
|
|
|
51
51
|
sandbox_config: Sandbox restrictions configuration
|
|
52
52
|
lifespan_handler: Async context manager for tool server
|
|
53
53
|
dependencies: List of packages to install
|
|
54
|
-
|
|
54
|
+
default_command_timeout: Execution timeout in seconds
|
|
55
55
|
executable: Executable to use (auto-detect if None)
|
|
56
56
|
language: Programming language
|
|
57
57
|
cwd: Working directory for the sandbox
|
|
@@ -62,7 +62,7 @@ class SRTExecutionEnvironment(LocalExecutionEnvironment):
|
|
|
62
62
|
super().__init__(
|
|
63
63
|
lifespan_handler=lifespan_handler,
|
|
64
64
|
dependencies=dependencies,
|
|
65
|
-
default_command_timeout=
|
|
65
|
+
default_command_timeout=default_command_timeout,
|
|
66
66
|
isolated=True,
|
|
67
67
|
executable=executable,
|
|
68
68
|
language=language,
|
|
@@ -70,12 +70,11 @@ class SRTExecutionEnvironment(LocalExecutionEnvironment):
|
|
|
70
70
|
env_vars=env_vars,
|
|
71
71
|
inherit_env=inherit_env,
|
|
72
72
|
)
|
|
73
|
-
self.timeout = timeout # Store for srt settings
|
|
74
73
|
self.sandbox_config = sandbox_config or SandboxConfig()
|
|
75
74
|
self._settings_file = self._create_settings_file()
|
|
76
75
|
atexit.register(self._cleanup_settings_file)
|
|
77
76
|
|
|
78
|
-
def get_fs(self) -> SRTFS:
|
|
77
|
+
def get_fs(self) -> SRTFS:
|
|
79
78
|
"""Get sandboxed filesystem."""
|
|
80
79
|
from upathtools.filesystems.sandbox_filesystems import SRTFS
|
|
81
80
|
|
|
@@ -88,7 +87,7 @@ class SRTExecutionEnvironment(LocalExecutionEnvironment):
|
|
|
88
87
|
deny_read=self.sandbox_config.deny_read,
|
|
89
88
|
allow_write=self.sandbox_config.allow_write,
|
|
90
89
|
deny_write=self.sandbox_config.deny_write,
|
|
91
|
-
timeout=self.
|
|
90
|
+
timeout=self.default_command_timeout,
|
|
92
91
|
)
|
|
93
92
|
|
|
94
93
|
def _create_settings_file(self) -> Path:
|
|
@@ -105,11 +105,9 @@ class VercelTerminalManager(ProcessManagerProtocol):
|
|
|
105
105
|
if stderr := await terminal._command.stderr():
|
|
106
106
|
terminal.add_output(f"STDERR: {stderr}")
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
if
|
|
110
|
-
|
|
111
|
-
if exit_code is not None:
|
|
112
|
-
terminal.set_exit_code(exit_code)
|
|
108
|
+
exit_code = terminal._command.cmd.exit_code
|
|
109
|
+
if exit_code is not None:
|
|
110
|
+
terminal.set_exit_code(exit_code)
|
|
113
111
|
|
|
114
112
|
except Exception as e:
|
|
115
113
|
logger.exception("Error collecting output for %s", terminal.terminal_id)
|
|
@@ -396,14 +396,6 @@ class SRTExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
|
|
|
396
396
|
sandbox: SandboxConfig = Field(default_factory=SandboxConfig)
|
|
397
397
|
"""Sandbox restrictions configuration."""
|
|
398
398
|
|
|
399
|
-
sandbox_timeout: float = Field(
|
|
400
|
-
default=300.0,
|
|
401
|
-
gt=0.0,
|
|
402
|
-
title="Sandbox Lifetime",
|
|
403
|
-
examples=[300.0, 600.0, 3600.0],
|
|
404
|
-
)
|
|
405
|
-
"""How long the sandbox stays alive in seconds."""
|
|
406
|
-
|
|
407
399
|
def get_provider(
|
|
408
400
|
self, lifespan_handler: AbstractAsyncContextManager[ServerInfo] | None = None
|
|
409
401
|
) -> SRTExecutionEnvironment:
|
|
@@ -414,7 +406,6 @@ class SRTExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
|
|
|
414
406
|
sandbox_config=self.sandbox,
|
|
415
407
|
lifespan_handler=lifespan_handler,
|
|
416
408
|
dependencies=self.dependencies,
|
|
417
|
-
timeout=self.sandbox_timeout,
|
|
418
409
|
default_command_timeout=self.default_command_timeout,
|
|
419
410
|
executable=self.executable,
|
|
420
411
|
language=self.language,
|
|
@@ -528,6 +519,9 @@ class ModalExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
|
|
|
528
519
|
gpu: str | None = Field(default=None, title="GPU Type", examples=["T4", "A100", "A10G"])
|
|
529
520
|
"""GPU type."""
|
|
530
521
|
|
|
522
|
+
timeout: int = Field(default=60, title="Timeout")
|
|
523
|
+
"""Timeout for the sandbox."""
|
|
524
|
+
|
|
531
525
|
idle_timeout: int | None = Field(default=None, title="Idle Timeout (seconds)")
|
|
532
526
|
"""Idle timeout in seconds."""
|
|
533
527
|
|
|
@@ -555,6 +549,7 @@ class ModalExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
|
|
|
555
549
|
memory=self.memory,
|
|
556
550
|
gpu=self.gpu,
|
|
557
551
|
timeout=int(self.timeout),
|
|
552
|
+
default_command_timeout=self.default_command_timeout,
|
|
558
553
|
idle_timeout=self.idle_timeout,
|
|
559
554
|
workdir=self.workdir,
|
|
560
555
|
language=self.language,
|
|
@@ -651,6 +646,9 @@ class VercelExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
|
|
|
651
646
|
ports: list[int] = Field(default=[3000], title="Ports")
|
|
652
647
|
"""List of ports to expose."""
|
|
653
648
|
|
|
649
|
+
timeout: int = Field(default=60, title="Timeout")
|
|
650
|
+
"""Timeout for the sandbox."""
|
|
651
|
+
|
|
654
652
|
language: Language = Field(
|
|
655
653
|
default="python",
|
|
656
654
|
title="Programming Language",
|
|
@@ -678,7 +676,8 @@ class VercelExecutionEnvironmentConfig(BaseExecutionEnvironmentConfig):
|
|
|
678
676
|
lifespan_handler=lifespan_handler,
|
|
679
677
|
dependencies=self.dependencies,
|
|
680
678
|
runtime=self.runtime,
|
|
681
|
-
|
|
679
|
+
default_command_timeout=self.default_command_timeout,
|
|
680
|
+
timeout=self.timeout,
|
|
682
681
|
resources=self.resources,
|
|
683
682
|
ports=self.ports,
|
|
684
683
|
language=self.language,
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"""Configuration for sandbox restrictions."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from typing import Any
|
|
6
|
-
|
|
7
|
-
from pydantic import BaseModel, Field
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class SandboxConfig(BaseModel):
|
|
11
|
-
"""Configuration for sandbox-runtime restrictions."""
|
|
12
|
-
|
|
13
|
-
# Network settings
|
|
14
|
-
allowed_domains: list[str] = Field(
|
|
15
|
-
default_factory=list,
|
|
16
|
-
title="Allowed Domains",
|
|
17
|
-
examples=[["github.com", "*.github.com", "pypi.org"]],
|
|
18
|
-
)
|
|
19
|
-
"""Domains that can be accessed. Empty = no network access."""
|
|
20
|
-
|
|
21
|
-
denied_domains: list[str] = Field(
|
|
22
|
-
default_factory=list,
|
|
23
|
-
title="Denied Domains",
|
|
24
|
-
examples=[["malicious.com"]],
|
|
25
|
-
)
|
|
26
|
-
"""Domains explicitly blocked (checked before allowed_domains)."""
|
|
27
|
-
|
|
28
|
-
allow_unix_sockets: list[str] = Field(
|
|
29
|
-
default_factory=list,
|
|
30
|
-
title="Allowed Unix Sockets",
|
|
31
|
-
examples=[["/var/run/docker.sock"]],
|
|
32
|
-
)
|
|
33
|
-
"""Specific Unix socket paths to allow (e.g., Docker socket)."""
|
|
34
|
-
|
|
35
|
-
allow_all_unix_sockets: bool = Field(default=False, title="Allow All Unix Sockets")
|
|
36
|
-
"""Allow all Unix sockets (less secure)."""
|
|
37
|
-
|
|
38
|
-
allow_local_binding: bool = Field(default=False, title="Allow Local Binding")
|
|
39
|
-
"""Allow binding to localhost ports."""
|
|
40
|
-
|
|
41
|
-
# Filesystem read settings (deny-only pattern)
|
|
42
|
-
deny_read: list[str] = Field(
|
|
43
|
-
default_factory=lambda: ["~/.ssh", "~/.aws", "~/.gnupg"],
|
|
44
|
-
title="Deny Read Paths",
|
|
45
|
-
examples=[["~/.ssh", "~/.aws"]],
|
|
46
|
-
)
|
|
47
|
-
"""Paths blocked from reading. Empty = full read access."""
|
|
48
|
-
|
|
49
|
-
# Filesystem write settings (allow-only pattern)
|
|
50
|
-
allow_write: list[str] = Field(
|
|
51
|
-
default_factory=lambda: ["."],
|
|
52
|
-
title="Allow Write Paths",
|
|
53
|
-
examples=[["."], [".", "/tmp"]],
|
|
54
|
-
)
|
|
55
|
-
"""Paths where writes are permitted. Empty = no write access."""
|
|
56
|
-
|
|
57
|
-
deny_write: list[str] = Field(
|
|
58
|
-
default_factory=list,
|
|
59
|
-
title="Deny Write Paths",
|
|
60
|
-
examples=[[".env", "secrets/"]],
|
|
61
|
-
)
|
|
62
|
-
"""Paths denied within allowed write paths."""
|
|
63
|
-
|
|
64
|
-
def to_srt_settings(self) -> dict[str, dict[str, Any]]:
|
|
65
|
-
"""Convert to srt-settings.json format."""
|
|
66
|
-
return {
|
|
67
|
-
"network": {
|
|
68
|
-
"allowedDomains": self.allowed_domains,
|
|
69
|
-
"deniedDomains": self.denied_domains,
|
|
70
|
-
"allowUnixSockets": self.allow_unix_sockets,
|
|
71
|
-
"allowAllUnixSockets": self.allow_all_unix_sockets,
|
|
72
|
-
"allowLocalBinding": self.allow_local_binding,
|
|
73
|
-
},
|
|
74
|
-
"filesystem": {
|
|
75
|
-
"denyRead": self.deny_read,
|
|
76
|
-
"allowWrite": self.allow_write,
|
|
77
|
-
"denyWrite": self.deny_write,
|
|
78
|
-
},
|
|
79
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|