@vfarcic/dot-ai 0.195.0 → 1.0.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 +2 -7
- package/dist/core/capability-scan-workflow.d.ts +4 -3
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +34 -39
- package/dist/core/circuit-breaker.d.ts +1 -0
- package/dist/core/circuit-breaker.d.ts.map +1 -1
- package/dist/core/circuit-breaker.js +11 -3
- package/dist/core/command-executor.d.ts +10 -1
- package/dist/core/command-executor.d.ts.map +1 -1
- package/dist/core/command-executor.js +63 -48
- package/dist/core/crd-availability.d.ts +6 -1
- package/dist/core/crd-availability.d.ts.map +1 -1
- package/dist/core/crd-availability.js +59 -49
- package/dist/core/deploy-operation.d.ts +17 -3
- package/dist/core/deploy-operation.d.ts.map +1 -1
- package/dist/core/deploy-operation.js +72 -21
- package/dist/core/discovery.d.ts +16 -43
- package/dist/core/discovery.d.ts.map +1 -1
- package/dist/core/discovery.js +128 -277
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +20 -9
- package/dist/core/pattern-operations.d.ts +3 -1
- package/dist/core/pattern-operations.d.ts.map +1 -1
- package/dist/core/pattern-operations.js +3 -2
- package/dist/core/plugin-client.d.ts +53 -0
- package/dist/core/plugin-client.d.ts.map +1 -0
- package/dist/core/plugin-client.js +148 -0
- package/dist/core/plugin-manager.d.ts +119 -0
- package/dist/core/plugin-manager.d.ts.map +1 -0
- package/dist/core/plugin-manager.js +366 -0
- package/dist/core/plugin-types.d.ts +100 -0
- package/dist/core/plugin-types.d.ts.map +1 -0
- package/dist/core/plugin-types.js +10 -0
- package/dist/core/policy-operations.d.ts +15 -7
- package/dist/core/policy-operations.d.ts.map +1 -1
- package/dist/core/policy-operations.js +59 -31
- package/dist/core/resource-tools.d.ts +2 -90
- package/dist/core/resource-tools.d.ts.map +1 -1
- package/dist/core/resource-tools.js +4 -178
- package/dist/core/schema.d.ts +18 -2
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +118 -16
- package/dist/core/telemetry/client.d.ts +7 -0
- package/dist/core/telemetry/client.d.ts.map +1 -1
- package/dist/core/telemetry/client.js +51 -51
- 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 +2 -1
- package/dist/core/telemetry/types.d.ts +1 -3
- package/dist/core/telemetry/types.d.ts.map +1 -1
- package/dist/core/tracing/index.d.ts +0 -1
- package/dist/core/tracing/index.d.ts.map +1 -1
- package/dist/core/tracing/index.js +1 -4
- package/dist/core/unified-creation-session.d.ts +6 -1
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +19 -11
- package/dist/interfaces/mcp.d.ts +8 -2
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +85 -34
- package/dist/interfaces/resource-sync-handler.d.ts.map +1 -1
- package/dist/interfaces/resource-sync-handler.js +37 -17
- package/dist/interfaces/rest-api.d.ts +4 -1
- package/dist/interfaces/rest-api.d.ts.map +1 -1
- package/dist/interfaces/rest-api.js +172 -49
- package/dist/mcp/server.js +39 -54
- package/dist/tools/deploy-manifests.d.ts +3 -1
- package/dist/tools/deploy-manifests.d.ts.map +1 -1
- package/dist/tools/deploy-manifests.js +112 -13
- package/dist/tools/generate-manifests.d.ts +3 -1
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +107 -33
- package/dist/tools/operate-analysis.d.ts +5 -1
- package/dist/tools/operate-analysis.d.ts.map +1 -1
- package/dist/tools/operate-analysis.js +37 -7
- package/dist/tools/operate-execution.d.ts +3 -1
- package/dist/tools/operate-execution.d.ts.map +1 -1
- package/dist/tools/operate-execution.js +6 -4
- package/dist/tools/operate.d.ts +7 -2
- package/dist/tools/operate.d.ts.map +1 -1
- package/dist/tools/operate.js +10 -6
- package/dist/tools/organizational-data.d.ts +3 -2
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +15 -13
- package/dist/tools/query.d.ts +5 -1
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +26 -18
- package/dist/tools/recommend.d.ts +3 -1
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +7 -7
- package/dist/tools/remediate.d.ts +5 -2
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +69 -20
- package/dist/tools/version.d.ts +20 -5
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +169 -161
- package/package.json +1 -1
- package/prompts/helm-generation.md +9 -0
- package/dist/core/cluster-utils.d.ts +0 -12
- package/dist/core/cluster-utils.d.ts.map +0 -1
- package/dist/core/cluster-utils.js +0 -27
- package/dist/core/helm-utils.d.ts +0 -66
- package/dist/core/helm-utils.d.ts.map +0 -1
- package/dist/core/helm-utils.js +0 -196
- package/dist/core/kubectl-tools.d.ts +0 -71
- package/dist/core/kubectl-tools.d.ts.map +0 -1
- package/dist/core/kubectl-tools.js +0 -546
- package/dist/core/kubernetes-utils.d.ts +0 -38
- package/dist/core/kubernetes-utils.d.ts.map +0 -1
- package/dist/core/kubernetes-utils.js +0 -288
- package/dist/core/tracing/k8s-tracing.d.ts +0 -57
- package/dist/core/tracing/k8s-tracing.d.ts.map +0 -1
- package/dist/core/tracing/k8s-tracing.js +0 -155
- package/scripts/toolhive.nu +0 -21
package/dist/tools/remediate.js
CHANGED
|
@@ -43,7 +43,6 @@ const zod_1 = require("zod");
|
|
|
43
43
|
const error_handling_1 = require("../core/error-handling");
|
|
44
44
|
const ai_provider_factory_1 = require("../core/ai-provider-factory");
|
|
45
45
|
const generic_session_manager_1 = require("../core/generic-session-manager");
|
|
46
|
-
const kubectl_tools_1 = require("../core/kubectl-tools");
|
|
47
46
|
const index_1 = require("../core/index");
|
|
48
47
|
const visualization_1 = require("../core/visualization");
|
|
49
48
|
const fs = __importStar(require("fs"));
|
|
@@ -64,10 +63,27 @@ exports.REMEDIATE_TOOL_INPUT_SCHEMA = {
|
|
|
64
63
|
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
65
64
|
};
|
|
66
65
|
// Session management now handled by GenericSessionManager
|
|
66
|
+
/** Kubectl tool names for investigation and validation */
|
|
67
|
+
const KUBECTL_INVESTIGATION_TOOL_NAMES = [
|
|
68
|
+
'kubectl_get',
|
|
69
|
+
'kubectl_describe',
|
|
70
|
+
'kubectl_logs',
|
|
71
|
+
'kubectl_events',
|
|
72
|
+
'kubectl_api_resources',
|
|
73
|
+
'kubectl_get_crd_schema',
|
|
74
|
+
'kubectl_get_resource_json',
|
|
75
|
+
// Dry-run tools for validation
|
|
76
|
+
'kubectl_patch_dryrun',
|
|
77
|
+
'kubectl_apply_dryrun',
|
|
78
|
+
'kubectl_delete_dryrun'
|
|
79
|
+
];
|
|
67
80
|
/**
|
|
68
81
|
* AI-driven investigation - uses toolLoop for single-phase investigation and analysis
|
|
82
|
+
*
|
|
83
|
+
* PRD #343: Kubectl tools are routed through the plugin system.
|
|
84
|
+
* No fallback to direct execution - MCP server has no RBAC.
|
|
69
85
|
*/
|
|
70
|
-
async function conductInvestigation(session, sessionManager, aiProvider, logger, requestId, isValidation = false, interactionId) {
|
|
86
|
+
async function conductInvestigation(session, sessionManager, aiProvider, logger, requestId, pluginManager, isValidation = false, interactionId) {
|
|
71
87
|
const maxIterations = 30; // Increased for thorough investigation workflows
|
|
72
88
|
logger.info('Starting AI investigation with toolLoop', {
|
|
73
89
|
requestId,
|
|
@@ -78,19 +94,27 @@ async function conductInvestigation(session, sessionManager, aiProvider, logger,
|
|
|
78
94
|
// Load investigation system prompt (static, cacheable)
|
|
79
95
|
const promptPath = path.join(__dirname, '..', '..', 'prompts', 'remediate-system.md');
|
|
80
96
|
const systemPrompt = fs.readFileSync(promptPath, 'utf8');
|
|
81
|
-
|
|
97
|
+
// PRD #343: Get kubectl tools from plugin
|
|
98
|
+
const kubectlTools = pluginManager.getDiscoveredTools().filter(t => KUBECTL_INVESTIGATION_TOOL_NAMES.includes(t.name));
|
|
99
|
+
if (kubectlTools.length === 0) {
|
|
100
|
+
throw new Error('No kubectl tools available from plugin. Ensure agentic-tools plugin is running.');
|
|
101
|
+
}
|
|
102
|
+
logger.debug('Starting toolLoop with kubectl investigation tools from plugin', {
|
|
82
103
|
requestId,
|
|
83
104
|
sessionId: session.sessionId,
|
|
84
|
-
toolCount:
|
|
105
|
+
toolCount: kubectlTools.length,
|
|
106
|
+
tools: kubectlTools.map(t => t.name)
|
|
85
107
|
});
|
|
108
|
+
// PRD #343: Create tool executor that routes through plugin
|
|
109
|
+
const toolExecutor = pluginManager.createToolExecutor();
|
|
86
110
|
// Use toolLoop for AI-driven investigation with kubectl tools
|
|
87
111
|
// System prompt is static (cached), issue description is dynamic (userMessage)
|
|
88
112
|
const operationName = isValidation ? 'remediate-validation' : 'remediate-investigation';
|
|
89
113
|
const result = await aiProvider.toolLoop({
|
|
90
114
|
systemPrompt: systemPrompt,
|
|
91
115
|
userMessage: `Investigate this Kubernetes issue: ${session.data.issue}`,
|
|
92
|
-
tools:
|
|
93
|
-
toolExecutor:
|
|
116
|
+
tools: kubectlTools,
|
|
117
|
+
toolExecutor: toolExecutor,
|
|
94
118
|
maxIterations: maxIterations,
|
|
95
119
|
operation: operationName,
|
|
96
120
|
evaluationContext: {
|
|
@@ -270,7 +294,7 @@ function parseAIFinalAnalysis(aiResponse) {
|
|
|
270
294
|
/**
|
|
271
295
|
* Execute user choice from previous session
|
|
272
296
|
*/
|
|
273
|
-
async function executeUserChoice(sessionManager, sessionId, choice, logger, requestId, currentInteractionId) {
|
|
297
|
+
async function executeUserChoice(sessionManager, sessionId, choice, logger, requestId, pluginManager, currentInteractionId) {
|
|
274
298
|
try {
|
|
275
299
|
// Load previous session
|
|
276
300
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -289,7 +313,7 @@ async function executeUserChoice(sessionManager, sessionId, choice, logger, requ
|
|
|
289
313
|
// Handle different choices
|
|
290
314
|
switch (choice) {
|
|
291
315
|
case 1: // Execute automatically via MCP
|
|
292
|
-
return await executeRemediationCommands(session, sessionManager, logger, requestId, currentInteractionId);
|
|
316
|
+
return await executeRemediationCommands(session, sessionManager, logger, requestId, pluginManager, currentInteractionId);
|
|
293
317
|
case 2: { // Execute via agent
|
|
294
318
|
// Use validation intent directly from final analysis
|
|
295
319
|
const validationIntent = session.data.finalAnalysis.validationIntent || 'Check the status of the affected resources to verify the issue has been resolved';
|
|
@@ -331,7 +355,7 @@ async function executeUserChoice(sessionManager, sessionId, choice, logger, requ
|
|
|
331
355
|
/**
|
|
332
356
|
* Execute remediation commands via kubectl
|
|
333
357
|
*/
|
|
334
|
-
async function executeRemediationCommands(session, sessionManager, logger, requestId, currentInteractionId) {
|
|
358
|
+
async function executeRemediationCommands(session, sessionManager, logger, requestId, pluginManager, currentInteractionId) {
|
|
335
359
|
const results = [];
|
|
336
360
|
const finalAnalysis = session.data.finalAnalysis;
|
|
337
361
|
let overallSuccess = true;
|
|
@@ -351,15 +375,38 @@ async function executeRemediationCommands(session, sessionManager, logger, reque
|
|
|
351
375
|
actionId,
|
|
352
376
|
command: action.command
|
|
353
377
|
});
|
|
354
|
-
// Execute the command
|
|
378
|
+
// PRD #343: Execute the command via plugin's shell_exec tool
|
|
355
379
|
// Clean up escape sequences that some AI models incorrectly add to JSON parameters
|
|
356
380
|
let fullCommand = action.command || '';
|
|
357
381
|
fullCommand = fullCommand.replace(/\\"/g, '"');
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
382
|
+
const response = await pluginManager.invokeTool('shell_exec', { command: fullCommand });
|
|
383
|
+
if (!response.success) {
|
|
384
|
+
throw new Error(response.error?.message || 'Command execution failed');
|
|
385
|
+
}
|
|
386
|
+
// Check for nested error - plugin wraps command errors in { success: false, error: "..." }
|
|
387
|
+
if (typeof response.result === 'object' && response.result !== null) {
|
|
388
|
+
const result = response.result;
|
|
389
|
+
if (result.success === false) {
|
|
390
|
+
throw new Error(result.error || result.message || 'Command execution failed');
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
// Extract only the data field - never pass JSON wrapper
|
|
394
|
+
let output;
|
|
395
|
+
if (typeof response.result === 'object' && response.result !== null) {
|
|
396
|
+
const result = response.result;
|
|
397
|
+
if (result.data !== undefined) {
|
|
398
|
+
output = String(result.data);
|
|
399
|
+
}
|
|
400
|
+
else if (typeof result === 'string') {
|
|
401
|
+
output = result;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
throw new Error('Plugin returned unexpected response format - missing data field');
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
output = String(response.result || '');
|
|
409
|
+
}
|
|
363
410
|
results.push({
|
|
364
411
|
action: `${actionId}: ${action.description}`,
|
|
365
412
|
success: true,
|
|
@@ -429,7 +476,7 @@ IMPORTANT: You MUST respond with the final JSON analysis format as specified in
|
|
|
429
476
|
interaction_id: currentInteractionId || session.data.interaction_id // Use current interaction_id for validation
|
|
430
477
|
};
|
|
431
478
|
// Recursive call to main function for validation
|
|
432
|
-
const validationResponse = await handleRemediateTool(validationInput);
|
|
479
|
+
const validationResponse = await handleRemediateTool(validationInput, pluginManager);
|
|
433
480
|
const validationData = JSON.parse(validationResponse.content[0].text);
|
|
434
481
|
// If validation discovered new issues, enhance with execution context
|
|
435
482
|
if (validationData.status === 'awaiting_user_approval') {
|
|
@@ -567,8 +614,10 @@ IMPORTANT: You MUST respond with the final JSON analysis format as specified in
|
|
|
567
614
|
}
|
|
568
615
|
/**
|
|
569
616
|
* Main tool handler for remediate tool
|
|
617
|
+
*
|
|
618
|
+
* PRD #343: pluginManager is required - all kubectl operations go through plugin.
|
|
570
619
|
*/
|
|
571
|
-
async function handleRemediateTool(args) {
|
|
620
|
+
async function handleRemediateTool(args, pluginManager) {
|
|
572
621
|
const requestId = `remediate_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
573
622
|
const logger = new error_handling_1.ConsoleLogger('RemediateTool');
|
|
574
623
|
try {
|
|
@@ -584,7 +633,7 @@ async function handleRemediateTool(args) {
|
|
|
584
633
|
choice: validatedInput.executeChoice,
|
|
585
634
|
sessionId: validatedInput.sessionId
|
|
586
635
|
});
|
|
587
|
-
return await executeUserChoice(sessionManager, validatedInput.sessionId, validatedInput.executeChoice, logger, requestId, validatedInput.interaction_id);
|
|
636
|
+
return await executeUserChoice(sessionManager, validatedInput.sessionId, validatedInput.executeChoice, logger, requestId, pluginManager, validatedInput.interaction_id);
|
|
588
637
|
}
|
|
589
638
|
// Validate that we have an issue for new investigations
|
|
590
639
|
if (!validatedInput.issue) {
|
|
@@ -604,7 +653,7 @@ async function handleRemediateTool(args) {
|
|
|
604
653
|
const aiProvider = (0, ai_provider_factory_1.createAIProvider)();
|
|
605
654
|
// Conduct AI-driven investigation (detect if this is post-execution validation)
|
|
606
655
|
const isValidation = validatedInput.executedCommands && validatedInput.executedCommands.length > 0;
|
|
607
|
-
const finalAnalysis = await conductInvestigation(session, sessionManager, aiProvider, logger, requestId, isValidation, validatedInput.interaction_id);
|
|
656
|
+
const finalAnalysis = await conductInvestigation(session, sessionManager, aiProvider, logger, requestId, pluginManager, isValidation, validatedInput.interaction_id);
|
|
608
657
|
logger.info('Remediation analysis completed', {
|
|
609
658
|
requestId,
|
|
610
659
|
sessionId: session.sessionId,
|
|
@@ -675,7 +724,7 @@ async function handleRemediateTool(args) {
|
|
|
675
724
|
// Update session object with final analysis for execution
|
|
676
725
|
session.data.finalAnalysis = finalAnalysis;
|
|
677
726
|
// Execute commands and return the complete result (includes post-execution validation)
|
|
678
|
-
return await executeRemediationCommands(session, sessionManager, logger, requestId, validatedInput.interaction_id);
|
|
727
|
+
return await executeRemediationCommands(session, sessionManager, logger, requestId, pluginManager, validatedInput.interaction_id);
|
|
679
728
|
}
|
|
680
729
|
// Generate visualization URL for analysis response
|
|
681
730
|
const visualizationUrl = (0, visualization_1.getVisualizationUrl)(session.sessionId);
|
package/dist/tools/version.d.ts
CHANGED
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides comprehensive system status including version information,
|
|
5
5
|
* Vector DB connection status, and embedding service capabilities
|
|
6
|
+
*
|
|
7
|
+
* PRD #343: Kubernetes interactions migrated to plugin system
|
|
6
8
|
*/
|
|
7
9
|
import { z } from 'zod';
|
|
8
10
|
import { Logger } from '../core/error-handling';
|
|
9
11
|
import { BaseVisualizationData } from '../core/visualization';
|
|
12
|
+
import { PluginManager } from '../core/plugin-manager';
|
|
10
13
|
export declare const VERSION_TOOL_NAME = "version";
|
|
11
14
|
export declare const VERSION_TOOL_DESCRIPTION = "Get comprehensive system health and diagnostics";
|
|
12
15
|
export declare const VERSION_TOOL_INPUT_SCHEMA: {
|
|
@@ -96,6 +99,15 @@ export interface SystemStatus {
|
|
|
96
99
|
serviceName: string;
|
|
97
100
|
initialized: boolean;
|
|
98
101
|
};
|
|
102
|
+
plugins?: {
|
|
103
|
+
pluginCount: number;
|
|
104
|
+
toolCount: number;
|
|
105
|
+
plugins: Array<{
|
|
106
|
+
name: string;
|
|
107
|
+
version: string;
|
|
108
|
+
toolCount: number;
|
|
109
|
+
}>;
|
|
110
|
+
};
|
|
99
111
|
}
|
|
100
112
|
export interface VersionSessionData extends BaseVisualizationData {
|
|
101
113
|
toolName: 'version';
|
|
@@ -112,10 +124,6 @@ export interface VersionSessionData extends BaseVisualizationData {
|
|
|
112
124
|
timestamp: string;
|
|
113
125
|
status: 'success' | 'error';
|
|
114
126
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Test Kyverno installation and readiness for policy generation using shared client
|
|
117
|
-
*/
|
|
118
|
-
export declare function getKyvernoStatus(): Promise<SystemStatus['kyverno']>;
|
|
119
127
|
/**
|
|
120
128
|
* Get version information from package.json
|
|
121
129
|
*/
|
|
@@ -124,8 +132,15 @@ export declare function getVersionInfo(): VersionInfo;
|
|
|
124
132
|
* Get OpenTelemetry tracing status
|
|
125
133
|
*/
|
|
126
134
|
export declare function getTracingStatus(): SystemStatus['tracing'];
|
|
135
|
+
/**
|
|
136
|
+
* Get Kyverno status via plugin (PRD #343)
|
|
137
|
+
* Uses kubectl_get_resource_json plugin tool for Kyverno resource checks
|
|
138
|
+
*/
|
|
139
|
+
export declare function getKyvernoStatusViaPlugin(pluginManager: PluginManager): Promise<SystemStatus['kyverno']>;
|
|
127
140
|
/**
|
|
128
141
|
* Handle version tool request with comprehensive system diagnostics
|
|
142
|
+
*
|
|
143
|
+
* PRD #343: When pluginManager is provided, uses plugin system for all K8s interactions
|
|
129
144
|
*/
|
|
130
|
-
export declare function handleVersionTool(args: any, logger: Logger, requestId: string): Promise<any>;
|
|
145
|
+
export declare function handleVersionTool(args: any, logger: Logger, requestId: string, pluginManager?: PluginManager): Promise<any>;
|
|
131
146
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"mappings":"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"}
|
package/dist/tools/version.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Provides comprehensive system status including version information,
|
|
6
6
|
* Vector DB connection status, and embedding service capabilities
|
|
7
|
+
*
|
|
8
|
+
* PRD #343: Kubernetes interactions migrated to plugin system
|
|
7
9
|
*/
|
|
8
10
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
11
|
if (k2 === undefined) k2 = k;
|
|
@@ -40,19 +42,16 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
40
42
|
})();
|
|
41
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
44
|
exports.VERSION_TOOL_INPUT_SCHEMA = exports.VERSION_TOOL_DESCRIPTION = exports.VERSION_TOOL_NAME = void 0;
|
|
43
|
-
exports.getKyvernoStatus = getKyvernoStatus;
|
|
44
45
|
exports.getVersionInfo = getVersionInfo;
|
|
45
46
|
exports.getTracingStatus = getTracingStatus;
|
|
47
|
+
exports.getKyvernoStatusViaPlugin = getKyvernoStatusViaPlugin;
|
|
46
48
|
exports.handleVersionTool = handleVersionTool;
|
|
47
49
|
const fs_1 = require("fs");
|
|
48
50
|
const path_1 = require("path");
|
|
49
51
|
const zod_1 = require("zod");
|
|
50
|
-
const k8s = __importStar(require("@kubernetes/client-node"));
|
|
51
52
|
const constants_1 = require("../core/constants");
|
|
52
53
|
const index_1 = require("../core/index");
|
|
53
54
|
const resource_vector_service_1 = require("../core/resource-vector-service");
|
|
54
|
-
const discovery_1 = require("../core/discovery");
|
|
55
|
-
const kubernetes_utils_1 = require("../core/kubernetes-utils");
|
|
56
55
|
const tracing_1 = require("../core/tracing");
|
|
57
56
|
const config_1 = require("../core/tracing/config");
|
|
58
57
|
const generic_session_manager_1 = require("../core/generic-session-manager");
|
|
@@ -310,158 +309,6 @@ async function getCapabilityStatus() {
|
|
|
310
309
|
};
|
|
311
310
|
}
|
|
312
311
|
}
|
|
313
|
-
/**
|
|
314
|
-
* Test Kyverno installation and readiness for policy generation using shared client
|
|
315
|
-
*/
|
|
316
|
-
async function getKyvernoStatus() {
|
|
317
|
-
try {
|
|
318
|
-
// Create discovery instance and establish connection
|
|
319
|
-
const discovery = new discovery_1.KubernetesDiscovery({});
|
|
320
|
-
await discovery.connect();
|
|
321
|
-
// First test if we can connect to Kubernetes at all
|
|
322
|
-
const testResult = await discovery.testConnection();
|
|
323
|
-
if (!testResult.connected) {
|
|
324
|
-
return {
|
|
325
|
-
installed: false,
|
|
326
|
-
policyGenerationReady: false,
|
|
327
|
-
error: 'Cannot detect Kyverno - Kubernetes cluster is not accessible'
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
// Check if Kyverno CRDs are installed using the original approach
|
|
331
|
-
const crdOutput = await discovery.executeKubectl(['get', 'crd', '--no-headers']);
|
|
332
|
-
const kyvernoCRDs = crdOutput.split('\n').filter(line => line.includes('kyverno.io') && (line.includes('clusterpolicies') ||
|
|
333
|
-
line.includes('policies') ||
|
|
334
|
-
line.includes('policyreports')));
|
|
335
|
-
if (kyvernoCRDs.length === 0) {
|
|
336
|
-
return {
|
|
337
|
-
installed: false,
|
|
338
|
-
policyGenerationReady: false,
|
|
339
|
-
reason: 'Kyverno CRDs not found in cluster - Kyverno is not installed'
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
// Check if Kyverno deployment is ready using the client
|
|
343
|
-
let deploymentReady = false;
|
|
344
|
-
let webhookReady = false;
|
|
345
|
-
let version;
|
|
346
|
-
try {
|
|
347
|
-
// Get client and check deployment status
|
|
348
|
-
const client = discovery.getClient();
|
|
349
|
-
const appsV1Api = (0, tracing_1.createTracedK8sClient)(client.makeApiClient(k8s.AppsV1Api), 'AppsV1Api');
|
|
350
|
-
const deploymentResponse = await appsV1Api.listNamespacedDeployment({
|
|
351
|
-
namespace: 'kyverno'
|
|
352
|
-
});
|
|
353
|
-
const kyvernoDeployments = deploymentResponse.items.filter((deployment) => deployment.metadata?.name?.startsWith('kyverno-'));
|
|
354
|
-
if (kyvernoDeployments.length > 0) {
|
|
355
|
-
// Check if all Kyverno deployments are ready
|
|
356
|
-
deploymentReady = kyvernoDeployments.every((deployment) => {
|
|
357
|
-
const readyReplicas = deployment.status?.readyReplicas || 0;
|
|
358
|
-
const replicas = deployment.status?.replicas || 0;
|
|
359
|
-
return readyReplicas > 0 && readyReplicas === replicas;
|
|
360
|
-
});
|
|
361
|
-
// Try to get version from image tag of the first deployment (usually admission controller)
|
|
362
|
-
const firstDeployment = kyvernoDeployments[0];
|
|
363
|
-
const container = firstDeployment.spec?.template.spec?.containers?.[0];
|
|
364
|
-
if (container?.image) {
|
|
365
|
-
const imageMatch = container.image.match(/:v?([0-9]+\.[0-9]+\.[0-9]+)/);
|
|
366
|
-
if (imageMatch) {
|
|
367
|
-
version = imageMatch[1];
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
// Kyverno might be in a different namespace or not exist
|
|
374
|
-
deploymentReady = false;
|
|
375
|
-
}
|
|
376
|
-
// Check admission controller webhook
|
|
377
|
-
try {
|
|
378
|
-
const client = discovery.getClient();
|
|
379
|
-
const admissionApi = (0, tracing_1.createTracedK8sClient)(client.makeApiClient(k8s.AdmissionregistrationV1Api), 'AdmissionregistrationV1Api');
|
|
380
|
-
const webhookResponse = await admissionApi.listValidatingWebhookConfiguration();
|
|
381
|
-
webhookReady = webhookResponse.items.some((webhook) => webhook.metadata?.name?.includes('kyverno'));
|
|
382
|
-
}
|
|
383
|
-
catch (error) {
|
|
384
|
-
webhookReady = false;
|
|
385
|
-
}
|
|
386
|
-
// Determine if policy generation is ready
|
|
387
|
-
const policyGenerationReady = deploymentReady && webhookReady;
|
|
388
|
-
if (!policyGenerationReady) {
|
|
389
|
-
let reason = 'Kyverno is partially installed but not fully operational';
|
|
390
|
-
if (!deploymentReady && !webhookReady) {
|
|
391
|
-
reason = 'Kyverno deployment and admission webhook are not ready';
|
|
392
|
-
}
|
|
393
|
-
else if (!deploymentReady) {
|
|
394
|
-
reason = 'Kyverno deployment is not ready';
|
|
395
|
-
}
|
|
396
|
-
else if (!webhookReady) {
|
|
397
|
-
reason = 'Kyverno admission webhook is not ready';
|
|
398
|
-
}
|
|
399
|
-
return {
|
|
400
|
-
installed: true,
|
|
401
|
-
version,
|
|
402
|
-
webhookReady,
|
|
403
|
-
policyGenerationReady,
|
|
404
|
-
reason
|
|
405
|
-
};
|
|
406
|
-
}
|
|
407
|
-
return {
|
|
408
|
-
installed: true,
|
|
409
|
-
version,
|
|
410
|
-
webhookReady: true,
|
|
411
|
-
policyGenerationReady: true
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
catch (error) {
|
|
415
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
416
|
-
return {
|
|
417
|
-
installed: false,
|
|
418
|
-
policyGenerationReady: false,
|
|
419
|
-
error: `Kyverno detection failed: ${errorMessage}`
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Test Kubernetes cluster connectivity using shared client
|
|
425
|
-
*/
|
|
426
|
-
async function getKubernetesStatus() {
|
|
427
|
-
try {
|
|
428
|
-
// Create discovery instance and establish connection
|
|
429
|
-
const discovery = new discovery_1.KubernetesDiscovery({});
|
|
430
|
-
await discovery.connect();
|
|
431
|
-
// Get connection info using the shared approach
|
|
432
|
-
const connectionInfo = discovery.getConnectionInfo();
|
|
433
|
-
const testResult = await discovery.testConnection();
|
|
434
|
-
if (testResult.connected) {
|
|
435
|
-
return {
|
|
436
|
-
connected: true,
|
|
437
|
-
clusterInfo: {
|
|
438
|
-
endpoint: connectionInfo.server,
|
|
439
|
-
version: testResult.version,
|
|
440
|
-
context: connectionInfo.context
|
|
441
|
-
},
|
|
442
|
-
kubeconfig: connectionInfo.kubeconfig
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
return {
|
|
447
|
-
connected: false,
|
|
448
|
-
kubeconfig: connectionInfo.kubeconfig,
|
|
449
|
-
error: testResult.error,
|
|
450
|
-
errorType: testResult.errorType
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
catch (error) {
|
|
455
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
456
|
-
const classified = kubernetes_utils_1.ErrorClassifier.classifyError(error);
|
|
457
|
-
return {
|
|
458
|
-
connected: false,
|
|
459
|
-
kubeconfig: process.env.KUBECONFIG || '~/.kube/config',
|
|
460
|
-
error: errorMessage,
|
|
461
|
-
errorType: classified.type
|
|
462
|
-
};
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
312
|
/**
|
|
466
313
|
* Test AI provider connectivity
|
|
467
314
|
*/
|
|
@@ -592,28 +439,188 @@ function getTracingStatus() {
|
|
|
592
439
|
initialized: tracer.isEnabled()
|
|
593
440
|
};
|
|
594
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* Get Kubernetes status via plugin (PRD #343)
|
|
444
|
+
* Uses kubectl_version plugin tool for K8s version information
|
|
445
|
+
*/
|
|
446
|
+
async function getKubernetesStatusViaPlugin(pluginManager) {
|
|
447
|
+
try {
|
|
448
|
+
const response = await pluginManager.invokeTool('kubectl_version', {});
|
|
449
|
+
if (!response.success) {
|
|
450
|
+
return {
|
|
451
|
+
connected: false,
|
|
452
|
+
kubeconfig: 'in-cluster',
|
|
453
|
+
error: response.error?.message || 'Failed to get Kubernetes version via plugin',
|
|
454
|
+
errorType: response.error?.code
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
// Check for nested error - plugin wraps kubectl errors in { success: false, error: "..." }
|
|
458
|
+
const result = response.result;
|
|
459
|
+
if (result.success === false) {
|
|
460
|
+
return {
|
|
461
|
+
connected: false,
|
|
462
|
+
kubeconfig: 'in-cluster',
|
|
463
|
+
error: result.error || result.message || 'kubectl version failed',
|
|
464
|
+
errorType: 'KUBECTL_ERROR'
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
// Parse the kubectl version JSON output
|
|
468
|
+
const versionData = JSON.parse(result.data || '{}');
|
|
469
|
+
return {
|
|
470
|
+
connected: true,
|
|
471
|
+
clusterInfo: {
|
|
472
|
+
version: versionData.serverVersion?.gitVersion,
|
|
473
|
+
endpoint: undefined, // Not available from kubectl version
|
|
474
|
+
context: 'in-cluster'
|
|
475
|
+
},
|
|
476
|
+
kubeconfig: 'in-cluster'
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
catch (error) {
|
|
480
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
481
|
+
return {
|
|
482
|
+
connected: false,
|
|
483
|
+
kubeconfig: 'in-cluster',
|
|
484
|
+
error: errorMessage,
|
|
485
|
+
errorType: 'PLUGIN_ERROR'
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Get Kyverno status via plugin (PRD #343)
|
|
491
|
+
* Uses kubectl_get_resource_json plugin tool for Kyverno resource checks
|
|
492
|
+
*/
|
|
493
|
+
async function getKyvernoStatusViaPlugin(pluginManager) {
|
|
494
|
+
try {
|
|
495
|
+
// Check if Kyverno CRD exists (clusterpolicies.kyverno.io)
|
|
496
|
+
const crdResponse = await pluginManager.invokeTool('kubectl_get_resource_json', {
|
|
497
|
+
resource: 'crd/clusterpolicies.kyverno.io'
|
|
498
|
+
});
|
|
499
|
+
// Check both outer success and nested result.success
|
|
500
|
+
if (!crdResponse.success) {
|
|
501
|
+
// CRD doesn't exist - Kyverno not installed
|
|
502
|
+
return {
|
|
503
|
+
installed: false,
|
|
504
|
+
policyGenerationReady: false,
|
|
505
|
+
reason: 'Kyverno CRDs not found in cluster - Kyverno is not installed'
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
const crdResult = crdResponse.result;
|
|
509
|
+
if (crdResult?.success === false) {
|
|
510
|
+
// CRD doesn't exist - Kyverno not installed
|
|
511
|
+
return {
|
|
512
|
+
installed: false,
|
|
513
|
+
policyGenerationReady: false,
|
|
514
|
+
reason: 'Kyverno CRDs not found in cluster - Kyverno is not installed'
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
// Kyverno CRDs exist, check deployment status
|
|
518
|
+
let deploymentReady = false;
|
|
519
|
+
let version;
|
|
520
|
+
// Try to get kyverno-admission-controller deployment
|
|
521
|
+
const deploymentResponse = await pluginManager.invokeTool('kubectl_get_resource_json', {
|
|
522
|
+
resource: 'deployment/kyverno-admission-controller',
|
|
523
|
+
namespace: 'kyverno'
|
|
524
|
+
});
|
|
525
|
+
if (deploymentResponse.success) {
|
|
526
|
+
const result = deploymentResponse.result;
|
|
527
|
+
// Check for nested error
|
|
528
|
+
if (result.success !== false) {
|
|
529
|
+
const deployment = JSON.parse(result.data || '{}');
|
|
530
|
+
const readyReplicas = deployment.status?.readyReplicas || 0;
|
|
531
|
+
const replicas = deployment.status?.replicas || 0;
|
|
532
|
+
deploymentReady = readyReplicas > 0 && readyReplicas === replicas;
|
|
533
|
+
// Extract version from image tag
|
|
534
|
+
const container = deployment.spec?.template?.spec?.containers?.[0];
|
|
535
|
+
if (container?.image) {
|
|
536
|
+
const imageMatch = container.image.match(/:v?([0-9]+\.[0-9]+\.[0-9]+)/);
|
|
537
|
+
if (imageMatch) {
|
|
538
|
+
version = imageMatch[1];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// Check webhook configuration
|
|
544
|
+
let webhookReady = false;
|
|
545
|
+
const webhookResponse = await pluginManager.invokeTool('kubectl_get_resource_json', {
|
|
546
|
+
resource: 'validatingwebhookconfiguration/kyverno-resource-validating-webhook-cfg'
|
|
547
|
+
});
|
|
548
|
+
// Check both outer success and nested result.success
|
|
549
|
+
if (webhookResponse.success) {
|
|
550
|
+
const webhookResult = webhookResponse.result;
|
|
551
|
+
if (webhookResult?.success !== false) {
|
|
552
|
+
webhookReady = true;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
const policyGenerationReady = deploymentReady && webhookReady;
|
|
556
|
+
if (!policyGenerationReady) {
|
|
557
|
+
let reason = 'Kyverno is partially installed but not fully operational';
|
|
558
|
+
if (!deploymentReady && !webhookReady) {
|
|
559
|
+
reason = 'Kyverno deployment and admission webhook are not ready';
|
|
560
|
+
}
|
|
561
|
+
else if (!deploymentReady) {
|
|
562
|
+
reason = 'Kyverno deployment is not ready';
|
|
563
|
+
}
|
|
564
|
+
else if (!webhookReady) {
|
|
565
|
+
reason = 'Kyverno admission webhook is not ready';
|
|
566
|
+
}
|
|
567
|
+
return {
|
|
568
|
+
installed: true,
|
|
569
|
+
version,
|
|
570
|
+
webhookReady,
|
|
571
|
+
policyGenerationReady,
|
|
572
|
+
reason
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
installed: true,
|
|
577
|
+
version,
|
|
578
|
+
webhookReady: true,
|
|
579
|
+
policyGenerationReady: true
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
catch (error) {
|
|
583
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
584
|
+
return {
|
|
585
|
+
installed: false,
|
|
586
|
+
policyGenerationReady: false,
|
|
587
|
+
error: `Kyverno detection via plugin failed: ${errorMessage}`
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
}
|
|
595
591
|
/**
|
|
596
592
|
* Handle version tool request with comprehensive system diagnostics
|
|
593
|
+
*
|
|
594
|
+
* PRD #343: When pluginManager is provided, uses plugin system for all K8s interactions
|
|
597
595
|
*/
|
|
598
|
-
async function handleVersionTool(args, logger, requestId) {
|
|
596
|
+
async function handleVersionTool(args, logger, requestId, pluginManager) {
|
|
599
597
|
try {
|
|
600
598
|
// Extract interaction_id for evaluation dataset generation
|
|
601
599
|
const interaction_id = args.interaction_id ? exports.VERSION_TOOL_INPUT_SCHEMA.interaction_id.parse(args.interaction_id) : undefined;
|
|
602
600
|
logger.info('Processing version tool request with system diagnostics', { requestId });
|
|
603
601
|
// Get version info
|
|
604
602
|
const version = getVersionInfo();
|
|
603
|
+
// PRD #343: K8s interactions go through plugins only
|
|
604
|
+
// If plugins not available, K8s/Kyverno status reports as unavailable
|
|
605
|
+
const hasK8sPlugins = pluginManager?.isPluginTool('kubectl_version') ?? false;
|
|
605
606
|
// Run all diagnostics in parallel for better performance
|
|
606
|
-
logger.info('Running system diagnostics...', { requestId });
|
|
607
|
+
logger.info('Running system diagnostics...', { requestId, hasK8sPlugins });
|
|
607
608
|
const [vectorDBStatus, embeddingStatus, aiProviderStatus, kubernetesStatus, capabilityStatus, kyvernoStatus] = await Promise.all([
|
|
608
609
|
getVectorDBStatus(),
|
|
609
610
|
getEmbeddingStatus(),
|
|
610
611
|
getAIProviderStatus(interaction_id),
|
|
611
|
-
|
|
612
|
+
hasK8sPlugins
|
|
613
|
+
? getKubernetesStatusViaPlugin(pluginManager)
|
|
614
|
+
: Promise.resolve({ connected: false, kubeconfig: 'unknown', error: 'Kubernetes plugins not available' }),
|
|
612
615
|
getCapabilityStatus(),
|
|
613
|
-
|
|
616
|
+
hasK8sPlugins
|
|
617
|
+
? getKyvernoStatusViaPlugin(pluginManager)
|
|
618
|
+
: Promise.resolve({ installed: false, policyGenerationReady: false, error: 'Kubernetes plugins not available' })
|
|
614
619
|
]);
|
|
615
620
|
// Get tracing status synchronously (no async operations)
|
|
616
621
|
const tracingStatus = getTracingStatus();
|
|
622
|
+
// PRD #343: Add plugin stats when pluginManager is available
|
|
623
|
+
const pluginStats = pluginManager?.getStats();
|
|
617
624
|
const systemStatus = {
|
|
618
625
|
version,
|
|
619
626
|
vectorDB: vectorDBStatus,
|
|
@@ -622,7 +629,8 @@ async function handleVersionTool(args, logger, requestId) {
|
|
|
622
629
|
kubernetes: kubernetesStatus,
|
|
623
630
|
capabilities: capabilityStatus,
|
|
624
631
|
kyverno: kyvernoStatus,
|
|
625
|
-
tracing: tracingStatus
|
|
632
|
+
tracing: tracingStatus,
|
|
633
|
+
plugins: pluginStats
|
|
626
634
|
};
|
|
627
635
|
// Log summary of system health
|
|
628
636
|
logger.info('System diagnostics completed', {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vfarcic/dot-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.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",
|