Skip to content

Commit 0c4086b

Browse files
committed
merge: resolve package.json conflicts
2 parents 1e67e00 + bd37885 commit 0c4086b

File tree

34 files changed

+660
-300
lines changed

34 files changed

+660
-300
lines changed

package-lock.json

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "/review: Code Issues ellipses menu displays AWS Toolkit options, if installed."
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q chat: Improve responses for saved prompts and workspace rules"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "/test: show descriptive error message"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Fix inline completion failure due to context length exceeding the threshold"
4+
}

packages/amazonq/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"Codewhisperer",
3333
"AI",
3434
"Assistant",
35-
"Chatbot"
35+
"Chatbot",
36+
"Q Developer"
3637
],
3738
"preview": false,
3839
"qna": "https://github.com/aws/aws-toolkit-vscode/issues",
@@ -220,7 +221,7 @@
220221
},
221222
{
222223
"type": "webview",
223-
"id": "aws.AmazonQChatView",
224+
"id": "aws.amazonq.AmazonQChatView",
224225
"name": "%AWS.amazonq.chat%",
225226
"when": "!aws.isWebExtHost && !aws.amazonq.showLoginView"
226227
}
@@ -340,32 +341,32 @@
340341
},
341342
{
342343
"command": "aws.amazonq.openReferencePanel",
343-
"when": "view == aws.AmazonQChatView",
344+
"when": "view == aws.amazonq.AmazonQChatView",
344345
"group": "0_topAmazonQ@1"
345346
},
346347
{
347348
"command": "aws.amazonq.learnMore",
348-
"when": "view == aws.AmazonQChatView || view == aws.amazonq.AmazonCommonAuth",
349+
"when": "view =~ /^aws\\.amazonq/",
349350
"group": "1_amazonQ@1"
350351
},
351352
{
352353
"command": "aws.amazonq.signout",
353-
"when": "(view == aws.AmazonQChatView) && aws.codewhisperer.connected",
354+
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected",
354355
"group": "2_amazonQ@4"
355356
},
356357
{
357358
"command": "aws.amazonq.reconnect",
358-
"when": "(view == aws.AmazonQChatView) && aws.codewhisperer.connectionExpired",
359+
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connectionExpired",
359360
"group": "2_amazonQ@3"
360361
},
361362
{
362363
"submenu": "aws.amazonq.submenu.feedback",
363-
"when": "view == aws.AmazonQChatView || view == aws.amazonq.AmazonCommonAuth",
364+
"when": "view =~ /^aws\\.amazonq/",
364365
"group": "y_toolkitMeta@1"
365366
},
366367
{
367368
"submenu": "aws.amazonq.submenu.help",
368-
"when": "view == aws.AmazonQChatView || view == aws.amazonq.AmazonCommonAuth",
369+
"when": "view =~ /^aws\\.amazonq/",
369370
"group": "y_toolkitMeta@2"
370371
},
371372
{

packages/amazonq/scripts/build/copyFiles.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,6 @@ const tasks: CopyTask[] = [
5656
destination: 'vue/',
5757
},
5858

59-
// Mynah
60-
{
61-
target: path.join(
62-
'../../node_modules',
63-
'@aws',
64-
'fully-qualified-names',
65-
'node',
66-
'aws_fully_qualified_names_bg.wasm'
67-
),
68-
destination: path.join('src', 'aws_fully_qualified_names_bg.wasm'),
69-
},
7059
{
7160
target: path.join('../../node_modules', 'web-tree-sitter', 'tree-sitter.wasm'),
7261
destination: path.join('src', 'tree-sitter.wasm'),

packages/amazonq/test/unit/amazonqFeatureDev/util/files.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import {
1111
maxRepoSizeBytes,
1212
} from 'aws-core-vscode/amazonqFeatureDev'
1313
import { assertTelemetry, getWorkspaceFolder, TestFolder } from 'aws-core-vscode/test'
14-
import { fs, AmazonqCreateUpload, ZipStream } from 'aws-core-vscode/shared'
14+
import { fs, AmazonqCreateUpload, ZipStream, ContentLengthError } from 'aws-core-vscode/shared'
1515
import { MetricName, Span } from 'aws-core-vscode/telemetry'
1616
import sinon from 'sinon'
1717
import { CodeWhispererSettings } from 'aws-core-vscode/codewhisperer'
18-
import { ContentLengthError, CurrentWsFolders } from 'aws-core-vscode/amazonq'
18+
import { CurrentWsFolders } from 'aws-core-vscode/amazonq'
1919
import path from 'path'
2020

2121
const testDevfilePrepareRepo = async (devfileEnabled: boolean) => {

packages/amazonq/test/unit/codewhisperer/util/supplemetalContextUtil.test.ts

Lines changed: 180 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import assert from 'assert'
77
import * as FakeTimers from '@sinonjs/fake-timers'
88
import * as vscode from 'vscode'
99
import * as sinon from 'sinon'
10+
import * as os from 'os'
1011
import * as crossFile from 'aws-core-vscode/codewhisperer'
1112
import { TestFolder, assertTabCount, installFakeClock } from 'aws-core-vscode/test'
12-
import { FeatureConfigProvider } from 'aws-core-vscode/codewhisperer'
13+
import { CodeWhispererSupplementalContext, FeatureConfigProvider } from 'aws-core-vscode/codewhisperer'
1314
import { toTextEditor } from 'aws-core-vscode/test'
1415
import { LspController } from 'aws-core-vscode/amazonq'
1516

17+
const newLine = os.EOL
18+
1619
describe('supplementalContextUtil', function () {
1720
let testFolder: TestFolder
1821
let clock: FakeTimers.InstalledClock
@@ -83,4 +86,180 @@ describe('supplementalContextUtil', function () {
8386
})
8487
})
8588
})
89+
90+
describe('truncation', function () {
91+
it('truncate context should do nothing if everything fits in constraint', function () {
92+
const chunkA: crossFile.CodeWhispererSupplementalContextItem = {
93+
content: 'a',
94+
filePath: 'a.java',
95+
score: 0,
96+
}
97+
const chunkB: crossFile.CodeWhispererSupplementalContextItem = {
98+
content: 'b',
99+
filePath: 'b.java',
100+
score: 1,
101+
}
102+
const chunks = [chunkA, chunkB]
103+
104+
const supplementalContext: CodeWhispererSupplementalContext = {
105+
isUtg: false,
106+
isProcessTimeout: false,
107+
supplementalContextItems: chunks,
108+
contentsLength: 25000,
109+
latency: 0,
110+
strategy: 'codemap',
111+
}
112+
113+
const actual = crossFile.truncateSuppelementalContext(supplementalContext)
114+
assert.strictEqual(actual.supplementalContextItems.length, 2)
115+
assert.strictEqual(actual.supplementalContextItems[0].content, 'a')
116+
assert.strictEqual(actual.supplementalContextItems[1].content, 'b')
117+
})
118+
119+
it('truncateLineByLine should drop the last line if max length is greater than threshold', function () {
120+
const input =
121+
repeatString('a', 11) +
122+
newLine +
123+
repeatString('b', 11) +
124+
newLine +
125+
repeatString('c', 11) +
126+
newLine +
127+
repeatString('d', 11) +
128+
newLine +
129+
repeatString('e', 11)
130+
131+
assert.ok(input.length > 50)
132+
const actual = crossFile.truncateLineByLine(input, 50)
133+
assert.ok(actual.length <= 50)
134+
135+
const input2 = repeatString(`b${newLine}`, 10)
136+
const actual2 = crossFile.truncateLineByLine(input2, 8)
137+
assert.ok(actual2.length <= 8)
138+
})
139+
140+
it('truncation context should make context length per item lte 10240 cap', function () {
141+
const chunkA: crossFile.CodeWhispererSupplementalContextItem = {
142+
content: repeatString(`a${newLine}`, 4000),
143+
filePath: 'a.java',
144+
score: 0,
145+
}
146+
const chunkB: crossFile.CodeWhispererSupplementalContextItem = {
147+
content: repeatString(`b${newLine}`, 6000),
148+
filePath: 'b.java',
149+
score: 1,
150+
}
151+
const chunkC: crossFile.CodeWhispererSupplementalContextItem = {
152+
content: repeatString(`c${newLine}`, 1000),
153+
filePath: 'c.java',
154+
score: 2,
155+
}
156+
const chunkD: crossFile.CodeWhispererSupplementalContextItem = {
157+
content: repeatString(`d${newLine}`, 1500),
158+
filePath: 'd.java',
159+
score: 3,
160+
}
161+
162+
assert.ok(
163+
chunkA.content.length + chunkB.content.length + chunkC.content.length + chunkD.content.length > 20480
164+
)
165+
166+
const supplementalContext: CodeWhispererSupplementalContext = {
167+
isUtg: false,
168+
isProcessTimeout: false,
169+
supplementalContextItems: [chunkA, chunkB, chunkC, chunkD],
170+
contentsLength: 25000,
171+
latency: 0,
172+
strategy: 'codemap',
173+
}
174+
175+
const actual = crossFile.truncateSuppelementalContext(supplementalContext)
176+
assert.strictEqual(actual.supplementalContextItems.length, 3)
177+
assert.ok(actual.contentsLength <= 20480)
178+
assert.strictEqual(actual.strategy, 'codemap')
179+
})
180+
181+
it('truncate context should make context items lte 5', function () {
182+
const chunkA: crossFile.CodeWhispererSupplementalContextItem = {
183+
content: 'a',
184+
filePath: 'a.java',
185+
score: 0,
186+
}
187+
const chunkB: crossFile.CodeWhispererSupplementalContextItem = {
188+
content: 'b',
189+
filePath: 'b.java',
190+
score: 1,
191+
}
192+
const chunkC: crossFile.CodeWhispererSupplementalContextItem = {
193+
content: 'c',
194+
filePath: 'c.java',
195+
score: 2,
196+
}
197+
const chunkD: crossFile.CodeWhispererSupplementalContextItem = {
198+
content: 'd',
199+
filePath: 'd.java',
200+
score: 3,
201+
}
202+
const chunkE: crossFile.CodeWhispererSupplementalContextItem = {
203+
content: 'e',
204+
filePath: 'e.java',
205+
score: 4,
206+
}
207+
const chunkF: crossFile.CodeWhispererSupplementalContextItem = {
208+
content: 'f',
209+
filePath: 'f.java',
210+
score: 5,
211+
}
212+
const chunkG: crossFile.CodeWhispererSupplementalContextItem = {
213+
content: 'g',
214+
filePath: 'g.java',
215+
score: 6,
216+
}
217+
const chunks = [chunkA, chunkB, chunkC, chunkD, chunkE, chunkF, chunkG]
218+
219+
assert.strictEqual(chunks.length, 7)
220+
221+
const supplementalContext: CodeWhispererSupplementalContext = {
222+
isUtg: false,
223+
isProcessTimeout: false,
224+
supplementalContextItems: chunks,
225+
contentsLength: 25000,
226+
latency: 0,
227+
strategy: 'codemap',
228+
}
229+
230+
const actual = crossFile.truncateSuppelementalContext(supplementalContext)
231+
assert.strictEqual(actual.supplementalContextItems.length, 5)
232+
})
233+
234+
describe('truncate line by line', function () {
235+
it('should return empty if empty string is provided', function () {
236+
const input = ''
237+
const actual = crossFile.truncateLineByLine(input, 50)
238+
assert.strictEqual(actual, '')
239+
})
240+
241+
it('should return empty if 0 max length is provided', function () {
242+
const input = 'aaaaa'
243+
const actual = crossFile.truncateLineByLine(input, 0)
244+
assert.strictEqual(actual, '')
245+
})
246+
247+
it('should flip the value if negative max length is provided', function () {
248+
const input = `aaaaa${newLine}bbbbb`
249+
const actual = crossFile.truncateLineByLine(input, -6)
250+
const expected = crossFile.truncateLineByLine(input, 6)
251+
assert.strictEqual(actual, expected)
252+
assert.strictEqual(actual, 'aaaaa')
253+
})
254+
})
255+
})
86256
})
257+
258+
function repeatString(s: string, n: number): string {
259+
let output = ''
260+
for (let i = 0; i < n; i++) {
261+
output += s
262+
}
263+
264+
return output
265+
}

packages/core/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@
440440
},
441441
"devDependencies": {
442442
"@aws-sdk/types": "^3.13.1",
443-
"@aws/fully-qualified-names": "^2.1.4",
444443
"@cspotcode/source-map-support": "^0.8.1",
445444
"@sinonjs/fake-timers": "^10.0.2",
446445
"@types/adm-zip": "^0.4.34",
@@ -497,6 +496,7 @@
497496
"@amzn/amazon-q-developer-streaming-client": "file:../../src.gen/@amzn/amazon-q-developer-streaming-client",
498497
"@amzn/codewhisperer-streaming": "file:../../src.gen/@amzn/codewhisperer-streaming",
499498
"@aws-sdk/client-api-gateway": "<3.696.0",
499+
"@aws-sdk/client-cloudcontrol": "<3.696.0",
500500
"@aws-sdk/client-cloudformation": "<3.696.0",
501501
"@aws-sdk/client-cloudwatch-logs": "<3.696.0",
502502
"@aws-sdk/client-codecatalyst": "<3.696.0",
@@ -511,7 +511,6 @@
511511
"@aws-sdk/client-sso": "<3.696.0",
512512
"@aws-sdk/client-sso-oidc": "<3.696.0",
513513
"@aws-sdk/client-apprunner": "<3.696.0",
514-
"@aws-sdk/client-cloudcontrol": "<3.696.0",
515514
"@aws-sdk/credential-provider-env": "<3.696.0",
516515
"@aws-sdk/credential-provider-process": "<3.696.0",
517516
"@aws-sdk/credential-provider-sso": "<3.696.0",

0 commit comments

Comments
 (0)