kailash 0.3.1__py3-none-any.whl → 0.4.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.
Files changed (146) hide show
  1. kailash/__init__.py +33 -1
  2. kailash/access_control/__init__.py +129 -0
  3. kailash/access_control/managers.py +461 -0
  4. kailash/access_control/rule_evaluators.py +467 -0
  5. kailash/access_control_abac.py +825 -0
  6. kailash/config/__init__.py +27 -0
  7. kailash/config/database_config.py +359 -0
  8. kailash/database/__init__.py +28 -0
  9. kailash/database/execution_pipeline.py +499 -0
  10. kailash/middleware/__init__.py +306 -0
  11. kailash/middleware/auth/__init__.py +33 -0
  12. kailash/middleware/auth/access_control.py +436 -0
  13. kailash/middleware/auth/auth_manager.py +422 -0
  14. kailash/middleware/auth/jwt_auth.py +477 -0
  15. kailash/middleware/auth/kailash_jwt_auth.py +616 -0
  16. kailash/middleware/communication/__init__.py +37 -0
  17. kailash/middleware/communication/ai_chat.py +989 -0
  18. kailash/middleware/communication/api_gateway.py +802 -0
  19. kailash/middleware/communication/events.py +470 -0
  20. kailash/middleware/communication/realtime.py +710 -0
  21. kailash/middleware/core/__init__.py +21 -0
  22. kailash/middleware/core/agent_ui.py +890 -0
  23. kailash/middleware/core/schema.py +643 -0
  24. kailash/middleware/core/workflows.py +396 -0
  25. kailash/middleware/database/__init__.py +63 -0
  26. kailash/middleware/database/base.py +113 -0
  27. kailash/middleware/database/base_models.py +525 -0
  28. kailash/middleware/database/enums.py +106 -0
  29. kailash/middleware/database/migrations.py +12 -0
  30. kailash/{api/database.py → middleware/database/models.py} +183 -291
  31. kailash/middleware/database/repositories.py +685 -0
  32. kailash/middleware/database/session_manager.py +19 -0
  33. kailash/middleware/mcp/__init__.py +38 -0
  34. kailash/middleware/mcp/client_integration.py +585 -0
  35. kailash/middleware/mcp/enhanced_server.py +576 -0
  36. kailash/nodes/__init__.py +25 -3
  37. kailash/nodes/admin/__init__.py +35 -0
  38. kailash/nodes/admin/audit_log.py +794 -0
  39. kailash/nodes/admin/permission_check.py +864 -0
  40. kailash/nodes/admin/role_management.py +823 -0
  41. kailash/nodes/admin/security_event.py +1519 -0
  42. kailash/nodes/admin/user_management.py +944 -0
  43. kailash/nodes/ai/a2a.py +24 -7
  44. kailash/nodes/ai/ai_providers.py +1 -0
  45. kailash/nodes/ai/embedding_generator.py +11 -11
  46. kailash/nodes/ai/intelligent_agent_orchestrator.py +99 -11
  47. kailash/nodes/ai/llm_agent.py +407 -2
  48. kailash/nodes/ai/self_organizing.py +85 -10
  49. kailash/nodes/api/auth.py +287 -6
  50. kailash/nodes/api/rest.py +151 -0
  51. kailash/nodes/auth/__init__.py +17 -0
  52. kailash/nodes/auth/directory_integration.py +1228 -0
  53. kailash/nodes/auth/enterprise_auth_provider.py +1328 -0
  54. kailash/nodes/auth/mfa.py +2338 -0
  55. kailash/nodes/auth/risk_assessment.py +872 -0
  56. kailash/nodes/auth/session_management.py +1093 -0
  57. kailash/nodes/auth/sso.py +1040 -0
  58. kailash/nodes/base.py +344 -13
  59. kailash/nodes/base_cycle_aware.py +4 -2
  60. kailash/nodes/base_with_acl.py +1 -1
  61. kailash/nodes/code/python.py +293 -12
  62. kailash/nodes/compliance/__init__.py +9 -0
  63. kailash/nodes/compliance/data_retention.py +1888 -0
  64. kailash/nodes/compliance/gdpr.py +2004 -0
  65. kailash/nodes/data/__init__.py +22 -2
  66. kailash/nodes/data/async_connection.py +469 -0
  67. kailash/nodes/data/async_sql.py +757 -0
  68. kailash/nodes/data/async_vector.py +598 -0
  69. kailash/nodes/data/readers.py +767 -0
  70. kailash/nodes/data/retrieval.py +360 -1
  71. kailash/nodes/data/sharepoint_graph.py +397 -21
  72. kailash/nodes/data/sql.py +94 -5
  73. kailash/nodes/data/streaming.py +68 -8
  74. kailash/nodes/data/vector_db.py +54 -4
  75. kailash/nodes/enterprise/__init__.py +13 -0
  76. kailash/nodes/enterprise/batch_processor.py +741 -0
  77. kailash/nodes/enterprise/data_lineage.py +497 -0
  78. kailash/nodes/logic/convergence.py +31 -9
  79. kailash/nodes/logic/operations.py +14 -3
  80. kailash/nodes/mixins/__init__.py +8 -0
  81. kailash/nodes/mixins/event_emitter.py +201 -0
  82. kailash/nodes/mixins/mcp.py +9 -4
  83. kailash/nodes/mixins/security.py +165 -0
  84. kailash/nodes/monitoring/__init__.py +7 -0
  85. kailash/nodes/monitoring/performance_benchmark.py +2497 -0
  86. kailash/nodes/rag/__init__.py +284 -0
  87. kailash/nodes/rag/advanced.py +1615 -0
  88. kailash/nodes/rag/agentic.py +773 -0
  89. kailash/nodes/rag/conversational.py +999 -0
  90. kailash/nodes/rag/evaluation.py +875 -0
  91. kailash/nodes/rag/federated.py +1188 -0
  92. kailash/nodes/rag/graph.py +721 -0
  93. kailash/nodes/rag/multimodal.py +671 -0
  94. kailash/nodes/rag/optimized.py +933 -0
  95. kailash/nodes/rag/privacy.py +1059 -0
  96. kailash/nodes/rag/query_processing.py +1335 -0
  97. kailash/nodes/rag/realtime.py +764 -0
  98. kailash/nodes/rag/registry.py +547 -0
  99. kailash/nodes/rag/router.py +837 -0
  100. kailash/nodes/rag/similarity.py +1854 -0
  101. kailash/nodes/rag/strategies.py +566 -0
  102. kailash/nodes/rag/workflows.py +575 -0
  103. kailash/nodes/security/__init__.py +19 -0
  104. kailash/nodes/security/abac_evaluator.py +1411 -0
  105. kailash/nodes/security/audit_log.py +91 -0
  106. kailash/nodes/security/behavior_analysis.py +1893 -0
  107. kailash/nodes/security/credential_manager.py +401 -0
  108. kailash/nodes/security/rotating_credentials.py +760 -0
  109. kailash/nodes/security/security_event.py +132 -0
  110. kailash/nodes/security/threat_detection.py +1103 -0
  111. kailash/nodes/testing/__init__.py +9 -0
  112. kailash/nodes/testing/credential_testing.py +499 -0
  113. kailash/nodes/transform/__init__.py +10 -2
  114. kailash/nodes/transform/chunkers.py +592 -1
  115. kailash/nodes/transform/processors.py +484 -14
  116. kailash/nodes/validation.py +321 -0
  117. kailash/runtime/access_controlled.py +1 -1
  118. kailash/runtime/async_local.py +41 -7
  119. kailash/runtime/docker.py +1 -1
  120. kailash/runtime/local.py +474 -55
  121. kailash/runtime/parallel.py +1 -1
  122. kailash/runtime/parallel_cyclic.py +1 -1
  123. kailash/runtime/testing.py +210 -2
  124. kailash/utils/migrations/__init__.py +25 -0
  125. kailash/utils/migrations/generator.py +433 -0
  126. kailash/utils/migrations/models.py +231 -0
  127. kailash/utils/migrations/runner.py +489 -0
  128. kailash/utils/secure_logging.py +342 -0
  129. kailash/workflow/__init__.py +16 -0
  130. kailash/workflow/cyclic_runner.py +3 -4
  131. kailash/workflow/graph.py +70 -2
  132. kailash/workflow/resilience.py +249 -0
  133. kailash/workflow/templates.py +726 -0
  134. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/METADATA +253 -20
  135. kailash-0.4.0.dist-info/RECORD +223 -0
  136. kailash/api/__init__.py +0 -17
  137. kailash/api/__main__.py +0 -6
  138. kailash/api/studio_secure.py +0 -893
  139. kailash/mcp/__main__.py +0 -13
  140. kailash/mcp/server_new.py +0 -336
  141. kailash/mcp/servers/__init__.py +0 -12
  142. kailash-0.3.1.dist-info/RECORD +0 -136
  143. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/WHEEL +0 -0
  144. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/entry_points.txt +0 -0
  145. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/licenses/LICENSE +0 -0
  146. {kailash-0.3.1.dist-info → kailash-0.4.0.dist-info}/top_level.txt +0 -0
kailash/nodes/ai/a2a.py CHANGED
@@ -112,8 +112,11 @@ class SharedMemoryPoolNode(Node):
112
112
  ... )
113
113
  """
114
114
 
115
- def __init__(self):
116
- super().__init__()
115
+ def __init__(self, name=None, **kwargs):
116
+ # Accept name parameter and pass all kwargs to parent
117
+ if name:
118
+ kwargs["name"] = name
119
+ super().__init__(**kwargs)
117
120
  self.memory_segments = defaultdict(deque)
118
121
  self.agent_subscriptions = defaultdict(set)
119
122
  self.attention_indices = defaultdict(lambda: defaultdict(list))
@@ -183,6 +186,13 @@ class SharedMemoryPoolNode(Node):
183
186
  required=False,
184
187
  description="Search query for semantic memory search",
185
188
  ),
189
+ "segments": NodeParameter(
190
+ name="segments",
191
+ type=list,
192
+ required=False,
193
+ default=["general"],
194
+ description="Memory segments to subscribe to",
195
+ ),
186
196
  }
187
197
 
188
198
  def run(self, **kwargs) -> Dict[str, Any]:
@@ -545,8 +555,11 @@ class A2AAgentNode(LLMAgentNode):
545
555
  >>> assert all("content" in i for i in insights)
546
556
  """
547
557
 
548
- def __init__(self):
549
- super().__init__()
558
+ def __init__(self, name=None, **kwargs):
559
+ # Accept name parameter and pass all kwargs to parent
560
+ if name:
561
+ kwargs["name"] = name
562
+ super().__init__(**kwargs)
550
563
  self.local_memory = deque(maxlen=100)
551
564
  self.communication_log = deque(maxlen=50)
552
565
 
@@ -1220,8 +1233,11 @@ class A2ACoordinatorNode(CycleAwareNode):
1220
1233
  ... )
1221
1234
  """
1222
1235
 
1223
- def __init__(self):
1224
- super().__init__()
1236
+ def __init__(self, name=None, **kwargs):
1237
+ # Accept name parameter and pass all kwargs to parent
1238
+ if name:
1239
+ kwargs["name"] = name
1240
+ super().__init__(**kwargs)
1225
1241
  self.registered_agents = {}
1226
1242
  self.task_queue = deque()
1227
1243
  self.consensus_sessions = {}
@@ -1275,7 +1291,7 @@ class A2ACoordinatorNode(CycleAwareNode):
1275
1291
  ),
1276
1292
  }
1277
1293
 
1278
- def run(self, context: Dict[str, Any], **kwargs) -> Dict[str, Any]:
1294
+ def run(self, **kwargs) -> Dict[str, Any]:
1279
1295
  """
1280
1296
  Execute coordination action with cycle awareness.
1281
1297
 
@@ -1315,6 +1331,7 @@ class A2ACoordinatorNode(CycleAwareNode):
1315
1331
  ... )
1316
1332
  >>> assert result[\"success\"] == True
1317
1333
  """
1334
+ context = kwargs.get("context", {})
1318
1335
  action = kwargs.get("action")
1319
1336
 
1320
1337
  # Get cycle information using CycleAwareNode helpers
@@ -399,6 +399,7 @@ class OllamaProvider(UnifiedAIProvider):
399
399
  **kwargs: Additional arguments including:
400
400
  model (str): Ollama model name (default: "llama3.1:8b-instruct-q8_0")
401
401
  generation_config (dict): Generation parameters including:
402
+
402
403
  * temperature, max_tokens, top_p, top_k, repeat_penalty
403
404
  * seed, stop, num_ctx, num_batch, num_thread
404
405
  * tfs_z, typical_p, mirostat, mirostat_tau, mirostat_eta
@@ -94,17 +94,17 @@ class EmbeddingGeneratorNode(Node):
94
94
  ... similarity_metric="cosine"
95
95
  ... )
96
96
 
97
- Cached embedding with MCP integration:
98
-
99
- mcp_embedder = EmbeddingGeneratorNode()
100
- result = mcp_embedder.run(
101
- provider="azure",
102
- model="text-embedding-3-small",
103
- mcp_resource_uri="data://documents/knowledge_base.json",
104
- operation="embed_mcp_resource",
105
- cache_ttl=3600,
106
- chunk_size=512
107
- )
97
+ Cached embedding with MCP integration::
98
+
99
+ mcp_embedder = EmbeddingGeneratorNode()
100
+ result = mcp_embedder.run(
101
+ provider="azure",
102
+ model="text-embedding-3-small",
103
+ mcp_resource_uri="data://documents/knowledge_base.json",
104
+ operation="embed_mcp_resource",
105
+ cache_ttl=3600,
106
+ chunk_size=512
107
+ )
108
108
  """
109
109
 
110
110
  def get_parameters(self) -> dict[str, NodeParameter]:
@@ -132,14 +132,29 @@ class IntelligentCacheNode(Node):
132
132
  >>> assert "hit_rate" in stats["stats"]
133
133
  """
134
134
 
135
- def __init__(self):
136
- super().__init__()
135
+ def __init__(self, name: str = None, id: str = None, **kwargs):
136
+ # Set name from parameters
137
+ if name:
138
+ self.name = name
139
+ elif id:
140
+ self.name = id
141
+ elif "name" in kwargs:
142
+ self.name = kwargs.pop("name")
143
+ elif "id" in kwargs:
144
+ self.name = kwargs.pop("id")
145
+ else:
146
+ self.name = self.__class__.__name__
147
+
148
+ # Initialize node attributes
137
149
  self.cache = {}
138
150
  self.semantic_index = defaultdict(list)
139
151
  self.access_patterns = defaultdict(int)
140
152
  self.cost_metrics = {}
141
153
  self.query_abstractions = {}
142
154
 
155
+ # Call parent constructor
156
+ super().__init__(name=self.name)
157
+
143
158
  def get_parameters(self) -> dict[str, NodeParameter]:
144
159
  return {
145
160
  "action": NodeParameter(
@@ -482,12 +497,27 @@ class MCPAgentNode(SelfOrganizingAgentNode):
482
497
  >>> assert "task" in params
483
498
  """
484
499
 
485
- def __init__(self):
486
- super().__init__()
500
+ def __init__(self, name: str = None, id: str = None, **kwargs):
501
+ # Set name from parameters
502
+ if name:
503
+ self.name = name
504
+ elif id:
505
+ self.name = id
506
+ elif "name" in kwargs:
507
+ self.name = kwargs.pop("name")
508
+ elif "id" in kwargs:
509
+ self.name = kwargs.pop("id")
510
+ else:
511
+ self.name = self.__class__.__name__
512
+
513
+ # Initialize node attributes
487
514
  self.mcp_clients = {}
488
515
  self.tool_registry = {}
489
516
  self.call_history = deque(maxlen=100)
490
517
 
518
+ # Call parent constructor
519
+ super().__init__(name=self.name)
520
+
491
521
  def get_parameters(self) -> dict[str, NodeParameter]:
492
522
  params = super().get_parameters()
493
523
 
@@ -789,8 +819,20 @@ class QueryAnalysisNode(Node):
789
819
  >>> assert simple["analysis"]["team_suggestion"]["suggested_size"] >= 1
790
820
  """
791
821
 
792
- def __init__(self):
793
- super().__init__()
822
+ def __init__(self, name: str = None, id: str = None, **kwargs):
823
+ # Set name from parameters
824
+ if name:
825
+ self.name = name
826
+ elif id:
827
+ self.name = id
828
+ elif "name" in kwargs:
829
+ self.name = kwargs.pop("name")
830
+ elif "id" in kwargs:
831
+ self.name = kwargs.pop("id")
832
+ else:
833
+ self.name = self.__class__.__name__
834
+
835
+ # Initialize node attributes
794
836
  self.query_patterns = {
795
837
  "data_retrieval": {
796
838
  "keywords": ["what is", "get", "fetch", "retrieve", "show me"],
@@ -824,6 +866,9 @@ class QueryAnalysisNode(Node):
824
866
  },
825
867
  }
826
868
 
869
+ # Call parent constructor
870
+ super().__init__(name=self.name)
871
+
827
872
  def get_parameters(self) -> dict[str, NodeParameter]:
828
873
  return {
829
874
  "query": NodeParameter(
@@ -1148,11 +1193,26 @@ class OrchestrationManagerNode(Node):
1148
1193
  >>> assert "max_iterations" in params
1149
1194
  """
1150
1195
 
1151
- def __init__(self):
1152
- super().__init__()
1196
+ def __init__(self, name: str = None, id: str = None, **kwargs):
1197
+ # Set name from parameters
1198
+ if name:
1199
+ self.name = name
1200
+ elif id:
1201
+ self.name = id
1202
+ elif "name" in kwargs:
1203
+ self.name = kwargs.pop("name")
1204
+ elif "id" in kwargs:
1205
+ self.name = kwargs.pop("id")
1206
+ else:
1207
+ self.name = self.__class__.__name__
1208
+
1209
+ # Initialize node attributes
1153
1210
  self.session_id = str(uuid.uuid4())
1154
1211
  self.orchestration_history = deque(maxlen=50)
1155
1212
 
1213
+ # Call parent constructor
1214
+ super().__init__(name=self.name)
1215
+
1156
1216
  def get_parameters(self) -> dict[str, NodeParameter]:
1157
1217
  return {
1158
1218
  "query": NodeParameter(
@@ -1304,9 +1364,22 @@ class OrchestrationManagerNode(Node):
1304
1364
 
1305
1365
  # Phase 5: Final Processing
1306
1366
  print("📊 Phase 5: Finalizing results...")
1367
+
1368
+ # Handle case where solution_history is empty (time limit reached early)
1369
+ if final_solution:
1370
+ solution_to_use = final_solution
1371
+ elif solution_history:
1372
+ solution_to_use = solution_history[-1]["solution"]
1373
+ else:
1374
+ solution_to_use = {
1375
+ "content": "No solution generated due to time constraints.",
1376
+ "confidence": 0.0,
1377
+ "reasoning": "Time limit reached before any solution could be generated.",
1378
+ }
1379
+
1307
1380
  final_result = self._finalize_results(
1308
1381
  query,
1309
- final_solution or solution_history[-1]["solution"],
1382
+ solution_to_use,
1310
1383
  solution_history,
1311
1384
  time.time() - start_time,
1312
1385
  infrastructure,
@@ -1825,10 +1898,25 @@ class ConvergenceDetectorNode(Node):
1825
1898
  >>> assert "Diminishing returns" in result2["reason"]
1826
1899
  """
1827
1900
 
1828
- def __init__(self):
1829
- super().__init__()
1901
+ def __init__(self, name: str = None, id: str = None, **kwargs):
1902
+ # Set name from parameters
1903
+ if name:
1904
+ self.name = name
1905
+ elif id:
1906
+ self.name = id
1907
+ elif "name" in kwargs:
1908
+ self.name = kwargs.pop("name")
1909
+ elif "id" in kwargs:
1910
+ self.name = kwargs.pop("id")
1911
+ else:
1912
+ self.name = self.__class__.__name__
1913
+
1914
+ # Initialize node attributes
1830
1915
  self.convergence_history = deque(maxlen=100)
1831
1916
 
1917
+ # Call parent constructor
1918
+ super().__init__(name=self.name)
1919
+
1832
1920
  def get_parameters(self) -> dict[str, NodeParameter]:
1833
1921
  return {
1834
1922
  "solution_history": NodeParameter(