Skip to content

Commit b013042

Browse files
committed
refactor(amazonqFeatureDev): include updated rts model
1 parent e05a87a commit b013042

File tree

6 files changed

+189
-59
lines changed

6 files changed

+189
-59
lines changed

packages/core/src/amazonqFeatureDev/client/codewhispererruntime-2022-11-11.json

Lines changed: 115 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@
353353
},
354354
"AppStudioStatePropertyValueString": {
355355
"type": "string",
356-
"max": 1024,
357-
"min": 1,
356+
"max": 10240,
357+
"min": 0,
358358
"sensitive": true
359359
},
360360
"ArtifactId": {
@@ -613,6 +613,17 @@
613613
},
614614
"exception": true
615615
},
616+
"ConsoleState": {
617+
"type": "structure",
618+
"members": {
619+
"region": { "shape": "String" },
620+
"consoleUrl": { "shape": "SensitiveString" },
621+
"serviceId": { "shape": "String" },
622+
"serviceConsolePage": { "shape": "String" },
623+
"serviceSubconsolePage": { "shape": "String" },
624+
"taskName": { "shape": "SensitiveString" }
625+
}
626+
},
616627
"ContentChecksumType": {
617628
"type": "string",
618629
"enum": ["SHA_256"]
@@ -811,7 +822,8 @@
811822
"members": {
812823
"document": { "shape": "TextDocument" },
813824
"cursorState": { "shape": "CursorState" },
814-
"relevantDocuments": { "shape": "RelevantDocumentList" }
825+
"relevantDocuments": { "shape": "RelevantDocumentList" },
826+
"useRelevantDocuments": { "shape": "Boolean" }
815827
}
816828
},
817829
"EnvState": {
@@ -1093,6 +1105,21 @@
10931105
"max": 10,
10941106
"min": 0
10951107
},
1108+
"InlineChatEvent": {
1109+
"type": "structure",
1110+
"members": {
1111+
"inputLength": { "shape": "PrimitiveInteger" },
1112+
"numSelectedLines": { "shape": "PrimitiveInteger" },
1113+
"codeIntent": { "shape": "Boolean" },
1114+
"userDecision": { "shape": "InlineChatUserDecision" },
1115+
"responseStartLatency": { "shape": "Double" },
1116+
"responseEndLatency": { "shape": "Double" }
1117+
}
1118+
},
1119+
"InlineChatUserDecision": {
1120+
"type": "string",
1121+
"enum": ["ACCEPT", "REJECT", "DISMISS"]
1122+
},
10961123
"Integer": {
10971124
"type": "integer",
10981125
"box": true
@@ -1535,7 +1562,9 @@
15351562
"required": ["conversationState", "workspaceState"],
15361563
"members": {
15371564
"conversationState": { "shape": "ConversationState" },
1538-
"workspaceState": { "shape": "WorkspaceState" }
1565+
"workspaceState": { "shape": "WorkspaceState" },
1566+
"taskAssistPlan": { "shape": "TaskAssistPlan" },
1567+
"currentCodeGenerationId": { "shape": "CodeGenerationId" }
15391568
}
15401569
},
15411570
"StartTaskAssistCodeGenerationResponse": {
@@ -1648,6 +1677,46 @@
16481677
"type": "string",
16491678
"enum": ["DECLARATION", "USAGE"]
16501679
},
1680+
"TaskAssistPlan": {
1681+
"type": "list",
1682+
"member": { "shape": "TaskAssistPlanStep" },
1683+
"min": 0
1684+
},
1685+
"TaskAssistPlanStep": {
1686+
"type": "structure",
1687+
"required": ["filePath", "description"],
1688+
"members": {
1689+
"filePath": { "shape": "TaskAssistPlanStepFilePathString" },
1690+
"description": { "shape": "TaskAssistPlanStepDescriptionString" },
1691+
"startLine": { "shape": "TaskAssistPlanStepStartLineInteger" },
1692+
"endLine": { "shape": "TaskAssistPlanStepEndLineInteger" },
1693+
"action": { "shape": "TaskAssistPlanStepAction" }
1694+
}
1695+
},
1696+
"TaskAssistPlanStepAction": {
1697+
"type": "string",
1698+
"enum": ["MODIFY", "CREATE", "DELETE", "UNKNOWN"]
1699+
},
1700+
"TaskAssistPlanStepDescriptionString": {
1701+
"type": "string",
1702+
"max": 1024,
1703+
"min": 1
1704+
},
1705+
"TaskAssistPlanStepEndLineInteger": {
1706+
"type": "integer",
1707+
"box": true,
1708+
"min": 0
1709+
},
1710+
"TaskAssistPlanStepFilePathString": {
1711+
"type": "string",
1712+
"max": 1024,
1713+
"min": 1
1714+
},
1715+
"TaskAssistPlanStepStartLineInteger": {
1716+
"type": "integer",
1717+
"box": true,
1718+
"min": 0
1719+
},
16511720
"TaskAssistPlanningUploadContext": {
16521721
"type": "structure",
16531722
"required": ["conversationId"],
@@ -1668,7 +1737,8 @@
16681737
"chatInteractWithMessageEvent": { "shape": "ChatInteractWithMessageEvent" },
16691738
"chatUserModificationEvent": { "shape": "ChatUserModificationEvent" },
16701739
"terminalUserInteractionEvent": { "shape": "TerminalUserInteractionEvent" },
1671-
"featureDevEvent": { "shape": "FeatureDevEvent" }
1740+
"featureDevEvent": { "shape": "FeatureDevEvent" },
1741+
"inlineChatEvent": { "shape": "InlineChatEvent" }
16721742
},
16731743
"union": true
16741744
},
@@ -1777,7 +1847,7 @@
17771847
},
17781848
"TransformationDownloadArtifactType": {
17791849
"type": "string",
1780-
"enum": ["ClientInstructions", "Logs"]
1850+
"enum": ["ClientInstructions", "Logs", "GeneratedCode"]
17811851
},
17821852
"TransformationDownloadArtifacts": {
17831853
"type": "list",
@@ -1808,7 +1878,15 @@
18081878
},
18091879
"TransformationLanguage": {
18101880
"type": "string",
1811-
"enum": ["JAVA_8", "JAVA_11", "JAVA_17", "C_SHARP"]
1881+
"enum": ["JAVA_8", "JAVA_11", "JAVA_17", "C_SHARP", "COBOL", "PL_I", "JCL"]
1882+
},
1883+
"TransformationLanguages": {
1884+
"type": "list",
1885+
"member": { "shape": "TransformationLanguage" }
1886+
},
1887+
"TransformationMainframeRuntimeEnv": {
1888+
"type": "string",
1889+
"enum": ["MAINFRAME"]
18121890
},
18131891
"TransformationOperatingSystemFamily": {
18141892
"type": "string",
@@ -1841,24 +1919,40 @@
18411919
},
18421920
"TransformationProgressUpdateStatus": {
18431921
"type": "string",
1844-
"enum": ["IN_PROGRESS", "COMPLETED", "FAILED", "PAUSED"]
1922+
"enum": ["IN_PROGRESS", "COMPLETED", "FAILED", "PAUSED", "AWAITING_CLIENT_ACTION"]
1923+
},
1924+
"TransformationProjectArtifactDescriptor": {
1925+
"type": "structure",
1926+
"members": {
1927+
"sourceCodeArtifact": { "shape": "TransformationSourceCodeArtifactDescriptor" }
1928+
},
1929+
"union": true
18451930
},
18461931
"TransformationProjectState": {
18471932
"type": "structure",
18481933
"members": {
18491934
"language": { "shape": "TransformationLanguage" },
18501935
"runtimeEnv": { "shape": "TransformationRuntimeEnv" },
1851-
"platformConfig": { "shape": "TransformationPlatformConfig" }
1936+
"platformConfig": { "shape": "TransformationPlatformConfig" },
1937+
"projectArtifact": { "shape": "TransformationProjectArtifactDescriptor" }
18521938
}
18531939
},
18541940
"TransformationRuntimeEnv": {
18551941
"type": "structure",
18561942
"members": {
18571943
"java": { "shape": "TransformationJavaRuntimeEnv" },
1858-
"dotNet": { "shape": "TransformationDotNetRuntimeEnv" }
1944+
"dotNet": { "shape": "TransformationDotNetRuntimeEnv" },
1945+
"mainframe": { "shape": "TransformationMainframeRuntimeEnv" }
18591946
},
18601947
"union": true
18611948
},
1949+
"TransformationSourceCodeArtifactDescriptor": {
1950+
"type": "structure",
1951+
"members": {
1952+
"languages": { "shape": "TransformationLanguages" },
1953+
"runtimeEnv": { "shape": "TransformationRuntimeEnv" }
1954+
}
1955+
},
18621956
"TransformationSpec": {
18631957
"type": "structure",
18641958
"members": {
@@ -1912,11 +2006,11 @@
19122006
},
19132007
"TransformationType": {
19142008
"type": "string",
1915-
"enum": ["LANGUAGE_UPGRADE"]
2009+
"enum": ["LANGUAGE_UPGRADE", "DOCUMENT_GENERATION"]
19162010
},
19172011
"TransformationUploadArtifactType": {
19182012
"type": "string",
1919-
"enum": ["Dependencies"]
2013+
"enum": ["Dependencies", "ClientBuildResult"]
19202014
},
19212015
"TransformationUploadContext": {
19222016
"type": "structure",
@@ -1998,7 +2092,9 @@
19982092
"gitState": { "shape": "GitState" },
19992093
"envState": { "shape": "EnvState" },
20002094
"appStudioContext": { "shape": "AppStudioState" },
2001-
"diagnostic": { "shape": "Diagnostic" }
2095+
"diagnostic": { "shape": "Diagnostic" },
2096+
"consoleState": { "shape": "ConsoleState" },
2097+
"userSettings": { "shape": "UserSettings" }
20022098
}
20032099
},
20042100
"UserIntent": {
@@ -2026,6 +2122,12 @@
20262122
"timestamp": { "shape": "Timestamp" }
20272123
}
20282124
},
2125+
"UserSettings": {
2126+
"type": "structure",
2127+
"members": {
2128+
"hasConsentedToCrossRegionCalls": { "shape": "Boolean" }
2129+
}
2130+
},
20292131
"UserTriggerDecisionEvent": {
20302132
"type": "structure",
20312133
"required": [

packages/core/src/amazonqFeatureDev/client/featureDev.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { ServiceOptions } from '../../shared/awsClientBuilder'
1010
import globals from '../../shared/extensionGlobals'
1111
import { getLogger } from '../../shared/logger'
1212
import * as FeatureDevProxyClient from './featuredevproxyclient'
13-
import apiConfig = require('./codewhispererruntime-2022-11-11.json')
1413
import { featureName } from '../constants'
1514
import { CodeReference } from '../../amazonq/webview/ui/connector'
1615
import {
@@ -25,6 +24,7 @@ import { getCodewhispererConfig } from '../../codewhisperer/client/codewhisperer
2524
import { createCodeWhispererChatStreamingClient } from '../../shared/clients/codewhispererChatClient'
2625
import { getClientId, getOptOutPreference, getOperatingSystem } from '../../shared/telemetry/util'
2726
import { extensionVersion } from '../../shared/vscode/env'
27+
import apiConfig = require('./codewhispererruntime-2022-11-11.json')
2828

2929
// Create a client for featureDev proxy client based off of aws sdk v2
3030
export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClient> {
@@ -117,7 +117,12 @@ export class FeatureDevClient {
117117
}
118118
}
119119

120-
public async startCodeGeneration(conversationId: string, uploadId: string, message: string) {
120+
public async startCodeGeneration(
121+
conversationId: string,
122+
uploadId: string,
123+
message: string,
124+
currentCodeGenerationId?: string
125+
) {
121126
try {
122127
const client = await this.getClient()
123128
const params = {
@@ -132,6 +137,9 @@ export class FeatureDevClient {
132137
uploadId,
133138
programmingLanguage: { languageName: 'javascript' },
134139
},
140+
} as FeatureDevProxyClient.Types.StartTaskAssistCodeGenerationRequest
141+
if (currentCodeGenerationId) {
142+
params.currentCodeGenerationId = currentCodeGenerationId
135143
}
136144
getLogger().debug(`Executing startTaskAssistCodeGeneration with %O`, params)
137145
const response = await client.startTaskAssistCodeGeneration(params).promise()

packages/core/src/amazonqFeatureDev/controllers/chat/controller.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,11 @@ export class FeatureDevController {
351351
const deletedFiles = session.state.deletedFiles ?? []
352352

353353
// Only add the follow up accept/deny buttons when the tab hasn't been closed/request hasn't been cancelled
354-
if (session?.state.tokenSource.token.isCancellationRequested) {
355-
this.workOnNewTask(message)
354+
if (session?.state?.tokenSource?.token.isCancellationRequested) {
355+
session?.state.tokenSource?.dispose()
356+
if (session?.state?.tokenSource) {
357+
session.state.tokenSource = undefined
358+
}
356359
return
357360
}
358361

@@ -703,11 +706,9 @@ export class FeatureDevController {
703706
type: 'answer-part',
704707
tabID: message.tabID,
705708
})
706-
707-
const session = await this.sessionStorage.getSession(message.tabID)
708-
session.state.tokenSource.cancel()
709-
710709
this.workOnNewTask(message)
710+
const session = await this.sessionStorage.getSession(message.tabID)
711+
session.state?.tokenSource?.cancel()
711712
}
712713

713714
private async tabOpened(message: any) {

packages/core/src/amazonqFeatureDev/session/session.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export class Session {
109109
workspaceFolders: this.config.workspaceFolders,
110110
proxyClient: this.proxyClient,
111111
conversationId: this.conversationId,
112+
currentCodeGenerationId: this.currentCodeGenerationId as string,
112113
}
113114
}
114115

@@ -135,7 +136,7 @@ export class Session {
135136

136137
if (resp.nextState) {
137138
// Cancel the request before moving to a new state
138-
this.state.tokenSource.cancel()
139+
this.state?.tokenSource?.cancel()
139140

140141
// Move to the next state
141142
this._state = resp.nextState
@@ -182,6 +183,10 @@ export class Session {
182183
return this._state
183184
}
184185

186+
get currentCodeGenerationId() {
187+
return this.state.currentCodeGenerationId
188+
}
189+
185190
get uploadId() {
186191
if (!('uploadId' in this.state)) {
187192
throw new Error("UploadId has to be initialized before it's read")

0 commit comments

Comments
 (0)