sycommon-python-lib 0.2.4a6__py3-none-any.whl → 0.2.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. sycli/cdp/client.py +7 -0
  2. sycommon/agent/chat_events.py +36 -0
  3. sycommon/agent/deep_agent.py +746 -86
  4. sycommon/agent/mcp/models.py +4 -0
  5. sycommon/agent/mcp/tool_loader.py +145 -44
  6. sycommon/agent/multi_agent_team.py +39 -51
  7. sycommon/agent/sandbox/file_ops.py +71 -16
  8. sycommon/agent/sandbox/http_sandbox_backend.py +496 -255
  9. sycommon/agent/sandbox/minio_sync.py +71 -16
  10. sycommon/agent/sandbox/sandbox_recovery.py +3 -2
  11. sycommon/agent/summarization_utils.py +154 -2
  12. sycommon/auth/__init__.py +23 -0
  13. sycommon/auth/oa_cache.py +95 -0
  14. sycommon/auth/oa_crypto.py +60 -0
  15. sycommon/auth/oa_service.py +201 -0
  16. sycommon/auth/wecom_ldap_service.py +284 -101
  17. sycommon/database/async_base_db_service.py +82 -4
  18. sycommon/database/async_database_service.py +12 -2
  19. sycommon/database/base_db_service.py +84 -0
  20. sycommon/database/database_service.py +12 -2
  21. sycommon/database/pg_checkpoint_service.py +21 -1
  22. sycommon/llm/llm_with_token_tracking.py +27 -9
  23. sycommon/llm/struct_token.py +69 -10
  24. sycommon/llm/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4 +100256 -0
  25. sycommon/llm/tiktoken_cache/fb374d419588a4632f3f557e76b4b70aebbca790 +199998 -0
  26. sycommon/llm/token_utils.py +96 -0
  27. sycommon/llm/usage_token.py +25 -0
  28. sycommon/logging/kafka_log.py +71 -9
  29. sycommon/mcp_server/__init__.py +13 -0
  30. sycommon/mcp_server/server.py +184 -0
  31. sycommon/middleware/middleware.py +4 -0
  32. sycommon/middleware/sandbox.py +306 -629
  33. sycommon/middleware/tool_result_truncation.py +154 -21
  34. sycommon/middleware/traceid.py +2 -10
  35. sycommon/models/mcp_server_config.py +36 -0
  36. sycommon/models/mqlistener_config.py +2 -0
  37. sycommon/models/sandbox.py +11 -0
  38. sycommon/rabbitmq/process_pool_consumer.py +4 -4
  39. sycommon/rabbitmq/rabbitmq_client.py +151 -81
  40. sycommon/rabbitmq/rabbitmq_service_client_manager.py +26 -18
  41. sycommon/rabbitmq/rabbitmq_service_connection_monitor.py +55 -4
  42. sycommon/rabbitmq/rabbitmq_service_consumer_manager.py +19 -22
  43. sycommon/rabbitmq/rabbitmq_service_producer_manager.py +2 -1
  44. sycommon/services.py +51 -2
  45. sycommon/synacos/feign.py +5 -2
  46. sycommon/synacos/feign_client.py +7 -4
  47. sycommon/synacos/nacos_service.py +4 -4
  48. sycommon/tests/test_consumer_loss_rootcause.py +399 -0
  49. sycommon/tests/test_consumer_recovery.py +283 -0
  50. sycommon/tests/test_dynamic_max_tokens.py +372 -0
  51. sycommon/tests/test_encoding_cache.py +148 -0
  52. sycommon/tests/test_fix_verification.py +404 -0
  53. sycommon/tests/test_mcp_server.py +401 -0
  54. sycommon/tests/test_minimax_reasoning.py +290 -0
  55. sycommon/tests/test_oa_login.py +229 -0
  56. sycommon/tests/test_summary_leak_e2e.py +872 -0
  57. sycommon/tools/snowflake.py +32 -76
  58. {sycommon_python_lib-0.2.4a6.dist-info → sycommon_python_lib-0.2.5.dist-info}/METADATA +40 -39
  59. {sycommon_python_lib-0.2.4a6.dist-info → sycommon_python_lib-0.2.5.dist-info}/RECORD +62 -45
  60. sycommon/middleware/background_execution.py +0 -568
  61. {sycommon_python_lib-0.2.4a6.dist-info → sycommon_python_lib-0.2.5.dist-info}/WHEEL +0 -0
  62. {sycommon_python_lib-0.2.4a6.dist-info → sycommon_python_lib-0.2.5.dist-info}/entry_points.txt +0 -0
  63. {sycommon_python_lib-0.2.4a6.dist-info → sycommon_python_lib-0.2.5.dist-info}/top_level.txt +0 -0
sycli/cdp/client.py CHANGED
@@ -29,6 +29,13 @@ class CDPClient:
29
29
 
30
30
  # ── Connection lifecycle ──────────────────────────────────────
31
31
 
32
+ async def __aenter__(self) -> CDPClient:
33
+ await self.connect()
34
+ return self
35
+
36
+ async def __aexit__(self, *exc) -> None:
37
+ await self.close()
38
+
32
39
  async def connect(self) -> None:
33
40
  self._session = aiohttp.ClientSession()
34
41
  self._ws = await self._session.ws_connect(
@@ -62,6 +62,9 @@ class EventType(str, Enum):
62
62
  PARALLEL_AGENTS = "parallel_agents" # 并行 Agent
63
63
  AGENT_COMPLETE = "agent_complete" # Agent 任务完成
64
64
 
65
+ # 评分相关
66
+ RUBRIC_EVALUATION = "rubric_evaluation" # Rubric 评估结果
67
+
65
68
  # 生命周期
66
69
  DONE = "done" # 完成
67
70
  ERROR = "error" # 错误
@@ -368,6 +371,39 @@ class ChatEventBuilder:
368
371
  """
369
372
  return ChatEvent(EventType.CANCELLED, {"message": message})
370
373
 
374
+ # ============== 评分相关 ==============
375
+
376
+ @staticmethod
377
+ def rubric_evaluation(
378
+ iteration: int,
379
+ result: str,
380
+ criteria: list,
381
+ explanation: str = "",
382
+ agent: str = DEFAULT_AGENT_NAME,
383
+ ) -> ChatEvent:
384
+ """
385
+ 构建 Rubric 评估事件
386
+
387
+ Args:
388
+ iteration: 评估迭代次数
389
+ result: 评估结果(satisfied / needs_revision / failed / max_iterations_reached / grader_error)
390
+ criteria: 各评分标准的判定列表
391
+ explanation: 评估说明
392
+ agent: Agent 名称
393
+
394
+ Returns:
395
+ ChatEvent: 评估事件
396
+ """
397
+ data = {
398
+ "iteration": iteration,
399
+ "result": result,
400
+ "criteria": criteria,
401
+ "agent": agent,
402
+ }
403
+ if explanation:
404
+ data["explanation"] = explanation
405
+ return ChatEvent(EventType.RUBRIC_EVALUATION, data)
406
+
371
407
 
372
408
  # ============== 便捷函数(直接返回字典,兼容旧代码) ==============
373
409