@vfarcic/dot-ai 0.111.0 → 0.113.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 (95) hide show
  1. package/dist/core/ai-provider-factory.d.ts +0 -10
  2. package/dist/core/ai-provider-factory.d.ts.map +1 -1
  3. package/dist/core/ai-provider-factory.js +14 -24
  4. package/dist/core/ai-provider.interface.d.ts +28 -1
  5. package/dist/core/ai-provider.interface.d.ts.map +1 -1
  6. package/dist/core/capabilities.d.ts +1 -1
  7. package/dist/core/capabilities.d.ts.map +1 -1
  8. package/dist/core/capabilities.js +7 -4
  9. package/dist/core/capability-scan-workflow.js +2 -2
  10. package/dist/core/embedding-service.d.ts +35 -2
  11. package/dist/core/embedding-service.d.ts.map +1 -1
  12. package/dist/core/embedding-service.js +228 -15
  13. package/dist/core/model-config.d.ts +23 -0
  14. package/dist/core/model-config.d.ts.map +1 -0
  15. package/dist/core/model-config.js +28 -0
  16. package/dist/core/platform-operations.d.ts.map +1 -1
  17. package/dist/core/platform-operations.js +3 -5
  18. package/dist/core/platform-utils.d.ts +13 -2
  19. package/dist/core/platform-utils.d.ts.map +1 -1
  20. package/dist/core/platform-utils.js +91 -9
  21. package/dist/core/providers/anthropic-provider.d.ts +6 -1
  22. package/dist/core/providers/anthropic-provider.d.ts.map +1 -1
  23. package/dist/core/providers/anthropic-provider.js +99 -27
  24. package/dist/core/providers/provider-debug-utils.d.ts +53 -20
  25. package/dist/core/providers/provider-debug-utils.d.ts.map +1 -1
  26. package/dist/core/providers/provider-debug-utils.js +106 -51
  27. package/dist/core/providers/vercel-provider.d.ts +6 -1
  28. package/dist/core/providers/vercel-provider.d.ts.map +1 -1
  29. package/dist/core/providers/vercel-provider.js +212 -130
  30. package/dist/core/schema.d.ts +1 -101
  31. package/dist/core/schema.d.ts.map +1 -1
  32. package/dist/core/schema.js +20 -154
  33. package/dist/core/unified-creation-session.d.ts.map +1 -1
  34. package/dist/core/unified-creation-session.js +15 -7
  35. package/dist/evaluation/dataset-analyzer.d.ts +118 -0
  36. package/dist/evaluation/dataset-analyzer.d.ts.map +1 -0
  37. package/dist/evaluation/dataset-analyzer.js +234 -0
  38. package/dist/evaluation/datasets/loader.d.ts +42 -0
  39. package/dist/evaluation/datasets/loader.d.ts.map +1 -0
  40. package/dist/evaluation/datasets/loader.js +104 -0
  41. package/dist/evaluation/eval-runner.d.ts +9 -0
  42. package/dist/evaluation/eval-runner.d.ts.map +1 -0
  43. package/dist/evaluation/eval-runner.js +399 -0
  44. package/dist/evaluation/evaluators/base-comparative.d.ts +94 -0
  45. package/dist/evaluation/evaluators/base-comparative.d.ts.map +1 -0
  46. package/dist/evaluation/evaluators/base-comparative.js +187 -0
  47. package/dist/evaluation/evaluators/base.d.ts +47 -0
  48. package/dist/evaluation/evaluators/base.d.ts.map +1 -0
  49. package/dist/evaluation/evaluators/base.js +10 -0
  50. package/dist/evaluation/evaluators/capability-comparative.d.ts +32 -0
  51. package/dist/evaluation/evaluators/capability-comparative.d.ts.map +1 -0
  52. package/dist/evaluation/evaluators/capability-comparative.js +104 -0
  53. package/dist/evaluation/evaluators/pattern-comparative.d.ts +31 -0
  54. package/dist/evaluation/evaluators/pattern-comparative.d.ts.map +1 -0
  55. package/dist/evaluation/evaluators/pattern-comparative.js +97 -0
  56. package/dist/evaluation/evaluators/policy-comparative.d.ts +31 -0
  57. package/dist/evaluation/evaluators/policy-comparative.d.ts.map +1 -0
  58. package/dist/evaluation/evaluators/policy-comparative.js +97 -0
  59. package/dist/evaluation/evaluators/recommendation-comparative.d.ts +25 -0
  60. package/dist/evaluation/evaluators/recommendation-comparative.d.ts.map +1 -0
  61. package/dist/evaluation/evaluators/recommendation-comparative.js +55 -0
  62. package/dist/evaluation/evaluators/remediation-comparative.d.ts +25 -0
  63. package/dist/evaluation/evaluators/remediation-comparative.d.ts.map +1 -0
  64. package/dist/evaluation/evaluators/remediation-comparative.js +54 -0
  65. package/dist/evaluation/platform-synthesizer.d.ts +54 -0
  66. package/dist/evaluation/platform-synthesizer.d.ts.map +1 -0
  67. package/dist/evaluation/platform-synthesizer.js +368 -0
  68. package/dist/evaluation/run-platform-synthesis.d.ts +9 -0
  69. package/dist/evaluation/run-platform-synthesis.d.ts.map +1 -0
  70. package/dist/evaluation/run-platform-synthesis.js +45 -0
  71. package/dist/interfaces/mcp.d.ts.map +1 -1
  72. package/dist/interfaces/mcp.js +23 -29
  73. package/dist/interfaces/rest-api.d.ts.map +1 -1
  74. package/dist/tools/answer-question.d.ts +2 -0
  75. package/dist/tools/answer-question.d.ts.map +1 -1
  76. package/dist/tools/answer-question.js +18 -11
  77. package/dist/tools/generate-manifests.d.ts +2 -0
  78. package/dist/tools/generate-manifests.d.ts.map +1 -1
  79. package/dist/tools/generate-manifests.js +11 -12
  80. package/dist/tools/organizational-data.d.ts +1 -0
  81. package/dist/tools/organizational-data.d.ts.map +1 -1
  82. package/dist/tools/organizational-data.js +2 -1
  83. package/dist/tools/recommend.d.ts +1 -0
  84. package/dist/tools/recommend.d.ts.map +1 -1
  85. package/dist/tools/recommend.js +13 -21
  86. package/dist/tools/remediate.d.ts +3 -0
  87. package/dist/tools/remediate.d.ts.map +1 -1
  88. package/dist/tools/remediate.js +35 -14
  89. package/dist/tools/test-docs.d.ts +1 -0
  90. package/dist/tools/test-docs.d.ts.map +1 -1
  91. package/dist/tools/test-docs.js +4 -2
  92. package/dist/tools/version.d.ts +5 -1
  93. package/dist/tools/version.d.ts.map +1 -1
  94. package/dist/tools/version.js +23 -8
  95. package/package.json +19 -1
@@ -51,16 +51,6 @@ export declare class AIProviderFactory {
51
51
  * @private
52
52
  */
53
53
  private static createAnthropicProvider;
54
- /**
55
- * Create OpenAI provider instance
56
- * @private
57
- */
58
- private static createOpenAIProvider;
59
- /**
60
- * Create Google provider instance
61
- * @private
62
- */
63
- private static createGoogleProvider;
64
54
  /**
65
55
  * Check if a provider is available (has API key configured)
66
56
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ai-provider-factory.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAoBjC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAoCnD;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,aAAa,IAAI,UAAU;IA+ClC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAItC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAInC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAInC;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAMrD;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,IAAI,MAAM,EAAE;IAMxC;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAGxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C"}
1
+ {"version":3,"file":"ai-provider-factory.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,UAAU,EACV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AA8BjC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAgCnD;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,aAAa,IAAI,UAAU;IA+ClC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAItC;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAMrD;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,IAAI,MAAM,EAAE;IAMxC;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAGxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C"}
@@ -13,19 +13,25 @@ exports.AIProviderFactory = void 0;
13
13
  exports.createAIProvider = createAIProvider;
14
14
  const anthropic_provider_1 = require("./providers/anthropic-provider");
15
15
  const vercel_provider_1 = require("./providers/vercel-provider");
16
+ const model_config_1 = require("./model-config");
16
17
  /**
17
18
  * Provider environment variable mappings
18
19
  * Phase 1 (PRD 73): anthropic, openai, google
20
+ * Phase 2 (PRD 154): openai_pro for GPT-5 Pro
19
21
  */
20
22
  const PROVIDER_ENV_KEYS = {
21
23
  anthropic: 'ANTHROPIC_API_KEY',
24
+ anthropic_haiku: 'ANTHROPIC_API_KEY', // Uses same API key as regular Anthropic
22
25
  openai: 'OPENAI_API_KEY',
26
+ openai_pro: 'OPENAI_API_KEY', // Uses same API key as regular OpenAI
23
27
  google: 'GOOGLE_API_KEY',
28
+ google_fast: 'GOOGLE_API_KEY', // Uses same API key as regular Google
29
+ xai: 'XAI_API_KEY',
30
+ xai_fast: 'XAI_API_KEY', // Uses same API key as regular xAI
31
+ mistral: 'MISTRAL_API_KEY',
32
+ deepseek: 'DEEPSEEK_API_KEY',
24
33
  };
25
- /**
26
- * Providers implemented in Phase 1
27
- */
28
- const IMPLEMENTED_PROVIDERS = ['anthropic', 'openai', 'google'];
34
+ const IMPLEMENTED_PROVIDERS = Object.keys(model_config_1.CURRENT_MODELS);
29
35
  /**
30
36
  * Factory for creating AI provider instances
31
37
  *
@@ -66,14 +72,12 @@ class AIProviderFactory {
66
72
  // Create provider based on type
67
73
  switch (config.provider) {
68
74
  case 'anthropic':
75
+ case 'anthropic_haiku':
69
76
  return this.createAnthropicProvider(config);
70
- case 'openai':
71
- return this.createOpenAIProvider(config);
72
- case 'google':
73
- return this.createGoogleProvider(config);
74
77
  default:
75
- // This should never happen due to IMPLEMENTED_PROVIDERS check above
76
- throw new Error(`Unsupported provider: ${config.provider}`);
78
+ // All non-Anthropic providers use VercelProvider
79
+ // This matches the integration test behavior with AI_PROVIDER_SDK=vercel
80
+ return new vercel_provider_1.VercelProvider(config);
77
81
  }
78
82
  }
79
83
  /**
@@ -133,20 +137,6 @@ class AIProviderFactory {
133
137
  static createAnthropicProvider(config) {
134
138
  return new anthropic_provider_1.AnthropicProvider(config);
135
139
  }
136
- /**
137
- * Create OpenAI provider instance
138
- * @private
139
- */
140
- static createOpenAIProvider(config) {
141
- return new vercel_provider_1.VercelProvider(config);
142
- }
143
- /**
144
- * Create Google provider instance
145
- * @private
146
- */
147
- static createGoogleProvider(config) {
148
- return new vercel_provider_1.VercelProvider(config);
149
- }
150
140
  /**
151
141
  * Check if a provider is available (has API key configured)
152
142
  *
@@ -109,6 +109,12 @@ export interface ToolLoopConfig {
109
109
  onIteration?: (iteration: number, toolCalls: any[]) => void;
110
110
  /** Optional operation identifier for metrics and debugging */
111
111
  operation?: string;
112
+ /** PRD #154: Evaluation context for dataset generation */
113
+ evaluationContext?: {
114
+ user_intent?: string;
115
+ };
116
+ /** PRD #154: Interaction ID for dataset generation pairing */
117
+ interaction_id?: string;
112
118
  }
113
119
  /**
114
120
  * Result from agentic tool loop
@@ -137,6 +143,11 @@ export interface AgenticResult {
137
143
  completionReason?: 'investigation_complete' | 'max_iterations' | 'parse_failure' | 'model_stopped' | 'error';
138
144
  /** Specific model version used (PRD #143 Decision 5) */
139
145
  modelVersion?: string;
146
+ /** Debug files created during toolLoop execution (PRD #154) */
147
+ debugFiles?: {
148
+ full_prompt: string;
149
+ full_response: string;
150
+ };
140
151
  }
141
152
  /**
142
153
  * AI Provider Interface
@@ -154,9 +165,13 @@ export interface AIProvider {
154
165
  *
155
166
  * @param message The message/prompt to send
156
167
  * @param operation Optional operation identifier for debugging (e.g., 'deployment', 'intent-analysis')
168
+ * @param evaluationContext Optional evaluation context for dataset generation (PRD #154)
157
169
  * @returns AI response with content and usage statistics
158
170
  */
159
- sendMessage(message: string, operation?: string): Promise<AIResponse>;
171
+ sendMessage(message: string, operation?: string, evaluationContext?: {
172
+ user_intent?: string;
173
+ interaction_id?: string;
174
+ }): Promise<AIResponse>;
160
175
  /**
161
176
  * Check if the provider is properly initialized
162
177
  *
@@ -182,6 +197,18 @@ export interface AIProvider {
182
197
  * @returns Provider identifier (e.g., 'anthropic', 'openai', 'google')
183
198
  */
184
199
  getProviderType(): string;
200
+ /**
201
+ * Get the current model name being used
202
+ *
203
+ * @returns Model name (e.g., 'grok-4-fast-reasoning', 'claude-3-5-sonnet-20241022')
204
+ */
205
+ getModelName(): string;
206
+ /**
207
+ * Get the underlying SDK provider being used (for Vercel AI SDK)
208
+ *
209
+ * @returns SDK provider name (e.g., 'xai', 'anthropic', 'openai') or the provider type for native SDKs
210
+ */
211
+ getSDKProvider(): string;
185
212
  /**
186
213
  * Execute agentic loop with tool calling (NEW - PRD #136)
187
214
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ai-provider.interface.d.ts","sourceRoot":"","sources":["../../src/core/ai-provider.interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,2BAA2B,CAAC,EAAE,MAAM,CAAC;QACrC,uBAAuB,CAAC,EAAE,MAAM,CAAC;KAClC,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,0BAA0B,GAC1B,uBAAuB,GACvB,0BAA0B,GAC1B,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WAAW,UAAU;IACzB;;;;;;;;;;;OAWG;IACH,WAAW,CACT,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,UAAU,CAAC,CAAC;IAEvB;;;;;;OAMG;IACH,aAAa,IAAI,OAAO,CAAC;IAEzB;;;;;;;OAOG;IACH,eAAe,IAAI,MAAM,CAAC;IAE1B;;;;;;OAMG;IACH,eAAe,IAAI,MAAM,CAAC;IAE1B;;;;OAIG;IACH,YAAY,IAAI,MAAM,CAAC;IAEvB;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CAE1D"}
@@ -39,7 +39,7 @@ export declare class CapabilityInferenceEngine {
39
39
  * @param resourceName - Full resource name (e.g., "resourcegroups.azure.upbound.io")
40
40
  * @throws Error if capability inference fails for any reason
41
41
  */
42
- inferCapabilities(resourceName: string, resourceDefinition?: string): Promise<ResourceCapability>;
42
+ inferCapabilities(resourceName: string, resourceDefinition?: string, interaction_id?: string): Promise<ResourceCapability>;
43
43
  /**
44
44
  * Use AI to infer capabilities from all available resource context
45
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/core/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAEjC,YAAY,EAAE,MAAM,CAAC;IAGrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;I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OAAO,EAAE,MAAM,CAAC;IAGhB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAGrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM;IAKlD;;;;;OAKG;IACG,iBAAiB,CACrB,YAAY,EAAE,MAAM,EACpB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,kBAAkB,CAAC;IA2B9B;;;;OAIG;YACW,WAAW;IA8BzB;;;;OAIG;YACW,oBAAoB;IAalC;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAwD/B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAyB/B;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CAQ1D"}
@@ -29,7 +29,7 @@ class CapabilityInferenceEngine {
29
29
  * @param resourceName - Full resource name (e.g., "resourcegroups.azure.upbound.io")
30
30
  * @throws Error if capability inference fails for any reason
31
31
  */
32
- async inferCapabilities(resourceName, resourceDefinition) {
32
+ async inferCapabilities(resourceName, resourceDefinition, interaction_id) {
33
33
  const requestId = `capability-inference-${Date.now()}`;
34
34
  this.logger.info('Starting capability inference', {
35
35
  requestId,
@@ -37,7 +37,7 @@ class CapabilityInferenceEngine {
37
37
  hasDefinition: !!resourceDefinition
38
38
  });
39
39
  // Use AI to analyze all available information
40
- const aiResult = await this.inferWithAI(resourceName, resourceDefinition, requestId);
40
+ const aiResult = await this.inferWithAI(resourceName, resourceDefinition, requestId, interaction_id);
41
41
  // Convert AI result to final capability structure
42
42
  const finalCapability = this.buildResourceCapability(resourceName, aiResult);
43
43
  this.logger.info('Capability inference completed', {
@@ -55,10 +55,13 @@ class CapabilityInferenceEngine {
55
55
  *
56
56
  * @throws Error if AI inference fails
57
57
  */
58
- async inferWithAI(resourceName, resourceDefinition, requestId) {
58
+ async inferWithAI(resourceName, resourceDefinition, requestId, interaction_id) {
59
59
  try {
60
60
  const prompt = await this.buildInferencePrompt(resourceName, resourceDefinition);
61
- const response = await this.aiProvider.sendMessage(prompt);
61
+ const response = await this.aiProvider.sendMessage(prompt, 'capability-inference', {
62
+ user_intent: `Analyze capabilities of Kubernetes resource: ${resourceName}`,
63
+ interaction_id: interaction_id || 'inference'
64
+ });
62
65
  return this.parseCapabilitiesFromAI(response.content);
63
66
  }
64
67
  catch (error) {
@@ -530,7 +530,7 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
530
530
  });
531
531
  if (session.processingMode === 'manual') {
532
532
  // Manual mode: Show capability data for user review
533
- const capability = await engine.inferCapabilities(resourceName, resourceDefinition);
533
+ const capability = await engine.inferCapabilities(resourceName, resourceDefinition, args.interaction_id);
534
534
  const capabilityId = capabilities_1.CapabilityInferenceEngine.generateCapabilityId(resourceName);
535
535
  return {
536
536
  success: true,
@@ -671,7 +671,7 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
671
671
  resource: currentResource,
672
672
  percentage: Math.round(((i + 1) / totalResources) * 100)
673
673
  });
674
- const capability = await engine.inferCapabilities(currentResource, currentResourceDefinition);
674
+ const capability = await engine.inferCapabilities(currentResource, currentResourceDefinition, args.interaction_id);
675
675
  const capabilityId = capabilities_1.CapabilityInferenceEngine.generateCapabilityId(currentResource);
676
676
  // Store capability in Vector DB
677
677
  await capabilityService.storeCapability(capability);
@@ -2,10 +2,10 @@
2
2
  * Embedding Service
3
3
  *
4
4
  * Optional semantic search enhancement for pattern matching.
5
- * Gracefully falls back to keyword-only search when OpenAI API key is not available.
5
+ * Gracefully falls back to keyword-only search when embedding providers are not available.
6
6
  */
7
7
  export interface EmbeddingConfig {
8
- provider?: 'openai';
8
+ provider?: 'openai' | 'google' | 'mistral';
9
9
  apiKey?: string;
10
10
  model?: string;
11
11
  dimensions?: number;
@@ -15,6 +15,7 @@ export interface EmbeddingProvider {
15
15
  generateEmbeddings(texts: string[]): Promise<number[][]>;
16
16
  isAvailable(): boolean;
17
17
  getDimensions(): number;
18
+ getModel(): string;
18
19
  }
19
20
  /**
20
21
  * OpenAI Embedding Provider
@@ -32,6 +33,38 @@ export declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
32
33
  getDimensions(): number;
33
34
  getModel(): string;
34
35
  }
36
+ /**
37
+ * Google Embedding Provider
38
+ * Optional provider using Google's text-embedding-004 model
39
+ */
40
+ export declare class GoogleEmbeddingProvider implements EmbeddingProvider {
41
+ private apiKey;
42
+ private model;
43
+ private dimensions;
44
+ private available;
45
+ constructor(config?: EmbeddingConfig);
46
+ generateEmbedding(text: string): Promise<number[]>;
47
+ generateEmbeddings(texts: string[]): Promise<number[][]>;
48
+ isAvailable(): boolean;
49
+ getDimensions(): number;
50
+ getModel(): string;
51
+ }
52
+ /**
53
+ * Mistral Embedding Provider
54
+ * Optional provider using Mistral's text-embedding-v1 model
55
+ */
56
+ export declare class MistralEmbeddingProvider implements EmbeddingProvider {
57
+ private apiKey;
58
+ private model;
59
+ private dimensions;
60
+ private available;
61
+ constructor(config?: EmbeddingConfig);
62
+ generateEmbedding(text: string): Promise<number[]>;
63
+ generateEmbeddings(texts: string[]): Promise<number[][]>;
64
+ isAvailable(): boolean;
65
+ getDimensions(): number;
66
+ getModel(): string;
67
+ }
35
68
  /**
36
69
  * Main Embedding Service
37
70
  * Provides optional semantic search capabilities with graceful degradation
@@ -1 +1 @@
1
- {"version":3,"file":"embedding-service.d.ts","sourceRoot":"","sources":["../../src/core/embedding-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,E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,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAc9D;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,SAAS,IAAI;QACX,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB;IAqCD;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE;QAC/B,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,kBAAkB,EAAE,MAAM,EAAE,CAAC;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,MAAM;CASX"}
@@ -3,14 +3,17 @@
3
3
  * Embedding Service
4
4
  *
5
5
  * Optional semantic search enhancement for pattern matching.
6
- * Gracefully falls back to keyword-only search when OpenAI API key is not available.
6
+ * Gracefully falls back to keyword-only search when embedding providers are not available.
7
7
  */
8
8
  var __importDefault = (this && this.__importDefault) || function (mod) {
9
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.EmbeddingService = exports.OpenAIEmbeddingProvider = void 0;
12
+ exports.EmbeddingService = exports.MistralEmbeddingProvider = exports.GoogleEmbeddingProvider = exports.OpenAIEmbeddingProvider = void 0;
13
13
  const openai_1 = __importDefault(require("openai"));
14
+ const google_1 = require("@ai-sdk/google");
15
+ const mistral_1 = require("@ai-sdk/mistral");
16
+ const ai_1 = require("ai");
14
17
  /**
15
18
  * OpenAI Embedding Provider
16
19
  * Optional provider for semantic search enhancement
@@ -102,21 +105,211 @@ class OpenAIEmbeddingProvider {
102
105
  }
103
106
  exports.OpenAIEmbeddingProvider = OpenAIEmbeddingProvider;
104
107
  /**
105
- * Main Embedding Service
106
- * Provides optional semantic search capabilities with graceful degradation
108
+ * Google Embedding Provider
109
+ * Optional provider using Google's text-embedding-004 model
107
110
  */
108
- class EmbeddingService {
109
- provider;
111
+ class GoogleEmbeddingProvider {
112
+ apiKey = null;
113
+ model;
114
+ dimensions;
115
+ available;
110
116
  constructor(config = {}) {
111
- // Try to initialize OpenAI provider, but don't fail if unavailable
117
+ this.apiKey = config.apiKey || process.env.GOOGLE_API_KEY || null;
118
+ this.model = config.model || 'text-embedding-004';
119
+ this.dimensions = config.dimensions || 768; // text-embedding-004 default
120
+ this.available = !!this.apiKey;
121
+ // Set the environment variable that Google SDK expects
122
+ if (this.apiKey) {
123
+ process.env.GOOGLE_GENERATIVE_AI_API_KEY = this.apiKey;
124
+ }
125
+ }
126
+ async generateEmbedding(text) {
127
+ if (!this.isAvailable()) {
128
+ throw new Error('Google embedding provider not available');
129
+ }
130
+ if (!text || text.trim().length === 0) {
131
+ throw new Error('Text cannot be empty for embedding generation');
132
+ }
112
133
  try {
113
- const provider = new OpenAIEmbeddingProvider(config);
114
- this.provider = provider.isAvailable() ? provider : null;
134
+ const model = google_1.google.textEmbedding(this.model);
135
+ const result = await (0, ai_1.embed)({
136
+ model,
137
+ value: text.trim(),
138
+ providerOptions: {
139
+ google: {
140
+ outputDimensionality: this.dimensions,
141
+ taskType: 'SEMANTIC_SIMILARITY'
142
+ }
143
+ }
144
+ });
145
+ return result.embedding;
115
146
  }
116
147
  catch (error) {
117
- this.provider = null;
148
+ if (error instanceof Error) {
149
+ throw new Error(`Google embedding failed: ${error.message}`);
150
+ }
151
+ throw new Error(`Google embedding failed: ${String(error)}`);
118
152
  }
119
153
  }
154
+ async generateEmbeddings(texts) {
155
+ if (!this.isAvailable()) {
156
+ throw new Error('Google embedding provider not available');
157
+ }
158
+ if (!texts || texts.length === 0) {
159
+ return [];
160
+ }
161
+ const validTexts = texts
162
+ .map(t => t?.trim())
163
+ .filter(t => t && t.length > 0);
164
+ if (validTexts.length === 0) {
165
+ return [];
166
+ }
167
+ try {
168
+ const model = google_1.google.textEmbedding(this.model);
169
+ const results = await Promise.all(validTexts.map(text => (0, ai_1.embed)({
170
+ model,
171
+ value: text,
172
+ providerOptions: {
173
+ google: {
174
+ outputDimensionality: this.dimensions,
175
+ taskType: 'SEMANTIC_SIMILARITY'
176
+ }
177
+ }
178
+ })));
179
+ return results.map(result => result.embedding);
180
+ }
181
+ catch (error) {
182
+ if (error instanceof Error) {
183
+ throw new Error(`Google batch embedding failed: ${error.message}`);
184
+ }
185
+ throw new Error(`Google batch embedding failed: ${String(error)}`);
186
+ }
187
+ }
188
+ isAvailable() {
189
+ return this.available;
190
+ }
191
+ getDimensions() {
192
+ return this.dimensions;
193
+ }
194
+ getModel() {
195
+ return this.model;
196
+ }
197
+ }
198
+ exports.GoogleEmbeddingProvider = GoogleEmbeddingProvider;
199
+ /**
200
+ * Mistral Embedding Provider
201
+ * Optional provider using Mistral's text-embedding-v1 model
202
+ */
203
+ class MistralEmbeddingProvider {
204
+ apiKey = null;
205
+ model;
206
+ dimensions;
207
+ available;
208
+ constructor(config = {}) {
209
+ this.apiKey = config.apiKey || process.env.MISTRAL_API_KEY || null;
210
+ this.model = config.model || 'mistral-embed';
211
+ this.dimensions = config.dimensions || 1024; // mistral-embed default
212
+ this.available = !!this.apiKey;
213
+ }
214
+ async generateEmbedding(text) {
215
+ if (!this.isAvailable()) {
216
+ throw new Error('Mistral embedding provider not available');
217
+ }
218
+ if (!text || text.trim().length === 0) {
219
+ throw new Error('Text cannot be empty for embedding generation');
220
+ }
221
+ try {
222
+ const mistral = (0, mistral_1.createMistral)({ apiKey: this.apiKey });
223
+ const model = mistral.textEmbedding(this.model);
224
+ const result = await (0, ai_1.embed)({
225
+ model,
226
+ value: text.trim()
227
+ });
228
+ return result.embedding;
229
+ }
230
+ catch (error) {
231
+ if (error instanceof Error) {
232
+ throw new Error(`Mistral embedding failed: ${error.message}`);
233
+ }
234
+ throw new Error(`Mistral embedding failed: ${String(error)}`);
235
+ }
236
+ }
237
+ async generateEmbeddings(texts) {
238
+ if (!this.isAvailable()) {
239
+ throw new Error('Mistral embedding provider not available');
240
+ }
241
+ if (!texts || texts.length === 0) {
242
+ return [];
243
+ }
244
+ const validTexts = texts
245
+ .map(t => t?.trim())
246
+ .filter(t => t && t.length > 0);
247
+ if (validTexts.length === 0) {
248
+ return [];
249
+ }
250
+ try {
251
+ const mistral = (0, mistral_1.createMistral)({ apiKey: this.apiKey });
252
+ const model = mistral.textEmbedding(this.model);
253
+ const results = await Promise.all(validTexts.map(text => (0, ai_1.embed)({
254
+ model,
255
+ value: text
256
+ })));
257
+ return results.map(result => result.embedding);
258
+ }
259
+ catch (error) {
260
+ if (error instanceof Error) {
261
+ throw new Error(`Mistral batch embedding failed: ${error.message}`);
262
+ }
263
+ throw new Error(`Mistral batch embedding failed: ${String(error)}`);
264
+ }
265
+ }
266
+ isAvailable() {
267
+ return this.available;
268
+ }
269
+ getDimensions() {
270
+ return this.dimensions;
271
+ }
272
+ getModel() {
273
+ return this.model;
274
+ }
275
+ }
276
+ exports.MistralEmbeddingProvider = MistralEmbeddingProvider;
277
+ /**
278
+ * Factory function to create embedding provider based on configuration
279
+ */
280
+ function createEmbeddingProvider(config = {}) {
281
+ const provider = config.provider || process.env.EMBEDDINGS_PROVIDER || 'openai';
282
+ try {
283
+ switch (provider.toLowerCase()) {
284
+ case 'google': {
285
+ const googleProvider = new GoogleEmbeddingProvider(config);
286
+ return googleProvider.isAvailable() ? googleProvider : null;
287
+ }
288
+ case 'mistral': {
289
+ const mistralProvider = new MistralEmbeddingProvider(config);
290
+ return mistralProvider.isAvailable() ? mistralProvider : null;
291
+ }
292
+ case 'openai':
293
+ default: {
294
+ const openaiProvider = new OpenAIEmbeddingProvider(config);
295
+ return openaiProvider.isAvailable() ? openaiProvider : null;
296
+ }
297
+ }
298
+ }
299
+ catch (error) {
300
+ return null;
301
+ }
302
+ }
303
+ /**
304
+ * Main Embedding Service
305
+ * Provides optional semantic search capabilities with graceful degradation
306
+ */
307
+ class EmbeddingService {
308
+ provider;
309
+ constructor(config = {}) {
310
+ // Use factory to initialize appropriate provider
311
+ this.provider = createEmbeddingProvider(config);
312
+ }
120
313
  /**
121
314
  * Generate embedding for text
122
315
  * Throws error if embeddings not available or generation fails
@@ -167,18 +360,38 @@ class EmbeddingService {
167
360
  */
168
361
  getStatus() {
169
362
  if (this.isAvailable()) {
170
- const openaiProvider = this.provider;
363
+ // Determine provider type based on instance
364
+ let providerName;
365
+ if (this.provider instanceof GoogleEmbeddingProvider) {
366
+ providerName = 'google';
367
+ }
368
+ else if (this.provider instanceof MistralEmbeddingProvider) {
369
+ providerName = 'mistral';
370
+ }
371
+ else if (this.provider instanceof OpenAIEmbeddingProvider) {
372
+ providerName = 'openai';
373
+ }
374
+ else {
375
+ providerName = 'unknown';
376
+ }
171
377
  return {
172
378
  available: true,
173
- provider: 'openai',
174
- model: openaiProvider.getModel(),
175
- dimensions: openaiProvider.getDimensions()
379
+ provider: providerName,
380
+ model: this.provider.getModel(),
381
+ dimensions: this.provider.getDimensions()
176
382
  };
177
383
  }
384
+ const requestedProvider = process.env.EMBEDDINGS_PROVIDER || 'openai';
385
+ const keyMap = {
386
+ 'openai': 'OPENAI_API_KEY',
387
+ 'google': 'GOOGLE_API_KEY',
388
+ 'mistral': 'MISTRAL_API_KEY'
389
+ };
390
+ const requiredKey = keyMap[requestedProvider] || 'OPENAI_API_KEY';
178
391
  return {
179
392
  available: false,
180
393
  provider: null,
181
- reason: 'OPENAI_API_KEY not set - vector operations will fail'
394
+ reason: `${requiredKey} not set - vector operations will fail`
182
395
  };
183
396
  }
184
397
  /**
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Centralized Model Configuration
3
+ *
4
+ * Single source of truth for model versions currently used across the system.
5
+ * Update versions here to change them everywhere.
6
+ */
7
+ export declare const CURRENT_MODELS: {
8
+ readonly anthropic: "claude-sonnet-4-5-20250929";
9
+ readonly anthropic_haiku: "claude-haiku-4-5-20251001";
10
+ readonly openai: "gpt-5";
11
+ readonly openai_pro: "gpt-5-pro";
12
+ readonly google: "gemini-2.5-pro";
13
+ readonly google_fast: "gemini-2.5-flash";
14
+ readonly xai: "grok-4";
15
+ readonly xai_fast: "grok-4-fast-reasoning";
16
+ readonly mistral: "mistral-large-latest";
17
+ readonly deepseek: "deepseek-reasoner";
18
+ };
19
+ /**
20
+ * Get current model for a provider
21
+ */
22
+ export declare function getCurrentModel(provider: keyof typeof CURRENT_MODELS): string;
23
+ //# sourceMappingURL=model-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../src/core/model-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,OAAO,cAAc,GAAG,MAAM,CAE7E"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * Centralized Model Configuration
4
+ *
5
+ * Single source of truth for model versions currently used across the system.
6
+ * Update versions here to change them everywhere.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.CURRENT_MODELS = void 0;
10
+ exports.getCurrentModel = getCurrentModel;
11
+ exports.CURRENT_MODELS = {
12
+ anthropic: 'claude-sonnet-4-5-20250929',
13
+ anthropic_haiku: 'claude-haiku-4-5-20251001',
14
+ openai: 'gpt-5',
15
+ openai_pro: 'gpt-5-pro',
16
+ google: 'gemini-2.5-pro',
17
+ google_fast: 'gemini-2.5-flash',
18
+ xai: 'grok-4',
19
+ xai_fast: 'grok-4-fast-reasoning',
20
+ mistral: 'mistral-large-latest',
21
+ deepseek: 'deepseek-reasoner'
22
+ };
23
+ /**
24
+ * Get current model for a provider
25
+ */
26
+ function getCurrentModel(provider) {
27
+ return exports.CURRENT_MODELS[provider];
28
+ }