omnimancer-cli 0.1.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 (126) hide show
  1. omnimancer/__init__.py +42 -0
  2. omnimancer/__main__.py +9 -0
  3. omnimancer/cli/__init__.py +8 -0
  4. omnimancer/cli/agent_manager.py +826 -0
  5. omnimancer/cli/agent_wizard.py +944 -0
  6. omnimancer/cli/approval_formatter.py +734 -0
  7. omnimancer/cli/approval_integration.py +734 -0
  8. omnimancer/cli/approval_prompt.py +1286 -0
  9. omnimancer/cli/batch_approval_display.py +617 -0
  10. omnimancer/cli/batch_approval_filters.py +729 -0
  11. omnimancer/cli/batch_operation_monitor.py +775 -0
  12. omnimancer/cli/commands/performance_cmd.py +624 -0
  13. omnimancer/cli/commands.py +757 -0
  14. omnimancer/cli/completion_handler.py +281 -0
  15. omnimancer/cli/config_setup_wizard.py +783 -0
  16. omnimancer/cli/dynamic_commands.py +371 -0
  17. omnimancer/cli/handlers/__init__.py +18 -0
  18. omnimancer/cli/handlers/agent_handler.py +865 -0
  19. omnimancer/cli/handlers/agent_persona_handler.py +1048 -0
  20. omnimancer/cli/handlers/custom_agent_handler.py +352 -0
  21. omnimancer/cli/handlers/permissions_handler.py +1609 -0
  22. omnimancer/cli/interface.py +6695 -0
  23. omnimancer/cli/performance_dashboard.py +612 -0
  24. omnimancer/core/__init__.py +34 -0
  25. omnimancer/core/agent/__init__.py +256 -0
  26. omnimancer/core/agent/agent_config.py +715 -0
  27. omnimancer/core/agent/agent_switcher.py +668 -0
  28. omnimancer/core/agent/approval_context.py +460 -0
  29. omnimancer/core/agent/approval_dialog.py +902 -0
  30. omnimancer/core/agent/approval_interface.py +628 -0
  31. omnimancer/core/agent/approval_manager.py +760 -0
  32. omnimancer/core/agent/cli_integration.py +470 -0
  33. omnimancer/core/agent/config.py +845 -0
  34. omnimancer/core/agent/custom_agent_integration.py +654 -0
  35. omnimancer/core/agent/diff_renderer.py +706 -0
  36. omnimancer/core/agent/file_content_display.py +503 -0
  37. omnimancer/core/agent/file_modification_workflow.py +658 -0
  38. omnimancer/core/agent/file_system_manager.py +1790 -0
  39. omnimancer/core/agent/input_handler.py +614 -0
  40. omnimancer/core/agent/metrics_collector.py +771 -0
  41. omnimancer/core/agent/optimization_engine.py +729 -0
  42. omnimancer/core/agent/performance_monitor.py +717 -0
  43. omnimancer/core/agent/persona.py +870 -0
  44. omnimancer/core/agent/persona_validator.py +672 -0
  45. omnimancer/core/agent/program_executor.py +748 -0
  46. omnimancer/core/agent/proposed_changes_integration.py +663 -0
  47. omnimancer/core/agent/read_before_write_errors.py +492 -0
  48. omnimancer/core/agent/read_before_write_ui.py +647 -0
  49. omnimancer/core/agent/rich_renderer.py +763 -0
  50. omnimancer/core/agent/status_config.py +238 -0
  51. omnimancer/core/agent/status_core.py +446 -0
  52. omnimancer/core/agent/status_integrated_engine.py +540 -0
  53. omnimancer/core/agent/status_manager.py +878 -0
  54. omnimancer/core/agent/status_ui_components.py +535 -0
  55. omnimancer/core/agent/template_applicator.py +548 -0
  56. omnimancer/core/agent/terminal_status_listener.py +394 -0
  57. omnimancer/core/agent/token_tracker.py +679 -0
  58. omnimancer/core/agent/types.py +60 -0
  59. omnimancer/core/agent/web_client.py +745 -0
  60. omnimancer/core/agent/workflow_orchestrator.py +826 -0
  61. omnimancer/core/agent_engine.py +1625 -0
  62. omnimancer/core/agent_mode_manager.py +706 -0
  63. omnimancer/core/agent_progress_ui.py +545 -0
  64. omnimancer/core/chat_manager.py +141 -0
  65. omnimancer/core/config_manager.py +2199 -0
  66. omnimancer/core/config_migration.py +772 -0
  67. omnimancer/core/config_provider.py +1974 -0
  68. omnimancer/core/config_security_validator.py +393 -0
  69. omnimancer/core/config_validator.py +768 -0
  70. omnimancer/core/conversation_manager.py +352 -0
  71. omnimancer/core/engine.py +787 -0
  72. omnimancer/core/enhanced_input.py +523 -0
  73. omnimancer/core/env_loader.py +83 -0
  74. omnimancer/core/fallback_manager.py +568 -0
  75. omnimancer/core/health_monitor.py +462 -0
  76. omnimancer/core/history_manager.py +462 -0
  77. omnimancer/core/mcp_integration_layer.py +878 -0
  78. omnimancer/core/models.py +1889 -0
  79. omnimancer/core/provider_capabilities.py +403 -0
  80. omnimancer/core/provider_initializer.py +450 -0
  81. omnimancer/core/provider_registry.py +432 -0
  82. omnimancer/core/security/__init__.py +16 -0
  83. omnimancer/core/security/approval_workflow.py +406 -0
  84. omnimancer/core/security/audit_logger.py +511 -0
  85. omnimancer/core/security/permission_controller.py +511 -0
  86. omnimancer/core/security/sandbox_manager.py +379 -0
  87. omnimancer/core/security/security_manager.py +530 -0
  88. omnimancer/core/setup_wizard.py +345 -0
  89. omnimancer/core/setup_wizard_core.py +449 -0
  90. omnimancer/core/setup_wizard_guide_generator.py +376 -0
  91. omnimancer/core/setup_wizard_provider_setup.py +454 -0
  92. omnimancer/core/setup_wizard_ui.py +317 -0
  93. omnimancer/core/setup_wizard_validation.py +371 -0
  94. omnimancer/core/signal_handler.py +174 -0
  95. omnimancer/mcp/__init__.py +11 -0
  96. omnimancer/mcp/client.py +725 -0
  97. omnimancer/mcp/manager.py +649 -0
  98. omnimancer/providers/__init__.py +24 -0
  99. omnimancer/providers/azure.py +608 -0
  100. omnimancer/providers/base.py +262 -0
  101. omnimancer/providers/bedrock.py +711 -0
  102. omnimancer/providers/claude.py +426 -0
  103. omnimancer/providers/claude_code.py +406 -0
  104. omnimancer/providers/cohere.py +412 -0
  105. omnimancer/providers/factory.py +988 -0
  106. omnimancer/providers/gemini.py +708 -0
  107. omnimancer/providers/mistral.py +554 -0
  108. omnimancer/providers/ollama.py +510 -0
  109. omnimancer/providers/openai.py +362 -0
  110. omnimancer/providers/openrouter.py +709 -0
  111. omnimancer/providers/perplexity.py +476 -0
  112. omnimancer/providers/vertex.py +617 -0
  113. omnimancer/providers/xai.py +484 -0
  114. omnimancer/ui/__init__.py +6 -0
  115. omnimancer/ui/cancellation_handler.py +235 -0
  116. omnimancer/ui/progress_indicator.py +318 -0
  117. omnimancer/utils/__init__.py +22 -0
  118. omnimancer/utils/error_handler.py +589 -0
  119. omnimancer/utils/errors.py +667 -0
  120. omnimancer/utils/retry.py +238 -0
  121. omnimancer_cli-0.1.0.dist-info/METADATA +413 -0
  122. omnimancer_cli-0.1.0.dist-info/RECORD +126 -0
  123. omnimancer_cli-0.1.0.dist-info/WHEEL +5 -0
  124. omnimancer_cli-0.1.0.dist-info/entry_points.txt +4 -0
  125. omnimancer_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
  126. omnimancer_cli-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,449 @@
1
+ """
2
+ Core orchestration methods for the setup wizard.
3
+
4
+ This module contains the main orchestration logic for coordinating
5
+ the setup wizard workflow.
6
+ """
7
+
8
+ from typing import Any, Dict, List, Optional
9
+
10
+ from rich.console import Console
11
+ from rich.prompt import Confirm
12
+
13
+ from ..core.signal_handler import SignalHandler
14
+ from ..providers.factory import ProviderFactory
15
+ from ..ui.cancellation_handler import CancellationHandler
16
+ from .config_manager import ConfigManager
17
+ from .provider_registry import ProviderRegistry
18
+
19
+
20
+ class SetupWizardCore:
21
+ """Core orchestration methods for the setup wizard."""
22
+
23
+ def __init__(
24
+ self,
25
+ config_manager: ConfigManager,
26
+ provider_registry: ProviderRegistry,
27
+ ):
28
+ """
29
+ Initialize the setup wizard core.
30
+
31
+ Args:
32
+ config_manager: Configuration manager instance
33
+ provider_registry: Provider registry instance
34
+ """
35
+ self.config_manager = config_manager
36
+ self.provider_registry = provider_registry
37
+ self.console = Console()
38
+ self.provider_factory = ProviderFactory()
39
+
40
+ # Initialize cancellation support
41
+ self.cancellation_handler = CancellationHandler(self.console)
42
+ self.signal_handler = SignalHandler()
43
+
44
+ # Provider descriptions and strengths
45
+ self.provider_info = {
46
+ "claude": {
47
+ "name": "Anthropic Claude",
48
+ "description": "Advanced reasoning and analysis with strong safety features",
49
+ "strengths": [
50
+ "Code analysis",
51
+ "Complex reasoning",
52
+ "Safety-focused",
53
+ "Long conversations",
54
+ ],
55
+ "models": [
56
+ "claude-sonnet-4-20250514",
57
+ "claude-opus-4-20250514",
58
+ "claude-3-5-sonnet-20241022",
59
+ ],
60
+ "api_key_url": "https://console.anthropic.com/",
61
+ "api_key_prefix": "sk-ant-",
62
+ "setup_notes": "Get your API key from the Anthropic Console",
63
+ },
64
+ "openai": {
65
+ "name": "OpenAI GPT",
66
+ "description": "Versatile models with strong general capabilities",
67
+ "strengths": [
68
+ "General purpose",
69
+ "Code generation",
70
+ "Creative writing",
71
+ "Tool usage",
72
+ ],
73
+ "models": [
74
+ "gpt-4o",
75
+ "o1",
76
+ "o3",
77
+ "o3-mini",
78
+ "o4-mini",
79
+ "o1-mini",
80
+ "o1-pro",
81
+ "gpt-4o-mini",
82
+ ],
83
+ "api_key_url": "https://platform.openai.com/api-keys",
84
+ "api_key_prefix": "sk-",
85
+ "setup_notes": "Get your API key from the OpenAI Platform",
86
+ },
87
+ "gemini": {
88
+ "name": "Google Gemini",
89
+ "description": "Multimodal AI with strong integration capabilities",
90
+ "strengths": [
91
+ "Multimodal",
92
+ "Large context",
93
+ "Fast responses",
94
+ "Google integration",
95
+ ],
96
+ "models": [
97
+ "gemini-2.5-pro-preview-05-06",
98
+ "gemini-2.5-flash-preview-04-17",
99
+ "gemini-2.0-flash",
100
+ "gemini-1.5-pro",
101
+ ],
102
+ "api_key_url": "https://makersuite.google.com/app/apikey",
103
+ "api_key_prefix": "AIza",
104
+ "setup_notes": "Get your API key from Google AI Studio",
105
+ },
106
+ "perplexity": {
107
+ "name": "Perplexity AI",
108
+ "description": "Search-enhanced AI with real-time information access",
109
+ "strengths": [
110
+ "Web search",
111
+ "Real-time info",
112
+ "Research",
113
+ "Current events",
114
+ ],
115
+ "models": [
116
+ "sonar-pro",
117
+ "sonar",
118
+ "deep-research",
119
+ "sonar-reasoning-pro",
120
+ "sonar-reasoning",
121
+ ],
122
+ "api_key_url": "https://www.perplexity.ai/settings/api",
123
+ "api_key_prefix": "pplx-",
124
+ "setup_notes": "Get your API key from Perplexity Settings",
125
+ },
126
+ "xai": {
127
+ "name": "xAI Grok",
128
+ "description": "Advanced reasoning with real-time information",
129
+ "strengths": [
130
+ "Real-time data",
131
+ "Reasoning",
132
+ "Multimodal",
133
+ "Tool usage",
134
+ ],
135
+ "models": ["grok-3", "grok-3-fast", "grok-4"],
136
+ "api_key_url": "https://console.x.ai/",
137
+ "api_key_prefix": "xai-",
138
+ "setup_notes": "Get your API key from the xAI Console",
139
+ },
140
+ "mistral": {
141
+ "name": "Mistral AI",
142
+ "description": "Efficient European AI with strong performance",
143
+ "strengths": [
144
+ "Efficiency",
145
+ "Multilingual",
146
+ "Code generation",
147
+ "Privacy-focused",
148
+ ],
149
+ "models": [
150
+ "mistral-small-3.1",
151
+ "mistral-medium",
152
+ "mistral-large",
153
+ ],
154
+ "api_key_url": "https://console.mistral.ai/",
155
+ "api_key_prefix": "mistral-",
156
+ "setup_notes": "Get your API key from the Mistral Console",
157
+ },
158
+ "cohere": {
159
+ "name": "Cohere",
160
+ "description": "Enterprise-focused AI with strong text generation",
161
+ "strengths": [
162
+ "Enterprise features",
163
+ "Text generation",
164
+ "Embeddings",
165
+ "Classification",
166
+ ],
167
+ "models": ["command-r", "command-r-plus", "command-light"],
168
+ "api_key_url": "https://dashboard.cohere.ai/api-keys",
169
+ "api_key_prefix": "",
170
+ "setup_notes": "Get your API key from the Cohere Dashboard",
171
+ },
172
+ "ollama": {
173
+ "name": "Ollama (Local)",
174
+ "description": "Run models locally on your machine",
175
+ "strengths": [
176
+ "Privacy",
177
+ "No API costs",
178
+ "Offline usage",
179
+ "Custom models",
180
+ ],
181
+ "models": [
182
+ "llama3.3:latest",
183
+ "qwen3:latest",
184
+ "mistral-small3.1:latest",
185
+ "phi4:latest",
186
+ "devstral:latest",
187
+ ],
188
+ "api_key_url": "https://ollama.ai/",
189
+ "api_key_prefix": "",
190
+ "setup_notes": "Install Ollama locally - no API key required",
191
+ },
192
+ "azure": {
193
+ "name": "Azure OpenAI",
194
+ "description": "OpenAI models through Microsoft Azure cloud platform",
195
+ "strengths": [
196
+ "Enterprise security",
197
+ "Azure integration",
198
+ "Compliance",
199
+ "Scalability",
200
+ ],
201
+ "models": ["gpt-4o", "gpt-4o-mini", "gpt-4-1"],
202
+ "api_key_url": "https://portal.azure.com/",
203
+ "api_key_prefix": "",
204
+ "setup_notes": "Requires Azure subscription and OpenAI service deployment",
205
+ },
206
+ "vertex": {
207
+ "name": "Google Vertex AI",
208
+ "description": "Google's enterprise AI platform with Gemini models",
209
+ "strengths": [
210
+ "Enterprise features",
211
+ "Google Cloud integration",
212
+ "MLOps",
213
+ "Custom models",
214
+ ],
215
+ "models": ["gemini-1.5-pro", "gemini-1.5-flash", "text-bison"],
216
+ "api_key_url": "https://console.cloud.google.com/",
217
+ "api_key_prefix": "",
218
+ "setup_notes": "Requires Google Cloud project and service account credentials",
219
+ },
220
+ "bedrock": {
221
+ "name": "AWS Bedrock",
222
+ "description": "Amazon's managed AI service with multiple model providers",
223
+ "strengths": [
224
+ "AWS integration",
225
+ "Multiple models",
226
+ "Enterprise security",
227
+ "Serverless",
228
+ ],
229
+ "models": [
230
+ "arn:aws:bedrock:us-west-2::foundation-model/meta.llama4-maverick-17b-instruct-v1:0",
231
+ "arn:aws:bedrock:us-west-2::inference-profile/us.meta.llama4-maverick-17b-instruct-v1:0",
232
+ "anthropic.claude-3-sonnet-20240229-v1:0",
233
+ "anthropic.claude-3-haiku-20240307-v1:0",
234
+ "meta.llama3-1-8b-instruct-v1:0",
235
+ ],
236
+ "api_key_url": "https://console.aws.amazon.com/bedrock/home",
237
+ "api_key_prefix": "ABSKQmVkcm9ja0FQSUtleS1",
238
+ "setup_notes": "Get a 30-day API key from the AWS Bedrock Console. You can enter custom model IDs or ARNs during setup.",
239
+ },
240
+ "openrouter": {
241
+ "name": "OpenRouter",
242
+ "description": "Access to multiple AI models through a single API",
243
+ "strengths": [
244
+ "Model variety",
245
+ "Cost optimization",
246
+ "Unified API",
247
+ "Real-time switching",
248
+ ],
249
+ "models": [
250
+ "google/gemini-2.5-flash-preview-05-20",
251
+ "openai/gpt-4.1",
252
+ "openai/o3",
253
+ "openai/o4-mini",
254
+ "meta-llama/llama-4-maverick",
255
+ ],
256
+ "api_key_url": "https://openrouter.ai/keys",
257
+ "api_key_prefix": "sk-or-",
258
+ "setup_notes": "Get your API key from OpenRouter dashboard",
259
+ },
260
+ "claude-code": {
261
+ "name": "Claude Code (Local)",
262
+ "description": "Free local Claude integration for development",
263
+ "strengths": [
264
+ "Free usage",
265
+ "Local processing",
266
+ "Development focus",
267
+ "No API limits",
268
+ ],
269
+ "models": ["claude-code-opus", "claude-code-sonnet"],
270
+ "api_key_url": "",
271
+ "api_key_prefix": "",
272
+ "setup_notes": "No API key required - uses your existing Claude Code authentication",
273
+ },
274
+ }
275
+
276
+ async def start_wizard(self) -> bool:
277
+ """
278
+ Start the interactive setup process.
279
+
280
+ Returns:
281
+ True if setup completed successfully, False otherwise
282
+ """
283
+ try:
284
+ from .setup_wizard_provider_setup import SetupWizardProviderSetup
285
+ from .setup_wizard_ui import SetupWizardUI
286
+ from .setup_wizard_validation import SetupWizardValidation
287
+
288
+ # Create helper instances
289
+ ui = SetupWizardUI(self.console, self.provider_info)
290
+ provider_setup = SetupWizardProviderSetup(self.console, self.provider_info)
291
+ validation = SetupWizardValidation(
292
+ self.console,
293
+ self.provider_info,
294
+ self.provider_factory,
295
+ self.cancellation_handler,
296
+ self.signal_handler,
297
+ )
298
+
299
+ ui.show_welcome()
300
+
301
+ # Check if this is first run
302
+ if not self.config_manager.is_first_run():
303
+ if not self._confirm_overwrite():
304
+ return False
305
+
306
+ # Select provider
307
+ provider_name = provider_setup.select_provider()
308
+ if not provider_name:
309
+ return False
310
+
311
+ # Configure the selected provider
312
+ provider_config = await provider_setup.configure_provider(provider_name)
313
+ if not provider_config:
314
+ return False
315
+
316
+ # Test the configuration
317
+ if not await validation.test_configuration(provider_name, provider_config):
318
+ return False
319
+
320
+ # Save configuration
321
+ provider_setup.save_configuration(
322
+ provider_name, provider_config, self.config_manager
323
+ )
324
+
325
+ # Show completion message
326
+ ui.show_completion(provider_name)
327
+
328
+ return True
329
+
330
+ except KeyboardInterrupt:
331
+ self.console.print("\n[yellow]Setup cancelled by user[/yellow]")
332
+ return False
333
+ except Exception as e:
334
+ self.console.print(f"\n[red]Setup failed: {e}[/red]")
335
+ return False
336
+
337
+ def _confirm_overwrite(self) -> bool:
338
+ """
339
+ Confirm if user wants to add another provider to existing configuration.
340
+
341
+ Returns:
342
+ True if user confirms, False otherwise
343
+ """
344
+ self.console.print("[yellow]⚠️ Existing configuration detected[/yellow]")
345
+ return Confirm.ask("Do you want to continue and add another provider?")
346
+
347
+ def get_available_providers(self) -> List[str]:
348
+ """
349
+ Get list of available providers for setup.
350
+
351
+ Returns:
352
+ List of provider names
353
+ """
354
+ return list(self.provider_info.keys())
355
+
356
+ def get_provider_info(self, provider_name: str) -> Optional[Dict[str, Any]]:
357
+ """
358
+ Get information about a specific provider.
359
+
360
+ Args:
361
+ provider_name: Name of the provider
362
+
363
+ Returns:
364
+ Provider information dictionary or None if not found
365
+ """
366
+ return self.provider_info.get(provider_name)
367
+
368
+ def get_common_setup_issues(self, provider_name: str) -> List[Dict[str, str]]:
369
+ """
370
+ Get common setup issues and solutions for a provider.
371
+
372
+ Args:
373
+ provider_name: Name of the provider
374
+
375
+ Returns:
376
+ List of issue dictionaries with 'issue' and 'solution' keys
377
+ """
378
+ common_issues = {
379
+ "claude": [
380
+ {
381
+ "issue": "API key authentication fails",
382
+ "solution": "Ensure your API key starts with 'sk-ant-' and is from console.anthropic.com",
383
+ },
384
+ {
385
+ "issue": "Rate limit errors",
386
+ "solution": "Check your usage limits in the Anthropic Console and consider upgrading your plan",
387
+ },
388
+ {
389
+ "issue": "Model not found",
390
+ "solution": "Verify the model name matches exactly (e.g., 'claude-3-5-sonnet-20241022')",
391
+ },
392
+ ],
393
+ "openai": [
394
+ {
395
+ "issue": "API key authentication fails",
396
+ "solution": "Ensure your API key starts with 'sk-' and is from platform.openai.com",
397
+ },
398
+ {
399
+ "issue": "Insufficient quota",
400
+ "solution": "Add billing information to your OpenAI account or check usage limits",
401
+ },
402
+ {
403
+ "issue": "Model access denied",
404
+ "solution": "Some models require special access - check your account permissions",
405
+ },
406
+ ],
407
+ "gemini": [
408
+ {
409
+ "issue": "API key authentication fails",
410
+ "solution": "Ensure your API key starts with 'AIza' and is from Google AI Studio",
411
+ },
412
+ {
413
+ "issue": "Safety filter blocks",
414
+ "solution": "Adjust safety settings or rephrase your input to avoid triggering filters",
415
+ },
416
+ {
417
+ "issue": "Quota exceeded",
418
+ "solution": "Check your usage in Google AI Studio and consider upgrading limits",
419
+ },
420
+ ],
421
+ "ollama": [
422
+ {
423
+ "issue": "Connection refused",
424
+ "solution": "Start Ollama server with 'ollama serve' and ensure it's running on the correct port",
425
+ },
426
+ {
427
+ "issue": "Model not found",
428
+ "solution": "Install the model with 'ollama pull <model-name>' before using it",
429
+ },
430
+ {
431
+ "issue": "Slow responses",
432
+ "solution": "Ensure sufficient RAM and consider using smaller models for better performance",
433
+ },
434
+ ],
435
+ }
436
+
437
+ return common_issues.get(
438
+ provider_name,
439
+ [
440
+ {
441
+ "issue": "API authentication fails",
442
+ "solution": "Verify your API key is correct and your account has sufficient credits",
443
+ },
444
+ {
445
+ "issue": "Network connection issues",
446
+ "solution": "Check your internet connection and firewall settings",
447
+ },
448
+ ],
449
+ )