@vfarcic/dot-ai 0.104.0 → 0.106.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 +6 -1
- package/dist/core/ai-provider-factory.d.ts +90 -0
- package/dist/core/ai-provider-factory.d.ts.map +1 -0
- package/dist/core/ai-provider-factory.js +187 -0
- package/dist/core/ai-provider.interface.d.ts +208 -0
- package/dist/core/ai-provider.interface.d.ts.map +1 -0
- package/dist/core/ai-provider.interface.js +14 -0
- package/dist/core/capabilities.d.ts +3 -3
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/capabilities.js +4 -4
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +29 -14
- package/dist/core/doc-testing-session.d.ts +1 -1
- package/dist/core/doc-testing-session.js +1 -1
- package/dist/core/error-handling.js +2 -2
- package/dist/core/index.d.ts +4 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +11 -22
- package/dist/core/platform-operations.d.ts +9 -15
- package/dist/core/platform-operations.d.ts.map +1 -1
- package/dist/core/platform-operations.js +28 -49
- package/dist/core/platform-utils.d.ts +16 -0
- package/dist/core/platform-utils.d.ts.map +1 -0
- package/dist/core/platform-utils.js +68 -0
- package/dist/core/providers/anthropic-provider.d.ts +44 -0
- package/dist/core/providers/anthropic-provider.d.ts.map +1 -0
- package/dist/core/providers/anthropic-provider.js +281 -0
- package/dist/core/providers/provider-debug-utils.d.ts +27 -0
- package/dist/core/providers/provider-debug-utils.d.ts.map +1 -0
- package/dist/core/providers/provider-debug-utils.js +122 -0
- package/dist/core/providers/vercel-provider.d.ts +47 -0
- package/dist/core/providers/vercel-provider.d.ts.map +1 -0
- package/dist/core/providers/vercel-provider.js +152 -0
- package/dist/core/schema.d.ts +4 -7
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +13 -11
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +13 -14
- package/dist/interfaces/mcp.d.ts +1 -1
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +29 -8
- package/dist/interfaces/rest-api.js +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +8 -10
- package/dist/tools/build-platform.js +3 -3
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +7 -8
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +3 -2
- package/dist/tools/platform/discover-operations.tool.d.ts +35 -0
- package/dist/tools/platform/discover-operations.tool.d.ts.map +1 -0
- package/dist/tools/platform/discover-operations.tool.js +88 -0
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +50 -30
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +23 -39
- package/dist/tools/version.d.ts +3 -2
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +35 -23
- package/package.json +5 -2
- package/prompts/{parse-script-operations.md → platform-operations-parse-script-help.md} +4 -8
- package/prompts/question-generation.md +31 -3
- package/dist/core/claude.d.ts +0 -88
- package/dist/core/claude.d.ts.map +0 -1
- package/dist/core/claude.js +0 -414
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/core/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAUrD,MAAM,WAAW,gBAAgB;IAC/B,OAA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,cAAc,CAAC,CAAuB;IAC9C,OAAO,CAAC,iBAAiB,CAAC,CAA0B;IACpD,OAAO,CAAC,aAAa,CAAC,CAAsB;gBAEhC,UAAU,CAAC,EAAE,UAAU;IAyCnC;;OAEG;IACG,iBAAiB,CACrB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,GACnD,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAyE9B;;OAEG;YACW,wBAAwB;IAiBtC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IA+CnC;;OAEG;YACW,0BAA0B;IA6CxC;;OAEG;YACW,0BAA0B;IAuFxC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAOtC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAanC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IASpC;;OAEG;IACH,OAAO,CAAC,mCAAmC;IAU3C;;;OAGG;YACW,sBAAsB;IAsBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8FG;YACW,oBAAoB;IAmDlC;;OAEG;YACW,sBAAsB;IAiEpC;;OAEG;IACH,OAAO,CAAC,yBAAyB;IAgCjC;;OAEG;YACW,uBAAuB;CAqItC"}
|
package/dist/core/schema.js
CHANGED
|
@@ -41,7 +41,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.ResourceRecommender = exports.ManifestValidator = exports.SchemaParser = void 0;
|
|
43
43
|
const kubernetes_utils_1 = require("./kubernetes-utils");
|
|
44
|
-
const claude_1 = require("./claude");
|
|
45
44
|
const pattern_vector_service_1 = require("./pattern-vector-service");
|
|
46
45
|
const vector_db_service_1 = require("./vector-db-service");
|
|
47
46
|
const capability_vector_service_1 = require("./capability-vector-service");
|
|
@@ -266,14 +265,17 @@ exports.ManifestValidator = ManifestValidator;
|
|
|
266
265
|
* ResourceRecommender determines which resources best meet user needs using AI
|
|
267
266
|
*/
|
|
268
267
|
class ResourceRecommender {
|
|
269
|
-
|
|
270
|
-
config;
|
|
268
|
+
aiProvider;
|
|
271
269
|
patternService;
|
|
272
270
|
capabilityService;
|
|
273
271
|
policyService;
|
|
274
|
-
constructor(
|
|
275
|
-
|
|
276
|
-
this.
|
|
272
|
+
constructor(aiProvider) {
|
|
273
|
+
// Use provided AI provider or create from environment
|
|
274
|
+
this.aiProvider = aiProvider || (() => {
|
|
275
|
+
// Lazy import to avoid circular dependencies
|
|
276
|
+
const { createAIProvider } = require('./ai-provider-factory');
|
|
277
|
+
return createAIProvider();
|
|
278
|
+
})();
|
|
277
279
|
// Initialize capability service - fail gracefully if Vector DB unavailable
|
|
278
280
|
try {
|
|
279
281
|
// Use environment variable for collection name (allows using test data collection)
|
|
@@ -311,8 +313,8 @@ class ResourceRecommender {
|
|
|
311
313
|
* Find the best resource solution(s) for user intent using two-phase analysis
|
|
312
314
|
*/
|
|
313
315
|
async findBestSolutions(intent, _explainResource) {
|
|
314
|
-
if (!this.
|
|
315
|
-
throw new Error('
|
|
316
|
+
if (!this.aiProvider.isInitialized()) {
|
|
317
|
+
throw new Error('AI provider not initialized. API key required for AI-powered resource ranking.');
|
|
316
318
|
}
|
|
317
319
|
try {
|
|
318
320
|
// Phase 0: Search for relevant organizational patterns
|
|
@@ -373,7 +375,7 @@ class ResourceRecommender {
|
|
|
373
375
|
*/
|
|
374
376
|
async assembleAndRankSolutions(intent, availableResources, patterns) {
|
|
375
377
|
const prompt = await this.loadSolutionAssemblyPrompt(intent, availableResources, patterns);
|
|
376
|
-
const response = await this.
|
|
378
|
+
const response = await this.aiProvider.sendMessage(prompt, 'solution-assembly');
|
|
377
379
|
return this.parseSimpleSolutionResponse(response.content);
|
|
378
380
|
}
|
|
379
381
|
/**
|
|
@@ -620,7 +622,7 @@ class ResourceRecommender {
|
|
|
620
622
|
.replace('{patterns}', patternsContext);
|
|
621
623
|
|
|
622
624
|
|
|
623
|
-
const response = await this.
|
|
625
|
+
const response = await this.aiProvider.sendMessage(selectionPrompt, 'resource-selection');
|
|
624
626
|
|
|
625
627
|
try {
|
|
626
628
|
// Extract JSON from response with robust parsing
|
|
@@ -901,7 +903,7 @@ Available Node Labels: ${clusterOptions.nodeLabels.length > 0 ? clusterOptions.n
|
|
|
901
903
|
.replace('{resource_details}', resourceDetails)
|
|
902
904
|
.replace('{cluster_options}', clusterOptionsText)
|
|
903
905
|
.replace('{policy_context}', policyContextText);
|
|
904
|
-
const response = await this.
|
|
906
|
+
const response = await this.aiProvider.sendMessage(questionPrompt, 'question-generation');
|
|
905
907
|
// Use robust JSON extraction
|
|
906
908
|
const questions = this.extractJsonFromAIResponse(response.content);
|
|
907
909
|
// Validate the response structure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-creation-session.d.ts","sourceRoot":"","sources":["../../src/core/unified-creation-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"unified-creation-session.d.ts","sourceRoot":"","sources":["../../src/core/unified-creation-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,iCAAiC,EACjC,UAAU,EAIX,MAAM,0BAA0B,CAAC;AAKlC,qBAAa,6BAA6B;IACxC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAsB;gBAE3B,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,mBAAmB;IAKnE;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,sBAAsB;IAqBhD;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,sBAAsB,GAAG,IAAI;IAiBxE;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,sBAAsB;IA2GvF;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,2BAA2B,GAAG,iCAAiC,CAAC;IAoGhJ;;OAEG;YACW,4BAA4B;IA4C1C;;OAEG;YACW,gCAAgC;IAsC9C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6E1B;;OAEG;YACW,gBAAgB;IAsF9B;;OAEG;YACW,4BAA4B;IAoH1C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;YACW,qBAAqB;IAqCnC;;OAEG;YACW,mBAAmB;IAqLjC;;OAEG;YACW,uBAAuB;IAmFrC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAY9B;;OAEG;IACH,OAAO,CAAC,WAAW;IAgBnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAG1B"}
|
|
@@ -48,7 +48,6 @@ const session_utils_1 = require("./session-utils");
|
|
|
48
48
|
const shared_prompt_loader_1 = require("./shared-prompt-loader");
|
|
49
49
|
const capability_vector_service_1 = require("./capability-vector-service");
|
|
50
50
|
const discovery_1 = require("./discovery");
|
|
51
|
-
const claude_1 = require("./claude");
|
|
52
51
|
const schema_1 = require("./schema");
|
|
53
52
|
const version_1 = require("../tools/version");
|
|
54
53
|
const yaml = __importStar(require("js-yaml"));
|
|
@@ -335,18 +334,18 @@ class UnifiedCreationSessionManager {
|
|
|
335
334
|
* Generate trigger expansion using internal AI
|
|
336
335
|
*/
|
|
337
336
|
async generateInternalTriggerExpansion(initialTriggers, description) {
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
337
|
+
const { createAIProvider } = require('./ai-provider-factory');
|
|
338
|
+
const aiProvider = createAIProvider();
|
|
339
|
+
if (!aiProvider.isInitialized()) {
|
|
340
|
+
console.warn('AI provider not available for trigger expansion');
|
|
341
341
|
return [];
|
|
342
342
|
}
|
|
343
|
-
const claudeIntegration = new claude_1.ClaudeIntegration(apiKey);
|
|
344
343
|
const prompt = (0, shared_prompt_loader_1.loadPrompt)('infrastructure-trigger-expansion', {
|
|
345
344
|
initialTriggers: initialTriggers.join(', '),
|
|
346
345
|
description
|
|
347
346
|
});
|
|
348
347
|
try {
|
|
349
|
-
const response = await
|
|
348
|
+
const response = await aiProvider.sendMessage(prompt, 'trigger-expansion');
|
|
350
349
|
const expandedText = response.content.trim();
|
|
351
350
|
if (!expandedText || expandedText.toLowerCase().includes('no relevant') || expandedText.toLowerCase().includes('no additional')) {
|
|
352
351
|
return [];
|
|
@@ -354,9 +353,9 @@ class UnifiedCreationSessionManager {
|
|
|
354
353
|
// Parse comma-separated response and clean up
|
|
355
354
|
const expanded = expandedText
|
|
356
355
|
.split(',')
|
|
357
|
-
.map(trigger => trigger.trim())
|
|
358
|
-
.filter(trigger => trigger.length > 0)
|
|
359
|
-
.filter(trigger => !initialTriggers.some(initial => initial.toLowerCase() === trigger.toLowerCase()));
|
|
356
|
+
.map((trigger) => trigger.trim())
|
|
357
|
+
.filter((trigger) => trigger.length > 0)
|
|
358
|
+
.filter((trigger) => !initialTriggers.some((initial) => initial.toLowerCase() === trigger.toLowerCase()));
|
|
360
359
|
return expanded;
|
|
361
360
|
}
|
|
362
361
|
catch (error) {
|
|
@@ -485,7 +484,7 @@ The pattern is now ready to enhance AI recommendations. When users ask for deplo
|
|
|
485
484
|
// Create policy intent using the consistent ID generated during kyverno-generation step
|
|
486
485
|
if (!session.data.policyId) {
|
|
487
486
|
// In test environment, generate ID if missing (for mocked workflows)
|
|
488
|
-
const isTestEnv = process.env.NODE_ENV === 'test'
|
|
487
|
+
const isTestEnv = process.env.NODE_ENV === 'test';
|
|
489
488
|
if (isTestEnv) {
|
|
490
489
|
session.data.policyId = (0, crypto_1.randomUUID)();
|
|
491
490
|
}
|
|
@@ -733,10 +732,10 @@ The policy intent has been stored in the database. The Kyverno policy was not ap
|
|
|
733
732
|
error_details: lastError ? `\n**Attempt**: ${lastError.attempt}\n**Validation Errors**: ${lastError.validationResult.errors.join(', ')}\n**Validation Warnings**: ${lastError.validationResult.warnings.join(', ')}` : 'None - this is the first attempt.'
|
|
734
733
|
};
|
|
735
734
|
const prompt = (0, shared_prompt_loader_1.loadPrompt)('kyverno-generation', templateData);
|
|
736
|
-
// Call
|
|
737
|
-
const
|
|
738
|
-
const
|
|
739
|
-
const response = await
|
|
735
|
+
// Call AI provider internally to generate Kyverno policy
|
|
736
|
+
const { createAIProvider } = require('./ai-provider-factory');
|
|
737
|
+
const aiProvider = createAIProvider();
|
|
738
|
+
const response = await aiProvider.sendMessage(prompt, 'kyverno-generation');
|
|
740
739
|
// Response should be clean YAML with analysis comments
|
|
741
740
|
const kyvernoPolicy = response.content.trim();
|
|
742
741
|
// Save policy to file immediately after generation
|
package/dist/interfaces/mcp.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Model Context Protocol (MCP) Interface for DevOps AI Toolkit
|
|
3
3
|
*
|
|
4
4
|
* Provides MCP server capabilities that expose DevOps AI Toolkit functionality
|
|
5
|
-
* to AI assistants
|
|
5
|
+
* to AI assistants through standardized protocol
|
|
6
6
|
*/
|
|
7
7
|
import { DotAI } from '../core/index';
|
|
8
8
|
export interface MCPServerConfig {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp.ts"],"names":[],"mappings":"AAAA;;;;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ose DevOps AI Toolkit functionality
|
|
6
|
-
* to AI assistants
|
|
6
|
+
* to AI assistants through standardized protocol
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.MCPServer = void 0;
|
|
@@ -19,7 +19,15 @@ const version_1 = require("../tools/version");
|
|
|
19
19
|
const test_docs_1 = require("../tools/test-docs");
|
|
20
20
|
const organizational_data_1 = require("../tools/organizational-data");
|
|
21
21
|
const remediate_1 = require("../tools/remediate");
|
|
22
|
-
|
|
22
|
+
/*
|
|
23
|
+
// DEVELOPER NOTE: Platform Building tool disabled - imports commented out
|
|
24
|
+
import {
|
|
25
|
+
BUILD_PLATFORM_TOOL_NAME,
|
|
26
|
+
BUILD_PLATFORM_TOOL_DESCRIPTION,
|
|
27
|
+
BUILD_PLATFORM_TOOL_INPUT_SCHEMA,
|
|
28
|
+
handleBuildPlatformTool,
|
|
29
|
+
} from '../tools/build-platform';
|
|
30
|
+
*/
|
|
23
31
|
const prompts_1 = require("../tools/prompts");
|
|
24
32
|
const rest_registry_1 = require("./rest-registry");
|
|
25
33
|
const rest_api_1 = require("./rest-api");
|
|
@@ -117,12 +125,25 @@ class MCPServer {
|
|
|
117
125
|
this.logger.info(`Processing ${remediate_1.REMEDIATE_TOOL_NAME} tool request`, { requestId });
|
|
118
126
|
return await (0, remediate_1.handleRemediateTool)(args);
|
|
119
127
|
}, 'Troubleshooting', ['remediation', 'troubleshooting', 'kubernetes', 'analysis']);
|
|
128
|
+
/*
|
|
129
|
+
// DEVELOPER NOTE: buildPlatform tool disabled - under active development with incomplete functionality
|
|
120
130
|
// Register buildPlatform tool
|
|
121
|
-
this.registerTool(
|
|
131
|
+
this.registerTool(
|
|
132
|
+
BUILD_PLATFORM_TOOL_NAME,
|
|
133
|
+
BUILD_PLATFORM_TOOL_DESCRIPTION,
|
|
134
|
+
BUILD_PLATFORM_TOOL_INPUT_SCHEMA,
|
|
135
|
+
async (args: any) => {
|
|
122
136
|
const requestId = this.generateRequestId();
|
|
123
|
-
this.logger.info(
|
|
124
|
-
|
|
125
|
-
|
|
137
|
+
this.logger.info(
|
|
138
|
+
`Processing ${BUILD_PLATFORM_TOOL_NAME} tool request`,
|
|
139
|
+
{ requestId }
|
|
140
|
+
);
|
|
141
|
+
return await handleBuildPlatformTool(args, this.dotAI, this.logger, requestId);
|
|
142
|
+
},
|
|
143
|
+
'Platform',
|
|
144
|
+
['platform', 'kubernetes', 'installation', 'infrastructure']
|
|
145
|
+
);
|
|
146
|
+
*/
|
|
126
147
|
this.logger.info('Registered all tools with McpServer', {
|
|
127
148
|
tools: [
|
|
128
149
|
recommend_1.RECOMMEND_TOOL_NAME,
|
|
@@ -130,9 +151,9 @@ class MCPServer {
|
|
|
130
151
|
test_docs_1.TESTDOCS_TOOL_NAME,
|
|
131
152
|
organizational_data_1.ORGANIZATIONAL_DATA_TOOL_NAME,
|
|
132
153
|
remediate_1.REMEDIATE_TOOL_NAME,
|
|
133
|
-
|
|
154
|
+
// BUILD_PLATFORM_TOOL_NAME, // Disabled - under development
|
|
134
155
|
],
|
|
135
|
-
totalTools:
|
|
156
|
+
totalTools: 5,
|
|
136
157
|
});
|
|
137
158
|
}
|
|
138
159
|
/**
|
|
@@ -38,7 +38,7 @@ class RestApiRouter {
|
|
|
38
38
|
basePath: '/api',
|
|
39
39
|
version: 'v1',
|
|
40
40
|
enableCors: true,
|
|
41
|
-
requestTimeout:
|
|
41
|
+
requestTimeout: 1800000, // 30 minutes for long-running operations (capability scan with slower AI providers)
|
|
42
42
|
...config
|
|
43
43
|
};
|
|
44
44
|
// Initialize OpenAPI generator
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* MCP Server Entry Point for DevOps AI Toolkit
|
|
4
4
|
*
|
|
5
5
|
* This server exposes DevOps AI Toolkit functionality through the Model Context Protocol,
|
|
6
|
-
* enabling AI assistants
|
|
6
|
+
* enabling AI assistants to interact with Kubernetes deployment capabilities.
|
|
7
7
|
*/
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/mcp/server.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* MCP Server Entry Point for DevOps AI Toolkit
|
|
5
5
|
*
|
|
6
6
|
* This server exposes DevOps AI Toolkit functionality through the Model Context Protocol,
|
|
7
|
-
* enabling AI assistants
|
|
7
|
+
* enabling AI assistants to interact with Kubernetes deployment capabilities.
|
|
8
8
|
*/
|
|
9
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
@@ -92,7 +92,7 @@ async function main() {
|
|
|
92
92
|
process.stderr.write(`FATAL: Session directory validation failed: ${error}\n`);
|
|
93
93
|
process.exit(1);
|
|
94
94
|
}
|
|
95
|
-
// Initialize DotAI - it will read KUBECONFIG and
|
|
95
|
+
// Initialize DotAI - it will read KUBECONFIG and AI provider configuration from environment
|
|
96
96
|
const dotAI = new index_js_1.DotAI();
|
|
97
97
|
// Initialize without cluster connection (lazy connection)
|
|
98
98
|
process.stderr.write('Initializing DevOps AI Toolkit...\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"answer-question.d.ts","sourceRoot":"","sources":["../../src/tools/answer-question.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;AAQhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,8HAA4H,CAAC;AAGzK,eAAO,MAAM,gCAAgC;;;;CAI5C,CAAC;AAgiBF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,EAC7G,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,CAqUxD"}
|
|
@@ -40,7 +40,6 @@ exports.ANSWERQUESTION_TOOL_INPUT_SCHEMA = exports.ANSWERQUESTION_TOOL_DESCRIPTI
|
|
|
40
40
|
exports.handleAnswerQuestionTool = handleAnswerQuestionTool;
|
|
41
41
|
const zod_1 = require("zod");
|
|
42
42
|
const error_handling_1 = require("../core/error-handling");
|
|
43
|
-
const claude_1 = require("../core/claude");
|
|
44
43
|
const fs = __importStar(require("fs"));
|
|
45
44
|
const path = __importStar(require("path"));
|
|
46
45
|
const shared_prompt_loader_1 = require("../core/shared-prompt-loader");
|
|
@@ -370,15 +369,14 @@ async function analyzeResourceNeeds(currentSolution, openResponse, context) {
|
|
|
370
369
|
.replace('{current_solution}', JSON.stringify(currentSolution, null, 2))
|
|
371
370
|
.replace('{user_request}', openResponse)
|
|
372
371
|
.replace('{available_resource_types}', JSON.stringify(availableResourceTypes, null, 2));
|
|
373
|
-
//
|
|
374
|
-
const
|
|
375
|
-
const claudeIntegration = new claude_1.ClaudeIntegration(apiKey);
|
|
372
|
+
// Get AI provider from context
|
|
373
|
+
const aiProvider = context.dotAI.ai;
|
|
376
374
|
context.logger.info('Analyzing resource needs for open question', {
|
|
377
375
|
openResponse,
|
|
378
376
|
availableResourceCount: availableResourceTypes.length
|
|
379
377
|
});
|
|
380
378
|
try {
|
|
381
|
-
const response = await
|
|
379
|
+
const response = await aiProvider.sendMessage(analysisPrompt);
|
|
382
380
|
const analysisResult = parseEnhancementResponse(response.content);
|
|
383
381
|
// Check for capability gap and throw specific error
|
|
384
382
|
if (analysisResult.approach === 'capability_gap') {
|
|
@@ -411,7 +409,7 @@ async function applySolutionEnhancement(solution, openResponse, analysisResult,
|
|
|
411
409
|
approach: analysisResult.approach,
|
|
412
410
|
reasoning: analysisResult.reasoning
|
|
413
411
|
});
|
|
414
|
-
return autoPopulateQuestions(solution, openResponse, analysisResult);
|
|
412
|
+
return autoPopulateQuestions(solution, openResponse, analysisResult, context);
|
|
415
413
|
}
|
|
416
414
|
if (analysisResult.approach === 'add_resources') {
|
|
417
415
|
// Add new resources and their questions
|
|
@@ -427,16 +425,16 @@ async function applySolutionEnhancement(solution, openResponse, analysisResult,
|
|
|
427
425
|
/**
|
|
428
426
|
* Auto-populate existing questions based on user requirements
|
|
429
427
|
*/
|
|
430
|
-
async function autoPopulateQuestions(solution, openResponse, analysisResult) {
|
|
428
|
+
async function autoPopulateQuestions(solution, openResponse, analysisResult, context) {
|
|
431
429
|
const template = (0, shared_prompt_loader_1.loadPrompt)('solution-enhancement');
|
|
432
430
|
const enhancementPrompt = template
|
|
433
431
|
.replace('{current_solution}', JSON.stringify(solution, null, 2))
|
|
434
432
|
.replace('{detailed_schemas}', JSON.stringify(solution.schemas || {}, null, 2))
|
|
435
433
|
.replace('{analysis_result}', JSON.stringify(analysisResult, null, 2))
|
|
436
434
|
.replace('{open_response}', openResponse);
|
|
437
|
-
|
|
438
|
-
const
|
|
439
|
-
const response = await
|
|
435
|
+
// Get AI provider from context
|
|
436
|
+
const aiProvider = context.dotAI.ai;
|
|
437
|
+
const response = await aiProvider.sendMessage(enhancementPrompt);
|
|
440
438
|
const enhancementData = parseEnhancementResponse(response.content);
|
|
441
439
|
if (enhancementData.enhancedSolution) {
|
|
442
440
|
return enhancementData.enhancedSolution;
|
|
@@ -101,7 +101,7 @@ async function handleBuildPlatformTool(args, dotAI, logger, requestId) {
|
|
|
101
101
|
// Phase 2: Handle stage: 'list' - discover all operations
|
|
102
102
|
if (stage === 'list') {
|
|
103
103
|
logger.info('Discovering available operations', { requestId });
|
|
104
|
-
const operations = await (0, platform_operations_1.discoverOperations)(dotAI.
|
|
104
|
+
const operations = await (0, platform_operations_1.discoverOperations)(dotAI.ai, logger);
|
|
105
105
|
const result = {
|
|
106
106
|
success: true,
|
|
107
107
|
operations,
|
|
@@ -171,9 +171,9 @@ async function handleBuildPlatformTool(args, dotAI, logger, requestId) {
|
|
|
171
171
|
intent
|
|
172
172
|
});
|
|
173
173
|
// Discover operations for intent mapping
|
|
174
|
-
const operations = await (0, platform_operations_1.discoverOperations)(dotAI.
|
|
174
|
+
const operations = await (0, platform_operations_1.discoverOperations)(dotAI.ai, logger);
|
|
175
175
|
// Map intent to operation using AI
|
|
176
|
-
const mapping = await (0, platform_operations_1.mapIntentToOperation)(intent, operations, dotAI.
|
|
176
|
+
const mapping = await (0, platform_operations_1.mapIntentToOperation)(intent, operations, dotAI.ai, logger);
|
|
177
177
|
// Handle no match case
|
|
178
178
|
if (!mapping.matched) {
|
|
179
179
|
logger.info('No matching operation found for intent', {
|
|
@@ -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;
|
|
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;;CAE/C,CAAC;AA+RF;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,EAC5B,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,CAqMxD"}
|
|
@@ -40,7 +40,6 @@ exports.GENERATEMANIFESTS_TOOL_INPUT_SCHEMA = exports.GENERATEMANIFESTS_TOOL_DES
|
|
|
40
40
|
exports.handleGenerateManifestsTool = handleGenerateManifestsTool;
|
|
41
41
|
const zod_1 = require("zod");
|
|
42
42
|
const error_handling_1 = require("../core/error-handling");
|
|
43
|
-
const claude_1 = require("../core/claude");
|
|
44
43
|
const cluster_utils_1 = require("../core/cluster-utils");
|
|
45
44
|
const schema_1 = require("../core/schema");
|
|
46
45
|
const fs = __importStar(require("fs"));
|
|
@@ -178,7 +177,7 @@ async function validateManifests(yamlPath) {
|
|
|
178
177
|
return await validator.validateManifest(yamlPath, { dryRunMode: 'server' });
|
|
179
178
|
}
|
|
180
179
|
/**
|
|
181
|
-
* Generate manifests using AI
|
|
180
|
+
* Generate manifests using AI provider
|
|
182
181
|
*/
|
|
183
182
|
async function generateManifestsWithAI(solution, dotAI, logger, errorContext, dotAiLabels) {
|
|
184
183
|
// Load prompt template
|
|
@@ -214,11 +213,10 @@ ${errorContext.previousManifests}
|
|
|
214
213
|
hasErrorContext: !!errorContext,
|
|
215
214
|
solutionId: solution.solutionId
|
|
216
215
|
});
|
|
217
|
-
//
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
const response = await claudeIntegration.sendMessage(aiPrompt);
|
|
216
|
+
// Get AI provider from dotAI
|
|
217
|
+
const aiProvider = dotAI.ai;
|
|
218
|
+
// Send prompt to AI
|
|
219
|
+
const response = await aiProvider.sendMessage(aiPrompt);
|
|
222
220
|
// Extract YAML content from response
|
|
223
221
|
let manifestContent = response.content;
|
|
224
222
|
// Try to extract YAML from code blocks if wrapped
|
|
@@ -401,9 +399,10 @@ async function handleGenerateManifestsTool(args, dotAI, logger, requestId) {
|
|
|
401
399
|
};
|
|
402
400
|
}
|
|
403
401
|
// Validation failed, prepare error context for next attempt
|
|
402
|
+
// Only pass AI-generated manifests (not ConfigMap) to avoid duplicate ConfigMaps on retry
|
|
404
403
|
lastError = {
|
|
405
404
|
attempt,
|
|
406
|
-
previousManifests:
|
|
405
|
+
previousManifests: aiManifests,
|
|
407
406
|
validationResult: validation
|
|
408
407
|
};
|
|
409
408
|
logger.warn('Manifest validation failed', {
|
|
@@ -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;
|
|
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;;;;;;;;;;;;;;;;;;;;;;;CA2BjD,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"}
|
|
@@ -54,6 +54,7 @@ const policy_operations_1 = require("../core/policy-operations");
|
|
|
54
54
|
const pattern_operations_1 = require("../core/pattern-operations");
|
|
55
55
|
const capability_operations_1 = require("../core/capability-operations");
|
|
56
56
|
const capability_scan_workflow_1 = require("../core/capability-scan-workflow");
|
|
57
|
+
const crypto_1 = require("crypto");
|
|
57
58
|
const fs = __importStar(require("fs"));
|
|
58
59
|
const path = __importStar(require("path"));
|
|
59
60
|
// Tool metadata for MCP registration
|
|
@@ -302,8 +303,8 @@ function getOrCreateCapabilitySession(sessionId, args, logger, requestId) {
|
|
|
302
303
|
return existing;
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
// Create new session
|
|
306
|
-
const newSessionId = sessionId || `cap-scan-${Date.now()}`;
|
|
306
|
+
// Create new session with unique ID (timestamp + UUID for concurrent request safety)
|
|
307
|
+
const newSessionId = sessionId || `cap-scan-${Date.now()}-${(0, crypto_1.randomUUID)().substring(0, 8)}`;
|
|
307
308
|
const session = {
|
|
308
309
|
sessionId: newSessionId,
|
|
309
310
|
currentStep: 'resource-selection',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discover Operations Tool
|
|
3
|
+
*
|
|
4
|
+
* Self-contained tool that fetches raw Nu shell script help output.
|
|
5
|
+
* Returns unprocessed data for AI to parse.
|
|
6
|
+
*/
|
|
7
|
+
import { AITool, AIProvider } from '../../core/ai-provider.interface';
|
|
8
|
+
import { Logger } from '../../core/error-handling';
|
|
9
|
+
/**
|
|
10
|
+
* Operation interfaces (re-export for tool consumers)
|
|
11
|
+
*/
|
|
12
|
+
export interface OperationCommand {
|
|
13
|
+
name: string;
|
|
14
|
+
command: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface Operation {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
operations: OperationCommand[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Tool schema for getting Nu script help output
|
|
23
|
+
*/
|
|
24
|
+
export declare const discoverOperationsTool: AITool;
|
|
25
|
+
/**
|
|
26
|
+
* Execute get_nu_help_output tool
|
|
27
|
+
*
|
|
28
|
+
* Simple data fetcher - returns raw Nu script help output
|
|
29
|
+
*/
|
|
30
|
+
export declare function executeDiscoverOperations(input: any, aiProvider: AIProvider, logger: Logger): Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
helpOutput?: string;
|
|
33
|
+
error?: string;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=discover-operations.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-operations.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/platform/discover-operations.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGnD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAUpC,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,GAAG,EACV,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAyBpE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Discover Operations Tool
|
|
4
|
+
*
|
|
5
|
+
* Self-contained tool that fetches raw Nu shell script help output.
|
|
6
|
+
* Returns unprocessed data for AI to parse.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.discoverOperationsTool = void 0;
|
|
43
|
+
exports.executeDiscoverOperations = executeDiscoverOperations;
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const platform_utils_1 = require("../../core/platform-utils");
|
|
46
|
+
/**
|
|
47
|
+
* Tool schema for getting Nu script help output
|
|
48
|
+
*/
|
|
49
|
+
exports.discoverOperationsTool = {
|
|
50
|
+
name: "get_nu_help_output",
|
|
51
|
+
description: `Executes 'nu ./dot.nu --help' and returns the raw help output text.
|
|
52
|
+
|
|
53
|
+
Returns the complete help documentation that lists all available platform
|
|
54
|
+
operations with their commands and descriptions.`,
|
|
55
|
+
inputSchema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {} // No input needed
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Execute get_nu_help_output tool
|
|
62
|
+
*
|
|
63
|
+
* Simple data fetcher - returns raw Nu script help output
|
|
64
|
+
*/
|
|
65
|
+
async function executeDiscoverOperations(input, aiProvider, logger) {
|
|
66
|
+
try {
|
|
67
|
+
// Execute Nu script help command
|
|
68
|
+
const scriptPath = path.join((0, platform_utils_1.getScriptsDir)(), 'dot.nu');
|
|
69
|
+
const { stdout, stderr } = await (0, platform_utils_1.execAsync)(`nu "${scriptPath}" --help`);
|
|
70
|
+
if (stderr) {
|
|
71
|
+
logger.warn?.('Nu script help command produced stderr', { stderr });
|
|
72
|
+
}
|
|
73
|
+
logger.info?.('Tool fetched Nu help output', {
|
|
74
|
+
length: stdout.length
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
success: true,
|
|
78
|
+
helpOutput: stdout
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
logger.error?.('Tool failed to get Nu help output', error);
|
|
83
|
+
return {
|
|
84
|
+
success: false,
|
|
85
|
+
error: error instanceof Error ? error.message : String(error)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -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;
|
|
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;;;;;;;CAUvC,CAAC;AAqHF;;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,CA4QxD"}
|