Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 1 addition & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "Amazon Q Developer: Updated legal disclaimer text"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('HumanInTheLoopManager', async function () {
)
const outputPathResult = path.join(outputDirectoryPath, 'pom.xml')
assertEqualPaths(newPomFilePath.fsPath, outputPathResult)
const newPomFileContents = await fs.readFileAsString(newPomFilePath.path)
const newPomFileContents = await fs.readFileText(newPomFilePath.path)
assert.strictEqual(
stripStringWhitespace(newPomFileContents),
stripStringWhitespace(`<?xml version="1.0" encoding="UTF-8"?>
Expand Down
2 changes: 1 addition & 1 deletion packages/amazonq/test/unit/validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('package validations', function () {
*/
it('has synced contributes.icons with core/package.json', async function () {
const corePackageJson = JSON.parse(
await fs.readFileAsString(path.resolve(__dirname, '../../../../core/package.json'))
await fs.readFileText(path.resolve(__dirname, '../../../../core/package.json'))
)
assert.deepStrictEqual(packageJson.contributes.icons, corePackageJson.contributes.icons)
})
Expand Down
2 changes: 0 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,6 @@
"mime-types": "^2.1.32",
"node-fetch": "^2.7.0",
"portfinder": "^1.0.32",
"proper-lockfile": "^4.1.2",
"ps-list": "^8.1.1",
"semver": "^7.5.4",
"stream-buffers": "^3.0.2",
"strip-ansi": "^5.2.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/core/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@
"AWS.command.apig.copyUrl": "Copy URL",
"AWS.command.apig.invokeRemoteRestApi": "Invoke on AWS",
"AWS.command.apig.invokeRemoteRestApi.cn": "Invoke on Amazon",
"AWS.command.applicationComposer.open": "Open with Application Composer",
"AWS.command.applicationComposer.openDialog": "Open Template with Application Composer...",
"AWS.command.applicationComposer.open": "Open with Infrastructure Composer",
"AWS.command.applicationComposer.openDialog": "Open Template with Infrastructure Composer...",
"AWS.command.auth.addConnection": "Add New Connection",
"AWS.command.auth.showConnectionsPage": "Add New Connection",
"AWS.command.auth.switchConnections": "Switch Connections",
Expand Down Expand Up @@ -227,7 +227,7 @@
"AWS.lambda.explorerTitle": "Explorer",
"AWS.developerTools.explorerTitle": "Developer Tools",
"AWS.codewhisperer.explorerTitle": "CodeWhisperer",
"AWS.appcomposer.explorerTitle": "Application Composer",
"AWS.appcomposer.explorerTitle": "Infrastructure Composer",
"AWS.cdk.explorerTitle": "CDK",
"AWS.codecatalyst.explorerTitle": "CodeCatalyst",
"AWS.cwl.limit.desc": "Maximum amount of log entries pulled per request from CloudWatch Logs (max 10000)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/amazonq/lsp/lspController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class LspController {
}

async getFileSha384(filePath: string): Promise<string> {
const fileBuffer = await fs.readFile(filePath)
const fileBuffer = await fs.readFileBytes(filePath)
const hash = crypto.createHash('sha384')
hash.update(fileBuffer)
return hash.digest('hex')
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/amazonq/webview/ui/tabs/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class TabDataGenerator {
const tabData: MynahUIDataModel = {
tabTitle: taskName ?? TabTypeDataMap[tabType].title,
promptInputInfo:
'Use of Amazon Q is subject to the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).',
'Amazon Q Developer uses generative AI. You may need to verify responses. See the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).',
quickActionCommands: this.quickActionsGenerator.generateForTab(tabType),
promptInputPlaceholder: TabTypeDataMap[tabType].placeholder,
contextCommands: [
Expand Down
28 changes: 16 additions & 12 deletions packages/core/src/amazonqFeatureDev/client/featureDev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ import { createCodeWhispererChatStreamingClient } from '../../shared/clients/cod
import { getClientId, getOptOutPreference, getOperatingSystem } from '../../shared/telemetry/util'
import { extensionVersion } from '../../shared/vscode/env'

// Re-enable once BE is able to handle retries.
const writeAPIRetryOptions = {
maxRetries: 0,
retryDelayOptions: {
// The default number of milliseconds to use in the exponential backoff
base: 500,
},
}

// Create a client for featureDev proxy client based off of aws sdk v2
export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClient> {
export async function createFeatureDevProxyClient(options?: Partial<ServiceOptions>): Promise<FeatureDevProxyClient> {
const bearerToken = await AuthUtil.instance.getBearerToken()
const cwsprConfig = getCodewhispererConfig()
return (await globals.sdkClientBuilder.createAwsService(
Expand All @@ -37,27 +46,22 @@ export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClie
region: cwsprConfig.region,
endpoint: cwsprConfig.endpoint,
token: new Token({ token: bearerToken }),
// SETTING TO 0 FOR BETA. RE-ENABLE FOR RE-INVENT
maxRetries: 0,
retryDelayOptions: {
// The default number of milliseconds to use in the exponential backoff
base: 500,
},
...options,
} as ServiceOptions,
undefined
)) as FeatureDevProxyClient
}

export class FeatureDevClient {
public async getClient() {
public async getClient(options?: Partial<ServiceOptions>) {
// Should not be stored for the whole session.
// Client has to be reinitialized for each request so we always have a fresh bearerToken
return await createFeatureDevProxyClient()
return await createFeatureDevProxyClient(options)
}

public async createConversation() {
try {
const client = await this.getClient()
const client = await this.getClient(writeAPIRetryOptions)
getLogger().debug(`Executing createTaskAssistConversation with {}`)
const { conversationId, $response } = await client.createTaskAssistConversation().promise()
getLogger().debug(`${featureName}: Created conversation: %O`, {
Expand All @@ -82,7 +86,7 @@ export class FeatureDevClient {

public async createUploadUrl(conversationId: string, contentChecksumSha256: string, contentLength: number) {
try {
const client = await this.getClient()
const client = await this.getClient(writeAPIRetryOptions)
const params = {
uploadContext: {
taskAssistPlanningUploadContext: {
Expand Down Expand Up @@ -119,7 +123,7 @@ export class FeatureDevClient {

public async startCodeGeneration(conversationId: string, uploadId: string, message: string) {
try {
const client = await this.getClient()
const client = await this.getClient(writeAPIRetryOptions)
const params = {
conversationState: {
conversationId,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/applicationcomposer/codeLensProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ApplicationComposerCodeLensProvider implements vscode.CodeLensProvi
}
const resourcesLoc = new vscode.Range(codeLensLine, 0, codeLensLine, 0)
const codeLens = openTemplateInComposerCommand.build().asCodeLens(resourcesLoc, {
title: localize('AWS.applicationComposer.codeLens.title', 'Visualize with Application Composer'),
title: localize('AWS.applicationComposer.codeLens.title', 'Visualize with Infrastructure Composer'),
tooltip: localize(
'AWS.applicationComposer.codeLens.tooltip',
'Visually design and build modern applications quickly'
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/applicationcomposer/composerWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ export class ApplicationComposer {
): vscode.WebviewPanel {
const panel = vscode.window.createWebviewPanel(
'applicationComposer',
localize('AWS.applicationComposer.title', '{0} (Application Composer)', path.basename(documentUri.fsPath)),
localize(
'AWS.applicationComposer.title',
'{0} (Infrastructure Composer)',
path.basename(documentUri.fsPath)
),
{
preserveFocus: true,
viewColumn: vscode.ViewColumn.Active,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import { submitFeedback } from '../../feedback/vue/submitFeedback'
import { placeholder } from '../../shared/vscode/commands2'

export function openFeedbackMessageHandler() {
void submitFeedback(placeholder, 'Application Composer')
void submitFeedback(placeholder, 'Infrastructure Composer')
}
2 changes: 1 addition & 1 deletion packages/core/src/applicationcomposer/webviewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class ApplicationComposerManager {
void vscode.window.showInformationMessage(
localize(
'AWS.applicationComposer.visualisation.errors.rendering',
'There was an error rendering Application Composer, check logs for details.'
'There was an error rendering Infrastructure Composer, check logs for details.'
)
)
this.logger.error(`${this.name}: Unable to show App Composer webview: ${err}`)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/auth/credentials/sharedCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ async function loadConfigFile(configUri?: vscode.Uri): Promise<ReturnType<typeof
return []
}

return parseIni(await fs.readFileAsString(configUri), configUri)
return parseIni(await fs.readFileText(configUri), configUri)
}

async function loadCredentialsFile(credentialsUri?: vscode.Uri): Promise<ReturnType<typeof parseIni>> {
if (!credentialsUri || !(await fs.exists(credentialsUri))) {
return []
}

return parseIni(await fs.readFileAsString(credentialsUri), credentialsUri)
return parseIni(await fs.readFileText(credentialsUri), credentialsUri)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/auth/sso/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class AuthSSOServer {

private async loadResource(res: http.ServerResponse, resourcePath: string) {
try {
const file = await fs.readFile(resourcePath)
const file = await fs.readFileBytes(resourcePath)
res.writeHead(200)
res.end(file)
} catch (e) {
Expand Down
Loading