foundry-mcp 0.8.22__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.

Potentially problematic release.


This version of foundry-mcp might be problematic. Click here for more details.

Files changed (153) hide show
  1. foundry_mcp/__init__.py +13 -0
  2. foundry_mcp/cli/__init__.py +67 -0
  3. foundry_mcp/cli/__main__.py +9 -0
  4. foundry_mcp/cli/agent.py +96 -0
  5. foundry_mcp/cli/commands/__init__.py +37 -0
  6. foundry_mcp/cli/commands/cache.py +137 -0
  7. foundry_mcp/cli/commands/dashboard.py +148 -0
  8. foundry_mcp/cli/commands/dev.py +446 -0
  9. foundry_mcp/cli/commands/journal.py +377 -0
  10. foundry_mcp/cli/commands/lifecycle.py +274 -0
  11. foundry_mcp/cli/commands/modify.py +824 -0
  12. foundry_mcp/cli/commands/plan.py +640 -0
  13. foundry_mcp/cli/commands/pr.py +393 -0
  14. foundry_mcp/cli/commands/review.py +667 -0
  15. foundry_mcp/cli/commands/session.py +472 -0
  16. foundry_mcp/cli/commands/specs.py +686 -0
  17. foundry_mcp/cli/commands/tasks.py +807 -0
  18. foundry_mcp/cli/commands/testing.py +676 -0
  19. foundry_mcp/cli/commands/validate.py +982 -0
  20. foundry_mcp/cli/config.py +98 -0
  21. foundry_mcp/cli/context.py +298 -0
  22. foundry_mcp/cli/logging.py +212 -0
  23. foundry_mcp/cli/main.py +44 -0
  24. foundry_mcp/cli/output.py +122 -0
  25. foundry_mcp/cli/registry.py +110 -0
  26. foundry_mcp/cli/resilience.py +178 -0
  27. foundry_mcp/cli/transcript.py +217 -0
  28. foundry_mcp/config.py +1454 -0
  29. foundry_mcp/core/__init__.py +144 -0
  30. foundry_mcp/core/ai_consultation.py +1773 -0
  31. foundry_mcp/core/batch_operations.py +1202 -0
  32. foundry_mcp/core/cache.py +195 -0
  33. foundry_mcp/core/capabilities.py +446 -0
  34. foundry_mcp/core/concurrency.py +898 -0
  35. foundry_mcp/core/context.py +540 -0
  36. foundry_mcp/core/discovery.py +1603 -0
  37. foundry_mcp/core/error_collection.py +728 -0
  38. foundry_mcp/core/error_store.py +592 -0
  39. foundry_mcp/core/health.py +749 -0
  40. foundry_mcp/core/intake.py +933 -0
  41. foundry_mcp/core/journal.py +700 -0
  42. foundry_mcp/core/lifecycle.py +412 -0
  43. foundry_mcp/core/llm_config.py +1376 -0
  44. foundry_mcp/core/llm_patterns.py +510 -0
  45. foundry_mcp/core/llm_provider.py +1569 -0
  46. foundry_mcp/core/logging_config.py +374 -0
  47. foundry_mcp/core/metrics_persistence.py +584 -0
  48. foundry_mcp/core/metrics_registry.py +327 -0
  49. foundry_mcp/core/metrics_store.py +641 -0
  50. foundry_mcp/core/modifications.py +224 -0
  51. foundry_mcp/core/naming.py +146 -0
  52. foundry_mcp/core/observability.py +1216 -0
  53. foundry_mcp/core/otel.py +452 -0
  54. foundry_mcp/core/otel_stubs.py +264 -0
  55. foundry_mcp/core/pagination.py +255 -0
  56. foundry_mcp/core/progress.py +387 -0
  57. foundry_mcp/core/prometheus.py +564 -0
  58. foundry_mcp/core/prompts/__init__.py +464 -0
  59. foundry_mcp/core/prompts/fidelity_review.py +691 -0
  60. foundry_mcp/core/prompts/markdown_plan_review.py +515 -0
  61. foundry_mcp/core/prompts/plan_review.py +627 -0
  62. foundry_mcp/core/providers/__init__.py +237 -0
  63. foundry_mcp/core/providers/base.py +515 -0
  64. foundry_mcp/core/providers/claude.py +472 -0
  65. foundry_mcp/core/providers/codex.py +637 -0
  66. foundry_mcp/core/providers/cursor_agent.py +630 -0
  67. foundry_mcp/core/providers/detectors.py +515 -0
  68. foundry_mcp/core/providers/gemini.py +426 -0
  69. foundry_mcp/core/providers/opencode.py +718 -0
  70. foundry_mcp/core/providers/opencode_wrapper.js +308 -0
  71. foundry_mcp/core/providers/package-lock.json +24 -0
  72. foundry_mcp/core/providers/package.json +25 -0
  73. foundry_mcp/core/providers/registry.py +607 -0
  74. foundry_mcp/core/providers/test_provider.py +171 -0
  75. foundry_mcp/core/providers/validation.py +857 -0
  76. foundry_mcp/core/rate_limit.py +427 -0
  77. foundry_mcp/core/research/__init__.py +68 -0
  78. foundry_mcp/core/research/memory.py +528 -0
  79. foundry_mcp/core/research/models.py +1234 -0
  80. foundry_mcp/core/research/providers/__init__.py +40 -0
  81. foundry_mcp/core/research/providers/base.py +242 -0
  82. foundry_mcp/core/research/providers/google.py +507 -0
  83. foundry_mcp/core/research/providers/perplexity.py +442 -0
  84. foundry_mcp/core/research/providers/semantic_scholar.py +544 -0
  85. foundry_mcp/core/research/providers/tavily.py +383 -0
  86. foundry_mcp/core/research/workflows/__init__.py +25 -0
  87. foundry_mcp/core/research/workflows/base.py +298 -0
  88. foundry_mcp/core/research/workflows/chat.py +271 -0
  89. foundry_mcp/core/research/workflows/consensus.py +539 -0
  90. foundry_mcp/core/research/workflows/deep_research.py +4142 -0
  91. foundry_mcp/core/research/workflows/ideate.py +682 -0
  92. foundry_mcp/core/research/workflows/thinkdeep.py +405 -0
  93. foundry_mcp/core/resilience.py +600 -0
  94. foundry_mcp/core/responses.py +1624 -0
  95. foundry_mcp/core/review.py +366 -0
  96. foundry_mcp/core/security.py +438 -0
  97. foundry_mcp/core/spec.py +4119 -0
  98. foundry_mcp/core/task.py +2463 -0
  99. foundry_mcp/core/testing.py +839 -0
  100. foundry_mcp/core/validation.py +2357 -0
  101. foundry_mcp/dashboard/__init__.py +32 -0
  102. foundry_mcp/dashboard/app.py +119 -0
  103. foundry_mcp/dashboard/components/__init__.py +17 -0
  104. foundry_mcp/dashboard/components/cards.py +88 -0
  105. foundry_mcp/dashboard/components/charts.py +177 -0
  106. foundry_mcp/dashboard/components/filters.py +136 -0
  107. foundry_mcp/dashboard/components/tables.py +195 -0
  108. foundry_mcp/dashboard/data/__init__.py +11 -0
  109. foundry_mcp/dashboard/data/stores.py +433 -0
  110. foundry_mcp/dashboard/launcher.py +300 -0
  111. foundry_mcp/dashboard/views/__init__.py +12 -0
  112. foundry_mcp/dashboard/views/errors.py +217 -0
  113. foundry_mcp/dashboard/views/metrics.py +164 -0
  114. foundry_mcp/dashboard/views/overview.py +96 -0
  115. foundry_mcp/dashboard/views/providers.py +83 -0
  116. foundry_mcp/dashboard/views/sdd_workflow.py +255 -0
  117. foundry_mcp/dashboard/views/tool_usage.py +139 -0
  118. foundry_mcp/prompts/__init__.py +9 -0
  119. foundry_mcp/prompts/workflows.py +525 -0
  120. foundry_mcp/resources/__init__.py +9 -0
  121. foundry_mcp/resources/specs.py +591 -0
  122. foundry_mcp/schemas/__init__.py +38 -0
  123. foundry_mcp/schemas/intake-schema.json +89 -0
  124. foundry_mcp/schemas/sdd-spec-schema.json +414 -0
  125. foundry_mcp/server.py +150 -0
  126. foundry_mcp/tools/__init__.py +10 -0
  127. foundry_mcp/tools/unified/__init__.py +92 -0
  128. foundry_mcp/tools/unified/authoring.py +3620 -0
  129. foundry_mcp/tools/unified/context_helpers.py +98 -0
  130. foundry_mcp/tools/unified/documentation_helpers.py +268 -0
  131. foundry_mcp/tools/unified/environment.py +1341 -0
  132. foundry_mcp/tools/unified/error.py +479 -0
  133. foundry_mcp/tools/unified/health.py +225 -0
  134. foundry_mcp/tools/unified/journal.py +841 -0
  135. foundry_mcp/tools/unified/lifecycle.py +640 -0
  136. foundry_mcp/tools/unified/metrics.py +777 -0
  137. foundry_mcp/tools/unified/plan.py +876 -0
  138. foundry_mcp/tools/unified/pr.py +294 -0
  139. foundry_mcp/tools/unified/provider.py +589 -0
  140. foundry_mcp/tools/unified/research.py +1283 -0
  141. foundry_mcp/tools/unified/review.py +1042 -0
  142. foundry_mcp/tools/unified/review_helpers.py +314 -0
  143. foundry_mcp/tools/unified/router.py +102 -0
  144. foundry_mcp/tools/unified/server.py +565 -0
  145. foundry_mcp/tools/unified/spec.py +1283 -0
  146. foundry_mcp/tools/unified/task.py +3846 -0
  147. foundry_mcp/tools/unified/test.py +431 -0
  148. foundry_mcp/tools/unified/verification.py +520 -0
  149. foundry_mcp-0.8.22.dist-info/METADATA +344 -0
  150. foundry_mcp-0.8.22.dist-info/RECORD +153 -0
  151. foundry_mcp-0.8.22.dist-info/WHEEL +4 -0
  152. foundry_mcp-0.8.22.dist-info/entry_points.txt +3 -0
  153. foundry_mcp-0.8.22.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,237 @@
1
+ """
2
+ Provider abstractions for foundry-mcp.
3
+
4
+ This package provides pluggable LLM provider backends for CLI operations,
5
+ with support for capability negotiation, request/response normalization,
6
+ lifecycle hooks, availability detection, and registry management.
7
+
8
+ Example usage:
9
+ from foundry_mcp.core.providers import (
10
+ # Core types
11
+ ProviderCapability,
12
+ ProviderRequest,
13
+ ProviderResult,
14
+ ProviderContext,
15
+ ProviderHooks,
16
+ # Detection
17
+ detect_provider_availability,
18
+ get_provider_statuses,
19
+ # Registry
20
+ register_provider,
21
+ resolve_provider,
22
+ available_providers,
23
+ )
24
+
25
+ # Check provider availability
26
+ if detect_provider_availability("gemini"):
27
+ # Register and resolve a provider
28
+ hooks = ProviderHooks()
29
+ provider = resolve_provider("gemini", hooks=hooks)
30
+
31
+ # Check if provider supports streaming
32
+ if provider.supports(ProviderCapability.STREAMING):
33
+ request = ProviderRequest(prompt="Hello", stream=True)
34
+ result = provider.generate(request)
35
+ """
36
+
37
+ from foundry_mcp.core.providers.base import (
38
+ # Enums
39
+ ProviderCapability,
40
+ ProviderStatus,
41
+ # Request/Response dataclasses
42
+ ProviderRequest,
43
+ ProviderResult,
44
+ TokenUsage,
45
+ StreamChunk,
46
+ # Metadata dataclasses
47
+ ModelDescriptor,
48
+ ProviderMetadata,
49
+ # Hooks
50
+ ProviderHooks,
51
+ StreamChunkCallback,
52
+ BeforeExecuteHook,
53
+ AfterResultHook,
54
+ # Errors
55
+ ProviderError,
56
+ ProviderUnavailableError,
57
+ ProviderExecutionError,
58
+ ProviderTimeoutError,
59
+ ContextWindowError,
60
+ # ABC
61
+ ProviderContext,
62
+ )
63
+
64
+ from foundry_mcp.core.providers.detectors import (
65
+ ProviderDetector,
66
+ register_detector,
67
+ get_detector,
68
+ detect_provider_availability,
69
+ get_provider_statuses,
70
+ list_detectors,
71
+ reset_detectors,
72
+ )
73
+
74
+ from foundry_mcp.core.providers.registry import (
75
+ # Types
76
+ ProviderFactory,
77
+ ProviderRegistration,
78
+ AvailabilityCheck,
79
+ MetadataResolver,
80
+ LazyFactoryLoader,
81
+ DependencyResolver,
82
+ # Registration
83
+ register_provider,
84
+ register_lazy_provider,
85
+ # Resolution
86
+ available_providers,
87
+ check_provider_available,
88
+ resolve_provider,
89
+ get_provider_metadata,
90
+ describe_providers,
91
+ # Dependency Injection
92
+ set_dependency_resolver,
93
+ # Testing
94
+ reset_registry,
95
+ get_registration,
96
+ )
97
+
98
+ from foundry_mcp.core.providers.validation import (
99
+ # Validation
100
+ ValidationError,
101
+ strip_ansi,
102
+ ensure_utf8,
103
+ sanitize_prompt,
104
+ validate_request,
105
+ # Command allowlists
106
+ COMMON_SAFE_COMMANDS,
107
+ BLOCKED_COMMANDS,
108
+ is_command_allowed,
109
+ # Observability
110
+ ExecutionSpan,
111
+ create_execution_span,
112
+ log_span,
113
+ # Retry
114
+ RETRYABLE_STATUSES,
115
+ is_retryable,
116
+ is_retryable_error,
117
+ # Circuit breaker
118
+ CircuitState,
119
+ CircuitBreaker,
120
+ get_circuit_breaker,
121
+ reset_circuit_breakers,
122
+ # Rate limiting
123
+ RateLimiter,
124
+ get_rate_limiter,
125
+ reset_rate_limiters,
126
+ # Execution wrapper
127
+ with_validation_and_resilience,
128
+ # Context window detection
129
+ CONTEXT_WINDOW_ERROR_PATTERNS,
130
+ is_context_window_error,
131
+ extract_token_counts,
132
+ create_context_window_guidance,
133
+ )
134
+
135
+ # ---------------------------------------------------------------------------
136
+ # Import provider modules to trigger auto-registration with the registry.
137
+ # Each provider module calls register_provider() at import time.
138
+ # ---------------------------------------------------------------------------
139
+ from foundry_mcp.core.providers import gemini as _gemini_provider # noqa: F401
140
+ from foundry_mcp.core.providers import codex as _codex_provider # noqa: F401
141
+ from foundry_mcp.core.providers import cursor_agent as _cursor_agent_provider # noqa: F401
142
+ from foundry_mcp.core.providers import claude as _claude_provider # noqa: F401
143
+ from foundry_mcp.core.providers import opencode as _opencode_provider # noqa: F401
144
+ from foundry_mcp.core.providers import test_provider as _test_provider # noqa: F401
145
+
146
+ __all__ = [
147
+ # === Base Types (base.py) ===
148
+ # Enums
149
+ "ProviderCapability",
150
+ "ProviderStatus",
151
+ # Request/Response dataclasses
152
+ "ProviderRequest",
153
+ "ProviderResult",
154
+ "TokenUsage",
155
+ "StreamChunk",
156
+ # Metadata dataclasses
157
+ "ModelDescriptor",
158
+ "ProviderMetadata",
159
+ # Hooks
160
+ "ProviderHooks",
161
+ "StreamChunkCallback",
162
+ "BeforeExecuteHook",
163
+ "AfterResultHook",
164
+ # Errors
165
+ "ProviderError",
166
+ "ProviderUnavailableError",
167
+ "ProviderExecutionError",
168
+ "ProviderTimeoutError",
169
+ "ContextWindowError",
170
+ # ABC
171
+ "ProviderContext",
172
+ # === Detection (detectors.py) ===
173
+ "ProviderDetector",
174
+ "register_detector",
175
+ "get_detector",
176
+ "detect_provider_availability",
177
+ "get_provider_statuses",
178
+ "list_detectors",
179
+ "reset_detectors",
180
+ # === Registry (registry.py) ===
181
+ # Types
182
+ "ProviderFactory",
183
+ "ProviderRegistration",
184
+ "AvailabilityCheck",
185
+ "MetadataResolver",
186
+ "LazyFactoryLoader",
187
+ "DependencyResolver",
188
+ # Registration
189
+ "register_provider",
190
+ "register_lazy_provider",
191
+ # Resolution
192
+ "available_providers",
193
+ "check_provider_available",
194
+ "resolve_provider",
195
+ "get_provider_metadata",
196
+ "describe_providers",
197
+ # Dependency Injection
198
+ "set_dependency_resolver",
199
+ # Testing
200
+ "reset_registry",
201
+ "get_registration",
202
+ # === Validation & Resilience (validation.py) ===
203
+ # Validation
204
+ "ValidationError",
205
+ "strip_ansi",
206
+ "ensure_utf8",
207
+ "sanitize_prompt",
208
+ "validate_request",
209
+ # Command allowlists
210
+ "COMMON_SAFE_COMMANDS",
211
+ "BLOCKED_COMMANDS",
212
+ "is_command_allowed",
213
+ # Observability
214
+ "ExecutionSpan",
215
+ "create_execution_span",
216
+ "log_span",
217
+ # Retry
218
+ "RETRYABLE_STATUSES",
219
+ "is_retryable",
220
+ "is_retryable_error",
221
+ # Circuit breaker
222
+ "CircuitState",
223
+ "CircuitBreaker",
224
+ "get_circuit_breaker",
225
+ "reset_circuit_breakers",
226
+ # Rate limiting
227
+ "RateLimiter",
228
+ "get_rate_limiter",
229
+ "reset_rate_limiters",
230
+ # Execution wrapper
231
+ "with_validation_and_resilience",
232
+ # Context window detection
233
+ "CONTEXT_WINDOW_ERROR_PATTERNS",
234
+ "is_context_window_error",
235
+ "extract_token_counts",
236
+ "create_context_window_guidance",
237
+ ]