sycommon-python-lib 0.2.2a11__tar.gz → 0.2.2a13__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.2a11 → sycommon_python_lib-0.2.2a13}/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/pyproject.toml +1 -1
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/file_ops.py +30 -28
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/http_sandbox_backend.py +75 -98
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/services.py +4 -16
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon_python_lib.egg-info/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/README.md +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/setup.cfg +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/cli.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/core/console.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/core/models.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/core/project.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/core/utils.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/agent/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/agent/main_agent.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/agent/nodes/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/agent/nodes/example_node.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/agent/states/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/agent/states/agent_state.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/api/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/api/query.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/api/sse/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/api/sse/agent.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/db/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/db/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/db/model/entity.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/db/service.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/model/parse.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/agent/tools/mq.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/.env.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/.gitignore.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/Dockerfile.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/app.yaml.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/client/FileServiceClient.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/model/file_info.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/base/requirements.txt.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/commands/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/commands/hello.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/pyproject.toml.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/cli/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/api/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/api/echo.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/api/sse/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/api/sse/echo.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/web/tools/mq.py.tpl +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/nexus/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/__main__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/agents/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/agents/factory.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/agents/prompts.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/browser.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/console.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/dom.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/network.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/page_errors.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/performance.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/capabilities/screenshot.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/client.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/protocol.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cdp/repl.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/cli.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/cdp_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/chat_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/create_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/evaluate_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/init_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/memory_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/resume_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/rollback_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/commands/run_cmd.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/backend.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/config.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/display.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/git_integration.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/llm.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/core/state.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/evaluate/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/evaluate/api_evaluator.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/memory/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/memory/compressor.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/memory/full.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/memory/hot.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/memory/manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/memory/warm.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/mode/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/mode/create.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/mode/optimize.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/models/config_models.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/baseline_tests.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/checkpoint.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/convergence.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/diagnosis.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/engine.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/environment.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/experience.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/harness_prompts.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/history.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/optimization_logger.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/pre_validation.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/reward.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/strategy_bandit.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/strategy_generator.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/rl/strategy_prompts.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycli/skills/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/agent_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/chat_events.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/deep_agent.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/multi_agent_team.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/sandbox_pool.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/sandbox_recovery.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/session.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/auth/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/auth/ldap_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/auth/wecom_ldap_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/Config.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/ElasticsearchConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/LLMConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/RedisConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/XxlJobConfig.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/config/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/async_database_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/database_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/elasticsearch_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/redis_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/database/token_usage_db_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/health/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/heartbeat_process/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/heartbeat_process/heartbeat_config.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/heartbeat_process/heartbeat_process_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/heartbeat_process/heartbeat_process_worker.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/embedding.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/get_llm.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/llm_tokens.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/llm_with_token_tracking.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/native_with_fallback_runnable.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/output_fixing_runnable.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/struct_token.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/sy_langfuse.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/token_usage_es_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/token_usage_mysql_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/llm/usage_token.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/kafka_log.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/process_logger.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/background_execution.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/middleware.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/mq.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/sandbox.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/timeout.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/token_tracking.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/sandbox.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/sso_user.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/token_usage.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/token_usage_mysql.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/models/xxljob_handler_config.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/notice/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/process_pool_consumer.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/sentry/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/sse/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/sse/sse.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/feign.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/feign_client.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/nacos_client_base.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/nacos_config_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/nacos_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/nacos_service_discovery.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/nacos_service_registration.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tests/deep_agent_server.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tests/test_deep_agent.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tests/test_email.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tests/test_mq.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/async_utils.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/env.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/merge_headers.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/syemail.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/xxljob/__init__.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/xxljob/xxljob_service.py +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon_python_lib.egg-info/SOURCES.txt +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon_python_lib.egg-info/requires.txt +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
- {sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/tests/test_sycli.py +0 -0
{sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/sycommon/agent/sandbox/file_ops.py
RENAMED
|
@@ -196,7 +196,7 @@ class FileOperationsMixin:
|
|
|
196
196
|
SYLogger.error(f"[Sandbox] 列出目录失败: {e}")
|
|
197
197
|
return LsResult(error=str(e))
|
|
198
198
|
|
|
199
|
-
async def als(self: "HTTPSandboxBackend", path: str) -> LsResult:
|
|
199
|
+
async def als(self: "HTTPSandboxBackend", path: str, *, timeout: int = None) -> LsResult:
|
|
200
200
|
"""异步列出目录内容"""
|
|
201
201
|
try:
|
|
202
202
|
await self._ensure_synced_async()
|
|
@@ -204,7 +204,7 @@ class FileOperationsMixin:
|
|
|
204
204
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/ls", {
|
|
205
205
|
"path": path,
|
|
206
206
|
"user_id": self.user_id
|
|
207
|
-
})
|
|
207
|
+
}, timeout=timeout)
|
|
208
208
|
entries = [FileInfo(**item) for item in result]
|
|
209
209
|
SYLogger.info(f"[Sandbox] 目录内容: {len(entries)} 项")
|
|
210
210
|
return LsResult(entries=entries)
|
|
@@ -251,8 +251,10 @@ class FileOperationsMixin:
|
|
|
251
251
|
file_path: str,
|
|
252
252
|
offset: int = 0,
|
|
253
253
|
limit: int = 2000,
|
|
254
|
+
*,
|
|
255
|
+
timeout: int = None,
|
|
254
256
|
) -> ReadResult:
|
|
255
|
-
"""
|
|
257
|
+
"""异步读取文件内容"""
|
|
256
258
|
try:
|
|
257
259
|
await self._ensure_synced_async()
|
|
258
260
|
SYLogger.info(
|
|
@@ -262,7 +264,7 @@ class FileOperationsMixin:
|
|
|
262
264
|
"user_id": self.user_id,
|
|
263
265
|
"offset": offset,
|
|
264
266
|
"limit": limit
|
|
265
|
-
})
|
|
267
|
+
}, timeout=timeout)
|
|
266
268
|
if result.get("error"):
|
|
267
269
|
SYLogger.error(f"[Sandbox] 异步读取文件失败: {result['error']}")
|
|
268
270
|
return ReadResult(error=result["error"])
|
|
@@ -309,8 +311,10 @@ class FileOperationsMixin:
|
|
|
309
311
|
self: "HTTPSandboxBackend",
|
|
310
312
|
file_path: str,
|
|
311
313
|
content: str,
|
|
314
|
+
*,
|
|
315
|
+
timeout: int = None,
|
|
312
316
|
) -> WriteResult:
|
|
313
|
-
"""
|
|
317
|
+
"""异步写入文件"""
|
|
314
318
|
try:
|
|
315
319
|
await self._ensure_synced_async()
|
|
316
320
|
SYLogger.info(f"[Sandbox] 异步写入文件: {file_path} ({len(content)} 字符)")
|
|
@@ -318,7 +322,7 @@ class FileOperationsMixin:
|
|
|
318
322
|
"file_path": file_path,
|
|
319
323
|
"content": base64.b64encode(content.encode()).decode(),
|
|
320
324
|
"user_id": self.user_id
|
|
321
|
-
})
|
|
325
|
+
}, timeout=timeout)
|
|
322
326
|
write_result = WriteResult(
|
|
323
327
|
error=result.get("error"),
|
|
324
328
|
path=result.get("path")
|
|
@@ -364,8 +368,10 @@ class FileOperationsMixin:
|
|
|
364
368
|
old_string: str,
|
|
365
369
|
new_string: str,
|
|
366
370
|
replace_all: bool = False,
|
|
371
|
+
*,
|
|
372
|
+
timeout: int = None,
|
|
367
373
|
) -> EditResult:
|
|
368
|
-
"""
|
|
374
|
+
"""异步编辑文件"""
|
|
369
375
|
try:
|
|
370
376
|
await self._ensure_synced_async()
|
|
371
377
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/edit", {
|
|
@@ -374,7 +380,7 @@ class FileOperationsMixin:
|
|
|
374
380
|
"new_string": base64.b64encode(new_string.encode()).decode(),
|
|
375
381
|
"user_id": self.user_id,
|
|
376
382
|
"replace_all": replace_all
|
|
377
|
-
})
|
|
383
|
+
}, timeout=timeout)
|
|
378
384
|
return EditResult(
|
|
379
385
|
error=result.get("error"),
|
|
380
386
|
path=result.get("path"),
|
|
@@ -401,15 +407,15 @@ class FileOperationsMixin:
|
|
|
401
407
|
SYLogger.error(f"[Sandbox] glob 搜索失败: {e}")
|
|
402
408
|
return GlobResult(error=str(e))
|
|
403
409
|
|
|
404
|
-
async def aglob(self: "HTTPSandboxBackend", pattern: str, path: str = "/") -> GlobResult:
|
|
405
|
-
"""异步 glob
|
|
410
|
+
async def aglob(self: "HTTPSandboxBackend", pattern: str, path: str = "/", *, timeout: int = None) -> GlobResult:
|
|
411
|
+
"""异步 glob 搜索文件"""
|
|
406
412
|
try:
|
|
407
413
|
await self._ensure_synced_async()
|
|
408
414
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/glob", {
|
|
409
415
|
"pattern": pattern,
|
|
410
416
|
"path": path,
|
|
411
417
|
"user_id": self.user_id
|
|
412
|
-
})
|
|
418
|
+
}, timeout=timeout)
|
|
413
419
|
matches = [FileInfo(**item) for item in result]
|
|
414
420
|
return GlobResult(matches=matches)
|
|
415
421
|
except Exception as e:
|
|
@@ -438,7 +444,7 @@ class FileOperationsMixin:
|
|
|
438
444
|
SYLogger.error(f"[Sandbox] tree 失败: {e}")
|
|
439
445
|
return TreeResult(error=str(e))
|
|
440
446
|
|
|
441
|
-
async def atree(self: "HTTPSandboxBackend", path: str = "/", max_depth: int = 30, max_files: int = 0) -> TreeResult:
|
|
447
|
+
async def atree(self: "HTTPSandboxBackend", path: str = "/", max_depth: int = 30, max_files: int = 0, *, timeout: int = None) -> TreeResult:
|
|
442
448
|
"""异步以树形结构展示目录"""
|
|
443
449
|
try:
|
|
444
450
|
await self._ensure_synced_async()
|
|
@@ -448,7 +454,7 @@ class FileOperationsMixin:
|
|
|
448
454
|
"user_id": self.user_id,
|
|
449
455
|
"max_depth": max_depth,
|
|
450
456
|
"max_files": max_files,
|
|
451
|
-
})
|
|
457
|
+
}, timeout=timeout)
|
|
452
458
|
if result.get("error"):
|
|
453
459
|
return TreeResult(error=result["error"])
|
|
454
460
|
tree_node = TreeNode(
|
|
@@ -486,8 +492,10 @@ class FileOperationsMixin:
|
|
|
486
492
|
pattern: str,
|
|
487
493
|
path: str = None,
|
|
488
494
|
glob: str = None,
|
|
495
|
+
*,
|
|
496
|
+
timeout: int = None,
|
|
489
497
|
) -> GrepResult:
|
|
490
|
-
"""
|
|
498
|
+
"""异步搜索文件内容"""
|
|
491
499
|
try:
|
|
492
500
|
await self._ensure_synced_async()
|
|
493
501
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/grep", {
|
|
@@ -495,7 +503,7 @@ class FileOperationsMixin:
|
|
|
495
503
|
"user_id": self.user_id,
|
|
496
504
|
"path": path,
|
|
497
505
|
"glob": glob
|
|
498
|
-
})
|
|
506
|
+
}, timeout=timeout)
|
|
499
507
|
if isinstance(result, list):
|
|
500
508
|
matches = [GrepMatch(**item) for item in result]
|
|
501
509
|
return GrepResult(matches=matches)
|
|
@@ -545,16 +553,10 @@ class FileOperationsMixin:
|
|
|
545
553
|
self: "HTTPSandboxBackend",
|
|
546
554
|
path: str,
|
|
547
555
|
recursive: bool = False,
|
|
556
|
+
*,
|
|
557
|
+
timeout: int = None,
|
|
548
558
|
) -> DeleteResult:
|
|
549
|
-
"""异步删除文件或文件夹
|
|
550
|
-
|
|
551
|
-
Args:
|
|
552
|
-
path: 要删除的文件或文件夹路径
|
|
553
|
-
recursive: 是否递归删除(删除文件夹时需要设为 True)
|
|
554
|
-
|
|
555
|
-
Returns:
|
|
556
|
-
DeleteResult
|
|
557
|
-
"""
|
|
559
|
+
"""异步删除文件或文件夹"""
|
|
558
560
|
try:
|
|
559
561
|
await self._ensure_synced_async()
|
|
560
562
|
SYLogger.info(f"[Sandbox] 异步删除: {path} (recursive={recursive})")
|
|
@@ -562,7 +564,7 @@ class FileOperationsMixin:
|
|
|
562
564
|
"path": path,
|
|
563
565
|
"user_id": self.user_id,
|
|
564
566
|
"recursive": recursive,
|
|
565
|
-
})
|
|
567
|
+
}, timeout=timeout)
|
|
566
568
|
delete_result = DeleteResult(
|
|
567
569
|
path=result.get("path", path),
|
|
568
570
|
error=result.get("error"),
|
|
@@ -578,15 +580,15 @@ class FileOperationsMixin:
|
|
|
578
580
|
|
|
579
581
|
# ============== 文件存在检查 ==============
|
|
580
582
|
|
|
581
|
-
async def astat(self: "HTTPSandboxBackend", path: str) -> "StatResult":
|
|
582
|
-
"""
|
|
583
|
+
async def astat(self: "HTTPSandboxBackend", path: str, *, timeout: int = None) -> "StatResult":
|
|
584
|
+
"""异步检查文件或目录状态"""
|
|
583
585
|
try:
|
|
584
586
|
await self._ensure_synced_async()
|
|
585
587
|
SYLogger.info(f"[Sandbox] 异步查询文件状态: {path}")
|
|
586
588
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/stat", {
|
|
587
589
|
"path": path,
|
|
588
590
|
"user_id": self.user_id
|
|
589
|
-
})
|
|
591
|
+
}, timeout=timeout)
|
|
590
592
|
return StatResult(
|
|
591
593
|
path=result.get("path", path),
|
|
592
594
|
exists=result.get("exists", False),
|
|
@@ -121,9 +121,6 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
121
121
|
"/", "-"
|
|
122
122
|
)
|
|
123
123
|
|
|
124
|
-
# 共享 aiohttp session(延迟创建,在 __del__ / aclose 中关闭)
|
|
125
|
-
self._aiohttp_session: Optional[aiohttp.ClientSession] = None
|
|
126
|
-
|
|
127
124
|
@classmethod
|
|
128
125
|
def from_nacos(
|
|
129
126
|
cls,
|
|
@@ -344,33 +341,8 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
344
341
|
|
|
345
342
|
# ============== 内部方法 - 异步版本 ==============
|
|
346
343
|
|
|
347
|
-
async def _get_aiohttp_session(self) -> aiohttp.ClientSession:
|
|
348
|
-
"""获取或创建共享 aiohttp session"""
|
|
349
|
-
if self._aiohttp_session is None or self._aiohttp_session.closed:
|
|
350
|
-
connector = aiohttp.TCPConnector(ssl=_SSL_CONTEXT)
|
|
351
|
-
self._aiohttp_session = aiohttp.ClientSession(connector=connector)
|
|
352
|
-
return self._aiohttp_session
|
|
353
|
-
|
|
354
|
-
async def aclose(self):
|
|
355
|
-
"""关闭共享 aiohttp session"""
|
|
356
|
-
if self._aiohttp_session and not self._aiohttp_session.closed:
|
|
357
|
-
await self._aiohttp_session.close()
|
|
358
|
-
self._aiohttp_session = None
|
|
359
|
-
|
|
360
|
-
def __del__(self):
|
|
361
|
-
# best-effort close; asyncio loop may already be gone
|
|
362
|
-
if self._aiohttp_session and not self._aiohttp_session.closed:
|
|
363
|
-
try:
|
|
364
|
-
loop = asyncio.get_event_loop()
|
|
365
|
-
if loop.is_running():
|
|
366
|
-
loop.create_task(self._aiohttp_session.close())
|
|
367
|
-
else:
|
|
368
|
-
loop.run_until_complete(self._aiohttp_session.close())
|
|
369
|
-
except Exception:
|
|
370
|
-
pass
|
|
371
|
-
|
|
372
344
|
async def _post_async(self, endpoint: str, data: dict, timeout: int = None) -> dict:
|
|
373
|
-
"""
|
|
345
|
+
"""异步 POST 请求(每次创建独立 session,避免跨 Task 共享导致超时上下文错误)"""
|
|
374
346
|
actual_timeout = timeout if timeout is not None else self._timeout
|
|
375
347
|
if "/execute" in endpoint:
|
|
376
348
|
http_timeout = actual_timeout + 60
|
|
@@ -385,10 +357,10 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
385
357
|
url = f"{self._base_url}{endpoint}"
|
|
386
358
|
SYLogger.info(f"[Sandbox] Async POST 请求开始: {url}, timeout={http_timeout}s")
|
|
387
359
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
async
|
|
391
|
-
async with session.post(url, json=data, headers=headers) as resp:
|
|
360
|
+
timeout_obj = aiohttp.ClientTimeout(total=http_timeout)
|
|
361
|
+
connector = aiohttp.TCPConnector(ssl=_SSL_CONTEXT)
|
|
362
|
+
async with aiohttp.ClientSession(connector=connector) as session:
|
|
363
|
+
async with session.post(url, json=data, headers=headers, timeout=timeout_obj) as resp:
|
|
392
364
|
SYLogger.info(f"[Sandbox] Async POST 响应状态码: {resp.status}")
|
|
393
365
|
if resp.status >= 400:
|
|
394
366
|
text = await resp.text()
|
|
@@ -398,8 +370,6 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
398
370
|
SYLogger.info(f"[Sandbox] Async POST 成功: {url}")
|
|
399
371
|
return result
|
|
400
372
|
|
|
401
|
-
return await asyncio.wait_for(_do_request(), timeout=http_timeout)
|
|
402
|
-
|
|
403
373
|
async def _post_async_with_failover(self, endpoint: str, data: dict, timeout: int = None) -> dict:
|
|
404
374
|
"""带故障转移的异步 POST 请求"""
|
|
405
375
|
max_retries = 3
|
|
@@ -486,15 +456,17 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
486
456
|
# 从沙箱服务端 health 接口获取(aiohttp 异步)
|
|
487
457
|
try:
|
|
488
458
|
url = f"{self._base_url}{SANDBOX_API_PREFIX}/health"
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
459
|
+
connector = aiohttp.TCPConnector(ssl=_SSL_CONTEXT)
|
|
460
|
+
timeout_obj = aiohttp.ClientTimeout(total=10)
|
|
461
|
+
async with aiohttp.ClientSession(connector=connector) as session:
|
|
462
|
+
async with session.get(url, timeout=timeout_obj) as resp:
|
|
463
|
+
if resp.status == 200:
|
|
464
|
+
data = await resp.json()
|
|
465
|
+
workspace = data.get("workspace", "")
|
|
466
|
+
if workspace:
|
|
467
|
+
self._workspace_root = workspace
|
|
468
|
+
SYLogger.info(f"[Sandbox] 从沙箱服务端获取 WORKSPACE_ROOT={workspace}")
|
|
469
|
+
return self._workspace_root
|
|
498
470
|
except Exception as e:
|
|
499
471
|
SYLogger.warning(f"[Sandbox] 异步获取沙箱 workspace 失败: {e}")
|
|
500
472
|
|
|
@@ -557,7 +529,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
557
529
|
truncated=False
|
|
558
530
|
)
|
|
559
531
|
|
|
560
|
-
async def _sync_async(self) -> dict:
|
|
532
|
+
async def _sync_async(self, *, timeout: int = None) -> dict:
|
|
561
533
|
"""同步目录(异步版本)
|
|
562
534
|
|
|
563
535
|
sync_dirs 条目支持两种格式:
|
|
@@ -587,14 +559,14 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
587
559
|
|
|
588
560
|
if is_dir:
|
|
589
561
|
SYLogger.info(f"[Sandbox] 开始上传目录: {local_path}")
|
|
590
|
-
result = await self._upload_directory_async(str(local_dir), remote_path, mode=mode)
|
|
562
|
+
result = await self._upload_directory_async(str(local_dir), remote_path, mode=mode, timeout=timeout)
|
|
591
563
|
results[local_path] = result
|
|
592
564
|
SYLogger.info(f"[Sandbox] 目录上传完成: {local_path}, 成功={result['success']}, 失败={result['failed']}")
|
|
593
565
|
else:
|
|
594
566
|
# 单文件
|
|
595
567
|
SYLogger.info(f"[Sandbox] 上传单文件: {local_path}")
|
|
596
568
|
content = await asyncio.to_thread(lambda: open(local_dir, "rb").read())
|
|
597
|
-
upload_results = await self.aupload_files([(remote_path, content)])
|
|
569
|
+
upload_results = await self.aupload_files([(remote_path, content)], timeout=timeout)
|
|
598
570
|
if upload_results[0].error:
|
|
599
571
|
results[local_path] = {"success": 0, "failed": 1, "errors": [{"path": remote_path, "error": upload_results[0].error}]}
|
|
600
572
|
else:
|
|
@@ -604,7 +576,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
604
576
|
SYLogger.info("[Sandbox] _sync_async 完成")
|
|
605
577
|
return results
|
|
606
578
|
|
|
607
|
-
async def _upload_directory_async(self, local_dir: str, remote_path: str = "/", *, mode: str = "full") -> dict:
|
|
579
|
+
async def _upload_directory_async(self, local_dir: str, remote_path: str = "/", *, mode: str = "full", timeout: int = None) -> dict:
|
|
608
580
|
"""上传整个目录到沙箱(异步版本)
|
|
609
581
|
|
|
610
582
|
Args:
|
|
@@ -633,7 +605,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
633
605
|
ls_result = await self._post_async(f"{SANDBOX_API_PREFIX}/ls", {
|
|
634
606
|
"path": remote_path,
|
|
635
607
|
"user_id": self._user_id
|
|
636
|
-
})
|
|
608
|
+
}, timeout=timeout)
|
|
637
609
|
if ls_result and not ls_result.get("error"):
|
|
638
610
|
for item in ls_result.get("files", ls_result.get("children", [])):
|
|
639
611
|
if item.get("is_dir", False):
|
|
@@ -702,7 +674,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
702
674
|
return items
|
|
703
675
|
batch_items = await asyncio.to_thread(_read_batch)
|
|
704
676
|
|
|
705
|
-
upload_results = await self.aupload_files(batch_items)
|
|
677
|
+
upload_results = await self.aupload_files(batch_items, timeout=timeout)
|
|
706
678
|
for r in upload_results:
|
|
707
679
|
if r.error:
|
|
708
680
|
all_results.append({"ok": False, "path": r.path, "error": r.error})
|
|
@@ -742,71 +714,74 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
742
714
|
await self._ensure_synced_async()
|
|
743
715
|
actual_timeout = timeout if timeout is not None else self._timeout
|
|
744
716
|
url = f"{self._base_url}{SANDBOX_API_PREFIX}/execute_stream"
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
async with
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
resp
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
717
|
+
timeout_obj = aiohttp.ClientTimeout(total=actual_timeout + 60)
|
|
718
|
+
connector = aiohttp.TCPConnector(ssl=_SSL_CONTEXT)
|
|
719
|
+
async with aiohttp.ClientSession(connector=connector) as session:
|
|
720
|
+
async with session.post(url, json={
|
|
721
|
+
"command": command.strip(),
|
|
722
|
+
"user_id": self._user_id,
|
|
723
|
+
"timeout": actual_timeout
|
|
724
|
+
}, timeout=timeout_obj) as resp:
|
|
725
|
+
resp.raise_for_status()
|
|
726
|
+
buffer = ""
|
|
727
|
+
async for chunk in resp.content.iter_any():
|
|
728
|
+
buffer += chunk.decode('utf-8', errors='replace')
|
|
729
|
+
while "\n\n" in buffer:
|
|
730
|
+
event_str, buffer = buffer.split("\n\n", 1)
|
|
731
|
+
for line in event_str.strip().split("\n"):
|
|
732
|
+
if line.startswith("data: "):
|
|
733
|
+
import json
|
|
734
|
+
yield json.loads(line[6:])
|
|
735
|
+
|
|
736
|
+
async def aexecute_background(self, command: str, *, timeout: int = None) -> dict:
|
|
764
737
|
"""异步后台执行 shell 命令(服务端负责路径隔离)"""
|
|
765
738
|
await self._ensure_synced_async()
|
|
739
|
+
actual_timeout = timeout if timeout is not None else 600
|
|
766
740
|
SYLogger.info(f"[Sandbox] 异步后台执行: {command}")
|
|
767
741
|
try:
|
|
768
742
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/execute_background", {
|
|
769
743
|
"command": command.strip(),
|
|
770
744
|
"user_id": self._user_id,
|
|
771
|
-
"timeout":
|
|
772
|
-
})
|
|
745
|
+
"timeout": actual_timeout
|
|
746
|
+
}, timeout=actual_timeout)
|
|
773
747
|
SYLogger.info(f"[Sandbox] 异步后台进程已启动: process_id={result['process_id']}")
|
|
774
748
|
return result
|
|
775
749
|
except Exception as e:
|
|
776
750
|
SYLogger.error(f"[Sandbox] 异步后台执行失败: {e}")
|
|
777
751
|
return {"process_id": None, "status": "error", "error": str(e)}
|
|
778
752
|
|
|
779
|
-
async def acheck_process(self, process_id: str) -> dict:
|
|
780
|
-
"""
|
|
753
|
+
async def acheck_process(self, process_id: str, *, timeout: int = None) -> dict:
|
|
754
|
+
"""异步检查后台进程状态"""
|
|
781
755
|
try:
|
|
782
756
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/process_status", {
|
|
783
757
|
"process_id": process_id,
|
|
784
758
|
"user_id": self._user_id
|
|
785
|
-
})
|
|
759
|
+
}, timeout=timeout)
|
|
786
760
|
return result
|
|
787
761
|
except Exception as e:
|
|
788
762
|
SYLogger.error(f"[Sandbox] 异步检查进程失败: {e}")
|
|
789
763
|
return {"process_id": process_id, "status": "error", "error": str(e)}
|
|
790
764
|
|
|
791
|
-
async def akill_process(self, process_id: str) -> dict:
|
|
792
|
-
"""
|
|
765
|
+
async def akill_process(self, process_id: str, *, timeout: int = None) -> dict:
|
|
766
|
+
"""异步终止后台进程"""
|
|
793
767
|
try:
|
|
794
768
|
result = await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/kill_process", {
|
|
795
769
|
"process_id": process_id,
|
|
796
770
|
"user_id": self._user_id
|
|
797
|
-
})
|
|
771
|
+
}, timeout=timeout)
|
|
798
772
|
SYLogger.info(f"[Sandbox] 异步进程终止: {process_id}, status={result['status']}")
|
|
799
773
|
return result
|
|
800
774
|
except Exception as e:
|
|
801
775
|
SYLogger.error(f"[Sandbox] 异步终止进程失败: {e}")
|
|
802
776
|
return {"process_id": process_id, "status": "error", "error": str(e)}
|
|
803
777
|
|
|
804
|
-
async def akill_all_processes(self) -> dict:
|
|
778
|
+
async def akill_all_processes(self, *, timeout: int = None) -> dict:
|
|
805
779
|
"""异步终止该用户的所有后台进程"""
|
|
806
780
|
try:
|
|
807
781
|
result = await self._post_async_with_failover(
|
|
808
782
|
f"{SANDBOX_API_PREFIX}/kill_all_processes",
|
|
809
|
-
{"user_id": self._user_id}
|
|
783
|
+
{"user_id": self._user_id},
|
|
784
|
+
timeout=timeout,
|
|
810
785
|
)
|
|
811
786
|
SYLogger.info(
|
|
812
787
|
f"[Sandbox] 批量终止进程: "
|
|
@@ -820,21 +795,21 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
820
795
|
|
|
821
796
|
# ============== 端口转发 ==============
|
|
822
797
|
|
|
823
|
-
async def aport_forward(self, port: int, action: str = "list") -> dict:
|
|
798
|
+
async def aport_forward(self, port: int, action: str = "list", *, timeout: int = None) -> dict:
|
|
824
799
|
"""异步端口转发管理"""
|
|
825
800
|
return await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/port_forward", {
|
|
826
801
|
"port": port,
|
|
827
802
|
"user_id": self._user_id,
|
|
828
803
|
"action": action,
|
|
829
|
-
})
|
|
804
|
+
}, timeout=timeout)
|
|
830
805
|
|
|
831
|
-
async def awatch(self, path: str = "/", event_types: list = None) -> dict:
|
|
806
|
+
async def awatch(self, path: str = "/", event_types: list = None, *, timeout: int = None) -> dict:
|
|
832
807
|
"""异步查询文件变更"""
|
|
833
808
|
return await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/watch", {
|
|
834
809
|
"path": path,
|
|
835
810
|
"user_id": self._user_id,
|
|
836
811
|
"event_types": event_types,
|
|
837
|
-
})
|
|
812
|
+
}, timeout=timeout)
|
|
838
813
|
|
|
839
814
|
# ============== 批量操作 ==============
|
|
840
815
|
|
|
@@ -980,9 +955,9 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
980
955
|
"""
|
|
981
956
|
return self._sync_sync()
|
|
982
957
|
|
|
983
|
-
async def async_sync(self) -> dict:
|
|
984
|
-
"""
|
|
985
|
-
return await self._sync_async()
|
|
958
|
+
async def async_sync(self, *, timeout: int = None) -> dict:
|
|
959
|
+
"""异步手动同步所有配置的目录到沙箱"""
|
|
960
|
+
return await self._sync_async(timeout=timeout)
|
|
986
961
|
|
|
987
962
|
def sync_dirs(self, dirs: List[tuple[str, str]]) -> dict:
|
|
988
963
|
"""同步指定的目录列表到沙箱
|
|
@@ -1027,7 +1002,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
1027
1002
|
SYLogger.info("[Sandbox] sync_dirs 完成")
|
|
1028
1003
|
return results
|
|
1029
1004
|
|
|
1030
|
-
async def async_sync_dirs(self, dirs: List[tuple[str, str]]) -> dict:
|
|
1005
|
+
async def async_sync_dirs(self, dirs: List[tuple[str, str]], *, timeout: int = None) -> dict:
|
|
1031
1006
|
"""异步同步指定的目录列表到沙箱(真正的异步实现)
|
|
1032
1007
|
|
|
1033
1008
|
Args:
|
|
@@ -1057,13 +1032,13 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
1057
1032
|
|
|
1058
1033
|
if is_dir:
|
|
1059
1034
|
SYLogger.info(f"[Sandbox] 开始异步上传目录: {local_path}")
|
|
1060
|
-
result = await self._upload_directory_async(str(local_dir), remote_path)
|
|
1035
|
+
result = await self._upload_directory_async(str(local_dir), remote_path, timeout=timeout)
|
|
1061
1036
|
results[local_path] = result
|
|
1062
1037
|
SYLogger.info(f"[Sandbox] 异步目录上传完成: {local_path}, 成功={result['success']}, 失败={result['failed']}")
|
|
1063
1038
|
else:
|
|
1064
1039
|
SYLogger.info(f"[Sandbox] 异步上传单文件: {local_path}")
|
|
1065
1040
|
content = await asyncio.to_thread(lambda: open(local_dir, "rb").read())
|
|
1066
|
-
upload_results = await self.aupload_files([(remote_path, content)])
|
|
1041
|
+
upload_results = await self.aupload_files([(remote_path, content)], timeout=timeout)
|
|
1067
1042
|
if upload_results[0].error:
|
|
1068
1043
|
results[local_path] = {"success": 0, "failed": 1, "errors": [{"path": remote_path, "error": upload_results[0].error}]}
|
|
1069
1044
|
else:
|
|
@@ -1270,9 +1245,9 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
1270
1245
|
"""重置沙箱环境"""
|
|
1271
1246
|
return self._post_sync(f"{SANDBOX_API_PREFIX}/reset", {"user_id": self._user_id})
|
|
1272
1247
|
|
|
1273
|
-
async def areset(self) -> dict:
|
|
1248
|
+
async def areset(self, *, timeout: int = None) -> dict:
|
|
1274
1249
|
"""异步重置沙箱环境"""
|
|
1275
|
-
return await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/reset", {"user_id": self._user_id})
|
|
1250
|
+
return await self._post_async_with_failover(f"{SANDBOX_API_PREFIX}/reset", {"user_id": self._user_id}, timeout=timeout)
|
|
1276
1251
|
|
|
1277
1252
|
def health_check(self, timeout: int = 10) -> dict:
|
|
1278
1253
|
"""健康检查(快速检查,默认10秒超时)"""
|
|
@@ -1297,16 +1272,18 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
1297
1272
|
SYLogger.error(f"[Sandbox] 健康检查失败: {e}")
|
|
1298
1273
|
raise
|
|
1299
1274
|
|
|
1300
|
-
async def ahealth_check(self) -> dict:
|
|
1275
|
+
async def ahealth_check(self, timeout: int = 10) -> dict:
|
|
1301
1276
|
"""异步健康检查"""
|
|
1302
1277
|
try:
|
|
1303
1278
|
url = f"{self._base_url}{SANDBOX_API_PREFIX}/health"
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1279
|
+
timeout_obj = aiohttp.ClientTimeout(total=timeout)
|
|
1280
|
+
connector = aiohttp.TCPConnector(ssl=_SSL_CONTEXT)
|
|
1281
|
+
async with aiohttp.ClientSession(connector=connector) as session:
|
|
1282
|
+
async with session.get(url, timeout=timeout_obj) as resp:
|
|
1283
|
+
resp.raise_for_status()
|
|
1284
|
+
result = await resp.json()
|
|
1285
|
+
SYLogger.info(f"[Sandbox] 异步健康检查成功: {result}")
|
|
1286
|
+
return result
|
|
1310
1287
|
except Exception as e:
|
|
1311
1288
|
SYLogger.error(f"[Sandbox] 异步健康检查失败: {e}")
|
|
1312
1289
|
raise
|
|
@@ -181,20 +181,12 @@ class Services(metaclass=SingletonMeta):
|
|
|
181
181
|
|
|
182
182
|
workers = cls._config.get('Workers', 1)
|
|
183
183
|
|
|
184
|
-
# Worker
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
# 检测方式:
|
|
189
|
-
# 1. 第一次调用 plugins() 的是主进程(设置了 _SY_MAIN_PID),主进程正常注册 Nacos
|
|
190
|
-
# 2. 子进程通过 spawn 创建后,_SY_MAIN_PID 环境变量已设置,且 PID 不同 → 判定为 worker
|
|
191
|
-
# 3. 主进程在 plugins() 返回后、uvicorn.run() 前设置 _SY_WORKER=1,
|
|
192
|
-
# 让子进程 import 时能直接通过环境变量判断
|
|
184
|
+
# Worker 进程检测:
|
|
185
|
+
# 主进程 plugins() 设置 _SY_WORKER=1,uvicorn spawn 的子进程继承该变量。
|
|
186
|
+
# Worker 进程跳过 Nacos 注册和用户 lifespan 中不支持多实例的服务。
|
|
193
187
|
_is_worker = os.environ.get("_SY_WORKER") == "1"
|
|
194
|
-
app.state._is_worker = _is_worker
|
|
195
188
|
|
|
196
189
|
if workers > 1 and not _is_worker:
|
|
197
|
-
# 主进程:设置环境变量,子进程 spawn 后会继承
|
|
198
190
|
os.environ["_SY_WORKER"] = "1"
|
|
199
191
|
logging.info(f"多 Worker 模式 (workers={workers}),主进程将注册 Nacos,子进程跳过")
|
|
200
192
|
|
|
@@ -313,11 +305,7 @@ class Services(metaclass=SingletonMeta):
|
|
|
313
305
|
logging.info("沙箱后台清理任务已启动")
|
|
314
306
|
|
|
315
307
|
# 5. 执行用户定义的生命周期
|
|
316
|
-
|
|
317
|
-
if _is_worker:
|
|
318
|
-
logging.info("Worker 进程,跳过用户生命周期")
|
|
319
|
-
yield
|
|
320
|
-
elif cls._user_lifespan:
|
|
308
|
+
if cls._user_lifespan:
|
|
321
309
|
async with cls._user_lifespan(app_instance):
|
|
322
310
|
yield
|
|
323
311
|
else:
|
|
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
|
{sycommon_python_lib-0.2.2a11 → sycommon_python_lib-0.2.2a13}/src/command/templates/__init__.py
RENAMED
|
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
|