@vfarcic/dot-ai 0.104.0 → 0.106.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.
- package/README.md +6 -1
- package/dist/core/ai-provider-factory.d.ts +90 -0
- package/dist/core/ai-provider-factory.d.ts.map +1 -0
- package/dist/core/ai-provider-factory.js +187 -0
- package/dist/core/ai-provider.interface.d.ts +208 -0
- package/dist/core/ai-provider.interface.d.ts.map +1 -0
- package/dist/core/ai-provider.interface.js +14 -0
- package/dist/core/capabilities.d.ts +3 -3
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/capabilities.js +4 -4
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +29 -14
- package/dist/core/doc-testing-session.d.ts +1 -1
- package/dist/core/doc-testing-session.js +1 -1
- package/dist/core/error-handling.js +2 -2
- package/dist/core/index.d.ts +4 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +11 -22
- package/dist/core/platform-operations.d.ts +9 -15
- package/dist/core/platform-operations.d.ts.map +1 -1
- package/dist/core/platform-operations.js +28 -49
- package/dist/core/platform-utils.d.ts +16 -0
- package/dist/core/platform-utils.d.ts.map +1 -0
- package/dist/core/platform-utils.js +68 -0
- package/dist/core/providers/anthropic-provider.d.ts +44 -0
- package/dist/core/providers/anthropic-provider.d.ts.map +1 -0
- package/dist/core/providers/anthropic-provider.js +281 -0
- package/dist/core/providers/provider-debug-utils.d.ts +27 -0
- package/dist/core/providers/provider-debug-utils.d.ts.map +1 -0
- package/dist/core/providers/provider-debug-utils.js +122 -0
- package/dist/core/providers/vercel-provider.d.ts +47 -0
- package/dist/core/providers/vercel-provider.d.ts.map +1 -0
- package/dist/core/providers/vercel-provider.js +152 -0
- package/dist/core/schema.d.ts +4 -7
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +13 -11
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +13 -14
- package/dist/interfaces/mcp.d.ts +1 -1
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +29 -8
- package/dist/interfaces/rest-api.js +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +8 -10
- package/dist/tools/build-platform.js +3 -3
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +7 -8
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +3 -2
- package/dist/tools/platform/discover-operations.tool.d.ts +35 -0
- package/dist/tools/platform/discover-operations.tool.d.ts.map +1 -0
- package/dist/tools/platform/discover-operations.tool.js +88 -0
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +50 -30
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +23 -39
- package/dist/tools/version.d.ts +3 -2
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +35 -23
- package/package.json +5 -2
- package/prompts/{parse-script-operations.md → platform-operations-parse-script-help.md} +4 -8
- package/prompts/question-generation.md +31 -3
- package/dist/core/claude.d.ts +0 -88
- package/dist/core/claude.d.ts.map +0 -1
- package/dist/core/claude.js +0 -414
package/README.md
CHANGED
|
@@ -22,10 +22,13 @@ DevOps AI Toolkit is an AI-powered development productivity platform that enhanc
|
|
|
22
22
|
- **SRE Teams**: Automate root cause analysis and generate executable remediation commands
|
|
23
23
|
- **Support Teams**: Handle incident response with AI-guided investigation and repair workflows
|
|
24
24
|
|
|
25
|
+
<!--
|
|
25
26
|
### Platform Building
|
|
27
|
+
DEVELOPER NOTE: This tool is under active development with incomplete functionality. Not recommended for production use.
|
|
26
28
|
- **Platform Engineers**: Install and configure platform tools conversationally without memorizing script paths and commands
|
|
27
29
|
- **New Team Members**: Build platform infrastructure through zero-knowledge guided workflows
|
|
28
30
|
- **DevOps Teams**: Create and manage Kubernetes clusters through natural language interactions
|
|
31
|
+
-->
|
|
29
32
|
|
|
30
33
|
### Documentation Testing
|
|
31
34
|
- **Documentation Maintainers**: Automatically validate documentation accuracy and catch outdated content
|
|
@@ -84,7 +87,9 @@ Result: Finds sqls.devopstoolkit.live as perfect match ✨
|
|
|
84
87
|
|
|
85
88
|
📖 [Learn more →](./docs/mcp-remediate-guide.md)
|
|
86
89
|
|
|
90
|
+
<!--
|
|
87
91
|
### Platform Building
|
|
92
|
+
DEVELOPER NOTE: This tool is under active development with incomplete functionality. Not recommended for production use.
|
|
88
93
|
🗣️ **Natural Language Operations**: Install tools and create clusters through conversation without memorizing commands
|
|
89
94
|
🔍 **Dynamic Discovery**: Automatically discovers 21+ available platform operations from infrastructure scripts
|
|
90
95
|
🤖 **AI-Powered Intent Mapping**: Understands variations like "Install Argo CD", "Set up ArgoCD", "Deploy Argo CD"
|
|
@@ -92,6 +97,7 @@ Result: Finds sqls.devopstoolkit.live as perfect match ✨
|
|
|
92
97
|
🎯 **Zero-Knowledge Onboarding**: New users successfully build platforms without documentation
|
|
93
98
|
|
|
94
99
|
📖 [Learn more →](./docs/mcp-build-platform-guide.md)
|
|
100
|
+
-->
|
|
95
101
|
|
|
96
102
|
### Documentation Testing & Validation
|
|
97
103
|
📖 **Automated Testing**: Validates documentation by executing commands and testing examples
|
|
@@ -181,4 +187,3 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
181
187
|
---
|
|
182
188
|
|
|
183
189
|
**DevOps AI Toolkit** - AI-powered development productivity platform for enhanced software development workflows.
|
|
184
|
-
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Provider Factory
|
|
3
|
+
*
|
|
4
|
+
* Creates AI provider instances based on configuration.
|
|
5
|
+
* Supports environment-based provider selection and extensible provider architecture.
|
|
6
|
+
*
|
|
7
|
+
* Phase 1 Implementation (PRD 73): anthropic, openai, google
|
|
8
|
+
* Architecture supports future expansion to 19+ Vercel AI SDK providers
|
|
9
|
+
*/
|
|
10
|
+
import { AIProvider, AIProviderConfig } from './ai-provider.interface';
|
|
11
|
+
/**
|
|
12
|
+
* Factory for creating AI provider instances
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Explicit provider selection
|
|
17
|
+
* const provider = AIProviderFactory.create({
|
|
18
|
+
* provider: 'anthropic',
|
|
19
|
+
* apiKey: process.env.ANTHROPIC_API_KEY
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // Auto-detect from environment
|
|
23
|
+
* const provider = AIProviderFactory.createFromEnv();
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class AIProviderFactory {
|
|
27
|
+
/**
|
|
28
|
+
* Create an AI provider instance with explicit configuration
|
|
29
|
+
*
|
|
30
|
+
* @param config Provider configuration
|
|
31
|
+
* @returns Configured AI provider instance
|
|
32
|
+
* @throws Error if provider type is unsupported or configuration is invalid
|
|
33
|
+
*/
|
|
34
|
+
static create(config: AIProviderConfig): AIProvider;
|
|
35
|
+
/**
|
|
36
|
+
* Create provider from environment variables
|
|
37
|
+
*
|
|
38
|
+
* Detects provider from AI_PROVIDER env var (defaults to 'anthropic')
|
|
39
|
+
* and loads corresponding API key from environment.
|
|
40
|
+
*
|
|
41
|
+
* Supports AI_PROVIDER_SDK env var to override SDK choice:
|
|
42
|
+
* - 'native' (default): Use native provider SDK
|
|
43
|
+
* - 'vercel': Use Vercel AI SDK for the provider
|
|
44
|
+
*
|
|
45
|
+
* @returns Configured AI provider instance
|
|
46
|
+
* @throws Error if required environment variables are missing
|
|
47
|
+
*/
|
|
48
|
+
static createFromEnv(): AIProvider;
|
|
49
|
+
/**
|
|
50
|
+
* Create Anthropic provider instance
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
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
|
+
/**
|
|
65
|
+
* Check if a provider is available (has API key configured)
|
|
66
|
+
*
|
|
67
|
+
* @param provider Provider type to check
|
|
68
|
+
* @returns true if provider has API key configured
|
|
69
|
+
*/
|
|
70
|
+
static isProviderAvailable(provider: string): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Get list of available providers (implemented + have API keys configured)
|
|
73
|
+
*
|
|
74
|
+
* @returns Array of available provider types
|
|
75
|
+
*/
|
|
76
|
+
static getAvailableProviders(): string[];
|
|
77
|
+
/**
|
|
78
|
+
* Check if a provider is implemented in current phase
|
|
79
|
+
*
|
|
80
|
+
* @param provider Provider type to check
|
|
81
|
+
* @returns true if provider is implemented
|
|
82
|
+
*/
|
|
83
|
+
static isProviderImplemented(provider: string): boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Convenience function to create AI provider from environment
|
|
87
|
+
* Maintains backward compatibility with existing code
|
|
88
|
+
*/
|
|
89
|
+
export declare function createAIProvider(): AIProvider;
|
|
90
|
+
//# sourceMappingURL=ai-provider-factory.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Provider Factory
|
|
4
|
+
*
|
|
5
|
+
* Creates AI provider instances based on configuration.
|
|
6
|
+
* Supports environment-based provider selection and extensible provider architecture.
|
|
7
|
+
*
|
|
8
|
+
* Phase 1 Implementation (PRD 73): anthropic, openai, google
|
|
9
|
+
* Architecture supports future expansion to 19+ Vercel AI SDK providers
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AIProviderFactory = void 0;
|
|
13
|
+
exports.createAIProvider = createAIProvider;
|
|
14
|
+
const anthropic_provider_1 = require("./providers/anthropic-provider");
|
|
15
|
+
const vercel_provider_1 = require("./providers/vercel-provider");
|
|
16
|
+
/**
|
|
17
|
+
* Provider environment variable mappings
|
|
18
|
+
* Phase 1 (PRD 73): anthropic, openai, google
|
|
19
|
+
*/
|
|
20
|
+
const PROVIDER_ENV_KEYS = {
|
|
21
|
+
anthropic: 'ANTHROPIC_API_KEY',
|
|
22
|
+
openai: 'OPENAI_API_KEY',
|
|
23
|
+
google: 'GOOGLE_API_KEY',
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Providers implemented in Phase 1
|
|
27
|
+
*/
|
|
28
|
+
const IMPLEMENTED_PROVIDERS = ['anthropic', 'openai', 'google'];
|
|
29
|
+
/**
|
|
30
|
+
* Factory for creating AI provider instances
|
|
31
|
+
*
|
|
32
|
+
* Usage:
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Explicit provider selection
|
|
35
|
+
* const provider = AIProviderFactory.create({
|
|
36
|
+
* provider: 'anthropic',
|
|
37
|
+
* apiKey: process.env.ANTHROPIC_API_KEY
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Auto-detect from environment
|
|
41
|
+
* const provider = AIProviderFactory.createFromEnv();
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
class AIProviderFactory {
|
|
45
|
+
/**
|
|
46
|
+
* Create an AI provider instance with explicit configuration
|
|
47
|
+
*
|
|
48
|
+
* @param config Provider configuration
|
|
49
|
+
* @returns Configured AI provider instance
|
|
50
|
+
* @throws Error if provider type is unsupported or configuration is invalid
|
|
51
|
+
*/
|
|
52
|
+
static create(config) {
|
|
53
|
+
// Validate configuration
|
|
54
|
+
if (!config.apiKey) {
|
|
55
|
+
throw new Error(`API key is required for ${config.provider} provider`);
|
|
56
|
+
}
|
|
57
|
+
if (!config.provider) {
|
|
58
|
+
throw new Error('Provider type must be specified');
|
|
59
|
+
}
|
|
60
|
+
// Check if provider is implemented in Phase 1
|
|
61
|
+
if (!IMPLEMENTED_PROVIDERS.includes(config.provider)) {
|
|
62
|
+
throw new Error(`Provider '${config.provider}' is not yet implemented. ` +
|
|
63
|
+
`Phase 1 providers: ${IMPLEMENTED_PROVIDERS.join(', ')}. ` +
|
|
64
|
+
`Future phases will add support for additional Vercel AI SDK providers.`);
|
|
65
|
+
}
|
|
66
|
+
// Create provider based on type
|
|
67
|
+
switch (config.provider) {
|
|
68
|
+
case 'anthropic':
|
|
69
|
+
return this.createAnthropicProvider(config);
|
|
70
|
+
case 'openai':
|
|
71
|
+
return this.createOpenAIProvider(config);
|
|
72
|
+
case 'google':
|
|
73
|
+
return this.createGoogleProvider(config);
|
|
74
|
+
default:
|
|
75
|
+
// This should never happen due to IMPLEMENTED_PROVIDERS check above
|
|
76
|
+
throw new Error(`Unsupported provider: ${config.provider}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create provider from environment variables
|
|
81
|
+
*
|
|
82
|
+
* Detects provider from AI_PROVIDER env var (defaults to 'anthropic')
|
|
83
|
+
* and loads corresponding API key from environment.
|
|
84
|
+
*
|
|
85
|
+
* Supports AI_PROVIDER_SDK env var to override SDK choice:
|
|
86
|
+
* - 'native' (default): Use native provider SDK
|
|
87
|
+
* - 'vercel': Use Vercel AI SDK for the provider
|
|
88
|
+
*
|
|
89
|
+
* @returns Configured AI provider instance
|
|
90
|
+
* @throws Error if required environment variables are missing
|
|
91
|
+
*/
|
|
92
|
+
static createFromEnv() {
|
|
93
|
+
const providerType = process.env.AI_PROVIDER || 'anthropic';
|
|
94
|
+
const sdkPreference = process.env.AI_PROVIDER_SDK || 'native';
|
|
95
|
+
// Validate provider is implemented
|
|
96
|
+
if (!IMPLEMENTED_PROVIDERS.includes(providerType)) {
|
|
97
|
+
throw new Error(`Invalid AI_PROVIDER: ${providerType}. ` +
|
|
98
|
+
`Must be one of: ${IMPLEMENTED_PROVIDERS.join(', ')}`);
|
|
99
|
+
}
|
|
100
|
+
// Get API key for the provider
|
|
101
|
+
const apiKeyEnvVar = PROVIDER_ENV_KEYS[providerType];
|
|
102
|
+
if (!apiKeyEnvVar) {
|
|
103
|
+
throw new Error(`No API key environment variable defined for provider: ${providerType}`);
|
|
104
|
+
}
|
|
105
|
+
const apiKey = process.env[apiKeyEnvVar];
|
|
106
|
+
if (!apiKey) {
|
|
107
|
+
throw new Error(`${apiKeyEnvVar} environment variable must be set for ${providerType} provider`);
|
|
108
|
+
}
|
|
109
|
+
// Get optional model override
|
|
110
|
+
const model = process.env.AI_MODEL;
|
|
111
|
+
// Get debug mode setting
|
|
112
|
+
const debugMode = process.env.DEBUG_DOT_AI === 'true';
|
|
113
|
+
// If SDK override to 'vercel', use VercelProvider for all providers
|
|
114
|
+
if (sdkPreference === 'vercel') {
|
|
115
|
+
return new vercel_provider_1.VercelProvider({
|
|
116
|
+
provider: providerType,
|
|
117
|
+
apiKey,
|
|
118
|
+
model,
|
|
119
|
+
debugMode
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return this.create({
|
|
123
|
+
provider: providerType,
|
|
124
|
+
apiKey,
|
|
125
|
+
model,
|
|
126
|
+
debugMode
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Create Anthropic provider instance
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
static createAnthropicProvider(config) {
|
|
134
|
+
return new anthropic_provider_1.AnthropicProvider(config);
|
|
135
|
+
}
|
|
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
|
+
/**
|
|
151
|
+
* Check if a provider is available (has API key configured)
|
|
152
|
+
*
|
|
153
|
+
* @param provider Provider type to check
|
|
154
|
+
* @returns true if provider has API key configured
|
|
155
|
+
*/
|
|
156
|
+
static isProviderAvailable(provider) {
|
|
157
|
+
const apiKeyEnvVar = PROVIDER_ENV_KEYS[provider];
|
|
158
|
+
if (!apiKeyEnvVar)
|
|
159
|
+
return false;
|
|
160
|
+
return !!process.env[apiKeyEnvVar];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get list of available providers (implemented + have API keys configured)
|
|
164
|
+
*
|
|
165
|
+
* @returns Array of available provider types
|
|
166
|
+
*/
|
|
167
|
+
static getAvailableProviders() {
|
|
168
|
+
return IMPLEMENTED_PROVIDERS.filter(provider => this.isProviderAvailable(provider));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Check if a provider is implemented in current phase
|
|
172
|
+
*
|
|
173
|
+
* @param provider Provider type to check
|
|
174
|
+
* @returns true if provider is implemented
|
|
175
|
+
*/
|
|
176
|
+
static isProviderImplemented(provider) {
|
|
177
|
+
return IMPLEMENTED_PROVIDERS.includes(provider);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
exports.AIProviderFactory = AIProviderFactory;
|
|
181
|
+
/**
|
|
182
|
+
* Convenience function to create AI provider from environment
|
|
183
|
+
* Maintains backward compatibility with existing code
|
|
184
|
+
*/
|
|
185
|
+
function createAIProvider() {
|
|
186
|
+
return AIProviderFactory.createFromEnv();
|
|
187
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Provider Interface
|
|
3
|
+
*
|
|
4
|
+
* Provider-agnostic abstraction for AI services supporting multiple providers
|
|
5
|
+
* through Vercel AI SDK (19+ providers supported).
|
|
6
|
+
*
|
|
7
|
+
* This interface is extracted from actual ClaudeIntegration usage patterns
|
|
8
|
+
* across the codebase, ensuring backward compatibility and minimal migration effort.
|
|
9
|
+
*
|
|
10
|
+
* Phase 1 Implementation (PRD 73): Anthropic, OpenAI, Google
|
|
11
|
+
* Future: AWS Bedrock, Mistral, Groq, Ollama, etc.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Standard AI response structure
|
|
15
|
+
*/
|
|
16
|
+
export interface AIResponse {
|
|
17
|
+
content: string;
|
|
18
|
+
usage: {
|
|
19
|
+
input_tokens: number;
|
|
20
|
+
output_tokens: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Impact level for clarification opportunities
|
|
25
|
+
*/
|
|
26
|
+
export type ImpactLevel = 'HIGH' | 'MEDIUM' | 'LOW';
|
|
27
|
+
/**
|
|
28
|
+
* Clarification category types
|
|
29
|
+
*/
|
|
30
|
+
export type ClarificationCategory = 'TECHNICAL_SPECIFICATIONS' | 'ARCHITECTURAL_CONTEXT' | 'OPERATIONAL_REQUIREMENTS' | 'SECURITY_COMPLIANCE' | 'ORGANIZATIONAL_ALIGNMENT';
|
|
31
|
+
/**
|
|
32
|
+
* Clarification opportunity structure
|
|
33
|
+
*/
|
|
34
|
+
export interface ClarificationOpportunity {
|
|
35
|
+
category: ClarificationCategory;
|
|
36
|
+
missingContext: string;
|
|
37
|
+
impactLevel: ImpactLevel;
|
|
38
|
+
reasoning: string;
|
|
39
|
+
suggestedQuestions?: string[];
|
|
40
|
+
patternAlignment?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Intent analysis result structure
|
|
44
|
+
*/
|
|
45
|
+
export interface IntentAnalysisResult {
|
|
46
|
+
clarificationOpportunities: ClarificationOpportunity[];
|
|
47
|
+
overallAssessment: {
|
|
48
|
+
enhancementPotential: ImpactLevel;
|
|
49
|
+
primaryGaps: string[];
|
|
50
|
+
recommendedFocus: string;
|
|
51
|
+
};
|
|
52
|
+
intentQuality: {
|
|
53
|
+
currentSpecificity: string;
|
|
54
|
+
strengthAreas: string[];
|
|
55
|
+
improvementAreas: string[];
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* AI Provider configuration
|
|
60
|
+
*/
|
|
61
|
+
export interface AIProviderConfig {
|
|
62
|
+
/** API key for the provider */
|
|
63
|
+
apiKey: string;
|
|
64
|
+
/** Provider type (extensible string - supports any Vercel AI SDK provider) */
|
|
65
|
+
provider: string;
|
|
66
|
+
/** Optional model override (defaults to provider-specific default) */
|
|
67
|
+
model?: string;
|
|
68
|
+
/** Enable debug mode for logging AI interactions */
|
|
69
|
+
debugMode?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Tool definition for AI providers
|
|
73
|
+
* Defines a tool that the AI can call during agentic loops
|
|
74
|
+
*/
|
|
75
|
+
export interface AITool {
|
|
76
|
+
/** Unique tool name (e.g., 'kubectl_get', 'search_capabilities') */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Human-readable description of what the tool does and when to use it */
|
|
79
|
+
description: string;
|
|
80
|
+
/** JSON schema for tool input parameters */
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object';
|
|
83
|
+
properties: Record<string, any>;
|
|
84
|
+
required?: string[];
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Tool executor function type
|
|
89
|
+
* Called by the provider when AI requests a tool execution
|
|
90
|
+
*/
|
|
91
|
+
export type ToolExecutor = (toolName: string, input: any) => Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* Configuration for agentic tool loop
|
|
94
|
+
*/
|
|
95
|
+
export interface ToolLoopConfig {
|
|
96
|
+
/** System prompt with context and strategic guidance */
|
|
97
|
+
systemPrompt: string;
|
|
98
|
+
/** User message/query to respond to */
|
|
99
|
+
userMessage: string;
|
|
100
|
+
/** Available tools for this workflow (scoped to workflow needs) */
|
|
101
|
+
tools: AITool[];
|
|
102
|
+
/** Function to execute tool calls */
|
|
103
|
+
toolExecutor: ToolExecutor;
|
|
104
|
+
/** Maximum number of AI iterations (default: 20) */
|
|
105
|
+
maxIterations?: number;
|
|
106
|
+
/** Optional callback invoked after each iteration */
|
|
107
|
+
onIteration?: (iteration: number, toolCalls: any[]) => void;
|
|
108
|
+
/** Optional operation identifier for metrics and debugging */
|
|
109
|
+
operation?: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Result from agentic tool loop
|
|
113
|
+
*/
|
|
114
|
+
export interface AgenticResult {
|
|
115
|
+
/** Final text response from AI after completing tool loop */
|
|
116
|
+
finalMessage: string;
|
|
117
|
+
/** Number of iterations executed */
|
|
118
|
+
iterations: number;
|
|
119
|
+
/** All tool calls executed during the loop */
|
|
120
|
+
toolCallsExecuted: Array<{
|
|
121
|
+
tool: string;
|
|
122
|
+
input: any;
|
|
123
|
+
output: any;
|
|
124
|
+
}>;
|
|
125
|
+
/** Token usage statistics */
|
|
126
|
+
totalTokens: {
|
|
127
|
+
input: number;
|
|
128
|
+
output: number;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* AI Provider Interface
|
|
133
|
+
*
|
|
134
|
+
* Minimal interface based on actual usage across 10 dependent files.
|
|
135
|
+
* Only includes methods that are currently called in production code.
|
|
136
|
+
*/
|
|
137
|
+
export interface AIProvider {
|
|
138
|
+
/**
|
|
139
|
+
* Send a message to the AI service
|
|
140
|
+
*
|
|
141
|
+
* Primary method for all AI interactions. Supports streaming for long operations.
|
|
142
|
+
* Used in: recommend.ts, answer-question.ts, generate-manifests.ts, remediate.ts,
|
|
143
|
+
* schema.ts, unified-creation-session.ts, platform-operations.ts
|
|
144
|
+
*
|
|
145
|
+
* @param message The message/prompt to send
|
|
146
|
+
* @param operation Optional operation identifier for debugging (e.g., 'deployment', 'intent-analysis')
|
|
147
|
+
* @returns AI response with content and usage statistics
|
|
148
|
+
*/
|
|
149
|
+
sendMessage(message: string, operation?: string): Promise<AIResponse>;
|
|
150
|
+
/**
|
|
151
|
+
* Check if the provider is properly initialized
|
|
152
|
+
*
|
|
153
|
+
* Used in: schema.ts (pre-flight check before AI calls)
|
|
154
|
+
*
|
|
155
|
+
* @returns true if provider is ready to use, false otherwise
|
|
156
|
+
*/
|
|
157
|
+
isInitialized(): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Get the default model for this provider
|
|
160
|
+
*
|
|
161
|
+
* NEW: Required to replace hardcoded model at claude.ts:181
|
|
162
|
+
* Each provider has different model naming conventions.
|
|
163
|
+
*
|
|
164
|
+
* @returns Model identifier (e.g., 'claude-sonnet-4-5', 'gpt-4o', 'gemini-1.5-pro')
|
|
165
|
+
*/
|
|
166
|
+
getDefaultModel(): string;
|
|
167
|
+
/**
|
|
168
|
+
* Get the provider type
|
|
169
|
+
*
|
|
170
|
+
* NEW: Useful for debugging and logging
|
|
171
|
+
*
|
|
172
|
+
* @returns Provider identifier (e.g., 'anthropic', 'openai', 'google')
|
|
173
|
+
*/
|
|
174
|
+
getProviderType(): string;
|
|
175
|
+
/**
|
|
176
|
+
* Execute agentic loop with tool calling (NEW - PRD #136)
|
|
177
|
+
*
|
|
178
|
+
* AI autonomously decides which tools to call and when to stop.
|
|
179
|
+
* Supports multi-turn conversations with tool execution.
|
|
180
|
+
*
|
|
181
|
+
* NOTE: Currently NOT USED in codebase. PRD #136 analysis showed JSON-based loops
|
|
182
|
+
* achieve same goals without SDK overhead. Kept for potential future use.
|
|
183
|
+
*
|
|
184
|
+
* IMPLEMENTATION STATUS:
|
|
185
|
+
* - AnthropicProvider: ✅ Implemented
|
|
186
|
+
* - VercelAIProvider: ❌ Not implemented (not needed for current workflows)
|
|
187
|
+
*
|
|
188
|
+
* @param config Tool loop configuration with system prompt, tools, and executor
|
|
189
|
+
* @returns Agentic result with final message, iterations, tool calls, and token usage
|
|
190
|
+
*/
|
|
191
|
+
toolLoop(config: ToolLoopConfig): Promise<AgenticResult>;
|
|
192
|
+
/**
|
|
193
|
+
* Single-shot message with tool calling enabled (NEW - PRD #136)
|
|
194
|
+
*
|
|
195
|
+
* AI can call tools, but only processes one round.
|
|
196
|
+
* Useful for simple tool use cases that don't require iteration.
|
|
197
|
+
*
|
|
198
|
+
* @param message The message/prompt to send
|
|
199
|
+
* @param tools Available tools for this request
|
|
200
|
+
* @param toolExecutor Function to execute tool calls
|
|
201
|
+
* @param operation Optional operation identifier for debugging
|
|
202
|
+
* @returns AI response with content, usage, and any tool calls made
|
|
203
|
+
*/
|
|
204
|
+
sendMessageWithTools(message: string, tools: AITool[], toolExecutor: ToolExecutor, operation?: string): Promise<AIResponse & {
|
|
205
|
+
toolCalls?: any[];
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=ai-provider.interface.d.ts.map
|
|
@@ -0,0 +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;KACvB,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,qBAAqB,GACrB,0BAA0B,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0BAA0B,EAAE,wBAAwB,EAAE,CAAC;IACvD,iBAAiB,EAAE;QACjB,oBAAoB,EAAE,WAAW,CAAC;QAClC,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,aAAa,EAAE;QACb,kBAAkB,EAAE,MAAM,CAAC;QAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IAEf,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IAEjB,s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AAE,GAAG,CAAC;KACb,CAAC,CAAC;IAEH,6BAA6B;IAC7B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEtE;;;;;;OAMG;IACH,aAAa,IAAI,OAAO,CAAC;IAEzB;;;;;;;OAOG;IACH,eAAe,IAAI,MAAM,CAAC;IAE1B;;;;;;OAMG;IACH,eAAe,IAAI,MAAM,CAAC;IAE1B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAEzD;;;;;;;;;;;OAWG;IACH,oBAAoB,CAClB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EAAE,EACf,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,GAAG;QAAE,SAAS,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC,CAAC;CAChD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI Provider Interface
|
|
4
|
+
*
|
|
5
|
+
* Provider-agnostic abstraction for AI services supporting multiple providers
|
|
6
|
+
* through Vercel AI SDK (19+ providers supported).
|
|
7
|
+
*
|
|
8
|
+
* This interface is extracted from actual ClaudeIntegration usage patterns
|
|
9
|
+
* across the codebase, ensuring backward compatibility and minimal migration effort.
|
|
10
|
+
*
|
|
11
|
+
* Phase 1 Implementation (PRD 73): Anthropic, OpenAI, Google
|
|
12
|
+
* Future: AWS Bedrock, Mistral, Groq, Ollama, etc.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* AI-powered analysis of schemas and metadata.
|
|
8
8
|
*/
|
|
9
9
|
import { Logger } from './error-handling';
|
|
10
|
-
import {
|
|
10
|
+
import { AIProvider } from './ai-provider.interface';
|
|
11
11
|
/**
|
|
12
12
|
* Complete resource capability data structure for Vector DB storage
|
|
13
13
|
*/
|
|
@@ -31,8 +31,8 @@ export interface ResourceCapability {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare class CapabilityInferenceEngine {
|
|
33
33
|
private logger;
|
|
34
|
-
private
|
|
35
|
-
constructor(
|
|
34
|
+
private aiProvider;
|
|
35
|
+
constructor(aiProvider: AIProvider, logger: Logger);
|
|
36
36
|
/**
|
|
37
37
|
* Main entry point: analyze resource to infer complete capabilities
|
|
38
38
|
*
|
|
@@ -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,
|
|
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;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAGtC,WAAW,EAAE,MAAM,CAAC;IACpB,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,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IA2B9B;;;;OAIG;YACW,WAAW;IA0BzB;;;;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"}
|
|
@@ -18,9 +18,9 @@ const shared_prompt_loader_1 = require("./shared-prompt-loader");
|
|
|
18
18
|
*/
|
|
19
19
|
class CapabilityInferenceEngine {
|
|
20
20
|
logger;
|
|
21
|
-
|
|
22
|
-
constructor(
|
|
23
|
-
this.
|
|
21
|
+
aiProvider;
|
|
22
|
+
constructor(aiProvider, logger) {
|
|
23
|
+
this.aiProvider = aiProvider;
|
|
24
24
|
this.logger = logger;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
@@ -58,7 +58,7 @@ class CapabilityInferenceEngine {
|
|
|
58
58
|
async inferWithAI(resourceName, resourceDefinition, requestId) {
|
|
59
59
|
try {
|
|
60
60
|
const prompt = await this.buildInferencePrompt(resourceName, resourceDefinition);
|
|
61
|
-
const response = await this.
|
|
61
|
+
const response = await this.aiProvider.sendMessage(prompt);
|
|
62
62
|
return this.parseCapabilitiesFromAI(response.content);
|
|
63
63
|
}
|
|
64
64
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-sc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sCAAsC,EAAE,wCAAwC,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7Y,OAAO,CAAC,GAAG,CAAC,CAuCd;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,uBAAuB,EAC1C,oBAAoB,EAAE,sBAAsB,EAC5C,2BAA2B,EAAE,6BAA6B,EAC1D,wBAAwB,EAAE,0BAA0B,EACpD,sCAAsC,EAAE,wCAAwC,GAC/E,OAAO,CAAC,GAAG,CAAC,CA8gBd"}
|
|
@@ -12,7 +12,7 @@ exports.handleProcessingMode = handleProcessingMode;
|
|
|
12
12
|
exports.handleScanning = handleScanning;
|
|
13
13
|
const discovery_1 = require("./discovery");
|
|
14
14
|
const capabilities_1 = require("./capabilities");
|
|
15
|
-
const
|
|
15
|
+
const ai_provider_factory_1 = require("./ai-provider-factory");
|
|
16
16
|
/**
|
|
17
17
|
* Create user-friendly error message for resource definition failures
|
|
18
18
|
*/
|
|
@@ -352,23 +352,38 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
|
|
|
352
352
|
}
|
|
353
353
|
// Import capability engine
|
|
354
354
|
// Already imported at top of file
|
|
355
|
-
// Validate
|
|
355
|
+
// Validate AI provider - skip in test environment
|
|
356
356
|
const isTestEnvironment = process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID;
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
357
|
+
if (!isTestEnvironment) {
|
|
358
|
+
try {
|
|
359
|
+
const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
|
|
360
|
+
if (!aiProvider.isInitialized()) {
|
|
361
|
+
return {
|
|
362
|
+
success: false,
|
|
363
|
+
operation: 'scan',
|
|
364
|
+
dataType: 'capabilities',
|
|
365
|
+
error: {
|
|
366
|
+
message: 'AI provider API key required for capability inference',
|
|
367
|
+
details: 'Configure AI provider credentials to enable AI-powered capability analysis'
|
|
368
|
+
}
|
|
369
|
+
};
|
|
366
370
|
}
|
|
367
|
-
}
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
return {
|
|
374
|
+
success: false,
|
|
375
|
+
operation: 'scan',
|
|
376
|
+
dataType: 'capabilities',
|
|
377
|
+
error: {
|
|
378
|
+
message: 'AI provider initialization failed',
|
|
379
|
+
details: error instanceof Error ? error.message : 'Unknown error'
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
}
|
|
368
383
|
}
|
|
369
384
|
// Initialize capability engine
|
|
370
|
-
const
|
|
371
|
-
const engine = new capabilities_1.CapabilityInferenceEngine(
|
|
385
|
+
const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
|
|
386
|
+
const engine = new capabilities_1.CapabilityInferenceEngine(aiProvider, logger);
|
|
372
387
|
// Get the resource to analyze
|
|
373
388
|
let resourceName;
|
|
374
389
|
let currentIndex;
|