sycommon-python-lib 0.2.0b32__tar.gz → 0.2.1a0__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.
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/pyproject.toml +1 -1
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/__init__.py +15 -0
- sycommon_python_lib-0.2.1a0/src/sycommon/agent/sandbox/__init__.py +91 -0
- sycommon_python_lib-0.2.1a0/src/sycommon/agent/sandbox/file_ops.py +132 -0
- sycommon_python_lib-0.2.1a0/src/sycommon/agent/sandbox/http_sandbox_backend.py +215 -0
- sycommon_python_lib-0.2.1a0/src/sycommon/agent/sandbox/sandbox_pool.py +267 -0
- sycommon_python_lib-0.2.1a0/src/sycommon/agent/sandbox/session.py +82 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/get_llm.py +1 -1
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/middleware.py +6 -2
- sycommon_python_lib-0.2.1a0/src/sycommon/middleware/sandbox.py +540 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/timeout.py +1 -1
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/services.py +12 -5
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tests/deep_agent_server.py +1 -1
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tests/test_deep_agent.py +47 -17
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/merge_headers.py +21 -3
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon_python_lib.egg-info/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon_python_lib.egg-info/SOURCES.txt +6 -2
- sycommon_python_lib-0.2.0b32/src/sycommon/tests/skills/web-search/helpers/formatter.py +0 -207
- sycommon_python_lib-0.2.0b32/src/sycommon/tests/skills/web-search/helpers/query_builder.py +0 -144
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/README.md +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/setup.cfg +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/cli.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/core/console.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/core/models.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/core/project.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/core/utils.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/templates/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/templates/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/templates/base/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/command/templates/web/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/01_basic_agent.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/02_tool_agent.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/03_structured_output.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/04_memory_agent.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/05_streaming.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/06_multi_agent.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/07_skills_agent.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/08_middleware.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/09_interrupt.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/10_custom_llm.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/11_complex_workflow.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/12_batch_processing.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/01_basic_monitoring.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/02_permission_control.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/03_tool_skill_filter.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/04_caching_retry.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/05_sanitization.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/06_tracking.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/07_advanced.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/08_progressive_skills.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/middleware/override_examples.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/examples/virtual_employee_demo.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/exports.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/get_agent.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/skills/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/skills/examples/faq_handler/scripts/search.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/skills/exports.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/agent/virtual_employee.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/Config.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/ElasticsearchConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/LLMConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/RedisConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/config/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/async_database_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/database_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/elasticsearch_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/redis_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/database/token_usage_db_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/health/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/heartbeat_process/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/heartbeat_process/heartbeat_config.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/heartbeat_process/heartbeat_process_manager.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/heartbeat_process/heartbeat_process_worker.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/embedding.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/llm_tokens.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/llm_with_token_tracking.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/native_with_fallback_runnable.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/output_fixing_runnable.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/struct_token.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/sy_langfuse.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/token_usage_es_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/token_usage_mysql_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/llm/usage_token.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/kafka_log.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/process_logger.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/mq.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/sso_user.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/token_usage.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/models/token_usage_mysql.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/notice/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/process_pool_consumer.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/sentry/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/sse/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/sse/sse.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/feign.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/feign_client.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/nacos_client_base.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/nacos_config_manager.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/nacos_service.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/nacos_service_discovery.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/nacos_service_registration.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tests/test_email.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tests/test_mq.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/async_utils.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/env.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/syemail.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon_python_lib.egg-info/requires.txt +0 -0
- {sycommon_python_lib-0.2.0b32 → sycommon_python_lib-0.2.1a0}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
|
@@ -6,6 +6,15 @@ sycommon.agent - DeepAgents 便捷封装
|
|
|
6
6
|
|
|
7
7
|
from sycommon.agent.exports import *
|
|
8
8
|
|
|
9
|
+
# 沙箱模块
|
|
10
|
+
from sycommon.agent.sandbox import (
|
|
11
|
+
HTTPSandboxBackend,
|
|
12
|
+
SandboxPool,
|
|
13
|
+
SandboxInstance,
|
|
14
|
+
areset_all_sandboxes,
|
|
15
|
+
aget_sandbox_status,
|
|
16
|
+
)
|
|
17
|
+
|
|
9
18
|
__all__ = [
|
|
10
19
|
# 主要接口
|
|
11
20
|
"get_agent",
|
|
@@ -35,4 +44,10 @@ __all__ = [
|
|
|
35
44
|
# 技能系统中间件
|
|
36
45
|
"SkillsMiddleware",
|
|
37
46
|
"SkillMetadata",
|
|
47
|
+
# 沙箱模块
|
|
48
|
+
"HTTPSandboxBackend",
|
|
49
|
+
"SandboxPool",
|
|
50
|
+
"SandboxInstance",
|
|
51
|
+
"areset_all_sandboxes",
|
|
52
|
+
"aget_sandbox_status",
|
|
38
53
|
]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""
|
|
2
|
+
沙箱模块
|
|
3
|
+
|
|
4
|
+
提供远程沙箱容器的连接和管理能力,支持通过 Nacos 服务发现。
|
|
5
|
+
|
|
6
|
+
架构说明:
|
|
7
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
8
|
+
│ 调用服务 │
|
|
9
|
+
│ │
|
|
10
|
+
│ HTTPSandboxBackend.from_nacos("sandbox-service") │
|
|
11
|
+
│ │ │
|
|
12
|
+
│ ▼ │
|
|
13
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
14
|
+
│ │ Nacos │ │
|
|
15
|
+
│ │ 负责服务发现 + 负载均衡 │ │
|
|
16
|
+
│ │ │ │
|
|
17
|
+
│ │ sandbox-service: │ │
|
|
18
|
+
│ │ - 192.168.1.100:8080 (实例1) │ │
|
|
19
|
+
│ │ - 192.168.1.101:8080 (实例2) │ │
|
|
20
|
+
│ │ - 192.168.1.102:8080 (实例3) │ │
|
|
21
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
22
|
+
│ │ │
|
|
23
|
+
│ Nacos 轮询返回一个实例 │
|
|
24
|
+
│ ▼ │
|
|
25
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
26
|
+
│ │ 沙箱容器 (多副本) │ │
|
|
27
|
+
│ │ │ │
|
|
28
|
+
│ │ 每个容器运行 sandbox_server.py │ │
|
|
29
|
+
│ │ 提供命令执行、文件操作 API │ │
|
|
30
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
31
|
+
└─────────────────────────────────────────────────────────────┘
|
|
32
|
+
|
|
33
|
+
使用示例:
|
|
34
|
+
|
|
35
|
+
# 方式 1: 获取单个沙箱(推荐,Nacos 负责负载均衡)
|
|
36
|
+
from sycommon.agent.sandbox import HTTPSandboxBackend
|
|
37
|
+
|
|
38
|
+
sandbox = HTTPSandboxBackend.from_nacos("sandbox-service", user_id="user123")
|
|
39
|
+
result = await sandbox.aexecute("python --version")
|
|
40
|
+
|
|
41
|
+
# 方式 2: 普通用户重置自己的工作目录
|
|
42
|
+
await sandbox.areset() # 仅重置 /workspace/user123/
|
|
43
|
+
|
|
44
|
+
# 方式 3: 管理员批量管理所有沙箱
|
|
45
|
+
from sycommon.agent.sandbox import SandboxPool
|
|
46
|
+
|
|
47
|
+
pool = await SandboxPool.from_nacos("sandbox-service", is_admin=True)
|
|
48
|
+
print(await pool.astatus()) # 查看所有实例状态
|
|
49
|
+
await pool.areset_all() # 重置所有沙箱(需要管理员权限)
|
|
50
|
+
|
|
51
|
+
# 方式 4: 配合 Agent 使用
|
|
52
|
+
from deepagents import create_deep_agent
|
|
53
|
+
from sycommon.agent.sandbox import HTTPSandboxBackend
|
|
54
|
+
|
|
55
|
+
sandbox = HTTPSandboxBackend.from_nacos("sandbox-service", user_id="user123")
|
|
56
|
+
agent = create_deep_agent(
|
|
57
|
+
model="openai:gpt-4o",
|
|
58
|
+
backend=sandbox,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# 方式 5: 启用沙箱服务(在其他项目中)
|
|
62
|
+
from fastapi import FastAPI
|
|
63
|
+
from sycommon.services import Services
|
|
64
|
+
|
|
65
|
+
app = Services.plugins(
|
|
66
|
+
app=FastAPI(),
|
|
67
|
+
sandbox_service=True, # 启用沙箱服务
|
|
68
|
+
...
|
|
69
|
+
)
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
from sycommon.agent.sandbox.http_sandbox_backend import HTTPSandboxBackend
|
|
73
|
+
from sycommon.agent.sandbox.sandbox_pool import (
|
|
74
|
+
SandboxPool,
|
|
75
|
+
SandboxInstance,
|
|
76
|
+
areset_all_sandboxes,
|
|
77
|
+
aget_sandbox_status,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
# 后端
|
|
82
|
+
"HTTPSandboxBackend",
|
|
83
|
+
|
|
84
|
+
# 池管理
|
|
85
|
+
"SandboxPool",
|
|
86
|
+
"SandboxInstance",
|
|
87
|
+
|
|
88
|
+
# 便捷函数
|
|
89
|
+
"areset_all_sandboxes",
|
|
90
|
+
"aget_sandbox_status",
|
|
91
|
+
]
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""
|
|
2
|
+
沙箱文件操作 Mixin
|
|
3
|
+
|
|
4
|
+
提供文件相关的异步操作方法
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import base64
|
|
8
|
+
from typing import List, TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
from sycommon.logging.kafka_log import SYLogger
|
|
11
|
+
from deepagents.backends.protocol import (
|
|
12
|
+
FileInfo,
|
|
13
|
+
GrepMatch,
|
|
14
|
+
WriteResult,
|
|
15
|
+
EditResult,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from sycommon.agent.sandbox.http_sandbox_backend import HTTPSandboxBackend
|
|
20
|
+
|
|
21
|
+
# 沙箱 API 路径前缀
|
|
22
|
+
SANDBOX_API_PREFIX = "/v1/sandbox"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class FileOperationsMixin:
|
|
26
|
+
"""文件操作 Mixin(仅异步)"""
|
|
27
|
+
|
|
28
|
+
_timeout: int # 类型提示,子类需要提供此属性
|
|
29
|
+
user_id: str # 类型提示,子类需要提供此属性
|
|
30
|
+
|
|
31
|
+
async def _post_async(self: "HTTPSandboxBackend", endpoint: str, data: dict, timeout: int = None) -> dict:
|
|
32
|
+
"""发送异步 POST 请求"""
|
|
33
|
+
...
|
|
34
|
+
|
|
35
|
+
# ============== 目录操作 ==============
|
|
36
|
+
|
|
37
|
+
async def als_info(self: "HTTPSandboxBackend", path: str) -> List[FileInfo]:
|
|
38
|
+
"""异步列出目录内容"""
|
|
39
|
+
SYLogger.info(f"[Sandbox] 列出目录: {path}")
|
|
40
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/ls", {
|
|
41
|
+
"path": path,
|
|
42
|
+
"user_id": self.user_id
|
|
43
|
+
})
|
|
44
|
+
items = [FileInfo(**item) for item in result]
|
|
45
|
+
SYLogger.info(f"[Sandbox] 目录内容: {len(items)} 项")
|
|
46
|
+
return items
|
|
47
|
+
|
|
48
|
+
# ============== 文件读写 ==============
|
|
49
|
+
|
|
50
|
+
async def aread(self: "HTTPSandboxBackend", file_path: str, offset: int = 0, limit: int = 2000) -> str:
|
|
51
|
+
"""异步读取文件内容"""
|
|
52
|
+
SYLogger.info(f"[Sandbox] 读取文件: {file_path} (offset={offset}, limit={limit})")
|
|
53
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/read", {
|
|
54
|
+
"file_path": file_path,
|
|
55
|
+
"user_id": self.user_id,
|
|
56
|
+
"offset": offset,
|
|
57
|
+
"limit": limit
|
|
58
|
+
})
|
|
59
|
+
if result.get("error"):
|
|
60
|
+
SYLogger.error(f"[Sandbox] 读取文件失败: {result['error']}")
|
|
61
|
+
return f"Error: {result['error']}"
|
|
62
|
+
content = result.get("content", "")
|
|
63
|
+
SYLogger.info(f"[Sandbox] 读取完成: {len(content)} 字符")
|
|
64
|
+
return content
|
|
65
|
+
|
|
66
|
+
async def awrite(self: "HTTPSandboxBackend", file_path: str, content: str) -> WriteResult:
|
|
67
|
+
"""异步写入文件"""
|
|
68
|
+
SYLogger.info(f"[Sandbox] 写入文件: {file_path} ({len(content)} 字符)")
|
|
69
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/write", {
|
|
70
|
+
"file_path": file_path,
|
|
71
|
+
"content": base64.b64encode(content.encode()).decode(),
|
|
72
|
+
"user_id": self.user_id
|
|
73
|
+
})
|
|
74
|
+
write_result = WriteResult(
|
|
75
|
+
error=result.get("error"),
|
|
76
|
+
path=result.get("path")
|
|
77
|
+
)
|
|
78
|
+
if write_result.error:
|
|
79
|
+
SYLogger.error(f"[Sandbox] 写入失败: {write_result.error}")
|
|
80
|
+
else:
|
|
81
|
+
SYLogger.info(f"[Sandbox] 写入成功: {write_result.path}")
|
|
82
|
+
return write_result
|
|
83
|
+
|
|
84
|
+
async def aedit(
|
|
85
|
+
self: "HTTPSandboxBackend",
|
|
86
|
+
file_path: str,
|
|
87
|
+
old_string: str,
|
|
88
|
+
new_string: str,
|
|
89
|
+
replace_all: bool = False
|
|
90
|
+
) -> EditResult:
|
|
91
|
+
"""异步编辑文件"""
|
|
92
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/edit", {
|
|
93
|
+
"file_path": file_path,
|
|
94
|
+
"old_string": base64.b64encode(old_string.encode()).decode(),
|
|
95
|
+
"new_string": base64.b64encode(new_string.encode()).decode(),
|
|
96
|
+
"user_id": self.user_id,
|
|
97
|
+
"replace_all": replace_all
|
|
98
|
+
})
|
|
99
|
+
return EditResult(
|
|
100
|
+
error=result.get("error"),
|
|
101
|
+
path=result.get("path"),
|
|
102
|
+
occurrences=result.get("occurrences")
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# ============== 搜索 ==============
|
|
106
|
+
|
|
107
|
+
async def aglob_info(self: "HTTPSandboxBackend", pattern: str, path: str = "/") -> List[FileInfo]:
|
|
108
|
+
"""异步 glob 搜索文件"""
|
|
109
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/glob", {
|
|
110
|
+
"pattern": pattern,
|
|
111
|
+
"path": path,
|
|
112
|
+
"user_id": self.user_id
|
|
113
|
+
})
|
|
114
|
+
return [FileInfo(**item) for item in result]
|
|
115
|
+
|
|
116
|
+
async def agrep_raw(
|
|
117
|
+
self: "HTTPSandboxBackend",
|
|
118
|
+
pattern: str,
|
|
119
|
+
path: str = None,
|
|
120
|
+
glob: str = None
|
|
121
|
+
) -> List[GrepMatch] | str:
|
|
122
|
+
"""异步搜索文件内容"""
|
|
123
|
+
try:
|
|
124
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/grep", {
|
|
125
|
+
"pattern": pattern,
|
|
126
|
+
"user_id": self.user_id,
|
|
127
|
+
"path": path,
|
|
128
|
+
"glob": glob
|
|
129
|
+
})
|
|
130
|
+
return [GrepMatch(**item) for item in result]
|
|
131
|
+
except Exception as e:
|
|
132
|
+
return f"Error: {e}"
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"""
|
|
2
|
+
HTTP 客户端沙箱后端
|
|
3
|
+
|
|
4
|
+
通过 HTTP API 连接远程沙箱容器,支持 Nacos 服务发现
|
|
5
|
+
仅提供异步方法,使用 aiohttp 实现
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import base64
|
|
9
|
+
from typing import Optional, List
|
|
10
|
+
|
|
11
|
+
from sycommon.logging.kafka_log import SYLogger
|
|
12
|
+
from sycommon.agent.sandbox.session import get_async_session
|
|
13
|
+
from sycommon.agent.sandbox.file_ops import FileOperationsMixin, SANDBOX_API_PREFIX
|
|
14
|
+
|
|
15
|
+
from deepagents.backends.protocol import (
|
|
16
|
+
BackendProtocol,
|
|
17
|
+
ExecuteResponse,
|
|
18
|
+
FileDownloadResponse,
|
|
19
|
+
FileUploadResponse,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class HTTPSandboxBackend(FileOperationsMixin, BackendProtocol):
|
|
24
|
+
"""
|
|
25
|
+
通过 HTTP API 连接远程沙箱容器(仅异步)
|
|
26
|
+
|
|
27
|
+
支持两种模式:
|
|
28
|
+
1. 直接 URL: 直接指定沙箱服务地址
|
|
29
|
+
2. Nacos 服务发现: 通过服务名从 Nacos 获取实例
|
|
30
|
+
|
|
31
|
+
使用示例:
|
|
32
|
+
# 直接 URL 模式
|
|
33
|
+
backend = HTTPSandboxBackend(
|
|
34
|
+
base_url="http://192.168.1.100:8080",
|
|
35
|
+
user_id="user123"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# Nacos 服务发现模式
|
|
39
|
+
backend = HTTPSandboxBackend.from_nacos(
|
|
40
|
+
service_name="sandbox-service",
|
|
41
|
+
user_id="user123"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# 异步调用
|
|
45
|
+
result = await backend.aexecute("python --version")
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
def __init__(self, base_url: str, user_id: str, timeout: int = 120):
|
|
49
|
+
"""
|
|
50
|
+
初始化 HTTP 沙箱后端
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
base_url: 沙箱服务地址,如 http://192.168.1.100:8080
|
|
54
|
+
user_id: 用户ID,用于隔离工作目录
|
|
55
|
+
timeout: 默认超时时间(秒)
|
|
56
|
+
"""
|
|
57
|
+
self._base_url = base_url.rstrip("/")
|
|
58
|
+
self._user_id = user_id
|
|
59
|
+
self._timeout = timeout
|
|
60
|
+
|
|
61
|
+
# 生成 ID
|
|
62
|
+
self._id = self._base_url.replace(
|
|
63
|
+
"http://", ""
|
|
64
|
+
).replace(
|
|
65
|
+
"https://", ""
|
|
66
|
+
).replace(
|
|
67
|
+
":", "-"
|
|
68
|
+
).replace(
|
|
69
|
+
"/", "-"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
@classmethod
|
|
73
|
+
def from_nacos(
|
|
74
|
+
cls,
|
|
75
|
+
service_name: str,
|
|
76
|
+
user_id: str,
|
|
77
|
+
group: str = "DEFAULT_GROUP",
|
|
78
|
+
version: str = None,
|
|
79
|
+
timeout: int = 120,
|
|
80
|
+
) -> "HTTPSandboxBackend":
|
|
81
|
+
"""
|
|
82
|
+
从 Nacos 服务发现创建后端实例
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
service_name: Nacos 服务名
|
|
86
|
+
user_id: 用户ID,用于隔离工作目录
|
|
87
|
+
group: 服务分组
|
|
88
|
+
version: 服务版本
|
|
89
|
+
timeout: 超时时间
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
HTTPSandboxBackend 实例
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
RuntimeError: 无法发现服务实例
|
|
96
|
+
"""
|
|
97
|
+
from sycommon.synacos.nacos_service import NacosService
|
|
98
|
+
|
|
99
|
+
nacos_manager = NacosService(None)
|
|
100
|
+
instances = nacos_manager.get_service_instances(
|
|
101
|
+
service_name, group=group, target_version=version
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
if not instances:
|
|
105
|
+
raise RuntimeError(f"服务 [{service_name}] 无可用实例")
|
|
106
|
+
|
|
107
|
+
instance = instances[0]
|
|
108
|
+
base_url = f"http://{instance['ip']}:{instance['port']}"
|
|
109
|
+
|
|
110
|
+
SYLogger.info(f"Nacos 发现沙箱服务: {service_name} -> {base_url}")
|
|
111
|
+
|
|
112
|
+
return cls(base_url=base_url, user_id=user_id, timeout=timeout)
|
|
113
|
+
|
|
114
|
+
# ============== 内部方法 ==============
|
|
115
|
+
|
|
116
|
+
async def _post_async(self, endpoint: str, data: dict, timeout: int = None) -> dict:
|
|
117
|
+
"""发送异步 POST 请求"""
|
|
118
|
+
import aiohttp
|
|
119
|
+
session = get_async_session()
|
|
120
|
+
async with session.post(
|
|
121
|
+
f"{self._base_url}{endpoint}",
|
|
122
|
+
json=data,
|
|
123
|
+
timeout=aiohttp.ClientTimeout(total=(timeout or self._timeout) + 10)
|
|
124
|
+
) as resp:
|
|
125
|
+
resp.raise_for_status()
|
|
126
|
+
return await resp.json()
|
|
127
|
+
|
|
128
|
+
# ============== 属性 ==============
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def id(self) -> str:
|
|
132
|
+
"""沙箱 ID"""
|
|
133
|
+
return self._id
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def base_url(self) -> str:
|
|
137
|
+
"""服务基础 URL"""
|
|
138
|
+
return self._base_url
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def user_id(self) -> str:
|
|
142
|
+
"""用户ID"""
|
|
143
|
+
return self._user_id
|
|
144
|
+
|
|
145
|
+
# ============== 执行命令 ==============
|
|
146
|
+
|
|
147
|
+
async def aexecute(self, command: str, *, timeout: int = None) -> ExecuteResponse:
|
|
148
|
+
"""异步执行 shell 命令"""
|
|
149
|
+
SYLogger.info(f"[Sandbox] 执行命令: {command}")
|
|
150
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/execute", {
|
|
151
|
+
"command": command,
|
|
152
|
+
"user_id": self._user_id,
|
|
153
|
+
"timeout": timeout or self._timeout
|
|
154
|
+
})
|
|
155
|
+
response = ExecuteResponse(
|
|
156
|
+
output=result["output"],
|
|
157
|
+
exit_code=result["exit_code"],
|
|
158
|
+
truncated=result.get("truncated", False)
|
|
159
|
+
)
|
|
160
|
+
SYLogger.info(f"[Sandbox] 执行完成: exit_code={response.exit_code}, output={response.output[:500] if response.output else 'None'}...")
|
|
161
|
+
return response
|
|
162
|
+
|
|
163
|
+
# ============== 批量操作 ==============
|
|
164
|
+
|
|
165
|
+
async def aupload_files(self, files: List[tuple[str, bytes]]) -> List[FileUploadResponse]:
|
|
166
|
+
"""异步上传多个文件"""
|
|
167
|
+
results = []
|
|
168
|
+
for path, content in files:
|
|
169
|
+
try:
|
|
170
|
+
result = await self._post_async(f"{SANDBOX_API_PREFIX}/upload", {
|
|
171
|
+
"path": path,
|
|
172
|
+
"content": base64.b64encode(content).decode(),
|
|
173
|
+
"user_id": self._user_id
|
|
174
|
+
})
|
|
175
|
+
results.append(FileUploadResponse(
|
|
176
|
+
path=result["path"],
|
|
177
|
+
error=result.get("error")
|
|
178
|
+
))
|
|
179
|
+
except Exception as e:
|
|
180
|
+
results.append(FileUploadResponse(path=path, error=str(e)))
|
|
181
|
+
return results
|
|
182
|
+
|
|
183
|
+
async def adownload_files(self, paths: List[str]) -> List[FileDownloadResponse]:
|
|
184
|
+
"""异步下载多个文件"""
|
|
185
|
+
results = []
|
|
186
|
+
for path in paths:
|
|
187
|
+
try:
|
|
188
|
+
result = await self._post_async(
|
|
189
|
+
f"{SANDBOX_API_PREFIX}/download",
|
|
190
|
+
{"path": path, "user_id": self._user_id}
|
|
191
|
+
)
|
|
192
|
+
if result.get("error"):
|
|
193
|
+
results.append(FileDownloadResponse(
|
|
194
|
+
path=path,
|
|
195
|
+
error=result["error"]
|
|
196
|
+
))
|
|
197
|
+
else:
|
|
198
|
+
content = base64.b64decode(result["content"])
|
|
199
|
+
results.append(FileDownloadResponse(path=path, content=content))
|
|
200
|
+
except Exception as e:
|
|
201
|
+
results.append(FileDownloadResponse(path=path, error=str(e)))
|
|
202
|
+
return results
|
|
203
|
+
|
|
204
|
+
# ============== 管理操作 ==============
|
|
205
|
+
|
|
206
|
+
async def areset(self) -> dict:
|
|
207
|
+
"""异步重置沙箱环境"""
|
|
208
|
+
return await self._post_async(f"{SANDBOX_API_PREFIX}/reset", {"user_id": self._user_id})
|
|
209
|
+
|
|
210
|
+
async def ahealth_check(self) -> dict:
|
|
211
|
+
"""异步健康检查"""
|
|
212
|
+
# 健康检查不需要 user_id
|
|
213
|
+
async with get_async_session().get(f"{self._base_url}{SANDBOX_API_PREFIX}/health") as resp:
|
|
214
|
+
resp.raise_for_status()
|
|
215
|
+
return await resp.json()
|