@vfarcic/dot-ai 0.140.0 → 0.143.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/dist/core/ai-provider-factory.d.ts.map +1 -1
- package/dist/core/ai-provider-factory.js +4 -6
- package/dist/core/ai-provider.interface.d.ts +2 -2
- package/dist/core/ai-provider.interface.js +1 -1
- package/dist/core/crd-availability.d.ts +16 -0
- package/dist/core/crd-availability.d.ts.map +1 -0
- package/dist/core/crd-availability.js +108 -0
- package/dist/core/deploy-operation.js +2 -2
- package/dist/core/embedding-service.d.ts +8 -3
- package/dist/core/embedding-service.d.ts.map +1 -1
- package/dist/core/embedding-service.js +8 -16
- package/dist/core/model-config.d.ts +6 -8
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +6 -8
- package/dist/core/providers/vercel-provider.d.ts.map +1 -1
- package/dist/core/providers/vercel-provider.js +12 -11
- package/dist/core/schema.d.ts +2 -9
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +1 -2
- package/dist/core/solution-cr.d.ts +21 -0
- package/dist/core/solution-cr.d.ts.map +1 -0
- package/dist/core/solution-cr.js +112 -0
- package/dist/core/solution-utils.d.ts +0 -6
- package/dist/core/solution-utils.d.ts.map +1 -1
- package/dist/core/solution-utils.js +0 -26
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +21 -4
- package/dist/core/vector-db-service.d.ts.map +1 -1
- package/dist/core/vector-db-service.js +5 -0
- package/dist/interfaces/rest-registry.d.ts.map +1 -1
- package/dist/interfaces/rest-registry.js +1 -0
- package/dist/tools/answer-question.d.ts +6 -1
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +1 -1
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +34 -55
- package/dist/tools/operate-analysis.d.ts.map +1 -1
- package/dist/tools/operate-analysis.js +9 -15
- package/dist/tools/organizational-data.d.ts +17 -11
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/project-setup.d.ts +7 -3
- package/dist/tools/project-setup.d.ts.map +1 -1
- package/dist/tools/project-setup.js +1 -1
- package/dist/tools/recommend.d.ts +2 -0
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +15 -11
- package/dist/tools/remediate.d.ts +10 -3
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +1 -1
- package/package.json +4 -8
- package/prompts/operate-system.md +4 -3
- package/prompts/question-generation.md +8 -1
- package/prompts/remediate-system.md +10 -1
- package/prompts/resource-selection.md +7 -9
- package/scripts/crossplane.nu +1 -1
- package/scripts/dot-ai.nu +14 -2
- package/shared-prompts/prd-close.md +7 -1
- package/shared-prompts/deploy.md +0 -23
- package/shared-prompts/manage-org-data.md +0 -42
- package/shared-prompts/remediate.md +0 -44
- package/shared-prompts/status.md +0 -19
|
@@ -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;
|
|
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;AA4BjC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;OAMG;IACH,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU;IAiCnD;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,aAAa,IAAI,UAAU;IA0FlC;;;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"}
|
|
@@ -18,19 +18,16 @@ const model_config_1 = require("./model-config");
|
|
|
18
18
|
/**
|
|
19
19
|
* Provider environment variable mappings
|
|
20
20
|
* Phase 1 (PRD 73): anthropic, openai, google
|
|
21
|
-
* Phase 2 (PRD 154): openai_pro for GPT-5 Pro
|
|
22
21
|
*/
|
|
23
22
|
const PROVIDER_ENV_KEYS = {
|
|
24
23
|
anthropic: 'ANTHROPIC_API_KEY',
|
|
24
|
+
anthropic_opus: 'ANTHROPIC_API_KEY', // Uses same API key as regular Anthropic
|
|
25
25
|
anthropic_haiku: 'ANTHROPIC_API_KEY', // Uses same API key as regular Anthropic
|
|
26
26
|
openai: 'OPENAI_API_KEY',
|
|
27
|
-
openai_pro: 'OPENAI_API_KEY', // Uses same API key as regular OpenAI
|
|
28
27
|
google: 'GOOGLE_API_KEY',
|
|
29
|
-
|
|
28
|
+
kimi: 'MOONSHOT_API_KEY', // PRD #237: Moonshot AI Kimi K2
|
|
29
|
+
kimi_thinking: 'MOONSHOT_API_KEY', // PRD #237: Uses same API key as regular Kimi
|
|
30
30
|
xai: 'XAI_API_KEY',
|
|
31
|
-
xai_fast: 'XAI_API_KEY', // Uses same API key as regular xAI
|
|
32
|
-
mistral: 'MISTRAL_API_KEY',
|
|
33
|
-
deepseek: 'DEEPSEEK_API_KEY',
|
|
34
31
|
};
|
|
35
32
|
const IMPLEMENTED_PROVIDERS = Object.keys(model_config_1.CURRENT_MODELS);
|
|
36
33
|
/**
|
|
@@ -73,6 +70,7 @@ class AIProviderFactory {
|
|
|
73
70
|
// Create provider based on type
|
|
74
71
|
switch (config.provider) {
|
|
75
72
|
case 'anthropic':
|
|
73
|
+
case 'anthropic_opus':
|
|
76
74
|
case 'anthropic_haiku':
|
|
77
75
|
return this.createAnthropicProvider(config);
|
|
78
76
|
default:
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* across the codebase, ensuring backward compatibility and minimal migration effort.
|
|
9
9
|
*
|
|
10
10
|
* Phase 1 Implementation (PRD 73): Anthropic, OpenAI, Google
|
|
11
|
-
*
|
|
11
|
+
* Additional: AWS Bedrock, xAI Grok, OpenRouter, Custom endpoints
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
14
|
* Standard AI response structure
|
|
@@ -216,7 +216,7 @@ export interface AIProvider {
|
|
|
216
216
|
/**
|
|
217
217
|
* Get the current model name being used
|
|
218
218
|
*
|
|
219
|
-
* @returns Model name (e.g., 'grok-4
|
|
219
|
+
* @returns Model name (e.g., 'grok-4', 'claude-sonnet-4-5-20250929')
|
|
220
220
|
*/
|
|
221
221
|
getModelName(): string;
|
|
222
222
|
/**
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
* across the codebase, ensuring backward compatibility and minimal migration effort.
|
|
10
10
|
*
|
|
11
11
|
* Phase 1 Implementation (PRD 73): Anthropic, OpenAI, Google
|
|
12
|
-
*
|
|
12
|
+
* Additional: AWS Bedrock, xAI Grok, OpenRouter, Custom endpoints
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRD Availability Check with Global Caching
|
|
3
|
+
*
|
|
4
|
+
* Checks once per MCP server lifecycle if Solution CRD is available,
|
|
5
|
+
* then caches the result globally to avoid repeated cluster queries.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Helper function for checking CRD availability
|
|
9
|
+
* Use this function throughout the codebase
|
|
10
|
+
*/
|
|
11
|
+
export declare function isSolutionCRDAvailable(): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Reset CRD availability cache (primarily for testing)
|
|
14
|
+
*/
|
|
15
|
+
export declare function resetCRDAvailabilityCache(): void;
|
|
16
|
+
//# sourceMappingURL=crd-availability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crd-availability.d.ts","sourceRoot":"","sources":["../../src/core/crd-availability.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4DH;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG/D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CRD Availability Check with Global Caching
|
|
4
|
+
*
|
|
5
|
+
* Checks once per MCP server lifecycle if Solution CRD is available,
|
|
6
|
+
* then caches the result globally to avoid repeated cluster queries.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.isSolutionCRDAvailable = isSolutionCRDAvailable;
|
|
43
|
+
exports.resetCRDAvailabilityCache = resetCRDAvailabilityCache;
|
|
44
|
+
const k8s = __importStar(require("@kubernetes/client-node"));
|
|
45
|
+
/**
|
|
46
|
+
* Singleton cache for CRD availability check
|
|
47
|
+
* Checks once per MCP server lifecycle, caches result globally
|
|
48
|
+
*/
|
|
49
|
+
class CRDAvailabilityCache {
|
|
50
|
+
static instance;
|
|
51
|
+
crdAvailable = null;
|
|
52
|
+
constructor() { }
|
|
53
|
+
static getInstance() {
|
|
54
|
+
if (!CRDAvailabilityCache.instance) {
|
|
55
|
+
CRDAvailabilityCache.instance = new CRDAvailabilityCache();
|
|
56
|
+
}
|
|
57
|
+
return CRDAvailabilityCache.instance;
|
|
58
|
+
}
|
|
59
|
+
async isSolutionCRDAvailable() {
|
|
60
|
+
// Return cached result if available
|
|
61
|
+
if (this.crdAvailable !== null) {
|
|
62
|
+
return this.crdAvailable;
|
|
63
|
+
}
|
|
64
|
+
// Check cluster for Solution CRD
|
|
65
|
+
try {
|
|
66
|
+
const kc = new k8s.KubeConfig();
|
|
67
|
+
kc.loadFromDefault();
|
|
68
|
+
const k8sApi = kc.makeApiClient(k8s.ApiextensionsV1Api);
|
|
69
|
+
const crdName = 'solutions.dot-ai.devopstoolkit.live';
|
|
70
|
+
await k8sApi.readCustomResourceDefinition({ name: crdName });
|
|
71
|
+
// CRD exists, cache result
|
|
72
|
+
this.crdAvailable = true;
|
|
73
|
+
console.log('✅ Solution CRD available - Solution CR generation enabled');
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error.statusCode === 404 || error.response?.statusCode === 404) {
|
|
78
|
+
// CRD not found, cache result
|
|
79
|
+
this.crdAvailable = false;
|
|
80
|
+
console.log('ℹ️ Solution CRD not available - Solution CR generation disabled (graceful degradation)');
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
// Other errors (cluster unreachable, etc.) - don't cache, throw
|
|
84
|
+
throw new Error(`Failed to check Solution CRD availability: ${error.message || error}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Reset cache (for testing or manual refresh)
|
|
89
|
+
*/
|
|
90
|
+
reset() {
|
|
91
|
+
this.crdAvailable = null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Helper function for checking CRD availability
|
|
96
|
+
* Use this function throughout the codebase
|
|
97
|
+
*/
|
|
98
|
+
async function isSolutionCRDAvailable() {
|
|
99
|
+
const cache = CRDAvailabilityCache.getInstance();
|
|
100
|
+
return cache.isSolutionCRDAvailable();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Reset CRD availability cache (primarily for testing)
|
|
104
|
+
*/
|
|
105
|
+
function resetCRDAvailabilityCache() {
|
|
106
|
+
const cache = CRDAvailabilityCache.getInstance();
|
|
107
|
+
cache.reset();
|
|
108
|
+
}
|
|
@@ -85,9 +85,9 @@ class DeployOperation {
|
|
|
85
85
|
waitOutput = `\n\nWait output:\n${waitResult}`;
|
|
86
86
|
}
|
|
87
87
|
catch (waitError) {
|
|
88
|
-
// If no deployments found or wait fails, that's OK for
|
|
88
|
+
// If no deployments found or wait fails, that's OK for other resource types (Services, etc.)
|
|
89
89
|
if (waitError.message && waitError.message.includes('no matching resources found')) {
|
|
90
|
-
waitOutput = '\n\nWait output: No deployments found to wait for (likely
|
|
90
|
+
waitOutput = '\n\nWait output: No deployments found to wait for (likely Services, CRs, etc.)';
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
93
|
waitOutput = `\n\nWait output: Warning - ${waitError.message}`;
|
|
@@ -4,8 +4,13 @@
|
|
|
4
4
|
* Optional semantic search enhancement for pattern matching.
|
|
5
5
|
* Gracefully falls back to keyword-only search when embedding providers are not available.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Supported embedding providers - single source of truth
|
|
9
|
+
*/
|
|
10
|
+
export declare const EMBEDDING_PROVIDERS: readonly ["openai", "google", "amazon_bedrock"];
|
|
11
|
+
export type EmbeddingProviderType = typeof EMBEDDING_PROVIDERS[number];
|
|
7
12
|
export interface EmbeddingConfig {
|
|
8
|
-
provider?:
|
|
13
|
+
provider?: EmbeddingProviderType;
|
|
9
14
|
apiKey?: string;
|
|
10
15
|
model?: string;
|
|
11
16
|
dimensions?: number;
|
|
@@ -19,7 +24,7 @@ export interface EmbeddingProvider {
|
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
26
|
* Unified Vercel AI SDK Embedding Provider
|
|
22
|
-
* Supports OpenAI, Google,
|
|
27
|
+
* Supports OpenAI, Google, and Amazon Bedrock through Vercel AI SDK
|
|
23
28
|
*/
|
|
24
29
|
export declare class VercelEmbeddingProvider implements EmbeddingProvider {
|
|
25
30
|
private providerType;
|
|
@@ -29,7 +34,7 @@ export declare class VercelEmbeddingProvider implements EmbeddingProvider {
|
|
|
29
34
|
private available;
|
|
30
35
|
private modelInstance;
|
|
31
36
|
constructor(config: EmbeddingConfig & {
|
|
32
|
-
provider:
|
|
37
|
+
provider: EmbeddingProviderType;
|
|
33
38
|
});
|
|
34
39
|
generateEmbedding(text: string): Promise<number[]>;
|
|
35
40
|
generateEmbeddings(texts: string[]): Promise<number[][]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-service.d.ts","sourceRoot":"","sources":["../../src/core/embedding-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"embedding-service.d.ts","sourceRoot":"","sources":["../../src/core/embedding-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;GAEG;AACH,eAAO,MAAM,mBAAmB,iDAAkD,CAAC;AACnF,MAAM,MAAM,qBAAqB,GAAG,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAEvE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACnD,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzD,WAAW,IAAI,OAAO,CAAC;IACvB,aAAa,IAAI,MAAM,CAAC;IACxB,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAC/D,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,aAAa,CAAM;gBAEf,MAAM,EAAE,eAAe,GAAG;QAAE,QAAQ,EAAE,qBAAqB,CAAA;KAAE;IAgEnE,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAiDlD,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IA8D9D,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM;IAIvB,QAAQ,IAAI,MAAM;IAIlB,eAAe,IAAI,MAAM;CAG1B;AA0BD;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAA2B;gBAE/B,MAAM,GAAE,eAAoB;IAKxC;;;OAGG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAaxD;;;OAGG;IACG,kBAAkB,CAAC,KAAK,EAAE,MAAM,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;IA4BD;;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"}
|
|
@@ -6,16 +6,19 @@
|
|
|
6
6
|
* Gracefully falls back to keyword-only search when embedding providers are not available.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.EmbeddingService = exports.VercelEmbeddingProvider = void 0;
|
|
9
|
+
exports.EmbeddingService = exports.VercelEmbeddingProvider = exports.EMBEDDING_PROVIDERS = void 0;
|
|
10
10
|
const amazon_bedrock_1 = require("@ai-sdk/amazon-bedrock");
|
|
11
11
|
const google_1 = require("@ai-sdk/google");
|
|
12
|
-
const mistral_1 = require("@ai-sdk/mistral");
|
|
13
12
|
const openai_1 = require("@ai-sdk/openai");
|
|
14
13
|
const ai_1 = require("ai");
|
|
15
14
|
const tracing_1 = require("./tracing");
|
|
15
|
+
/**
|
|
16
|
+
* Supported embedding providers - single source of truth
|
|
17
|
+
*/
|
|
18
|
+
exports.EMBEDDING_PROVIDERS = ['openai', 'google', 'amazon_bedrock'];
|
|
16
19
|
/**
|
|
17
20
|
* Unified Vercel AI SDK Embedding Provider
|
|
18
|
-
* Supports OpenAI, Google,
|
|
21
|
+
* Supports OpenAI, Google, and Amazon Bedrock through Vercel AI SDK
|
|
19
22
|
*/
|
|
20
23
|
class VercelEmbeddingProvider {
|
|
21
24
|
providerType;
|
|
@@ -39,11 +42,6 @@ class VercelEmbeddingProvider {
|
|
|
39
42
|
this.model = config.model || 'text-embedding-004';
|
|
40
43
|
this.dimensions = config.dimensions || 768;
|
|
41
44
|
break;
|
|
42
|
-
case 'mistral':
|
|
43
|
-
this.apiKey = config.apiKey || process.env.MISTRAL_API_KEY || '';
|
|
44
|
-
this.model = config.model || 'mistral-embed';
|
|
45
|
-
this.dimensions = config.dimensions || 1024;
|
|
46
|
-
break;
|
|
47
45
|
case 'amazon_bedrock':
|
|
48
46
|
// AWS SDK handles credentials automatically - no API key needed
|
|
49
47
|
this.apiKey = 'bedrock-uses-aws-credentials';
|
|
@@ -72,11 +70,6 @@ class VercelEmbeddingProvider {
|
|
|
72
70
|
process.env.GOOGLE_GENERATIVE_AI_API_KEY = this.apiKey;
|
|
73
71
|
this.modelInstance = google_1.google.textEmbedding(this.model);
|
|
74
72
|
break;
|
|
75
|
-
case 'mistral': {
|
|
76
|
-
const mistral = (0, mistral_1.createMistral)({ apiKey: this.apiKey });
|
|
77
|
-
this.modelInstance = mistral.textEmbedding(this.model);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
73
|
case 'amazon_bedrock': {
|
|
81
74
|
// AWS SDK automatically uses credential chain:
|
|
82
75
|
// 1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)
|
|
@@ -204,8 +197,8 @@ exports.VercelEmbeddingProvider = VercelEmbeddingProvider;
|
|
|
204
197
|
*/
|
|
205
198
|
function createEmbeddingProvider(config = {}) {
|
|
206
199
|
const providerType = (config.provider || process.env.EMBEDDINGS_PROVIDER || 'openai').toLowerCase();
|
|
207
|
-
// Validate provider type
|
|
208
|
-
if (providerType
|
|
200
|
+
// Validate provider type using centralized list
|
|
201
|
+
if (!exports.EMBEDDING_PROVIDERS.includes(providerType)) {
|
|
209
202
|
console.warn(`Unknown embedding provider: ${providerType}, falling back to openai`);
|
|
210
203
|
return createEmbeddingProvider({ ...config, provider: 'openai' });
|
|
211
204
|
}
|
|
@@ -294,7 +287,6 @@ class EmbeddingService {
|
|
|
294
287
|
const keyMap = {
|
|
295
288
|
'openai': 'OPENAI_API_KEY',
|
|
296
289
|
'google': 'GOOGLE_API_KEY',
|
|
297
|
-
'mistral': 'MISTRAL_API_KEY',
|
|
298
290
|
'amazon_bedrock': 'AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)'
|
|
299
291
|
};
|
|
300
292
|
const requiredKey = keyMap[requestedProvider] || 'OPENAI_API_KEY';
|
|
@@ -6,17 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const CURRENT_MODELS: {
|
|
8
8
|
readonly anthropic: "claude-sonnet-4-5-20250929";
|
|
9
|
+
readonly anthropic_opus: "claude-opus-4-5-20251101";
|
|
9
10
|
readonly anthropic_haiku: "claude-haiku-4-5-20251001";
|
|
10
|
-
readonly openai: "gpt-5";
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
readonly
|
|
11
|
+
readonly openai: "gpt-5.1-codex";
|
|
12
|
+
readonly google: "gemini-3-pro-preview";
|
|
13
|
+
readonly kimi: "kimi-k2-0905-preview";
|
|
14
|
+
readonly kimi_thinking: "kimi-k2-thinking";
|
|
14
15
|
readonly xai: "grok-4";
|
|
15
|
-
readonly xai_fast: "grok-4-fast-reasoning";
|
|
16
|
-
readonly mistral: "mistral-large-latest";
|
|
17
|
-
readonly deepseek: "deepseek-reasoner";
|
|
18
16
|
readonly openrouter: "anthropic/claude-haiku-4.5";
|
|
19
|
-
readonly custom: "gpt-5";
|
|
17
|
+
readonly custom: "gpt-5.1-codex";
|
|
20
18
|
readonly amazon_bedrock: "global.anthropic.claude-sonnet-4-20250514-v1:0";
|
|
21
19
|
};
|
|
22
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../src/core/model-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"model-config.d.ts","sourceRoot":"","sources":["../../src/core/model-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;CAYjB,CAAC;AAEX;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,OAAO,cAAc,GAAG,MAAM,CAE7E"}
|
|
@@ -10,17 +10,15 @@ exports.CURRENT_MODELS = void 0;
|
|
|
10
10
|
exports.getCurrentModel = getCurrentModel;
|
|
11
11
|
exports.CURRENT_MODELS = {
|
|
12
12
|
anthropic: 'claude-sonnet-4-5-20250929',
|
|
13
|
+
anthropic_opus: 'claude-opus-4-5-20251101',
|
|
13
14
|
anthropic_haiku: 'claude-haiku-4-5-20251001',
|
|
14
|
-
openai: 'gpt-5',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
openai: 'gpt-5.1-codex',
|
|
16
|
+
google: 'gemini-3-pro-preview',
|
|
17
|
+
kimi: 'kimi-k2-0905-preview', // PRD #237: Moonshot AI Kimi K2 - standard model with 256K context
|
|
18
|
+
kimi_thinking: 'kimi-k2-thinking', // PRD #237: Moonshot AI Kimi K2 - extended thinking variant
|
|
18
19
|
xai: 'grok-4',
|
|
19
|
-
xai_fast: 'grok-4-fast-reasoning',
|
|
20
|
-
mistral: 'mistral-large-latest',
|
|
21
|
-
deepseek: 'deepseek-reasoner',
|
|
22
20
|
openrouter: 'anthropic/claude-haiku-4.5', // PRD #194: OpenRouter default model (overridden by AI_MODEL env var)
|
|
23
|
-
custom: 'gpt-5', // PRD #194: Custom endpoint default model (overridden by AI_MODEL env var)
|
|
21
|
+
custom: 'gpt-5.1-codex', // PRD #194: Custom endpoint default model (overridden by AI_MODEL env var)
|
|
24
22
|
amazon_bedrock: 'global.anthropic.claude-sonnet-4-20250514-v1:0' // PRD #175: Amazon Bedrock default model (overridden by AI_MODEL env var)
|
|
25
23
|
};
|
|
26
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/vercel-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"vercel-provider.d.ts","sourceRoot":"","sources":["../../../src/core/providers/vercel-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,0BAA0B,CAAC;AAiBlC,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,aAAa,CAAM;gBAEf,MAAM,EAAE,gBAAgB;IAWpC,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,eAAe;IAqFvB,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,YAAY,IAAI,MAAM;IAItB,cAAc,IAAI,MAAM;IAIxB,aAAa,IAAI,OAAO;IAIxB,OAAO,CAAC,iBAAiB;IAyBnB,WAAW,CACf,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAkB,EAC7B,iBAAiB,CAAC,EAAE;QAClB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,GACA,OAAO,CAAC,UAAU,CAAC;IAoJtB;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CAmW/D"}
|
|
@@ -12,8 +12,6 @@ const openai_1 = require("@ai-sdk/openai");
|
|
|
12
12
|
const google_1 = require("@ai-sdk/google");
|
|
13
13
|
const anthropic_1 = require("@ai-sdk/anthropic");
|
|
14
14
|
const xai_1 = require("@ai-sdk/xai");
|
|
15
|
-
const mistral_1 = require("@ai-sdk/mistral");
|
|
16
|
-
const deepseek_1 = require("@ai-sdk/deepseek");
|
|
17
15
|
const amazon_bedrock_1 = require("@ai-sdk/amazon-bedrock");
|
|
18
16
|
const ai_sdk_provider_1 = require("@openrouter/ai-sdk-provider");
|
|
19
17
|
const provider_debug_utils_1 = require("./provider-debug-utils");
|
|
@@ -50,16 +48,15 @@ class VercelProvider {
|
|
|
50
48
|
let provider;
|
|
51
49
|
switch (this.providerType) {
|
|
52
50
|
case 'openai':
|
|
53
|
-
case 'openai_pro':
|
|
54
51
|
provider = (0, openai_1.createOpenAI)({
|
|
55
52
|
apiKey: this.apiKey,
|
|
56
53
|
});
|
|
57
54
|
break;
|
|
58
55
|
case 'google':
|
|
59
|
-
case 'google_fast':
|
|
60
56
|
provider = (0, google_1.createGoogleGenerativeAI)({ apiKey: this.apiKey });
|
|
61
57
|
break;
|
|
62
58
|
case 'anthropic':
|
|
59
|
+
case 'anthropic_opus':
|
|
63
60
|
case 'anthropic_haiku':
|
|
64
61
|
provider = (0, anthropic_1.createAnthropic)({
|
|
65
62
|
apiKey: this.apiKey,
|
|
@@ -71,17 +68,19 @@ class VercelProvider {
|
|
|
71
68
|
});
|
|
72
69
|
break;
|
|
73
70
|
case 'xai':
|
|
74
|
-
case 'xai_fast':
|
|
75
71
|
provider = (0, xai_1.createXai)({ apiKey: this.apiKey });
|
|
76
72
|
break;
|
|
77
|
-
case '
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
73
|
+
case 'kimi':
|
|
74
|
+
case 'kimi_thinking':
|
|
75
|
+
// PRD #237: Moonshot AI Kimi K2 - uses OpenAI-compatible API
|
|
76
|
+
// Use .chat() explicitly to use /chat/completions instead of /responses
|
|
77
|
+
// Use global endpoint (api.moonshot.ai) - China endpoint (api.moonshot.cn) requires China-specific API keys
|
|
78
|
+
provider = (0, openai_1.createOpenAI)({
|
|
82
79
|
apiKey: this.apiKey,
|
|
80
|
+
baseURL: 'https://api.moonshot.ai/v1',
|
|
83
81
|
});
|
|
84
|
-
|
|
82
|
+
this.modelInstance = provider.chat(this.model);
|
|
83
|
+
return; // Early return - model instance already set
|
|
85
84
|
case 'amazon_bedrock':
|
|
86
85
|
// PRD #175: Amazon Bedrock provider
|
|
87
86
|
// AWS SDK automatically uses credential chain:
|
|
@@ -294,6 +293,7 @@ class VercelProvider {
|
|
|
294
293
|
// Add cache control ONLY to last tool for Anthropic (max 4 cache breakpoints)
|
|
295
294
|
// This caches the system prompt + all tools together
|
|
296
295
|
if ((this.providerType === 'anthropic' ||
|
|
296
|
+
this.providerType === 'anthropic_opus' ||
|
|
297
297
|
this.providerType === 'anthropic_haiku') &&
|
|
298
298
|
isLastTool) {
|
|
299
299
|
toolDef.providerOptions = {
|
|
@@ -316,6 +316,7 @@ class VercelProvider {
|
|
|
316
316
|
const messages = [];
|
|
317
317
|
let systemParam;
|
|
318
318
|
if (this.providerType === 'anthropic' ||
|
|
319
|
+
this.providerType === 'anthropic_opus' ||
|
|
319
320
|
this.providerType === 'anthropic_haiku') {
|
|
320
321
|
// For Anthropic: Put system in messages array with cacheControl
|
|
321
322
|
messages.push({
|
package/dist/core/schema.d.ts
CHANGED
|
@@ -79,13 +79,7 @@ export interface QuestionGroup {
|
|
|
79
79
|
placeholder: string;
|
|
80
80
|
answer?: string;
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
export interface PatternInfluence {
|
|
84
|
-
patternId: string;
|
|
85
|
-
description: string;
|
|
86
|
-
influence: 'high' | 'medium' | 'low';
|
|
87
|
-
matchedTriggers: string[];
|
|
88
|
-
matchedConcept?: string;
|
|
82
|
+
relevantPolicies?: string[];
|
|
89
83
|
}
|
|
90
84
|
export interface ResourceSolution {
|
|
91
85
|
type: 'single' | 'combination';
|
|
@@ -95,8 +89,7 @@ export interface ResourceSolution {
|
|
|
95
89
|
reasons: string[];
|
|
96
90
|
analysis: string;
|
|
97
91
|
questions: QuestionGroup;
|
|
98
|
-
|
|
99
|
-
usedPatterns?: boolean;
|
|
92
|
+
appliedPatterns?: string[];
|
|
100
93
|
}
|
|
101
94
|
export interface ClusterOptions {
|
|
102
95
|
namespaces: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAWrD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,O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AA0B;IA6ExC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAOtC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAanC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAYpC;;;OAGG;YACW,sBAAsB;IAsBpC;;OAEG;YACW,oBAAoB;IAmDlC;;OAEG;YACW,sBAAsB;IAkEpC;;OAEG;YACW,uBAAuB;CAuItC"}
|
package/dist/core/schema.js
CHANGED
|
@@ -412,8 +412,7 @@ class ResourceRecommender {
|
|
|
412
412
|
reasons: solution.reasons || [],
|
|
413
413
|
analysis: solution.analysis || '',
|
|
414
414
|
questions: { required: [], basic: [], advanced: [], open: { question: '', placeholder: '' } },
|
|
415
|
-
|
|
416
|
-
usedPatterns: solution.usedPatterns || false
|
|
415
|
+
appliedPatterns: solution.appliedPatterns || []
|
|
417
416
|
};
|
|
418
417
|
});
|
|
419
418
|
// Sort by score descending
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Solution Custom Resource Generation
|
|
3
|
+
*
|
|
4
|
+
* Generates Solution CR manifests from session data for tracking deployments
|
|
5
|
+
*/
|
|
6
|
+
import type { SolutionData } from '../tools/recommend';
|
|
7
|
+
export interface SolutionCROptions {
|
|
8
|
+
solutionId: string;
|
|
9
|
+
namespace: string;
|
|
10
|
+
solution: SolutionData;
|
|
11
|
+
generatedManifestsYaml: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Generate a Solution Custom Resource from solution session data
|
|
15
|
+
* Parses generated manifests to extract actual resource references
|
|
16
|
+
*
|
|
17
|
+
* @param options Configuration containing solution data and generated manifests
|
|
18
|
+
* @returns Solution CR as YAML string
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateSolutionCR(options: SolutionCROptions): string;
|
|
21
|
+
//# sourceMappingURL=solution-cr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solution-cr.d.ts","sourceRoot":"","sources":["../../src/core/solution-cr.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,YAAY,CAAC;IACvB,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA2CrE"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Solution Custom Resource Generation
|
|
4
|
+
*
|
|
5
|
+
* Generates Solution CR manifests from session data for tracking deployments
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.generateSolutionCR = generateSolutionCR;
|
|
42
|
+
const yaml = __importStar(require("js-yaml"));
|
|
43
|
+
/**
|
|
44
|
+
* Generate a Solution Custom Resource from solution session data
|
|
45
|
+
* Parses generated manifests to extract actual resource references
|
|
46
|
+
*
|
|
47
|
+
* @param options Configuration containing solution data and generated manifests
|
|
48
|
+
* @returns Solution CR as YAML string
|
|
49
|
+
*/
|
|
50
|
+
function generateSolutionCR(options) {
|
|
51
|
+
const { solutionId, namespace, solution, generatedManifestsYaml } = options;
|
|
52
|
+
// Parse generated manifests to extract actual resource references
|
|
53
|
+
const resourceReferences = extractResourceReferences(generatedManifestsYaml, namespace);
|
|
54
|
+
// Build rationale from solution description, reasons, and analysis
|
|
55
|
+
const rationale = [
|
|
56
|
+
solution.description,
|
|
57
|
+
...solution.reasons,
|
|
58
|
+
solution.analysis
|
|
59
|
+
].filter(Boolean).join('\n\n');
|
|
60
|
+
// Get patterns and policies from session
|
|
61
|
+
const patterns = solution.appliedPatterns || [];
|
|
62
|
+
const policies = solution.questions?.relevantPolicies || [];
|
|
63
|
+
// Create Solution CR object
|
|
64
|
+
const solutionCR = {
|
|
65
|
+
apiVersion: 'dot-ai.devopstoolkit.live/v1alpha1',
|
|
66
|
+
kind: 'Solution',
|
|
67
|
+
metadata: {
|
|
68
|
+
name: `solution-${solutionId}`,
|
|
69
|
+
namespace: namespace,
|
|
70
|
+
labels: {
|
|
71
|
+
'dot-ai.devopstoolkit.live/created-by': 'dot-ai-mcp',
|
|
72
|
+
'dot-ai.devopstoolkit.live/solution-id': solutionId
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
spec: {
|
|
76
|
+
intent: solution.intent,
|
|
77
|
+
resources: resourceReferences,
|
|
78
|
+
context: {
|
|
79
|
+
createdBy: 'dot-ai-mcp',
|
|
80
|
+
rationale: rationale,
|
|
81
|
+
patterns: patterns,
|
|
82
|
+
policies: policies
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
// Convert to YAML
|
|
87
|
+
return yaml.dump(solutionCR);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Extract resource references from generated manifest YAML
|
|
91
|
+
*
|
|
92
|
+
* @param manifestsYaml Generated Kubernetes manifests as YAML string
|
|
93
|
+
* @param defaultNamespace Default namespace if not specified in manifest
|
|
94
|
+
* @returns Array of resource references
|
|
95
|
+
*/
|
|
96
|
+
function extractResourceReferences(manifestsYaml, defaultNamespace) {
|
|
97
|
+
try {
|
|
98
|
+
const manifests = yaml.loadAll(manifestsYaml);
|
|
99
|
+
return manifests
|
|
100
|
+
.filter((manifest) => manifest && manifest.kind && manifest.metadata?.name)
|
|
101
|
+
.map((manifest) => ({
|
|
102
|
+
apiVersion: manifest.apiVersion,
|
|
103
|
+
kind: manifest.kind,
|
|
104
|
+
name: manifest.metadata.name,
|
|
105
|
+
namespace: manifest.metadata.namespace || defaultNamespace
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error('Failed to extract resource references from manifests:', error);
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
}
|