@vfarcic/dot-ai 0.111.0 → 0.112.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 +5 -0
- package/dist/core/ai-provider-factory.d.ts.map +1 -1
- package/dist/core/ai-provider-factory.js +13 -2
- package/dist/core/ai-provider.interface.d.ts +16 -1
- package/dist/core/ai-provider.interface.d.ts.map +1 -1
- package/dist/core/capabilities.d.ts +1 -1
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/capabilities.js +7 -4
- package/dist/core/capability-scan-workflow.js +2 -2
- package/dist/core/model-config.d.ts +17 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/model-config.js +22 -0
- package/dist/core/platform-operations.d.ts.map +1 -1
- package/dist/core/platform-operations.js +3 -5
- package/dist/core/platform-utils.d.ts +3 -2
- package/dist/core/platform-utils.d.ts.map +1 -1
- package/dist/core/platform-utils.js +35 -9
- package/dist/core/providers/anthropic-provider.d.ts +4 -1
- package/dist/core/providers/anthropic-provider.d.ts.map +1 -1
- package/dist/core/providers/anthropic-provider.js +89 -27
- package/dist/core/providers/provider-debug-utils.d.ts +49 -20
- package/dist/core/providers/provider-debug-utils.d.ts.map +1 -1
- package/dist/core/providers/provider-debug-utils.js +117 -51
- package/dist/core/providers/vercel-provider.d.ts +4 -1
- package/dist/core/providers/vercel-provider.d.ts.map +1 -1
- package/dist/core/providers/vercel-provider.js +105 -114
- package/dist/core/schema.d.ts +1 -5
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +16 -42
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +12 -6
- package/dist/evaluation/dataset-analyzer.d.ts +118 -0
- package/dist/evaluation/dataset-analyzer.d.ts.map +1 -0
- package/dist/evaluation/dataset-analyzer.js +234 -0
- package/dist/evaluation/datasets/loader.d.ts +42 -0
- package/dist/evaluation/datasets/loader.d.ts.map +1 -0
- package/dist/evaluation/datasets/loader.js +104 -0
- package/dist/evaluation/eval-runner.d.ts +9 -0
- package/dist/evaluation/eval-runner.d.ts.map +1 -0
- package/dist/evaluation/eval-runner.js +255 -0
- package/dist/evaluation/evaluators/base-comparative.d.ts +91 -0
- package/dist/evaluation/evaluators/base-comparative.d.ts.map +1 -0
- package/dist/evaluation/evaluators/base-comparative.js +152 -0
- package/dist/evaluation/evaluators/base.d.ts +47 -0
- package/dist/evaluation/evaluators/base.d.ts.map +1 -0
- package/dist/evaluation/evaluators/base.js +10 -0
- package/dist/evaluation/evaluators/capability-comparative.d.ts +32 -0
- package/dist/evaluation/evaluators/capability-comparative.d.ts.map +1 -0
- package/dist/evaluation/evaluators/capability-comparative.js +104 -0
- package/dist/evaluation/evaluators/pattern-comparative.d.ts +31 -0
- package/dist/evaluation/evaluators/pattern-comparative.d.ts.map +1 -0
- package/dist/evaluation/evaluators/pattern-comparative.js +97 -0
- package/dist/evaluation/evaluators/policy-comparative.d.ts +31 -0
- package/dist/evaluation/evaluators/policy-comparative.d.ts.map +1 -0
- package/dist/evaluation/evaluators/policy-comparative.js +97 -0
- package/dist/evaluation/evaluators/recommendation-comparative.d.ts +25 -0
- package/dist/evaluation/evaluators/recommendation-comparative.d.ts.map +1 -0
- package/dist/evaluation/evaluators/recommendation-comparative.js +55 -0
- package/dist/evaluation/evaluators/remediation-comparative.d.ts +25 -0
- package/dist/evaluation/evaluators/remediation-comparative.d.ts.map +1 -0
- package/dist/evaluation/evaluators/remediation-comparative.js +54 -0
- package/dist/interfaces/rest-api.d.ts.map +1 -1
- package/dist/tools/answer-question.d.ts +2 -0
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +18 -11
- package/dist/tools/generate-manifests.d.ts +2 -0
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +8 -4
- package/dist/tools/organizational-data.d.ts +1 -0
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +2 -1
- package/dist/tools/recommend.d.ts +1 -0
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +10 -5
- package/dist/tools/remediate.d.ts +3 -0
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +25 -12
- package/dist/tools/test-docs.d.ts +1 -0
- package/dist/tools/test-docs.d.ts.map +1 -1
- package/dist/tools/test-docs.js +4 -2
- package/dist/tools/version.d.ts +4 -1
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +12 -4
- package/package.json +5 -1
|
@@ -52,7 +52,8 @@ exports.ANSWERQUESTION_TOOL_DESCRIPTION = 'Process user answers and return remai
|
|
|
52
52
|
exports.ANSWERQUESTION_TOOL_INPUT_SCHEMA = {
|
|
53
53
|
solutionId: zod_1.z.string().regex(/^sol_[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}_[a-f0-9]+$/).describe('The solution ID to update (e.g., sol_2025-07-01T154349_1e1e242592ff)'),
|
|
54
54
|
stage: zod_1.z.enum(['required', 'basic', 'advanced', 'open']).describe('The configuration stage being addressed'),
|
|
55
|
-
answers: zod_1.z.record(zod_1.z.any()).describe('User answers to configuration questions for the specified stage. For required/basic/advanced stages, use questionId as key. For open stage, use "open" as key (e.g., {"open": "add persistent storage"})')
|
|
55
|
+
answers: zod_1.z.record(zod_1.z.any()).describe('User answers to configuration questions for the specified stage. For required/basic/advanced stages, use questionId as key. For open stage, use "open" as key (e.g., {"open": "add persistent storage"})'),
|
|
56
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
56
57
|
};
|
|
57
58
|
/**
|
|
58
59
|
* Load solution file by ID
|
|
@@ -353,7 +354,7 @@ function getStageGuidance(stage) {
|
|
|
353
354
|
/**
|
|
354
355
|
* Phase 1: Analyze what resources are needed for the user request
|
|
355
356
|
*/
|
|
356
|
-
async function analyzeResourceNeeds(currentSolution, openResponse, context) {
|
|
357
|
+
async function analyzeResourceNeeds(currentSolution, openResponse, context, interaction_id) {
|
|
357
358
|
const template = (0, shared_prompt_loader_1.loadPrompt)('resource-analysis');
|
|
358
359
|
// Get available resources from solution or use defaults
|
|
359
360
|
const availableResources = currentSolution.availableResources || {
|
|
@@ -376,7 +377,10 @@ async function analyzeResourceNeeds(currentSolution, openResponse, context) {
|
|
|
376
377
|
availableResourceCount: availableResourceTypes.length
|
|
377
378
|
});
|
|
378
379
|
try {
|
|
379
|
-
const response = await aiProvider.sendMessage(analysisPrompt
|
|
380
|
+
const response = await aiProvider.sendMessage(analysisPrompt, 'answer-question-resource-analysis', {
|
|
381
|
+
user_intent: openResponse,
|
|
382
|
+
interaction_id: interaction_id
|
|
383
|
+
});
|
|
380
384
|
const analysisResult = parseEnhancementResponse(response.content);
|
|
381
385
|
// Check for capability gap and throw specific error
|
|
382
386
|
if (analysisResult.approach === 'capability_gap') {
|
|
@@ -399,7 +403,7 @@ async function analyzeResourceNeeds(currentSolution, openResponse, context) {
|
|
|
399
403
|
/**
|
|
400
404
|
* Phase 2: Apply enhancements based on analysis result
|
|
401
405
|
*/
|
|
402
|
-
async function applySolutionEnhancement(solution, openResponse, analysisResult, context) {
|
|
406
|
+
async function applySolutionEnhancement(solution, openResponse, analysisResult, context, interaction_id) {
|
|
403
407
|
if (analysisResult.approach === 'capability_gap') {
|
|
404
408
|
throw new Error(`Enhancement capability gap: ${analysisResult.reasoning}. ${analysisResult.suggestedAction}`);
|
|
405
409
|
}
|
|
@@ -409,7 +413,7 @@ async function applySolutionEnhancement(solution, openResponse, analysisResult,
|
|
|
409
413
|
approach: analysisResult.approach,
|
|
410
414
|
reasoning: analysisResult.reasoning
|
|
411
415
|
});
|
|
412
|
-
return autoPopulateQuestions(solution, openResponse, analysisResult, context);
|
|
416
|
+
return autoPopulateQuestions(solution, openResponse, analysisResult, context, interaction_id);
|
|
413
417
|
}
|
|
414
418
|
if (analysisResult.approach === 'add_resources') {
|
|
415
419
|
// Add new resources and their questions
|
|
@@ -425,7 +429,7 @@ async function applySolutionEnhancement(solution, openResponse, analysisResult,
|
|
|
425
429
|
/**
|
|
426
430
|
* Auto-populate existing questions based on user requirements
|
|
427
431
|
*/
|
|
428
|
-
async function autoPopulateQuestions(solution, openResponse, analysisResult, context) {
|
|
432
|
+
async function autoPopulateQuestions(solution, openResponse, analysisResult, context, interaction_id) {
|
|
429
433
|
const template = (0, shared_prompt_loader_1.loadPrompt)('solution-enhancement');
|
|
430
434
|
const enhancementPrompt = template
|
|
431
435
|
.replace('{current_solution}', JSON.stringify(solution, null, 2))
|
|
@@ -434,7 +438,10 @@ async function autoPopulateQuestions(solution, openResponse, analysisResult, con
|
|
|
434
438
|
.replace('{open_response}', openResponse);
|
|
435
439
|
// Get AI provider from context
|
|
436
440
|
const aiProvider = context.dotAI.ai;
|
|
437
|
-
const response = await aiProvider.sendMessage(enhancementPrompt
|
|
441
|
+
const response = await aiProvider.sendMessage(enhancementPrompt, 'answer-question-solution-enhancement', {
|
|
442
|
+
user_intent: openResponse,
|
|
443
|
+
interaction_id: interaction_id
|
|
444
|
+
});
|
|
438
445
|
const enhancementData = parseEnhancementResponse(response.content);
|
|
439
446
|
if (enhancementData.enhancedSolution) {
|
|
440
447
|
return enhancementData.enhancedSolution;
|
|
@@ -473,16 +480,16 @@ function parseEnhancementResponse(content) {
|
|
|
473
480
|
/**
|
|
474
481
|
* Enhance solution with AI analysis of open question
|
|
475
482
|
*/
|
|
476
|
-
async function enhanceSolutionWithOpenAnswer(solution, openAnswer, context) {
|
|
483
|
+
async function enhanceSolutionWithOpenAnswer(solution, openAnswer, context, interaction_id) {
|
|
477
484
|
try {
|
|
478
485
|
context.logger.info('Starting AI enhancement of solution', {
|
|
479
486
|
solutionId: solution.solutionId,
|
|
480
487
|
openAnswer
|
|
481
488
|
});
|
|
482
489
|
// Phase 1: Analyze what resources are needed
|
|
483
|
-
const analysisResult = await analyzeResourceNeeds(solution, openAnswer, context);
|
|
490
|
+
const analysisResult = await analyzeResourceNeeds(solution, openAnswer, context, interaction_id);
|
|
484
491
|
// Phase 2: Apply enhancements based on analysis
|
|
485
|
-
const enhancedSolution = await applySolutionEnhancement(solution, openAnswer, analysisResult, context);
|
|
492
|
+
const enhancedSolution = await applySolutionEnhancement(solution, openAnswer, analysisResult, context, interaction_id);
|
|
486
493
|
context.logger.info('AI enhancement completed', {
|
|
487
494
|
approach: analysisResult.approach,
|
|
488
495
|
changed: enhancedSolution !== solution
|
|
@@ -671,7 +678,7 @@ async function handleAnswerQuestionTool(args, dotAI, logger, requestId) {
|
|
|
671
678
|
solutionId: args.solutionId,
|
|
672
679
|
openAnswer
|
|
673
680
|
});
|
|
674
|
-
solution = await enhanceSolutionWithOpenAnswer(solution, openAnswer, { requestId, logger, dotAI });
|
|
681
|
+
solution = await enhanceSolutionWithOpenAnswer(solution, openAnswer, { requestId, logger, dotAI }, args.interaction_id);
|
|
675
682
|
// Save enhanced solution
|
|
676
683
|
saveSolutionFile(solution, args.solutionId, sessionDir);
|
|
677
684
|
logger.info('Enhanced solution saved', {
|
|
@@ -8,12 +8,14 @@ export declare const GENERATEMANIFESTS_TOOL_NAME = "generateManifests";
|
|
|
8
8
|
export declare const GENERATEMANIFESTS_TOOL_DESCRIPTION = "Generate final Kubernetes manifests from fully configured solution (ONLY after completing ALL stages: required, basic, advanced, and open)";
|
|
9
9
|
export declare const GENERATEMANIFESTS_TOOL_INPUT_SCHEMA: {
|
|
10
10
|
solutionId: z.ZodString;
|
|
11
|
+
interaction_id: z.ZodOptional<z.ZodString>;
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* Direct MCP tool handler for generateManifests functionality
|
|
14
15
|
*/
|
|
15
16
|
export declare function handleGenerateManifestsTool(args: {
|
|
16
17
|
solutionId: string;
|
|
18
|
+
interaction_id?: string;
|
|
17
19
|
}, dotAI: DotAI, logger: Logger, requestId: string): Promise<{
|
|
18
20
|
content: {
|
|
19
21
|
type: 'text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-manifests.d.ts","sourceRoot":"","sources":["../../src/tools/generate-manifests.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAWhD,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAC/D,eAAO,MAAM,kCAAkC,+IAA+I,CAAC;AAG/L,eAAO,MAAM,mCAAmC
|
|
1
|
+
{"version":3,"file":"generate-manifests.d.ts","sourceRoot":"","sources":["../../src/tools/generate-manifests.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAWhD,eAAO,MAAM,2BAA2B,sBAAsB,CAAC;AAC/D,eAAO,MAAM,kCAAkC,+IAA+I,CAAC;AAG/L,eAAO,MAAM,mCAAmC;;;CAG/C,CAAC;AAmSF;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,EACrD,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAsMxD"}
|
|
@@ -53,7 +53,8 @@ exports.GENERATEMANIFESTS_TOOL_NAME = 'generateManifests';
|
|
|
53
53
|
exports.GENERATEMANIFESTS_TOOL_DESCRIPTION = 'Generate final Kubernetes manifests from fully configured solution (ONLY after completing ALL stages: required, basic, advanced, and open)';
|
|
54
54
|
// Zod schema for MCP registration
|
|
55
55
|
exports.GENERATEMANIFESTS_TOOL_INPUT_SCHEMA = {
|
|
56
|
-
solutionId: zod_1.z.string().regex(/^sol_[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}_[a-f0-9]+$/).describe('The solution ID to generate manifests for (e.g., sol_2025-07-01T154349_1e1e242592ff)')
|
|
56
|
+
solutionId: zod_1.z.string().regex(/^sol_[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{6}_[a-f0-9]+$/).describe('The solution ID to generate manifests for (e.g., sol_2025-07-01T154349_1e1e242592ff)'),
|
|
57
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
57
58
|
};
|
|
58
59
|
/**
|
|
59
60
|
* Load solution file and validate structure
|
|
@@ -179,7 +180,7 @@ async function validateManifests(yamlPath) {
|
|
|
179
180
|
/**
|
|
180
181
|
* Generate manifests using AI provider
|
|
181
182
|
*/
|
|
182
|
-
async function generateManifestsWithAI(solution, dotAI, logger, errorContext, dotAiLabels) {
|
|
183
|
+
async function generateManifestsWithAI(solution, dotAI, logger, errorContext, dotAiLabels, interaction_id) {
|
|
183
184
|
// Load prompt template
|
|
184
185
|
const template = (0, shared_prompt_loader_1.loadPrompt)('manifest-generation');
|
|
185
186
|
// Retrieve schemas for solution resources
|
|
@@ -216,7 +217,10 @@ ${errorContext.previousManifests}
|
|
|
216
217
|
// Get AI provider from dotAI
|
|
217
218
|
const aiProvider = dotAI.ai;
|
|
218
219
|
// Send prompt to AI
|
|
219
|
-
const response = await aiProvider.sendMessage(aiPrompt
|
|
220
|
+
const response = await aiProvider.sendMessage(aiPrompt, 'recommend-manifests-generation', {
|
|
221
|
+
user_intent: solution.initialIntent || 'Kubernetes manifest generation',
|
|
222
|
+
interaction_id: interaction_id
|
|
223
|
+
});
|
|
220
224
|
// Extract YAML content from response
|
|
221
225
|
let manifestContent = response.content;
|
|
222
226
|
// Try to extract YAML from code blocks if wrapped
|
|
@@ -357,7 +361,7 @@ async function handleGenerateManifestsTool(args, dotAI, logger, requestId) {
|
|
|
357
361
|
const userAnswers = (0, solution_utils_1.extractUserAnswers)(solution);
|
|
358
362
|
const dotAiLabels = (0, solution_utils_1.addDotAiLabels)(undefined, userAnswers, solution);
|
|
359
363
|
// Generate manifests with AI (including labels)
|
|
360
|
-
const aiManifests = await generateManifestsWithAI(solution, dotAI, logger, lastError, dotAiLabels);
|
|
364
|
+
const aiManifests = await generateManifestsWithAI(solution, dotAI, logger, lastError, dotAiLabels, args.interaction_id);
|
|
361
365
|
// Generate metadata ConfigMap
|
|
362
366
|
const metadataConfigMap = generateMetadataConfigMap(solution, userAnswers, logger);
|
|
363
367
|
// Combine ConfigMap with AI-generated manifests
|
|
@@ -35,6 +35,7 @@ export declare const ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA: {
|
|
|
35
35
|
}>>;
|
|
36
36
|
resourceList: z.ZodOptional<z.ZodString>;
|
|
37
37
|
collection: z.ZodOptional<z.ZodString>;
|
|
38
|
+
interaction_id: z.ZodOptional<z.ZodString>;
|
|
38
39
|
};
|
|
39
40
|
/**
|
|
40
41
|
* Main tool handler - routes to appropriate data type handler
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAehD,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,oCAAoC,+jBAAyjB,CAAC;AAG3mB,eAAO,MAAM,qCAAqC
|
|
1
|
+
{"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAehD,eAAO,MAAM,6BAA6B,kBAAkB,CAAC;AAC7D,eAAO,MAAM,oCAAoC,+jBAAyjB,CAAC;AAG3mB,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;CA4BjD,CAAC;AAujBF;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CA0Hd"}
|
|
@@ -81,7 +81,8 @@ exports.ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA = {
|
|
|
81
81
|
// Resource list for specific resource scanning
|
|
82
82
|
resourceList: zod_1.z.string().optional().describe('Comma-separated list of resources to scan (format: Kind.group or Kind for core resources)'),
|
|
83
83
|
// Collection name for capabilities (allows using different collections for different purposes)
|
|
84
|
-
collection: zod_1.z.string().optional().describe('Collection name for capabilities operations (default: "capabilities", use "capabilities-policies" for pre-populated test data)')
|
|
84
|
+
collection: zod_1.z.string().optional().describe('Collection name for capabilities operations (default: "capabilities", use "capabilities-policies" for pre-populated test data)'),
|
|
85
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
85
86
|
};
|
|
86
87
|
/**
|
|
87
88
|
* Validate Vector DB connection and return helpful error if unavailable
|
|
@@ -13,6 +13,7 @@ export declare const RECOMMEND_TOOL_INPUT_SCHEMA: {
|
|
|
13
13
|
solutionId: z.ZodOptional<z.ZodString>;
|
|
14
14
|
answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
15
15
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
interaction_id: z.ZodOptional<z.ZodString>;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Direct MCP tool handler for recommend functionality (unified with stage routing)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommend.d.ts","sourceRoot":"","sources":["../../src/tools/recommend.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAahD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,iRAAiR,CAAC;AAGzT,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"recommend.d.ts","sourceRoot":"","sources":["../../src/tools/recommend.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAahD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,iRAAiR,CAAC;AAGzT,eAAO,MAAM,2BAA2B;;;;;;;;CAWvC,CAAC;AA2HF;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAsRxD"}
|
package/dist/tools/recommend.js
CHANGED
|
@@ -64,7 +64,8 @@ exports.RECOMMEND_TOOL_INPUT_SCHEMA = {
|
|
|
64
64
|
// Parameters for answerQuestion stage (stage parameter contains the config stage like "answerQuestion:required")
|
|
65
65
|
answers: zod_1.z.record(zod_1.z.any()).optional().describe('User answers for answerQuestion stage'),
|
|
66
66
|
// Parameters for deployManifests stage
|
|
67
|
-
timeout: zod_1.z.number().optional().describe('Deployment timeout in seconds for deployManifests stage')
|
|
67
|
+
timeout: zod_1.z.number().optional().describe('Deployment timeout in seconds for deployManifests stage'),
|
|
68
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
68
69
|
};
|
|
69
70
|
/**
|
|
70
71
|
* Analyze intent for clarification opportunities using AI
|
|
@@ -75,7 +76,7 @@ exports.RECOMMEND_TOOL_INPUT_SCHEMA = {
|
|
|
75
76
|
* @param organizationalPatterns Optional organizational patterns context
|
|
76
77
|
* @returns Analysis result with clarification opportunities
|
|
77
78
|
*/
|
|
78
|
-
async function analyzeIntentForClarification(intent, aiProvider, logger, organizationalPatterns = '') {
|
|
79
|
+
async function analyzeIntentForClarification(intent, aiProvider, logger, organizationalPatterns = '', evaluationContext) {
|
|
79
80
|
try {
|
|
80
81
|
// Load intent analysis prompt template
|
|
81
82
|
const analysisPrompt = (0, shared_prompt_loader_1.loadPrompt)('intent-analysis', {
|
|
@@ -83,7 +84,7 @@ async function analyzeIntentForClarification(intent, aiProvider, logger, organiz
|
|
|
83
84
|
organizational_patterns: organizationalPatterns || 'No specific organizational patterns available'
|
|
84
85
|
});
|
|
85
86
|
// Send to AI for analysis
|
|
86
|
-
const response = await aiProvider.sendMessage(analysisPrompt, 'intent-analysis');
|
|
87
|
+
const response = await aiProvider.sendMessage(analysisPrompt, 'recommend-intent-analysis', evaluationContext);
|
|
87
88
|
// Parse JSON response with robust error handling
|
|
88
89
|
let jsonContent = response.content;
|
|
89
90
|
// Try to find JSON object wrapped in code blocks
|
|
@@ -224,7 +225,11 @@ async function handleRecommendTool(args, dotAI, logger, requestId) {
|
|
|
224
225
|
// Check if intent clarification is needed (unless final=true)
|
|
225
226
|
if (!args.final) {
|
|
226
227
|
logger.debug('Analyzing intent for clarification opportunities', { requestId, intent: args.intent });
|
|
227
|
-
const analysisResult = await analyzeIntentForClarification(args.intent, aiProvider, logger
|
|
228
|
+
const analysisResult = await analyzeIntentForClarification(args.intent, aiProvider, logger, '', // organizationalPatterns - empty for now
|
|
229
|
+
{
|
|
230
|
+
user_intent: args.intent,
|
|
231
|
+
interaction_id: args.interaction_id
|
|
232
|
+
});
|
|
228
233
|
// If clarification opportunities exist, return them to the client agent
|
|
229
234
|
if (analysisResult.clarificationOpportunities &&
|
|
230
235
|
analysisResult.clarificationOpportunities.length > 0 &&
|
|
@@ -280,7 +285,7 @@ async function handleRecommendTool(args, dotAI, logger, requestId) {
|
|
|
280
285
|
};
|
|
281
286
|
// Find best solutions for the user intent
|
|
282
287
|
logger.debug('Generating recommendations with AI', { requestId });
|
|
283
|
-
const solutions = await recommender.findBestSolutions(args.intent, explainResourceFn);
|
|
288
|
+
const solutions = await recommender.findBestSolutions(args.intent, explainResourceFn, args.interaction_id);
|
|
284
289
|
logger.info('Recommendation process completed', {
|
|
285
290
|
requestId,
|
|
286
291
|
solutionCount: solutions.length,
|
|
@@ -12,6 +12,7 @@ export declare const REMEDIATE_TOOL_INPUT_SCHEMA: {
|
|
|
12
12
|
executeChoice: z.ZodOptional<z.ZodNumber>;
|
|
13
13
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
14
14
|
executedCommands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
interaction_id: z.ZodOptional<z.ZodString>;
|
|
15
16
|
};
|
|
16
17
|
export interface RemediateInput {
|
|
17
18
|
issue?: string;
|
|
@@ -21,11 +22,13 @@ export interface RemediateInput {
|
|
|
21
22
|
executeChoice?: number;
|
|
22
23
|
sessionId?: string;
|
|
23
24
|
executedCommands?: string[];
|
|
25
|
+
interaction_id?: string;
|
|
24
26
|
}
|
|
25
27
|
export interface RemediateSession {
|
|
26
28
|
sessionId: string;
|
|
27
29
|
issue: string;
|
|
28
30
|
mode: 'manual' | 'automatic';
|
|
31
|
+
interaction_id?: string;
|
|
29
32
|
finalAnalysis?: RemediateOutput;
|
|
30
33
|
created: Date;
|
|
31
34
|
updated: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remediate.d.ts","sourceRoot":"","sources":["../../src/tools/remediate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,yfAAwf,CAAC;AAIhiB,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"remediate.d.ts","sourceRoot":"","sources":["../../src/tools/remediate.ts"],"names":[],"mappings":"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"}
|
package/dist/tools/remediate.js
CHANGED
|
@@ -59,7 +59,8 @@ exports.REMEDIATE_TOOL_INPUT_SCHEMA = {
|
|
|
59
59
|
maxRiskLevel: zod_1.z.enum(['low', 'medium', 'high']).optional().default('low').describe('For automatic mode: maximum risk level allowed for execution (default: low)'),
|
|
60
60
|
executeChoice: zod_1.z.number().min(1).max(2).optional().describe('Execute a previously generated choice (1=Execute via MCP, 2=Execute via agent)'),
|
|
61
61
|
sessionId: zod_1.z.string().optional().describe('Session ID from previous remediate call when executing a choice'),
|
|
62
|
-
executedCommands: zod_1.z.array(zod_1.z.string()).optional().describe('Commands that were executed to remediate the issue')
|
|
62
|
+
executedCommands: zod_1.z.array(zod_1.z.string()).optional().describe('Commands that were executed to remediate the issue'),
|
|
63
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
63
64
|
};
|
|
64
65
|
/**
|
|
65
66
|
* Generate unique session ID for investigation tracking
|
|
@@ -103,7 +104,7 @@ function updateSessionFile(sessionDir, sessionId, updates) {
|
|
|
103
104
|
/**
|
|
104
105
|
* AI-driven investigation - uses toolLoop for single-phase investigation and analysis
|
|
105
106
|
*/
|
|
106
|
-
async function conductInvestigation(session, sessionDir, aiProvider, logger, requestId) {
|
|
107
|
+
async function conductInvestigation(session, sessionDir, aiProvider, logger, requestId, isValidation = false, interactionId) {
|
|
107
108
|
const maxIterations = 20;
|
|
108
109
|
logger.info('Starting AI investigation with toolLoop', {
|
|
109
110
|
requestId,
|
|
@@ -121,13 +122,18 @@ async function conductInvestigation(session, sessionDir, aiProvider, logger, req
|
|
|
121
122
|
});
|
|
122
123
|
// Use toolLoop for AI-driven investigation with kubectl tools
|
|
123
124
|
// System prompt is static (cached), issue description is dynamic (userMessage)
|
|
125
|
+
const operationName = isValidation ? 'remediate-validation' : 'remediate-investigation';
|
|
124
126
|
const result = await aiProvider.toolLoop({
|
|
125
127
|
systemPrompt: systemPrompt,
|
|
126
128
|
userMessage: `Investigate this Kubernetes issue: ${session.issue}`,
|
|
127
129
|
tools: kubectl_tools_1.KUBECTL_INVESTIGATION_TOOLS,
|
|
128
130
|
toolExecutor: kubectl_tools_1.executeKubectlTools,
|
|
129
131
|
maxIterations: maxIterations,
|
|
130
|
-
operation:
|
|
132
|
+
operation: operationName,
|
|
133
|
+
evaluationContext: {
|
|
134
|
+
user_intent: session.issue
|
|
135
|
+
},
|
|
136
|
+
interaction_id: interactionId
|
|
131
137
|
});
|
|
132
138
|
logger.info('Investigation completed by toolLoop', {
|
|
133
139
|
requestId,
|
|
@@ -293,7 +299,7 @@ function parseAIFinalAnalysis(aiResponse) {
|
|
|
293
299
|
/**
|
|
294
300
|
* Execute user choice from previous session
|
|
295
301
|
*/
|
|
296
|
-
async function executeUserChoice(sessionDir, sessionId, choice, logger, requestId) {
|
|
302
|
+
async function executeUserChoice(sessionDir, sessionId, choice, logger, requestId, currentInteractionId) {
|
|
297
303
|
try {
|
|
298
304
|
// Load previous session
|
|
299
305
|
const session = readSessionFile(sessionDir, sessionId);
|
|
@@ -309,7 +315,7 @@ async function executeUserChoice(sessionDir, sessionId, choice, logger, requestI
|
|
|
309
315
|
// Handle different choices
|
|
310
316
|
switch (choice) {
|
|
311
317
|
case 1: // Execute automatically via MCP
|
|
312
|
-
return await executeRemediationCommands(session, sessionDir, logger, requestId);
|
|
318
|
+
return await executeRemediationCommands(session, sessionDir, logger, requestId, currentInteractionId);
|
|
313
319
|
case 2: { // Execute via agent
|
|
314
320
|
// Use validation intent directly from final analysis
|
|
315
321
|
const validationIntent = session.finalAnalysis.validationIntent || 'Check the status of the affected resources to verify the issue has been resolved';
|
|
@@ -351,7 +357,7 @@ async function executeUserChoice(sessionDir, sessionId, choice, logger, requestI
|
|
|
351
357
|
/**
|
|
352
358
|
* Execute remediation commands via kubectl
|
|
353
359
|
*/
|
|
354
|
-
async function executeRemediationCommands(session, sessionDir, logger, requestId) {
|
|
360
|
+
async function executeRemediationCommands(session, sessionDir, logger, requestId, currentInteractionId) {
|
|
355
361
|
const results = [];
|
|
356
362
|
const finalAnalysis = session.finalAnalysis;
|
|
357
363
|
let overallSuccess = true;
|
|
@@ -424,7 +430,8 @@ async function executeRemediationCommands(session, sessionDir, logger, requestId
|
|
|
424
430
|
const validationInput = {
|
|
425
431
|
issue: validationIntent,
|
|
426
432
|
sessionDir: sessionDir,
|
|
427
|
-
executedCommands: executedCommands
|
|
433
|
+
executedCommands: executedCommands,
|
|
434
|
+
interaction_id: currentInteractionId || session.interaction_id // Use current interaction_id for validation
|
|
428
435
|
};
|
|
429
436
|
// Recursive call to main function for validation
|
|
430
437
|
const validationResponse = await handleRemediateTool(validationInput);
|
|
@@ -584,7 +591,7 @@ async function handleRemediateTool(args) {
|
|
|
584
591
|
choice: validatedInput.executeChoice,
|
|
585
592
|
sessionId: validatedInput.sessionId
|
|
586
593
|
});
|
|
587
|
-
return await executeUserChoice(sessionDir, validatedInput.sessionId, validatedInput.executeChoice, logger, requestId);
|
|
594
|
+
return await executeUserChoice(sessionDir, validatedInput.sessionId, validatedInput.executeChoice, logger, requestId, validatedInput.interaction_id);
|
|
588
595
|
}
|
|
589
596
|
// Validate that we have an issue for new investigations
|
|
590
597
|
if (!validatedInput.issue) {
|
|
@@ -596,6 +603,7 @@ async function handleRemediateTool(args) {
|
|
|
596
603
|
sessionId,
|
|
597
604
|
issue: validatedInput.issue,
|
|
598
605
|
mode: validatedInput.mode || 'manual',
|
|
606
|
+
interaction_id: validatedInput.interaction_id,
|
|
599
607
|
created: new Date(),
|
|
600
608
|
updated: new Date(),
|
|
601
609
|
status: 'investigating'
|
|
@@ -605,8 +613,9 @@ async function handleRemediateTool(args) {
|
|
|
605
613
|
logger.info('Investigation session created', { requestId, sessionId });
|
|
606
614
|
// Initialize AI provider (will validate API key automatically)
|
|
607
615
|
const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
|
|
608
|
-
// Conduct AI-driven investigation
|
|
609
|
-
const
|
|
616
|
+
// Conduct AI-driven investigation (detect if this is post-execution validation)
|
|
617
|
+
const isValidation = validatedInput.executedCommands && validatedInput.executedCommands.length > 0;
|
|
618
|
+
const finalAnalysis = await conductInvestigation(session, sessionDir, aiProvider, logger, requestId, isValidation, validatedInput.interaction_id);
|
|
610
619
|
logger.info('Remediation analysis completed', {
|
|
611
620
|
requestId,
|
|
612
621
|
sessionId,
|
|
@@ -670,7 +679,7 @@ async function handleRemediateTool(args) {
|
|
|
670
679
|
// Update session object with final analysis for execution
|
|
671
680
|
session.finalAnalysis = finalAnalysis;
|
|
672
681
|
// Execute commands and return the complete result (includes post-execution validation)
|
|
673
|
-
return await executeRemediationCommands(session, sessionDir, logger, requestId);
|
|
682
|
+
return await executeRemediationCommands(session, sessionDir, logger, requestId, validatedInput.interaction_id);
|
|
674
683
|
}
|
|
675
684
|
// Return MCP-compliant response
|
|
676
685
|
return {
|
|
@@ -752,7 +761,11 @@ function validateRemediateInput(args) {
|
|
|
752
761
|
exports.REMEDIATE_TOOL_INPUT_SCHEMA.maxRiskLevel.parse(args.maxRiskLevel) : 'low',
|
|
753
762
|
executeChoice: args.executeChoice !== undefined ?
|
|
754
763
|
exports.REMEDIATE_TOOL_INPUT_SCHEMA.executeChoice.parse(args.executeChoice) : undefined,
|
|
755
|
-
sessionId: args.sessionId ? exports.REMEDIATE_TOOL_INPUT_SCHEMA.sessionId.parse(args.sessionId) : undefined
|
|
764
|
+
sessionId: args.sessionId ? exports.REMEDIATE_TOOL_INPUT_SCHEMA.sessionId.parse(args.sessionId) : undefined,
|
|
765
|
+
executedCommands: args.executedCommands
|
|
766
|
+
? exports.REMEDIATE_TOOL_INPUT_SCHEMA.executedCommands.parse(args.executedCommands)
|
|
767
|
+
: undefined,
|
|
768
|
+
interaction_id: args.interaction_id ? exports.REMEDIATE_TOOL_INPUT_SCHEMA.interaction_id.parse(args.interaction_id) : undefined
|
|
756
769
|
};
|
|
757
770
|
return validated;
|
|
758
771
|
}
|
|
@@ -13,6 +13,7 @@ export declare const TESTDOCS_TOOL_INPUT_SCHEMA: {
|
|
|
13
13
|
sectionId: z.ZodOptional<z.ZodString>;
|
|
14
14
|
results: z.ZodOptional<z.ZodString>;
|
|
15
15
|
filePattern: z.ZodOptional<z.ZodString>;
|
|
16
|
+
interaction_id: z.ZodOptional<z.ZodString>;
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Handle test-docs tool request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-docs.d.ts","sourceRoot":"","sources":["../../src/tools/test-docs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOhD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,eAAO,MAAM,yBAAyB,+gBAA6gB,CAAC;AAGpjB,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"test-docs.d.ts","sourceRoot":"","sources":["../../src/tools/test-docs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOhD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,eAAO,MAAM,yBAAyB,+gBAA6gB,CAAC;AAGpjB,eAAO,MAAM,0BAA0B;;;;;;;;CAQtC,CAAC;AAEF;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,KAAK,GAAG,IAAI,EACpB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAkWd"}
|
package/dist/tools/test-docs.js
CHANGED
|
@@ -53,7 +53,8 @@ exports.TESTDOCS_TOOL_INPUT_SCHEMA = {
|
|
|
53
53
|
phase: zod_1.z.enum(['scan', 'test', 'analyze', 'fix', 'done']).optional().describe('Specific phase to run (defaults to scan)'),
|
|
54
54
|
sectionId: zod_1.z.string().optional().describe('Section ID when submitting test results'),
|
|
55
55
|
results: zod_1.z.string().optional().describe('Test results to store (for client agent reporting back)'),
|
|
56
|
-
filePattern: zod_1.z.string().optional().describe('File pattern for discovery (e.g., "**/*.md", "*.rst")')
|
|
56
|
+
filePattern: zod_1.z.string().optional().describe('File pattern for discovery (e.g., "**/*.md", "*.rst")'),
|
|
57
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
57
58
|
};
|
|
58
59
|
/**
|
|
59
60
|
* Handle test-docs tool request
|
|
@@ -64,7 +65,8 @@ async function handleTestDocsTool(args, _dotAI, logger, requestId) {
|
|
|
64
65
|
requestId,
|
|
65
66
|
filePath: args.filePath,
|
|
66
67
|
sessionId: args.sessionId,
|
|
67
|
-
phase: args.phase
|
|
68
|
+
phase: args.phase,
|
|
69
|
+
interaction_id: args.interaction_id
|
|
68
70
|
});
|
|
69
71
|
// Check if we're in discovery mode (no filePath and no sessionId provided)
|
|
70
72
|
if (!args.filePath && !args.sessionId) {
|
package/dist/tools/version.d.ts
CHANGED
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
* Provides comprehensive system status including version information,
|
|
5
5
|
* Vector DB connection status, and embedding service capabilities
|
|
6
6
|
*/
|
|
7
|
+
import { z } from 'zod';
|
|
7
8
|
import { Logger } from '../core/error-handling';
|
|
8
9
|
export declare const VERSION_TOOL_NAME = "version";
|
|
9
10
|
export declare const VERSION_TOOL_DESCRIPTION = "Get comprehensive system status including version information, Vector DB connection status, embedding service capabilities, AI provider connectivity, Kubernetes cluster connectivity, Kyverno policy engine status, and pattern management health check";
|
|
10
|
-
export declare const VERSION_TOOL_INPUT_SCHEMA: {
|
|
11
|
+
export declare const VERSION_TOOL_INPUT_SCHEMA: {
|
|
12
|
+
interaction_id: z.ZodOptional<z.ZodString>;
|
|
13
|
+
};
|
|
11
14
|
export interface VersionInfo {
|
|
12
15
|
version: string;
|
|
13
16
|
nodeVersion: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAMhD,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,wBAAwB,6PAA6P,CAAC;AACnS,eAAO,MAAM,yBAAyB;;CAErC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,EAAE;QACR,SAAS,EAAE,OAAO,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,EAAE;YACX,QAAQ,EAAE;gBACR,MAAM,EAAE,OAAO,CAAC;gBAChB,cAAc,CAAC,EAAE,MAAM,CAAC;gBACxB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,QAAQ,EAAE;gBACR,MAAM,EAAE,OAAO,CAAC;gBAChB,cAAc,CAAC,EAAE,MAAM,CAAC;gBACxB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;YACF,YAAY,EAAE;gBACZ,MAAM,EAAE,OAAO,CAAC;gBAChB,cAAc,CAAC,EAAE,MAAM,CAAC;gBACxB,KAAK,CAAC,EAAE,MAAM,CAAC;aAChB,CAAC;SACH,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,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,CAAC;IACF,UAAU,EAAE;QACV,SAAS,EAAE,OAAO,CAAC;QACnB,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,UAAU,EAAE;QACV,SAAS,EAAE,OAAO,CAAC;QACnB,WAAW,CAAC,EAAE;YACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;QACF,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,YAAY,EAAE;QACZ,WAAW,EAAE,OAAO,CAAC;QACrB,eAAe,EAAE,OAAO,CAAC;QACzB,oBAAoB,EAAE,OAAO,CAAC;QAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,qBAAqB,EAAE,OAAO,CAAC;QAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE;QACP,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,OAAO,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH;AAgOD;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CA8HzE;AAyHD;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAqB5C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAwFd"}
|
package/dist/tools/version.js
CHANGED
|
@@ -45,6 +45,7 @@ exports.getVersionInfo = getVersionInfo;
|
|
|
45
45
|
exports.handleVersionTool = handleVersionTool;
|
|
46
46
|
const fs_1 = require("fs");
|
|
47
47
|
const path_1 = require("path");
|
|
48
|
+
const zod_1 = require("zod");
|
|
48
49
|
const k8s = __importStar(require("@kubernetes/client-node"));
|
|
49
50
|
const index_1 = require("../core/index");
|
|
50
51
|
const discovery_1 = require("../core/discovery");
|
|
@@ -52,7 +53,9 @@ const kubernetes_utils_1 = require("../core/kubernetes-utils");
|
|
|
52
53
|
const nushell_runtime_1 = require("../core/nushell-runtime");
|
|
53
54
|
exports.VERSION_TOOL_NAME = 'version';
|
|
54
55
|
exports.VERSION_TOOL_DESCRIPTION = 'Get comprehensive system status including version information, Vector DB connection status, embedding service capabilities, AI provider connectivity, Kubernetes cluster connectivity, Kyverno policy engine status, and pattern management health check';
|
|
55
|
-
exports.VERSION_TOOL_INPUT_SCHEMA = {
|
|
56
|
+
exports.VERSION_TOOL_INPUT_SCHEMA = {
|
|
57
|
+
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
58
|
+
};
|
|
56
59
|
/**
|
|
57
60
|
* Test Vector DB connectivity and get status for all collections
|
|
58
61
|
*/
|
|
@@ -423,7 +426,7 @@ async function getNushellStatus() {
|
|
|
423
426
|
/**
|
|
424
427
|
* Test AI provider connectivity
|
|
425
428
|
*/
|
|
426
|
-
async function getAIProviderStatus() {
|
|
429
|
+
async function getAIProviderStatus(interaction_id) {
|
|
427
430
|
try {
|
|
428
431
|
// Import AI provider factory and test connectivity
|
|
429
432
|
const { createAIProvider } = await Promise.resolve().then(() => __importStar(require('../core/ai-provider-factory')));
|
|
@@ -437,7 +440,10 @@ async function getAIProviderStatus() {
|
|
|
437
440
|
};
|
|
438
441
|
}
|
|
439
442
|
// Test with a minimal request to check connectivity
|
|
440
|
-
await aiProvider.sendMessage('test'
|
|
443
|
+
await aiProvider.sendMessage('test', 'version-connectivity-check', {
|
|
444
|
+
user_intent: 'Test AI provider connectivity and system version check',
|
|
445
|
+
interaction_id: interaction_id
|
|
446
|
+
});
|
|
441
447
|
return {
|
|
442
448
|
connected: true,
|
|
443
449
|
keyConfigured: true,
|
|
@@ -492,6 +498,8 @@ function getVersionInfo() {
|
|
|
492
498
|
*/
|
|
493
499
|
async function handleVersionTool(args, logger, requestId) {
|
|
494
500
|
try {
|
|
501
|
+
// Extract interaction_id for evaluation dataset generation
|
|
502
|
+
const interaction_id = args.interaction_id ? exports.VERSION_TOOL_INPUT_SCHEMA.interaction_id.parse(args.interaction_id) : undefined;
|
|
495
503
|
logger.info('Processing version tool request with system diagnostics', { requestId });
|
|
496
504
|
// Get version info
|
|
497
505
|
const version = getVersionInfo();
|
|
@@ -500,7 +508,7 @@ async function handleVersionTool(args, logger, requestId) {
|
|
|
500
508
|
const [vectorDBStatus, embeddingStatus, aiProviderStatus, kubernetesStatus, capabilityStatus, kyvernoStatus, nushellStatus] = await Promise.all([
|
|
501
509
|
getVectorDBStatus(),
|
|
502
510
|
getEmbeddingStatus(),
|
|
503
|
-
getAIProviderStatus(),
|
|
511
|
+
getAIProviderStatus(interaction_id),
|
|
504
512
|
getKubernetesStatus(),
|
|
505
513
|
getCapabilityStatus(),
|
|
506
514
|
getKyvernoStatus(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vfarcic/dot-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.0",
|
|
4
4
|
"description": "AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance",
|
|
5
5
|
"mcpName": "io.github.vfarcic/dot-ai",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"test:integration:server": "KUBECONFIG=./kubeconfig-test.yaml PORT=3456 DOT_AI_SESSION_DIR=./tmp/sessions TRANSPORT_TYPE=http QDRANT_URL=http://localhost:6335 QDRANT_CAPABILITIES_COLLECTION=capabilities-policies ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY OPENAI_API_KEY=$OPENAI_API_KEY node dist/mcp/server.js",
|
|
19
19
|
"test:integration": "./tests/integration/infrastructure/run-integration-tests.sh",
|
|
20
20
|
"test:integration:watch": "vitest --config=vitest.integration.config.ts --test-timeout=1200000",
|
|
21
|
+
"test:integration:sonnet": "AI_PROVIDER=anthropic AI_PROVIDER_SDK=vercel DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
|
|
22
|
+
"test:integration:gpt": "AI_PROVIDER=openai AI_PROVIDER_SDK=vercel DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
|
|
23
|
+
"test:integration:gpt-pro": "AI_PROVIDER=openai_pro AI_PROVIDER_SDK=vercel DEBUG_DOT_AI=true ./tests/integration/infrastructure/run-integration-tests.sh",
|
|
24
|
+
"eval:comparative": "DEBUG_DOT_AI=true npx tsx src/evaluation/eval-runner.ts",
|
|
21
25
|
"clean": "rm -rf dist",
|
|
22
26
|
"prebuild": "npm run clean && npm run lint",
|
|
23
27
|
"build": "tsc --sourceMap false",
|