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 @@
1
+ {"version":3,"file":"bestPracticesEngine.js","sourceRoot":"","sources":["../../src/business/bestPracticesEngine.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA4JH,8DAKC;AA7JD,4CAAyC;AA4HzC;;GAEG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAC3C,YACE,OAAe,EACC,IAAY,EACZ,OAAiB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAA;QAHE,SAAI,GAAJ,I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C,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;YAC5E,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QACpC,CAAC;QAED,QAAQ,IAAI,kEAAkE,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;QAE5G,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC,CAAA,CAAC,qBAAqB;QAC/E,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;QAEtB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,WAAW;QACT,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAA;IAC7E,CAAC;CACF"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Complexity Assessment System for Prompt Orchestration
3
+ *
4
+ * This system evaluates prompts using 8 comprehensive metrics to determine
5
+ * the most appropriate processing approach:
6
+ * - Score < 0.6: Template normalization is sufficient
7
+ * - Score >= 0.6: MCP Sampling is required for optimal results
8
+ *
9
+ * The 8 evaluation metrics are:
10
+ * 1. Word Count Score - Longer prompts indicate higher complexity
11
+ * 2. Abstract Concepts - Philosophical or conceptual terms
12
+ * 3. Temporal Elements - Time-related descriptors
13
+ * 4. Character References - Human figure descriptions requiring consistency
14
+ * 5. Specificity Score - Detailed descriptors and technical terms
15
+ * 6. Negative Language - Phrases requiring positive conversion
16
+ * 7. Aspect Ratio Mentions - Technical format specifications
17
+ * 8. Camera Terms - Photography and technical imaging terms
18
+ */
19
+ import type { ComplexityAssessment as IComplexityAssessment } from '../types/mcp';
20
+ /**
21
+ * ComplexityAssessment class implementing 8-metric evaluation system
22
+ * Provides fast complexity scoring for prompt routing decisions
23
+ *
24
+ * Design Philosophy:
25
+ * - Fast execution for real-time prompt processing
26
+ * - Comprehensive evaluation without over-engineering
27
+ * - Clear threshold-based decision making
28
+ * - Robust error handling for production use
29
+ */
30
+ export declare class ComplexityAssessment {
31
+ private static readonly COMPLEXITY_THRESHOLD;
32
+ /**
33
+ * Assess complexity of a prompt using 8 comprehensive metrics
34
+ * Returns complexity score and processing recommendation
35
+ *
36
+ * @param prompt - The input prompt to evaluate
37
+ * @returns ComplexityAssessment with score, factors, recommendation, and confidence
38
+ */
39
+ assessComplexity(prompt: string): IComplexityAssessment;
40
+ /**
41
+ * Validate input prompt
42
+ * @param prompt - Input to validate
43
+ * @returns true if valid, false otherwise
44
+ */
45
+ private isValidPrompt;
46
+ /**
47
+ * Create default assessment for invalid inputs or errors
48
+ * @returns Safe default ComplexityAssessment
49
+ */
50
+ private createDefaultAssessment;
51
+ /**
52
+ * Perform the actual complexity assessment with all metrics
53
+ * @param prompt - Validated prompt string
54
+ * @returns ComplexityAssessment result
55
+ */
56
+ private performComplexityAssessment;
57
+ /**
58
+ * Calculate all 8 metrics efficiently
59
+ * @param prompt - Input prompt
60
+ * @returns Object containing all metric scores
61
+ */
62
+ private calculateAllMetrics;
63
+ /**
64
+ * Calculate weighted complexity score
65
+ * Weights are empirically optimized for optimal threshold behavior
66
+ * @param metrics - Individual metric scores
67
+ * @returns Weighted complexity score (0-1)
68
+ */
69
+ private calculateWeightedScore;
70
+ /**
71
+ * Map internal metrics to standard interface factors
72
+ * @param metrics - Internal metric calculations
73
+ * @returns Factors matching ComplexityAssessment interface
74
+ */
75
+ private mapMetricsToFactors;
76
+ /**
77
+ * Determine processing recommendation based on score
78
+ * @param score - Complexity score
79
+ * @returns Processing recommendation
80
+ */
81
+ private determineRecommendation;
82
+ /**
83
+ * Calculate confidence based on score distance from threshold
84
+ * Higher confidence when score is clearly above or below threshold
85
+ * @param score - Complexity score
86
+ * @returns Confidence level (0-1)
87
+ */
88
+ private calculateConfidence;
89
+ /**
90
+ * Calculate specificity score based on detailed descriptors
91
+ * Higher scores indicate more detailed, specific prompts
92
+ *
93
+ * @param prompt - Input prompt to analyze
94
+ * @returns Specificity score (0-1) where 1 is highly specific
95
+ */
96
+ calculateSpecificity(prompt: string): number;
97
+ /**
98
+ * Perform the actual specificity calculation
99
+ * @param prompt - Validated prompt string
100
+ * @returns Specificity score
101
+ */
102
+ private performSpecificityCalculation;
103
+ /**
104
+ * Score based on word count (>50 words threshold)
105
+ */
106
+ private calculateWordCountScore;
107
+ /**
108
+ * Detect abstract concepts that require sophisticated processing
109
+ */
110
+ private detectAbstractConcepts;
111
+ /**
112
+ * Detect temporal elements that add complexity
113
+ */
114
+ private detectTemporalElements;
115
+ /**
116
+ * Detect character references requiring consistency
117
+ */
118
+ private detectCharacterReferences;
119
+ /**
120
+ * Detect negative language patterns that require positive conversion
121
+ */
122
+ private detectNegativeLanguage;
123
+ /**
124
+ * Detect aspect ratio mentions indicating technical requirements
125
+ */
126
+ private detectAspectRatioMention;
127
+ /**
128
+ * Detect camera and photography terms indicating technical complexity
129
+ */
130
+ private detectCameraTerms;
131
+ }
132
+ //# sourceMappingURL=complexityAssessment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complexityAssessment.d.ts","sourceRoot":"","sources":["../../src/business/complexityAssessment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAgBjF;;;;;;;;;GASG;AACH,qBAAa,oBAAoB;IAE/B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAM;IAElD;;;;;;OAMG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB;IAoBvD;;;;OAIG;IACH,OAAO,CAAC,aAAa;IASrB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAc/B;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAwBnC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;;OAKG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAM/B;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAK3B;;;;;;OAMG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAa5C;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IA0FrC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAU/B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA0C9B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmC9B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAgCjC;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAmB9B;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAoC1B"}
@@ -0,0 +1,488 @@
1
+ "use strict";
2
+ /**
3
+ * Complexity Assessment System for Prompt Orchestration
4
+ *
5
+ * This system evaluates prompts using 8 comprehensive metrics to determine
6
+ * the most appropriate processing approach:
7
+ * - Score < 0.6: Template normalization is sufficient
8
+ * - Score >= 0.6: MCP Sampling is required for optimal results
9
+ *
10
+ * The 8 evaluation metrics are:
11
+ * 1. Word Count Score - Longer prompts indicate higher complexity
12
+ * 2. Abstract Concepts - Philosophical or conceptual terms
13
+ * 3. Temporal Elements - Time-related descriptors
14
+ * 4. Character References - Human figure descriptions requiring consistency
15
+ * 5. Specificity Score - Detailed descriptors and technical terms
16
+ * 6. Negative Language - Phrases requiring positive conversion
17
+ * 7. Aspect Ratio Mentions - Technical format specifications
18
+ * 8. Camera Terms - Photography and technical imaging terms
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ComplexityAssessment = void 0;
22
+ /**
23
+ * ComplexityAssessment class implementing 8-metric evaluation system
24
+ * Provides fast complexity scoring for prompt routing decisions
25
+ *
26
+ * Design Philosophy:
27
+ * - Fast execution for real-time prompt processing
28
+ * - Comprehensive evaluation without over-engineering
29
+ * - Clear threshold-based decision making
30
+ * - Robust error handling for production use
31
+ */
32
+ class ComplexityAssessment {
33
+ /**
34
+ * Assess complexity of a prompt using 8 comprehensive metrics
35
+ * Returns complexity score and processing recommendation
36
+ *
37
+ * @param prompt - The input prompt to evaluate
38
+ * @returns ComplexityAssessment with score, factors, recommendation, and confidence
39
+ */
40
+ assessComplexity(prompt) {
41
+ // Input validation with comprehensive error handling
42
+ if (!this.isValidPrompt(prompt)) {
43
+ return this.createDefaultAssessment();
44
+ }
45
+ try {
46
+ return this.performComplexityAssessment(prompt);
47
+ }
48
+ catch (error) {
49
+ // Log error for debugging while returning safe fallback
50
+ console.error('ComplexityAssessment.assessComplexity failed:', {
51
+ error: error instanceof Error ? error.message : 'Unknown error',
52
+ promptLength: prompt?.length || 0,
53
+ promptPreview: prompt?.substring(0, 30) || 'null/undefined',
54
+ });
55
+ return this.createDefaultAssessment();
56
+ }
57
+ }
58
+ /**
59
+ * Validate input prompt
60
+ * @param prompt - Input to validate
61
+ * @returns true if valid, false otherwise
62
+ */
63
+ isValidPrompt(prompt) {
64
+ return (prompt !== null &&
65
+ prompt !== undefined &&
66
+ typeof prompt === 'string' &&
67
+ prompt.trim().length > 0);
68
+ }
69
+ /**
70
+ * Create default assessment for invalid inputs or errors
71
+ * @returns Safe default ComplexityAssessment
72
+ */
73
+ createDefaultAssessment() {
74
+ return {
75
+ score: 0,
76
+ factors: {
77
+ abstractConcepts: 0,
78
+ technicalTerms: 0,
79
+ ambiguity: 0,
80
+ length: 0,
81
+ },
82
+ recommendation: 'template_normalization',
83
+ confidence: 1.0,
84
+ };
85
+ }
86
+ /**
87
+ * Perform the actual complexity assessment with all metrics
88
+ * @param prompt - Validated prompt string
89
+ * @returns ComplexityAssessment result
90
+ */
91
+ performComplexityAssessment(prompt) {
92
+ // Calculate individual metric scores using optimized calculations
93
+ const metrics = this.calculateAllMetrics(prompt);
94
+ // Apply empirically optimized weighted scoring
95
+ const score = this.calculateWeightedScore(metrics);
96
+ // Map metrics to standard interface structure
97
+ const factors = this.mapMetricsToFactors(metrics);
98
+ // Determine processing recommendation based on threshold
99
+ const recommendation = this.determineRecommendation(score);
100
+ // Calculate confidence based on score clarity relative to threshold
101
+ const confidence = this.calculateConfidence(score);
102
+ return {
103
+ score,
104
+ factors,
105
+ recommendation,
106
+ confidence,
107
+ };
108
+ }
109
+ /**
110
+ * Calculate all 8 metrics efficiently
111
+ * @param prompt - Input prompt
112
+ * @returns Object containing all metric scores
113
+ */
114
+ calculateAllMetrics(prompt) {
115
+ return {
116
+ wordCount: this.calculateWordCountScore(prompt),
117
+ abstractConcepts: this.detectAbstractConcepts(prompt),
118
+ temporalElements: this.detectTemporalElements(prompt),
119
+ characterReferences: this.detectCharacterReferences(prompt),
120
+ specificity: this.calculateSpecificity(prompt),
121
+ negativeLanguage: this.detectNegativeLanguage(prompt),
122
+ aspectRatioMention: this.detectAspectRatioMention(prompt),
123
+ cameraTerms: this.detectCameraTerms(prompt),
124
+ };
125
+ }
126
+ /**
127
+ * Calculate weighted complexity score
128
+ * Weights are empirically optimized for optimal threshold behavior
129
+ * @param metrics - Individual metric scores
130
+ * @returns Weighted complexity score (0-1)
131
+ */
132
+ calculateWeightedScore(metrics) {
133
+ const weights = {
134
+ wordCount: 0.15, // Length complexity
135
+ abstractConcepts: 0.25, // Highest weight - philosophical complexity
136
+ temporalElements: 0.12, // Time-based complexity
137
+ characterReferences: 0.15, // Human consistency complexity
138
+ specificity: 0.18, // Detail complexity
139
+ negativeLanguage: 0.05, // Conversion complexity
140
+ aspectRatioMention: 0.05, // Technical format complexity
141
+ cameraTerms: 0.05, // Photography complexity
142
+ };
143
+ const score = weights.wordCount * metrics.wordCount +
144
+ weights.abstractConcepts * metrics.abstractConcepts +
145
+ weights.temporalElements * metrics.temporalElements +
146
+ weights.characterReferences * metrics.characterReferences +
147
+ weights.specificity * metrics.specificity +
148
+ weights.negativeLanguage * metrics.negativeLanguage +
149
+ weights.aspectRatioMention * metrics.aspectRatioMention +
150
+ weights.cameraTerms * metrics.cameraTerms;
151
+ return Math.min(score, 1.0);
152
+ }
153
+ /**
154
+ * Map internal metrics to standard interface factors
155
+ * @param metrics - Internal metric calculations
156
+ * @returns Factors matching ComplexityAssessment interface
157
+ */
158
+ mapMetricsToFactors(metrics) {
159
+ return {
160
+ abstractConcepts: metrics.abstractConcepts,
161
+ technicalTerms: Math.max(metrics.characterReferences, metrics.aspectRatioMention, metrics.cameraTerms),
162
+ ambiguity: Math.max(metrics.negativeLanguage, metrics.temporalElements * 0.5),
163
+ length: Math.min(metrics.wordCount + metrics.specificity * 0.3, 1.0),
164
+ };
165
+ }
166
+ /**
167
+ * Determine processing recommendation based on score
168
+ * @param score - Complexity score
169
+ * @returns Processing recommendation
170
+ */
171
+ determineRecommendation(score) {
172
+ return score >= ComplexityAssessment.COMPLEXITY_THRESHOLD
173
+ ? 'mcp_sampling'
174
+ : 'template_normalization';
175
+ }
176
+ /**
177
+ * Calculate confidence based on score distance from threshold
178
+ * Higher confidence when score is clearly above or below threshold
179
+ * @param score - Complexity score
180
+ * @returns Confidence level (0-1)
181
+ */
182
+ calculateConfidence(score) {
183
+ const distanceFromThreshold = Math.abs(score - ComplexityAssessment.COMPLEXITY_THRESHOLD);
184
+ return Math.min(0.5 + distanceFromThreshold * 2, 1.0);
185
+ }
186
+ /**
187
+ * Calculate specificity score based on detailed descriptors
188
+ * Higher scores indicate more detailed, specific prompts
189
+ *
190
+ * @param prompt - Input prompt to analyze
191
+ * @returns Specificity score (0-1) where 1 is highly specific
192
+ */
193
+ calculateSpecificity(prompt) {
194
+ if (!this.isValidPrompt(prompt)) {
195
+ return 0;
196
+ }
197
+ try {
198
+ return this.performSpecificityCalculation(prompt);
199
+ }
200
+ catch (error) {
201
+ console.error('calculateSpecificity failed:', error);
202
+ return 0;
203
+ }
204
+ }
205
+ /**
206
+ * Perform the actual specificity calculation
207
+ * @param prompt - Validated prompt string
208
+ * @returns Specificity score
209
+ */
210
+ performSpecificityCalculation(prompt) {
211
+ const specificityKeywords = [
212
+ // Physical descriptors
213
+ 'detailed',
214
+ 'specific',
215
+ 'particular',
216
+ 'precise',
217
+ 'exact',
218
+ 'intricate',
219
+ 'complex',
220
+ 'elaborate',
221
+ 'sophisticated',
222
+ // Colors and materials
223
+ 'red',
224
+ 'blue',
225
+ 'green',
226
+ 'yellow',
227
+ 'black',
228
+ 'white',
229
+ 'brown',
230
+ 'purple',
231
+ 'leather',
232
+ 'metal',
233
+ 'wood',
234
+ 'fabric',
235
+ 'glass',
236
+ 'stone',
237
+ // Measurements and quantities
238
+ 'tall',
239
+ 'short',
240
+ 'wide',
241
+ 'narrow',
242
+ 'large',
243
+ 'small',
244
+ 'tiny',
245
+ 'huge',
246
+ // Age and temporal descriptors
247
+ 'old',
248
+ 'young',
249
+ 'ancient',
250
+ 'modern',
251
+ 'vintage',
252
+ 'new',
253
+ // Professional and technical terms
254
+ 'professional',
255
+ 'technical',
256
+ 'industrial',
257
+ 'commercial',
258
+ 'artistic',
259
+ 'cinematic',
260
+ 'photographic',
261
+ 'realistic',
262
+ 'stylized',
263
+ // Facial and character features
264
+ 'facial',
265
+ 'features',
266
+ 'heterochromia',
267
+ 'eyes',
268
+ 'hair',
269
+ 'texture',
270
+ 'skin',
271
+ 'expression',
272
+ 'pose',
273
+ // Technical photography terms
274
+ 'macro',
275
+ 'telephoto',
276
+ 'wide-angle',
277
+ 'bokeh',
278
+ 'depth',
279
+ // Dimensional and spatial
280
+ 'dimensions',
281
+ 'ratio',
282
+ 'aspect',
283
+ 'composition',
284
+ 'framing',
285
+ ];
286
+ const keywordMatches = specificityKeywords.filter((keyword) => new RegExp(`\\b${keyword}\\b`, 'i').test(prompt)).length;
287
+ // Enhanced calculation with better scoring
288
+ const wordCount = prompt.split(' ').length;
289
+ const keywordDensity = keywordMatches / Math.max(wordCount, 1);
290
+ const lengthFactor = Math.min(prompt.length / 150, 1); // Adjusted normalization
291
+ const complexityBonus = wordCount > 20 ? 0.2 : 0; // Bonus for longer prompts
292
+ return Math.min(keywordDensity * 3 + lengthFactor * 0.4 + complexityBonus, 1.0);
293
+ }
294
+ /**
295
+ * Score based on word count (>50 words threshold)
296
+ */
297
+ calculateWordCountScore(prompt) {
298
+ const wordCount = prompt.trim().split(/\s+/).length;
299
+ // Score increases after 50 words
300
+ if (wordCount <= 20)
301
+ return 0.1;
302
+ if (wordCount <= 50)
303
+ return 0.3;
304
+ if (wordCount <= 100)
305
+ return 0.6;
306
+ return 0.9;
307
+ }
308
+ /**
309
+ * Detect abstract concepts that require sophisticated processing
310
+ */
311
+ detectAbstractConcepts(prompt) {
312
+ const abstractTerms = [
313
+ 'consciousness',
314
+ 'existence',
315
+ 'concept',
316
+ 'abstract',
317
+ 'surreal',
318
+ 'philosophy',
319
+ 'metaphor',
320
+ 'symbolic',
321
+ 'meaning',
322
+ 'essence',
323
+ 'soul',
324
+ 'spirit',
325
+ 'emotion',
326
+ 'feeling',
327
+ 'mood',
328
+ 'atmosphere',
329
+ 'dream',
330
+ 'imagination',
331
+ 'fantasy',
332
+ 'ethereal',
333
+ 'mystical',
334
+ 'conceptual',
335
+ 'visualization',
336
+ 'representing',
337
+ 'interfacing',
338
+ 'temporal',
339
+ 'dimensions',
340
+ 'quantum',
341
+ 'nature',
342
+ 'human',
343
+ ];
344
+ const matches = abstractTerms.filter((term) => new RegExp(`\\b${term}\\b`, 'i').test(prompt)).length;
345
+ // Increased scoring for abstract concepts
346
+ return Math.min(matches * 0.4, 1.0);
347
+ }
348
+ /**
349
+ * Detect temporal elements that add complexity
350
+ */
351
+ detectTemporalElements(prompt) {
352
+ const temporalTerms = [
353
+ 'before',
354
+ 'after',
355
+ 'during',
356
+ 'while',
357
+ 'when',
358
+ 'until',
359
+ 'sunrise',
360
+ 'sunset',
361
+ 'midnight',
362
+ 'dawn',
363
+ 'dusk',
364
+ 'morning',
365
+ 'evening',
366
+ 'night',
367
+ 'day',
368
+ 'season',
369
+ 'winter',
370
+ 'summer',
371
+ 'spring',
372
+ 'autumn',
373
+ 'past',
374
+ 'future',
375
+ 'present',
376
+ 'time',
377
+ ];
378
+ const matches = temporalTerms.filter((term) => new RegExp(`\\b${term}\\b`, 'i').test(prompt)).length;
379
+ return Math.min(matches * 0.25, 1.0);
380
+ }
381
+ /**
382
+ * Detect character references requiring consistency
383
+ */
384
+ detectCharacterReferences(prompt) {
385
+ const characterTerms = [
386
+ 'person',
387
+ 'character',
388
+ 'individual',
389
+ 'human',
390
+ 'figure',
391
+ 'man',
392
+ 'woman',
393
+ 'child',
394
+ 'adult',
395
+ 'face',
396
+ 'portrait',
397
+ 'eyes',
398
+ 'hair',
399
+ 'skin',
400
+ 'features',
401
+ 'expression',
402
+ 'smile',
403
+ 'frown',
404
+ 'look',
405
+ 'gaze',
406
+ 'appearance',
407
+ ];
408
+ const matches = characterTerms.filter((term) => new RegExp(`\\b${term}\\b`, 'i').test(prompt)).length;
409
+ return Math.min(matches * 0.15, 1.0);
410
+ }
411
+ /**
412
+ * Detect negative language patterns that require positive conversion
413
+ */
414
+ detectNegativeLanguage(prompt) {
415
+ const negativePatterns = [
416
+ /\bno\s+\w+/gi,
417
+ /\bavoid\s+\w+/gi,
418
+ /\bwithout\s+\w+/gi,
419
+ /\bnot\s+\w+/gi,
420
+ /\bdont?\s+\w+/gi,
421
+ /\bexclude\s+\w+/gi,
422
+ /\bremove\s+\w+/gi,
423
+ ];
424
+ const totalMatches = negativePatterns.reduce((count, pattern) => {
425
+ const matches = prompt.match(pattern);
426
+ return count + (matches ? matches.length : 0);
427
+ }, 0);
428
+ return Math.min(totalMatches * 0.3, 1.0);
429
+ }
430
+ /**
431
+ * Detect aspect ratio mentions indicating technical requirements
432
+ */
433
+ detectAspectRatioMention(prompt) {
434
+ const aspectRatioPatterns = [
435
+ /\b\d+:\d+\b/g, // Format like 16:9, 4:3
436
+ /\baspect\s+ratio\b/gi,
437
+ /\bwidescreen\b/gi,
438
+ /\bcinematic\b/gi,
439
+ /\bportrait\s+orientation\b/gi,
440
+ /\blandscape\s+orientation\b/gi,
441
+ /\bsquare\s+format\b/gi,
442
+ ];
443
+ const totalMatches = aspectRatioPatterns.reduce((count, pattern) => {
444
+ const matches = prompt.match(pattern);
445
+ return count + (matches ? matches.length : 0);
446
+ }, 0);
447
+ return totalMatches > 0 ? Math.min(totalMatches * 0.5, 1.0) : 0;
448
+ }
449
+ /**
450
+ * Detect camera and photography terms indicating technical complexity
451
+ */
452
+ detectCameraTerms(prompt) {
453
+ const cameraTerms = [
454
+ 'lens',
455
+ 'aperture',
456
+ 'focal',
457
+ 'depth of field',
458
+ 'bokeh',
459
+ 'ISO',
460
+ 'exposure',
461
+ 'shutter',
462
+ 'f/',
463
+ 'mm',
464
+ 'wide-angle',
465
+ 'telephoto',
466
+ 'macro',
467
+ 'fisheye',
468
+ 'photography',
469
+ 'camera',
470
+ 'shot',
471
+ 'angle',
472
+ 'lighting',
473
+ 'flash',
474
+ 'studio',
475
+ 'natural light',
476
+ 'golden hour',
477
+ 'blue hour',
478
+ 'harsh light',
479
+ 'soft light',
480
+ ];
481
+ const matches = cameraTerms.filter((term) => new RegExp(`\\b${term}\\b`, 'i').test(prompt)).length;
482
+ return Math.min(matches * 0.2, 1.0);
483
+ }
484
+ }
485
+ exports.ComplexityAssessment = ComplexityAssessment;
486
+ // Threshold for determining processing approach (empirically optimized)
487
+ ComplexityAssessment.COMPLEXITY_THRESHOLD = 0.6;
488
+ //# sourceMappingURL=complexityAssessment.js.map