sycommon-python-lib 0.2.1a51__tar.gz → 0.2.1a52__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.1a51 → sycommon_python_lib-0.2.1a52}/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/pyproject.toml +1 -1
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/agents/factory.py +60 -46
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/__init__.py +1 -1
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/backend.py +8 -8
- sycommon_python_lib-0.2.1a52/src/sycli/core/config.py +4 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/display.py +18 -18
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/git_integration.py +32 -32
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/llm.py +10 -10
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/state.py +6 -6
- sycommon_python_lib-0.2.1a52/src/sycli/memory/__init__.py +1 -0
- sycommon_python_lib-0.2.1a52/src/sycli/memory/compressor.py +134 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/memory/full.py +14 -14
- sycommon_python_lib-0.2.1a52/src/sycli/memory/hot.py +92 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/memory/manager.py +48 -48
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/memory/warm.py +20 -20
- sycommon_python_lib-0.2.1a52/src/sycli/rl/__init__.py +1 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/rl/convergence.py +31 -31
- sycommon_python_lib-0.2.1a52/src/sycli/rl/diagnosis.py +188 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/rl/engine.py +412 -244
- sycommon_python_lib-0.2.1a52/src/sycli/rl/environment.py +237 -0
- sycommon_python_lib-0.2.1a52/src/sycli/rl/experience.py +203 -0
- sycommon_python_lib-0.2.1a52/src/sycli/rl/harness_prompts.py +93 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/rl/history.py +20 -20
- sycommon_python_lib-0.2.1a52/src/sycli/rl/pre_validation.py +106 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/rl/reward.py +34 -34
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/rl/strategy_bandit.py +34 -34
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/rl/strategy_generator.py +43 -41
- sycommon_python_lib-0.2.1a52/src/sycli/rl/strategy_prompts.py +93 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/deep_agent.py +2 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/multi_agent_team.py +3 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon_python_lib.egg-info/PKG-INFO +1 -1
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon_python_lib.egg-info/SOURCES.txt +5 -0
- sycommon_python_lib-0.2.1a51/src/sycli/core/config.py +0 -4
- sycommon_python_lib-0.2.1a51/src/sycli/memory/__init__.py +0 -1
- sycommon_python_lib-0.2.1a51/src/sycli/memory/compressor.py +0 -145
- sycommon_python_lib-0.2.1a51/src/sycli/memory/hot.py +0 -92
- sycommon_python_lib-0.2.1a51/src/sycli/rl/__init__.py +0 -1
- sycommon_python_lib-0.2.1a51/src/sycli/rl/strategy_prompts.py +0 -53
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/README.md +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/setup.cfg +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/cli.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/core/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/core/console.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/core/models.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/core/project.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/core/utils.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/templates/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/templates/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/templates/base/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/command/templates/web/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/__main__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/agents/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/agents/prompts.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/cli.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/chat_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/create_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/evaluate_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/init_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/memory_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/resume_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/rollback_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/commands/run_cmd.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/evaluate/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/evaluate/api_evaluator.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/mode/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/mode/create.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/mode/optimize.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/models/config_models.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/skills/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/agent_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/chat_events.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/sandbox/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/sandbox/file_ops.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/sandbox/http_sandbox_backend.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/sandbox/sandbox_pool.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/sandbox/sandbox_recovery.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/agent/sandbox/session.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/auth/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/auth/ldap_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/Config.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/DatabaseConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/ElasticsearchConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/EmbeddingConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/LLMConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/LangfuseConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/MQConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/RedisConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/RerankerConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/SentryConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/XxlJobConfig.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/config/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/async_base_db_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/async_database_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/base_db_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/database_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/elasticsearch_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/redis_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/database/token_usage_db_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/health/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/health/health_check.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/health/metrics.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/health/ping.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/heartbeat_process/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/heartbeat_process/heartbeat_config.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/heartbeat_process/heartbeat_process_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/heartbeat_process/heartbeat_process_worker.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/embedding.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/get_llm.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/llm_logger.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/llm_tokens.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/llm_with_token_tracking.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/native_with_fallback_runnable.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/output_fixing_runnable.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/struct_token.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/sy_langfuse.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/token_usage_es_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/token_usage_mysql_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/llm/usage_token.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/async_sql_logger.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/kafka_log.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/logger_levels.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/logger_wrapper.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/process_logger.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/logging/sql_logger.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/background_execution.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/context.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/cors.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/docs.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/exception.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/middleware.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/monitor_memory.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/mq.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/sandbox.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/timeout.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/token_tracking.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/middleware/traceid.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/base_http.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/log.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/mqlistener_config.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/mqmsg_model.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/mqsend_config.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/sandbox.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/sso_user.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/token_usage.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/token_usage_mysql.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/models/xxljob_handler_config.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/notice/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/notice/uvicorn_monitor.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/process_pool_consumer.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_client.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_pool.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_service_client_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_service_core.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/rabbitmq/rabbitmq_service_producer_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/sentry/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/sentry/sy_sentry.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/services.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/sse/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/sse/event.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/sse/sse.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/example.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/example2.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/feign.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/feign_client.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/nacos_client_base.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/nacos_config_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/nacos_heartbeat_manager.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/nacos_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/nacos_service_discovery.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/nacos_service_registration.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/synacos/param.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tests/deep_agent_server.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tests/test_deep_agent.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tests/test_email.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tests/test_mq.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/async_utils.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/docs.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/env.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/merge_headers.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/snowflake.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/syemail.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/tools/timing.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/xxljob/__init__.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon/xxljob/xxljob_service.py +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon_python_lib.egg-info/dependency_links.txt +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon_python_lib.egg-info/entry_points.txt +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon_python_lib.egg-info/requires.txt +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycommon_python_lib.egg-info/top_level.txt +0 -0
- {sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/tests/test_sycli.py +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Agent
|
|
1
|
+
"""Agent 工厂——构建 sycli 的所有 agent。"""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -10,24 +10,12 @@ from deepagents.backends.local_shell import LocalShellBackend
|
|
|
10
10
|
from deepagents.middleware.memory import MemoryMiddleware
|
|
11
11
|
from langchain_core.language_models import BaseChatModel
|
|
12
12
|
|
|
13
|
-
from sycli.agents.prompts import (
|
|
14
|
-
ANALYST_PROMPT,
|
|
15
|
-
ARCHITECT_PROMPT,
|
|
16
|
-
CODER_PROMPT,
|
|
17
|
-
CRITIC_PROMPT,
|
|
18
|
-
DATA_ANALYST_PROMPT,
|
|
19
|
-
ORCHESTRATOR_PROMPT,
|
|
20
|
-
PROMPT_ENGINEER_PROMPT,
|
|
21
|
-
RESEARCHER_PROMPT,
|
|
22
|
-
RUNTIME_OBSERVER_PROMPT,
|
|
23
|
-
SERVICE_MANAGER_PROMPT,
|
|
24
|
-
)
|
|
25
13
|
from sycli.models.config_models import SkillSettings, SycliConfig
|
|
26
14
|
|
|
27
|
-
#
|
|
15
|
+
# 内置技能目录(随 sycli 包发布)
|
|
28
16
|
_BUILTIN_SKILLS_DIR = Path(__file__).parent.parent / "skills" / "builtin"
|
|
29
17
|
|
|
30
|
-
#
|
|
18
|
+
# 映射:agent 名称 -> 内置技能目录名称列表
|
|
31
19
|
_SKILL_AGENT_MAP: dict[str, list[str]] = {
|
|
32
20
|
"coder": ["test-driven-development", "systematic-debugging"],
|
|
33
21
|
"analyst": ["systematic-debugging"],
|
|
@@ -38,14 +26,14 @@ _SKILL_AGENT_MAP: dict[str, list[str]] = {
|
|
|
38
26
|
def _get_skills_for_agent(
|
|
39
27
|
agent_name: str, config_skills: SkillSettings
|
|
40
28
|
) -> list[str] | None:
|
|
41
|
-
"""
|
|
29
|
+
"""返回指定 agent 的技能源路径,根据启用的配置进行过滤。
|
|
42
30
|
|
|
43
|
-
|
|
31
|
+
如果没有技能适用于此 agent,则返回 None(不设置 skills 键)。
|
|
44
32
|
"""
|
|
45
33
|
skill_names = _SKILL_AGENT_MAP.get(agent_name, [])
|
|
46
34
|
if not skill_names:
|
|
47
35
|
return None
|
|
48
|
-
#
|
|
36
|
+
# 根据 config.enabled 过滤(空列表 = 全部禁用;仅包含已启用的)
|
|
49
37
|
if config_skills.enabled is not None and len(config_skills.enabled) >= 0:
|
|
50
38
|
if not config_skills.enabled:
|
|
51
39
|
return None
|
|
@@ -57,7 +45,7 @@ def _get_skills_for_agent(
|
|
|
57
45
|
|
|
58
46
|
|
|
59
47
|
def _inject_project_root(prompt: str, project_root: str) -> str:
|
|
60
|
-
"""
|
|
48
|
+
"""将 __PROJECT_ROOT__ 占位符替换为实际的项目根目录路径。"""
|
|
61
49
|
return prompt.replace("__PROJECT_ROOT__", project_root)
|
|
62
50
|
|
|
63
51
|
|
|
@@ -66,13 +54,13 @@ def _memory_middleware(
|
|
|
66
54
|
project_name: str,
|
|
67
55
|
agent_role: str,
|
|
68
56
|
) -> MemoryMiddleware:
|
|
69
|
-
"""
|
|
57
|
+
"""创建带有按 agent 源路径的 MemoryMiddleware。
|
|
70
58
|
|
|
71
|
-
|
|
72
|
-
1. hot/context.md -
|
|
73
|
-
2. warm/agents/{role}.md -
|
|
74
|
-
3. warm/strategies.md -
|
|
75
|
-
4. warm/anti_patterns.md -
|
|
59
|
+
按顺序加载的源(拼接):
|
|
60
|
+
1. hot/context.md - 第 0+1 层:工作记忆
|
|
61
|
+
2. warm/agents/{role}.md - 第 2 层:agent 特定压缩
|
|
62
|
+
3. warm/strategies.md - 第 2 层:共享策略
|
|
63
|
+
4. warm/anti_patterns.md - 第 2 层:共享反模式
|
|
76
64
|
"""
|
|
77
65
|
return MemoryMiddleware(
|
|
78
66
|
backend=backend,
|
|
@@ -85,6 +73,30 @@ def _memory_middleware(
|
|
|
85
73
|
)
|
|
86
74
|
|
|
87
75
|
|
|
76
|
+
def _get_prompt(
|
|
77
|
+
builtin_attr: str,
|
|
78
|
+
harness: Any | None = None,
|
|
79
|
+
agent_name: str = "",
|
|
80
|
+
project_root: str = "",
|
|
81
|
+
) -> str:
|
|
82
|
+
"""从 harness(基于文件)获取提示词,或回退到内置默认值。
|
|
83
|
+
|
|
84
|
+
对任一来源应用 __PROJECT_ROOT__ 注入。
|
|
85
|
+
"""
|
|
86
|
+
prompt = ""
|
|
87
|
+
if harness is not None:
|
|
88
|
+
prompt = harness.get_prompt(agent_name)
|
|
89
|
+
if not prompt:
|
|
90
|
+
prompt = getattr(
|
|
91
|
+
__import__("sycli.agents.prompts", fromlist=[builtin_attr]),
|
|
92
|
+
builtin_attr,
|
|
93
|
+
"",
|
|
94
|
+
)
|
|
95
|
+
if project_root:
|
|
96
|
+
prompt = _inject_project_root(prompt, project_root)
|
|
97
|
+
return prompt
|
|
98
|
+
|
|
99
|
+
|
|
88
100
|
def build_subagents(
|
|
89
101
|
config: SycliConfig,
|
|
90
102
|
llm: BaseChatModel,
|
|
@@ -92,24 +104,26 @@ def build_subagents(
|
|
|
92
104
|
project_name: str,
|
|
93
105
|
mode: str = "optimize",
|
|
94
106
|
project_root: str | None = None,
|
|
107
|
+
harness: Any | None = None,
|
|
95
108
|
) -> list[SubAgent]:
|
|
96
|
-
"""
|
|
109
|
+
"""根据模式构建所有 agent 的 SubAgent 规格。
|
|
97
110
|
|
|
98
111
|
Args:
|
|
99
|
-
config: sycli
|
|
100
|
-
llm:
|
|
101
|
-
backend:
|
|
102
|
-
project_name:
|
|
103
|
-
mode: "optimize"
|
|
104
|
-
project_root:
|
|
112
|
+
config: sycli 配置。
|
|
113
|
+
llm: 所有 agent 共享的 LLM 实例。
|
|
114
|
+
backend: 所有 agent 共享的 LocalShellBackend。
|
|
115
|
+
project_name: 用于记忆路径的项目名称。
|
|
116
|
+
mode: "optimize" 或 "create"。
|
|
117
|
+
project_root: 要注入提示词的绝对项目根目录路径。
|
|
118
|
+
harness: 可选的 HarnessPromptManager,用于基于文件的提示词。
|
|
105
119
|
|
|
106
120
|
Returns:
|
|
107
|
-
|
|
121
|
+
要传递给编排器的 SubAgent 规格列表。
|
|
108
122
|
"""
|
|
109
123
|
agents: list[SubAgent] = []
|
|
110
124
|
root = project_root or str(backend.cwd)
|
|
111
125
|
|
|
112
|
-
# ---
|
|
126
|
+
# --- 核心 agent(始终可用) ---
|
|
113
127
|
|
|
114
128
|
agents.append({
|
|
115
129
|
"name": "researcher",
|
|
@@ -117,7 +131,7 @@ def build_subagents(
|
|
|
117
131
|
"Explores the codebase to understand structure, find relevant files, "
|
|
118
132
|
"analyze dependencies and patterns. Use FIRST before coding."
|
|
119
133
|
),
|
|
120
|
-
"system_prompt":
|
|
134
|
+
"system_prompt": _get_prompt("RESEARCHER_PROMPT", harness, "researcher", root),
|
|
121
135
|
"model": llm,
|
|
122
136
|
"middleware": [_memory_middleware(backend, project_name, "researcher")],
|
|
123
137
|
})
|
|
@@ -129,7 +143,7 @@ def build_subagents(
|
|
|
129
143
|
"The ONLY agent with write/edit capabilities. "
|
|
130
144
|
"Auto-fixes compilation errors before reporting."
|
|
131
145
|
),
|
|
132
|
-
"system_prompt":
|
|
146
|
+
"system_prompt": _get_prompt("CODER_PROMPT", harness, "coder", root),
|
|
133
147
|
"model": llm,
|
|
134
148
|
"middleware": [_memory_middleware(backend, project_name, "coder")],
|
|
135
149
|
"skills": _get_skills_for_agent("coder", config.skills),
|
|
@@ -142,13 +156,13 @@ def build_subagents(
|
|
|
142
156
|
"Read + execute access, no write. "
|
|
143
157
|
"Produces a structured evaluation report."
|
|
144
158
|
),
|
|
145
|
-
"system_prompt":
|
|
159
|
+
"system_prompt": _get_prompt("CRITIC_PROMPT", harness, "critic", root),
|
|
146
160
|
"model": llm,
|
|
147
161
|
"middleware": [_memory_middleware(backend, project_name, "critic")],
|
|
148
162
|
"skills": _get_skills_for_agent("critic", config.skills),
|
|
149
163
|
})
|
|
150
164
|
|
|
151
|
-
# ---
|
|
165
|
+
# --- 深度分析 agent(始终可用) ---
|
|
152
166
|
|
|
153
167
|
agents.append({
|
|
154
168
|
"name": "analyst",
|
|
@@ -157,13 +171,13 @@ def build_subagents(
|
|
|
157
171
|
"analyzes data flow and root causes. Read-only. "
|
|
158
172
|
"Use after researcher to provide deeper context for the coder."
|
|
159
173
|
),
|
|
160
|
-
"system_prompt":
|
|
174
|
+
"system_prompt": _get_prompt("ANALYST_PROMPT", harness, "analyst", root),
|
|
161
175
|
"model": llm,
|
|
162
176
|
"middleware": [_memory_middleware(backend, project_name, "analyst")],
|
|
163
177
|
"skills": _get_skills_for_agent("analyst", config.skills),
|
|
164
178
|
})
|
|
165
179
|
|
|
166
|
-
# ---
|
|
180
|
+
# --- 服务管理器 agent(始终可用) ---
|
|
167
181
|
|
|
168
182
|
agents.append({
|
|
169
183
|
"name": "service_manager",
|
|
@@ -172,7 +186,7 @@ def build_subagents(
|
|
|
172
186
|
"fresh, health-checks. Read + execute, no write. "
|
|
173
187
|
"Use after coder to restart the service before API evaluation."
|
|
174
188
|
),
|
|
175
|
-
"system_prompt":
|
|
189
|
+
"system_prompt": _get_prompt("SERVICE_MANAGER_PROMPT", harness, "service_manager", root),
|
|
176
190
|
"model": llm,
|
|
177
191
|
"middleware": [_memory_middleware(backend, project_name, "service_manager")],
|
|
178
192
|
})
|
|
@@ -184,7 +198,7 @@ def build_subagents(
|
|
|
184
198
|
"Read + execute access, no write. "
|
|
185
199
|
"Produces a runtime validation report."
|
|
186
200
|
),
|
|
187
|
-
"system_prompt":
|
|
201
|
+
"system_prompt": _get_prompt("RUNTIME_OBSERVER_PROMPT", harness, "runtime_observer", root),
|
|
188
202
|
"model": llm,
|
|
189
203
|
"middleware": [_memory_middleware(backend, project_name, "runtime_observer")],
|
|
190
204
|
})
|
|
@@ -196,12 +210,12 @@ def build_subagents(
|
|
|
196
210
|
"Read-only. Only called when a round scores below threshold. "
|
|
197
211
|
"Produces actionable optimization suggestions."
|
|
198
212
|
),
|
|
199
|
-
"system_prompt": PROMPT_ENGINEER_PROMPT,
|
|
213
|
+
"system_prompt": _get_prompt("PROMPT_ENGINEER_PROMPT", harness, "prompt_engineer"),
|
|
200
214
|
"model": llm,
|
|
201
215
|
"middleware": [_memory_middleware(backend, project_name, "prompt_engineer")],
|
|
202
216
|
})
|
|
203
217
|
|
|
204
|
-
# --- CREATE
|
|
218
|
+
# --- 仅 CREATE 模式 ---
|
|
205
219
|
|
|
206
220
|
if mode == "create":
|
|
207
221
|
agents.append({
|
|
@@ -211,7 +225,7 @@ def build_subagents(
|
|
|
211
225
|
"CREATE mode only. Read-only. "
|
|
212
226
|
"Produces a complete architecture blueprint."
|
|
213
227
|
),
|
|
214
|
-
"system_prompt":
|
|
228
|
+
"system_prompt": _get_prompt("ARCHITECT_PROMPT", harness, "architect", root),
|
|
215
229
|
"model": llm,
|
|
216
230
|
"middleware": [_memory_middleware(backend, project_name, "architect")],
|
|
217
231
|
})
|
|
@@ -223,7 +237,7 @@ def build_subagents(
|
|
|
223
237
|
"CREATE mode only. Read + execute. "
|
|
224
238
|
"Produces a data analysis report with seed data."
|
|
225
239
|
),
|
|
226
|
-
"system_prompt":
|
|
240
|
+
"system_prompt": _get_prompt("DATA_ANALYST_PROMPT", harness, "data_analyst", root),
|
|
227
241
|
"model": llm,
|
|
228
242
|
"middleware": [_memory_middleware(backend, project_name, "data_analyst")],
|
|
229
243
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""sycli agent 的 LocalShellBackend 工厂。"""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -14,18 +14,18 @@ def create_backend(
|
|
|
14
14
|
max_output_bytes: int = 100_000,
|
|
15
15
|
inherit_env: bool = True,
|
|
16
16
|
) -> LocalShellBackend:
|
|
17
|
-
"""
|
|
17
|
+
"""为 sycli agent 创建 LocalShellBackend。
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
所有 agent 共享一个在项目根目录上运行的后端实例。
|
|
20
20
|
|
|
21
21
|
Args:
|
|
22
|
-
project_root:
|
|
23
|
-
timeout:
|
|
24
|
-
max_output_bytes:
|
|
25
|
-
inherit_env:
|
|
22
|
+
project_root: 项目目录。
|
|
23
|
+
timeout: 默认 shell 命令超时(秒)。
|
|
24
|
+
max_output_bytes: 截断前的最大捕获输出字节数。
|
|
25
|
+
inherit_env: 是否继承系统环境变量。
|
|
26
26
|
|
|
27
27
|
Returns:
|
|
28
|
-
|
|
28
|
+
已配置的 LocalShellBackend。
|
|
29
29
|
"""
|
|
30
30
|
return LocalShellBackend(
|
|
31
31
|
root_dir=str(project_root),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""带颜色支持的终端显示工具。"""
|
|
2
2
|
|
|
3
3
|
import sys
|
|
4
4
|
import threading
|
|
@@ -38,8 +38,8 @@ def header(msg: str) -> None:
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def round_header(round_num: int, max_rounds: int, score: float | None = None) -> None:
|
|
41
|
-
score_str = f" |
|
|
42
|
-
print(f"\n{Colors.BOLD}{'─' * 10}
|
|
41
|
+
score_str = f" | 得分: {score:.3f}" if score is not None else ""
|
|
42
|
+
print(f"\n{Colors.BOLD}{'─' * 10} 第 {round_num}/{max_rounds} 轮{score_str} {'─' * 10}{Colors.RESET}")
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
def agent_result(agent_name: str, reward: float, summary: str) -> None:
|
|
@@ -57,27 +57,27 @@ def final_report(
|
|
|
57
57
|
strategy: str,
|
|
58
58
|
) -> None:
|
|
59
59
|
print(f"\n{Colors.BOLD}{Colors.GREEN}{'═' * 50}{Colors.RESET}")
|
|
60
|
-
print(f"{Colors.BOLD}{Colors.GREEN}
|
|
60
|
+
print(f"{Colors.BOLD}{Colors.GREEN} 优化完成{Colors.RESET}")
|
|
61
61
|
print(f"{Colors.BOLD}{Colors.GREEN}{'═' * 50}{Colors.RESET}")
|
|
62
|
-
print(f"
|
|
63
|
-
print(f"
|
|
64
|
-
print(f"
|
|
65
|
-
print(f"
|
|
62
|
+
print(f" 总轮次: {total_rounds}")
|
|
63
|
+
print(f" 得分变化: {initial_score:.3f} → {final_score:.3f} ({final_score - initial_score:+.3f})")
|
|
64
|
+
print(f" 最佳轮次: {best_round} (得分: {best_score:.3f})")
|
|
65
|
+
print(f" 最佳策略: {strategy}")
|
|
66
66
|
print(f"{Colors.BOLD}{Colors.GREEN}{'═' * 50}{Colors.RESET}\n")
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
def agent_thinking(agent_name: str) -> None:
|
|
70
|
-
"""
|
|
71
|
-
print(f"{Colors.DIM} ⋯ {agent_name}
|
|
70
|
+
"""打印 agent 的思考指示器。"""
|
|
71
|
+
print(f"{Colors.DIM} ⋯ {agent_name} 思考中...{Colors.RESET}", end="", flush=True)
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
def agent_done(agent_name: str) -> None:
|
|
75
|
-
"""
|
|
76
|
-
print(f"\r{Colors.GREEN} ✔ {agent_name}
|
|
75
|
+
"""清除思考指示器并打印完成。"""
|
|
76
|
+
print(f"\r{Colors.GREEN} ✔ {agent_name} 完成。 {Colors.RESET}")
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
def user_prompt() -> str:
|
|
80
|
-
"""
|
|
80
|
+
"""显示交互式提示并获取用户输入。"""
|
|
81
81
|
print(f"\n{Colors.MAGENTA}{Colors.BOLD}sycli > {Colors.RESET}", end="", flush=True)
|
|
82
82
|
try:
|
|
83
83
|
return input().strip()
|
|
@@ -86,11 +86,11 @@ def user_prompt() -> str:
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
def chat_banner() -> None:
|
|
89
|
-
"""
|
|
90
|
-
print(f"\n{Colors.BOLD}{Colors.CYAN}──
|
|
91
|
-
print(f"
|
|
92
|
-
print(f"
|
|
89
|
+
"""打印聊天模式横幅。"""
|
|
90
|
+
print(f"\n{Colors.BOLD}{Colors.CYAN}── 交互模式 ──{Colors.RESET}")
|
|
91
|
+
print(f" 命令: {Colors.BOLD}continue{Colors.RESET} | {Colors.BOLD}stop{Colors.RESET} | {Colors.BOLD}hint <文本>{Colors.RESET} | {Colors.BOLD}skip{Colors.RESET} | {Colors.BOLD}status{Colors.RESET}")
|
|
92
|
+
print(f" 按 Enter 继续下一轮\n")
|
|
93
93
|
|
|
94
94
|
|
|
95
|
-
#
|
|
95
|
+
# 线程安全打印锁
|
|
96
96
|
_print_lock = threading.Lock()
|
{sycommon_python_lib-0.2.1a51 → sycommon_python_lib-0.2.1a52}/src/sycli/core/git_integration.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""sycli 的 Git 检查点与回滚集成。"""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -9,17 +9,17 @@ from sycli.core.display import error, info, success, warning
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
def git_checkpoint(project_root: Path, message: str) -> bool:
|
|
12
|
-
"""
|
|
12
|
+
"""暂存所有更改并创建 git 提交作为检查点。
|
|
13
13
|
|
|
14
14
|
Args:
|
|
15
|
-
project_root:
|
|
16
|
-
message:
|
|
15
|
+
project_root: 项目根目录。
|
|
16
|
+
message: 提交消息。
|
|
17
17
|
|
|
18
18
|
Returns:
|
|
19
|
-
True
|
|
19
|
+
如果成功创建检查点返回 True,否则返回 False。
|
|
20
20
|
"""
|
|
21
21
|
try:
|
|
22
|
-
#
|
|
22
|
+
# 检查是否在 git 仓库内
|
|
23
23
|
result = subprocess.run(
|
|
24
24
|
["git", "rev-parse", "--is-inside-work-tree"],
|
|
25
25
|
cwd=str(project_root),
|
|
@@ -30,7 +30,7 @@ def git_checkpoint(project_root: Path, message: str) -> bool:
|
|
|
30
30
|
if result.returncode != 0:
|
|
31
31
|
return False
|
|
32
32
|
|
|
33
|
-
#
|
|
33
|
+
# 暂存所有更改(遵循 .gitignore)
|
|
34
34
|
subprocess.run(
|
|
35
35
|
["git", "add", "-A"],
|
|
36
36
|
cwd=str(project_root),
|
|
@@ -38,7 +38,7 @@ def git_checkpoint(project_root: Path, message: str) -> bool:
|
|
|
38
38
|
timeout=10,
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
#
|
|
41
|
+
# 检查是否有可提交的更改
|
|
42
42
|
result = subprocess.run(
|
|
43
43
|
["git", "diff", "--cached", "--quiet"],
|
|
44
44
|
cwd=str(project_root),
|
|
@@ -46,10 +46,10 @@ def git_checkpoint(project_root: Path, message: str) -> bool:
|
|
|
46
46
|
timeout=10,
|
|
47
47
|
)
|
|
48
48
|
if result.returncode == 0:
|
|
49
|
-
#
|
|
49
|
+
# 没有可提交的更改
|
|
50
50
|
return False
|
|
51
51
|
|
|
52
|
-
#
|
|
52
|
+
# 提交
|
|
53
53
|
result = subprocess.run(
|
|
54
54
|
["git", "commit", "-m", message],
|
|
55
55
|
cwd=str(project_root),
|
|
@@ -64,20 +64,20 @@ def git_checkpoint(project_root: Path, message: str) -> bool:
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
def git_rollback(project_root: Path, round_num: int) -> bool:
|
|
67
|
-
"""
|
|
67
|
+
"""回滚到之前轮次的检查点。
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
使用 `git revert` 撤销目标轮次之后的所有提交,
|
|
70
|
+
在当前基础上创建新的提交。此操作会保留历史记录。
|
|
71
71
|
|
|
72
72
|
Args:
|
|
73
|
-
project_root:
|
|
74
|
-
round_num:
|
|
73
|
+
project_root: 项目根目录。
|
|
74
|
+
round_num: 要回滚到的目标轮次编号。
|
|
75
75
|
|
|
76
76
|
Returns:
|
|
77
|
-
True
|
|
77
|
+
如果回滚成功返回 True,否则返回 False。
|
|
78
78
|
"""
|
|
79
79
|
try:
|
|
80
|
-
#
|
|
80
|
+
# 按顺序查找所有轮次提交
|
|
81
81
|
result = subprocess.run(
|
|
82
82
|
["git", "log", "--oneline", "--all"],
|
|
83
83
|
cwd=str(project_root),
|
|
@@ -87,7 +87,7 @@ def git_rollback(project_root: Path, round_num: int) -> bool:
|
|
|
87
87
|
)
|
|
88
88
|
lines = result.stdout.strip().split("\n")
|
|
89
89
|
|
|
90
|
-
#
|
|
90
|
+
# 建立轮次 -> 提交哈希的映射
|
|
91
91
|
round_commits: dict[int, str] = {}
|
|
92
92
|
for line in lines:
|
|
93
93
|
import re
|
|
@@ -97,22 +97,22 @@ def git_rollback(project_root: Path, round_num: int) -> bool:
|
|
|
97
97
|
|
|
98
98
|
target_commit = round_commits.get(round_num)
|
|
99
99
|
if not target_commit:
|
|
100
|
-
error(f"
|
|
100
|
+
error(f"未找到第 {round_num} 轮的 git 检查点")
|
|
101
101
|
return False
|
|
102
102
|
|
|
103
|
-
info(f"
|
|
103
|
+
info(f"找到检查点: {target_commit}(第 {round_num} 轮)")
|
|
104
104
|
|
|
105
|
-
#
|
|
105
|
+
# 查找需要回退的提交:目标轮次之后的所有轮次提交
|
|
106
106
|
commits_to_revert = []
|
|
107
107
|
for rn in sorted(round_commits.keys()):
|
|
108
108
|
if rn > round_num:
|
|
109
109
|
commits_to_revert.append(round_commits[rn])
|
|
110
110
|
|
|
111
111
|
if not commits_to_revert:
|
|
112
|
-
info(f"
|
|
112
|
+
info(f"第 {round_num} 轮已是最新检查点,无需回退。")
|
|
113
113
|
return True
|
|
114
114
|
|
|
115
|
-
#
|
|
115
|
+
# 按逆序回退提交(最新的先)以避免冲突
|
|
116
116
|
for commit_hash in reversed(commits_to_revert):
|
|
117
117
|
result = subprocess.run(
|
|
118
118
|
["git", "revert", "--no-commit", commit_hash],
|
|
@@ -122,17 +122,17 @@ def git_rollback(project_root: Path, round_num: int) -> bool:
|
|
|
122
122
|
timeout=15,
|
|
123
123
|
)
|
|
124
124
|
if result.returncode != 0:
|
|
125
|
-
#
|
|
125
|
+
# 冲突时中止回退
|
|
126
126
|
subprocess.run(
|
|
127
127
|
["git", "revert", "--abort"],
|
|
128
128
|
cwd=str(project_root),
|
|
129
129
|
capture_output=True,
|
|
130
130
|
timeout=5,
|
|
131
131
|
)
|
|
132
|
-
error(f"
|
|
132
|
+
error(f"回退 {commit_hash} 失败(冲突): {result.stderr}")
|
|
133
133
|
return False
|
|
134
134
|
|
|
135
|
-
#
|
|
135
|
+
# 提交累积的回退
|
|
136
136
|
result = subprocess.run(
|
|
137
137
|
["git", "commit", "-m", f"sycli: rollback to round {round_num}"],
|
|
138
138
|
cwd=str(project_root),
|
|
@@ -142,19 +142,19 @@ def git_rollback(project_root: Path, round_num: int) -> bool:
|
|
|
142
142
|
)
|
|
143
143
|
|
|
144
144
|
if result.returncode == 0:
|
|
145
|
-
success(f"
|
|
145
|
+
success(f"已回退到第 {round_num} 轮(回退了 {len(commits_to_revert)} 个提交)")
|
|
146
146
|
return True
|
|
147
147
|
else:
|
|
148
|
-
error(f"
|
|
148
|
+
error(f"回退提交失败: {result.stderr}")
|
|
149
149
|
return False
|
|
150
150
|
|
|
151
151
|
except (subprocess.TimeoutExpired, FileNotFoundError) as e:
|
|
152
|
-
error(f"Git
|
|
152
|
+
error(f"Git 回退失败: {e}")
|
|
153
153
|
return False
|
|
154
154
|
|
|
155
155
|
|
|
156
156
|
def git_is_repo(project_root: Path) -> bool:
|
|
157
|
-
"""
|
|
157
|
+
"""检查目录是否在 git 仓库内。"""
|
|
158
158
|
try:
|
|
159
159
|
result = subprocess.run(
|
|
160
160
|
["git", "rev-parse", "--is-inside-work-tree"],
|
|
@@ -169,7 +169,7 @@ def git_is_repo(project_root: Path) -> bool:
|
|
|
169
169
|
|
|
170
170
|
|
|
171
171
|
def git_current_branch(project_root: Path) -> str | None:
|
|
172
|
-
"""
|
|
172
|
+
"""获取当前 git 分支名称。"""
|
|
173
173
|
try:
|
|
174
174
|
result = subprocess.run(
|
|
175
175
|
["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
|
@@ -184,7 +184,7 @@ def git_current_branch(project_root: Path) -> str | None:
|
|
|
184
184
|
|
|
185
185
|
|
|
186
186
|
def git_has_changes(project_root: Path) -> bool:
|
|
187
|
-
"""
|
|
187
|
+
"""检查是否有未提交的更改。"""
|
|
188
188
|
try:
|
|
189
189
|
result = subprocess.run(
|
|
190
190
|
["git", "status", "--porcelain"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""sycli 的独立 LLM 初始化。
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
直接使用 langchain 的 init_chat_model,绕过 sycommon.config.Config。
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
@@ -18,24 +18,24 @@ def create_llm(
|
|
|
18
18
|
temperature: float | None = None,
|
|
19
19
|
thinking: bool | None = None,
|
|
20
20
|
) -> BaseChatModel:
|
|
21
|
-
"""
|
|
21
|
+
"""从 sycli.json 配置创建 LLM 实例。
|
|
22
22
|
|
|
23
23
|
Args:
|
|
24
|
-
settings:
|
|
25
|
-
streaming:
|
|
26
|
-
temperature:
|
|
27
|
-
thinking:
|
|
24
|
+
settings: 来自 sycli.json 的 LLM 配置。
|
|
25
|
+
streaming: 是否启用流式输出。
|
|
26
|
+
temperature: 如果提供,覆盖默认温度。
|
|
27
|
+
thinking: 启用思考/推理模式。
|
|
28
28
|
|
|
29
29
|
Returns:
|
|
30
|
-
|
|
30
|
+
BaseChatModel 实例。
|
|
31
31
|
"""
|
|
32
32
|
base_url = settings.resolved_base_url()
|
|
33
33
|
api_key = settings.resolved_api_key()
|
|
34
34
|
|
|
35
35
|
if not base_url:
|
|
36
36
|
raise ValueError(
|
|
37
|
-
f"LLM base_url
|
|
38
|
-
f"
|
|
37
|
+
f"LLM base_url 为空。请设置 {settings.base_url_env} 环境变量 "
|
|
38
|
+
f"或在 sycli.json 中设置 base_url"
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
effective_temp = temperature if temperature is not None else settings.temperature
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"""
|
|
1
|
+
"""共享 RL 状态持久化——保存/加载的单一数据源。
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
被 engine.py(OPTIMIZE)和 create.py(CREATE)共同使用。
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
@@ -11,17 +11,17 @@ from pathlib import Path
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def save_state(sycli_dir: Path, state: dict) -> None:
|
|
14
|
-
"""
|
|
14
|
+
"""原子性地将 RL 状态保存到磁盘。"""
|
|
15
15
|
state_file = sycli_dir / "rl_state.json"
|
|
16
16
|
state_file.parent.mkdir(parents=True, exist_ok=True)
|
|
17
|
-
#
|
|
17
|
+
# 先写入临时文件,然后重命名以确保原子性
|
|
18
18
|
fd, tmp_path = tempfile.mkstemp(
|
|
19
19
|
dir=str(state_file.parent), suffix=".tmp", prefix="rl_state_"
|
|
20
20
|
)
|
|
21
21
|
try:
|
|
22
22
|
with open(fd, "w") as f:
|
|
23
23
|
json.dump(state, f, indent=2, ensure_ascii=False)
|
|
24
|
-
#
|
|
24
|
+
# 原子重命名(POSIX)
|
|
25
25
|
Path(tmp_path).replace(state_file)
|
|
26
26
|
except Exception:
|
|
27
27
|
Path(tmp_path).unlink(missing_ok=True)
|
|
@@ -29,7 +29,7 @@ def save_state(sycli_dir: Path, state: dict) -> None:
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
def load_state(sycli_dir: Path) -> dict:
|
|
32
|
-
"""
|
|
32
|
+
"""从磁盘加载 RL 状态。"""
|
|
33
33
|
state_file = sycli_dir / "rl_state.json"
|
|
34
34
|
if state_file.exists():
|
|
35
35
|
try:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""sycli 内存管理包。"""
|