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,376 @@
1
+ """
2
+ Documentation generation methods for the setup wizard.
3
+
4
+ This module contains all methods for generating setup guides and
5
+ documentation for various providers.
6
+ """
7
+
8
+ from pathlib import Path
9
+ from typing import Any, Dict, List, Optional
10
+
11
+ from rich.console import Console
12
+
13
+
14
+ class SetupWizardGuideGenerator:
15
+ """Documentation generation methods for the setup wizard."""
16
+
17
+ def __init__(self, console: Console, provider_info: Dict[str, Dict[str, Any]]):
18
+ """
19
+ Initialize the guide generator component.
20
+
21
+ Args:
22
+ console: Rich console instance
23
+ provider_info: Dictionary of provider information
24
+ """
25
+ self.console = console
26
+ self.provider_info = provider_info
27
+
28
+ def create_setup_guide(
29
+ self, provider_name: str, output_path: Optional[str] = None
30
+ ) -> str:
31
+ """
32
+ Create a detailed setup guide for a specific provider.
33
+
34
+ Args:
35
+ provider_name: Name of the provider
36
+ output_path: Optional path to save the guide
37
+
38
+ Returns:
39
+ Setup guide content as markdown string
40
+ """
41
+ if provider_name not in self.provider_info:
42
+ raise ValueError(f"Unknown provider: {provider_name}")
43
+
44
+ info = self.provider_info[provider_name]
45
+
46
+ # Generate comprehensive setup guide
47
+ guide_content = f"""# {info['name']} Setup Guide
48
+
49
+ ## Overview
50
+
51
+ {info['description']}
52
+
53
+ ### Key Strengths
54
+ {chr(10).join(f"- {strength}" for strength in info['strengths'])}
55
+
56
+ ## Prerequisites
57
+
58
+ ### Account Setup
59
+ 1. Visit {info['api_key_url']}
60
+ 2. Create an account or sign in to your existing account
61
+ 3. Navigate to the API keys section
62
+ 4. Generate a new API key for Omnimancer
63
+
64
+ ### System Requirements
65
+ - Internet connection for API calls
66
+ - Omnimancer CLI installed and configured
67
+ - Sufficient account credits/quota for API usage
68
+
69
+ ## Step-by-Step Setup
70
+
71
+ ### 1. Get Your API Key
72
+
73
+ 1. **Visit the API Console**: Go to {info['api_key_url']}
74
+ 2. **Sign In**: Use your {info['name']} account credentials
75
+ 3. **Generate Key**: Create a new API key specifically for Omnimancer
76
+ 4. **Copy Key**: Save the API key securely (it should start with `{info['api_key_prefix']}`)
77
+
78
+ ### 2. Configure Omnimancer
79
+
80
+ #### Option A: Using Setup Wizard (Recommended)
81
+ ```bash
82
+ omnimancer --setup
83
+ ```
84
+ Then select "{info['name']}" from the provider list.
85
+
86
+ #### Option B: Manual Configuration
87
+ ```bash
88
+ omnimancer --config set-provider {provider_name} \\
89
+ --api-key "your-api-key-here" \\
90
+ --model "{info['models'][0]}"
91
+ ```
92
+
93
+ ### 3. Test Your Configuration
94
+
95
+ ```bash
96
+ omnimancer --test-provider {provider_name}
97
+ ```
98
+
99
+ ## Available Models
100
+
101
+ {self._generate_model_table(provider_name, info)}
102
+
103
+ ## Configuration Options
104
+
105
+ ### Basic Settings
106
+ - **API Key**: Your {info['name']} API key
107
+ - **Model**: Choose from available models above
108
+ - **Temperature**: Controls randomness (0.0-1.0, default: 0.7)
109
+ - **Max Tokens**: Maximum response length (default: 4096)
110
+
111
+ {self._generate_provider_specific_config(provider_name)}
112
+
113
+ ## Troubleshooting
114
+
115
+ {self._generate_troubleshooting_section(provider_name)}
116
+
117
+ ## Best Practices
118
+
119
+ {self._generate_best_practices(provider_name)}
120
+
121
+ ## Support and Resources
122
+
123
+ - **API Documentation**: {info['api_key_url']}
124
+ {self._generate_support_links(provider_name)}
125
+
126
+ ---
127
+
128
+ *Generated by Omnimancer Setup Wizard*
129
+ """
130
+
131
+ # Save to file if path provided
132
+ if output_path:
133
+ with open(output_path, "w") as f:
134
+ f.write(guide_content)
135
+
136
+ return guide_content
137
+
138
+ def _generate_model_table(self, provider_name: str, info: Dict[str, Any]) -> str:
139
+ """Generate markdown table of available models."""
140
+ models = info["models"]
141
+
142
+ # Model descriptions
143
+ descriptions = {
144
+ "claude-3-5-sonnet-20241022": "Latest Claude model with enhanced reasoning and coding capabilities",
145
+ "claude-3-haiku-20240307": "Fast, efficient model for quick responses",
146
+ "claude-3-opus-20240229": "Most capable Claude model for complex tasks",
147
+ "gpt-4o": "Latest GPT-4 with vision, tool use, and enhanced capabilities",
148
+ "gpt-4o-mini": "Efficient GPT-4 variant with good performance/cost ratio",
149
+ "gpt-4-turbo": "Enhanced GPT-4 with 128k context window",
150
+ "gpt-3.5-turbo": "Fast, cost-effective model for general use",
151
+ "gemini-1.5-pro": "Advanced Gemini with 2M token context window",
152
+ "gemini-1.5-flash": "Fast Gemini variant optimized for speed",
153
+ "gemini-1.0-pro": "Stable Gemini model for general use",
154
+ "sonar-pro": "Advanced search-enabled model with real-time information",
155
+ "sonar": "Standard search-enabled model",
156
+ "deep-research": "Specialized model for in-depth research tasks",
157
+ "grok-3": "Latest Grok model with enhanced reasoning",
158
+ "grok-3-fast": "Optimized Grok variant for faster responses",
159
+ "mistral-small-3.1": "Efficient model for general tasks",
160
+ "mistral-medium": "Balanced performance and capability",
161
+ "mistral-large": "Most capable Mistral model",
162
+ "command-r": "Cohere's reasoning-focused model",
163
+ "command-r-plus": "Enhanced version of Command-R",
164
+ "command-light": "Lightweight model for simple tasks",
165
+ "llama3.2": "Meta's latest open-source model",
166
+ "codellama": "Specialized for code generation and analysis",
167
+ "mistral": "General-purpose open-source model",
168
+ "phi3": "Microsoft's efficient small language model",
169
+ }
170
+
171
+ table = (
172
+ "| Model | Description | Best For |\n|-------|-------------|----------|\n"
173
+ )
174
+
175
+ for model in models:
176
+ description = descriptions.get(model, "High-quality AI model")
177
+ # Determine best use case based on model name
178
+ if (
179
+ "haiku" in model
180
+ or "flash" in model
181
+ or "mini" in model
182
+ or "light" in model
183
+ or "fast" in model
184
+ ):
185
+ best_for = "Quick responses, cost efficiency"
186
+ elif "opus" in model or "large" in model or "pro" in model:
187
+ best_for = "Complex tasks, detailed analysis"
188
+ elif "code" in model:
189
+ best_for = "Programming, code analysis"
190
+ elif "search" in model or "sonar" in model:
191
+ best_for = "Research, real-time information"
192
+ else:
193
+ best_for = "General purpose tasks"
194
+
195
+ table += f"| `{model}` | {description} | {best_for} |\n"
196
+
197
+ return table
198
+
199
+ def _generate_provider_specific_config(self, provider_name: str) -> str:
200
+ """Generate provider-specific configuration documentation."""
201
+ if provider_name == "claude":
202
+ return """
203
+ ### Claude-Specific Settings
204
+ - **API Version**: Uses Anthropic API version 2023-06-01
205
+ - **System Messages**: Supported through conversation context
206
+ - **Tool Calling**: Available on Claude 3 models
207
+ - **Vision**: Supported on Claude 3 models with image inputs
208
+ """
209
+ elif provider_name == "openai":
210
+ return """
211
+ ### OpenAI-Specific Settings
212
+ - **Organization**: Optional organization ID for team accounts
213
+ - **Project**: Optional project ID for organization management
214
+ - **Tool Calling**: Available on GPT-4 and GPT-3.5-turbo models
215
+ - **Vision**: Available on GPT-4V and GPT-4o models
216
+ - **Function Calling**: Legacy function calling support
217
+ """
218
+ elif provider_name == "gemini":
219
+ return """
220
+ ### Gemini-Specific Settings
221
+ - **Safety Settings**: Configure content filtering levels
222
+ - **Project ID**: Google Cloud project for billing
223
+ - **Location**: Geographic region for processing
224
+ - **Multimodal**: Native support for text, images, and other media
225
+ """
226
+ elif provider_name == "ollama":
227
+ return """
228
+ ### Ollama-Specific Settings
229
+ - **Base URL**: Ollama server endpoint (default: http://localhost:11434)
230
+ - **Timeout**: Request timeout for local inference
231
+ - **Model Management**: Use `ollama pull <model>` to install models
232
+ - **GPU Support**: Automatic GPU acceleration when available
233
+ """
234
+ elif provider_name == "perplexity":
235
+ return """
236
+ ### Perplexity-Specific Settings
237
+ - **Search Mode**: Enable real-time web search capabilities
238
+ - **Recency Filter**: Control how recent information should be
239
+ - **Citation Style**: Configure how sources are referenced
240
+ - **Pro Features**: Requires Perplexity Pro subscription
241
+ """
242
+ else:
243
+ return """
244
+ ### Provider-Specific Settings
245
+ - **Custom Headers**: Additional HTTP headers if required
246
+ - **Rate Limiting**: Built-in rate limit handling
247
+ - **Retry Logic**: Automatic retry on transient failures
248
+ - **Timeout**: Request timeout configuration
249
+ """
250
+
251
+ def _generate_troubleshooting_section(self, provider_name: str) -> str:
252
+ """Generate troubleshooting section for the provider."""
253
+ from .setup_wizard_core import SetupWizardCore
254
+
255
+ # Create a temporary instance just to access the common issues method
256
+ temp_core = SetupWizardCore(None, None)
257
+ common_issues = temp_core.get_common_setup_issues(provider_name)
258
+
259
+ section = "### Common Issues\n\n"
260
+
261
+ for i, issue in enumerate(common_issues, 1):
262
+ section += f"#### {i}. {issue['issue']}\n\n"
263
+ section += f"**Solution**: {issue['solution']}\n\n"
264
+
265
+ section += "### Getting Help\n\n"
266
+ section += "If you continue to experience issues:\n\n"
267
+ section += "1. Check the provider's status page for known outages\n"
268
+ section += "2. Verify your account has sufficient credits/quota\n"
269
+ section += "3. Test with a different model from the same provider\n"
270
+ section += "4. Check Omnimancer logs for detailed error messages\n"
271
+ section += "5. Contact the provider's support team if issues persist\n"
272
+
273
+ return section
274
+
275
+ def _generate_best_practices(self, provider_name: str) -> str:
276
+ """Generate best practices section for the provider."""
277
+ practices = [
278
+ "**Secure API Keys**: Never share or commit API keys to version control",
279
+ "**Monitor Usage**: Keep track of your API usage and costs",
280
+ "**Rate Limiting**: Respect provider rate limits to avoid throttling",
281
+ "**Error Handling**: Implement proper error handling in your applications",
282
+ "**Model Selection**: Choose the right model for your specific use case",
283
+ ]
284
+
285
+ if provider_name == "claude":
286
+ practices.extend(
287
+ [
288
+ "**Context Management**: Use system messages effectively for better responses",
289
+ "**Safety Guidelines**: Follow Anthropic's usage policies and safety guidelines",
290
+ ]
291
+ )
292
+ elif provider_name == "openai":
293
+ practices.extend(
294
+ [
295
+ "**Fine-tuning**: Consider fine-tuning for specialized use cases",
296
+ "**Prompt Engineering**: Invest time in crafting effective prompts",
297
+ ]
298
+ )
299
+ elif provider_name == "ollama":
300
+ practices.extend(
301
+ [
302
+ "**Resource Management**: Monitor CPU/GPU usage during inference",
303
+ "**Model Updates**: Regularly update models for improved performance",
304
+ ]
305
+ )
306
+
307
+ return "\n".join(f"- {practice}" for practice in practices)
308
+
309
+ def _generate_support_links(self, provider_name: str) -> str:
310
+ """Generate support links for the provider."""
311
+ links = []
312
+
313
+ if provider_name == "claude":
314
+ links = [
315
+ "- **Status Page**: https://status.anthropic.com/",
316
+ "- **Support**: https://support.anthropic.com/",
317
+ "- **Community**: https://discord.gg/anthropic",
318
+ ]
319
+ elif provider_name == "openai":
320
+ links = [
321
+ "- **Status Page**: https://status.openai.com/",
322
+ "- **Support**: https://help.openai.com/",
323
+ "- **Community**: https://community.openai.com/",
324
+ ]
325
+ elif provider_name == "gemini":
326
+ links = [
327
+ "- **Status Page**: https://status.cloud.google.com/",
328
+ "- **Support**: https://support.google.com/",
329
+ "- **Community**: https://developers.googleblog.com/",
330
+ ]
331
+ elif provider_name == "ollama":
332
+ links = [
333
+ "- **GitHub**: https://github.com/ollama/ollama",
334
+ "- **Documentation**: https://ollama.ai/docs",
335
+ "- **Discord**: https://discord.gg/ollama",
336
+ ]
337
+ else:
338
+ links = [
339
+ "- **Provider Documentation**: Check the official documentation",
340
+ "- **Community Forums**: Look for community support channels",
341
+ "- **GitHub Issues**: Report bugs or request features",
342
+ ]
343
+
344
+ return "\n".join(links)
345
+
346
+ def generate_all_setup_guides(self, output_dir: str) -> List[str]:
347
+ """
348
+ Generate setup guides for all supported providers.
349
+
350
+ Args:
351
+ output_dir: Directory to save the guides
352
+
353
+ Returns:
354
+ List of generated file paths
355
+ """
356
+ output_path = Path(output_dir)
357
+ output_path.mkdir(parents=True, exist_ok=True)
358
+
359
+ generated_files = []
360
+
361
+ for provider_name in self.provider_info.keys():
362
+ guide_filename = f"{provider_name}_setup_guide.md"
363
+ guide_path = output_path / guide_filename
364
+
365
+ try:
366
+ self.create_setup_guide(provider_name, str(guide_path))
367
+ generated_files.append(str(guide_path))
368
+ self.console.print(
369
+ f"[green]✅ Generated setup guide for {provider_name}: {guide_path}[/green]"
370
+ )
371
+ except Exception as e:
372
+ self.console.print(
373
+ f"[red]❌ Failed to generate guide for {provider_name}: {e}[/red]"
374
+ )
375
+
376
+ return generated_files