hermes-agent-evolution 3.0.2__tar.gz → 3.0.3__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.
Files changed (103) hide show
  1. {hermes_agent_evolution-3.0.2/src/hermes_agent_evolution.egg-info → hermes_agent_evolution-3.0.3}/PKG-INFO +1 -1
  2. {hermes_agent_evolution-3.0.2/src/evolution/_plugin → hermes_agent_evolution-3.0.3/hermes-plugin}/__init__.py +23 -18
  3. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/hermes-plugin/__pycache__/__init__.cpython-311.pyc +0 -0
  4. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/hermes-plugin/__pycache__/__init__.cpython-312.pyc +0 -0
  5. {hermes_agent_evolution-3.0.2/src/evolution/_plugin → hermes_agent_evolution-3.0.3/hermes-plugin}/plugin.yaml +1 -1
  6. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/pyproject.toml +1 -1
  7. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/setup.py +1 -1
  8. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/__init__.py +3 -0
  9. {hermes_agent_evolution-3.0.2/hermes-plugin → hermes_agent_evolution-3.0.3/src/evolution/_plugin}/__init__.py +11 -11
  10. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/enhanced_tool_creator.py +71 -10
  11. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3/src/hermes_agent_evolution.egg-info}/PKG-INFO +1 -1
  12. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_iteration6_integration.py +1 -1
  13. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/CHANGELOG.md +0 -0
  14. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/MANIFEST.in +0 -0
  15. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/README.md +0 -0
  16. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/requirements.txt +0 -0
  17. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/setup.cfg +0 -0
  18. {hermes_agent_evolution-3.0.2/hermes-plugin → hermes_agent_evolution-3.0.3/src/evolution/_plugin}/plugin.yaml +0 -0
  19. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/cli.py +0 -0
  20. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/closed_loop/__init__.py +0 -0
  21. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/closed_loop/action_executor.py +0 -0
  22. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/closed_loop/daemon.py +0 -0
  23. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/closed_loop/metrics_collector.py +0 -0
  24. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/closed_loop/orchestrator.py +0 -0
  25. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/collaboration/__init__.py +0 -0
  26. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/collaboration/agent_orchestrator.py +0 -0
  27. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/collaboration/agent_registry.py +0 -0
  28. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/collaboration/message_bus.py +0 -0
  29. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/collaboration/task_dispatcher.py +0 -0
  30. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/db_utils.py +0 -0
  31. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/fusion/__init__.py +0 -0
  32. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/fusion/bridge.py +0 -0
  33. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/fusion/compatibility.py +0 -0
  34. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/fusion/unified_entry.py +0 -0
  35. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/learning/__init__.py +0 -0
  36. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/learning/analyzer.py +0 -0
  37. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/learning/experience.py +0 -0
  38. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/learning/observer.py +0 -0
  39. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/learning/pattern_recognizer.py +0 -0
  40. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/learning/tool_strategy_learner.py +0 -0
  41. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/logging_config.py +0 -0
  42. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/memory/__init__.py +0 -0
  43. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/memory/association_discoverer.py +0 -0
  44. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/memory/association_optimizer.py +0 -0
  45. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/memory/database.py +0 -0
  46. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/memory/retrieval_optimizer.py +0 -0
  47. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/security/__init__.py +0 -0
  48. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/security/audit_logger.py +0 -0
  49. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/security/permission_manager.py +0 -0
  50. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/security/sandbox_executor.py +0 -0
  51. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/security/threat_detector.py +0 -0
  52. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/self_monitor.py +0 -0
  53. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/__init__.py +0 -0
  54. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/tool_auto_generator.py +0 -0
  55. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/tool_creator.py +0 -0
  56. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/tool_integration.py +0 -0
  57. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/tool_performance_analyzer.py +0 -0
  58. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/evolution/tools/tool_registry.py +0 -0
  59. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/hermes_agent_evolution.egg-info/SOURCES.txt +0 -0
  60. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/hermes_agent_evolution.egg-info/dependency_links.txt +0 -0
  61. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/hermes_agent_evolution.egg-info/entry_points.txt +0 -0
  62. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/hermes_agent_evolution.egg-info/requires.txt +0 -0
  63. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/hermes_agent_evolution.egg-info/top_level.txt +0 -0
  64. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/__init__.py +0 -0
  65. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/core/__init__.py +0 -0
  66. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/core/config/config_manager.py +0 -0
  67. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/core/events/event_bus.py +0 -0
  68. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/core/services/service_manager.py +0 -0
  69. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/learning/__init__.py +0 -0
  70. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/learning/meta/meta_learning_service.py +0 -0
  71. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/learning/reflection/reflection_service.py +0 -0
  72. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/learning/reinforcement/rl_service.py +0 -0
  73. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/system/__init__.py +0 -0
  74. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/system/deployment/deployment_service.py +0 -0
  75. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/system/monitoring/monitoring_service.py +0 -0
  76. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/system/testing/test_service.py +0 -0
  77. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/tools/__init__.py +0 -0
  78. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/tools/composition/tool_composition_service.py +0 -0
  79. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/services/tools/discovery/tool_discovery_service.py +0 -0
  80. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/utils/__init__.py +0 -0
  81. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/utils/feishu_notifier.py +0 -0
  82. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/src/utils/progress_reporter.py +0 -0
  83. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_association_discovery.py +0 -0
  84. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_association_optimizer.py +0 -0
  85. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_closed_loop.py +0 -0
  86. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_collaboration.py +0 -0
  87. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_core_functionality.py +0 -0
  88. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_db_utils.py +0 -0
  89. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_enhanced_tool_creator.py +0 -0
  90. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_fusion.py +0 -0
  91. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_iteration3_integration.py +0 -0
  92. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_learning_evolution_integration.py +0 -0
  93. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_observer.py +0 -0
  94. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_pattern_recognizer.py +0 -0
  95. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_retrieval_optimizer.py +0 -0
  96. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_security.py +0 -0
  97. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_self_monitor.py +0 -0
  98. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_simple_integration.py +0 -0
  99. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_tool_auto_generator.py +0 -0
  100. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_tool_creator.py +0 -0
  101. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_tool_evolution.py +0 -0
  102. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_tool_integration.py +0 -0
  103. {hermes_agent_evolution-3.0.2 → hermes_agent_evolution-3.0.3}/tests/test_tool_performance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hermes-agent-evolution
3
- Version: 3.0.2
3
+ Version: 3.0.3
4
4
  Summary: AI助手自我进化系统 V1/V2/V3 融合版 - 单体+微服务混合架构
5
5
  Home-page: https://github.com/WayneLiu519888/Hermes-Agent-EvolutionV3
6
6
  Author: HermesAgentEvolution Team
@@ -48,7 +48,7 @@ def _get_tool_registry():
48
48
  """Get or create a ToolRegistry singleton."""
49
49
  if "tool_registry" not in _engine_instances:
50
50
  try:
51
- from src.evolution.tools import ToolRegistry
51
+ from evolution.tools import ToolRegistry
52
52
  project_root = Path(__file__).resolve().parent.parent
53
53
  db_path = str(project_root / "data" / "tools.db")
54
54
  _engine_instances["tool_registry"] = ToolRegistry(db_path=db_path)
@@ -62,7 +62,7 @@ def _get_learning_observer():
62
62
  """Get or create a LearningObserver singleton."""
63
63
  if "learning_observer" not in _engine_instances:
64
64
  try:
65
- from src.evolution.learning import LearningObserver
65
+ from evolution.learning import LearningObserver
66
66
  project_root = Path(__file__).resolve().parent.parent
67
67
  db_path = str(project_root / "data" / "learning_experiences.db")
68
68
  _engine_instances["learning_observer"] = LearningObserver(db_path=db_path)
@@ -76,17 +76,17 @@ def _get_orchestrator():
76
76
  """Get or create a ClosedLoopOrchestrator singleton."""
77
77
  if "orchestrator" not in _engine_instances:
78
78
  try:
79
- from src.evolution.closed_loop import (
79
+ from evolution.closed_loop import (
80
80
  ClosedLoopOrchestrator,
81
81
  SystemMetricsCollector,
82
82
  )
83
- from src.evolution.learning import (
83
+ from evolution.learning import (
84
84
  LearningObserver,
85
85
  ExperienceAnalyzer,
86
86
  PatternRecognizer,
87
87
  ToolStrategyLearner,
88
88
  )
89
- from src.evolution import SelfMonitor # top-level import
89
+ from evolution import SelfMonitor # top-level import
90
90
 
91
91
  project_root = Path(__file__).resolve().parent.parent
92
92
  db_base = str(project_root / "data")
@@ -98,7 +98,7 @@ def _get_orchestrator():
98
98
  self_monitor = SelfMonitor(observer, analyzer, strategy_learner)
99
99
  metrics_collector = SystemMetricsCollector()
100
100
  pattern_recognizer = PatternRecognizer()
101
- from src.evolution.closed_loop import ActionExecutor
101
+ from evolution.closed_loop import ActionExecutor
102
102
  action_executor = ActionExecutor()
103
103
 
104
104
  _engine_instances["orchestrator"] = ClosedLoopOrchestrator(
@@ -133,7 +133,7 @@ def _get_tool_performance_analyzer():
133
133
  """Get or create a ToolPerformanceAnalyzer singleton."""
134
134
  if "tool_performance_analyzer" not in _engine_instances:
135
135
  try:
136
- from src.evolution.tools import ToolPerformanceAnalyzer
136
+ from evolution.tools import ToolPerformanceAnalyzer
137
137
  registry = _get_tool_registry()
138
138
  if registry is None:
139
139
  _engine_instances["tool_performance_analyzer"] = None
@@ -153,7 +153,7 @@ def _get_association_discoverer():
153
153
  """Get or create an AssociationDiscoverer singleton."""
154
154
  if "association_discoverer" not in _engine_instances:
155
155
  try:
156
- from src.evolution.memory import AssociationDatabase, AssociationDiscoverer
156
+ from evolution.memory import AssociationDatabase, AssociationDiscoverer
157
157
  project_root = Path(__file__).resolve().parent.parent
158
158
  db_path = str(project_root / "data" / "associations.db")
159
159
  db = AssociationDatabase(db_path=db_path)
@@ -179,7 +179,7 @@ TOOL_RUN_CYCLE_SCHEMA = {
179
179
  }
180
180
 
181
181
 
182
- def _handle_run_cycle(ctx, params):
182
+ def _handle_run_cycle(ctx, params, **kwargs):
183
183
  """Handler for evolution_run_cycle."""
184
184
  try:
185
185
  orchestrator = _get_orchestrator()
@@ -244,7 +244,7 @@ TOOL_CREATE_TOOL_SCHEMA = {
244
244
  }
245
245
 
246
246
 
247
- def _handle_create_tool(ctx, params):
247
+ def _handle_create_tool(ctx, params, **kwargs):
248
248
  """Handler for evolution_create_tool."""
249
249
  try:
250
250
  tool_name = params.get("tool_name", "")
@@ -259,7 +259,7 @@ def _handle_create_tool(ctx, params):
259
259
  "error": "Missing required parameters: tool_name, description, api_spec",
260
260
  })
261
261
 
262
- from src.evolution.tools import EnhancedToolCreator, ToolCategory
262
+ from evolution.tools import EnhancedToolCreator, ToolCategory
263
263
 
264
264
  cat_map = {
265
265
  "utility": ToolCategory.UTILITY,
@@ -332,7 +332,7 @@ TOOL_ANALYZE_PERFORMANCE_SCHEMA = {
332
332
  }
333
333
 
334
334
 
335
- def _handle_analyze_performance(ctx, params):
335
+ def _handle_analyze_performance(ctx, params, **kwargs):
336
336
  """Handler for evolution_analyze_performance."""
337
337
  try:
338
338
  analyzer = _get_tool_performance_analyzer()
@@ -451,10 +451,10 @@ TOOL_LEARN_SCHEMA = {
451
451
  }
452
452
 
453
453
 
454
- def _handle_learn(ctx, params):
454
+ def _handle_learn(ctx, params, **kwargs):
455
455
  """Handler for evolution_learn."""
456
456
  try:
457
- from src.evolution.learning import Experience, ExperienceType, Outcome
457
+ from evolution.learning import Experience, ExperienceType, Outcome
458
458
  import uuid
459
459
 
460
460
  desc = params.get("description", "")
@@ -543,7 +543,7 @@ TOOL_SELF_MONITOR_SCHEMA = {
543
543
  }
544
544
 
545
545
 
546
- def _handle_self_monitor(ctx, params):
546
+ def _handle_self_monitor(ctx, params, **kwargs):
547
547
  """Handler for evolution_self_monitor."""
548
548
  try:
549
549
  self_monitor = _get_self_monitor()
@@ -618,7 +618,7 @@ TOOL_MEMORY_DISCOVER_SCHEMA = {
618
618
  }
619
619
 
620
620
 
621
- def _handle_memory_discover(ctx, params):
621
+ def _handle_memory_discover(ctx, params, **kwargs):
622
622
  """Handler for evolution_memory_discover."""
623
623
  try:
624
624
  discoverer = _get_association_discoverer()
@@ -672,7 +672,7 @@ def _on_post_tool_call(ctx, tool_name, params, result, duration_ms, error):
672
672
  if observer is None:
673
673
  return
674
674
 
675
- from src.evolution.learning import Experience, ExperienceType, Outcome
675
+ from evolution.learning import Experience, ExperienceType, Outcome
676
676
  import uuid
677
677
 
678
678
  # Determine outcome
@@ -738,7 +738,12 @@ def register(ctx):
738
738
 
739
739
  for name, schema, handler in tools:
740
740
  try:
741
- ctx.register_tool(name, schema, handler)
741
+ ctx.register_tool(
742
+ name=name,
743
+ toolset="hermes-evolution",
744
+ schema=schema,
745
+ handler=handler,
746
+ )
742
747
  logger.info("Registered tool: %s", name)
743
748
  except Exception as e:
744
749
  logger.error("Failed to register tool %s: %s", name, e)
@@ -1,3 +1,3 @@
1
1
  name: hermes-evolution
2
- version: "3.0.2"
2
+ version: "3.0.3"
3
3
  description: HermesAgentEvolution V3 — V1/V2/V3 融合架构,AI自主进化引擎(学习/工具/安全/协作/闭环)+ 微服务层
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hermes-agent-evolution"
7
- version = "3.0.2"
7
+ version = "3.0.3"
8
8
  authors = [
9
9
  { name = "HermesAgentEvolution Team", email = "contact@example.com" },
10
10
  ]
@@ -34,7 +34,7 @@ install_requires = parse_requirements()
34
34
 
35
35
  setup(
36
36
  name="hermes-agent-evolution",
37
- version="3.0.2",
37
+ version="3.0.3",
38
38
  author="HermesAgentEvolution Team",
39
39
  author_email="contact@example.com",
40
40
  description="AI自我进化系统 V1/V2/V3 融合版 — 单体+微服务混合架构",
@@ -12,3 +12,6 @@ Hermes Agent Evolution - AI助手自我进化系统 V1/V2/V3 融合版
12
12
  __version__ = "3.0.0"
13
13
  __author__ = "HermesAgentEvolution Team"
14
14
  __description__ = "AI助手自我进化系统 - V1/V2/V3融合版"
15
+
16
+ # Re-export key classes that plugins import directly from the evolution package
17
+ from .self_monitor import SelfMonitor
@@ -48,7 +48,7 @@ def _get_tool_registry():
48
48
  """Get or create a ToolRegistry singleton."""
49
49
  if "tool_registry" not in _engine_instances:
50
50
  try:
51
- from src.evolution.tools import ToolRegistry
51
+ from evolution.tools import ToolRegistry
52
52
  project_root = Path(__file__).resolve().parent.parent
53
53
  db_path = str(project_root / "data" / "tools.db")
54
54
  _engine_instances["tool_registry"] = ToolRegistry(db_path=db_path)
@@ -62,7 +62,7 @@ def _get_learning_observer():
62
62
  """Get or create a LearningObserver singleton."""
63
63
  if "learning_observer" not in _engine_instances:
64
64
  try:
65
- from src.evolution.learning import LearningObserver
65
+ from evolution.learning import LearningObserver
66
66
  project_root = Path(__file__).resolve().parent.parent
67
67
  db_path = str(project_root / "data" / "learning_experiences.db")
68
68
  _engine_instances["learning_observer"] = LearningObserver(db_path=db_path)
@@ -76,17 +76,17 @@ def _get_orchestrator():
76
76
  """Get or create a ClosedLoopOrchestrator singleton."""
77
77
  if "orchestrator" not in _engine_instances:
78
78
  try:
79
- from src.evolution.closed_loop import (
79
+ from evolution.closed_loop import (
80
80
  ClosedLoopOrchestrator,
81
81
  SystemMetricsCollector,
82
82
  )
83
- from src.evolution.learning import (
83
+ from evolution.learning import (
84
84
  LearningObserver,
85
85
  ExperienceAnalyzer,
86
86
  PatternRecognizer,
87
87
  ToolStrategyLearner,
88
88
  )
89
- from src.evolution import SelfMonitor # top-level import
89
+ from evolution import SelfMonitor # top-level import
90
90
 
91
91
  project_root = Path(__file__).resolve().parent.parent
92
92
  db_base = str(project_root / "data")
@@ -98,7 +98,7 @@ def _get_orchestrator():
98
98
  self_monitor = SelfMonitor(observer, analyzer, strategy_learner)
99
99
  metrics_collector = SystemMetricsCollector()
100
100
  pattern_recognizer = PatternRecognizer()
101
- from src.evolution.closed_loop import ActionExecutor
101
+ from evolution.closed_loop import ActionExecutor
102
102
  action_executor = ActionExecutor()
103
103
 
104
104
  _engine_instances["orchestrator"] = ClosedLoopOrchestrator(
@@ -133,7 +133,7 @@ def _get_tool_performance_analyzer():
133
133
  """Get or create a ToolPerformanceAnalyzer singleton."""
134
134
  if "tool_performance_analyzer" not in _engine_instances:
135
135
  try:
136
- from src.evolution.tools import ToolPerformanceAnalyzer
136
+ from evolution.tools import ToolPerformanceAnalyzer
137
137
  registry = _get_tool_registry()
138
138
  if registry is None:
139
139
  _engine_instances["tool_performance_analyzer"] = None
@@ -153,7 +153,7 @@ def _get_association_discoverer():
153
153
  """Get or create an AssociationDiscoverer singleton."""
154
154
  if "association_discoverer" not in _engine_instances:
155
155
  try:
156
- from src.evolution.memory import AssociationDatabase, AssociationDiscoverer
156
+ from evolution.memory import AssociationDatabase, AssociationDiscoverer
157
157
  project_root = Path(__file__).resolve().parent.parent
158
158
  db_path = str(project_root / "data" / "associations.db")
159
159
  db = AssociationDatabase(db_path=db_path)
@@ -259,7 +259,7 @@ def _handle_create_tool(ctx, params):
259
259
  "error": "Missing required parameters: tool_name, description, api_spec",
260
260
  })
261
261
 
262
- from src.evolution.tools import EnhancedToolCreator, ToolCategory
262
+ from evolution.tools import EnhancedToolCreator, ToolCategory
263
263
 
264
264
  cat_map = {
265
265
  "utility": ToolCategory.UTILITY,
@@ -454,7 +454,7 @@ TOOL_LEARN_SCHEMA = {
454
454
  def _handle_learn(ctx, params):
455
455
  """Handler for evolution_learn."""
456
456
  try:
457
- from src.evolution.learning import Experience, ExperienceType, Outcome
457
+ from evolution.learning import Experience, ExperienceType, Outcome
458
458
  import uuid
459
459
 
460
460
  desc = params.get("description", "")
@@ -672,7 +672,7 @@ def _on_post_tool_call(ctx, tool_name, params, result, duration_ms, error):
672
672
  if observer is None:
673
673
  return
674
674
 
675
- from src.evolution.learning import Experience, ExperienceType, Outcome
675
+ from evolution.learning import Experience, ExperienceType, Outcome
676
676
  import uuid
677
677
 
678
678
  # Determine outcome
@@ -310,8 +310,38 @@ class EnhancedToolCreator:
310
310
 
311
311
  # 从配置创建工具
312
312
  if config.get("type") == "function":
313
- # TODO: 实现从配置加载函数
314
- pass
313
+ # 从配置加载函数:支持 module_path + function_name 或 inline_code
314
+ func_config = config.get("function", {})
315
+ if "module_path" in func_config and "function_name" in func_config:
316
+ # 动态导入模块中的函数
317
+ import importlib
318
+ mod = importlib.import_module(func_config["module_path"])
319
+ func = getattr(mod, func_config["function_name"])
320
+ elif "code" in func_config:
321
+ # 从配置中的 Python 代码动态创建函数
322
+ local_ns = {}
323
+ exec(func_config["code"], {"log": log, "__builtins__": __builtins__}, local_ns)
324
+ func_name = config.get("name", func_config.get("function_name", "config_tool"))
325
+ func = local_ns.get(func_name)
326
+ if func is None:
327
+ func = list(local_ns.values())[0] if local_ns else None
328
+ else:
329
+ return ToolCreationResult(
330
+ success=False,
331
+ error_message="函数配置缺少 module_path/function_name 或 code"
332
+ )
333
+ if func is None:
334
+ return ToolCreationResult(
335
+ success=False,
336
+ error_message="无法从配置加载函数"
337
+ )
338
+ return self.create_from_function(
339
+ func=func,
340
+ name=config.get("name", func_config.get("function_name", "config_tool")),
341
+ description=config.get("description", func.__doc__ or ""),
342
+ category=ToolCategory[config.get("category", "UTILITY")],
343
+ tags=config.get("tags", [])
344
+ )
315
345
  elif config.get("type") == "code":
316
346
  return self.create_from_code(
317
347
  code=config["code"],
@@ -692,8 +722,28 @@ class EnhancedToolCreator:
692
722
  Returns:
693
723
  {api_spec.get("return_type", "Any")}: {api_spec.get("return_description", "")}
694
724
  """
695
- # TODO: 实现API调用逻辑
696
- raise NotImplementedError("API工具尚未实现")
725
+ import urllib.request
726
+ import urllib.error
727
+ import json as _json
728
+
729
+ url = "{api_spec.get("endpoint", "")}"
730
+ method = "{api_spec.get("method", "GET")}"
731
+ headers = {api_spec.get("headers", {"Content-Type": "application/json"})}
732
+
733
+ try:
734
+ data = None
735
+ if params:
736
+ data = _json.dumps(params).encode("utf-8")
737
+ req = urllib.request.Request(url, data=data, headers=headers, method=method)
738
+ with urllib.request.urlopen(req, timeout=30) as resp:
739
+ body = resp.read().decode("utf-8")
740
+ return _json.loads(body) if body else None
741
+ except urllib.error.HTTPError as e:
742
+ log.error("API请求失败 [%d]: %s", e.code, e.reason)
743
+ return None
744
+ except Exception as e:
745
+ log.error("API调用异常: %s", e)
746
+ return None
697
747
  '''
698
748
 
699
749
  return code
@@ -797,13 +847,24 @@ def {name}(url: str, method: str = "GET", data: Optional[Dict] = None,
797
847
  '''
798
848
  }
799
849
 
800
- return templates.get(template_name, '''
801
- def {name}():
802
- """
803
- 工具模板
850
+ return templates.get(template_name, '''\
851
+ def {name}(*args, **kwargs):
852
+ """工具 {name} — 自动生成的通用工具
853
+
854
+ Args:
855
+ *args: 位置参数
856
+ **kwargs: 关键字参数
857
+
858
+ Returns:
859
+ 处理结果
804
860
  """
805
- # TODO: 实现工具功能
806
- pass
861
+ log.info("工具 %s 被调用: args=%s kwargs=%s", "{name}", args, kwargs)
862
+ # 通用工具实现 — 尝试对参数进行基本处理
863
+ if args and all(isinstance(a, (int, float)) for a in args):
864
+ return sum(args)
865
+ if kwargs:
866
+ return kwargs
867
+ return args[0] if len(args) == 1 else args if args else None
807
868
  ''')
808
869
 
809
870
  def _analyze_requirements(self, requirements: str, context: Optional[Dict[str, Any]]) -> Dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hermes-agent-evolution
3
- Version: 3.0.2
3
+ Version: 3.0.3
4
4
  Summary: AI助手自我进化系统 V1/V2/V3 融合版 - 单体+微服务混合架构
5
5
  Home-page: https://github.com/WayneLiu519888/Hermes-Agent-EvolutionV3
6
6
  Author: HermesAgentEvolution Team
@@ -40,7 +40,7 @@ class MockCtx:
40
40
  self.tools = {} # name → (schema, handler)
41
41
  self.hooks = {} # name → callback
42
42
 
43
- def register_tool(self, name, schema, handler):
43
+ def register_tool(self, name, schema, handler, toolset=None):
44
44
  self.tools[name] = (schema, handler)
45
45
 
46
46
  def register_hook(self, name, callback):