kailash 0.8.3__py3-none-any.whl → 0.8.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.
- kailash/__init__.py +1 -7
- kailash/cli/__init__.py +11 -1
- kailash/cli/validation_audit.py +570 -0
- kailash/core/actors/supervisor.py +1 -1
- kailash/core/resilience/circuit_breaker.py +71 -1
- kailash/core/resilience/health_monitor.py +172 -0
- kailash/edge/compliance.py +33 -0
- kailash/edge/consistency.py +609 -0
- kailash/edge/coordination/__init__.py +30 -0
- kailash/edge/coordination/global_ordering.py +355 -0
- kailash/edge/coordination/leader_election.py +217 -0
- kailash/edge/coordination/partition_detector.py +296 -0
- kailash/edge/coordination/raft.py +485 -0
- kailash/edge/discovery.py +63 -1
- kailash/edge/migration/__init__.py +19 -0
- kailash/edge/migration/edge_migrator.py +832 -0
- kailash/edge/monitoring/__init__.py +21 -0
- kailash/edge/monitoring/edge_monitor.py +736 -0
- kailash/edge/prediction/__init__.py +10 -0
- kailash/edge/prediction/predictive_warmer.py +591 -0
- kailash/edge/resource/__init__.py +102 -0
- kailash/edge/resource/cloud_integration.py +796 -0
- kailash/edge/resource/cost_optimizer.py +949 -0
- kailash/edge/resource/docker_integration.py +919 -0
- kailash/edge/resource/kubernetes_integration.py +893 -0
- kailash/edge/resource/platform_integration.py +913 -0
- kailash/edge/resource/predictive_scaler.py +959 -0
- kailash/edge/resource/resource_analyzer.py +824 -0
- kailash/edge/resource/resource_pools.py +610 -0
- kailash/integrations/dataflow_edge.py +261 -0
- kailash/mcp_server/registry_integration.py +1 -1
- kailash/monitoring/__init__.py +18 -0
- kailash/monitoring/alerts.py +646 -0
- kailash/monitoring/metrics.py +677 -0
- kailash/nodes/__init__.py +2 -0
- kailash/nodes/ai/__init__.py +17 -0
- kailash/nodes/ai/a2a.py +1914 -43
- kailash/nodes/ai/a2a_backup.py +1807 -0
- kailash/nodes/ai/hybrid_search.py +972 -0
- kailash/nodes/ai/semantic_memory.py +558 -0
- kailash/nodes/ai/streaming_analytics.py +947 -0
- kailash/nodes/base.py +545 -0
- kailash/nodes/edge/__init__.py +36 -0
- kailash/nodes/edge/base.py +240 -0
- kailash/nodes/edge/cloud_node.py +710 -0
- kailash/nodes/edge/coordination.py +239 -0
- kailash/nodes/edge/docker_node.py +825 -0
- kailash/nodes/edge/edge_data.py +582 -0
- kailash/nodes/edge/edge_migration_node.py +392 -0
- kailash/nodes/edge/edge_monitoring_node.py +421 -0
- kailash/nodes/edge/edge_state.py +673 -0
- kailash/nodes/edge/edge_warming_node.py +393 -0
- kailash/nodes/edge/kubernetes_node.py +652 -0
- kailash/nodes/edge/platform_node.py +766 -0
- kailash/nodes/edge/resource_analyzer_node.py +378 -0
- kailash/nodes/edge/resource_optimizer_node.py +501 -0
- kailash/nodes/edge/resource_scaler_node.py +397 -0
- kailash/nodes/ports.py +676 -0
- kailash/runtime/local.py +344 -1
- kailash/runtime/validation/__init__.py +20 -0
- kailash/runtime/validation/connection_context.py +119 -0
- kailash/runtime/validation/enhanced_error_formatter.py +202 -0
- kailash/runtime/validation/error_categorizer.py +164 -0
- kailash/runtime/validation/metrics.py +380 -0
- kailash/runtime/validation/performance.py +615 -0
- kailash/runtime/validation/suggestion_engine.py +212 -0
- kailash/testing/fixtures.py +2 -2
- kailash/workflow/builder.py +234 -8
- kailash/workflow/contracts.py +418 -0
- kailash/workflow/edge_infrastructure.py +369 -0
- kailash/workflow/migration.py +3 -3
- kailash/workflow/type_inference.py +669 -0
- {kailash-0.8.3.dist-info → kailash-0.8.5.dist-info}/METADATA +44 -27
- {kailash-0.8.3.dist-info → kailash-0.8.5.dist-info}/RECORD +78 -28
- kailash/nexus/__init__.py +0 -21
- kailash/nexus/cli/__init__.py +0 -5
- kailash/nexus/cli/__main__.py +0 -6
- kailash/nexus/cli/main.py +0 -176
- kailash/nexus/factory.py +0 -413
- kailash/nexus/gateway.py +0 -545
- {kailash-0.8.3.dist-info → kailash-0.8.5.dist-info}/WHEEL +0 -0
- {kailash-0.8.3.dist-info → kailash-0.8.5.dist-info}/entry_points.txt +0 -0
- {kailash-0.8.3.dist-info → kailash-0.8.5.dist-info}/licenses/LICENSE +0 -0
- {kailash-0.8.3.dist-info → kailash-0.8.5.dist-info}/top_level.txt +0 -0
kailash/nexus/factory.py
DELETED
@@ -1,413 +0,0 @@
|
|
1
|
-
"""Factory functions for creating Nexus Gateway instances."""
|
2
|
-
|
3
|
-
import logging
|
4
|
-
from typing import Any, Dict, List, Optional, Union
|
5
|
-
|
6
|
-
from ..workflow import Workflow
|
7
|
-
from .gateway import NexusConfig, NexusGateway
|
8
|
-
|
9
|
-
logger = logging.getLogger(__name__)
|
10
|
-
|
11
|
-
|
12
|
-
def create_nexus(
|
13
|
-
name: Optional[str] = None,
|
14
|
-
description: Optional[str] = None,
|
15
|
-
# Channel configuration
|
16
|
-
enable_api: bool = True,
|
17
|
-
enable_cli: bool = True,
|
18
|
-
enable_mcp: bool = True,
|
19
|
-
# API settings
|
20
|
-
api_host: str = "localhost",
|
21
|
-
api_port: int = 8000,
|
22
|
-
api_cors_origins: Optional[List[str]] = None,
|
23
|
-
# CLI settings
|
24
|
-
cli_interactive: bool = False,
|
25
|
-
cli_prompt: str = "nexus> ",
|
26
|
-
# MCP settings
|
27
|
-
mcp_host: str = "localhost",
|
28
|
-
mcp_port: int = 3001,
|
29
|
-
mcp_server_name: Optional[str] = None,
|
30
|
-
# Session management
|
31
|
-
session_timeout: int = 3600,
|
32
|
-
session_cleanup_interval: int = 300,
|
33
|
-
# Event routing
|
34
|
-
enable_event_routing: bool = True,
|
35
|
-
event_queue_size: int = 10000,
|
36
|
-
# Advanced settings
|
37
|
-
enable_health_monitoring: bool = True,
|
38
|
-
health_check_interval: int = 30,
|
39
|
-
graceful_shutdown_timeout: int = 30,
|
40
|
-
# Initial workflows
|
41
|
-
workflows: Optional[Dict[str, Workflow]] = None,
|
42
|
-
# Custom configuration
|
43
|
-
**kwargs,
|
44
|
-
) -> NexusGateway:
|
45
|
-
"""Create a Nexus Gateway with the specified configuration.
|
46
|
-
|
47
|
-
This is the main entry point for creating a Nexus Gateway instance
|
48
|
-
with sensible defaults for different use cases.
|
49
|
-
|
50
|
-
Args:
|
51
|
-
name: Gateway name (defaults to "kailash-nexus")
|
52
|
-
description: Gateway description
|
53
|
-
|
54
|
-
# Channel Configuration
|
55
|
-
enable_api: Enable HTTP API channel
|
56
|
-
enable_cli: Enable CLI channel
|
57
|
-
enable_mcp: Enable MCP channel
|
58
|
-
|
59
|
-
# API Channel Settings
|
60
|
-
api_host: API server host
|
61
|
-
api_port: API server port
|
62
|
-
api_cors_origins: CORS origins for API
|
63
|
-
|
64
|
-
# CLI Channel Settings
|
65
|
-
cli_interactive: Enable interactive CLI mode
|
66
|
-
cli_prompt: CLI prompt template
|
67
|
-
|
68
|
-
# MCP Channel Settings
|
69
|
-
mcp_host: MCP server host
|
70
|
-
mcp_port: MCP server port
|
71
|
-
mcp_server_name: MCP server name
|
72
|
-
|
73
|
-
# Session Management
|
74
|
-
session_timeout: Session timeout in seconds
|
75
|
-
session_cleanup_interval: Session cleanup interval in seconds
|
76
|
-
|
77
|
-
# Event Routing
|
78
|
-
enable_event_routing: Enable cross-channel event routing
|
79
|
-
event_queue_size: Event queue size
|
80
|
-
|
81
|
-
# Advanced Settings
|
82
|
-
enable_health_monitoring: Enable background health monitoring
|
83
|
-
health_check_interval: Health check interval in seconds
|
84
|
-
graceful_shutdown_timeout: Graceful shutdown timeout in seconds
|
85
|
-
|
86
|
-
# Initial Workflows
|
87
|
-
workflows: Dictionary of workflows to register initially
|
88
|
-
|
89
|
-
# Custom Configuration
|
90
|
-
**kwargs: Additional configuration options
|
91
|
-
|
92
|
-
Returns:
|
93
|
-
Configured NexusGateway instance
|
94
|
-
|
95
|
-
Examples:
|
96
|
-
Create a basic Nexus with all channels:
|
97
|
-
>>> nexus = create_nexus()
|
98
|
-
|
99
|
-
Create API-only Nexus:
|
100
|
-
>>> nexus = create_nexus(
|
101
|
-
... enable_cli=False,
|
102
|
-
... enable_mcp=False,
|
103
|
-
... api_port=9000
|
104
|
-
... )
|
105
|
-
|
106
|
-
Create Nexus with custom configuration:
|
107
|
-
>>> nexus = create_nexus(
|
108
|
-
... name="my-nexus",
|
109
|
-
... description="Custom multi-channel gateway",
|
110
|
-
... api_port=8080,
|
111
|
-
... mcp_port=3002,
|
112
|
-
... session_timeout=7200, # 2 hours
|
113
|
-
... workflows={"my_workflow": my_workflow_instance}
|
114
|
-
... )
|
115
|
-
"""
|
116
|
-
|
117
|
-
# Build configuration
|
118
|
-
config = NexusConfig(
|
119
|
-
name=name or "kailash-nexus",
|
120
|
-
description=description or "Multi-channel workflow orchestration gateway",
|
121
|
-
# Channel configuration
|
122
|
-
enable_api=enable_api,
|
123
|
-
enable_cli=enable_cli,
|
124
|
-
enable_mcp=enable_mcp,
|
125
|
-
# API settings
|
126
|
-
api_host=api_host,
|
127
|
-
api_port=api_port,
|
128
|
-
api_cors_origins=api_cors_origins or ["*"],
|
129
|
-
# CLI settings
|
130
|
-
cli_interactive=cli_interactive,
|
131
|
-
cli_prompt_template=cli_prompt,
|
132
|
-
# MCP settings
|
133
|
-
mcp_host=mcp_host,
|
134
|
-
mcp_port=mcp_port,
|
135
|
-
mcp_server_name=mcp_server_name or f"{name or 'kailash'}-nexus-mcp",
|
136
|
-
# Session management
|
137
|
-
session_timeout=session_timeout,
|
138
|
-
session_cleanup_interval=session_cleanup_interval,
|
139
|
-
# Event routing
|
140
|
-
enable_event_routing=enable_event_routing,
|
141
|
-
event_queue_size=event_queue_size,
|
142
|
-
# Advanced settings
|
143
|
-
enable_health_monitoring=enable_health_monitoring,
|
144
|
-
health_check_interval=health_check_interval,
|
145
|
-
graceful_shutdown_timeout=graceful_shutdown_timeout,
|
146
|
-
)
|
147
|
-
|
148
|
-
# Apply any additional kwargs to config
|
149
|
-
for key, value in kwargs.items():
|
150
|
-
if hasattr(config, key):
|
151
|
-
setattr(config, key, value)
|
152
|
-
else:
|
153
|
-
logger.warning(f"Unknown configuration option: {key}")
|
154
|
-
|
155
|
-
# Create gateway
|
156
|
-
nexus = NexusGateway(config)
|
157
|
-
|
158
|
-
# Register initial workflows if provided
|
159
|
-
if workflows:
|
160
|
-
for workflow_name, workflow in workflows.items():
|
161
|
-
nexus.register_workflow(workflow_name, workflow)
|
162
|
-
logger.info(f"Registered initial workflow: {workflow_name}")
|
163
|
-
|
164
|
-
logger.info(f"Created Nexus Gateway: {config.name}")
|
165
|
-
logger.info(
|
166
|
-
f"Enabled channels: API={enable_api}, CLI={enable_cli}, MCP={enable_mcp}"
|
167
|
-
)
|
168
|
-
|
169
|
-
return nexus
|
170
|
-
|
171
|
-
|
172
|
-
def create_api_nexus(
|
173
|
-
name: Optional[str] = None,
|
174
|
-
port: int = 8000,
|
175
|
-
host: str = "localhost",
|
176
|
-
cors_origins: Optional[List[str]] = None,
|
177
|
-
workflows: Optional[Dict[str, Workflow]] = None,
|
178
|
-
**kwargs,
|
179
|
-
) -> NexusGateway:
|
180
|
-
"""Create an API-only Nexus Gateway.
|
181
|
-
|
182
|
-
This is a convenience function for creating a Nexus Gateway
|
183
|
-
that only exposes the HTTP API channel.
|
184
|
-
|
185
|
-
Args:
|
186
|
-
name: Gateway name
|
187
|
-
port: API server port
|
188
|
-
host: API server host
|
189
|
-
cors_origins: CORS origins
|
190
|
-
workflows: Initial workflows to register
|
191
|
-
**kwargs: Additional configuration options
|
192
|
-
|
193
|
-
Returns:
|
194
|
-
Configured NexusGateway with only API channel enabled
|
195
|
-
|
196
|
-
Example:
|
197
|
-
>>> nexus = create_api_nexus(
|
198
|
-
... name="api-only-nexus",
|
199
|
-
... port=9000,
|
200
|
-
... workflows={"my_workflow": workflow}
|
201
|
-
... )
|
202
|
-
"""
|
203
|
-
return create_nexus(
|
204
|
-
name=name or "kailash-api-nexus",
|
205
|
-
description="API-only workflow gateway",
|
206
|
-
enable_api=True,
|
207
|
-
enable_cli=False,
|
208
|
-
enable_mcp=False,
|
209
|
-
api_host=host,
|
210
|
-
api_port=port,
|
211
|
-
api_cors_origins=cors_origins,
|
212
|
-
workflows=workflows,
|
213
|
-
**kwargs,
|
214
|
-
)
|
215
|
-
|
216
|
-
|
217
|
-
def create_cli_nexus(
|
218
|
-
name: Optional[str] = None,
|
219
|
-
interactive: bool = True,
|
220
|
-
prompt: str = "nexus-cli> ",
|
221
|
-
workflows: Optional[Dict[str, Workflow]] = None,
|
222
|
-
**kwargs,
|
223
|
-
) -> NexusGateway:
|
224
|
-
"""Create a CLI-only Nexus Gateway.
|
225
|
-
|
226
|
-
This is a convenience function for creating a Nexus Gateway
|
227
|
-
that only exposes the CLI channel.
|
228
|
-
|
229
|
-
Args:
|
230
|
-
name: Gateway name
|
231
|
-
interactive: Enable interactive CLI mode
|
232
|
-
prompt: CLI prompt template
|
233
|
-
workflows: Initial workflows to register
|
234
|
-
**kwargs: Additional configuration options
|
235
|
-
|
236
|
-
Returns:
|
237
|
-
Configured NexusGateway with only CLI channel enabled
|
238
|
-
|
239
|
-
Example:
|
240
|
-
>>> nexus = create_cli_nexus(
|
241
|
-
... name="cli-nexus",
|
242
|
-
... interactive=True,
|
243
|
-
... workflows={"help": help_workflow}
|
244
|
-
... )
|
245
|
-
"""
|
246
|
-
return create_nexus(
|
247
|
-
name=name or "kailash-cli-nexus",
|
248
|
-
description="CLI-only workflow gateway",
|
249
|
-
enable_api=False,
|
250
|
-
enable_cli=True,
|
251
|
-
enable_mcp=False,
|
252
|
-
cli_interactive=interactive,
|
253
|
-
cli_prompt=prompt,
|
254
|
-
workflows=workflows,
|
255
|
-
**kwargs,
|
256
|
-
)
|
257
|
-
|
258
|
-
|
259
|
-
def create_mcp_nexus(
|
260
|
-
name: Optional[str] = None,
|
261
|
-
port: int = 3001,
|
262
|
-
host: str = "localhost",
|
263
|
-
server_name: Optional[str] = None,
|
264
|
-
workflows: Optional[Dict[str, Workflow]] = None,
|
265
|
-
**kwargs,
|
266
|
-
) -> NexusGateway:
|
267
|
-
"""Create an MCP-only Nexus Gateway.
|
268
|
-
|
269
|
-
This is a convenience function for creating a Nexus Gateway
|
270
|
-
that only exposes the MCP channel.
|
271
|
-
|
272
|
-
Args:
|
273
|
-
name: Gateway name
|
274
|
-
port: MCP server port
|
275
|
-
host: MCP server host
|
276
|
-
server_name: MCP server name
|
277
|
-
workflows: Initial workflows to register
|
278
|
-
**kwargs: Additional configuration options
|
279
|
-
|
280
|
-
Returns:
|
281
|
-
Configured NexusGateway with only MCP channel enabled
|
282
|
-
|
283
|
-
Example:
|
284
|
-
>>> nexus = create_mcp_nexus(
|
285
|
-
... name="mcp-nexus",
|
286
|
-
... port=3002,
|
287
|
-
... workflows={"ai_tool": ai_workflow}
|
288
|
-
... )
|
289
|
-
"""
|
290
|
-
return create_nexus(
|
291
|
-
name=name or "kailash-mcp-nexus",
|
292
|
-
description="MCP-only workflow gateway",
|
293
|
-
enable_api=False,
|
294
|
-
enable_cli=False,
|
295
|
-
enable_mcp=True,
|
296
|
-
mcp_host=host,
|
297
|
-
mcp_port=port,
|
298
|
-
mcp_server_name=server_name,
|
299
|
-
workflows=workflows,
|
300
|
-
**kwargs,
|
301
|
-
)
|
302
|
-
|
303
|
-
|
304
|
-
def create_development_nexus(
|
305
|
-
name: Optional[str] = None,
|
306
|
-
api_port: int = 8000,
|
307
|
-
mcp_port: int = 3001,
|
308
|
-
workflows: Optional[Dict[str, Workflow]] = None,
|
309
|
-
**kwargs,
|
310
|
-
) -> NexusGateway:
|
311
|
-
"""Create a development-focused Nexus Gateway.
|
312
|
-
|
313
|
-
This configuration is optimized for development with:
|
314
|
-
- All channels enabled
|
315
|
-
- Interactive CLI
|
316
|
-
- Health monitoring
|
317
|
-
- Verbose logging
|
318
|
-
- Short timeouts for faster iteration
|
319
|
-
|
320
|
-
Args:
|
321
|
-
name: Gateway name
|
322
|
-
api_port: API server port
|
323
|
-
mcp_port: MCP server port
|
324
|
-
workflows: Initial workflows to register
|
325
|
-
**kwargs: Additional configuration options
|
326
|
-
|
327
|
-
Returns:
|
328
|
-
Configured NexusGateway optimized for development
|
329
|
-
|
330
|
-
Example:
|
331
|
-
>>> nexus = create_development_nexus(
|
332
|
-
... name="dev-nexus",
|
333
|
-
... workflows={"test": test_workflow}
|
334
|
-
... )
|
335
|
-
"""
|
336
|
-
return create_nexus(
|
337
|
-
name=name or "kailash-dev-nexus",
|
338
|
-
description="Development multi-channel gateway",
|
339
|
-
# Enable all channels
|
340
|
-
enable_api=True,
|
341
|
-
enable_cli=True,
|
342
|
-
enable_mcp=True,
|
343
|
-
# Development-friendly settings
|
344
|
-
api_port=api_port,
|
345
|
-
mcp_port=mcp_port,
|
346
|
-
cli_interactive=True,
|
347
|
-
cli_prompt="dev-nexus> ",
|
348
|
-
# Faster cleanup for development
|
349
|
-
session_timeout=1800, # 30 minutes
|
350
|
-
session_cleanup_interval=60, # 1 minute
|
351
|
-
health_check_interval=10, # 10 seconds
|
352
|
-
graceful_shutdown_timeout=10, # 10 seconds
|
353
|
-
# Enhanced monitoring
|
354
|
-
enable_health_monitoring=True,
|
355
|
-
enable_event_routing=True,
|
356
|
-
workflows=workflows,
|
357
|
-
**kwargs,
|
358
|
-
)
|
359
|
-
|
360
|
-
|
361
|
-
def create_production_nexus(
|
362
|
-
name: Optional[str] = None,
|
363
|
-
api_port: int = 80,
|
364
|
-
mcp_port: int = 3001,
|
365
|
-
workflows: Optional[Dict[str, Workflow]] = None,
|
366
|
-
**kwargs,
|
367
|
-
) -> NexusGateway:
|
368
|
-
"""Create a production-optimized Nexus Gateway.
|
369
|
-
|
370
|
-
This configuration is optimized for production with:
|
371
|
-
- Conservative timeouts
|
372
|
-
- Enhanced monitoring
|
373
|
-
- Larger queue sizes
|
374
|
-
- Robust error handling
|
375
|
-
|
376
|
-
Args:
|
377
|
-
name: Gateway name
|
378
|
-
api_port: API server port (defaults to 80 for production)
|
379
|
-
mcp_port: MCP server port
|
380
|
-
workflows: Initial workflows to register
|
381
|
-
**kwargs: Additional configuration options
|
382
|
-
|
383
|
-
Returns:
|
384
|
-
Configured NexusGateway optimized for production
|
385
|
-
|
386
|
-
Example:
|
387
|
-
>>> nexus = create_production_nexus(
|
388
|
-
... name="prod-nexus",
|
389
|
-
... api_port=8080,
|
390
|
-
... workflows=production_workflows
|
391
|
-
... )
|
392
|
-
"""
|
393
|
-
return create_nexus(
|
394
|
-
name=name or "kailash-prod-nexus",
|
395
|
-
description="Production multi-channel gateway",
|
396
|
-
# Production ports
|
397
|
-
api_port=api_port,
|
398
|
-
mcp_port=mcp_port,
|
399
|
-
# Conservative timeouts
|
400
|
-
session_timeout=7200, # 2 hours
|
401
|
-
session_cleanup_interval=300, # 5 minutes
|
402
|
-
health_check_interval=60, # 1 minute
|
403
|
-
graceful_shutdown_timeout=60, # 1 minute
|
404
|
-
# Larger queues for production load
|
405
|
-
event_queue_size=50000,
|
406
|
-
# Enhanced monitoring
|
407
|
-
enable_health_monitoring=True,
|
408
|
-
enable_event_routing=True,
|
409
|
-
# CLI disabled by default in production
|
410
|
-
enable_cli=False,
|
411
|
-
workflows=workflows,
|
412
|
-
**kwargs,
|
413
|
-
)
|