@aws/lsp-codewhisperer 0.0.70 → 0.0.71
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/CHANGELOG.md +35 -0
- package/out/language-server/agenticChat/agenticChatController.js +22 -3
- package/out/language-server/agenticChat/agenticChatController.js.map +1 -1
- package/out/language-server/agenticChat/tools/executeBash.d.ts +3 -1
- package/out/language-server/agenticChat/tools/executeBash.js +28 -24
- package/out/language-server/agenticChat/tools/executeBash.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpEventHandler.js +257 -163
- package/out/language-server/agenticChat/tools/mcp/mcpEventHandler.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpManager.d.ts +37 -17
- package/out/language-server/agenticChat/tools/mcp/mcpManager.js +195 -78
- package/out/language-server/agenticChat/tools/mcp/mcpManager.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpTypes.d.ts +3 -1
- package/out/language-server/agenticChat/tools/mcp/mcpTypes.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpUtils.d.ts +0 -1
- package/out/language-server/agenticChat/tools/mcp/mcpUtils.js +36 -21
- package/out/language-server/agenticChat/tools/mcp/mcpUtils.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReview.d.ts +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReview.js +10 -15
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReview.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.d.ts +2 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.js +3 -2
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewConstants.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.d.ts +6 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.js +9 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/codeReviewUtils.js.map +1 -1
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindings.d.ts +89 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindings.js +138 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindings.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsConstants.d.ts +14 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsConstants.js +40 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsConstants.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsSchemas.d.ts +177 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsSchemas.js +93 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsSchemas.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsTypes.d.ts +27 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsTypes.js +12 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsTypes.js.map +1 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsUtils.d.ts +17 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsUtils.js +33 -0
- package/out/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsUtils.js.map +1 -0
- package/out/language-server/agenticChat/tools/toolServer.js +22 -2
- package/out/language-server/agenticChat/tools/toolServer.js.map +1 -1
- package/out/language-server/agenticChat/utils/commandParser.d.ts +17 -0
- package/out/language-server/agenticChat/utils/commandParser.js +85 -0
- package/out/language-server/agenticChat/utils/commandParser.js.map +1 -0
- package/out/language-server/chat/chatController.js +77 -0
- package/out/language-server/chat/chatController.js.map +1 -1
- package/out/language-server/chat/constants.d.ts +1 -0
- package/out/language-server/chat/constants.js +2 -1
- package/out/language-server/chat/constants.js.map +1 -1
- package/out/language-server/chat/telemetry/chatTelemetryController.d.ts +1 -0
- package/out/language-server/chat/telemetry/chatTelemetryController.js +1 -0
- package/out/language-server/chat/telemetry/chatTelemetryController.js.map +1 -1
- package/out/language-server/chat/utils.js +6 -0
- package/out/language-server/chat/utils.js.map +1 -1
- package/out/language-server/configuration/qConfigurationServer.d.ts +1 -0
- package/out/language-server/configuration/qConfigurationServer.js.map +1 -1
- package/out/language-server/inline-completion/auto-trigger/autoTrigger.js +2 -1
- package/out/language-server/inline-completion/auto-trigger/autoTrigger.js.map +1 -1
- package/out/language-server/inline-completion/codeWhispererServer.js +40 -37
- package/out/language-server/inline-completion/codeWhispererServer.js.map +1 -1
- package/out/language-server/workspaceContext/artifactManager.js +25 -6
- package/out/language-server/workspaceContext/artifactManager.js.map +1 -1
- package/out/shared/languageDetection.js +0 -2
- package/out/shared/languageDetection.js.map +1 -1
- package/out/shared/models/constants.js +2 -1
- package/out/shared/models/constants.js.map +1 -1
- package/out/shared/supplementalContextUtil/crossFileContextUtil.d.ts +4 -4
- package/out/shared/supplementalContextUtil/crossFileContextUtil.js +112 -8
- package/out/shared/supplementalContextUtil/crossFileContextUtil.js.map +1 -1
- package/out/shared/supplementalContextUtil/supplementalContextUtil.d.ts +1 -1
- package/out/shared/supplementalContextUtil/supplementalContextUtil.js +2 -2
- package/out/shared/supplementalContextUtil/supplementalContextUtil.js.map +1 -1
- package/out/shared/telemetry/telemetryService.js +36 -17
- package/out/shared/telemetry/telemetryService.js.map +1 -1
- package/out/shared/telemetry/types.d.ts +8 -1
- package/out/shared/telemetry/types.js +1 -0
- package/out/shared/telemetry/types.js.map +1 -1
- package/out/shared/utils.d.ts +12 -0
- package/out/shared/utils.js +53 -3
- package/out/shared/utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* Input schema for CodeReview tool
|
|
8
|
+
*/
|
|
9
|
+
export declare const DISPLAY_FINDINGS_INPUT_SCHEMA: {
|
|
10
|
+
type: "object";
|
|
11
|
+
description: string;
|
|
12
|
+
properties: {
|
|
13
|
+
findings: {
|
|
14
|
+
type: "array";
|
|
15
|
+
description: string;
|
|
16
|
+
items: {
|
|
17
|
+
type: "object";
|
|
18
|
+
description: string;
|
|
19
|
+
properties: {
|
|
20
|
+
filePath: {
|
|
21
|
+
type: "string";
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
startLine: {
|
|
25
|
+
type: "string";
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
endLine: {
|
|
29
|
+
type: "string";
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
title: {
|
|
33
|
+
type: "string";
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
language: {
|
|
37
|
+
type: "string";
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
description: {
|
|
41
|
+
type: "string";
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
severity: {
|
|
45
|
+
type: "string";
|
|
46
|
+
description: string;
|
|
47
|
+
enum: string[];
|
|
48
|
+
};
|
|
49
|
+
suggestedFixes: {
|
|
50
|
+
type: "array";
|
|
51
|
+
description: string;
|
|
52
|
+
items: {
|
|
53
|
+
type: "string";
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
required: readonly ["filePath", "startLine", "endLine", "title", "severity", "description", "language"];
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
required: readonly ["findings"];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Schema for a single finding
|
|
66
|
+
*/
|
|
67
|
+
export declare const Z_DISPLAY_FINDING_SCHEMA: z.ZodObject<{
|
|
68
|
+
description: z.ZodString;
|
|
69
|
+
endLine: z.ZodString;
|
|
70
|
+
filePath: z.ZodString;
|
|
71
|
+
language: z.ZodString;
|
|
72
|
+
severity: z.ZodEnum<[string, ...string[]]>;
|
|
73
|
+
startLine: z.ZodString;
|
|
74
|
+
suggestedFixes: z.ZodOptional<z.ZodArray<z.ZodOptional<z.ZodString>, "many">>;
|
|
75
|
+
title: z.ZodString;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
filePath: string;
|
|
78
|
+
description: string;
|
|
79
|
+
language: string;
|
|
80
|
+
title: string;
|
|
81
|
+
startLine: string;
|
|
82
|
+
endLine: string;
|
|
83
|
+
severity: string;
|
|
84
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
filePath: string;
|
|
87
|
+
description: string;
|
|
88
|
+
language: string;
|
|
89
|
+
title: string;
|
|
90
|
+
startLine: string;
|
|
91
|
+
endLine: string;
|
|
92
|
+
severity: string;
|
|
93
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Schema for an array of findings
|
|
97
|
+
*/
|
|
98
|
+
export declare const Z_DISPLAY_FINDINGS_SCHEMA: z.ZodArray<z.ZodObject<{
|
|
99
|
+
description: z.ZodString;
|
|
100
|
+
endLine: z.ZodString;
|
|
101
|
+
filePath: z.ZodString;
|
|
102
|
+
language: z.ZodString;
|
|
103
|
+
severity: z.ZodEnum<[string, ...string[]]>;
|
|
104
|
+
startLine: z.ZodString;
|
|
105
|
+
suggestedFixes: z.ZodOptional<z.ZodArray<z.ZodOptional<z.ZodString>, "many">>;
|
|
106
|
+
title: z.ZodString;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
filePath: string;
|
|
109
|
+
description: string;
|
|
110
|
+
language: string;
|
|
111
|
+
title: string;
|
|
112
|
+
startLine: string;
|
|
113
|
+
endLine: string;
|
|
114
|
+
severity: string;
|
|
115
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
116
|
+
}, {
|
|
117
|
+
filePath: string;
|
|
118
|
+
description: string;
|
|
119
|
+
language: string;
|
|
120
|
+
title: string;
|
|
121
|
+
startLine: string;
|
|
122
|
+
endLine: string;
|
|
123
|
+
severity: string;
|
|
124
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
125
|
+
}>, "many">;
|
|
126
|
+
export declare const Z_DISPLAY_FINDINGS_INPUT_SCHEMA: z.ZodObject<{
|
|
127
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
128
|
+
description: z.ZodString;
|
|
129
|
+
endLine: z.ZodString;
|
|
130
|
+
filePath: z.ZodString;
|
|
131
|
+
language: z.ZodString;
|
|
132
|
+
severity: z.ZodEnum<[string, ...string[]]>;
|
|
133
|
+
startLine: z.ZodString;
|
|
134
|
+
suggestedFixes: z.ZodOptional<z.ZodArray<z.ZodOptional<z.ZodString>, "many">>;
|
|
135
|
+
title: z.ZodString;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
filePath: string;
|
|
138
|
+
description: string;
|
|
139
|
+
language: string;
|
|
140
|
+
title: string;
|
|
141
|
+
startLine: string;
|
|
142
|
+
endLine: string;
|
|
143
|
+
severity: string;
|
|
144
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
145
|
+
}, {
|
|
146
|
+
filePath: string;
|
|
147
|
+
description: string;
|
|
148
|
+
language: string;
|
|
149
|
+
title: string;
|
|
150
|
+
startLine: string;
|
|
151
|
+
endLine: string;
|
|
152
|
+
severity: string;
|
|
153
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
154
|
+
}>, "many">;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
findings: {
|
|
157
|
+
filePath: string;
|
|
158
|
+
description: string;
|
|
159
|
+
language: string;
|
|
160
|
+
title: string;
|
|
161
|
+
startLine: string;
|
|
162
|
+
endLine: string;
|
|
163
|
+
severity: string;
|
|
164
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
165
|
+
}[];
|
|
166
|
+
}, {
|
|
167
|
+
findings: {
|
|
168
|
+
filePath: string;
|
|
169
|
+
description: string;
|
|
170
|
+
language: string;
|
|
171
|
+
title: string;
|
|
172
|
+
startLine: string;
|
|
173
|
+
endLine: string;
|
|
174
|
+
severity: string;
|
|
175
|
+
suggestedFixes?: (string | undefined)[] | undefined;
|
|
176
|
+
}[];
|
|
177
|
+
}>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Z_DISPLAY_FINDINGS_INPUT_SCHEMA = exports.Z_DISPLAY_FINDINGS_SCHEMA = exports.Z_DISPLAY_FINDING_SCHEMA = exports.DISPLAY_FINDINGS_INPUT_SCHEMA = void 0;
|
|
8
|
+
const zod_1 = require("zod");
|
|
9
|
+
const codeReviewConstants_1 = require("./codeReviewConstants");
|
|
10
|
+
/**
|
|
11
|
+
* Input schema for CodeReview tool
|
|
12
|
+
*/
|
|
13
|
+
exports.DISPLAY_FINDINGS_INPUT_SCHEMA = {
|
|
14
|
+
type: 'object',
|
|
15
|
+
description: [
|
|
16
|
+
'There is only one input to the DisplayFindings tool: the findings.',
|
|
17
|
+
'Please format all of the findings which are meant to be displayed using this schema.',
|
|
18
|
+
].join('\n'),
|
|
19
|
+
properties: {
|
|
20
|
+
findings: {
|
|
21
|
+
type: 'array',
|
|
22
|
+
description: [
|
|
23
|
+
'Array of the code issues, bugs, security risks, and code quality violations which were found by the agent and need to be sent to the Code Issues Panel',
|
|
24
|
+
].join('\n'),
|
|
25
|
+
items: {
|
|
26
|
+
type: 'object',
|
|
27
|
+
description: 'Array item containing all of the findings which will be sent to the Code Issues Panel',
|
|
28
|
+
properties: {
|
|
29
|
+
filePath: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'The absolute path of the file which has the finding',
|
|
32
|
+
},
|
|
33
|
+
startLine: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
description: 'The line number of the first line of the finding',
|
|
36
|
+
},
|
|
37
|
+
endLine: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
description: 'The line number of the last line of the finding.',
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'A short title to represent the finding',
|
|
44
|
+
},
|
|
45
|
+
language: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'The programming language of the file which holds the finding',
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
type: 'string',
|
|
51
|
+
description: 'A more thorough description of the finding',
|
|
52
|
+
},
|
|
53
|
+
severity: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'The severity of the finding',
|
|
56
|
+
enum: codeReviewConstants_1.FINDING_SEVERITY,
|
|
57
|
+
},
|
|
58
|
+
suggestedFixes: {
|
|
59
|
+
type: 'array',
|
|
60
|
+
description: 'An array of possible fixes. Do not generate fixes just to populate this, only include them if they are provided.',
|
|
61
|
+
items: {
|
|
62
|
+
type: 'string',
|
|
63
|
+
description: 'The absolute path of the file which has the finding',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
required: ['filePath', 'startLine', 'endLine', 'title', 'severity', 'description', 'language'],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ['findings'],
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Schema for a single finding
|
|
75
|
+
*/
|
|
76
|
+
exports.Z_DISPLAY_FINDING_SCHEMA = zod_1.z.object({
|
|
77
|
+
description: zod_1.z.string(),
|
|
78
|
+
endLine: zod_1.z.string(),
|
|
79
|
+
filePath: zod_1.z.string(),
|
|
80
|
+
language: zod_1.z.string(),
|
|
81
|
+
severity: zod_1.z.enum(codeReviewConstants_1.FINDING_SEVERITY),
|
|
82
|
+
startLine: zod_1.z.string(),
|
|
83
|
+
suggestedFixes: zod_1.z.array(zod_1.z.string().optional()).optional(),
|
|
84
|
+
title: zod_1.z.string(),
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Schema for an array of findings
|
|
88
|
+
*/
|
|
89
|
+
exports.Z_DISPLAY_FINDINGS_SCHEMA = zod_1.z.array(exports.Z_DISPLAY_FINDING_SCHEMA);
|
|
90
|
+
exports.Z_DISPLAY_FINDINGS_INPUT_SCHEMA = zod_1.z.object({
|
|
91
|
+
findings: exports.Z_DISPLAY_FINDINGS_SCHEMA,
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=displayFindingsSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayFindingsSchemas.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsSchemas.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6BAAuB;AACvB,+DAAwD;AAExD;;GAEG;AACU,QAAA,6BAA6B,GAAG;IACzC,IAAI,EAAS,QAAQ;IACrB,WAAW,EAAE;QACT,oEAAoE;QACpE,sFAAsF;KACzF,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,UAAU,EAAE;QACR,QAAQ,EAAE;YACN,IAAI,EAAS,OAAO;YACpB,WAAW,EAAE;gBACT,wJAAwJ;aAC3J,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,KAAK,EAAE;gBACH,IAAI,EAAS,QAAQ;gBACrB,WAAW,EAAE,uFAAuF;gBACpG,UAAU,EAAE;oBACR,QAAQ,EAAE;wBACN,IAAI,EAAS,QAAQ;wBACrB,WAAW,EAAE,qDAAqD;qBACrE;oBACD,SAAS,EAAE;wBACP,IAAI,EAAS,QAAQ;wBACrB,WAAW,EAAE,kDAAkD;qBAClE;oBACD,OAAO,EAAE;wBACL,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B,CAAC,CAAA;AAEF;;GAEG;AACU,QAAA,yBAAyB,GAAG,OAAC,CAAC,KAAK,CAAC,gCAAwB,CAAC,CAAA;AAE7D,QAAA,+BAA+B,GAAG,OAAC,CAAC,MAAM,CAAC;IACpD,QAAQ,EAAE,iCAAyB;CACtC,CAAC,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type DisplayFinding = {
|
|
2
|
+
filePath: string;
|
|
3
|
+
startLine: string;
|
|
4
|
+
endLine: string;
|
|
5
|
+
comment: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
severity: string;
|
|
9
|
+
suggestedFixes: (string | undefined)[] | undefined;
|
|
10
|
+
language: string;
|
|
11
|
+
};
|
|
12
|
+
export declare enum SuccessMetricName {
|
|
13
|
+
DisplayFindingsSuccess = "displayFindingsSuccess"
|
|
14
|
+
}
|
|
15
|
+
export declare enum FailedMetricName {
|
|
16
|
+
DisplayFindingsFailed = "displayFindingsFailed"
|
|
17
|
+
}
|
|
18
|
+
export type DisplayFindingsMetric = {
|
|
19
|
+
reason: SuccessMetricName;
|
|
20
|
+
result: 'Succeeded';
|
|
21
|
+
metadata?: object;
|
|
22
|
+
} | {
|
|
23
|
+
reason: FailedMetricName;
|
|
24
|
+
result: 'Failed';
|
|
25
|
+
reasonDesc: string;
|
|
26
|
+
metadata?: object;
|
|
27
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FailedMetricName = exports.SuccessMetricName = void 0;
|
|
4
|
+
var SuccessMetricName;
|
|
5
|
+
(function (SuccessMetricName) {
|
|
6
|
+
SuccessMetricName["DisplayFindingsSuccess"] = "displayFindingsSuccess";
|
|
7
|
+
})(SuccessMetricName || (exports.SuccessMetricName = SuccessMetricName = {}));
|
|
8
|
+
var FailedMetricName;
|
|
9
|
+
(function (FailedMetricName) {
|
|
10
|
+
FailedMetricName["DisplayFindingsFailed"] = "displayFindingsFailed";
|
|
11
|
+
})(FailedMetricName || (exports.FailedMetricName = FailedMetricName = {}));
|
|
12
|
+
//# sourceMappingURL=displayFindingsTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayFindingsTypes.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsTypes.ts"],"names":[],"mappings":";;;AAYA,IAAY,iBAEX;AAFD,WAAY,iBAAiB;IACzB,sEAAiD,CAAA;AACrD,CAAC,EAFW,iBAAiB,iCAAjB,iBAAiB,QAE5B;AAED,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IACxB,mEAA+C,CAAA;AACnD,CAAC,EAFW,gBAAgB,gCAAhB,gBAAgB,QAE3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Features } from '@aws/language-server-runtimes/server-interface/server';
|
|
2
|
+
import { DisplayFindingsMetric } from './displayFindingsTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Utility functions for DisplayFindings
|
|
5
|
+
*/
|
|
6
|
+
export declare class DisplayFindingsUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Emit a telemetry metric with standard formatting
|
|
9
|
+
* @param metricSuffix Suffix for the metric name
|
|
10
|
+
* @param metricData Additional metric data
|
|
11
|
+
* @param toolName Tool name for the metric prefix
|
|
12
|
+
* @param logging Logging interface
|
|
13
|
+
* @param telemetry Telemetry interface
|
|
14
|
+
* @param credentialStartUrl Optional credential start URL
|
|
15
|
+
*/
|
|
16
|
+
static emitMetric(metric: DisplayFindingsMetric, logging: Features['logging'], telemetry: Features['telemetry']): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisplayFindingsUtils = void 0;
|
|
4
|
+
const displayFindingsConstants_1 = require("./displayFindingsConstants");
|
|
5
|
+
/**
|
|
6
|
+
* Utility functions for DisplayFindings
|
|
7
|
+
*/
|
|
8
|
+
class DisplayFindingsUtils {
|
|
9
|
+
/**
|
|
10
|
+
* Emit a telemetry metric with standard formatting
|
|
11
|
+
* @param metricSuffix Suffix for the metric name
|
|
12
|
+
* @param metricData Additional metric data
|
|
13
|
+
* @param toolName Tool name for the metric prefix
|
|
14
|
+
* @param logging Logging interface
|
|
15
|
+
* @param telemetry Telemetry interface
|
|
16
|
+
* @param credentialStartUrl Optional credential start URL
|
|
17
|
+
*/
|
|
18
|
+
static emitMetric(metric, logging, telemetry) {
|
|
19
|
+
const { metadata, ...metricDetails } = metric;
|
|
20
|
+
const metricPayload = {
|
|
21
|
+
name: displayFindingsConstants_1.DISPLAY_FINDINGS_METRICS_PARENT_NAME,
|
|
22
|
+
data: {
|
|
23
|
+
// metadata is optional attribute
|
|
24
|
+
...(metadata || {}),
|
|
25
|
+
...metricDetails,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
logging.info(`Emitting telemetry metric: ${metric.reason} with data: ${JSON.stringify(metricPayload.data)}`);
|
|
29
|
+
telemetry.emitMetric(metricPayload);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.DisplayFindingsUtils = DisplayFindingsUtils;
|
|
33
|
+
//# sourceMappingURL=displayFindingsUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayFindingsUtils.js","sourceRoot":"","sources":["../../../../../src/language-server/agenticChat/tools/qCodeAnalysis/displayFindingsUtils.ts"],"names":[],"mappings":";;;AACA,yEAAiF;AAEjF;;GAEG;AACH,MAAa,oBAAoB;IAC7B;;;;;;;;OAQG;IACI,MAAM,CAAC,UAAU,CACpB,MAA6B,EAC7B,OAA4B,EAC5B,SAAgC;QAEhC,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,CAAA;QAC7C,MAAM,aAAa,GAAG;YAClB,IAAI,EAAE,+DAAoC;YAC1C,IAAI,EAAE;gBACF,iCAAiC;gBACjC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;gBACnB,GAAG,aAAa;aACnB;SACJ,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,8BAA8B,MAAM,CAAC,MAAM,eAAe,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC5G,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;IACvC,CAAC;CACJ;AA3BD,oDA2BC"}
|
|
@@ -18,6 +18,7 @@ const mcpUtils_1 = require("./mcp/mcpUtils");
|
|
|
18
18
|
const fsReplace_1 = require("./fsReplace");
|
|
19
19
|
const codeReviewUtils_1 = require("./qCodeAnalysis/codeReviewUtils");
|
|
20
20
|
const constants_1 = require("../../../shared/constants");
|
|
21
|
+
const displayFindings_1 = require("./qCodeAnalysis/displayFindings");
|
|
21
22
|
const FsToolsServer = ({ workspace, logging, agent, lsp }) => {
|
|
22
23
|
const fsReadTool = new fsRead_1.FsRead({ workspace, lsp, logging });
|
|
23
24
|
const fsWriteTool = new fsWrite_1.FsWrite({ workspace, lsp, logging });
|
|
@@ -60,6 +61,11 @@ const QCodeAnalysisServer = ({ agent, credentialsProvider, logging, lsp, sdkInit
|
|
|
60
61
|
telemetry,
|
|
61
62
|
workspace,
|
|
62
63
|
});
|
|
64
|
+
const displayFindingsTool = new displayFindings_1.DisplayFindings({
|
|
65
|
+
logging,
|
|
66
|
+
telemetry,
|
|
67
|
+
workspace,
|
|
68
|
+
});
|
|
63
69
|
lsp.onInitialized(async () => {
|
|
64
70
|
if (!codeReviewUtils_1.CodeReviewUtils.isAgenticReviewEnabled(lsp.getClientInitializeParams())) {
|
|
65
71
|
logging.warn('Agentic Review is currently not supported');
|
|
@@ -84,12 +90,26 @@ const QCodeAnalysisServer = ({ agent, credentialsProvider, logging, lsp, sdkInit
|
|
|
84
90
|
writableStream: updates,
|
|
85
91
|
});
|
|
86
92
|
}, server_interface_1.ToolClassification.BuiltIn);
|
|
93
|
+
if (!codeReviewUtils_1.CodeReviewUtils.isDisplayFindingsEnabled(lsp.getClientInitializeParams())) {
|
|
94
|
+
logging.warn('Display Findings is currently not supported');
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
agent.addTool({
|
|
98
|
+
name: displayFindings_1.DisplayFindings.toolName,
|
|
99
|
+
description: displayFindings_1.DisplayFindings.toolDescription,
|
|
100
|
+
inputSchema: displayFindings_1.DisplayFindings.inputSchema,
|
|
101
|
+
}, async (input, token, updates) => {
|
|
102
|
+
return await displayFindingsTool.execute(input, {
|
|
103
|
+
cancellationToken: token,
|
|
104
|
+
writableStream: updates,
|
|
105
|
+
});
|
|
106
|
+
}, server_interface_1.ToolClassification.BuiltIn);
|
|
87
107
|
});
|
|
88
108
|
return () => { };
|
|
89
109
|
};
|
|
90
110
|
exports.QCodeAnalysisServer = QCodeAnalysisServer;
|
|
91
|
-
const BashToolsServer = ({ logging, workspace, agent, lsp }) => {
|
|
92
|
-
const bashTool = new executeBash_1.ExecuteBash({ logging, workspace, lsp });
|
|
111
|
+
const BashToolsServer = ({ logging, workspace, agent, lsp, telemetry, credentialsProvider }) => {
|
|
112
|
+
const bashTool = new executeBash_1.ExecuteBash({ logging, workspace, lsp, telemetry, credentialsProvider });
|
|
93
113
|
agent.addTool(bashTool.getSpec(), async (input, token, updates) => {
|
|
94
114
|
await bashTool.validate(input);
|
|
95
115
|
return await bashTool.invoke(input, token, updates);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolServer.js","sourceRoot":"","sources":["../../../../src/language-server/agenticChat/tools/toolServer.ts"],"names":[],"mappings":";;;AAAA,qFAA8G;AAC9G,qCAA+C;AAC/C,uCAAkD;AAClD,mDAAoE;AACpE,+CAA8D;AAC9D,uDAA0E;AAC1E,uEAAkG;AAClG,mEAA+D;AAC/D,iDAAkE;AAClE,2CAAuC;AACvC,6CAA2D;AAE3D,2DAAuD;AACvD,+EAAgF;AAEhF,6CAMuB;AACvB,2CAAwD;AACxD,qEAAiE;AACjE,yDAA4F;
|
|
1
|
+
{"version":3,"file":"toolServer.js","sourceRoot":"","sources":["../../../../src/language-server/agenticChat/tools/toolServer.ts"],"names":[],"mappings":";;;AAAA,qFAA8G;AAC9G,qCAA+C;AAC/C,uCAAkD;AAClD,mDAAoE;AACpE,+CAA8D;AAC9D,uDAA0E;AAC1E,uEAAkG;AAClG,mEAA+D;AAC/D,iDAAkE;AAClE,2CAAuC;AACvC,6CAA2D;AAE3D,2DAAuD;AACvD,+EAAgF;AAEhF,6CAMuB;AACvB,2CAAwD;AACxD,qEAAiE;AACjE,yDAA4F;AAC5F,qEAAiE;AAE1D,MAAM,aAAa,GAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;IACxE,MAAM,UAAU,GAAG,IAAI,eAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IAC1D,MAAM,WAAW,GAAG,IAAI,iBAAO,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IAC5D,MAAM,iBAAiB,GAAG,IAAI,6BAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAA;IACxE,MAAM,cAAc,GAAG,IAAI,uBAAU,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IAClE,MAAM,aAAa,GAAG,IAAI,qBAAS,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IAEhE,KAAK,CAAC,OAAO,CACT,UAAU,CAAC,OAAO,EAAE,EACpB,KAAK,EAAE,KAAmB,EAAE,EAAE;QAC1B,MAAM,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAChC,OAAO,MAAM,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC,E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1
|
+
/**
|
|
2
|
+
* Parses command arguments and extracts only the base commands without arguments or options.
|
|
3
|
+
*
|
|
4
|
+
* Examples:
|
|
5
|
+
* - "cd /home/user/documents" -> ["cd"]
|
|
6
|
+
* - "echo 'Hello World' && ls -la" -> ["echo", "ls"]
|
|
7
|
+
* - "sudo apt-get install" -> ["sudo", "apt-get"]
|
|
8
|
+
* - "time curl http://example.com" -> ["time", "curl"]
|
|
9
|
+
* - "command1; command2" -> ["command1", "command2"]
|
|
10
|
+
* - "/usr/bin/python script.py" -> ["python"]
|
|
11
|
+
* - "./script.sh" -> ["script.sh"]
|
|
12
|
+
* - "function_name args" -> ["function_name"]
|
|
13
|
+
*
|
|
14
|
+
* @param args Array of command arguments
|
|
15
|
+
* @returns Array of base commands found in the input args
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseBaseCommands(args: string[]): string[];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseBaseCommands = parseBaseCommands;
|
|
4
|
+
const executeBash_1 = require("../tools/executeBash");
|
|
5
|
+
/**
|
|
6
|
+
* Parses command arguments and extracts only the base commands without arguments or options.
|
|
7
|
+
*
|
|
8
|
+
* Examples:
|
|
9
|
+
* - "cd /home/user/documents" -> ["cd"]
|
|
10
|
+
* - "echo 'Hello World' && ls -la" -> ["echo", "ls"]
|
|
11
|
+
* - "sudo apt-get install" -> ["sudo", "apt-get"]
|
|
12
|
+
* - "time curl http://example.com" -> ["time", "curl"]
|
|
13
|
+
* - "command1; command2" -> ["command1", "command2"]
|
|
14
|
+
* - "/usr/bin/python script.py" -> ["python"]
|
|
15
|
+
* - "./script.sh" -> ["script.sh"]
|
|
16
|
+
* - "function_name args" -> ["function_name"]
|
|
17
|
+
*
|
|
18
|
+
* @param args Array of command arguments
|
|
19
|
+
* @returns Array of base commands found in the input args
|
|
20
|
+
*/
|
|
21
|
+
function parseBaseCommands(args) {
|
|
22
|
+
if (!args || !Array.isArray(args) || args.length === 0) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
const baseCommands = [];
|
|
26
|
+
// Process the args to extract base commands
|
|
27
|
+
let i = 0;
|
|
28
|
+
let expectCommand = true; // Flag to indicate we're expecting a command
|
|
29
|
+
while (i < args.length) {
|
|
30
|
+
const arg = args[i];
|
|
31
|
+
// Check if this arg is an operator or contains an operator
|
|
32
|
+
if (executeBash_1.splitOperators.has(arg) || arg.includes(';')) {
|
|
33
|
+
expectCommand = true; // Next argument should be a command
|
|
34
|
+
i++;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (expectCommand) {
|
|
38
|
+
// Extract the base command
|
|
39
|
+
let baseCommand = arg;
|
|
40
|
+
// Handle path prefixes (/usr/bin/command or ./command)
|
|
41
|
+
if (baseCommand.includes('/')) {
|
|
42
|
+
baseCommand = baseCommand.split('/').pop() || baseCommand;
|
|
43
|
+
}
|
|
44
|
+
baseCommands.push(baseCommand);
|
|
45
|
+
// Special case for sudo, time, etc. - include the actual command too
|
|
46
|
+
if (['sudo', 'time', 'nice', 'nohup', 'env'].includes(baseCommand)) {
|
|
47
|
+
// Skip any flags/options and their values
|
|
48
|
+
let j = i + 1;
|
|
49
|
+
while (j < args.length) {
|
|
50
|
+
// If we find an operator, stop looking for the command
|
|
51
|
+
if (executeBash_1.splitOperators.has(args[j]) || args[j].includes(';')) {
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
// Skip flag and its value if present
|
|
55
|
+
if (args[j].startsWith('-')) {
|
|
56
|
+
// Handle flags with values (e.g., -u user, -n 10)
|
|
57
|
+
if (j + 1 < args.length &&
|
|
58
|
+
!args[j + 1].startsWith('-') &&
|
|
59
|
+
!executeBash_1.splitOperators.has(args[j + 1]) &&
|
|
60
|
+
!args[j + 1].includes(';')) {
|
|
61
|
+
j += 2; // Skip both the flag and its value
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
j++; // Skip just the flag
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Found the actual command
|
|
69
|
+
let nextCommand = args[j];
|
|
70
|
+
// Handle path prefixes for the command after sudo/time
|
|
71
|
+
if (nextCommand.includes('/')) {
|
|
72
|
+
nextCommand = nextCommand.split('/').pop() || nextCommand;
|
|
73
|
+
}
|
|
74
|
+
baseCommands.push(nextCommand);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// For all commands, we don't expect another command until we see an operator
|
|
79
|
+
expectCommand = false;
|
|
80
|
+
}
|
|
81
|
+
i++;
|
|
82
|
+
}
|
|
83
|
+
return baseCommands;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=commandParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandParser.js","sourceRoot":"","sources":["../../../../src/language-server/agenticChat/utils/commandParser.ts"],"names":[],"mappings":";;AAkBA,8CA+EC;AAjGD,sDAAqD;AAErD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,iBAAiB,CAAC,IAAc;IAC5C,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,EAAE,CAAA;IACb,CAAC;IAED,MAAM,YAAY,GAAa,EAAE,CAAA;IAEjC,4CAA4C;IAC5C,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,IAAI,aAAa,GAAG,IAAI,CAAA,CAAC,6CAA6C;IAEtE,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAEnB,2DAA2D;QAC3D,IAAI,4BAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/C,aAAa,G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