sycommon-python-lib 0.2.3a11__tar.gz → 0.2.4__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.3a11 → sycommon_python_lib-0.2.4}/PKG-INFO +9 -6
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/pyproject.toml +9 -6
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/__init__.py +26 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/deep_agent.py +21 -2
- sycommon_python_lib-0.2.4/src/sycommon/agent/mcp/__init__.py +30 -0
- sycommon_python_lib-0.2.4/src/sycommon/agent/mcp/models.py +56 -0
- sycommon_python_lib-0.2.4/src/sycommon/agent/mcp/tool_loader.py +174 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/multi_agent_team.py +6 -2
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/http_sandbox_backend.py +27 -3
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/minio_sync.py +26 -13
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/sandbox_recovery.py +3 -2
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/summarization_utils.py +72 -29
- sycommon_python_lib-0.2.4/src/sycommon/config/PgConfig.py +54 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/async_database_service.py +15 -0
- sycommon_python_lib-0.2.4/src/sycommon/database/pg_checkpoint_service.py +132 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/get_llm.py +4 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/services.py +18 -2
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/feign.py +5 -2
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/feign_client.py +7 -4
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon_python_lib.egg-info/PKG-INFO +9 -6
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon_python_lib.egg-info/SOURCES.txt +5 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon_python_lib.egg-info/requires.txt +8 -5
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/README.md +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/setup.cfg +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/cli.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/core/console.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/core/models.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/core/project.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/core/utils.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/agent/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/agent/main_agent.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/agent/nodes/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/agent/nodes/example_node.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/agent/states/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/agent/states/agent_state.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/api/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/api/query.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/api/sse/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/api/sse/agent.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/db/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/db/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/db/model/entity.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/db/service.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/model/parse.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/agent/tools/mq.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/.env.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/.gitignore.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/Dockerfile.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/app.yaml.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/client/FileServiceClient.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/model/file_info.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/base/requirements.txt.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/commands/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/commands/hello.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/pyproject.toml.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/cli/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/README.md.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/api/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/api/echo.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/api/sse/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/api/sse/echo.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/app.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/client/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/model/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/tools/__init__.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/command/templates/web/tools/mq.py.tpl +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/nexus/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/__main__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/agents/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/agents/factory.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/agents/prompts.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/browser.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/console.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/dom.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/network.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/page_errors.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/performance.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/capabilities/screenshot.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/client.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/protocol.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cdp/repl.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/cli.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/cdp_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/chat_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/create_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/evaluate_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/init_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/memory_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/resume_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/rollback_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/commands/run_cmd.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/backend.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/display.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/git_integration.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/llm.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/core/state.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/evaluate/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/evaluate/api_evaluator.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/memory/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/memory/compressor.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/memory/full.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/memory/hot.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/memory/manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/memory/warm.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/mode/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/mode/create.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/mode/optimize.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/models/config_models.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/baseline_tests.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/checkpoint.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/convergence.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/diagnosis.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/engine.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/environment.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/experience.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/harness_prompts.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/history.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/optimization_logger.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/pre_validation.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/reward.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/strategy_bandit.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/strategy_generator.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/rl/strategy_prompts.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycli/skills/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/agent_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/chat_events.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/file_ops.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/sandbox_pool.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/session.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/auth/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/auth/ldap_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/auth/wecom_ldap_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/Config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/ElasticsearchConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/LLMConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/RedisConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/XxlJobConfig.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/config/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/database_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/elasticsearch_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/redis_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/database/token_usage_db_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/health/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/heartbeat_process/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/heartbeat_process/heartbeat_config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/heartbeat_process/heartbeat_process_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/heartbeat_process/heartbeat_process_worker.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/embedding.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/llm_tokens.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/llm_with_token_tracking.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/native_with_fallback_runnable.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/output_fixing_runnable.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/struct_token.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/sy_langfuse.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/token_usage_es_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/token_usage_mysql_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/llm/usage_token.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/kafka_log.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/process_logger.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/background_execution.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/middleware.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/mq.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/sandbox.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/timeout.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/token_tracking.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/tool_result_truncation.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/sandbox.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/sso_user.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/token_usage.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/token_usage_mysql.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/models/xxljob_handler_config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/notice/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/notice/wecom_message.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/process_pool_consumer.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/sentry/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/sse/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/sse/sse.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/nacos_client_base.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/nacos_config_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/nacos_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/nacos_service_discovery.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/nacos_service_registration.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/deep_agent_server.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/test_deep_agent.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/test_email.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/test_mq.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/test_real_summarization.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/test_summarization_config.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tests/test_summarization_real.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/async_utils.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/env.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/merge_headers.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/syemail.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/xxljob/__init__.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/xxljob/xxljob_service.py +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
- {sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/tests/test_sycli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sycommon-python-lib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Description-Content-Type: text/markdown
|
|
@@ -8,17 +8,18 @@ Requires-Dist: aio-pika>=9.6.2
|
|
|
8
8
|
Requires-Dist: aiohttp>=3.13.5
|
|
9
9
|
Requires-Dist: aiomysql>=0.3.2
|
|
10
10
|
Requires-Dist: anyio>=4.12.1
|
|
11
|
-
Requires-Dist: decorator>=5.
|
|
11
|
+
Requires-Dist: decorator>=5.3.0
|
|
12
12
|
Requires-Dist: deepagents>=0.6.1
|
|
13
13
|
Requires-Dist: elasticsearch>=9.4.0
|
|
14
14
|
Requires-Dist: fastapi>=0.136.1
|
|
15
15
|
Requires-Dist: jinja2>=3.1.6
|
|
16
16
|
Requires-Dist: kafka-python>=2.3.1
|
|
17
|
-
Requires-Dist: langchain>=1.3.
|
|
17
|
+
Requires-Dist: langchain>=1.3.1
|
|
18
18
|
Requires-Dist: langchain-core>=1.4.0
|
|
19
19
|
Requires-Dist: langchain-openai>=1.2.1
|
|
20
20
|
Requires-Dist: langfuse>=4.6.1
|
|
21
21
|
Requires-Dist: langgraph>=1.2.0
|
|
22
|
+
Requires-Dist: langgraph-checkpoint-postgres>=3.1.0
|
|
22
23
|
Requires-Dist: langgraph-checkpoint-redis>=0.4.1
|
|
23
24
|
Requires-Dist: ldap3>=2.9.1
|
|
24
25
|
Requires-Dist: loguru>=0.7.3
|
|
@@ -28,17 +29,19 @@ Requires-Dist: psutil>=7.2.2
|
|
|
28
29
|
Requires-Dist: pyxxl>=0.4.6
|
|
29
30
|
Requires-Dist: pydantic>=2.13.4
|
|
30
31
|
Requires-Dist: python-dotenv>=1.2.2
|
|
31
|
-
Requires-Dist: python-multipart>=0.0.
|
|
32
|
+
Requires-Dist: python-multipart>=0.0.29
|
|
32
33
|
Requires-Dist: pyyaml>=6.0.3
|
|
33
34
|
Requires-Dist: redis>=7.3.0
|
|
34
35
|
Requires-Dist: sentry-sdk[fastapi]>=2.60.0
|
|
35
36
|
Requires-Dist: sqlalchemy[asyncio]>=2.0.48
|
|
36
37
|
Requires-Dist: starlette[full]>=1.0.0
|
|
37
|
-
Requires-Dist: tiktoken>=0.
|
|
38
|
-
Requires-Dist: uvicorn>=0.
|
|
38
|
+
Requires-Dist: tiktoken>=0.13.0
|
|
39
|
+
Requires-Dist: uvicorn>=0.47.0
|
|
39
40
|
Requires-Dist: wecom-aibot-python-sdk>=1.0.2
|
|
40
41
|
Requires-Dist: twine>=6.2.0
|
|
41
42
|
Requires-Dist: minio>=7.2.20
|
|
43
|
+
Requires-Dist: langchain-mcp-adapters>=0.2.2
|
|
44
|
+
Requires-Dist: psycopg[binary,pool]>=3.3.4
|
|
42
45
|
|
|
43
46
|
# sycommon-python-lib
|
|
44
47
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sycommon-python-lib"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4"
|
|
4
4
|
description = "Add your description here"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -9,17 +9,18 @@ dependencies = [
|
|
|
9
9
|
"aiohttp>=3.13.5",
|
|
10
10
|
"aiomysql>=0.3.2",
|
|
11
11
|
"anyio>=4.12.1",
|
|
12
|
-
"decorator>=5.
|
|
12
|
+
"decorator>=5.3.0",
|
|
13
13
|
"deepagents>=0.6.1",
|
|
14
14
|
"elasticsearch>=9.4.0",
|
|
15
15
|
"fastapi>=0.136.1",
|
|
16
16
|
"jinja2>=3.1.6",
|
|
17
17
|
"kafka-python>=2.3.1",
|
|
18
|
-
"langchain>=1.3.
|
|
18
|
+
"langchain>=1.3.1",
|
|
19
19
|
"langchain-core>=1.4.0",
|
|
20
20
|
"langchain-openai>=1.2.1",
|
|
21
21
|
"langfuse>=4.6.1",
|
|
22
22
|
"langgraph>=1.2.0",
|
|
23
|
+
"langgraph-checkpoint-postgres>=3.1.0",
|
|
23
24
|
"langgraph-checkpoint-redis>=0.4.1",
|
|
24
25
|
"ldap3>=2.9.1",
|
|
25
26
|
"loguru>=0.7.3",
|
|
@@ -29,17 +30,19 @@ dependencies = [
|
|
|
29
30
|
"pyxxl>=0.4.6",
|
|
30
31
|
"pydantic>=2.13.4",
|
|
31
32
|
"python-dotenv>=1.2.2",
|
|
32
|
-
"python-multipart>=0.0.
|
|
33
|
+
"python-multipart>=0.0.29",
|
|
33
34
|
"pyyaml>=6.0.3",
|
|
34
35
|
"redis>=7.3.0",
|
|
35
36
|
"sentry-sdk[fastapi]>=2.60.0",
|
|
36
37
|
"sqlalchemy[asyncio]>=2.0.48",
|
|
37
38
|
"starlette[full]>=1.0.0",
|
|
38
|
-
"tiktoken>=0.
|
|
39
|
-
"uvicorn>=0.
|
|
39
|
+
"tiktoken>=0.13.0",
|
|
40
|
+
"uvicorn>=0.47.0",
|
|
40
41
|
"wecom-aibot-python-sdk>=1.0.2",
|
|
41
42
|
"twine>=6.2.0",
|
|
42
43
|
"minio>=7.2.20",
|
|
44
|
+
"langchain-mcp-adapters>=0.2.2",
|
|
45
|
+
"psycopg[binary,pool]>=3.3.4",
|
|
43
46
|
]
|
|
44
47
|
|
|
45
48
|
[tool.setuptools]
|
|
@@ -105,6 +105,18 @@ from sycommon.agent.chat_events import (
|
|
|
105
105
|
error_event,
|
|
106
106
|
cancelled_event,
|
|
107
107
|
)
|
|
108
|
+
from sycommon.agent.mcp import (
|
|
109
|
+
MCPToolStatus,
|
|
110
|
+
MCPServerConfig,
|
|
111
|
+
MCPServerCreateRequest,
|
|
112
|
+
MCPServerUpdateRequest,
|
|
113
|
+
MCPServerTestRequest,
|
|
114
|
+
MCPServerTestResult,
|
|
115
|
+
load_mcp_tools,
|
|
116
|
+
test_mcp_connection,
|
|
117
|
+
sanitize_name,
|
|
118
|
+
)
|
|
119
|
+
from sycommon.database.pg_checkpoint_service import PgCheckpointService
|
|
108
120
|
|
|
109
121
|
__all__ = [
|
|
110
122
|
# 沙箱
|
|
@@ -147,4 +159,18 @@ __all__ = [
|
|
|
147
159
|
"done_event",
|
|
148
160
|
"error_event",
|
|
149
161
|
"cancelled_event",
|
|
162
|
+
|
|
163
|
+
# MCP 工具集成
|
|
164
|
+
"MCPToolStatus",
|
|
165
|
+
"MCPServerConfig",
|
|
166
|
+
"MCPServerCreateRequest",
|
|
167
|
+
"MCPServerUpdateRequest",
|
|
168
|
+
"MCPServerTestRequest",
|
|
169
|
+
"MCPServerTestResult",
|
|
170
|
+
"load_mcp_tools",
|
|
171
|
+
"test_mcp_connection",
|
|
172
|
+
"sanitize_name",
|
|
173
|
+
|
|
174
|
+
# PG Checkpoint 服务
|
|
175
|
+
"PgCheckpointService",
|
|
150
176
|
]
|
|
@@ -168,6 +168,7 @@ class DeepAgent:
|
|
|
168
168
|
"""
|
|
169
169
|
current_tool_calls = []
|
|
170
170
|
ai_chunk_buffer = ""
|
|
171
|
+
ai_text_content = ""
|
|
171
172
|
seen_tool_call_ids = set()
|
|
172
173
|
stream_step = 0
|
|
173
174
|
# 兜底:累积流式 chunk 中的 usage_metadata(middleware 在流式场景可能拿不到)
|
|
@@ -211,6 +212,12 @@ class DeepAgent:
|
|
|
211
212
|
if usage_meta:
|
|
212
213
|
total_input_tokens += usage_meta.get("input_tokens", 0)
|
|
213
214
|
total_output_tokens += usage_meta.get("output_tokens", 0)
|
|
215
|
+
if usage_meta.get("input_tokens", 0) > 0:
|
|
216
|
+
SYLogger.debug(
|
|
217
|
+
f"[DeepAgent] usage_metadata | input={usage_meta.get('input_tokens', 0)} "
|
|
218
|
+
f"output={usage_meta.get('output_tokens', 0)} "
|
|
219
|
+
f"total={usage_meta.get('total_tokens', 0)} "
|
|
220
|
+
f"cumulative_input={total_input_tokens} step={stream_step}")
|
|
214
221
|
|
|
215
222
|
if msg_type == "AIMessageChunk":
|
|
216
223
|
tool_calls_log = getattr(msg, "tool_calls", [])
|
|
@@ -397,6 +404,7 @@ class DeepAgent:
|
|
|
397
404
|
|
|
398
405
|
if content:
|
|
399
406
|
ai_chunk_buffer += content
|
|
407
|
+
ai_text_content += content
|
|
400
408
|
event = ChatEventBuilder.ai_chunk(
|
|
401
409
|
content, id=getattr(msg, "id", None),
|
|
402
410
|
agent=DEFAULT_AGENT_NAME)
|
|
@@ -453,6 +461,13 @@ class DeepAgent:
|
|
|
453
461
|
print(
|
|
454
462
|
f"[DeepAgent] AI chunk done | {repr(ai_chunk_buffer[:100])}...")
|
|
455
463
|
|
|
464
|
+
# 空响应检测:模型被调用但没有产出任何文本
|
|
465
|
+
if not ai_text_content and not ai_chunk_buffer:
|
|
466
|
+
SYLogger.warning(
|
|
467
|
+
f"[DeepAgent] 空响应警告:模型未返回任何文本内容。"
|
|
468
|
+
f"stream_step={stream_step}, tool_calls={len(current_tool_calls)}, "
|
|
469
|
+
f"input_tokens={total_input_tokens}, output_tokens={total_output_tokens}")
|
|
470
|
+
|
|
456
471
|
# 兜底:如果 middleware 没有成功记录(流式场景),在这里补充记录
|
|
457
472
|
if total_input_tokens > 0 or total_output_tokens > 0:
|
|
458
473
|
try:
|
|
@@ -598,8 +613,12 @@ async def create_deep_agent(
|
|
|
598
613
|
|
|
599
614
|
# 创建 checkpointer
|
|
600
615
|
if checkpointer is None:
|
|
601
|
-
from
|
|
602
|
-
|
|
616
|
+
from sycommon.database.pg_checkpoint_service import PgCheckpointService
|
|
617
|
+
if PgCheckpointService.is_initialized():
|
|
618
|
+
checkpointer = await PgCheckpointService.get_checkpointer()
|
|
619
|
+
else:
|
|
620
|
+
from langgraph.checkpoint.memory import MemorySaver
|
|
621
|
+
checkpointer = MemorySaver()
|
|
603
622
|
|
|
604
623
|
tid = thread_id or user_id
|
|
605
624
|
agent_config = {"configurable": {"thread_id": tid}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""MCP 工具集成模块
|
|
2
|
+
|
|
3
|
+
提供 MCP 服务器连接、工具发现和加载功能。
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from sycommon.agent.mcp.models import (
|
|
7
|
+
MCPToolStatus,
|
|
8
|
+
MCPServerConfig,
|
|
9
|
+
MCPServerCreateRequest,
|
|
10
|
+
MCPServerUpdateRequest,
|
|
11
|
+
MCPServerTestRequest,
|
|
12
|
+
MCPServerTestResult,
|
|
13
|
+
)
|
|
14
|
+
from sycommon.agent.mcp.tool_loader import (
|
|
15
|
+
load_mcp_tools,
|
|
16
|
+
test_mcp_connection,
|
|
17
|
+
sanitize_name,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"MCPToolStatus",
|
|
22
|
+
"MCPServerConfig",
|
|
23
|
+
"MCPServerCreateRequest",
|
|
24
|
+
"MCPServerUpdateRequest",
|
|
25
|
+
"MCPServerTestRequest",
|
|
26
|
+
"MCPServerTestResult",
|
|
27
|
+
"load_mcp_tools",
|
|
28
|
+
"test_mcp_connection",
|
|
29
|
+
"sanitize_name",
|
|
30
|
+
]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""MCP 服务器配置数据模型"""
|
|
2
|
+
|
|
3
|
+
from typing import Optional, List
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class MCPToolStatus(BaseModel):
|
|
8
|
+
"""MCP 工具可用状态"""
|
|
9
|
+
tool_name: str
|
|
10
|
+
description: Optional[str] = None
|
|
11
|
+
available: bool = True
|
|
12
|
+
last_check_at: Optional[str] = None
|
|
13
|
+
last_error: Optional[str] = None
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MCPServerConfig(BaseModel):
|
|
17
|
+
id: str
|
|
18
|
+
user_id: Optional[str] = None
|
|
19
|
+
name: str
|
|
20
|
+
server_url: str
|
|
21
|
+
description: Optional[str] = None
|
|
22
|
+
headers: Optional[dict] = None
|
|
23
|
+
enabled: bool = True
|
|
24
|
+
sanitized_name: str = ""
|
|
25
|
+
created_at: str
|
|
26
|
+
updated_at: str
|
|
27
|
+
tools: Optional[List[MCPToolStatus]] = None
|
|
28
|
+
server_status: Optional[str] = None
|
|
29
|
+
server_error: Optional[str] = None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MCPServerCreateRequest(BaseModel):
|
|
33
|
+
name: str
|
|
34
|
+
server_url: str
|
|
35
|
+
description: Optional[str] = None
|
|
36
|
+
headers: Optional[dict] = None
|
|
37
|
+
enabled: bool = True
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class MCPServerUpdateRequest(BaseModel):
|
|
41
|
+
name: Optional[str] = None
|
|
42
|
+
server_url: Optional[str] = None
|
|
43
|
+
description: Optional[str] = None
|
|
44
|
+
headers: Optional[dict] = None
|
|
45
|
+
enabled: Optional[bool] = None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class MCPServerTestRequest(BaseModel):
|
|
49
|
+
server_url: str
|
|
50
|
+
headers: Optional[dict] = None
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class MCPServerTestResult(BaseModel):
|
|
54
|
+
success: bool
|
|
55
|
+
tools: Optional[list] = None
|
|
56
|
+
error: Optional[str] = None
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"""MCP 工具加载器
|
|
2
|
+
|
|
3
|
+
使用 langchain-mcp-adapters 官方库连接远程 MCP 服务器,
|
|
4
|
+
发现工具并作为 LangChain BaseTool 注入 Agent。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import re
|
|
8
|
+
import hashlib
|
|
9
|
+
from typing import List, Optional, Callable, Awaitable
|
|
10
|
+
|
|
11
|
+
from langchain_core.tools import BaseTool
|
|
12
|
+
|
|
13
|
+
from sycommon.logging.kafka_log import SYLogger
|
|
14
|
+
from sycommon.agent.mcp.models import MCPServerConfig
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def sanitize_name(name: str) -> str:
|
|
18
|
+
"""将名称转为合法的标识符,中文等非ASCII字符做 transliterate"""
|
|
19
|
+
sanitized = re.sub(r'[^a-zA-Z0-9_]', '_', name).strip('_')
|
|
20
|
+
if not sanitized:
|
|
21
|
+
h = hashlib.md5(name.encode()).hexdigest()[:8]
|
|
22
|
+
sanitized = f"mcp_{h}"
|
|
23
|
+
return sanitized
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def wrap_tool_with_error_handler(
|
|
27
|
+
tool: BaseTool,
|
|
28
|
+
server_config_id: str,
|
|
29
|
+
server_name: str,
|
|
30
|
+
original_tool_name: str,
|
|
31
|
+
on_tool_success: Optional[Callable[[str, str], Awaitable[None]]] = None,
|
|
32
|
+
on_tool_error: Optional[Callable[[str, str, str], Awaitable[None]]] = None,
|
|
33
|
+
) -> BaseTool:
|
|
34
|
+
"""包装 MCP 工具的 coroutine,捕获连接/超时等异常,返回友好的错误信息而非抛出异常。
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
on_tool_success: 异步回调 (server_config_id, tool_name) -> None
|
|
38
|
+
on_tool_error: 异步回调 (server_config_id, tool_name, error_msg) -> None
|
|
39
|
+
"""
|
|
40
|
+
original_coroutine = tool.coroutine
|
|
41
|
+
tool_name = tool.name
|
|
42
|
+
|
|
43
|
+
async def _safe_coroutine(*args, **kwargs):
|
|
44
|
+
try:
|
|
45
|
+
result = await original_coroutine(*args, **kwargs)
|
|
46
|
+
if on_tool_success:
|
|
47
|
+
try:
|
|
48
|
+
await on_tool_success(server_config_id, original_tool_name)
|
|
49
|
+
except Exception:
|
|
50
|
+
pass
|
|
51
|
+
return result
|
|
52
|
+
except Exception as e:
|
|
53
|
+
err_type = type(e).__name__
|
|
54
|
+
err_msg = str(e)[:500]
|
|
55
|
+
SYLogger.warning(f"[MCP] 工具 '{tool_name}' 调用失败 ({err_type}): {err_msg}")
|
|
56
|
+
|
|
57
|
+
if on_tool_error:
|
|
58
|
+
try:
|
|
59
|
+
await on_tool_error(server_config_id, original_tool_name, f"{err_type}: {err_msg}")
|
|
60
|
+
except Exception:
|
|
61
|
+
pass
|
|
62
|
+
|
|
63
|
+
friendly_msg = (
|
|
64
|
+
f"MCP 工具调用失败:工具 '{tool_name}' (服务器: {server_name}) 当前不可用。\n"
|
|
65
|
+
f"错误类型: {err_type}\n"
|
|
66
|
+
f"可能原因: MCP 服务器未启动、网络不可达或连接超时。\n"
|
|
67
|
+
f"请尝试不使用该工具继续完成任务,或联系管理员检查 MCP 服务 '{server_name}'。"
|
|
68
|
+
)
|
|
69
|
+
return [friendly_msg]
|
|
70
|
+
|
|
71
|
+
tool.coroutine = _safe_coroutine
|
|
72
|
+
return tool
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
async def load_mcp_tools(
|
|
76
|
+
configs: List[MCPServerConfig],
|
|
77
|
+
on_tool_success: Optional[Callable[[str, str], Awaitable[None]]] = None,
|
|
78
|
+
on_tool_error: Optional[Callable[[str, str, str], Awaitable[None]]] = None,
|
|
79
|
+
on_batch_available: Optional[Callable[[str, list], Awaitable[None]]] = None,
|
|
80
|
+
on_server_failure: Optional[Callable[[str, str], Awaitable[None]]] = None,
|
|
81
|
+
) -> List[BaseTool]:
|
|
82
|
+
"""加载 MCP 工具列表
|
|
83
|
+
|
|
84
|
+
接受 MCPServerConfig 列表,逐个服务器连接并加载工具。
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
configs: MCP 服务器配置列表(仅 enabled 的会被处理)
|
|
88
|
+
on_tool_success: 单个工具调用成功回调
|
|
89
|
+
on_tool_error: 单个工具调用失败回调
|
|
90
|
+
on_batch_available: 服务器连接成功后批量标记工具可用回调 (config_id, tool_names)
|
|
91
|
+
on_server_failure: 服务器连接失败回调 (config_id, error_msg)
|
|
92
|
+
"""
|
|
93
|
+
enabled_configs = [c for c in configs if c.enabled]
|
|
94
|
+
if not enabled_configs:
|
|
95
|
+
return []
|
|
96
|
+
|
|
97
|
+
all_tools = []
|
|
98
|
+
for config in enabled_configs:
|
|
99
|
+
try:
|
|
100
|
+
from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
101
|
+
|
|
102
|
+
key = sanitize_name(config.name)
|
|
103
|
+
client_config = {
|
|
104
|
+
key: {
|
|
105
|
+
"url": config.server_url,
|
|
106
|
+
"transport": "streamable_http",
|
|
107
|
+
**({"headers": config.headers} if config.headers else {}),
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
client = MultiServerMCPClient(client_config)
|
|
112
|
+
tools = await client.get_tools()
|
|
113
|
+
|
|
114
|
+
original_names = []
|
|
115
|
+
for tool in tools:
|
|
116
|
+
original_name = tool.name
|
|
117
|
+
original_names.append(original_name)
|
|
118
|
+
tool.name = f"mcp__{key}__{original_name}"
|
|
119
|
+
if tool.description and not tool.description.startswith("[MCP"):
|
|
120
|
+
tool.description = f"[MCP:{config.name}] {tool.description}"
|
|
121
|
+
wrap_tool_with_error_handler(
|
|
122
|
+
tool, config.id, config.name, original_name,
|
|
123
|
+
on_tool_success=on_tool_success,
|
|
124
|
+
on_tool_error=on_tool_error,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
all_tools.extend(tools)
|
|
128
|
+
|
|
129
|
+
if on_batch_available:
|
|
130
|
+
try:
|
|
131
|
+
await on_batch_available(config.id, original_names)
|
|
132
|
+
except Exception as e:
|
|
133
|
+
SYLogger.warning(f"[MCP] 写入工具状态失败: {e}")
|
|
134
|
+
|
|
135
|
+
SYLogger.info(f"[MCP] 服务器 '{config.name}' 加载了 {len(tools)} 个工具")
|
|
136
|
+
|
|
137
|
+
except Exception as e:
|
|
138
|
+
SYLogger.warning(f"[MCP] 服务器 '{config.name}' ({config.server_url}) 连接失败,跳过: {e}")
|
|
139
|
+
if on_server_failure:
|
|
140
|
+
try:
|
|
141
|
+
await on_server_failure(config.id, str(e)[:300])
|
|
142
|
+
except Exception:
|
|
143
|
+
pass
|
|
144
|
+
|
|
145
|
+
if all_tools:
|
|
146
|
+
SYLogger.info(f"[MCP] 共加载 {len(all_tools)} 个 MCP 工具")
|
|
147
|
+
return all_tools
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
async def test_mcp_connection(server_url: str, headers: dict = None) -> dict:
|
|
151
|
+
"""测试 MCP 服务器连接,返回发现的工具列表"""
|
|
152
|
+
try:
|
|
153
|
+
from langchain_mcp_adapters.client import MultiServerMCPClient
|
|
154
|
+
|
|
155
|
+
client_config = {
|
|
156
|
+
"test": {
|
|
157
|
+
"url": server_url,
|
|
158
|
+
"transport": "streamable_http",
|
|
159
|
+
**({"headers": headers} if headers else {}),
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
client = MultiServerMCPClient(client_config)
|
|
164
|
+
tools = await client.get_tools()
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
"success": True,
|
|
168
|
+
"tools": [{"name": t.name, "description": t.description or ""} for t in tools],
|
|
169
|
+
}
|
|
170
|
+
except Exception as e:
|
|
171
|
+
return {
|
|
172
|
+
"success": False,
|
|
173
|
+
"error": str(e),
|
|
174
|
+
}
|
{sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/multi_agent_team.py
RENAMED
|
@@ -574,8 +574,12 @@ async def create_multi_agent_team(
|
|
|
574
574
|
|
|
575
575
|
# 创建 checkpointer
|
|
576
576
|
if checkpointer is None:
|
|
577
|
-
from
|
|
578
|
-
|
|
577
|
+
from sycommon.database.pg_checkpoint_service import PgCheckpointService
|
|
578
|
+
if PgCheckpointService.is_initialized():
|
|
579
|
+
checkpointer = await PgCheckpointService.get_checkpointer()
|
|
580
|
+
else:
|
|
581
|
+
from langgraph.checkpoint.memory import MemorySaver
|
|
582
|
+
checkpointer = MemorySaver()
|
|
579
583
|
|
|
580
584
|
tid = thread_id or user_id
|
|
581
585
|
agent_config = {"configurable": {"thread_id": tid}}
|
|
@@ -37,6 +37,11 @@ except ImportError:
|
|
|
37
37
|
_SSL_CONTEXT = ssl.create_default_context()
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
def _read_file_safe(path: str) -> bytes:
|
|
41
|
+
with open(path, "rb") as f:
|
|
42
|
+
return f.read()
|
|
43
|
+
|
|
44
|
+
|
|
40
45
|
class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
41
46
|
"""
|
|
42
47
|
通过 HTTP API 连接远程沙箱容器
|
|
@@ -210,6 +215,24 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
210
215
|
nacos_group=group,
|
|
211
216
|
)
|
|
212
217
|
|
|
218
|
+
@classmethod
|
|
219
|
+
async def afrom_nacos(
|
|
220
|
+
cls,
|
|
221
|
+
service_name: str,
|
|
222
|
+
user_id: str,
|
|
223
|
+
group: str = "DEFAULT_GROUP",
|
|
224
|
+
version: str = None,
|
|
225
|
+
timeout: int = 180,
|
|
226
|
+
sync_dirs: List[tuple[str, str]] = None,
|
|
227
|
+
auto_sync: bool = False,
|
|
228
|
+
load_balance: bool = True,
|
|
229
|
+
) -> "HTTPSandboxBackend":
|
|
230
|
+
"""异步从 Nacos 服务发现创建后端实例"""
|
|
231
|
+
return await asyncio.to_thread(
|
|
232
|
+
cls.from_nacos,
|
|
233
|
+
service_name, user_id, group, version, timeout, sync_dirs, auto_sync, load_balance,
|
|
234
|
+
)
|
|
235
|
+
|
|
213
236
|
# ============== 内部方法 - 同步版本 ==============
|
|
214
237
|
|
|
215
238
|
def _refresh_from_nacos_and_switch_sync(self) -> bool:
|
|
@@ -565,7 +588,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
565
588
|
else:
|
|
566
589
|
# 单文件
|
|
567
590
|
SYLogger.info(f"[Sandbox] 上传单文件: {local_path}")
|
|
568
|
-
content = await asyncio.to_thread(lambda:
|
|
591
|
+
content = await asyncio.to_thread(lambda p: _read_file_safe(p), local_dir)
|
|
569
592
|
upload_results = await self.aupload_files([(remote_path, content)], timeout=timeout)
|
|
570
593
|
if upload_results[0].error:
|
|
571
594
|
results[local_path] = {"success": 0, "failed": 1, "errors": [{"path": remote_path, "error": upload_results[0].error}]}
|
|
@@ -669,7 +692,8 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
669
692
|
def _read_batch():
|
|
670
693
|
items = []
|
|
671
694
|
for sandbox_path, local_file in batch_files:
|
|
672
|
-
|
|
695
|
+
with open(local_file, "rb") as f:
|
|
696
|
+
content = f.read()
|
|
673
697
|
items.append((sandbox_path, content))
|
|
674
698
|
return items
|
|
675
699
|
batch_items = await asyncio.to_thread(_read_batch)
|
|
@@ -1037,7 +1061,7 @@ class HTTPSandboxBackend(FileOperationsMixin, SandboxBackendProtocol):
|
|
|
1037
1061
|
SYLogger.info(f"[Sandbox] 异步目录上传完成: {local_path}, 成功={result['success']}, 失败={result['failed']}")
|
|
1038
1062
|
else:
|
|
1039
1063
|
SYLogger.info(f"[Sandbox] 异步上传单文件: {local_path}")
|
|
1040
|
-
content = await asyncio.to_thread(lambda:
|
|
1064
|
+
content = await asyncio.to_thread(lambda p: _read_file_safe(p), local_dir)
|
|
1041
1065
|
upload_results = await self.aupload_files([(remote_path, content)], timeout=timeout)
|
|
1042
1066
|
if upload_results[0].error:
|
|
1043
1067
|
results[local_path] = {"success": 0, "failed": 1, "errors": [{"path": remote_path, "error": upload_results[0].error}]}
|
{sycommon_python_lib-0.2.3a11 → sycommon_python_lib-0.2.4}/src/sycommon/agent/sandbox/minio_sync.py
RENAMED
|
@@ -162,7 +162,7 @@ class MinioSyncService(metaclass=SingletonMeta):
|
|
|
162
162
|
return None
|
|
163
163
|
|
|
164
164
|
def get_presigned_url(self, object_key: str, expires_days: int = 7) -> Optional[str]:
|
|
165
|
-
"""生成预签名下载 URL"""
|
|
165
|
+
"""生成预签名下载 URL(同步)"""
|
|
166
166
|
if not self._client:
|
|
167
167
|
return None
|
|
168
168
|
try:
|
|
@@ -177,8 +177,12 @@ class MinioSyncService(metaclass=SingletonMeta):
|
|
|
177
177
|
f"[MinIO] Presigned URL failed: {object_key}, error={e}")
|
|
178
178
|
return None
|
|
179
179
|
|
|
180
|
+
async def aget_presigned_url(self, object_key: str, expires_days: int = 7) -> Optional[str]:
|
|
181
|
+
"""异步生成预签名下载 URL"""
|
|
182
|
+
return await asyncio.to_thread(self.get_presigned_url, object_key, expires_days)
|
|
183
|
+
|
|
180
184
|
def remove_object(self, object_key: str) -> bool:
|
|
181
|
-
"""从 MinIO
|
|
185
|
+
"""从 MinIO 删除文件(同步)"""
|
|
182
186
|
if not self._client:
|
|
183
187
|
return False
|
|
184
188
|
try:
|
|
@@ -189,12 +193,12 @@ class MinioSyncService(metaclass=SingletonMeta):
|
|
|
189
193
|
SYLogger.warning(f"[MinIO] Delete failed: {object_key}, error={e}")
|
|
190
194
|
return False
|
|
191
195
|
|
|
192
|
-
def
|
|
193
|
-
"""
|
|
196
|
+
async def aremove_object(self, object_key: str) -> bool:
|
|
197
|
+
"""异步从 MinIO 删除文件"""
|
|
198
|
+
return await asyncio.to_thread(self.remove_object, object_key)
|
|
194
199
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
"""
|
|
200
|
+
def remove_prefix(self, prefix: str) -> int:
|
|
201
|
+
"""删除 MinIO 中指定前缀下的所有对象(同步,用于目录删除)"""
|
|
198
202
|
if not self._client:
|
|
199
203
|
return 0
|
|
200
204
|
try:
|
|
@@ -210,6 +214,10 @@ class MinioSyncService(metaclass=SingletonMeta):
|
|
|
210
214
|
SYLogger.warning(f"[MinIO] Delete prefix failed: {prefix}, error={e}")
|
|
211
215
|
return 0
|
|
212
216
|
|
|
217
|
+
async def aremove_prefix(self, prefix: str) -> int:
|
|
218
|
+
"""异步删除 MinIO 中指定前缀下的所有对象"""
|
|
219
|
+
return await asyncio.to_thread(self.remove_prefix, prefix)
|
|
220
|
+
|
|
213
221
|
# ============== 查找最近副本 ==============
|
|
214
222
|
|
|
215
223
|
def find_latest_object_key(self, user_id: str, file_path: str) -> Optional[str]:
|
|
@@ -252,7 +260,7 @@ class MinioSyncService(metaclass=SingletonMeta):
|
|
|
252
260
|
SYLogger.warning(f"[MinIO] find_latest failed: {e}")
|
|
253
261
|
return None
|
|
254
262
|
|
|
255
|
-
async def
|
|
263
|
+
async def afind_latest_object_key(self, user_id: str, file_path: str) -> Optional[str]:
|
|
256
264
|
"""异步查找某个文件最近一天的 object key"""
|
|
257
265
|
return await asyncio.to_thread(self.find_latest_object_key, user_id, file_path)
|
|
258
266
|
|
|
@@ -473,12 +481,17 @@ class MinioSyncService(metaclass=SingletonMeta):
|
|
|
473
481
|
files_to_upload = []
|
|
474
482
|
for rel_path in batch:
|
|
475
483
|
try:
|
|
476
|
-
|
|
477
|
-
self._client.get_object,
|
|
484
|
+
def _download_object(bucket, key):
|
|
485
|
+
resp = self._client.get_object(bucket, key)
|
|
486
|
+
try:
|
|
487
|
+
return resp.read()
|
|
488
|
+
finally:
|
|
489
|
+
resp.close()
|
|
490
|
+
resp.release_conn()
|
|
491
|
+
|
|
492
|
+
content = await asyncio.to_thread(
|
|
493
|
+
_download_object, self._bucket, f"{prefix}{rel_path}"
|
|
478
494
|
)
|
|
479
|
-
content = response.read()
|
|
480
|
-
response.close()
|
|
481
|
-
response.release_conn()
|
|
482
495
|
files_to_upload.append((f"/{rel_path}", content))
|
|
483
496
|
except Exception as e:
|
|
484
497
|
SYLogger.warning(f"[MinIO] 下载文件失败: {rel_path}, error={e}")
|
|
@@ -123,7 +123,7 @@ class SandboxRecoveryManager:
|
|
|
123
123
|
bool: 切换成功返回 True,否则返回 False
|
|
124
124
|
"""
|
|
125
125
|
# 优先使用底层已有的切换逻辑(会尝试迁移工作空间文件)
|
|
126
|
-
switched = await self.backend.
|
|
126
|
+
switched = await asyncio.to_thread(self.backend._refresh_from_nacos_and_switch_sync)
|
|
127
127
|
|
|
128
128
|
if switched:
|
|
129
129
|
self._consecutive_failures = 0
|
|
@@ -149,7 +149,8 @@ class SandboxRecoveryManager:
|
|
|
149
149
|
SYLogger.error("[Sandbox] NacosService 未初始化")
|
|
150
150
|
return False
|
|
151
151
|
|
|
152
|
-
instances =
|
|
152
|
+
instances = await asyncio.to_thread(
|
|
153
|
+
nacos_manager.get_service_instances,
|
|
153
154
|
self.backend._nacos_service_name,
|
|
154
155
|
group=self.backend._nacos_group
|
|
155
156
|
)
|