@aws/lsp-codewhisperer 0.0.28 → 0.0.30
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 +40 -0
- package/README.md +3 -0
- package/out/client/token/codewhisperer.d.ts +1 -1
- package/out/constants.d.ts +3 -0
- package/out/constants.js +4 -1
- package/out/constants.js.map +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +2 -0
- package/out/index.js.map +1 -1
- package/out/language-server/agenticChat/agenticChatController.d.ts +37 -0
- package/out/language-server/agenticChat/agenticChatController.js +361 -0
- package/out/language-server/agenticChat/agenticChatController.js.map +1 -0
- package/out/language-server/agenticChat/qAgenticChatServer.d.ts +6 -0
- package/out/language-server/agenticChat/qAgenticChatServer.js +92 -0
- package/out/language-server/agenticChat/qAgenticChatServer.js.map +1 -0
- package/out/language-server/amazonQServiceManager/AmazonQTokenServiceManager.d.ts +90 -0
- package/out/language-server/amazonQServiceManager/AmazonQTokenServiceManager.js +466 -0
- package/out/language-server/amazonQServiceManager/AmazonQTokenServiceManager.js.map +1 -0
- package/out/language-server/amazonQServiceManager/BaseAmazonQServiceManager.d.ts +5 -0
- package/out/language-server/amazonQServiceManager/BaseAmazonQServiceManager.js +3 -0
- package/out/language-server/amazonQServiceManager/BaseAmazonQServiceManager.js.map +1 -0
- package/out/language-server/amazonQServiceManager/errors.d.ts +28 -0
- package/out/language-server/amazonQServiceManager/errors.js +70 -0
- package/out/language-server/amazonQServiceManager/errors.js.map +1 -0
- package/out/language-server/amazonQServiceManager/qDeveloperProfiles.js +7 -7
- package/out/language-server/amazonQServiceManager/qDeveloperProfiles.js.map +1 -1
- package/out/language-server/chat/agents/docGeneration/constants.d.ts +59 -0
- package/out/language-server/chat/agents/docGeneration/constants.js +147 -0
- package/out/language-server/chat/agents/docGeneration/constants.js.map +1 -0
- package/out/language-server/chat/agents/docGeneration/errors.d.ts +29 -0
- package/out/language-server/chat/agents/docGeneration/errors.js +67 -0
- package/out/language-server/chat/agents/docGeneration/errors.js.map +1 -0
- package/out/language-server/chat/agents/shared/i18n.d.ts +1 -0
- package/out/language-server/chat/agents/shared/i18n.js +7 -0
- package/out/language-server/chat/agents/shared/i18n.js.map +1 -0
- package/out/language-server/chat/agents/shared/types.d.ts +55 -0
- package/out/language-server/chat/agents/shared/types.js +46 -0
- package/out/language-server/chat/agents/shared/types.js.map +1 -0
- package/out/language-server/chat/chatController.d.ts +1 -1
- package/out/language-server/chat/chatController.js +17 -1
- package/out/language-server/chat/chatController.js.map +1 -1
- package/out/language-server/chat/chatSessionManagementService.d.ts +3 -8
- package/out/language-server/chat/chatSessionManagementService.js +5 -57
- package/out/language-server/chat/chatSessionManagementService.js.map +1 -1
- package/out/language-server/chat/chatSessionService.d.ts +2 -3
- package/out/language-server/chat/chatSessionService.js +7 -21
- package/out/language-server/chat/chatSessionService.js.map +1 -1
- package/out/language-server/chat/contexts/documentContext.d.ts +2 -0
- package/out/language-server/chat/contexts/documentContext.js +14 -1
- package/out/language-server/chat/contexts/documentContext.js.map +1 -1
- package/out/language-server/chat/contexts/triggerContext.d.ts +1 -1
- package/out/language-server/chat/contexts/triggerContext.js +3 -2
- package/out/language-server/chat/contexts/triggerContext.js.map +1 -1
- package/out/language-server/chat/telemetry/chatTelemetryController.js +88 -81
- package/out/language-server/chat/telemetry/chatTelemetryController.js.map +1 -1
- package/out/language-server/codeWhispererSecurityScanServer.d.ts +2 -4
- package/out/language-server/codeWhispererSecurityScanServer.js +24 -11
- package/out/language-server/codeWhispererSecurityScanServer.js.map +1 -1
- package/out/language-server/codeWhispererServer.d.ts +1 -1
- package/out/language-server/codeWhispererServer.js +92 -38
- package/out/language-server/codeWhispererServer.js.map +1 -1
- package/out/language-server/codeWhispererService.d.ts +8 -1
- package/out/language-server/codeWhispererService.js +39 -16
- package/out/language-server/codeWhispererService.js.map +1 -1
- package/out/language-server/configuration/qConfigurationServer.d.ts +5 -9
- package/out/language-server/configuration/qConfigurationServer.js +23 -35
- package/out/language-server/configuration/qConfigurationServer.js.map +1 -1
- package/out/language-server/netTransformServer.js +2 -2
- package/out/language-server/netTransformServer.js.map +1 -1
- package/out/language-server/proxy-server.d.ts +1 -0
- package/out/language-server/proxy-server.js +8 -17
- package/out/language-server/proxy-server.js.map +1 -1
- package/out/language-server/qChatServer.d.ts +2 -4
- package/out/language-server/qChatServer.js +30 -16
- package/out/language-server/qChatServer.js.map +1 -1
- package/out/language-server/securityScan/constants.d.ts +3 -0
- package/out/language-server/securityScan/constants.js +7 -0
- package/out/language-server/securityScan/constants.js.map +1 -0
- package/out/language-server/securityScan/securityScanHandler.d.ts +5 -5
- package/out/language-server/securityScan/securityScanHandler.js +22 -12
- package/out/language-server/securityScan/securityScanHandler.js.map +1 -1
- package/out/language-server/telemetry/codeDiffTracker.d.ts +1 -1
- package/out/language-server/telemetry/codeDiffTracker.js +1 -1
- package/out/language-server/telemetry/codeDiffTracker.js.map +1 -1
- package/out/language-server/telemetryService.d.ts +7 -5
- package/out/language-server/telemetryService.js +29 -20
- package/out/language-server/telemetryService.js.map +1 -1
- package/out/language-server/testUtils.d.ts +3 -0
- package/out/language-server/testUtils.js +12 -1
- package/out/language-server/testUtils.js.map +1 -1
- package/out/language-server/utils.d.ts +2 -0
- package/out/language-server/utils.js +11 -0
- package/out/language-server/utils.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmazonQServiceNoProfileSupportError = exports.AmazonQServiceInvalidProfileError = exports.AmazonQServiceProfileUpdateCancelled = exports.AmazonQServicePendingProfileUpdateError = exports.AmazonQServicePendingProfileError = exports.AmazonQServicePendingSigninError = exports.AmazonQServiceNotInitializedError = exports.AmazonQServiceInitializationError = exports.AmazonQError = void 0;
|
|
4
|
+
// Base error class for Amazon Q
|
|
5
|
+
class AmazonQError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
constructor(message, code) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'AmazonQError';
|
|
10
|
+
this.code = code;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AmazonQError = AmazonQError;
|
|
14
|
+
class AmazonQServiceInitializationError extends AmazonQError {
|
|
15
|
+
constructor(message = 'Amazon Q service manager initilization error') {
|
|
16
|
+
super(message, 'E_AMAZON_Q_INITIALIZATION_ERROR');
|
|
17
|
+
this.name = 'AmazonQServiceInitializationError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AmazonQServiceInitializationError = AmazonQServiceInitializationError;
|
|
21
|
+
class AmazonQServiceNotInitializedError extends AmazonQError {
|
|
22
|
+
constructor(message = 'Amazon Q service SDK is not initialized') {
|
|
23
|
+
super(message, 'E_AMAZON_Q_NOT_INITIALIZED');
|
|
24
|
+
this.name = 'AmazonQServiceNotInitializedError';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.AmazonQServiceNotInitializedError = AmazonQServiceNotInitializedError;
|
|
28
|
+
class AmazonQServicePendingSigninError extends AmazonQError {
|
|
29
|
+
constructor(message = 'Amazon Q service is not signed in') {
|
|
30
|
+
super(message, 'E_AMAZON_Q_PENDING_CONNECTION');
|
|
31
|
+
this.name = 'AmazonQServicePendingSigninError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.AmazonQServicePendingSigninError = AmazonQServicePendingSigninError;
|
|
35
|
+
class AmazonQServicePendingProfileError extends AmazonQError {
|
|
36
|
+
constructor(message = 'Amazon Q Profile is not selected for IDC connection type') {
|
|
37
|
+
super(message, 'E_AMAZON_Q_PENDING_PROFILE');
|
|
38
|
+
this.name = 'AmazonQServicePendingProfileError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.AmazonQServicePendingProfileError = AmazonQServicePendingProfileError;
|
|
42
|
+
class AmazonQServicePendingProfileUpdateError extends AmazonQError {
|
|
43
|
+
constructor(message = 'Amazon Q Profile is pending update') {
|
|
44
|
+
super(message, 'E_AMAZON_Q_PENDING_PROFILE_UPDATE');
|
|
45
|
+
this.name = 'AmazonQServicePendingProfileUpdateError';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.AmazonQServicePendingProfileUpdateError = AmazonQServicePendingProfileUpdateError;
|
|
49
|
+
class AmazonQServiceProfileUpdateCancelled extends AmazonQError {
|
|
50
|
+
constructor(message = 'Amazon Q Profile cancelled') {
|
|
51
|
+
super(message, 'E_AMAZON_Q_PROFILE_UPDATE_CANCELLED');
|
|
52
|
+
this.name = 'AmazonQServiceProfileUpdateCancelled';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.AmazonQServiceProfileUpdateCancelled = AmazonQServiceProfileUpdateCancelled;
|
|
56
|
+
class AmazonQServiceInvalidProfileError extends AmazonQError {
|
|
57
|
+
constructor(message = 'Selected Amazon Q Profile is invalid') {
|
|
58
|
+
super(message, 'E_AMAZON_Q_INVALID_PROFILE');
|
|
59
|
+
this.name = 'AmazonQServiceInvalidProfileError';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.AmazonQServiceInvalidProfileError = AmazonQServiceInvalidProfileError;
|
|
63
|
+
class AmazonQServiceNoProfileSupportError extends AmazonQError {
|
|
64
|
+
constructor(message = 'Current Connection type does not support Amazon Q Profiles') {
|
|
65
|
+
super(message, 'E_AMAZON_Q_CONNECTION_NO_PROFILE_SUPPORT');
|
|
66
|
+
this.name = 'AmazonQServiceNoProfileSupportError';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.AmazonQServiceNoProfileSupportError = AmazonQServiceNoProfileSupportError;
|
|
70
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../src/language-server/amazonQServiceManager/errors.ts"],"names":[],"mappings":";;;AAAA,gCAAgC;AAChC,MAAa,YAAa,SAAQ,KAAK;I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AqC,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,GAAG,sCAAsC,CAAA;IACtD,CAAC;CACJ;AALD,oFAKC;AAED,MAAa,iCAAkC,SAAQ,YAAY;IAC/D,YAAY,UAAkB,sCAAsC;QAChE,KAAK,CAAC,OAAO,EAAE,4BAA4B,CAAC,CAAA;QAC5C,IAAI,CAAC,IAAI,GAAG,mCAAmC,CAAA;IACnD,CAAC;CACJ;AALD,8EAKC;AAED,MAAa,mCAAoC,SAAQ,YAAY;IACjE,YAAY,UAAkB,4DAA4D;QACtF,KAAK,CAAC,OAAO,EAAE,0CAA0C,CAAC,CAAA;QAC1D,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAA;IACrD,CAAC;CACJ;AALD,kFAKC"}
|
|
@@ -44,9 +44,9 @@ async function fetchProfilesFromRegion(service, region, logging) {
|
|
|
44
44
|
},
|
|
45
45
|
}));
|
|
46
46
|
allRegionalProfiles.push(...profiles);
|
|
47
|
+
logging.debug(`Fetched profiles from ${region}: ${JSON.stringify(response)} (iteration: ${numberOfPages})`);
|
|
47
48
|
nextToken = response.nextToken;
|
|
48
49
|
numberOfPages++;
|
|
49
|
-
logging.debug(`Fetched profiles from ${region}: ${JSON.stringify(response)} (iteration: ${numberOfPages})`);
|
|
50
50
|
} while (nextToken !== undefined && numberOfPages < exports.MAX_Q_DEVELOPER_PROFILE_PAGES);
|
|
51
51
|
return allRegionalProfiles;
|
|
52
52
|
}
|
|
@@ -73,12 +73,12 @@ const developerProfilesEnabledKey = 'developerProfiles';
|
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
function signalsAWSQDeveloperProfilesEnabled(initializationOptions) {
|
|
76
|
-
const
|
|
77
|
-
if ((0, utils_1.isObject)(
|
|
78
|
-
!(
|
|
79
|
-
developerProfilesEnabledKey in
|
|
80
|
-
(0, utils_1.isBool)(
|
|
81
|
-
return
|
|
76
|
+
const qCapabilities = initializationOptions.awsClientCapabilities?.[AWSQCapabilitiesKey];
|
|
77
|
+
if ((0, utils_1.isObject)(qCapabilities) &&
|
|
78
|
+
!(qCapabilities instanceof Array) &&
|
|
79
|
+
developerProfilesEnabledKey in qCapabilities &&
|
|
80
|
+
(0, utils_1.isBool)(qCapabilities[developerProfilesEnabledKey])) {
|
|
81
|
+
return qCapabilities[developerProfilesEnabledKey];
|
|
82
82
|
}
|
|
83
83
|
return false;
|
|
84
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qDeveloperProfiles.js","sourceRoot":"","sources":["../../../src/language-server/amazonQServiceManager/qDeveloperProfiles.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"qDeveloperProfiles.js","sourceRoot":"","sources":["../../../src/language-server/amazonQServiceManager/qDeveloperProfiles.ts"],"names":[],"mappings":";;;AAwHA,kFAaC;AArID,qFAKuD;AACvD,oCAA8D;AAC9D,+CAAiD;AAuBpC,QAAA,6BAA6B,GAAG,EAAE,CAAA;AAC/C,MAAM,iCAAiC,GAAG,EAAE,CAAA;AAErC,MAAM,kCAAkC,GAC3C,CAAC,OAAwE,EAAmC,EAAE,CAC9G,KAAK,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;IAC7C,IAAI,CAAC,cAAc,IAAI,cAAc,KAAK,gBAAgB,EAAE,CAAC;QACzD,OAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAA;QAC7F,OAAO,EAAE,CAAA;IACb,CAAC;IAED,IAAI,WAAW,GAA8B,EAAE,CAAA;IAC/C,MAAM,UAAU,GAAG,SAAS,IAAI,2BAAe,CAAA;IAE/C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CACnC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,EAAE;QAClD,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACt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,CAAA;YAErC,OAAO,CAAC,KAAK,CAAC,yBAAyB,MAAM,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,gBAAgB,aAAa,GAAG,CAAC,CAAA;YAC3G,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;YAC9B,aAAa,EAAE,CAAA;QACnB,CAAC,QAAQ,SAAS,KAAK,SAAS,IAAI,aAAa,GAAG,qCAA6B,EAAC;QAElF,OAAO,mBAAmB,CAAA;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,gCAAgC,MAAM,KAAK,KAAK,EAAE,CAAC,CAAA;QAEjE,MAAM,KAAK,CAAA;IACf,CAAC;AACL,CAAC;AAED,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAC/B,MAAM,2BAA2B,GAAG,mBAAmB,CAAA;AAEvD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,mCAAmC,CAAC,qBAA+C;IAC/F,MAAM,aAAa,GAAG,qBAAqB,CAAC,qBAAqB,EAAE,CAAC,mBAAmB,CAAC,CAAA;IAExF,IACI,IAAA,gBAAQ,EAAC,aAAa,CAAC;QACvB,CAAC,CAAC,aAAa,YAAY,KAAK,CAAC;QACjC,2BAA2B,IAAI,aAAa;QAC5C,IAAA,cAAM,EAAC,aAAa,CAAC,2BAA2B,CAAC,CAAC,EACpD,CAAC;QACC,OAAO,aAAa,CAAC,2BAA2B,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,KAAK,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { MynahIcons, Status } from '@aws/mynah-ui';
|
|
6
|
+
import { FollowUpTypes, NewFileInfo } from '../shared/types';
|
|
7
|
+
export declare const docChat = "docChat";
|
|
8
|
+
export declare const docScheme = "aws-doc";
|
|
9
|
+
export declare const featureName = "Amazon Q Doc Generation";
|
|
10
|
+
export declare function getFileSummaryPercentage(input: string): number;
|
|
11
|
+
export declare enum DocGenerationStep {
|
|
12
|
+
UPLOAD_TO_S3 = 0,
|
|
13
|
+
SUMMARIZING_FILES = 1,
|
|
14
|
+
GENERATING_ARTIFACTS = 2
|
|
15
|
+
}
|
|
16
|
+
export declare const docGenerationProgressMessage: (currentStep: DocGenerationStep, mode: Mode) => string;
|
|
17
|
+
export declare const docGenerationSuccessMessage: (mode: Mode) => string;
|
|
18
|
+
export declare const docRejectConfirmation = "Your changes have been discarded.";
|
|
19
|
+
export declare const FolderSelectorFollowUps: {
|
|
20
|
+
icon: MynahIcons;
|
|
21
|
+
pillText: string;
|
|
22
|
+
prompt: string;
|
|
23
|
+
status: Status;
|
|
24
|
+
type: FollowUpTypes;
|
|
25
|
+
}[];
|
|
26
|
+
export declare const CodeChangeFollowUps: {
|
|
27
|
+
pillText: string;
|
|
28
|
+
prompt: string;
|
|
29
|
+
type: FollowUpTypes;
|
|
30
|
+
icon: MynahIcons;
|
|
31
|
+
status: Status;
|
|
32
|
+
}[];
|
|
33
|
+
export declare const NewSessionFollowUps: {
|
|
34
|
+
pillText: string;
|
|
35
|
+
type: FollowUpTypes;
|
|
36
|
+
status: Status;
|
|
37
|
+
}[];
|
|
38
|
+
export declare const SynchronizeDocumentation: {
|
|
39
|
+
pillText: string;
|
|
40
|
+
prompt: string;
|
|
41
|
+
type: FollowUpTypes;
|
|
42
|
+
};
|
|
43
|
+
export declare const EditDocumentation: {
|
|
44
|
+
pillText: string;
|
|
45
|
+
prompt: string;
|
|
46
|
+
type: FollowUpTypes;
|
|
47
|
+
};
|
|
48
|
+
export declare enum Mode {
|
|
49
|
+
NONE = "None",
|
|
50
|
+
CREATE = "Create",
|
|
51
|
+
SYNC = "Sync",
|
|
52
|
+
EDIT = "Edit"
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param paths file paths
|
|
57
|
+
* @returns the path to a README.md, or undefined if none exist
|
|
58
|
+
*/
|
|
59
|
+
export declare const findReadmePath: (paths?: NewFileInfo[]) => NewFileInfo | undefined;
|
|
@@ -0,0 +1,147 @@
|
|
|
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.findReadmePath = exports.Mode = exports.EditDocumentation = exports.SynchronizeDocumentation = exports.NewSessionFollowUps = exports.CodeChangeFollowUps = exports.FolderSelectorFollowUps = exports.docRejectConfirmation = exports.docGenerationSuccessMessage = exports.docGenerationProgressMessage = exports.DocGenerationStep = exports.featureName = exports.docScheme = exports.docChat = void 0;
|
|
8
|
+
exports.getFileSummaryPercentage = getFileSummaryPercentage;
|
|
9
|
+
const types_1 = require("../shared/types");
|
|
10
|
+
const i18n_1 = require("../shared/i18n");
|
|
11
|
+
// For uniquely identifiying which chat messages should be routed to Doc
|
|
12
|
+
exports.docChat = 'docChat';
|
|
13
|
+
exports.docScheme = 'aws-doc';
|
|
14
|
+
exports.featureName = 'Amazon Q Doc Generation';
|
|
15
|
+
function getFileSummaryPercentage(input) {
|
|
16
|
+
// Split the input string by newline characters
|
|
17
|
+
const lines = input.split('\n');
|
|
18
|
+
// Find the line containing "summarized:"
|
|
19
|
+
const summaryLine = lines.find(line => line.includes('summarized:'));
|
|
20
|
+
// If the line is not found, return null
|
|
21
|
+
if (!summaryLine) {
|
|
22
|
+
return -1;
|
|
23
|
+
}
|
|
24
|
+
// Extract the numbers from the summary line
|
|
25
|
+
const [summarized, total] = summaryLine.split(':')[1].trim().split(' of ').map(Number);
|
|
26
|
+
// Calculate the percentage
|
|
27
|
+
const percentage = (summarized / total) * 100;
|
|
28
|
+
return percentage;
|
|
29
|
+
}
|
|
30
|
+
const checkIcons = {
|
|
31
|
+
wait: '☐',
|
|
32
|
+
current: '☐',
|
|
33
|
+
done: '☑',
|
|
34
|
+
};
|
|
35
|
+
const getIconForStep = (targetStep, currentStep) => {
|
|
36
|
+
return currentStep === targetStep
|
|
37
|
+
? checkIcons.current
|
|
38
|
+
: currentStep > targetStep
|
|
39
|
+
? checkIcons.done
|
|
40
|
+
: checkIcons.wait;
|
|
41
|
+
};
|
|
42
|
+
var DocGenerationStep;
|
|
43
|
+
(function (DocGenerationStep) {
|
|
44
|
+
DocGenerationStep[DocGenerationStep["UPLOAD_TO_S3"] = 0] = "UPLOAD_TO_S3";
|
|
45
|
+
DocGenerationStep[DocGenerationStep["SUMMARIZING_FILES"] = 1] = "SUMMARIZING_FILES";
|
|
46
|
+
DocGenerationStep[DocGenerationStep["GENERATING_ARTIFACTS"] = 2] = "GENERATING_ARTIFACTS";
|
|
47
|
+
})(DocGenerationStep || (exports.DocGenerationStep = DocGenerationStep = {}));
|
|
48
|
+
const docGenerationProgressMessage = (currentStep, mode) => `
|
|
49
|
+
${mode === Mode.CREATE ? (0, i18n_1.i18n)('AWS.amazonq.doc.answer.creating') : (0, i18n_1.i18n)('AWS.amazonq.doc.answer.updating')}
|
|
50
|
+
|
|
51
|
+
${getIconForStep(DocGenerationStep.UPLOAD_TO_S3, currentStep)} ${(0, i18n_1.i18n)('AWS.amazonq.doc.answer.scanning')}
|
|
52
|
+
|
|
53
|
+
${getIconForStep(DocGenerationStep.SUMMARIZING_FILES, currentStep)} ${(0, i18n_1.i18n)('AWS.amazonq.doc.answer.summarizing')}
|
|
54
|
+
|
|
55
|
+
${getIconForStep(DocGenerationStep.GENERATING_ARTIFACTS, currentStep)} ${(0, i18n_1.i18n)('AWS.amazonq.doc.answer.generating')}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
`;
|
|
59
|
+
exports.docGenerationProgressMessage = docGenerationProgressMessage;
|
|
60
|
+
const docGenerationSuccessMessage = (mode) => mode === Mode.CREATE ? (0, i18n_1.i18n)('AWS.amazonq.doc.answer.readmeCreated') : (0, i18n_1.i18n)('AWS.amazonq.doc.answer.readmeUpdated');
|
|
61
|
+
exports.docGenerationSuccessMessage = docGenerationSuccessMessage;
|
|
62
|
+
exports.docRejectConfirmation = 'Your changes have been discarded.';
|
|
63
|
+
exports.FolderSelectorFollowUps = [
|
|
64
|
+
{
|
|
65
|
+
icon: 'ok',
|
|
66
|
+
pillText: 'Yes',
|
|
67
|
+
prompt: 'Yes',
|
|
68
|
+
status: 'success',
|
|
69
|
+
type: types_1.FollowUpTypes.ProceedFolderSelection,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
icon: 'refresh',
|
|
73
|
+
pillText: 'Change folder',
|
|
74
|
+
prompt: 'Change folder',
|
|
75
|
+
status: 'info',
|
|
76
|
+
type: types_1.FollowUpTypes.ChooseFolder,
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
icon: 'cancel',
|
|
80
|
+
pillText: 'Cancel',
|
|
81
|
+
prompt: 'Cancel',
|
|
82
|
+
status: 'error',
|
|
83
|
+
type: types_1.FollowUpTypes.CancelFolderSelection,
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
exports.CodeChangeFollowUps = [
|
|
87
|
+
{
|
|
88
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.accept'),
|
|
89
|
+
prompt: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.accept'),
|
|
90
|
+
type: types_1.FollowUpTypes.AcceptChanges,
|
|
91
|
+
icon: 'ok',
|
|
92
|
+
status: 'success',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.makeChanges'),
|
|
96
|
+
prompt: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.makeChanges'),
|
|
97
|
+
type: types_1.FollowUpTypes.MakeChanges,
|
|
98
|
+
icon: 'refresh',
|
|
99
|
+
status: 'info',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.reject'),
|
|
103
|
+
prompt: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.reject'),
|
|
104
|
+
type: types_1.FollowUpTypes.RejectChanges,
|
|
105
|
+
icon: 'cancel',
|
|
106
|
+
status: 'error',
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
exports.NewSessionFollowUps = [
|
|
110
|
+
{
|
|
111
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.newTask'),
|
|
112
|
+
type: types_1.FollowUpTypes.NewTask,
|
|
113
|
+
status: 'info',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.closeSession'),
|
|
117
|
+
type: types_1.FollowUpTypes.CloseSession,
|
|
118
|
+
status: 'info',
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
exports.SynchronizeDocumentation = {
|
|
122
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.update'),
|
|
123
|
+
prompt: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.update'),
|
|
124
|
+
type: types_1.FollowUpTypes.SynchronizeDocumentation,
|
|
125
|
+
};
|
|
126
|
+
exports.EditDocumentation = {
|
|
127
|
+
pillText: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.makeChange'),
|
|
128
|
+
prompt: (0, i18n_1.i18n)('AWS.amazonq.doc.pillText.makeChange'),
|
|
129
|
+
type: types_1.FollowUpTypes.EditDocumentation,
|
|
130
|
+
};
|
|
131
|
+
var Mode;
|
|
132
|
+
(function (Mode) {
|
|
133
|
+
Mode["NONE"] = "None";
|
|
134
|
+
Mode["CREATE"] = "Create";
|
|
135
|
+
Mode["SYNC"] = "Sync";
|
|
136
|
+
Mode["EDIT"] = "Edit";
|
|
137
|
+
})(Mode || (exports.Mode = Mode = {}));
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* @param paths file paths
|
|
141
|
+
* @returns the path to a README.md, or undefined if none exist
|
|
142
|
+
*/
|
|
143
|
+
const findReadmePath = (paths) => {
|
|
144
|
+
return paths?.find(path => /readme\.md$/i.test(path.relativePath));
|
|
145
|
+
};
|
|
146
|
+
exports.findReadmePath = findReadmePath;
|
|
147
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/language-server/chat/agents/docGeneration/constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAaH,4DAmBC;AA7BD,2CAA4D;AAC5D,yCAAqC;AAErC,wEAAwE;AAC3D,QAAA,OAAO,GAAG,SAAS,CAAA;AAEnB,QAAA,SAAS,GAAG,SAAS,CAAA;AAErB,QAAA,WAAW,GAAG,yBAAyB,CAAA;AAEpD,SAAgB,wBAAwB,CAAC,KAAa;IAClD,+CAA+C;IAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAE/B,yCAAyC;IACzC,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAA;IAEpE,wCAAwC;IACxC,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,CAAC,CAAC,CAAA;IACb,CAAC;IAED,4CAA4C;IAC5C,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAEtF,2BAA2B;IAC3B,MAAM,UAAU,GAAG,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,GAAG,CAAA;IAE7C,OAAO,UAAU,CAAA;AACrB,CAAC;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
remainingIterations?: number;
|
|
7
|
+
constructor(message: string, code: string, remainingIterations?: number);
|
|
8
|
+
}
|
|
9
|
+
export declare class ReadmeTooLargeError extends DocClientError {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export declare class ReadmeUpdateTooLargeError extends DocClientError {
|
|
13
|
+
constructor(remainingIterations: number);
|
|
14
|
+
}
|
|
15
|
+
export declare class WorkspaceEmptyError extends DocClientError {
|
|
16
|
+
constructor();
|
|
17
|
+
}
|
|
18
|
+
export declare class NoChangeRequiredException extends DocClientError {
|
|
19
|
+
constructor();
|
|
20
|
+
}
|
|
21
|
+
export declare class PromptRefusalException extends DocClientError {
|
|
22
|
+
constructor(remainingIterations: number);
|
|
23
|
+
}
|
|
24
|
+
export declare class PromptTooVagueError extends DocClientError {
|
|
25
|
+
constructor(remainingIterations: number);
|
|
26
|
+
}
|
|
27
|
+
export declare class PromptUnrelatedError extends DocClientError {
|
|
28
|
+
constructor(remainingIterations: number);
|
|
29
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.PromptUnrelatedError = exports.PromptTooVagueError = exports.PromptRefusalException = exports.NoChangeRequiredException = exports.WorkspaceEmptyError = exports.ReadmeUpdateTooLargeError = exports.ReadmeTooLargeError = exports.DocClientError = void 0;
|
|
8
|
+
//TODO: extend the toolkit error once ready
|
|
9
|
+
// import { ClientError, ContentLengthError as CommonContentLengthError } from '../shared/errors'
|
|
10
|
+
const i18n_1 = require("../shared/i18n");
|
|
11
|
+
class DocClientError {
|
|
12
|
+
remainingIterations;
|
|
13
|
+
constructor(message, code, remainingIterations) {
|
|
14
|
+
// super(message, { code })
|
|
15
|
+
this.remainingIterations = remainingIterations;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.DocClientError = DocClientError;
|
|
19
|
+
class ReadmeTooLargeError extends DocClientError {
|
|
20
|
+
constructor() {
|
|
21
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.readmeTooLarge'), ReadmeTooLargeError.name);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ReadmeTooLargeError = ReadmeTooLargeError;
|
|
25
|
+
class ReadmeUpdateTooLargeError extends DocClientError {
|
|
26
|
+
constructor(remainingIterations) {
|
|
27
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.readmeUpdateTooLarge'), ReadmeUpdateTooLargeError.name, remainingIterations);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ReadmeUpdateTooLargeError = ReadmeUpdateTooLargeError;
|
|
31
|
+
class WorkspaceEmptyError extends DocClientError {
|
|
32
|
+
constructor() {
|
|
33
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.workspaceEmpty'), WorkspaceEmptyError.name);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.WorkspaceEmptyError = WorkspaceEmptyError;
|
|
37
|
+
class NoChangeRequiredException extends DocClientError {
|
|
38
|
+
constructor() {
|
|
39
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.noChangeRequiredException'), NoChangeRequiredException.name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.NoChangeRequiredException = NoChangeRequiredException;
|
|
43
|
+
class PromptRefusalException extends DocClientError {
|
|
44
|
+
constructor(remainingIterations) {
|
|
45
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.promptRefusal'), PromptRefusalException.name, remainingIterations);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.PromptRefusalException = PromptRefusalException;
|
|
49
|
+
// TODO: move the common content length error to shared folder
|
|
50
|
+
// export class ContentLengthError extends CommonContentLengthError {
|
|
51
|
+
// constructor() {
|
|
52
|
+
// super(i18n('AWS.amazonq.doc.error.contentLengthError'), { code: ContentLengthError.name })
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
class PromptTooVagueError extends DocClientError {
|
|
56
|
+
constructor(remainingIterations) {
|
|
57
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.promptTooVague'), PromptTooVagueError.name, remainingIterations);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.PromptTooVagueError = PromptTooVagueError;
|
|
61
|
+
class PromptUnrelatedError extends DocClientError {
|
|
62
|
+
constructor(remainingIterations) {
|
|
63
|
+
super((0, i18n_1.i18n)('AWS.amazonq.doc.error.promptUnrelated'), PromptUnrelatedError.name, remainingIterations);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.PromptUnrelatedError = PromptUnrelatedError;
|
|
67
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/language-server/chat/agents/docGeneration/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAA2C;AAC3C,iGAAiG;AACjG,yCAAqC;AAErC,MAAa,cAAc;IACvB,mBAAmB,CAAS;IAC5B,YAAY,OAAe,EAAE,IAAY,EAAE,mBAA4B;QACnE,2BAA2B;QAC3B,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;IAClD,CAAC;CACJ;AAND,wCAMC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACnD;QACI,KAAK,CAAC,IAAA,WAAI,EAAC,sCAAsC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACjF,CAAC;CACJ;AAJD,kDAIC;AAED,MAAa,yBAA0B,SAAQ,cAAc;IACzD,YAAY,mBAA2B;QACnC,KAAK,CAAC,IAAA,WAAI,EAAC,4CAA4C,CAAC,EAAE,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;IAClH,CAAC;CACJ;AAJD,8DAIC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACnD;QACI,KAAK,CAAC,IAAA,WAAI,EAAC,sCAAsC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAA;IACjF,CAAC;CACJ;AAJD,kDAIC;AAED,MAAa,yBAA0B,SAAQ,cAAc;IACzD;QACI,KAAK,CAAC,IAAA,WAAI,EAAC,iDAAiD,CAAC,EAAE,yBAAyB,CAAC,IAAI,CAAC,CAAA;IAClG,CAAC;CACJ;AAJD,8DAIC;AAED,MAAa,sBAAuB,SAAQ,cAAc;IACtD,YAAY,mBAA2B;QACnC,KAAK,CAAC,IAAA,WAAI,EAAC,qCAAqC,CAAC,EAAE,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;IACxG,CAAC;CACJ;AAJD,wDAIC;AAED,8DAA8D;AAC9D,qEAAqE;AACrE,sBAAsB;AACtB,qGAAqG;AACrG,QAAQ;AACR,IAAI;AACJ,MAAa,mBAAoB,SAAQ,cAAc;IACnD,YAAY,mBAA2B;QACnC,KAAK,CAAC,IAAA,WAAI,EAAC,sCAAsC,CAAC,EAAE,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;IACtG,CAAC;CACJ;AAJD,kDAIC;AAED,MAAa,oBAAqB,SAAQ,cAAc;IACpD,YAAY,mBAA2B;QACnC,KAAK,CAAC,IAAA,WAAI,EAAC,uCAAuC,CAAC,EAAE,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;IACxG,CAAC;CACJ;AAJD,oDAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function i18n(text: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.js","sourceRoot":"","sources":["../../../../../src/language-server/chat/agents/shared/i18n.ts"],"names":[],"mappings":";;AAAA,oBAEC;AAFD,SAAgB,IAAI,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { WorkspaceFolder } from '@aws/language-server-runtimes/protocol';
|
|
6
|
+
export declare enum FollowUpTypes {
|
|
7
|
+
ViewDiff = "ViewDiff",
|
|
8
|
+
AcceptCode = "AcceptCode",
|
|
9
|
+
RejectCode = "RejectCode",
|
|
10
|
+
BuildAndExecute = "BuildAndExecute",
|
|
11
|
+
ModifyCommands = "ModifyCommands",
|
|
12
|
+
SkipBuildAndFinish = "SkipBuildAndFinish",
|
|
13
|
+
InstallDependenciesAndContinue = "InstallDependenciesAndContinue",
|
|
14
|
+
ContinueBuildAndExecute = "ContinueBuildAndExecute",
|
|
15
|
+
ViewCodeDiffAfterIteration = "ViewCodeDiffAfterIteration",
|
|
16
|
+
GenerateCode = "GenerateCode",
|
|
17
|
+
InsertCode = "InsertCode",
|
|
18
|
+
ProvideFeedbackAndRegenerateCode = "ProvideFeedbackAndRegenerateCode",
|
|
19
|
+
Retry = "Retry",
|
|
20
|
+
ModifyDefaultSourceFolder = "ModifyDefaultSourceFolder",
|
|
21
|
+
DevExamples = "DevExamples",
|
|
22
|
+
NewTask = "NewTask",
|
|
23
|
+
CloseSession = "CloseSession",
|
|
24
|
+
SendFeedback = "SendFeedback",
|
|
25
|
+
AcceptAutoBuild = "AcceptAutoBuild",
|
|
26
|
+
DenyAutoBuild = "DenyAutoBuild",
|
|
27
|
+
GenerateDevFile = "GenerateDevFile",
|
|
28
|
+
CreateDocumentation = "CreateDocumentation",
|
|
29
|
+
ChooseFolder = "ChooseFolder",
|
|
30
|
+
UpdateDocumentation = "UpdateDocumentation",
|
|
31
|
+
SynchronizeDocumentation = "SynchronizeDocumentation",
|
|
32
|
+
EditDocumentation = "EditDocumentation",
|
|
33
|
+
AcceptChanges = "AcceptChanges",
|
|
34
|
+
RejectChanges = "RejectChanges",
|
|
35
|
+
MakeChanges = "MakeChanges",
|
|
36
|
+
ProceedFolderSelection = "ProceedFolderSelection",
|
|
37
|
+
CancelFolderSelection = "CancelFolderSelection"
|
|
38
|
+
}
|
|
39
|
+
export type DiffTreeFileInfo = {
|
|
40
|
+
zipFilePath: string;
|
|
41
|
+
relativePath: string;
|
|
42
|
+
rejected: boolean;
|
|
43
|
+
changeApplied: boolean;
|
|
44
|
+
};
|
|
45
|
+
export type NewFileZipContents = {
|
|
46
|
+
zipFilePath: string;
|
|
47
|
+
fileContent: string;
|
|
48
|
+
};
|
|
49
|
+
export type DeletedFileInfo = DiffTreeFileInfo & {
|
|
50
|
+
workspaceFolder: WorkspaceFolder;
|
|
51
|
+
};
|
|
52
|
+
export type NewFileInfo = DiffTreeFileInfo & NewFileZipContents & {
|
|
53
|
+
virtualMemoryUri: string;
|
|
54
|
+
workspaceFolder: WorkspaceFolder;
|
|
55
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
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.FollowUpTypes = void 0;
|
|
8
|
+
//TODO: May not be needed follow up with flare
|
|
9
|
+
var FollowUpTypes;
|
|
10
|
+
(function (FollowUpTypes) {
|
|
11
|
+
// UnitTestGeneration
|
|
12
|
+
FollowUpTypes["ViewDiff"] = "ViewDiff";
|
|
13
|
+
FollowUpTypes["AcceptCode"] = "AcceptCode";
|
|
14
|
+
FollowUpTypes["RejectCode"] = "RejectCode";
|
|
15
|
+
FollowUpTypes["BuildAndExecute"] = "BuildAndExecute";
|
|
16
|
+
FollowUpTypes["ModifyCommands"] = "ModifyCommands";
|
|
17
|
+
FollowUpTypes["SkipBuildAndFinish"] = "SkipBuildAndFinish";
|
|
18
|
+
FollowUpTypes["InstallDependenciesAndContinue"] = "InstallDependenciesAndContinue";
|
|
19
|
+
FollowUpTypes["ContinueBuildAndExecute"] = "ContinueBuildAndExecute";
|
|
20
|
+
FollowUpTypes["ViewCodeDiffAfterIteration"] = "ViewCodeDiffAfterIteration";
|
|
21
|
+
// FeatureDev
|
|
22
|
+
FollowUpTypes["GenerateCode"] = "GenerateCode";
|
|
23
|
+
FollowUpTypes["InsertCode"] = "InsertCode";
|
|
24
|
+
FollowUpTypes["ProvideFeedbackAndRegenerateCode"] = "ProvideFeedbackAndRegenerateCode";
|
|
25
|
+
FollowUpTypes["Retry"] = "Retry";
|
|
26
|
+
FollowUpTypes["ModifyDefaultSourceFolder"] = "ModifyDefaultSourceFolder";
|
|
27
|
+
FollowUpTypes["DevExamples"] = "DevExamples";
|
|
28
|
+
FollowUpTypes["NewTask"] = "NewTask";
|
|
29
|
+
FollowUpTypes["CloseSession"] = "CloseSession";
|
|
30
|
+
FollowUpTypes["SendFeedback"] = "SendFeedback";
|
|
31
|
+
FollowUpTypes["AcceptAutoBuild"] = "AcceptAutoBuild";
|
|
32
|
+
FollowUpTypes["DenyAutoBuild"] = "DenyAutoBuild";
|
|
33
|
+
FollowUpTypes["GenerateDevFile"] = "GenerateDevFile";
|
|
34
|
+
// Doc
|
|
35
|
+
FollowUpTypes["CreateDocumentation"] = "CreateDocumentation";
|
|
36
|
+
FollowUpTypes["ChooseFolder"] = "ChooseFolder";
|
|
37
|
+
FollowUpTypes["UpdateDocumentation"] = "UpdateDocumentation";
|
|
38
|
+
FollowUpTypes["SynchronizeDocumentation"] = "SynchronizeDocumentation";
|
|
39
|
+
FollowUpTypes["EditDocumentation"] = "EditDocumentation";
|
|
40
|
+
FollowUpTypes["AcceptChanges"] = "AcceptChanges";
|
|
41
|
+
FollowUpTypes["RejectChanges"] = "RejectChanges";
|
|
42
|
+
FollowUpTypes["MakeChanges"] = "MakeChanges";
|
|
43
|
+
FollowUpTypes["ProceedFolderSelection"] = "ProceedFolderSelection";
|
|
44
|
+
FollowUpTypes["CancelFolderSelection"] = "CancelFolderSelection";
|
|
45
|
+
})(FollowUpTypes || (exports.FollowUpTypes = FollowUpTypes = {}));
|
|
46
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/language-server/chat/agents/shared/types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,8CAA8C;AAC9C,IAAY,aAmCX;AAnCD,WAAY,aAAa;IACrB,qBAAqB;IACrB,sCAAqB,CAAA;IACrB,0CAAyB,CAAA;IACzB,0CAAyB,CAAA;IACzB,oDAAmC,CAAA;IACnC,kDAAiC,CAAA;IACjC,0DAAyC,CAAA;IACzC,kFAAiE,CAAA;IACjE,oEAAmD,CAAA;IACnD,0EAAyD,CAAA;IACzD,aAAa;IACb,8CAA6B,CAAA;IAC7B,0CAAyB,CAAA;IACzB,sFAAqE,CAAA;IACrE,gCAAe,CAAA;IACf,wEAAuD,CAAA;IACvD,4CAA2B,CAAA;IAC3B,oCAAmB,CAAA;IACnB,8CAA6B,CAAA;IAC7B,8CAA6B,CAAA;IAC7B,oDAAmC,CAAA;IACnC,gDAA+B,CAAA;IAC/B,oDAAmC,CAAA;IACnC,MAAM;IACN,4DAA2C,CAAA;IAC3C,8CAA6B,CAAA;IAC7B,4DAA2C,CAAA;IAC3C,sEAAqD,CAAA;IACrD,wDAAuC,CAAA;IACvC,gDAA+B,CAAA;IAC/B,gDAA+B,CAAA;IAC/B,4CAA2B,CAAA;IAC3B,kEAAiD,CAAA;IACjD,gEAA+C,CAAA;AACnD,CAAC,EAnCW,aAAa,6BAAb,aAAa,QAmCxB"}
|
|
@@ -3,7 +3,7 @@ import { CancellationToken, Chat, ChatParams, ChatResult, EndChatParams, QuickAc
|
|
|
3
3
|
import { Features, LspHandlers } from '../types';
|
|
4
4
|
import { ChatSessionManagementService } from './chatSessionManagementService';
|
|
5
5
|
import { TelemetryService } from '../telemetryService';
|
|
6
|
-
type ChatHandlers = Omit<LspHandlers<Chat>, 'openTab'>;
|
|
6
|
+
type ChatHandlers = Omit<LspHandlers<Chat>, 'openTab' | 'sendChatUpdate' | 'onFileClicked'>;
|
|
7
7
|
export declare class ChatController implements ChatHandlers {
|
|
8
8
|
#private;
|
|
9
9
|
constructor(chatSessionManagementService: ChatSessionManagementService, features: Features, telemetryService: TelemetryService);
|
|
@@ -15,6 +15,8 @@ const triggerContext_1 = require("./contexts/triggerContext");
|
|
|
15
15
|
const constants_1 = require("./constants");
|
|
16
16
|
const qConfigurationServer_1 = require("../configuration/qConfigurationServer");
|
|
17
17
|
const lsp_core_1 = require("@aws/lsp-core");
|
|
18
|
+
const errors_1 = require("../amazonQServiceManager/errors");
|
|
19
|
+
const AmazonQTokenServiceManager_1 = require("../amazonQServiceManager/AmazonQTokenServiceManager");
|
|
18
20
|
class ChatController {
|
|
19
21
|
#features;
|
|
20
22
|
#chatSessionManagementService;
|
|
@@ -57,7 +59,8 @@ class ChatController {
|
|
|
57
59
|
const conversationIdentifier = session?.conversationId ?? 'New conversation';
|
|
58
60
|
try {
|
|
59
61
|
this.#log('Request for conversation id:', conversationIdentifier);
|
|
60
|
-
|
|
62
|
+
const profileArn = AmazonQTokenServiceManager_1.AmazonQTokenServiceManager.getInstance(this.#features).getActiveProfileArn();
|
|
63
|
+
requestInput = this.#triggerContext.getChatParamsFromTrigger(params, triggerContext, this.#customizationArn, profileArn);
|
|
61
64
|
metric.recordStart();
|
|
62
65
|
response = await session.sendMessage(requestInput);
|
|
63
66
|
this.#log('Response for conversation id:', conversationIdentifier, JSON.stringify(response.$metadata));
|
|
@@ -67,6 +70,19 @@ class ChatController {
|
|
|
67
70
|
metric.setDimension('cwsprChatRepsonseCode', err.statusCode ?? 400);
|
|
68
71
|
this.#telemetryController.emitMessageResponseError(params.tabId, metric.metric);
|
|
69
72
|
}
|
|
73
|
+
if (err instanceof errors_1.AmazonQServicePendingSigninError) {
|
|
74
|
+
this.#log(`Q Chat SSO Connection error: ${(0, utils_2.getErrorMessage)(err)}`);
|
|
75
|
+
return (0, utils_1.createAuthFollowUpResult)('full-auth');
|
|
76
|
+
}
|
|
77
|
+
if (err instanceof errors_1.AmazonQServicePendingProfileError) {
|
|
78
|
+
this.#log(`Q Chat SSO Connection error: ${(0, utils_2.getErrorMessage)(err)}`);
|
|
79
|
+
const followUpResult = (0, utils_1.createAuthFollowUpResult)('use-supported-auth');
|
|
80
|
+
// Access first element in array
|
|
81
|
+
if (followUpResult.followUp?.options) {
|
|
82
|
+
followUpResult.followUp.options[0].pillText = 'Select Q Developer Profile';
|
|
83
|
+
}
|
|
84
|
+
return followUpResult;
|
|
85
|
+
}
|
|
70
86
|
const authFollowType = (0, utils_1.getAuthFollowUpType)(err);
|
|
71
87
|
if (authFollowType) {
|
|
72
88
|
this.#log(`Q auth error: ${(0, utils_2.getErrorMessage)(err)}`);
|