@vfarcic/dot-ai 0.138.0 → 0.140.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +3 -2
- package/dist/core/command-executor.d.ts +39 -0
- package/dist/core/command-executor.d.ts.map +1 -0
- package/dist/core/command-executor.js +111 -0
- package/dist/core/deploy-operation.d.ts.map +1 -1
- package/dist/core/deploy-operation.js +3 -5
- package/dist/core/pattern-vector-service.d.ts +1 -1
- package/dist/core/pattern-vector-service.d.ts.map +1 -1
- package/dist/core/pattern-vector-service.js +2 -2
- package/dist/core/schema.js +1 -1
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +9 -1
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +27 -142
- package/dist/tools/choose-solution.d.ts.map +1 -1
- package/dist/tools/choose-solution.js +22 -85
- package/dist/tools/deploy-manifests.js +1 -1
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +33 -71
- package/dist/tools/operate-analysis.d.ts +15 -0
- package/dist/tools/operate-analysis.d.ts.map +1 -0
- package/dist/tools/operate-analysis.js +238 -0
- package/dist/tools/operate-execution.d.ts +18 -0
- package/dist/tools/operate-execution.d.ts.map +1 -0
- package/dist/tools/operate-execution.js +122 -0
- package/dist/tools/operate.d.ts +133 -0
- package/dist/tools/operate.d.ts.map +1 -0
- package/dist/tools/operate.js +237 -0
- package/dist/tools/recommend.d.ts +23 -1
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +14 -116
- package/dist/tools/remediate.d.ts +7 -4
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +38 -81
- package/dist/tools/version.js +1 -1
- package/package.json +1 -1
- package/prompts/operate-system.md +322 -0
- package/prompts/operate-user.md +25 -0
|
@@ -1 +1 @@
|
|
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C,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7Y,OAAO,CAAC,GAAG,CAAC,CA4Hd;AAED;;GAEG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,uBAAuB,EAC1C,oBAAoB,EAAE,sBAAsB,EAC5C,2BAA2B,EAAE,6BAA6B,EAC1D,wBAAwB,EAAE,0BAA0B,EACpD,sCAAsC,EAAE,wCAAwC,EAChF,gBAAgB,EAAE,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,sCAAsC,EAAE,wCAAwC,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7Y,OAAO,CAAC,GAAG,CAAC,CAuCd;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,uBAAuB,EAC1C,oBAAoB,EAAE,sBAAsB,EAC5C,2BAA2B,EAAE,6BAA6B,EAC1D,wBAAwB,EAAE,0BAA0B,EACpD,sCAAsC,EAAE,wCAAwC,GAC/E,OAAO,CAAC,GAAG,CAAC,CAoad"}
|
|
@@ -455,8 +455,9 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
|
|
|
455
455
|
const lines = currentResourceDefinition.split('\n');
|
|
456
456
|
const groupLine = lines.find((line) => line.startsWith('GROUP:'));
|
|
457
457
|
const versionLine = lines.find((line) => line.startsWith('VERSION:'));
|
|
458
|
-
if (
|
|
459
|
-
|
|
458
|
+
// Extract metadata if version is found (group is optional for core resources)
|
|
459
|
+
if (versionLine) {
|
|
460
|
+
const group = groupLine ? groupLine.replace('GROUP:', '').trim() : '';
|
|
460
461
|
const version = versionLine.replace('VERSION:', '').trim();
|
|
461
462
|
const apiVersion = group ? `${group}/${version}` : version;
|
|
462
463
|
metadata = { apiVersion, version, group };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Command Executor
|
|
3
|
+
*
|
|
4
|
+
* Provides common command execution logic for tools (remediate, operate, etc.)
|
|
5
|
+
* Uses continue-on-error pattern: executes all commands sequentially regardless
|
|
6
|
+
* of individual failures.
|
|
7
|
+
*/
|
|
8
|
+
import { Logger } from './error-handling';
|
|
9
|
+
/**
|
|
10
|
+
* Execution result for a single command
|
|
11
|
+
*/
|
|
12
|
+
export interface CommandExecutionResult {
|
|
13
|
+
command: string;
|
|
14
|
+
success: boolean;
|
|
15
|
+
output?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
timestamp: Date;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Options for command execution
|
|
21
|
+
*/
|
|
22
|
+
export interface CommandExecutionOptions {
|
|
23
|
+
sessionId?: string;
|
|
24
|
+
context?: string;
|
|
25
|
+
logMetadata?: Record<string, any>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Execute a list of commands sequentially with continue-on-error pattern
|
|
29
|
+
*
|
|
30
|
+
* @param commands - Array of command strings to execute
|
|
31
|
+
* @param logger - Logger instance for tracking execution
|
|
32
|
+
* @param options - Optional execution context and metadata
|
|
33
|
+
* @returns Array of execution results and overall success status
|
|
34
|
+
*/
|
|
35
|
+
export declare function executeCommands(commands: string[], logger: Logger, options?: CommandExecutionOptions): Promise<{
|
|
36
|
+
results: CommandExecutionResult[];
|
|
37
|
+
overallSuccess: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=command-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-executor.d.ts","sourceRoot":"","sources":["../../src/core/command-executor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC;IAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,CAAC,CAwEzE"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared Command Executor
|
|
4
|
+
*
|
|
5
|
+
* Provides common command execution logic for tools (remediate, operate, etc.)
|
|
6
|
+
* Uses continue-on-error pattern: executes all commands sequentially regardless
|
|
7
|
+
* of individual failures.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.executeCommands = executeCommands;
|
|
44
|
+
/**
|
|
45
|
+
* Execute a list of commands sequentially with continue-on-error pattern
|
|
46
|
+
*
|
|
47
|
+
* @param commands - Array of command strings to execute
|
|
48
|
+
* @param logger - Logger instance for tracking execution
|
|
49
|
+
* @param options - Optional execution context and metadata
|
|
50
|
+
* @returns Array of execution results and overall success status
|
|
51
|
+
*/
|
|
52
|
+
async function executeCommands(commands, logger, options = {}) {
|
|
53
|
+
const results = [];
|
|
54
|
+
let overallSuccess = true;
|
|
55
|
+
const { sessionId, context = 'command execution', logMetadata = {} } = options;
|
|
56
|
+
logger.info(`Starting ${context}`, {
|
|
57
|
+
...logMetadata,
|
|
58
|
+
sessionId,
|
|
59
|
+
commandCount: commands.length
|
|
60
|
+
});
|
|
61
|
+
// Execute each command sequentially
|
|
62
|
+
for (let i = 0; i < commands.length; i++) {
|
|
63
|
+
const command = commands[i];
|
|
64
|
+
const commandNum = i + 1;
|
|
65
|
+
try {
|
|
66
|
+
logger.info(`Executing command ${commandNum}/${commands.length}`, {
|
|
67
|
+
...logMetadata,
|
|
68
|
+
sessionId,
|
|
69
|
+
command
|
|
70
|
+
});
|
|
71
|
+
// Clean up escape sequences that AI models sometimes add
|
|
72
|
+
const cleanCommand = command.replace(/\\"/g, '"');
|
|
73
|
+
// Execute command using shared utility
|
|
74
|
+
const { execAsync } = await Promise.resolve().then(() => __importStar(require('./platform-utils.js')));
|
|
75
|
+
const { stdout } = await execAsync(cleanCommand);
|
|
76
|
+
results.push({
|
|
77
|
+
command,
|
|
78
|
+
success: true,
|
|
79
|
+
output: stdout?.trim() || '',
|
|
80
|
+
timestamp: new Date()
|
|
81
|
+
});
|
|
82
|
+
logger.info(`Command ${commandNum} succeeded`, {
|
|
83
|
+
...logMetadata,
|
|
84
|
+
sessionId
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
89
|
+
overallSuccess = false;
|
|
90
|
+
results.push({
|
|
91
|
+
command,
|
|
92
|
+
success: false,
|
|
93
|
+
error: errorMessage,
|
|
94
|
+
timestamp: new Date()
|
|
95
|
+
});
|
|
96
|
+
logger.error(`Command ${commandNum} failed`, error, {
|
|
97
|
+
...logMetadata,
|
|
98
|
+
sessionId,
|
|
99
|
+
command
|
|
100
|
+
});
|
|
101
|
+
// Continue to next command (continue-on-error pattern)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
logger.info(`${context} completed`, {
|
|
105
|
+
...logMetadata,
|
|
106
|
+
sessionId,
|
|
107
|
+
successCount: results.filter(r => r.success).length,
|
|
108
|
+
failureCount: results.filter(r => !r.success).length
|
|
109
|
+
});
|
|
110
|
+
return { results, overallSuccess };
|
|
111
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-operation.d.ts","sourceRoot":"","sources":["../../src/core/deploy-operation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,UAAU,CAAC,EAAE,MAAM;IAM/B;;OAEG;IACU,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAiClE;;OAEG;IACH,OAAO,CAAC,eAAe;
|
|
1
|
+
{"version":3,"file":"deploy-operation.d.ts","sourceRoot":"","sources":["../../src/core/deploy-operation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,aAAa,CAAgB;gBAEzB,UAAU,CAAC,EAAE,MAAM;IAM/B;;OAEG;IACU,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAiClE;;OAEG;IACH,OAAO,CAAC,eAAe;IAMvB;;OAEG;YACW,oBAAoB;IAQlC;;OAEG;YACW,cAAc;CA8B7B"}
|
|
@@ -47,11 +47,9 @@ class DeployOperation {
|
|
|
47
47
|
* Get the manifest file path for the solution
|
|
48
48
|
*/
|
|
49
49
|
getManifestPath(options) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
return (0, path_1.join)(sessionDir, `${options.solutionId}.yaml`);
|
|
50
|
+
// Use sessionDir if provided, otherwise use tmp directory (for recommend tool compatibility)
|
|
51
|
+
const tmpDir = options.sessionDir || (0, path_1.join)(process.cwd(), 'tmp');
|
|
52
|
+
return (0, path_1.join)(tmpDir, `${options.solutionId}.yaml`);
|
|
55
53
|
}
|
|
56
54
|
/**
|
|
57
55
|
* Verify that the manifest file exists
|
|
@@ -13,7 +13,7 @@ export interface PatternSearchOptions extends BaseSearchOptions {
|
|
|
13
13
|
export interface PatternSearchResult extends BaseSearchResult<OrganizationalPattern> {
|
|
14
14
|
}
|
|
15
15
|
export declare class PatternVectorService extends BaseVectorService<OrganizationalPattern> {
|
|
16
|
-
constructor(vectorDB?: VectorDBService, embeddingService?: EmbeddingService);
|
|
16
|
+
constructor(collectionName?: string, vectorDB?: VectorDBService, embeddingService?: EmbeddingService);
|
|
17
17
|
protected createSearchText(pattern: OrganizationalPattern): string;
|
|
18
18
|
protected extractId(pattern: OrganizationalPattern): string;
|
|
19
19
|
protected createPayload(pattern: OrganizationalPattern): Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern-vector-service.d.ts","sourceRoot":"","sources":["../../src/core/pattern-vector-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;CAAG;AAClE,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB,CAAC,qBAAqB,CAAC;CAAG;AAEvF,qBAAa,oBAAqB,SAAQ,iBAAiB,CAAC,qBAAqB,CAAC;gBACpE,QAAQ,CAAC,EAAE,eAAe,EAAE,gBAAgB,CAAC,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"pattern-vector-service.d.ts","sourceRoot":"","sources":["../../src/core/pattern-vector-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE/F,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;CAAG;AAClE,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB,CAAC,qBAAqB,CAAC;CAAG;AAEvF,qBAAa,oBAAqB,SAAQ,iBAAiB,CAAC,qBAAqB,CAAC;gBACpE,cAAc,GAAE,MAAmB,EAAE,QAAQ,CAAC,EAAE,eAAe,EAAE,gBAAgB,CAAC,EAAE,gBAAgB;IAKhH,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IAOlE,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IAI3D,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAW5E,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,qBAAqB;IAatE,YAAY,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAIjG,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAI7D,cAAc,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAIlD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;CAG1C"}
|
|
@@ -9,8 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.PatternVectorService = void 0;
|
|
10
10
|
const base_vector_service_1 = require("./base-vector-service");
|
|
11
11
|
class PatternVectorService extends base_vector_service_1.BaseVectorService {
|
|
12
|
-
constructor(vectorDB, embeddingService) {
|
|
13
|
-
super(
|
|
12
|
+
constructor(collectionName = 'patterns', vectorDB, embeddingService) {
|
|
13
|
+
super(collectionName, vectorDB, embeddingService);
|
|
14
14
|
}
|
|
15
15
|
// Implement abstract methods from BaseVectorService
|
|
16
16
|
createSearchText(pattern) {
|
package/dist/core/schema.js
CHANGED
|
@@ -292,7 +292,7 @@ class ResourceRecommender {
|
|
|
292
292
|
// Initialize pattern service only if Vector DB is available
|
|
293
293
|
try {
|
|
294
294
|
const vectorDB = new vector_db_service_1.VectorDBService({ collectionName: 'patterns' });
|
|
295
|
-
this.patternService = new pattern_vector_service_1.PatternVectorService(vectorDB);
|
|
295
|
+
this.patternService = new pattern_vector_service_1.PatternVectorService('patterns', vectorDB);
|
|
296
296
|
console.log('✅ Pattern service initialized with Vector DB');
|
|
297
297
|
}
|
|
298
298
|
catch (error) {
|
|
@@ -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;;;;;GAKG;AAWH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAgDtC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACxC;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,gBAAgB,CAAa;IACrC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAAC,CAAkC;IACrD,OAAO,CAAC,aAAa,CAAC,CAAgC;IACtD,OAAO,CAAC,YAAY,CAAmB;IACvC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe;IAsCjD;;OAEG;IACH,OAAO,CAAC,YAAY;IA2BpB;;OAEG;IACH,OAAO,CAAC,aAAa;IA6HrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAqCvB,OAAO,CAAC,iBAAiB;IAInB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAkBd,mBAAmB;YAMnB,kBAAkB;YA6GlB,gBAAgB;IAexB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB3B,OAAO,IAAI,OAAO;CAGnB"}
|
package/dist/interfaces/mcp.js
CHANGED
|
@@ -18,6 +18,7 @@ const recommend_1 = require("../tools/recommend");
|
|
|
18
18
|
const version_1 = require("../tools/version");
|
|
19
19
|
const organizational_data_1 = require("../tools/organizational-data");
|
|
20
20
|
const remediate_1 = require("../tools/remediate");
|
|
21
|
+
const operate_1 = require("../tools/operate");
|
|
21
22
|
const project_setup_1 = require("../tools/project-setup");
|
|
22
23
|
const prompts_1 = require("../tools/prompts");
|
|
23
24
|
const rest_registry_1 = require("./rest-registry");
|
|
@@ -114,6 +115,12 @@ class MCPServer {
|
|
|
114
115
|
this.logger.info(`Processing ${remediate_1.REMEDIATE_TOOL_NAME} tool request`, { requestId });
|
|
115
116
|
return await (0, remediate_1.handleRemediateTool)(args);
|
|
116
117
|
}, 'Troubleshooting', ['remediation', 'troubleshooting', 'kubernetes', 'analysis']);
|
|
118
|
+
// Register operate tool
|
|
119
|
+
this.registerTool(operate_1.OPERATE_TOOL_NAME, operate_1.OPERATE_TOOL_DESCRIPTION, operate_1.OPERATE_TOOL_INPUT_SCHEMA, async (args) => {
|
|
120
|
+
const requestId = this.generateRequestId();
|
|
121
|
+
this.logger.info(`Processing ${operate_1.OPERATE_TOOL_NAME} tool request`, { requestId });
|
|
122
|
+
return await (0, operate_1.handleOperateTool)(args);
|
|
123
|
+
}, 'Operations', ['operate', 'operations', 'kubernetes', 'day2', 'update', 'scale']);
|
|
117
124
|
// Register projectSetup tool
|
|
118
125
|
this.registerTool(project_setup_1.PROJECT_SETUP_TOOL_NAME, project_setup_1.PROJECT_SETUP_TOOL_DESCRIPTION, project_setup_1.PROJECT_SETUP_TOOL_INPUT_SCHEMA, async (args) => {
|
|
119
126
|
const requestId = this.generateRequestId();
|
|
@@ -126,9 +133,10 @@ class MCPServer {
|
|
|
126
133
|
version_1.VERSION_TOOL_NAME,
|
|
127
134
|
organizational_data_1.ORGANIZATIONAL_DATA_TOOL_NAME,
|
|
128
135
|
remediate_1.REMEDIATE_TOOL_NAME,
|
|
136
|
+
operate_1.OPERATE_TOOL_NAME,
|
|
129
137
|
project_setup_1.PROJECT_SETUP_TOOL_NAME
|
|
130
138
|
],
|
|
131
|
-
totalTools:
|
|
139
|
+
totalTools: 6,
|
|
132
140
|
});
|
|
133
141
|
}
|
|
134
142
|
/**
|
|
@@ -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;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,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;AAOhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,8HAA4H,CAAC;AAGzK,eAAO,MAAM,gCAAgC;;;;;CAK5C,CAAC;AAifF;;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,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,EACtI,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,CAgSxD"}
|
|
@@ -2,108 +2,25 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Answer Question Tool - Process user answers and return remaining questions
|
|
4
4
|
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
-
var ownKeys = function(o) {
|
|
23
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
-
var ar = [];
|
|
25
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
-
return ar;
|
|
27
|
-
};
|
|
28
|
-
return ownKeys(o);
|
|
29
|
-
};
|
|
30
|
-
return function (mod) {
|
|
31
|
-
if (mod && mod.__esModule) return mod;
|
|
32
|
-
var result = {};
|
|
33
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
-
__setModuleDefault(result, mod);
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
})();
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
6
|
exports.ANSWERQUESTION_TOOL_INPUT_SCHEMA = exports.ANSWERQUESTION_TOOL_DESCRIPTION = exports.ANSWERQUESTION_TOOL_NAME = void 0;
|
|
40
7
|
exports.handleAnswerQuestionTool = handleAnswerQuestionTool;
|
|
41
8
|
const zod_1 = require("zod");
|
|
42
9
|
const error_handling_1 = require("../core/error-handling");
|
|
43
|
-
const fs = __importStar(require("fs"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
10
|
const shared_prompt_loader_1 = require("../core/shared-prompt-loader");
|
|
46
|
-
const
|
|
11
|
+
const generic_session_manager_1 = require("../core/generic-session-manager");
|
|
47
12
|
const solution_utils_1 = require("../core/solution-utils");
|
|
48
13
|
// Tool metadata for direct MCP registration
|
|
49
14
|
exports.ANSWERQUESTION_TOOL_NAME = 'answerQuestion';
|
|
50
15
|
exports.ANSWERQUESTION_TOOL_DESCRIPTION = 'Process user answers and return remaining questions or completion status. For open stage, use "open" as the answer key.';
|
|
51
16
|
// Zod schema for MCP registration
|
|
52
17
|
exports.ANSWERQUESTION_TOOL_INPUT_SCHEMA = {
|
|
53
|
-
solutionId: zod_1.z.string().regex(/^
|
|
18
|
+
solutionId: zod_1.z.string().regex(/^sol-\d+-[a-f0-9]{8}$/).describe('The solution ID to update (e.g., sol-1762983784617-9ddae2b8)'),
|
|
54
19
|
stage: zod_1.z.enum(['required', 'basic', 'advanced', 'open']).describe('The configuration stage being addressed'),
|
|
55
20
|
answers: zod_1.z.record(zod_1.z.any()).describe('User answers to configuration questions for the specified stage. For required/basic/advanced stages, use questionId as key. For open stage, use "open" as key (e.g., {"open": "add persistent storage"})'),
|
|
56
21
|
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
57
22
|
};
|
|
58
|
-
|
|
59
|
-
* Load solution file by ID
|
|
60
|
-
*/
|
|
61
|
-
function loadSolutionFile(solutionId, sessionDir) {
|
|
62
|
-
const solutionPath = path.join(sessionDir, `${solutionId}.json`);
|
|
63
|
-
if (!fs.existsSync(solutionPath)) {
|
|
64
|
-
throw new Error(`Solution file not found: ${solutionPath}. Available files: ${fs.readdirSync(sessionDir).filter(f => f.endsWith('.json')).join(', ')}`);
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
const content = fs.readFileSync(solutionPath, 'utf8');
|
|
68
|
-
const solution = JSON.parse(content);
|
|
69
|
-
// Validate solution structure
|
|
70
|
-
if (!solution.solutionId || !solution.questions) {
|
|
71
|
-
throw new Error(`Invalid solution file structure: ${solutionId}. Missing required fields: solutionId or questions`);
|
|
72
|
-
}
|
|
73
|
-
return solution;
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
if (error instanceof SyntaxError) {
|
|
77
|
-
throw new Error(`Invalid JSON in solution file: ${solutionId}`);
|
|
78
|
-
}
|
|
79
|
-
throw error;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Save solution file with atomic operations
|
|
84
|
-
*/
|
|
85
|
-
function saveSolutionFile(solution, solutionId, sessionDir) {
|
|
86
|
-
const solutionPath = path.join(sessionDir, `${solutionId}.json`);
|
|
87
|
-
const tempPath = solutionPath + '.tmp';
|
|
88
|
-
try {
|
|
89
|
-
// Write to temporary file first
|
|
90
|
-
fs.writeFileSync(tempPath, JSON.stringify(solution, null, 2), 'utf8');
|
|
91
|
-
// Atomically rename to final path
|
|
92
|
-
fs.renameSync(tempPath, solutionPath);
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
// Clean up temporary file if it exists
|
|
96
|
-
if (fs.existsSync(tempPath)) {
|
|
97
|
-
try {
|
|
98
|
-
fs.unlinkSync(tempPath);
|
|
99
|
-
}
|
|
100
|
-
catch (cleanupError) {
|
|
101
|
-
// Ignore cleanup errors
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
throw error;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
23
|
+
// Session management now handled by GenericSessionManager
|
|
107
24
|
/**
|
|
108
25
|
* Validate answer against question schema
|
|
109
26
|
*/
|
|
@@ -514,47 +431,29 @@ async function handleAnswerQuestionTool(args, dotAI, logger, requestId) {
|
|
|
514
431
|
});
|
|
515
432
|
// Input validation is handled automatically by MCP SDK with Zod schema
|
|
516
433
|
// args are already validated and typed when we reach this point
|
|
517
|
-
//
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
operation: 'session_directory_validation',
|
|
526
|
-
component: 'AnswerQuestionTool',
|
|
527
|
-
requestId,
|
|
528
|
-
suggestedActions: [
|
|
529
|
-
'Ensure session directory exists and is writable',
|
|
530
|
-
'Check directory permissions',
|
|
531
|
-
'Verify the directory path is correct',
|
|
532
|
-
'Verify DOT_AI_SESSION_DIR environment variable is correctly set'
|
|
533
|
-
]
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
// Load solution file
|
|
537
|
-
let solution;
|
|
538
|
-
try {
|
|
539
|
-
solution = loadSolutionFile(args.solutionId, sessionDir);
|
|
540
|
-
logger.debug('Solution file loaded successfully', {
|
|
541
|
-
solutionId: args.solutionId,
|
|
542
|
-
hasQuestions: !!solution.questions
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
catch (error) {
|
|
546
|
-
throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.VALIDATION, error_handling_1.ErrorSeverity.HIGH, error instanceof Error ? error.message : 'Failed to load solution file', {
|
|
547
|
-
operation: 'solution_file_loading',
|
|
434
|
+
// Initialize session manager
|
|
435
|
+
const sessionManager = new generic_session_manager_1.GenericSessionManager('sol');
|
|
436
|
+
logger.debug('Session manager initialized', { requestId });
|
|
437
|
+
// Load solution session
|
|
438
|
+
const session = sessionManager.getSession(args.solutionId);
|
|
439
|
+
if (!session) {
|
|
440
|
+
throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.VALIDATION, error_handling_1.ErrorSeverity.HIGH, `Solution not found: ${args.solutionId}`, {
|
|
441
|
+
operation: 'solution_loading',
|
|
548
442
|
component: 'AnswerQuestionTool',
|
|
549
443
|
requestId,
|
|
444
|
+
input: { solutionId: args.solutionId },
|
|
550
445
|
suggestedActions: [
|
|
551
|
-
'Verify the solution ID
|
|
552
|
-
'
|
|
553
|
-
'
|
|
554
|
-
'List available solution files in the session directory'
|
|
446
|
+
'Verify the solution ID is correct',
|
|
447
|
+
'Ensure the solution was created by the recommend tool',
|
|
448
|
+
'Check that the session has not expired'
|
|
555
449
|
]
|
|
556
450
|
});
|
|
557
451
|
}
|
|
452
|
+
let solution = session.data;
|
|
453
|
+
logger.debug('Solution loaded successfully', {
|
|
454
|
+
solutionId: args.solutionId,
|
|
455
|
+
hasQuestions: !!solution.questions
|
|
456
|
+
});
|
|
558
457
|
// Stage-based validation and workflow
|
|
559
458
|
const stageState = getCurrentStage(solution);
|
|
560
459
|
// Validate stage transition
|
|
@@ -648,26 +547,12 @@ async function handleAnswerQuestionTool(args, dotAI, logger, requestId) {
|
|
|
648
547
|
}
|
|
649
548
|
}
|
|
650
549
|
// Save solution with answers
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
catch (error) {
|
|
660
|
-
throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.STORAGE, error_handling_1.ErrorSeverity.HIGH, 'Failed to save solution file', {
|
|
661
|
-
operation: 'solution_file_saving',
|
|
662
|
-
component: 'AnswerQuestionTool',
|
|
663
|
-
requestId,
|
|
664
|
-
suggestedActions: [
|
|
665
|
-
'Check session directory write permissions',
|
|
666
|
-
'Ensure adequate disk space',
|
|
667
|
-
'Verify solution JSON is valid'
|
|
668
|
-
]
|
|
669
|
-
});
|
|
670
|
-
}
|
|
550
|
+
sessionManager.replaceSession(args.solutionId, solution);
|
|
551
|
+
logger.info('Solution updated with stage answers', {
|
|
552
|
+
solutionId: args.solutionId,
|
|
553
|
+
stage: args.stage,
|
|
554
|
+
answerCount: Object.keys(args.answers).length
|
|
555
|
+
});
|
|
671
556
|
// Handle open stage completion (triggers manifest generation)
|
|
672
557
|
if (args.stage === 'open') {
|
|
673
558
|
const openAnswer = args.answers.open;
|
|
@@ -680,7 +565,7 @@ async function handleAnswerQuestionTool(args, dotAI, logger, requestId) {
|
|
|
680
565
|
});
|
|
681
566
|
solution = await enhanceSolutionWithOpenAnswer(solution, openAnswer, { requestId, logger, dotAI }, args.interaction_id);
|
|
682
567
|
// Save enhanced solution
|
|
683
|
-
|
|
568
|
+
sessionManager.replaceSession(args.solutionId, solution);
|
|
684
569
|
logger.info('Enhanced solution saved', {
|
|
685
570
|
solutionId: args.solutionId,
|
|
686
571
|
hasOpenAnswer: !!openAnswer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choose-solution.d.ts","sourceRoot":"","sources":["../../src/tools/choose-solution.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;
|
|
1
|
+
{"version":3,"file":"choose-solution.d.ts","sourceRoot":"","sources":["../../src/tools/choose-solution.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;AAKhD,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AACzD,eAAO,MAAM,+BAA+B,uEAAuE,CAAC;AAGpH,eAAO,MAAM,gCAAgC;;CAE5C,CAAC;AAIF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,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,CA2GxD"}
|