@vfarcic/dot-ai 0.103.0 → 0.105.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 +14 -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 +116 -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/nushell-runtime.d.ts +39 -0
- package/dist/core/nushell-runtime.d.ts.map +1 -0
- package/dist/core/nushell-runtime.js +103 -0
- package/dist/core/platform-operations.d.ts +76 -0
- package/dist/core/platform-operations.d.ts.map +1 -0
- package/dist/core/platform-operations.js +317 -0
- package/dist/core/providers/anthropic-provider.d.ts +32 -0
- package/dist/core/providers/anthropic-provider.d.ts.map +1 -0
- package/dist/core/providers/anthropic-provider.js +177 -0
- package/dist/core/providers/vercel-provider.d.ts +34 -0
- package/dist/core/providers/vercel-provider.d.ts.map +1 -0
- package/dist/core/providers/vercel-provider.js +202 -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 +10 -2
- 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.d.ts +25 -0
- package/dist/tools/build-platform.d.ts.map +1 -0
- package/dist/tools/build-platform.js +277 -0
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +7 -8
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -1
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +3 -2
- 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 +10 -2
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +65 -24
- package/package.json +7 -3
- package/prompts/map-intent-to-operation.md +104 -0
- package/prompts/parse-script-operations.md +72 -0
- package/prompts/question-generation.md +31 -3
- package/scripts/ack.nu +195 -0
- package/scripts/anthropic.nu +24 -0
- package/scripts/argo-workflows.nu +47 -0
- package/scripts/argocd.nu +85 -0
- package/scripts/aso.nu +74 -0
- package/scripts/atlas.nu +15 -0
- package/scripts/backstage.nu +349 -0
- package/scripts/cert-manager.nu +13 -0
- package/scripts/cnpg.nu +14 -0
- package/scripts/common.nu +116 -0
- package/scripts/crossplane.nu +718 -0
- package/scripts/dot.nu +32 -0
- package/scripts/external-secrets.nu +110 -0
- package/scripts/gatekeeper.nu +19 -0
- package/scripts/github.nu +42 -0
- package/scripts/image.nu +67 -0
- package/scripts/ingress.nu +149 -0
- package/scripts/kro.nu +11 -0
- package/scripts/kubernetes.nu +609 -0
- package/scripts/kubevela.nu +22 -0
- package/scripts/kyverno.nu +16 -0
- package/scripts/mcp.nu +139 -0
- package/scripts/port.nu +71 -0
- package/scripts/prometheus.nu +21 -0
- package/scripts/registry.nu +55 -0
- package/scripts/storage.nu +210 -0
- package/scripts/tests.nu +12 -0
- package/scripts/toolhive.nu +21 -0
- package/scripts/velero.nu +45 -0
- 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,6 +22,11 @@ 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
|
+
### Platform Building
|
|
26
|
+
- **Platform Engineers**: Install and configure platform tools conversationally without memorizing script paths and commands
|
|
27
|
+
- **New Team Members**: Build platform infrastructure through zero-knowledge guided workflows
|
|
28
|
+
- **DevOps Teams**: Create and manage Kubernetes clusters through natural language interactions
|
|
29
|
+
|
|
25
30
|
### Documentation Testing
|
|
26
31
|
- **Documentation Maintainers**: Automatically validate documentation accuracy and catch outdated content
|
|
27
32
|
- **Technical Writers**: Identify which sections need updates and prioritize work effectively
|
|
@@ -79,6 +84,15 @@ Result: Finds sqls.devopstoolkit.live as perfect match ✨
|
|
|
79
84
|
|
|
80
85
|
📖 [Learn more →](./docs/mcp-remediate-guide.md)
|
|
81
86
|
|
|
87
|
+
### Platform Building
|
|
88
|
+
🗣️ **Natural Language Operations**: Install tools and create clusters through conversation without memorizing commands
|
|
89
|
+
🔍 **Dynamic Discovery**: Automatically discovers 21+ available platform operations from infrastructure scripts
|
|
90
|
+
🤖 **AI-Powered Intent Mapping**: Understands variations like "Install Argo CD", "Set up ArgoCD", "Deploy Argo CD"
|
|
91
|
+
💬 **Conversational Configuration**: Guides through parameter collection step-by-step with sensible defaults
|
|
92
|
+
🎯 **Zero-Knowledge Onboarding**: New users successfully build platforms without documentation
|
|
93
|
+
|
|
94
|
+
📖 [Learn more →](./docs/mcp-build-platform-guide.md)
|
|
95
|
+
|
|
82
96
|
### Documentation Testing & Validation
|
|
83
97
|
📖 **Automated Testing**: Validates documentation by executing commands and testing examples
|
|
84
98
|
🔍 **Two-Phase Validation**: Tests both functionality (does it work?) and semantic accuracy (are descriptions truthful?)
|
|
@@ -167,4 +181,3 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
167
181
|
---
|
|
168
182
|
|
|
169
183
|
**DevOps AI Toolkit** - AI-powered development productivity platform for enhanced software development workflows.
|
|
170
|
-
|
|
@@ -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,116 @@
|
|
|
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
|
+
* AI Provider Interface
|
|
73
|
+
*
|
|
74
|
+
* Minimal interface based on actual usage across 10 dependent files.
|
|
75
|
+
* Only includes methods that are currently called in production code.
|
|
76
|
+
*/
|
|
77
|
+
export interface AIProvider {
|
|
78
|
+
/**
|
|
79
|
+
* Send a message to the AI service
|
|
80
|
+
*
|
|
81
|
+
* Primary method for all AI interactions. Supports streaming for long operations.
|
|
82
|
+
* Used in: recommend.ts, answer-question.ts, generate-manifests.ts, remediate.ts,
|
|
83
|
+
* schema.ts, unified-creation-session.ts, platform-operations.ts
|
|
84
|
+
*
|
|
85
|
+
* @param message The message/prompt to send
|
|
86
|
+
* @param operation Optional operation identifier for debugging (e.g., 'deployment', 'intent-analysis')
|
|
87
|
+
* @returns AI response with content and usage statistics
|
|
88
|
+
*/
|
|
89
|
+
sendMessage(message: string, operation?: string): Promise<AIResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Check if the provider is properly initialized
|
|
92
|
+
*
|
|
93
|
+
* Used in: schema.ts (pre-flight check before AI calls)
|
|
94
|
+
*
|
|
95
|
+
* @returns true if provider is ready to use, false otherwise
|
|
96
|
+
*/
|
|
97
|
+
isInitialized(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Get the default model for this provider
|
|
100
|
+
*
|
|
101
|
+
* NEW: Required to replace hardcoded model at claude.ts:181
|
|
102
|
+
* Each provider has different model naming conventions.
|
|
103
|
+
*
|
|
104
|
+
* @returns Model identifier (e.g., 'claude-sonnet-4-5', 'gpt-4o', 'gemini-1.5-pro')
|
|
105
|
+
*/
|
|
106
|
+
getDefaultModel(): string;
|
|
107
|
+
/**
|
|
108
|
+
* Get the provider type
|
|
109
|
+
*
|
|
110
|
+
* NEW: Useful for debugging and logging
|
|
111
|
+
*
|
|
112
|
+
* @returns Provider identifier (e.g., 'anthropic', 'openai', 'google')
|
|
113
|
+
*/
|
|
114
|
+
getProviderType(): string;
|
|
115
|
+
}
|
|
116
|
+
//# 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,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;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;CAC3B"}
|
|
@@ -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-scan-workflow.d.ts","sourceRoot":"","sources":["../../src/core/capability-scan-workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAMtE,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,EAAE,qBAAqB,EAAE,QAAQ,EAAE,qBAAqB,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;AACzL,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;AAChI,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;AAC1F,MAAM,MAAM,wCAAwC,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC;AAoBlN,UAAU,qBAAqB;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,oBAAoB,GAAG,wBAAwB,GAAG,iBAAiB,GAAG,UAAU,GAAG,UAAU,CAAC;IAC3G,iBAAiB,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC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EAAE,iBAAiB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,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;
|
|
@@ -40,7 +40,7 @@ export declare class DocTestingSessionManager {
|
|
|
40
40
|
getActiveSessions(args: any): ValidationSession[];
|
|
41
41
|
private generateSessionId;
|
|
42
42
|
/**
|
|
43
|
-
* Load phase prompt from file
|
|
43
|
+
* Load phase prompt from file
|
|
44
44
|
*/
|
|
45
45
|
private loadPhasePrompt;
|
|
46
46
|
private getNextPhase;
|
|
@@ -271,7 +271,7 @@ The system manages session state and workflow progression automatically.`;
|
|
|
271
271
|
return `${timestamp}-${random}`;
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
|
-
* Load phase prompt from file
|
|
274
|
+
* Load phase prompt from file
|
|
275
275
|
*/
|
|
276
276
|
loadPhasePrompt(phase, session) {
|
|
277
277
|
// Prepare template variables for all phases
|
|
@@ -325,7 +325,7 @@ class ErrorHandler {
|
|
|
325
325
|
if (message.includes('authentication') || message.includes('unauthorized')) {
|
|
326
326
|
return ErrorCategory.AUTHENTICATION;
|
|
327
327
|
}
|
|
328
|
-
if (message.includes('
|
|
328
|
+
if (message.includes('ai') || message.includes('api key invalid') || message.includes('model')) {
|
|
329
329
|
return ErrorCategory.AI_SERVICE;
|
|
330
330
|
}
|
|
331
331
|
if (message.includes('validation') || message.includes('invalid')) {
|
|
@@ -376,7 +376,7 @@ class ErrorHandler {
|
|
|
376
376
|
];
|
|
377
377
|
case ErrorCategory.AI_SERVICE:
|
|
378
378
|
return [
|
|
379
|
-
'Check
|
|
379
|
+
'Check AI provider API key environment variable is set',
|
|
380
380
|
'Verify API key is valid and has sufficient credits',
|
|
381
381
|
'Try again after a short delay'
|
|
382
382
|
];
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
import { KubernetesDiscovery } from './discovery';
|
|
7
7
|
import { MemorySystem } from './memory';
|
|
8
8
|
import { WorkflowEngine } from './workflow';
|
|
9
|
-
import {
|
|
9
|
+
import { AIProvider } from './ai-provider.interface';
|
|
10
10
|
import { SchemaParser, ManifestValidator, ResourceRecommender } from './schema';
|
|
11
11
|
export interface CoreConfig {
|
|
12
12
|
kubernetesConfig?: string;
|
|
13
|
-
anthropicApiKey?: string;
|
|
14
13
|
}
|
|
15
14
|
export declare class DotAI {
|
|
16
15
|
private config;
|
|
@@ -18,7 +17,7 @@ export declare class DotAI {
|
|
|
18
17
|
readonly discovery: KubernetesDiscovery;
|
|
19
18
|
readonly memory: MemorySystem;
|
|
20
19
|
readonly workflow: WorkflowEngine;
|
|
21
|
-
readonly
|
|
20
|
+
readonly ai: AIProvider;
|
|
22
21
|
readonly schema: {
|
|
23
22
|
parser: SchemaParser;
|
|
24
23
|
validator: ManifestValidator;
|
|
@@ -27,17 +26,16 @@ export declare class DotAI {
|
|
|
27
26
|
rankResources: (intent: string) => Promise<any>;
|
|
28
27
|
};
|
|
29
28
|
constructor(config?: CoreConfig);
|
|
30
|
-
private validateConfig;
|
|
31
29
|
initialize(): Promise<void>;
|
|
32
30
|
initializeWithoutCluster(): Promise<void>;
|
|
33
31
|
isInitialized(): boolean;
|
|
34
32
|
getVersion(): string;
|
|
35
|
-
getAnthropicApiKey(): string | undefined;
|
|
36
33
|
}
|
|
37
34
|
export { KubernetesDiscovery } from './discovery';
|
|
38
35
|
export { MemorySystem } from './memory';
|
|
39
36
|
export { WorkflowEngine } from './workflow';
|
|
40
|
-
export {
|
|
37
|
+
export { AIProvider, AIResponse, IntentAnalysisResult, AIProviderConfig } from './ai-provider.interface';
|
|
38
|
+
export { createAIProvider, AIProviderFactory } from './ai-provider-factory';
|
|
41
39
|
export { SchemaParser, ManifestValidator, ResourceRecommender } from './schema';
|
|
42
40
|
export { OrganizationalPattern, CreatePatternRequest } from './pattern-types';
|
|
43
41
|
export { BaseOrganizationalEntity, PolicyIntent, CreatePolicyIntentRequest, DeployedPolicyReference } from './organizational-types';
|