@vfarcic/dot-ai 1.0.3 → 1.1.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 +1 -0
- package/dist/core/ai-provider.interface.d.ts +12 -8
- package/dist/core/ai-provider.interface.d.ts.map +1 -1
- package/dist/core/artifacthub.d.ts +1 -1
- package/dist/core/artifacthub.d.ts.map +1 -1
- package/dist/core/base-vector-service.d.ts +22 -9
- package/dist/core/base-vector-service.d.ts.map +1 -1
- package/dist/core/base-vector-service.js +106 -37
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/capabilities.js +5 -2
- package/dist/core/capability-operations.d.ts +55 -7
- package/dist/core/capability-operations.d.ts.map +1 -1
- package/dist/core/capability-operations.js +1 -3
- package/dist/core/capability-scan-workflow.d.ts +64 -8
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +14 -13
- package/dist/core/capability-tools.d.ts +1 -1
- package/dist/core/capability-tools.d.ts.map +1 -1
- package/dist/core/capability-tools.js +1 -1
- package/dist/core/capability-vector-service.d.ts +3 -4
- package/dist/core/capability-vector-service.d.ts.map +1 -1
- package/dist/core/capability-vector-service.js +2 -2
- package/dist/core/command-executor.d.ts +3 -4
- package/dist/core/command-executor.d.ts.map +1 -1
- package/dist/core/command-executor.js +8 -4
- package/dist/core/crd-availability.d.ts +3 -5
- package/dist/core/crd-availability.d.ts.map +1 -1
- package/dist/core/crd-availability.js +8 -18
- package/dist/core/deploy-operation.d.ts +6 -5
- package/dist/core/deploy-operation.d.ts.map +1 -1
- package/dist/core/deploy-operation.js +16 -10
- package/dist/core/discovery.d.ts +6 -14
- package/dist/core/discovery.d.ts.map +1 -1
- package/dist/core/discovery.js +35 -51
- package/dist/core/embedding-service.d.ts.map +1 -1
- package/dist/core/embedding-service.js +1 -1
- package/dist/core/error-handling.d.ts +13 -13
- package/dist/core/error-handling.d.ts.map +1 -1
- package/dist/core/error-handling.js +2 -3
- package/dist/core/generic-session-manager.d.ts +2 -2
- package/dist/core/generic-session-manager.d.ts.map +1 -1
- package/dist/core/helm-types.d.ts +5 -5
- package/dist/core/helm-types.d.ts.map +1 -1
- package/dist/core/index.d.ts +4 -11
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -14
- package/dist/core/knowledge-types.d.ts +114 -0
- package/dist/core/knowledge-types.d.ts.map +1 -0
- package/dist/core/knowledge-types.js +10 -0
- package/dist/core/memory.d.ts +12 -12
- package/dist/core/memory.d.ts.map +1 -1
- package/dist/core/mermaid-tools.d.ts +24 -1
- package/dist/core/mermaid-tools.d.ts.map +1 -1
- package/dist/core/mermaid-tools.js +10 -8
- package/dist/core/packaging.d.ts +23 -1
- package/dist/core/packaging.d.ts.map +1 -1
- package/dist/core/pattern-operations.d.ts +32 -9
- package/dist/core/pattern-operations.d.ts.map +1 -1
- package/dist/core/pattern-operations.js +17 -22
- package/dist/core/pattern-vector-service.d.ts +3 -4
- package/dist/core/pattern-vector-service.d.ts.map +1 -1
- package/dist/core/pattern-vector-service.js +2 -2
- package/dist/core/platform-utils.d.ts +2 -2
- package/dist/core/platform-utils.d.ts.map +1 -1
- package/dist/core/plugin-manager.d.ts +6 -2
- package/dist/core/plugin-manager.d.ts.map +1 -1
- package/dist/core/plugin-manager.js +9 -16
- package/dist/core/plugin-registry.d.ts +59 -0
- package/dist/core/plugin-registry.d.ts.map +1 -0
- package/dist/core/plugin-registry.js +80 -0
- package/dist/core/policy-operations.d.ts +101 -21
- package/dist/core/policy-operations.d.ts.map +1 -1
- package/dist/core/policy-operations.js +45 -47
- package/dist/core/policy-vector-service.d.ts +3 -4
- package/dist/core/policy-vector-service.d.ts.map +1 -1
- package/dist/core/policy-vector-service.js +2 -2
- package/dist/core/providers/host-provider.d.ts +1 -1
- package/dist/core/providers/host-provider.d.ts.map +1 -1
- package/dist/core/providers/host-provider.js +2 -2
- package/dist/core/providers/provider-debug-utils.d.ts +2 -2
- package/dist/core/providers/provider-debug-utils.d.ts.map +1 -1
- package/dist/core/providers/tool-utils.d.ts +10 -2
- package/dist/core/providers/tool-utils.d.ts.map +1 -1
- package/dist/core/providers/tool-utils.js +2 -2
- package/dist/core/providers/vercel-provider.d.ts.map +1 -1
- package/dist/core/providers/vercel-provider.js +29 -23
- package/dist/core/resource-tools.d.ts +29 -1
- package/dist/core/resource-tools.d.ts.map +1 -1
- package/dist/core/resource-vector-service.d.ts +3 -4
- package/dist/core/resource-vector-service.d.ts.map +1 -1
- package/dist/core/resource-vector-service.js +2 -2
- package/dist/core/schema.d.ts +15 -14
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +32 -34
- package/dist/core/shared-prompt-loader.d.ts +1 -1
- package/dist/core/shared-prompt-loader.d.ts.map +1 -1
- package/dist/core/solution-cr.js +1 -1
- package/dist/core/solution-utils.d.ts +22 -3
- package/dist/core/solution-utils.d.ts.map +1 -1
- package/dist/core/solution-utils.js +1 -1
- package/dist/core/telemetry/client.d.ts +0 -6
- package/dist/core/telemetry/client.d.ts.map +1 -1
- package/dist/core/telemetry/client.js +6 -17
- package/dist/core/telemetry/config.js +1 -1
- package/dist/core/telemetry/index.d.ts +1 -1
- package/dist/core/telemetry/index.d.ts.map +1 -1
- package/dist/core/telemetry/index.js +1 -2
- package/dist/core/tracing/tool-tracing.d.ts +1 -1
- package/dist/core/tracing/tool-tracing.d.ts.map +1 -1
- package/dist/core/unified-creation-session.d.ts +15 -8
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +19 -19
- package/dist/core/unified-creation-types.d.ts +2 -2
- package/dist/core/unified-creation-types.d.ts.map +1 -1
- package/dist/core/visualization.d.ts +1 -1
- package/dist/core/visualization.d.ts.map +1 -1
- package/dist/core/workflow.d.ts +8 -5
- package/dist/core/workflow.d.ts.map +1 -1
- package/dist/evaluation/dataset-analyzer.d.ts +13 -7
- package/dist/evaluation/dataset-analyzer.d.ts.map +1 -1
- package/dist/evaluation/dataset-analyzer.js +1 -1
- package/dist/evaluation/datasets/loader.d.ts +2 -2
- package/dist/evaluation/datasets/loader.d.ts.map +1 -1
- package/dist/evaluation/eval-runner.js +7 -5
- package/dist/evaluation/evaluators/base-comparative.d.ts +1 -1
- package/dist/evaluation/evaluators/base-comparative.d.ts.map +1 -1
- package/dist/evaluation/evaluators/base-comparative.js +4 -3
- package/dist/evaluation/evaluators/base.d.ts +5 -5
- package/dist/evaluation/evaluators/base.d.ts.map +1 -1
- package/dist/evaluation/evaluators/capability-comparative.js +1 -1
- package/dist/evaluation/platform-synthesizer.d.ts.map +1 -1
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +26 -15
- package/dist/interfaces/openapi-generator.d.ts +116 -12
- package/dist/interfaces/openapi-generator.d.ts.map +1 -1
- package/dist/interfaces/openapi-generator.js +490 -199
- package/dist/interfaces/rest-api.d.ts +28 -6
- package/dist/interfaces/rest-api.d.ts.map +1 -1
- package/dist/interfaces/rest-api.js +436 -245
- package/dist/interfaces/rest-registry.d.ts +4 -4
- package/dist/interfaces/rest-registry.d.ts.map +1 -1
- package/dist/interfaces/rest-registry.js +6 -5
- package/dist/interfaces/rest-route-registry.d.ts +165 -0
- package/dist/interfaces/rest-route-registry.d.ts.map +1 -0
- package/dist/interfaces/rest-route-registry.js +230 -0
- package/dist/interfaces/routes/index.d.ts +22 -0
- package/dist/interfaces/routes/index.d.ts.map +1 -0
- package/dist/interfaces/routes/index.js +347 -0
- package/dist/interfaces/schemas/common.d.ts +177 -0
- package/dist/interfaces/schemas/common.d.ts.map +1 -0
- package/dist/interfaces/schemas/common.js +102 -0
- package/dist/interfaces/schemas/events.d.ts +131 -0
- package/dist/interfaces/schemas/events.d.ts.map +1 -0
- package/dist/interfaces/schemas/events.js +66 -0
- package/dist/interfaces/schemas/index.d.ts +21 -0
- package/dist/interfaces/schemas/index.d.ts.map +1 -0
- package/dist/interfaces/schemas/index.js +138 -0
- package/dist/interfaces/schemas/knowledge.d.ts +210 -0
- package/dist/interfaces/schemas/knowledge.d.ts.map +1 -0
- package/dist/interfaces/schemas/knowledge.js +117 -0
- package/dist/interfaces/schemas/logs.d.ts +82 -0
- package/dist/interfaces/schemas/logs.d.ts.map +1 -0
- package/dist/interfaces/schemas/logs.js +46 -0
- package/dist/interfaces/schemas/prompts.d.ts +191 -0
- package/dist/interfaces/schemas/prompts.d.ts.map +1 -0
- package/dist/interfaces/schemas/prompts.js +91 -0
- package/dist/interfaces/schemas/resources.d.ts +378 -0
- package/dist/interfaces/schemas/resources.d.ts.map +1 -0
- package/dist/interfaces/schemas/resources.js +173 -0
- package/dist/interfaces/schemas/sessions.d.ts +90 -0
- package/dist/interfaces/schemas/sessions.d.ts.map +1 -0
- package/dist/interfaces/schemas/sessions.js +56 -0
- package/dist/interfaces/schemas/tools.d.ts +194 -0
- package/dist/interfaces/schemas/tools.d.ts.map +1 -0
- package/dist/interfaces/schemas/tools.js +101 -0
- package/dist/interfaces/schemas/visualization.d.ts +373 -0
- package/dist/interfaces/schemas/visualization.d.ts.map +1 -0
- package/dist/interfaces/schemas/visualization.js +134 -0
- package/dist/mcp/server.js +5 -4
- package/dist/tools/answer-question.d.ts +1 -1
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +9 -8
- package/dist/tools/deploy-manifests.d.ts +4 -2
- package/dist/tools/deploy-manifests.d.ts.map +1 -1
- package/dist/tools/deploy-manifests.js +10 -6
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +28 -20
- 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/manage-knowledge.d.ts +77 -0
- package/dist/tools/manage-knowledge.d.ts.map +1 -0
- package/dist/tools/manage-knowledge.js +573 -0
- package/dist/tools/operate-analysis.d.ts +31 -2
- package/dist/tools/operate-analysis.d.ts.map +1 -1
- package/dist/tools/operate-execution.d.ts +2 -3
- package/dist/tools/operate-execution.d.ts.map +1 -1
- package/dist/tools/operate-execution.js +7 -7
- package/dist/tools/operate.d.ts +7 -2
- package/dist/tools/operate.d.ts.map +1 -1
- package/dist/tools/operate.js +2 -2
- package/dist/tools/organizational-data.d.ts +30 -4
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +24 -19
- package/dist/tools/project-setup/discovery.d.ts.map +1 -1
- package/dist/tools/project-setup/generate-scope.d.ts +1 -1
- package/dist/tools/project-setup/generate-scope.d.ts.map +1 -1
- package/dist/tools/project-setup/types.d.ts +1 -0
- package/dist/tools/project-setup/types.d.ts.map +1 -1
- package/dist/tools/prompts.d.ts +28 -2
- package/dist/tools/prompts.d.ts.map +1 -1
- package/dist/tools/query.d.ts +17 -3
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +1 -7
- package/dist/tools/recommend.d.ts +24 -6
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +18 -15
- package/dist/tools/remediate.d.ts +12 -3
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +22 -14
- package/dist/tools/version.d.ts +19 -5
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +106 -54
- package/package.json +11 -5
- package/prompts/knowledge-ask.md +29 -0
- package/dist/core/vector-db-service.d.ts +0 -108
- package/dist/core/vector-db-service.d.ts.map +0 -1
- package/dist/core/vector-db-service.js +0 -647
package/dist/tools/recommend.js
CHANGED
|
@@ -61,7 +61,6 @@ function generateIntentRefinementGuidance(intent) {
|
|
|
61
61
|
guidance
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
// Session management now handled by GenericSessionManager
|
|
65
64
|
/**
|
|
66
65
|
* Direct MCP tool handler for recommend functionality (unified with stage routing)
|
|
67
66
|
* PRD #343: pluginManager required for kubectl operations
|
|
@@ -79,18 +78,20 @@ async function handleRecommendTool(args, dotAI, logger, requestId, pluginManager
|
|
|
79
78
|
// Extract config stage from stage parameter (e.g., "answerQuestion:required" -> "required")
|
|
80
79
|
const configStage = stage.split(':')[1];
|
|
81
80
|
const answerQuestionArgs = {
|
|
82
|
-
solutionId: args.solutionId,
|
|
81
|
+
solutionId: args.solutionId || '',
|
|
83
82
|
stage: configStage,
|
|
84
|
-
answers: args.answers
|
|
83
|
+
answers: args.answers || {},
|
|
84
|
+
interaction_id: args.interaction_id
|
|
85
85
|
};
|
|
86
86
|
return await (0, answer_question_1.handleAnswerQuestionTool)(answerQuestionArgs, dotAI, logger, requestId);
|
|
87
87
|
}
|
|
88
88
|
if (stage === 'generateManifests') {
|
|
89
|
-
// PRD #
|
|
89
|
+
// PRD #359: Uses unified plugin registry for kubectl operations
|
|
90
90
|
return await (0, generate_manifests_1.handleGenerateManifestsTool)(args, dotAI, logger, requestId, pluginManager);
|
|
91
91
|
}
|
|
92
92
|
if (stage === 'deployManifests') {
|
|
93
|
-
|
|
93
|
+
// PRD #359: Uses unified plugin registry for kubectl operations
|
|
94
|
+
return await (0, deploy_manifests_1.handleDeployManifestsTool)(args, dotAI, logger, requestId);
|
|
94
95
|
}
|
|
95
96
|
// Default: recommend stage (original recommend logic)
|
|
96
97
|
// Input validation is handled automatically by MCP SDK with Zod schema
|
|
@@ -104,15 +105,17 @@ async function handleRecommendTool(args, dotAI, logger, requestId, pluginManager
|
|
|
104
105
|
intent: args.intent,
|
|
105
106
|
hasApiProvider: dotAI.ai.isInitialized()
|
|
106
107
|
});
|
|
108
|
+
// Ensure intent is provided for recommend stage
|
|
109
|
+
const intent = args.intent || '';
|
|
107
110
|
// Check if intent needs refinement using simple heuristic (unless final=true)
|
|
108
|
-
if (!args.final && isVagueIntent(
|
|
111
|
+
if (!args.final && isVagueIntent(intent)) {
|
|
109
112
|
logger.debug('Vague intent detected, returning refinement guidance', {
|
|
110
113
|
requestId,
|
|
111
|
-
intent
|
|
112
|
-
intentLength:
|
|
114
|
+
intent,
|
|
115
|
+
intentLength: intent.length,
|
|
113
116
|
threshold: VAGUE_INTENT_THRESHOLD
|
|
114
117
|
});
|
|
115
|
-
const guidanceResponse = generateIntentRefinementGuidance(
|
|
118
|
+
const guidanceResponse = generateIntentRefinementGuidance(intent);
|
|
116
119
|
return {
|
|
117
120
|
content: [
|
|
118
121
|
{
|
|
@@ -128,12 +131,12 @@ async function handleRecommendTool(args, dotAI, logger, requestId, pluginManager
|
|
|
128
131
|
else {
|
|
129
132
|
logger.debug('Intent is detailed enough, proceeding with recommendations', {
|
|
130
133
|
requestId,
|
|
131
|
-
intentLength:
|
|
134
|
+
intentLength: intent.length
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
// Initialize AI-powered ResourceRecommender with provider
|
|
135
|
-
// PRD #
|
|
136
|
-
const recommender = new schema_1.ResourceRecommender(dotAI.ai
|
|
138
|
+
// PRD #359: Uses unified plugin registry for kubectl operations
|
|
139
|
+
const recommender = new schema_1.ResourceRecommender(dotAI.ai);
|
|
137
140
|
// Create discovery function
|
|
138
141
|
const explainResourceFn = async (resource) => {
|
|
139
142
|
logger.debug(`Explaining resource: ${resource}`, { requestId });
|
|
@@ -141,7 +144,7 @@ async function handleRecommendTool(args, dotAI, logger, requestId, pluginManager
|
|
|
141
144
|
};
|
|
142
145
|
// Find best solutions for the user intent
|
|
143
146
|
logger.debug('Generating recommendations with AI', { requestId });
|
|
144
|
-
const solutionResult = await recommender.findBestSolutions(
|
|
147
|
+
const solutionResult = await recommender.findBestSolutions(intent, explainResourceFn, args.interaction_id);
|
|
145
148
|
// Handle Helm recommendation case
|
|
146
149
|
if (solutionResult.helmRecommendation) {
|
|
147
150
|
logger.info('Helm installation recommended, searching ArtifactHub', {
|
|
@@ -205,7 +208,7 @@ async function handleRecommendTool(args, dotAI, logger, requestId, pluginManager
|
|
|
205
208
|
const originalChart = charts.find(c => c.name === aiSolution.chartName);
|
|
206
209
|
const solutionData = {
|
|
207
210
|
toolName: 'recommend',
|
|
208
|
-
intent
|
|
211
|
+
intent,
|
|
209
212
|
type: 'helm',
|
|
210
213
|
score: aiSolution.score,
|
|
211
214
|
description: aiSolution.description,
|
|
@@ -294,7 +297,7 @@ async function handleRecommendTool(args, dotAI, logger, requestId, pluginManager
|
|
|
294
297
|
// Create complete solution data
|
|
295
298
|
const solutionData = {
|
|
296
299
|
toolName: 'recommend',
|
|
297
|
-
intent
|
|
300
|
+
intent,
|
|
298
301
|
type: solution.type,
|
|
299
302
|
score: solution.score,
|
|
300
303
|
description: solution.description,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Remediate Tool - AI-powered Kubernetes issue analysis and remediation
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
import { PluginManager } from '../core/plugin-manager';
|
|
6
5
|
import { BaseVisualizationData } from '../core/visualization';
|
|
7
6
|
export declare const REMEDIATE_TOOL_NAME = "remediate";
|
|
8
7
|
export declare const REMEDIATE_TOOL_DESCRIPTION = "AI-powered Kubernetes issue analysis that provides root cause identification and actionable remediation steps. Unlike basic kubectl commands, this tool performs multi-step investigation, correlates cluster data, and generates intelligent solutions. Use when users want to understand WHY something is broken, not just see raw status. Ideal for: troubleshooting failures, diagnosing performance issues, analyzing pod problems, investigating networking/storage issues, or any \"what's wrong\" questions.";
|
|
@@ -95,6 +94,15 @@ export interface RemediateOutput {
|
|
|
95
94
|
fallbackReason?: string;
|
|
96
95
|
mode?: 'manual' | 'automatic';
|
|
97
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Remediate tool response type
|
|
99
|
+
*/
|
|
100
|
+
export interface RemediateToolResponse {
|
|
101
|
+
content: Array<{
|
|
102
|
+
type: 'text';
|
|
103
|
+
text: string;
|
|
104
|
+
}>;
|
|
105
|
+
}
|
|
98
106
|
/**
|
|
99
107
|
* AI Final Analysis Response interface matching final analysis prompt format
|
|
100
108
|
*/
|
|
@@ -117,8 +125,9 @@ export declare function parseAIFinalAnalysis(aiResponse: string): AIFinalAnalysi
|
|
|
117
125
|
/**
|
|
118
126
|
* Main tool handler for remediate tool
|
|
119
127
|
*
|
|
120
|
-
* PRD #343:
|
|
128
|
+
* PRD #343: All kubectl operations go through plugin.
|
|
129
|
+
* PRD #359: Uses unified plugin registry - no pluginManager parameter needed.
|
|
121
130
|
*/
|
|
122
|
-
export declare function handleRemediateTool(args:
|
|
131
|
+
export declare function handleRemediateTool(args: RemediateInput): Promise<RemediateToolResponse>;
|
|
123
132
|
export {};
|
|
124
133
|
//# sourceMappingURL=remediate.d.ts.map
|
|
@@ -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;
|
|
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;AAMxB,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAgBnF,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,yfAAwf,CAAC;AAIhiB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;CASvC,CAAC;AAGF,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAID,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,QAAQ,EAAE,WAAW,CAAC;IACtB,K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B,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,uBAAuB,CAmGhF;AA8YD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA0M9F"}
|
package/dist/tools/remediate.js
CHANGED
|
@@ -45,6 +45,7 @@ const ai_provider_factory_1 = require("../core/ai-provider-factory");
|
|
|
45
45
|
const generic_session_manager_1 = require("../core/generic-session-manager");
|
|
46
46
|
const index_1 = require("../core/index");
|
|
47
47
|
const visualization_1 = require("../core/visualization");
|
|
48
|
+
const plugin_registry_1 = require("../core/plugin-registry");
|
|
48
49
|
const fs = __importStar(require("fs"));
|
|
49
50
|
const path = __importStar(require("path"));
|
|
50
51
|
// PRD #143 Milestone 1: Hybrid approach - AI can use kubectl_api_resources tool OR continue with JSON dataRequests
|
|
@@ -62,7 +63,6 @@ exports.REMEDIATE_TOOL_INPUT_SCHEMA = {
|
|
|
62
63
|
executedCommands: zod_1.z.array(zod_1.z.string()).optional().describe('Commands that were executed to remediate the issue'),
|
|
63
64
|
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
64
65
|
};
|
|
65
|
-
// Session management now handled by GenericSessionManager
|
|
66
66
|
/** Kubectl tool names for investigation and validation */
|
|
67
67
|
const KUBECTL_INVESTIGATION_TOOL_NAMES = [
|
|
68
68
|
'kubectl_get',
|
|
@@ -81,9 +81,14 @@ const KUBECTL_INVESTIGATION_TOOL_NAMES = [
|
|
|
81
81
|
* AI-driven investigation - uses toolLoop for single-phase investigation and analysis
|
|
82
82
|
*
|
|
83
83
|
* PRD #343: Kubectl tools are routed through the plugin system.
|
|
84
|
+
* PRD #359: Uses unified plugin registry for tool access.
|
|
84
85
|
* No fallback to direct execution - MCP server has no RBAC.
|
|
85
86
|
*/
|
|
86
|
-
async function conductInvestigation(session, sessionManager, aiProvider, logger, requestId,
|
|
87
|
+
async function conductInvestigation(session, sessionManager, aiProvider, logger, requestId, isValidation = false, interactionId) {
|
|
88
|
+
if (!(0, plugin_registry_1.isPluginInitialized)()) {
|
|
89
|
+
throw new Error('Plugin system not initialized');
|
|
90
|
+
}
|
|
91
|
+
const pluginManager = (0, plugin_registry_1.getPluginManager)();
|
|
87
92
|
const maxIterations = 30; // Increased for thorough investigation workflows
|
|
88
93
|
logger.info('Starting AI investigation with toolLoop', {
|
|
89
94
|
requestId,
|
|
@@ -293,8 +298,9 @@ function parseAIFinalAnalysis(aiResponse) {
|
|
|
293
298
|
}
|
|
294
299
|
/**
|
|
295
300
|
* Execute user choice from previous session
|
|
301
|
+
* PRD #359: Uses unified plugin registry
|
|
296
302
|
*/
|
|
297
|
-
async function executeUserChoice(sessionManager, sessionId, choice, logger, requestId,
|
|
303
|
+
async function executeUserChoice(sessionManager, sessionId, choice, logger, requestId, currentInteractionId) {
|
|
298
304
|
try {
|
|
299
305
|
// Load previous session
|
|
300
306
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -313,7 +319,7 @@ async function executeUserChoice(sessionManager, sessionId, choice, logger, requ
|
|
|
313
319
|
// Handle different choices
|
|
314
320
|
switch (choice) {
|
|
315
321
|
case 1: // Execute automatically via MCP
|
|
316
|
-
return await executeRemediationCommands(session, sessionManager, logger, requestId,
|
|
322
|
+
return await executeRemediationCommands(session, sessionManager, logger, requestId, currentInteractionId);
|
|
317
323
|
case 2: { // Execute via agent
|
|
318
324
|
// Use validation intent directly from final analysis
|
|
319
325
|
const validationIntent = session.data.finalAnalysis.validationIntent || 'Check the status of the affected resources to verify the issue has been resolved';
|
|
@@ -354,8 +360,9 @@ async function executeUserChoice(sessionManager, sessionId, choice, logger, requ
|
|
|
354
360
|
}
|
|
355
361
|
/**
|
|
356
362
|
* Execute remediation commands via kubectl
|
|
363
|
+
* PRD #359: Uses unified plugin registry
|
|
357
364
|
*/
|
|
358
|
-
async function executeRemediationCommands(session, sessionManager, logger, requestId,
|
|
365
|
+
async function executeRemediationCommands(session, sessionManager, logger, requestId, currentInteractionId) {
|
|
359
366
|
const results = [];
|
|
360
367
|
const finalAnalysis = session.data.finalAnalysis;
|
|
361
368
|
let overallSuccess = true;
|
|
@@ -375,11 +382,11 @@ async function executeRemediationCommands(session, sessionManager, logger, reque
|
|
|
375
382
|
actionId,
|
|
376
383
|
command: action.command
|
|
377
384
|
});
|
|
378
|
-
// PRD #
|
|
385
|
+
// PRD #359: Execute the command via unified plugin registry
|
|
379
386
|
// Clean up escape sequences that some AI models incorrectly add to JSON parameters
|
|
380
387
|
let fullCommand = action.command || '';
|
|
381
388
|
fullCommand = fullCommand.replace(/\\"/g, '"');
|
|
382
|
-
const response = await
|
|
389
|
+
const response = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'shell_exec', { command: fullCommand });
|
|
383
390
|
if (!response.success) {
|
|
384
391
|
throw new Error(response.error?.message || 'Command execution failed');
|
|
385
392
|
}
|
|
@@ -475,8 +482,8 @@ IMPORTANT: You MUST respond with the final JSON analysis format as specified in
|
|
|
475
482
|
executedCommands: executedCommands,
|
|
476
483
|
interaction_id: currentInteractionId || session.data.interaction_id // Use current interaction_id for validation
|
|
477
484
|
};
|
|
478
|
-
// Recursive call to main function for validation
|
|
479
|
-
const validationResponse = await handleRemediateTool(validationInput
|
|
485
|
+
// Recursive call to main function for validation (PRD #359: uses unified registry)
|
|
486
|
+
const validationResponse = await handleRemediateTool(validationInput);
|
|
480
487
|
const validationData = JSON.parse(validationResponse.content[0].text);
|
|
481
488
|
// If validation discovered new issues, enhance with execution context
|
|
482
489
|
if (validationData.status === 'awaiting_user_approval') {
|
|
@@ -615,9 +622,10 @@ IMPORTANT: You MUST respond with the final JSON analysis format as specified in
|
|
|
615
622
|
/**
|
|
616
623
|
* Main tool handler for remediate tool
|
|
617
624
|
*
|
|
618
|
-
* PRD #343:
|
|
625
|
+
* PRD #343: All kubectl operations go through plugin.
|
|
626
|
+
* PRD #359: Uses unified plugin registry - no pluginManager parameter needed.
|
|
619
627
|
*/
|
|
620
|
-
async function handleRemediateTool(args
|
|
628
|
+
async function handleRemediateTool(args) {
|
|
621
629
|
const requestId = `remediate_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
622
630
|
const logger = new error_handling_1.ConsoleLogger('RemediateTool');
|
|
623
631
|
try {
|
|
@@ -633,7 +641,7 @@ async function handleRemediateTool(args, pluginManager) {
|
|
|
633
641
|
choice: validatedInput.executeChoice,
|
|
634
642
|
sessionId: validatedInput.sessionId
|
|
635
643
|
});
|
|
636
|
-
return await executeUserChoice(sessionManager, validatedInput.sessionId, validatedInput.executeChoice, logger, requestId,
|
|
644
|
+
return await executeUserChoice(sessionManager, validatedInput.sessionId, validatedInput.executeChoice, logger, requestId, validatedInput.interaction_id);
|
|
637
645
|
}
|
|
638
646
|
// Validate that we have an issue for new investigations
|
|
639
647
|
if (!validatedInput.issue) {
|
|
@@ -653,7 +661,7 @@ async function handleRemediateTool(args, pluginManager) {
|
|
|
653
661
|
const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
|
|
654
662
|
// Conduct AI-driven investigation (detect if this is post-execution validation)
|
|
655
663
|
const isValidation = validatedInput.executedCommands && validatedInput.executedCommands.length > 0;
|
|
656
|
-
const finalAnalysis = await conductInvestigation(session, sessionManager, aiProvider, logger, requestId,
|
|
664
|
+
const finalAnalysis = await conductInvestigation(session, sessionManager, aiProvider, logger, requestId, isValidation, validatedInput.interaction_id);
|
|
657
665
|
logger.info('Remediation analysis completed', {
|
|
658
666
|
requestId,
|
|
659
667
|
sessionId: session.sessionId,
|
|
@@ -724,7 +732,7 @@ async function handleRemediateTool(args, pluginManager) {
|
|
|
724
732
|
// Update session object with final analysis for execution
|
|
725
733
|
session.data.finalAnalysis = finalAnalysis;
|
|
726
734
|
// Execute commands and return the complete result (includes post-execution validation)
|
|
727
|
-
return await executeRemediationCommands(session, sessionManager, logger, requestId,
|
|
735
|
+
return await executeRemediationCommands(session, sessionManager, logger, requestId, validatedInput.interaction_id);
|
|
728
736
|
}
|
|
729
737
|
// Generate visualization URL for analysis response
|
|
730
738
|
const visualizationUrl = (0, visualization_1.getVisualizationUrl)(session.sessionId);
|
package/dist/tools/version.d.ts
CHANGED
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { Logger } from '../core/error-handling';
|
|
11
11
|
import { BaseVisualizationData } from '../core/visualization';
|
|
12
|
-
import { PluginManager } from '../core/plugin-manager';
|
|
13
12
|
export declare const VERSION_TOOL_NAME = "version";
|
|
14
13
|
export declare const VERSION_TOOL_DESCRIPTION = "Get comprehensive system health and diagnostics";
|
|
15
14
|
export declare const VERSION_TOOL_INPUT_SCHEMA: {
|
|
@@ -48,6 +47,11 @@ export interface SystemStatus {
|
|
|
48
47
|
documentsCount?: number;
|
|
49
48
|
error?: string;
|
|
50
49
|
};
|
|
50
|
+
knowledgeBase: {
|
|
51
|
+
exists: boolean;
|
|
52
|
+
documentsCount?: number;
|
|
53
|
+
error?: string;
|
|
54
|
+
};
|
|
51
55
|
};
|
|
52
56
|
};
|
|
53
57
|
embedding: {
|
|
@@ -136,13 +140,23 @@ export declare function getVersionInfo(): VersionInfo;
|
|
|
136
140
|
export declare function getTracingStatus(): SystemStatus['tracing'];
|
|
137
141
|
/**
|
|
138
142
|
* Get Kyverno status via plugin (PRD #343)
|
|
139
|
-
* Uses
|
|
143
|
+
* PRD #359: Uses unified plugin registry
|
|
140
144
|
*/
|
|
141
|
-
export declare function getKyvernoStatusViaPlugin(
|
|
145
|
+
export declare function getKyvernoStatusViaPlugin(): Promise<SystemStatus['kyverno']>;
|
|
142
146
|
/**
|
|
143
147
|
* Handle version tool request with comprehensive system diagnostics
|
|
144
148
|
*
|
|
145
|
-
* PRD #
|
|
149
|
+
* PRD #359: Uses unified plugin registry for all K8s interactions
|
|
146
150
|
*/
|
|
147
|
-
|
|
151
|
+
interface VersionToolArgs {
|
|
152
|
+
interaction_id?: string;
|
|
153
|
+
}
|
|
154
|
+
interface VersionToolResponse {
|
|
155
|
+
content: Array<{
|
|
156
|
+
type: 'text';
|
|
157
|
+
text: string;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
export declare function handleVersionTool(args: VersionToolArgs | undefined, logger: Logger, requestId: string): Promise<VersionToolResponse>;
|
|
161
|
+
export {};
|
|
148
162
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOhD,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAOhD,OAAO,EAAuB,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGnF,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,wBAAwB,oDAAoD,CAAC;AAC1F,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,EAA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rB,OAAO,EAAE;QACP,OAAO,EAAE,SAAS,GAAG,UAAU,CAAC;QAChC,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,gBAAgB,EAAE,MAAM,CAAC;QACzB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,uBAAuB,EAAE,MAAM,CAAC;QAChC,YAAY,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;CAC7B;AA+cD;;GAEG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAqB5C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,CAAC,SAAS,CAAC,CAW1D;AAqDD;;;GAGG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CA0GlF;AAED;;;;GAIG;AACH,UAAU,eAAe;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,mBAAmB;IAC3B,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAmI9B"}
|
package/dist/tools/version.js
CHANGED
|
@@ -56,77 +56,86 @@ const tracing_1 = require("../core/tracing");
|
|
|
56
56
|
const config_1 = require("../core/tracing/config");
|
|
57
57
|
const generic_session_manager_1 = require("../core/generic-session-manager");
|
|
58
58
|
const visualization_1 = require("../core/visualization");
|
|
59
|
+
const plugin_registry_1 = require("../core/plugin-registry");
|
|
59
60
|
exports.VERSION_TOOL_NAME = 'version';
|
|
60
61
|
exports.VERSION_TOOL_DESCRIPTION = 'Get comprehensive system health and diagnostics';
|
|
61
62
|
exports.VERSION_TOOL_INPUT_SCHEMA = {
|
|
62
63
|
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
63
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Helper function to create error collections object
|
|
67
|
+
* PRD #356: Added knowledgeBase collection
|
|
68
|
+
*/
|
|
69
|
+
function createErrorCollections(errorMessage) {
|
|
70
|
+
return {
|
|
71
|
+
patterns: { exists: false, error: errorMessage },
|
|
72
|
+
policies: { exists: false, error: errorMessage },
|
|
73
|
+
capabilities: { exists: false, error: errorMessage },
|
|
74
|
+
resources: { exists: false, error: errorMessage },
|
|
75
|
+
knowledgeBase: { exists: false, error: errorMessage },
|
|
76
|
+
};
|
|
77
|
+
}
|
|
64
78
|
/**
|
|
65
79
|
* Test Vector DB connectivity and get status for all collections
|
|
80
|
+
* PRD #359: Uses plugin for all Qdrant operations, URL comes from plugin
|
|
66
81
|
*/
|
|
67
82
|
async function getVectorDBStatus() {
|
|
68
|
-
|
|
69
|
-
const testVectorDB = new index_1.VectorDBService({ collectionName: 'test' });
|
|
70
|
-
const config = testVectorDB.getConfig();
|
|
83
|
+
const fallbackUrl = 'unknown';
|
|
71
84
|
try {
|
|
72
|
-
// Test basic Vector DB connectivity
|
|
73
|
-
const
|
|
74
|
-
|
|
85
|
+
// Test basic Vector DB connectivity via plugin
|
|
86
|
+
const healthResponse = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'collection_stats', {
|
|
87
|
+
collection: 'capabilities', // Use any collection for health check
|
|
88
|
+
});
|
|
89
|
+
if (!healthResponse.success) {
|
|
75
90
|
return {
|
|
76
91
|
connected: false,
|
|
77
|
-
url:
|
|
92
|
+
url: fallbackUrl,
|
|
78
93
|
error: 'Health check failed - Vector DB not responding',
|
|
79
|
-
collections:
|
|
80
|
-
patterns: { exists: false, error: 'Vector DB not accessible' },
|
|
81
|
-
policies: { exists: false, error: 'Vector DB not accessible' },
|
|
82
|
-
capabilities: { exists: false, error: 'Vector DB not accessible' },
|
|
83
|
-
resources: { exists: false, error: 'Vector DB not accessible' }
|
|
84
|
-
}
|
|
94
|
+
collections: createErrorCollections('Vector DB not accessible'),
|
|
85
95
|
};
|
|
86
96
|
}
|
|
97
|
+
// Extract URL from plugin response (PRD #359)
|
|
98
|
+
const toolResult = healthResponse.result;
|
|
99
|
+
const url = toolResult?.data?.url || fallbackUrl;
|
|
87
100
|
// Test each collection separately
|
|
88
101
|
const embeddingService = new index_1.EmbeddingService();
|
|
89
102
|
// Test patterns collection
|
|
90
103
|
const patternsStatus = await testCollectionStatus('patterns', () => {
|
|
91
|
-
const
|
|
92
|
-
const patternService = new index_1.PatternVectorService('patterns', patternVectorDB, embeddingService);
|
|
104
|
+
const patternService = new index_1.PatternVectorService('patterns', embeddingService);
|
|
93
105
|
return patternService.getPatternsCount();
|
|
94
106
|
});
|
|
95
107
|
// Test policies collection
|
|
96
108
|
const policiesStatus = await testCollectionStatus('policies', () => {
|
|
97
|
-
const
|
|
98
|
-
const policyService = new index_1.PolicyVectorService(policyVectorDB, embeddingService);
|
|
109
|
+
const policyService = new index_1.PolicyVectorService(embeddingService);
|
|
99
110
|
return policyService.getDataCount();
|
|
100
111
|
});
|
|
101
112
|
// Test capabilities collection
|
|
102
113
|
const capabilitiesStatus = await testCollectionStatus('capabilities', () => {
|
|
103
|
-
const capabilityService = new index_1.CapabilityVectorService();
|
|
114
|
+
const capabilityService = new index_1.CapabilityVectorService('capabilities', embeddingService);
|
|
104
115
|
return capabilityService.getCapabilitiesCount();
|
|
105
116
|
});
|
|
106
117
|
// Test resources collection and get synced types
|
|
107
118
|
const resourcesStatus = await testResourcesCollectionStatus(embeddingService);
|
|
119
|
+
// Test knowledge base collection (PRD #356)
|
|
120
|
+
const knowledgeBaseStatus = await testKnowledgeBaseCollectionStatus();
|
|
108
121
|
return {
|
|
109
122
|
connected: true,
|
|
110
|
-
url
|
|
123
|
+
url,
|
|
111
124
|
collections: {
|
|
112
125
|
patterns: patternsStatus,
|
|
113
126
|
policies: policiesStatus,
|
|
114
127
|
capabilities: capabilitiesStatus,
|
|
115
|
-
resources: resourcesStatus
|
|
116
|
-
|
|
128
|
+
resources: resourcesStatus,
|
|
129
|
+
knowledgeBase: knowledgeBaseStatus,
|
|
130
|
+
},
|
|
117
131
|
};
|
|
118
132
|
}
|
|
119
133
|
catch (error) {
|
|
120
134
|
return {
|
|
121
135
|
connected: false,
|
|
122
|
-
url:
|
|
136
|
+
url: fallbackUrl,
|
|
123
137
|
error: error instanceof Error ? error.message : String(error),
|
|
124
|
-
collections:
|
|
125
|
-
patterns: { exists: false, error: 'Vector DB connection failed' },
|
|
126
|
-
policies: { exists: false, error: 'Vector DB connection failed' },
|
|
127
|
-
capabilities: { exists: false, error: 'Vector DB connection failed' },
|
|
128
|
-
resources: { exists: false, error: 'Vector DB connection failed' }
|
|
129
|
-
}
|
|
138
|
+
collections: createErrorCollections('Vector DB connection failed'),
|
|
130
139
|
};
|
|
131
140
|
}
|
|
132
141
|
}
|
|
@@ -158,8 +167,7 @@ async function testCollectionStatus(collectionName, getCountFn) {
|
|
|
158
167
|
*/
|
|
159
168
|
async function testResourcesCollectionStatus(embeddingService) {
|
|
160
169
|
try {
|
|
161
|
-
const
|
|
162
|
-
const resourceService = new resource_vector_service_1.ResourceVectorService('resources', resourceVectorDB, embeddingService);
|
|
170
|
+
const resourceService = new resource_vector_service_1.ResourceVectorService('resources', embeddingService);
|
|
163
171
|
const resources = await resourceService.listResources();
|
|
164
172
|
const documentsCount = resources.length;
|
|
165
173
|
return {
|
|
@@ -178,6 +186,56 @@ async function testResourcesCollectionStatus(embeddingService) {
|
|
|
178
186
|
};
|
|
179
187
|
}
|
|
180
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Test knowledge base collection status (PRD #356)
|
|
191
|
+
* Uses plugin to query collection stats directly
|
|
192
|
+
*/
|
|
193
|
+
async function testKnowledgeBaseCollectionStatus() {
|
|
194
|
+
try {
|
|
195
|
+
const response = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'collection_stats', {
|
|
196
|
+
collection: 'knowledge-base',
|
|
197
|
+
});
|
|
198
|
+
if (!response.success) {
|
|
199
|
+
const errorMessage = response.error?.message || 'Failed to get collection stats';
|
|
200
|
+
const collectionNotExists = errorMessage.toLowerCase().includes('collection') &&
|
|
201
|
+
(errorMessage.toLowerCase().includes('not exist') ||
|
|
202
|
+
errorMessage.toLowerCase().includes('does not exist') ||
|
|
203
|
+
errorMessage.toLowerCase().includes('not found'));
|
|
204
|
+
return {
|
|
205
|
+
exists: false,
|
|
206
|
+
error: collectionNotExists ? 'knowledge-base collection does not exist' : errorMessage
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
const result = response.result;
|
|
210
|
+
// Check for nested error in result
|
|
211
|
+
if (result.success === false) {
|
|
212
|
+
const errorMessage = result.error || 'Collection query failed';
|
|
213
|
+
const collectionNotExists = errorMessage.toLowerCase().includes('collection') &&
|
|
214
|
+
(errorMessage.toLowerCase().includes('not exist') ||
|
|
215
|
+
errorMessage.toLowerCase().includes('does not exist') ||
|
|
216
|
+
errorMessage.toLowerCase().includes('not found'));
|
|
217
|
+
return {
|
|
218
|
+
exists: false,
|
|
219
|
+
error: collectionNotExists ? 'knowledge-base collection does not exist' : errorMessage
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
exists: true,
|
|
224
|
+
documentsCount: result.data?.pointsCount ?? 0
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
229
|
+
const collectionNotExists = errorMessage.toLowerCase().includes('collection') &&
|
|
230
|
+
(errorMessage.toLowerCase().includes('not exist') ||
|
|
231
|
+
errorMessage.toLowerCase().includes('does not exist') ||
|
|
232
|
+
errorMessage.toLowerCase().includes('not found'));
|
|
233
|
+
return {
|
|
234
|
+
exists: false,
|
|
235
|
+
error: collectionNotExists ? 'knowledge-base collection does not exist' : errorMessage
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
181
239
|
/**
|
|
182
240
|
* Test embedding service status
|
|
183
241
|
* Performs actual embedding generation test to verify service works
|
|
@@ -414,12 +472,12 @@ function getVersionInfo() {
|
|
|
414
472
|
const packageJsonPath = (0, path_1.join)(mcpServerDir, 'package.json');
|
|
415
473
|
packageJson = JSON.parse((0, fs_1.readFileSync)(packageJsonPath, 'utf8'));
|
|
416
474
|
}
|
|
417
|
-
catch
|
|
475
|
+
catch {
|
|
418
476
|
// If package.json not found, use unknown version
|
|
419
477
|
packageJson = { version: 'unknown' };
|
|
420
478
|
}
|
|
421
479
|
return {
|
|
422
|
-
version: packageJson.version,
|
|
480
|
+
version: packageJson.version || 'unknown',
|
|
423
481
|
nodeVersion: process.version,
|
|
424
482
|
platform: process.platform,
|
|
425
483
|
arch: process.arch
|
|
@@ -441,11 +499,11 @@ function getTracingStatus() {
|
|
|
441
499
|
}
|
|
442
500
|
/**
|
|
443
501
|
* Get Kubernetes status via plugin (PRD #343)
|
|
444
|
-
* Uses
|
|
502
|
+
* PRD #359: Uses unified plugin registry
|
|
445
503
|
*/
|
|
446
|
-
async function getKubernetesStatusViaPlugin(
|
|
504
|
+
async function getKubernetesStatusViaPlugin() {
|
|
447
505
|
try {
|
|
448
|
-
const response = await
|
|
506
|
+
const response = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'kubectl_version', {});
|
|
449
507
|
if (!response.success) {
|
|
450
508
|
return {
|
|
451
509
|
connected: false,
|
|
@@ -488,12 +546,12 @@ async function getKubernetesStatusViaPlugin(pluginManager) {
|
|
|
488
546
|
}
|
|
489
547
|
/**
|
|
490
548
|
* Get Kyverno status via plugin (PRD #343)
|
|
491
|
-
* Uses
|
|
549
|
+
* PRD #359: Uses unified plugin registry
|
|
492
550
|
*/
|
|
493
|
-
async function getKyvernoStatusViaPlugin(
|
|
551
|
+
async function getKyvernoStatusViaPlugin() {
|
|
494
552
|
try {
|
|
495
553
|
// Check if Kyverno CRD exists (clusterpolicies.kyverno.io)
|
|
496
|
-
const crdResponse = await
|
|
554
|
+
const crdResponse = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'kubectl_get_resource_json', {
|
|
497
555
|
resource: 'crd/clusterpolicies.kyverno.io'
|
|
498
556
|
});
|
|
499
557
|
// Check both outer success and nested result.success
|
|
@@ -518,7 +576,7 @@ async function getKyvernoStatusViaPlugin(pluginManager) {
|
|
|
518
576
|
let deploymentReady = false;
|
|
519
577
|
let version;
|
|
520
578
|
// Try to get kyverno-admission-controller deployment
|
|
521
|
-
const deploymentResponse = await
|
|
579
|
+
const deploymentResponse = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'kubectl_get_resource_json', {
|
|
522
580
|
resource: 'deployment/kyverno-admission-controller',
|
|
523
581
|
namespace: 'kyverno'
|
|
524
582
|
});
|
|
@@ -542,7 +600,7 @@ async function getKyvernoStatusViaPlugin(pluginManager) {
|
|
|
542
600
|
}
|
|
543
601
|
// Check webhook configuration
|
|
544
602
|
let webhookReady = false;
|
|
545
|
-
const webhookResponse = await
|
|
603
|
+
const webhookResponse = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'kubectl_get_resource_json', {
|
|
546
604
|
resource: 'validatingwebhookconfiguration/kyverno-resource-validating-webhook-cfg'
|
|
547
605
|
});
|
|
548
606
|
// Check both outer success and nested result.success
|
|
@@ -588,21 +646,15 @@ async function getKyvernoStatusViaPlugin(pluginManager) {
|
|
|
588
646
|
};
|
|
589
647
|
}
|
|
590
648
|
}
|
|
591
|
-
|
|
592
|
-
* Handle version tool request with comprehensive system diagnostics
|
|
593
|
-
*
|
|
594
|
-
* PRD #343: When pluginManager is provided, uses plugin system for all K8s interactions
|
|
595
|
-
*/
|
|
596
|
-
async function handleVersionTool(args, logger, requestId, pluginManager) {
|
|
649
|
+
async function handleVersionTool(args, logger, requestId) {
|
|
597
650
|
try {
|
|
598
651
|
// Extract interaction_id for evaluation dataset generation
|
|
599
|
-
const interaction_id = args
|
|
652
|
+
const interaction_id = args?.interaction_id ? exports.VERSION_TOOL_INPUT_SCHEMA.interaction_id.parse(args.interaction_id) : undefined;
|
|
600
653
|
logger.info('Processing version tool request with system diagnostics', { requestId });
|
|
601
654
|
// Get version info
|
|
602
655
|
const version = getVersionInfo();
|
|
603
|
-
// PRD #
|
|
604
|
-
|
|
605
|
-
const hasK8sPlugins = pluginManager?.isPluginTool('kubectl_version') ?? false;
|
|
656
|
+
// PRD #359: Check for plugins via unified registry
|
|
657
|
+
const hasK8sPlugins = (0, plugin_registry_1.isPluginInitialized)();
|
|
606
658
|
// Run all diagnostics in parallel for better performance
|
|
607
659
|
logger.info('Running system diagnostics...', { requestId, hasK8sPlugins });
|
|
608
660
|
const [vectorDBStatus, embeddingStatus, aiProviderStatus, kubernetesStatus, capabilityStatus, kyvernoStatus] = await Promise.all([
|
|
@@ -610,17 +662,17 @@ async function handleVersionTool(args, logger, requestId, pluginManager) {
|
|
|
610
662
|
getEmbeddingStatus(),
|
|
611
663
|
getAIProviderStatus(interaction_id),
|
|
612
664
|
hasK8sPlugins
|
|
613
|
-
? getKubernetesStatusViaPlugin(
|
|
665
|
+
? getKubernetesStatusViaPlugin()
|
|
614
666
|
: Promise.resolve({ connected: false, kubeconfig: 'unknown', error: 'Kubernetes plugins not available' }),
|
|
615
667
|
getCapabilityStatus(),
|
|
616
668
|
hasK8sPlugins
|
|
617
|
-
? getKyvernoStatusViaPlugin(
|
|
669
|
+
? getKyvernoStatusViaPlugin()
|
|
618
670
|
: Promise.resolve({ installed: false, policyGenerationReady: false, error: 'Kubernetes plugins not available' })
|
|
619
671
|
]);
|
|
620
672
|
// Get tracing status synchronously (no async operations)
|
|
621
673
|
const tracingStatus = getTracingStatus();
|
|
622
|
-
// PRD #
|
|
623
|
-
const pluginStats =
|
|
674
|
+
// PRD #359: Add plugin stats via unified registry
|
|
675
|
+
const pluginStats = (0, plugin_registry_1.getPluginManager)()?.getStats();
|
|
624
676
|
const systemStatus = {
|
|
625
677
|
version,
|
|
626
678
|
vectorDB: vectorDBStatus,
|