@aws/lsp-codewhisperer 0.0.49 → 0.0.50
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 +18 -0
- package/out/language-server/agenticChat/agenticChatController.d.ts +9 -3
- package/out/language-server/agenticChat/agenticChatController.js +75 -14
- package/out/language-server/agenticChat/agenticChatController.js.map +1 -1
- package/out/language-server/agenticChat/constants.d.ts +3 -3
- package/out/language-server/agenticChat/constants.js +3 -5
- package/out/language-server/agenticChat/constants.js.map +1 -1
- package/out/language-server/agenticChat/context/addtionalContextProvider.d.ts +39 -6
- package/out/language-server/agenticChat/context/addtionalContextProvider.js +329 -53
- package/out/language-server/agenticChat/context/addtionalContextProvider.js.map +1 -1
- package/out/language-server/agenticChat/context/agenticChatTriggerContext.d.ts +1 -0
- package/out/language-server/agenticChat/context/agenticChatTriggerContext.js +1 -1
- package/out/language-server/agenticChat/context/agenticChatTriggerContext.js.map +1 -1
- package/out/language-server/agenticChat/context/contextCommandsProvider.js +4 -2
- package/out/language-server/agenticChat/context/contextCommandsProvider.js.map +1 -1
- package/out/language-server/agenticChat/context/contextUtils.d.ts +21 -2
- package/out/language-server/agenticChat/context/contextUtils.js +45 -16
- package/out/language-server/agenticChat/context/contextUtils.js.map +1 -1
- package/out/language-server/agenticChat/qAgenticChatServer.js +15 -0
- package/out/language-server/agenticChat/qAgenticChatServer.js.map +1 -1
- package/out/language-server/agenticChat/tabBarController.d.ts +1 -1
- package/out/language-server/agenticChat/tabBarController.js +5 -4
- package/out/language-server/agenticChat/tabBarController.js.map +1 -1
- package/out/language-server/agenticChat/tools/chatDb/chatDb.d.ts +9 -2
- package/out/language-server/agenticChat/tools/chatDb/chatDb.js +118 -6
- package/out/language-server/agenticChat/tools/chatDb/chatDb.js.map +1 -1
- package/out/language-server/agenticChat/tools/chatDb/util.d.ts +17 -1
- package/out/language-server/agenticChat/tools/chatDb/util.js +3 -1
- package/out/language-server/agenticChat/tools/chatDb/util.js.map +1 -1
- package/out/language-server/chat/chatController.d.ts +1 -1
- package/out/language-server/chat/chatController.js.map +1 -1
- package/out/language-server/chat/telemetry/chatTelemetryController.js +5 -0
- package/out/language-server/chat/telemetry/chatTelemetryController.js.map +1 -1
- package/out/language-server/inline-completion/auto-trigger/EditPredictionAutoTriggerTestConstants.d.ts +59 -0
- package/out/language-server/inline-completion/auto-trigger/EditPredictionAutoTriggerTestConstants.js +189 -0
- package/out/language-server/inline-completion/auto-trigger/EditPredictionAutoTriggerTestConstants.js.map +1 -0
- package/out/language-server/inline-completion/auto-trigger/editPredictionAutoTrigger.d.ts +27 -0
- package/out/language-server/inline-completion/auto-trigger/editPredictionAutoTrigger.js +57 -0
- package/out/language-server/inline-completion/auto-trigger/editPredictionAutoTrigger.js.map +1 -0
- package/out/language-server/netTransform/artifactManager.js +3 -0
- package/out/language-server/netTransform/artifactManager.js.map +1 -1
- package/out/language-server/netTransform/models.d.ts +2 -0
- package/out/language-server/netTransform/models.js.map +1 -1
- package/out/language-server/netTransform/tests/mockData.js +1 -0
- package/out/language-server/netTransform/tests/mockData.js.map +1 -1
- package/out/language-server/workspaceContext/workspaceContextServer.js +11 -4
- package/out/language-server/workspaceContext/workspaceContextServer.js.map +1 -1
- package/out/language-server/workspaceContext/workspaceFolderManager.d.ts +1 -0
- package/out/language-server/workspaceContext/workspaceFolderManager.js +24 -15
- package/out/language-server/workspaceContext/workspaceFolderManager.js.map +1 -1
- package/out/shared/telemetry/telemetryService.d.ts +5 -0
- package/out/shared/telemetry/telemetryService.js +5 -0
- package/out/shared/telemetry/telemetryService.js.map +1 -1
- package/out/shared/telemetry/types.d.ts +5 -0
- package/out/shared/telemetry/types.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.50](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.49...lsp-codewhisperer/v0.0.50) (2025-06-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add EnableWebFormsToBlazorTransform flag to support WebForms to Blazor transformation ([#1577](https://github.com/aws/language-servers/issues/1577)) ([8c6e9f6](https://github.com/aws/language-servers/commit/8c6e9f6e0a6fd1a7464b26572c1b613b3864b27a))
|
|
9
|
+
* **amazonq:** edit predition auto trigger ([#1662](https://github.com/aws/language-servers/issues/1662)) ([cbcd82b](https://github.com/aws/language-servers/commit/cbcd82bf6632859539e46d1fbe12ec75ab505fb4))
|
|
10
|
+
* **amazonq:** model throttling message as card instead of chat message ([#1657](https://github.com/aws/language-servers/issues/1657)) ([7ee1f2a](https://github.com/aws/language-servers/commit/7ee1f2ac0bdaa9f73fb63fc6d20d0de6d7b07523))
|
|
11
|
+
* **amazonq:** pinned context and rules ([#1663](https://github.com/aws/language-servers/issues/1663)) ([25e7a5a](https://github.com/aws/language-servers/commit/25e7a5ab8b6630525a4fd6acc0524f67f00af817))
|
|
12
|
+
* update list of models and set default to 4 ([#1659](https://github.com/aws/language-servers/issues/1659)) ([1991658](https://github.com/aws/language-servers/commit/19916584d3f46049d30f0c23b41c3857a07bc622))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **agenticChat:** UX fixes for MCP ([#1661](https://github.com/aws/language-servers/issues/1661)) ([bbdb4b4](https://github.com/aws/language-servers/commit/bbdb4b451352af50a914df684d7654686142a13b))
|
|
18
|
+
* **amazonq:** properly deposit workspace context server resources on exit ([#1647](https://github.com/aws/language-servers/issues/1647)) ([34efb2b](https://github.com/aws/language-servers/commit/34efb2b0e4ded031b33ed1ed7b96cf41fbe8e03b))
|
|
19
|
+
* increase timeout value for the streaming client ([#1654](https://github.com/aws/language-servers/issues/1654)) ([439a488](https://github.com/aws/language-servers/commit/439a488fc95683ab0da2df18a5044d66b689f4ed))
|
|
20
|
+
|
|
3
21
|
## [0.0.49](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.48...lsp-codewhisperer/v0.0.49) (2025-06-13)
|
|
4
22
|
|
|
5
23
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Will be deleted or merged.
|
|
4
4
|
*/
|
|
5
5
|
import { GenerateAssistantResponseCommandInput, ToolUse } from '@aws/codewhisperer-streaming-client';
|
|
6
|
-
import { Status, ButtonClickParams, ButtonClickResult, InlineChatResultParams, PromptInputOptionChangeParams, ExecuteCommandParams, FollowUpClickParams } from '@aws/language-server-runtimes/protocol';
|
|
6
|
+
import { Status, ButtonClickParams, ButtonClickResult, InlineChatResultParams, PromptInputOptionChangeParams, RuleClickParams, ListRulesParams, ActiveEditorChangedParams, PinnedContextParams, ExecuteCommandParams, FollowUpClickParams } from '@aws/language-server-runtimes/protocol';
|
|
7
7
|
import { FeedbackParams, InsertToCursorPositionParams, InlineChatParams, ConversationClickParams, ListConversationsParams, ListMcpServersParams, McpServerClickParams, TabBarActionParams, CreatePromptParams, FileClickParams } from '@aws/language-server-runtimes/protocol';
|
|
8
8
|
import { CancellationToken, Chat, ChatParams, ChatResult, EndChatParams, QuickActionParams, ResponseError, TabAddParams, TabRemoveParams, TabChangeParams, InlineChatResult } from '@aws/language-server-runtimes/server-interface';
|
|
9
9
|
import { Features, LspHandlers } from '../types';
|
|
@@ -14,7 +14,7 @@ import { AmazonQWorkspaceConfig } from '../../shared/amazonQServiceManager/confi
|
|
|
14
14
|
import { ChatSessionService } from '../chat/chatSessionService';
|
|
15
15
|
import { AgenticChatResultStream } from './agenticChatResultStream';
|
|
16
16
|
import { PaidTierMode } from '../paidTier/paidTier';
|
|
17
|
-
type ChatHandlers = Omit<LspHandlers<Chat>, 'openTab' | 'sendChatUpdate' | 'sendContextCommands' | 'onListConversations' | 'onConversationClick' | 'onListMcpServers' | 'onMcpServerClick' | 'onTabBarAction' | 'getSerializedChat' | 'chatOptionsUpdate' | 'onListMcpServers' | 'onMcpServerClick'>;
|
|
17
|
+
type ChatHandlers = Omit<LspHandlers<Chat>, 'openTab' | 'sendChatUpdate' | 'sendContextCommands' | 'onListConversations' | 'onConversationClick' | 'onListMcpServers' | 'onMcpServerClick' | 'onTabBarAction' | 'getSerializedChat' | 'chatOptionsUpdate' | 'onListMcpServers' | 'onMcpServerClick' | 'onListRules' | 'sendPinnedContext' | 'onActiveEditorChanged' | 'onPinnedContextAdd' | 'onPinnedContextRemove'>;
|
|
18
18
|
export declare class AgenticChatController implements ChatHandlers {
|
|
19
19
|
#private;
|
|
20
20
|
constructor(chatSessionManagementService: ChatSessionManagementService, features: Features, telemetryService: TelemetryService, serviceManager?: AmazonQTokenServiceManager);
|
|
@@ -24,6 +24,8 @@ export declare class AgenticChatController implements ChatHandlers {
|
|
|
24
24
|
dispose(): void;
|
|
25
25
|
onListConversations(params: ListConversationsParams): Promise<import("@aws/language-server-runtimes/protocol").ListConversationsResult>;
|
|
26
26
|
onConversationClick(params: ConversationClickParams): Promise<import("@aws/language-server-runtimes/protocol").ConversationClickResult>;
|
|
27
|
+
onRuleClick(params: RuleClickParams): Promise<import("@aws/language-server-runtimes/protocol").RuleClickResult>;
|
|
28
|
+
onListRules(params: ListRulesParams): Promise<import("@aws/language-server-runtimes/protocol").ListRulesResult>;
|
|
27
29
|
onListMcpServers(params: ListMcpServersParams): Promise<{
|
|
28
30
|
header: {
|
|
29
31
|
title: string;
|
|
@@ -52,7 +54,7 @@ export declare class AgenticChatController implements ChatHandlers {
|
|
|
52
54
|
* @param promptBlockId id of approval block. This allows us to overwrite the buttons with 'accepted' or 'rejected' text.
|
|
53
55
|
* @param session
|
|
54
56
|
*/
|
|
55
|
-
waitForToolApproval(toolUse: ToolUse, resultStream: AgenticChatResultStream, promptBlockId: number, session: ChatSessionService): Promise<void>;
|
|
57
|
+
waitForToolApproval(toolUse: ToolUse, resultStream: AgenticChatResultStream, promptBlockId: number, session: ChatSessionService, toolName: string): Promise<void>;
|
|
56
58
|
/**
|
|
57
59
|
* Determines if error is thrown as a result of a user action (Ex. rejecting tool, stop button)
|
|
58
60
|
* @param err
|
|
@@ -61,6 +63,7 @@ export declare class AgenticChatController implements ChatHandlers {
|
|
|
61
63
|
isUserAction(err: unknown, token?: CancellationToken, session?: ChatSessionService): boolean;
|
|
62
64
|
onInlineChatPrompt(params: InlineChatParams, token: CancellationToken): Promise<InlineChatResult | ResponseError<InlineChatResult>>;
|
|
63
65
|
onInlineChatResult(params: InlineChatResultParams): Promise<void>;
|
|
66
|
+
onActiveEditorChanged(params: ActiveEditorChangedParams): Promise<void>;
|
|
64
67
|
onCodeInsertToCursorPosition(params: InsertToCursorPositionParams): Promise<void>;
|
|
65
68
|
onCopyCodeToClipboard(): void;
|
|
66
69
|
onEndChat(params: EndChatParams, _token: CancellationToken): boolean;
|
|
@@ -76,6 +79,7 @@ export declare class AgenticChatController implements ChatHandlers {
|
|
|
76
79
|
onSourceLinkClick(): void;
|
|
77
80
|
onTabAdd(params: TabAddParams): ResponseError<ChatResult> | undefined;
|
|
78
81
|
onTabChange(params: TabChangeParams): void;
|
|
82
|
+
sendPinnedContext(tabId: string): void;
|
|
79
83
|
onTabRemove(params: TabRemoveParams): void;
|
|
80
84
|
onQuickAction(params: QuickActionParams, _cancellationToken: CancellationToken): {
|
|
81
85
|
messageId?: undefined;
|
|
@@ -84,6 +88,8 @@ export declare class AgenticChatController implements ChatHandlers {
|
|
|
84
88
|
messageId: string;
|
|
85
89
|
body: string;
|
|
86
90
|
};
|
|
91
|
+
onPinnedContextAdd(params: PinnedContextParams): void;
|
|
92
|
+
onPinnedContextRemove(params: PinnedContextParams): void;
|
|
87
93
|
onTabBarAction(params: TabBarActionParams): Promise<{
|
|
88
94
|
success: boolean;
|
|
89
95
|
tabId?: string;
|
|
@@ -90,8 +90,8 @@ class AgenticChatController {
|
|
|
90
90
|
this.#telemetryService = telemetryService;
|
|
91
91
|
this.#serviceManager = serviceManager;
|
|
92
92
|
this.#chatHistoryDb = new chatDb_1.ChatDatabase(features);
|
|
93
|
-
this.#tabBarController = new tabBarController_1.TabBarController(features, this.#chatHistoryDb, telemetryService);
|
|
94
|
-
this.#additionalContextProvider = new addtionalContextProvider_1.AdditionalContextProvider(features
|
|
93
|
+
this.#tabBarController = new tabBarController_1.TabBarController(features, this.#chatHistoryDb, telemetryService, (tabId) => this.sendPinnedContext(tabId));
|
|
94
|
+
this.#additionalContextProvider = new addtionalContextProvider_1.AdditionalContextProvider(features, this.#chatHistoryDb);
|
|
95
95
|
this.#contextCommandsProvider = new contextCommandsProvider_1.ContextCommandsProvider(this.#features.logging, this.#features.chat, this.#features.workspace, this.#features.lsp);
|
|
96
96
|
this.#mcpEventHandler = new mcpEventHandler_1.McpEventHandler(features, telemetryService);
|
|
97
97
|
}
|
|
@@ -248,6 +248,23 @@ class AgenticChatController {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
async onCreatePrompt(params) {
|
|
251
|
+
if (params.isRule) {
|
|
252
|
+
let workspaceFolders = lsp_core_1.workspaceUtils.getWorkspaceFolderPaths(this.#features.workspace);
|
|
253
|
+
let workspaceRulesDirectory = path.join(workspaceFolders[0], '.amazonq', 'rules');
|
|
254
|
+
if (workspaceFolders.length > 0) {
|
|
255
|
+
const newFilePath = (0, contextUtils_1.getNewRuleFilePath)(params.promptName, workspaceRulesDirectory);
|
|
256
|
+
const newFileContent = '';
|
|
257
|
+
try {
|
|
258
|
+
await this.#features.workspace.fs.mkdir(workspaceRulesDirectory, { recursive: true });
|
|
259
|
+
await this.#features.workspace.fs.writeFile(newFilePath, newFileContent, { mode: 0o600 });
|
|
260
|
+
await this.#features.lsp.window.showDocument({ uri: vscode_uri_1.URI.file(newFilePath).toString() });
|
|
261
|
+
}
|
|
262
|
+
catch (e) {
|
|
263
|
+
this.#features.logging.warn(`Error creating rule file: ${e}`);
|
|
264
|
+
}
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
251
268
|
const newFilePath = (0, contextUtils_1.getNewPromptFilePath)(params.promptName);
|
|
252
269
|
const newFileContent = '';
|
|
253
270
|
try {
|
|
@@ -272,6 +289,12 @@ class AgenticChatController {
|
|
|
272
289
|
async onConversationClick(params) {
|
|
273
290
|
return this.#tabBarController.onConversationClick(params);
|
|
274
291
|
}
|
|
292
|
+
async onRuleClick(params) {
|
|
293
|
+
return this.#additionalContextProvider.onRuleClick(params);
|
|
294
|
+
}
|
|
295
|
+
async onListRules(params) {
|
|
296
|
+
return this.#additionalContextProvider.onListRules(params);
|
|
297
|
+
}
|
|
275
298
|
async onListMcpServers(params) {
|
|
276
299
|
return this.#mcpEventHandler.onListMcpServers(params);
|
|
277
300
|
}
|
|
@@ -337,7 +360,7 @@ class AgenticChatController {
|
|
|
337
360
|
await this.#telemetryController.emitAddMessageMetric(params.tabId, metric.metric, 'Cancelled');
|
|
338
361
|
});
|
|
339
362
|
session.setConversationType('AgenticChat');
|
|
340
|
-
const additionalContext = await this.#additionalContextProvider.getAdditionalContext(triggerContext, params.context);
|
|
363
|
+
const additionalContext = await this.#additionalContextProvider.getAdditionalContext(triggerContext, params.tabId, params.context);
|
|
341
364
|
if (additionalContext.length) {
|
|
342
365
|
triggerContext.documentReference =
|
|
343
366
|
this.#additionalContextProvider.getFileListFromContext(additionalContext);
|
|
@@ -642,13 +665,13 @@ class AgenticChatController {
|
|
|
642
665
|
* @param promptBlockId id of approval block. This allows us to overwrite the buttons with 'accepted' or 'rejected' text.
|
|
643
666
|
* @param session
|
|
644
667
|
*/
|
|
645
|
-
async waitForToolApproval(toolUse, resultStream, promptBlockId, session) {
|
|
668
|
+
async waitForToolApproval(toolUse, resultStream, promptBlockId, session, toolName) {
|
|
646
669
|
const deferred = this.#createDeferred();
|
|
647
670
|
session.setDeferredToolExecution(toolUse.toolUseId, deferred.resolve, deferred.reject);
|
|
648
|
-
this.#log(`Prompting for tool approval for tool: ${toolUse.name}`);
|
|
671
|
+
this.#log(`Prompting for tool approval for tool: ${toolName ?? toolUse.name}`);
|
|
649
672
|
await deferred.promise;
|
|
650
673
|
// Note: we want to overwrite the button block because it already exists in the stream.
|
|
651
|
-
await resultStream.overwriteResultBlock(this.#getUpdateToolConfirmResult(toolUse, true), promptBlockId);
|
|
674
|
+
await resultStream.overwriteResultBlock(this.#getUpdateToolConfirmResult(toolUse, true, toolName), promptBlockId);
|
|
652
675
|
}
|
|
653
676
|
/**
|
|
654
677
|
* Processes tool uses by running the tools and collecting results
|
|
@@ -724,7 +747,7 @@ class AgenticChatController {
|
|
|
724
747
|
this.#telemetryController.emitInteractWithAgenticChat('GeneratedCommand', tabId, session.pairProgrammingMode, session.getConversationType());
|
|
725
748
|
}
|
|
726
749
|
if (requiresAcceptance) {
|
|
727
|
-
await this.waitForToolApproval(toolUse, chatResultStream, cachedButtonBlockId, session);
|
|
750
|
+
await this.waitForToolApproval(toolUse, chatResultStream, cachedButtonBlockId, session, toolUse.name);
|
|
728
751
|
}
|
|
729
752
|
if (isExecuteBash) {
|
|
730
753
|
this.#telemetryController.emitInteractWithAgenticChat('RunCommand', tabId, session.pairProgrammingMode, session.getConversationType());
|
|
@@ -751,7 +774,7 @@ class AgenticChatController {
|
|
|
751
774
|
const confirmation = this.#processToolConfirmation(toolUse, requiresAcceptance, warning, undefined, toolName // Pass the original tool name here
|
|
752
775
|
);
|
|
753
776
|
cachedButtonBlockId = await chatResultStream.writeResultBlock(confirmation);
|
|
754
|
-
await this.waitForToolApproval(toolUse, chatResultStream, cachedButtonBlockId, session);
|
|
777
|
+
await this.waitForToolApproval(toolUse, chatResultStream, cachedButtonBlockId, session, toolName);
|
|
755
778
|
}
|
|
756
779
|
// Store the blockId in the session for later use
|
|
757
780
|
if (toolUse.toolUseId) {
|
|
@@ -863,7 +886,7 @@ class AgenticChatController {
|
|
|
863
886
|
if (this.isUserAction(err, token)) {
|
|
864
887
|
// Handle ToolApprovalException for any tool
|
|
865
888
|
if (err instanceof toolShared_1.ToolApprovalException && cachedButtonBlockId) {
|
|
866
|
-
await chatResultStream.overwriteResultBlock(this.#getUpdateToolConfirmResult(toolUse, false), cachedButtonBlockId);
|
|
889
|
+
await chatResultStream.overwriteResultBlock(this.#getUpdateToolConfirmResult(toolUse, false, toolUse.name), cachedButtonBlockId);
|
|
867
890
|
if (err.shouldShowMessage) {
|
|
868
891
|
await chatResultStream.writeResultBlock({
|
|
869
892
|
type: 'answer',
|
|
@@ -1132,8 +1155,8 @@ class AgenticChatController {
|
|
|
1132
1155
|
* @param toolType Optional tool type for specialized handling
|
|
1133
1156
|
* @returns ChatResult with appropriate confirmation UI
|
|
1134
1157
|
*/
|
|
1135
|
-
#getUpdateToolConfirmResult(toolUse, isAccept, toolType) {
|
|
1136
|
-
const toolName = toolType || toolUse.name;
|
|
1158
|
+
#getUpdateToolConfirmResult(toolUse, isAccept, originalToolName, toolType) {
|
|
1159
|
+
const toolName = originalToolName ?? (toolType || toolUse.name);
|
|
1137
1160
|
// Handle bash commands with special formatting
|
|
1138
1161
|
if (toolName === 'executeBash') {
|
|
1139
1162
|
return {
|
|
@@ -1184,7 +1207,7 @@ class AgenticChatController {
|
|
|
1184
1207
|
body = `File search ${isAccept ? 'allowed' : 'rejected'}: \`${searchPath}\``;
|
|
1185
1208
|
break;
|
|
1186
1209
|
default:
|
|
1187
|
-
// Default tool (not MCP)
|
|
1210
|
+
// Default tool (not only MCP)
|
|
1188
1211
|
return {
|
|
1189
1212
|
type: 'tool',
|
|
1190
1213
|
messageId: toolUse.toolUseId,
|
|
@@ -1192,7 +1215,7 @@ class AgenticChatController {
|
|
|
1192
1215
|
content: {
|
|
1193
1216
|
header: {
|
|
1194
1217
|
icon: 'tools',
|
|
1195
|
-
body: `${
|
|
1218
|
+
body: `${toolName}`,
|
|
1196
1219
|
status: {
|
|
1197
1220
|
status: isAccept ? 'success' : 'error',
|
|
1198
1221
|
icon: isAccept ? 'ok' : 'cancel',
|
|
@@ -1594,7 +1617,8 @@ class AgenticChatController {
|
|
|
1594
1617
|
cwsprChatHasContextList: triggerContext.documentReference?.filePaths?.length ? true : false,
|
|
1595
1618
|
cwsprChatFolderContextCount: triggerContext.contextInfo.contextCount.folderContextCount,
|
|
1596
1619
|
cwsprChatFileContextCount: triggerContext.contextInfo.contextCount.fileContextCount,
|
|
1597
|
-
cwsprChatRuleContextCount: triggerContext.contextInfo.contextCount.
|
|
1620
|
+
cwsprChatRuleContextCount: triggerContext.contextInfo.contextCount.activeRuleContextCount,
|
|
1621
|
+
cwsprChatTotalRuleContextCount: triggerContext.contextInfo.contextCount.totalRuleContextCount,
|
|
1598
1622
|
cwsprChatPromptContextCount: triggerContext.contextInfo.contextCount.promptContextCount,
|
|
1599
1623
|
cwsprChatFileContextLength: triggerContext.contextInfo.contextLength.fileContextLength,
|
|
1600
1624
|
cwsprChatRuleContextLength: triggerContext.contextInfo.contextLength.ruleContextLength,
|
|
@@ -1602,6 +1626,10 @@ class AgenticChatController {
|
|
|
1602
1626
|
cwsprChatCodeContextCount: triggerContext.contextInfo.contextCount.codeContextCount,
|
|
1603
1627
|
cwsprChatCodeContextLength: triggerContext.contextInfo.contextLength.codeContextLength,
|
|
1604
1628
|
cwsprChatFocusFileContextLength: triggerContext.text?.length,
|
|
1629
|
+
cwsprChatPinnedCodeContextCount: triggerContext.contextInfo.pinnedContextCount.codeContextCount,
|
|
1630
|
+
cwsprChatPinnedFileContextCount: triggerContext.contextInfo.pinnedContextCount.fileContextCount,
|
|
1631
|
+
cwsprChatPinnedFolderContextCount: triggerContext.contextInfo.pinnedContextCount.folderContextCount,
|
|
1632
|
+
cwsprChatPinnedPromptContextCount: triggerContext.contextInfo.pinnedContextCount.promptContextCount,
|
|
1605
1633
|
});
|
|
1606
1634
|
}
|
|
1607
1635
|
await this.#telemetryController.emitAddMessageMetric(params.tabId, metric.metric, 'Succeeded');
|
|
@@ -1676,6 +1704,21 @@ class AgenticChatController {
|
|
|
1676
1704
|
buttons: [],
|
|
1677
1705
|
};
|
|
1678
1706
|
if (err.code === 'QModelResponse') {
|
|
1707
|
+
// special case for throttling where we show error card instead of chat message
|
|
1708
|
+
if (err.message ===
|
|
1709
|
+
`The model you selected is temporarily unavailable. Please switch to a different model and try again.`) {
|
|
1710
|
+
this.#features.chat.sendChatUpdate({
|
|
1711
|
+
tabId: tabId,
|
|
1712
|
+
data: { messages: [{ messageId: 'modelUnavailable' }] },
|
|
1713
|
+
});
|
|
1714
|
+
const emptyChatResult = {
|
|
1715
|
+
type: 'answer',
|
|
1716
|
+
body: '',
|
|
1717
|
+
messageId: errorMessageId,
|
|
1718
|
+
buttons: [],
|
|
1719
|
+
};
|
|
1720
|
+
return emptyChatResult;
|
|
1721
|
+
}
|
|
1679
1722
|
return responseData;
|
|
1680
1723
|
}
|
|
1681
1724
|
return new server_interface_1.ResponseError(server_interface_1.LSPErrorCodes.RequestFailed, err.message, responseData);
|
|
@@ -1730,6 +1773,11 @@ class AgenticChatController {
|
|
|
1730
1773
|
async onInlineChatResult(params) {
|
|
1731
1774
|
await this.#telemetryService.emitInlineChatResultLog(params);
|
|
1732
1775
|
}
|
|
1776
|
+
async onActiveEditorChanged(params) {
|
|
1777
|
+
if (this.#telemetryController.activeTabId) {
|
|
1778
|
+
this.sendPinnedContext(this.#telemetryController.activeTabId);
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1733
1781
|
async onCodeInsertToCursorPosition(params) {
|
|
1734
1782
|
// Implementation based on https://github.com/aws/aws-toolkit-vscode/blob/1814cc84228d4bf20270574c5980b91b227f31cf/packages/core/src/amazonq/commons/controllers/contentController.ts#L38
|
|
1735
1783
|
if (!params.textDocument || !params.cursorPosition || !params.code) {
|
|
@@ -1876,6 +1924,9 @@ class AgenticChatController {
|
|
|
1876
1924
|
// In that case, we use the default modelId.
|
|
1877
1925
|
const modelId = this.#chatHistoryDb.getModelId() ?? constants_2.defaultModelId;
|
|
1878
1926
|
this.#features.chat.chatOptionsUpdate({ modelId: modelId, tabId: params.tabId });
|
|
1927
|
+
if (!params.restoredTab) {
|
|
1928
|
+
this.sendPinnedContext(params.tabId);
|
|
1929
|
+
}
|
|
1879
1930
|
const sessionResult = this.#chatSessionManagementService.createSession(params.tabId);
|
|
1880
1931
|
const { data: session, success } = sessionResult;
|
|
1881
1932
|
if (!success) {
|
|
@@ -1894,12 +1945,16 @@ class AgenticChatController {
|
|
|
1894
1945
|
data: {},
|
|
1895
1946
|
});
|
|
1896
1947
|
this.#telemetryController.activeTabId = params.tabId;
|
|
1948
|
+
this.sendPinnedContext(params.tabId);
|
|
1897
1949
|
this.#telemetryController.emitConversationMetric({
|
|
1898
1950
|
name: types_1.ChatTelemetryEventName.EnterFocusConversation,
|
|
1899
1951
|
data: {},
|
|
1900
1952
|
});
|
|
1901
1953
|
this.setPaidTierMode(params.tabId);
|
|
1902
1954
|
}
|
|
1955
|
+
sendPinnedContext(tabId) {
|
|
1956
|
+
this.#additionalContextProvider.sendPinnedContext(tabId);
|
|
1957
|
+
}
|
|
1903
1958
|
onTabRemove(params) {
|
|
1904
1959
|
if (this.#telemetryController.activeTabId === params.tabId) {
|
|
1905
1960
|
this.#telemetryController.emitConversationMetric({
|
|
@@ -1942,6 +1997,12 @@ class AgenticChatController {
|
|
|
1942
1997
|
return {};
|
|
1943
1998
|
}
|
|
1944
1999
|
}
|
|
2000
|
+
onPinnedContextAdd(params) {
|
|
2001
|
+
this.#additionalContextProvider.onPinnedContextAdd(params);
|
|
2002
|
+
}
|
|
2003
|
+
onPinnedContextRemove(params) {
|
|
2004
|
+
this.#additionalContextProvider.onPinnedContextRemove(params);
|
|
2005
|
+
}
|
|
1945
2006
|
async onTabBarAction(params) {
|
|
1946
2007
|
return this.#tabBarController.onTabBarAction(params);
|
|
1947
2008
|
}
|