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,403 @@
1
+ """
2
+ Provider capability definitions for Omnimancer configuration optimization.
3
+
4
+ This module defines the inherent capabilities and default settings for each provider,
5
+ eliminating the need to store null values in configuration files.
6
+ """
7
+
8
+ from dataclasses import dataclass
9
+ from enum import Enum
10
+ from typing import Any, Dict, List, Optional
11
+
12
+
13
+ class ProviderType(str, Enum):
14
+ """Supported AI provider types."""
15
+
16
+ OPENAI = "openai"
17
+ CLAUDE = "claude"
18
+ CLAUDE_CODE = "claude-code"
19
+ GEMINI = "gemini"
20
+ COHERE = "cohere"
21
+ MISTRAL = "mistral"
22
+ OLLAMA = "ollama"
23
+ PERPLEXITY = "perplexity"
24
+ XAI = "xai"
25
+ AZURE = "azure"
26
+ VERTEX = "vertex"
27
+ BEDROCK = "bedrock"
28
+ OPENROUTER = "openrouter"
29
+
30
+
31
+ @dataclass
32
+ class ProviderCapabilities:
33
+ """Defines the capabilities and defaults for a provider."""
34
+
35
+ # Capabilities (what the provider supports)
36
+ supports_tools: bool = False
37
+ supports_multimodal: bool = False
38
+ supports_streaming: bool = True
39
+ supports_system_messages: bool = True
40
+ supports_function_calling: bool = False
41
+ supports_vision: bool = False
42
+ supports_json_mode: bool = False
43
+
44
+ # Default settings
45
+ default_max_tokens: Optional[int] = None
46
+ default_temperature: Optional[float] = 0.7
47
+ default_timeout: float = 30.0
48
+
49
+ # Retry and reliability defaults
50
+ max_retries: int = 3
51
+ retry_delay: float = 1.0
52
+ exponential_backoff: bool = True
53
+ health_check_enabled: bool = True
54
+ health_check_interval: int = 300
55
+ health_check_timeout: float = 10.0
56
+
57
+ # Security defaults
58
+ auth_type: str = "api_key"
59
+ requires_api_key: bool = True
60
+
61
+ # Provider-specific settings that are commonly used
62
+ common_settings: Dict[str, Any] = None
63
+
64
+ def __post_init__(self):
65
+ if self.common_settings is None:
66
+ self.common_settings = {}
67
+
68
+
69
+ # Provider capability definitions
70
+ PROVIDER_CAPABILITIES: Dict[ProviderType, ProviderCapabilities] = {
71
+ ProviderType.CLAUDE: ProviderCapabilities(
72
+ supports_tools=True,
73
+ supports_multimodal=True,
74
+ supports_streaming=True,
75
+ supports_system_messages=True,
76
+ supports_function_calling=True,
77
+ supports_vision=True,
78
+ supports_json_mode=True,
79
+ default_max_tokens=4096,
80
+ default_temperature=0.7,
81
+ common_settings={"anthropic_version": "2023-06-01"},
82
+ ),
83
+ ProviderType.CLAUDE_CODE: ProviderCapabilities(
84
+ supports_tools=True,
85
+ supports_multimodal=True,
86
+ supports_streaming=True,
87
+ supports_system_messages=True,
88
+ supports_function_calling=True,
89
+ supports_vision=True,
90
+ supports_json_mode=True,
91
+ default_max_tokens=8192,
92
+ default_temperature=0.3, # Lower for code
93
+ requires_api_key=False, # Local Claude Code
94
+ auth_type="local",
95
+ common_settings={"api_key": "local", "claude_code_mode": True},
96
+ ),
97
+ ProviderType.OPENAI: ProviderCapabilities(
98
+ supports_tools=True,
99
+ supports_multimodal=True,
100
+ supports_streaming=True,
101
+ supports_system_messages=True,
102
+ supports_function_calling=True,
103
+ supports_vision=True,
104
+ supports_json_mode=True,
105
+ default_max_tokens=4096,
106
+ default_temperature=0.7,
107
+ ),
108
+ ProviderType.GEMINI: ProviderCapabilities(
109
+ supports_tools=True,
110
+ supports_multimodal=True,
111
+ supports_streaming=True,
112
+ supports_system_messages=True,
113
+ supports_function_calling=True,
114
+ supports_vision=True,
115
+ supports_json_mode=True,
116
+ default_max_tokens=8192,
117
+ default_temperature=0.7,
118
+ common_settings={
119
+ "safety_settings": {
120
+ "HARM_CATEGORY_HARASSMENT": "BLOCK_NONE",
121
+ "HARM_CATEGORY_HATE_SPEECH": "BLOCK_NONE",
122
+ "HARM_CATEGORY_SEXUALLY_EXPLICIT": "BLOCK_NONE",
123
+ "HARM_CATEGORY_DANGEROUS_CONTENT": "BLOCK_NONE",
124
+ }
125
+ },
126
+ ),
127
+ ProviderType.COHERE: ProviderCapabilities(
128
+ supports_tools=True,
129
+ supports_multimodal=False,
130
+ supports_streaming=True,
131
+ supports_system_messages=True,
132
+ supports_function_calling=True,
133
+ supports_vision=False,
134
+ supports_json_mode=True,
135
+ default_max_tokens=4096,
136
+ default_temperature=0.7,
137
+ ),
138
+ ProviderType.MISTRAL: ProviderCapabilities(
139
+ supports_tools=True,
140
+ supports_multimodal=False,
141
+ supports_streaming=True,
142
+ supports_system_messages=True,
143
+ supports_function_calling=True,
144
+ supports_vision=False,
145
+ supports_json_mode=True,
146
+ default_max_tokens=4096,
147
+ default_temperature=0.7,
148
+ common_settings={"safe_prompt": False},
149
+ ),
150
+ ProviderType.OLLAMA: ProviderCapabilities(
151
+ supports_tools=False,
152
+ supports_multimodal=False,
153
+ supports_streaming=True,
154
+ supports_system_messages=True,
155
+ supports_function_calling=False,
156
+ supports_vision=False,
157
+ supports_json_mode=False,
158
+ default_max_tokens=2048,
159
+ default_temperature=0.7,
160
+ requires_api_key=False,
161
+ auth_type="none",
162
+ common_settings={
163
+ "base_url": "http://localhost:11434",
164
+ "num_ctx": 4096,
165
+ "repeat_penalty": 1.1,
166
+ },
167
+ ),
168
+ ProviderType.PERPLEXITY: ProviderCapabilities(
169
+ supports_tools=False,
170
+ supports_multimodal=False,
171
+ supports_streaming=True,
172
+ supports_system_messages=True,
173
+ supports_function_calling=False,
174
+ supports_vision=False,
175
+ supports_json_mode=False,
176
+ default_max_tokens=4096,
177
+ default_temperature=0.2, # Lower for research
178
+ common_settings={
179
+ "search_enabled": True,
180
+ "return_citations": True,
181
+ "search_recency_filter": "month",
182
+ },
183
+ ),
184
+ ProviderType.XAI: ProviderCapabilities(
185
+ supports_tools=True,
186
+ supports_multimodal=False,
187
+ supports_streaming=True,
188
+ supports_system_messages=True,
189
+ supports_function_calling=True,
190
+ supports_vision=False,
191
+ supports_json_mode=True,
192
+ default_max_tokens=4096,
193
+ default_temperature=0.7,
194
+ common_settings={
195
+ "grok_mode": "balanced",
196
+ "enable_web_search": True,
197
+ "enable_real_time": True,
198
+ },
199
+ ),
200
+ ProviderType.AZURE: ProviderCapabilities(
201
+ supports_tools=True,
202
+ supports_multimodal=True,
203
+ supports_streaming=True,
204
+ supports_system_messages=True,
205
+ supports_function_calling=True,
206
+ supports_vision=True,
207
+ supports_json_mode=True,
208
+ default_max_tokens=4096,
209
+ default_temperature=0.7,
210
+ common_settings={"api_version": "2024-02-15-preview"},
211
+ ),
212
+ ProviderType.VERTEX: ProviderCapabilities(
213
+ supports_tools=True,
214
+ supports_multimodal=True,
215
+ supports_streaming=True,
216
+ supports_system_messages=True,
217
+ supports_function_calling=True,
218
+ supports_vision=True,
219
+ supports_json_mode=True,
220
+ default_max_tokens=8192,
221
+ default_temperature=0.7,
222
+ common_settings={"vertex_location": "us-central1"},
223
+ ),
224
+ ProviderType.BEDROCK: ProviderCapabilities(
225
+ supports_tools=True,
226
+ supports_multimodal=True,
227
+ supports_streaming=True,
228
+ supports_system_messages=True,
229
+ supports_function_calling=True,
230
+ supports_vision=True,
231
+ supports_json_mode=True,
232
+ default_max_tokens=4096,
233
+ default_temperature=0.7,
234
+ common_settings={"aws_region": "us-east-1"},
235
+ ),
236
+ ProviderType.OPENROUTER: ProviderCapabilities(
237
+ supports_tools=False, # Depends on selected model
238
+ supports_multimodal=False, # Depends on selected model
239
+ supports_streaming=True,
240
+ supports_system_messages=True,
241
+ supports_function_calling=False, # Depends on selected model
242
+ supports_vision=False, # Depends on selected model
243
+ supports_json_mode=False, # Depends on selected model
244
+ default_max_tokens=4096,
245
+ default_temperature=0.7,
246
+ common_settings={"base_url": "https://openrouter.ai/api/v1"},
247
+ ),
248
+ }
249
+
250
+
251
+ def get_provider_capabilities(provider_type: str) -> ProviderCapabilities:
252
+ """
253
+ Get capabilities for a provider type.
254
+
255
+ Args:
256
+ provider_type: The provider type string
257
+
258
+ Returns:
259
+ ProviderCapabilities object with defaults and capabilities
260
+
261
+ Raises:
262
+ ValueError: If provider type is not supported
263
+ """
264
+ try:
265
+ provider_enum = ProviderType(provider_type.lower().replace("-", "_"))
266
+ return PROVIDER_CAPABILITIES[provider_enum]
267
+ except (ValueError, KeyError):
268
+ # Return basic capabilities for unknown providers
269
+ return ProviderCapabilities()
270
+
271
+
272
+ def get_provider_defaults(provider_type: str) -> Dict[str, Any]:
273
+ """
274
+ Get default configuration values for a provider.
275
+
276
+ Args:
277
+ provider_type: The provider type string
278
+
279
+ Returns:
280
+ Dictionary of default configuration values
281
+ """
282
+ capabilities = get_provider_capabilities(provider_type)
283
+
284
+ defaults = {
285
+ # Capabilities
286
+ "supports_tools": capabilities.supports_tools,
287
+ "supports_multimodal": capabilities.supports_multimodal,
288
+ "supports_streaming": capabilities.supports_streaming,
289
+ "supports_system_messages": capabilities.supports_system_messages,
290
+ "supports_function_calling": capabilities.supports_function_calling,
291
+ "supports_vision": capabilities.supports_vision,
292
+ "supports_json_mode": capabilities.supports_json_mode,
293
+ # Default settings
294
+ "max_tokens": capabilities.default_max_tokens,
295
+ "temperature": capabilities.default_temperature,
296
+ "timeout": capabilities.default_timeout,
297
+ # Reliability settings
298
+ "max_retries": capabilities.max_retries,
299
+ "retry_delay": capabilities.retry_delay,
300
+ "exponential_backoff": capabilities.exponential_backoff,
301
+ "health_check_enabled": capabilities.health_check_enabled,
302
+ "health_check_interval": capabilities.health_check_interval,
303
+ "health_check_timeout": capabilities.health_check_timeout,
304
+ # Security
305
+ "auth_type": capabilities.auth_type,
306
+ # Provider-specific defaults
307
+ **capabilities.common_settings,
308
+ }
309
+
310
+ return defaults
311
+
312
+
313
+ def merge_user_config_with_defaults(
314
+ provider_type: str, user_config: Dict[str, Any]
315
+ ) -> Dict[str, Any]:
316
+ """
317
+ Merge user configuration with provider defaults.
318
+
319
+ Args:
320
+ provider_type: The provider type string
321
+ user_config: User-provided configuration
322
+
323
+ Returns:
324
+ Complete configuration with defaults applied
325
+ """
326
+ defaults = get_provider_defaults(provider_type)
327
+
328
+ # Start with defaults
329
+ merged_config = defaults.copy()
330
+
331
+ # Override with user settings (only non-None values)
332
+ for key, value in user_config.items():
333
+ if value is not None:
334
+ merged_config[key] = value
335
+
336
+ return merged_config
337
+
338
+
339
+ def get_essential_config_fields() -> List[str]:
340
+ """
341
+ Get list of configuration fields that should be stored in config files.
342
+
343
+ Returns:
344
+ List of essential configuration field names
345
+ """
346
+ return [
347
+ # Required for all providers
348
+ "api_key",
349
+ "model",
350
+ # Common user preferences
351
+ "max_tokens",
352
+ "temperature",
353
+ "timeout",
354
+ "base_url",
355
+ # Provider-specific essentials
356
+ "organization", # OpenAI
357
+ "project_id", # Google
358
+ "azure_endpoint", # Azure
359
+ "azure_deployment", # Azure
360
+ "api_version", # Azure
361
+ "vertex_project", # Vertex
362
+ "vertex_location", # Vertex
363
+ "vertex_credentials_path", # Vertex
364
+ "aws_region", # Bedrock
365
+ "aws_access_key_id", # Bedrock
366
+ "aws_secret_access_key", # Bedrock
367
+ "service_account_path", # Vertex/Google
368
+ # Feature toggles that users might want to change
369
+ "search_enabled", # Perplexity
370
+ "grok_mode", # XAI
371
+ "safe_prompt", # Mistral
372
+ # System settings
373
+ "enabled",
374
+ "priority",
375
+ ]
376
+
377
+
378
+ def should_store_in_config(field_name: str, value: Any, provider_type: str) -> bool:
379
+ """
380
+ Determine if a configuration field should be stored in the config file.
381
+
382
+ Args:
383
+ field_name: Name of the configuration field
384
+ value: Value of the field
385
+ provider_type: Provider type
386
+
387
+ Returns:
388
+ True if the field should be stored, False otherwise
389
+ """
390
+ # Always store essential fields if they have values
391
+ if field_name in get_essential_config_fields() and value is not None:
392
+ return True
393
+
394
+ # Don't store None values
395
+ if value is None:
396
+ return False
397
+
398
+ # Don't store default values
399
+ defaults = get_provider_defaults(provider_type)
400
+ if field_name in defaults and defaults[field_name] == value:
401
+ return False
402
+
403
+ return True