@aws/lsp-codewhisperer 0.0.29 → 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 +14 -0
- 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/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/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.js +1 -1
- package/out/language-server/chat/contexts/triggerContext.js.map +1 -1
- package/out/language-server/codeWhispererServer.d.ts +1 -1
- package/out/language-server/codeWhispererServer.js +4 -3
- package/out/language-server/codeWhispererServer.js.map +1 -1
- package/out/language-server/proxy-server.d.ts +1 -0
- package/out/language-server/proxy-server.js +5 -3
- package/out/language-server/proxy-server.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.30](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.29...lsp-codewhisperer/v0.0.30) (2025-03-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* copied test files and added README to clarify purpose of this folder ([6a18e55](https://github.com/aws/language-servers/commit/6a18e55a1392aa9e68a202a8ca6f1a8b5c55bb4b))
|
|
9
|
+
* create copy of chat server and controller to use in agentic chat ([035b30e](https://github.com/aws/language-servers/commit/035b30ec98b85faad5696034e56dbafef67e7f79))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **amazonq:** select corrert Service manager mode in completion server factory ([8041934](https://github.com/aws/language-servers/commit/8041934de1021cfe570fc2686e4000749fe297a6))
|
|
15
|
+
* **amazonq:** use relative path of document with chat params ([#867](https://github.com/aws/language-servers/issues/867)) ([fbc667e](https://github.com/aws/language-servers/commit/fbc667e44767ca8ddcb743b9377bf1331a27fb29))
|
|
16
|
+
|
|
3
17
|
## [0.0.29](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.28...lsp-codewhisperer/v0.0.29) (2025-03-26)
|
|
4
18
|
|
|
5
19
|
|
package/out/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './language-server/codeWhispererSecurityScanServer';
|
|
2
2
|
export * from './language-server/codeWhispererServer';
|
|
3
3
|
export * from './language-server/qChatServer';
|
|
4
|
+
export * as QAgenticChatServer from './language-server/agenticChat/qAgenticChatServer';
|
|
4
5
|
export * from './language-server/proxy-server';
|
|
5
6
|
export * from './language-server/netTransformServer';
|
package/out/index.js
CHANGED
|
@@ -14,9 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.QAgenticChatServer = void 0;
|
|
17
18
|
__exportStar(require("./language-server/codeWhispererSecurityScanServer"), exports);
|
|
18
19
|
__exportStar(require("./language-server/codeWhispererServer"), exports);
|
|
19
20
|
__exportStar(require("./language-server/qChatServer"), exports);
|
|
21
|
+
exports.QAgenticChatServer = require("./language-server/agenticChat/qAgenticChatServer");
|
|
20
22
|
__exportStar(require("./language-server/proxy-server"), exports);
|
|
21
23
|
__exportStar(require("./language-server/netTransformServer"), exports);
|
|
22
24
|
//# sourceMappingURL=index.js.map
|
package/out/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oFAAiE;AACjE,wEAAqD;AACrD,gEAA6C;AAC7C,yFAAsF;AACtF,iEAA8C;AAC9C,uEAAoD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copied from ../chat/chatController.ts for the purpose of developing a divergent implementation.
|
|
3
|
+
* Will be deleted or merged.
|
|
4
|
+
*/
|
|
5
|
+
import { FeedbackParams, InsertToCursorPositionParams } from '@aws/language-server-runtimes/protocol';
|
|
6
|
+
import { CancellationToken, Chat, ChatParams, ChatResult, EndChatParams, QuickActionParams, ResponseError, TabAddParams, TabRemoveParams, TabChangeParams } from '@aws/language-server-runtimes/server-interface';
|
|
7
|
+
import { Features, LspHandlers } from '../types';
|
|
8
|
+
import { ChatSessionManagementService } from '../chat/chatSessionManagementService';
|
|
9
|
+
import { TelemetryService } from '../telemetryService';
|
|
10
|
+
type ChatHandlers = Omit<LspHandlers<Chat>, 'openTab' | 'sendChatUpdate' | 'onFileClicked'>;
|
|
11
|
+
export declare class AgenticChatController implements ChatHandlers {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(chatSessionManagementService: ChatSessionManagementService, features: Features, telemetryService: TelemetryService);
|
|
14
|
+
dispose(): void;
|
|
15
|
+
onChatPrompt(params: ChatParams, token: CancellationToken): Promise<ChatResult | ResponseError<ChatResult>>;
|
|
16
|
+
onCodeInsertToCursorPosition(params: InsertToCursorPositionParams): Promise<void>;
|
|
17
|
+
onCopyCodeToClipboard(): void;
|
|
18
|
+
onEndChat(params: EndChatParams, _token: CancellationToken): boolean;
|
|
19
|
+
onFollowUpClicked(): void;
|
|
20
|
+
onInfoLinkClick(): void;
|
|
21
|
+
onLinkClick(): void;
|
|
22
|
+
onReady(): void;
|
|
23
|
+
onSendFeedback({ tabId, feedbackPayload }: FeedbackParams): void;
|
|
24
|
+
onSourceLinkClick(): void;
|
|
25
|
+
onTabAdd(params: TabAddParams): void;
|
|
26
|
+
onTabChange(params: TabChangeParams): void;
|
|
27
|
+
onTabRemove(params: TabRemoveParams): void;
|
|
28
|
+
onQuickAction(params: QuickActionParams, _cancellationToken: CancellationToken): {
|
|
29
|
+
messageId?: undefined;
|
|
30
|
+
body?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
messageId: string;
|
|
33
|
+
body: string;
|
|
34
|
+
};
|
|
35
|
+
updateConfiguration: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copied from ../chat/chatController.ts for the purpose of developing a divergent implementation.
|
|
4
|
+
* Will be deleted or merged.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.AgenticChatController = void 0;
|
|
8
|
+
const protocol_1 = require("@aws/language-server-runtimes/protocol");
|
|
9
|
+
const server_interface_1 = require("@aws/language-server-runtimes/server-interface");
|
|
10
|
+
const uuid_1 = require("uuid");
|
|
11
|
+
const types_1 = require("../telemetry/types");
|
|
12
|
+
const chatEventParser_1 = require("../chat/chatEventParser");
|
|
13
|
+
const utils_1 = require("../chat/utils");
|
|
14
|
+
const chatTelemetryController_1 = require("../chat/telemetry/chatTelemetryController");
|
|
15
|
+
const quickActions_1 = require("../chat/quickActions");
|
|
16
|
+
const metric_1 = require("../telemetry/metric");
|
|
17
|
+
const utils_2 = require("../utils");
|
|
18
|
+
const triggerContext_1 = require("../chat/contexts/triggerContext");
|
|
19
|
+
const constants_1 = require("../chat/constants");
|
|
20
|
+
const qConfigurationServer_1 = require("../configuration/qConfigurationServer");
|
|
21
|
+
const lsp_core_1 = require("@aws/lsp-core");
|
|
22
|
+
const errors_1 = require("../amazonQServiceManager/errors");
|
|
23
|
+
const AmazonQTokenServiceManager_1 = require("../amazonQServiceManager/AmazonQTokenServiceManager");
|
|
24
|
+
class AgenticChatController {
|
|
25
|
+
#features;
|
|
26
|
+
#chatSessionManagementService;
|
|
27
|
+
#telemetryController;
|
|
28
|
+
#triggerContext;
|
|
29
|
+
#customizationArn;
|
|
30
|
+
#telemetryService;
|
|
31
|
+
constructor(chatSessionManagementService, features, telemetryService) {
|
|
32
|
+
this.#features = features;
|
|
33
|
+
this.#chatSessionManagementService = chatSessionManagementService;
|
|
34
|
+
this.#triggerContext = new triggerContext_1.QChatTriggerContext(features.workspace, features.logging);
|
|
35
|
+
this.#telemetryController = new chatTelemetryController_1.ChatTelemetryController(features, telemetryService);
|
|
36
|
+
this.#telemetryService = telemetryService;
|
|
37
|
+
}
|
|
38
|
+
dispose() {
|
|
39
|
+
this.#chatSessionManagementService.dispose();
|
|
40
|
+
this.#telemetryController.dispose();
|
|
41
|
+
}
|
|
42
|
+
async onChatPrompt(params, token) {
|
|
43
|
+
const maybeDefaultResponse = (0, utils_1.getDefaultChatResponse)(params.prompt.prompt);
|
|
44
|
+
if (maybeDefaultResponse) {
|
|
45
|
+
return maybeDefaultResponse;
|
|
46
|
+
}
|
|
47
|
+
const sessionResult = this.#chatSessionManagementService.getSession(params.tabId);
|
|
48
|
+
const { data: session, success } = sessionResult;
|
|
49
|
+
if (!success) {
|
|
50
|
+
return new server_interface_1.ResponseError(protocol_1.ErrorCodes.InternalError, sessionResult.error);
|
|
51
|
+
}
|
|
52
|
+
const metric = new metric_1.Metric({
|
|
53
|
+
cwsprChatConversationType: 'Chat',
|
|
54
|
+
});
|
|
55
|
+
const triggerContext = await this.#getTriggerContext(params, metric);
|
|
56
|
+
const isNewConversation = !session.conversationId;
|
|
57
|
+
token.onCancellationRequested(() => {
|
|
58
|
+
this.#log('cancellation requested');
|
|
59
|
+
session.abortRequest();
|
|
60
|
+
});
|
|
61
|
+
let response;
|
|
62
|
+
let requestInput;
|
|
63
|
+
const conversationIdentifier = session?.conversationId ?? 'New conversation';
|
|
64
|
+
try {
|
|
65
|
+
this.#log('Request for conversation id:', conversationIdentifier);
|
|
66
|
+
const profileArn = AmazonQTokenServiceManager_1.AmazonQTokenServiceManager.getInstance(this.#features).getActiveProfileArn();
|
|
67
|
+
requestInput = this.#triggerContext.getChatParamsFromTrigger(params, triggerContext, this.#customizationArn, profileArn);
|
|
68
|
+
metric.recordStart();
|
|
69
|
+
response = await session.sendMessage(requestInput);
|
|
70
|
+
this.#log('Response for conversation id:', conversationIdentifier, JSON.stringify(response.$metadata));
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
if ((0, utils_2.isAwsError)(err) || ((0, utils_2.isObject)(err) && 'statusCode' in err && typeof err.statusCode === 'number')) {
|
|
74
|
+
metric.setDimension('cwsprChatRepsonseCode', err.statusCode ?? 400);
|
|
75
|
+
this.#telemetryController.emitMessageResponseError(params.tabId, metric.metric);
|
|
76
|
+
}
|
|
77
|
+
if (err instanceof errors_1.AmazonQServicePendingSigninError) {
|
|
78
|
+
this.#log(`Q Chat SSO Connection error: ${(0, utils_2.getErrorMessage)(err)}`);
|
|
79
|
+
return (0, utils_1.createAuthFollowUpResult)('full-auth');
|
|
80
|
+
}
|
|
81
|
+
if (err instanceof errors_1.AmazonQServicePendingProfileError) {
|
|
82
|
+
this.#log(`Q Chat SSO Connection error: ${(0, utils_2.getErrorMessage)(err)}`);
|
|
83
|
+
const followUpResult = (0, utils_1.createAuthFollowUpResult)('use-supported-auth');
|
|
84
|
+
// Access first element in array
|
|
85
|
+
if (followUpResult.followUp?.options) {
|
|
86
|
+
followUpResult.followUp.options[0].pillText = 'Select Q Developer Profile';
|
|
87
|
+
}
|
|
88
|
+
return followUpResult;
|
|
89
|
+
}
|
|
90
|
+
const authFollowType = (0, utils_1.getAuthFollowUpType)(err);
|
|
91
|
+
if (authFollowType) {
|
|
92
|
+
this.#log(`Q auth error: ${(0, utils_2.getErrorMessage)(err)}`);
|
|
93
|
+
return (0, utils_1.createAuthFollowUpResult)(authFollowType);
|
|
94
|
+
}
|
|
95
|
+
this.#log(`Q api request error ${err instanceof Error ? err.message : 'unknown'}`);
|
|
96
|
+
return new server_interface_1.ResponseError(server_interface_1.LSPErrorCodes.RequestFailed, err instanceof Error ? err.message : 'Unknown request error');
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const result = await this.#processSendMessageResponse(response, metric.mergeWith({
|
|
100
|
+
cwsprChatResponseCode: response.$metadata.httpStatusCode,
|
|
101
|
+
cwsprChatMessageId: response.$metadata.requestId,
|
|
102
|
+
}), params.partialResultToken);
|
|
103
|
+
session.conversationId = result.data?.conversationId;
|
|
104
|
+
this.#log('Session conversation id:', session.conversationId || '');
|
|
105
|
+
if (session.conversationId) {
|
|
106
|
+
this.#telemetryController.setConversationId(params.tabId, session.conversationId);
|
|
107
|
+
if (isNewConversation) {
|
|
108
|
+
this.#telemetryController.updateTriggerInfo(params.tabId, {
|
|
109
|
+
startTrigger: {
|
|
110
|
+
hasUserSnippet: metric.metric.cwsprChatHasCodeSnippet ?? false,
|
|
111
|
+
triggerType: triggerContext.triggerType,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
this.#telemetryController.emitStartConversationMetric(params.tabId, metric.metric);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
metric.setDimension('codewhispererCustomizationArn', requestInput.conversationState?.customizationArn);
|
|
118
|
+
await this.#telemetryController.emitAddMessageMetric(params.tabId, metric.metric);
|
|
119
|
+
this.#telemetryController.updateTriggerInfo(params.tabId, {
|
|
120
|
+
lastMessageTrigger: {
|
|
121
|
+
...triggerContext,
|
|
122
|
+
messageId: response.$metadata.requestId,
|
|
123
|
+
followUpActions: new Set(result.data?.chatResult.followUp?.options
|
|
124
|
+
?.map(option => option.prompt ?? '')
|
|
125
|
+
.filter(prompt => prompt.length > 0)),
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
return result.success
|
|
129
|
+
? result.data.chatResult
|
|
130
|
+
: new server_interface_1.ResponseError(server_interface_1.LSPErrorCodes.RequestFailed, result.error);
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
this.#log('Error encountered during response streaming:', err instanceof Error ? err.message : 'unknown');
|
|
134
|
+
return new server_interface_1.ResponseError(server_interface_1.LSPErrorCodes.RequestFailed, err instanceof Error ? err.message : 'Unknown error occured during response stream');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async onCodeInsertToCursorPosition(params) {
|
|
138
|
+
// Implementation based on https://github.com/aws/aws-toolkit-vscode/blob/1814cc84228d4bf20270574c5980b91b227f31cf/packages/core/src/amazonq/commons/controllers/contentController.ts#L38
|
|
139
|
+
if (!params.textDocument || !params.cursorPosition || !params.code) {
|
|
140
|
+
const missingParams = [];
|
|
141
|
+
if (!params.textDocument)
|
|
142
|
+
missingParams.push('textDocument');
|
|
143
|
+
if (!params.cursorPosition)
|
|
144
|
+
missingParams.push('cursorPosition');
|
|
145
|
+
if (!params.code)
|
|
146
|
+
missingParams.push('code');
|
|
147
|
+
this.#log(`Q Chat server failed to insert code. Missing required parameters for insert code: ${missingParams.join(', ')}`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
let cursorPosition = params.cursorPosition;
|
|
151
|
+
const indentRange = {
|
|
152
|
+
start: { line: cursorPosition.line, character: 0 },
|
|
153
|
+
end: cursorPosition,
|
|
154
|
+
};
|
|
155
|
+
const documentContent = await this.#features.workspace.getTextDocument(params.textDocument.uri);
|
|
156
|
+
// linePrefix is the raw text that is between the start of the line and the current cursor position
|
|
157
|
+
let linePrefix = documentContent?.getText(indentRange);
|
|
158
|
+
// calculatedIndent is the indent we calculate inside this function and apply to the text to be inserted
|
|
159
|
+
let calculatedIndent = '';
|
|
160
|
+
let hasVirtualSpace = false;
|
|
161
|
+
if (linePrefix) {
|
|
162
|
+
// If linePrefix object is not empty, there are two possibilities:
|
|
163
|
+
// Case 1: If linePrefix contains only whitespace: Use the entire linePrefix as is for the indent
|
|
164
|
+
// Case 2: If linePrefix contains non-whitespace characters: Extract leading whitespace from linePrefix (if any), ignore rest of text
|
|
165
|
+
calculatedIndent =
|
|
166
|
+
linePrefix.trim().length == 0
|
|
167
|
+
? linePrefix
|
|
168
|
+
: ' '.repeat(linePrefix.length - linePrefix.trimStart().length);
|
|
169
|
+
}
|
|
170
|
+
else if (documentContent && cursorPosition.character > 0) {
|
|
171
|
+
// When the cursor is not at the start of the line (position > 0) but there's no actual text at the indentation range
|
|
172
|
+
// It means there are virtual spaces that is being rendered by the IDE
|
|
173
|
+
// In this case, the indentation is determined by the cursorPosition
|
|
174
|
+
this.#log('Indent is nullish and the cursor position is greater than zero while inserting code');
|
|
175
|
+
calculatedIndent = ' '.repeat(cursorPosition.character);
|
|
176
|
+
hasVirtualSpace = true;
|
|
177
|
+
cursorPosition.character = 0;
|
|
178
|
+
}
|
|
179
|
+
const textWithIndent = params.code
|
|
180
|
+
.split('\n')
|
|
181
|
+
.map((line, index) => {
|
|
182
|
+
if (index === 0) {
|
|
183
|
+
return hasVirtualSpace && line ? calculatedIndent + line : line;
|
|
184
|
+
}
|
|
185
|
+
// Only indent non-empty lines
|
|
186
|
+
return line ? calculatedIndent + line : '';
|
|
187
|
+
})
|
|
188
|
+
.join('\n');
|
|
189
|
+
const workspaceEdit = {
|
|
190
|
+
edit: {
|
|
191
|
+
documentChanges: [
|
|
192
|
+
protocol_1.TextDocumentEdit.create({ uri: params.textDocument.uri, version: 0 }, [
|
|
193
|
+
protocol_1.TextEdit.insert(cursorPosition, textWithIndent),
|
|
194
|
+
]),
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
const applyResult = await this.#features.lsp.workspace.applyWorkspaceEdit(workspaceEdit);
|
|
199
|
+
if (applyResult.applied) {
|
|
200
|
+
this.#log(`Q Chat server inserted code successfully`);
|
|
201
|
+
this.#telemetryController.enqueueCodeDiffEntry({ ...params, code: textWithIndent });
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
this.#log(`Q Chat server failed to insert code: ${applyResult.failureReason ?? 'No failure reason provided'}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
onCopyCodeToClipboard() { }
|
|
208
|
+
onEndChat(params, _token) {
|
|
209
|
+
const { success } = this.#chatSessionManagementService.deleteSession(params.tabId);
|
|
210
|
+
return success;
|
|
211
|
+
}
|
|
212
|
+
onFollowUpClicked() { }
|
|
213
|
+
onInfoLinkClick() { }
|
|
214
|
+
onLinkClick() { }
|
|
215
|
+
onReady() { }
|
|
216
|
+
onSendFeedback({ tabId, feedbackPayload }) {
|
|
217
|
+
this.#features.telemetry.emitMetric({
|
|
218
|
+
name: 'amazonq_sendFeedback',
|
|
219
|
+
data: {
|
|
220
|
+
comment: JSON.stringify({
|
|
221
|
+
type: 'codewhisperer-chat-answer-feedback',
|
|
222
|
+
conversationId: this.#telemetryController.getConversationId(tabId) ?? '',
|
|
223
|
+
messageId: feedbackPayload.messageId,
|
|
224
|
+
reason: feedbackPayload.selectedOption,
|
|
225
|
+
userComment: feedbackPayload.comment,
|
|
226
|
+
}),
|
|
227
|
+
// this is always Negative because only thumbs down has a form
|
|
228
|
+
sentiment: 'Negative',
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
onSourceLinkClick() { }
|
|
233
|
+
onTabAdd(params) {
|
|
234
|
+
this.#telemetryController.activeTabId = params.tabId;
|
|
235
|
+
this.#chatSessionManagementService.createSession(params.tabId);
|
|
236
|
+
}
|
|
237
|
+
onTabChange(params) {
|
|
238
|
+
this.#telemetryController.emitConversationMetric({
|
|
239
|
+
name: types_1.ChatTelemetryEventName.ExitFocusConversation,
|
|
240
|
+
data: {},
|
|
241
|
+
});
|
|
242
|
+
this.#telemetryController.activeTabId = params.tabId;
|
|
243
|
+
this.#telemetryController.emitConversationMetric({
|
|
244
|
+
name: types_1.ChatTelemetryEventName.EnterFocusConversation,
|
|
245
|
+
data: {},
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
onTabRemove(params) {
|
|
249
|
+
if (this.#telemetryController.activeTabId === params.tabId) {
|
|
250
|
+
this.#telemetryController.emitConversationMetric({
|
|
251
|
+
name: types_1.ChatTelemetryEventName.ExitFocusConversation,
|
|
252
|
+
data: {},
|
|
253
|
+
});
|
|
254
|
+
this.#telemetryController.activeTabId = undefined;
|
|
255
|
+
}
|
|
256
|
+
this.#chatSessionManagementService.deleteSession(params.tabId);
|
|
257
|
+
this.#telemetryController.removeConversation(params.tabId);
|
|
258
|
+
}
|
|
259
|
+
onQuickAction(params, _cancellationToken) {
|
|
260
|
+
switch (params.quickAction) {
|
|
261
|
+
case quickActions_1.QuickAction.Clear: {
|
|
262
|
+
const sessionResult = this.#chatSessionManagementService.getSession(params.tabId);
|
|
263
|
+
this.#telemetryController.emitChatMetric({
|
|
264
|
+
name: types_1.ChatTelemetryEventName.RunCommand,
|
|
265
|
+
data: {
|
|
266
|
+
cwsprChatCommandType: params.quickAction,
|
|
267
|
+
},
|
|
268
|
+
});
|
|
269
|
+
this.#telemetryController.removeConversation(params.tabId);
|
|
270
|
+
sessionResult.data?.clear();
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
case quickActions_1.QuickAction.Help:
|
|
274
|
+
this.#telemetryController.emitChatMetric({
|
|
275
|
+
name: types_1.ChatTelemetryEventName.RunCommand,
|
|
276
|
+
data: {
|
|
277
|
+
cwsprChatCommandType: params.quickAction,
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
return {
|
|
281
|
+
messageId: (0, uuid_1.v4)(),
|
|
282
|
+
body: constants_1.HELP_MESSAGE,
|
|
283
|
+
};
|
|
284
|
+
default:
|
|
285
|
+
return {};
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
async #getTriggerContext(params, metric) {
|
|
289
|
+
const lastMessageTrigger = this.#telemetryController.getLastMessageTrigger(params.tabId);
|
|
290
|
+
let triggerContext;
|
|
291
|
+
// this is the only way we can detect a follow up action
|
|
292
|
+
// we can reuse previous trigger information
|
|
293
|
+
if (lastMessageTrigger?.followUpActions?.has(params.prompt?.prompt ?? '')) {
|
|
294
|
+
await this.#telemetryController.emitInteractWithMessageMetric(params.tabId, {
|
|
295
|
+
cwsprChatMessageId: lastMessageTrigger.messageId,
|
|
296
|
+
cwsprChatInteractionType: types_1.ChatInteractionType.ClickFollowUp,
|
|
297
|
+
});
|
|
298
|
+
triggerContext = lastMessageTrigger;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
triggerContext = await this.#triggerContext.getNewTriggerContext(params);
|
|
302
|
+
triggerContext.triggerType = this.#telemetryController.getCurrentTrigger(params.tabId) ?? 'click';
|
|
303
|
+
}
|
|
304
|
+
metric.mergeWith({
|
|
305
|
+
cwsprChatUserIntent: triggerContext?.userIntent,
|
|
306
|
+
cwsprChatProgrammingLanguage: triggerContext?.programmingLanguage?.languageName,
|
|
307
|
+
cwsprChatRequestLength: params.prompt?.prompt?.length ?? 0,
|
|
308
|
+
cwsprChatTriggerInteraction: triggerContext?.triggerType,
|
|
309
|
+
cwsprChatHasCodeSnippet: triggerContext.hasCodeSnippet ?? false,
|
|
310
|
+
cwsprChatActiveEditorTotalCharacters: triggerContext.totalEditorCharacters ?? 0,
|
|
311
|
+
});
|
|
312
|
+
return triggerContext;
|
|
313
|
+
}
|
|
314
|
+
async #processSendMessageResponse(response, metric, partialResultToken) {
|
|
315
|
+
const requestId = response.$metadata.requestId;
|
|
316
|
+
const chatEventParser = new chatEventParser_1.ChatEventParser(requestId, metric);
|
|
317
|
+
for await (const chatEvent of response.sendMessageResponse) {
|
|
318
|
+
const result = chatEventParser.processPartialEvent(chatEvent);
|
|
319
|
+
// terminate early when there is an error
|
|
320
|
+
if (!result.success) {
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
323
|
+
if (!(0, utils_2.isNullish)(partialResultToken)) {
|
|
324
|
+
await this.#features.lsp.sendProgress(protocol_1.chatRequestType, partialResultToken, result.data.chatResult);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
metric.mergeWith({
|
|
328
|
+
cwsprChatFullResponseLatency: metric.getTimeElapsed(),
|
|
329
|
+
cwsprChatFollowUpCount: chatEventParser.totalEvents.followupPromptEvent,
|
|
330
|
+
cwsprChatReferencesCount: chatEventParser.totalEvents.codeReferenceEvent,
|
|
331
|
+
cwsprChatSourceLinkCount: chatEventParser.totalEvents.supplementaryWebLinksEvent,
|
|
332
|
+
cwsprChatResponseLength: chatEventParser.body?.length ?? 0,
|
|
333
|
+
});
|
|
334
|
+
return chatEventParser.getResult();
|
|
335
|
+
}
|
|
336
|
+
updateConfiguration = async () => {
|
|
337
|
+
try {
|
|
338
|
+
const qConfig = await this.#features.lsp.workspace.getConfiguration(qConfigurationServer_1.Q_CONFIGURATION_SECTION);
|
|
339
|
+
if (qConfig) {
|
|
340
|
+
this.#customizationArn = lsp_core_1.textUtils.undefinedIfEmpty(qConfig.customization);
|
|
341
|
+
this.#log(`Chat configuration updated to use ${this.#customizationArn}`);
|
|
342
|
+
/*
|
|
343
|
+
The flag enableTelemetryEventsToDestination is set to true temporarily. It's value will be determined through destination
|
|
344
|
+
configuration post all events migration to STE. It'll be replaced by qConfig['enableTelemetryEventsToDestination'] === true
|
|
345
|
+
*/
|
|
346
|
+
// const enableTelemetryEventsToDestination = true
|
|
347
|
+
// this.#telemetryService.updateEnableTelemetryEventsToDestination(enableTelemetryEventsToDestination)
|
|
348
|
+
const optOutTelemetryPreference = qConfig['optOutTelemetry'] === true ? 'OPTOUT' : 'OPTIN';
|
|
349
|
+
this.#telemetryService.updateOptOutPreference(optOutTelemetryPreference);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
catch (error) {
|
|
353
|
+
this.#log(`Error in GetConfiguration: ${error}`);
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
#log(...messages) {
|
|
357
|
+
this.#features.logging.log(messages.join(' '));
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
exports.AgenticChatController = AgenticChatController;
|
|
361
|
+
//# sourceMappingURL=agenticChatController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agenticChatController.js","sourceRoot":"","sources":["../../../src/language-server/agenticChat/agenticChatController.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,qEAQ+C;AAC/C,qFAYuD;AACvD,+BAAiC;AACjC,8CAK2B;AAE3B,6DAAiF;AACjF,yCAAqG;AAErG,uFAAmF;AACnF,uDAAkD;AAClD,gDAA4C;AAC5C,oCAA2E;AAC3E,oEAAqF;AACrF,iDAAgD;AAChD,gFAA+E;AAC/E,4CAAyC;AAEzC,4DAAqH;AACrH,oGAAgG;AAIhG,MAAa,qBAAqB;IAC9B,SAAS,CAAU;IACnB,6BAA6B,CAA8B;IAC3D,oBAAoB,CAAyB;IAC7C,eAAe,CAAqB;IACpC,iBAAiB,CAAS;IAC1B,iBAAiB,CAAkB;IAEnC,YACI,4BAA0D,EAC1D,QAAkB,EAClB,gBAAkC;QAElC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;QACzB,IAAI,CAAC,6BAA6B,GAAG,4BAA4B,C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AA;YAC5F,IAAI,OAAO,EAAE,CAAC;gBACV,IAAI,CAAC,iBAAiB,GAAG,oBAAS,CAAC,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;gBAC1E,IAAI,CAAC,IAAI,CAAC,qCAAqC,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;gBACxE;;;kBAGE;gBACF,kDAAkD;gBAClD,sGAAsG;gBACtG,MAAM,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAA;gBAC1F,IAAI,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,yBAAyB,CAAC,CAAA;YAC5E,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,8BAA8B,KAAK,EAAE,CAAC,CAAA;QACpD,CAAC;IACL,CAAC,CAAA;IAED,IAAI,CAAC,GAAG,QAAkB;QACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAClD,CAAC;CACJ;AA/aD,sDA+aC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copied from ../qChatServer.ts for the purpose of developing a divergent implementation.
|
|
4
|
+
* Will be deleted or merged.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.QAgenticChatServer = void 0;
|
|
8
|
+
const agenticChatController_1 = require("./agenticChatController");
|
|
9
|
+
const chatSessionManagementService_1 = require("../chat/chatSessionManagementService");
|
|
10
|
+
const quickActions_1 = require("../chat/quickActions");
|
|
11
|
+
const telemetryService_1 = require("../telemetryService");
|
|
12
|
+
const telemetryUtils_1 = require("../utilities/telemetryUtils");
|
|
13
|
+
const AmazonQTokenServiceManager_1 = require("../amazonQServiceManager/AmazonQTokenServiceManager");
|
|
14
|
+
const errors_1 = require("../amazonQServiceManager/errors");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
const QAgenticChatServer =
|
|
17
|
+
// prettier-ignore
|
|
18
|
+
() => features => {
|
|
19
|
+
const { chat, credentialsProvider, telemetry, logging, lsp, runtime } = features;
|
|
20
|
+
let amazonQServiceManager;
|
|
21
|
+
let chatController;
|
|
22
|
+
let chatSessionManagementService;
|
|
23
|
+
let telemetryService;
|
|
24
|
+
lsp.addInitializer((params) => {
|
|
25
|
+
return {
|
|
26
|
+
capabilities: {},
|
|
27
|
+
awsServerCapabilities: {
|
|
28
|
+
chatOptions: {
|
|
29
|
+
quickActions: {
|
|
30
|
+
quickActionsCommandGroups: [
|
|
31
|
+
{
|
|
32
|
+
commands: [quickActions_1.HELP_QUICK_ACTION, quickActions_1.CLEAR_QUICK_ACTION],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
const updateConfigurationHandler = async () => {
|
|
41
|
+
await amazonQServiceManager.handleDidChangeConfiguration();
|
|
42
|
+
await chatController.updateConfiguration();
|
|
43
|
+
};
|
|
44
|
+
lsp.onInitialized(async () => {
|
|
45
|
+
// Initialize service manager and inject it to chatSessionManagementService to pass it down
|
|
46
|
+
amazonQServiceManager = AmazonQTokenServiceManager_1.AmazonQTokenServiceManager.getInstance(features);
|
|
47
|
+
chatSessionManagementService = chatSessionManagementService_1.ChatSessionManagementService
|
|
48
|
+
.getInstance()
|
|
49
|
+
.withAmazonQServiceManager(amazonQServiceManager);
|
|
50
|
+
telemetryService = new telemetryService_1.TelemetryService(amazonQServiceManager, credentialsProvider, telemetry, logging);
|
|
51
|
+
const clientParams = (0, utils_1.safeGet)(lsp.getClientInitializeParams(), new errors_1.AmazonQServiceInitializationError('TelemetryService initialized before LSP connection was initialized.'));
|
|
52
|
+
telemetryService.updateUserContext((0, telemetryUtils_1.makeUserContextObject)(clientParams, runtime.platform, 'CHAT'));
|
|
53
|
+
chatController = new agenticChatController_1.AgenticChatController(chatSessionManagementService, features, telemetryService);
|
|
54
|
+
await updateConfigurationHandler();
|
|
55
|
+
});
|
|
56
|
+
lsp.didChangeConfiguration(updateConfigurationHandler);
|
|
57
|
+
chat.onTabAdd(params => {
|
|
58
|
+
logging.log(`Adding tab: ${params.tabId}`);
|
|
59
|
+
return chatController.onTabAdd(params);
|
|
60
|
+
});
|
|
61
|
+
chat.onTabChange(params => {
|
|
62
|
+
logging.log(`Changing to tab: ${params.tabId}`);
|
|
63
|
+
return chatController.onTabChange(params);
|
|
64
|
+
});
|
|
65
|
+
chat.onTabRemove(params => {
|
|
66
|
+
logging.log(`Removing tab: ${params.tabId}`);
|
|
67
|
+
return chatController.onTabRemove(params);
|
|
68
|
+
});
|
|
69
|
+
chat.onEndChat((...params) => {
|
|
70
|
+
logging.log('Received end chat request');
|
|
71
|
+
return chatController.onEndChat(...params);
|
|
72
|
+
});
|
|
73
|
+
chat.onChatPrompt((...params) => {
|
|
74
|
+
logging.log('Received chat prompt');
|
|
75
|
+
return chatController.onChatPrompt(...params);
|
|
76
|
+
});
|
|
77
|
+
chat.onQuickAction((...params) => {
|
|
78
|
+
return chatController.onQuickAction(...params);
|
|
79
|
+
});
|
|
80
|
+
chat.onSendFeedback(params => {
|
|
81
|
+
return chatController.onSendFeedback(params);
|
|
82
|
+
});
|
|
83
|
+
chat.onCodeInsertToCursorPosition(params => {
|
|
84
|
+
return chatController.onCodeInsertToCursorPosition(params);
|
|
85
|
+
});
|
|
86
|
+
logging.log('Q Chat server has been initialized');
|
|
87
|
+
return () => {
|
|
88
|
+
chatController?.dispose();
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
exports.QAgenticChatServer = QAgenticChatServer;
|
|
92
|
+
//# sourceMappingURL=qAgenticChatServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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O,cAAc,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,YAAY,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE;QAC5B,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;QACnC,OAAO,cAAc,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,aAAa,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE;QAC7B,OAAO,cAAc,CAAC,aAAa,CAAC,GAAG,MAAM,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE;QACzB,OAAO,cAAc,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC,EAAE;QACvC,OAAO,cAAc,CAAC,4BAA4B,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;IAEjD,OAAO,GAAG,EAAE;QACR,cAAc,EAAE,OAAO,EAAE,CAAA;IAC7B,CAAC,CAAA;AACL,CAAC,CAAA;AAtGQ,QAAA,kBAAkB,sBAsG1B"}
|
|
@@ -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;
|