ms-enclave 0.0.0__py3-none-any.whl → 0.0.2__py3-none-any.whl
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.
Potentially problematic release.
This version of ms-enclave might be problematic. Click here for more details.
- ms_enclave/__init__.py +2 -2
- ms_enclave/cli/__init__.py +1 -0
- ms_enclave/cli/base.py +20 -0
- ms_enclave/cli/cli.py +27 -0
- ms_enclave/cli/start_server.py +84 -0
- ms_enclave/sandbox/__init__.py +27 -0
- ms_enclave/sandbox/boxes/__init__.py +16 -0
- ms_enclave/sandbox/boxes/base.py +270 -0
- ms_enclave/sandbox/boxes/docker_notebook.py +214 -0
- ms_enclave/sandbox/boxes/docker_sandbox.py +317 -0
- ms_enclave/sandbox/manager/__init__.py +11 -0
- ms_enclave/sandbox/manager/base.py +155 -0
- ms_enclave/sandbox/manager/http_manager.py +405 -0
- ms_enclave/sandbox/manager/local_manager.py +295 -0
- ms_enclave/sandbox/model/__init__.py +21 -0
- ms_enclave/sandbox/model/base.py +36 -0
- ms_enclave/sandbox/model/config.py +97 -0
- ms_enclave/sandbox/model/requests.py +57 -0
- ms_enclave/sandbox/model/responses.py +57 -0
- ms_enclave/sandbox/server/__init__.py +0 -0
- ms_enclave/sandbox/server/server.py +195 -0
- ms_enclave/sandbox/tools/__init__.py +4 -0
- ms_enclave/sandbox/tools/base.py +95 -0
- ms_enclave/sandbox/tools/sandbox_tool.py +46 -0
- ms_enclave/sandbox/tools/sandbox_tools/__init__.py +4 -0
- ms_enclave/sandbox/tools/sandbox_tools/file_operation.py +331 -0
- ms_enclave/sandbox/tools/sandbox_tools/notebook_executor.py +167 -0
- ms_enclave/sandbox/tools/sandbox_tools/python_executor.py +87 -0
- ms_enclave/sandbox/tools/sandbox_tools/shell_executor.py +63 -0
- ms_enclave/sandbox/tools/tool_info.py +141 -0
- ms_enclave/utils/__init__.py +1 -0
- ms_enclave/utils/json_schema.py +208 -0
- ms_enclave/utils/logger.py +170 -0
- ms_enclave/version.py +2 -2
- ms_enclave-0.0.2.dist-info/METADATA +366 -0
- ms_enclave-0.0.2.dist-info/RECORD +40 -0
- {ms_enclave-0.0.0.dist-info → ms_enclave-0.0.2.dist-info}/WHEEL +1 -1
- ms_enclave-0.0.2.dist-info/entry_points.txt +2 -0
- ms_enclave/run_server.py +0 -21
- ms_enclave-0.0.0.dist-info/METADATA +0 -329
- ms_enclave-0.0.0.dist-info/RECORD +0 -8
- {ms_enclave-0.0.0.dist-info → ms_enclave-0.0.2.dist-info}/licenses/LICENSE +0 -0
- {ms_enclave-0.0.0.dist-info → ms_enclave-0.0.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ms-enclave
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Modularized and Stable Sandbox runtime environment.
|
|
5
|
+
Author: ModelScope team
|
|
6
|
+
Author-email: contact@modelscope.cn
|
|
7
|
+
License: Apache License 2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/modelscope/ms-enclave
|
|
9
|
+
Keywords: python,llm,sandbox
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: fastapi>=0.104.0
|
|
14
|
+
Requires-Dist: uvicorn[standard]>=0.24.0
|
|
15
|
+
Requires-Dist: openai
|
|
16
|
+
Requires-Dist: pydantic>=2.11.7
|
|
17
|
+
Requires-Dist: requests>=2.32.4
|
|
18
|
+
Requires-Dist: shortuuid>=1.0.13
|
|
19
|
+
Requires-Dist: aiohttp>=3.8.1
|
|
20
|
+
Requires-Dist: docstring-parser
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=8.3.5; extra == "dev"
|
|
23
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pre-commit>=4.2.0; extra == "dev"
|
|
25
|
+
Requires-Dist: jupyter-book>=1.0.4.post1; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
|
|
27
|
+
Provides-Extra: docker
|
|
28
|
+
Requires-Dist: docker>=7.1.0; extra == "docker"
|
|
29
|
+
Requires-Dist: websocket-client; extra == "docker"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<br>
|
|
34
|
+
<img src="doc/asset/image/logo.png"/>
|
|
35
|
+
<br>
|
|
36
|
+
<p>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<a href="README_zh.md">中文</a>   |   English  
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center">
|
|
43
|
+
<img src="https://img.shields.io/badge/python-%E2%89%A53.10-5be.svg">
|
|
44
|
+
<a href="https://badge.fury.io/py/ms-enclave"><img src="https://badge.fury.io/py/ms-enclave.svg" alt="PyPI version" height="18"></a>
|
|
45
|
+
<a href="https://pypi.org/project/ms-enclave"><img alt="PyPI - Downloads" src="https://static.pepy.tech/badge/ms-enclave"></a>
|
|
46
|
+
<a href="https://github.com/modelscope/ms-enclave/pulls"><img src="https://img.shields.io/badge/PR-welcome-55EB99.svg"></a>
|
|
47
|
+
<p>
|
|
48
|
+
|
|
49
|
+
## Overview
|
|
50
|
+
|
|
51
|
+
ms-enclave is a modular and stable agent sandbox runtime environment that provides a secure isolated execution environment for applications. It achieves strong isolation through Docker containers, with accompanying local/HTTP managers and an extensible tool system, enabling you to safely and efficiently execute code in a controlled environment.
|
|
52
|
+
|
|
53
|
+
- 🔒 Secure Isolation: Full isolation and resource limitation based on Docker
|
|
54
|
+
- 🧩 Modular: Extensible sandbox and tools (registration factory)
|
|
55
|
+
- ⚡ Stable Performance: Simple implementation, fast startup, lifecycle management
|
|
56
|
+
- 🌐 Remote Management: Built-in FastAPI service, supports HTTP management
|
|
57
|
+
- 🔧 Tool System: Standardized tools enabled by sandbox type (OpenAI-style schema)
|
|
58
|
+
|
|
59
|
+
## System Requirements
|
|
60
|
+
|
|
61
|
+
- Python >= 3.10
|
|
62
|
+
- Operating System: Linux, macOS, or Windows with Docker support
|
|
63
|
+
- Docker daemon running locally (Notebook sandbox requires port 8888 open)
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
### Install from PyPI
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install ms-enclave
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Install from Source
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/modelscope/ms-enclave.git
|
|
77
|
+
cd ms-enclave
|
|
78
|
+
pip install -e .
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Quick Start: Minimal Example (SandboxFactory)
|
|
82
|
+
|
|
83
|
+
> Tools need to be explicitly enabled in the tools_config setting, otherwise they won't be registered.
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
import asyncio
|
|
87
|
+
from ms_enclave.sandbox.boxes import SandboxFactory
|
|
88
|
+
from ms_enclave.sandbox.model import DockerSandboxConfig, SandboxType
|
|
89
|
+
|
|
90
|
+
async def main():
|
|
91
|
+
config = DockerSandboxConfig(
|
|
92
|
+
image='python:3.11-slim',
|
|
93
|
+
memory_limit='512m',
|
|
94
|
+
tools_config={
|
|
95
|
+
'python_executor': {},
|
|
96
|
+
'file_operation': {},
|
|
97
|
+
'shell_executor': {}
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
async with SandboxFactory.create_sandbox(SandboxType.DOCKER, config) as sandbox:
|
|
102
|
+
# 1) Write a file
|
|
103
|
+
await sandbox.execute_tool('file_operation', {
|
|
104
|
+
'operation': 'write', 'file_path': '/sandbox/hello.txt', 'content': 'hi from enclave'
|
|
105
|
+
})
|
|
106
|
+
# 2) Execute Python code
|
|
107
|
+
result = await sandbox.execute_tool('python_executor', {
|
|
108
|
+
'code': "print('Hello from sandbox!')\nprint(open('/sandbox/hello.txt').read())"
|
|
109
|
+
})
|
|
110
|
+
print(result.output)
|
|
111
|
+
|
|
112
|
+
asyncio.run(main())
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Typical Usage Scenarios and Examples
|
|
118
|
+
|
|
119
|
+
- Directly using SandboxFactory: Create/destroy sandboxes in a single process—lightweight; suitable for scripts or one-off tasks
|
|
120
|
+
- Using LocalSandboxManager: Manage the lifecycle/cleanup of multiple sandboxes locally; suitable for service-oriented or multi-task parallel scenarios
|
|
121
|
+
- Using HttpSandboxManager: Unified sandbox management through remote HTTP services; suitable for cross-machine/distributed or more isolated deployments
|
|
122
|
+
|
|
123
|
+
### 1) Direct Sandbox Creation: SandboxFactory (Lightweight, Temporary)
|
|
124
|
+
|
|
125
|
+
Usage Scenarios:
|
|
126
|
+
|
|
127
|
+
- Temporarily execute code in scripts or microservices
|
|
128
|
+
- Fine-grained control over sandbox lifecycle (cleanup upon context exit)
|
|
129
|
+
|
|
130
|
+
Example (Docker Sandbox + Python Execution):
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
import asyncio
|
|
134
|
+
from ms_enclave.sandbox.boxes import SandboxFactory
|
|
135
|
+
from ms_enclave.sandbox.model import DockerSandboxConfig, SandboxType
|
|
136
|
+
|
|
137
|
+
async def main():
|
|
138
|
+
cfg = DockerSandboxConfig(
|
|
139
|
+
tools_config={'python_executor': {}}
|
|
140
|
+
)
|
|
141
|
+
async with SandboxFactory.create_sandbox(SandboxType.DOCKER, cfg) as sb:
|
|
142
|
+
r = await sb.execute_tool('python_executor', {
|
|
143
|
+
'code': 'import platform; print(platform.python_version())'
|
|
144
|
+
})
|
|
145
|
+
print(r.output)
|
|
146
|
+
|
|
147
|
+
asyncio.run(main())
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 2) Local Unified Management: LocalSandboxManager (Multi-Sandbox, Lifecycle Management)
|
|
151
|
+
|
|
152
|
+
Usage Scenarios:
|
|
153
|
+
|
|
154
|
+
- Create/manage multiple sandboxes within the same process (creation, query, stop, periodic cleanup)
|
|
155
|
+
- Unified view for monitoring stats and health
|
|
156
|
+
|
|
157
|
+
Example:
|
|
158
|
+
|
|
159
|
+
```python
|
|
160
|
+
import asyncio
|
|
161
|
+
from ms_enclave.sandbox.manager import LocalSandboxManager
|
|
162
|
+
from ms_enclave.sandbox.model import DockerSandboxConfig, SandboxType
|
|
163
|
+
|
|
164
|
+
async def main():
|
|
165
|
+
async with LocalSandboxManager() as manager:
|
|
166
|
+
cfg = DockerSandboxConfig(tools_config={'shell_executor': {}})
|
|
167
|
+
sandbox_id = await manager.create_sandbox(SandboxType.DOCKER, cfg)
|
|
168
|
+
|
|
169
|
+
# Execute command
|
|
170
|
+
res = await manager.execute_tool(sandbox_id, 'shell_executor', {'command': 'echo hello'})
|
|
171
|
+
print(res.output.strip()) # hello
|
|
172
|
+
|
|
173
|
+
# View list
|
|
174
|
+
infos = await manager.list_sandboxes()
|
|
175
|
+
print([i.id for i in infos])
|
|
176
|
+
|
|
177
|
+
# Stop and delete
|
|
178
|
+
await manager.stop_sandbox(sandbox_id)
|
|
179
|
+
await manager.delete_sandbox(sandbox_id)
|
|
180
|
+
|
|
181
|
+
asyncio.run(main())
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 3) Remote Unified Management: HttpSandboxManager (Cross-Machine/Isolated Deployment)
|
|
185
|
+
|
|
186
|
+
Usage Scenarios:
|
|
187
|
+
|
|
188
|
+
- Run sandbox services on dedicated hosts/containers, invoke remotely via HTTP
|
|
189
|
+
- Share a secure controlled sandbox cluster among multiple applications
|
|
190
|
+
|
|
191
|
+
Start the service (choose one):
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Option A: Command line
|
|
195
|
+
ms-enclave server --host 0.0.0.0 --port 8000
|
|
196
|
+
|
|
197
|
+
# Option B: Python script
|
|
198
|
+
python -c "from ms_enclave.sandbox import create_server; create_server().run(host='0.0.0.0', port=8000)"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Client Example:
|
|
202
|
+
|
|
203
|
+
```python
|
|
204
|
+
import asyncio
|
|
205
|
+
from ms_enclave.sandbox.manager import HttpSandboxManager
|
|
206
|
+
from ms_enclave.sandbox.model import DockerSandboxConfig, SandboxType
|
|
207
|
+
|
|
208
|
+
async def main():
|
|
209
|
+
async with HttpSandboxManager(base_url='http://127.0.0.1:8000') as m:
|
|
210
|
+
cfg = DockerSandboxConfig(tools_config={'python_executor': {}})
|
|
211
|
+
sid = await m.create_sandbox(SandboxType.DOCKER, cfg)
|
|
212
|
+
r = await m.execute_tool(sid, 'python_executor', {'code': 'print("Hello remote")'})
|
|
213
|
+
print(r.output)
|
|
214
|
+
await m.delete_sandbox(sid)
|
|
215
|
+
|
|
216
|
+
asyncio.run(main())
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Sandbox Types and Tool Support
|
|
222
|
+
|
|
223
|
+
Currently Supported Sandbox Types:
|
|
224
|
+
|
|
225
|
+
- DOCKER (General-purpose container execution)
|
|
226
|
+
- Supported tools:
|
|
227
|
+
- python_executor (execute Python code)
|
|
228
|
+
- shell_executor (execute Shell commands)
|
|
229
|
+
- file_operation (read/write/delete/list files)
|
|
230
|
+
- Features: Configurable memory/CPU limits, volume mounts, network toggling, privileged mode, port mapping
|
|
231
|
+
|
|
232
|
+
- DOCKER_NOTEBOOK (Jupyter Kernel Gateway environment)
|
|
233
|
+
- Supported tools:
|
|
234
|
+
- notebook_executor (execute code via Jupyter Kernel, supports context saving)
|
|
235
|
+
- Note: This type only loads notebook_executor; other DOCKER-specific tools won't be enabled in this sandbox.
|
|
236
|
+
- Dependencies: Requires port 8888 exposed and network enabled
|
|
237
|
+
|
|
238
|
+
Tool Loading Rules:
|
|
239
|
+
|
|
240
|
+
- Tools are initialized and made available only when explicitly declared in `tools_config`.
|
|
241
|
+
- Tools validate `required_sandbox_type`; unmatched types will be ignored automatically.
|
|
242
|
+
|
|
243
|
+
Example:
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
DockerSandboxConfig(tools_config={'python_executor': {}, 'shell_executor': {}, 'file_operation': {}})
|
|
247
|
+
DockerNotebookConfig(tools_config={'notebook_executor': {}})
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Common Configuration Options
|
|
253
|
+
|
|
254
|
+
- `image`: Docker image name (e.g., `python:3.11-slim` or `jupyter-kernel-gateway`)
|
|
255
|
+
- `memory_limit`: Memory limit (e.g., `512m` / `1g`)
|
|
256
|
+
- `cpu_limit`: CPU limit (float > 0)
|
|
257
|
+
- `volumes`: Volume mounts, e.g., `{host_path: {"bind": "/container/path", "mode": "rw"}}`
|
|
258
|
+
- `ports`: Port mappings, e.g., `{ "8888/tcp": ("127.0.0.1", 8888) }`
|
|
259
|
+
- `network_enabled`: Enable network (Notebook sandbox requires True)
|
|
260
|
+
- `remove_on_exit`: Automatically remove container on exit (default True)
|
|
261
|
+
|
|
262
|
+
**Example of Installing Additional Dependencies in Sandbox**
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
async with SandboxFactory.create_sandbox(SandboxType.DOCKER, config) as sandbox:
|
|
266
|
+
# 1) Write a file
|
|
267
|
+
requirements_file = '/sandbox/requirements.txt'
|
|
268
|
+
await sandbox.execute_tool('file_operation', {
|
|
269
|
+
'operation': 'write', 'file_path': f'{requirements_file}', 'content': 'numpy\npandas\nmodelscope\n'
|
|
270
|
+
})
|
|
271
|
+
# 2) Execute Python code
|
|
272
|
+
result = await sandbox.execute_tool('python_executor', {
|
|
273
|
+
'code': f"print('Hello from sandbox!')\nprint(open(f'{requirements_file}').read())"
|
|
274
|
+
})
|
|
275
|
+
print(result.output)
|
|
276
|
+
|
|
277
|
+
# 3) Execute CLI
|
|
278
|
+
result_cli = await sandbox.execute_command(f'pip install -r {requirements_file}')
|
|
279
|
+
print(result_cli.stdout, flush=True)
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Example of Reading and Writing Host Files in Sandbox**
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
async with LocalSandboxManager() as manager:
|
|
286
|
+
# Create sandbox
|
|
287
|
+
config = DockerSandboxConfig(
|
|
288
|
+
# image='python-sandbox',
|
|
289
|
+
image='python:3.11-slim',
|
|
290
|
+
tools_config={'python_executor': {}, 'file_operation': {}},
|
|
291
|
+
volumes={'~/Code/ms-enclave/output': {'bind': '/sandbox/data', 'mode': 'rw'}}
|
|
292
|
+
)
|
|
293
|
+
sandbox_id = await manager.create_sandbox(SandboxType.DOCKER, config)
|
|
294
|
+
|
|
295
|
+
# Write file
|
|
296
|
+
result = await manager.execute_tool(
|
|
297
|
+
sandbox_id, 'file_operation', {'operation': 'write', 'file_path': '/sandbox/data/hello.txt', 'content': 'Hello, Sandbox!'}
|
|
298
|
+
)
|
|
299
|
+
print(result.model_dump())
|
|
300
|
+
```
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Error Handling and Debugging
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
result = await sandbox.execute_tool('python_executor', {'code': 'print(1/0)'})
|
|
307
|
+
if result.error:
|
|
308
|
+
print('Error:', result.error)
|
|
309
|
+
else:
|
|
310
|
+
print('Output:', result.output)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Development and Testing
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
# Clone the repository
|
|
319
|
+
git clone https://github.com/modelscope/ms-enclave.git
|
|
320
|
+
cd ms-enclave
|
|
321
|
+
|
|
322
|
+
# Setup virtual environment
|
|
323
|
+
python -m venv venv
|
|
324
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
325
|
+
|
|
326
|
+
# Install dependencies
|
|
327
|
+
pip install -e ".[dev]"
|
|
328
|
+
|
|
329
|
+
# Run tests
|
|
330
|
+
pytest
|
|
331
|
+
|
|
332
|
+
# Run examples (provided in the repository)
|
|
333
|
+
python examples/sandbox_usage_examples.py
|
|
334
|
+
python examples/local_manager_example.py
|
|
335
|
+
python examples/server_manager_example.py
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Available Tools
|
|
341
|
+
|
|
342
|
+
- `python_executor`: Execute Python code (DOCKER)
|
|
343
|
+
- `shell_executor`: Execute Shell commands (DOCKER)
|
|
344
|
+
- `file_operation`: Read/Write/Delete/List files (DOCKER)
|
|
345
|
+
- `notebook_executor`: Execute via Jupyter Kernel (DOCKER_NOTEBOOK)
|
|
346
|
+
- You can also register custom tools via the Tool factory (`@register_tool`).
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Contribution
|
|
351
|
+
|
|
352
|
+
We welcome contributions! Please check [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
|
353
|
+
|
|
354
|
+
### Steps to Contribute
|
|
355
|
+
|
|
356
|
+
1. Fork the repository
|
|
357
|
+
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
358
|
+
3. Develop and add tests
|
|
359
|
+
4. Run local tests: `pytest`
|
|
360
|
+
5. Commit changes: `git commit -m 'Add amazing feature'`
|
|
361
|
+
6. Push the branch: `git push origin feature/amazing-feature`
|
|
362
|
+
7. Submit a Pull Request
|
|
363
|
+
|
|
364
|
+
## License
|
|
365
|
+
|
|
366
|
+
This project is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
ms_enclave/__init__.py,sha256=IKXP5d9APyqXs14IU1mBKSr8tGxAwxeCtCnAWTOGhAU,98
|
|
2
|
+
ms_enclave/version.py,sha256=WqqLptwhThO-50eN9GEdqDPEtMsOV0svfTEXxTezYvE,63
|
|
3
|
+
ms_enclave/cli/__init__.py,sha256=I_ANdxdcIHpkIzIXc1yKOlWwzb4oY0FwTPq1kYtgzQw,50
|
|
4
|
+
ms_enclave/cli/base.py,sha256=m1DFlF16L0Lyrn0YNuFj8ByGjVJIoI0jKzAoodIXjRk,404
|
|
5
|
+
ms_enclave/cli/cli.py,sha256=AoSPw65_7OBMT8qgv5vPz1S3Fo91Y6yluaDGGHbUDj0,693
|
|
6
|
+
ms_enclave/cli/start_server.py,sha256=FPmZ97MhWgsyXkl0y32D4XjhAak5Ogrt0Am3izRdi74,2858
|
|
7
|
+
ms_enclave/sandbox/__init__.py,sha256=OPU_W5fZE98IQ8_pAaYkN66R8TZw435Co8uw9oAyZo4,783
|
|
8
|
+
ms_enclave/sandbox/boxes/__init__.py,sha256=it3KgV8cAU4a1TQbiRz-kg7GgI5xA0nqhEAwEgUnpnQ,356
|
|
9
|
+
ms_enclave/sandbox/boxes/base.py,sha256=lLjktdh4YQABr7X-lTLne2VN2Uv6Rcc5TN5LYx_NLxc,8532
|
|
10
|
+
ms_enclave/sandbox/boxes/docker_notebook.py,sha256=-6O54MRNpiGAaQTiI9_1LCl0zzvB2se2_M1Bi8FuZ3s,7989
|
|
11
|
+
ms_enclave/sandbox/boxes/docker_sandbox.py,sha256=ouFPtJyoSeZrQKD61Qyhq13QSuZl1Ut2gD1KgBbKPUs,11755
|
|
12
|
+
ms_enclave/sandbox/manager/__init__.py,sha256=juYJsmpRoCThcILPemx6VGU-brpNF4cbu1FPV-d-tNc,255
|
|
13
|
+
ms_enclave/sandbox/manager/base.py,sha256=nXznN8Yysgkgk8i-yfL29gAh2gBi3sdxPlQciTXnN9g,3848
|
|
14
|
+
ms_enclave/sandbox/manager/http_manager.py,sha256=heVehKDi_VMJ5g9BllzmK5o68c2WIagsl8e231SKWtc,15731
|
|
15
|
+
ms_enclave/sandbox/manager/local_manager.py,sha256=lv7vF9sNOThOPnCz9RzNTcD0pZHoNTVldVanfF7c5Io,9402
|
|
16
|
+
ms_enclave/sandbox/model/__init__.py,sha256=3Sbj5Id77MWOZ1IXHGbu2q5U_p5KMLKvwZEr1QwjUqg,550
|
|
17
|
+
ms_enclave/sandbox/model/base.py,sha256=1X5PaCUC5B5GXVCTzQMybqF7t0QEhWUkYFC-DyYXdhY,709
|
|
18
|
+
ms_enclave/sandbox/model/config.py,sha256=afiSu5QcaZsd36lSoWMDmzz6o6kxTGebHzAqgLQOG_w,4616
|
|
19
|
+
ms_enclave/sandbox/model/requests.py,sha256=JDcANsACotKscWrLs0H_-J8BKEhALUNgmJnoy6_JZuA,2336
|
|
20
|
+
ms_enclave/sandbox/model/responses.py,sha256=AZ_BspRHzlqIP7xjI9XnoeQasIzJqMV8Qmdw23-KAwA,2502
|
|
21
|
+
ms_enclave/sandbox/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
ms_enclave/sandbox/server/server.py,sha256=SrSxl_C-4IudD5fXbi_cJ9EUv6A0EqxGmW9Opw4lsQE,7029
|
|
23
|
+
ms_enclave/sandbox/tools/__init__.py,sha256=McNOuC9E9Xsckp7vOAxv9TP5q6XEIUAsLbnme3kSvJI,167
|
|
24
|
+
ms_enclave/sandbox/tools/base.py,sha256=vLTJMFOQnfKyTyMMcgeq5f7KBFEFV5y7PFZmb4Ss0KE,2555
|
|
25
|
+
ms_enclave/sandbox/tools/sandbox_tool.py,sha256=iATkvNax7aae53ZnmMwmQDuDb5qcXEUI-aPXD5eVfzo,1370
|
|
26
|
+
ms_enclave/sandbox/tools/tool_info.py,sha256=A3RZLETWG9834J7r2KZfG6_JdV4UWnrFKSrEBfeCLHE,5223
|
|
27
|
+
ms_enclave/sandbox/tools/sandbox_tools/__init__.py,sha256=Mtm2jQTrztLbRVDBiitogIB3GdIrwF3Hwk5KlruyntQ,176
|
|
28
|
+
ms_enclave/sandbox/tools/sandbox_tools/file_operation.py,sha256=3yqkMdx_yrHUM4oyhd5WQm_tSV3o1-JwmBeVoIwaLfE,13348
|
|
29
|
+
ms_enclave/sandbox/tools/sandbox_tools/notebook_executor.py,sha256=kZf9QA0yk-aFOJjtAbzYdKfNwjcoBSrscT9mWsv906w,6029
|
|
30
|
+
ms_enclave/sandbox/tools/sandbox_tools/python_executor.py,sha256=SlhenlO09B_eVfcnrqSZAVYC_JCMws0eXj-caR2BTmw,3259
|
|
31
|
+
ms_enclave/sandbox/tools/sandbox_tools/shell_executor.py,sha256=d5qPv6O1K1V91fsGAf9MiArcRuLtjFWEthi4iwtmAEE,2263
|
|
32
|
+
ms_enclave/utils/__init__.py,sha256=KYWYfti4m8TcWzjOfmollEfEArTgTasq2Zuaz9AkzZI,31
|
|
33
|
+
ms_enclave/utils/json_schema.py,sha256=hBhdMilb9_7JZaFZBb_THPrq8N4m_rJPD43mfwnTx14,7431
|
|
34
|
+
ms_enclave/utils/logger.py,sha256=Hg_iVhgUX39LlWiQsvCyDx9NwQt3wQUukbOSCiLYEQU,5974
|
|
35
|
+
ms_enclave-0.0.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
36
|
+
ms_enclave-0.0.2.dist-info/METADATA,sha256=Pqe2xTBcURL8-edgOc9wBSo7SAUb8L2gjcURrqqYvyU,12016
|
|
37
|
+
ms_enclave-0.0.2.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
|
38
|
+
ms_enclave-0.0.2.dist-info/entry_points.txt,sha256=Av3oIAE91Jj-742sTPA90ktrrq8lDowFC2RfXLwM8JM,58
|
|
39
|
+
ms_enclave-0.0.2.dist-info/top_level.txt,sha256=V_Q9rBOF-RGwACDP9ppukoyjaOtpjdht7dhe7StS86A,11
|
|
40
|
+
ms_enclave-0.0.2.dist-info/RECORD,,
|
ms_enclave/run_server.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"""Server startup script."""
|
|
2
|
-
|
|
3
|
-
from ms_enclave.sandbox import create_server
|
|
4
|
-
from ms_enclave.utils import get_logger
|
|
5
|
-
|
|
6
|
-
logger = get_logger()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def main():
|
|
10
|
-
"""Run the sandbox server."""
|
|
11
|
-
server = create_server(cleanup_interval=300) # 5 minutes
|
|
12
|
-
|
|
13
|
-
logger.info('Starting Sandbox Server...')
|
|
14
|
-
logger.info('API docs: http://localhost:8000/docs')
|
|
15
|
-
logger.info('Health check: http://localhost:8000/health')
|
|
16
|
-
|
|
17
|
-
server.run(host='0.0.0.0', port=8000, log_level='info')
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if __name__ == '__main__':
|
|
21
|
-
main()
|