@aws/lsp-codewhisperer 0.0.9 → 0.0.10
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 +5 -0
- package/node_modules/@amzn/codewhisperer-streaming/package.json +4 -4
- package/node_modules/@aws/lsp-fqn/out/common/commonFqnWorkerPool.js +12 -25
- package/node_modules/@aws/lsp-fqn/out/common/commonFqnWorkerPool.js.map +1 -1
- package/node_modules/@aws/lsp-fqn/out/common/fqnExtractor.js +1 -2
- package/node_modules/@aws/lsp-fqn/out/common/fqnExtractor.js.map +1 -1
- package/node_modules/@aws/lsp-fqn/package.json +1 -1
- package/node_modules/@aws/lsp-fqn/tsconfig.tsbuildinfo +1 -1
- package/out/client/streamingClient/codewhispererStreamingClient.d.ts +5 -0
- package/out/client/streamingClient/codewhispererStreamingClient.js +25 -0
- package/out/client/streamingClient/codewhispererStreamingClient.js.map +1 -0
- package/out/client/token/bearer-token-service.json +55 -2
- 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.js +104 -108
- package/out/language-server/chat/chatController.js.map +1 -1
- package/out/language-server/chat/chatController.test.js +16 -1
- package/out/language-server/chat/chatController.test.js.map +1 -1
- package/out/language-server/chat/chatEventParser.js +28 -34
- package/out/language-server/chat/chatEventParser.js.map +1 -1
- package/out/language-server/chat/chatSessionManagementService.js +22 -36
- package/out/language-server/chat/chatSessionManagementService.js.map +1 -1
- package/out/language-server/chat/chatSessionService.js +24 -37
- package/out/language-server/chat/chatSessionService.js.map +1 -1
- package/out/language-server/chat/constants.d.ts +2 -0
- package/out/language-server/chat/constants.js +32 -0
- package/out/language-server/chat/constants.js.map +1 -0
- package/out/language-server/chat/contexts/documentContext.js +11 -24
- package/out/language-server/chat/contexts/documentContext.js.map +1 -1
- package/out/language-server/chat/contexts/documentFqnExtractor.js +67 -78
- package/out/language-server/chat/contexts/documentFqnExtractor.js.map +1 -1
- package/out/language-server/chat/contexts/triggerContext.js +32 -44
- package/out/language-server/chat/contexts/triggerContext.js.map +1 -1
- package/out/language-server/chat/quickActions.d.ts +0 -1
- package/out/language-server/chat/quickActions.js +1 -28
- package/out/language-server/chat/quickActions.js.map +1 -1
- package/out/language-server/chat/telemetry/chatTelemetryController.js +114 -126
- package/out/language-server/chat/telemetry/chatTelemetryController.js.map +1 -1
- package/out/language-server/chat/utils.d.ts +6 -0
- package/out/language-server/chat/utils.js +60 -0
- package/out/language-server/chat/utils.js.map +1 -0
- package/out/language-server/codeWhispererService.js +13 -11
- package/out/language-server/codeWhispererService.js.map +1 -1
- package/out/language-server/constants.d.ts +3 -0
- package/out/language-server/constants.js +7 -0
- package/out/language-server/constants.js.map +1 -0
- package/out/language-server/dependencyGraph/csharpDependencyGraph.js +2 -2
- package/out/language-server/dependencyGraph/csharpDependencyGraph.js.map +1 -1
- package/out/language-server/dependencyGraph/dependencyGraph.js +12 -9
- package/out/language-server/dependencyGraph/dependencyGraph.js.map +1 -1
- package/out/language-server/dependencyGraph/gitIgnoreFilter.js +1 -0
- package/out/language-server/dependencyGraph/gitIgnoreFilter.js.map +1 -1
- package/out/language-server/netTransform/artifactManager.d.ts +29 -0
- package/out/language-server/netTransform/artifactManager.js +191 -0
- package/out/language-server/netTransform/artifactManager.js.map +1 -0
- package/out/language-server/netTransform/converter.d.ts +7 -0
- package/out/language-server/netTransform/converter.js +88 -0
- package/out/language-server/netTransform/converter.js.map +1 -0
- package/out/language-server/netTransform/metrics.d.ts +17 -0
- package/out/language-server/netTransform/metrics.js +222 -0
- package/out/language-server/netTransform/metrics.js.map +1 -0
- package/out/language-server/netTransform/models.d.ts +84 -0
- package/out/language-server/netTransform/models.js +12 -0
- package/out/language-server/netTransform/models.js.map +1 -0
- package/out/language-server/netTransform/resources/SupportedProjects.d.ts +2 -0
- package/out/language-server/netTransform/resources/SupportedProjects.js +26 -0
- package/out/language-server/netTransform/resources/SupportedProjects.js.map +1 -0
- package/out/language-server/netTransform/tests/converter.test.d.ts +1 -0
- package/out/language-server/netTransform/tests/converter.test.js +151 -0
- package/out/language-server/netTransform/tests/converter.test.js.map +1 -0
- package/out/language-server/netTransform/tests/mockData.d.ts +21 -0
- package/out/language-server/netTransform/tests/mockData.js +60 -0
- package/out/language-server/netTransform/tests/mockData.js.map +1 -0
- package/out/language-server/netTransform/tests/transformHandler.test.d.ts +1 -0
- package/out/language-server/netTransform/tests/transformHandler.test.js +242 -0
- package/out/language-server/netTransform/tests/transformHandler.test.js.map +1 -0
- package/out/language-server/netTransform/tests/validation.test.d.ts +1 -0
- package/out/language-server/netTransform/tests/validation.test.js +80 -0
- package/out/language-server/netTransform/tests/validation.test.js.map +1 -0
- package/out/language-server/netTransform/transformHandler.d.ts +27 -0
- package/out/language-server/netTransform/transformHandler.js +315 -0
- package/out/language-server/netTransform/transformHandler.js.map +1 -0
- package/out/language-server/netTransform/validation.d.ts +9 -0
- package/out/language-server/netTransform/validation.js +79 -0
- package/out/language-server/netTransform/validation.js.map +1 -0
- package/out/language-server/netTransformServer.d.ts +5 -6
- package/out/language-server/netTransformServer.js +149 -15
- package/out/language-server/netTransformServer.js.map +1 -1
- package/out/language-server/proxy-server.d.ts +1 -0
- package/out/language-server/proxy-server.js +16 -1
- package/out/language-server/proxy-server.js.map +1 -1
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.js +10 -6
- package/out/language-server/securityScan/securityScanDiagnosticsProvider.js.map +1 -1
- package/out/language-server/securityScan/securityScanHandler.js +4 -0
- package/out/language-server/securityScan/securityScanHandler.js.map +1 -1
- package/out/language-server/session/sessionManager.js +35 -15
- package/out/language-server/session/sessionManager.js.map +1 -1
- package/out/language-server/telemetry/codeDiffTracker.js +69 -80
- package/out/language-server/telemetry/codeDiffTracker.js.map +1 -1
- package/out/language-server/telemetry/codePercentage.js +3 -0
- package/out/language-server/telemetry/codePercentage.js.map +1 -1
- package/out/language-server/telemetry/metric.js +8 -21
- package/out/language-server/telemetry/metric.js.map +1 -1
- package/out/language-server/telemetry/types.d.ts +38 -0
- package/out/language-server/telemetry/types.js.map +1 -1
- package/out/language-server/utils.d.ts +2 -5
- package/out/language-server/utils.js +25 -49
- package/out/language-server/utils.js.map +1 -1
- package/package.json +5 -2
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/HISTORY.md +0 -395
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/LICENSE +0 -201
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/README.md +0 -530
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/worker.js +0 -288
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/worker.js.map +0 -1
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/worker.min.js +0 -2
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/worker.min.js.map +0 -1
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/workerpool.js +0 -1737
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/workerpool.js.map +0 -1
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/workerpool.min.js +0 -3
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/workerpool.min.js.LICENSE.txt +0 -24
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/dist/workerpool.min.js.map +0 -1
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/package.json +0 -57
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/Pool.js +0 -476
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/Promise.js +0 -293
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/WorkerHandler.js +0 -547
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/debug-port-allocator.js +0 -28
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/environment.js +0 -30
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/generated/embeddedWorker.js +0 -6
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/header.js +0 -24
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/index.js +0 -60
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/requireFoolWebpack.js +0 -8
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/transfer.js +0 -12
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/types.js +0 -46
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/validateOptions.js +0 -51
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/src/worker.js +0 -256
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/Pool.d.ts +0 -130
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/Promise.d.ts +0 -125
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/WorkerHandler.d.ts +0 -89
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/debug-port-allocator.d.ts +0 -8
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/environment.d.ts +0 -4
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/generated/embeddedWorker.d.ts +0 -2
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/index.d.ts +0 -43
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/transfer.d.ts +0 -19
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/types.d.ts +0 -99
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/validateOptions.d.ts +0 -4
- package/node_modules/@aws/lsp-fqn/node_modules/workerpool/types/worker.d.ts +0 -8
- package/node_modules/@smithy/eventstream-serde-config-resolver/LICENSE +0 -201
- package/node_modules/@smithy/eventstream-serde-config-resolver/README.md +0 -10
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-cjs/EventStreamSerdeConfig.js +0 -1
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-cjs/index.js +0 -37
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-es/EventStreamSerdeConfig.js +0 -4
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-es/index.js +0 -1
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-types/EventStreamSerdeConfig.d.ts +0 -24
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-types/index.d.ts +0 -4
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-types/ts3.4/EventStreamSerdeConfig.d.ts +0 -24
- package/node_modules/@smithy/eventstream-serde-config-resolver/dist-types/ts3.4/index.d.ts +0 -4
- package/node_modules/@smithy/eventstream-serde-config-resolver/package.json +0 -61
- package/node_modules/bowser/CHANGELOG.md +0 -218
- package/node_modules/bowser/LICENSE +0 -39
- package/node_modules/bowser/README.md +0 -179
- package/node_modules/bowser/bundled.js +0 -1
- package/node_modules/bowser/es5.js +0 -1
- package/node_modules/bowser/index.d.ts +0 -250
- package/node_modules/bowser/package.json +0 -83
- package/node_modules/bowser/src/bowser.js +0 -77
- package/node_modules/bowser/src/constants.js +0 -116
- package/node_modules/bowser/src/parser-browsers.js +0 -700
- package/node_modules/bowser/src/parser-engines.js +0 -120
- package/node_modules/bowser/src/parser-os.js +0 -199
- package/node_modules/bowser/src/parser-platforms.js +0 -266
- package/node_modules/bowser/src/parser.js +0 -496
- package/node_modules/bowser/src/utils.js +0 -309
- package/node_modules/tslib/CopyrightNotice.txt +0 -15
- package/node_modules/tslib/LICENSE.txt +0 -12
- package/node_modules/tslib/README.md +0 -164
- package/node_modules/tslib/SECURITY.md +0 -41
- package/node_modules/tslib/modules/index.d.ts +0 -37
- package/node_modules/tslib/modules/index.js +0 -68
- package/node_modules/tslib/modules/package.json +0 -3
- package/node_modules/tslib/package.json +0 -47
- package/node_modules/tslib/tslib.d.ts +0 -453
- package/node_modules/tslib/tslib.es6.html +0 -1
- package/node_modules/tslib/tslib.es6.js +0 -374
- package/node_modules/tslib/tslib.es6.mjs +0 -373
- package/node_modules/tslib/tslib.html +0 -1
- package/node_modules/tslib/tslib.js +0 -424
- package/node_modules/uuid/CHANGELOG.md +0 -274
- package/node_modules/uuid/CONTRIBUTING.md +0 -18
- package/node_modules/uuid/LICENSE.md +0 -9
- package/node_modules/uuid/README.md +0 -466
- package/node_modules/uuid/dist/bin/uuid +0 -2
- package/node_modules/uuid/dist/commonjs-browser/index.js +0 -79
- package/node_modules/uuid/dist/commonjs-browser/md5.js +0 -223
- package/node_modules/uuid/dist/commonjs-browser/native.js +0 -11
- package/node_modules/uuid/dist/commonjs-browser/nil.js +0 -8
- package/node_modules/uuid/dist/commonjs-browser/parse.js +0 -45
- package/node_modules/uuid/dist/commonjs-browser/regex.js +0 -8
- package/node_modules/uuid/dist/commonjs-browser/rng.js +0 -25
- package/node_modules/uuid/dist/commonjs-browser/sha1.js +0 -104
- package/node_modules/uuid/dist/commonjs-browser/stringify.js +0 -44
- package/node_modules/uuid/dist/commonjs-browser/v1.js +0 -107
- package/node_modules/uuid/dist/commonjs-browser/v3.js +0 -16
- package/node_modules/uuid/dist/commonjs-browser/v35.js +0 -80
- package/node_modules/uuid/dist/commonjs-browser/v4.js +0 -43
- package/node_modules/uuid/dist/commonjs-browser/v5.js +0 -16
- package/node_modules/uuid/dist/commonjs-browser/validate.js +0 -17
- package/node_modules/uuid/dist/commonjs-browser/version.js +0 -21
- package/node_modules/uuid/dist/esm-browser/index.js +0 -9
- package/node_modules/uuid/dist/esm-browser/md5.js +0 -215
- package/node_modules/uuid/dist/esm-browser/native.js +0 -4
- package/node_modules/uuid/dist/esm-browser/nil.js +0 -1
- package/node_modules/uuid/dist/esm-browser/parse.js +0 -35
- package/node_modules/uuid/dist/esm-browser/regex.js +0 -1
- package/node_modules/uuid/dist/esm-browser/rng.js +0 -18
- package/node_modules/uuid/dist/esm-browser/sha1.js +0 -96
- package/node_modules/uuid/dist/esm-browser/stringify.js +0 -33
- package/node_modules/uuid/dist/esm-browser/v1.js +0 -95
- package/node_modules/uuid/dist/esm-browser/v3.js +0 -4
- package/node_modules/uuid/dist/esm-browser/v35.js +0 -66
- package/node_modules/uuid/dist/esm-browser/v4.js +0 -29
- package/node_modules/uuid/dist/esm-browser/v5.js +0 -4
- package/node_modules/uuid/dist/esm-browser/validate.js +0 -7
- package/node_modules/uuid/dist/esm-browser/version.js +0 -11
- package/node_modules/uuid/dist/esm-node/index.js +0 -9
- package/node_modules/uuid/dist/esm-node/md5.js +0 -13
- package/node_modules/uuid/dist/esm-node/native.js +0 -4
- package/node_modules/uuid/dist/esm-node/nil.js +0 -1
- package/node_modules/uuid/dist/esm-node/parse.js +0 -35
- package/node_modules/uuid/dist/esm-node/regex.js +0 -1
- package/node_modules/uuid/dist/esm-node/rng.js +0 -12
- package/node_modules/uuid/dist/esm-node/sha1.js +0 -13
- package/node_modules/uuid/dist/esm-node/stringify.js +0 -33
- package/node_modules/uuid/dist/esm-node/v1.js +0 -95
- package/node_modules/uuid/dist/esm-node/v3.js +0 -4
- package/node_modules/uuid/dist/esm-node/v35.js +0 -66
- package/node_modules/uuid/dist/esm-node/v4.js +0 -29
- package/node_modules/uuid/dist/esm-node/v5.js +0 -4
- package/node_modules/uuid/dist/esm-node/validate.js +0 -7
- package/node_modules/uuid/dist/esm-node/version.js +0 -11
- package/node_modules/uuid/dist/index.js +0 -79
- package/node_modules/uuid/dist/md5-browser.js +0 -223
- package/node_modules/uuid/dist/md5.js +0 -23
- package/node_modules/uuid/dist/native-browser.js +0 -11
- package/node_modules/uuid/dist/native.js +0 -15
- package/node_modules/uuid/dist/nil.js +0 -8
- package/node_modules/uuid/dist/parse.js +0 -45
- package/node_modules/uuid/dist/regex.js +0 -8
- package/node_modules/uuid/dist/rng-browser.js +0 -25
- package/node_modules/uuid/dist/rng.js +0 -24
- package/node_modules/uuid/dist/sha1-browser.js +0 -104
- package/node_modules/uuid/dist/sha1.js +0 -23
- package/node_modules/uuid/dist/stringify.js +0 -44
- package/node_modules/uuid/dist/uuid-bin.js +0 -85
- package/node_modules/uuid/dist/v1.js +0 -107
- package/node_modules/uuid/dist/v3.js +0 -16
- package/node_modules/uuid/dist/v35.js +0 -80
- package/node_modules/uuid/dist/v4.js +0 -43
- package/node_modules/uuid/dist/v5.js +0 -16
- package/node_modules/uuid/dist/validate.js +0 -17
- package/node_modules/uuid/dist/version.js +0 -21
- package/node_modules/uuid/package.json +0 -135
- package/node_modules/uuid/wrapper.mjs +0 -10
|
@@ -1,33 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _QChatTriggerContext_instances, _QChatTriggerContext_workspace, _QChatTriggerContext_documentContextExtractor, _QChatTriggerContext_extractDocumentContext, _QChatTriggerContext_guessIntentFromPrompt;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.QChatTriggerContext = void 0;
|
|
16
4
|
const codewhisperer_streaming_1 = require("@amzn/codewhisperer-streaming");
|
|
17
5
|
const documentContext_1 = require("./documentContext");
|
|
18
6
|
class QChatTriggerContext {
|
|
7
|
+
#workspace;
|
|
8
|
+
#documentContextExtractor;
|
|
19
9
|
constructor(workspace, logger) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
_QChatTriggerContext_documentContextExtractor.set(this, void 0);
|
|
23
|
-
__classPrivateFieldSet(this, _QChatTriggerContext_workspace, workspace, "f");
|
|
24
|
-
__classPrivateFieldSet(this, _QChatTriggerContext_documentContextExtractor, new documentContext_1.DocumentContextExtractor({ logger }), "f");
|
|
10
|
+
this.#workspace = workspace;
|
|
11
|
+
this.#documentContextExtractor = new documentContext_1.DocumentContextExtractor({ logger });
|
|
25
12
|
}
|
|
26
13
|
async getNewTriggerContext(params) {
|
|
27
|
-
const documentContext = await
|
|
14
|
+
const documentContext = await this.#extractDocumentContext(params);
|
|
28
15
|
return {
|
|
29
16
|
...documentContext,
|
|
30
|
-
userIntent:
|
|
17
|
+
userIntent: this.#guessIntentFromPrompt(params.prompt.prompt),
|
|
31
18
|
};
|
|
32
19
|
}
|
|
33
20
|
getChatParamsFromTrigger(params, triggerContext) {
|
|
@@ -59,32 +46,33 @@ class QChatTriggerContext {
|
|
|
59
46
|
return data;
|
|
60
47
|
}
|
|
61
48
|
dispose() {
|
|
62
|
-
|
|
49
|
+
this.#documentContextExtractor.dispose();
|
|
63
50
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
? __classPrivateFieldGet(this, _QChatTriggerContext_documentContextExtractor, "f").extractDocumentContext(textDocument, cursorState[0])
|
|
71
|
-
: undefined;
|
|
72
|
-
}, _QChatTriggerContext_guessIntentFromPrompt = function _QChatTriggerContext_guessIntentFromPrompt(prompt) {
|
|
73
|
-
if (prompt === undefined) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
else if (/^explain/i.test(prompt)) {
|
|
77
|
-
return codewhisperer_streaming_1.UserIntent.EXPLAIN_CODE_SELECTION;
|
|
78
|
-
}
|
|
79
|
-
else if (/^refactor/i.test(prompt)) {
|
|
80
|
-
return codewhisperer_streaming_1.UserIntent.SUGGEST_ALTERNATE_IMPLEMENTATION;
|
|
51
|
+
async #extractDocumentContext(input) {
|
|
52
|
+
const { textDocument: textDocumentIdentifier, cursorState = [] } = input;
|
|
53
|
+
const textDocument = textDocumentIdentifier?.uri && (await this.#workspace.getTextDocument(textDocumentIdentifier.uri));
|
|
54
|
+
return textDocument
|
|
55
|
+
? this.#documentContextExtractor.extractDocumentContext(textDocument, cursorState[0])
|
|
56
|
+
: undefined;
|
|
81
57
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
58
|
+
#guessIntentFromPrompt(prompt) {
|
|
59
|
+
if (prompt === undefined) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
else if (/^explain/i.test(prompt)) {
|
|
63
|
+
return codewhisperer_streaming_1.UserIntent.EXPLAIN_CODE_SELECTION;
|
|
64
|
+
}
|
|
65
|
+
else if (/^refactor/i.test(prompt)) {
|
|
66
|
+
return codewhisperer_streaming_1.UserIntent.SUGGEST_ALTERNATE_IMPLEMENTATION;
|
|
67
|
+
}
|
|
68
|
+
else if (/^fix/i.test(prompt)) {
|
|
69
|
+
return codewhisperer_streaming_1.UserIntent.APPLY_COMMON_BEST_PRACTICES;
|
|
70
|
+
}
|
|
71
|
+
else if (/^optimize/i.test(prompt)) {
|
|
72
|
+
return codewhisperer_streaming_1.UserIntent.IMPROVE_CODE;
|
|
73
|
+
}
|
|
74
|
+
return undefined;
|
|
87
75
|
}
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
}
|
|
77
|
+
exports.QChatTriggerContext = QChatTriggerContext;
|
|
90
78
|
//# sourceMappingURL=triggerContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triggerContext.js","sourceRoot":"","sources":["../../../../src/language-server/chat/contexts/triggerContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"triggerContext.js","sourceRoot":"","sources":["../../../../src/language-server/chat/contexts/triggerContext.ts"],"names":[],"mappings":";;;AACA,2EAAkH;AAGlH,uDAA6E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M,OAAO;QACV,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,CAAA;IAC5C,CAAC;IAED,KAAK,CAAC,uBAAuB,CACzB,KAAuD;QAEvD,MAAM,EAAE,YAAY,EAAE,sBAAsB,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,KAAK,CAAA;QAExE,MAAM,YAAY,GACd,sBAAsB,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,CAAA;QAEtG,OAAO,YAAY;YACf,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;YACrF,CAAC,CAAC,SAAS,CAAA;IACnB,CAAC;IAED,sBAAsB,CAAC,MAAe;QAClC,IAAI,MAAM,KAAK,SAAS,EAAE;YACtB,OAAO,SAAS,CAAA;SACnB;aAAM,IAAI,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACjC,OAAO,oCAAU,CAAC,sBAAsB,CAAA;SAC3C;aAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAClC,OAAO,oCAAU,CAAC,gCAAgC,CAAA;SACrD;aAAM,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAC7B,OAAO,oCAAU,CAAC,2BAA2B,CAAA;SAChD;aAAM,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YAClC,OAAO,oCAAU,CAAC,YAAY,CAAA;SACjC;QAED,OAAO,SAAS,CAAA;IACpB,CAAC;CACJ;AArFD,kDAqFC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CLEAR_QUICK_ACTION = exports.HELP_QUICK_ACTION = exports.QuickAction = void 0;
|
|
4
4
|
var QuickAction;
|
|
5
5
|
(function (QuickAction) {
|
|
6
6
|
QuickAction["Clear"] = "/clear";
|
|
@@ -14,31 +14,4 @@ exports.CLEAR_QUICK_ACTION = {
|
|
|
14
14
|
command: QuickAction.Clear,
|
|
15
15
|
description: 'Clear this session',
|
|
16
16
|
};
|
|
17
|
-
const userGuideURL = 'https://docs.aws.amazon.com/amazonq/latest/aws-builder-use-ug/getting-started.html';
|
|
18
|
-
exports.HELP_MESSAGE = `I'm Amazon Q, a generative AI assistant. Learn more about me below. Your feedback will help me improve.
|
|
19
|
-
\n\n### What I can do:
|
|
20
|
-
\n\n- Answer questions about AWS
|
|
21
|
-
\n\n- Answer questions about general programming concepts
|
|
22
|
-
\n\n- Explain what a line of code or code function does
|
|
23
|
-
\n\n- Write unit tests and code
|
|
24
|
-
\n\n- Debug and fix code
|
|
25
|
-
\n\n- Refactor code
|
|
26
|
-
\n\n### What I don't do right now:
|
|
27
|
-
\n\n- Answer questions in languages other than English
|
|
28
|
-
\n\n- Remember conversations from your previous sessions
|
|
29
|
-
\n\n- Have information about your AWS account or your specific AWS resources
|
|
30
|
-
\n\n### Examples of questions I can answer:
|
|
31
|
-
\n\n- When should I use ElastiCache?
|
|
32
|
-
\n\n- How do I create an Application Load Balancer?
|
|
33
|
-
\n\n- Explain selected code and ask clarifying questions about it.
|
|
34
|
-
\n\n- What is the syntax of declaring a variable in TypeScript?
|
|
35
|
-
\n\n### Special Commands
|
|
36
|
-
\n\n- /clear - Clear the conversation.
|
|
37
|
-
\n\n- /help - View chat topics and commands.
|
|
38
|
-
\n\n### Things to note:
|
|
39
|
-
\n\n- I may not always provide completely accurate or current information.
|
|
40
|
-
\n\n- Provide feedback by choosing the like or dislike buttons that appear below answers.
|
|
41
|
-
\n\n- When you use Amazon Q, AWS may, for service improvement purposes, store data about your usage and content. You can opt-out of sharing this data by following the steps in AI services opt-out policies. See <a href="https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/opt-out-IDE.html">here</a>
|
|
42
|
-
\n\n- Do not enter any confidential, sensitive, or personal information.
|
|
43
|
-
\n\n*For additional help, visit the [Amazon Q User Guide](${userGuideURL}).*`;
|
|
44
17
|
//# sourceMappingURL=quickActions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quickActions.js","sourceRoot":"","sources":["../../../src/language-server/chat/quickActions.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,+BAAgB,CAAA;IAChB,6BAAc,CAAA;AAClB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAEY,QAAA,iBAAiB,GAAG;IAC7B,OAAO,EAAE,WAAW,CAAC,IAAI;IACzB,WAAW,EAAE,2BAA2B;CAC3C,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAC9B,OAAO,EAAE,WAAW,CAAC,KAAK;IAC1B,WAAW,EAAE,oBAAoB;CACpC,CAAA
|
|
1
|
+
{"version":3,"file":"quickActions.js","sourceRoot":"","sources":["../../../src/language-server/chat/quickActions.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,+BAAgB,CAAA;IAChB,6BAAc,CAAA;AAClB,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB;AAEY,QAAA,iBAAiB,GAAG;IAC7B,OAAO,EAAE,WAAW,CAAC,IAAI;IACzB,WAAW,EAAE,2BAA2B;CAC3C,CAAA;AAEY,QAAA,kBAAkB,GAAG;IAC9B,OAAO,EAAE,WAAW,CAAC,KAAK;IAC1B,WAAW,EAAE,oBAAoB;CACpC,CAAA"}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
-
};
|
|
8
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
-
};
|
|
13
|
-
var _ChatTelemetryController_instances, _ChatTelemetryController_activeTabId, _ChatTelemetryController_tabTelemetryInfoByTabId, _ChatTelemetryController_currentTriggerByTabId, _ChatTelemetryController_credentialsProvider, _ChatTelemetryController_telemetry, _ChatTelemetryController_codeDiffTracker, _ChatTelemetryController_enqueueCodeDiffEntry, _ChatTelemetryController_handleClientTelemetry;
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.convertToTelemetryUserIntent = exports.ChatTelemetryController = exports.CONVERSATION_ID_METRIC_KEY = void 0;
|
|
16
4
|
const types_1 = require("../../telemetry/types");
|
|
@@ -19,44 +7,43 @@ const codewhisperer_streaming_1 = require("@amzn/codewhisperer-streaming");
|
|
|
19
7
|
const codeDiffTracker_1 = require("../../telemetry/codeDiffTracker");
|
|
20
8
|
exports.CONVERSATION_ID_METRIC_KEY = 'cwsprChatConversationId';
|
|
21
9
|
class ChatTelemetryController {
|
|
10
|
+
#activeTabId;
|
|
11
|
+
#tabTelemetryInfoByTabId;
|
|
12
|
+
#currentTriggerByTabId = {};
|
|
13
|
+
#credentialsProvider;
|
|
14
|
+
#telemetry;
|
|
15
|
+
#codeDiffTracker;
|
|
22
16
|
constructor(features) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_ChatTelemetryController_codeDiffTracker.set(this, void 0);
|
|
30
|
-
__classPrivateFieldSet(this, _ChatTelemetryController_tabTelemetryInfoByTabId, {}, "f");
|
|
31
|
-
__classPrivateFieldSet(this, _ChatTelemetryController_currentTriggerByTabId, {}, "f");
|
|
32
|
-
__classPrivateFieldSet(this, _ChatTelemetryController_telemetry, features.telemetry, "f");
|
|
33
|
-
__classPrivateFieldSet(this, _ChatTelemetryController_credentialsProvider, features.credentialsProvider, "f");
|
|
34
|
-
__classPrivateFieldGet(this, _ChatTelemetryController_telemetry, "f").onClientTelemetry(params => __classPrivateFieldGet(this, _ChatTelemetryController_instances, "m", _ChatTelemetryController_handleClientTelemetry).call(this, params));
|
|
35
|
-
__classPrivateFieldSet(this, _ChatTelemetryController_codeDiffTracker, new codeDiffTracker_1.CodeDiffTracker(features.workspace, features.logging, (entry, percentage) => this.emitModifyCodeMetric(entry, percentage)), "f");
|
|
17
|
+
this.#tabTelemetryInfoByTabId = {};
|
|
18
|
+
this.#currentTriggerByTabId = {};
|
|
19
|
+
this.#telemetry = features.telemetry;
|
|
20
|
+
this.#credentialsProvider = features.credentialsProvider;
|
|
21
|
+
this.#telemetry.onClientTelemetry(params => this.#handleClientTelemetry(params));
|
|
22
|
+
this.#codeDiffTracker = new codeDiffTracker_1.CodeDiffTracker(features.workspace, features.logging, (entry, percentage) => this.emitModifyCodeMetric(entry, percentage));
|
|
36
23
|
}
|
|
37
24
|
get activeTabId() {
|
|
38
|
-
return
|
|
25
|
+
return this.#activeTabId;
|
|
39
26
|
}
|
|
40
27
|
set activeTabId(activeTabId) {
|
|
41
|
-
|
|
28
|
+
this.#activeTabId = activeTabId;
|
|
42
29
|
}
|
|
43
30
|
getCurrentTrigger(tabId) {
|
|
44
|
-
return
|
|
31
|
+
return this.#currentTriggerByTabId[tabId];
|
|
45
32
|
}
|
|
46
33
|
getConversationId(tabId) {
|
|
47
|
-
return tabId &&
|
|
34
|
+
return tabId && this.#tabTelemetryInfoByTabId[tabId]?.conversationId;
|
|
48
35
|
}
|
|
49
36
|
removeConversation(tabId) {
|
|
50
|
-
delete
|
|
37
|
+
delete this.#tabTelemetryInfoByTabId[tabId];
|
|
51
38
|
}
|
|
52
39
|
setConversationId(tabId, conversationId) {
|
|
53
40
|
this.updateTriggerInfo(tabId, { conversationId });
|
|
54
41
|
}
|
|
55
42
|
updateTriggerInfo(tabId, info) {
|
|
56
|
-
|
|
43
|
+
this.#tabTelemetryInfoByTabId[tabId] = { ...this.#tabTelemetryInfoByTabId[tabId], ...info };
|
|
57
44
|
}
|
|
58
45
|
getLastMessageTrigger(tabId) {
|
|
59
|
-
return
|
|
46
|
+
return this.#tabTelemetryInfoByTabId[tabId]?.lastMessageTrigger;
|
|
60
47
|
}
|
|
61
48
|
emitModifyCodeMetric(entry, percentage) {
|
|
62
49
|
this.emitConversationMetric({
|
|
@@ -68,22 +55,22 @@ class ChatTelemetryController {
|
|
|
68
55
|
});
|
|
69
56
|
}
|
|
70
57
|
emitChatMetric(metric) {
|
|
71
|
-
|
|
58
|
+
this.#telemetry.emitMetric({
|
|
72
59
|
...metric,
|
|
73
60
|
data: {
|
|
74
61
|
...metric.data,
|
|
75
|
-
credentialStartUrl:
|
|
62
|
+
credentialStartUrl: this.#credentialsProvider.getConnectionMetadata()?.sso?.startUrl,
|
|
76
63
|
},
|
|
77
64
|
});
|
|
78
65
|
}
|
|
79
66
|
emitConversationMetric(metric, tabId = this.activeTabId) {
|
|
80
67
|
const conversationId = this.getConversationId(tabId);
|
|
81
68
|
if (conversationId) {
|
|
82
|
-
|
|
69
|
+
this.#telemetry.emitMetric({
|
|
83
70
|
...metric,
|
|
84
71
|
data: {
|
|
85
72
|
...metric.data,
|
|
86
|
-
credentialStartUrl:
|
|
73
|
+
credentialStartUrl: this.#credentialsProvider.getConnectionMetadata()?.sso?.startUrl,
|
|
87
74
|
[exports.CONVERSATION_ID_METRIC_KEY]: conversationId,
|
|
88
75
|
},
|
|
89
76
|
});
|
|
@@ -149,101 +136,102 @@ class ChatTelemetryController {
|
|
|
149
136
|
},
|
|
150
137
|
}, tabId);
|
|
151
138
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
originalString: params.code,
|
|
168
|
-
startPosition,
|
|
169
|
-
endPosition,
|
|
170
|
-
});
|
|
139
|
+
#enqueueCodeDiffEntry(params) {
|
|
140
|
+
const documentUri = params.textDocument?.uri;
|
|
141
|
+
const cursorRangeOrPosition = params.cursorState?.[0];
|
|
142
|
+
if (params.code && documentUri && cursorRangeOrPosition) {
|
|
143
|
+
const startPosition = 'position' in cursorRangeOrPosition ? cursorRangeOrPosition.position : cursorRangeOrPosition.range.start;
|
|
144
|
+
const endPosition = 'position' in cursorRangeOrPosition ? cursorRangeOrPosition.position : cursorRangeOrPosition.range.end;
|
|
145
|
+
this.#codeDiffTracker.enqueue({
|
|
146
|
+
messageId: params.messageId,
|
|
147
|
+
fileUrl: documentUri,
|
|
148
|
+
time: Date.now(),
|
|
149
|
+
originalString: params.code,
|
|
150
|
+
startPosition,
|
|
151
|
+
endPosition,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
171
154
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
155
|
+
#handleClientTelemetry(params) {
|
|
156
|
+
if ((0, clientTelemetry_1.isClientTelemetryEvent)(params)) {
|
|
157
|
+
switch (params.name) {
|
|
158
|
+
case clientTelemetry_1.ChatUIEventName.AddMessage:
|
|
159
|
+
// we are trusting that the notification comes just right before the request
|
|
160
|
+
this.#currentTriggerByTabId[params.tabId] = params.triggerType;
|
|
161
|
+
break;
|
|
162
|
+
case clientTelemetry_1.ChatUIEventName.TabAdd:
|
|
163
|
+
this.#tabTelemetryInfoByTabId[params.tabId] = {
|
|
164
|
+
...this.#tabTelemetryInfoByTabId[params.tabId],
|
|
165
|
+
startTrigger: {
|
|
166
|
+
triggerType: params.triggerType,
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
break;
|
|
170
|
+
case clientTelemetry_1.ChatUIEventName.EnterFocusChat:
|
|
171
|
+
this.emitChatMetric({
|
|
172
|
+
name: types_1.ChatTelemetryEventName.EnterFocusChat,
|
|
173
|
+
data: {},
|
|
174
|
+
});
|
|
175
|
+
break;
|
|
176
|
+
case clientTelemetry_1.ChatUIEventName.ExitFocusChat:
|
|
177
|
+
this.emitChatMetric({
|
|
178
|
+
name: types_1.ChatTelemetryEventName.ExitFocusChat,
|
|
179
|
+
data: {},
|
|
180
|
+
});
|
|
181
|
+
break;
|
|
182
|
+
case clientTelemetry_1.ChatUIEventName.Vote:
|
|
183
|
+
this.emitConversationMetric({
|
|
184
|
+
name: types_1.ChatTelemetryEventName.InteractWithMessage,
|
|
185
|
+
data: {
|
|
186
|
+
cwsprChatMessageId: params.messageId,
|
|
187
|
+
cwsprChatInteractionType: params.vote === clientTelemetry_1.RelevancyVoteType.UP
|
|
188
|
+
? types_1.ChatInteractionType.Upvote
|
|
189
|
+
: types_1.ChatInteractionType.Downvote,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
break;
|
|
193
|
+
case clientTelemetry_1.ChatUIEventName.InsertToCursorPosition:
|
|
194
|
+
case clientTelemetry_1.ChatUIEventName.CopyToClipboard:
|
|
195
|
+
if (params.name === clientTelemetry_1.ChatUIEventName.InsertToCursorPosition) {
|
|
196
|
+
this.#enqueueCodeDiffEntry(params);
|
|
197
|
+
}
|
|
198
|
+
this.emitConversationMetric({
|
|
199
|
+
name: types_1.ChatTelemetryEventName.InteractWithMessage,
|
|
200
|
+
data: {
|
|
201
|
+
cwsprChatMessageId: params.messageId,
|
|
202
|
+
cwsprChatInteractionType: params.name === clientTelemetry_1.ChatUIEventName.InsertToCursorPosition
|
|
203
|
+
? types_1.ChatInteractionType.InsertAtCursor
|
|
204
|
+
: types_1.ChatInteractionType.CopySnippet,
|
|
205
|
+
cwsprChatAcceptedCharactersLength: params.code?.length ?? 0,
|
|
206
|
+
cwsprChatHasReference: Boolean(params.referenceTrackerInformation?.length),
|
|
207
|
+
cwsprChatCodeBlockIndex: params.codeBlockIndex,
|
|
208
|
+
cwsprChatTotalCodeBlocks: params.totalCodeBlocks,
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
break;
|
|
212
|
+
case clientTelemetry_1.ChatUIEventName.LinkClick:
|
|
213
|
+
case clientTelemetry_1.ChatUIEventName.InfoLinkClick:
|
|
214
|
+
this.emitInteractWithMessageMetric(params.tabId, {
|
|
203
215
|
cwsprChatMessageId: params.messageId,
|
|
204
|
-
cwsprChatInteractionType:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
case clientTelemetry_1.ChatUIEventName.InsertToCursorPosition:
|
|
211
|
-
case clientTelemetry_1.ChatUIEventName.CopyToClipboard:
|
|
212
|
-
if (params.name === clientTelemetry_1.ChatUIEventName.InsertToCursorPosition) {
|
|
213
|
-
__classPrivateFieldGet(this, _ChatTelemetryController_instances, "m", _ChatTelemetryController_enqueueCodeDiffEntry).call(this, params);
|
|
214
|
-
}
|
|
215
|
-
this.emitConversationMetric({
|
|
216
|
-
name: types_1.ChatTelemetryEventName.InteractWithMessage,
|
|
217
|
-
data: {
|
|
216
|
+
cwsprChatInteractionType: types_1.ChatInteractionType.ClickBodyLink,
|
|
217
|
+
cwsprChatInteractionTarget: params.link,
|
|
218
|
+
});
|
|
219
|
+
break;
|
|
220
|
+
case clientTelemetry_1.ChatUIEventName.SourceLinkClick:
|
|
221
|
+
this.emitInteractWithMessageMetric(params.tabId, {
|
|
218
222
|
cwsprChatMessageId: params.messageId,
|
|
219
|
-
cwsprChatInteractionType:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
cwsprChatCodeBlockIndex: params.codeBlockIndex,
|
|
225
|
-
cwsprChatTotalCodeBlocks: params.totalCodeBlocks,
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
break;
|
|
229
|
-
case clientTelemetry_1.ChatUIEventName.LinkClick:
|
|
230
|
-
case clientTelemetry_1.ChatUIEventName.InfoLinkClick:
|
|
231
|
-
this.emitInteractWithMessageMetric(params.tabId, {
|
|
232
|
-
cwsprChatMessageId: params.messageId,
|
|
233
|
-
cwsprChatInteractionType: types_1.ChatInteractionType.ClickBodyLink,
|
|
234
|
-
cwsprChatInteractionTarget: params.link,
|
|
235
|
-
});
|
|
236
|
-
break;
|
|
237
|
-
case clientTelemetry_1.ChatUIEventName.SourceLinkClick:
|
|
238
|
-
this.emitInteractWithMessageMetric(params.tabId, {
|
|
239
|
-
cwsprChatMessageId: params.messageId,
|
|
240
|
-
cwsprChatInteractionType: types_1.ChatInteractionType.ClickLink,
|
|
241
|
-
cwsprChatInteractionTarget: params.link,
|
|
242
|
-
});
|
|
243
|
-
break;
|
|
223
|
+
cwsprChatInteractionType: types_1.ChatInteractionType.ClickLink,
|
|
224
|
+
cwsprChatInteractionTarget: params.link,
|
|
225
|
+
});
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
244
228
|
}
|
|
245
229
|
}
|
|
246
|
-
|
|
230
|
+
dispose() {
|
|
231
|
+
this.#codeDiffTracker.shutdown();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
exports.ChatTelemetryController = ChatTelemetryController;
|
|
247
235
|
function convertToTelemetryUserIntent(userIntent) {
|
|
248
236
|
switch (userIntent) {
|
|
249
237
|
case codewhisperer_streaming_1.UserIntent.EXPLAIN_CODE_SELECTION:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chatTelemetryController.js","sourceRoot":"","sources":["../../../../src/language-server/chat/telemetry/chatTelemetryController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chatTelemetryController.js","sourceRoot":"","sources":["../../../../src/language-server/chat/telemetry/chatTelemetryController.ts"],"names":[],"mappings":";;;AAEA,iDAM8B;AAE9B,uDAK0B;AAC1B,2EAA0D;AAE1D,qEAA0F;AAE7E,QAAA,0BAA0B,GAAG,yBAAyB,CAAA;AAgCnE,MAAa,uBAAuB;IAChC,YAAY,CAAS;IACrB,wBAAwB,CAA8C;IACtE,sBAAsB,GAAqC,EAAE,CAAA;IAC7D,oBAAoB,CAAiC;IACrD,UAAU,CAAuB;IACjC,gBAAgB,CAA8C;IAE9D,YAAY,QAAkB;QAC1B,IAAI,CAAC,wBAAwB,GAAG,EAAE,CAAA;QAClC,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAA;QAChC,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,SAAS,CAAA;QACpC,IAAI,CAAC,oBAAoB,GAAG,QAAQ,CAAC,mBAAmB,CAAA;QACxD,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAA;QAChF,IAAI,CAAC,gBAAgB,GAAG,IAAI,iCAAe,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,CACpG,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAA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BAAsB,CAAA;QACjC,KAAK,oCAAU,CAAC,gCAAgC;YAC5C,OAAO,gCAAgC,CAAA;QAC3C,KAAK,oCAAU,CAAC,2BAA2B;YACvC,OAAO,0BAA0B,CAAA;QACrC,KAAK,oCAAU,CAAC,YAAY;YACxB,OAAO,aAAa,CAAA;QACxB,KAAK,oCAAU,CAAC,YAAY;YACxB,OAAO,aAAa,CAAA;QACxB,KAAK,oCAAU,CAAC,oBAAoB;YAChC,OAAO,mBAAmB,CAAA;QAC9B,KAAK,oCAAU,CAAC,aAAa;YACzB,OAAO,cAAc,CAAA;QACzB;YACI,OAAO,EAAE,CAAA;KAChB;AACL,CAAC;AAnBD,oEAmBC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ChatResult } from '@aws/language-server-runtimes/server-interface';
|
|
2
|
+
type AuthFollowUpType = 'full-auth' | 're-auth' | 'missing_scopes' | 'use-supported-auth';
|
|
3
|
+
export declare function getAuthFollowUpType(err: unknown): AuthFollowUpType | undefined;
|
|
4
|
+
export declare function createAuthFollowUpResult(authType: AuthFollowUpType): ChatResult;
|
|
5
|
+
export declare function getDefaultChatResponse(prompt?: string): ChatResult | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultChatResponse = exports.createAuthFollowUpResult = exports.getAuthFollowUpType = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const constants_2 = require("./constants");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
7
|
+
const AUTH_ERROR_DEFINITION_LIST = [
|
|
8
|
+
{
|
|
9
|
+
match: (err) => err.message.startsWith(constants_1.MISSING_BEARER_TOKEN_ERROR),
|
|
10
|
+
authFollowType: 'full-auth',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
match: (err) => err.message.startsWith(constants_1.INVALID_TOKEN),
|
|
14
|
+
authFollowType: 're-auth',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
match: (err) => err.message.startsWith(constants_1.GENERIC_UNAUTHORIZED_ERROR),
|
|
18
|
+
authFollowType: 'full-auth',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
function getAuthFollowUpType(err) {
|
|
22
|
+
return err instanceof Error
|
|
23
|
+
? AUTH_ERROR_DEFINITION_LIST.find(definition => definition.match(err))?.authFollowType
|
|
24
|
+
: undefined;
|
|
25
|
+
}
|
|
26
|
+
exports.getAuthFollowUpType = getAuthFollowUpType;
|
|
27
|
+
function createAuthFollowUpResult(authType) {
|
|
28
|
+
let pillText;
|
|
29
|
+
switch (authType) {
|
|
30
|
+
case 'full-auth':
|
|
31
|
+
pillText = 'Authenticate';
|
|
32
|
+
break;
|
|
33
|
+
case 'use-supported-auth':
|
|
34
|
+
case 'missing_scopes':
|
|
35
|
+
pillText = 'Enable Amazon Q';
|
|
36
|
+
break;
|
|
37
|
+
case 're-auth':
|
|
38
|
+
pillText = 'Re-authenticate';
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
body: '',
|
|
43
|
+
followUp: {
|
|
44
|
+
text: '',
|
|
45
|
+
options: [{ pillText, type: authType }],
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.createAuthFollowUpResult = createAuthFollowUpResult;
|
|
50
|
+
function getDefaultChatResponse(prompt) {
|
|
51
|
+
if (prompt === constants_2.DEFAULT_HELP_FOLLOW_UP_PROMPT) {
|
|
52
|
+
return {
|
|
53
|
+
messageId: (0, uuid_1.v4)(),
|
|
54
|
+
body: constants_2.HELP_MESSAGE,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
exports.getDefaultChatResponse = getDefaultChatResponse;
|
|
60
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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QAAQ,EAAE,CAAC;SAC1C;KACJ,CAAA;AACL,CAAC;AAtBD,4DAsBC;AAED,SAAgB,sBAAsB,CAAC,MAAe;IAClD,IAAI,MAAM,KAAK,yCAA6B,EAAE;QAC1C,OAAO;YACH,SAAS,EAAE,IAAA,SAAI,GAAE;YACjB,IAAI,EAAE,wBAAY;SACrB,CAAA;KACJ;IAED,OAAO,SAAS,CAAA;AACpB,CAAC;AATD,wDASC"}
|
|
@@ -9,23 +9,24 @@ const AWS = require("aws-sdk");
|
|
|
9
9
|
// Right now the only difference between the token client and the IAM client for codewhsiperer is the difference in function name
|
|
10
10
|
// This abstract class can grow in the future to account for any additional changes across the clients
|
|
11
11
|
class CodeWhispererServiceBase {
|
|
12
|
+
codeWhispererRegion = 'us-east-1';
|
|
13
|
+
codeWhispererEndpoint = 'https://codewhisperer.us-east-1.amazonaws.com/';
|
|
14
|
+
shareCodeWhispererContentWithAWS = false;
|
|
12
15
|
constructor(credentialsProvider, additionalAwsConfig = {}) {
|
|
13
|
-
this.codeWhispererRegion = 'us-east-1';
|
|
14
|
-
this.codeWhispererEndpoint = 'https://codewhisperer.us-east-1.amazonaws.com/';
|
|
15
|
-
this.shareCodeWhispererContentWithAWS = false;
|
|
16
|
-
this.updateAwsConfiguration = (awsConfig) => {
|
|
17
|
-
if (awsConfig?.proxy) {
|
|
18
|
-
AWS.config.update({
|
|
19
|
-
httpOptions: { agent: awsConfig.proxy },
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
this.generateItemId = () => (0, uuid_1.v4)();
|
|
24
16
|
this.updateAwsConfiguration(additionalAwsConfig);
|
|
25
17
|
}
|
|
18
|
+
updateAwsConfiguration = (awsConfig) => {
|
|
19
|
+
if (awsConfig?.proxy) {
|
|
20
|
+
AWS.config.update({
|
|
21
|
+
httpOptions: { agent: awsConfig.proxy },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
generateItemId = () => (0, uuid_1.v4)();
|
|
26
26
|
}
|
|
27
27
|
exports.CodeWhispererServiceBase = CodeWhispererServiceBase;
|
|
28
28
|
class CodeWhispererServiceIAM extends CodeWhispererServiceBase {
|
|
29
|
+
client;
|
|
29
30
|
constructor(credentialsProvider, additionalAwsConfig = {}) {
|
|
30
31
|
super(credentialsProvider, additionalAwsConfig);
|
|
31
32
|
const options = {
|
|
@@ -60,6 +61,7 @@ class CodeWhispererServiceIAM extends CodeWhispererServiceBase {
|
|
|
60
61
|
}
|
|
61
62
|
exports.CodeWhispererServiceIAM = CodeWhispererServiceIAM;
|
|
62
63
|
class CodeWhispererServiceToken extends CodeWhispererServiceBase {
|
|
64
|
+
client;
|
|
63
65
|
constructor(credentialsProvider, additionalAwsConfig = {}) {
|
|
64
66
|
super(credentialsProvider, additionalAwsConfig);
|
|
65
67
|
const options = {
|