@vfarcic/dot-ai 0.195.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -7
- package/dist/core/capability-scan-workflow.d.ts +4 -3
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +34 -39
- package/dist/core/circuit-breaker.d.ts +1 -0
- package/dist/core/circuit-breaker.d.ts.map +1 -1
- package/dist/core/circuit-breaker.js +11 -3
- package/dist/core/command-executor.d.ts +10 -1
- package/dist/core/command-executor.d.ts.map +1 -1
- package/dist/core/command-executor.js +63 -48
- package/dist/core/crd-availability.d.ts +6 -1
- package/dist/core/crd-availability.d.ts.map +1 -1
- package/dist/core/crd-availability.js +59 -49
- package/dist/core/deploy-operation.d.ts +17 -3
- package/dist/core/deploy-operation.d.ts.map +1 -1
- package/dist/core/deploy-operation.js +72 -21
- package/dist/core/discovery.d.ts +16 -43
- package/dist/core/discovery.d.ts.map +1 -1
- package/dist/core/discovery.js +128 -277
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +20 -9
- package/dist/core/pattern-operations.d.ts +3 -1
- package/dist/core/pattern-operations.d.ts.map +1 -1
- package/dist/core/pattern-operations.js +3 -2
- package/dist/core/plugin-client.d.ts +53 -0
- package/dist/core/plugin-client.d.ts.map +1 -0
- package/dist/core/plugin-client.js +148 -0
- package/dist/core/plugin-manager.d.ts +119 -0
- package/dist/core/plugin-manager.d.ts.map +1 -0
- package/dist/core/plugin-manager.js +366 -0
- package/dist/core/plugin-types.d.ts +100 -0
- package/dist/core/plugin-types.d.ts.map +1 -0
- package/dist/core/plugin-types.js +10 -0
- package/dist/core/policy-operations.d.ts +15 -7
- package/dist/core/policy-operations.d.ts.map +1 -1
- package/dist/core/policy-operations.js +59 -31
- package/dist/core/resource-tools.d.ts +2 -90
- package/dist/core/resource-tools.d.ts.map +1 -1
- package/dist/core/resource-tools.js +4 -178
- package/dist/core/schema.d.ts +18 -2
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +118 -16
- package/dist/core/telemetry/client.d.ts +7 -0
- package/dist/core/telemetry/client.d.ts.map +1 -1
- package/dist/core/telemetry/client.js +51 -51
- package/dist/core/telemetry/index.d.ts +1 -1
- package/dist/core/telemetry/index.d.ts.map +1 -1
- package/dist/core/telemetry/index.js +2 -1
- package/dist/core/telemetry/types.d.ts +1 -3
- package/dist/core/telemetry/types.d.ts.map +1 -1
- package/dist/core/tracing/index.d.ts +0 -1
- package/dist/core/tracing/index.d.ts.map +1 -1
- package/dist/core/tracing/index.js +1 -4
- package/dist/core/unified-creation-session.d.ts +6 -1
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +19 -11
- package/dist/interfaces/mcp.d.ts +8 -2
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +85 -34
- package/dist/interfaces/resource-sync-handler.d.ts.map +1 -1
- package/dist/interfaces/resource-sync-handler.js +37 -17
- package/dist/interfaces/rest-api.d.ts +4 -1
- package/dist/interfaces/rest-api.d.ts.map +1 -1
- package/dist/interfaces/rest-api.js +172 -49
- package/dist/mcp/server.js +39 -54
- package/dist/tools/deploy-manifests.d.ts +3 -1
- package/dist/tools/deploy-manifests.d.ts.map +1 -1
- package/dist/tools/deploy-manifests.js +112 -13
- package/dist/tools/generate-manifests.d.ts +3 -1
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +107 -33
- package/dist/tools/operate-analysis.d.ts +5 -1
- package/dist/tools/operate-analysis.d.ts.map +1 -1
- package/dist/tools/operate-analysis.js +37 -7
- package/dist/tools/operate-execution.d.ts +3 -1
- package/dist/tools/operate-execution.d.ts.map +1 -1
- package/dist/tools/operate-execution.js +6 -4
- package/dist/tools/operate.d.ts +7 -2
- package/dist/tools/operate.d.ts.map +1 -1
- package/dist/tools/operate.js +10 -6
- package/dist/tools/organizational-data.d.ts +3 -2
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +15 -13
- package/dist/tools/query.d.ts +5 -1
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +26 -18
- package/dist/tools/recommend.d.ts +3 -1
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +7 -7
- package/dist/tools/remediate.d.ts +5 -2
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +69 -20
- package/dist/tools/version.d.ts +20 -5
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +169 -161
- package/package.json +1 -1
- package/prompts/helm-generation.md +9 -0
- package/dist/core/cluster-utils.d.ts +0 -12
- package/dist/core/cluster-utils.d.ts.map +0 -1
- package/dist/core/cluster-utils.js +0 -27
- package/dist/core/helm-utils.d.ts +0 -66
- package/dist/core/helm-utils.d.ts.map +0 -1
- package/dist/core/helm-utils.js +0 -196
- package/dist/core/kubectl-tools.d.ts +0 -71
- package/dist/core/kubectl-tools.d.ts.map +0 -1
- package/dist/core/kubectl-tools.js +0 -546
- package/dist/core/kubernetes-utils.d.ts +0 -38
- package/dist/core/kubernetes-utils.d.ts.map +0 -1
- package/dist/core/kubernetes-utils.js +0 -288
- package/dist/core/tracing/k8s-tracing.d.ts +0 -57
- package/dist/core/tracing/k8s-tracing.d.ts.map +0 -1
- package/dist/core/tracing/k8s-tracing.js +0 -155
- package/scripts/toolhive.nu +0 -21
package/dist/core/schema.js
CHANGED
|
@@ -40,7 +40,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.ResourceRecommender = exports.ManifestValidator = exports.SchemaParser = exports.OUTPUT_PATH_QUESTION = exports.OUTPUT_FORMAT_QUESTION = void 0;
|
|
43
|
-
const kubernetes_utils_1 = require("./kubernetes-utils");
|
|
44
43
|
const pattern_vector_service_1 = require("./pattern-vector-service");
|
|
45
44
|
const vector_db_service_1 = require("./vector-db-service");
|
|
46
45
|
const capability_vector_service_1 = require("./capability-vector-service");
|
|
@@ -48,7 +47,21 @@ const policy_vector_service_1 = require("./policy-vector-service");
|
|
|
48
47
|
const shared_prompt_loader_1 = require("./shared-prompt-loader");
|
|
49
48
|
const platform_utils_1 = require("./platform-utils");
|
|
50
49
|
const constants_1 = require("./constants");
|
|
51
|
-
|
|
50
|
+
// PRD #343: Inline sanitization (helm-utils.ts removed)
|
|
51
|
+
function sanitizeShellArg(arg, fieldName = 'argument') {
|
|
52
|
+
if (!/^[a-zA-Z0-9\-_./:\\@]+$/.test(arg)) {
|
|
53
|
+
throw new Error(`Invalid characters in ${fieldName}: "${arg}". Only alphanumeric characters, dashes, underscores, dots, forward slashes, colons, and @ are allowed.`);
|
|
54
|
+
}
|
|
55
|
+
return arg;
|
|
56
|
+
}
|
|
57
|
+
function sanitizeChartInfo(chart) {
|
|
58
|
+
return {
|
|
59
|
+
repositoryName: sanitizeShellArg(chart.repositoryName, 'repository name'),
|
|
60
|
+
repository: sanitizeShellArg(chart.repository, 'repository URL'),
|
|
61
|
+
chartName: sanitizeShellArg(chart.chartName, 'chart name'),
|
|
62
|
+
version: chart.version ? sanitizeShellArg(chart.version, 'version') : undefined
|
|
63
|
+
};
|
|
64
|
+
}
|
|
52
65
|
/**
|
|
53
66
|
* Packaging questions for capability-based solutions (not Helm charts)
|
|
54
67
|
* These are injected programmatically after AI generates questions
|
|
@@ -236,25 +249,80 @@ class SchemaParser {
|
|
|
236
249
|
exports.SchemaParser = SchemaParser;
|
|
237
250
|
/**
|
|
238
251
|
* ManifestValidator validates Kubernetes manifests using kubectl dry-run
|
|
252
|
+
* PRD #343: Supports plugin system for kubectl operations
|
|
239
253
|
*/
|
|
240
254
|
class ManifestValidator {
|
|
255
|
+
pluginManager;
|
|
256
|
+
constructor(pluginManager) {
|
|
257
|
+
this.pluginManager = pluginManager;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Execute kubectl via plugin system
|
|
261
|
+
* PRD #343: ALL Kubernetes operations go through plugin
|
|
262
|
+
*/
|
|
263
|
+
async executeKubectlViaPlugin(args) {
|
|
264
|
+
if (!this.pluginManager) {
|
|
265
|
+
throw new Error('Plugin system not available. ManifestValidator requires agentic-tools plugin for kubectl operations.');
|
|
266
|
+
}
|
|
267
|
+
const response = await this.pluginManager.invokeTool('kubectl_exec_command', { args });
|
|
268
|
+
if (response.success) {
|
|
269
|
+
if (typeof response.result === 'object' && response.result !== null) {
|
|
270
|
+
const result = response.result;
|
|
271
|
+
// Check for nested error - plugin wraps kubectl errors in { success: false, error: "..." }
|
|
272
|
+
if (result.success === false) {
|
|
273
|
+
throw new Error(result.error || result.message || 'kubectl command failed');
|
|
274
|
+
}
|
|
275
|
+
// Return only the data field - never pass JSON wrapper to consumers
|
|
276
|
+
if (result.data !== undefined) {
|
|
277
|
+
return String(result.data);
|
|
278
|
+
}
|
|
279
|
+
if (typeof result === 'string') {
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
throw new Error('Plugin returned unexpected response format - missing data field');
|
|
283
|
+
}
|
|
284
|
+
return String(response.result || '');
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
throw new Error(response.error?.message || 'kubectl command failed via plugin');
|
|
288
|
+
}
|
|
289
|
+
}
|
|
241
290
|
/**
|
|
242
291
|
* Validate a manifest using kubectl dry-run
|
|
243
292
|
* This uses the actual Kubernetes API server validation for accuracy
|
|
293
|
+
* PRD #343: Routes through plugin system when pluginManager is available
|
|
244
294
|
*/
|
|
245
295
|
async validateManifest(manifestPath, config) {
|
|
246
296
|
const errors = [];
|
|
247
297
|
const warnings = [];
|
|
248
298
|
try {
|
|
249
299
|
const dryRunMode = config?.dryRunMode || 'server';
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
// If we get here, validation passed
|
|
253
|
-
// kubectl dry-run will throw an error if validation fails
|
|
254
|
-
// Add best practice warnings by reading the manifest
|
|
300
|
+
// PRD #343: Read manifest content and use kubectl_apply_dryrun tool
|
|
301
|
+
// File paths don't work across containers, so we pass content via plugin tool
|
|
255
302
|
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
256
303
|
const yaml = await Promise.resolve().then(() => __importStar(require('yaml')));
|
|
257
|
-
const
|
|
304
|
+
const manifestContent = fs.readFileSync(manifestPath, 'utf8');
|
|
305
|
+
if (!this.pluginManager) {
|
|
306
|
+
throw new Error('Plugin system not available. ManifestValidator requires agentic-tools plugin for kubectl operations.');
|
|
307
|
+
}
|
|
308
|
+
// Use kubectl_apply_dryrun tool which accepts manifest content
|
|
309
|
+
const response = await this.pluginManager.invokeTool('kubectl_apply_dryrun', {
|
|
310
|
+
manifest: manifestContent,
|
|
311
|
+
dryRunMode: dryRunMode
|
|
312
|
+
});
|
|
313
|
+
if (!response.success) {
|
|
314
|
+
throw new Error(response.error?.message || 'kubectl dry-run validation failed');
|
|
315
|
+
}
|
|
316
|
+
// Check for nested error
|
|
317
|
+
if (typeof response.result === 'object' && response.result !== null) {
|
|
318
|
+
const result = response.result;
|
|
319
|
+
if (result.success === false) {
|
|
320
|
+
throw new Error(result.error || result.message || 'kubectl dry-run validation failed');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// If we get here, validation passed
|
|
324
|
+
// Add best practice warnings by parsing the manifest
|
|
325
|
+
const documents = yaml.parseAllDocuments(manifestContent);
|
|
258
326
|
// Process all documents for best practice warnings
|
|
259
327
|
documents.forEach(doc => {
|
|
260
328
|
if (doc.contents) {
|
|
@@ -312,7 +380,10 @@ class ResourceRecommender {
|
|
|
312
380
|
patternService;
|
|
313
381
|
capabilityService;
|
|
314
382
|
policyService;
|
|
315
|
-
|
|
383
|
+
// PRD #343: Plugin manager for K8s operations
|
|
384
|
+
pluginManager;
|
|
385
|
+
constructor(aiProvider, pluginManager) {
|
|
386
|
+
this.pluginManager = pluginManager;
|
|
316
387
|
// Use provided AI provider or create from environment
|
|
317
388
|
this.aiProvider = aiProvider || (() => {
|
|
318
389
|
// Lazy import to avoid circular dependencies
|
|
@@ -352,6 +423,37 @@ class ResourceRecommender {
|
|
|
352
423
|
this.policyService = undefined;
|
|
353
424
|
}
|
|
354
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* Execute kubectl via plugin system
|
|
428
|
+
* PRD #343: ALL Kubernetes operations go through plugin
|
|
429
|
+
*/
|
|
430
|
+
async executeKubectlViaPlugin(args) {
|
|
431
|
+
if (!this.pluginManager) {
|
|
432
|
+
throw new Error('Plugin system not available. ResourceRecommender requires agentic-tools plugin for kubectl operations.');
|
|
433
|
+
}
|
|
434
|
+
const response = await this.pluginManager.invokeTool('kubectl_exec_command', { args });
|
|
435
|
+
if (response.success) {
|
|
436
|
+
if (typeof response.result === 'object' && response.result !== null) {
|
|
437
|
+
const result = response.result;
|
|
438
|
+
// Check for nested error - plugin wraps kubectl errors in { success: false, error: "..." }
|
|
439
|
+
if (result.success === false) {
|
|
440
|
+
throw new Error(result.error || result.message || 'kubectl command failed');
|
|
441
|
+
}
|
|
442
|
+
// Return only the data field - never pass JSON wrapper to consumers
|
|
443
|
+
if (result.data !== undefined) {
|
|
444
|
+
return String(result.data);
|
|
445
|
+
}
|
|
446
|
+
if (typeof result === 'string') {
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
throw new Error('Plugin returned unexpected response format - missing data field');
|
|
450
|
+
}
|
|
451
|
+
return String(response.result || '');
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
throw new Error(response.error?.message || 'kubectl command failed via plugin');
|
|
455
|
+
}
|
|
456
|
+
}
|
|
355
457
|
/**
|
|
356
458
|
* Find the best resource solution(s) for user intent using two-phase analysis
|
|
357
459
|
*/
|
|
@@ -675,17 +777,17 @@ class ResourceRecommender {
|
|
|
675
777
|
}
|
|
676
778
|
/**
|
|
677
779
|
* Discover cluster options for dynamic question generation
|
|
780
|
+
* PRD #343: ALL kubectl operations go through plugin
|
|
678
781
|
*/
|
|
679
782
|
async discoverClusterOptions() {
|
|
680
783
|
try {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
const namespacesResult = await executeKubectl(['get', 'namespaces', '-o', 'jsonpath={.items[*].metadata.name}']);
|
|
784
|
+
// Discover namespaces via plugin
|
|
785
|
+
const namespacesResult = await this.executeKubectlViaPlugin(['get', 'namespaces', '-o', 'jsonpath={.items[*].metadata.name}']);
|
|
684
786
|
const namespaces = namespacesResult.split(/\s+/).filter(Boolean);
|
|
685
787
|
// Discover storage classes with default marking
|
|
686
788
|
let storageClasses = [];
|
|
687
789
|
try {
|
|
688
|
-
const storageResult = await
|
|
790
|
+
const storageResult = await this.executeKubectlViaPlugin(['get', 'storageclass', '-o', 'json']);
|
|
689
791
|
const storageData = JSON.parse(storageResult);
|
|
690
792
|
storageClasses = (storageData.items || []).map((item) => ({
|
|
691
793
|
name: item.metadata?.name || '',
|
|
@@ -699,7 +801,7 @@ class ResourceRecommender {
|
|
|
699
801
|
// Discover ingress classes with default marking
|
|
700
802
|
let ingressClasses = [];
|
|
701
803
|
try {
|
|
702
|
-
const ingressResult = await
|
|
804
|
+
const ingressResult = await this.executeKubectlViaPlugin(['get', 'ingressclass', '-o', 'json']);
|
|
703
805
|
const ingressData = JSON.parse(ingressResult);
|
|
704
806
|
ingressClasses = (ingressData.items || []).map((item) => ({
|
|
705
807
|
name: item.metadata?.name || '',
|
|
@@ -713,7 +815,7 @@ class ResourceRecommender {
|
|
|
713
815
|
// Get common node labels
|
|
714
816
|
let nodeLabels = [];
|
|
715
817
|
try {
|
|
716
|
-
const nodesResult = await
|
|
818
|
+
const nodesResult = await this.executeKubectlViaPlugin(['get', 'nodes', '-o', 'json']);
|
|
717
819
|
const nodes = JSON.parse(nodesResult);
|
|
718
820
|
const labelSet = new Set();
|
|
719
821
|
nodes.items?.forEach((node) => {
|
|
@@ -994,7 +1096,7 @@ ${readme || 'No README available'}`;
|
|
|
994
1096
|
let valuesYaml = '';
|
|
995
1097
|
let readme = '';
|
|
996
1098
|
// Sanitize chart info to prevent command injection
|
|
997
|
-
const safeChart =
|
|
1099
|
+
const safeChart = sanitizeChartInfo(chart);
|
|
998
1100
|
const versionFlag = safeChart.version ? `--version ${safeChart.version}` : '';
|
|
999
1101
|
try {
|
|
1000
1102
|
// Add repo and update
|
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides anonymous usage telemetry using PostHog.
|
|
5
5
|
* Follows a singleton pattern with lazy initialization.
|
|
6
|
+
* PRD #343: Uses plugin system for K8s operations instead of direct @kubernetes/client-node.
|
|
6
7
|
*/
|
|
7
8
|
import { TelemetryService } from './types';
|
|
9
|
+
import type { PluginManager } from '../plugin-manager';
|
|
10
|
+
/**
|
|
11
|
+
* Set plugin manager for telemetry K8s operations
|
|
12
|
+
* Must be called before first getTelemetry() use for cluster ID generation
|
|
13
|
+
*/
|
|
14
|
+
export declare function setTelemetryPluginManager(pluginManager: PluginManager): void;
|
|
8
15
|
/**
|
|
9
16
|
* Get or create the global telemetry instance
|
|
10
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/telemetry/client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/core/telemetry/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAEL,gBAAgB,EAUjB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAYvD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAE5E;AA4QD;;GAEG;AACH,wBAAgB,YAAY,IAAI,gBAAgB,CAM/C;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAKvD"}
|
|
@@ -4,75 +4,76 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Provides anonymous usage telemetry using PostHog.
|
|
6
6
|
* Follows a singleton pattern with lazy initialization.
|
|
7
|
+
* PRD #343: Uses plugin system for K8s operations instead of direct @kubernetes/client-node.
|
|
7
8
|
*/
|
|
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
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.setTelemetryPluginManager = setTelemetryPluginManager;
|
|
42
11
|
exports.getTelemetry = getTelemetry;
|
|
43
12
|
exports.shutdownTelemetry = shutdownTelemetry;
|
|
44
13
|
const posthog_node_1 = require("posthog-node");
|
|
45
|
-
const k8s = __importStar(require("@kubernetes/client-node"));
|
|
46
14
|
const crypto_1 = require("crypto");
|
|
47
15
|
const config_1 = require("./config");
|
|
48
16
|
/**
|
|
49
17
|
* Global telemetry instance (singleton pattern with lazy initialization)
|
|
50
18
|
*/
|
|
51
19
|
let telemetryInstance = null;
|
|
20
|
+
/**
|
|
21
|
+
* PRD #343: Plugin manager for K8s operations (set before first telemetry use)
|
|
22
|
+
*/
|
|
23
|
+
let telemetryPluginManager = null;
|
|
24
|
+
/**
|
|
25
|
+
* Set plugin manager for telemetry K8s operations
|
|
26
|
+
* Must be called before first getTelemetry() use for cluster ID generation
|
|
27
|
+
*/
|
|
28
|
+
function setTelemetryPluginManager(pluginManager) {
|
|
29
|
+
telemetryPluginManager = pluginManager;
|
|
30
|
+
}
|
|
52
31
|
/**
|
|
53
32
|
* Generate anonymous instance ID from Kubernetes cluster UID
|
|
54
33
|
*
|
|
55
34
|
* Uses SHA-256 hash of the kube-system namespace UID to create a stable,
|
|
56
35
|
* anonymous identifier that's unique per cluster but doesn't reveal cluster identity.
|
|
36
|
+
* PRD #343: Uses plugin system for kubectl operations.
|
|
57
37
|
*/
|
|
58
38
|
async function generateInstanceId() {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
39
|
+
// PRD #343: Use plugin to get namespace UID instead of direct K8s client
|
|
40
|
+
if (telemetryPluginManager) {
|
|
41
|
+
try {
|
|
42
|
+
const response = await telemetryPluginManager.invokeTool('kubectl_get_resource_json', {
|
|
43
|
+
resource: 'namespace/kube-system',
|
|
44
|
+
field: 'metadata'
|
|
45
|
+
});
|
|
46
|
+
if (response.success && response.result) {
|
|
47
|
+
// Parse the metadata to get UID
|
|
48
|
+
let metadata;
|
|
49
|
+
if (typeof response.result === 'string') {
|
|
50
|
+
metadata = JSON.parse(response.result);
|
|
51
|
+
}
|
|
52
|
+
else if (typeof response.result === 'object') {
|
|
53
|
+
const result = response.result;
|
|
54
|
+
// Handle nested {success, data} format
|
|
55
|
+
if (result.data) {
|
|
56
|
+
metadata = JSON.parse(result.data);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
metadata = result;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
metadata = {};
|
|
64
|
+
}
|
|
65
|
+
if (metadata.uid) {
|
|
66
|
+
// Hash the UID for anonymity
|
|
67
|
+
const hash = (0, crypto_1.createHash)('sha256').update(metadata.uid).digest('hex');
|
|
68
|
+
return `cluster_${hash.substring(0, 16)}`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
// Plugin not available or failed - fall through to random ID
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
|
-
|
|
72
|
-
// Cluster not available - generate a random ID for this session
|
|
73
|
-
// This handles local development without a cluster
|
|
74
|
-
}
|
|
75
|
-
// Fallback: generate random ID for non-cluster environments
|
|
76
|
+
// Fallback: generate random ID for non-cluster environments or when plugin unavailable
|
|
76
77
|
const randomId = (0, crypto_1.createHash)('sha256')
|
|
77
78
|
.update(`${Date.now()}-${Math.random()}`)
|
|
78
79
|
.digest('hex');
|
|
@@ -226,12 +227,11 @@ class PostHogTelemetry {
|
|
|
226
227
|
/**
|
|
227
228
|
* Track MCP client connection
|
|
228
229
|
*/
|
|
229
|
-
trackClientConnected(mcpClient
|
|
230
|
+
trackClientConnected(mcpClient) {
|
|
230
231
|
const properties = {
|
|
231
232
|
...this.getBaseProperties(),
|
|
232
233
|
mcp_client: mcpClient.name,
|
|
233
234
|
mcp_client_version: mcpClient.version,
|
|
234
|
-
transport,
|
|
235
235
|
};
|
|
236
236
|
this.trackEvent('client_connected', properties);
|
|
237
237
|
}
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
*/
|
|
27
27
|
export * from './types';
|
|
28
28
|
export { loadTelemetryConfig } from './config';
|
|
29
|
-
export { getTelemetry, shutdownTelemetry } from './client';
|
|
29
|
+
export { getTelemetry, shutdownTelemetry, setTelemetryPluginManager } from './client';
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -40,10 +40,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
40
40
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
41
41
|
};
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.shutdownTelemetry = exports.getTelemetry = exports.loadTelemetryConfig = void 0;
|
|
43
|
+
exports.setTelemetryPluginManager = exports.shutdownTelemetry = exports.getTelemetry = exports.loadTelemetryConfig = void 0;
|
|
44
44
|
__exportStar(require("./types"), exports);
|
|
45
45
|
var config_1 = require("./config");
|
|
46
46
|
Object.defineProperty(exports, "loadTelemetryConfig", { enumerable: true, get: function () { return config_1.loadTelemetryConfig; } });
|
|
47
47
|
var client_1 = require("./client");
|
|
48
48
|
Object.defineProperty(exports, "getTelemetry", { enumerable: true, get: function () { return client_1.getTelemetry; } });
|
|
49
49
|
Object.defineProperty(exports, "shutdownTelemetry", { enumerable: true, get: function () { return client_1.shutdownTelemetry; } });
|
|
50
|
+
Object.defineProperty(exports, "setTelemetryPluginManager", { enumerable: true, get: function () { return client_1.setTelemetryPluginManager; } });
|
|
@@ -67,8 +67,6 @@ export interface ClientConnectedEventProperties extends BaseEventProperties {
|
|
|
67
67
|
mcp_client: string;
|
|
68
68
|
/** MCP client version */
|
|
69
69
|
mcp_client_version: string;
|
|
70
|
-
/** Transport type (stdio, http) */
|
|
71
|
-
transport: string;
|
|
72
70
|
}
|
|
73
71
|
/**
|
|
74
72
|
* Properties for server_started event
|
|
@@ -118,7 +116,7 @@ export interface TelemetryService {
|
|
|
118
116
|
/** Track server stop */
|
|
119
117
|
trackServerStop(uptimeSeconds: number): void;
|
|
120
118
|
/** Track MCP client connection */
|
|
121
|
-
trackClientConnected(mcpClient: McpClientInfo
|
|
119
|
+
trackClientConnected(mcpClient: McpClientInfo): void;
|
|
122
120
|
/** Flush pending events and shutdown */
|
|
123
121
|
shutdown(): Promise<void>;
|
|
124
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/telemetry/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAC;IACjB,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,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@ export { getTracer, shutdownTracer, withSpan } from './tracer';
|
|
|
9
9
|
export { createHttpServerSpan, withHttpServerTracing } from './http-tracing';
|
|
10
10
|
export { withToolTracing, ToolTracingOptions } from './tool-tracing';
|
|
11
11
|
export { withAITracing } from './ai-tracing';
|
|
12
|
-
export { createTracedK8sClient, withKubectlTracing } from './k8s-tracing';
|
|
13
12
|
export { withQdrantTracing } from './qdrant-tracing';
|
|
14
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tracing/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tracing/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -19,7 +19,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.withQdrantTracing = exports.
|
|
22
|
+
exports.withQdrantTracing = exports.withAITracing = exports.withToolTracing = exports.withHttpServerTracing = exports.createHttpServerSpan = exports.withSpan = exports.shutdownTracer = exports.getTracer = void 0;
|
|
23
23
|
__exportStar(require("./types"), exports);
|
|
24
24
|
__exportStar(require("./config"), exports);
|
|
25
25
|
var tracer_1 = require("./tracer");
|
|
@@ -33,8 +33,5 @@ var tool_tracing_1 = require("./tool-tracing");
|
|
|
33
33
|
Object.defineProperty(exports, "withToolTracing", { enumerable: true, get: function () { return tool_tracing_1.withToolTracing; } });
|
|
34
34
|
var ai_tracing_1 = require("./ai-tracing");
|
|
35
35
|
Object.defineProperty(exports, "withAITracing", { enumerable: true, get: function () { return ai_tracing_1.withAITracing; } });
|
|
36
|
-
var k8s_tracing_1 = require("./k8s-tracing");
|
|
37
|
-
Object.defineProperty(exports, "createTracedK8sClient", { enumerable: true, get: function () { return k8s_tracing_1.createTracedK8sClient; } });
|
|
38
|
-
Object.defineProperty(exports, "withKubectlTracing", { enumerable: true, get: function () { return k8s_tracing_1.withKubectlTracing; } });
|
|
39
36
|
var qdrant_tracing_1 = require("./qdrant-tracing");
|
|
40
37
|
Object.defineProperty(exports, "withQdrantTracing", { enumerable: true, get: function () { return qdrant_tracing_1.withQdrantTracing; } });
|
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
* Loads prompts from markdown files following CLAUDE.md guidelines.
|
|
7
7
|
*/
|
|
8
8
|
import { KubernetesDiscovery } from './discovery';
|
|
9
|
+
import type { PluginManager } from './plugin-manager';
|
|
9
10
|
import { UnifiedCreationSession, UnifiedWorkflowStepResponse, UnifiedWorkflowCompletionResponse, EntityType } from './unified-creation-types';
|
|
10
11
|
export declare class UnifiedCreationSessionManager {
|
|
11
12
|
private config;
|
|
12
13
|
private discovery;
|
|
13
14
|
private sessionManager;
|
|
14
|
-
|
|
15
|
+
private pluginManager;
|
|
16
|
+
/**
|
|
17
|
+
* PRD #343: pluginManager required for kubectl operations via plugin system
|
|
18
|
+
*/
|
|
19
|
+
constructor(entityType: EntityType, discovery?: KubernetesDiscovery, pluginManager?: PluginManager);
|
|
15
20
|
/**
|
|
16
21
|
* Create a new creation session
|
|
17
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-creation-session.d.ts","sourceRoot":"","sources":["../../src/core/unified-creation-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"unified-creation-session.d.ts","sourceRoot":"","sources":["../../src/core/unified-creation-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,EACL,sBAAsB,EAEtB,2BAA2B,EAC3B,iCAAiC,EACjC,UAAU,EAIX,MAAM,0BAA0B,CAAC;AAKlC,qBAAa,6BAA6B;IACxC,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,SAAS,CAAsB;IACvC,OAAO,CAAC,cAAc,CAAoD;IAC1E,OAAO,CAAC,aAAa,CAAgB;IAErC;;OAEG;gBACS,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,mBAAmB,EAAE,aAAa,CAAC,EAAE,aAAa;IAclG;;OAEG;IACH,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,sBAAsB;IAWhD;;OAEG;IACH,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,sBAAsB,GAAG,IAAI;IAIzE;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,sBAAsB;IAiHxF;;OAEG;IACG,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,2BAA2B,GAAG,iCAAiC,CAAC;IAiGhJ;;OAEG;YACW,4BAA4B;IA4C1C;;OAEG;YACW,gCAAgC;IAyC9C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6E1B;;OAEG;YACW,gBAAgB;IAsF9B;;OAEG;YACW,4BAA4B;IAqH1C;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;OAEG;YACW,qBAAqB;IAsCnC;;OAEG;YACW,mBAAmB;IAsLjC;;OAEG;YACW,uBAAuB;IAsGrC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAU5B;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAY/B"}
|
|
@@ -59,10 +59,20 @@ class UnifiedCreationSessionManager {
|
|
|
59
59
|
config;
|
|
60
60
|
discovery;
|
|
61
61
|
sessionManager;
|
|
62
|
-
|
|
62
|
+
pluginManager;
|
|
63
|
+
/**
|
|
64
|
+
* PRD #343: pluginManager required for kubectl operations via plugin system
|
|
65
|
+
*/
|
|
66
|
+
constructor(entityType, discovery, pluginManager) {
|
|
67
|
+
if (!pluginManager) {
|
|
68
|
+
throw new Error('Plugin system not available. UnifiedCreationSessionManager requires agentic-tools plugin for kubectl operations.');
|
|
69
|
+
}
|
|
63
70
|
this.config = unified_creation_types_1.WORKFLOW_CONFIGS[entityType];
|
|
64
71
|
this.discovery = discovery || new discovery_1.KubernetesDiscovery();
|
|
65
72
|
this.sessionManager = new generic_session_manager_1.GenericSessionManager(entityType);
|
|
73
|
+
this.pluginManager = pluginManager;
|
|
74
|
+
// PRD #343: Set pluginManager on discovery for kubectl operations
|
|
75
|
+
this.discovery.setPluginManager(pluginManager);
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
68
78
|
* Create a new creation session
|
|
@@ -246,15 +256,13 @@ class UnifiedCreationSessionManager {
|
|
|
246
256
|
};
|
|
247
257
|
case 'namespace-scope': {
|
|
248
258
|
// Check if Kyverno is installed - only show namespace options if it is
|
|
249
|
-
const kyvernoStatus = await (0, version_1.
|
|
259
|
+
const kyvernoStatus = await (0, version_1.getKyvernoStatusViaPlugin)(this.pluginManager);
|
|
250
260
|
if (!kyvernoStatus.installed) {
|
|
251
261
|
// Skip namespace-scope if Kyverno not installed, go to next step
|
|
252
262
|
session.data.currentStep = (0, unified_creation_types_1.getNextStep)('namespace-scope', this.config);
|
|
253
263
|
return this.getNextWorkflowStep(session, args);
|
|
254
264
|
}
|
|
255
|
-
//
|
|
256
|
-
await this.discovery.connect();
|
|
257
|
-
// Get actual namespaces from cluster
|
|
265
|
+
// Get actual namespaces from cluster via plugin
|
|
258
266
|
const namespaces = await this.discovery.getNamespaces();
|
|
259
267
|
const prompt = (0, shared_prompt_loader_1.loadPrompt)('policy-namespace-scope', {
|
|
260
268
|
namespaces: namespaces.join(', ')
|
|
@@ -539,9 +547,10 @@ The pattern is now ready to enhance AI recommendations. When users ask for deplo
|
|
|
539
547
|
// Save Kyverno policy to file
|
|
540
548
|
fs.writeFileSync(kyvernoFilePath, generatedKyvernoPolicy, 'utf8');
|
|
541
549
|
// Apply to cluster using existing DeployOperation
|
|
550
|
+
// PRD #343: Pass pluginManager for kubectl operations
|
|
542
551
|
try {
|
|
543
552
|
const { DeployOperation } = await Promise.resolve().then(() => __importStar(require('./deploy-operation')));
|
|
544
|
-
const deployOp = new DeployOperation();
|
|
553
|
+
const deployOp = new DeployOperation(this.pluginManager);
|
|
545
554
|
const deployResult = await deployOp.deploy({
|
|
546
555
|
solutionId: `${policy.id}-kyverno`,
|
|
547
556
|
sessionDir,
|
|
@@ -658,8 +667,9 @@ The policy intent has been stored in the database. The Kyverno policy was not ap
|
|
|
658
667
|
};
|
|
659
668
|
}
|
|
660
669
|
// 2. kubectl dry-run validation using ManifestValidator
|
|
670
|
+
// PRD #343: Pass pluginManager for kubectl operations
|
|
661
671
|
try {
|
|
662
|
-
const validator = new schema_1.ManifestValidator();
|
|
672
|
+
const validator = new schema_1.ManifestValidator(this.pluginManager);
|
|
663
673
|
const result = await validator.validateManifest(yamlPath, { dryRunMode: 'server' });
|
|
664
674
|
return result;
|
|
665
675
|
}
|
|
@@ -676,7 +686,7 @@ The policy intent has been stored in the database. The Kyverno policy was not ap
|
|
|
676
686
|
*/
|
|
677
687
|
async generateKyvernoStep(session, args) {
|
|
678
688
|
// Check if Kyverno is available before attempting policy generation
|
|
679
|
-
const kyvernoStatus = await (0, version_1.
|
|
689
|
+
const kyvernoStatus = await (0, version_1.getKyvernoStatusViaPlugin)(this.pluginManager);
|
|
680
690
|
if (!kyvernoStatus.policyGenerationReady) {
|
|
681
691
|
// Skip Kyverno generation and go directly to review with intent-only option
|
|
682
692
|
session.data.currentStep = (0, unified_creation_types_1.getNextStep)('kyverno-generation', this.config);
|
|
@@ -695,9 +705,7 @@ The policy intent has been stored in the database. The Kyverno policy was not ap
|
|
|
695
705
|
const maxAttempts = 5;
|
|
696
706
|
let lastError;
|
|
697
707
|
try {
|
|
698
|
-
//
|
|
699
|
-
await this.discovery.connect();
|
|
700
|
-
// Retrieve actual resource schemas using semantic search and discovery
|
|
708
|
+
// Retrieve actual resource schemas using semantic search and discovery via plugin
|
|
701
709
|
// Use capabilities collection from session data if provided (for testing with pre-populated data)
|
|
702
710
|
const resourceSchemas = await this.retrieveRelevantSchemas(data.description || '', finalTriggers, data.capabilitiesCollection);
|
|
703
711
|
// Prepare session directory for YAML saving
|
package/dist/interfaces/mcp.d.ts
CHANGED
|
@@ -6,15 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { DotAI } from '../core/index';
|
|
8
8
|
import { McpClientInfo } from '../core/telemetry';
|
|
9
|
+
import { PluginManager } from '../core/plugin-manager';
|
|
9
10
|
export interface MCPServerConfig {
|
|
10
11
|
name: string;
|
|
11
12
|
version: string;
|
|
12
13
|
description: string;
|
|
13
14
|
author?: string;
|
|
14
|
-
transport?: 'stdio' | 'http';
|
|
15
15
|
port?: number;
|
|
16
16
|
host?: string;
|
|
17
17
|
sessionMode?: 'stateful' | 'stateless';
|
|
18
|
+
/** Optional PluginManager for plugin-based tools (PRD #343) */
|
|
19
|
+
pluginManager?: PluginManager;
|
|
18
20
|
}
|
|
19
21
|
export declare class MCPServer {
|
|
20
22
|
private server;
|
|
@@ -28,6 +30,7 @@ export declare class MCPServer {
|
|
|
28
30
|
private restRegistry;
|
|
29
31
|
private restApiRouter;
|
|
30
32
|
private mcpClientInfo;
|
|
33
|
+
private pluginManager?;
|
|
31
34
|
constructor(dotAI: DotAI, config: MCPServerConfig);
|
|
32
35
|
/**
|
|
33
36
|
* Get the current MCP client info (available after client connects)
|
|
@@ -41,6 +44,10 @@ export declare class MCPServer {
|
|
|
41
44
|
* Register all tools with McpServer and REST registry
|
|
42
45
|
*/
|
|
43
46
|
private registerTools;
|
|
47
|
+
/**
|
|
48
|
+
* Register tools from discovered plugins (PRD #343)
|
|
49
|
+
*/
|
|
50
|
+
private registerPluginTools;
|
|
44
51
|
/**
|
|
45
52
|
* Register prompts capability with McpServer
|
|
46
53
|
*/
|
|
@@ -49,7 +56,6 @@ export declare class MCPServer {
|
|
|
49
56
|
private handleSamplingRequest;
|
|
50
57
|
private generateRequestId;
|
|
51
58
|
start(): Promise<void>;
|
|
52
|
-
private startStdioTransport;
|
|
53
59
|
private startHttpTransport;
|
|
54
60
|
private parseRequestBody;
|
|
55
61
|
stop(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAU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