@vfarcic/dot-ai 1.0.3 → 1.1.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 +1 -0
- package/dist/core/ai-provider.interface.d.ts +12 -8
- package/dist/core/ai-provider.interface.d.ts.map +1 -1
- package/dist/core/artifacthub.d.ts +1 -1
- package/dist/core/artifacthub.d.ts.map +1 -1
- package/dist/core/base-vector-service.d.ts +22 -9
- package/dist/core/base-vector-service.d.ts.map +1 -1
- package/dist/core/base-vector-service.js +106 -37
- package/dist/core/capabilities.d.ts.map +1 -1
- package/dist/core/capabilities.js +5 -2
- package/dist/core/capability-operations.d.ts +55 -7
- package/dist/core/capability-operations.d.ts.map +1 -1
- package/dist/core/capability-operations.js +1 -3
- package/dist/core/capability-scan-workflow.d.ts +64 -8
- package/dist/core/capability-scan-workflow.d.ts.map +1 -1
- package/dist/core/capability-scan-workflow.js +14 -13
- package/dist/core/capability-tools.d.ts +1 -1
- package/dist/core/capability-tools.d.ts.map +1 -1
- package/dist/core/capability-tools.js +1 -1
- package/dist/core/capability-vector-service.d.ts +3 -4
- package/dist/core/capability-vector-service.d.ts.map +1 -1
- package/dist/core/capability-vector-service.js +2 -2
- package/dist/core/command-executor.d.ts +3 -4
- package/dist/core/command-executor.d.ts.map +1 -1
- package/dist/core/command-executor.js +8 -4
- package/dist/core/crd-availability.d.ts +3 -5
- package/dist/core/crd-availability.d.ts.map +1 -1
- package/dist/core/crd-availability.js +8 -18
- package/dist/core/deploy-operation.d.ts +6 -5
- package/dist/core/deploy-operation.d.ts.map +1 -1
- package/dist/core/deploy-operation.js +16 -10
- package/dist/core/discovery.d.ts +6 -14
- package/dist/core/discovery.d.ts.map +1 -1
- package/dist/core/discovery.js +35 -51
- package/dist/core/embedding-service.d.ts.map +1 -1
- package/dist/core/embedding-service.js +1 -1
- package/dist/core/error-handling.d.ts +13 -13
- package/dist/core/error-handling.d.ts.map +1 -1
- package/dist/core/error-handling.js +2 -3
- package/dist/core/generic-session-manager.d.ts +2 -2
- package/dist/core/generic-session-manager.d.ts.map +1 -1
- package/dist/core/helm-types.d.ts +5 -5
- package/dist/core/helm-types.d.ts.map +1 -1
- package/dist/core/index.d.ts +4 -11
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -14
- package/dist/core/knowledge-types.d.ts +114 -0
- package/dist/core/knowledge-types.d.ts.map +1 -0
- package/dist/core/knowledge-types.js +10 -0
- package/dist/core/memory.d.ts +12 -12
- package/dist/core/memory.d.ts.map +1 -1
- package/dist/core/mermaid-tools.d.ts +24 -1
- package/dist/core/mermaid-tools.d.ts.map +1 -1
- package/dist/core/mermaid-tools.js +10 -8
- package/dist/core/packaging.d.ts +23 -1
- package/dist/core/packaging.d.ts.map +1 -1
- package/dist/core/pattern-operations.d.ts +32 -9
- package/dist/core/pattern-operations.d.ts.map +1 -1
- package/dist/core/pattern-operations.js +17 -22
- package/dist/core/pattern-vector-service.d.ts +3 -4
- package/dist/core/pattern-vector-service.d.ts.map +1 -1
- package/dist/core/pattern-vector-service.js +2 -2
- package/dist/core/platform-utils.d.ts +2 -2
- package/dist/core/platform-utils.d.ts.map +1 -1
- package/dist/core/plugin-manager.d.ts +6 -2
- package/dist/core/plugin-manager.d.ts.map +1 -1
- package/dist/core/plugin-manager.js +9 -16
- package/dist/core/plugin-registry.d.ts +59 -0
- package/dist/core/plugin-registry.d.ts.map +1 -0
- package/dist/core/plugin-registry.js +80 -0
- package/dist/core/policy-operations.d.ts +101 -21
- package/dist/core/policy-operations.d.ts.map +1 -1
- package/dist/core/policy-operations.js +45 -47
- package/dist/core/policy-vector-service.d.ts +3 -4
- package/dist/core/policy-vector-service.d.ts.map +1 -1
- package/dist/core/policy-vector-service.js +2 -2
- package/dist/core/providers/host-provider.d.ts +1 -1
- package/dist/core/providers/host-provider.d.ts.map +1 -1
- package/dist/core/providers/host-provider.js +2 -2
- package/dist/core/providers/provider-debug-utils.d.ts +2 -2
- package/dist/core/providers/provider-debug-utils.d.ts.map +1 -1
- package/dist/core/providers/tool-utils.d.ts +10 -2
- package/dist/core/providers/tool-utils.d.ts.map +1 -1
- package/dist/core/providers/tool-utils.js +2 -2
- package/dist/core/providers/vercel-provider.d.ts.map +1 -1
- package/dist/core/providers/vercel-provider.js +29 -23
- package/dist/core/resource-tools.d.ts +29 -1
- package/dist/core/resource-tools.d.ts.map +1 -1
- package/dist/core/resource-vector-service.d.ts +3 -4
- package/dist/core/resource-vector-service.d.ts.map +1 -1
- package/dist/core/resource-vector-service.js +2 -2
- package/dist/core/schema.d.ts +15 -14
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +32 -34
- package/dist/core/shared-prompt-loader.d.ts +1 -1
- package/dist/core/shared-prompt-loader.d.ts.map +1 -1
- package/dist/core/solution-cr.js +1 -1
- package/dist/core/solution-utils.d.ts +22 -3
- package/dist/core/solution-utils.d.ts.map +1 -1
- package/dist/core/solution-utils.js +1 -1
- package/dist/core/telemetry/client.d.ts +0 -6
- package/dist/core/telemetry/client.d.ts.map +1 -1
- package/dist/core/telemetry/client.js +6 -17
- package/dist/core/telemetry/config.js +1 -1
- 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 +1 -2
- package/dist/core/tracing/tool-tracing.d.ts +1 -1
- package/dist/core/tracing/tool-tracing.d.ts.map +1 -1
- package/dist/core/unified-creation-session.d.ts +15 -8
- package/dist/core/unified-creation-session.d.ts.map +1 -1
- package/dist/core/unified-creation-session.js +19 -19
- package/dist/core/unified-creation-types.d.ts +2 -2
- package/dist/core/unified-creation-types.d.ts.map +1 -1
- package/dist/core/visualization.d.ts +1 -1
- package/dist/core/visualization.d.ts.map +1 -1
- package/dist/core/workflow.d.ts +8 -5
- package/dist/core/workflow.d.ts.map +1 -1
- package/dist/evaluation/dataset-analyzer.d.ts +13 -7
- package/dist/evaluation/dataset-analyzer.d.ts.map +1 -1
- package/dist/evaluation/dataset-analyzer.js +1 -1
- package/dist/evaluation/datasets/loader.d.ts +2 -2
- package/dist/evaluation/datasets/loader.d.ts.map +1 -1
- package/dist/evaluation/eval-runner.js +7 -5
- package/dist/evaluation/evaluators/base-comparative.d.ts +1 -1
- package/dist/evaluation/evaluators/base-comparative.d.ts.map +1 -1
- package/dist/evaluation/evaluators/base-comparative.js +4 -3
- package/dist/evaluation/evaluators/base.d.ts +5 -5
- package/dist/evaluation/evaluators/base.d.ts.map +1 -1
- package/dist/evaluation/evaluators/capability-comparative.js +1 -1
- package/dist/evaluation/platform-synthesizer.d.ts.map +1 -1
- package/dist/interfaces/mcp.d.ts.map +1 -1
- package/dist/interfaces/mcp.js +26 -15
- package/dist/interfaces/openapi-generator.d.ts +116 -12
- package/dist/interfaces/openapi-generator.d.ts.map +1 -1
- package/dist/interfaces/openapi-generator.js +490 -199
- package/dist/interfaces/rest-api.d.ts +28 -6
- package/dist/interfaces/rest-api.d.ts.map +1 -1
- package/dist/interfaces/rest-api.js +436 -245
- package/dist/interfaces/rest-registry.d.ts +4 -4
- package/dist/interfaces/rest-registry.d.ts.map +1 -1
- package/dist/interfaces/rest-registry.js +6 -5
- package/dist/interfaces/rest-route-registry.d.ts +165 -0
- package/dist/interfaces/rest-route-registry.d.ts.map +1 -0
- package/dist/interfaces/rest-route-registry.js +230 -0
- package/dist/interfaces/routes/index.d.ts +22 -0
- package/dist/interfaces/routes/index.d.ts.map +1 -0
- package/dist/interfaces/routes/index.js +347 -0
- package/dist/interfaces/schemas/common.d.ts +177 -0
- package/dist/interfaces/schemas/common.d.ts.map +1 -0
- package/dist/interfaces/schemas/common.js +102 -0
- package/dist/interfaces/schemas/events.d.ts +131 -0
- package/dist/interfaces/schemas/events.d.ts.map +1 -0
- package/dist/interfaces/schemas/events.js +66 -0
- package/dist/interfaces/schemas/index.d.ts +21 -0
- package/dist/interfaces/schemas/index.d.ts.map +1 -0
- package/dist/interfaces/schemas/index.js +138 -0
- package/dist/interfaces/schemas/knowledge.d.ts +210 -0
- package/dist/interfaces/schemas/knowledge.d.ts.map +1 -0
- package/dist/interfaces/schemas/knowledge.js +117 -0
- package/dist/interfaces/schemas/logs.d.ts +82 -0
- package/dist/interfaces/schemas/logs.d.ts.map +1 -0
- package/dist/interfaces/schemas/logs.js +46 -0
- package/dist/interfaces/schemas/prompts.d.ts +191 -0
- package/dist/interfaces/schemas/prompts.d.ts.map +1 -0
- package/dist/interfaces/schemas/prompts.js +91 -0
- package/dist/interfaces/schemas/resources.d.ts +378 -0
- package/dist/interfaces/schemas/resources.d.ts.map +1 -0
- package/dist/interfaces/schemas/resources.js +173 -0
- package/dist/interfaces/schemas/sessions.d.ts +90 -0
- package/dist/interfaces/schemas/sessions.d.ts.map +1 -0
- package/dist/interfaces/schemas/sessions.js +56 -0
- package/dist/interfaces/schemas/tools.d.ts +194 -0
- package/dist/interfaces/schemas/tools.d.ts.map +1 -0
- package/dist/interfaces/schemas/tools.js +101 -0
- package/dist/interfaces/schemas/visualization.d.ts +373 -0
- package/dist/interfaces/schemas/visualization.d.ts.map +1 -0
- package/dist/interfaces/schemas/visualization.js +134 -0
- package/dist/mcp/server.js +5 -4
- package/dist/tools/answer-question.d.ts +1 -1
- package/dist/tools/answer-question.d.ts.map +1 -1
- package/dist/tools/answer-question.js +9 -8
- package/dist/tools/deploy-manifests.d.ts +4 -2
- package/dist/tools/deploy-manifests.d.ts.map +1 -1
- package/dist/tools/deploy-manifests.js +10 -6
- package/dist/tools/generate-manifests.d.ts.map +1 -1
- package/dist/tools/generate-manifests.js +28 -20
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -1
- package/dist/tools/manage-knowledge.d.ts +77 -0
- package/dist/tools/manage-knowledge.d.ts.map +1 -0
- package/dist/tools/manage-knowledge.js +573 -0
- package/dist/tools/operate-analysis.d.ts +31 -2
- package/dist/tools/operate-analysis.d.ts.map +1 -1
- package/dist/tools/operate-execution.d.ts +2 -3
- package/dist/tools/operate-execution.d.ts.map +1 -1
- package/dist/tools/operate-execution.js +7 -7
- package/dist/tools/operate.d.ts +7 -2
- package/dist/tools/operate.d.ts.map +1 -1
- package/dist/tools/operate.js +2 -2
- package/dist/tools/organizational-data.d.ts +30 -4
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +24 -19
- package/dist/tools/project-setup/discovery.d.ts.map +1 -1
- package/dist/tools/project-setup/generate-scope.d.ts +1 -1
- package/dist/tools/project-setup/generate-scope.d.ts.map +1 -1
- package/dist/tools/project-setup/types.d.ts +1 -0
- package/dist/tools/project-setup/types.d.ts.map +1 -1
- package/dist/tools/prompts.d.ts +28 -2
- package/dist/tools/prompts.d.ts.map +1 -1
- package/dist/tools/query.d.ts +17 -3
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +1 -7
- package/dist/tools/recommend.d.ts +24 -6
- package/dist/tools/recommend.d.ts.map +1 -1
- package/dist/tools/recommend.js +18 -15
- package/dist/tools/remediate.d.ts +12 -3
- package/dist/tools/remediate.d.ts.map +1 -1
- package/dist/tools/remediate.js +22 -14
- package/dist/tools/version.d.ts +19 -5
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +106 -54
- package/package.json +11 -5
- package/prompts/knowledge-ask.md +29 -0
- package/dist/core/vector-db-service.d.ts +0 -108
- package/dist/core/vector-db-service.d.ts.map +0 -1
- package/dist/core/vector-db-service.js +0 -647
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-manager.d.ts","sourceRoot":"","sources":["../../src/core/plugin-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAW/D;;GAEG;AACH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kBAAkB,CAAC,gBAAgB,CAAC,EAAE,YAAY,GAAG,YAAY;IAuDjE;;OAEG;IACH,wBAAwB,IAAI,MAAM,EAAE;IAIpC;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAI/D;;OAEG;IACH,uBAAuB,IAAI,gBAAgB,EAAE;IAI7C;;OAEG;IACH,QAAQ,IAAI;QACV,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACrE,gBAAgB,EAAE,MAAM,EAAE,CAAC;QAC3B,yBAAyB,EAAE,OAAO,CAAC;KACpC;IAgBD;;OAEG;IACH,OAAO,CAAC,eAAe;CAOxB"}
|
|
@@ -362,21 +362,13 @@ class PluginManager {
|
|
|
362
362
|
return this.toolToPlugin.get(toolName);
|
|
363
363
|
}
|
|
364
364
|
/**
|
|
365
|
-
* Invoke a tool on
|
|
365
|
+
* Invoke a tool on a specific plugin (explicit routing)
|
|
366
|
+
*
|
|
367
|
+
* PRD #359: Unified plugin invocation with explicit plugin specification.
|
|
368
|
+
* Use this when you know which plugin provides the tool, avoiding
|
|
369
|
+
* ambiguity when multiple plugins might have tools with the same name.
|
|
366
370
|
*/
|
|
367
|
-
async
|
|
368
|
-
const pluginName = this.toolToPlugin.get(toolName);
|
|
369
|
-
if (!pluginName) {
|
|
370
|
-
return {
|
|
371
|
-
sessionId: sessionId || '',
|
|
372
|
-
success: false,
|
|
373
|
-
error: {
|
|
374
|
-
code: 'TOOL_NOT_FOUND',
|
|
375
|
-
message: `Tool '${toolName}' not found in any plugin`,
|
|
376
|
-
},
|
|
377
|
-
state,
|
|
378
|
-
};
|
|
379
|
-
}
|
|
371
|
+
async invokeToolOnPlugin(pluginName, toolName, args, state = {}, sessionId) {
|
|
380
372
|
const client = this.plugins.get(pluginName);
|
|
381
373
|
if (!client) {
|
|
382
374
|
return {
|
|
@@ -410,7 +402,8 @@ class PluginManager {
|
|
|
410
402
|
plugin: this.getToolPlugin(toolName),
|
|
411
403
|
});
|
|
412
404
|
try {
|
|
413
|
-
const
|
|
405
|
+
const pluginName = this.getToolPlugin(toolName);
|
|
406
|
+
const response = await this.invokeToolOnPlugin(pluginName, toolName, input);
|
|
414
407
|
if (response.success) {
|
|
415
408
|
// PRD #343: Return only the data field to AI, not the full JSON wrapper
|
|
416
409
|
// This saves tokens and provides cleaner output matching raw command output
|
|
@@ -433,7 +426,7 @@ class PluginManager {
|
|
|
433
426
|
catch (err) {
|
|
434
427
|
// Catch invoke exceptions to prevent tool-loop crashes
|
|
435
428
|
const message = err instanceof Error ? err.message : String(err);
|
|
436
|
-
this.logger.error('Plugin
|
|
429
|
+
this.logger.error('Plugin invokeToolOnPlugin failed with exception', new Error(message), {
|
|
437
430
|
tool: toolName,
|
|
438
431
|
plugin: this.getToolPlugin(toolName),
|
|
439
432
|
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin Registry - Unified Plugin Tool Invocation
|
|
3
|
+
*
|
|
4
|
+
* PRD #359: Provides a single, consistent way to invoke plugin tools from anywhere
|
|
5
|
+
* in the codebase. Replaces scattered plugin manager passing and module-level setters.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* // At startup (src/mcp/server.ts):
|
|
9
|
+
* initializePluginRegistry(pluginManager);
|
|
10
|
+
*
|
|
11
|
+
* // Anywhere in the codebase:
|
|
12
|
+
* const response = await invokePluginTool('agentic-tools', 'vector_search', { ... });
|
|
13
|
+
*/
|
|
14
|
+
import type { PluginManager } from './plugin-manager';
|
|
15
|
+
import type { InvokeResponse } from './plugin-types';
|
|
16
|
+
/**
|
|
17
|
+
* Initialize the plugin registry with a PluginManager instance.
|
|
18
|
+
* Must be called once at startup before any plugin tool invocations.
|
|
19
|
+
*/
|
|
20
|
+
export declare function initializePluginRegistry(pm: PluginManager): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get the PluginManager instance.
|
|
23
|
+
* Returns null if not initialized.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getPluginManager(): PluginManager | null;
|
|
26
|
+
/**
|
|
27
|
+
* Check if the plugin registry is initialized.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isPluginInitialized(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Invoke a tool on a specific plugin.
|
|
32
|
+
*
|
|
33
|
+
* @param plugin - The plugin name (e.g., 'agentic-tools')
|
|
34
|
+
* @param tool - The tool name (e.g., 'vector_search', 'kubectl_get_resource_json')
|
|
35
|
+
* @param args - Tool arguments
|
|
36
|
+
* @returns InvokeResponse with success/error status and result
|
|
37
|
+
* @throws Error if plugin registry is not initialized
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* // Invoke a vector tool
|
|
41
|
+
* const response = await invokePluginTool('agentic-tools', 'vector_search', {
|
|
42
|
+
* collection: 'capabilities',
|
|
43
|
+
* embedding: [...],
|
|
44
|
+
* limit: 10
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // Invoke a kubectl tool
|
|
48
|
+
* const response = await invokePluginTool('agentic-tools', 'kubectl_get_resource_json', {
|
|
49
|
+
* resource: 'namespace/kube-system',
|
|
50
|
+
* field: 'metadata'
|
|
51
|
+
* });
|
|
52
|
+
*/
|
|
53
|
+
export declare function invokePluginTool(plugin: string, tool: string, args: Record<string, unknown>): Promise<InvokeResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Reset the plugin registry (for testing only).
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare function resetPluginRegistry(): void;
|
|
59
|
+
//# sourceMappingURL=plugin-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../../src/core/plugin-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAOrD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,CAEhE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CAKzB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Registry - Unified Plugin Tool Invocation
|
|
4
|
+
*
|
|
5
|
+
* PRD #359: Provides a single, consistent way to invoke plugin tools from anywhere
|
|
6
|
+
* in the codebase. Replaces scattered plugin manager passing and module-level setters.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* // At startup (src/mcp/server.ts):
|
|
10
|
+
* initializePluginRegistry(pluginManager);
|
|
11
|
+
*
|
|
12
|
+
* // Anywhere in the codebase:
|
|
13
|
+
* const response = await invokePluginTool('agentic-tools', 'vector_search', { ... });
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.initializePluginRegistry = initializePluginRegistry;
|
|
17
|
+
exports.getPluginManager = getPluginManager;
|
|
18
|
+
exports.isPluginInitialized = isPluginInitialized;
|
|
19
|
+
exports.invokePluginTool = invokePluginTool;
|
|
20
|
+
exports.resetPluginRegistry = resetPluginRegistry;
|
|
21
|
+
/**
|
|
22
|
+
* Global plugin manager instance (set once at startup)
|
|
23
|
+
*/
|
|
24
|
+
let pluginManager = null;
|
|
25
|
+
/**
|
|
26
|
+
* Initialize the plugin registry with a PluginManager instance.
|
|
27
|
+
* Must be called once at startup before any plugin tool invocations.
|
|
28
|
+
*/
|
|
29
|
+
function initializePluginRegistry(pm) {
|
|
30
|
+
pluginManager = pm;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the PluginManager instance.
|
|
34
|
+
* Returns null if not initialized.
|
|
35
|
+
*/
|
|
36
|
+
function getPluginManager() {
|
|
37
|
+
return pluginManager;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Check if the plugin registry is initialized.
|
|
41
|
+
*/
|
|
42
|
+
function isPluginInitialized() {
|
|
43
|
+
return pluginManager !== null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Invoke a tool on a specific plugin.
|
|
47
|
+
*
|
|
48
|
+
* @param plugin - The plugin name (e.g., 'agentic-tools')
|
|
49
|
+
* @param tool - The tool name (e.g., 'vector_search', 'kubectl_get_resource_json')
|
|
50
|
+
* @param args - Tool arguments
|
|
51
|
+
* @returns InvokeResponse with success/error status and result
|
|
52
|
+
* @throws Error if plugin registry is not initialized
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // Invoke a vector tool
|
|
56
|
+
* const response = await invokePluginTool('agentic-tools', 'vector_search', {
|
|
57
|
+
* collection: 'capabilities',
|
|
58
|
+
* embedding: [...],
|
|
59
|
+
* limit: 10
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* // Invoke a kubectl tool
|
|
63
|
+
* const response = await invokePluginTool('agentic-tools', 'kubectl_get_resource_json', {
|
|
64
|
+
* resource: 'namespace/kube-system',
|
|
65
|
+
* field: 'metadata'
|
|
66
|
+
* });
|
|
67
|
+
*/
|
|
68
|
+
async function invokePluginTool(plugin, tool, args) {
|
|
69
|
+
if (!pluginManager) {
|
|
70
|
+
throw new Error('Plugin registry not initialized. Call initializePluginRegistry() at startup.');
|
|
71
|
+
}
|
|
72
|
+
return pluginManager.invokeToolOnPlugin(plugin, tool, args);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Reset the plugin registry (for testing only).
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
function resetPluginRegistry() {
|
|
79
|
+
pluginManager = null;
|
|
80
|
+
}
|
|
@@ -6,51 +6,131 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { Logger } from './error-handling';
|
|
8
8
|
import { PolicyVectorService } from './policy-vector-service';
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Kyverno policy metadata
|
|
11
|
+
*/
|
|
12
|
+
interface KyvernoPolicyInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
labels?: Record<string, string>;
|
|
15
|
+
creationTimestamp?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Kyverno delete result
|
|
19
|
+
*/
|
|
20
|
+
interface KyvernoDeleteResult {
|
|
21
|
+
successful: Array<{
|
|
22
|
+
policyId?: string;
|
|
23
|
+
deletedAt: string;
|
|
24
|
+
}>;
|
|
25
|
+
failed: Array<{
|
|
26
|
+
policyId?: string;
|
|
27
|
+
error: string;
|
|
28
|
+
}>;
|
|
29
|
+
total: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Policy operation result
|
|
33
|
+
*/
|
|
34
|
+
interface PolicyOperationResult {
|
|
35
|
+
success: boolean;
|
|
36
|
+
operation?: string;
|
|
37
|
+
dataType?: string;
|
|
38
|
+
message?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
data?: unknown;
|
|
41
|
+
deletedKyvernoPolicies?: KyvernoDeleteResult;
|
|
42
|
+
requiresConfirmation?: boolean;
|
|
43
|
+
confirmationMessage?: string;
|
|
44
|
+
confirmation?: string | {
|
|
45
|
+
question: string;
|
|
46
|
+
options: string[];
|
|
47
|
+
};
|
|
48
|
+
note?: string;
|
|
49
|
+
deletedPolicyIntent?: {
|
|
50
|
+
id: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
deletedPolicyIntents?: unknown[];
|
|
54
|
+
deletedCount?: number;
|
|
55
|
+
workflow?: unknown;
|
|
56
|
+
storage?: unknown;
|
|
57
|
+
policyIntents?: unknown[];
|
|
58
|
+
policyIntent?: unknown;
|
|
59
|
+
totalCount?: number;
|
|
60
|
+
searchResults?: unknown[];
|
|
61
|
+
kyvernoCleanup?: unknown;
|
|
62
|
+
kyvernoPolicies?: unknown;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Policy delete arguments
|
|
66
|
+
*/
|
|
67
|
+
interface PolicyDeleteArgs {
|
|
68
|
+
operation?: string;
|
|
69
|
+
dataType?: string;
|
|
70
|
+
id?: string;
|
|
71
|
+
response?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Policy operation arguments
|
|
75
|
+
*/
|
|
76
|
+
interface PolicyOperationArgs {
|
|
77
|
+
sessionId?: string;
|
|
78
|
+
response?: string;
|
|
79
|
+
id?: string;
|
|
80
|
+
limit?: number;
|
|
81
|
+
step?: string;
|
|
82
|
+
[key: string]: unknown;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validation result from connection checks
|
|
86
|
+
*/
|
|
87
|
+
interface ValidationCheckResult {
|
|
88
|
+
success: boolean;
|
|
89
|
+
error?: string;
|
|
90
|
+
}
|
|
10
91
|
/**
|
|
11
92
|
* Get initialized policy service
|
|
12
93
|
*/
|
|
13
94
|
export declare function getPolicyService(): Promise<PolicyVectorService>;
|
|
14
95
|
/**
|
|
15
96
|
* Find Kyverno policies by policy intent ID using label selector
|
|
16
|
-
* PRD #
|
|
97
|
+
* PRD #359: Uses unified plugin registry
|
|
17
98
|
*/
|
|
18
|
-
export declare function findKyvernoPoliciesByPolicyId(policyId: string, logger: Logger, requestId: string
|
|
99
|
+
export declare function findKyvernoPoliciesByPolicyId(policyId: string, logger: Logger, requestId: string): Promise<KyvernoPolicyInfo[]>;
|
|
19
100
|
/**
|
|
20
101
|
* Find all Kyverno policies that have policy-intent/id labels
|
|
21
|
-
* PRD #
|
|
102
|
+
* PRD #359: Uses unified plugin registry
|
|
22
103
|
*/
|
|
23
|
-
export declare function findAllKyvernoPoliciesForPolicyIntents(logger: Logger, requestId: string
|
|
104
|
+
export declare function findAllKyvernoPoliciesForPolicyIntents(logger: Logger, requestId: string): Promise<Array<KyvernoPolicyInfo & {
|
|
105
|
+
policyId?: string;
|
|
106
|
+
}>>;
|
|
24
107
|
/**
|
|
25
108
|
* Delete Kyverno policies by policy intent ID using label selector
|
|
26
|
-
* PRD #
|
|
109
|
+
* PRD #359: Uses unified plugin registry
|
|
27
110
|
*/
|
|
28
|
-
export declare function deleteKyvernoPoliciesByPolicyId(policyId: string, logger: Logger, requestId: string
|
|
111
|
+
export declare function deleteKyvernoPoliciesByPolicyId(policyId: string, logger: Logger, requestId: string): Promise<KyvernoDeleteResult>;
|
|
29
112
|
/**
|
|
30
113
|
* Delete all Kyverno policies that have policy-intent/id labels
|
|
31
|
-
* PRD #
|
|
114
|
+
* PRD #359: Uses unified plugin registry
|
|
32
115
|
*/
|
|
33
|
-
export declare function deleteAllKyvernoPoliciesForPolicyIntents(logger: Logger, requestId: string
|
|
116
|
+
export declare function deleteAllKyvernoPoliciesForPolicyIntents(logger: Logger, requestId: string): Promise<KyvernoDeleteResult>;
|
|
34
117
|
/**
|
|
35
118
|
* Handle individual policy delete with Kyverno cleanup
|
|
36
|
-
* PRD #
|
|
119
|
+
* PRD #359: Uses unified plugin registry
|
|
37
120
|
*/
|
|
38
|
-
export declare function handlePolicyDelete(policyId: string, policyService:
|
|
121
|
+
export declare function handlePolicyDelete(policyId: string, policyService: PolicyVectorService, args: PolicyDeleteArgs, logger: Logger, requestId: string): Promise<PolicyOperationResult>;
|
|
39
122
|
/**
|
|
40
123
|
* Handle deleteAll policies with batch Kyverno cleanup
|
|
41
|
-
* PRD #
|
|
124
|
+
* PRD #359: Uses unified plugin registry
|
|
42
125
|
*/
|
|
43
|
-
export declare function handlePolicyDeleteAll(policyService:
|
|
126
|
+
export declare function handlePolicyDeleteAll(policyService: PolicyVectorService, args: PolicyDeleteArgs & {
|
|
127
|
+
response?: string;
|
|
128
|
+
}, logger: Logger, requestId: string): Promise<PolicyOperationResult>;
|
|
44
129
|
/**
|
|
45
130
|
* Main policy operations handler - delegates to specific operation functions
|
|
46
131
|
* Requires shared validation utilities to be passed as parameters to avoid circular imports
|
|
47
|
-
* PRD #
|
|
132
|
+
* PRD #359: Uses unified plugin registry for kubectl operations
|
|
48
133
|
*/
|
|
49
|
-
export declare function handlePolicyOperation(operation: string, args:
|
|
50
|
-
|
|
51
|
-
error?: any;
|
|
52
|
-
}>, validateEmbeddingService: (logger: Logger, requestId: string) => Promise<{
|
|
53
|
-
success: boolean;
|
|
54
|
-
error?: any;
|
|
55
|
-
}>, pluginManager?: PluginManager): Promise<any>;
|
|
134
|
+
export declare function handlePolicyOperation(operation: string, args: PolicyOperationArgs, logger: Logger, requestId: string, validateVectorDBConnection: (vectorService: PolicyVectorService, logger: Logger, requestId: string) => Promise<ValidationCheckResult>, validateEmbeddingService: (logger: Logger, requestId: string) => Promise<ValidationCheckResult>): Promise<PolicyOperationResult>;
|
|
135
|
+
export {};
|
|
56
136
|
//# sourceMappingURL=policy-operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-operations.d.ts","sourceRoot":"","sources":["../../src/core/policy-operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA8C,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"policy-operations.d.ts","sourceRoot":"","sources":["../../src/core/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C,CAgRhC"}
|
|
@@ -16,12 +16,10 @@ exports.handlePolicyDeleteAll = handlePolicyDeleteAll;
|
|
|
16
16
|
exports.handlePolicyOperation = handlePolicyOperation;
|
|
17
17
|
const error_handling_1 = require("./error-handling");
|
|
18
18
|
const policy_vector_service_1 = require("./policy-vector-service");
|
|
19
|
-
const vector_db_service_1 = require("./vector-db-service");
|
|
20
19
|
const unified_creation_session_1 = require("./unified-creation-session");
|
|
20
|
+
const plugin_registry_1 = require("./plugin-registry");
|
|
21
21
|
const validation_1 = require("./constants/validation");
|
|
22
22
|
const constants_1 = require("./constants");
|
|
23
|
-
// Note: validateVectorDBConnection and validateEmbeddingService are shared utilities
|
|
24
|
-
// that remain in the main organizational-data.ts file as they're used by multiple domains
|
|
25
23
|
/**
|
|
26
24
|
* Get initialized policy service
|
|
27
25
|
*/
|
|
@@ -41,9 +39,10 @@ async function getPolicyService() {
|
|
|
41
39
|
/**
|
|
42
40
|
* Execute kubectl command via plugin
|
|
43
41
|
* PRD #343: All kubectl operations go through plugin
|
|
42
|
+
* PRD #359: Uses unified plugin registry
|
|
44
43
|
*/
|
|
45
|
-
async function executeKubectlViaPlugin(
|
|
46
|
-
const response = await
|
|
44
|
+
async function executeKubectlViaPlugin(args) {
|
|
45
|
+
const response = await (0, plugin_registry_1.invokePluginTool)('agentic-tools', 'kubectl_exec_command', { args });
|
|
47
46
|
if (response.success) {
|
|
48
47
|
if (typeof response.result === 'object' && response.result !== null) {
|
|
49
48
|
const result = response.result;
|
|
@@ -68,15 +67,15 @@ async function executeKubectlViaPlugin(pluginManager, args) {
|
|
|
68
67
|
}
|
|
69
68
|
/**
|
|
70
69
|
* Find Kyverno policies by policy intent ID using label selector
|
|
71
|
-
* PRD #
|
|
70
|
+
* PRD #359: Uses unified plugin registry
|
|
72
71
|
*/
|
|
73
|
-
async function findKyvernoPoliciesByPolicyId(policyId, logger, requestId
|
|
72
|
+
async function findKyvernoPoliciesByPolicyId(policyId, logger, requestId) {
|
|
74
73
|
try {
|
|
75
74
|
logger.info('Searching for Kyverno policies by policy ID', {
|
|
76
75
|
requestId,
|
|
77
76
|
policyId
|
|
78
77
|
});
|
|
79
|
-
const output = await executeKubectlViaPlugin(
|
|
78
|
+
const output = await executeKubectlViaPlugin(['get', 'clusterpolicy', '-l', `policy-intent/id=${policyId}`, '-o', 'json']);
|
|
80
79
|
const parsedOutput = JSON.parse(output || '{"items": []}');
|
|
81
80
|
const policies = parsedOutput.items || [];
|
|
82
81
|
logger.info('Found Kyverno policies for policy intent', {
|
|
@@ -86,7 +85,7 @@ async function findKyvernoPoliciesByPolicyId(policyId, logger, requestId, plugin
|
|
|
86
85
|
policyNames: policies.map((p) => p.metadata?.name)
|
|
87
86
|
});
|
|
88
87
|
return policies.map((p) => ({
|
|
89
|
-
name: p.metadata?.name,
|
|
88
|
+
name: p.metadata?.name || '',
|
|
90
89
|
labels: p.metadata?.labels,
|
|
91
90
|
creationTimestamp: p.metadata?.creationTimestamp
|
|
92
91
|
}));
|
|
@@ -102,14 +101,14 @@ async function findKyvernoPoliciesByPolicyId(policyId, logger, requestId, plugin
|
|
|
102
101
|
}
|
|
103
102
|
/**
|
|
104
103
|
* Find all Kyverno policies that have policy-intent/id labels
|
|
105
|
-
* PRD #
|
|
104
|
+
* PRD #359: Uses unified plugin registry
|
|
106
105
|
*/
|
|
107
|
-
async function findAllKyvernoPoliciesForPolicyIntents(logger, requestId
|
|
106
|
+
async function findAllKyvernoPoliciesForPolicyIntents(logger, requestId) {
|
|
108
107
|
try {
|
|
109
108
|
logger.info('Searching for all Kyverno policies with policy-intent labels', {
|
|
110
109
|
requestId
|
|
111
110
|
});
|
|
112
|
-
const output = await executeKubectlViaPlugin(
|
|
111
|
+
const output = await executeKubectlViaPlugin(['get', 'clusterpolicy', '-l', 'policy-intent/id', '-o', 'json']);
|
|
113
112
|
const parsedOutput = JSON.parse(output || '{"items": []}');
|
|
114
113
|
const policies = parsedOutput.items || [];
|
|
115
114
|
logger.info('Found all Kyverno policies for policy intents', {
|
|
@@ -118,7 +117,7 @@ async function findAllKyvernoPoliciesForPolicyIntents(logger, requestId, pluginM
|
|
|
118
117
|
policyNames: policies.map((p) => p.metadata?.name)
|
|
119
118
|
});
|
|
120
119
|
return policies.map((p) => ({
|
|
121
|
-
name: p.metadata?.name,
|
|
120
|
+
name: p.metadata?.name || '',
|
|
122
121
|
policyId: p.metadata?.labels?.['policy-intent/id'],
|
|
123
122
|
labels: p.metadata?.labels,
|
|
124
123
|
creationTimestamp: p.metadata?.creationTimestamp
|
|
@@ -134,15 +133,15 @@ async function findAllKyvernoPoliciesForPolicyIntents(logger, requestId, pluginM
|
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
136
135
|
* Delete Kyverno policies by policy intent ID using label selector
|
|
137
|
-
* PRD #
|
|
136
|
+
* PRD #359: Uses unified plugin registry
|
|
138
137
|
*/
|
|
139
|
-
async function deleteKyvernoPoliciesByPolicyId(policyId, logger, requestId
|
|
138
|
+
async function deleteKyvernoPoliciesByPolicyId(policyId, logger, requestId) {
|
|
140
139
|
try {
|
|
141
140
|
logger.info('Deleting Kyverno policies by policy ID', {
|
|
142
141
|
requestId,
|
|
143
142
|
policyId
|
|
144
143
|
});
|
|
145
|
-
const output = await executeKubectlViaPlugin(
|
|
144
|
+
const output = await executeKubectlViaPlugin(['delete', 'clusterpolicy', '-l', `policy-intent/id=${policyId}`]);
|
|
146
145
|
logger.info('Kyverno policies deleted successfully', {
|
|
147
146
|
requestId,
|
|
148
147
|
policyId,
|
|
@@ -169,14 +168,14 @@ async function deleteKyvernoPoliciesByPolicyId(policyId, logger, requestId, plug
|
|
|
169
168
|
}
|
|
170
169
|
/**
|
|
171
170
|
* Delete all Kyverno policies that have policy-intent/id labels
|
|
172
|
-
* PRD #
|
|
171
|
+
* PRD #359: Uses unified plugin registry
|
|
173
172
|
*/
|
|
174
|
-
async function deleteAllKyvernoPoliciesForPolicyIntents(logger, requestId
|
|
173
|
+
async function deleteAllKyvernoPoliciesForPolicyIntents(logger, requestId) {
|
|
175
174
|
try {
|
|
176
175
|
logger.info('Deleting all Kyverno policies with policy-intent labels', {
|
|
177
176
|
requestId
|
|
178
177
|
});
|
|
179
|
-
const output = await executeKubectlViaPlugin(
|
|
178
|
+
const output = await executeKubectlViaPlugin(['delete', 'clusterpolicy', '-l', 'policy-intent/id']);
|
|
180
179
|
logger.info('All Kyverno policies deleted successfully', {
|
|
181
180
|
requestId,
|
|
182
181
|
output
|
|
@@ -201,9 +200,9 @@ async function deleteAllKyvernoPoliciesForPolicyIntents(logger, requestId, plugi
|
|
|
201
200
|
}
|
|
202
201
|
/**
|
|
203
202
|
* Handle individual policy delete with Kyverno cleanup
|
|
204
|
-
* PRD #
|
|
203
|
+
* PRD #359: Uses unified plugin registry
|
|
205
204
|
*/
|
|
206
|
-
async function handlePolicyDelete(policyId, policyService, args, logger, requestId
|
|
205
|
+
async function handlePolicyDelete(policyId, policyService, args, logger, requestId) {
|
|
207
206
|
try {
|
|
208
207
|
// Check if policy intent exists
|
|
209
208
|
const existingPolicyIntent = await policyService.getPolicyIntent(policyId);
|
|
@@ -217,7 +216,7 @@ async function handlePolicyDelete(policyId, policyService, args, logger, request
|
|
|
217
216
|
};
|
|
218
217
|
}
|
|
219
218
|
// Check if there are deployed Kyverno policies with this policy ID
|
|
220
|
-
const kyvernoPolicies = await findKyvernoPoliciesByPolicyId(policyId, logger, requestId
|
|
219
|
+
const kyvernoPolicies = await findKyvernoPoliciesByPolicyId(policyId, logger, requestId);
|
|
221
220
|
if (kyvernoPolicies.length > 0 && !args.response) {
|
|
222
221
|
// Show confirmation prompt for Kyverno cleanup
|
|
223
222
|
return {
|
|
@@ -240,7 +239,7 @@ async function handlePolicyDelete(policyId, policyService, args, logger, request
|
|
|
240
239
|
const response = args.response.trim();
|
|
241
240
|
if (response === '1' || response.toLowerCase().includes('delete everything')) {
|
|
242
241
|
// Delete Kyverno policies from cluster
|
|
243
|
-
kyvernoCleanupResults = await deleteKyvernoPoliciesByPolicyId(policyId, logger, requestId
|
|
242
|
+
kyvernoCleanupResults = await deleteKyvernoPoliciesByPolicyId(policyId, logger, requestId);
|
|
244
243
|
}
|
|
245
244
|
}
|
|
246
245
|
// Always delete the policy intent from Vector DB
|
|
@@ -272,9 +271,9 @@ async function handlePolicyDelete(policyId, policyService, args, logger, request
|
|
|
272
271
|
}
|
|
273
272
|
/**
|
|
274
273
|
* Handle deleteAll policies with batch Kyverno cleanup
|
|
275
|
-
* PRD #
|
|
274
|
+
* PRD #359: Uses unified plugin registry
|
|
276
275
|
*/
|
|
277
|
-
async function handlePolicyDeleteAll(policyService, args, logger,
|
|
276
|
+
async function handlePolicyDeleteAll(policyService, args, logger, requestId) {
|
|
278
277
|
try {
|
|
279
278
|
// Get all policy intents
|
|
280
279
|
const allPolicyIntents = await policyService.getAllPolicyIntents();
|
|
@@ -288,7 +287,7 @@ async function handlePolicyDeleteAll(policyService, args, logger, pluginManager,
|
|
|
288
287
|
};
|
|
289
288
|
}
|
|
290
289
|
// Find all deployed Kyverno policies for all policy intents
|
|
291
|
-
const allKyvernoPolicies = await findAllKyvernoPoliciesForPolicyIntents(logger, requestId
|
|
290
|
+
const allKyvernoPolicies = await findAllKyvernoPoliciesForPolicyIntents(logger, requestId);
|
|
292
291
|
if (allKyvernoPolicies.length > 0 && !args.response) {
|
|
293
292
|
// Show confirmation prompt for batch Kyverno cleanup
|
|
294
293
|
return {
|
|
@@ -311,7 +310,7 @@ async function handlePolicyDeleteAll(policyService, args, logger, pluginManager,
|
|
|
311
310
|
const response = args.response.trim();
|
|
312
311
|
if (response === '1' || response.toLowerCase().includes('delete everything')) {
|
|
313
312
|
// Delete all Kyverno policies from cluster
|
|
314
|
-
kyvernoCleanupResults = await deleteAllKyvernoPoliciesForPolicyIntents(logger, requestId
|
|
313
|
+
kyvernoCleanupResults = await deleteAllKyvernoPoliciesForPolicyIntents(logger, requestId);
|
|
315
314
|
}
|
|
316
315
|
}
|
|
317
316
|
// Always delete all policy intents from Vector DB
|
|
@@ -347,9 +346,9 @@ async function handlePolicyDeleteAll(policyService, args, logger, pluginManager,
|
|
|
347
346
|
/**
|
|
348
347
|
* Main policy operations handler - delegates to specific operation functions
|
|
349
348
|
* Requires shared validation utilities to be passed as parameters to avoid circular imports
|
|
350
|
-
* PRD #
|
|
349
|
+
* PRD #359: Uses unified plugin registry for kubectl operations
|
|
351
350
|
*/
|
|
352
|
-
async function handlePolicyOperation(operation, args, logger, requestId, validateVectorDBConnection, validateEmbeddingService
|
|
351
|
+
async function handlePolicyOperation(operation, args, logger, requestId, validateVectorDBConnection, validateEmbeddingService) {
|
|
353
352
|
// Get policy service and validate Vector DB connection
|
|
354
353
|
const policyService = await getPolicyService();
|
|
355
354
|
const connectionCheck = await validateVectorDBConnection(policyService, logger, requestId);
|
|
@@ -376,7 +375,7 @@ async function handlePolicyOperation(operation, args, logger, requestId, validat
|
|
|
376
375
|
};
|
|
377
376
|
}
|
|
378
377
|
}
|
|
379
|
-
const sessionManager = new unified_creation_session_1.UnifiedCreationSessionManager('policy'
|
|
378
|
+
const sessionManager = new unified_creation_session_1.UnifiedCreationSessionManager('policy');
|
|
380
379
|
switch (operation) {
|
|
381
380
|
case 'create': {
|
|
382
381
|
let workflowStep;
|
|
@@ -388,12 +387,12 @@ async function handlePolicyOperation(operation, args, logger, requestId, validat
|
|
|
388
387
|
});
|
|
389
388
|
if (args.response) {
|
|
390
389
|
// Process user response and move to next step
|
|
391
|
-
const updatedSession = sessionManager.processResponse(args.sessionId, args.response
|
|
390
|
+
const updatedSession = sessionManager.processResponse(args.sessionId, args.response);
|
|
392
391
|
workflowStep = await sessionManager.getNextWorkflowStep(updatedSession, args);
|
|
393
392
|
}
|
|
394
393
|
else {
|
|
395
394
|
// Just get current step without processing response
|
|
396
|
-
const session = sessionManager.loadSession(args.sessionId
|
|
395
|
+
const session = sessionManager.loadSession(args.sessionId);
|
|
397
396
|
if (!session) {
|
|
398
397
|
throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.VALIDATION, error_handling_1.ErrorSeverity.HIGH, `Session not found: ${args.sessionId}`, {
|
|
399
398
|
operation: 'policy_workflow_continue',
|
|
@@ -429,27 +428,26 @@ async function handlePolicyOperation(operation, args, logger, requestId, validat
|
|
|
429
428
|
// Always check if workflow is complete and store policy in Vector DB
|
|
430
429
|
let storageInfo = {};
|
|
431
430
|
const isComplete = !('nextStep' in workflowStep) || !workflowStep.nextStep; // Complete when no next step
|
|
432
|
-
const
|
|
431
|
+
const workflowData = workflowStep.data;
|
|
432
|
+
const hasPolicy = !!workflowData?.policy;
|
|
433
433
|
logger.info('Checking workflow completion', {
|
|
434
434
|
requestId,
|
|
435
435
|
nextStep: ('nextStep' in workflowStep) ? workflowStep.nextStep : 'complete',
|
|
436
436
|
hasPolicy,
|
|
437
|
-
policyId:
|
|
437
|
+
policyId: workflowData?.policy?.id
|
|
438
438
|
});
|
|
439
439
|
if (isComplete && hasPolicy) {
|
|
440
440
|
try {
|
|
441
|
-
await policyService.storePolicyIntent(
|
|
442
|
-
const vectorDBConfig = new vector_db_service_1.VectorDBService({ collectionName: 'policies' }).getConfig();
|
|
441
|
+
await policyService.storePolicyIntent(workflowData.policy);
|
|
443
442
|
storageInfo = {
|
|
444
443
|
stored: true,
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
policyId: workflowStep.data.policy.id
|
|
444
|
+
collectionName: 'policies',
|
|
445
|
+
policyId: workflowData.policy.id
|
|
448
446
|
};
|
|
449
447
|
logger.info('Policy stored in Vector DB successfully', {
|
|
450
448
|
requestId,
|
|
451
|
-
policyId:
|
|
452
|
-
description:
|
|
449
|
+
policyId: workflowData.policy.id,
|
|
450
|
+
description: workflowData.policy.description.substring(0, 50) + (workflowData.policy.description.length > 50 ? '...' : '')
|
|
453
451
|
});
|
|
454
452
|
}
|
|
455
453
|
catch (error) {
|
|
@@ -457,11 +455,11 @@ async function handlePolicyOperation(operation, args, logger, requestId, validat
|
|
|
457
455
|
storageInfo = {
|
|
458
456
|
stored: false,
|
|
459
457
|
error: errorMessage,
|
|
460
|
-
policyId:
|
|
458
|
+
policyId: workflowData.policy.id
|
|
461
459
|
};
|
|
462
460
|
logger.error('Failed to store policy in Vector DB', error instanceof Error ? error : new Error(String(error)), {
|
|
463
461
|
requestId,
|
|
464
|
-
policyId:
|
|
462
|
+
policyId: workflowData.policy.id
|
|
465
463
|
});
|
|
466
464
|
}
|
|
467
465
|
}
|
|
@@ -556,16 +554,16 @@ async function handlePolicyOperation(operation, args, logger, requestId, validat
|
|
|
556
554
|
error: validation_1.VALIDATION_MESSAGES.MISSING_PARAMETER('id')
|
|
557
555
|
};
|
|
558
556
|
}
|
|
559
|
-
if (!
|
|
557
|
+
if (!(0, plugin_registry_1.isPluginInitialized)()) {
|
|
560
558
|
throw new Error('Plugin system not available. Policy delete requires agentic-tools plugin for kubectl operations.');
|
|
561
559
|
}
|
|
562
|
-
return await handlePolicyDelete(args.id, policyService, args, logger, requestId
|
|
560
|
+
return await handlePolicyDelete(args.id, policyService, args, logger, requestId);
|
|
563
561
|
}
|
|
564
562
|
case 'deleteAll': {
|
|
565
|
-
if (!
|
|
563
|
+
if (!(0, plugin_registry_1.isPluginInitialized)()) {
|
|
566
564
|
throw new Error('Plugin system not available. Policy deleteAll requires agentic-tools plugin for kubectl operations.');
|
|
567
565
|
}
|
|
568
|
-
return await handlePolicyDeleteAll(policyService, args, logger,
|
|
566
|
+
return await handlePolicyDeleteAll(policyService, args, logger, requestId);
|
|
569
567
|
}
|
|
570
568
|
default:
|
|
571
569
|
return {
|