@vfarcic/dot-ai 0.195.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/README.md +2 -7
  2. package/dist/core/capability-scan-workflow.d.ts +4 -3
  3. package/dist/core/capability-scan-workflow.d.ts.map +1 -1
  4. package/dist/core/capability-scan-workflow.js +34 -39
  5. package/dist/core/circuit-breaker.d.ts +1 -0
  6. package/dist/core/circuit-breaker.d.ts.map +1 -1
  7. package/dist/core/circuit-breaker.js +11 -3
  8. package/dist/core/command-executor.d.ts +10 -1
  9. package/dist/core/command-executor.d.ts.map +1 -1
  10. package/dist/core/command-executor.js +63 -48
  11. package/dist/core/crd-availability.d.ts +6 -1
  12. package/dist/core/crd-availability.d.ts.map +1 -1
  13. package/dist/core/crd-availability.js +59 -49
  14. package/dist/core/deploy-operation.d.ts +17 -3
  15. package/dist/core/deploy-operation.d.ts.map +1 -1
  16. package/dist/core/deploy-operation.js +72 -21
  17. package/dist/core/discovery.d.ts +16 -43
  18. package/dist/core/discovery.d.ts.map +1 -1
  19. package/dist/core/discovery.js +128 -277
  20. package/dist/core/index.d.ts +10 -2
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +20 -9
  23. package/dist/core/pattern-operations.d.ts +3 -1
  24. package/dist/core/pattern-operations.d.ts.map +1 -1
  25. package/dist/core/pattern-operations.js +3 -2
  26. package/dist/core/plugin-client.d.ts +53 -0
  27. package/dist/core/plugin-client.d.ts.map +1 -0
  28. package/dist/core/plugin-client.js +148 -0
  29. package/dist/core/plugin-manager.d.ts +119 -0
  30. package/dist/core/plugin-manager.d.ts.map +1 -0
  31. package/dist/core/plugin-manager.js +366 -0
  32. package/dist/core/plugin-types.d.ts +100 -0
  33. package/dist/core/plugin-types.d.ts.map +1 -0
  34. package/dist/core/plugin-types.js +10 -0
  35. package/dist/core/policy-operations.d.ts +15 -7
  36. package/dist/core/policy-operations.d.ts.map +1 -1
  37. package/dist/core/policy-operations.js +59 -31
  38. package/dist/core/resource-tools.d.ts +2 -90
  39. package/dist/core/resource-tools.d.ts.map +1 -1
  40. package/dist/core/resource-tools.js +4 -178
  41. package/dist/core/schema.d.ts +18 -2
  42. package/dist/core/schema.d.ts.map +1 -1
  43. package/dist/core/schema.js +118 -16
  44. package/dist/core/telemetry/client.d.ts +7 -0
  45. package/dist/core/telemetry/client.d.ts.map +1 -1
  46. package/dist/core/telemetry/client.js +51 -51
  47. package/dist/core/telemetry/index.d.ts +1 -1
  48. package/dist/core/telemetry/index.d.ts.map +1 -1
  49. package/dist/core/telemetry/index.js +2 -1
  50. package/dist/core/telemetry/types.d.ts +1 -3
  51. package/dist/core/telemetry/types.d.ts.map +1 -1
  52. package/dist/core/tracing/index.d.ts +0 -1
  53. package/dist/core/tracing/index.d.ts.map +1 -1
  54. package/dist/core/tracing/index.js +1 -4
  55. package/dist/core/unified-creation-session.d.ts +6 -1
  56. package/dist/core/unified-creation-session.d.ts.map +1 -1
  57. package/dist/core/unified-creation-session.js +19 -11
  58. package/dist/interfaces/mcp.d.ts +8 -2
  59. package/dist/interfaces/mcp.d.ts.map +1 -1
  60. package/dist/interfaces/mcp.js +85 -34
  61. package/dist/interfaces/resource-sync-handler.d.ts.map +1 -1
  62. package/dist/interfaces/resource-sync-handler.js +37 -17
  63. package/dist/interfaces/rest-api.d.ts +4 -1
  64. package/dist/interfaces/rest-api.d.ts.map +1 -1
  65. package/dist/interfaces/rest-api.js +172 -49
  66. package/dist/mcp/server.js +39 -54
  67. package/dist/tools/deploy-manifests.d.ts +3 -1
  68. package/dist/tools/deploy-manifests.d.ts.map +1 -1
  69. package/dist/tools/deploy-manifests.js +112 -13
  70. package/dist/tools/generate-manifests.d.ts +3 -1
  71. package/dist/tools/generate-manifests.d.ts.map +1 -1
  72. package/dist/tools/generate-manifests.js +107 -33
  73. package/dist/tools/operate-analysis.d.ts +5 -1
  74. package/dist/tools/operate-analysis.d.ts.map +1 -1
  75. package/dist/tools/operate-analysis.js +37 -7
  76. package/dist/tools/operate-execution.d.ts +3 -1
  77. package/dist/tools/operate-execution.d.ts.map +1 -1
  78. package/dist/tools/operate-execution.js +6 -4
  79. package/dist/tools/operate.d.ts +7 -2
  80. package/dist/tools/operate.d.ts.map +1 -1
  81. package/dist/tools/operate.js +10 -6
  82. package/dist/tools/organizational-data.d.ts +3 -2
  83. package/dist/tools/organizational-data.d.ts.map +1 -1
  84. package/dist/tools/organizational-data.js +15 -13
  85. package/dist/tools/query.d.ts +5 -1
  86. package/dist/tools/query.d.ts.map +1 -1
  87. package/dist/tools/query.js +26 -18
  88. package/dist/tools/recommend.d.ts +3 -1
  89. package/dist/tools/recommend.d.ts.map +1 -1
  90. package/dist/tools/recommend.js +7 -7
  91. package/dist/tools/remediate.d.ts +5 -2
  92. package/dist/tools/remediate.d.ts.map +1 -1
  93. package/dist/tools/remediate.js +69 -20
  94. package/dist/tools/version.d.ts +20 -5
  95. package/dist/tools/version.d.ts.map +1 -1
  96. package/dist/tools/version.js +169 -161
  97. package/package.json +1 -1
  98. package/prompts/helm-generation.md +9 -0
  99. package/dist/core/cluster-utils.d.ts +0 -12
  100. package/dist/core/cluster-utils.d.ts.map +0 -1
  101. package/dist/core/cluster-utils.js +0 -27
  102. package/dist/core/helm-utils.d.ts +0 -66
  103. package/dist/core/helm-utils.d.ts.map +0 -1
  104. package/dist/core/helm-utils.js +0 -196
  105. package/dist/core/kubectl-tools.d.ts +0 -71
  106. package/dist/core/kubectl-tools.d.ts.map +0 -1
  107. package/dist/core/kubectl-tools.js +0 -546
  108. package/dist/core/kubernetes-utils.d.ts +0 -38
  109. package/dist/core/kubernetes-utils.d.ts.map +0 -1
  110. package/dist/core/kubernetes-utils.js +0 -288
  111. package/dist/core/tracing/k8s-tracing.d.ts +0 -57
  112. package/dist/core/tracing/k8s-tracing.d.ts.map +0 -1
  113. package/dist/core/tracing/k8s-tracing.js +0 -155
  114. package/scripts/toolhive.nu +0 -21
package/README.md CHANGED
@@ -42,16 +42,11 @@ DevOps AI Toolkit brings AI-powered intelligence to platform engineering, Kubern
42
42
  - Automated repository setup with governance files
43
43
  - Shared prompt libraries for consistent workflows
44
44
 
45
- ## Deployment Options
45
+ ## Deployment
46
46
 
47
47
  > **For the easiest setup**, we recommend installing the complete dot-ai stack which includes all components pre-configured. See the [Stack Installation Guide](https://devopstoolkit.ai/docs/stack).
48
48
 
49
- For individual component installation:
50
-
51
- - **[Kubernetes Setup](https://devopstoolkit.ai/docs/mcp/setup/kubernetes-setup/)** - Individual component deployment with full features
52
- - **[ToolHive Setup](https://devopstoolkit.ai/docs/mcp/setup/kubernetes-toolhive-setup/)** - Operator-managed Kubernetes deployment
53
- - **[Docker Setup](https://devopstoolkit.ai/docs/mcp/setup/docker-setup/)** - Local development (manual capability scanning only)
54
- - **[NPX Setup](https://devopstoolkit.ai/docs/mcp/setup/npx-setup/)** - Quick trials with Node.js
49
+ For individual component installation, see the **[MCP Setup Guide](https://devopstoolkit.ai/docs/mcp/setup/mcp-setup/)**.
55
50
 
56
51
  [Read the Documentation](https://devopstoolkit.ai/docs/mcp/)
57
52
 
@@ -8,6 +8,7 @@ import { Logger } from './error-handling';
8
8
  import { CapabilityVectorService } from './capability-vector-service';
9
9
  import { KubernetesDiscovery } from './discovery';
10
10
  import { CapabilityInferenceEngine } from './capabilities';
11
+ import type { PluginManager } from './plugin-manager';
11
12
  export type TransitionCapabilitySessionFn = (session: CapabilityScanSession, nextStep: CapabilityScanSession['currentStep'], updates: Partial<CapabilityScanSession>, args: any) => void;
12
13
  export type CleanupCapabilitySessionFn = (session: CapabilityScanSession, args: any, logger: Logger, requestId: string) => void;
13
14
  export type ParseNumericResponseFn = (response: string, validOptions: string[]) => string;
@@ -58,14 +59,14 @@ export declare function scanSingleResource(resourceName: string, discovery: Kube
58
59
  /**
59
60
  * Handle resource selection step
60
61
  */
61
- export declare function handleResourceSelection(session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, handleScanningFn: (session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn) => Promise<any>): Promise<any>;
62
+ export declare function handleResourceSelection(session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, handleScanningFn: (session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, pluginManager?: PluginManager) => Promise<any>, pluginManager?: PluginManager): Promise<any>;
62
63
  /**
63
64
  * Handle resource specification step
64
65
  */
65
- export declare function handleResourceSpecification(session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, handleScanningFn: (session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn) => Promise<any>): Promise<any>;
66
+ export declare function handleResourceSpecification(session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, handleScanningFn: (session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, pluginManager?: PluginManager) => Promise<any>, pluginManager?: PluginManager): Promise<any>;
66
67
  /**
67
68
  * Handle scanning step (actual capability analysis - auto mode only)
68
69
  */
69
- export declare function handleScanning(session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn): Promise<any>;
70
+ export declare function handleScanning(session: CapabilityScanSession, args: any, logger: Logger, requestId: string, capabilityService: CapabilityVectorService, parseNumericResponse: ParseNumericResponseFn, transitionCapabilitySession: TransitionCapabilitySessionFn, cleanupCapabilitySession: CleanupCapabilitySessionFn, createCapabilityScanCompletionResponse: CreateCapabilityScanCompletionResponseFn, pluginManager?: PluginManager): Promise<any>;
70
71
  export {};
71
72
  //# sourceMappingURL=capability-scan-workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capability-scan-workflow.d.ts","sourceRoot":"","sources":["../../src/core/capability-scan-workflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAA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AAE,0BAA0B,EAAE,sCAAsC,EAAE,wCAAwC,EAAE,aAAa,CAAC,EAAE,aAAa,KAAK,OAAO,CAAC,GAAG,CAAC,EAC7a,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,GAAG,CAAC,CA8Cd;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,EAChF,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,GAAG,CAAC,CAiTd"}
@@ -138,7 +138,7 @@ async function scanSingleResource(resourceName, discovery, engine, capabilitySer
138
138
  /**
139
139
  * Handle resource selection step
140
140
  */
141
- async function handleResourceSelection(session, args, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, handleScanningFn) {
141
+ async function handleResourceSelection(session, args, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, handleScanningFn, pluginManager) {
142
142
  if (!args.response) {
143
143
  // Show initial resource selection prompt
144
144
  return {
@@ -185,13 +185,26 @@ async function handleResourceSelection(session, args, logger, requestId, capabil
185
185
  // Process user response
186
186
  const normalizedResponse = parseNumericResponse(args.response, ['all', 'specific']);
187
187
  if (normalizedResponse === 'all') {
188
+ // Guard: Verify plugin is available before starting background scan
189
+ if (!pluginManager) {
190
+ logger.error('Cannot start capability scan: plugin system not available', undefined, { requestId, sessionId: session.sessionId });
191
+ return {
192
+ success: false,
193
+ operation: 'scan',
194
+ dataType: 'capabilities',
195
+ error: {
196
+ message: 'Plugin system not available',
197
+ details: 'Capability scanning requires the agentic-tools plugin for kubectl operations. Ensure the plugin is deployed and configured.'
198
+ }
199
+ };
200
+ }
188
201
  // Transition directly to scanning (auto mode only - manual mode removed)
189
202
  transitionCapabilitySession(session, 'scanning', {
190
203
  selectedResources: 'all',
191
204
  currentResourceIndex: 0 // Start with first resource
192
205
  }, args);
193
206
  // Start scanning in background (don't await) to avoid MCP timeout
194
- handleScanningFn(session, { ...args, response: undefined }, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse)
207
+ handleScanningFn(session, { ...args, response: undefined }, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, pluginManager)
195
208
  .catch(error => {
196
209
  logger.error('Background capability scan failed', error, {
197
210
  requestId,
@@ -275,7 +288,7 @@ async function handleResourceSelection(session, args, logger, requestId, capabil
275
288
  /**
276
289
  * Handle resource specification step
277
290
  */
278
- async function handleResourceSpecification(session, args, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, handleScanningFn) {
291
+ async function handleResourceSpecification(session, args, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, handleScanningFn, pluginManager) {
279
292
  if (!args.resourceList) {
280
293
  return {
281
294
  success: false,
@@ -316,12 +329,12 @@ async function handleResourceSpecification(session, args, logger, requestId, cap
316
329
  currentResourceIndex: 0
317
330
  }, args);
318
331
  // Begin actual capability scanning and return completion summary
319
- return await handleScanningFn(session, { ...args, response: undefined }, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse);
332
+ return await handleScanningFn(session, { ...args, response: undefined }, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, pluginManager);
320
333
  }
321
334
  /**
322
335
  * Handle scanning step (actual capability analysis - auto mode only)
323
336
  */
324
- async function handleScanning(session, args, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse) {
337
+ async function handleScanning(session, args, logger, requestId, capabilityService, parseNumericResponse, transitionCapabilitySession, cleanupCapabilitySession, createCapabilityScanCompletionResponse, pluginManager) {
325
338
  try {
326
339
  // Validate and initialize AI provider
327
340
  let aiProvider;
@@ -356,8 +369,12 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
356
369
  // For 'all' mode, discover actual cluster resources first
357
370
  try {
358
371
  logger.info('Discovering all cluster resources for capability scanning', { requestId, sessionId: session.sessionId });
372
+ // PRD #343: pluginManager required for all kubectl operations
373
+ if (!pluginManager) {
374
+ throw new Error('Plugin system not available. Capability scanning requires agentic-tools plugin.');
375
+ }
359
376
  const discovery = new discovery_1.KubernetesDiscovery();
360
- await discovery.connect();
377
+ discovery.setPluginManager(pluginManager);
361
378
  // Discover all available resources
362
379
  const resourceMap = await discovery.discoverResources();
363
380
  const allResources = [...resourceMap.resources, ...resourceMap.custom];
@@ -483,38 +500,23 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
483
500
  progress: progressData
484
501
  }, args);
485
502
  };
486
- // Setup kubectl access
487
- const discovery = new discovery_1.KubernetesDiscovery();
488
- try {
489
- await discovery.connect();
490
- logger.info('Connected to Kubernetes for capability scanning', {
491
- requestId,
492
- sessionId: session.sessionId
493
- });
494
- }
495
- catch (error) {
496
- return {
497
- success: false,
498
- operation: 'scan',
499
- dataType: 'capabilities',
500
- error: {
501
- message: 'Could not connect to Kubernetes cluster',
502
- details: error instanceof Error ? error.message : String(error),
503
- sessionId: session.sessionId
504
- }
505
- };
503
+ // PRD #343: pluginManager required for all kubectl operations
504
+ if (!pluginManager) {
505
+ throw new Error('Plugin system not available. Capability scanning requires agentic-tools plugin.');
506
506
  }
507
+ // Setup kubectl access via plugin
508
+ const discovery = new discovery_1.KubernetesDiscovery();
509
+ discovery.setPluginManager(pluginManager);
510
+ logger.info('Ready for capability scanning via plugin', {
511
+ requestId,
512
+ sessionId: session.sessionId
513
+ });
507
514
  // Process each resource using scanSingleResource
515
+ // Progress is tracked via updateProgress() and available via the progress endpoint
508
516
  for (let i = 0; i < resources.length; i++) {
509
517
  const currentResource = resources[i];
510
518
  // Update progress before processing
511
519
  updateProgress(i + 1, currentResource, processedResults.length, errors.length, errors);
512
- logger.info(`Processing resource ${i + 1}/${totalResources}`, {
513
- requestId,
514
- sessionId: session.sessionId,
515
- resource: currentResource,
516
- percentage: Math.round(((i + 1) / totalResources) * 100)
517
- });
518
520
  // Call the shared single-resource scan function
519
521
  const result = await scanSingleResource(currentResource, discovery, engine, capabilityService, logger, requestId, args.interaction_id);
520
522
  if (result.success) {
@@ -526,13 +528,6 @@ async function handleScanning(session, args, logger, requestId, capabilityServic
526
528
  complexity: result.complexity,
527
529
  confidence: result.confidence
528
530
  });
529
- logger.info(`Successfully processed resource ${i + 1}/${totalResources}`, {
530
- requestId,
531
- sessionId: session.sessionId,
532
- resource: currentResource,
533
- capabilitiesFound: result.capabilities?.length || 0,
534
- percentage: Math.round(((i + 1) / totalResources) * 100)
535
- });
536
531
  }
537
532
  else {
538
533
  errors.push({
@@ -79,6 +79,7 @@ export declare class CircuitBreaker {
79
79
  private lastSuccessTime?;
80
80
  private openedAt?;
81
81
  private halfOpenAttempts;
82
+ private lastCircuitOpenLogTime?;
82
83
  constructor(name: string, config?: CircuitBreakerConfig, logger?: Logger);
83
84
  /**
84
85
  * Execute an operation through the circuit breaker
@@ -1 +1 @@
1
- {"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../../src/core/circuit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAiB,MAAM,kBAAkB,CAAC;AAEzD;;GAEG;AACH,oBAAY,YAAY;IACtB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,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,EAAE,MAAM,CAAC,EAAE,MAAM;IAKjE;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,oBAAoB,GAAG,cAAc;IAexE;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI7C;;OAEG;IACH,QAAQ,IAAI,IAAI;IAMhB;;OAEG;IACH,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;CAOnD"}
@@ -64,6 +64,7 @@ class CircuitBreaker {
64
64
  lastSuccessTime;
65
65
  openedAt;
66
66
  halfOpenAttempts = 0;
67
+ lastCircuitOpenLogTime;
67
68
  constructor(name, config, logger) {
68
69
  this.name = name;
69
70
  this.config = {
@@ -83,9 +84,15 @@ class CircuitBreaker {
83
84
  // Check if we should allow the request
84
85
  if (!this.canExecute()) {
85
86
  const remainingCooldown = this.getRemainingCooldown();
86
- this.logger.warn(`Circuit '${this.name}' is open, blocking request`, {
87
- remainingCooldownMs: remainingCooldown
88
- });
87
+ // Only log once per circuit open period to avoid log spam
88
+ if (!this.lastCircuitOpenLogTime ||
89
+ this.lastCircuitOpenLogTime < this.openedAt) {
90
+ this.logger.warn(`Circuit '${this.name}' is open, blocking requests`, {
91
+ remainingCooldownMs: remainingCooldown,
92
+ willRetryAt: new Date(Date.now() + remainingCooldown).toISOString()
93
+ });
94
+ this.lastCircuitOpenLogTime = new Date();
95
+ }
89
96
  throw new CircuitOpenError(this.name, remainingCooldown);
90
97
  }
91
98
  // Track half-open attempts
@@ -157,6 +164,7 @@ class CircuitBreaker {
157
164
  this.consecutiveFailures = 0;
158
165
  this.halfOpenAttempts = 0;
159
166
  this.openedAt = undefined;
167
+ this.lastCircuitOpenLogTime = undefined;
160
168
  if (previousState !== CircuitState.CLOSED) {
161
169
  this.logger.info(`Circuit '${this.name}' manually reset to closed`);
162
170
  this.config.onStateChange?.(previousState, CircuitState.CLOSED, this.name);
@@ -4,8 +4,12 @@
4
4
  * Provides common command execution logic for tools (remediate, operate, etc.)
5
5
  * Uses continue-on-error pattern: executes all commands sequentially regardless
6
6
  * of individual failures.
7
+ *
8
+ * PRD #343: Commands are executed through the plugin system via shell_exec tool.
9
+ * The plugin container has RBAC permissions; the MCP server does not.
7
10
  */
8
11
  import { Logger } from './error-handling';
12
+ import { PluginManager } from './plugin-manager';
9
13
  /**
10
14
  * Execution result for a single command
11
15
  */
@@ -27,12 +31,17 @@ export interface CommandExecutionOptions {
27
31
  /**
28
32
  * Execute a list of commands sequentially with continue-on-error pattern
29
33
  *
34
+ * PRD #343: Commands are executed through the plugin's shell_exec tool.
35
+ * The plugin container has RBAC; commands are executed exactly as provided
36
+ * (no parsing or transformation).
37
+ *
30
38
  * @param commands - Array of command strings to execute
31
39
  * @param logger - Logger instance for tracking execution
40
+ * @param pluginManager - Plugin manager for executing commands via plugin
32
41
  * @param options - Optional execution context and metadata
33
42
  * @returns Array of execution results and overall success status
34
43
  */
35
- export declare function executeCommands(commands: string[], logger: Logger, options?: CommandExecutionOptions): Promise<{
44
+ export declare function executeCommands(commands: string[], logger: Logger, pluginManager: PluginManager, options?: CommandExecutionOptions): Promise<{
36
45
  results: CommandExecutionResult[];
37
46
  overallSuccess: boolean;
38
47
  }>;
@@ -1 +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"}
1
+ {"version":3,"file":"command-executor.d.ts","sourceRoot":"","sources":["../../src/core/command-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;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;;;;;;;;;;;;GAYG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC;IAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,CAAC,CAgHzE"}
@@ -5,51 +5,26 @@
5
5
  * Provides common command execution logic for tools (remediate, operate, etc.)
6
6
  * Uses continue-on-error pattern: executes all commands sequentially regardless
7
7
  * of individual failures.
8
+ *
9
+ * PRD #343: Commands are executed through the plugin system via shell_exec tool.
10
+ * The plugin container has RBAC permissions; the MCP server does not.
8
11
  */
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
12
  Object.defineProperty(exports, "__esModule", { value: true });
43
13
  exports.executeCommands = executeCommands;
44
14
  /**
45
15
  * Execute a list of commands sequentially with continue-on-error pattern
46
16
  *
17
+ * PRD #343: Commands are executed through the plugin's shell_exec tool.
18
+ * The plugin container has RBAC; commands are executed exactly as provided
19
+ * (no parsing or transformation).
20
+ *
47
21
  * @param commands - Array of command strings to execute
48
22
  * @param logger - Logger instance for tracking execution
23
+ * @param pluginManager - Plugin manager for executing commands via plugin
49
24
  * @param options - Optional execution context and metadata
50
25
  * @returns Array of execution results and overall success status
51
26
  */
52
- async function executeCommands(commands, logger, options = {}) {
27
+ async function executeCommands(commands, logger, pluginManager, options = {}) {
53
28
  const results = [];
54
29
  let overallSuccess = true;
55
30
  const { sessionId, context = 'command execution', logMetadata = {} } = options;
@@ -63,26 +38,66 @@ async function executeCommands(commands, logger, options = {}) {
63
38
  const command = commands[i];
64
39
  const commandNum = i + 1;
65
40
  try {
66
- logger.info(`Executing command ${commandNum}/${commands.length}`, {
41
+ logger.debug(`Executing command ${commandNum}/${commands.length}`, {
67
42
  ...logMetadata,
68
43
  sessionId,
69
44
  command
70
45
  });
71
46
  // Clean up escape sequences that AI models sometimes add
72
47
  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
- });
48
+ // PRD #343: Execute command via plugin's shell_exec tool
49
+ const response = await pluginManager.invokeTool('shell_exec', { command: cleanCommand });
50
+ if (response.success) {
51
+ // Check for nested error - plugin wraps command errors in { success: false, error: "..." }
52
+ if (typeof response.result === 'object' && response.result !== null) {
53
+ const result = response.result;
54
+ if (result.success === false) {
55
+ throw new Error(result.error || result.message || 'Command execution failed');
56
+ }
57
+ }
58
+ // Extract only the data field - never pass JSON wrapper
59
+ let output;
60
+ if (typeof response.result === 'object' && response.result !== null) {
61
+ const result = response.result;
62
+ if (result.data !== undefined) {
63
+ output = String(result.data);
64
+ }
65
+ else if (typeof result === 'string') {
66
+ output = result;
67
+ }
68
+ else {
69
+ throw new Error('Plugin returned unexpected response format - missing data field');
70
+ }
71
+ }
72
+ else {
73
+ output = String(response.result || '');
74
+ }
75
+ results.push({
76
+ command,
77
+ success: true,
78
+ output: output,
79
+ timestamp: new Date()
80
+ });
81
+ logger.debug(`Command ${commandNum} succeeded`, {
82
+ ...logMetadata,
83
+ sessionId
84
+ });
85
+ }
86
+ else {
87
+ const errorMessage = response.error?.message || 'Command execution failed';
88
+ overallSuccess = false;
89
+ results.push({
90
+ command,
91
+ success: false,
92
+ error: errorMessage,
93
+ timestamp: new Date()
94
+ });
95
+ logger.error(`Command ${commandNum} failed`, new Error(errorMessage), {
96
+ ...logMetadata,
97
+ sessionId,
98
+ command
99
+ });
100
+ }
86
101
  }
87
102
  catch (error) {
88
103
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
@@ -3,12 +3,17 @@
3
3
  *
4
4
  * Checks once per MCP server lifecycle if Solution CRD is available,
5
5
  * then caches the result globally to avoid repeated cluster queries.
6
+ *
7
+ * PRD #343: Uses plugin system for K8s operations (MCP server has no RBAC)
6
8
  */
9
+ import type { PluginManager } from './plugin-manager';
7
10
  /**
8
11
  * Helper function for checking CRD availability
9
12
  * Use this function throughout the codebase
13
+ *
14
+ * @param pluginManager - Optional plugin manager. If provided on first call, will be cached.
10
15
  */
11
- export declare function isSolutionCRDAvailable(): Promise<boolean>;
16
+ export declare function isSolutionCRDAvailable(pluginManager?: PluginManager): Promise<boolean>;
12
17
  /**
13
18
  * Reset CRD availability cache (primarily for testing)
14
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"crd-availability.d.ts","sourceRoot":"","sources":["../../src/core/crd-availability.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4DH;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG/D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
1
+ {"version":3,"file":"crd-availability.d.ts","sourceRoot":"","sources":["../../src/core/crd-availability.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAgGtD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,aAAa,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAM5F;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAGhD"}
@@ -4,44 +4,12 @@
4
4
  *
5
5
  * Checks once per MCP server lifecycle if Solution CRD is available,
6
6
  * then caches the result globally to avoid repeated cluster queries.
7
+ *
8
+ * PRD #343: Uses plugin system for K8s operations (MCP server has no RBAC)
7
9
  */
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
10
  Object.defineProperty(exports, "__esModule", { value: true });
42
11
  exports.isSolutionCRDAvailable = isSolutionCRDAvailable;
43
12
  exports.resetCRDAvailabilityCache = resetCRDAvailabilityCache;
44
- const k8s = __importStar(require("@kubernetes/client-node"));
45
13
  /**
46
14
  * Singleton cache for CRD availability check
47
15
  * Checks once per MCP server lifecycle, caches result globally
@@ -49,6 +17,7 @@ const k8s = __importStar(require("@kubernetes/client-node"));
49
17
  class CRDAvailabilityCache {
50
18
  static instance;
51
19
  crdAvailable = null;
20
+ pluginManager = null;
52
21
  constructor() { }
53
22
  static getInstance() {
54
23
  if (!CRDAvailabilityCache.instance) {
@@ -56,32 +25,68 @@ class CRDAvailabilityCache {
56
25
  }
57
26
  return CRDAvailabilityCache.instance;
58
27
  }
28
+ /**
29
+ * Set plugin manager for K8s operations
30
+ */
31
+ setPluginManager(pluginManager) {
32
+ this.pluginManager = pluginManager;
33
+ }
59
34
  async isSolutionCRDAvailable() {
60
35
  // Return cached result if available
61
36
  if (this.crdAvailable !== null) {
62
37
  return this.crdAvailable;
63
38
  }
64
- // Check cluster for Solution CRD
39
+ // PRD #343: All K8s operations go through plugin
40
+ if (!this.pluginManager) {
41
+ console.log('ℹ️ Plugin system not available - Solution CR generation disabled');
42
+ this.crdAvailable = false;
43
+ return false;
44
+ }
45
+ // Check cluster for Solution CRD via plugin
46
+ const crdName = 'solutions.dot-ai.devopstoolkit.live';
65
47
  try {
66
- const kc = new k8s.KubeConfig();
67
- kc.loadFromDefault();
68
- const k8sApi = kc.makeApiClient(k8s.ApiextensionsV1Api);
69
- const crdName = 'solutions.dot-ai.devopstoolkit.live';
70
- await k8sApi.readCustomResourceDefinition({ name: crdName });
71
- // CRD exists, cache result
72
- this.crdAvailable = true;
73
- console.log('✅ Solution CRD available - Solution CR generation enabled');
74
- return true;
48
+ const response = await this.pluginManager.invokeTool('kubectl_get_resource_json', {
49
+ resource: `crd/${crdName}`
50
+ });
51
+ if (response.success) {
52
+ // Check for nested error - plugin wraps kubectl errors in { success: false, error: "..." }
53
+ const result = response.result;
54
+ if (result && result.success === false) {
55
+ const errorMsg = result.error || '';
56
+ if (errorMsg.includes('NotFound') || errorMsg.includes('not found')) {
57
+ this.crdAvailable = false;
58
+ console.log('ℹ️ Solution CRD not available - Solution CR generation disabled (graceful degradation)');
59
+ return false;
60
+ }
61
+ throw new Error(`Failed to check Solution CRD availability: ${errorMsg}`);
62
+ }
63
+ // CRD exists, cache result
64
+ this.crdAvailable = true;
65
+ console.log('✅ Solution CRD available - Solution CR generation enabled');
66
+ return true;
67
+ }
68
+ else {
69
+ // CRD not found or error
70
+ const errorMsg = response.error?.message || '';
71
+ if (errorMsg.includes('NotFound') || errorMsg.includes('not found')) {
72
+ this.crdAvailable = false;
73
+ console.log('ℹ️ Solution CRD not available - Solution CR generation disabled (graceful degradation)');
74
+ return false;
75
+ }
76
+ // Other errors - don't cache, throw
77
+ throw new Error(`Failed to check Solution CRD availability: ${errorMsg}`);
78
+ }
75
79
  }
76
80
  catch (error) {
77
- if (error.statusCode === 404 || error.response?.statusCode === 404) {
78
- // CRD not found, cache result
81
+ // Check if it's a "not found" error
82
+ const errorMsg = error.message || String(error);
83
+ if (errorMsg.includes('NotFound') || errorMsg.includes('not found')) {
79
84
  this.crdAvailable = false;
80
85
  console.log('ℹ️ Solution CRD not available - Solution CR generation disabled (graceful degradation)');
81
86
  return false;
82
87
  }
83
- // Other errors (cluster unreachable, etc.) - don't cache, throw
84
- throw new Error(`Failed to check Solution CRD availability: ${error.message || error}`);
88
+ // Other errors - don't cache, throw
89
+ throw new Error(`Failed to check Solution CRD availability: ${errorMsg}`);
85
90
  }
86
91
  }
87
92
  /**
@@ -94,9 +99,14 @@ class CRDAvailabilityCache {
94
99
  /**
95
100
  * Helper function for checking CRD availability
96
101
  * Use this function throughout the codebase
102
+ *
103
+ * @param pluginManager - Optional plugin manager. If provided on first call, will be cached.
97
104
  */
98
- async function isSolutionCRDAvailable() {
105
+ async function isSolutionCRDAvailable(pluginManager) {
99
106
  const cache = CRDAvailabilityCache.getInstance();
107
+ if (pluginManager) {
108
+ cache.setPluginManager(pluginManager);
109
+ }
100
110
  return cache.isSolutionCRDAvailable();
101
111
  }
102
112
  /**