@vfarcic/dot-ai 0.103.0 → 0.105.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.
Files changed (96) hide show
  1. package/README.md +14 -1
  2. package/dist/core/ai-provider-factory.d.ts +90 -0
  3. package/dist/core/ai-provider-factory.d.ts.map +1 -0
  4. package/dist/core/ai-provider-factory.js +187 -0
  5. package/dist/core/ai-provider.interface.d.ts +116 -0
  6. package/dist/core/ai-provider.interface.d.ts.map +1 -0
  7. package/dist/core/ai-provider.interface.js +14 -0
  8. package/dist/core/capabilities.d.ts +3 -3
  9. package/dist/core/capabilities.d.ts.map +1 -1
  10. package/dist/core/capabilities.js +4 -4
  11. package/dist/core/capability-scan-workflow.d.ts.map +1 -1
  12. package/dist/core/capability-scan-workflow.js +29 -14
  13. package/dist/core/doc-testing-session.d.ts +1 -1
  14. package/dist/core/doc-testing-session.js +1 -1
  15. package/dist/core/error-handling.js +2 -2
  16. package/dist/core/index.d.ts +4 -6
  17. package/dist/core/index.d.ts.map +1 -1
  18. package/dist/core/index.js +11 -22
  19. package/dist/core/nushell-runtime.d.ts +39 -0
  20. package/dist/core/nushell-runtime.d.ts.map +1 -0
  21. package/dist/core/nushell-runtime.js +103 -0
  22. package/dist/core/platform-operations.d.ts +76 -0
  23. package/dist/core/platform-operations.d.ts.map +1 -0
  24. package/dist/core/platform-operations.js +317 -0
  25. package/dist/core/providers/anthropic-provider.d.ts +32 -0
  26. package/dist/core/providers/anthropic-provider.d.ts.map +1 -0
  27. package/dist/core/providers/anthropic-provider.js +177 -0
  28. package/dist/core/providers/vercel-provider.d.ts +34 -0
  29. package/dist/core/providers/vercel-provider.d.ts.map +1 -0
  30. package/dist/core/providers/vercel-provider.js +202 -0
  31. package/dist/core/schema.d.ts +4 -7
  32. package/dist/core/schema.d.ts.map +1 -1
  33. package/dist/core/schema.js +13 -11
  34. package/dist/core/unified-creation-session.d.ts.map +1 -1
  35. package/dist/core/unified-creation-session.js +13 -14
  36. package/dist/interfaces/mcp.d.ts +1 -1
  37. package/dist/interfaces/mcp.d.ts.map +1 -1
  38. package/dist/interfaces/mcp.js +10 -2
  39. package/dist/interfaces/rest-api.js +1 -1
  40. package/dist/mcp/server.d.ts +1 -1
  41. package/dist/mcp/server.js +2 -2
  42. package/dist/tools/answer-question.d.ts.map +1 -1
  43. package/dist/tools/answer-question.js +8 -10
  44. package/dist/tools/build-platform.d.ts +25 -0
  45. package/dist/tools/build-platform.d.ts.map +1 -0
  46. package/dist/tools/build-platform.js +277 -0
  47. package/dist/tools/generate-manifests.d.ts.map +1 -1
  48. package/dist/tools/generate-manifests.js +7 -8
  49. package/dist/tools/index.d.ts +1 -0
  50. package/dist/tools/index.d.ts.map +1 -1
  51. package/dist/tools/index.js +6 -1
  52. package/dist/tools/organizational-data.d.ts.map +1 -1
  53. package/dist/tools/organizational-data.js +3 -2
  54. package/dist/tools/recommend.d.ts.map +1 -1
  55. package/dist/tools/recommend.js +50 -30
  56. package/dist/tools/remediate.d.ts.map +1 -1
  57. package/dist/tools/remediate.js +23 -39
  58. package/dist/tools/version.d.ts +10 -2
  59. package/dist/tools/version.d.ts.map +1 -1
  60. package/dist/tools/version.js +65 -24
  61. package/package.json +7 -3
  62. package/prompts/map-intent-to-operation.md +104 -0
  63. package/prompts/parse-script-operations.md +72 -0
  64. package/prompts/question-generation.md +31 -3
  65. package/scripts/ack.nu +195 -0
  66. package/scripts/anthropic.nu +24 -0
  67. package/scripts/argo-workflows.nu +47 -0
  68. package/scripts/argocd.nu +85 -0
  69. package/scripts/aso.nu +74 -0
  70. package/scripts/atlas.nu +15 -0
  71. package/scripts/backstage.nu +349 -0
  72. package/scripts/cert-manager.nu +13 -0
  73. package/scripts/cnpg.nu +14 -0
  74. package/scripts/common.nu +116 -0
  75. package/scripts/crossplane.nu +718 -0
  76. package/scripts/dot.nu +32 -0
  77. package/scripts/external-secrets.nu +110 -0
  78. package/scripts/gatekeeper.nu +19 -0
  79. package/scripts/github.nu +42 -0
  80. package/scripts/image.nu +67 -0
  81. package/scripts/ingress.nu +149 -0
  82. package/scripts/kro.nu +11 -0
  83. package/scripts/kubernetes.nu +609 -0
  84. package/scripts/kubevela.nu +22 -0
  85. package/scripts/kyverno.nu +16 -0
  86. package/scripts/mcp.nu +139 -0
  87. package/scripts/port.nu +71 -0
  88. package/scripts/prometheus.nu +21 -0
  89. package/scripts/registry.nu +55 -0
  90. package/scripts/storage.nu +210 -0
  91. package/scripts/tests.nu +12 -0
  92. package/scripts/toolhive.nu +21 -0
  93. package/scripts/velero.nu +45 -0
  94. package/dist/core/claude.d.ts +0 -88
  95. package/dist/core/claude.d.ts.map +0 -1
  96. package/dist/core/claude.js +0 -414
@@ -3,7 +3,7 @@
3
3
  * Model Context Protocol (MCP) Interface for DevOps AI Toolkit
4
4
  *
5
5
  * Provides MCP server capabilities that expose DevOps AI Toolkit functionality
6
- * to AI assistants like Claude through standardized protocol
6
+ * to AI assistants through standardized protocol
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.MCPServer = void 0;
@@ -19,6 +19,7 @@ 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
+ const build_platform_1 = require("../tools/build-platform");
22
23
  const prompts_1 = require("../tools/prompts");
23
24
  const rest_registry_1 = require("./rest-registry");
24
25
  const rest_api_1 = require("./rest-api");
@@ -116,6 +117,12 @@ class MCPServer {
116
117
  this.logger.info(`Processing ${remediate_1.REMEDIATE_TOOL_NAME} tool request`, { requestId });
117
118
  return await (0, remediate_1.handleRemediateTool)(args);
118
119
  }, 'Troubleshooting', ['remediation', 'troubleshooting', 'kubernetes', 'analysis']);
120
+ // Register buildPlatform tool
121
+ this.registerTool(build_platform_1.BUILD_PLATFORM_TOOL_NAME, build_platform_1.BUILD_PLATFORM_TOOL_DESCRIPTION, build_platform_1.BUILD_PLATFORM_TOOL_INPUT_SCHEMA, async (args) => {
122
+ const requestId = this.generateRequestId();
123
+ this.logger.info(`Processing ${build_platform_1.BUILD_PLATFORM_TOOL_NAME} tool request`, { requestId });
124
+ return await (0, build_platform_1.handleBuildPlatformTool)(args, this.dotAI, this.logger, requestId);
125
+ }, 'Platform', ['platform', 'kubernetes', 'installation', 'infrastructure']);
119
126
  this.logger.info('Registered all tools with McpServer', {
120
127
  tools: [
121
128
  recommend_1.RECOMMEND_TOOL_NAME,
@@ -123,8 +130,9 @@ class MCPServer {
123
130
  test_docs_1.TESTDOCS_TOOL_NAME,
124
131
  organizational_data_1.ORGANIZATIONAL_DATA_TOOL_NAME,
125
132
  remediate_1.REMEDIATE_TOOL_NAME,
133
+ build_platform_1.BUILD_PLATFORM_TOOL_NAME,
126
134
  ],
127
- totalTools: 5,
135
+ totalTools: 6,
128
136
  });
129
137
  }
130
138
  /**
@@ -38,7 +38,7 @@ class RestApiRouter {
38
38
  basePath: '/api',
39
39
  version: 'v1',
40
40
  enableCors: true,
41
- requestTimeout: 900000, // 15 minutes for long-running operations like remediation
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
@@ -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 like Claude Code to interact with Kubernetes deployment capabilities.
6
+ * enabling AI assistants to interact with Kubernetes deployment capabilities.
7
7
  */
8
8
  export {};
9
9
  //# sourceMappingURL=server.d.ts.map
@@ -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 like Claude Code to interact with Kubernetes deployment capabilities.
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 ANTHROPIC_API_KEY from environment
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;AAGxB,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"}
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
- // Initialize Claude integration
374
- const apiKey = process.env.ANTHROPIC_API_KEY || 'test-key';
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 claudeIntegration.sendMessage(analysisPrompt);
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
- const apiKey = process.env.ANTHROPIC_API_KEY || 'test-key';
438
- const claudeIntegration = new claude_1.ClaudeIntegration(apiKey);
439
- const response = await claudeIntegration.sendMessage(enhancementPrompt);
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;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Build Platform Tool for MCP Server
3
+ *
4
+ * AI-powered tool that enables users to build and manage Kubernetes platforms
5
+ * through natural language intent. Handles script discovery, parameter collection,
6
+ * and execution transparently.
7
+ *
8
+ * Phase 1: Basic invocation and Nushell runtime validation
9
+ */
10
+ import { z } from 'zod';
11
+ import { Logger } from '../core/error-handling';
12
+ import { DotAI } from '../core/index';
13
+ export declare const BUILD_PLATFORM_TOOL_NAME = "buildPlatform";
14
+ export declare const BUILD_PLATFORM_TOOL_DESCRIPTION = "AI-powered platform operations tool for building and managing Kubernetes platforms. Use this to: (1) LIST/DISCOVER what tools and operations are available - use stage=\"list\" when user asks \"what can I install\", \"show available tools\", \"list platform capabilities\", (2) INSTALL/CREATE platform components like Argo CD, Crossplane, cert-manager, Kubernetes clusters through natural language intent. Handles tool installation, cluster creation, and platform configuration conversationally.";
15
+ export declare const BUILD_PLATFORM_TOOL_INPUT_SCHEMA: {
16
+ stage: z.ZodOptional<z.ZodString>;
17
+ intent: z.ZodOptional<z.ZodString>;
18
+ sessionId: z.ZodOptional<z.ZodString>;
19
+ answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
20
+ };
21
+ /**
22
+ * Main tool handler - Phase 1 & 2: Script discovery and intent mapping
23
+ */
24
+ export declare function handleBuildPlatformTool(args: any, dotAI: DotAI, logger: Logger, requestId: string): Promise<any>;
25
+ //# sourceMappingURL=build-platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-platform.d.ts","sourceRoot":"","sources":["../../src/tools/build-platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAItC,eAAO,MAAM,wBAAwB,kBAAkB,CAAC;AACxD,eAAO,MAAM,+BAA+B,mfAA2e,CAAC;AAuBxhB,eAAO,MAAM,gCAAgC;;;;;CAY5C,CAAC;AAEF;;GAEG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,CAgQd"}
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ /**
3
+ * Build Platform Tool for MCP Server
4
+ *
5
+ * AI-powered tool that enables users to build and manage Kubernetes platforms
6
+ * through natural language intent. Handles script discovery, parameter collection,
7
+ * and execution transparently.
8
+ *
9
+ * Phase 1: Basic invocation and Nushell runtime validation
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.BUILD_PLATFORM_TOOL_INPUT_SCHEMA = exports.BUILD_PLATFORM_TOOL_DESCRIPTION = exports.BUILD_PLATFORM_TOOL_NAME = void 0;
13
+ exports.handleBuildPlatformTool = handleBuildPlatformTool;
14
+ const zod_1 = require("zod");
15
+ const nushell_runtime_1 = require("../core/nushell-runtime");
16
+ const platform_operations_1 = require("../core/platform-operations");
17
+ const crypto_1 = require("crypto");
18
+ // Tool metadata for MCP registration
19
+ exports.BUILD_PLATFORM_TOOL_NAME = 'buildPlatform';
20
+ exports.BUILD_PLATFORM_TOOL_DESCRIPTION = 'AI-powered platform operations tool for building and managing Kubernetes platforms. Use this to: (1) LIST/DISCOVER what tools and operations are available - use stage="list" when user asks "what can I install", "show available tools", "list platform capabilities", (2) INSTALL/CREATE platform components like Argo CD, Crossplane, cert-manager, Kubernetes clusters through natural language intent. Handles tool installation, cluster creation, and platform configuration conversationally.';
21
+ /**
22
+ * Create execution started response (terminal state - no further MCP calls needed)
23
+ */
24
+ function createExecutionResponse(tool, operation) {
25
+ return {
26
+ content: [{
27
+ type: 'text',
28
+ text: JSON.stringify({
29
+ success: true,
30
+ execution: {
31
+ tool,
32
+ operation,
33
+ status: 'started',
34
+ message: `${tool} ${operation} execution started. Monitor progress using kubectl or other cluster tools. No further action required.`
35
+ }
36
+ }, null, 2)
37
+ }]
38
+ };
39
+ }
40
+ // Tool input schema
41
+ exports.BUILD_PLATFORM_TOOL_INPUT_SCHEMA = {
42
+ stage: zod_1.z.string().optional()
43
+ .describe('Workflow stage: "list" (discover all operations) or "submitAnswers" (submit answers and execute). Omit when providing intent for the first time.'),
44
+ intent: zod_1.z.string().optional()
45
+ .describe('Natural language intent describing what platform operation to perform (e.g., "Install Argo CD", "Create AWS cluster"). Used when stage is omitted.'),
46
+ sessionId: zod_1.z.string().optional()
47
+ .describe('Session ID for continuing a multi-step workflow (required for submitAnswers stage)'),
48
+ answers: zod_1.z.record(zod_1.z.any()).optional()
49
+ .describe('Parameter answers for submitAnswers stage (e.g., {"host-name": "example.com", "apply-apps": true})')
50
+ };
51
+ /**
52
+ * Main tool handler - Phase 1 & 2: Script discovery and intent mapping
53
+ */
54
+ async function handleBuildPlatformTool(args, dotAI, logger, requestId) {
55
+ try {
56
+ const { stage, intent, sessionId, answers } = args;
57
+ logger.info('Processing buildPlatform tool request', {
58
+ requestId,
59
+ stage,
60
+ hasIntent: !!intent,
61
+ hasSessionId: !!sessionId,
62
+ hasAnswers: !!answers
63
+ });
64
+ // Validate required parameters - either stage or intent must be provided
65
+ if (!stage && !intent) {
66
+ logger.warn('buildPlatform request missing both stage and intent parameters', { requestId });
67
+ return {
68
+ content: [{
69
+ type: 'text',
70
+ text: JSON.stringify({
71
+ success: false,
72
+ error: {
73
+ message: 'Either stage or intent parameter is required. Use stage: "list" to discover operations, or provide intent like "Install Argo CD"'
74
+ }
75
+ }, null, 2)
76
+ }]
77
+ };
78
+ }
79
+ // Validate Nushell runtime availability
80
+ const runtime = new nushell_runtime_1.NushellRuntime();
81
+ const validation = await runtime.validateRuntime();
82
+ if (!validation.ready) {
83
+ logger.warn('Nushell runtime not available', {
84
+ requestId,
85
+ error: validation.message
86
+ });
87
+ return {
88
+ content: [{
89
+ type: 'text',
90
+ text: JSON.stringify({
91
+ success: false,
92
+ error: {
93
+ message: 'Nushell runtime required for platform operations',
94
+ details: validation.message,
95
+ installationUrl: validation.installationUrl
96
+ }
97
+ }, null, 2)
98
+ }]
99
+ };
100
+ }
101
+ // Phase 2: Handle stage: 'list' - discover all operations
102
+ if (stage === 'list') {
103
+ logger.info('Discovering available operations', { requestId });
104
+ const operations = await (0, platform_operations_1.discoverOperations)(dotAI.ai, logger);
105
+ const result = {
106
+ success: true,
107
+ operations,
108
+ message: `Found ${operations.length} platform tools. Present to user as numbered list showing each tool's available operations (install/delete/create/etc). When user selects (by number or name), convert their selection to natural language intent and call this tool again with the 'intent' parameter (e.g., intent: 'Install Crossplane' or 'Delete ACK').`
109
+ };
110
+ return {
111
+ content: [{
112
+ type: 'text',
113
+ text: JSON.stringify(result, null, 2)
114
+ }]
115
+ };
116
+ }
117
+ // Phase 3: Handle stage: 'submitAnswers' - execute with collected parameters
118
+ if (stage === 'submitAnswers') {
119
+ if (!sessionId) {
120
+ return {
121
+ content: [{
122
+ type: 'text',
123
+ text: JSON.stringify({
124
+ success: false,
125
+ error: {
126
+ message: 'sessionId is required for submitAnswers stage'
127
+ }
128
+ }, null, 2)
129
+ }]
130
+ };
131
+ }
132
+ logger.info('Processing submitAnswers stage', { requestId, sessionId });
133
+ // Load session
134
+ const session = (0, platform_operations_1.loadSession)(sessionId, logger);
135
+ if (!session) {
136
+ return {
137
+ content: [{
138
+ type: 'text',
139
+ text: JSON.stringify({
140
+ success: false,
141
+ error: {
142
+ message: `Session ${sessionId} not found`
143
+ }
144
+ }, null, 2)
145
+ }]
146
+ };
147
+ }
148
+ // Execute operation with answers
149
+ const executionResult = await (0, platform_operations_1.executeOperation)(session, answers || {}, logger);
150
+ if (!executionResult.success) {
151
+ return {
152
+ content: [{
153
+ type: 'text',
154
+ text: JSON.stringify({
155
+ success: false,
156
+ error: {
157
+ message: executionResult.error,
158
+ missingParameters: executionResult.missingParameters
159
+ }
160
+ }, null, 2)
161
+ }]
162
+ };
163
+ }
164
+ return createExecutionResponse(session.matchedOperation.tool, session.matchedOperation.operation);
165
+ }
166
+ // Phase 3: Intent-based workflow with AI mapping and parameter discovery
167
+ const workflowSessionId = sessionId || `platform-${Date.now()}-${(0, crypto_1.randomUUID)()}`;
168
+ logger.info('Nushell runtime validated, starting intent mapping', {
169
+ requestId,
170
+ sessionId: workflowSessionId,
171
+ intent
172
+ });
173
+ // Discover operations for intent mapping
174
+ const operations = await (0, platform_operations_1.discoverOperations)(dotAI.ai, logger);
175
+ // Map intent to operation using AI
176
+ const mapping = await (0, platform_operations_1.mapIntentToOperation)(intent, operations, dotAI.ai, logger);
177
+ // Handle no match case
178
+ if (!mapping.matched) {
179
+ logger.info('No matching operation found for intent', {
180
+ requestId,
181
+ intent,
182
+ reason: mapping.reason
183
+ });
184
+ return {
185
+ content: [{
186
+ type: 'text',
187
+ text: JSON.stringify({
188
+ success: false,
189
+ error: {
190
+ message: mapping.reason || 'No matching operation found for the given intent',
191
+ suggestion: 'Use stage: \'list\' to see all available operations'
192
+ }
193
+ }, null, 2)
194
+ }]
195
+ };
196
+ }
197
+ // Get parameters for the matched operation
198
+ const parameters = await (0, platform_operations_1.getOperationParameters)(mapping.operation.command, logger);
199
+ logger.info('Intent mapped and parameters retrieved', {
200
+ requestId,
201
+ tool: mapping.operation.tool,
202
+ parameterCount: parameters.length
203
+ });
204
+ // Create and persist session
205
+ await (0, platform_operations_1.createSession)(workflowSessionId, intent, mapping.operation, parameters, logger);
206
+ // If no parameters, execute immediately (skip to submitAnswers stage)
207
+ if (parameters.length === 0) {
208
+ logger.info('No parameters required, executing immediately', {
209
+ requestId,
210
+ sessionId: workflowSessionId
211
+ });
212
+ // Reuse submitAnswers stage logic with empty answers
213
+ const session = (0, platform_operations_1.loadSession)(workflowSessionId, logger);
214
+ if (!session) {
215
+ return {
216
+ content: [{
217
+ type: 'text',
218
+ text: JSON.stringify({
219
+ success: false,
220
+ error: {
221
+ message: `Session ${workflowSessionId} not found`
222
+ }
223
+ }, null, 2)
224
+ }]
225
+ };
226
+ }
227
+ const executionResult = await (0, platform_operations_1.executeOperation)(session, {}, logger);
228
+ if (!executionResult.success) {
229
+ return {
230
+ content: [{
231
+ type: 'text',
232
+ text: JSON.stringify({
233
+ success: false,
234
+ error: {
235
+ message: executionResult.error
236
+ }
237
+ }, null, 2)
238
+ }]
239
+ };
240
+ }
241
+ return createExecutionResponse(session.matchedOperation.tool, session.matchedOperation.operation);
242
+ }
243
+ const result = {
244
+ success: true,
245
+ workflow: {
246
+ sessionId: workflowSessionId,
247
+ intent: intent,
248
+ matchedOperation: mapping.operation,
249
+ parameters,
250
+ nextStep: 'collectParameters',
251
+ message: `Found ${parameters.length} parameters for ${mapping.operation.tool} ${mapping.operation.operation}. Collect answers from user (one at a time or all at once - user decides via client agent), then call this tool again with stage: "submitAnswers", sessionId: "${workflowSessionId}", and answers: {param1: value1, ...}`
252
+ }
253
+ };
254
+ return {
255
+ content: [{
256
+ type: 'text',
257
+ text: JSON.stringify(result, null, 2)
258
+ }]
259
+ };
260
+ }
261
+ catch (error) {
262
+ const errorMessage = error instanceof Error ? error.message : String(error);
263
+ logger.error('buildPlatform tool request failed', error, { requestId });
264
+ return {
265
+ content: [{
266
+ type: 'text',
267
+ text: JSON.stringify({
268
+ success: false,
269
+ error: {
270
+ message: 'Tool execution failed',
271
+ details: errorMessage
272
+ }
273
+ }, null, 2)
274
+ }]
275
+ };
276
+ }
277
+ }
@@ -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;AAGxB,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;AAgSF;;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,CAoMxD"}
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 with Claude integration
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
- // Initialize Claude integration
218
- const apiKey = process.env.ANTHROPIC_API_KEY || 'test-key';
219
- const claudeIntegration = new claude_1.ClaudeIntegration(apiKey);
220
- // Send prompt to Claude
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: manifests,
405
+ previousManifests: aiManifests,
407
406
  validationResult: validation
408
407
  };
409
408
  logger.warn('Manifest validation failed', {
@@ -10,4 +10,5 @@ export { GENERATEMANIFESTS_TOOL_NAME, GENERATEMANIFESTS_TOOL_DESCRIPTION, GENERA
10
10
  export { DEPLOYMANIFESTS_TOOL_NAME, DEPLOYMANIFESTS_TOOL_DESCRIPTION, DEPLOYMANIFESTS_TOOL_INPUT_SCHEMA, handleDeployManifestsTool, } from './deploy-manifests';
11
11
  export { ORGANIZATIONAL_DATA_TOOL_NAME, ORGANIZATIONAL_DATA_TOOL_DESCRIPTION, ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA, handleOrganizationalDataTool, } from './organizational-data';
12
12
  export { REMEDIATE_TOOL_NAME, REMEDIATE_TOOL_DESCRIPTION, REMEDIATE_TOOL_INPUT_SCHEMA, handleRemediateTool, } from './remediate';
13
+ export { BUILD_PLATFORM_TOOL_NAME, BUILD_PLATFORM_TOOL_DESCRIPTION, BUILD_PLATFORM_TOOL_INPUT_SCHEMA, handleBuildPlatformTool, } from './build-platform';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,EAClC,mCAAmC,EACnC,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,EACpC,qCAAqC,EACrC,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,EAClC,mCAAmC,EACnC,2BAA2B,GAC5B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EACzB,gCAAgC,EAChC,iCAAiC,EACjC,yBAAyB,GAC1B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,EACpC,qCAAqC,EACrC,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,uBAAuB,GACxB,MAAM,kBAAkB,CAAC"}
@@ -5,7 +5,7 @@
5
5
  * Centralized exports for all available tools (direct handlers)
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.handleRemediateTool = exports.REMEDIATE_TOOL_INPUT_SCHEMA = exports.REMEDIATE_TOOL_DESCRIPTION = exports.REMEDIATE_TOOL_NAME = exports.handleOrganizationalDataTool = exports.ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA = exports.ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = exports.ORGANIZATIONAL_DATA_TOOL_NAME = exports.handleDeployManifestsTool = exports.DEPLOYMANIFESTS_TOOL_INPUT_SCHEMA = exports.DEPLOYMANIFESTS_TOOL_DESCRIPTION = exports.DEPLOYMANIFESTS_TOOL_NAME = exports.handleGenerateManifestsTool = exports.GENERATEMANIFESTS_TOOL_INPUT_SCHEMA = exports.GENERATEMANIFESTS_TOOL_DESCRIPTION = exports.GENERATEMANIFESTS_TOOL_NAME = exports.handleAnswerQuestionTool = exports.ANSWERQUESTION_TOOL_INPUT_SCHEMA = exports.ANSWERQUESTION_TOOL_DESCRIPTION = exports.ANSWERQUESTION_TOOL_NAME = exports.handleChooseSolutionTool = exports.CHOOSESOLUTION_TOOL_INPUT_SCHEMA = exports.CHOOSESOLUTION_TOOL_DESCRIPTION = exports.CHOOSESOLUTION_TOOL_NAME = exports.handleRecommendTool = exports.RECOMMEND_TOOL_INPUT_SCHEMA = exports.RECOMMEND_TOOL_DESCRIPTION = exports.RECOMMEND_TOOL_NAME = void 0;
8
+ exports.handleBuildPlatformTool = exports.BUILD_PLATFORM_TOOL_INPUT_SCHEMA = exports.BUILD_PLATFORM_TOOL_DESCRIPTION = exports.BUILD_PLATFORM_TOOL_NAME = exports.handleRemediateTool = exports.REMEDIATE_TOOL_INPUT_SCHEMA = exports.REMEDIATE_TOOL_DESCRIPTION = exports.REMEDIATE_TOOL_NAME = exports.handleOrganizationalDataTool = exports.ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA = exports.ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = exports.ORGANIZATIONAL_DATA_TOOL_NAME = exports.handleDeployManifestsTool = exports.DEPLOYMANIFESTS_TOOL_INPUT_SCHEMA = exports.DEPLOYMANIFESTS_TOOL_DESCRIPTION = exports.DEPLOYMANIFESTS_TOOL_NAME = exports.handleGenerateManifestsTool = exports.GENERATEMANIFESTS_TOOL_INPUT_SCHEMA = exports.GENERATEMANIFESTS_TOOL_DESCRIPTION = exports.GENERATEMANIFESTS_TOOL_NAME = exports.handleAnswerQuestionTool = exports.ANSWERQUESTION_TOOL_INPUT_SCHEMA = exports.ANSWERQUESTION_TOOL_DESCRIPTION = exports.ANSWERQUESTION_TOOL_NAME = exports.handleChooseSolutionTool = exports.CHOOSESOLUTION_TOOL_INPUT_SCHEMA = exports.CHOOSESOLUTION_TOOL_DESCRIPTION = exports.CHOOSESOLUTION_TOOL_NAME = exports.handleRecommendTool = exports.RECOMMEND_TOOL_INPUT_SCHEMA = exports.RECOMMEND_TOOL_DESCRIPTION = exports.RECOMMEND_TOOL_NAME = void 0;
9
9
  // Export direct tool handlers for use in MCP server and CLI
10
10
  var recommend_1 = require("./recommend");
11
11
  Object.defineProperty(exports, "RECOMMEND_TOOL_NAME", { enumerable: true, get: function () { return recommend_1.RECOMMEND_TOOL_NAME; } });
@@ -42,3 +42,8 @@ Object.defineProperty(exports, "REMEDIATE_TOOL_NAME", { enumerable: true, get: f
42
42
  Object.defineProperty(exports, "REMEDIATE_TOOL_DESCRIPTION", { enumerable: true, get: function () { return remediate_1.REMEDIATE_TOOL_DESCRIPTION; } });
43
43
  Object.defineProperty(exports, "REMEDIATE_TOOL_INPUT_SCHEMA", { enumerable: true, get: function () { return remediate_1.REMEDIATE_TOOL_INPUT_SCHEMA; } });
44
44
  Object.defineProperty(exports, "handleRemediateTool", { enumerable: true, get: function () { return remediate_1.handleRemediateTool; } });
45
+ var build_platform_1 = require("./build-platform");
46
+ Object.defineProperty(exports, "BUILD_PLATFORM_TOOL_NAME", { enumerable: true, get: function () { return build_platform_1.BUILD_PLATFORM_TOOL_NAME; } });
47
+ Object.defineProperty(exports, "BUILD_PLATFORM_TOOL_DESCRIPTION", { enumerable: true, get: function () { return build_platform_1.BUILD_PLATFORM_TOOL_DESCRIPTION; } });
48
+ Object.defineProperty(exports, "BUILD_PLATFORM_TOOL_INPUT_SCHEMA", { enumerable: true, get: function () { return build_platform_1.BUILD_PLATFORM_TOOL_INPUT_SCHEMA; } });
49
+ Object.defineProperty(exports, "handleBuildPlatformTool", { enumerable: true, get: function () { return build_platform_1.handleBuildPlatformTool; } });
@@ -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;AAchD,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"}
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',
@@ -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;AAYhD,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C,eAAO,MAAM,0BAA0B,iRAAiR,CAAC;AAGzT,eAAO,MAAM,2BAA2B;;;;;;;CAUvC,CAAC;AA2EF;;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,CAgSxD"}
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"}