From d35bb9ed4ab24d4b1bbd2a0ece69464de8143b44 Mon Sep 17 00:00:00 2001
From: Tai Lai
Date: Fri, 14 Mar 2025 21:47:53 -0700
Subject: [PATCH 1/4] wip
---
.../codewhisperer/client/user-service-2.json | 717 +++++++++++++++++-
.../codewhispererChat/clients/chat/v0/chat.ts | 2 +-
.../controllers/chat/chatRequest/converter.ts | 2 +
.../@amzn/codewhisperer-streaming/README.md | 56 +-
.../commands/ExportResultArchiveCommand.ts | 1 +
.../GenerateAssistantResponseCommand.ts | 43 ++
.../commands/GenerateTaskAssistPlanCommand.ts | 44 ++
.../src/commands/SendMessageCommand.ts | 43 ++
.../src/models/models_0.ts | 445 +++++++++--
.../src/protocols/Aws_restJson1.ts | 109 ++-
10 files changed, 1345 insertions(+), 117 deletions(-)
diff --git a/packages/core/src/codewhisperer/client/user-service-2.json b/packages/core/src/codewhisperer/client/user-service-2.json
index ed7661bec4c..986b4d465b0 100644
--- a/packages/core/src/codewhisperer/client/user-service-2.json
+++ b/packages/core/src/codewhisperer/client/user-service-2.json
@@ -66,6 +66,23 @@
"documentation": "Creates a pre-signed, S3 write URL for uploading a repository zip archive.
",
"idempotent": true
},
+ "CreateWorkspace": {
+ "name": "CreateWorkspace",
+ "http": {
+ "method": "POST",
+ "requestUri": "/"
+ },
+ "input": { "shape": "CreateWorkspaceRequest" },
+ "output": { "shape": "CreateWorkspaceResponse" },
+ "errors": [
+ { "shape": "ThrottlingException" },
+ { "shape": "ConflictException" },
+ { "shape": "InternalServerException" },
+ { "shape": "ValidationException" },
+ { "shape": "AccessDeniedException" }
+ ],
+ "documentation": "Create a workspace based on a workspace root
"
+ },
"DeleteTaskAssistConversation": {
"name": "DeleteTaskAssistConversation",
"http": {
@@ -83,6 +100,22 @@
],
"documentation": "API to delete task assist conversation.
"
},
+ "DeleteWorkspace": {
+ "name": "DeleteWorkspace",
+ "http": {
+ "method": "POST",
+ "requestUri": "/"
+ },
+ "input": { "shape": "DeleteWorkspaceRequest" },
+ "output": { "shape": "DeleteWorkspaceResponse" },
+ "errors": [
+ { "shape": "ThrottlingException" },
+ { "shape": "InternalServerException" },
+ { "shape": "ValidationException" },
+ { "shape": "AccessDeniedException" }
+ ],
+ "documentation": "Delete a workspace based on a workspaceId
"
+ },
"GenerateCompletions": {
"name": "GenerateCompletions",
"http": {
@@ -215,6 +248,21 @@
{ "shape": "AccessDeniedException" }
]
},
+ "ListAvailableProfiles": {
+ "name": "ListAvailableProfiles",
+ "http": {
+ "method": "POST",
+ "requestUri": "/"
+ },
+ "input": { "shape": "ListAvailableProfilesRequest" },
+ "output": { "shape": "ListAvailableProfilesResponse" },
+ "errors": [
+ { "shape": "ThrottlingException" },
+ { "shape": "InternalServerException" },
+ { "shape": "ValidationException" },
+ { "shape": "AccessDeniedException" }
+ ]
+ },
"ListCodeAnalysisFindings": {
"name": "ListCodeAnalysisFindings",
"http": {
@@ -248,6 +296,22 @@
],
"documentation": "Return configruations for each feature that has been setup for A/B testing.
"
},
+ "ListWorkspaceMetadata": {
+ "name": "ListWorkspaceMetadata",
+ "http": {
+ "method": "POST",
+ "requestUri": "/"
+ },
+ "input": { "shape": "ListWorkspaceMetadataRequest" },
+ "output": { "shape": "ListWorkspaceMetadataResponse" },
+ "errors": [
+ { "shape": "ThrottlingException" },
+ { "shape": "InternalServerException" },
+ { "shape": "ValidationException" },
+ { "shape": "AccessDeniedException" }
+ ],
+ "documentation": "List workspace metadata based on a workspace root
"
+ },
"ResumeTransformation": {
"name": "ResumeTransformation",
"http": {
@@ -404,6 +468,57 @@
"documentation": "Reason for AccessDeniedException
",
"enum": ["UNAUTHORIZED_CUSTOMIZATION_RESOURCE_ACCESS"]
},
+ "ActiveFunctionalityList": {
+ "type": "list",
+ "member": { "shape": "FunctionalityName" },
+ "max": 10,
+ "min": 0
+ },
+ "AdditionalContentEntry": {
+ "type": "structure",
+ "required": ["name", "description"],
+ "members": {
+ "name": {
+ "shape": "AdditionalContentEntryNameString",
+ "documentation": "The name/identifier for this context entry
"
+ },
+ "description": {
+ "shape": "AdditionalContentEntryDescriptionString",
+ "documentation": "A description of what this context entry represents
"
+ },
+ "innerContext": {
+ "shape": "AdditionalContentEntryInnerContextString",
+ "documentation": "The actual contextual content
"
+ }
+ },
+ "documentation": "Structure representing a single entry of additional contextual content
"
+ },
+ "AdditionalContentEntryDescriptionString": {
+ "type": "string",
+ "max": 1024,
+ "min": 1,
+ "sensitive": true
+ },
+ "AdditionalContentEntryInnerContextString": {
+ "type": "string",
+ "max": 8192,
+ "min": 1,
+ "sensitive": true
+ },
+ "AdditionalContentEntryNameString": {
+ "type": "string",
+ "max": 1024,
+ "min": 1,
+ "pattern": "[a-z]+(?:-[a-z0-9]+)*",
+ "sensitive": true
+ },
+ "AdditionalContentList": {
+ "type": "list",
+ "member": { "shape": "AdditionalContentEntry" },
+ "documentation": "A list of additional content entries, limited to 20 items
",
+ "max": 20,
+ "min": 0
+ },
"AppStudioState": {
"type": "structure",
"required": ["namespace", "propertyName", "propertyContext"],
@@ -451,6 +566,20 @@
"min": 0,
"sensitive": true
},
+ "ApplicationProperties": {
+ "type": "structure",
+ "required": ["tenantId", "applicationArn", "tenantUrl", "applicationType"],
+ "members": {
+ "tenantId": { "shape": "TenantId" },
+ "applicationArn": { "shape": "ResourceArn" },
+ "tenantUrl": { "shape": "Url" },
+ "applicationType": { "shape": "FunctionalityName" }
+ }
+ },
+ "ApplicationPropertiesList": {
+ "type": "list",
+ "member": { "shape": "ApplicationProperties" }
+ },
"ArtifactId": {
"type": "string",
"max": 126,
@@ -488,13 +617,17 @@
"followupPrompt": {
"shape": "FollowupPrompt",
"documentation": "Followup Prompt
"
+ },
+ "toolUses": {
+ "shape": "ToolUses",
+ "documentation": "ToolUse Request
"
}
},
"documentation": "Markdown text message.
"
},
"AssistantResponseMessageContentString": {
"type": "string",
- "max": 4096,
+ "max": 100000,
"min": 0,
"sensitive": true
},
@@ -508,6 +641,14 @@
"type": "boolean",
"box": true
},
+ "ByUserAnalytics": {
+ "type": "structure",
+ "required": ["toggle"],
+ "members": {
+ "s3Uri": { "shape": "S3Uri" },
+ "toggle": { "shape": "OptInFeatureToggle" }
+ }
+ },
"ChatAddMessageEvent": {
"type": "structure",
"required": ["conversationId", "messageId"],
@@ -532,7 +673,7 @@
"type": "list",
"member": { "shape": "ChatMessage" },
"documentation": "Indicates Participant in Chat conversation
",
- "max": 10,
+ "max": 100,
"min": 0
},
"ChatInteractWithMessageEvent": {
@@ -596,6 +737,11 @@
"hasProjectLevelContext": { "shape": "Boolean" }
}
},
+ "ClientId": {
+ "type": "string",
+ "max": 255,
+ "min": 1
+ },
"CodeAnalysisFindingsSchema": {
"type": "string",
"enum": ["codeanalysis/findings/1.0"]
@@ -868,7 +1014,9 @@
},
"CreateTaskAssistConversationRequest": {
"type": "structure",
- "members": {},
+ "members": {
+ "profileArn": { "shape": "ProfileArn" }
+ },
"documentation": "Structure to represent bootstrap conversation request.
"
},
"CreateTaskAssistConversationResponse": {
@@ -889,7 +1037,8 @@
"artifactType": { "shape": "ArtifactType" },
"uploadIntent": { "shape": "UploadIntent" },
"uploadContext": { "shape": "UploadContext" },
- "uploadId": { "shape": "UploadId" }
+ "uploadId": { "shape": "UploadId" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"CreateUploadUrlRequestContentChecksumString": {
@@ -919,6 +1068,26 @@
"requestHeaders": { "shape": "RequestHeaders" }
}
},
+ "CreateWorkspaceRequest": {
+ "type": "structure",
+ "required": ["workspaceRoot"],
+ "members": {
+ "workspaceRoot": { "shape": "CreateWorkspaceRequestWorkspaceRootString" },
+ "profileArn": { "shape": "ProfileArn" }
+ }
+ },
+ "CreateWorkspaceRequestWorkspaceRootString": {
+ "type": "string",
+ "max": 1024,
+ "min": 1
+ },
+ "CreateWorkspaceResponse": {
+ "type": "structure",
+ "required": ["workspace"],
+ "members": {
+ "workspace": { "shape": "WorkspaceMetadata" }
+ }
+ },
"CursorState": {
"type": "structure",
"members": {
@@ -959,11 +1128,19 @@
"type": "list",
"member": { "shape": "Customization" }
},
+ "DashboardAnalytics": {
+ "type": "structure",
+ "required": ["toggle"],
+ "members": {
+ "toggle": { "shape": "OptInFeatureToggle" }
+ }
+ },
"DeleteTaskAssistConversationRequest": {
"type": "structure",
"required": ["conversationId"],
"members": {
- "conversationId": { "shape": "ConversationId" }
+ "conversationId": { "shape": "ConversationId" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent bootstrap conversation request.
"
},
@@ -975,6 +1152,18 @@
},
"documentation": "Structure to represent bootstrap conversation response.
"
},
+ "DeleteWorkspaceRequest": {
+ "type": "structure",
+ "required": ["workspaceId"],
+ "members": {
+ "workspaceId": { "shape": "UUID" },
+ "profileArn": { "shape": "ProfileArn" }
+ }
+ },
+ "DeleteWorkspaceResponse": {
+ "type": "structure",
+ "members": {}
+ },
"Description": {
"type": "string",
"max": 256,
@@ -1282,6 +1471,19 @@
"max": 100,
"min": 0
},
+ "ErrorDetails": {
+ "type": "string",
+ "max": 2048,
+ "min": 0
+ },
+ "ExternalIdentityDetails": {
+ "type": "structure",
+ "members": {
+ "issuerUrl": { "shape": "IssuerUrl" },
+ "clientId": { "shape": "ClientId" },
+ "scimEndpoint": { "shape": "String" }
+ }
+ },
"FeatureDevCodeAcceptanceEvent": {
"type": "structure",
"required": ["conversationId", "linesOfCodeAccepted", "charactersOfCodeAccepted"],
@@ -1418,6 +1620,20 @@
"min": 0,
"sensitive": true
},
+ "FunctionalityName": {
+ "type": "string",
+ "enum": [
+ "COMPLETIONS",
+ "ANALYSIS",
+ "CONVERSATIONS",
+ "TASK_ASSIST",
+ "TRANSFORMATIONS",
+ "CHAT_CUSTOMIZATION",
+ "TRANSFORMATIONS_WEBAPP"
+ ],
+ "max": 64,
+ "min": 1
+ },
"GenerateCompletionsRequest": {
"type": "structure",
"required": ["fileContext"],
@@ -1430,7 +1646,8 @@
"customizationArn": { "shape": "CustomizationArn" },
"optOutPreference": { "shape": "OptOutPreference" },
"userContext": { "shape": "UserContext" },
- "profileArn": { "shape": "ProfileArn" }
+ "profileArn": { "shape": "ProfileArn" },
+ "workspaceId": { "shape": "UUID" }
}
},
"GenerateCompletionsRequestMaxResultsInteger": {
@@ -1457,7 +1674,8 @@
"type": "structure",
"required": ["jobId"],
"members": {
- "jobId": { "shape": "GetCodeAnalysisRequestJobIdString" }
+ "jobId": { "shape": "GetCodeAnalysisRequestJobIdString" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"GetCodeAnalysisRequestJobIdString": {
@@ -1477,7 +1695,8 @@
"type": "structure",
"required": ["jobId"],
"members": {
- "jobId": { "shape": "GetCodeFixJobRequestJobIdString" }
+ "jobId": { "shape": "GetCodeFixJobRequestJobIdString" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"GetCodeFixJobRequestJobIdString": {
@@ -1498,7 +1717,8 @@
"required": ["conversationId", "codeGenerationId"],
"members": {
"conversationId": { "shape": "ConversationId" },
- "codeGenerationId": { "shape": "CodeGenerationId" }
+ "codeGenerationId": { "shape": "CodeGenerationId" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Request for getting task assist code generation.
"
},
@@ -1519,7 +1739,8 @@
"required": ["testGenerationJobGroupName", "testGenerationJobId"],
"members": {
"testGenerationJobGroupName": { "shape": "TestGenerationJobGroupName" },
- "testGenerationJobId": { "shape": "UUID" }
+ "testGenerationJobId": { "shape": "UUID" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent get test generation request.
"
},
@@ -1534,7 +1755,8 @@
"type": "structure",
"required": ["transformationJobId"],
"members": {
- "transformationJobId": { "shape": "TransformationJobId" }
+ "transformationJobId": { "shape": "TransformationJobId" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent get code transformation plan request.
"
},
@@ -1550,7 +1772,8 @@
"type": "structure",
"required": ["transformationJobId"],
"members": {
- "transformationJobId": { "shape": "TransformationJobId" }
+ "transformationJobId": { "shape": "TransformationJobId" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent get code transformation request.
"
},
@@ -1589,6 +1812,47 @@
"max": 256,
"min": 1
},
+ "IdentityDetails": {
+ "type": "structure",
+ "members": {
+ "ssoIdentityDetails": { "shape": "SSOIdentityDetails" },
+ "externalIdentityDetails": { "shape": "ExternalIdentityDetails" }
+ },
+ "union": true
+ },
+ "ImageBlock": {
+ "type": "structure",
+ "required": ["format", "source"],
+ "members": {
+ "format": { "shape": "ImageFormat" },
+ "source": { "shape": "ImageSource" }
+ },
+ "documentation": "Represents the image source itself and the format of the image.
"
+ },
+ "ImageBlocks": {
+ "type": "list",
+ "member": { "shape": "ImageBlock" },
+ "max": 10,
+ "min": 0
+ },
+ "ImageFormat": {
+ "type": "string",
+ "enum": ["png", "jpeg", "gif", "webp"]
+ },
+ "ImageSource": {
+ "type": "structure",
+ "members": {
+ "bytes": { "shape": "ImageSourceBytesBlob" }
+ },
+ "documentation": "Image bytes limited to ~10MB considering overhead of base64 encoding
",
+ "sensitive": true,
+ "union": true
+ },
+ "ImageSourceBytesBlob": {
+ "type": "blob",
+ "max": 1500000,
+ "min": 1
+ },
"Import": {
"type": "structure",
"members": {
@@ -1656,6 +1920,11 @@
"fault": true,
"retryable": { "throttling": false }
},
+ "IssuerUrl": {
+ "type": "string",
+ "max": 255,
+ "min": 1
+ },
"LineRangeList": {
"type": "list",
"member": { "shape": "Range" }
@@ -1664,7 +1933,8 @@
"type": "structure",
"members": {
"maxResults": { "shape": "ListAvailableCustomizationsRequestMaxResultsInteger" },
- "nextToken": { "shape": "Base64EncodedPaginationToken" }
+ "nextToken": { "shape": "Base64EncodedPaginationToken" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"ListAvailableCustomizationsRequestMaxResultsInteger": {
@@ -1681,13 +1951,35 @@
"nextToken": { "shape": "Base64EncodedPaginationToken" }
}
},
+ "ListAvailableProfilesRequest": {
+ "type": "structure",
+ "members": {
+ "maxResults": { "shape": "ListAvailableProfilesRequestMaxResultsInteger" },
+ "nextToken": { "shape": "Base64EncodedPaginationToken" }
+ }
+ },
+ "ListAvailableProfilesRequestMaxResultsInteger": {
+ "type": "integer",
+ "box": true,
+ "max": 10,
+ "min": 1
+ },
+ "ListAvailableProfilesResponse": {
+ "type": "structure",
+ "required": ["profiles"],
+ "members": {
+ "profiles": { "shape": "ProfileList" },
+ "nextToken": { "shape": "Base64EncodedPaginationToken" }
+ }
+ },
"ListCodeAnalysisFindingsRequest": {
"type": "structure",
"required": ["jobId", "codeAnalysisFindingsSchema"],
"members": {
"jobId": { "shape": "ListCodeAnalysisFindingsRequestJobIdString" },
"nextToken": { "shape": "PaginationToken" },
- "codeAnalysisFindingsSchema": { "shape": "CodeAnalysisFindingsSchema" }
+ "codeAnalysisFindingsSchema": { "shape": "CodeAnalysisFindingsSchema" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"ListCodeAnalysisFindingsRequestJobIdString": {
@@ -1707,7 +1999,8 @@
"type": "structure",
"required": ["userContext"],
"members": {
- "userContext": { "shape": "UserContext" }
+ "userContext": { "shape": "UserContext" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"ListFeatureEvaluationsResponse": {
@@ -1717,6 +2010,29 @@
"featureEvaluations": { "shape": "FeatureEvaluationsList" }
}
},
+ "ListWorkspaceMetadataRequest": {
+ "type": "structure",
+ "required": ["workspaceRoot"],
+ "members": {
+ "workspaceRoot": { "shape": "ListWorkspaceMetadataRequestWorkspaceRootString" },
+ "nextToken": { "shape": "String" },
+ "maxResults": { "shape": "Integer" },
+ "profileArn": { "shape": "ProfileArn" }
+ }
+ },
+ "ListWorkspaceMetadataRequestWorkspaceRootString": {
+ "type": "string",
+ "max": 1024,
+ "min": 1
+ },
+ "ListWorkspaceMetadataResponse": {
+ "type": "structure",
+ "required": ["workspaces"],
+ "members": {
+ "workspaces": { "shape": "WorkspaceList" },
+ "nextToken": { "shape": "String" }
+ }
+ },
"Long": {
"type": "long",
"box": true
@@ -1750,16 +2066,65 @@
"min": 1,
"pattern": "[-a-zA-Z0-9._]*"
},
+ "Notifications": {
+ "type": "list",
+ "member": { "shape": "NotificationsFeature" },
+ "max": 10,
+ "min": 0
+ },
+ "NotificationsFeature": {
+ "type": "structure",
+ "required": ["feature", "toggle"],
+ "members": {
+ "feature": { "shape": "FeatureName" },
+ "toggle": { "shape": "OptInFeatureToggle" }
+ }
+ },
"OperatingSystem": {
"type": "string",
"enum": ["MAC", "WINDOWS", "LINUX"],
"max": 64,
"min": 1
},
+ "OptInFeatureToggle": {
+ "type": "string",
+ "enum": ["ON", "OFF"]
+ },
+ "OptInFeatures": {
+ "type": "structure",
+ "members": {
+ "promptLogging": { "shape": "PromptLogging" },
+ "byUserAnalytics": { "shape": "ByUserAnalytics" },
+ "dashboardAnalytics": { "shape": "DashboardAnalytics" },
+ "notifications": { "shape": "Notifications" },
+ "workspaceContext": { "shape": "WorkspaceContext" }
+ }
+ },
"OptOutPreference": {
"type": "string",
"enum": ["OPTIN", "OPTOUT"]
},
+ "Origin": {
+ "type": "string",
+ "documentation": "Enum to represent the origin application conversing with Sidekick.
",
+ "enum": [
+ "CHATBOT",
+ "CONSOLE",
+ "DOCUMENTATION",
+ "MARKETING",
+ "MOBILE",
+ "SERVICE_INTERNAL",
+ "UNIFIED_SEARCH",
+ "UNKNOWN",
+ "MD",
+ "IDE",
+ "SAGE_MAKER",
+ "CLI",
+ "AI_EDITOR",
+ "OPENSEARCH_DASHBOARD",
+ "GITLAB"
+ ]
+ },
"PackageInfo": {
"type": "structure",
"members": {
@@ -1821,12 +2186,56 @@
"sensitive": true
},
"PrimitiveInteger": { "type": "integer" },
+ "Profile": {
+ "type": "structure",
+ "required": ["arn", "profileName"],
+ "members": {
+ "arn": { "shape": "ProfileArn" },
+ "identityDetails": { "shape": "IdentityDetails" },
+ "profileName": { "shape": "ProfileName" },
+ "description": { "shape": "ProfileDescription" },
+ "referenceTrackerConfiguration": { "shape": "ReferenceTrackerConfiguration" },
+ "kmsKeyArn": { "shape": "ResourceArn" },
+ "activeFunctionalities": { "shape": "ActiveFunctionalityList" },
+ "status": { "shape": "ProfileStatus" },
+ "errorDetails": { "shape": "ErrorDetails" },
+ "resourcePolicy": { "shape": "ResourcePolicy" },
+ "profileType": { "shape": "ProfileType" },
+ "optInFeatures": { "shape": "OptInFeatures" },
+ "permissionUpdateRequired": { "shape": "Boolean" },
+ "applicationProperties": { "shape": "ApplicationPropertiesList" }
+ }
+ },
"ProfileArn": {
"type": "string",
"max": 950,
"min": 0,
"pattern": "arn:aws:codewhisperer:[-.a-z0-9]{1,63}:\\d{12}:profile/([a-zA-Z0-9]){12}"
},
+ "ProfileDescription": {
+ "type": "string",
+ "max": 256,
+ "min": 1,
+ "pattern": "[\\sa-zA-Z0-9_-]*"
+ },
+ "ProfileList": {
+ "type": "list",
+ "member": { "shape": "Profile" }
+ },
+ "ProfileName": {
+ "type": "string",
+ "max": 100,
+ "min": 1,
+ "pattern": "[a-zA-Z][a-zA-Z0-9_-]*"
+ },
+ "ProfileStatus": {
+ "type": "string",
+ "enum": ["ACTIVE", "CREATING", "CREATE_FAILED", "UPDATING", "UPDATE_FAILED", "DELETING", "DELETE_FAILED"]
+ },
+ "ProfileType": {
+ "type": "string",
+ "enum": ["Q_DEVELOPER", "CODEWHISPERER"]
+ },
"ProgrammingLanguage": {
"type": "structure",
"required": ["languageName"],
@@ -1845,6 +2254,14 @@
"type": "list",
"member": { "shape": "TransformationProgressUpdate" }
},
+ "PromptLogging": {
+ "type": "structure",
+ "required": ["s3Uri", "toggle"],
+ "members": {
+ "s3Uri": { "shape": "S3Uri" },
+ "toggle": { "shape": "OptInFeatureToggle" }
+ }
+ },
"Range": {
"type": "structure",
"required": ["start", "end"],
@@ -1918,7 +2335,7 @@
"RelevantDocumentList": {
"type": "list",
"member": { "shape": "RelevantTextDocument" },
- "max": 5,
+ "max": 30,
"min": 0
},
"RelevantTextDocument": {
@@ -1952,7 +2369,7 @@
},
"RelevantTextDocumentTextString": {
"type": "string",
- "max": 10240,
+ "max": 40960,
"min": 0,
"sensitive": true
},
@@ -1989,12 +2406,24 @@
"documentation": "This exception is thrown when describing a resource that does not exist.
",
"exception": true
},
+ "ResourcePolicy": {
+ "type": "structure",
+ "required": ["effect"],
+ "members": {
+ "effect": { "shape": "ResourcePolicyEffect" }
+ }
+ },
+ "ResourcePolicyEffect": {
+ "type": "string",
+ "enum": ["ALLOW", "DENY"]
+ },
"ResumeTransformationRequest": {
"type": "structure",
"required": ["transformationJobId"],
"members": {
"transformationJobId": { "shape": "TransformationJobId" },
- "userActionStatus": { "shape": "TransformationUserActionStatus" }
+ "userActionStatus": { "shape": "TransformationUserActionStatus" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent stop code transformation request.
"
},
@@ -2037,6 +2466,27 @@
"min": 0,
"sensitive": true
},
+ "S3Uri": {
+ "type": "string",
+ "max": 1024,
+ "min": 1,
+ "pattern": "s3://((?!xn--)[a-z0-9](?![^/]*[.]{2})[a-z0-9-.]{1,61}[a-z0-9](?Represents span in a text
"
+ "documentation": "Represents span in a text.
"
},
"SpanEndInteger": {
"type": "integer",
@@ -2176,7 +2632,8 @@
"idempotencyToken": true
},
"scope": { "shape": "CodeAnalysisScope" },
- "codeScanName": { "shape": "CodeScanName" }
+ "codeScanName": { "shape": "CodeScanName" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"StartCodeAnalysisRequestClientTokenString": {
@@ -2206,7 +2663,9 @@
"uploadId": { "shape": "UploadId" },
"description": { "shape": "StartCodeFixJobRequestDescriptionString" },
"ruleId": { "shape": "StartCodeFixJobRequestRuleIdString" },
- "codeFixName": { "shape": "CodeFixName" }
+ "codeFixName": { "shape": "CodeFixName" },
+ "referenceTrackerConfiguration": { "shape": "ReferenceTrackerConfiguration" },
+ "profileArn": { "shape": "ProfileArn" }
}
},
"StartCodeFixJobRequestDescriptionString": {
@@ -2244,7 +2703,8 @@
"codeGenerationId": { "shape": "CodeGenerationId" },
"currentCodeGenerationId": { "shape": "CodeGenerationId" },
"intent": { "shape": "Intent" },
- "intentContext": { "shape": "IntentContext" }
+ "intentContext": { "shape": "IntentContext" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent start code generation request.
"
},
@@ -2271,7 +2731,9 @@
"clientToken": {
"shape": "StartTestGenerationRequestClientTokenString",
"idempotencyToken": true
- }
+ },
+ "profileArn": { "shape": "ProfileArn" },
+ "referenceTrackerConfiguration": { "shape": "ReferenceTrackerConfiguration" }
},
"documentation": "Structure to represent test generation request.
"
},
@@ -2298,7 +2760,8 @@
"required": ["workspaceState", "transformationSpec"],
"members": {
"workspaceState": { "shape": "WorkspaceState" },
- "transformationSpec": { "shape": "TransformationSpec" }
+ "transformationSpec": { "shape": "TransformationSpec" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent code transformation request.
"
},
@@ -2319,7 +2782,8 @@
"type": "structure",
"required": ["transformationJobId"],
"members": {
- "transformationJobId": { "shape": "TransformationJobId" }
+ "transformationJobId": { "shape": "TransformationJobId" },
+ "profileArn": { "shape": "ProfileArn" }
},
"documentation": "Structure to represent stop code transformation request.
"
},
@@ -2388,15 +2852,15 @@
"members": {
"url": {
"shape": "SupplementaryWebLinkUrlString",
- "documentation": "URL of the web reference link
"
+ "documentation": "URL of the web reference link.
"
},
"title": {
"shape": "SupplementaryWebLinkTitleString",
- "documentation": "Title of the web reference link
"
+ "documentation": "Title of the web reference link.
"
},
"snippet": {
"shape": "SupplementaryWebLinkSnippetString",
- "documentation": "Relevant text snippet from the link
"
+ "documentation": "Relevant text snippet from the link.
"
}
},
"documentation": "Represents an additional reference link retured with the Chat message
"
@@ -2583,6 +3047,11 @@
},
"union": true
},
+ "TenantId": {
+ "type": "string",
+ "max": 1024,
+ "min": 1
+ },
"TerminalUserInteractionEvent": {
"type": "structure",
"members": {
@@ -2729,7 +3198,7 @@
},
"TextDocumentTextString": {
"type": "string",
- "max": 10240,
+ "max": 40000,
"min": 0,
"sensitive": true
},
@@ -2750,6 +3219,124 @@
"enum": ["MONTHLY_REQUEST_COUNT"]
},
"Timestamp": { "type": "timestamp" },
+ "Tool": {
+ "type": "structure",
+ "members": {
+ "toolSpecification": { "shape": "ToolSpecification" }
+ },
+ "documentation": "Information about a tool that can be used.
",
+ "union": true
+ },
+ "ToolDescription": {
+ "type": "string",
+ "documentation": "The description for the tool.
",
+ "max": 10240,
+ "min": 1,
+ "sensitive": true
+ },
+ "ToolInputSchema": {
+ "type": "structure",
+ "members": {
+ "json": { "shape": "SensitiveDocument" }
+ },
+ "documentation": "The input schema for the tool in JSON format.
"
+ },
+ "ToolName": {
+ "type": "string",
+ "documentation": "The name for the tool.
",
+ "max": 64,
+ "min": 0,
+ "pattern": "[a-zA-Z][a-zA-Z0-9_]*",
+ "sensitive": true
+ },
+ "ToolResult": {
+ "type": "structure",
+ "required": ["toolUseId", "content"],
+ "members": {
+ "toolUseId": { "shape": "ToolUseId" },
+ "content": {
+ "shape": "ToolResultContent",
+ "documentation": "Content of the tool result.
"
+ },
+ "status": { "shape": "ToolResultStatus" }
+ },
+ "documentation": "A tool result that contains the results for a tool request that was previously made.
"
+ },
+ "ToolResultContent": {
+ "type": "list",
+ "member": { "shape": "ToolResultContentBlock" }
+ },
+ "ToolResultContentBlock": {
+ "type": "structure",
+ "members": {
+ "text": {
+ "shape": "ToolResultContentBlockTextString",
+ "documentation": "A tool result that is text.
"
+ },
+ "json": {
+ "shape": "SensitiveDocument",
+ "documentation": "A tool result that is JSON format data.
"
+ }
+ },
+ "union": true
+ },
+ "ToolResultContentBlockTextString": {
+ "type": "string",
+ "max": 800000,
+ "min": 0,
+ "sensitive": true
+ },
+ "ToolResultStatus": {
+ "type": "string",
+ "documentation": "Status of the tools result.
",
+ "enum": ["success", "error"]
+ },
+ "ToolResults": {
+ "type": "list",
+ "member": { "shape": "ToolResult" },
+ "max": 10,
+ "min": 0
+ },
+ "ToolSpecification": {
+ "type": "structure",
+ "required": ["inputSchema", "name"],
+ "members": {
+ "inputSchema": { "shape": "ToolInputSchema" },
+ "name": { "shape": "ToolName" },
+ "description": { "shape": "ToolDescription" }
+ },
+ "documentation": "The specification for the tool.
"
+ },
+ "ToolUse": {
+ "type": "structure",
+ "required": ["toolUseId", "name", "input"],
+ "members": {
+ "toolUseId": { "shape": "ToolUseId" },
+ "name": { "shape": "ToolName" },
+ "input": {
+ "shape": "SensitiveDocument",
+ "documentation": "The input to pass to the tool.
"
+ }
+ },
+ "documentation": "Contains information about a tool that the model is requesting be run. The model uses the result from the tool to generate a response.
"
+ },
+ "ToolUseId": {
+ "type": "string",
+ "documentation": "The ID for the tool request.
",
+ "max": 64,
+ "min": 0,
+ "pattern": "[a-zA-Z0-9_-]+"
+ },
+ "ToolUses": {
+ "type": "list",
+ "member": { "shape": "ToolUse" },
+ "max": 10,
+ "min": 0
+ },
+ "Tools": {
+ "type": "list",
+ "member": { "shape": "Tool" }
+ },
"TransformEvent": {
"type": "structure",
"required": ["jobId"],
@@ -2966,7 +3553,8 @@
"taskAssistPlanningUploadContext": { "shape": "TaskAssistPlanningUploadContext" },
"transformationUploadContext": { "shape": "TransformationUploadContext" },
"codeAnalysisUploadContext": { "shape": "CodeAnalysisUploadContext" },
- "codeFixUploadContext": { "shape": "CodeFixUploadContext" }
+ "codeFixUploadContext": { "shape": "CodeFixUploadContext" },
+ "workspaceContextUploadContext": { "shape": "WorkspaceContextUploadContext" }
},
"union": true
},
@@ -2985,9 +3573,15 @@
"AUTOMATIC_FILE_SECURITY_SCAN",
"FULL_PROJECT_SECURITY_SCAN",
"UNIT_TESTS_GENERATION",
- "CODE_FIX_GENERATION"
+ "CODE_FIX_GENERATION",
+ "WORKSPACE_CONTEXT"
]
},
+ "Url": {
+ "type": "string",
+ "max": 1024,
+ "min": 1
+ },
"UserContext": {
"type": "structure",
"required": ["ideCategory", "operatingSystem", "product"],
@@ -3015,18 +3609,26 @@
},
"userInputMessageContext": {
"shape": "UserInputMessageContext",
- "documentation": "Chat message context associated with the Chat Message
"
+ "documentation": "Chat message context associated with the Chat Message.
"
},
"userIntent": {
"shape": "UserIntent",
- "documentation": "User Intent
"
+ "documentation": "User Intent.
"
+ },
+ "origin": {
+ "shape": "Origin",
+ "documentation": "User Input Origin.
"
+ },
+ "images": {
+ "shape": "ImageBlocks",
+ "documentation": "Images associated with the Chat Message.
"
}
},
- "documentation": "Structure to represent a chat input message from User
"
+ "documentation": "Structure to represent a chat input message from User.
"
},
"UserInputMessageContentString": {
"type": "string",
- "max": 4096,
+ "max": 600000,
"min": 0,
"sensitive": true
},
@@ -3064,6 +3666,18 @@
"userSettings": {
"shape": "UserSettings",
"documentation": "Settings information, e.g., whether the user has enabled cross-region API calls.
"
+ },
+ "additionalContext": {
+ "shape": "AdditionalContentList",
+ "documentation": "List of additional contextual content entries that can be included with the message.
"
+ },
+ "toolResults": {
+ "shape": "ToolResults",
+ "documentation": "ToolResults for the requested ToolUses.
"
+ },
+ "tools": {
+ "shape": "Tools",
+ "documentation": "Tools that can be used.
"
}
},
"documentation": "Additional Chat message context associated with the Chat Message
"
@@ -3156,6 +3770,35 @@
"documentation": "Reason for ValidationException
",
"enum": ["INVALID_CONVERSATION_ID", "CONTENT_LENGTH_EXCEEDS_THRESHOLD", "INVALID_KMS_GRANT"]
},
+ "WorkspaceContext": {
+ "type": "structure",
+ "required": ["toggle"],
+ "members": {
+ "toggle": { "shape": "OptInFeatureToggle" }
+ }
+ },
+ "WorkspaceContextUploadContext": {
+ "type": "structure",
+ "required": ["workspaceId", "relativePath", "programmingLanguage"],
+ "members": {
+ "workspaceId": { "shape": "UUID" },
+ "relativePath": { "shape": "SensitiveString" },
+ "programmingLanguage": { "shape": "ProgrammingLanguage" }
+ }
+ },
+ "WorkspaceList": {
+ "type": "list",
+ "member": { "shape": "WorkspaceMetadata" }
+ },
+ "WorkspaceMetadata": {
+ "type": "structure",
+ "required": ["workspaceId", "workspaceStatus"],
+ "members": {
+ "workspaceId": { "shape": "UUID" },
+ "workspaceStatus": { "shape": "WorkspaceStatus" },
+ "environmentId": { "shape": "SensitiveString" }
+ }
+ },
"WorkspaceState": {
"type": "structure",
"required": ["uploadId", "programmingLanguage"],
@@ -3175,6 +3818,10 @@
},
"documentation": "Represents a Workspace state uploaded to S3 for Async Code Actions
"
},
+ "WorkspaceStatus": {
+ "type": "string",
+ "enum": ["CREATED", "PENDING", "READY", "CONNECTED", "DELETING"]
+ },
"timeBetweenChunks": {
"type": "list",
"member": { "shape": "Double" },
diff --git a/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts b/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts
index 3cf030b9b8e..486938c3cab 100644
--- a/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts
+++ b/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts
@@ -60,7 +60,7 @@ export class ChatSession {
async chatSso(chatRequest: GenerateAssistantResponseRequest): Promise {
const client = await createCodeWhispererChatStreamingClient()
- if (this.sessionId !== undefined && chatRequest.conversationState !== undefined) {
+ if (this.sessionId !== '' && this.sessionId !== undefined && chatRequest.conversationState !== undefined) {
chatRequest.conversationState.conversationId = this.sessionId
}
diff --git a/packages/core/src/codewhispererChat/controllers/chat/chatRequest/converter.ts b/packages/core/src/codewhispererChat/controllers/chat/chatRequest/converter.ts
index 0a34463058e..4c00db30392 100644
--- a/packages/core/src/codewhispererChat/controllers/chat/chatRequest/converter.ts
+++ b/packages/core/src/codewhispererChat/controllers/chat/chatRequest/converter.ts
@@ -104,6 +104,7 @@ export function triggerPayloadToChatRequest(triggerPayload: TriggerPayload): { c
return {
conversationState: {
+ conversationId: 'dummyConversationId',
currentMessage: {
userInputMessage: {
content: triggerPayload.message
@@ -119,6 +120,7 @@ export function triggerPayloadToChatRequest(triggerPayload: TriggerPayload): { c
additionalContext: triggerPayload.additionalContents,
},
userIntent: triggerPayload.userIntent,
+ origin: 'IDE',
},
},
chatTriggerType,
diff --git a/src.gen/@amzn/codewhisperer-streaming/README.md b/src.gen/@amzn/codewhisperer-streaming/README.md
index 5f5df60669d..ea254be0911 100644
--- a/src.gen/@amzn/codewhisperer-streaming/README.md
+++ b/src.gen/@amzn/codewhisperer-streaming/README.md
@@ -227,13 +227,6 @@ CreateProfile
-CreateWorkspace
-
-
-[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/CreateWorkspaceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/CreateWorkspaceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/CreateWorkspaceCommandOutput/)
-
-
-
DeleteCustomization
@@ -304,13 +297,6 @@ ListTagsForResource
-ListWorkspaceMetadata
-
-
-[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/ListWorkspaceMetadataCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/ListWorkspaceMetadataCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/ListWorkspaceMetadataCommandOutput/)
-
-
-
TagResource
@@ -367,6 +353,13 @@ CreateUploadUrl
+CreateWorkspace
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/CreateWorkspaceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/CreateWorkspaceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/CreateWorkspaceCommandOutput/)
+
+
+
DeleteTaskAssistConversation
@@ -374,6 +367,13 @@ DeleteTaskAssistConversation
+DeleteWorkspace
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/DeleteWorkspaceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/DeleteWorkspaceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/DeleteWorkspaceCommandOutput/)
+
+
+
GenerateCompletions
@@ -451,6 +451,13 @@ ListFeatureEvaluations
+ListWorkspaceMetadata
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/ListWorkspaceMetadataCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/ListWorkspaceMetadataCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/ListWorkspaceMetadataCommandOutput/)
+
+
+
ResumeTransformation
@@ -570,6 +577,13 @@ DeleteAssignment
+DeleteConversation
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/DeleteConversationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/DeleteConversationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/DeleteConversationCommandOutput/)
+
+
+
DeleteExtension
@@ -759,6 +773,20 @@ UntagResource
+UpdateConversation
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/UpdateConversationCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/UpdateConversationCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/UpdateConversationCommandOutput/)
+
+
+
+UpdatePlugin
+
+
+[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/codewhispererstreaming/command/UpdatePluginCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/UpdatePluginCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-codewhispererstreaming/Interface/UpdatePluginCommandOutput/)
+
+
+
UpdateTroubleshootingCommandResult
diff --git a/src.gen/@amzn/codewhisperer-streaming/src/commands/ExportResultArchiveCommand.ts b/src.gen/@amzn/codewhisperer-streaming/src/commands/ExportResultArchiveCommand.ts
index 8b8a5016715..c2376564160 100644
--- a/src.gen/@amzn/codewhisperer-streaming/src/commands/ExportResultArchiveCommand.ts
+++ b/src.gen/@amzn/codewhisperer-streaming/src/commands/ExportResultArchiveCommand.ts
@@ -56,6 +56,7 @@ export interface ExportResultArchiveCommandOutput extends ExportResultArchiveRes
* testGenerationJobId: "STRING_VALUE",
* },
* },
+ * profileArn: "STRING_VALUE",
* };
* const command = new ExportResultArchiveCommand(input);
* const response = await client.send(command);
diff --git a/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts b/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts
index 4bfdeb6aa74..93692022f1d 100644
--- a/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts
+++ b/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts
@@ -212,6 +212,15 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
* ],
* },
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
+ * origin: "STRING_VALUE",
+ * images: [ // ImageBlocks
+ * { // ImageBlock
+ * format: "png" || "jpeg" || "gif" || "webp", // required
+ * source: { // ImageSource Union: only one key present
+ * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
+ * },
+ * },
+ * ],
* },
* assistantResponseMessage: { // AssistantResponseMessage
* messageId: "STRING_VALUE",
@@ -238,6 +247,13 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
* content: "STRING_VALUE", // required
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
* },
+ * toolUses: [ // ToolUses
+ * { // ToolUse
+ * toolUseId: "STRING_VALUE", // required
+ * name: "STRING_VALUE", // required
+ * input: "DOCUMENT_VALUE", // required
+ * },
+ * ],
* },
* },
* ],
@@ -364,6 +380,15 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
* ],
* },
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
+ * origin: "STRING_VALUE",
+ * images: [
+ * {
+ * format: "png" || "jpeg" || "gif" || "webp", // required
+ * source: {// Union: only one key present
+ * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
+ * },
+ * },
+ * ],
* },
* assistantResponseMessage: {
* messageId: "STRING_VALUE",
@@ -390,6 +415,13 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
* content: "STRING_VALUE", // required
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
* },
+ * toolUses: [
+ * {
+ * toolUseId: "STRING_VALUE", // required
+ * name: "STRING_VALUE", // required
+ * input: "DOCUMENT_VALUE", // required
+ * },
+ * ],
* },
* },
* chatTriggerType: "MANUAL" || "DIAGNOSTIC" || "INLINE_CHAT", // required
@@ -651,6 +683,17 @@ export interface GenerateAssistantResponseCommandOutput extends GenerateAssistan
* // input: "STRING_VALUE",
* // stop: true || false,
* // },
+ * // citationEvent: { // CitationEvent
+ * // target: { // CitationTarget Union: only one key present
+ * // location: Number("int"),
+ * // range: {
+ * // start: Number("int"),
+ * // end: Number("int"),
+ * // },
+ * // },
+ * // citationText: "STRING_VALUE",
+ * // citationLink: "STRING_VALUE", // required
+ * // },
* // invalidStateEvent: { // InvalidStateEvent
* // reason: "INVALID_TASK_ASSIST_PLAN", // required
* // message: "STRING_VALUE", // required
diff --git a/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts b/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts
index ef188a0600a..aabf5ec6a55 100644
--- a/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts
+++ b/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts
@@ -212,6 +212,15 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
* ],
* },
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
+ * origin: "STRING_VALUE",
+ * images: [ // ImageBlocks
+ * { // ImageBlock
+ * format: "png" || "jpeg" || "gif" || "webp", // required
+ * source: { // ImageSource Union: only one key present
+ * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
+ * },
+ * },
+ * ],
* },
* assistantResponseMessage: { // AssistantResponseMessage
* messageId: "STRING_VALUE",
@@ -238,6 +247,13 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
* content: "STRING_VALUE", // required
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
* },
+ * toolUses: [ // ToolUses
+ * { // ToolUse
+ * toolUseId: "STRING_VALUE", // required
+ * name: "STRING_VALUE", // required
+ * input: "DOCUMENT_VALUE", // required
+ * },
+ * ],
* },
* },
* ],
@@ -364,6 +380,15 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
* ],
* },
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
+ * origin: "STRING_VALUE",
+ * images: [
+ * {
+ * format: "png" || "jpeg" || "gif" || "webp", // required
+ * source: {// Union: only one key present
+ * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
+ * },
+ * },
+ * ],
* },
* assistantResponseMessage: {
* messageId: "STRING_VALUE",
@@ -390,6 +415,13 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
* content: "STRING_VALUE", // required
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
* },
+ * toolUses: [
+ * {
+ * toolUseId: "STRING_VALUE", // required
+ * name: "STRING_VALUE", // required
+ * input: "DOCUMENT_VALUE", // required
+ * },
+ * ],
* },
* },
* chatTriggerType: "MANUAL" || "DIAGNOSTIC" || "INLINE_CHAT", // required
@@ -400,6 +432,7 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
* programmingLanguage: "", // required
* contextTruncationScheme: "ANALYSIS" || "GUMBY",
* },
+ * profileArn: "STRING_VALUE",
* };
* const command = new GenerateTaskAssistPlanCommand(input);
* const response = await client.send(command);
@@ -654,6 +687,17 @@ export interface GenerateTaskAssistPlanCommandOutput extends GenerateTaskAssistP
* // input: "STRING_VALUE",
* // stop: true || false,
* // },
+ * // citationEvent: { // CitationEvent
+ * // target: { // CitationTarget Union: only one key present
+ * // location: Number("int"),
+ * // range: {
+ * // start: Number("int"),
+ * // end: Number("int"),
+ * // },
+ * // },
+ * // citationText: "STRING_VALUE",
+ * // citationLink: "STRING_VALUE", // required
+ * // },
* // invalidStateEvent: { // InvalidStateEvent
* // reason: "INVALID_TASK_ASSIST_PLAN", // required
* // message: "STRING_VALUE", // required
diff --git a/src.gen/@amzn/codewhisperer-streaming/src/commands/SendMessageCommand.ts b/src.gen/@amzn/codewhisperer-streaming/src/commands/SendMessageCommand.ts
index 8a83024b54d..c040041719c 100644
--- a/src.gen/@amzn/codewhisperer-streaming/src/commands/SendMessageCommand.ts
+++ b/src.gen/@amzn/codewhisperer-streaming/src/commands/SendMessageCommand.ts
@@ -213,6 +213,15 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
* ],
* },
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
+ * origin: "STRING_VALUE",
+ * images: [ // ImageBlocks
+ * { // ImageBlock
+ * format: "png" || "jpeg" || "gif" || "webp", // required
+ * source: { // ImageSource Union: only one key present
+ * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
+ * },
+ * },
+ * ],
* },
* assistantResponseMessage: { // AssistantResponseMessage
* messageId: "STRING_VALUE",
@@ -239,6 +248,13 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
* content: "STRING_VALUE", // required
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
* },
+ * toolUses: [ // ToolUses
+ * { // ToolUse
+ * toolUseId: "STRING_VALUE", // required
+ * name: "STRING_VALUE", // required
+ * input: "DOCUMENT_VALUE", // required
+ * },
+ * ],
* },
* },
* ],
@@ -365,6 +381,15 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
* ],
* },
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
+ * origin: "STRING_VALUE",
+ * images: [
+ * {
+ * format: "png" || "jpeg" || "gif" || "webp", // required
+ * source: {// Union: only one key present
+ * bytes: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
+ * },
+ * },
+ * ],
* },
* assistantResponseMessage: {
* messageId: "STRING_VALUE",
@@ -391,6 +416,13 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
* content: "STRING_VALUE", // required
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION" || "GENERATE_CLOUDFORMATION_TEMPLATE" || "GENERATE_UNIT_TESTS" || "CODE_GENERATION",
* },
+ * toolUses: [
+ * {
+ * toolUseId: "STRING_VALUE", // required
+ * name: "STRING_VALUE", // required
+ * input: "DOCUMENT_VALUE", // required
+ * },
+ * ],
* },
* },
* chatTriggerType: "MANUAL" || "DIAGNOSTIC" || "INLINE_CHAT", // required
@@ -653,6 +685,17 @@ export interface SendMessageCommandOutput extends SendMessageResponse, __Metadat
* // input: "STRING_VALUE",
* // stop: true || false,
* // },
+ * // citationEvent: { // CitationEvent
+ * // target: { // CitationTarget Union: only one key present
+ * // location: Number("int"),
+ * // range: {
+ * // start: Number("int"),
+ * // end: Number("int"),
+ * // },
+ * // },
+ * // citationText: "STRING_VALUE",
+ * // citationLink: "STRING_VALUE", // required
+ * // },
* // invalidStateEvent: { // InvalidStateEvent
* // reason: "INVALID_TASK_ASSIST_PLAN", // required
* // message: "STRING_VALUE", // required
diff --git a/src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts b/src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts
index 07e2794da2d..0ed67acb7d8 100644
--- a/src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts
+++ b/src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts
@@ -361,7 +361,7 @@ export const FollowupPromptFilterSensitiveLog = (obj: FollowupPrompt): any => ({
})
/**
- * Represents span in a text
+ * Represents span in a text.
* @public
*/
export interface Span {
@@ -405,19 +405,19 @@ export interface Reference {
*/
export interface SupplementaryWebLink {
/**
- * URL of the web reference link
+ * URL of the web reference link.
* @public
*/
url: string | undefined;
/**
- * Title of the web reference link
+ * Title of the web reference link.
* @public
*/
title: string | undefined;
/**
- * Relevant text snippet from the link
+ * Relevant text snippet from the link.
* @public
*/
snippet?: string | undefined;
@@ -439,6 +439,43 @@ export const SupplementaryWebLinkFilterSensitiveLog = (obj: SupplementaryWebLink
}),
})
+/**
+ * Contains information about a tool that the model is requesting be run. The model uses the result from the tool to generate a response.
+ * @public
+ */
+export interface ToolUse {
+ /**
+ * The ID for the tool request.
+ * @public
+ */
+ toolUseId: string | undefined;
+
+ /**
+ * The name for the tool.
+ * @public
+ */
+ name: string | undefined;
+
+ /**
+ * The input to pass to the tool.
+ * @public
+ */
+ input: __DocumentType | undefined;
+}
+
+/**
+ * @internal
+ */
+export const ToolUseFilterSensitiveLog = (obj: ToolUse): any => ({
+ ...obj,
+ ...(obj.name && { name:
+ SENSITIVE_STRING
+ }),
+ ...(obj.input && { input:
+ SENSITIVE_STRING
+ }),
+})
+
/**
* Markdown text message.
* @public
@@ -473,6 +510,12 @@ export interface AssistantResponseMessage {
* @public
*/
followupPrompt?: FollowupPrompt | undefined;
+
+ /**
+ * ToolUse Request
+ * @public
+ */
+ toolUses?: (ToolUse)[] | undefined;
}
/**
@@ -492,6 +535,12 @@ export const AssistantResponseMessageFilterSensitiveLog = (obj: AssistantRespons
...(obj.followupPrompt && { followupPrompt:
FollowupPromptFilterSensitiveLog(obj.followupPrompt)
}),
+ ...(obj.toolUses && { toolUses:
+ obj.toolUses.map(
+ item =>
+ ToolUseFilterSensitiveLog(item)
+ )
+ }),
})
/**
@@ -614,6 +663,165 @@ export const BinaryPayloadEventFilterSensitiveLog = (obj: BinaryPayloadEvent): a
}),
})
+/**
+ * @public
+ * @enum
+ */
+export const ImageFormat = {
+ GIF: "gif",
+ JPEG: "jpeg",
+ PNG: "png",
+ WEBP: "webp",
+} as const
+/**
+ * @public
+ */
+export type ImageFormat = typeof ImageFormat[keyof typeof ImageFormat]
+
+/**
+ * Image bytes limited to ~10MB considering overhead of base64 encoding
+ * @public
+ */
+export type ImageSource =
+ | ImageSource.BytesMember
+ | ImageSource.$UnknownMember
+
+/**
+ * @public
+ */
+export namespace ImageSource {
+
+ export interface BytesMember {
+ bytes: Uint8Array;
+ $unknown?: never;
+ }
+
+ /**
+ * @public
+ */
+ export interface $UnknownMember {
+ bytes?: never;
+ $unknown: [string, any];
+ }
+
+ export interface Visitor {
+ bytes: (value: Uint8Array) => T;
+ _: (name: string, value: any) => T;
+ }
+
+ export const visit = (
+ value: ImageSource,
+ visitor: Visitor
+ ): T => {
+ if (value.bytes !== undefined) return visitor.bytes(value.bytes);
+ return visitor._(value.$unknown[0], value.$unknown[1]);
+ }
+
+}
+/**
+ * @internal
+ */
+export const ImageSourceFilterSensitiveLog = (obj: ImageSource): any => {
+ if (obj.bytes !== undefined) return {bytes:
+ obj.bytes
+ };
+ if (obj.$unknown !== undefined) return {[obj.$unknown[0]]: 'UNKNOWN'};
+}
+
+/**
+ * Represents the image source itself and the format of the image.
+ * @public
+ */
+export interface ImageBlock {
+ format: ImageFormat | undefined;
+ /**
+ * Image bytes limited to ~10MB considering overhead of base64 encoding
+ * @public
+ */
+ source: ImageSource | undefined;
+}
+
+/**
+ * @internal
+ */
+export const ImageBlockFilterSensitiveLog = (obj: ImageBlock): any => ({
+ ...obj,
+ ...(obj.source && { source:
+ SENSITIVE_STRING
+ }),
+})
+
+/**
+ * @public
+ * @enum
+ */
+export const Origin = {
+ /**
+ * Any AI Editor.
+ */
+ AI_EDITOR: "AI_EDITOR",
+ /**
+ * AWS Chatbot
+ */
+ CHATBOT: "CHATBOT",
+ /**
+ * Any CLI caller.
+ */
+ CLI: "CLI",
+ /**
+ * AWS Management Console (https://.console.aws.amazon.com)
+ */
+ CONSOLE: "CONSOLE",
+ /**
+ * AWS Documentation Website (https://docs.aws.amazon.com)
+ */
+ DOCUMENTATION: "DOCUMENTATION",
+ /**
+ * Any caller from GitLab Q integration.
+ */
+ GITLAB: "GITLAB",
+ /**
+ * Any IDE caller.
+ */
+ IDE: "IDE",
+ /**
+ * AWS Marketing Website (https://aws.amazon.com)
+ */
+ MARKETING: "MARKETING",
+ /**
+ * MD.
+ */
+ MD: "MD",
+ /**
+ * AWS Mobile Application (ACMA)
+ */
+ MOBILE: "MOBILE",
+ /**
+ * Amazon OpenSearch dashboard
+ */
+ OPENSEARCH_DASHBOARD: "OPENSEARCH_DASHBOARD",
+ /**
+ * Amazon SageMaker's Rome Chat.
+ */
+ SAGE_MAKER: "SAGE_MAKER",
+ /**
+ * Internal Service Traffic (Integ Tests, Canaries, etc.). This is the default when no Origin header present in request.
+ */
+ SERVICE_INTERNAL: "SERVICE_INTERNAL",
+ /**
+ * Unified Search in AWS Management Console (https://.console.aws.amazon.com)
+ */
+ UNIFIED_SEARCH: "UNIFIED_SEARCH",
+ /**
+ * Origin header is not set.
+ */
+ UNKNOWN: "UNKNOWN",
+} as const
+/**
+ * @public
+ */
+export type Origin = typeof Origin[keyof typeof Origin]
+
/**
* Information about the state of the AWS management console page from which the user is calling
* @public
@@ -1563,13 +1771,13 @@ export interface UserInputMessageContext {
userSettings?: UserSettings | undefined;
/**
- * List of additional contextual content entries that can be included with the message
+ * List of additional contextual content entries that can be included with the message.
* @public
*/
additionalContext?: (AdditionalContentEntry)[] | undefined;
/**
- * ToolResults for the requested ToolUses
+ * ToolResults for the requested ToolUses.
* @public
*/
toolResults?: (ToolResult)[] | undefined;
@@ -1628,7 +1836,7 @@ export const UserInputMessageContextFilterSensitiveLog = (obj: UserInputMessageC
})
/**
- * Structure to represent a chat input message from User
+ * Structure to represent a chat input message from User.
* @public
*/
export interface UserInputMessage {
@@ -1639,16 +1847,28 @@ export interface UserInputMessage {
content: string | undefined;
/**
- * Chat message context associated with the Chat Message
+ * Chat message context associated with the Chat Message.
* @public
*/
userInputMessageContext?: UserInputMessageContext | undefined;
/**
- * User Intent
+ * User Intent.
* @public
*/
userIntent?: UserIntent | undefined;
+
+ /**
+ * User Input Origin.
+ * @public
+ */
+ origin?: Origin | undefined;
+
+ /**
+ * Images associated with the Chat Message.
+ * @public
+ */
+ images?: (ImageBlock)[] | undefined;
}
/**
@@ -1662,6 +1882,12 @@ export const UserInputMessageFilterSensitiveLog = (obj: UserInputMessage): any =
...(obj.userInputMessageContext && { userInputMessageContext:
UserInputMessageContextFilterSensitiveLog(obj.userInputMessageContext)
}),
+ ...(obj.images && { images:
+ obj.images.map(
+ item =>
+ ImageBlockFilterSensitiveLog(item)
+ )
+ }),
})
/**
@@ -1678,7 +1904,7 @@ export type ChatMessage =
export namespace ChatMessage {
/**
- * Structure to represent a chat input message from User
+ * Structure to represent a chat input message from User.
* @public
*/
export interface UserInputMessageMember {
@@ -1735,6 +1961,106 @@ export const ChatMessageFilterSensitiveLog = (obj: ChatMessage): any => {
if (obj.$unknown !== undefined) return {[obj.$unknown[0]]: 'UNKNOWN'};
}
+/**
+ * Represents the target of a citation event
+ * @public
+ */
+export type CitationTarget =
+ | CitationTarget.LocationMember
+ | CitationTarget.RangeMember
+ | CitationTarget.$UnknownMember
+
+/**
+ * @public
+ */
+export namespace CitationTarget {
+
+ /**
+ * Represents a position in the response text where a citation should be added
+ * @public
+ */
+ export interface LocationMember {
+ location: number;
+ range?: never;
+ $unknown?: never;
+ }
+
+ /**
+ * Represents the range in the response text to be targetted by a citation
+ * @public
+ */
+ export interface RangeMember {
+ location?: never;
+ range: Span;
+ $unknown?: never;
+ }
+
+ /**
+ * @public
+ */
+ export interface $UnknownMember {
+ location?: never;
+ range?: never;
+ $unknown: [string, any];
+ }
+
+ export interface Visitor {
+ location: (value: number) => T;
+ range: (value: Span) => T;
+ _: (name: string, value: any) => T;
+ }
+
+ export const visit = (
+ value: CitationTarget,
+ visitor: Visitor
+ ): T => {
+ if (value.location !== undefined) return visitor.location(value.location);
+ if (value.range !== undefined) return visitor.range(value.range);
+ return visitor._(value.$unknown[0], value.$unknown[1]);
+ }
+
+}
+
+/**
+ * Streaming response event for citations
+ * @public
+ */
+export interface CitationEvent {
+ /**
+ * The position or the range of the response text to be cited
+ * @public
+ */
+ target: CitationTarget | undefined;
+
+ /**
+ * The text inside the citation '1' in [1]
+ * @public
+ */
+ citationText?: string | undefined;
+
+ /**
+ * The link to the document being cited
+ * @public
+ */
+ citationLink: string | undefined;
+}
+
+/**
+ * @internal
+ */
+export const CitationEventFilterSensitiveLog = (obj: CitationEvent): any => ({
+ ...obj,
+ ...(obj.target && { target:
+ obj.target
+ }),
+ ...(obj.citationText && { citationText:
+ SENSITIVE_STRING
+ }),
+ ...(obj.citationLink && { citationLink:
+ SENSITIVE_STRING
+ }),
+})
+
/**
* Streaming response event for generated code text.
* @public
@@ -3073,6 +3399,7 @@ export const ToolUseEventFilterSensitiveLog = (obj: ToolUseEvent): any => ({
*/
export type ChatResponseStream =
| ChatResponseStream.AssistantResponseEventMember
+ | ChatResponseStream.CitationEventMember
| ChatResponseStream.CodeEventMember
| ChatResponseStream.CodeReferenceEventMember
| ChatResponseStream.DryRunSucceedEventMember
@@ -3106,6 +3433,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3126,6 +3454,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3146,6 +3475,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3166,6 +3496,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3186,6 +3517,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3206,6 +3538,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3226,6 +3559,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3246,6 +3580,7 @@ export namespace ChatResponseStream {
intentsEvent: IntentsEvent;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3266,6 +3601,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent: InteractionComponentsEvent;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3286,6 +3622,28 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent: ToolUseEvent;
+ citationEvent?: never;
+ invalidStateEvent?: never;
+ error?: never;
+ $unknown?: never;
+ }
+
+ /**
+ * Citation event
+ * @public
+ */
+ export interface CitationEventMember {
+ messageMetadataEvent?: never;
+ assistantResponseEvent?: never;
+ dryRunSucceedEvent?: never;
+ codeReferenceEvent?: never;
+ supplementaryWebLinksEvent?: never;
+ followupPromptEvent?: never;
+ codeEvent?: never;
+ intentsEvent?: never;
+ interactionComponentsEvent?: never;
+ toolUseEvent?: never;
+ citationEvent: CitationEvent;
invalidStateEvent?: never;
error?: never;
$unknown?: never;
@@ -3306,6 +3664,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent: InvalidStateEvent;
error?: never;
$unknown?: never;
@@ -3326,6 +3685,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error: InternalServerException;
$unknown?: never;
@@ -3345,6 +3705,7 @@ export namespace ChatResponseStream {
intentsEvent?: never;
interactionComponentsEvent?: never;
toolUseEvent?: never;
+ citationEvent?: never;
invalidStateEvent?: never;
error?: never;
$unknown: [string, any];
@@ -3361,6 +3722,7 @@ export namespace ChatResponseStream {
intentsEvent: (value: IntentsEvent) => T;
interactionComponentsEvent: (value: InteractionComponentsEvent) => T;
toolUseEvent: (value: ToolUseEvent) => T;
+ citationEvent: (value: CitationEvent) => T;
invalidStateEvent: (value: InvalidStateEvent) => T;
error: (value: InternalServerException) => T;
_: (name: string, value: any) => T;
@@ -3380,6 +3742,7 @@ export namespace ChatResponseStream {
if (value.intentsEvent !== undefined) return visitor.intentsEvent(value.intentsEvent);
if (value.interactionComponentsEvent !== undefined) return visitor.interactionComponentsEvent(value.interactionComponentsEvent);
if (value.toolUseEvent !== undefined) return visitor.toolUseEvent(value.toolUseEvent);
+ if (value.citationEvent !== undefined) return visitor.citationEvent(value.citationEvent);
if (value.invalidStateEvent !== undefined) return visitor.invalidStateEvent(value.invalidStateEvent);
if (value.error !== undefined) return visitor.error(value.error);
return visitor._(value.$unknown[0], value.$unknown[1]);
@@ -3420,6 +3783,9 @@ export const ChatResponseStreamFilterSensitiveLog = (obj: ChatResponseStream): a
if (obj.toolUseEvent !== undefined) return {toolUseEvent:
ToolUseEventFilterSensitiveLog(obj.toolUseEvent)
};
+ if (obj.citationEvent !== undefined) return {citationEvent:
+ CitationEventFilterSensitiveLog(obj.citationEvent)
+ };
if (obj.invalidStateEvent !== undefined) return {invalidStateEvent:
obj.invalidStateEvent
};
@@ -3860,6 +4226,8 @@ export interface ExportResultArchiveRequest {
* @public
*/
exportContext?: ExportContext | undefined;
+
+ profileArn?: string | undefined;
}
/**
@@ -3884,61 +4252,6 @@ export const ExportResultArchiveResponseFilterSensitiveLog = (obj: ExportResultA
}),
})
-/**
- * @public
- * @enum
- */
-export const Origin = {
- /**
- * AWS Chatbot
- */
- CHATBOT: "CHATBOT",
- /**
- * AWS Management Console (https://.console.aws.amazon.com)
- */
- CONSOLE: "CONSOLE",
- /**
- * AWS Documentation Website (https://docs.aws.amazon.com)
- */
- DOCUMENTATION: "DOCUMENTATION",
- /**
- * Any IDE caller.
- */
- IDE: "IDE",
- /**
- * AWS Marketing Website (https://aws.amazon.com)
- */
- MARKETING: "MARKETING",
- /**
- * MD.
- */
- MD: "MD",
- /**
- * AWS Mobile Application (ACMA)
- */
- MOBILE: "MOBILE",
- /**
- * Amazon SageMaker's Rome Chat.
- */
- SAGE_MAKER: "SAGE_MAKER",
- /**
- * Internal Service Traffic (Integ Tests, Canaries, etc.). This is the default when no Origin header present in request.
- */
- SERVICE_INTERNAL: "SERVICE_INTERNAL",
- /**
- * Unified Search in AWS Management Console (https://.console.aws.amazon.com)
- */
- UNIFIED_SEARCH: "UNIFIED_SEARCH",
- /**
- * Origin header is not set.
- */
- UNKNOWN: "UNKNOWN",
-} as const
-/**
- * @public
- */
-export type Origin = typeof Origin[keyof typeof Origin]
-
/**
* Structure to represent a SendMessage request.
* @public
@@ -4008,6 +4321,8 @@ export interface GenerateTaskAssistPlanRequest {
* @public
*/
workspaceState: WorkspaceState | undefined;
+
+ profileArn?: string | undefined;
}
/**
diff --git a/src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts b/src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts
index 252aa8f3e43..529fb5b1798 100644
--- a/src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts
+++ b/src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts
@@ -26,6 +26,7 @@ import {
BinaryPayloadEvent,
ChatMessage,
ChatResponseStream,
+ CitationEvent,
CodeEvent,
CodeReferenceEvent,
ConflictException,
@@ -43,6 +44,8 @@ import {
FollowupPrompt,
FollowupPromptEvent,
GitState,
+ ImageBlock,
+ ImageSource,
IntentsEvent,
InteractionComponent,
InteractionComponentEntry,
@@ -72,6 +75,7 @@ import {
ToolResult,
ToolResultContentBlock,
ToolSpecification,
+ ToolUse,
ToolUseEvent,
TransformationExportContext,
UnitTestGenerationExportContext,
@@ -126,6 +130,7 @@ export const se_ExportResultArchiveCommand = async(
'exportContext': _ => _json(_),
'exportId': [],
'exportIntent': [],
+ 'profileArn': [],
}));
b.m("POST")
.h(headers)
@@ -171,6 +176,7 @@ export const se_GenerateTaskAssistPlanCommand = async(
let body: any;
body = JSON.stringify(take(input, {
'conversationState': _ => se_ConversationState(_, context),
+ 'profileArn': [],
'workspaceState': _ => _json(_),
}));
b.m("POST")
@@ -557,6 +563,11 @@ const de_CommandError = async(
toolUseEvent: await de_ToolUseEvent_event(event["toolUseEvent"], context),
};
}
+ if (event["citationEvent"] != null) {
+ return {
+ citationEvent: await de_CitationEvent_event(event["citationEvent"], context),
+ };
+ }
if (event["invalidStateEvent"] != null) {
return {
invalidStateEvent: await de_InvalidStateEvent_event(event["invalidStateEvent"], context),
@@ -627,6 +638,15 @@ const de_CommandError = async(
Object.assign(contents, de_BinaryPayloadEvent(data, context));
return contents;
}
+ const de_CitationEvent_event = async (
+ output: any,
+ context: __SerdeContext
+ ): Promise => {
+ const contents: CitationEvent = {} as any;
+ const data: any = await parseBody(output.body, context);
+ Object.assign(contents, _json(data));
+ return contents;
+ }
const de_CodeEvent_event = async (
output: any,
context: __SerdeContext
@@ -733,7 +753,22 @@ const de_CommandError = async(
// se_AppStudioState omitted.
- // se_AssistantResponseMessage omitted.
+ /**
+ * serializeAws_restJson1AssistantResponseMessage
+ */
+ const se_AssistantResponseMessage = (
+ input: AssistantResponseMessage,
+ context: __SerdeContext
+ ): any => {
+ return take(input, {
+ 'content': [],
+ 'followupPrompt': _json,
+ 'messageId': [],
+ 'references': _json,
+ 'supplementaryWebLinks': _json,
+ 'toolUses': _ => se_ToolUses(_, context),
+ });
+ }
/**
* serializeAws_restJson1ChatHistory
@@ -755,7 +790,7 @@ const de_CommandError = async(
context: __SerdeContext
): any => {
return ChatMessage.visit(input, {
- assistantResponseMessage: value => ({ "assistantResponseMessage": _json(value) }),
+ assistantResponseMessage: value => ({ "assistantResponseMessage": se_AssistantResponseMessage(value, context) }),
userInputMessage: value => ({ "userInputMessage": se_UserInputMessage(value, context) }),
_: (name, value) => ({ name: value } as any)
});
@@ -801,6 +836,44 @@ const de_CommandError = async(
// se_GitState omitted.
+ /**
+ * serializeAws_restJson1ImageBlock
+ */
+ const se_ImageBlock = (
+ input: ImageBlock,
+ context: __SerdeContext
+ ): any => {
+ return take(input, {
+ 'format': [],
+ 'source': _ => se_ImageSource(_, context),
+ });
+ }
+
+ /**
+ * serializeAws_restJson1ImageBlocks
+ */
+ const se_ImageBlocks = (
+ input: (ImageBlock)[],
+ context: __SerdeContext
+ ): any => {
+ return input.filter((e: any) => e != null).map(entry => {
+ return se_ImageBlock(entry, context);
+ });
+ }
+
+ /**
+ * serializeAws_restJson1ImageSource
+ */
+ const se_ImageSource = (
+ input: ImageSource,
+ context: __SerdeContext
+ ): any => {
+ return ImageSource.visit(input, {
+ bytes: value => ({ "bytes": context.base64Encoder(value) }),
+ _: (name, value) => ({ name: value } as any)
+ });
+ }
+
// se_Position omitted.
// se_ProgrammingLanguage omitted.
@@ -946,6 +1019,32 @@ const de_CommandError = async(
});
}
+ /**
+ * serializeAws_restJson1ToolUse
+ */
+ const se_ToolUse = (
+ input: ToolUse,
+ context: __SerdeContext
+ ): any => {
+ return take(input, {
+ 'input': _ => se_SensitiveDocument(_, context),
+ 'name': [],
+ 'toolUseId': [],
+ });
+ }
+
+ /**
+ * serializeAws_restJson1ToolUses
+ */
+ const se_ToolUses = (
+ input: (ToolUse)[],
+ context: __SerdeContext
+ ): any => {
+ return input.filter((e: any) => e != null).map(entry => {
+ return se_ToolUse(entry, context);
+ });
+ }
+
// se_TransformationExportContext omitted.
// se_UnitTestGenerationExportContext omitted.
@@ -959,6 +1058,8 @@ const de_CommandError = async(
): any => {
return take(input, {
'content': [],
+ 'images': _ => se_ImageBlocks(_, context),
+ 'origin': [],
'userInputMessageContext': _ => se_UserInputMessageContext(_, context),
'userIntent': [],
});
@@ -1006,6 +1107,10 @@ const de_CommandError = async(
}) as any;
}
+ // de_CitationEvent omitted.
+
+ // de_CitationTarget omitted.
+
// de_CodeEvent omitted.
// de_CodeReferenceEvent omitted.
From 0b9f81e95e157622938e16d5dd6a5001808defee Mon Sep 17 00:00:00 2001
From: laileni
Date: Mon, 17 Mar 2025 16:21:00 -0700
Subject: [PATCH 2/4] Adding Tool execution
Executing default commands in the terminal
Temporary moving the command execution logic to messenger.ts, need to implement this in controller.ts
Disabling the Run command button
Agentic IDE Terminal integration and show the logs in the terminal
Agentic IDE Terminal integration
---
.../webview/ui/apps/cwChatConnector.ts | 45 +++++++-
.../core/src/amazonq/webview/ui/connector.ts | 2 +-
packages/core/src/amazonq/webview/ui/main.ts | 1 +
.../codewhispererChat/clients/chat/v0/chat.ts | 3 +
.../controllers/chat/controller.ts | 109 +++++++++++++++---
.../controllers/chat/messenger/messenger.ts | 66 ++++++++++-
.../view/connector/connector.ts | 3 +
7 files changed, 212 insertions(+), 17 deletions(-)
diff --git a/packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts b/packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts
index 324616a445a..7e32c3a0741 100644
--- a/packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts
+++ b/packages/core/src/amazonq/webview/ui/apps/cwChatConnector.ts
@@ -3,7 +3,14 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { ChatItemButton, ChatItemFormItem, ChatItemType, MynahUIDataModel, QuickActionCommand } from '@aws/mynah-ui'
+import {
+ ChatItem,
+ ChatItemButton,
+ ChatItemFormItem,
+ ChatItemType,
+ MynahUIDataModel,
+ QuickActionCommand,
+} from '@aws/mynah-ui'
import { TabType } from '../storages/tabsStorage'
import { CWCChatItem } from '../connector'
import { BaseConnector, BaseConnectorProps } from './baseConnector'
@@ -18,12 +25,14 @@ export interface ConnectorProps extends BaseConnectorProps {
title?: string,
description?: string
) => void
+ onChatAnswerUpdated?: (tabID: string, message: ChatItem) => void
}
export class Connector extends BaseConnector {
private readonly onCWCContextCommandMessage
private readonly onContextCommandDataReceived
private readonly onShowCustomForm
+ private readonly onChatAnswerUpdated
override getTabType(): TabType {
return 'cwc'
@@ -34,6 +43,7 @@ export class Connector extends BaseConnector {
this.onCWCContextCommandMessage = props.onCWCContextCommandMessage
this.onContextCommandDataReceived = props.onContextCommandDataReceived
this.onShowCustomForm = props.onShowCustomForm
+ this.onChatAnswerUpdated = props.onChatAnswerUpdated
}
onSourceLinkClick = (tabID: string, messageId: string, link: string): void => {
@@ -96,6 +106,7 @@ export class Connector extends BaseConnector {
userIntent: messageData.userIntent,
codeBlockLanguage: messageData.codeBlockLanguage,
contextList: messageData.contextList,
+ buttons: messageData.buttons ?? undefined,
}
// If it is not there we will not set it
@@ -137,6 +148,7 @@ export class Connector extends BaseConnector {
options: messageData.followUps,
}
: undefined,
+ buttons: messageData.buttons ?? undefined,
}
this.onChatAnswerReceived(messageData.tabID, answer, messageData)
@@ -204,7 +216,7 @@ export class Connector extends BaseConnector {
}
if (messageData.type === 'customFormActionMessage') {
- this.onCustomFormAction(messageData.tabID, messageData.action)
+ this.onCustomFormAction(messageData.tabID, messageData.messageId, messageData.action)
return
}
// For other message types, call the base class handleMessageReceive
@@ -235,6 +247,7 @@ export class Connector extends BaseConnector {
onCustomFormAction(
tabId: string,
+ messageId: string,
action: {
id: string
text?: string | undefined
@@ -248,9 +261,37 @@ export class Connector extends BaseConnector {
this.sendMessageToExtension({
command: 'form-action-click',
action: action,
+ formSelectedValues: action.formItemValues,
tabType: this.getTabType(),
tabID: tabId,
})
+
+ if (this.onChatAnswerUpdated === undefined) {
+ return
+ }
+ const answer: ChatItem = {
+ type: ChatItemType.ANSWER,
+ messageId: messageId,
+ buttons: [],
+ }
+
+ switch (action.id) {
+ case 'RunCommand':
+ answer.buttons = [
+ {
+ keepCardAfterClick: true,
+ text: 'Executing Command',
+ id: 'RunCommandClicked',
+ status: 'success',
+ position: 'outside',
+ disabled: true,
+ },
+ ]
+ break
+ default:
+ break
+ }
+ this.onChatAnswerUpdated(tabId, answer)
}
onFileClick = (tabID: string, filePath: string, messageId?: string) => {
diff --git a/packages/core/src/amazonq/webview/ui/connector.ts b/packages/core/src/amazonq/webview/ui/connector.ts
index 8f1cde9e565..e9ade610f1e 100644
--- a/packages/core/src/amazonq/webview/ui/connector.ts
+++ b/packages/core/src/amazonq/webview/ui/connector.ts
@@ -711,7 +711,7 @@ export class Connector {
tabType: 'cwc',
})
} else {
- this.cwChatConnector.onCustomFormAction(tabId, action)
+ this.cwChatConnector.onCustomFormAction(tabId, messageId ?? '', action)
}
break
case 'agentWalkthrough': {
diff --git a/packages/core/src/amazonq/webview/ui/main.ts b/packages/core/src/amazonq/webview/ui/main.ts
index d7285d81ba5..4767bc848ed 100644
--- a/packages/core/src/amazonq/webview/ui/main.ts
+++ b/packages/core/src/amazonq/webview/ui/main.ts
@@ -352,6 +352,7 @@ export const createMynahUI = (
...(item.followUp !== undefined ? { followUp: item.followUp } : {}),
...(item.fileList !== undefined ? { fileList: item.fileList } : {}),
...(item.header !== undefined ? { header: item.header } : { header: undefined }),
+ ...(item.buttons !== undefined ? { buttons: item.buttons } : { buttons: undefined }),
})
if (
item.messageId !== undefined &&
diff --git a/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts b/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts
index 486938c3cab..b796fb7dc34 100644
--- a/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts
+++ b/packages/core/src/codewhispererChat/clients/chat/v0/chat.ts
@@ -18,6 +18,9 @@ export class ChatSession {
// TODO: doesn't handle the edge case when two files share the same relativePath string but from different root
// e.g. root_a/file1 vs root_b/file1
relativePathToWorkspaceRoot: Map = new Map()
+
+ public storedBashCommands: string[] = []
+
public get sessionIdentifier(): string | undefined {
return this.sessionId
}
diff --git a/packages/core/src/codewhispererChat/controllers/chat/controller.ts b/packages/core/src/codewhispererChat/controllers/chat/controller.ts
index e1a41d69a23..750221dab59 100644
--- a/packages/core/src/codewhispererChat/controllers/chat/controller.ts
+++ b/packages/core/src/codewhispererChat/controllers/chat/controller.ts
@@ -4,6 +4,9 @@
*/
import * as path from 'path'
import * as vscode from 'vscode'
+import * as os from 'os'
+import { fs } from '../../../shared/fs/fs'
+import { ChildProcess } from '../../../shared/utilities/processUtils'
import { Event as VSCodeEvent, Uri, workspace, window, ViewColumn, Position, Selection } from 'vscode'
import { EditorContextExtractor } from '../../editor/context/extractor'
import { ChatSessionStorage } from '../../storages/chatSession'
@@ -68,7 +71,6 @@ import { MynahIconsType, MynahUIDataModel, QuickActionCommand } from '@aws/mynah
import { LspClient } from '../../../amazonq/lsp/lspClient'
import { AdditionalContextPrompt, ContextCommandItem, ContextCommandItemType } from '../../../amazonq/lsp/types'
import { workspaceCommand } from '../../../amazonq/webview/ui/tabs/constants'
-import fs from '../../../shared/fs/fs'
import { FeatureConfigProvider, Features } from '../../../shared/featureConfig'
import { i18n } from '../../../shared/i18n-helper'
import {
@@ -132,6 +134,8 @@ export interface ChatControllerMessageListeners {
}
export class ChatController {
+ // Store the last terminal output
+ private lastTerminalOutput: string = ''
private readonly sessionStorage: ChatSessionStorage
private readonly triggerEventsStorage: TriggerEventsStorage
private readonly messenger: Messenger
@@ -560,20 +564,99 @@ export class ChatController {
}
private async processCustomFormAction(message: CustomFormActionMessage) {
- if (message.action.id === 'submit-create-prompt') {
- const userPromptsDirectory = getUserPromptsDirectory()
+ const session = this.sessionStorage.getSession(message.tabID ?? '')
+ if (!session) {
+ getLogger().error(`No session found for tab: ${message.tabID ?? 'unknown'}`)
+ return
+ }
+ if (message.action.id === 'RunCommand') {
+ const terminals = vscode.window.terminals
+ let terminal: vscode.Terminal
- const title = message.action.formItemValues?.['prompt-name']
- const newFilePath = path.join(
- userPromptsDirectory,
- title ? `${title}${promptFileExtension}` : `default${promptFileExtension}`
- )
- const newFileContent = new Uint8Array(Buffer.from(''))
- await fs.writeFile(newFilePath, newFileContent)
- const newFileDoc = await vscode.workspace.openTextDocument(newFilePath)
- await vscode.window.showTextDocument(newFileDoc)
- telemetry.ui_click.emit({ elementId: 'amazonq_createSavedPrompt' })
+ if (terminals.length > 0) {
+ terminal = terminals[0]
+ } else {
+ terminal = vscode.window.createTerminal('Amazon Q Terminal')
+ }
+
+ terminal.show()
+
+ const command = session.storedBashCommands[0]
+
+ // Get the current path of the terminal
+ const currentPath = await this.getCurrentTerminalPath(terminal)
+
+ let terminalOutput = ''
+
+ try {
+ // Execute the command in the terminal's current directory
+ const childProcess = new ChildProcess('bash', ['-c', command], {
+ spawnOptions: { cwd: currentPath },
+ collect: true,
+ })
+
+ const result = await childProcess.run()
+
+ if (result.exitCode !== 0 || result.error) {
+ const errorMessage = result.error ? result.error.message : result.stderr
+ getLogger().error(`Error executing command: ${errorMessage}`)
+ terminal.sendText(`echo "Error executing command: ${errorMessage}"`)
+ this.lastTerminalOutput = `Error: ${errorMessage}`
+ } else {
+ terminalOutput = result.stdout.trim()
+ terminal.sendText(command)
+ getLogger().info(`Command executed: ${command}`)
+ getLogger().info(`Command output: ${terminalOutput}`)
+ this.lastTerminalOutput = terminalOutput
+ }
+ } catch (error) {
+ const errorMessage = error instanceof Error ? error.message : String(error)
+ getLogger().error(`Error executing command: ${errorMessage}`)
+ terminal.sendText(`echo "Error executing command: ${errorMessage}"`)
+ this.lastTerminalOutput = `Error: ${errorMessage}`
+ }
}
+ getLogger().error(`Last terminal output: ${this.getLastTerminalOutput()}`)
+ this.messenger.sendMessage(this.getLastTerminalOutput(), message.tabID ?? '', message.tabID ?? 'unknown')
+ session.storedBashCommands = []
+ }
+
+ private async getCurrentTerminalPath(terminal: vscode.Terminal): Promise {
+ try {
+ // Get the current workspace folders
+ const workspaceFolders = vscode.workspace.workspaceFolders
+
+ // Try to get the terminal's creation options
+ // We need to use type assertion since the API types might not expose cwd directly
+ const options = terminal.creationOptions as any
+ if (options) {
+ // Check if cwd exists in the options
+ if (options.cwd) {
+ if (typeof options.cwd === 'string') {
+ return options.cwd
+ } else if (options.cwd instanceof vscode.Uri) {
+ return options.cwd.fsPath
+ }
+ }
+ }
+
+ // If there's an active workspace folder, use its path
+ if (workspaceFolders && workspaceFolders.length > 0) {
+ const activeWorkspace = workspaceFolders[0]
+ return activeWorkspace.uri.fsPath
+ }
+
+ // Fallback to user's home directory
+ return os.homedir()
+ } catch (err) {
+ getLogger().error(`Failed to get terminal path: ${err}`)
+ return os.homedir()
+ }
+ }
+
+ // Get the last terminal output
+ public getLastTerminalOutput(): string {
+ return this.lastTerminalOutput
}
private async processContextSelected(message: ContextSelectedMessage) {
diff --git a/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts b/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts
index dd80676cf8b..a261b21d2f7 100644
--- a/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts
+++ b/packages/core/src/codewhispererChat/controllers/chat/messenger/messenger.ts
@@ -37,7 +37,7 @@ import { LspController } from '../../../../amazonq/lsp/lspController'
import { extractCodeBlockLanguage } from '../../../../shared/markdown'
import { extractAuthFollowUp } from '../../../../amazonq/util/authUtils'
import { helpMessage } from '../../../../amazonq/webview/ui/texts/constants'
-import { ChatItemButton, ChatItemFormItem, MynahUIDataModel } from '@aws/mynah-ui'
+import { ChatItemButton, ChatItemFormItem, MynahIcons, MynahUIDataModel } from '@aws/mynah-ui'
export type StaticTextResponseType = 'quick-action-help' | 'onboarding-help' | 'transform' | 'help'
@@ -313,6 +313,50 @@ export class Messenger {
)
}
+ if (message.includes('```bash')) {
+ let bashCommand: string | undefined
+ try {
+ const bashRegex = /```bash\s*([\s\S]*?)```/
+ const match = message.match(bashRegex)
+ if (match && match[1]) {
+ bashCommand = match[1].trim()
+ session.storedBashCommands.push(bashCommand)
+ getLogger().info(`Extracted bash command: ${bashCommand}`)
+ }
+
+ const buttons: ChatItemButton[] = []
+ buttons.push({
+ keepCardAfterClick: true,
+ text: 'Run the bash command in terminal',
+ id: 'RunCommand',
+ disabled: false, // allow button to be re-clicked
+ position: 'outside',
+ icon: 'comment' as MynahIcons,
+ })
+
+ this.dispatcher.sendChatMessage(
+ new ChatMessage(
+ {
+ message: message,
+ messageType: 'answer-part',
+ followUps: followUps,
+ followUpsHeader: undefined,
+ relatedSuggestions: undefined,
+ triggerID,
+ messageID,
+ userIntent: triggerPayload.userIntent,
+ codeBlockLanguage: undefined,
+ contextList: undefined,
+ buttons,
+ },
+ tabID
+ )
+ )
+ } catch (error) {
+ const errorMessage = error instanceof Error ? error.message : String(error)
+ getLogger().error(`Error executing command: ${errorMessage}`)
+ }
+ }
this.dispatcher.sendChatMessage(
new ChatMessage(
{
@@ -365,6 +409,26 @@ export class Messenger {
)
}
+ public sendMessage(message: string | undefined, messageID: string, tabID: string) {
+ this.dispatcher.sendChatMessage(
+ new ChatMessage(
+ {
+ message: message,
+ messageType: 'answer',
+ followUps: [],
+ followUpsHeader: undefined,
+ relatedSuggestions: undefined,
+ triggerID: '',
+ messageID,
+ userIntent: undefined,
+ codeBlockLanguage: undefined,
+ contextList: undefined,
+ },
+ tabID
+ )
+ )
+ }
+
private editorContextMenuCommandVerbs: Map = new Map([
['aws.amazonq.explainCode', 'Explain'],
['aws.amazonq.explainIssue', 'Explain'],
diff --git a/packages/core/src/codewhispererChat/view/connector/connector.ts b/packages/core/src/codewhispererChat/view/connector/connector.ts
index 0b2b29498c4..104fc6c5bca 100644
--- a/packages/core/src/codewhispererChat/view/connector/connector.ts
+++ b/packages/core/src/codewhispererChat/view/connector/connector.ts
@@ -208,6 +208,7 @@ export interface ChatMessageProps {
readonly userIntent: string | undefined
readonly codeBlockLanguage: string | undefined
readonly contextList: DocumentReference[] | undefined
+ readonly buttons?: ChatItemButton[] | undefined
}
export class ChatMessage extends UiMessage {
@@ -223,6 +224,7 @@ export class ChatMessage extends UiMessage {
readonly userIntent: string | undefined
readonly codeBlockLanguage: string | undefined
readonly contextList: DocumentReference[] | undefined
+ readonly buttons?: ChatItemButton[] | undefined
override type = 'chatMessage'
constructor(props: ChatMessageProps, tabID: string) {
@@ -238,6 +240,7 @@ export class ChatMessage extends UiMessage {
this.userIntent = props.userIntent
this.codeBlockLanguage = props.codeBlockLanguage
this.contextList = props.contextList
+ this.buttons = props.buttons
}
}
From b136dbea65505ee3b4dc6ea3610218e887256886 Mon Sep 17 00:00:00 2001
From: laileni
Date: Wed, 19 Mar 2025 12:05:46 -0700
Subject: [PATCH 3/4] Refactoring code to store the logs from the terminal.
---
.../controllers/chat/controller.ts | 78 +++++--------------
1 file changed, 18 insertions(+), 60 deletions(-)
diff --git a/packages/core/src/codewhispererChat/controllers/chat/controller.ts b/packages/core/src/codewhispererChat/controllers/chat/controller.ts
index 92c1a2a6fb8..d5d8c56d6f8 100644
--- a/packages/core/src/codewhispererChat/controllers/chat/controller.ts
+++ b/packages/core/src/codewhispererChat/controllers/chat/controller.ts
@@ -4,9 +4,7 @@
*/
import * as path from 'path'
import * as vscode from 'vscode'
-import * as os from 'os'
import { fs } from '../../../shared/fs/fs'
-import { ChildProcess } from '../../../shared/utilities/processUtils'
import { Event as VSCodeEvent, Uri, workspace, window, ViewColumn, Position, Selection } from 'vscode'
import { EditorContextExtractor } from '../../editor/context/extractor'
import { ChatSessionStorage } from '../../storages/chatSession'
@@ -82,6 +80,7 @@ import {
contextMaxLength,
} from '../../constants'
import { ChatSession } from '../../clients/chat/v0/chat'
+import { tempDirPath } from '../../../shared/filesystemUtilities'
export interface ChatControllerMessagePublishers {
readonly processPromptChatMessage: MessagePublisher
@@ -580,35 +579,26 @@ export class ChatController {
}
terminal.show()
+ // Create a temporary file at /tmp/aws-toolkit-vscode/agenticChatTerminalCommandLogs.log
+ const outLogFilePath = path.join(tempDirPath, 'agenticChatTerminalCommandLogs.log')
- const command = session.storedBashCommands[0]
+ try {
+ const command = `${session.storedBashCommands[0]} > ${outLogFilePath}`
- // Get the current path of the terminal
- const currentPath = await this.getCurrentTerminalPath(terminal)
+ // Execute the command in terminal
+ terminal.sendText(command)
- let terminalOutput = ''
+ // Store the outLogFilePath text in lastTerminalOutput
+ this.lastTerminalOutput = outLogFilePath
- try {
- // Execute the command in the terminal's current directory
- const childProcess = new ChildProcess('bash', ['-c', command], {
- spawnOptions: { cwd: currentPath },
- collect: true,
- })
+ getLogger().info(`Command executed: ${command}`)
+ getLogger().info(`Output saved to: ${outLogFilePath}`)
- const result = await childProcess.run()
-
- if (result.exitCode !== 0 || result.error) {
- const errorMessage = result.error ? result.error.message : result.stderr
- getLogger().error(`Error executing command: ${errorMessage}`)
- terminal.sendText(`echo "Error executing command: ${errorMessage}"`)
- this.lastTerminalOutput = `Error: ${errorMessage}`
- } else {
- terminalOutput = result.stdout.trim()
- terminal.sendText(command)
- getLogger().info(`Command executed: ${command}`)
- getLogger().info(`Command output: ${terminalOutput}`)
- this.lastTerminalOutput = terminalOutput
- }
+ // TODO: Move this deleting temp file logic near send the logs to RTS.
+ // Delete the temporary agenticChatTerminalCommandLogs file
+ fs.delete(outLogFilePath).catch((err: Error) => {
+ getLogger().error(`Failed to delete output log file: ${err}`)
+ })
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error)
getLogger().error(`Error executing command: ${errorMessage}`)
@@ -616,44 +606,12 @@ export class ChatController {
this.lastTerminalOutput = `Error: ${errorMessage}`
}
}
- getLogger().error(`Last terminal output: ${this.getLastTerminalOutput()}`)
+
+ getLogger().info(`Last terminal output: ${this.getLastTerminalOutput()}`)
this.messenger.sendMessage(this.getLastTerminalOutput(), message.tabID ?? '', message.tabID ?? 'unknown')
session.storedBashCommands = []
}
- private async getCurrentTerminalPath(terminal: vscode.Terminal): Promise {
- try {
- // Get the current workspace folders
- const workspaceFolders = vscode.workspace.workspaceFolders
-
- // Try to get the terminal's creation options
- // We need to use type assertion since the API types might not expose cwd directly
- const options = terminal.creationOptions as any
- if (options) {
- // Check if cwd exists in the options
- if (options.cwd) {
- if (typeof options.cwd === 'string') {
- return options.cwd
- } else if (options.cwd instanceof vscode.Uri) {
- return options.cwd.fsPath
- }
- }
- }
-
- // If there's an active workspace folder, use its path
- if (workspaceFolders && workspaceFolders.length > 0) {
- const activeWorkspace = workspaceFolders[0]
- return activeWorkspace.uri.fsPath
- }
-
- // Fallback to user's home directory
- return os.homedir()
- } catch (err) {
- getLogger().error(`Failed to get terminal path: ${err}`)
- return os.homedir()
- }
- }
-
// Get the last terminal output
public getLastTerminalOutput(): string {
return this.lastTerminalOutput
From 49bd9cd138692375749c6d970c87c70309b03790 Mon Sep 17 00:00:00 2001
From: laileni
Date: Wed, 19 Mar 2025 12:27:54 -0700
Subject: [PATCH 4/4] Show the logs in the chatwindow
---
.../controllers/chat/controller.ts | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/packages/core/src/codewhispererChat/controllers/chat/controller.ts b/packages/core/src/codewhispererChat/controllers/chat/controller.ts
index d5d8c56d6f8..3b22cca6b0d 100644
--- a/packages/core/src/codewhispererChat/controllers/chat/controller.ts
+++ b/packages/core/src/codewhispererChat/controllers/chat/controller.ts
@@ -588,8 +588,20 @@ export class ChatController {
// Execute the command in terminal
terminal.sendText(command)
- // Store the outLogFilePath text in lastTerminalOutput
- this.lastTerminalOutput = outLogFilePath
+ // Read the content from outLogFilePath and store it in lastTerminalOutput
+ try {
+ // Wait a moment for the command to complete and write to the file
+ await new Promise((resolve) => setTimeout(resolve, 500))
+
+ if (await fs.existsFile(outLogFilePath)) {
+ this.lastTerminalOutput = await fs.readFileText(outLogFilePath)
+ } else {
+ this.lastTerminalOutput = 'Command executed, but no output was captured.'
+ }
+ } catch (readErr) {
+ getLogger().error(`Failed to read output log file: ${readErr}`)
+ this.lastTerminalOutput = `Error reading command output: ${readErr}`
+ }
getLogger().info(`Command executed: ${command}`)
getLogger().info(`Output saved to: ${outLogFilePath}`)