@aws/lsp-codewhisperer 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/out/client/sigv4/service.json +1 -1
- package/out/client/token/bearer-token-service.json +1 -1
- package/out/index.d.ts +1 -0
- package/out/index.js +1 -0
- package/out/index.js.map +1 -1
- package/out/language-server/chat/chatController.d.ts +25 -0
- package/out/language-server/chat/chatController.js +117 -0
- package/out/language-server/chat/chatController.js.map +1 -0
- package/out/language-server/chat/chatController.test.d.ts +1 -0
- package/out/language-server/chat/chatController.test.js +240 -0
- package/out/language-server/chat/chatController.test.js.map +1 -0
- package/out/language-server/chat/chatEventParser.d.ts +24 -0
- package/out/language-server/chat/chatEventParser.js +84 -0
- package/out/language-server/chat/chatEventParser.js.map +1 -0
- package/out/language-server/chat/chatEventParser.test.d.ts +1 -0
- package/out/language-server/chat/chatEventParser.test.js +189 -0
- package/out/language-server/chat/chatEventParser.test.js.map +1 -0
- package/out/language-server/chat/chatSessionManagementService.d.ts +16 -0
- package/out/language-server/chat/chatSessionManagementService.js +92 -0
- package/out/language-server/chat/chatSessionManagementService.js.map +1 -0
- package/out/language-server/chat/chatSessionManagementService.test.d.ts +1 -0
- package/out/language-server/chat/chatSessionManagementService.test.js +73 -0
- package/out/language-server/chat/chatSessionManagementService.test.js.map +1 -0
- package/out/language-server/chat/chatSessionService.d.ts +13 -0
- package/out/language-server/chat/chatSessionService.js +63 -0
- package/out/language-server/chat/chatSessionService.js.map +1 -0
- package/out/language-server/chat/chatSessionService.test.d.ts +1 -0
- package/out/language-server/chat/chatSessionService.test.js +80 -0
- package/out/language-server/chat/chatSessionService.test.js.map +1 -0
- package/out/language-server/chat/contexts/documentContext.d.ts +17 -0
- package/out/language-server/chat/contexts/documentContext.js +59 -0
- package/out/language-server/chat/contexts/documentContext.js.map +1 -0
- package/out/language-server/chat/contexts/documentContext.test.d.ts +1 -0
- package/out/language-server/chat/contexts/documentContext.test.js +147 -0
- package/out/language-server/chat/contexts/documentContext.test.js.map +1 -0
- package/out/language-server/chat/contexts/utils.d.ts +10 -0
- package/out/language-server/chat/contexts/utils.js +71 -0
- package/out/language-server/chat/contexts/utils.js.map +1 -0
- package/out/language-server/chat/contexts/utils.test.d.ts +1 -0
- package/out/language-server/chat/contexts/utils.test.js +72 -0
- package/out/language-server/chat/contexts/utils.test.js.map +1 -0
- package/out/language-server/chat/utils.d.ts +4 -0
- package/out/language-server/chat/utils.js +34 -0
- package/out/language-server/chat/utils.js.map +1 -0
- package/out/language-server/codeWhispererSecurityScanServer.d.ts +1 -1
- package/out/language-server/codeWhispererSecurityScanServer.js +41 -26
- package/out/language-server/codeWhispererSecurityScanServer.js.map +1 -1
- package/out/language-server/codeWhispererServer.js +1 -1
- package/out/language-server/codeWhispererServer.js.map +1 -1
- package/out/language-server/languageDetection.d.ts +9 -2
- package/out/language-server/languageDetection.js +84 -20
- package/out/language-server/languageDetection.js.map +1 -1
- package/out/language-server/languageDetection.test.d.ts +1 -0
- package/out/language-server/languageDetection.test.js +31 -0
- package/out/language-server/languageDetection.test.js.map +1 -0
- package/out/language-server/proxy-server.d.ts +1 -0
- package/out/language-server/proxy-server.js +35 -1
- package/out/language-server/proxy-server.js.map +1 -1
- package/out/language-server/qChatServer.d.ts +3 -0
- package/out/language-server/qChatServer.js +31 -0
- package/out/language-server/qChatServer.js.map +1 -0
- package/out/language-server/qChatServer.test.d.ts +1 -0
- package/out/language-server/qChatServer.test.js +51 -0
- package/out/language-server/qChatServer.test.js.map +1 -0
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.d.ts +2 -3
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.js +5 -23
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.js.map +1 -1
- package/out/language-server/securityScan/types.d.ts +8 -6
- package/out/language-server/testUtils.d.ts +1 -0
- package/out/language-server/testUtils.js +17 -1
- package/out/language-server/testUtils.js.map +1 -1
- package/out/language-server/types.d.ts +13 -0
- package/out/language-server/types.js +3 -0
- package/out/language-server/types.js.map +1 -0
- package/out/language-server/utils.d.ts +3 -0
- package/out/language-server/utils.js +19 -1
- package/out/language-server/utils.js.map +1 -1
- package/out/language-server/utils.test.d.ts +1 -0
- package/out/language-server/utils.test.js +33 -0
- package/out/language-server/utils.test.js.map +1 -0
- package/package.json +13 -4
- package/src.gen/@amzn/codewhisperer-streaming/LICENSE +201 -0
- package/src.gen/@amzn/codewhisperer-streaming/README.md +464 -0
- package/src.gen/@amzn/codewhisperer-streaming/api-extractor.json +4 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/CodeWhispererStreaming.js +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/CodeWhispererStreamingClient.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/ExportResultArchiveCommand.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/GenerateAssistantResponseCommand.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/GenerateTaskAssistPlanCommand.js +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/commands/index.js +6 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/endpoints.js +165 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/extensionConfiguration.js +2 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/index.js +10 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/models/CodeWhispererStreamingServiceException.js +12 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/models/index.js +4 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/models/models_0.js +361 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/protocols/Aws_restJson1.js +458 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.browser.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.js +46 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.native.js +15 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeConfig.shared.js +22 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-cjs/runtimeExtensions.js +22 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/CodeWhispererStreaming.js +13 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/CodeWhispererStreamingClient.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/ExportResultArchiveCommand.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/GenerateAssistantResponseCommand.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/GenerateTaskAssistPlanCommand.js +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/commands/index.js +3 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/endpoints.js +161 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/extensionConfiguration.js +1 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/index.js +5 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/models/CodeWhispererStreamingServiceException.js +8 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/models/index.js +1 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/models/models_0.js +328 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/protocols/Aws_restJson1.js +449 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.browser.js +33 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.js +41 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.native.js +11 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeConfig.shared.js +18 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-es/runtimeExtensions.js +18 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/CodeWhispererStreaming.d.ts +30 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/CodeWhispererStreamingClient.d.ts +169 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/ExportResultArchiveCommand.d.ts +103 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/GenerateAssistantResponseCommand.d.ts +294 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/GenerateTaskAssistPlanCommand.d.ts +304 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/commands/index.d.ts +3 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/endpoints.d.ts +2 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/extensionConfiguration.d.ts +8 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/index.d.ts +5 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/models/CodeWhispererStreamingServiceException.d.ts +13 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/models/index.d.ts +1 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/models/models_0.d.ts +1173 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/protocols/Aws_restJson1.d.ts +29 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.browser.d.ts +39 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.d.ts +39 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.native.d.ts +38 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeConfig.shared.d.ts +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/dist-types/runtimeExtensions.d.ts +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/package.json +87 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/CodeWhispererStreaming.ts +84 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/CodeWhispererStreamingClient.ts +304 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/ExportResultArchiveCommand.ts +177 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts +369 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateTaskAssistPlanCommand.ts +379 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/commands/index.ts +4 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/endpoints.ts +170 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/extensionConfiguration.ts +12 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/index.ts +8 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/models/CodeWhispererStreamingServiceException.ts +22 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/models/index.ts +2 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/models/models_0.ts +1518 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/protocols/Aws_restJson1.ts +740 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.browser.ts +42 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.native.ts +17 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.shared.ts +24 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeConfig.ts +55 -0
- package/src.gen/@amzn/codewhisperer-streaming/src/runtimeExtensions.ts +44 -0
- package/src.gen/@amzn/codewhisperer-streaming/typedoc.json +5 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// smithy-typescript generated code
|
|
2
|
+
import {
|
|
3
|
+
CodeWhispererStreamingClientResolvedConfig,
|
|
4
|
+
ServiceInputTypes,
|
|
5
|
+
ServiceOutputTypes,
|
|
6
|
+
} from '../CodeWhispererStreamingClient'
|
|
7
|
+
import {
|
|
8
|
+
ExportResultArchiveRequest,
|
|
9
|
+
ExportResultArchiveResponse,
|
|
10
|
+
ExportResultArchiveResponseFilterSensitiveLog,
|
|
11
|
+
} from '../models/models_0'
|
|
12
|
+
import { de_ExportResultArchiveCommand, se_ExportResultArchiveCommand } from '../protocols/Aws_restJson1'
|
|
13
|
+
import { getSerdePlugin } from '@smithy/middleware-serde'
|
|
14
|
+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from '@smithy/protocol-http'
|
|
15
|
+
import { Command as $Command } from '@smithy/smithy-client'
|
|
16
|
+
import {
|
|
17
|
+
FinalizeHandlerArguments,
|
|
18
|
+
Handler,
|
|
19
|
+
HandlerExecutionContext,
|
|
20
|
+
MiddlewareStack,
|
|
21
|
+
SMITHY_CONTEXT_KEY,
|
|
22
|
+
EventStreamSerdeContext as __EventStreamSerdeContext,
|
|
23
|
+
HttpHandlerOptions as __HttpHandlerOptions,
|
|
24
|
+
MetadataBearer as __MetadataBearer,
|
|
25
|
+
SerdeContext as __SerdeContext,
|
|
26
|
+
} from '@smithy/types'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export { __MetadataBearer, $Command }
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*
|
|
35
|
+
* The input for {@link ExportResultArchiveCommand}.
|
|
36
|
+
*/
|
|
37
|
+
export interface ExportResultArchiveCommandInput extends ExportResultArchiveRequest {}
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
*
|
|
41
|
+
* The output of {@link ExportResultArchiveCommand}.
|
|
42
|
+
*/
|
|
43
|
+
export interface ExportResultArchiveCommandOutput extends ExportResultArchiveResponse, __MetadataBearer {}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
* API to export operation result as an archive
|
|
48
|
+
* @example
|
|
49
|
+
* Use a bare-bones client and the command you need to make an API call.
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { CodeWhispererStreamingClient, ExportResultArchiveCommand } from "@amzn/codewhisperer-streaming"; // ES Modules import
|
|
52
|
+
* // const { CodeWhispererStreamingClient, ExportResultArchiveCommand } = require("@amzn/codewhisperer-streaming"); // CommonJS import
|
|
53
|
+
* const client = new CodeWhispererStreamingClient(config);
|
|
54
|
+
* const input = { // ExportResultArchiveRequest
|
|
55
|
+
* exportId: "STRING_VALUE", // required
|
|
56
|
+
* exportIntent: "TRANSFORMATION" || "TASK_ASSIST", // required
|
|
57
|
+
* };
|
|
58
|
+
* const command = new ExportResultArchiveCommand(input);
|
|
59
|
+
* const response = await client.send(command);
|
|
60
|
+
* // { // ExportResultArchiveResponse
|
|
61
|
+
* // body: { // ResultArchiveStream Union: only one key present
|
|
62
|
+
* // binaryMetadataEvent: { // BinaryMetadataEvent
|
|
63
|
+
* // size: Number("long"),
|
|
64
|
+
* // mimeType: "STRING_VALUE",
|
|
65
|
+
* // contentChecksum: "STRING_VALUE",
|
|
66
|
+
* // contentChecksumType: "SHA_256",
|
|
67
|
+
* // },
|
|
68
|
+
* // binaryPayloadEvent: { // BinaryPayloadEvent
|
|
69
|
+
* // bytes: "BLOB_VALUE",
|
|
70
|
+
* // },
|
|
71
|
+
* // internalServerException: { // InternalServerException
|
|
72
|
+
* // message: "STRING_VALUE", // required
|
|
73
|
+
* // },
|
|
74
|
+
* // },
|
|
75
|
+
* // };
|
|
76
|
+
*
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @param ExportResultArchiveCommandInput - {@link ExportResultArchiveCommandInput}
|
|
80
|
+
* @returns {@link ExportResultArchiveCommandOutput}
|
|
81
|
+
* @see {@link ExportResultArchiveCommandInput} for command's `input` shape.
|
|
82
|
+
* @see {@link ExportResultArchiveCommandOutput} for command's `response` shape.
|
|
83
|
+
* @see {@link CodeWhispererStreamingClientResolvedConfig | config} for CodeWhispererStreamingClient's `config` shape.
|
|
84
|
+
*
|
|
85
|
+
* @throws {@link InternalServerException} (server fault)
|
|
86
|
+
* This exception is thrown when an unexpected error occurred during the processing of a request.
|
|
87
|
+
*
|
|
88
|
+
* @throws {@link ThrottlingException} (client fault)
|
|
89
|
+
* This exception is thrown when request was denied due to request throttling.
|
|
90
|
+
*
|
|
91
|
+
* @throws {@link ValidationException} (client fault)
|
|
92
|
+
* This exception is thrown when the input fails to satisfy the constraints specified by the service.
|
|
93
|
+
*
|
|
94
|
+
* @throws {@link ConflictException} (client fault)
|
|
95
|
+
* This exception is thrown when the action to perform could not be completed because the resource is in a conflicting state.
|
|
96
|
+
*
|
|
97
|
+
* @throws {@link ResourceNotFoundException} (client fault)
|
|
98
|
+
* This exception is thrown when describing a resource that does not exist.
|
|
99
|
+
*
|
|
100
|
+
* @throws {@link AccessDeniedException} (client fault)
|
|
101
|
+
* This exception is thrown when the user does not have sufficient access to perform this action.
|
|
102
|
+
*
|
|
103
|
+
* @throws {@link CodeWhispererStreamingServiceException}
|
|
104
|
+
* <p>Base exception class for all service exceptions from CodeWhispererStreaming service.</p>
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
export class ExportResultArchiveCommand extends $Command<
|
|
108
|
+
ExportResultArchiveCommandInput,
|
|
109
|
+
ExportResultArchiveCommandOutput,
|
|
110
|
+
CodeWhispererStreamingClientResolvedConfig
|
|
111
|
+
> {
|
|
112
|
+
// Start section: command_properties
|
|
113
|
+
// End section: command_properties
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @public
|
|
117
|
+
*/
|
|
118
|
+
constructor(readonly input: ExportResultArchiveCommandInput) {
|
|
119
|
+
// Start section: command_constructor
|
|
120
|
+
super()
|
|
121
|
+
// End section: command_constructor
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
resolveMiddleware(
|
|
128
|
+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
|
|
129
|
+
configuration: CodeWhispererStreamingClientResolvedConfig,
|
|
130
|
+
options?: __HttpHandlerOptions
|
|
131
|
+
): Handler<ExportResultArchiveCommandInput, ExportResultArchiveCommandOutput> {
|
|
132
|
+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize))
|
|
133
|
+
|
|
134
|
+
const stack = clientStack.concat(this.middlewareStack)
|
|
135
|
+
|
|
136
|
+
const { logger } = configuration
|
|
137
|
+
const clientName = 'CodeWhispererStreamingClient'
|
|
138
|
+
const commandName = 'ExportResultArchiveCommand'
|
|
139
|
+
const handlerExecutionContext: HandlerExecutionContext = {
|
|
140
|
+
logger,
|
|
141
|
+
clientName,
|
|
142
|
+
commandName,
|
|
143
|
+
inputFilterSensitiveLog: (_: any) => _,
|
|
144
|
+
outputFilterSensitiveLog: ExportResultArchiveResponseFilterSensitiveLog,
|
|
145
|
+
[SMITHY_CONTEXT_KEY]: {
|
|
146
|
+
service: 'AmazonCodeWhispererStreamingService',
|
|
147
|
+
operation: 'ExportResultArchive',
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
const { requestHandler } = configuration
|
|
151
|
+
return stack.resolve(
|
|
152
|
+
(request: FinalizeHandlerArguments<any>) =>
|
|
153
|
+
requestHandler.handle(request.request as __HttpRequest, options || {}),
|
|
154
|
+
handlerExecutionContext
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @internal
|
|
160
|
+
*/
|
|
161
|
+
private serialize(input: ExportResultArchiveCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
|
|
162
|
+
return se_ExportResultArchiveCommand(input, context)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
private deserialize(
|
|
169
|
+
output: __HttpResponse,
|
|
170
|
+
context: __SerdeContext & __EventStreamSerdeContext
|
|
171
|
+
): Promise<ExportResultArchiveCommandOutput> {
|
|
172
|
+
return de_ExportResultArchiveCommand(output, context)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Start section: command_body_extra
|
|
176
|
+
// End section: command_body_extra
|
|
177
|
+
}
|
package/src.gen/@amzn/codewhisperer-streaming/src/commands/GenerateAssistantResponseCommand.ts
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
// smithy-typescript generated code
|
|
2
|
+
import {
|
|
3
|
+
CodeWhispererStreamingClientResolvedConfig,
|
|
4
|
+
ServiceInputTypes,
|
|
5
|
+
ServiceOutputTypes,
|
|
6
|
+
} from '../CodeWhispererStreamingClient'
|
|
7
|
+
import {
|
|
8
|
+
GenerateAssistantResponseRequest,
|
|
9
|
+
GenerateAssistantResponseRequestFilterSensitiveLog,
|
|
10
|
+
GenerateAssistantResponseResponse,
|
|
11
|
+
GenerateAssistantResponseResponseFilterSensitiveLog,
|
|
12
|
+
} from '../models/models_0'
|
|
13
|
+
import { de_GenerateAssistantResponseCommand, se_GenerateAssistantResponseCommand } from '../protocols/Aws_restJson1'
|
|
14
|
+
import { getSerdePlugin } from '@smithy/middleware-serde'
|
|
15
|
+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from '@smithy/protocol-http'
|
|
16
|
+
import { Command as $Command } from '@smithy/smithy-client'
|
|
17
|
+
import {
|
|
18
|
+
FinalizeHandlerArguments,
|
|
19
|
+
Handler,
|
|
20
|
+
HandlerExecutionContext,
|
|
21
|
+
MiddlewareStack,
|
|
22
|
+
SMITHY_CONTEXT_KEY,
|
|
23
|
+
EventStreamSerdeContext as __EventStreamSerdeContext,
|
|
24
|
+
HttpHandlerOptions as __HttpHandlerOptions,
|
|
25
|
+
MetadataBearer as __MetadataBearer,
|
|
26
|
+
SerdeContext as __SerdeContext,
|
|
27
|
+
} from '@smithy/types'
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export { __MetadataBearer, $Command }
|
|
33
|
+
/**
|
|
34
|
+
* @public
|
|
35
|
+
*
|
|
36
|
+
* The input for {@link GenerateAssistantResponseCommand}.
|
|
37
|
+
*/
|
|
38
|
+
export interface GenerateAssistantResponseCommandInput extends GenerateAssistantResponseRequest {}
|
|
39
|
+
/**
|
|
40
|
+
* @public
|
|
41
|
+
*
|
|
42
|
+
* The output of {@link GenerateAssistantResponseCommand}.
|
|
43
|
+
*/
|
|
44
|
+
export interface GenerateAssistantResponseCommandOutput extends GenerateAssistantResponseResponse, __MetadataBearer {}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
* API to generate assistant response.
|
|
49
|
+
* @example
|
|
50
|
+
* Use a bare-bones client and the command you need to make an API call.
|
|
51
|
+
* ```javascript
|
|
52
|
+
* import { CodeWhispererStreamingClient, GenerateAssistantResponseCommand } from "@amzn/codewhisperer-streaming"; // ES Modules import
|
|
53
|
+
* // const { CodeWhispererStreamingClient, GenerateAssistantResponseCommand } = require("@amzn/codewhisperer-streaming"); // CommonJS import
|
|
54
|
+
* const client = new CodeWhispererStreamingClient(config);
|
|
55
|
+
* const input = { // GenerateAssistantResponseRequest
|
|
56
|
+
* conversationState: { // ConversationState
|
|
57
|
+
* conversationId: "STRING_VALUE",
|
|
58
|
+
* history: [ // ChatHistory
|
|
59
|
+
* { // ChatMessage Union: only one key present
|
|
60
|
+
* userInputMessage: { // UserInputMessage
|
|
61
|
+
* content: "STRING_VALUE", // required
|
|
62
|
+
* userInputMessageContext: { // UserInputMessageContext
|
|
63
|
+
* editorState: { // EditorState
|
|
64
|
+
* document: { // TextDocument
|
|
65
|
+
* relativeFilePath: "STRING_VALUE", // required
|
|
66
|
+
* programmingLanguage: { // ProgrammingLanguage
|
|
67
|
+
* languageName: "STRING_VALUE", // required
|
|
68
|
+
* },
|
|
69
|
+
* text: "STRING_VALUE",
|
|
70
|
+
* documentSymbols: [ // DocumentSymbols
|
|
71
|
+
* { // DocumentSymbol
|
|
72
|
+
* name: "STRING_VALUE", // required
|
|
73
|
+
* type: "DECLARATION" || "USAGE", // required
|
|
74
|
+
* source: "STRING_VALUE",
|
|
75
|
+
* },
|
|
76
|
+
* ],
|
|
77
|
+
* },
|
|
78
|
+
* cursorState: { // CursorState Union: only one key present
|
|
79
|
+
* position: { // Position
|
|
80
|
+
* line: Number("int"), // required
|
|
81
|
+
* character: Number("int"), // required
|
|
82
|
+
* },
|
|
83
|
+
* range: { // Range
|
|
84
|
+
* start: {
|
|
85
|
+
* line: Number("int"), // required
|
|
86
|
+
* character: Number("int"), // required
|
|
87
|
+
* },
|
|
88
|
+
* end: {
|
|
89
|
+
* line: Number("int"), // required
|
|
90
|
+
* character: Number("int"), // required
|
|
91
|
+
* },
|
|
92
|
+
* },
|
|
93
|
+
* },
|
|
94
|
+
* },
|
|
95
|
+
* diagnostic: { // Diagnostic Union: only one key present
|
|
96
|
+
* textDocumentDiagnostic: { // TextDocumentDiagnostic
|
|
97
|
+
* document: {
|
|
98
|
+
* relativeFilePath: "STRING_VALUE", // required
|
|
99
|
+
* programmingLanguage: {
|
|
100
|
+
* languageName: "STRING_VALUE", // required
|
|
101
|
+
* },
|
|
102
|
+
* text: "STRING_VALUE",
|
|
103
|
+
* documentSymbols: [
|
|
104
|
+
* {
|
|
105
|
+
* name: "STRING_VALUE", // required
|
|
106
|
+
* type: "DECLARATION" || "USAGE", // required
|
|
107
|
+
* source: "STRING_VALUE",
|
|
108
|
+
* },
|
|
109
|
+
* ],
|
|
110
|
+
* },
|
|
111
|
+
* range: {
|
|
112
|
+
* start: {
|
|
113
|
+
* line: Number("int"), // required
|
|
114
|
+
* character: Number("int"), // required
|
|
115
|
+
* },
|
|
116
|
+
* end: {
|
|
117
|
+
* line: Number("int"), // required
|
|
118
|
+
* character: Number("int"), // required
|
|
119
|
+
* },
|
|
120
|
+
* },
|
|
121
|
+
* source: "STRING_VALUE", // required
|
|
122
|
+
* severity: "ERROR" || "WARNING" || "INFORMATION" || "HINT", // required
|
|
123
|
+
* message: "STRING_VALUE", // required
|
|
124
|
+
* },
|
|
125
|
+
* runtimeDiagnostic: { // RuntimeDiagnostic
|
|
126
|
+
* source: "STRING_VALUE", // required
|
|
127
|
+
* severity: "ERROR" || "WARNING" || "INFORMATION" || "HINT", // required
|
|
128
|
+
* message: "STRING_VALUE", // required
|
|
129
|
+
* },
|
|
130
|
+
* },
|
|
131
|
+
* },
|
|
132
|
+
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION",
|
|
133
|
+
* },
|
|
134
|
+
* assistantResponseMessage: { // AssistantResponseMessage
|
|
135
|
+
* messageId: "STRING_VALUE",
|
|
136
|
+
* content: "STRING_VALUE", // required
|
|
137
|
+
* supplementaryWebLinks: [ // SupplementaryWebLinks
|
|
138
|
+
* { // SupplementaryWebLink
|
|
139
|
+
* url: "STRING_VALUE", // required
|
|
140
|
+
* title: "STRING_VALUE", // required
|
|
141
|
+
* snippet: "STRING_VALUE",
|
|
142
|
+
* },
|
|
143
|
+
* ],
|
|
144
|
+
* references: [ // References
|
|
145
|
+
* { // Reference
|
|
146
|
+
* licenseName: "STRING_VALUE",
|
|
147
|
+
* repository: "STRING_VALUE",
|
|
148
|
+
* url: "STRING_VALUE",
|
|
149
|
+
* recommendationContentSpan: { // Span
|
|
150
|
+
* start: Number("int"),
|
|
151
|
+
* end: Number("int"),
|
|
152
|
+
* },
|
|
153
|
+
* },
|
|
154
|
+
* ],
|
|
155
|
+
* followupPrompt: { // FollowupPrompt
|
|
156
|
+
* content: "STRING_VALUE", // required
|
|
157
|
+
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION",
|
|
158
|
+
* },
|
|
159
|
+
* },
|
|
160
|
+
* },
|
|
161
|
+
* ],
|
|
162
|
+
* currentMessage: {// Union: only one key present
|
|
163
|
+
* userInputMessage: {
|
|
164
|
+
* content: "STRING_VALUE", // required
|
|
165
|
+
* userInputMessageContext: {
|
|
166
|
+
* editorState: {
|
|
167
|
+
* document: "<TextDocument>",
|
|
168
|
+
* cursorState: {// Union: only one key present
|
|
169
|
+
* position: "<Position>",
|
|
170
|
+
* range: {
|
|
171
|
+
* start: "<Position>", // required
|
|
172
|
+
* end: "<Position>", // required
|
|
173
|
+
* },
|
|
174
|
+
* },
|
|
175
|
+
* },
|
|
176
|
+
* diagnostic: {// Union: only one key present
|
|
177
|
+
* textDocumentDiagnostic: {
|
|
178
|
+
* document: "<TextDocument>", // required
|
|
179
|
+
* range: {
|
|
180
|
+
* start: "<Position>", // required
|
|
181
|
+
* end: "<Position>", // required
|
|
182
|
+
* },
|
|
183
|
+
* source: "STRING_VALUE", // required
|
|
184
|
+
* severity: "ERROR" || "WARNING" || "INFORMATION" || "HINT", // required
|
|
185
|
+
* message: "STRING_VALUE", // required
|
|
186
|
+
* },
|
|
187
|
+
* runtimeDiagnostic: {
|
|
188
|
+
* source: "STRING_VALUE", // required
|
|
189
|
+
* severity: "ERROR" || "WARNING" || "INFORMATION" || "HINT", // required
|
|
190
|
+
* message: "STRING_VALUE", // required
|
|
191
|
+
* },
|
|
192
|
+
* },
|
|
193
|
+
* },
|
|
194
|
+
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION",
|
|
195
|
+
* },
|
|
196
|
+
* assistantResponseMessage: {
|
|
197
|
+
* messageId: "STRING_VALUE",
|
|
198
|
+
* content: "STRING_VALUE", // required
|
|
199
|
+
* supplementaryWebLinks: [
|
|
200
|
+
* {
|
|
201
|
+
* url: "STRING_VALUE", // required
|
|
202
|
+
* title: "STRING_VALUE", // required
|
|
203
|
+
* snippet: "STRING_VALUE",
|
|
204
|
+
* },
|
|
205
|
+
* ],
|
|
206
|
+
* references: [
|
|
207
|
+
* {
|
|
208
|
+
* licenseName: "STRING_VALUE",
|
|
209
|
+
* repository: "STRING_VALUE",
|
|
210
|
+
* url: "STRING_VALUE",
|
|
211
|
+
* recommendationContentSpan: {
|
|
212
|
+
* start: Number("int"),
|
|
213
|
+
* end: Number("int"),
|
|
214
|
+
* },
|
|
215
|
+
* },
|
|
216
|
+
* ],
|
|
217
|
+
* followupPrompt: {
|
|
218
|
+
* content: "STRING_VALUE", // required
|
|
219
|
+
* userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION",
|
|
220
|
+
* },
|
|
221
|
+
* },
|
|
222
|
+
* },
|
|
223
|
+
* chatTriggerType: "MANUAL" || "DIAGNOSTIC", // required
|
|
224
|
+
* },
|
|
225
|
+
* };
|
|
226
|
+
* const command = new GenerateAssistantResponseCommand(input);
|
|
227
|
+
* const response = await client.send(command);
|
|
228
|
+
* // { // GenerateAssistantResponseResponse
|
|
229
|
+
* // conversationId: "STRING_VALUE", // required
|
|
230
|
+
* // generateAssistantResponseResponse: { // ChatResponseStream Union: only one key present
|
|
231
|
+
* // messageMetadataEvent: { // MessageMetadataEvent
|
|
232
|
+
* // conversationId: "STRING_VALUE",
|
|
233
|
+
* // },
|
|
234
|
+
* // assistantResponseEvent: { // AssistantResponseEvent
|
|
235
|
+
* // content: "STRING_VALUE", // required
|
|
236
|
+
* // },
|
|
237
|
+
* // codeReferenceEvent: { // CodeReferenceEvent
|
|
238
|
+
* // references: [ // References
|
|
239
|
+
* // { // Reference
|
|
240
|
+
* // licenseName: "STRING_VALUE",
|
|
241
|
+
* // repository: "STRING_VALUE",
|
|
242
|
+
* // url: "STRING_VALUE",
|
|
243
|
+
* // recommendationContentSpan: { // Span
|
|
244
|
+
* // start: Number("int"),
|
|
245
|
+
* // end: Number("int"),
|
|
246
|
+
* // },
|
|
247
|
+
* // },
|
|
248
|
+
* // ],
|
|
249
|
+
* // },
|
|
250
|
+
* // supplementaryWebLinksEvent: { // SupplementaryWebLinksEvent
|
|
251
|
+
* // supplementaryWebLinks: [ // SupplementaryWebLinks
|
|
252
|
+
* // { // SupplementaryWebLink
|
|
253
|
+
* // url: "STRING_VALUE", // required
|
|
254
|
+
* // title: "STRING_VALUE", // required
|
|
255
|
+
* // snippet: "STRING_VALUE",
|
|
256
|
+
* // },
|
|
257
|
+
* // ],
|
|
258
|
+
* // },
|
|
259
|
+
* // followupPromptEvent: { // FollowupPromptEvent
|
|
260
|
+
* // followupPrompt: { // FollowupPrompt
|
|
261
|
+
* // content: "STRING_VALUE", // required
|
|
262
|
+
* // userIntent: "SUGGEST_ALTERNATE_IMPLEMENTATION" || "APPLY_COMMON_BEST_PRACTICES" || "IMPROVE_CODE" || "SHOW_EXAMPLES" || "CITE_SOURCES" || "EXPLAIN_LINE_BY_LINE" || "EXPLAIN_CODE_SELECTION",
|
|
263
|
+
* // },
|
|
264
|
+
* // },
|
|
265
|
+
* // invalidStateEvent: { // InvalidStateEvent
|
|
266
|
+
* // reason: "INVALID_TASK_ASSIST_PLAN", // required
|
|
267
|
+
* // message: "STRING_VALUE", // required
|
|
268
|
+
* // },
|
|
269
|
+
* // error: { // InternalServerException
|
|
270
|
+
* // message: "STRING_VALUE", // required
|
|
271
|
+
* // },
|
|
272
|
+
* // },
|
|
273
|
+
* // };
|
|
274
|
+
*
|
|
275
|
+
* ```
|
|
276
|
+
*
|
|
277
|
+
* @param GenerateAssistantResponseCommandInput - {@link GenerateAssistantResponseCommandInput}
|
|
278
|
+
* @returns {@link GenerateAssistantResponseCommandOutput}
|
|
279
|
+
* @see {@link GenerateAssistantResponseCommandInput} for command's `input` shape.
|
|
280
|
+
* @see {@link GenerateAssistantResponseCommandOutput} for command's `response` shape.
|
|
281
|
+
* @see {@link CodeWhispererStreamingClientResolvedConfig | config} for CodeWhispererStreamingClient's `config` shape.
|
|
282
|
+
*
|
|
283
|
+
* @throws {@link InternalServerException} (server fault)
|
|
284
|
+
* This exception is thrown when an unexpected error occurred during the processing of a request.
|
|
285
|
+
*
|
|
286
|
+
* @throws {@link ThrottlingException} (client fault)
|
|
287
|
+
* This exception is thrown when request was denied due to request throttling.
|
|
288
|
+
*
|
|
289
|
+
* @throws {@link ValidationException} (client fault)
|
|
290
|
+
* This exception is thrown when the input fails to satisfy the constraints specified by the service.
|
|
291
|
+
*
|
|
292
|
+
* @throws {@link AccessDeniedException} (client fault)
|
|
293
|
+
* This exception is thrown when the user does not have sufficient access to perform this action.
|
|
294
|
+
*
|
|
295
|
+
* @throws {@link CodeWhispererStreamingServiceException}
|
|
296
|
+
* <p>Base exception class for all service exceptions from CodeWhispererStreaming service.</p>
|
|
297
|
+
*
|
|
298
|
+
*/
|
|
299
|
+
export class GenerateAssistantResponseCommand extends $Command<
|
|
300
|
+
GenerateAssistantResponseCommandInput,
|
|
301
|
+
GenerateAssistantResponseCommandOutput,
|
|
302
|
+
CodeWhispererStreamingClientResolvedConfig
|
|
303
|
+
> {
|
|
304
|
+
// Start section: command_properties
|
|
305
|
+
// End section: command_properties
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @public
|
|
309
|
+
*/
|
|
310
|
+
constructor(readonly input: GenerateAssistantResponseCommandInput) {
|
|
311
|
+
// Start section: command_constructor
|
|
312
|
+
super()
|
|
313
|
+
// End section: command_constructor
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @internal
|
|
318
|
+
*/
|
|
319
|
+
resolveMiddleware(
|
|
320
|
+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
|
|
321
|
+
configuration: CodeWhispererStreamingClientResolvedConfig,
|
|
322
|
+
options?: __HttpHandlerOptions
|
|
323
|
+
): Handler<GenerateAssistantResponseCommandInput, GenerateAssistantResponseCommandOutput> {
|
|
324
|
+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize))
|
|
325
|
+
|
|
326
|
+
const stack = clientStack.concat(this.middlewareStack)
|
|
327
|
+
|
|
328
|
+
const { logger } = configuration
|
|
329
|
+
const clientName = 'CodeWhispererStreamingClient'
|
|
330
|
+
const commandName = 'GenerateAssistantResponseCommand'
|
|
331
|
+
const handlerExecutionContext: HandlerExecutionContext = {
|
|
332
|
+
logger,
|
|
333
|
+
clientName,
|
|
334
|
+
commandName,
|
|
335
|
+
inputFilterSensitiveLog: GenerateAssistantResponseRequestFilterSensitiveLog,
|
|
336
|
+
outputFilterSensitiveLog: GenerateAssistantResponseResponseFilterSensitiveLog,
|
|
337
|
+
[SMITHY_CONTEXT_KEY]: {
|
|
338
|
+
service: 'AmazonCodeWhispererStreamingService',
|
|
339
|
+
operation: 'GenerateAssistantResponse',
|
|
340
|
+
},
|
|
341
|
+
}
|
|
342
|
+
const { requestHandler } = configuration
|
|
343
|
+
return stack.resolve(
|
|
344
|
+
(request: FinalizeHandlerArguments<any>) =>
|
|
345
|
+
requestHandler.handle(request.request as __HttpRequest, options || {}),
|
|
346
|
+
handlerExecutionContext
|
|
347
|
+
)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* @internal
|
|
352
|
+
*/
|
|
353
|
+
private serialize(input: GenerateAssistantResponseCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
|
|
354
|
+
return se_GenerateAssistantResponseCommand(input, context)
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* @internal
|
|
359
|
+
*/
|
|
360
|
+
private deserialize(
|
|
361
|
+
output: __HttpResponse,
|
|
362
|
+
context: __SerdeContext & __EventStreamSerdeContext
|
|
363
|
+
): Promise<GenerateAssistantResponseCommandOutput> {
|
|
364
|
+
return de_GenerateAssistantResponseCommand(output, context)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// Start section: command_body_extra
|
|
368
|
+
// End section: command_body_extra
|
|
369
|
+
}
|