aiecs 1.1.0__py3-none-any.whl → 1.2.0__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.

Potentially problematic release.


This version of aiecs might be problematic. Click here for more details.

Files changed (58) hide show
  1. aiecs/__init__.py +1 -1
  2. aiecs/config/config.py +2 -0
  3. aiecs/domain/__init__.py +95 -0
  4. aiecs/domain/community/__init__.py +159 -0
  5. aiecs/domain/community/agent_adapter.py +516 -0
  6. aiecs/domain/community/analytics.py +465 -0
  7. aiecs/domain/community/collaborative_workflow.py +99 -7
  8. aiecs/domain/community/communication_hub.py +649 -0
  9. aiecs/domain/community/community_builder.py +322 -0
  10. aiecs/domain/community/community_integration.py +365 -12
  11. aiecs/domain/community/community_manager.py +481 -5
  12. aiecs/domain/community/decision_engine.py +459 -13
  13. aiecs/domain/community/exceptions.py +238 -0
  14. aiecs/domain/community/models/__init__.py +36 -0
  15. aiecs/domain/community/resource_manager.py +1 -1
  16. aiecs/domain/community/shared_context_manager.py +621 -0
  17. aiecs/domain/context/context_engine.py +37 -33
  18. aiecs/main.py +2 -2
  19. aiecs/scripts/aid/VERSION_MANAGEMENT.md +97 -0
  20. aiecs/scripts/aid/__init__.py +15 -0
  21. aiecs/scripts/aid/version_manager.py +224 -0
  22. aiecs/scripts/dependance_check/download_nlp_data.py +1 -0
  23. aiecs/tools/__init__.py +23 -23
  24. aiecs/tools/docs/__init__.py +5 -2
  25. aiecs/tools/docs/ai_document_orchestrator.py +39 -26
  26. aiecs/tools/docs/ai_document_writer_orchestrator.py +61 -38
  27. aiecs/tools/docs/content_insertion_tool.py +48 -28
  28. aiecs/tools/docs/document_creator_tool.py +47 -29
  29. aiecs/tools/docs/document_layout_tool.py +35 -20
  30. aiecs/tools/docs/document_parser_tool.py +56 -36
  31. aiecs/tools/docs/document_writer_tool.py +115 -62
  32. aiecs/tools/schema_generator.py +56 -56
  33. aiecs/tools/statistics/__init__.py +82 -0
  34. aiecs/tools/statistics/ai_data_analysis_orchestrator.py +581 -0
  35. aiecs/tools/statistics/ai_insight_generator_tool.py +473 -0
  36. aiecs/tools/statistics/ai_report_orchestrator_tool.py +629 -0
  37. aiecs/tools/statistics/data_loader_tool.py +518 -0
  38. aiecs/tools/statistics/data_profiler_tool.py +599 -0
  39. aiecs/tools/statistics/data_transformer_tool.py +531 -0
  40. aiecs/tools/statistics/data_visualizer_tool.py +460 -0
  41. aiecs/tools/statistics/model_trainer_tool.py +470 -0
  42. aiecs/tools/statistics/statistical_analyzer_tool.py +426 -0
  43. aiecs/tools/task_tools/chart_tool.py +2 -1
  44. aiecs/tools/task_tools/image_tool.py +43 -43
  45. aiecs/tools/task_tools/office_tool.py +39 -36
  46. aiecs/tools/task_tools/pandas_tool.py +37 -33
  47. aiecs/tools/task_tools/report_tool.py +67 -56
  48. aiecs/tools/task_tools/research_tool.py +32 -31
  49. aiecs/tools/task_tools/scraper_tool.py +53 -46
  50. aiecs/tools/task_tools/search_tool.py +1123 -0
  51. aiecs/tools/task_tools/stats_tool.py +20 -15
  52. {aiecs-1.1.0.dist-info → aiecs-1.2.0.dist-info}/METADATA +5 -1
  53. {aiecs-1.1.0.dist-info → aiecs-1.2.0.dist-info}/RECORD +57 -36
  54. {aiecs-1.1.0.dist-info → aiecs-1.2.0.dist-info}/entry_points.txt +1 -0
  55. aiecs/tools/task_tools/search_api.py +0 -7
  56. {aiecs-1.1.0.dist-info → aiecs-1.2.0.dist-info}/WHEEL +0 -0
  57. {aiecs-1.1.0.dist-info → aiecs-1.2.0.dist-info}/licenses/LICENSE +0 -0
  58. {aiecs-1.1.0.dist-info → aiecs-1.2.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,322 @@
1
+ """
2
+ Community Builder
3
+
4
+ Provides a fluent interface for building communities with preset templates
5
+ and customizable configuration.
6
+ """
7
+
8
+ import logging
9
+ from typing import Dict, List, Any, Optional
10
+ from datetime import datetime, timedelta
11
+
12
+ from .models.community_models import GovernanceType, CommunityRole
13
+ from .community_integration import CommunityIntegration
14
+
15
+ logger = logging.getLogger(__name__)
16
+
17
+
18
+ class CommunityBuilder:
19
+ """
20
+ Fluent interface builder for creating communities.
21
+
22
+ Provides an intuitive way to configure and create communities
23
+ with method chaining.
24
+ """
25
+
26
+ def __init__(self, integration: CommunityIntegration):
27
+ """
28
+ Initialize the community builder.
29
+
30
+ Args:
31
+ integration: Community integration instance
32
+ """
33
+ self.integration = integration
34
+ self._reset()
35
+
36
+ def _reset(self) -> None:
37
+ """Reset builder state."""
38
+ self._name: Optional[str] = None
39
+ self._description: Optional[str] = None
40
+ self._governance_type: GovernanceType = GovernanceType.DEMOCRATIC
41
+ self._agent_roles: List[str] = []
42
+ self._creator_agent_id: Optional[str] = None
43
+ self._metadata: Dict[str, Any] = {}
44
+ self._is_temporary: bool = False
45
+ self._duration_minutes: int = 60
46
+ self._auto_cleanup: bool = True
47
+ self._template: Optional[str] = None
48
+ self._template_config: Dict[str, Any] = {}
49
+
50
+ def with_name(self, name: str) -> 'CommunityBuilder':
51
+ """
52
+ Set the community name.
53
+
54
+ Args:
55
+ name: Name of the community
56
+
57
+ Returns:
58
+ Self for chaining
59
+ """
60
+ self._name = name
61
+ return self
62
+
63
+ def with_description(self, description: str) -> 'CommunityBuilder':
64
+ """
65
+ Set the community description.
66
+
67
+ Args:
68
+ description: Description of the community
69
+
70
+ Returns:
71
+ Self for chaining
72
+ """
73
+ self._description = description
74
+ return self
75
+
76
+ def with_governance(self, governance_type: GovernanceType) -> 'CommunityBuilder':
77
+ """
78
+ Set the governance type.
79
+
80
+ Args:
81
+ governance_type: Type of governance
82
+
83
+ Returns:
84
+ Self for chaining
85
+ """
86
+ self._governance_type = governance_type
87
+ return self
88
+
89
+ def add_agent_role(self, role: str) -> 'CommunityBuilder':
90
+ """
91
+ Add an agent role to the community.
92
+
93
+ Args:
94
+ role: Agent role to add
95
+
96
+ Returns:
97
+ Self for chaining
98
+ """
99
+ if role not in self._agent_roles:
100
+ self._agent_roles.append(role)
101
+ return self
102
+
103
+ def add_agent_roles(self, roles: List[str]) -> 'CommunityBuilder':
104
+ """
105
+ Add multiple agent roles.
106
+
107
+ Args:
108
+ roles: List of agent roles
109
+
110
+ Returns:
111
+ Self for chaining
112
+ """
113
+ for role in roles:
114
+ self.add_agent_role(role)
115
+ return self
116
+
117
+ def with_creator(self, agent_id: str) -> 'CommunityBuilder':
118
+ """
119
+ Set the creator agent.
120
+
121
+ Args:
122
+ agent_id: ID of the creating agent
123
+
124
+ Returns:
125
+ Self for chaining
126
+ """
127
+ self._creator_agent_id = agent_id
128
+ return self
129
+
130
+ def with_duration(self, minutes: int, auto_cleanup: bool = True) -> 'CommunityBuilder':
131
+ """
132
+ Make the community temporary with a duration.
133
+
134
+ Args:
135
+ minutes: Duration in minutes
136
+ auto_cleanup: Whether to automatically cleanup after duration
137
+
138
+ Returns:
139
+ Self for chaining
140
+ """
141
+ self._is_temporary = True
142
+ self._duration_minutes = minutes
143
+ self._auto_cleanup = auto_cleanup
144
+ return self
145
+
146
+ def with_metadata(self, key: str, value: Any) -> 'CommunityBuilder':
147
+ """
148
+ Add metadata to the community.
149
+
150
+ Args:
151
+ key: Metadata key
152
+ value: Metadata value
153
+
154
+ Returns:
155
+ Self for chaining
156
+ """
157
+ self._metadata[key] = value
158
+ return self
159
+
160
+ def use_template(self, template: str, **config) -> 'CommunityBuilder':
161
+ """
162
+ Use a preset template.
163
+
164
+ Args:
165
+ template: Template name (research, development, support, creative)
166
+ **config: Template configuration
167
+
168
+ Returns:
169
+ Self for chaining
170
+ """
171
+ self._template = template
172
+ self._template_config = config
173
+ return self
174
+
175
+ async def build(self) -> str:
176
+ """
177
+ Build and create the community.
178
+
179
+ Returns:
180
+ Community ID
181
+ """
182
+ # Apply template if specified
183
+ if self._template:
184
+ await self._apply_template(self._template, self._template_config)
185
+
186
+ # Validate required fields
187
+ if not self._name:
188
+ raise ValueError("Community name is required")
189
+
190
+ # Create community based on configuration
191
+ if self._is_temporary:
192
+ community_id = await self.integration.create_temporary_community(
193
+ name=self._name,
194
+ description=self._description or f"Community: {self._name}",
195
+ agent_roles=self._agent_roles,
196
+ duration_minutes=self._duration_minutes,
197
+ auto_cleanup=self._auto_cleanup,
198
+ governance_type=self._governance_type,
199
+ creator_agent_id=self._creator_agent_id
200
+ )
201
+ else:
202
+ community_id = await self.integration.create_agent_community(
203
+ name=self._name,
204
+ description=self._description or f"Community: {self._name}",
205
+ agent_roles=self._agent_roles,
206
+ governance_type=self._governance_type,
207
+ creator_agent_id=self._creator_agent_id
208
+ )
209
+
210
+ # Apply metadata
211
+ if self._metadata:
212
+ community = self.integration.community_manager.communities[community_id]
213
+ community.metadata.update(self._metadata)
214
+
215
+ logger.info(f"Built community: {self._name} ({community_id})")
216
+
217
+ # Reset builder for reuse
218
+ self._reset()
219
+
220
+ return community_id
221
+
222
+ async def _apply_template(self, template: str, config: Dict[str, Any]) -> None:
223
+ """Apply a preset template configuration."""
224
+ if template == "research":
225
+ await self._apply_research_template(config)
226
+ elif template == "development":
227
+ await self._apply_development_template(config)
228
+ elif template == "support":
229
+ await self._apply_support_template(config)
230
+ elif template == "creative":
231
+ await self._apply_creative_template(config)
232
+ else:
233
+ logger.warning(f"Unknown template: {template}")
234
+
235
+ async def _apply_research_template(self, config: Dict[str, Any]) -> None:
236
+ """Apply research community template."""
237
+ self.with_governance(GovernanceType.CONSENSUS)
238
+
239
+ # Default research roles
240
+ default_roles = ["researcher", "analyst", "writer", "reviewer"]
241
+ self.add_agent_roles(config.get("roles", default_roles))
242
+
243
+ # Research-specific metadata
244
+ if "topic" in config:
245
+ self.with_metadata("research_topic", config["topic"])
246
+ if "questions" in config:
247
+ self.with_metadata("research_questions", config["questions"])
248
+ if "methodologies" in config:
249
+ self.with_metadata("methodologies", config["methodologies"])
250
+
251
+ self.with_metadata("type", "research")
252
+ logger.debug("Applied research template")
253
+
254
+ async def _apply_development_template(self, config: Dict[str, Any]) -> None:
255
+ """Apply development/project community template."""
256
+ self.with_governance(GovernanceType.HIERARCHICAL)
257
+
258
+ # Default development roles
259
+ default_roles = ["architect", "developer", "tester", "reviewer"]
260
+ self.add_agent_roles(config.get("roles", default_roles))
261
+
262
+ # Development-specific metadata
263
+ if "project_name" in config:
264
+ self.with_metadata("project_name", config["project_name"])
265
+ if "goal" in config:
266
+ self.with_metadata("project_goal", config["goal"])
267
+ if "deadline" in config:
268
+ self.with_metadata("project_deadline", config["deadline"])
269
+ if "tech_stack" in config:
270
+ self.with_metadata("tech_stack", config["tech_stack"])
271
+
272
+ self.with_metadata("type", "development")
273
+ logger.debug("Applied development template")
274
+
275
+ async def _apply_support_template(self, config: Dict[str, Any]) -> None:
276
+ """Apply support community template."""
277
+ self.with_governance(GovernanceType.DEMOCRATIC)
278
+
279
+ # Default support roles
280
+ default_roles = ["support_agent", "specialist", "escalation_handler"]
281
+ self.add_agent_roles(config.get("roles", default_roles))
282
+
283
+ # Support-specific metadata
284
+ if "support_level" in config:
285
+ self.with_metadata("support_level", config["support_level"])
286
+ if "coverage_hours" in config:
287
+ self.with_metadata("coverage_hours", config["coverage_hours"])
288
+
289
+ self.with_metadata("type", "support")
290
+ logger.debug("Applied support template")
291
+
292
+ async def _apply_creative_template(self, config: Dict[str, Any]) -> None:
293
+ """Apply creative collaboration template."""
294
+ self.with_governance(GovernanceType.HYBRID)
295
+
296
+ # Default creative roles
297
+ default_roles = ["ideator", "creator", "critic", "synthesizer"]
298
+ self.add_agent_roles(config.get("roles", default_roles))
299
+
300
+ # Creative-specific metadata
301
+ if "project_type" in config:
302
+ self.with_metadata("project_type", config["project_type"])
303
+ if "style_guidelines" in config:
304
+ self.with_metadata("style_guidelines", config["style_guidelines"])
305
+
306
+ self.with_metadata("type", "creative")
307
+ logger.debug("Applied creative template")
308
+
309
+
310
+ # Convenience function for quick builder creation
311
+ def builder(integration: CommunityIntegration) -> CommunityBuilder:
312
+ """
313
+ Create a new community builder.
314
+
315
+ Args:
316
+ integration: Community integration instance
317
+
318
+ Returns:
319
+ CommunityBuilder instance
320
+ """
321
+ return CommunityBuilder(integration)
322
+