@aws/lsp-codewhisperer 0.0.96 → 0.0.97
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 +12 -0
- package/out/language-server/agenticChat/agenticChatController.d.ts +3 -1
- package/out/language-server/agenticChat/agenticChatController.js +38 -17
- package/out/language-server/agenticChat/agenticChatController.js.map +1 -1
- package/out/language-server/agenticChat/constants/constants.d.ts +0 -3
- package/out/language-server/agenticChat/constants/constants.js +1 -7
- package/out/language-server/agenticChat/constants/constants.js.map +1 -1
- package/out/language-server/agenticChat/constants/modelSelection.d.ts +1 -0
- package/out/language-server/agenticChat/constants/modelSelection.js +5 -1
- package/out/language-server/agenticChat/constants/modelSelection.js.map +1 -1
- package/out/language-server/agenticChat/tools/mcp/mcpOauthClient.js.map +1 -1
- package/out/language-server/agenticChat/utils/tokenLimitsCalculator.d.ts +48 -0
- package/out/language-server/agenticChat/utils/tokenLimitsCalculator.js +48 -0
- package/out/language-server/agenticChat/utils/tokenLimitsCalculator.js.map +1 -0
- package/out/language-server/chat/chatSessionService.d.ts +17 -1
- package/out/language-server/chat/chatSessionService.js +28 -1
- package/out/language-server/chat/chatSessionService.js.map +1 -1
- package/out/language-server/configuration/transformConfigurationServer.d.ts +0 -13
- package/out/language-server/configuration/transformConfigurationServer.js +4 -112
- package/out/language-server/configuration/transformConfigurationServer.js.map +1 -1
- package/out/language-server/netTransform/atxTransformHandler.d.ts +2 -33
- package/out/language-server/netTransform/atxTransformHandler.js +130 -428
- package/out/language-server/netTransform/atxTransformHandler.js.map +1 -1
- package/out/language-server/netTransform/transformHandler.d.ts +0 -4
- package/out/language-server/netTransform/transformHandler.js +11 -39
- package/out/language-server/netTransform/transformHandler.js.map +1 -1
- package/out/language-server/netTransform/utils.d.ts +49 -0
- package/out/language-server/netTransform/utils.js +187 -0
- package/out/language-server/netTransform/utils.js.map +1 -0
- package/out/shared/amazonQServiceManager/AtxTokenServiceManager.d.ts +0 -1
- package/out/shared/amazonQServiceManager/AtxTokenServiceManager.js +14 -38
- package/out/shared/amazonQServiceManager/AtxTokenServiceManager.js.map +1 -1
- package/out/shared/codeWhispererService.js +1 -1
- package/out/shared/codeWhispererService.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.97](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.96...lsp-codewhisperer/v0.0.97) (2025-12-08)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* use dynamic token limits from listAvailableModels API ([#2539](https://github.com/aws/language-servers/issues/2539)) ([f87ac9f](https://github.com/aws/language-servers/commit/f87ac9fce32d235649f81957b71d424264aae9c8))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* ATX Transform Fix Retrieve Job Erroring on Profile changes ([#2538](https://github.com/aws/language-servers/issues/2538)) ([870d540](https://github.com/aws/language-servers/commit/870d5400dd5eb77f32e5592089525dacc001cb81))
|
|
14
|
+
|
|
3
15
|
## [0.0.96](https://github.com/aws/language-servers/compare/lsp-codewhisperer/v0.0.95...lsp-codewhisperer/v0.0.96) (2025-12-01)
|
|
4
16
|
|
|
5
17
|
|
|
@@ -79,8 +79,10 @@ export declare class AgenticChatController implements ChatHandlers {
|
|
|
79
79
|
* performs truncation of request before sending to backend service.
|
|
80
80
|
* Returns the remaining character budget for chat history.
|
|
81
81
|
* @param request
|
|
82
|
+
* @param additionalContext
|
|
83
|
+
* @param inputLimit - The dynamic input limit from the session's token limits
|
|
82
84
|
*/
|
|
83
|
-
truncateRequest(request: ChatCommandInput, additionalContext?: AdditionalContentEntryAddition[]): number;
|
|
85
|
+
truncateRequest(request: ChatCommandInput, additionalContext?: AdditionalContentEntryAddition[], inputLimit?: number): number;
|
|
84
86
|
/**
|
|
85
87
|
* Creates a promise that does not resolve until the user accepts or rejects the tool usage.
|
|
86
88
|
* @param toolUseId
|
|
@@ -41,6 +41,7 @@ const executeBash_1 = require("./tools/executeBash");
|
|
|
41
41
|
const toolShared_1 = require("./tools/toolShared");
|
|
42
42
|
const pathValidation_1 = require("./utils/pathValidation");
|
|
43
43
|
const fileModificationMetrics_1 = require("./utils/fileModificationMetrics");
|
|
44
|
+
const tokenLimitsCalculator_1 = require("./utils/tokenLimitsCalculator");
|
|
44
45
|
const grepSearch_1 = require("./tools/grepSearch");
|
|
45
46
|
const fileSearch_1 = require("./tools/fileSearch");
|
|
46
47
|
const fsReplace_1 = require("./tools/fsReplace");
|
|
@@ -470,10 +471,15 @@ class AgenticChatController {
|
|
|
470
471
|
// Wait for the response to be completed before proceeding
|
|
471
472
|
this.#log('Model Response: ', JSON.stringify(responseResult, null, 2));
|
|
472
473
|
if (responseResult.models) {
|
|
473
|
-
models = Object.values(responseResult.models).map(({ modelId, modelName, description }) => ({
|
|
474
|
+
models = Object.values(responseResult.models).map(({ modelId, modelName, description, tokenLimits }) => ({
|
|
474
475
|
id: modelId ?? 'unknown',
|
|
475
476
|
name: modelName ?? modelId ?? 'unknown',
|
|
476
477
|
description: description ?? '',
|
|
478
|
+
tokenLimits: tokenLimits
|
|
479
|
+
? {
|
|
480
|
+
maxInputTokens: tokenLimits.maxInputTokens,
|
|
481
|
+
}
|
|
482
|
+
: undefined,
|
|
477
483
|
}));
|
|
478
484
|
}
|
|
479
485
|
defaultModelId = responseResult.defaultModel?.modelId;
|
|
@@ -514,6 +520,11 @@ class AgenticChatController {
|
|
|
514
520
|
const { data: session, success } = sessionResult;
|
|
515
521
|
// Handle error cases by returning default model
|
|
516
522
|
if (!success || errorFromAPI) {
|
|
523
|
+
// Even in error cases, set the model with token limits
|
|
524
|
+
if (success && session) {
|
|
525
|
+
session.setModel(DEFAULT_MODEL_ID, models);
|
|
526
|
+
this.#log(`Model set for fallback (error case): ${DEFAULT_MODEL_ID}, tokenLimits: ${JSON.stringify(session.tokenLimits)}`);
|
|
527
|
+
}
|
|
517
528
|
return {
|
|
518
529
|
tabId: params.tabId,
|
|
519
530
|
models: models,
|
|
@@ -547,8 +558,9 @@ class AgenticChatController {
|
|
|
547
558
|
// No user-selected model - use API default or system default
|
|
548
559
|
selectedModelId = defaultModelId || getMappedModelId(DEFAULT_MODEL_ID);
|
|
549
560
|
}
|
|
550
|
-
// Store the selected model in the session
|
|
551
|
-
session.
|
|
561
|
+
// Store the selected model in the session (automatically calculates token limits)
|
|
562
|
+
session.setModel(selectedModelId, models);
|
|
563
|
+
this.#log(`Model set for initial selection: ${selectedModelId}, tokenLimits: ${JSON.stringify(session.tokenLimits)}`);
|
|
552
564
|
return {
|
|
553
565
|
tabId: params.tabId,
|
|
554
566
|
models: models,
|
|
@@ -802,8 +814,8 @@ class AgenticChatController {
|
|
|
802
814
|
/**
|
|
803
815
|
* Runs the compaction, making requests and processing tool uses until completion
|
|
804
816
|
*/
|
|
805
|
-
#shouldCompact(currentRequestCount) {
|
|
806
|
-
if (currentRequestCount >
|
|
817
|
+
#shouldCompact(currentRequestCount, compactionThreshold) {
|
|
818
|
+
if (currentRequestCount > compactionThreshold) {
|
|
807
819
|
this.#debug(`Current request total character count is: ${currentRequestCount}, prompting user to compact`);
|
|
808
820
|
return true;
|
|
809
821
|
}
|
|
@@ -937,7 +949,7 @@ class AgenticChatController {
|
|
|
937
949
|
this.#debug('Stopping agent loop - cancelled by user');
|
|
938
950
|
throw new lsp_core_1.CancellationError('user');
|
|
939
951
|
}
|
|
940
|
-
this.truncateRequest(currentRequestInput, additionalContext);
|
|
952
|
+
this.truncateRequest(currentRequestInput, additionalContext, session.tokenLimits.inputLimit);
|
|
941
953
|
const currentMessage = currentRequestInput.conversationState?.currentMessage;
|
|
942
954
|
const conversationId = conversationIdentifier ?? '';
|
|
943
955
|
if (!currentMessage || !conversationId) {
|
|
@@ -1115,10 +1127,10 @@ class AgenticChatController {
|
|
|
1115
1127
|
}
|
|
1116
1128
|
currentRequestInput = this.#updateRequestInputWithToolResults(currentRequestInput, toolResults, content);
|
|
1117
1129
|
}
|
|
1118
|
-
if (this.#shouldCompact(currentRequestCount)) {
|
|
1130
|
+
if (this.#shouldCompact(currentRequestCount, session.tokenLimits.compactionThreshold)) {
|
|
1119
1131
|
this.#telemetryController.emitCompactNudge(currentRequestCount, this.#features.runtime.serverInfo.version ?? '');
|
|
1120
1132
|
const messageId = this.#getMessageIdForCompact((0, uuid_1.v4)());
|
|
1121
|
-
const confirmationResult = this.#processCompactConfirmation(messageId, currentRequestCount);
|
|
1133
|
+
const confirmationResult = this.#processCompactConfirmation(messageId, currentRequestCount, session.tokenLimits.maxOverallCharacters);
|
|
1122
1134
|
const cachedButtonBlockId = await chatResultStream.writeResultBlock(confirmationResult);
|
|
1123
1135
|
await this.waitForCompactApproval(messageId, chatResultStream, cachedButtonBlockId, session);
|
|
1124
1136
|
// Get the compaction request input
|
|
@@ -1154,10 +1166,13 @@ class AgenticChatController {
|
|
|
1154
1166
|
* performs truncation of request before sending to backend service.
|
|
1155
1167
|
* Returns the remaining character budget for chat history.
|
|
1156
1168
|
* @param request
|
|
1169
|
+
* @param additionalContext
|
|
1170
|
+
* @param inputLimit - The dynamic input limit from the session's token limits
|
|
1157
1171
|
*/
|
|
1158
|
-
truncateRequest(request, additionalContext) {
|
|
1159
|
-
//
|
|
1160
|
-
|
|
1172
|
+
truncateRequest(request, additionalContext, inputLimit) {
|
|
1173
|
+
// Use dynamic inputLimit from session, or fall back to default calculated value
|
|
1174
|
+
const effectiveInputLimit = inputLimit ?? tokenLimitsCalculator_1.TokenLimitsCalculator.calculate().inputLimit;
|
|
1175
|
+
let remainingCharacterBudget = effectiveInputLimit;
|
|
1161
1176
|
if (!request?.conversationState?.currentMessage?.userInputMessage) {
|
|
1162
1177
|
return remainingCharacterBudget;
|
|
1163
1178
|
}
|
|
@@ -1165,9 +1180,9 @@ class AgenticChatController {
|
|
|
1165
1180
|
// 1. prioritize user input message
|
|
1166
1181
|
let truncatedUserInputMessage = '';
|
|
1167
1182
|
if (message) {
|
|
1168
|
-
if (message.length >
|
|
1169
|
-
this.#debug(`Truncating userInputMessage to ${
|
|
1170
|
-
truncatedUserInputMessage = message.substring(0,
|
|
1183
|
+
if (message.length > effectiveInputLimit) {
|
|
1184
|
+
this.#debug(`Truncating userInputMessage to ${effectiveInputLimit} characters}`);
|
|
1185
|
+
truncatedUserInputMessage = message.substring(0, effectiveInputLimit);
|
|
1171
1186
|
remainingCharacterBudget = remainingCharacterBudget - truncatedUserInputMessage.length;
|
|
1172
1187
|
request.conversationState.currentMessage.userInputMessage.content = truncatedUserInputMessage;
|
|
1173
1188
|
}
|
|
@@ -2055,7 +2070,7 @@ class AgenticChatController {
|
|
|
2055
2070
|
},
|
|
2056
2071
|
});
|
|
2057
2072
|
}
|
|
2058
|
-
#processCompactConfirmation(messageId, characterCount) {
|
|
2073
|
+
#processCompactConfirmation(messageId, characterCount, maxOverallCharacters) {
|
|
2059
2074
|
const buttons = [{ id: 'allow-tools', text: 'Allow', icon: 'ok', status: 'clear' }];
|
|
2060
2075
|
const header = {
|
|
2061
2076
|
icon: 'warning',
|
|
@@ -2063,7 +2078,7 @@ class AgenticChatController {
|
|
|
2063
2078
|
body: constants_2.COMPACTION_HEADER_BODY,
|
|
2064
2079
|
buttons,
|
|
2065
2080
|
};
|
|
2066
|
-
const body = (0, constants_2.COMPACTION_BODY)(Math.round((characterCount /
|
|
2081
|
+
const body = (0, constants_2.COMPACTION_BODY)(Math.round((characterCount / maxOverallCharacters) * 100));
|
|
2067
2082
|
return {
|
|
2068
2083
|
type: 'tool',
|
|
2069
2084
|
messageId,
|
|
@@ -3535,7 +3550,13 @@ class AgenticChatController {
|
|
|
3535
3550
|
return;
|
|
3536
3551
|
}
|
|
3537
3552
|
session.pairProgrammingMode = params.optionsValues['pair-programmer-mode'] === 'true';
|
|
3538
|
-
|
|
3553
|
+
const newModelId = params.optionsValues['model-selection'];
|
|
3554
|
+
// Set model (automatically recalculates token limits)
|
|
3555
|
+
if (newModelId !== session.modelId) {
|
|
3556
|
+
const cachedData = this.#chatHistoryDb.getCachedModels();
|
|
3557
|
+
session.setModel(newModelId, cachedData?.models);
|
|
3558
|
+
this.#log(`Model set for model switch: ${newModelId}, tokenLimits: ${JSON.stringify(session.tokenLimits)}`);
|
|
3559
|
+
}
|
|
3539
3560
|
this.#chatHistoryDb.setModelId(session.modelId);
|
|
3540
3561
|
this.#chatHistoryDb.setPairProgrammingMode(session.pairProgrammingMode);
|
|
3541
3562
|
}
|