From f4d2c3473bbaff19f9e49b58a6e53b9df683e115 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Fri, 5 Jul 2024 12:24:32 -0400 Subject: [PATCH 01/13] refactor(amazonqFeatureDev): include zip error --- .../src/amazonqFeatureDev/controllers/chat/controller.ts | 4 ++++ packages/core/src/amazonqFeatureDev/errors.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts index ed286e731ed..d9e23fbe891 100644 --- a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts +++ b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts @@ -22,6 +22,7 @@ import { UploadCodeError, UserMessageNotFoundError, WorkspaceFolderNotFoundError, + ZipFileError, createUserFacingErrorMessage, denyListedErrors, } from '../../errors' @@ -274,6 +275,9 @@ export class FeatureDevController { session?.conversationIdUnsafe ) break + case ZipFileError.name: + this.messenger.sendErrorMessage(errorMessage, message.tabID, 0, session?.conversationIdUnsafe, true) + break case CodeIterationLimitError.name: this.messenger.sendAnswer({ type: 'answer', diff --git a/packages/core/src/amazonqFeatureDev/errors.ts b/packages/core/src/amazonqFeatureDev/errors.ts index 2f701efd0b9..782e3b327d8 100644 --- a/packages/core/src/amazonqFeatureDev/errors.ts +++ b/packages/core/src/amazonqFeatureDev/errors.ts @@ -86,6 +86,12 @@ export class ContentLengthError extends ToolkitError { } } +export class ZipFileError extends ToolkitError { + constructor() { + super('The zip file is corrupted', { code: 'ZipFileError' }) + } +} + export class PlanIterationLimitError extends ToolkitError { constructor() { super( From 6955ba10cf502656f4b53dfb82ee9c7633c06e79 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Fri, 5 Jul 2024 15:37:08 -0400 Subject: [PATCH 02/13] refactor(amazonqFeatureDev): add enum for status --- .../amazonqFeatureDev/session/sessionState.ts | 37 ++++++------------- packages/core/src/amazonqFeatureDev/types.ts | 9 +++++ 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index c4944ad3697..6a59d7f1c23 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -15,6 +15,7 @@ import { VirtualMemoryFile } from '../../shared/virtualMemoryFile' import { featureDevScheme } from '../constants' import { IllegalStateTransition, UserMessageNotFoundError } from '../errors' import { + CodeGenerationStatus, CurrentWsFolders, DeletedFileInfo, DevPhase, @@ -41,10 +42,7 @@ export class ConversationNotStartedState implements Omit { public tokenSource: vscode.CancellationTokenSource public readonly phase = DevPhase.APPROACH - constructor( - private config: Omit, - public approach: string, - public tabID: string - ) { + constructor(private config: Omit, public approach: string, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() } @@ -231,10 +225,7 @@ abstract class CodeGenBase { public readonly conversationId: string public readonly uploadId: string - constructor( - protected config: SessionStateConfig, - public tabID: string - ) { + constructor(protected config: SessionStateConfig, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() this.conversationId = config.conversationId this.uploadId = config.uploadId @@ -263,8 +254,8 @@ abstract class CodeGenBase { const codegenResult = await this.config.proxyClient.getCodeGeneration(this.conversationId, codeGenerationId) getLogger().debug(`Codegen response: %O`, codegenResult) telemetry.setCodeGenerationResult(codegenResult.codeGenerationStatus.status) - switch (codegenResult.codeGenerationStatus.status) { - case 'Complete': { + switch (codegenResult.codeGenerationStatus.status as CodeGenerationStatus) { + case CodeGenerationStatus.COMPLETE: { const { newFileContents, deletedFiles, references } = await this.config.proxyClient.exportResultArchive(this.conversationId) const newFileInfo = registerNewFiles(fs, newFileContents, this.uploadId, workspaceFolders) @@ -275,14 +266,14 @@ abstract class CodeGenBase { references, } } - case 'predict-ready': - case 'InProgress': { + case CodeGenerationStatus.PREDICT_READY: + case CodeGenerationStatus.IN_PROGRESS: { await new Promise(f => globals.clock.setTimeout(f, this.requestDelay)) break } - case 'predict-failed': - case 'debate-failed': - case 'Failed': { + case CodeGenerationStatus.PREDICT_FAILED: + case CodeGenerationStatus.DEBATE_FAILED: + case CodeGenerationStatus.FAILED: { /** * * TODO: Here we need to implement the granular error handling for @@ -389,11 +380,7 @@ export class MockCodeGenState implements SessionState { public readonly conversationId: string public readonly uploadId: string - constructor( - private config: SessionStateConfig, - public approach: string, - public tabID: string - ) { + constructor(private config: SessionStateConfig, public approach: string, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() this.filePaths = [] this.deletedFiles = [] diff --git a/packages/core/src/amazonqFeatureDev/types.ts b/packages/core/src/amazonqFeatureDev/types.ts index 76baa044702..a4951f74122 100644 --- a/packages/core/src/amazonqFeatureDev/types.ts +++ b/packages/core/src/amazonqFeatureDev/types.ts @@ -30,6 +30,15 @@ export enum DevPhase { CODEGEN = 'Codegen', } +export enum CodeGenerationStatus { + COMPLETE = 'Complete', + PREDICT_READY = 'predict-ready', + IN_PROGRESS = 'InProgress', + PREDICT_FAILED = 'predict-failed', + DEBATE_FAILED = 'debate-failed', + FAILED = 'Failed', +} + export enum FollowUpTypes { GenerateCode = 'GenerateCode', InsertCode = 'InsertCode', From 3ce06ac70a34fd7d593d62602d60b26725c3fcc2 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Tue, 9 Jul 2024 10:30:38 -0400 Subject: [PATCH 03/13] refactor(amazonqFeatureDev): include Guardrails exceptions in codegen handling --- .../codewhispererruntime-2022-11-11.json | 2141 +++++++---------- .../controllers/chat/controller.ts | 9 +- packages/core/src/amazonqFeatureDev/errors.ts | 38 + .../amazonqFeatureDev/session/sessionState.ts | 36 +- 4 files changed, 990 insertions(+), 1234 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json b/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json index 6f1a1fc2671..c8690b720ee 100644 --- a/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json +++ b/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json @@ -2,9 +2,11 @@ "version": "2.0", "metadata": { "apiVersion": "2022-11-11", + "auth": ["smithy.api#httpBearerAuth"], "endpointPrefix": "amazoncodewhispererservice", "jsonVersion": "1.0", "protocol": "json", + "protocols": ["json"], "serviceFullName": "Amazon CodeWhisperer", "serviceId": "CodeWhispererRuntime", "signatureVersion": "bearer", @@ -19,27 +21,14 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "CreateUploadUrlRequest" - }, - "output": { - "shape": "CreateUploadUrlResponse" - }, + "input": { "shape": "CreateUploadUrlRequest" }, + "output": { "shape": "CreateUploadUrlResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } + { "shape": "ThrottlingException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } ], - "documentation": "

Creates a pre-signed, S3 write URL for uploading a repository zip archive.

", "idempotent": true }, "CreateTaskAssistConversation": { @@ -48,27 +37,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "CreateTaskAssistConversationRequest" - }, - "output": { - "shape": "CreateTaskAssistConversationResponse" - }, + "input": { "shape": "CreateTaskAssistConversationRequest" }, + "output": { "shape": "CreateTaskAssistConversationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to create task assist conversation.

" + { "shape": "ThrottlingException" }, + { "shape": "ServiceQuotaExceededException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "CreateUploadUrl": { "name": "CreateUploadUrl", @@ -76,33 +53,17 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "CreateUploadUrlRequest" - }, - "output": { - "shape": "CreateUploadUrlResponse" - }, + "input": { "shape": "CreateUploadUrlRequest" }, + "output": { "shape": "CreateUploadUrlResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ConflictException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } + { "shape": "ThrottlingException" }, + { "shape": "ConflictException" }, + { "shape": "ServiceQuotaExceededException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } ], - "documentation": "

Creates a pre-signed, S3 write URL for uploading a repository zip archive.

", "idempotent": true }, "DeleteTaskAssistConversation": { @@ -111,30 +72,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "DeleteTaskAssistConversationRequest" - }, - "output": { - "shape": "DeleteTaskAssistConversationResponse" - }, + "input": { "shape": "DeleteTaskAssistConversationRequest" }, + "output": { "shape": "DeleteTaskAssistConversationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to delete task assist conversation.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "GenerateCompletions": { "name": "GenerateCompletions", @@ -142,27 +88,14 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "GenerateCompletionsRequest" - }, - "output": { - "shape": "GenerateCompletionsResponse" - }, + "input": { "shape": "GenerateCompletionsRequest" }, + "output": { "shape": "GenerateCompletionsResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

Generate completions based on the provided file context in a paginated response.

" + { "shape": "ThrottlingException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "GetCodeAnalysis": { "name": "GetCodeAnalysis", @@ -170,30 +103,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "GetCodeAnalysisRequest" - }, - "output": { - "shape": "GetCodeAnalysisResponse" - }, + "input": { "shape": "GetCodeAnalysisRequest" }, + "output": { "shape": "GetCodeAnalysisResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

Gets the metadata of a code analysis job.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "GetTaskAssistCodeGeneration": { "name": "GetTaskAssistCodeGeneration", @@ -201,33 +119,16 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "GetTaskAssistCodeGenerationRequest" - }, - "output": { - "shape": "GetTaskAssistCodeGenerationResponse" - }, + "input": { "shape": "GetTaskAssistCodeGenerationRequest" }, + "output": { "shape": "GetTaskAssistCodeGenerationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ConflictException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to get status of task assist code generation.

" + { "shape": "ThrottlingException" }, + { "shape": "ConflictException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "GetTransformation": { "name": "GetTransformation", @@ -235,27 +136,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "GetTransformationRequest" - }, - "output": { - "shape": "GetTransformationResponse" - }, + "input": { "shape": "GetTransformationRequest" }, + "output": { "shape": "GetTransformationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to get code transformation status.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "GetTransformationPlan": { "name": "GetTransformationPlan", @@ -263,27 +152,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "GetTransformationPlanRequest" - }, - "output": { - "shape": "GetTransformationPlanResponse" - }, + "input": { "shape": "GetTransformationPlanRequest" }, + "output": { "shape": "GetTransformationPlanResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to get code transformation status.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "ListAvailableCustomizations": { "name": "ListAvailableCustomizations", @@ -291,25 +168,13 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "ListAvailableCustomizationsRequest" - }, - "output": { - "shape": "ListAvailableCustomizationsResponse" - }, + "input": { "shape": "ListAvailableCustomizationsRequest" }, + "output": { "shape": "ListAvailableCustomizationsResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } + { "shape": "ThrottlingException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } ] }, "ListCodeAnalysisFindings": { @@ -318,30 +183,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "ListCodeAnalysisFindingsRequest" - }, - "output": { - "shape": "ListCodeAnalysisFindingsResponse" - }, + "input": { "shape": "ListCodeAnalysisFindingsRequest" }, + "output": { "shape": "ListCodeAnalysisFindingsResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

Lists the findings from a particular code analysis job.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "ListFeatureEvaluations": { "name": "ListFeatureEvaluations", @@ -349,27 +199,30 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "ListFeatureEvaluationsRequest" - }, - "output": { - "shape": "ListFeatureEvaluationsResponse" + "input": { "shape": "ListFeatureEvaluationsRequest" }, + "output": { "shape": "ListFeatureEvaluationsResponse" }, + "errors": [ + { "shape": "ThrottlingException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] + }, + "ResumeTransformation": { + "name": "ResumeTransformation", + "http": { + "method": "POST", + "requestUri": "/" }, + "input": { "shape": "ResumeTransformationRequest" }, + "output": { "shape": "ResumeTransformationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

Return configruations for each feature that has been setup for A/B testing.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "SendTelemetryEvent": { "name": "SendTelemetryEvent", @@ -377,27 +230,14 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "SendTelemetryEventRequest" - }, - "output": { - "shape": "SendTelemetryEventResponse" - }, + "input": { "shape": "SendTelemetryEventRequest" }, + "output": { "shape": "SendTelemetryEventResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } + { "shape": "ThrottlingException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } ], - "documentation": "

API to record telemetry events.

", "idempotent": true }, "StartCodeAnalysis": { @@ -406,33 +246,16 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "StartCodeAnalysisRequest" - }, - "output": { - "shape": "StartCodeAnalysisResponse" - }, + "input": { "shape": "StartCodeAnalysisRequest" }, + "output": { "shape": "StartCodeAnalysisResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ConflictException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } + { "shape": "ThrottlingException" }, + { "shape": "ConflictException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } ], - "documentation": "

Starts a code analysis job

", "idempotent": true }, "StartTaskAssistCodeGeneration": { @@ -441,33 +264,17 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "StartTaskAssistCodeGenerationRequest" - }, - "output": { - "shape": "StartTaskAssistCodeGenerationResponse" - }, + "input": { "shape": "StartTaskAssistCodeGenerationRequest" }, + "output": { "shape": "StartTaskAssistCodeGenerationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "ConflictException" - }, - { - "shape": "ResourceNotFoundException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to start task assist code generation.

" + { "shape": "ThrottlingException" }, + { "shape": "ConflictException" }, + { "shape": "ServiceQuotaExceededException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "StartTransformation": { "name": "StartTransformation", @@ -475,27 +282,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "StartTransformationRequest" - }, - "output": { - "shape": "StartTransformationResponse" - }, + "input": { "shape": "StartTransformationRequest" }, + "output": { "shape": "StartTransformationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to start code translation.

" + { "shape": "ThrottlingException" }, + { "shape": "ConflictException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] }, "StopTransformation": { "name": "StopTransformation", @@ -503,27 +298,15 @@ "method": "POST", "requestUri": "/" }, - "input": { - "shape": "StopTransformationRequest" - }, - "output": { - "shape": "StopTransformationResponse" - }, + "input": { "shape": "StopTransformationRequest" }, + "output": { "shape": "StopTransformationResponse" }, "errors": [ - { - "shape": "ThrottlingException" - }, - { - "shape": "InternalServerException" - }, - { - "shape": "ValidationException" - }, - { - "shape": "AccessDeniedException" - } - ], - "documentation": "

API to stop code transformation status.

" + { "shape": "ThrottlingException" }, + { "shape": "ResourceNotFoundException" }, + { "shape": "InternalServerException" }, + { "shape": "ValidationException" }, + { "shape": "AccessDeniedException" } + ] } }, "shapes": { @@ -531,21 +314,59 @@ "type": "structure", "required": ["message"], "members": { - "message": { - "shape": "String" - } + "message": { "shape": "String" }, + "reason": { "shape": "AccessDeniedExceptionReason" } }, - "documentation": "

This exception is thrown when the user does not have sufficient access to perform this action.

", "exception": true }, + "AccessDeniedExceptionReason": { + "type": "string", + "enum": ["UNAUTHORIZED_CUSTOMIZATION_RESOURCE_ACCESS"] + }, + "AppStudioState": { + "type": "structure", + "required": ["namespace", "propertyName", "propertyContext"], + "members": { + "namespace": { "shape": "AppStudioStateNamespaceString" }, + "propertyName": { "shape": "AppStudioStatePropertyNameString" }, + "propertyValue": { "shape": "AppStudioStatePropertyValueString" }, + "propertyContext": { "shape": "AppStudioStatePropertyContextString" } + } + }, + "AppStudioStateNamespaceString": { + "type": "string", + "max": 1024, + "min": 1, + "sensitive": true + }, + "AppStudioStatePropertyContextString": { + "type": "string", + "max": 1024, + "min": 1, + "sensitive": true + }, + "AppStudioStatePropertyNameString": { + "type": "string", + "max": 1024, + "min": 1, + "sensitive": true + }, + "AppStudioStatePropertyValueString": { + "type": "string", + "max": 1024, + "min": 1, + "sensitive": true + }, + "ArtifactId": { + "type": "string", + "max": 126, + "min": 1, + "pattern": "[a-zA-Z0-9-_]+" + }, "ArtifactMap": { "type": "map", - "key": { - "shape": "ArtifactType" - }, - "value": { - "shape": "UploadId" - }, + "key": { "shape": "ArtifactType" }, + "value": { "shape": "UploadId" }, "max": 64, "min": 1 }, @@ -557,28 +378,12 @@ "type": "structure", "required": ["content"], "members": { - "messageId": { - "shape": "AssistantResponseMessageMessageIdString", - "documentation": "

Unique identifier for the chat message

" - }, - "content": { - "shape": "AssistantResponseMessageContentString", - "documentation": "

The content of the text message in markdown format.

" - }, - "supplementaryWebLinks": { - "shape": "SupplementaryWebLinks", - "documentation": "

Web References

" - }, - "references": { - "shape": "References", - "documentation": "

Code References

" - }, - "followupPrompt": { - "shape": "FollowupPrompt", - "documentation": "

Followup Prompt

" - } - }, - "documentation": "

Markdown text message.

" + "messageId": { "shape": "MessageId" }, + "content": { "shape": "AssistantResponseMessageContentString" }, + "supplementaryWebLinks": { "shape": "SupplementaryWebLinks" }, + "references": { "shape": "References" }, + "followupPrompt": { "shape": "FollowupPrompt" } + } }, "AssistantResponseMessageContentString": { "type": "string", @@ -586,11 +391,6 @@ "min": 0, "sensitive": true }, - "AssistantResponseMessageMessageIdString": { - "type": "string", - "max": 128, - "min": 0 - }, "Base64EncodedPaginationToken": { "type": "string", "max": 2048, @@ -601,64 +401,123 @@ "type": "boolean", "box": true }, + "ChatAddMessageEvent": { + "type": "structure", + "required": ["conversationId", "messageId"], + "members": { + "conversationId": { "shape": "ConversationId" }, + "messageId": { "shape": "MessageId" }, + "customizationArn": { "shape": "CustomizationArn" }, + "userIntent": { "shape": "UserIntent" }, + "hasCodeSnippet": { "shape": "Boolean" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "activeEditorTotalCharacters": { "shape": "Integer" }, + "timeToFirstChunkMilliseconds": { "shape": "Double" }, + "timeBetweenChunks": { "shape": "timeBetweenChunks" }, + "fullResponselatency": { "shape": "Double" }, + "requestLength": { "shape": "Integer" }, + "responseLength": { "shape": "Integer" }, + "numberOfCodeBlocks": { "shape": "Integer" }, + "hasProjectLevelContext": { "shape": "Boolean" } + } + }, "ChatHistory": { "type": "list", - "member": { - "shape": "ChatMessage" - }, - "documentation": "

Indicates Participant in Chat conversation

", + "member": { "shape": "ChatMessage" }, "max": 10, "min": 0 }, + "ChatInteractWithMessageEvent": { + "type": "structure", + "required": ["conversationId", "messageId"], + "members": { + "conversationId": { "shape": "ConversationId" }, + "messageId": { "shape": "MessageId" }, + "customizationArn": { "shape": "CustomizationArn" }, + "interactionType": { "shape": "ChatMessageInteractionType" }, + "interactionTarget": { "shape": "ChatInteractWithMessageEventInteractionTargetString" }, + "acceptedCharacterCount": { "shape": "Integer" }, + "acceptedLineCount": { "shape": "Integer" }, + "acceptedSnippetHasReference": { "shape": "Boolean" }, + "hasProjectLevelContext": { "shape": "Boolean" } + } + }, + "ChatInteractWithMessageEventInteractionTargetString": { + "type": "string", + "max": 1024, + "min": 1 + }, "ChatMessage": { "type": "structure", "members": { - "userInputMessage": { - "shape": "UserInputMessage" - }, - "assistantResponseMessage": { - "shape": "AssistantResponseMessage" - } + "userInputMessage": { "shape": "UserInputMessage" }, + "assistantResponseMessage": { "shape": "AssistantResponseMessage" } }, "union": true }, + "ChatMessageInteractionType": { + "type": "string", + "enum": [ + "INSERT_AT_CURSOR", + "COPY_SNIPPET", + "COPY", + "CLICK_LINK", + "CLICK_BODY_LINK", + "CLICK_FOLLOW_UP", + "HOVER_REFERENCE", + "UPVOTE", + "DOWNVOTE" + ] + }, "ChatTriggerType": { "type": "string", - "documentation": "

Trigger Reason for Chat

", "enum": ["MANUAL", "DIAGNOSTIC"] }, + "ChatUserModificationEvent": { + "type": "structure", + "required": ["conversationId", "messageId", "modificationPercentage"], + "members": { + "conversationId": { "shape": "ConversationId" }, + "customizationArn": { "shape": "CustomizationArn" }, + "messageId": { "shape": "MessageId" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "modificationPercentage": { "shape": "Double" }, + "hasProjectLevelContext": { "shape": "Boolean" } + } + }, "CodeAnalysisFindingsSchema": { "type": "string", "enum": ["codeanalysis/findings/1.0"] }, + "CodeAnalysisScope": { + "type": "string", + "enum": ["FILE", "PROJECT"] + }, "CodeAnalysisStatus": { "type": "string", "enum": ["Completed", "Pending", "Failed"] }, + "CodeAnalysisUploadContext": { + "type": "structure", + "required": ["codeScanName"], + "members": { + "codeScanName": { "shape": "CodeScanName" } + } + }, "CodeCoverageEvent": { "type": "structure", "required": ["programmingLanguage", "acceptedCharacterCount", "totalCharacterCount", "timestamp"], "members": { - "customizationArn": { - "shape": "CustomizationArn" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage" - }, - "acceptedCharacterCount": { - "shape": "PrimitiveInteger" - }, - "totalCharacterCount": { - "shape": "PrimitiveInteger" - }, - "timestamp": { - "shape": "Timestamp" - } + "customizationArn": { "shape": "CustomizationArn" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "acceptedCharacterCount": { "shape": "PrimitiveInteger" }, + "totalCharacterCount": { "shape": "PrimitiveInteger" }, + "timestamp": { "shape": "Timestamp" }, + "unmodifiedAcceptedCharacterCount": { "shape": "PrimitiveInteger" } } }, "CodeGenerationId": { "type": "string", - "documentation": "

ID which represents a single code generation in a conversation

", "max": 128, "min": 1 }, @@ -666,14 +525,14 @@ "type": "structure", "required": ["status", "currentStage"], "members": { - "status": { - "shape": "CodeGenerationWorkflowStatus" - }, - "currentStage": { - "shape": "CodeGenerationWorkflowStage" - } + "status": { "shape": "CodeGenerationWorkflowStatus" }, + "currentStage": { "shape": "CodeGenerationWorkflowStage" } } }, + "CodeGenerationStatusDetail": { + "type": "string", + "sensitive": true + }, "CodeGenerationWorkflowStage": { "type": "string", "enum": ["InitialCodeGeneration", "CodeRefinement"] @@ -686,15 +545,10 @@ "type": "structure", "required": ["programmingLanguage", "codeScanJobId", "timestamp"], "members": { - "programmingLanguage": { - "shape": "ProgrammingLanguage" - }, - "codeScanJobId": { - "shape": "CodeScanJobId" - }, - "timestamp": { - "shape": "Timestamp" - } + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "codeScanJobId": { "shape": "CodeScanJobId" }, + "timestamp": { "shape": "Timestamp" }, + "codeAnalysisScope": { "shape": "CodeAnalysisScope" } } }, "CodeScanJobId": { @@ -702,19 +556,37 @@ "max": 128, "min": 1 }, + "CodeScanName": { + "type": "string", + "max": 128, + "min": 1 + }, + "CodeScanRemediationsEvent": { + "type": "structure", + "members": { + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "CodeScanRemediationsEventType": { "shape": "CodeScanRemediationsEventType" }, + "timestamp": { "shape": "Timestamp" }, + "detectorId": { "shape": "String" }, + "findingId": { "shape": "String" }, + "ruleId": { "shape": "String" }, + "component": { "shape": "String" }, + "reason": { "shape": "String" }, + "result": { "shape": "String" }, + "includesFix": { "shape": "Boolean" } + } + }, + "CodeScanRemediationsEventType": { + "type": "string", + "enum": ["CODESCAN_ISSUE_HOVER", "CODESCAN_ISSUE_APPLY_FIX", "CODESCAN_ISSUE_VIEW_DETAILS"] + }, "Completion": { "type": "structure", "required": ["content"], "members": { - "content": { - "shape": "CompletionContentString" - }, - "references": { - "shape": "References" - }, - "mostRelevantMissingImports": { - "shape": "Imports" - } + "content": { "shape": "CompletionContentString" }, + "references": { "shape": "References" }, + "mostRelevantMissingImports": { "shape": "Imports" } } }, "CompletionContentString": { @@ -729,9 +601,7 @@ }, "Completions": { "type": "list", - "member": { - "shape": "Completion" - }, + "member": { "shape": "Completion" }, "max": 10, "min": 0 }, @@ -739,11 +609,8 @@ "type": "structure", "required": ["message"], "members": { - "message": { - "shape": "String" - } + "message": { "shape": "String" } }, - "documentation": "

This exception is thrown when the action to perform could not be completed because the resource is in a conflicting state.

", "exception": true }, "ContentChecksumType": { @@ -752,12 +619,10 @@ }, "ContextTruncationScheme": { "type": "string", - "documentation": "

Workspace context truncation schemes based on usecase

", "enum": ["ANALYSIS", "GUMBY"] }, "ConversationId": { "type": "string", - "documentation": "

ID which represents a multi-turn conversation

", "max": 128, "min": 1 }, @@ -765,64 +630,34 @@ "type": "structure", "required": ["currentMessage", "chatTriggerType"], "members": { - "conversationId": { - "shape": "ConversationId", - "documentation": "

Unique identifier for the chat conversation stream

" - }, - "history": { - "shape": "ChatHistory", - "documentation": "

Holds the history of chat messages.

" - }, - "currentMessage": { - "shape": "ChatMessage", - "documentation": "

Holds the current message being processed or displayed.

" - }, - "chatTriggerType": { - "shape": "ChatTriggerType", - "documentation": "

Trigger Reason for Chat

" - } - }, - "documentation": "

Structure to represent the current state of a chat conversation.

" + "conversationId": { "shape": "ConversationId" }, + "history": { "shape": "ChatHistory" }, + "currentMessage": { "shape": "ChatMessage" }, + "chatTriggerType": { "shape": "ChatTriggerType" }, + "customizationArn": { "shape": "ResourceArn" } + } }, "CreateTaskAssistConversationRequest": { "type": "structure", - "members": {}, - "documentation": "

Structure to represent bootstrap conversation request.

" + "members": {} }, "CreateTaskAssistConversationResponse": { "type": "structure", "required": ["conversationId"], "members": { - "conversationId": { - "shape": "ConversationId" - } - }, - "documentation": "

Structure to represent bootstrap conversation response.

" + "conversationId": { "shape": "ConversationId" } + } }, "CreateUploadUrlRequest": { "type": "structure", "members": { - "contentMd5": { - "shape": "CreateUploadUrlRequestContentMd5String" - }, - "contentChecksum": { - "shape": "CreateUploadUrlRequestContentChecksumString" - }, - "contentChecksumType": { - "shape": "ContentChecksumType" - }, - "contentLength": { - "shape": "CreateUploadUrlRequestContentLengthLong" - }, - "artifactType": { - "shape": "ArtifactType" - }, - "uploadIntent": { - "shape": "UploadIntent" - }, - "uploadContext": { - "shape": "UploadContext" - } + "contentMd5": { "shape": "CreateUploadUrlRequestContentMd5String" }, + "contentChecksum": { "shape": "CreateUploadUrlRequestContentChecksumString" }, + "contentChecksumType": { "shape": "ContentChecksumType" }, + "contentLength": { "shape": "CreateUploadUrlRequestContentLengthLong" }, + "artifactType": { "shape": "ArtifactType" }, + "uploadIntent": { "shape": "UploadIntent" }, + "uploadContext": { "shape": "UploadContext" } } }, "CreateUploadUrlRequestContentChecksumString": { @@ -846,52 +681,34 @@ "type": "structure", "required": ["uploadId", "uploadUrl"], "members": { - "uploadId": { - "shape": "UploadId" - }, - "uploadUrl": { - "shape": "PreSignedUrl" - }, - "kmsKeyArn": { - "shape": "ResourceArn" - } + "uploadId": { "shape": "UploadId" }, + "uploadUrl": { "shape": "PreSignedUrl" }, + "kmsKeyArn": { "shape": "ResourceArn" }, + "requestHeaders": { "shape": "RequestHeaders" } } }, "CursorState": { "type": "structure", "members": { - "position": { - "shape": "Position", - "documentation": "

Represents a cursor position in a Text Document

" - }, - "range": { - "shape": "Range", - "documentation": "

Represents a text selection in a Text Document

" - } + "position": { "shape": "Position" }, + "range": { "shape": "Range" } }, - "documentation": "

Represents the state of the Cursor in an Editor

", "union": true }, "Customization": { "type": "structure", "required": ["arn"], "members": { - "arn": { - "shape": "CustomizationArn" - }, - "name": { - "shape": "CustomizationName" - }, - "description": { - "shape": "Description" - } + "arn": { "shape": "CustomizationArn" }, + "name": { "shape": "CustomizationName" }, + "description": { "shape": "Description" } } }, "CustomizationArn": { "type": "string", "max": 950, "min": 0, - "pattern": "$|^arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}" + "pattern": "arn:[-.a-z0-9]{1,63}:codewhisperer:([-.a-z0-9]{0,63}:){2}([a-zA-Z0-9-_:/]){1,1023}" }, "CustomizationName": { "type": "string", @@ -901,29 +718,21 @@ }, "Customizations": { "type": "list", - "member": { - "shape": "Customization" - } + "member": { "shape": "Customization" } }, "DeleteTaskAssistConversationRequest": { "type": "structure", "required": ["conversationId"], "members": { - "conversationId": { - "shape": "ConversationId" - } - }, - "documentation": "

Structure to represent bootstrap conversation request.

" + "conversationId": { "shape": "ConversationId" } + } }, "DeleteTaskAssistConversationResponse": { "type": "structure", "required": ["conversationId"], "members": { - "conversationId": { - "shape": "ConversationId" - } - }, - "documentation": "

Structure to represent bootstrap conversation response.

" + "conversationId": { "shape": "ConversationId" } + } }, "Description": { "type": "string", @@ -934,39 +743,25 @@ "Diagnostic": { "type": "structure", "members": { - "textDocumentDiagnostic": { - "shape": "TextDocumentDiagnostic", - "documentation": "

Diagnostics originating from a TextDocument

" - }, - "runtimeDiagnostic": { - "shape": "RuntimeDiagnostic", - "documentation": "

Diagnostics originating from a Runtime

" - } + "textDocumentDiagnostic": { "shape": "TextDocumentDiagnostic" }, + "runtimeDiagnostic": { "shape": "RuntimeDiagnostic" } }, - "documentation": "

Represents a Diagnostic message

", "union": true }, "DiagnosticSeverity": { "type": "string", - "documentation": "

Diagnostic Error types

", "enum": ["ERROR", "WARNING", "INFORMATION", "HINT"] }, "Dimension": { "type": "structure", "members": { - "name": { - "shape": "DimensionNameString" - }, - "value": { - "shape": "DimensionValueString" - } + "name": { "shape": "DimensionNameString" }, + "value": { "shape": "DimensionValueString" } } }, "DimensionList": { "type": "list", - "member": { - "shape": "Dimension" - }, + "member": { "shape": "Dimension" }, "max": 30, "min": 0 }, @@ -986,18 +781,9 @@ "type": "structure", "required": ["name", "type"], "members": { - "name": { - "shape": "DocumentSymbolNameString", - "documentation": "

Name of the Document Symbol

" - }, - "type": { - "shape": "SymbolType", - "documentation": "

Symbol type - DECLARATION / USAGE

" - }, - "source": { - "shape": "DocumentSymbolSourceString", - "documentation": "

Symbol package / source for FullyQualified names

" - } + "name": { "shape": "DocumentSymbolNameString" }, + "type": { "shape": "SymbolType" }, + "source": { "shape": "DocumentSymbolSourceString" } } }, "DocumentSymbolNameString": { @@ -1012,9 +798,7 @@ }, "DocumentSymbols": { "type": "list", - "member": { - "shape": "DocumentSymbol" - }, + "member": { "shape": "DocumentSymbol" }, "max": 1000, "min": 0 }, @@ -1025,46 +809,75 @@ "EditorState": { "type": "structure", "members": { - "document": { - "shape": "TextDocument", - "documentation": "

Represents currently edited file

" - }, - "cursorState": { - "shape": "CursorState", - "documentation": "

Position of the cursor

" - } - }, - "documentation": "

Represents the state of an Editor

" + "document": { "shape": "TextDocument" }, + "cursorState": { "shape": "CursorState" }, + "relevantDocuments": { "shape": "RelevantDocumentList" } + } + }, + "EnvState": { + "type": "structure", + "members": { + "operatingSystem": { "shape": "EnvStateOperatingSystemString" }, + "currentWorkingDirectory": { "shape": "EnvStateCurrentWorkingDirectoryString" }, + "environmentVariables": { "shape": "EnvironmentVariables" } + } + }, + "EnvStateCurrentWorkingDirectoryString": { + "type": "string", + "max": 256, + "min": 1, + "sensitive": true + }, + "EnvStateOperatingSystemString": { + "type": "string", + "max": 32, + "min": 1, + "pattern": "(macos|linux|windows)" + }, + "EnvironmentVariable": { + "type": "structure", + "members": { + "key": { "shape": "EnvironmentVariableKeyString" }, + "value": { "shape": "EnvironmentVariableValueString" } + } + }, + "EnvironmentVariableKeyString": { + "type": "string", + "max": 256, + "min": 1, + "sensitive": true + }, + "EnvironmentVariableValueString": { + "type": "string", + "max": 1024, + "min": 1, + "sensitive": true + }, + "EnvironmentVariables": { + "type": "list", + "member": { "shape": "EnvironmentVariable" }, + "max": 100, + "min": 0 }, "FeatureDevEvent": { "type": "structure", "required": ["conversationId"], "members": { - "conversationId": { - "shape": "ConversationId" - } + "conversationId": { "shape": "ConversationId" } } }, "FeatureEvaluation": { "type": "structure", "required": ["feature", "variation", "value"], "members": { - "feature": { - "shape": "FeatureName" - }, - "variation": { - "shape": "FeatureVariation" - }, - "value": { - "shape": "FeatureValue" - } + "feature": { "shape": "FeatureName" }, + "variation": { "shape": "FeatureVariation" }, + "value": { "shape": "FeatureValue" } } }, "FeatureEvaluationsList": { "type": "list", - "member": { - "shape": "FeatureEvaluation" - }, + "member": { "shape": "FeatureEvaluation" }, "max": 50, "min": 0 }, @@ -1077,18 +890,10 @@ "FeatureValue": { "type": "structure", "members": { - "boolValue": { - "shape": "Boolean" - }, - "doubleValue": { - "shape": "Double" - }, - "longValue": { - "shape": "Long" - }, - "stringValue": { - "shape": "FeatureValueStringType" - } + "boolValue": { "shape": "Boolean" }, + "doubleValue": { "shape": "Double" }, + "longValue": { "shape": "Long" }, + "stringValue": { "shape": "FeatureValueStringType" } }, "union": true }, @@ -1107,18 +912,10 @@ "type": "structure", "required": ["leftFileContent", "rightFileContent", "filename", "programmingLanguage"], "members": { - "leftFileContent": { - "shape": "FileContextLeftFileContentString" - }, - "rightFileContent": { - "shape": "FileContextRightFileContentString" - }, - "filename": { - "shape": "FileContextFilenameString" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage" - } + "leftFileContent": { "shape": "FileContextLeftFileContentString" }, + "rightFileContent": { "shape": "FileContextRightFileContentString" }, + "filename": { "shape": "FileContextFilenameString" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" } } }, "FileContextFilenameString": { @@ -1143,16 +940,9 @@ "type": "structure", "required": ["content"], "members": { - "content": { - "shape": "FollowupPromptContentString", - "documentation": "

The content of the text message in markdown format.

" - }, - "userIntent": { - "shape": "UserIntent", - "documentation": "

User Intent

" - } - }, - "documentation": "

Followup Prompt for the Assistant Response

" + "content": { "shape": "FollowupPromptContentString" }, + "userIntent": { "shape": "UserIntent" } + } }, "FollowupPromptContentString": { "type": "string", @@ -1164,30 +954,15 @@ "type": "structure", "required": ["fileContext"], "members": { - "fileContext": { - "shape": "FileContext" - }, - "maxResults": { - "shape": "GenerateCompletionsRequestMaxResultsInteger" - }, - "nextToken": { - "shape": "GenerateCompletionsRequestNextTokenString" - }, - "referenceTrackerConfiguration": { - "shape": "ReferenceTrackerConfiguration" - }, - "supplementalContexts": { - "shape": "SupplementalContextList" - }, - "customizationArn": { - "shape": "CustomizationArn" - }, - "optOutPreference": { - "shape": "OptOutPreference" - }, - "userContext": { - "shape": "UserContext" - } + "fileContext": { "shape": "FileContext" }, + "maxResults": { "shape": "GenerateCompletionsRequestMaxResultsInteger" }, + "nextToken": { "shape": "GenerateCompletionsRequestNextTokenString" }, + "referenceTrackerConfiguration": { "shape": "ReferenceTrackerConfiguration" }, + "supplementalContexts": { "shape": "SupplementalContextList" }, + "customizationArn": { "shape": "CustomizationArn" }, + "optOutPreference": { "shape": "OptOutPreference" }, + "userContext": { "shape": "UserContext" }, + "profileArn": { "shape": "ProfileArn" } } }, "GenerateCompletionsRequestMaxResultsInteger": { @@ -1206,21 +981,15 @@ "GenerateCompletionsResponse": { "type": "structure", "members": { - "completions": { - "shape": "Completions" - }, - "nextToken": { - "shape": "SensitiveString" - } + "completions": { "shape": "Completions" }, + "nextToken": { "shape": "SensitiveString" } } }, "GetCodeAnalysisRequest": { "type": "structure", "required": ["jobId"], "members": { - "jobId": { - "shape": "GetCodeAnalysisRequestJobIdString" - } + "jobId": { "shape": "GetCodeAnalysisRequestJobIdString" } } }, "GetCodeAnalysisRequestJobIdString": { @@ -1232,83 +1001,72 @@ "type": "structure", "required": ["status"], "members": { - "status": { - "shape": "CodeAnalysisStatus" - }, - "errorMessage": { - "shape": "SensitiveString" - } + "status": { "shape": "CodeAnalysisStatus" }, + "errorMessage": { "shape": "SensitiveString" } } }, "GetTaskAssistCodeGenerationRequest": { "type": "structure", "required": ["conversationId", "codeGenerationId"], "members": { - "conversationId": { - "shape": "ConversationId" - }, - "codeGenerationId": { - "shape": "CodeGenerationId" - } - }, - "documentation": "

Request for getting task assist code generation.

" + "conversationId": { "shape": "ConversationId" }, + "codeGenerationId": { "shape": "CodeGenerationId" } + } }, "GetTaskAssistCodeGenerationResponse": { "type": "structure", "required": ["conversationId", "codeGenerationStatus"], "members": { - "conversationId": { - "shape": "ConversationId" - }, - "codeGenerationStatus": { - "shape": "CodeGenerationStatus" - } - }, - "documentation": "

Response for getting task assist code generation status.

" + "conversationId": { "shape": "ConversationId" }, + "codeGenerationStatus": { "shape": "CodeGenerationStatus" }, + "codeGenerationStatusDetail": { "shape": "CodeGenerationStatusDetail" }, + "codeGenerationRemainingIterationCount": { "shape": "Integer" }, + "codeGenerationTotalIterationCount": { "shape": "Integer" } + } }, "GetTransformationPlanRequest": { "type": "structure", "required": ["transformationJobId"], "members": { - "transformationJobId": { - "shape": "TransformationJobId" - } - }, - "documentation": "

Structure to represent get code transformation plan request.

" + "transformationJobId": { "shape": "TransformationJobId" } + } }, "GetTransformationPlanResponse": { "type": "structure", "required": ["transformationPlan"], "members": { - "transformationPlan": { - "shape": "TransformationPlan" - } - }, - "documentation": "

Structure to represent get code transformation plan response.

" + "transformationPlan": { "shape": "TransformationPlan" } + } }, "GetTransformationRequest": { "type": "structure", "required": ["transformationJobId"], "members": { - "transformationJobId": { - "shape": "TransformationJobId" - } - }, - "documentation": "

Structure to represent get code transformation request.

" + "transformationJobId": { "shape": "TransformationJobId" } + } }, "GetTransformationResponse": { "type": "structure", "required": ["transformationJob"], "members": { - "transformationJob": { - "shape": "TransformationJob" - } - }, - "documentation": "

Structure to represent get code transformation response.

" + "transformationJob": { "shape": "TransformationJob" } + } + }, + "GitState": { + "type": "structure", + "members": { + "status": { "shape": "GitStateStatusString" } + } + }, + "GitStateStatusString": { + "type": "string", + "max": 4096, + "min": 0, + "sensitive": true }, "IdeCategory": { "type": "string", - "enum": ["JETBRAINS", "VSCODE"], + "enum": ["JETBRAINS", "VSCODE", "CLI", "JUPYTER_MD", "JUPYTER_SM"], "max": 64, "min": 1 }, @@ -1320,9 +1078,7 @@ "Import": { "type": "structure", "members": { - "statement": { - "shape": "ImportStatementString" - } + "statement": { "shape": "ImportStatementString" } } }, "ImportStatementString": { @@ -1333,9 +1089,7 @@ }, "Imports": { "type": "list", - "member": { - "shape": "Import" - }, + "member": { "shape": "Import" }, "max": 10, "min": 0 }, @@ -1347,26 +1101,17 @@ "type": "structure", "required": ["message"], "members": { - "message": { - "shape": "String" - } + "message": { "shape": "String" } }, - "documentation": "

This exception is thrown when an unexpected error occurred during the processing of a request.

", "exception": true, "fault": true, - "retryable": { - "throttling": false - } + "retryable": { "throttling": false } }, "ListAvailableCustomizationsRequest": { "type": "structure", "members": { - "maxResults": { - "shape": "ListAvailableCustomizationsRequestMaxResultsInteger" - }, - "nextToken": { - "shape": "Base64EncodedPaginationToken" - } + "maxResults": { "shape": "ListAvailableCustomizationsRequestMaxResultsInteger" }, + "nextToken": { "shape": "Base64EncodedPaginationToken" } } }, "ListAvailableCustomizationsRequestMaxResultsInteger": { @@ -1379,27 +1124,17 @@ "type": "structure", "required": ["customizations"], "members": { - "customizations": { - "shape": "Customizations" - }, - "nextToken": { - "shape": "Base64EncodedPaginationToken" - } + "customizations": { "shape": "Customizations" }, + "nextToken": { "shape": "Base64EncodedPaginationToken" } } }, "ListCodeAnalysisFindingsRequest": { "type": "structure", "required": ["jobId", "codeAnalysisFindingsSchema"], "members": { - "jobId": { - "shape": "ListCodeAnalysisFindingsRequestJobIdString" - }, - "nextToken": { - "shape": "PaginationToken" - }, - "codeAnalysisFindingsSchema": { - "shape": "CodeAnalysisFindingsSchema" - } + "jobId": { "shape": "ListCodeAnalysisFindingsRequestJobIdString" }, + "nextToken": { "shape": "PaginationToken" }, + "codeAnalysisFindingsSchema": { "shape": "CodeAnalysisFindingsSchema" } } }, "ListCodeAnalysisFindingsRequestJobIdString": { @@ -1411,52 +1146,42 @@ "type": "structure", "required": ["codeAnalysisFindings"], "members": { - "nextToken": { - "shape": "PaginationToken" - }, - "codeAnalysisFindings": { - "shape": "SensitiveString" - } + "nextToken": { "shape": "PaginationToken" }, + "codeAnalysisFindings": { "shape": "SensitiveString" } } }, "ListFeatureEvaluationsRequest": { "type": "structure", "required": ["userContext"], "members": { - "userContext": { - "shape": "UserContext" - } + "userContext": { "shape": "UserContext" } } }, "ListFeatureEvaluationsResponse": { "type": "structure", "required": ["featureEvaluations"], "members": { - "featureEvaluations": { - "shape": "FeatureEvaluationsList" - } + "featureEvaluations": { "shape": "FeatureEvaluationsList" } } }, "Long": { "type": "long", "box": true }, + "MessageId": { + "type": "string", + "max": 128, + "min": 0 + }, "MetricData": { "type": "structure", - "required": ["metricName", "metricValue", "timestamp"], + "required": ["metricName", "metricValue", "timestamp", "product"], "members": { - "metricName": { - "shape": "MetricDataMetricNameString" - }, - "metricValue": { - "shape": "Double" - }, - "timestamp": { - "shape": "Timestamp" - }, - "dimensions": { - "shape": "DimensionList" - } + "metricName": { "shape": "MetricDataMetricNameString" }, + "metricValue": { "shape": "Double" }, + "timestamp": { "shape": "Timestamp" }, + "product": { "shape": "MetricDataProductString" }, + "dimensions": { "shape": "DimensionList" } } }, "MetricDataMetricNameString": { @@ -1465,6 +1190,12 @@ "min": 1, "pattern": "[-a-zA-Z0-9._]*" }, + "MetricDataProductString": { + "type": "string", + "max": 128, + "min": 1, + "pattern": "[-a-zA-Z0-9._]*" + }, "OperatingSystem": { "type": "string", "enum": ["MAC", "WINDOWS", "LINUX"], @@ -1485,16 +1216,9 @@ "type": "structure", "required": ["line", "character"], "members": { - "line": { - "shape": "Integer", - "documentation": "

Line position in a document.

" - }, - "character": { - "shape": "Integer", - "documentation": "

Character offset on a line in a document (zero-based)

" - } - }, - "documentation": "

Indicates Cursor postion in a Text Document

" + "line": { "shape": "Integer" }, + "character": { "shape": "Integer" } + } }, "PreSignedUrl": { "type": "string", @@ -1502,72 +1226,50 @@ "min": 1, "sensitive": true }, - "PrimitiveInteger": { - "type": "integer" + "PrimitiveInteger": { "type": "integer" }, + "ProfileArn": { + "type": "string", + "max": 950, + "min": 0, + "pattern": "arn:aws:codewhisperer:[-.a-z0-9]{1,63}:\\d{12}:profile/([a-zA-Z0-9]){12}" }, "ProgrammingLanguage": { "type": "structure", "required": ["languageName"], "members": { - "languageName": { - "shape": "ProgrammingLanguageLanguageNameString" - } - }, - "documentation": "

Programming Languages supported by CodeWhisperer

" + "languageName": { "shape": "ProgrammingLanguageLanguageNameString" } + } }, "ProgrammingLanguageLanguageNameString": { "type": "string", "max": 128, "min": 1, - "pattern": "(python|javascript|java|csharp|typescript|c|cpp|go|kotlin|php|ruby|rust|scala|shell|sql|json|yaml|vue|tf)" + "pattern": "(python|javascript|java|csharp|typescript|c|cpp|go|kotlin|php|ruby|rust|scala|shell|sql|json|yaml|vue|tf|tsx|jsx|plaintext)" }, "ProgressUpdates": { "type": "list", - "member": { - "shape": "TransformationProgressUpdate" - } + "member": { "shape": "TransformationProgressUpdate" } }, "Range": { "type": "structure", "required": ["start", "end"], "members": { - "start": { - "shape": "Position", - "documentation": "

The range's start position.

" - }, - "end": { - "shape": "Position", - "documentation": "

The range's end position.

" - } - }, - "documentation": "

Indicates Range / Span in a Text Document

" + "start": { "shape": "Position" }, + "end": { "shape": "Position" } + } }, "RecommendationsWithReferencesPreference": { "type": "string", - "documentation": "

Recommendations with references setting for CodeWhisperer

", "enum": ["BLOCK", "ALLOW"] }, "Reference": { "type": "structure", "members": { - "licenseName": { - "shape": "ReferenceLicenseNameString", - "documentation": "

License name

" - }, - "repository": { - "shape": "ReferenceRepositoryString", - "documentation": "

Code Repsitory for the associated reference

" - }, - "url": { - "shape": "ReferenceUrlString", - "documentation": "

Respository URL

" - }, - "recommendationContentSpan": { - "shape": "Span", - "documentation": "

Span / Range for the Reference

" - } - }, - "documentation": "

Code Reference / Repository details

" + "licenseName": { "shape": "ReferenceLicenseNameString" }, + "repository": { "shape": "ReferenceRepositoryString" }, + "url": { "shape": "ReferenceUrlString" }, + "recommendationContentSpan": { "shape": "Span" } + } }, "ReferenceLicenseNameString": { "type": "string", @@ -1583,9 +1285,7 @@ "type": "structure", "required": ["recommendationsWithReferences"], "members": { - "recommendationsWithReferences": { - "shape": "RecommendationsWithReferencesPreference" - } + "recommendationsWithReferences": { "shape": "RecommendationsWithReferencesPreference" } } }, "ReferenceUrlString": { @@ -1595,12 +1295,56 @@ }, "References": { "type": "list", - "member": { - "shape": "Reference" - }, + "member": { "shape": "Reference" }, "max": 10, "min": 0 }, + "RelevantDocumentList": { + "type": "list", + "member": { "shape": "RelevantTextDocument" }, + "max": 5, + "min": 0 + }, + "RelevantTextDocument": { + "type": "structure", + "required": ["relativeFilePath"], + "members": { + "relativeFilePath": { "shape": "RelevantTextDocumentRelativeFilePathString" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "text": { "shape": "RelevantTextDocumentTextString" }, + "documentSymbols": { "shape": "DocumentSymbols" } + } + }, + "RelevantTextDocumentRelativeFilePathString": { + "type": "string", + "max": 4096, + "min": 1, + "sensitive": true + }, + "RelevantTextDocumentTextString": { + "type": "string", + "max": 10240, + "min": 0, + "sensitive": true + }, + "RequestHeaderKey": { + "type": "string", + "max": 64, + "min": 1 + }, + "RequestHeaderValue": { + "type": "string", + "max": 256, + "min": 1 + }, + "RequestHeaders": { + "type": "map", + "key": { "shape": "RequestHeaderKey" }, + "value": { "shape": "RequestHeaderValue" }, + "max": 16, + "min": 1, + "sensitive": true + }, "ResourceArn": { "type": "string", "max": 1224, @@ -1611,31 +1355,33 @@ "type": "structure", "required": ["message"], "members": { - "message": { - "shape": "String" - } + "message": { "shape": "String" } }, - "documentation": "

This exception is thrown when describing a resource that does not exist.

", "exception": true }, + "ResumeTransformationRequest": { + "type": "structure", + "required": ["transformationJobId"], + "members": { + "transformationJobId": { "shape": "TransformationJobId" }, + "userActionStatus": { "shape": "TransformationUserActionStatus" } + } + }, + "ResumeTransformationResponse": { + "type": "structure", + "required": ["transformationStatus"], + "members": { + "transformationStatus": { "shape": "TransformationStatus" } + } + }, "RuntimeDiagnostic": { "type": "structure", "required": ["source", "severity", "message"], "members": { - "source": { - "shape": "RuntimeDiagnosticSourceString", - "documentation": "

A human-readable string describing the source of the diagnostic

" - }, - "severity": { - "shape": "DiagnosticSeverity", - "documentation": "

Diagnostic Error type

" - }, - "message": { - "shape": "RuntimeDiagnosticMessageString", - "documentation": "

The diagnostic's message.

" - } - }, - "documentation": "

Structure to represent metadata about a Runtime Diagnostics

" + "source": { "shape": "RuntimeDiagnosticSourceString" }, + "severity": { "shape": "DiagnosticSeverity" }, + "message": { "shape": "RuntimeDiagnosticMessageString" } + } }, "RuntimeDiagnosticMessageString": { "type": "string", @@ -1657,15 +1403,10 @@ "shape": "IdempotencyToken", "idempotencyToken": true }, - "telemetryEvent": { - "shape": "TelemetryEvent" - }, - "optOutPreference": { - "shape": "OptOutPreference" - }, - "userContext": { - "shape": "UserContext" - } + "telemetryEvent": { "shape": "TelemetryEvent" }, + "optOutPreference": { "shape": "OptOutPreference" }, + "userContext": { "shape": "UserContext" }, + "profileArn": { "shape": "ProfileArn" } } }, "SendTelemetryEventResponse": { @@ -1676,17 +1417,75 @@ "type": "string", "sensitive": true }, - "Span": { + "ServiceQuotaExceededException": { "type": "structure", + "required": ["message"], "members": { - "start": { - "shape": "SpanStartInteger" - }, - "end": { - "shape": "SpanEndInteger" - } + "message": { "shape": "String" } }, - "documentation": "

Represents span in a text

" + "exception": true + }, + "ShellHistory": { + "type": "list", + "member": { "shape": "ShellHistoryEntry" }, + "max": 20, + "min": 0 + }, + "ShellHistoryEntry": { + "type": "structure", + "required": ["command"], + "members": { + "command": { "shape": "ShellHistoryEntryCommandString" }, + "directory": { "shape": "ShellHistoryEntryDirectoryString" }, + "exitCode": { "shape": "Integer" }, + "stdout": { "shape": "ShellHistoryEntryStdoutString" }, + "stderr": { "shape": "ShellHistoryEntryStderrString" } + } + }, + "ShellHistoryEntryCommandString": { + "type": "string", + "max": 1024, + "min": 1, + "sensitive": true + }, + "ShellHistoryEntryDirectoryString": { + "type": "string", + "max": 256, + "min": 1, + "sensitive": true + }, + "ShellHistoryEntryStderrString": { + "type": "string", + "max": 4096, + "min": 0, + "sensitive": true + }, + "ShellHistoryEntryStdoutString": { + "type": "string", + "max": 4096, + "min": 0, + "sensitive": true + }, + "ShellState": { + "type": "structure", + "required": ["shellName"], + "members": { + "shellName": { "shape": "ShellStateShellNameString" }, + "shellHistory": { "shape": "ShellHistory" } + } + }, + "ShellStateShellNameString": { + "type": "string", + "max": 32, + "min": 1, + "pattern": "(zsh|bash|fish|pwsh|nu)" + }, + "Span": { + "type": "structure", + "members": { + "start": { "shape": "SpanStartInteger" }, + "end": { "shape": "SpanEndInteger" } + } }, "SpanEndInteger": { "type": "integer", @@ -1702,16 +1501,14 @@ "type": "structure", "required": ["artifacts", "programmingLanguage"], "members": { - "artifacts": { - "shape": "ArtifactMap" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage" - }, + "artifacts": { "shape": "ArtifactMap" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, "clientToken": { "shape": "StartCodeAnalysisRequestClientTokenString", "idempotencyToken": true - } + }, + "scope": { "shape": "CodeAnalysisScope" }, + "codeScanName": { "shape": "CodeScanName" } } }, "StartCodeAnalysisRequestClientTokenString": { @@ -1723,15 +1520,9 @@ "type": "structure", "required": ["jobId", "status"], "members": { - "jobId": { - "shape": "StartCodeAnalysisResponseJobIdString" - }, - "status": { - "shape": "CodeAnalysisStatus" - }, - "errorMessage": { - "shape": "SensitiveString" - } + "jobId": { "shape": "StartCodeAnalysisResponseJobIdString" }, + "status": { "shape": "CodeAnalysisStatus" }, + "errorMessage": { "shape": "SensitiveString" } } }, "StartCodeAnalysisResponseJobIdString": { @@ -1743,50 +1534,32 @@ "type": "structure", "required": ["conversationState", "workspaceState"], "members": { - "conversationState": { - "shape": "ConversationState" - }, - "workspaceState": { - "shape": "WorkspaceState" - } - }, - "documentation": "

Structure to represent start code generation request.

" + "conversationState": { "shape": "ConversationState" }, + "workspaceState": { "shape": "WorkspaceState" } + } }, "StartTaskAssistCodeGenerationResponse": { "type": "structure", "required": ["conversationId", "codeGenerationId"], "members": { - "conversationId": { - "shape": "ConversationId" - }, - "codeGenerationId": { - "shape": "CodeGenerationId" - } - }, - "documentation": "

Structure to represent start code generation response.

" + "conversationId": { "shape": "ConversationId" }, + "codeGenerationId": { "shape": "CodeGenerationId" } + } }, "StartTransformationRequest": { "type": "structure", "required": ["workspaceState", "transformationSpec"], "members": { - "workspaceState": { - "shape": "WorkspaceState" - }, - "transformationSpec": { - "shape": "TransformationSpec" - } - }, - "documentation": "

Structure to represent code transformation request.

" + "workspaceState": { "shape": "WorkspaceState" }, + "transformationSpec": { "shape": "TransformationSpec" } + } }, "StartTransformationResponse": { "type": "structure", "required": ["transformationJobId"], "members": { - "transformationJobId": { - "shape": "TransformationJobId" - } - }, - "documentation": "

Structure to represent code transformation response.

" + "transformationJobId": { "shape": "TransformationJobId" } + } }, "StepId": { "type": "string", @@ -1797,25 +1570,17 @@ "type": "structure", "required": ["transformationJobId"], "members": { - "transformationJobId": { - "shape": "TransformationJobId" - } - }, - "documentation": "

Structure to represent stop code transformation request.

" + "transformationJobId": { "shape": "TransformationJobId" } + } }, "StopTransformationResponse": { "type": "structure", "required": ["transformationStatus"], "members": { - "transformationStatus": { - "shape": "TransformationStatus" - } - }, - "documentation": "

Structure to represent stop code transformation response.

" - }, - "String": { - "type": "string" + "transformationStatus": { "shape": "TransformationStatus" } + } }, + "String": { "type": "string" }, "SuggestionState": { "type": "string", "enum": ["ACCEPT", "REJECT", "DISCARD", "EMPTY"] @@ -1824,12 +1589,8 @@ "type": "structure", "required": ["filePath", "content"], "members": { - "filePath": { - "shape": "SupplementalContextFilePathString" - }, - "content": { - "shape": "SupplementalContextContentString" - } + "filePath": { "shape": "SupplementalContextFilePathString" }, + "content": { "shape": "SupplementalContextContentString" } } }, "SupplementalContextContentString": { @@ -1846,9 +1607,7 @@ }, "SupplementalContextList": { "type": "list", - "member": { - "shape": "SupplementalContext" - }, + "member": { "shape": "SupplementalContext" }, "max": 5, "min": 0 }, @@ -1856,20 +1615,10 @@ "type": "structure", "required": ["url", "title"], "members": { - "url": { - "shape": "SupplementaryWebLinkUrlString", - "documentation": "

URL of the web reference link

" - }, - "title": { - "shape": "SupplementaryWebLinkTitleString", - "documentation": "

Title of the web reference link

" - }, - "snippet": { - "shape": "SupplementaryWebLinkSnippetString", - "documentation": "

Relevant text snippet from the link

" - } - }, - "documentation": "

Represents an additional reference link retured with the Chat message

" + "url": { "shape": "SupplementaryWebLinkUrlString" }, + "title": { "shape": "SupplementaryWebLinkTitleString" }, + "snippet": { "shape": "SupplementaryWebLinkSnippetString" } + } }, "SupplementaryWebLinkSnippetString": { "type": "string", @@ -1891,9 +1640,7 @@ }, "SupplementaryWebLinks": { "type": "list", - "member": { - "shape": "SupplementaryWebLink" - }, + "member": { "shape": "SupplementaryWebLink" }, "max": 10, "min": 0 }, @@ -1905,84 +1652,64 @@ "type": "structure", "required": ["conversationId"], "members": { - "conversationId": { - "shape": "ConversationId" - } + "conversationId": { "shape": "ConversationId" } } }, "TelemetryEvent": { "type": "structure", "members": { - "userTriggerDecisionEvent": { - "shape": "UserTriggerDecisionEvent" - }, - "codeCoverageEvent": { - "shape": "CodeCoverageEvent" - }, - "userModificationEvent": { - "shape": "UserModificationEvent" - }, - "codeScanEvent": { - "shape": "CodeScanEvent" - }, - "metricData": { - "shape": "MetricData" - }, - "featureDevEvent": { - "shape": "FeatureDevEvent" - } + "userTriggerDecisionEvent": { "shape": "UserTriggerDecisionEvent" }, + "codeCoverageEvent": { "shape": "CodeCoverageEvent" }, + "userModificationEvent": { "shape": "UserModificationEvent" }, + "codeScanEvent": { "shape": "CodeScanEvent" }, + "codeScanRemediationsEvent": { "shape": "CodeScanRemediationsEvent" }, + "metricData": { "shape": "MetricData" }, + "chatAddMessageEvent": { "shape": "ChatAddMessageEvent" }, + "chatInteractWithMessageEvent": { "shape": "ChatInteractWithMessageEvent" }, + "chatUserModificationEvent": { "shape": "ChatUserModificationEvent" }, + "terminalUserInteractionEvent": { "shape": "TerminalUserInteractionEvent" }, + "featureDevEvent": { "shape": "FeatureDevEvent" } }, "union": true }, + "TerminalUserInteractionEvent": { + "type": "structure", + "members": { + "terminalUserInteractionEventType": { "shape": "TerminalUserInteractionEventType" }, + "terminal": { "shape": "String" }, + "terminalVersion": { "shape": "String" }, + "shell": { "shape": "String" }, + "shellVersion": { "shape": "String" }, + "duration": { "shape": "Integer" }, + "timeToSuggestion": { "shape": "Integer" }, + "isCompletionAccepted": { "shape": "Boolean" }, + "cliToolCommand": { "shape": "String" } + } + }, + "TerminalUserInteractionEventType": { + "type": "string", + "enum": ["CODEWHISPERER_TERMINAL_TRANSLATION_ACTION", "CODEWHISPERER_TERMINAL_COMPLETION_INSERTED"] + }, "TextDocument": { "type": "structure", "required": ["relativeFilePath"], "members": { - "relativeFilePath": { - "shape": "TextDocumentRelativeFilePathString", - "documentation": "

Filepath relative to the root of the workspace

" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage", - "documentation": "

The text document's language identifier.

" - }, - "text": { - "shape": "TextDocumentTextString", - "documentation": "

Content of the text document

" - }, - "documentSymbols": { - "shape": "DocumentSymbols", - "documentation": "

DocumentSymbols parsed from a text document

" - } - }, - "documentation": "

Represents a Text Document / File

" + "relativeFilePath": { "shape": "TextDocumentRelativeFilePathString" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "text": { "shape": "TextDocumentTextString" }, + "documentSymbols": { "shape": "DocumentSymbols" } + } }, "TextDocumentDiagnostic": { "type": "structure", "required": ["document", "range", "source", "severity", "message"], "members": { - "document": { - "shape": "TextDocument", - "documentation": "

Represents a Text Document associated with Diagnostic

" - }, - "range": { - "shape": "Range", - "documentation": "

The range at which the message applies.

" - }, - "source": { - "shape": "SensitiveString", - "documentation": "

A human-readable string describing the source of the diagnostic

" - }, - "severity": { - "shape": "DiagnosticSeverity", - "documentation": "

Diagnostic Error type

" - }, - "message": { - "shape": "TextDocumentDiagnosticMessageString", - "documentation": "

The diagnostic's message.

" - } - }, - "documentation": "

Structure to represent metadata about a TextDocument Diagnostic

" + "document": { "shape": "TextDocument" }, + "range": { "shape": "Range" }, + "source": { "shape": "SensitiveString" }, + "severity": { "shape": "DiagnosticSeverity" }, + "message": { "shape": "TextDocumentDiagnosticMessageString" } + } }, "TextDocumentDiagnosticMessageString": { "type": "string", @@ -2006,110 +1733,138 @@ "type": "structure", "required": ["message"], "members": { - "message": { - "shape": "String" - } + "message": { "shape": "String" } }, - "documentation": "

This exception is thrown when request was denied due to request throttling.

", "exception": true, - "retryable": { - "throttling": true + "retryable": { "throttling": true } + }, + "Timestamp": { "type": "timestamp" }, + "TransformationDotNetRuntimeEnv": { + "type": "string", + "enum": [ + "NET_FRAMEWORK_V_3_5", + "NET_FRAMEWORK_V_4_0", + "NET_FRAMEWORK_V_4_5", + "NET_FRAMEWORK_V_4_5_1", + "NET_FRAMEWORK_V_4_5_2", + "NET_FRAMEWORK_V_4_6", + "NET_FRAMEWORK_V_4_6_1", + "NET_FRAMEWORK_V_4_6_2", + "NET_FRAMEWORK_V_4_7", + "NET_FRAMEWORK_V_4_7_1", + "NET_FRAMEWORK_V_4_7_2", + "NET_FRAMEWORK_V_4_8", + "NET_FRAMEWORK_V_4_8_1", + "NET_CORE_APP_1_0", + "NET_CORE_APP_1_1", + "NET_CORE_APP_2_0", + "NET_CORE_APP_2_1", + "NET_CORE_APP_2_2", + "NET_CORE_APP_3_0", + "NET_CORE_APP_3_1", + "NET_5_0", + "NET_6_0", + "NET_7_0", + "NET_8_0" + ] + }, + "TransformationDownloadArtifact": { + "type": "structure", + "members": { + "downloadArtifactType": { "shape": "TransformationDownloadArtifactType" }, + "downloadArtifactId": { "shape": "ArtifactId" } } }, - "Timestamp": { - "type": "timestamp" + "TransformationDownloadArtifactType": { + "type": "string", + "enum": ["ClientInstructions", "Logs"] + }, + "TransformationDownloadArtifacts": { + "type": "list", + "member": { "shape": "TransformationDownloadArtifact" }, + "max": 10, + "min": 0 + }, + "TransformationJavaRuntimeEnv": { + "type": "string", + "enum": ["JVM_8", "JVM_11", "JVM_17"] }, "TransformationJob": { "type": "structure", "members": { - "jobId": { - "shape": "TransformationJobId" - }, - "transformationSpec": { - "shape": "TransformationSpec" - }, - "status": { - "shape": "TransformationStatus" - }, - "reason": { - "shape": "String" - }, - "creationTime": { - "shape": "Timestamp" - }, - "startExecutionTime": { - "shape": "Timestamp" - }, - "endExecutionTime": { - "shape": "Timestamp" - } - }, - "documentation": "

Represent a Transformation Job

" + "jobId": { "shape": "TransformationJobId" }, + "transformationSpec": { "shape": "TransformationSpec" }, + "status": { "shape": "TransformationStatus" }, + "reason": { "shape": "String" }, + "creationTime": { "shape": "Timestamp" }, + "startExecutionTime": { "shape": "Timestamp" }, + "endExecutionTime": { "shape": "Timestamp" } + } }, "TransformationJobId": { "type": "string", - "documentation": "

Identifier for the Transformation Job

", "max": 128, "min": 1 }, "TransformationLanguage": { "type": "string", - "enum": ["JAVA_8", "JAVA_11", "JAVA_17"] + "enum": ["JAVA_8", "JAVA_11", "JAVA_17", "C_SHARP"] + }, + "TransformationOperatingSystemFamily": { + "type": "string", + "enum": ["WINDOWS", "LINUX"] }, "TransformationPlan": { "type": "structure", "required": ["transformationSteps"], "members": { - "transformationSteps": { - "shape": "TransformationSteps" - } + "transformationSteps": { "shape": "TransformationSteps" } + } + }, + "TransformationPlatformConfig": { + "type": "structure", + "members": { + "operatingSystemFamily": { "shape": "TransformationOperatingSystemFamily" } } }, "TransformationProgressUpdate": { "type": "structure", "required": ["name", "status"], "members": { - "name": { - "shape": "String" - }, - "status": { - "shape": "TransformationProgressUpdateStatus" - }, - "description": { - "shape": "String" - }, - "startTime": { - "shape": "Timestamp" - }, - "endTime": { - "shape": "Timestamp" - } + "name": { "shape": "String" }, + "status": { "shape": "TransformationProgressUpdateStatus" }, + "description": { "shape": "String" }, + "startTime": { "shape": "Timestamp" }, + "endTime": { "shape": "Timestamp" }, + "downloadArtifacts": { "shape": "TransformationDownloadArtifacts" } } }, "TransformationProgressUpdateStatus": { "type": "string", - "enum": ["IN_PROGRESS", "COMPLETED", "FAILED"] + "enum": ["IN_PROGRESS", "COMPLETED", "FAILED", "PAUSED"] }, "TransformationProjectState": { "type": "structure", "members": { - "language": { - "shape": "TransformationLanguage" - } + "language": { "shape": "TransformationLanguage" }, + "runtimeEnv": { "shape": "TransformationRuntimeEnv" }, + "platformConfig": { "shape": "TransformationPlatformConfig" } } }, + "TransformationRuntimeEnv": { + "type": "structure", + "members": { + "java": { "shape": "TransformationJavaRuntimeEnv" }, + "dotNet": { "shape": "TransformationDotNetRuntimeEnv" } + }, + "union": true + }, "TransformationSpec": { "type": "structure", "members": { - "transformationType": { - "shape": "TransformationType" - }, - "source": { - "shape": "TransformationProjectState" - }, - "target": { - "shape": "TransformationProjectState" - } + "transformationType": { "shape": "TransformationType" }, + "source": { "shape": "TransformationProjectState" }, + "target": { "shape": "TransformationProjectState" } } }, "TransformationStatus": { @@ -2129,50 +1884,52 @@ "COMPLETED", "PARTIALLY_COMPLETED", "STOPPING", - "STOPPED" + "STOPPED", + "PAUSED", + "RESUMED" ] }, "TransformationStep": { "type": "structure", "required": ["id", "name", "description", "status"], "members": { - "id": { - "shape": "StepId" - }, - "name": { - "shape": "String" - }, - "description": { - "shape": "String" - }, - "status": { - "shape": "TransformationStepStatus" - }, - "progressUpdates": { - "shape": "ProgressUpdates" - }, - "startTime": { - "shape": "Timestamp" - }, - "endTime": { - "shape": "Timestamp" - } + "id": { "shape": "StepId" }, + "name": { "shape": "String" }, + "description": { "shape": "String" }, + "status": { "shape": "TransformationStepStatus" }, + "progressUpdates": { "shape": "ProgressUpdates" }, + "startTime": { "shape": "Timestamp" }, + "endTime": { "shape": "Timestamp" } } }, "TransformationStepStatus": { "type": "string", - "enum": ["CREATED", "COMPLETED", "PARTIALLY_COMPLETED", "STOPPED", "FAILED"] + "enum": ["CREATED", "COMPLETED", "PARTIALLY_COMPLETED", "STOPPED", "FAILED", "PAUSED"] }, "TransformationSteps": { "type": "list", - "member": { - "shape": "TransformationStep" - } + "member": { "shape": "TransformationStep" } }, "TransformationType": { "type": "string", "enum": ["LANGUAGE_UPGRADE"] }, + "TransformationUploadArtifactType": { + "type": "string", + "enum": ["Dependencies"] + }, + "TransformationUploadContext": { + "type": "structure", + "required": ["jobId", "uploadArtifactType"], + "members": { + "jobId": { "shape": "TransformationJobId" }, + "uploadArtifactType": { "shape": "TransformationUploadArtifactType" } + } + }, + "TransformationUserActionStatus": { + "type": "string", + "enum": ["COMPLETED", "REJECTED"] + }, "UUID": { "type": "string", "max": 36, @@ -2181,42 +1938,35 @@ "UploadContext": { "type": "structure", "members": { - "taskAssistPlanningUploadContext": { - "shape": "TaskAssistPlanningUploadContext" - } + "taskAssistPlanningUploadContext": { "shape": "TaskAssistPlanningUploadContext" }, + "transformationUploadContext": { "shape": "TransformationUploadContext" }, + "codeAnalysisUploadContext": { "shape": "CodeAnalysisUploadContext" } }, "union": true }, "UploadId": { "type": "string", - "documentation": "

Upload ID returned by CreateUploadUrl API

", "max": 128, "min": 1 }, "UploadIntent": { "type": "string", - "documentation": "

Upload Intent

", - "enum": ["TRANSFORMATION", "TASK_ASSIST_PLANNING"] + "enum": [ + "TRANSFORMATION", + "TASK_ASSIST_PLANNING", + "AUTOMATIC_FILE_SECURITY_SCAN", + "FULL_PROJECT_SECURITY_SCAN" + ] }, "UserContext": { "type": "structure", "required": ["ideCategory", "operatingSystem", "product"], "members": { - "ideCategory": { - "shape": "IdeCategory" - }, - "operatingSystem": { - "shape": "OperatingSystem" - }, - "product": { - "shape": "UserContextProductString" - }, - "clientId": { - "shape": "UUID" - }, - "ideVersion": { - "shape": "String" - } + "ideCategory": { "shape": "IdeCategory" }, + "operatingSystem": { "shape": "OperatingSystem" }, + "product": { "shape": "UserContextProductString" }, + "clientId": { "shape": "UUID" }, + "ideVersion": { "shape": "String" } } }, "UserContextProductString": { @@ -2229,20 +1979,10 @@ "type": "structure", "required": ["content"], "members": { - "content": { - "shape": "UserInputMessageContentString", - "documentation": "

The content of the chat message.

" - }, - "userInputMessageContext": { - "shape": "UserInputMessageContext", - "documentation": "

Chat message context associated with the Chat Message

" - }, - "userIntent": { - "shape": "UserIntent", - "documentation": "

User Intent

" - } - }, - "documentation": "

Structure to represent a chat input message from User

" + "content": { "shape": "UserInputMessageContentString" }, + "userInputMessageContext": { "shape": "UserInputMessageContext" }, + "userIntent": { "shape": "UserIntent" } + } }, "UserInputMessageContentString": { "type": "string", @@ -2253,20 +1993,16 @@ "UserInputMessageContext": { "type": "structure", "members": { - "editorState": { - "shape": "EditorState", - "documentation": "

Editor state chat message context.

" - }, - "diagnostic": { - "shape": "Diagnostic", - "documentation": "

Diagnostic chat message context.

" - } - }, - "documentation": "

Additional Chat message context associated with the Chat Message

" + "editorState": { "shape": "EditorState" }, + "shellState": { "shape": "ShellState" }, + "gitState": { "shape": "GitState" }, + "envState": { "shape": "EnvState" }, + "appStudioContext": { "shape": "AppStudioState" }, + "diagnostic": { "shape": "Diagnostic" } + } }, "UserIntent": { "type": "string", - "documentation": "

User Intent

", "enum": [ "SUGGEST_ALTERNATE_IMPLEMENTATION", "APPLY_COMMON_BEST_PRACTICES", @@ -2274,31 +2010,20 @@ "SHOW_EXAMPLES", "CITE_SOURCES", "EXPLAIN_LINE_BY_LINE", - "EXPLAIN_CODE_SELECTION" + "EXPLAIN_CODE_SELECTION", + "GENERATE_CLOUDFORMATION_TEMPLATE" ] }, "UserModificationEvent": { "type": "structure", "required": ["sessionId", "requestId", "programmingLanguage", "modificationPercentage", "timestamp"], "members": { - "sessionId": { - "shape": "UUID" - }, - "requestId": { - "shape": "UUID" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage" - }, - "modificationPercentage": { - "shape": "Double" - }, - "customizationArn": { - "shape": "CustomizationArn" - }, - "timestamp": { - "shape": "Timestamp" - } + "sessionId": { "shape": "UUID" }, + "requestId": { "shape": "UUID" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "modificationPercentage": { "shape": "Double" }, + "customizationArn": { "shape": "CustomizationArn" }, + "timestamp": { "shape": "Timestamp" } } }, "UserTriggerDecisionEvent": { @@ -2313,75 +2038,47 @@ "timestamp" ], "members": { - "sessionId": { - "shape": "UUID" - }, - "requestId": { - "shape": "UUID" - }, - "customizationArn": { - "shape": "CustomizationArn" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage" - }, - "completionType": { - "shape": "CompletionType" - }, - "suggestionState": { - "shape": "SuggestionState" - }, - "recommendationLatencyMilliseconds": { - "shape": "Double" - }, - "timestamp": { - "shape": "Timestamp" - }, - "suggestionReferenceCount": { - "shape": "PrimitiveInteger" - }, - "generatedLine": { - "shape": "PrimitiveInteger" - } + "sessionId": { "shape": "UUID" }, + "requestId": { "shape": "UUID" }, + "customizationArn": { "shape": "CustomizationArn" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "completionType": { "shape": "CompletionType" }, + "suggestionState": { "shape": "SuggestionState" }, + "recommendationLatencyMilliseconds": { "shape": "Double" }, + "timestamp": { "shape": "Timestamp" }, + "triggerToResponseLatencyMilliseconds": { "shape": "Double" }, + "suggestionReferenceCount": { "shape": "PrimitiveInteger" }, + "generatedLine": { "shape": "PrimitiveInteger" }, + "numberOfRecommendations": { "shape": "PrimitiveInteger" } } }, "ValidationException": { "type": "structure", "required": ["message"], "members": { - "message": { - "shape": "String" - }, - "reason": { - "shape": "ValidationExceptionReason" - } + "message": { "shape": "String" }, + "reason": { "shape": "ValidationExceptionReason" } }, - "documentation": "

This exception is thrown when the input fails to satisfy the constraints specified by the service.

", "exception": true }, "ValidationExceptionReason": { "type": "string", - "documentation": "

Reason for ValidationException

", - "enum": ["INVALID_CONVERSATION_ID"] + "enum": ["INVALID_CONVERSATION_ID", "CONTENT_LENGTH_EXCEEDS_THRESHOLD"] }, "WorkspaceState": { "type": "structure", "required": ["uploadId", "programmingLanguage"], "members": { - "uploadId": { - "shape": "UploadId", - "documentation": "

Upload ID representing an Upload using a PreSigned URL

" - }, - "programmingLanguage": { - "shape": "ProgrammingLanguage", - "documentation": "

Primary programming language of the Workspace

" - }, - "contextTruncationScheme": { - "shape": "ContextTruncationScheme", - "documentation": "

Workspace context truncation schemes based on usecase

" - } - }, - "documentation": "

Represents a Workspace state uploaded to S3 for Async Code Actions

" + "uploadId": { "shape": "UploadId" }, + "programmingLanguage": { "shape": "ProgrammingLanguage" }, + "contextTruncationScheme": { "shape": "ContextTruncationScheme" } + } + }, + "timeBetweenChunks": { + "type": "list", + "member": { "shape": "Double" }, + "max": 100, + "min": 0 } } } diff --git a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts index d9e23fbe891..ff2001d19c5 100644 --- a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts +++ b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts @@ -14,11 +14,15 @@ import { featureDevScheme } from '../../constants' import { CodeIterationLimitError, ContentLengthError, + EmptyPatchException, + GuardrailsException, MonthlyConversationLimitError, PlanIterationLimitError, PrepareRepoFailedError, + PromptRefusalException, SelectedFolderNotInWorkspaceFolderError, TabIdNotFoundError, + ThrottlingException, UploadCodeError, UserMessageNotFoundError, WorkspaceFolderNotFoundError, @@ -263,7 +267,10 @@ export class FeatureDevController { ], }) break - + case GuardrailsException.name: + case PromptRefusalException.name: + case EmptyPatchException.name: + case ThrottlingException.name: case UploadCodeError.name: case UserMessageNotFoundError.name: case TabIdNotFoundError.name: diff --git a/packages/core/src/amazonqFeatureDev/errors.ts b/packages/core/src/amazonqFeatureDev/errors.ts index 782e3b327d8..40d3011c47a 100644 --- a/packages/core/src/amazonqFeatureDev/errors.ts +++ b/packages/core/src/amazonqFeatureDev/errors.ts @@ -57,6 +57,44 @@ export class SelectedFolderNotInWorkspaceFolderError extends ToolkitError { } } +export class GuardrailsException extends ToolkitError { + constructor() { + super("I'm sorry, I'm having trouble generating your code. Please try again. ", { + code: 'GuardrailsException', + }) + } +} + +export class PromptRefusalException extends ToolkitError { + constructor() { + super( + 'I\'m sorry, I can\'t generate code for your request. Please make sure your message and code files comply with the AWS Responsible AI Policy.', + { + code: 'PromptRefusalException', + } + ) + } +} + +export class EmptyPatchException extends ToolkitError { + constructor() { + super("I'm sorry, I'm having trouble generating your code. Please try again.", { + code: 'EmptyPatchException', + }) + } +} + +export class ThrottlingException extends ToolkitError { + constructor() { + super( + "I'm sorry, I'm experiencing high demand at the moment and can't generate your code. This attempt won't count toward usage limits. Please try again.", + { + code: 'ThrottlingException', + } + ) + } +} + export class PrepareRepoFailedError extends ToolkitError { constructor() { super('Sorry, I ran into an issue while trying to upload your code. Please try again.', { diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index 6a59d7f1c23..50250289edf 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -13,7 +13,14 @@ import { telemetry } from '../../shared/telemetry/telemetry' import { VirtualFileSystem } from '../../shared/virtualFilesystem' import { VirtualMemoryFile } from '../../shared/virtualMemoryFile' import { featureDevScheme } from '../constants' -import { IllegalStateTransition, UserMessageNotFoundError } from '../errors' +import { + EmptyPatchException, + GuardrailsException, + IllegalStateTransition, + PromptRefusalException, + ThrottlingException, + UserMessageNotFoundError, +} from '../errors' import { CodeGenerationStatus, CurrentWsFolders, @@ -274,16 +281,23 @@ abstract class CodeGenBase { case CodeGenerationStatus.PREDICT_FAILED: case CodeGenerationStatus.DEBATE_FAILED: case CodeGenerationStatus.FAILED: { - /** - * - * TODO: Here we need to implement the granular error handling for - * Code generation GuardrailsException - Code generation PromptRefusalException - Code generation EmptyPatchException - Code generation ThrottlingException - * - * */ - throw new ToolkitError('Code generation failed', { code: 'CodeGenFailed' }) + switch (true) { + case codegenResult.codeGenerationStatusDetail?.includes('Guardrails'): { + throw new GuardrailsException() + } + case codegenResult.codeGenerationStatusDetail?.includes('PromptRefusal'): { + throw new PromptRefusalException() + } + case codegenResult.codeGenerationStatusDetail?.includes('EmptyPatch'): { + throw new EmptyPatchException() + } + case codegenResult.codeGenerationStatusDetail?.includes('Throttling'): { + throw new ThrottlingException() + } + default: { + throw new ToolkitError('Code generation failed', { code: 'CodeGenFailed' }) + } + } } default: { const errorMessage = `Unknown status: ${codegenResult.codeGenerationStatus.status}\n` From 47fded5076a52b535d03904861937b3b06f81556 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Tue, 9 Jul 2024 11:03:49 -0400 Subject: [PATCH 04/13] refactor(amazonqFeatureDev): add 0 retries for PromptRefusalException to allow user redefine the prompt --- .../src/amazonqFeatureDev/controllers/chat/controller.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts index ff2001d19c5..4494a2a70e5 100644 --- a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts +++ b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts @@ -267,8 +267,11 @@ export class FeatureDevController { ], }) break - case GuardrailsException.name: case PromptRefusalException.name: + this.messenger.sendErrorMessage(errorMessage, message.tabID, 0, session?.conversationIdUnsafe, true) + break + + case GuardrailsException.name: case EmptyPatchException.name: case ThrottlingException.name: case UploadCodeError.name: From 1e9e13fbaec0e3b7e632b6aa1c5c82a1de74aa69 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Tue, 9 Jul 2024 11:12:30 -0400 Subject: [PATCH 05/13] fix(amazonqFeatureDev): fix lint for sessionState file --- .../amazonqFeatureDev/session/sessionState.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index 50250289edf..d861a686fa7 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -49,7 +49,10 @@ export class ConversationNotStartedState implements Omit { public tokenSource: vscode.CancellationTokenSource public readonly phase = DevPhase.APPROACH - constructor(private config: Omit, public approach: string, public tabID: string) { + constructor( + private config: Omit, + public approach: string, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() } @@ -232,7 +239,10 @@ abstract class CodeGenBase { public readonly conversationId: string public readonly uploadId: string - constructor(protected config: SessionStateConfig, public tabID: string) { + constructor( + protected config: SessionStateConfig, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() this.conversationId = config.conversationId this.uploadId = config.uploadId @@ -394,7 +404,11 @@ export class MockCodeGenState implements SessionState { public readonly conversationId: string public readonly uploadId: string - constructor(private config: SessionStateConfig, public approach: string, public tabID: string) { + constructor( + private config: SessionStateConfig, + public approach: string, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() this.filePaths = [] this.deletedFiles = [] From d3b144c377f08d4bea7508e5fef4170e4b3296d2 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Wed, 10 Jul 2024 13:05:58 -0400 Subject: [PATCH 06/13] refactor(amazonqFeatureDev): include FeatureDevServiceError instead of new 3 error types --- .../controllers/chat/controller.ts | 8 +--- packages/core/src/amazonqFeatureDev/errors.ts | 27 ++---------- .../amazonqFeatureDev/session/sessionState.ts | 41 ++++++++----------- 3 files changed, 22 insertions(+), 54 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts index 4494a2a70e5..35a262cad37 100644 --- a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts +++ b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts @@ -14,15 +14,13 @@ import { featureDevScheme } from '../../constants' import { CodeIterationLimitError, ContentLengthError, - EmptyPatchException, - GuardrailsException, + FeatureDevServiceError, MonthlyConversationLimitError, PlanIterationLimitError, PrepareRepoFailedError, PromptRefusalException, SelectedFolderNotInWorkspaceFolderError, TabIdNotFoundError, - ThrottlingException, UploadCodeError, UserMessageNotFoundError, WorkspaceFolderNotFoundError, @@ -271,9 +269,7 @@ export class FeatureDevController { this.messenger.sendErrorMessage(errorMessage, message.tabID, 0, session?.conversationIdUnsafe, true) break - case GuardrailsException.name: - case EmptyPatchException.name: - case ThrottlingException.name: + case FeatureDevServiceError.name: case UploadCodeError.name: case UserMessageNotFoundError.name: case TabIdNotFoundError.name: diff --git a/packages/core/src/amazonqFeatureDev/errors.ts b/packages/core/src/amazonqFeatureDev/errors.ts index 40d3011c47a..c386f25d49f 100644 --- a/packages/core/src/amazonqFeatureDev/errors.ts +++ b/packages/core/src/amazonqFeatureDev/errors.ts @@ -57,14 +57,6 @@ export class SelectedFolderNotInWorkspaceFolderError extends ToolkitError { } } -export class GuardrailsException extends ToolkitError { - constructor() { - super("I'm sorry, I'm having trouble generating your code. Please try again. ", { - code: 'GuardrailsException', - }) - } -} - export class PromptRefusalException extends ToolkitError { constructor() { super( @@ -76,22 +68,9 @@ export class PromptRefusalException extends ToolkitError { } } -export class EmptyPatchException extends ToolkitError { - constructor() { - super("I'm sorry, I'm having trouble generating your code. Please try again.", { - code: 'EmptyPatchException', - }) - } -} - -export class ThrottlingException extends ToolkitError { - constructor() { - super( - "I'm sorry, I'm experiencing high demand at the moment and can't generate your code. This attempt won't count toward usage limits. Please try again.", - { - code: 'ThrottlingException', - } - ) +export class FeatureDevServiceError extends ToolkitError { + constructor(message: string, code: string) { + super(message, { code }) } } diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index d861a686fa7..5021bb6cb74 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -14,11 +14,9 @@ import { VirtualFileSystem } from '../../shared/virtualFilesystem' import { VirtualMemoryFile } from '../../shared/virtualMemoryFile' import { featureDevScheme } from '../constants' import { - EmptyPatchException, - GuardrailsException, + FeatureDevServiceError, IllegalStateTransition, PromptRefusalException, - ThrottlingException, UserMessageNotFoundError, } from '../errors' import { @@ -49,10 +47,7 @@ export class ConversationNotStartedState implements Omit { public tokenSource: vscode.CancellationTokenSource public readonly phase = DevPhase.APPROACH - constructor( - private config: Omit, - public approach: string, - public tabID: string - ) { + constructor(private config: Omit, public approach: string, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() } @@ -239,10 +230,7 @@ abstract class CodeGenBase { public readonly conversationId: string public readonly uploadId: string - constructor( - protected config: SessionStateConfig, - public tabID: string - ) { + constructor(protected config: SessionStateConfig, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() this.conversationId = config.conversationId this.uploadId = config.uploadId @@ -293,16 +281,25 @@ abstract class CodeGenBase { case CodeGenerationStatus.FAILED: { switch (true) { case codegenResult.codeGenerationStatusDetail?.includes('Guardrails'): { - throw new GuardrailsException() + throw new FeatureDevServiceError( + "I'm sorry, I'm having trouble generating your code. Please try again.", + 'GuardrailsException' + ) } case codegenResult.codeGenerationStatusDetail?.includes('PromptRefusal'): { throw new PromptRefusalException() } case codegenResult.codeGenerationStatusDetail?.includes('EmptyPatch'): { - throw new EmptyPatchException() + throw new FeatureDevServiceError( + "I'm sorry, I'm having trouble generating your code. Please try again.", + 'EmptyPatchException' + ) } case codegenResult.codeGenerationStatusDetail?.includes('Throttling'): { - throw new ThrottlingException() + throw new FeatureDevServiceError( + "I'm sorry, I'm experiencing high demand at the moment and can't generate your code. This attempt won't count toward usage limits. Please try again.", + 'ThrottlingException' + ) } default: { throw new ToolkitError('Code generation failed', { code: 'CodeGenFailed' }) @@ -404,11 +401,7 @@ export class MockCodeGenState implements SessionState { public readonly conversationId: string public readonly uploadId: string - constructor( - private config: SessionStateConfig, - public approach: string, - public tabID: string - ) { + constructor(private config: SessionStateConfig, public approach: string, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() this.filePaths = [] this.deletedFiles = [] From 3f6f0d33e916306ecdb3b5406284468d6a3892ca Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Wed, 10 Jul 2024 13:07:34 -0400 Subject: [PATCH 07/13] refactor(amazonqFeatureDev): remove duplication in switch mapping for error handling --- .../core/src/amazonqFeatureDev/controllers/chat/controller.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts index 35a262cad37..e3e35d64a6a 100644 --- a/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts +++ b/packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts @@ -265,9 +265,6 @@ export class FeatureDevController { ], }) break - case PromptRefusalException.name: - this.messenger.sendErrorMessage(errorMessage, message.tabID, 0, session?.conversationIdUnsafe, true) - break case FeatureDevServiceError.name: case UploadCodeError.name: @@ -281,6 +278,7 @@ export class FeatureDevController { session?.conversationIdUnsafe ) break + case PromptRefusalException.name: case ZipFileError.name: this.messenger.sendErrorMessage(errorMessage, message.tabID, 0, session?.conversationIdUnsafe, true) break From 3a42fc7d76860230e23c2eabe386ce6d4c259430 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Wed, 10 Jul 2024 13:18:14 -0400 Subject: [PATCH 08/13] fix(amazonqFeatureDev): eslint for session file --- .../amazonqFeatureDev/session/sessionState.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index 5021bb6cb74..e75f29d1cb7 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -47,7 +47,10 @@ export class ConversationNotStartedState implements Omit { public tokenSource: vscode.CancellationTokenSource public readonly phase = DevPhase.APPROACH - constructor(private config: Omit, public approach: string, public tabID: string) { + constructor( + private config: Omit, + public approach: string, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() } @@ -230,7 +237,10 @@ abstract class CodeGenBase { public readonly conversationId: string public readonly uploadId: string - constructor(protected config: SessionStateConfig, public tabID: string) { + constructor( + protected config: SessionStateConfig, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() this.conversationId = config.conversationId this.uploadId = config.uploadId @@ -401,7 +411,11 @@ export class MockCodeGenState implements SessionState { public readonly conversationId: string public readonly uploadId: string - constructor(private config: SessionStateConfig, public approach: string, public tabID: string) { + constructor( + private config: SessionStateConfig, + public approach: string, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() this.filePaths = [] this.deletedFiles = [] From a614ae4b212f05decfee68d3eef945ee194bc9ca Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Thu, 11 Jul 2024 09:50:05 -0400 Subject: [PATCH 09/13] chore(amazonqFeatureDev): include changelog message --- .../Bug Fix-9b858707-a679-437f-b2f4-c3163d80e1b7.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 packages/amazonq/.changes/next-release/Bug Fix-9b858707-a679-437f-b2f4-c3163d80e1b7.json diff --git a/packages/amazonq/.changes/next-release/Bug Fix-9b858707-a679-437f-b2f4-c3163d80e1b7.json b/packages/amazonq/.changes/next-release/Bug Fix-9b858707-a679-437f-b2f4-c3163d80e1b7.json new file mode 100644 index 00000000000..1e4b04f2701 --- /dev/null +++ b/packages/amazonq/.changes/next-release/Bug Fix-9b858707-a679-437f-b2f4-c3163d80e1b7.json @@ -0,0 +1,4 @@ +{ + "type": "Bug Fix", + "description": "Amazon q /dev: include granular error handling for code generation failed state" +} From dbd6861881c26691a6abf18969ccbda30f3ac8f0 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Thu, 11 Jul 2024 16:56:23 -0400 Subject: [PATCH 10/13] chore(amazonqFeatureDev): include updated codewhispererruntime --- .../codewhispererruntime-2022-11-11.json | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json b/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json index ee8ab093446..c8690b720ee 100644 --- a/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json +++ b/packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json @@ -1017,20 +1017,12 @@ "type": "structure", "required": ["conversationId", "codeGenerationStatus"], "members": { - "conversationId": { - "shape": "ConversationId" - }, - "codeGenerationStatus": { - "shape": "CodeGenerationStatus" - }, - "codeGenerationRemainingIterationCount": { - "shape": "Integer" - }, - "codeGenerationTotalIterationCount": { - "shape": "Integer" - } - }, - "documentation": "

Response for getting task assist code generation status.

" + "conversationId": { "shape": "ConversationId" }, + "codeGenerationStatus": { "shape": "CodeGenerationStatus" }, + "codeGenerationStatusDetail": { "shape": "CodeGenerationStatusDetail" }, + "codeGenerationRemainingIterationCount": { "shape": "Integer" }, + "codeGenerationTotalIterationCount": { "shape": "Integer" } + } }, "GetTransformationPlanRequest": { "type": "structure", From 9c245630af55dadc019f39a585bec87a999d3b43 Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Mon, 15 Jul 2024 14:30:11 -0400 Subject: [PATCH 11/13] fix(amazonqFeatureDev): fix lint --- .../amazonqFeatureDev/session/sessionState.ts | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index 672d06d37e8..29902a0b371 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -47,10 +47,7 @@ export class ConversationNotStartedState implements Omit { public tokenSource: vscode.CancellationTokenSource public readonly phase = DevPhase.APPROACH - constructor( - private config: Omit, - public approach: string, - public tabID: string - ) { + constructor(private config: Omit, public approach: string, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() } @@ -237,10 +230,7 @@ abstract class CodeGenBase { public readonly conversationId: string public readonly uploadId: string - constructor( - protected config: SessionStateConfig, - public tabID: string - ) { + constructor(protected config: SessionStateConfig, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() this.conversationId = config.conversationId this.uploadId = config.uploadId @@ -290,7 +280,7 @@ abstract class CodeGenBase { } case CodeGenerationStatus.PREDICT_READY: case CodeGenerationStatus.IN_PROGRESS: { - await new Promise(f => globals.clock.setTimeout(f, this.requestDelay)) + await new Promise((f) => globals.clock.setTimeout(f, this.requestDelay)) break } case CodeGenerationStatus.PREDICT_FAILED: @@ -425,11 +415,7 @@ export class MockCodeGenState implements SessionState { public readonly conversationId: string public readonly uploadId: string - constructor( - private config: SessionStateConfig, - public approach: string, - public tabID: string - ) { + constructor(private config: SessionStateConfig, public approach: string, public tabID: string) { this.tokenSource = new vscode.CancellationTokenSource() this.filePaths = [] this.deletedFiles = [] From 371974181237e0446ead9a5cf53393bdc54118cb Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Mon, 15 Jul 2024 14:53:09 -0400 Subject: [PATCH 12/13] chore(amazonqFeatureDev): fix eslint in sessionState --- .../amazonqFeatureDev/session/sessionState.ts | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index 29902a0b371..ff5dd5d1b67 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -47,7 +47,10 @@ export class ConversationNotStartedState implements Omit { public tokenSource: vscode.CancellationTokenSource public readonly phase = DevPhase.APPROACH - constructor(private config: Omit, public approach: string, public tabID: string) { + constructor( + private config: Omit, + public approach: string, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() } @@ -230,7 +237,10 @@ abstract class CodeGenBase { public readonly conversationId: string public readonly uploadId: string - constructor(protected config: SessionStateConfig, public tabID: string) { + constructor( + protected config: SessionStateConfig, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() this.conversationId = config.conversationId this.uploadId = config.uploadId @@ -415,7 +425,11 @@ export class MockCodeGenState implements SessionState { public readonly conversationId: string public readonly uploadId: string - constructor(private config: SessionStateConfig, public approach: string, public tabID: string) { + constructor( + private config: SessionStateConfig, + public approach: string, + public tabID: string + ) { this.tokenSource = new vscode.CancellationTokenSource() this.filePaths = [] this.deletedFiles = [] From 81c0ea9a2643cc435cf4f1f2a9941f253c0b501d Mon Sep 17 00:00:00 2001 From: Thiago Verney Date: Mon, 15 Jul 2024 18:44:23 -0400 Subject: [PATCH 13/13] refactor(amazonqFeatureDev): remove dup string and share in a default error const --- packages/core/src/amazonqFeatureDev/errors.ts | 2 ++ .../src/amazonqFeatureDev/session/sessionState.ts | 11 +++-------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/core/src/amazonqFeatureDev/errors.ts b/packages/core/src/amazonqFeatureDev/errors.ts index da15a878836..162e8537e0d 100644 --- a/packages/core/src/amazonqFeatureDev/errors.ts +++ b/packages/core/src/amazonqFeatureDev/errors.ts @@ -7,6 +7,8 @@ import { ToolkitError } from '../shared/errors' import { featureName } from './constants' import { uploadCodeError } from './userFacingText' +export const CodeGenerationDefaultError = "I'm sorry, I'm having trouble generating your code." + export class ConversationIdNotFoundError extends ToolkitError { constructor() { super('Conversation id must exist before starting code generation', { code: 'ConversationIdNotFound' }) diff --git a/packages/core/src/amazonqFeatureDev/session/sessionState.ts b/packages/core/src/amazonqFeatureDev/session/sessionState.ts index ff5dd5d1b67..1b7f7c6151b 100644 --- a/packages/core/src/amazonqFeatureDev/session/sessionState.ts +++ b/packages/core/src/amazonqFeatureDev/session/sessionState.ts @@ -14,6 +14,7 @@ import { VirtualFileSystem } from '../../shared/virtualFilesystem' import { VirtualMemoryFile } from '../../shared/virtualMemoryFile' import { featureDevScheme } from '../constants' import { + CodeGenerationDefaultError, FeatureDevServiceError, IllegalStateTransition, PromptRefusalException, @@ -298,19 +299,13 @@ abstract class CodeGenBase { case CodeGenerationStatus.FAILED: { switch (true) { case codegenResult.codeGenerationStatusDetail?.includes('Guardrails'): { - throw new FeatureDevServiceError( - "I'm sorry, I'm having trouble generating your code. Please try again.", - 'GuardrailsException' - ) + throw new FeatureDevServiceError(CodeGenerationDefaultError, 'GuardrailsException') } case codegenResult.codeGenerationStatusDetail?.includes('PromptRefusal'): { throw new PromptRefusalException() } case codegenResult.codeGenerationStatusDetail?.includes('EmptyPatch'): { - throw new FeatureDevServiceError( - "I'm sorry, I'm having trouble generating your code. Please try again.", - 'EmptyPatchException' - ) + throw new FeatureDevServiceError(CodeGenerationDefaultError, 'EmptyPatchException') } case codegenResult.codeGenerationStatusDetail?.includes('Throttling'): { throw new FeatureDevServiceError(