|
3 | 3 | * SPDX-License-Identifier: Apache-2.0
|
4 | 4 | */
|
5 | 5 |
|
6 |
| -export const CodeWhispererConstants = { |
7 |
| - /** |
8 |
| - * SDK Client |
9 |
| - */ |
10 |
| - endpoint: 'https://codewhisperer.us-east-1.amazonaws.com/', |
11 |
| - region: 'us-east-1', |
12 |
| - |
13 |
| - /** |
14 |
| - * Automated and manual trigger |
15 |
| - */ |
16 |
| - invocationTimeIntervalThreshold: 2, // seconds |
17 |
| - promiseTimeoutLimit: 15, // seconds |
18 |
| - invocationKeyThreshold: 15, |
19 |
| - specialCharactersList: ['{', '[', '(', ':', '\t', '\n'], |
20 |
| - normalTextChangeRegex: /[A-Za-z0-9]/g, |
21 |
| - AutoSuggestion: { |
22 |
| - settingId: 'codewhisperer_autoSuggestionActivation', |
23 |
| - activated: 'Activated', |
24 |
| - deactivated: 'Deactivated', |
25 |
| - }, |
26 |
| - |
27 |
| - /** |
28 |
| - * EditorCon context |
29 |
| - */ |
30 |
| - charactersLimit: 10240, |
31 |
| - filenameCharsLimit: 1024, |
32 |
| - naturalLanguage: 'en-US', |
33 |
| - maxRecommendations: 1, |
34 |
| - space: ' ', |
35 |
| - lineBreak: '\n', |
36 |
| - lineBreakWin: '\r\n', |
37 |
| - |
38 |
| - /** |
39 |
| - * Ux of recommendations |
40 |
| - */ |
41 |
| - labelLength: 20, |
42 |
| - completionDetail: 'CodeWhisperer', |
43 |
| - |
44 |
| - /** |
45 |
| - * CodeWhisperer in configuration |
46 |
| - */ |
47 |
| - codewhisperer: 'CodeWhisperer', |
48 |
| - /** |
49 |
| - * Supported languages |
50 |
| - */ |
51 |
| - java: 'java', |
52 |
| - python: 'python', |
53 |
| - javascript: 'javascript', |
54 |
| - typescript: 'typescript', |
55 |
| - |
56 |
| - supportedLanguages: ['java', 'python', 'javascript', 'typescript'], |
57 |
| - |
58 |
| - /** |
59 |
| - * Prompt |
60 |
| - */ |
61 |
| - pendingResponse: 'Waiting for CodeWhisperer...', |
62 |
| - runningSecurityScan: 'Running security scan...', |
63 |
| - noSuggestions: 'No suggestions from CodeWhisperer', |
64 |
| - licenseFilter: 'CodeWhisperer suggestions were filtered due to reference setting', |
65 |
| - |
66 |
| - /** |
67 |
| - * Beta landing page file |
68 |
| - */ |
69 |
| - welcomeCodeWhispererReadmeFileSource: 'resources/markdown/WelcomeToCodeWhisperer.md', |
70 |
| - welcomeCodeWhispererCloud9ReadmeFileSource: 'resources/markdown/WelcomeToCodeWhispererCloud9.md', |
71 |
| - welcomeMessageKey: 'CODEWHISPERER_WELCOME_MESSAGE', |
72 |
| - |
73 |
| - /** |
74 |
| - * Key bindings JSON file path |
75 |
| - */ |
76 |
| - keyBindingPathMac: 'Library/Application Support/Code/User/keybindings.json', |
77 |
| - keyBindingPathLinux: '.config/Code/User/keybindings.json', |
78 |
| - keyBindingPathWin: 'Code/User/keybindings.json', |
79 |
| - |
80 |
| - /** |
81 |
| - * Length of left context preview in output channel |
82 |
| - */ |
83 |
| - contextPreviewLen: 20, |
84 |
| - |
85 |
| - /** |
86 |
| - * Unsupported language cache |
87 |
| - */ |
88 |
| - unsupportedLanguagesCacheTTL: 10 * 60 * 60 * 1000, |
89 |
| - unsupportedLanguagesKey: 'CODEWHISPERER_UNSUPPORTED_LANGUAGES_KEY', |
90 |
| - autoTriggerEnabledKey: 'CODEWHISPERER_AUTO_TRIGGER_ENABLED', |
91 |
| - termsAcceptedKey: 'CODEWHISPERER_TERMS_ACCEPTED', |
92 |
| - serviceActiveKey: 'CODEWHISPERER_SERVICE_ACTIVE', |
93 |
| - accessToken: 'CODEWHISPERER_ACCESS_TOKEN', |
94 |
| - |
95 |
| - learnMoreUri: 'https://aws.amazon.com/codewhisperer', |
96 |
| - |
97 |
| - previewSignupPortal: 'https://pages.awscloud.com/codewhisperer-sign-up-form.html', |
98 |
| - |
99 |
| - identityPoolID: 'us-east-1:70717e99-906f-4add-908c-bd9074a2f5b9', |
100 |
| - /** |
101 |
| - * the interval of the background thread invocation, which is triggered by the timer |
102 |
| - */ |
103 |
| - defaultCheckPeriodMillis: 1000 * 60 * 5, |
104 |
| - |
105 |
| - // suggestion show delay, in milliseconds |
106 |
| - suggestionShowDelay: 250, |
107 |
| - |
108 |
| - referenceLog: 'CodeWhisperer Reference Log', |
109 |
| - |
110 |
| - suggestionDetailReferenceText: (licenses: string) => |
111 |
| - `Reference code under ${licenses}. View full details in CodeWhisperer reference log.`, |
112 |
| - |
113 |
| - hoverInlayText: (licenseName: string | undefined, repository: string | undefined) => |
114 |
| - `Reference code under the ${licenseName} license from repository ${repository}`, |
115 |
| - |
116 |
| - referenceLogText: (code: string, license: string, repository: string, filePath: string, lineInfo: string) => |
117 |
| - `with code ${code} provided with reference under ${license} from repository ${repository}. Added to ${filePath} ${lineInfo}.`, |
118 |
| - |
119 |
| - referenceLogPromptText: `Don\'t want suggestions that include code with references? Uncheck this option in |
120 |
| - <a href="#" onclick="openSettings();return false;">CodeWhisperer Settings</a>`, |
121 |
| - /** |
122 |
| - * Security Scan |
123 |
| - */ |
124 |
| - codeScanJavaPayloadSizeLimitBytes: Math.pow(2, 20), // 1 MB |
125 |
| - codeScanPythonPayloadSizeLimitBytes: 200 * Math.pow(2, 10), // 200 KB |
126 |
| - codeScanTruncDirPrefix: 'codewhisperer_scan', |
127 |
| - codeScanZipExt: '.zip', |
128 |
| - contextTruncationTimeoutSeconds: 10, |
129 |
| - codeScanJobTimeoutSeconds: 50, |
130 |
| - projectSizeCalculateTimeoutSeconds: 10, |
131 |
| - codeScanJobPollingIntervalSeconds: 5, |
132 |
| - artifactTypeSource: 'SourceCode', |
133 |
| - artifactTypeBuild: 'BuiltJars', |
134 |
| - codeScanFindingsSchema: 'codescan/findings/1.0', |
135 |
| - |
136 |
| - // telemetry experiment id |
137 |
| - experimentId: 'codeWhisperer', |
138 |
| - |
139 |
| - // wait time for editor to update editor.selection.active (in milliseconds) |
140 |
| - vsCodeCursorUpdateDelay: 3, |
141 |
| - // cloud9 access state |
142 |
| - cloud9AccessStateKey: 'cloud9AccessStateKey', |
143 |
| - cloud9AccessSent: 'Access requested!', |
144 |
| - cloud9AccessAlreadySent: 'Access has already been requested, we are still processing it.', |
| 6 | +/** |
| 7 | + * SDK Client |
| 8 | + */ |
| 9 | +export const endpoint = 'https://codewhisperer.us-east-1.amazonaws.com/' |
| 10 | + |
| 11 | +export const region = 'us-east-1' |
| 12 | + |
| 13 | +/** |
| 14 | + * Automated and manual trigger |
| 15 | + */ |
| 16 | +export const invocationTimeIntervalThreshold = 2 // seconds |
| 17 | + |
| 18 | +export const promiseTimeoutLimit = 15 // seconds |
| 19 | + |
| 20 | +export const invocationKeyThreshold = 15 |
| 21 | + |
| 22 | +export const specialCharactersList = ['{', '[', '(', ':', '\t', '\n'] |
| 23 | + |
| 24 | +export const normalTextChangeRegex = /[A-Za-z0-9]/g |
| 25 | + |
| 26 | +export const autoSuggestionConfig = { |
| 27 | + settingId: 'codewhisperer_autoSuggestionActivation', |
| 28 | + activated: 'Activated', |
| 29 | + deactivated: 'Deactivated', |
145 | 30 | }
|
| 31 | + |
| 32 | +/** |
| 33 | + * EditorCon context |
| 34 | + */ |
| 35 | +export const charactersLimit = 10240 |
| 36 | + |
| 37 | +export const filenameCharsLimit = 1024 |
| 38 | + |
| 39 | +export const naturalLanguage = 'en-US' |
| 40 | + |
| 41 | +export const maxRecommendations = 1 |
| 42 | + |
| 43 | +export const space = ' ' |
| 44 | + |
| 45 | +export const lineBreak = '\n' |
| 46 | + |
| 47 | +export const lineBreakWin = '\r\n' |
| 48 | + |
| 49 | +/** |
| 50 | + * Ux of recommendations |
| 51 | + */ |
| 52 | +export const labelLength = 20 |
| 53 | + |
| 54 | +export const completionDetail = 'CodeWhisperer' |
| 55 | + |
| 56 | +/** |
| 57 | + * CodeWhisperer in configuration |
| 58 | + */ |
| 59 | +export const codewhisperer = 'CodeWhisperer' |
| 60 | + |
| 61 | +/** |
| 62 | + * Supported languages |
| 63 | + */ |
| 64 | +export const java = 'java' |
| 65 | + |
| 66 | +export const python = 'python' |
| 67 | + |
| 68 | +export const javascript = 'javascript' |
| 69 | + |
| 70 | +export const typescript = 'typescript' |
| 71 | + |
| 72 | +export const supportedLanguages = ['java', 'python', 'javascript', 'typescript'] |
| 73 | + |
| 74 | +/** |
| 75 | + * Prompt |
| 76 | + */ |
| 77 | +export const pendingResponse = 'Waiting for CodeWhisperer...' |
| 78 | + |
| 79 | +export const runningSecurityScan = 'Running security scan...' |
| 80 | + |
| 81 | +export const noSuggestions = 'No suggestions from CodeWhisperer' |
| 82 | + |
| 83 | +export const licenseFilter = 'CodeWhisperer suggestions were filtered due to reference setting' |
| 84 | + |
| 85 | +/** |
| 86 | + * Beta landing page file |
| 87 | + */ |
| 88 | +export const welcomeCodeWhispererReadmeFileSource = 'resources/markdown/WelcomeToCodeWhisperer.md' |
| 89 | + |
| 90 | +export const welcomeCodeWhispererCloud9ReadmeFileSource = 'resources/markdown/WelcomeToCodeWhispererCloud9.md' |
| 91 | + |
| 92 | +export const welcomeMessageKey = 'CODEWHISPERER_WELCOME_MESSAGE' |
| 93 | + |
| 94 | +/** |
| 95 | + * Key bindings JSON file path |
| 96 | + */ |
| 97 | +export const keyBindingPathMac = 'Library/Application Support/Code/User/keybindings.json' |
| 98 | + |
| 99 | +export const keyBindingPathLinux = '.config/Code/User/keybindings.json' |
| 100 | + |
| 101 | +export const keyBindingPathWin = 'Code/User/keybindings.json' |
| 102 | + |
| 103 | +/** |
| 104 | + * Length of left context preview in output channel |
| 105 | + */ |
| 106 | +export const contextPreviewLen = 20 |
| 107 | + |
| 108 | +/** |
| 109 | + * Unsupported language cache |
| 110 | + */ |
| 111 | +export const unsupportedLanguagesCacheTTL = 10 * 60 * 60 * 1000 |
| 112 | + |
| 113 | +export const unsupportedLanguagesKey = 'CODEWHISPERER_UNSUPPORTED_LANGUAGES_KEY' |
| 114 | + |
| 115 | +export const autoTriggerEnabledKey = 'CODEWHISPERER_AUTO_TRIGGER_ENABLED' |
| 116 | + |
| 117 | +export const termsAcceptedKey = 'CODEWHISPERER_TERMS_ACCEPTED' |
| 118 | + |
| 119 | +export const serviceActiveKey = 'CODEWHISPERER_SERVICE_ACTIVE' |
| 120 | + |
| 121 | +export const accessToken = 'CODEWHISPERER_ACCESS_TOKEN' |
| 122 | + |
| 123 | +export const learnMoreUri = 'https://aws.amazon.com/codewhisperer' |
| 124 | + |
| 125 | +export const previewSignupPortal = 'https://pages.awscloud.com/codewhisperer-sign-up-form.html' |
| 126 | + |
| 127 | +export const identityPoolID = 'us-east-1:70717e99-906f-4add-908c-bd9074a2f5b9' |
| 128 | + |
| 129 | +/** |
| 130 | + * the interval of the background thread invocation, which is triggered by the timer |
| 131 | + */ |
| 132 | +export const defaultCheckPeriodMillis = 1000 * 60 * 5 |
| 133 | + |
| 134 | +// suggestion show delay, in milliseconds |
| 135 | +export const suggestionShowDelay = 250 |
| 136 | + |
| 137 | +export const referenceLog = 'CodeWhisperer Reference Log' |
| 138 | + |
| 139 | +export const suggestionDetailReferenceText = (licenses: string) => |
| 140 | + `Reference code under ${licenses}. View full details in CodeWhisperer reference log.` |
| 141 | + |
| 142 | +export const hoverInlayText = (licenseName: string | undefined, repository: string | undefined) => |
| 143 | + `Reference code under the ${licenseName} license from repository ${repository}` |
| 144 | + |
| 145 | +export const referenceLogText = ( |
| 146 | + code: string, |
| 147 | + license: string, |
| 148 | + repository: string, |
| 149 | + filePath: string, |
| 150 | + lineInfo: string |
| 151 | +) => |
| 152 | + `with code ${code} provided with reference under ${license} from repository ${repository}. Added to ${filePath} ${lineInfo}.` |
| 153 | + |
| 154 | +export const referenceLogPromptText = `Don\'t want suggestions that include code with references? Uncheck this option in |
| 155 | + <a href="#" onclick="openSettings();return false;">CodeWhisperer Settings</a>` |
| 156 | + |
| 157 | +/** |
| 158 | + * Security Scan |
| 159 | + */ |
| 160 | +export const codeScanJavaPayloadSizeLimitBytes = Math.pow(2, 20) // 1 MB |
| 161 | + |
| 162 | +export const codeScanPythonPayloadSizeLimitBytes = 200 * Math.pow(2, 10) // 200 KB |
| 163 | + |
| 164 | +export const codeScanTruncDirPrefix = 'codewhisperer_scan' |
| 165 | + |
| 166 | +export const codeScanZipExt = '.zip' |
| 167 | + |
| 168 | +export const contextTruncationTimeoutSeconds = 10 |
| 169 | + |
| 170 | +export const codeScanJobTimeoutSeconds = 50 |
| 171 | + |
| 172 | +export const projectSizeCalculateTimeoutSeconds = 10 |
| 173 | + |
| 174 | +export const codeScanJobPollingIntervalSeconds = 5 |
| 175 | + |
| 176 | +export const artifactTypeSource = 'SourceCode' |
| 177 | + |
| 178 | +export const artifactTypeBuild = 'BuiltJars' |
| 179 | + |
| 180 | +export const codeScanFindingsSchema = 'codescan/findings/1.0' |
| 181 | + |
| 182 | +// telemetry experiment id |
| 183 | +export const experimentId = 'codeWhisperer' |
| 184 | + |
| 185 | +// wait time for editor to update editor.selection.active (in milliseconds) |
| 186 | +export const vsCodeCursorUpdateDelay = 3 |
| 187 | + |
| 188 | +// cloud9 access state |
| 189 | +export const cloud9AccessStateKey = 'cloud9AccessStateKey' |
| 190 | + |
| 191 | +export const cloud9AccessSent = 'Access requested!' |
| 192 | + |
| 193 | +export const cloud9AccessAlreadySent = 'Access has already been requested, we are still processing it.' |
0 commit comments