@vfarcic/dot-ai 1.23.1 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +0 -5
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -11
- package/dist/core/knowledge-migration.d.ts +30 -0
- package/dist/core/knowledge-migration.d.ts.map +1 -0
- package/dist/core/knowledge-migration.js +289 -0
- package/dist/core/knowledge-service.d.ts +46 -0
- package/dist/core/knowledge-service.d.ts.map +1 -0
- package/dist/core/knowledge-service.js +185 -0
- package/dist/core/knowledge-types.d.ts +14 -0
- package/dist/core/knowledge-types.d.ts.map +1 -1
- package/dist/core/schema.d.ts +13 -12
- package/dist/core/schema.d.ts.map +1 -1
- package/dist/core/schema.js +105 -170
- package/dist/core/user-prompts-loader.d.ts.map +1 -1
- package/dist/core/user-prompts-loader.js +13 -6
- package/dist/interfaces/rest-api.d.ts.map +1 -1
- package/dist/interfaces/rest-api.js +7 -6
- package/dist/mcp/server.js +12 -0
- package/dist/tools/manage-knowledge.d.ts +0 -22
- package/dist/tools/manage-knowledge.d.ts.map +1 -1
- package/dist/tools/manage-knowledge.js +71 -131
- package/dist/tools/operate-analysis.d.ts.map +1 -1
- package/dist/tools/operate-analysis.js +7 -6
- package/dist/tools/operate.d.ts +23 -11
- package/dist/tools/operate.d.ts.map +1 -1
- package/dist/tools/operate.js +40 -58
- package/dist/tools/organizational-data.d.ts +5 -8
- package/dist/tools/organizational-data.d.ts.map +1 -1
- package/dist/tools/organizational-data.js +19 -74
- package/dist/tools/query.d.ts +17 -0
- package/dist/tools/query.d.ts.map +1 -1
- package/dist/tools/query.js +36 -1
- package/dist/tools/version.d.ts +1 -12
- package/dist/tools/version.d.ts.map +1 -1
- package/dist/tools/version.js +10 -19
- package/package.json +2 -2
- package/prompts/knowledge-classification.md +24 -0
- package/prompts/operate-user.md +7 -8
- package/dist/core/organizational-types.d.ts +0 -43
- package/dist/core/organizational-types.d.ts.map +0 -1
- package/dist/core/organizational-types.js +0 -8
- package/dist/core/pattern-operations.d.ts +0 -50
- package/dist/core/pattern-operations.d.ts.map +0 -1
- package/dist/core/pattern-operations.js +0 -445
- package/dist/core/pattern-types.d.ts +0 -8
- package/dist/core/pattern-types.d.ts.map +0 -1
- package/dist/core/pattern-types.js +0 -8
- package/dist/core/pattern-vector-service.d.ts +0 -27
- package/dist/core/pattern-vector-service.d.ts.map +0 -1
- package/dist/core/pattern-vector-service.js +0 -65
- package/dist/core/policy-operations.d.ts +0 -136
- package/dist/core/policy-operations.d.ts.map +0 -1
- package/dist/core/policy-operations.js +0 -623
- package/dist/core/policy-vector-service.d.ts +0 -27
- package/dist/core/policy-vector-service.d.ts.map +0 -1
- package/dist/core/policy-vector-service.js +0 -64
- package/dist/core/unified-creation-session.d.ts +0 -88
- package/dist/core/unified-creation-session.d.ts.map +0 -1
- package/dist/core/unified-creation-session.js +0 -948
- package/dist/core/unified-creation-types.d.ts +0 -68
- package/dist/core/unified-creation-types.d.ts.map +0 -1
- package/dist/core/unified-creation-types.js +0 -61
|
@@ -11,23 +11,19 @@ import { z } from 'zod';
|
|
|
11
11
|
import { DotAI } from '../core/index';
|
|
12
12
|
import { Logger } from '../core/error-handling';
|
|
13
13
|
export declare const ORGANIZATIONAL_DATA_TOOL_NAME = "manageOrgData";
|
|
14
|
-
export declare const ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = "
|
|
14
|
+
export declare const ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = "Tool for managing cluster resource capabilities. Supports scan, list, get, search, delete, deleteAll, and progress operations for cluster resource capability discovery and management. Use dataType=\"capabilities\" to manage cluster capabilities. NOTE: Organizational patterns and policies are now managed via manageKnowledge tool (ingest documents, search, deleteByUri) with automatic AI classification.";
|
|
15
15
|
export declare const ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA: {
|
|
16
16
|
dataType: z.ZodEnum<{
|
|
17
17
|
capabilities: "capabilities";
|
|
18
|
-
pattern: "pattern";
|
|
19
|
-
policy: "policy";
|
|
20
18
|
}>;
|
|
21
19
|
operation: z.ZodEnum<{
|
|
22
20
|
search: "search";
|
|
23
21
|
get: "get";
|
|
24
22
|
progress: "progress";
|
|
25
23
|
list: "list";
|
|
26
|
-
create: "create";
|
|
27
24
|
delete: "delete";
|
|
28
25
|
deleteAll: "deleteAll";
|
|
29
26
|
scan: "scan";
|
|
30
|
-
analyze: "analyze";
|
|
31
27
|
}>;
|
|
32
28
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
33
29
|
step: z.ZodOptional<z.ZodString>;
|
|
@@ -47,11 +43,12 @@ export declare const ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA: {
|
|
|
47
43
|
interaction_id: z.ZodOptional<z.ZodString>;
|
|
48
44
|
};
|
|
49
45
|
/**
|
|
50
|
-
* Input type for organizational data tool
|
|
46
|
+
* Input type for organizational data tool.
|
|
47
|
+
* PRD #375: dataType is now capabilities-only (pattern/policy moved to manageKnowledge).
|
|
51
48
|
*/
|
|
52
49
|
export interface OrganizationalDataInput {
|
|
53
|
-
dataType: '
|
|
54
|
-
operation: '
|
|
50
|
+
dataType: 'capabilities';
|
|
51
|
+
operation: 'list' | 'get' | 'delete' | 'deleteAll' | 'scan' | 'progress' | 'search';
|
|
55
52
|
sessionId?: string;
|
|
56
53
|
step?: string;
|
|
57
54
|
response?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"organizational-data.d.ts","sourceRoot":"","sources":["../../src/tools/organizational-data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAA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AL_DATA_TOOL
|
|
|
46
46
|
exports.handleOrganizationalDataTool = handleOrganizationalDataTool;
|
|
47
47
|
const zod_1 = require("zod");
|
|
48
48
|
const error_handling_1 = require("../core/error-handling");
|
|
49
|
-
const constants_1 = require("../core/constants");
|
|
50
|
-
// Import only what we need - other imports removed as they're no longer used with Vector DB
|
|
51
49
|
const index_1 = require("../core/index");
|
|
52
50
|
const session_utils_1 = require("../core/session-utils");
|
|
53
|
-
const embedding_service_1 = require("../core/embedding-service");
|
|
54
|
-
const policy_operations_1 = require("../core/policy-operations");
|
|
55
|
-
const pattern_operations_1 = require("../core/pattern-operations");
|
|
56
51
|
const capability_operations_1 = require("../core/capability-operations");
|
|
57
52
|
const capability_scan_workflow_1 = require("../core/capability-scan-workflow");
|
|
58
53
|
const crypto_1 = require("crypto");
|
|
@@ -61,18 +56,21 @@ const path = __importStar(require("path"));
|
|
|
61
56
|
const request_context_1 = require("../interfaces/request-context");
|
|
62
57
|
const rbac_1 = require("../core/rbac");
|
|
63
58
|
// Tool metadata for MCP registration
|
|
59
|
+
// PRD #375: Unified Knowledge Base — pattern and policy operations removed.
|
|
60
|
+
// Organizational knowledge is now managed via manageKnowledge (ingest/search/deleteByUri).
|
|
61
|
+
// This tool is now capabilities-only.
|
|
64
62
|
exports.ORGANIZATIONAL_DATA_TOOL_NAME = 'manageOrgData';
|
|
65
|
-
exports.ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = '
|
|
66
|
-
//
|
|
63
|
+
exports.ORGANIZATIONAL_DATA_TOOL_DESCRIPTION = 'Tool for managing cluster resource capabilities. Supports scan, list, get, search, delete, deleteAll, and progress operations for cluster resource capability discovery and management. Use dataType="capabilities" to manage cluster capabilities. NOTE: Organizational patterns and policies are now managed via manageKnowledge tool (ingest documents, search, deleteByUri) with automatic AI classification.';
|
|
64
|
+
// Schema - capabilities only (PRD #375: pattern/policy removed from this tool)
|
|
67
65
|
exports.ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA = {
|
|
68
|
-
dataType: zod_1.z.enum(['
|
|
69
|
-
operation: zod_1.z.enum(['
|
|
70
|
-
// Workflow fields for step-by-step
|
|
66
|
+
dataType: zod_1.z.enum(['capabilities']).describe('Type of cluster data to manage: "capabilities" for resource capabilities. (Note: organizational knowledge/patterns/policies are managed via manageKnowledge tool)'),
|
|
67
|
+
operation: zod_1.z.enum(['list', 'get', 'delete', 'deleteAll', 'scan', 'progress', 'search']).describe('Operation to perform on the cluster data'),
|
|
68
|
+
// Workflow fields for step-by-step capability scanning
|
|
71
69
|
sessionId: zod_1.z.string().optional().describe('Session ID (required for continuing workflow steps, optional for progress - uses latest session if omitted)'),
|
|
72
70
|
step: zod_1.z.string().optional().describe('Current workflow step (required when sessionId is provided)'),
|
|
73
71
|
response: zod_1.z.string().optional().describe('User response to previous workflow step question'),
|
|
74
72
|
// Generic fields for get/delete/search operations
|
|
75
|
-
id: zod_1.z.string().optional().describe('
|
|
73
|
+
id: zod_1.z.string().optional().describe('Capability ID (required for get/delete operations) or search query (required for search operations)'),
|
|
76
74
|
// Generic fields for list operations
|
|
77
75
|
limit: zod_1.z.number().optional().describe('Maximum number of items to return (default: 10)'),
|
|
78
76
|
// Resource-specific fields (for capabilities operations)
|
|
@@ -89,46 +87,15 @@ exports.ORGANIZATIONAL_DATA_TOOL_INPUT_SCHEMA = {
|
|
|
89
87
|
collection: zod_1.z.string().optional().describe('Collection name for capabilities operations (default: "capabilities", use "capabilities-policies" for pre-populated test data)'),
|
|
90
88
|
interaction_id: zod_1.z.string().optional().describe('INTERNAL ONLY - Do not populate. Used for evaluation dataset generation.')
|
|
91
89
|
};
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
async function validateVectorDBConnection(vectorService, logger, requestId) {
|
|
96
|
-
const isHealthy = await vectorService.healthCheck();
|
|
97
|
-
if (!isHealthy) {
|
|
98
|
-
logger.warn('Vector DB connection not available', { requestId });
|
|
99
|
-
return {
|
|
100
|
-
success: false,
|
|
101
|
-
error: {
|
|
102
|
-
message: 'Vector DB connection required for pattern management',
|
|
103
|
-
details: 'Pattern management requires a Qdrant Vector Database connection to store and search organizational patterns.',
|
|
104
|
-
setup: {
|
|
105
|
-
selfHosted: {
|
|
106
|
-
docker: 'docker run -d -p 6333:6333 --name qdrant qdrant/qdrant',
|
|
107
|
-
environment: 'export QDRANT_URL=http://localhost:6333'
|
|
108
|
-
},
|
|
109
|
-
saas: {
|
|
110
|
-
signup: 'Sign up at https://cloud.qdrant.io',
|
|
111
|
-
environment: [
|
|
112
|
-
'export QDRANT_URL=https://your-cluster.aws.cloud.qdrant.io:6333',
|
|
113
|
-
'export QDRANT_API_KEY=your-api-key-from-dashboard'
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
docs: 'See documentation for detailed setup instructions'
|
|
117
|
-
},
|
|
118
|
-
currentConfig: {
|
|
119
|
-
QDRANT_URL: process.env.QDRANT_URL || 'not set (defaults to http://localhost:6333)',
|
|
120
|
-
QDRANT_API_KEY: process.env.QDRANT_API_KEY ? 'set' : 'not set (optional)'
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
return { success: true };
|
|
126
|
-
}
|
|
90
|
+
// PRD #375: validateVectorDBConnection and pattern/policy operations removed.
|
|
91
|
+
// Pattern/policy operations moved to manageKnowledge tool.
|
|
92
|
+
// Capabilities operations still use validateEmbeddingService below.
|
|
127
93
|
/**
|
|
128
94
|
* Validate embedding service configuration and fail if unavailable
|
|
129
95
|
*/
|
|
130
96
|
async function validateEmbeddingService(logger, requestId) {
|
|
131
|
-
const
|
|
97
|
+
const { EmbeddingService } = await Promise.resolve().then(() => __importStar(require('../core/index')));
|
|
98
|
+
const embeddingService = new EmbeddingService();
|
|
132
99
|
const status = embeddingService.getStatus();
|
|
133
100
|
if (!status.available) {
|
|
134
101
|
logger.warn('Embedding service required but not available', {
|
|
@@ -138,31 +105,16 @@ async function validateEmbeddingService(logger, requestId) {
|
|
|
138
105
|
return {
|
|
139
106
|
success: false,
|
|
140
107
|
error: {
|
|
141
|
-
message:
|
|
142
|
-
details: '
|
|
108
|
+
message: 'OpenAI API required for capability management',
|
|
109
|
+
details: 'Capability scanning requires OpenAI embeddings for semantic search and storage.',
|
|
143
110
|
reason: status.reason,
|
|
144
|
-
setup: {
|
|
145
|
-
required: 'export OPENAI_API_KEY=your-openai-api-key',
|
|
146
|
-
optional: [
|
|
147
|
-
'export OPENAI_MODEL=text-embedding-3-small (default)',
|
|
148
|
-
'export OPENAI_DIMENSIONS=1536 (default)'
|
|
149
|
-
],
|
|
150
|
-
docs: 'Get API key from https://platform.openai.com/api-keys'
|
|
151
|
-
},
|
|
152
111
|
currentConfig: {
|
|
153
112
|
OPENAI_API_KEY: process.env.OPENAI_API_KEY ? 'set' : 'not set',
|
|
154
113
|
QDRANT_URL: process.env.QDRANT_URL || 'http://localhost:6333',
|
|
155
|
-
status: constants_1.AI_SERVICE_ERROR_TEMPLATES.EMBEDDING_SERVICE_UNAVAILABLE
|
|
156
114
|
}
|
|
157
115
|
}
|
|
158
116
|
};
|
|
159
117
|
}
|
|
160
|
-
logger.info('Embedding service available', {
|
|
161
|
-
requestId,
|
|
162
|
-
provider: status.provider,
|
|
163
|
-
model: status.model,
|
|
164
|
-
dimensions: status.dimensions
|
|
165
|
-
});
|
|
166
118
|
return { success: true };
|
|
167
119
|
}
|
|
168
120
|
/**
|
|
@@ -696,25 +648,18 @@ async function handleOrganizationalDataTool(args, _dotAI, logger, requestId) {
|
|
|
696
648
|
}
|
|
697
649
|
}
|
|
698
650
|
// Route to appropriate handler based on data type
|
|
651
|
+
// PRD #375: capabilities only — pattern/policy moved to manageKnowledge
|
|
699
652
|
let result;
|
|
700
653
|
switch (args.dataType) {
|
|
701
|
-
case 'pattern':
|
|
702
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Args and validation function type compatibility between modules
|
|
703
|
-
result = await (0, pattern_operations_1.handlePatternOperation)(args.operation, args, logger, requestId, validateVectorDBConnection, validateEmbeddingService);
|
|
704
|
-
break;
|
|
705
|
-
case 'policy':
|
|
706
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Args and validation function type compatibility between modules
|
|
707
|
-
result = await (0, policy_operations_1.handlePolicyOperation)(args.operation, args, logger, requestId, validateVectorDBConnection, validateEmbeddingService);
|
|
708
|
-
break;
|
|
709
654
|
case 'capabilities':
|
|
710
655
|
result = await handleCapabilitiesOperation(args.operation, args, logger, requestId);
|
|
711
656
|
break;
|
|
712
657
|
default:
|
|
713
|
-
throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.VALIDATION, error_handling_1.ErrorSeverity.HIGH, `Unsupported data type: ${args.dataType}.
|
|
658
|
+
throw error_handling_1.ErrorHandler.createError(error_handling_1.ErrorCategory.VALIDATION, error_handling_1.ErrorSeverity.HIGH, `Unsupported data type: ${args.dataType}. Supported: capabilities. NOTE: Organizational knowledge (patterns, policies) is managed via manageKnowledge tool.`, {
|
|
714
659
|
operation: 'data_type_validation',
|
|
715
660
|
component: 'OrganizationalDataTool',
|
|
716
661
|
requestId,
|
|
717
|
-
input: { dataType: args.dataType, supportedTypes: ['
|
|
662
|
+
input: { dataType: args.dataType, supportedTypes: ['capabilities'] }
|
|
718
663
|
});
|
|
719
664
|
}
|
|
720
665
|
logger.info('Organizational-data tool request completed successfully', {
|
package/dist/tools/query.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* PRD #291: Cluster Query Tool - Natural Language Cluster Intelligence
|
|
8
8
|
*/
|
|
9
9
|
import { z } from 'zod';
|
|
10
|
+
import { Logger } from '../core/error-handling';
|
|
11
|
+
import type { AgenticResult } from '../core/ai-provider.interface';
|
|
10
12
|
import { PluginManager } from '../core/plugin-manager';
|
|
11
13
|
import { CachedVisualization } from '../core/visualization';
|
|
12
14
|
export declare const QUERY_TOOL_NAME = "query";
|
|
@@ -59,6 +61,21 @@ interface QueryToolArgs {
|
|
|
59
61
|
intent?: string;
|
|
60
62
|
interaction_id?: string;
|
|
61
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Bounded retry for the read-only query tool loop. A non-success status is a
|
|
66
|
+
* transient, retryable AI failure (the caller flags it isRetryable), so re-run
|
|
67
|
+
* the loop up to `maxAttempts` times — with a short backoff to avoid re-hammering
|
|
68
|
+
* the provider on rate-limit/overload — before surfacing the final result.
|
|
69
|
+
*
|
|
70
|
+
* Exported for unit testing. `backoffMs` is injectable so tests run without real
|
|
71
|
+
* delays; production uses exponential backoff with jitter, capped at 2s.
|
|
72
|
+
*/
|
|
73
|
+
export declare function runQueryLoopWithRetry(run: () => Promise<AgenticResult>, options: {
|
|
74
|
+
maxAttempts: number;
|
|
75
|
+
logger: Logger;
|
|
76
|
+
requestId: string;
|
|
77
|
+
backoffMs?: (attempt: number) => number;
|
|
78
|
+
}): Promise<AgenticResult>;
|
|
62
79
|
export declare function handleQueryTool(args: QueryToolArgs, pluginManager?: PluginManager): Promise<QueryOutput | {
|
|
63
80
|
content: Array<{
|
|
64
81
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/tools/query.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA6D,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE3G,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EAIL,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAK/B,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,sBA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EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;CACzC,GACA,OAAO,CAAC,aAAa,CAAC,CAsBxB;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,aAAa,EACnB,aAAa,CAAC,EAAE,aAAa,GAC5B,OAAO,CAAC,WAAW,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA6O3E"}
|
package/dist/tools/query.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.QUERY_TOOL_INPUT_SCHEMA = exports.QUERY_TOOL_DESCRIPTION = exports.QUERY_TOOL_NAME = void 0;
|
|
12
|
+
exports.runQueryLoopWithRetry = runQueryLoopWithRetry;
|
|
12
13
|
exports.handleQueryTool = handleQueryTool;
|
|
13
14
|
const zod_1 = require("zod");
|
|
14
15
|
const error_handling_1 = require("../core/error-handling");
|
|
@@ -82,6 +83,30 @@ function parseSummary(aiResponse) {
|
|
|
82
83
|
return aiResponse.trim() || 'No summary provided';
|
|
83
84
|
}
|
|
84
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Bounded retry for the read-only query tool loop. A non-success status is a
|
|
88
|
+
* transient, retryable AI failure (the caller flags it isRetryable), so re-run
|
|
89
|
+
* the loop up to `maxAttempts` times — with a short backoff to avoid re-hammering
|
|
90
|
+
* the provider on rate-limit/overload — before surfacing the final result.
|
|
91
|
+
*
|
|
92
|
+
* Exported for unit testing. `backoffMs` is injectable so tests run without real
|
|
93
|
+
* delays; production uses exponential backoff with jitter, capped at 2s.
|
|
94
|
+
*/
|
|
95
|
+
async function runQueryLoopWithRetry(run, options) {
|
|
96
|
+
const { maxAttempts, logger, requestId, backoffMs } = options;
|
|
97
|
+
const delayFor = backoffMs
|
|
98
|
+
?? ((attempt) => Math.min(2000, 250 * 2 ** (attempt - 1)) + Math.floor(Math.random() * 250));
|
|
99
|
+
let result = await run();
|
|
100
|
+
for (let attempt = 1; attempt < maxAttempts && result.status && result.status !== 'success'; attempt++) {
|
|
101
|
+
const delay = delayFor(attempt);
|
|
102
|
+
logger.warn(`Query tool loop returned status '${result.status}' — retrying in ${delay}ms (attempt ${attempt + 1}/${maxAttempts})`, { requestId, finalMessage: result.finalMessage });
|
|
103
|
+
if (delay > 0) {
|
|
104
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
105
|
+
}
|
|
106
|
+
result = await run();
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
85
110
|
async function handleQueryTool(args, pluginManager) {
|
|
86
111
|
const requestId = `query_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
|
|
87
112
|
const logger = new error_handling_1.ConsoleLogger('QueryTool');
|
|
@@ -155,7 +180,12 @@ async function handleQueryTool(args, pluginManager) {
|
|
|
155
180
|
? [...capability_tools_1.CAPABILITY_TOOLS, ...resource_tools_1.RESOURCE_TOOLS, ...pluginKubectlTools, ...mcpTools, ...mermaid_tools_1.MERMAID_TOOLS]
|
|
156
181
|
: [...capability_tools_1.CAPABILITY_TOOLS, ...resource_tools_1.RESOURCE_TOOLS, ...pluginKubectlTools, ...mcpTools];
|
|
157
182
|
// Execute tool loop with capability, resource, kubectl, and MCP tools
|
|
158
|
-
|
|
183
|
+
// The query tool loop uses only read-only tools (capability/resource search,
|
|
184
|
+
// kubectl get/describe/logs/events, mermaid), so a transient AI-loop failure is
|
|
185
|
+
// safe to retry. Smaller models occasionally fail the agentic loop; retry a
|
|
186
|
+
// bounded number of times before surfacing the (already isRetryable) error below.
|
|
187
|
+
const MAX_QUERY_ATTEMPTS = 3;
|
|
188
|
+
const runQueryLoop = () => aiProvider.toolLoop({
|
|
159
189
|
systemPrompt,
|
|
160
190
|
userMessage: intent,
|
|
161
191
|
tools,
|
|
@@ -167,6 +197,11 @@ async function handleQueryTool(args, pluginManager) {
|
|
|
167
197
|
},
|
|
168
198
|
interaction_id: args.interaction_id
|
|
169
199
|
});
|
|
200
|
+
const result = await runQueryLoopWithRetry(runQueryLoop, {
|
|
201
|
+
maxAttempts: MAX_QUERY_ATTEMPTS,
|
|
202
|
+
logger,
|
|
203
|
+
requestId,
|
|
204
|
+
});
|
|
170
205
|
// Extract data from execution record (reliable, not AI self-reporting)
|
|
171
206
|
const toolsUsed = [...new Set(result.toolCallsExecuted.map(tc => tc.tool))];
|
|
172
207
|
logger.info('Query completed', {
|
package/dist/tools/version.d.ts
CHANGED
|
@@ -27,16 +27,6 @@ export interface SystemStatus {
|
|
|
27
27
|
url: string;
|
|
28
28
|
error?: string;
|
|
29
29
|
collections: {
|
|
30
|
-
patterns: {
|
|
31
|
-
exists: boolean;
|
|
32
|
-
documentsCount?: number;
|
|
33
|
-
error?: string;
|
|
34
|
-
};
|
|
35
|
-
policies: {
|
|
36
|
-
exists: boolean;
|
|
37
|
-
documentsCount?: number;
|
|
38
|
-
error?: string;
|
|
39
|
-
};
|
|
40
30
|
capabilities: {
|
|
41
31
|
exists: boolean;
|
|
42
32
|
documentsCount?: number;
|
|
@@ -132,10 +122,9 @@ export interface VersionSessionData extends BaseVisualizationData {
|
|
|
132
122
|
system: SystemStatus;
|
|
133
123
|
summary: {
|
|
134
124
|
overall: 'healthy' | 'degraded';
|
|
135
|
-
|
|
125
|
+
knowledgeSearch: string;
|
|
136
126
|
capabilityScanning: string;
|
|
137
127
|
kubernetesAccess: string;
|
|
138
|
-
policyIntentManagement: string;
|
|
139
128
|
kyvernoPolicyGeneration: string;
|
|
140
129
|
capabilities: string[];
|
|
141
130
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/tools/version.ts"],"names":[],"m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errorMessage) {
|
|
72
72
|
return {
|
|
73
|
-
patterns: { exists: false, error: errorMessage },
|
|
74
|
-
policies: { exists: false, error: errorMessage },
|
|
75
73
|
capabilities: { exists: false, error: errorMessage },
|
|
76
74
|
resources: { exists: false, error: errorMessage },
|
|
77
75
|
knowledgeBase: { exists: false, error: errorMessage },
|
|
@@ -101,16 +99,6 @@ async function getVectorDBStatus() {
|
|
|
101
99
|
const url = toolResult?.data?.url || fallbackUrl;
|
|
102
100
|
// Test each collection separately
|
|
103
101
|
const embeddingService = new index_1.EmbeddingService();
|
|
104
|
-
// Test patterns collection
|
|
105
|
-
const patternsStatus = await testCollectionStatus('patterns', () => {
|
|
106
|
-
const patternService = new index_1.PatternVectorService('patterns', embeddingService);
|
|
107
|
-
return patternService.getPatternsCount();
|
|
108
|
-
});
|
|
109
|
-
// Test policies collection
|
|
110
|
-
const policiesStatus = await testCollectionStatus('policies', () => {
|
|
111
|
-
const policyService = new index_1.PolicyVectorService(embeddingService);
|
|
112
|
-
return policyService.getDataCount();
|
|
113
|
-
});
|
|
114
102
|
// Test capabilities collection
|
|
115
103
|
const capabilitiesStatus = await testCollectionStatus('capabilities', () => {
|
|
116
104
|
const capabilityService = new index_1.CapabilityVectorService('capabilities', embeddingService);
|
|
@@ -124,8 +112,6 @@ async function getVectorDBStatus() {
|
|
|
124
112
|
connected: true,
|
|
125
113
|
url,
|
|
126
114
|
collections: {
|
|
127
|
-
patterns: patternsStatus,
|
|
128
|
-
policies: policiesStatus,
|
|
129
115
|
capabilities: capabilitiesStatus,
|
|
130
116
|
resources: resourcesStatus,
|
|
131
117
|
knowledgeBase: knowledgeBaseStatus,
|
|
@@ -714,15 +700,20 @@ async function handleVersionTool(args, logger, requestId) {
|
|
|
714
700
|
// Build summary object
|
|
715
701
|
const summary = {
|
|
716
702
|
overall: (vectorDBStatus.connected && aiProviderStatus.connected && kubernetesStatus.connected && capabilityStatus.systemReady ? 'healthy' : 'degraded'),
|
|
717
|
-
|
|
703
|
+
// PRD #375: Unified knowledge base replaces separate pattern/policy search.
|
|
704
|
+
// Keep this on the same readiness rule as the `knowledge-base-search` capability
|
|
705
|
+
// below (both gate on vectorDBStatus.connected) so diagnostics never contradict.
|
|
706
|
+
knowledgeSearch: !vectorDBStatus.connected
|
|
707
|
+
? 'unavailable'
|
|
708
|
+
: embeddingStatus.available
|
|
709
|
+
? 'semantic+keyword'
|
|
710
|
+
: 'keyword-only',
|
|
718
711
|
capabilityScanning: capabilityStatus.systemReady && kubernetesStatus.connected ? 'ready' : 'not-ready',
|
|
719
712
|
kubernetesAccess: kubernetesStatus.connected ? 'connected' : 'disconnected',
|
|
720
|
-
policyIntentManagement: vectorDBStatus.connected && embeddingStatus.available ? 'ready' : 'not-ready',
|
|
721
713
|
kyvernoPolicyGeneration: kyvernoStatus.policyGenerationReady ? 'ready' : 'not-ready',
|
|
722
714
|
capabilities: [
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
vectorDBStatus.connected && embeddingStatus.available ? 'policy-intent-management' : null,
|
|
715
|
+
// PRD #375: knowledge-base-search replaces pattern-management and policy-intent-management
|
|
716
|
+
vectorDBStatus.connected ? 'knowledge-base-search' : null,
|
|
726
717
|
capabilityStatus.systemReady && kubernetesStatus.connected ? 'capability-scanning' : null,
|
|
727
718
|
embeddingStatus.available ? 'semantic-search' : null,
|
|
728
719
|
aiProviderStatus.connected ? 'ai-recommendations' : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vfarcic/dot-ai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance",
|
|
5
5
|
"mcpName": "io.github.vfarcic/dot-ai",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -104,7 +104,6 @@
|
|
|
104
104
|
"tsx": "^4.22.3",
|
|
105
105
|
"typescript": "^5.0.0",
|
|
106
106
|
"typescript-eslint": "^8.54.0",
|
|
107
|
-
"uuid": "^14.0.0",
|
|
108
107
|
"vitest": "^4.0.0"
|
|
109
108
|
},
|
|
110
109
|
"dependencies": {
|
|
@@ -134,6 +133,7 @@
|
|
|
134
133
|
"mermaid": "^11.15.0",
|
|
135
134
|
"posthog-node": "^5.23.0",
|
|
136
135
|
"simple-git": "^3.32.3",
|
|
136
|
+
"uuid": "^14.0.0",
|
|
137
137
|
"yaml": "^2.8.0"
|
|
138
138
|
},
|
|
139
139
|
"overrides": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Classify this document by determining whether it contains policy content,
|
|
2
|
+
pattern content, both, or neither.
|
|
3
|
+
|
|
4
|
+
A **policy** is a rule, requirement, constraint, or guideline that should be enforced
|
|
5
|
+
during infrastructure/application deployments. Examples:
|
|
6
|
+
- "All databases must use PostgreSQL"
|
|
7
|
+
- "Container images must come from approved registries"
|
|
8
|
+
- "Services must have health checks defined"
|
|
9
|
+
|
|
10
|
+
A **pattern** is a reusable deployment template or architectural approach. Examples:
|
|
11
|
+
- "Public web applications use Deployment + Service + Ingress"
|
|
12
|
+
- "Stateful workloads use StatefulSet + PVC + headless Service"
|
|
13
|
+
- "Event-driven services use Knative Serving with autoscaling"
|
|
14
|
+
|
|
15
|
+
Return ONLY a JSON array of applicable tags. Possible values: "policy", "pattern".
|
|
16
|
+
- If the document contains policy content, include "policy"
|
|
17
|
+
- If the document contains pattern content, include "pattern"
|
|
18
|
+
- If it contains both, include both: ["policy", "pattern"]
|
|
19
|
+
- If it contains neither, return an empty array: []
|
|
20
|
+
|
|
21
|
+
Do not include any explanation, markdown formatting, or text outside the JSON array.
|
|
22
|
+
|
|
23
|
+
Document:
|
|
24
|
+
{{{documentContent}}}
|
package/prompts/operate-user.md
CHANGED
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Organizational
|
|
7
|
+
# Organizational Knowledge
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The following organizational knowledge is relevant to this intent. Each entry is tagged with its type:
|
|
10
|
+
- **[Policy]** = a rule or requirement that must be enforced
|
|
11
|
+
- **[Pattern]** = a reusable architectural approach to follow
|
|
12
|
+
- **[General]** = general guidance or context
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
# Organizational Policies
|
|
14
|
-
|
|
15
|
-
{{{policies}}}
|
|
14
|
+
{{{knowledgeContext}}}
|
|
16
15
|
|
|
17
16
|
---
|
|
18
17
|
|
|
@@ -22,4 +21,4 @@
|
|
|
22
21
|
|
|
23
22
|
---
|
|
24
23
|
|
|
25
|
-
Analyze this operational intent using the provided organizational
|
|
24
|
+
Analyze this operational intent using the provided organizational knowledge and cluster capabilities. Propose a validated operational solution following the workflow requirements specified in your system instructions.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Organizational Entity Types
|
|
3
|
-
*
|
|
4
|
-
* Base interfaces and types for organizational entities (patterns and policies)
|
|
5
|
-
* that enhance AI recommendations with institutional knowledge via RAG.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Base interface for all organizational entities stored in Vector DB
|
|
9
|
-
* Contains shared fields used by both patterns and policies
|
|
10
|
-
*/
|
|
11
|
-
export interface BaseOrganizationalEntity {
|
|
12
|
-
id: string;
|
|
13
|
-
description: string;
|
|
14
|
-
triggers: string[];
|
|
15
|
-
rationale: string;
|
|
16
|
-
createdAt: string;
|
|
17
|
-
createdBy: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Organizational Pattern - guides resource selection
|
|
21
|
-
* Extends base entity with pattern-specific fields
|
|
22
|
-
*/
|
|
23
|
-
export interface OrganizationalPattern extends BaseOrganizationalEntity {
|
|
24
|
-
suggestedResources: string[];
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Policy Intent - guides resource configuration
|
|
28
|
-
* Extends base entity with policy-specific fields
|
|
29
|
-
*/
|
|
30
|
-
export interface PolicyIntent extends BaseOrganizationalEntity {
|
|
31
|
-
deployedPolicies?: DeployedPolicyReference[];
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Reference to a deployed Kyverno policy
|
|
35
|
-
* Stored in PolicyIntent to track lifecycle without duplicating YAML
|
|
36
|
-
*/
|
|
37
|
-
export interface DeployedPolicyReference {
|
|
38
|
-
name: string;
|
|
39
|
-
appliedAt: string;
|
|
40
|
-
}
|
|
41
|
-
export type CreatePatternRequest = Omit<OrganizationalPattern, 'id' | 'createdAt'>;
|
|
42
|
-
export type CreatePolicyIntentRequest = Omit<PolicyIntent, 'id' | 'createdAt' | 'deployedPolicies'>;
|
|
43
|
-
//# sourceMappingURL=organizational-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"organizational-types.d.ts","sourceRoot":"","sources":["../../src/core/organizational-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,wBAAwB;IACrE,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,YAAa,SAAQ,wBAAwB;IAC5D,gBAAgB,CAAC,EAAE,uBAAuB,EAAE,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,qBAAqB,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC;AAGnF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,YAAY,EAAE,IAAI,GAAG,WAAW,GAAG,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Shared Organizational Entity Types
|
|
4
|
-
*
|
|
5
|
-
* Base interfaces and types for organizational entities (patterns and policies)
|
|
6
|
-
* that enhance AI recommendations with institutional knowledge via RAG.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core Pattern Operations
|
|
3
|
-
*
|
|
4
|
-
* Complete operations for creating, validating, and managing organizational patterns
|
|
5
|
-
* Handles workflow management, Vector DB operations, and MCP routing
|
|
6
|
-
*/
|
|
7
|
-
import { OrganizationalPattern, CreatePatternRequest } from './pattern-types';
|
|
8
|
-
import { Logger } from './error-handling';
|
|
9
|
-
import { PatternVectorService } from './index';
|
|
10
|
-
/**
|
|
11
|
-
* Arguments for pattern operations
|
|
12
|
-
*/
|
|
13
|
-
interface PatternOperationArgs {
|
|
14
|
-
sessionId?: string;
|
|
15
|
-
response?: string;
|
|
16
|
-
id?: string;
|
|
17
|
-
limit?: number;
|
|
18
|
-
step?: string;
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Validation result structure
|
|
23
|
-
*/
|
|
24
|
-
interface ValidationResult {
|
|
25
|
-
success: boolean;
|
|
26
|
-
error?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Pattern operation response
|
|
30
|
-
*/
|
|
31
|
-
interface PatternOperationResponse {
|
|
32
|
-
success: boolean;
|
|
33
|
-
operation?: string;
|
|
34
|
-
dataType?: string;
|
|
35
|
-
error?: string;
|
|
36
|
-
message?: string;
|
|
37
|
-
[key: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
export declare function validatePattern(request: CreatePatternRequest): string[];
|
|
40
|
-
export declare function createPattern(request: CreatePatternRequest): OrganizationalPattern;
|
|
41
|
-
export declare function serializePattern(pattern: OrganizationalPattern): string;
|
|
42
|
-
export declare function deserializePattern(json: string): OrganizationalPattern;
|
|
43
|
-
/**
|
|
44
|
-
* Handle pattern operations with workflow support
|
|
45
|
-
* Shared validation functions are passed as parameters to avoid circular dependencies
|
|
46
|
-
* PRD #359: Uses unified plugin registry for kubectl operations
|
|
47
|
-
*/
|
|
48
|
-
export declare function handlePatternOperation(operation: string, args: PatternOperationArgs, logger: Logger, requestId: string, validateVectorDBConnection: (vectorService: PatternVectorService, logger: Logger, requestId: string) => Promise<ValidationResult>, validateEmbeddingService: (logger: Logger, requestId: string) => Promise<ValidationResult>): Promise<PatternOperationResponse>;
|
|
49
|
-
export {};
|
|
50
|
-
//# sourceMappingURL=pattern-operations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pattern-operations.d.ts","sourceRoot":"","sources":["../../src/core/pattern-operations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAA8C,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQ/C;;GAEG;AACH,UAAU,oBAAoB;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;G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