mcp-image 0.1.0 → 0.2.0

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 (178) hide show
  1. package/README.md +41 -17
  2. package/dist/api/geminiClient.d.ts +2 -12
  3. package/dist/api/geminiClient.d.ts.map +1 -1
  4. package/dist/api/geminiClient.js +28 -56
  5. package/dist/api/geminiClient.js.map +1 -1
  6. package/dist/api/geminiTextClient.d.ts +42 -0
  7. package/dist/api/geminiTextClient.d.ts.map +1 -0
  8. package/dist/api/geminiTextClient.js +198 -0
  9. package/dist/api/geminiTextClient.js.map +1 -0
  10. package/dist/business/__tests__/mocks/mcpSamplingClient.mock.d.ts +84 -0
  11. package/dist/business/__tests__/mocks/mcpSamplingClient.mock.d.ts.map +1 -0
  12. package/dist/business/__tests__/mocks/mcpSamplingClient.mock.js +100 -0
  13. package/dist/business/__tests__/mocks/mcpSamplingClient.mock.js.map +1 -0
  14. package/dist/business/bestPracticesEngine.d.ts +149 -0
  15. package/dist/business/bestPracticesEngine.d.ts.map +1 -0
  16. package/dist/business/bestPracticesEngine.js +781 -0
  17. package/dist/business/bestPracticesEngine.js.map +1 -0
  18. package/dist/business/complexityAssessment.d.ts +132 -0
  19. package/dist/business/complexityAssessment.d.ts.map +1 -0
  20. package/dist/business/complexityAssessment.js +488 -0
  21. package/dist/business/complexityAssessment.js.map +1 -0
  22. package/dist/business/fallbackStrategies.d.ts +177 -0
  23. package/dist/business/fallbackStrategies.d.ts.map +1 -0
  24. package/dist/business/fallbackStrategies.js +368 -0
  25. package/dist/business/fallbackStrategies.js.map +1 -0
  26. package/dist/business/imageGenerator.d.ts.map +1 -1
  27. package/dist/business/imageGenerator.js +26 -5
  28. package/dist/business/imageGenerator.js.map +1 -1
  29. package/dist/business/multiImage/aspectRatioController.d.ts +77 -0
  30. package/dist/business/multiImage/aspectRatioController.d.ts.map +1 -0
  31. package/dist/business/multiImage/aspectRatioController.js +580 -0
  32. package/dist/business/multiImage/aspectRatioController.js.map +1 -0
  33. package/dist/business/multiImage/multiImageCoordinator.d.ts +142 -0
  34. package/dist/business/multiImage/multiImageCoordinator.d.ts.map +1 -0
  35. package/dist/business/multiImage/multiImageCoordinator.js +801 -0
  36. package/dist/business/multiImage/multiImageCoordinator.js.map +1 -0
  37. package/dist/business/pomlTemplateEngine.d.ts +206 -0
  38. package/dist/business/pomlTemplateEngine.d.ts.map +1 -0
  39. package/dist/business/pomlTemplateEngine.js +737 -0
  40. package/dist/business/pomlTemplateEngine.js.map +1 -0
  41. package/dist/business/promptOrchestrator.d.ts +173 -0
  42. package/dist/business/promptOrchestrator.d.ts.map +1 -0
  43. package/dist/business/promptOrchestrator.js +490 -0
  44. package/dist/business/promptOrchestrator.js.map +1 -0
  45. package/dist/business/responseBuilder.d.ts +2 -2
  46. package/dist/business/responseBuilder.d.ts.map +1 -1
  47. package/dist/business/responseBuilder.js +6 -1
  48. package/dist/business/responseBuilder.js.map +1 -1
  49. package/dist/business/structuredPromptGenerator.d.ts +54 -0
  50. package/dist/business/structuredPromptGenerator.d.ts.map +1 -0
  51. package/dist/business/structuredPromptGenerator.js +208 -0
  52. package/dist/business/structuredPromptGenerator.js.map +1 -0
  53. package/dist/business/templateNormalizer.d.ts +81 -0
  54. package/dist/business/templateNormalizer.d.ts.map +1 -0
  55. package/dist/business/templateNormalizer.js +659 -0
  56. package/dist/business/templateNormalizer.js.map +1 -0
  57. package/dist/documentation/apiContractValidation.d.ts +62 -0
  58. package/dist/documentation/apiContractValidation.d.ts.map +1 -0
  59. package/dist/documentation/apiContractValidation.js +305 -0
  60. package/dist/documentation/apiContractValidation.js.map +1 -0
  61. package/dist/infrastructure/concurrency/concurrencyManager.d.ts +101 -0
  62. package/dist/infrastructure/concurrency/concurrencyManager.d.ts.map +1 -0
  63. package/dist/infrastructure/concurrency/concurrencyManager.js +345 -0
  64. package/dist/infrastructure/concurrency/concurrencyManager.js.map +1 -0
  65. package/dist/infrastructure/config/secureConfigManager.d.ts +319 -0
  66. package/dist/infrastructure/config/secureConfigManager.d.ts.map +1 -0
  67. package/dist/infrastructure/config/secureConfigManager.js +600 -0
  68. package/dist/infrastructure/config/secureConfigManager.js.map +1 -0
  69. package/dist/infrastructure/errorHandling/orchestrationErrorHandler.d.ts +229 -0
  70. package/dist/infrastructure/errorHandling/orchestrationErrorHandler.d.ts.map +1 -0
  71. package/dist/infrastructure/errorHandling/orchestrationErrorHandler.js +61 -0
  72. package/dist/infrastructure/errorHandling/orchestrationErrorHandler.js.map +1 -0
  73. package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.d.ts +133 -0
  74. package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.d.ts.map +1 -0
  75. package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.js +569 -0
  76. package/dist/infrastructure/errorHandling/orchestrationErrorHandlerImpl.js.map +1 -0
  77. package/dist/infrastructure/mcp/MCPSamplingClient.d.ts +19 -0
  78. package/dist/infrastructure/mcp/MCPSamplingClient.d.ts.map +1 -0
  79. package/dist/infrastructure/mcp/MCPSamplingClient.js +31 -0
  80. package/dist/infrastructure/mcp/MCPSamplingClient.js.map +1 -0
  81. package/dist/infrastructure/mcp/RealMCPSamplingClient.d.ts +59 -0
  82. package/dist/infrastructure/mcp/RealMCPSamplingClient.d.ts.map +1 -0
  83. package/dist/infrastructure/mcp/RealMCPSamplingClient.js +271 -0
  84. package/dist/infrastructure/mcp/RealMCPSamplingClient.js.map +1 -0
  85. package/dist/infrastructure/metadata/generationMetadata.d.ts +72 -0
  86. package/dist/infrastructure/metadata/generationMetadata.d.ts.map +1 -0
  87. package/dist/infrastructure/metadata/generationMetadata.js +228 -0
  88. package/dist/infrastructure/metadata/generationMetadata.js.map +1 -0
  89. package/dist/infrastructure/monitoring/OrchestrationMetrics.d.ts +106 -0
  90. package/dist/infrastructure/monitoring/OrchestrationMetrics.d.ts.map +1 -0
  91. package/dist/infrastructure/monitoring/OrchestrationMetrics.js +456 -0
  92. package/dist/infrastructure/monitoring/OrchestrationMetrics.js.map +1 -0
  93. package/dist/infrastructure/monitoring/alertingSystem.d.ts +135 -0
  94. package/dist/infrastructure/monitoring/alertingSystem.d.ts.map +1 -0
  95. package/dist/infrastructure/monitoring/alertingSystem.js +549 -0
  96. package/dist/infrastructure/monitoring/alertingSystem.js.map +1 -0
  97. package/dist/infrastructure/optimization/performanceOptimizer.d.ts +89 -0
  98. package/dist/infrastructure/optimization/performanceOptimizer.d.ts.map +1 -0
  99. package/dist/infrastructure/optimization/performanceOptimizer.js +375 -0
  100. package/dist/infrastructure/optimization/performanceOptimizer.js.map +1 -0
  101. package/dist/infrastructure/security/AdvancedContentFilter.d.ts +99 -0
  102. package/dist/infrastructure/security/AdvancedContentFilter.d.ts.map +1 -0
  103. package/dist/infrastructure/security/AdvancedContentFilter.js +363 -0
  104. package/dist/infrastructure/security/AdvancedContentFilter.js.map +1 -0
  105. package/dist/infrastructure/security/MCPSecurityValidator.d.ts +62 -0
  106. package/dist/infrastructure/security/MCPSecurityValidator.d.ts.map +1 -0
  107. package/dist/infrastructure/security/MCPSecurityValidator.js +129 -0
  108. package/dist/infrastructure/security/MCPSecurityValidator.js.map +1 -0
  109. package/dist/infrastructure/security/OrchestrationSecurityMiddleware.d.ts +304 -0
  110. package/dist/infrastructure/security/OrchestrationSecurityMiddleware.d.ts.map +1 -0
  111. package/dist/infrastructure/security/OrchestrationSecurityMiddleware.js +61 -0
  112. package/dist/infrastructure/security/OrchestrationSecurityMiddleware.js.map +1 -0
  113. package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.d.ts +62 -0
  114. package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.d.ts.map +1 -0
  115. package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.js +591 -0
  116. package/dist/infrastructure/security/OrchestrationSecurityMiddlewareImpl.js.map +1 -0
  117. package/dist/infrastructure/security/SecureMCPClient.d.ts +154 -0
  118. package/dist/infrastructure/security/SecureMCPClient.d.ts.map +1 -0
  119. package/dist/infrastructure/security/SecureMCPClient.js +292 -0
  120. package/dist/infrastructure/security/SecureMCPClient.js.map +1 -0
  121. package/dist/infrastructure/security/SecurityIncidentManager.d.ts +142 -0
  122. package/dist/infrastructure/security/SecurityIncidentManager.d.ts.map +1 -0
  123. package/dist/infrastructure/security/SecurityIncidentManager.js +260 -0
  124. package/dist/infrastructure/security/SecurityIncidentManager.js.map +1 -0
  125. package/dist/infrastructure/security/apiKeyManager.d.ts +297 -0
  126. package/dist/infrastructure/security/apiKeyManager.d.ts.map +1 -0
  127. package/dist/infrastructure/security/apiKeyManager.js +254 -0
  128. package/dist/infrastructure/security/apiKeyManager.js.map +1 -0
  129. package/dist/infrastructure/security/dataSanitizer.d.ts +157 -0
  130. package/dist/infrastructure/security/dataSanitizer.d.ts.map +1 -0
  131. package/dist/infrastructure/security/dataSanitizer.js +525 -0
  132. package/dist/infrastructure/security/dataSanitizer.js.map +1 -0
  133. package/dist/infrastructure/validation/inputValidator.d.ts +54 -0
  134. package/dist/infrastructure/validation/inputValidator.d.ts.map +1 -0
  135. package/dist/infrastructure/validation/inputValidator.js +362 -0
  136. package/dist/infrastructure/validation/inputValidator.js.map +1 -0
  137. package/dist/integration/parameterOptimizer.d.ts +69 -0
  138. package/dist/integration/parameterOptimizer.d.ts.map +1 -0
  139. package/dist/integration/parameterOptimizer.js +317 -0
  140. package/dist/integration/parameterOptimizer.js.map +1 -0
  141. package/dist/integration/twoStageProcessor.d.ts +66 -0
  142. package/dist/integration/twoStageProcessor.d.ts.map +1 -0
  143. package/dist/integration/twoStageProcessor.js +348 -0
  144. package/dist/integration/twoStageProcessor.js.map +1 -0
  145. package/dist/server/handlers/structuredPromptHandler.d.ts +65 -0
  146. package/dist/server/handlers/structuredPromptHandler.d.ts.map +1 -0
  147. package/dist/server/handlers/structuredPromptHandler.js +314 -0
  148. package/dist/server/handlers/structuredPromptHandler.js.map +1 -0
  149. package/dist/server/mcpServer.d.ts +16 -35
  150. package/dist/server/mcpServer.d.ts.map +1 -1
  151. package/dist/server/mcpServer.js +111 -150
  152. package/dist/server/mcpServer.js.map +1 -1
  153. package/dist/server/mcpServerWithOrchestration.d.ts +98 -0
  154. package/dist/server/mcpServerWithOrchestration.d.ts.map +1 -0
  155. package/dist/server/mcpServerWithOrchestration.js +284 -0
  156. package/dist/server/mcpServerWithOrchestration.js.map +1 -0
  157. package/dist/types/mcpOrchestrationTypes.d.ts +135 -0
  158. package/dist/types/mcpOrchestrationTypes.d.ts.map +1 -0
  159. package/dist/types/mcpOrchestrationTypes.js +28 -0
  160. package/dist/types/mcpOrchestrationTypes.js.map +1 -0
  161. package/dist/types/multiImageTypes.d.ts +328 -0
  162. package/dist/types/multiImageTypes.d.ts.map +1 -0
  163. package/dist/types/multiImageTypes.js +27 -0
  164. package/dist/types/multiImageTypes.js.map +1 -0
  165. package/dist/types/performanceTypes.d.ts +300 -0
  166. package/dist/types/performanceTypes.d.ts.map +1 -0
  167. package/dist/types/performanceTypes.js +50 -0
  168. package/dist/types/performanceTypes.js.map +1 -0
  169. package/dist/types/twoStageTypes.d.ts +123 -0
  170. package/dist/types/twoStageTypes.d.ts.map +1 -0
  171. package/dist/types/twoStageTypes.js +7 -0
  172. package/dist/types/twoStageTypes.js.map +1 -0
  173. package/dist/utils/config.d.ts +1 -0
  174. package/dist/utils/config.d.ts.map +1 -1
  175. package/dist/utils/config.js +1 -0
  176. package/dist/utils/config.js.map +1 -1
  177. package/package.json +11 -4
  178. package/vitest.config.mjs +0 -47
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /**
3
+ * Mock implementation of MCP Sampling Client for testing
4
+ * Provides predictable responses for testing the orchestrator
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MockMCPSamplingClient = void 0;
8
+ exports.createMockMCPSamplingClient = createMockMCPSamplingClient;
9
+ /**
10
+ * Mock implementation of MCPSamplingClient for testing purposes
11
+ * Provides predictable behavior for orchestrator testing
12
+ */
13
+ class MockMCPSamplingClient {
14
+ constructor(_config) {
15
+ this.config = {
16
+ timeout: 5000,
17
+ maxAttempts: 3,
18
+ enableLogging: false,
19
+ ..._config,
20
+ };
21
+ this.mockDelay = 100; // Fast response for testing
22
+ this.shouldFail = false;
23
+ }
24
+ /**
25
+ * Set whether the mock should simulate failures
26
+ */
27
+ setShouldFail(shouldFail) {
28
+ this.shouldFail = shouldFail;
29
+ }
30
+ /**
31
+ * Set mock response delay for testing timing scenarios
32
+ */
33
+ setMockDelay(delay) {
34
+ this.mockDelay = delay;
35
+ }
36
+ /**
37
+ * Mock implementation of prompt refinement
38
+ * Returns predictable enhanced prompts for testing
39
+ */
40
+ async refinePrompt(prompt) {
41
+ // Simulate processing time
42
+ await new Promise((resolve) => setTimeout(resolve, this.mockDelay));
43
+ if (this.config.enableLogging) {
44
+ console.debug(`Mock MCP Sampling processing: ${prompt.substring(0, 50)}...`);
45
+ }
46
+ // Simulate security validation - reject sensitive information
47
+ const sensitivePatterns = /\b(api[_\s-]?key|secret|token|password|bearer|sk-\w+)\b/i;
48
+ if (sensitivePatterns.test(prompt)) {
49
+ return {
50
+ refinedPrompt: prompt, // Return original without enhancement
51
+ success: false,
52
+ processingTime: this.mockDelay,
53
+ metadata: {
54
+ model: 'mock-model-v1',
55
+ iterations: 0,
56
+ confidence: 0,
57
+ },
58
+ };
59
+ }
60
+ if (this.shouldFail) {
61
+ return {
62
+ refinedPrompt: prompt,
63
+ success: false,
64
+ processingTime: this.mockDelay,
65
+ metadata: {
66
+ model: 'mock-model-v1',
67
+ iterations: 0,
68
+ confidence: 0,
69
+ },
70
+ };
71
+ }
72
+ // Simulate advanced prompt refinement
73
+ const refinedPrompt = `${prompt}, highly detailed professional rendering with advanced lighting techniques, photorealistic quality, enhanced composition`;
74
+ return {
75
+ refinedPrompt,
76
+ success: true,
77
+ processingTime: this.mockDelay,
78
+ metadata: {
79
+ model: 'mock-model-v1',
80
+ iterations: 3,
81
+ confidence: 0.9,
82
+ },
83
+ };
84
+ }
85
+ /**
86
+ * Mock availability check - always returns true unless configured to fail
87
+ */
88
+ async isAvailable() {
89
+ await new Promise((resolve) => setTimeout(resolve, 10));
90
+ return !this.shouldFail;
91
+ }
92
+ }
93
+ exports.MockMCPSamplingClient = MockMCPSamplingClient;
94
+ /**
95
+ * Factory function to create a mock MCP Sampling Client with default configuration
96
+ */
97
+ function createMockMCPSamplingClient(config) {
98
+ return new MockMCPSamplingClient(config);
99
+ }
100
+ //# sourceMappingURL=mcpSamplingClient.mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpSamplingClient.mock.js","sourceRoot":"","sources":["../../../../src/business/__tests__/mocks/mcpSamplingClient.mock.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2JH,kEAIC;AAzGD;;;GAGG;AACH,MAAa,qBAAqB;IAKhC,YAAY,OAAoC;QAC9C,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,CAAC;YACd,aAAa,EAAE,KAAK;YACpB,GAAG,OAAO;SACX,CAAA;QACD,IAAI,CAAC,SAAS,GAAG,GAAG,CAAA,CAAC,4BAA4B;QACjD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,UAAmB;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,KAAa;QACxB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;IACxB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,2BAA2B;QAC3B,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;QAEnE,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YAC9B,OAAO,CAAC,KAAK,CAAC,iCAAiC,MAAM,CA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AI,qBAAqB,CAAC,MAAM,CAAC,CAAA;AAC1C,CAAC"}
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Best Practices Engine for prompt optimization using 7 research-based strategies
3
+ * Implements hyper-specific conversion, semantic transformation, and structured enhancement
4
+ * for image generation prompts to improve output quality and consistency
5
+ */
6
+ import type { GeminiTextClient } from '../api/geminiTextClient';
7
+ import type { Result } from '../types/result';
8
+ /**
9
+ * Configuration options for best practices application
10
+ */
11
+ export interface BestPracticesOptions {
12
+ enabledPractices?: BestPracticeType[];
13
+ aspectRatio?: AspectRatio;
14
+ targetStyle?: string;
15
+ contextIntent?: string;
16
+ maintainCharacterConsistency?: boolean;
17
+ blendImages?: boolean;
18
+ useWorldKnowledge?: boolean;
19
+ }
20
+ /**
21
+ * Configuration for the Best Practices Engine
22
+ */
23
+ export interface BestPracticesConfig {
24
+ timeout: number;
25
+ enableAllPractices: boolean;
26
+ performanceTarget: number;
27
+ }
28
+ /**
29
+ * Types of best practices available for prompt enhancement
30
+ */
31
+ export type BestPracticeType = 'hyper-specific' | 'character-consistency' | 'multi-image-coordination' | 'iterative-refinement' | 'semantic-enhancement' | 'aspect-ratio-optimization' | 'camera-control-terminology';
32
+ /**
33
+ * Supported aspect ratios for image generation
34
+ */
35
+ export type AspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4';
36
+ /**
37
+ * Individual best practice item with application details
38
+ */
39
+ export interface BestPracticeItem {
40
+ type: BestPracticeType;
41
+ applied: boolean;
42
+ enhancement: string;
43
+ metadata: {
44
+ processingTime: number;
45
+ confidence: number;
46
+ };
47
+ }
48
+ /**
49
+ * Analysis of which best practices are already present in a prompt
50
+ */
51
+ export interface BestPracticeAnalysis {
52
+ existingPractices: BestPracticeType[];
53
+ missingPractices: BestPracticeType[];
54
+ overallScore: number;
55
+ recommendations: string[];
56
+ }
57
+ /**
58
+ * Enhanced prompt with applied best practices and metadata
59
+ */
60
+ export interface EnhancedPrompt {
61
+ originalPrompt: string;
62
+ enhancedPrompt: string;
63
+ appliedPractices: BestPracticeItem[];
64
+ transformationMeta: TransformationMetadata;
65
+ }
66
+ /**
67
+ * Metadata about the transformation process
68
+ */
69
+ export interface TransformationMetadata {
70
+ totalProcessingTime: number;
71
+ practicesAnalyzed: number;
72
+ practicesApplied: number;
73
+ qualityScore: number;
74
+ timestamp: Date;
75
+ }
76
+ /**
77
+ * Strategy for applying individual best practices
78
+ */
79
+ export interface TransformationStrategy {
80
+ analyze(prompt: string): Promise<boolean>;
81
+ apply(prompt: string, options?: BestPracticesOptions): Promise<string>;
82
+ getMetadata(): {
83
+ confidence: number;
84
+ processingTime: number;
85
+ };
86
+ }
87
+ /**
88
+ * Interface for the Best Practices Engine
89
+ */
90
+ export interface BestPracticesEngine {
91
+ /**
92
+ * Apply best practices to optimize a prompt for image generation
93
+ * @param prompt The original prompt to enhance
94
+ * @param options Optional configuration for practice application
95
+ * @returns Result containing enhanced prompt or error
96
+ */
97
+ applyBestPractices(prompt: string, options?: BestPracticesOptions): Promise<Result<EnhancedPrompt, Error>>;
98
+ /**
99
+ * Analyze which best practices are already present in a prompt
100
+ * @param prompt The prompt to analyze
101
+ * @returns Analysis of current practice compliance
102
+ */
103
+ analyzePracticeCompliance(prompt: string): Promise<BestPracticeAnalysis>;
104
+ /**
105
+ * Get list of available best practices and their status
106
+ * @returns Array of best practice items
107
+ */
108
+ getAppliedPractices(): BestPracticeItem[];
109
+ }
110
+ /**
111
+ * Error for best practices engine operations
112
+ */
113
+ export declare class BestPracticesError extends Error {
114
+ readonly code: string;
115
+ readonly details?: unknown | undefined;
116
+ constructor(message: string, code: string, details?: unknown | undefined);
117
+ }
118
+ /**
119
+ * Factory function to create BestPracticesEngine instance
120
+ * @param config Optional configuration
121
+ * @returns BestPracticesEngine instance
122
+ */
123
+ export declare function createBestPracticesEngine(config?: Partial<BestPracticesConfig>, geminiTextClient?: GeminiTextClient): BestPracticesEngine;
124
+ /**
125
+ * Implementation of the Best Practices Engine
126
+ */
127
+ export declare class BestPracticesEngineImpl implements BestPracticesEngine {
128
+ private readonly strategies;
129
+ private readonly config;
130
+ private appliedPractices;
131
+ private geminiTextClient;
132
+ constructor(config?: Partial<BestPracticesConfig>, geminiTextClient?: GeminiTextClient);
133
+ applyBestPractices(prompt: string, options?: BestPracticesOptions): Promise<Result<EnhancedPrompt, Error>>;
134
+ analyzePracticeCompliance(prompt: string): Promise<BestPracticeAnalysis>;
135
+ getAppliedPractices(): BestPracticeItem[];
136
+ private initializeStrategies;
137
+ private getEnhancementDescription;
138
+ private calculateQualityScore;
139
+ private generateRecommendations;
140
+ /**
141
+ * Build AI enhancement prompt for Gemini 2.0 Flash
142
+ */
143
+ private buildAIEnhancementPrompt;
144
+ /**
145
+ * Apply feature parameters as structured prompt instructions
146
+ */
147
+ private applyFeatureParameters;
148
+ }
149
+ //# sourceMappingURL=bestPracticesEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bestPracticesEngine.d.ts","sourceRoot":"","sources":["../../src/business/bestPracticesEngine.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAG7C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAA;IACrC,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,kBAAkB,EAAE,OAAO,CAAA;IAC3B,iBAAiB,EAAE,MAAM,CAAA;CAC1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