@vscode/chat-lib 0.0.1 → 0.0.2

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.
Files changed (391) hide show
  1. package/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts.map +1 -1
  2. package/dist/src/_internal/extension/xtab/common/promptCrafting.js +6 -5
  3. package/dist/src/_internal/extension/xtab/common/promptCrafting.js.map +1 -1
  4. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +1 -0
  5. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
  6. package/dist/src/_internal/platform/configuration/common/configurationService.js +1 -0
  7. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
  8. package/dist/src/_internal/platform/env/common/envService.d.ts +5 -0
  9. package/dist/src/_internal/platform/env/common/envService.d.ts.map +1 -1
  10. package/dist/src/_internal/platform/env/common/envService.js +2 -1
  11. package/dist/src/_internal/platform/env/common/envService.js.map +1 -1
  12. package/dist/src/_internal/platform/env/common/nullEnvService.d.ts +3 -0
  13. package/dist/src/_internal/platform/env/common/nullEnvService.d.ts.map +1 -1
  14. package/dist/src/_internal/platform/env/common/nullEnvService.js +8 -1
  15. package/dist/src/_internal/platform/env/common/nullEnvService.js.map +1 -1
  16. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.d.ts +7 -0
  17. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.d.ts.map +1 -1
  18. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.js +1 -0
  19. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.js.map +1 -1
  20. package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts +8 -0
  21. package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts.map +1 -1
  22. package/dist/src/_internal/util/common/test/shims/chatTypes.js +19 -1
  23. package/dist/src/_internal/util/common/test/shims/chatTypes.js.map +1 -1
  24. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.d.ts.map +1 -1
  25. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js +8 -1
  26. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js.map +1 -1
  27. package/dist/src/_internal/vscodeTypes.d.ts +4 -0
  28. package/dist/src/_internal/vscodeTypes.d.ts.map +1 -1
  29. package/dist/src/_internal/vscodeTypes.js +5 -1
  30. package/dist/src/_internal/vscodeTypes.js.map +1 -1
  31. package/dist/src/main.d.ts +5 -0
  32. package/dist/src/main.d.ts.map +1 -1
  33. package/dist/src/main.js +12 -0
  34. package/dist/src/main.js.map +1 -1
  35. package/dist/src/package.json +46 -19
  36. package/package.json +3 -6
  37. package/src/_internal/extension/byok/node/openAIEndpoint.ts +0 -171
  38. package/src/_internal/extension/common/constants.ts +0 -90
  39. package/src/_internal/extension/inlineEdits/common/delayer.ts +0 -108
  40. package/src/_internal/extension/inlineEdits/common/editRebase.ts +0 -268
  41. package/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.tsx +0 -163
  42. package/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.ts +0 -225
  43. package/src/_internal/extension/inlineEdits/common/rejectionCollector.ts +0 -164
  44. package/src/_internal/extension/inlineEdits/node/debugRecorder.ts +0 -205
  45. package/src/_internal/extension/inlineEdits/node/importFiltering.ts +0 -25
  46. package/src/_internal/extension/inlineEdits/node/nesConfigs.ts +0 -12
  47. package/src/_internal/extension/inlineEdits/node/nextEditCache.ts +0 -278
  48. package/src/_internal/extension/inlineEdits/node/nextEditProvider.ts +0 -778
  49. package/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.ts +0 -983
  50. package/src/_internal/extension/inlineEdits/node/nextEditResult.ts +0 -40
  51. package/src/_internal/extension/prompt/common/importStatement.ts +0 -25
  52. package/src/_internal/extension/prompt/node/chatMLFetcher.ts +0 -706
  53. package/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.ts +0 -146
  54. package/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.ts +0 -527
  55. package/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.ts +0 -76
  56. package/src/_internal/extension/prompts/node/inline/visualization.ts +0 -65
  57. package/src/_internal/extension/vscode.proposed.activeComment.d.ts +0 -23
  58. package/src/_internal/extension/vscode.proposed.aiRelatedInformation.d.ts +0 -49
  59. package/src/_internal/extension/vscode.proposed.aiSettingsSearch.d.ts +0 -31
  60. package/src/_internal/extension/vscode.proposed.aiTextSearchProvider.d.ts +0 -41
  61. package/src/_internal/extension/vscode.proposed.authLearnMore.d.ts +0 -16
  62. package/src/_internal/extension/vscode.proposed.chatBinaryReferenceData.d.ts +0 -41
  63. package/src/_internal/extension/vscode.proposed.chatEditing.d.ts +0 -29
  64. package/src/_internal/extension/vscode.proposed.chatParticipantAdditions.d.ts +0 -636
  65. package/src/_internal/extension/vscode.proposed.chatParticipantPrivate.d.ts +0 -276
  66. package/src/_internal/extension/vscode.proposed.chatProvider.d.ts +0 -62
  67. package/src/_internal/extension/vscode.proposed.chatReadonlyPromptReference.d.ts +0 -17
  68. package/src/_internal/extension/vscode.proposed.chatReferenceDiagnostic.d.ts +0 -23
  69. package/src/_internal/extension/vscode.proposed.chatSessionsProvider.d.ts +0 -218
  70. package/src/_internal/extension/vscode.proposed.chatStatusItem.d.ts +0 -61
  71. package/src/_internal/extension/vscode.proposed.codeActionAI.d.ts +0 -16
  72. package/src/_internal/extension/vscode.proposed.commentReveal.d.ts +0 -32
  73. package/src/_internal/extension/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts +0 -8
  74. package/src/_internal/extension/vscode.proposed.contribCommentsViewThreadMenus.d.ts +0 -6
  75. package/src/_internal/extension/vscode.proposed.contribSourceControlInputBoxMenu.d.ts +0 -7
  76. package/src/_internal/extension/vscode.proposed.dataChannels.d.ts +0 -19
  77. package/src/_internal/extension/vscode.proposed.defaultChatParticipant.d.ts +0 -52
  78. package/src/_internal/extension/vscode.proposed.documentFiltersExclusive.d.ts +0 -13
  79. package/src/_internal/extension/vscode.proposed.embeddings.d.ts +0 -33
  80. package/src/_internal/extension/vscode.proposed.extensionsAny.d.ts +0 -40
  81. package/src/_internal/extension/vscode.proposed.findFiles2.d.ts +0 -125
  82. package/src/_internal/extension/vscode.proposed.findTextInFiles.d.ts +0 -104
  83. package/src/_internal/extension/vscode.proposed.findTextInFiles2.d.ts +0 -144
  84. package/src/_internal/extension/vscode.proposed.inlineCompletionsAdditions.d.ts +0 -202
  85. package/src/_internal/extension/vscode.proposed.interactive.d.ts +0 -11
  86. package/src/_internal/extension/vscode.proposed.languageModelCapabilities.d.ts +0 -25
  87. package/src/_internal/extension/vscode.proposed.languageModelDataPart.d.ts +0 -163
  88. package/src/_internal/extension/vscode.proposed.languageModelSystem.d.ts +0 -17
  89. package/src/_internal/extension/vscode.proposed.languageModelThinkingPart.d.ts +0 -49
  90. package/src/_internal/extension/vscode.proposed.languageModelToolResultAudience.d.ts +0 -36
  91. package/src/_internal/extension/vscode.proposed.mappedEditsProvider.d.ts +0 -110
  92. package/src/_internal/extension/vscode.proposed.newSymbolNamesProvider.d.ts +0 -47
  93. package/src/_internal/extension/vscode.proposed.readonlyMessage.d.ts +0 -14
  94. package/src/_internal/extension/vscode.proposed.resolvers.d.ts +0 -475
  95. package/src/_internal/extension/vscode.proposed.scmInputBoxValueProvider.d.ts +0 -25
  96. package/src/_internal/extension/vscode.proposed.taskProblemMatcherStatus.d.ts +0 -42
  97. package/src/_internal/extension/vscode.proposed.terminalDataWriteEvent.d.ts +0 -32
  98. package/src/_internal/extension/vscode.proposed.terminalExecuteCommandEvent.d.ts +0 -48
  99. package/src/_internal/extension/vscode.proposed.terminalQuickFixProvider.d.ts +0 -87
  100. package/src/_internal/extension/vscode.proposed.terminalSelection.d.ts +0 -16
  101. package/src/_internal/extension/vscode.proposed.testObserver.d.ts +0 -199
  102. package/src/_internal/extension/vscode.proposed.textDocumentChangeReason.d.ts +0 -30
  103. package/src/_internal/extension/vscode.proposed.textSearchProvider.d.ts +0 -281
  104. package/src/_internal/extension/vscode.proposed.textSearchProvider2.d.ts +0 -297
  105. package/src/_internal/extension/xtab/common/promptCrafting.ts +0 -670
  106. package/src/_internal/extension/xtab/node/xtabEndpoint.ts +0 -102
  107. package/src/_internal/extension/xtab/node/xtabProvider.ts +0 -976
  108. package/src/_internal/extension/xtab/node/xtabUtils.ts +0 -62
  109. package/src/_internal/platform/authentication/common/authentication.ts +0 -309
  110. package/src/_internal/platform/authentication/common/copilotToken.ts +0 -300
  111. package/src/_internal/platform/authentication/common/copilotTokenManager.ts +0 -59
  112. package/src/_internal/platform/authentication/common/copilotTokenStore.ts +0 -40
  113. package/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.ts +0 -96
  114. package/src/_internal/platform/authentication/node/copilotTokenManager.ts +0 -303
  115. package/src/_internal/platform/chat/common/chatMLFetcher.ts +0 -124
  116. package/src/_internal/platform/chat/common/chatQuotaService.ts +0 -63
  117. package/src/_internal/platform/chat/common/chatQuotaServiceImpl.ts +0 -96
  118. package/src/_internal/platform/chat/common/commonTypes.ts +0 -353
  119. package/src/_internal/platform/chat/common/conversationOptions.ts +0 -16
  120. package/src/_internal/platform/chat/common/globalStringUtils.ts +0 -54
  121. package/src/_internal/platform/chat/common/interactionService.ts +0 -35
  122. package/src/_internal/platform/configuration/common/configurationService.ts +0 -803
  123. package/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.ts +0 -39
  124. package/src/_internal/platform/configuration/common/jsonSchema.ts +0 -139
  125. package/src/_internal/platform/configuration/common/validator.ts +0 -242
  126. package/src/_internal/platform/diff/common/diffService.ts +0 -41
  127. package/src/_internal/platform/diff/common/diffWorker.ts +0 -83
  128. package/src/_internal/platform/diff/node/diffServiceImpl.ts +0 -85
  129. package/src/_internal/platform/editing/common/abstractText.ts +0 -177
  130. package/src/_internal/platform/editing/common/notebookDocumentSnapshot.ts +0 -122
  131. package/src/_internal/platform/editing/common/positionOffsetTransformer.ts +0 -202
  132. package/src/_internal/platform/editing/common/textDocumentSnapshot.ts +0 -274
  133. package/src/_internal/platform/endpoint/common/capiClient.ts +0 -37
  134. package/src/_internal/platform/endpoint/common/chatModelCapabilities.ts +0 -115
  135. package/src/_internal/platform/endpoint/common/domainService.ts +0 -27
  136. package/src/_internal/platform/endpoint/common/endpointProvider.ts +0 -104
  137. package/src/_internal/platform/endpoint/common/endpointTypes.ts +0 -12
  138. package/src/_internal/platform/endpoint/common/licenseAgreement.ts +0 -11
  139. package/src/_internal/platform/endpoint/common/statefulMarkerContainer.tsx +0 -85
  140. package/src/_internal/platform/endpoint/common/thinkingDataContainer.tsx +0 -44
  141. package/src/_internal/platform/endpoint/node/capiClientImpl.ts +0 -18
  142. package/src/_internal/platform/endpoint/node/chatEndpoint.ts +0 -435
  143. package/src/_internal/platform/endpoint/node/domainServiceImpl.ts +0 -80
  144. package/src/_internal/platform/endpoint/node/proxyXtabEndpoint.ts +0 -43
  145. package/src/_internal/platform/endpoint/node/responsesApi.ts +0 -326
  146. package/src/_internal/platform/env/common/envService.ts +0 -134
  147. package/src/_internal/platform/env/common/nullEnvService.ts +0 -68
  148. package/src/_internal/platform/env/common/packagejson.ts +0 -49
  149. package/src/_internal/platform/git/common/gitExtensionService.ts +0 -21
  150. package/src/_internal/platform/git/common/nullGitExtensionService.ts +0 -20
  151. package/src/_internal/platform/git/vscode/git.d.ts +0 -414
  152. package/src/_internal/platform/github/common/githubAPI.ts +0 -44
  153. package/src/_internal/platform/github/common/githubService.ts +0 -87
  154. package/src/_internal/platform/github/common/nullOctokitServiceImpl.ts +0 -21
  155. package/src/_internal/platform/ignore/common/ignoreService.ts +0 -72
  156. package/src/_internal/platform/inlineCompletions/common/api.ts +0 -198
  157. package/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.ts +0 -32
  158. package/src/_internal/platform/inlineEdits/common/dataTypes/documentId.ts +0 -52
  159. package/src/_internal/platform/inlineEdits/common/dataTypes/edit.ts +0 -165
  160. package/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.ts +0 -74
  161. package/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.ts +0 -14
  162. package/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.ts +0 -107
  163. package/src/_internal/platform/inlineEdits/common/dataTypes/languageId.ts +0 -14
  164. package/src/_internal/platform/inlineEdits/common/dataTypes/permutation.ts +0 -69
  165. package/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.ts +0 -49
  166. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.ts +0 -74
  167. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.ts +0 -132
  168. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.ts +0 -184
  169. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.ts +0 -32
  170. package/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.ts +0 -89
  171. package/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.ts +0 -10
  172. package/src/_internal/platform/inlineEdits/common/editReason.ts +0 -134
  173. package/src/_internal/platform/inlineEdits/common/inlineEditLogContext.ts +0 -490
  174. package/src/_internal/platform/inlineEdits/common/observableGit.ts +0 -49
  175. package/src/_internal/platform/inlineEdits/common/observableWorkspace.ts +0 -239
  176. package/src/_internal/platform/inlineEdits/common/responseProcessor.ts +0 -249
  177. package/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.ts +0 -468
  178. package/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.ts +0 -59
  179. package/src/_internal/platform/inlineEdits/common/utils/observable.ts +0 -54
  180. package/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.ts +0 -29
  181. package/src/_internal/platform/inlineEdits/common/utils/utils.ts +0 -56
  182. package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.ts +0 -60
  183. package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.ts +0 -353
  184. package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.ts +0 -176
  185. package/src/_internal/platform/languageContextProvider/common/languageContextProviderService.ts +0 -25
  186. package/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.ts +0 -38
  187. package/src/_internal/platform/languageServer/common/languageContextService.ts +0 -186
  188. package/src/_internal/platform/languages/common/languageDiagnosticsService.ts +0 -67
  189. package/src/_internal/platform/languages/common/testLanguageDiagnosticsService.ts +0 -28
  190. package/src/_internal/platform/log/common/logService.ts +0 -232
  191. package/src/_internal/platform/nesFetch/common/completionsAPI.ts +0 -78
  192. package/src/_internal/platform/nesFetch/common/completionsFetchService.ts +0 -118
  193. package/src/_internal/platform/nesFetch/common/responseStream.ts +0 -151
  194. package/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.ts +0 -236
  195. package/src/_internal/platform/nesFetch/node/streamTransformer.ts +0 -95
  196. package/src/_internal/platform/networking/common/fetch.ts +0 -349
  197. package/src/_internal/platform/networking/common/fetcherService.ts +0 -84
  198. package/src/_internal/platform/networking/common/networking.ts +0 -442
  199. package/src/_internal/platform/networking/common/openai.ts +0 -273
  200. package/src/_internal/platform/networking/node/chatStream.ts +0 -137
  201. package/src/_internal/platform/networking/node/stream.ts +0 -749
  202. package/src/_internal/platform/notebook/common/alternativeContent.ts +0 -89
  203. package/src/_internal/platform/notebook/common/alternativeContentFormat.ts +0 -10
  204. package/src/_internal/platform/notebook/common/alternativeContentProvider.json.ts +0 -262
  205. package/src/_internal/platform/notebook/common/alternativeContentProvider.text.ts +0 -243
  206. package/src/_internal/platform/notebook/common/alternativeContentProvider.ts +0 -41
  207. package/src/_internal/platform/notebook/common/alternativeContentProvider.xml.ts +0 -205
  208. package/src/_internal/platform/notebook/common/alternativeNotebookDocument.ts +0 -155
  209. package/src/_internal/platform/notebook/common/helpers.ts +0 -212
  210. package/src/_internal/platform/notebook/common/notebookService.ts +0 -43
  211. package/src/_internal/platform/openai/node/fetch.ts +0 -596
  212. package/src/_internal/platform/parser/node/nodes.ts +0 -190
  213. package/src/_internal/platform/requestLogger/node/nullRequestLogger.ts +0 -26
  214. package/src/_internal/platform/requestLogger/node/requestLogger.ts +0 -383
  215. package/src/_internal/platform/simulationTestContext/common/simulationTestContext.ts +0 -29
  216. package/src/_internal/platform/snippy/common/snippyService.ts +0 -25
  217. package/src/_internal/platform/telemetry/common/nullExperimentationService.ts +0 -64
  218. package/src/_internal/platform/telemetry/common/nullTelemetryService.ts +0 -53
  219. package/src/_internal/platform/telemetry/common/telemetry.ts +0 -215
  220. package/src/_internal/platform/telemetry/common/telemetryData.ts +0 -205
  221. package/src/_internal/platform/thinking/common/thinking.ts +0 -61
  222. package/src/_internal/platform/thinking/common/thinkingUtils.ts +0 -57
  223. package/src/_internal/platform/tokenizer/node/parseTikTokens.ts +0 -23
  224. package/src/_internal/platform/tokenizer/node/tikTokenizerImpl.ts +0 -74
  225. package/src/_internal/platform/tokenizer/node/tikTokenizerWorker.ts +0 -24
  226. package/src/_internal/platform/tokenizer/node/tokenizer.ts +0 -357
  227. package/src/_internal/platform/workspace/common/workspaceService.ts +0 -226
  228. package/src/_internal/platform/workspaceRecorder/common/workspaceLog.ts +0 -118
  229. package/src/_internal/util/common/anomalyDetection.ts +0 -112
  230. package/src/_internal/util/common/arrays.ts +0 -81
  231. package/src/_internal/util/common/async.ts +0 -155
  232. package/src/_internal/util/common/cache.ts +0 -183
  233. package/src/_internal/util/common/crypto.ts +0 -41
  234. package/src/_internal/util/common/errors.ts +0 -22
  235. package/src/_internal/util/common/globals.d.ts +0 -12
  236. package/src/_internal/util/common/imageUtils.ts +0 -154
  237. package/src/_internal/util/common/languages.ts +0 -940
  238. package/src/_internal/util/common/notebooks.ts +0 -286
  239. package/src/_internal/util/common/result.ts +0 -71
  240. package/src/_internal/util/common/services.ts +0 -43
  241. package/src/_internal/util/common/test/shims/chatTypes.ts +0 -448
  242. package/src/_internal/util/common/test/shims/editing.ts +0 -233
  243. package/src/_internal/util/common/test/shims/enums.ts +0 -61
  244. package/src/_internal/util/common/test/shims/l10n.ts +0 -37
  245. package/src/_internal/util/common/test/shims/newSymbolName.ts +0 -23
  246. package/src/_internal/util/common/test/shims/terminal.ts +0 -33
  247. package/src/_internal/util/common/test/shims/vscodeTypesShim.ts +0 -115
  248. package/src/_internal/util/common/time.ts +0 -31
  249. package/src/_internal/util/common/tokenizer.ts +0 -30
  250. package/src/_internal/util/common/tracing.ts +0 -52
  251. package/src/_internal/util/common/types.ts +0 -33
  252. package/src/_internal/util/common/variableLengthQuantity.ts +0 -40
  253. package/src/_internal/util/node/worker.ts +0 -130
  254. package/src/_internal/util/vs/base/common/arrays.ts +0 -926
  255. package/src/_internal/util/vs/base/common/arraysFind.ts +0 -206
  256. package/src/_internal/util/vs/base/common/assert.ts +0 -89
  257. package/src/_internal/util/vs/base/common/async.ts +0 -2582
  258. package/src/_internal/util/vs/base/common/buffer.ts +0 -501
  259. package/src/_internal/util/vs/base/common/cache.ts +0 -122
  260. package/src/_internal/util/vs/base/common/cancellation.ts +0 -150
  261. package/src/_internal/util/vs/base/common/charCode.ts +0 -452
  262. package/src/_internal/util/vs/base/common/codicons.ts +0 -66
  263. package/src/_internal/util/vs/base/common/codiconsLibrary.ts +0 -618
  264. package/src/_internal/util/vs/base/common/codiconsUtil.ts +0 -30
  265. package/src/_internal/util/vs/base/common/collections.ts +0 -156
  266. package/src/_internal/util/vs/base/common/diff/diff.ts +0 -1317
  267. package/src/_internal/util/vs/base/common/diff/diffChange.ts +0 -62
  268. package/src/_internal/util/vs/base/common/equals.ts +0 -148
  269. package/src/_internal/util/vs/base/common/errors.ts +0 -342
  270. package/src/_internal/util/vs/base/common/event.ts +0 -1782
  271. package/src/_internal/util/vs/base/common/extpath.ts +0 -425
  272. package/src/_internal/util/vs/base/common/filters.ts +0 -928
  273. package/src/_internal/util/vs/base/common/functional.ts +0 -34
  274. package/src/_internal/util/vs/base/common/glob.ts +0 -839
  275. package/src/_internal/util/vs/base/common/hash.ts +0 -326
  276. package/src/_internal/util/vs/base/common/htmlContent.ts +0 -212
  277. package/src/_internal/util/vs/base/common/iconLabels.ts +0 -118
  278. package/src/_internal/util/vs/base/common/iterator.ts +0 -196
  279. package/src/_internal/util/vs/base/common/lazy.ts +0 -59
  280. package/src/_internal/util/vs/base/common/lifecycle.ts +0 -845
  281. package/src/_internal/util/vs/base/common/linkedList.ts +0 -144
  282. package/src/_internal/util/vs/base/common/map.ts +0 -954
  283. package/src/_internal/util/vs/base/common/marshallingIds.ts +0 -35
  284. package/src/_internal/util/vs/base/common/mime.ts +0 -136
  285. package/src/_internal/util/vs/base/common/naturalLanguage/korean.ts +0 -425
  286. package/src/_internal/util/vs/base/common/network.ts +0 -429
  287. package/src/_internal/util/vs/base/common/numbers.ts +0 -166
  288. package/src/_internal/util/vs/base/common/objects.ts +0 -242
  289. package/src/_internal/util/vs/base/common/observable.ts +0 -10
  290. package/src/_internal/util/vs/base/common/observableInternal/base.ts +0 -208
  291. package/src/_internal/util/vs/base/common/observableInternal/changeTracker.ts +0 -96
  292. package/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.ts +0 -9
  293. package/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.ts +0 -12
  294. package/src/_internal/util/vs/base/common/observableInternal/debugLocation.ts +0 -88
  295. package/src/_internal/util/vs/base/common/observableInternal/debugName.ts +0 -150
  296. package/src/_internal/util/vs/base/common/observableInternal/experimental/utils.ts +0 -62
  297. package/src/_internal/util/vs/base/common/observableInternal/index.ts +0 -61
  298. package/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.ts +0 -388
  299. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerApi.d.ts +0 -154
  300. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.ts +0 -80
  301. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.ts +0 -485
  302. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.ts +0 -103
  303. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.ts +0 -69
  304. package/src/_internal/util/vs/base/common/observableInternal/logging/logging.ts +0 -133
  305. package/src/_internal/util/vs/base/common/observableInternal/map.ts +0 -81
  306. package/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.ts +0 -172
  307. package/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.ts +0 -44
  308. package/src/_internal/util/vs/base/common/observableInternal/observables/derived.ts +0 -190
  309. package/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.ts +0 -445
  310. package/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.ts +0 -154
  311. package/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.ts +0 -174
  312. package/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.ts +0 -67
  313. package/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.ts +0 -62
  314. package/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.ts +0 -131
  315. package/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.ts +0 -37
  316. package/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.ts +0 -188
  317. package/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.ts +0 -256
  318. package/src/_internal/util/vs/base/common/observableInternal/set.ts +0 -78
  319. package/src/_internal/util/vs/base/common/observableInternal/transaction.ts +0 -115
  320. package/src/_internal/util/vs/base/common/observableInternal/utils/promise.ts +0 -129
  321. package/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.ts +0 -65
  322. package/src/_internal/util/vs/base/common/observableInternal/utils/utils.ts +0 -281
  323. package/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.ts +0 -101
  324. package/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.ts +0 -31
  325. package/src/_internal/util/vs/base/common/path.ts +0 -1591
  326. package/src/_internal/util/vs/base/common/platform.ts +0 -282
  327. package/src/_internal/util/vs/base/common/process.ts +0 -78
  328. package/src/_internal/util/vs/base/common/resources.ts +0 -446
  329. package/src/_internal/util/vs/base/common/sequence.ts +0 -36
  330. package/src/_internal/util/vs/base/common/sseParser.ts +0 -247
  331. package/src/_internal/util/vs/base/common/stopwatch.ts +0 -43
  332. package/src/_internal/util/vs/base/common/stream.ts +0 -792
  333. package/src/_internal/util/vs/base/common/strings.ts +0 -1364
  334. package/src/_internal/util/vs/base/common/symbols.ts +0 -11
  335. package/src/_internal/util/vs/base/common/themables.ts +0 -106
  336. package/src/_internal/util/vs/base/common/types.ts +0 -345
  337. package/src/_internal/util/vs/base/common/uint.ts +0 -61
  338. package/src/_internal/util/vs/base/common/uri.ts +0 -752
  339. package/src/_internal/util/vs/base/common/uuid.ts +0 -72
  340. package/src/_internal/util/vs/base-common.d.ts +0 -42
  341. package/src/_internal/util/vs/editor/common/core/editOperation.ts +0 -62
  342. package/src/_internal/util/vs/editor/common/core/edits/edit.ts +0 -399
  343. package/src/_internal/util/vs/editor/common/core/edits/lineEdit.ts +0 -414
  344. package/src/_internal/util/vs/editor/common/core/edits/stringEdit.ts +0 -568
  345. package/src/_internal/util/vs/editor/common/core/edits/textEdit.ts +0 -411
  346. package/src/_internal/util/vs/editor/common/core/position.ts +0 -186
  347. package/src/_internal/util/vs/editor/common/core/range.ts +0 -519
  348. package/src/_internal/util/vs/editor/common/core/ranges/lineRange.ts +0 -416
  349. package/src/_internal/util/vs/editor/common/core/ranges/offsetRange.ts +0 -275
  350. package/src/_internal/util/vs/editor/common/core/text/abstractText.ts +0 -127
  351. package/src/_internal/util/vs/editor/common/core/text/positionToOffset.ts +0 -26
  352. package/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.ts +0 -144
  353. package/src/_internal/util/vs/editor/common/core/text/textLength.ts +0 -150
  354. package/src/_internal/util/vs/editor/common/core/wordHelper.ts +0 -177
  355. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.ts +0 -210
  356. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.ts +0 -109
  357. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.ts +0 -178
  358. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts +0 -331
  359. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.ts +0 -273
  360. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.ts +0 -475
  361. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.ts +0 -47
  362. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.ts +0 -248
  363. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.ts +0 -76
  364. package/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.ts +0 -693
  365. package/src/_internal/util/vs/editor/common/diff/linesDiffComputer.ts +0 -61
  366. package/src/_internal/util/vs/editor/common/diff/rangeMapping.ts +0 -418
  367. package/src/_internal/util/vs/editor/common/model/prefixSumComputer.ts +0 -304
  368. package/src/_internal/util/vs/nls.messages.ts +0 -21
  369. package/src/_internal/util/vs/nls.ts +0 -243
  370. package/src/_internal/util/vs/platform/instantiation/common/descriptors.ts +0 -23
  371. package/src/_internal/util/vs/platform/instantiation/common/graph.ts +0 -113
  372. package/src/_internal/util/vs/platform/instantiation/common/instantiation.ts +0 -127
  373. package/src/_internal/util/vs/platform/instantiation/common/instantiationService.ts +0 -483
  374. package/src/_internal/util/vs/platform/instantiation/common/serviceCollection.ts +0 -34
  375. package/src/_internal/util/vs/vscode-globals-nls.d.ts +0 -42
  376. package/src/_internal/util/vs/vscode-globals-product.d.ts +0 -35
  377. package/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.ts +0 -109
  378. package/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.ts +0 -34
  379. package/src/_internal/util/vs/workbench/api/common/extHostTypes/location.ts +0 -51
  380. package/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.ts +0 -83
  381. package/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.ts +0 -296
  382. package/src/_internal/util/vs/workbench/api/common/extHostTypes/position.ts +0 -195
  383. package/src/_internal/util/vs/workbench/api/common/extHostTypes/range.ts +0 -167
  384. package/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.ts +0 -94
  385. package/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.ts +0 -103
  386. package/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.ts +0 -44
  387. package/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.ts +0 -89
  388. package/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.ts +0 -99
  389. package/src/_internal/vscodeTypes.ts +0 -100
  390. package/src/main.ts +0 -207
  391. package/src/package.json +0 -4063
@@ -1,983 +0,0 @@
1
- /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Microsoft Corporation. All rights reserved.
3
- * Licensed under the MIT License. See License.txt in the project root for license information.
4
- *--------------------------------------------------------------------------------------------*/
5
-
6
- import { ChatFetchResponseType } from '../../../platform/chat/common/commonTypes';
7
- import { StringTextDocument } from '../../../platform/editing/common/abstractText';
8
- import { IGitExtensionService } from '../../../platform/git/common/gitExtensionService';
9
- import { DebugRecorderBookmark } from '../../../platform/inlineEdits/common/debugRecorderBookmark';
10
- import { IObservableDocument } from '../../../platform/inlineEdits/common/observableWorkspace';
11
- import { IStatelessNextEditTelemetry, StatelessNextEditRequest } from '../../../platform/inlineEdits/common/statelessNextEditProvider';
12
- import { autorunWithChanges } from '../../../platform/inlineEdits/common/utils/observable';
13
- import { APIUsage } from '../../../platform/networking/common/openai';
14
- import { INotebookService } from '../../../platform/notebook/common/notebookService';
15
- import { ITelemetryService, multiplexProperties, TelemetryEventMeasurements, TelemetryEventProperties } from '../../../platform/telemetry/common/telemetry';
16
- import { IWorkspaceService } from '../../../platform/workspace/common/workspaceService';
17
- import { LogEntry } from '../../../platform/workspaceRecorder/common/workspaceLog';
18
- import { findNotebook } from '../../../util/common/notebooks';
19
- import { Disposable, IDisposable } from '../../../util/vs/base/common/lifecycle';
20
- import { Schemas } from '../../../util/vs/base/common/network';
21
- import { StringEdit, StringReplacement } from '../../../util/vs/editor/common/core/edits/stringEdit';
22
- import { OffsetRange } from '../../../util/vs/editor/common/core/ranges/offsetRange';
23
- import { StringText } from '../../../util/vs/editor/common/core/text/abstractText';
24
- import { Uri } from '../../../util/common/test/shims/vscodeTypesShim';
25
- import { ProjectedDocument } from '../../prompts/node/inline/summarizedDocument/implementation';
26
- import { ProjectedText } from '../../prompts/node/inline/summarizedDocument/projectedText';
27
- import { DebugRecorder } from './debugRecorder';
28
- import { INesConfigs } from './nesConfigs';
29
- import { INextEditDisplayLocation, INextEditResult } from './nextEditResult';
30
-
31
- export type NextEditTelemetryStatus = 'new' | 'requested' | `noEdit:${string}` | 'docChanged' | 'emptyEdits' | 'previouslyRejected' | 'previouslyRejectedCache' | 'accepted' | 'notAccepted' | 'rejected';
32
-
33
- export type NesAcceptance = 'accepted' | 'notAccepted' | 'rejected';
34
-
35
- export interface IAlternativeAction {
36
- readonly text: string | undefined; // undefined if the text is too long
37
- readonly textLength: number;
38
- readonly selection: ITelemetryRange[];
39
- readonly edits: ITelemetryEdit[];
40
- readonly summarizedText: string | undefined;
41
- readonly summarizedTextLength: number | undefined;
42
- readonly summarizedEdits: ITelemetryEdit[] | undefined;
43
- readonly tags: string[];
44
- readonly recording: ITelemetryRecording | undefined;
45
- }
46
-
47
- export interface ITelemetryEdit {
48
- readonly time: string;
49
- readonly start: number;
50
- readonly endExclusive: number;
51
- readonly newText: string;
52
- }
53
-
54
- export interface ITelemetryRange {
55
- readonly start: number;
56
- readonly endExclusive: number;
57
- }
58
-
59
- export interface ITelemetryRecording {
60
- readonly entries: LogEntry[] | undefined;
61
- readonly entriesSize: number;
62
- readonly requestTime: number;
63
- }
64
-
65
- export interface ILlmNESTelemetry extends Partial<IStatelessNextEditTelemetry> { // it's partial because the next edit can be pulled from cache resulting in no stateless provider telemetry
66
- readonly providerId: string;
67
- readonly headerRequestId: string;
68
- readonly nextEditProviderDuration: number;
69
- readonly fetchStartedAfterMs: number | undefined;
70
- readonly isFromCache: boolean;
71
- readonly subsequentEditOrder: number | undefined;
72
- readonly activeDocumentOriginalLineCount: number | undefined;
73
- readonly activeDocumentEditsCount: number | undefined;
74
- readonly activeDocumentLanguageId: string | undefined;
75
- readonly activeDocumentRepository: string | undefined;
76
- readonly hasNextEdit: boolean;
77
- readonly wasPreviouslyRejected: boolean;
78
- readonly status: NextEditTelemetryStatus;
79
- readonly nesConfigs: INesConfigs | undefined;
80
- readonly repositoryUrls: string[] | undefined;
81
- readonly documentsCount: number | undefined;
82
- readonly editsCount: number | undefined;
83
- readonly isNotebook: boolean;
84
- readonly notebookType: string | undefined;
85
- readonly alternativeAction: IAlternativeAction | undefined;
86
- }
87
-
88
- export interface IDiagnosticsTelemetry {
89
- readonly diagnosticType: string | undefined;
90
- readonly diagnosticDroppedReasons: string | undefined;
91
- readonly diagnosticDistanceToUnknownDiagnostic: number | undefined;
92
- readonly diagnosticDistanceToAlternativeDiagnostic: number | undefined;
93
- readonly diagnosticHasAlternativeDiagnosticForSameRange: boolean | undefined;
94
-
95
- // imports
96
- readonly diagnosticHasExistingSameFileImport: boolean | undefined;
97
- readonly diagnosticIsLocalImport: boolean | undefined;
98
- readonly diagnosticAlternativeImportsCount: number | undefined;
99
- }
100
-
101
- export interface INextEditProviderTelemetry extends ILlmNESTelemetry, IDiagnosticsTelemetry {
102
- readonly opportunityId: string;
103
- readonly requestN: number;
104
- readonly isShown: boolean;
105
- readonly acceptance: NesAcceptance;
106
- readonly disposalReason: string | undefined;
107
- readonly supersededByOpportunityId: string | undefined;
108
- readonly status: NextEditTelemetryStatus;
109
- readonly activeDocumentRepository: string | undefined;
110
- readonly repositoryUrls: string[] | undefined;
111
- readonly alternativeAction: IAlternativeAction | undefined;
112
- readonly postProcessingOutcome: string | undefined;
113
- readonly isNESForAnotherDoc: boolean;
114
- readonly notebookCellMarkerCount: number;
115
- readonly notebookCellMarkerIndex: number;
116
- readonly notebookId: string | undefined;
117
- readonly notebookCellLines: string | undefined;
118
- readonly isActiveDocument?: boolean;
119
- readonly isMultilineEdit?: boolean;
120
- readonly isEolDifferent?: boolean;
121
- readonly isNextEditorVisible?: boolean;
122
- readonly isNextEditorRangeVisible?: boolean;
123
- readonly isNaturalLanguageDominated: boolean;
124
-
125
- readonly hadLlmNES: boolean;
126
- readonly hadDiagnosticsNES: boolean;
127
- readonly pickedNES: 'llm' | 'diagnostics' | undefined;
128
- readonly configIsDiagnosticsNESEnabled: boolean;
129
- }
130
-
131
- export class LlmNESTelemetryBuilder extends Disposable {
132
-
133
- public build(includeAlternativeAction: boolean): ILlmNESTelemetry {
134
- let documentsCount: number | undefined = undefined;
135
- let editsCount: number | undefined = undefined;
136
- let activeDocumentEditsCount: number | undefined = undefined;
137
- let activeDocumentLanguageId: string | undefined = undefined;
138
- let activeDocumentOriginalLineCount: number | undefined = undefined;
139
- let isNotebook: boolean = false;
140
- let notebookType: string | undefined = undefined;
141
- let activeDocumentRepository: string | undefined = undefined;
142
- let repositoryUrls: string[] | undefined = undefined;
143
-
144
- if (this._request) {
145
- const activeDoc = this._request.getActiveDocument();
146
- documentsCount = this._request.documents.length;
147
- editsCount = this._request.documents.reduce((acc, doc) => acc + doc.recentEdits.edits.length, 0);
148
- activeDocumentEditsCount = activeDoc.recentEdits.edits.length;
149
- activeDocumentLanguageId = activeDoc.languageId;
150
- activeDocumentOriginalLineCount = activeDoc.documentAfterEditsLines.length;
151
- isNotebook = activeDoc.id.toUri().scheme === Schemas.vscodeNotebookCell || this._notebookService?.hasSupportedNotebooks(activeDoc.id.toUri()) || false;
152
- notebookType = findNotebook(activeDoc.id.toUri(), this._workspaceService.notebookDocuments)?.notebookType;
153
- const git = this._gitExtensionService.getExtensionApi();
154
- if (git) {
155
- const activeDocRepository = git.getRepository(Uri.parse(activeDoc.id.uri));
156
- if (activeDocRepository) {
157
- const remoteName = activeDocRepository.state.HEAD?.upstream?.remote;
158
- const remote = activeDocRepository.state.remotes.find(r => r.name === remoteName);
159
- if (remote?.fetchUrl) {
160
- activeDocumentRepository = remote.pushUrl || remote.fetchUrl;
161
- }
162
- }
163
-
164
- const remoteUrlSet = new Set<string>();
165
- const repositories = [...new Set(this._request.documents.map(doc => git.getRepository(Uri.parse(doc.id.uri))).filter(Boolean))];
166
- for (const repository of repositories) {
167
- const remoteName = repository?.state.HEAD?.upstream?.remote;
168
- const remote = repository?.state.remotes.find(r => r.name === remoteName);
169
- if (remote?.fetchUrl) {
170
- remoteUrlSet.add(remote.fetchUrl);
171
- }
172
- if (remote?.pushUrl) {
173
- remoteUrlSet.add(remote.pushUrl);
174
- }
175
- }
176
- repositoryUrls = [...remoteUrlSet];
177
- }
178
- }
179
-
180
- let alternativeAction: IAlternativeAction | undefined;
181
- if (includeAlternativeAction) {
182
- const tags: string[] = [];
183
- const projDoc: ProjectedDocument<StringTextDocument> | undefined = this._statelessNextEditTelemetry?.summarizedEditWindow;
184
- if (projDoc && projDoc.originalText !== this._originalDoc.value) {
185
- tags.push('original_texts_deviate');
186
- }
187
- const originalText = projDoc ? projDoc.originalText : this._originalDoc.value;
188
- const summarizedText = projDoc?.text;
189
- let summarizedEdits: { time: Date; edit: StringEdit }[] | undefined;
190
- if (projDoc) {
191
- let currentProjText: ProjectedText = projDoc;
192
- const projEdits: { time: Date; edit: StringEdit }[] = summarizedEdits = [];
193
- for (const { time, edit } of this._edits) {
194
- const rebased = currentProjText.tryRebase(edit);
195
- if (!rebased) {
196
- tags.push('user_edit_conflict_with_summarization');
197
- break;
198
- }
199
- currentProjText = rebased.text;
200
- projEdits.push({
201
- time,
202
- edit: rebased.edit,
203
- });
204
- }
205
- }
206
- let recording: ITelemetryRecording | undefined;
207
- if (this._debugRecorder && this._requestBookmark) {
208
- const entries = this._debugRecorder.getRecentLog();
209
- const entriesSize = JSON.stringify(entries)?.length || 0;
210
- recording = {
211
- entries: entriesSize > 200 * 1024 ? undefined : entries,
212
- entriesSize: entriesSize,
213
- requestTime: this._requestBookmark.timeMs,
214
- };
215
- }
216
- alternativeAction = {
217
- text: originalText.length > 200 * 1024 ? undefined : originalText,
218
- textLength: originalText.length,
219
- selection: this._originalSelection.map(range => ({
220
- start: range.start,
221
- endExclusive: range.endExclusive,
222
- })),
223
- edits: this._edits.map(edit => edit.edit.replacements.map(e => ({
224
- time: edit.time.toISOString(),
225
- start: e.replaceRange.start,
226
- endExclusive: e.replaceRange.endExclusive,
227
- newText: e.newText,
228
- }))).flat(),
229
- summarizedText,
230
- summarizedTextLength: summarizedText?.length,
231
- summarizedEdits: summarizedEdits?.map(edit => edit.edit.replacements.map(e => ({
232
- time: edit.time.toISOString(),
233
- start: e.replaceRange.start,
234
- endExclusive: e.replaceRange.endExclusive,
235
- newText: e.newText,
236
- }))).flat(),
237
- tags,
238
- recording,
239
- };
240
- }
241
-
242
- const fetchStartedAfterMs = this._statelessNextEditTelemetry?.fetchStartedAt === undefined ? undefined : this._statelessNextEditTelemetry.fetchStartedAt - this._startTime;
243
-
244
- return {
245
- providerId: this._providerId,
246
- headerRequestId: this._headerRequestId || '',
247
- nextEditProviderDuration: this._duration || 0,
248
- isFromCache: this._isFromCache,
249
- subsequentEditOrder: this._subsequentEditOrder,
250
- documentsCount,
251
- editsCount,
252
- activeDocumentEditsCount,
253
- activeDocumentLanguageId,
254
- activeDocumentOriginalLineCount,
255
- fetchStartedAfterMs,
256
- hasNextEdit: this._hasNextEdit,
257
- wasPreviouslyRejected: this._wasPreviouslyRejected,
258
- isNotebook: isNotebook,
259
- notebookType,
260
- status: this._status,
261
- alternativeAction,
262
-
263
- ...this._statelessNextEditTelemetry,
264
-
265
- activeDocumentRepository,
266
- repositoryUrls,
267
-
268
- nesConfigs: this._nesConfigs,
269
- };
270
- }
271
-
272
- private _startTime: number;
273
- private _originalDoc: StringText;
274
- private _originalSelection: readonly OffsetRange[];
275
- private _edits: { time: Date; edit: StringEdit }[] = [];
276
-
277
- constructor(
278
- private readonly _gitExtensionService: IGitExtensionService,
279
- private readonly _notebookService: INotebookService | undefined,
280
- private readonly _workspaceService: IWorkspaceService,
281
- private readonly _providerId: string,
282
- private readonly _doc: IObservableDocument,
283
- private readonly _debugRecorder?: DebugRecorder,
284
- private readonly _requestBookmark?: DebugRecorderBookmark,
285
- ) {
286
- super();
287
- this._startTime = Date.now();
288
-
289
- this._originalDoc = this._doc.value.get();
290
- this._originalSelection = this._doc.selection.get();
291
-
292
- this._store.add(autorunWithChanges(this, {
293
- value: this._doc.value,
294
- }, (data) => {
295
- const time = new Date();
296
- data.value.changes.forEach(change => {
297
- this._edits.push({
298
- time,
299
- edit: change,
300
- });
301
- });
302
- }));
303
- }
304
-
305
- private _nesConfigs: INesConfigs | undefined;
306
- public setNESConfigs(nesConfigs: INesConfigs): this {
307
- this._nesConfigs = nesConfigs;
308
- return this;
309
- }
310
-
311
- private _headerRequestId: string | undefined;
312
- public setHeaderRequestId(uuid: string): this {
313
- this._headerRequestId = uuid;
314
- return this;
315
- }
316
-
317
- private _isFromCache: boolean = false;
318
- public setIsFromCache(): this {
319
- this._isFromCache = true;
320
- return this;
321
- }
322
-
323
- private _subsequentEditOrder: number | undefined;
324
- public setSubsequentEditOrder(subsequentEditOrder: number | undefined): this {
325
- this._subsequentEditOrder = subsequentEditOrder;
326
- return this;
327
- }
328
-
329
- private _request: StatelessNextEditRequest | undefined;
330
- public setRequest(request: StatelessNextEditRequest): this {
331
- this._request = request;
332
- return this;
333
- }
334
-
335
- private _statelessNextEditTelemetry: IStatelessNextEditTelemetry | undefined;
336
- public setStatelessNextEditTelemetry(statelessNextEditTelemetry: IStatelessNextEditTelemetry): this {
337
- this._statelessNextEditTelemetry = statelessNextEditTelemetry;
338
- return this;
339
- }
340
-
341
- private _hasNextEdit: boolean = false;
342
- public setHasNextEdit(hasNextEdit: boolean): this {
343
- this._hasNextEdit = hasNextEdit;
344
- return this;
345
- }
346
-
347
- private _wasPreviouslyRejected: boolean = false;
348
- public setWasPreviouslyRejected(): this {
349
- this._wasPreviouslyRejected = true;
350
- return this;
351
- }
352
-
353
- private _duration: number | undefined;
354
- public markEndTime(): this {
355
- this._duration = Date.now() - this._startTime;
356
- return this;
357
- }
358
-
359
- private _status: NextEditTelemetryStatus = 'new';
360
- public setStatus(status: NextEditTelemetryStatus): this {
361
- this._status = status;
362
- return this;
363
- }
364
- }
365
-
366
- interface IDiagnosticTelemetryRun {
367
- alternativeImportsCount?: number;
368
- hasExistingSameFileImport?: boolean;
369
- isLocalImport?: boolean;
370
- distanceToUnknownDiagnostic?: number;
371
- distanceToAlternativeDiagnostic?: number;
372
- hasAlternativeDiagnosticForSameRange?: boolean;
373
- }
374
-
375
- export class DiagnosticsTelemetryBuilder {
376
-
377
- public build(): IDiagnosticsTelemetry {
378
- const diagnosticDroppedReasons = this._droppedReasons.length > 0 ? JSON.stringify(this._droppedReasons) : undefined;
379
- return {
380
- diagnosticType: this._type,
381
- diagnosticDroppedReasons,
382
- diagnosticAlternativeImportsCount: this._diagnosticRunTelemetry?.alternativeImportsCount,
383
- diagnosticHasExistingSameFileImport: this._diagnosticRunTelemetry?.hasExistingSameFileImport,
384
- diagnosticIsLocalImport: this._diagnosticRunTelemetry?.isLocalImport,
385
- diagnosticDistanceToUnknownDiagnostic: this._diagnosticRunTelemetry?.distanceToUnknownDiagnostic,
386
- diagnosticDistanceToAlternativeDiagnostic: this._diagnosticRunTelemetry?.distanceToAlternativeDiagnostic,
387
- diagnosticHasAlternativeDiagnosticForSameRange: this._diagnosticRunTelemetry?.hasAlternativeDiagnosticForSameRange
388
- };
389
- }
390
-
391
- public populate(telemetry: DiagnosticsTelemetryBuilder) {
392
- this._droppedReasons.forEach(reason => telemetry.addDroppedReason(reason));
393
- if (this._type) {
394
- telemetry.setType(this._type);
395
- }
396
- if (this._diagnosticRunTelemetry) {
397
- telemetry.setDiagnosticRunTelemetry(this._diagnosticRunTelemetry);
398
- }
399
- }
400
-
401
- private _type: string | undefined;
402
- setType(type: string): this {
403
- this._type = type;
404
- return this;
405
- }
406
-
407
- private _droppedReasons: string[] = [];
408
- addDroppedReason(reason: string): this {
409
- this._droppedReasons.push(reason);
410
- return this;
411
- }
412
-
413
- private _diagnosticRunTelemetry: IDiagnosticTelemetryRun | undefined;
414
- setDiagnosticRunTelemetry(diagnosticRun: IDiagnosticTelemetryRun): this {
415
- this._diagnosticRunTelemetry = diagnosticRun;
416
- return this;
417
- }
418
- }
419
-
420
- export class NextEditProviderTelemetryBuilder extends Disposable {
421
-
422
- private static requestN = 0;
423
-
424
- /**
425
- * Whether telemetry for this builder has been sent -- only for ordinary telemetry, not enhanced telemetry
426
- */
427
- private _isSent: boolean = false;
428
- public get isSent(): boolean {
429
- return this._isSent;
430
- }
431
- public markAsSent(): void {
432
- this._isSent = true;
433
- }
434
-
435
- public build(includeAlternativeAction: boolean): INextEditProviderTelemetry {
436
-
437
- const nesTelemetry = this._nesBuilder.build(includeAlternativeAction);
438
- const diagnosticsTelemetry = this._diagnosticsBuilder.build();
439
-
440
- return {
441
- ...nesTelemetry,
442
- ...diagnosticsTelemetry,
443
-
444
- opportunityId: this._opportunityId || '',
445
- requestN: this._requestN,
446
- isShown: this._isShown,
447
- acceptance: this._acceptance,
448
- disposalReason: this._disposalReason,
449
- supersededByOpportunityId: this._supersededByOpportunityId,
450
- pickedNES: this._nesTypePicked,
451
- hadLlmNES: this._hadLlmNES,
452
- isMultilineEdit: this._isMultilineEdit,
453
- isEolDifferent: this._isEolDifferent,
454
- isActiveDocument: this._isActiveDocument,
455
- isNextEditorVisible: this._isNextEditorVisible,
456
- isNextEditorRangeVisible: this._isNextEditorRangeVisible,
457
- isNESForAnotherDoc: this._isNESForAnotherDoc,
458
- notebookId: this._notebookId,
459
- notebookCellLines: this._notebookCellLines,
460
- notebookCellMarkerCount: this._notebookCellMarkerCount,
461
- notebookCellMarkerIndex: this._notebookCellMarkerIndex,
462
- hadDiagnosticsNES: this._hadDiagnosticsNES,
463
- configIsDiagnosticsNESEnabled: this._configIsDiagnosticsNESEnabled,
464
- isNaturalLanguageDominated: this._isNaturalLanguageDominated,
465
- postProcessingOutcome: this._postProcessingOutcome,
466
- };
467
- }
468
-
469
- private _requestN: number;
470
-
471
- private readonly _nesBuilder: LlmNESTelemetryBuilder;
472
- public get nesBuilder(): LlmNESTelemetryBuilder {
473
- return this._nesBuilder;
474
- }
475
- private readonly _diagnosticsBuilder: DiagnosticsTelemetryBuilder;
476
- public get diagnosticsBuilder(): DiagnosticsTelemetryBuilder {
477
- return this._diagnosticsBuilder;
478
- }
479
-
480
- constructor(
481
- gitExtensionService: IGitExtensionService,
482
- notebookService: INotebookService,
483
- workspaceService: IWorkspaceService,
484
- providerId: string,
485
- doc: IObservableDocument,
486
- debugRecorder?: DebugRecorder,
487
- requestBookmark?: DebugRecorderBookmark,
488
- ) {
489
- super();
490
- this._requestN = ++NextEditProviderTelemetryBuilder.requestN;
491
-
492
- this._nesBuilder = this._register(new LlmNESTelemetryBuilder(gitExtensionService, notebookService, workspaceService, providerId, doc, debugRecorder, requestBookmark));
493
- this._diagnosticsBuilder = new DiagnosticsTelemetryBuilder();
494
- }
495
-
496
- private _opportunityId: string | undefined;
497
- public setOpportunityId(uuid: string): this {
498
- this._opportunityId = uuid;
499
- return this;
500
- }
501
-
502
- private _isShown: boolean = false;
503
- public setAsShown(): this {
504
- this._isShown = true;
505
- return this;
506
- }
507
-
508
- private _acceptance: NesAcceptance = 'notAccepted';
509
- public setAcceptance(acceptance: NesAcceptance): this {
510
- this._acceptance = acceptance;
511
- return this;
512
- }
513
-
514
- private _disposalReason: string | undefined = undefined;
515
- public setDisposalReason(disposalReason: string | undefined): this {
516
- this._disposalReason = disposalReason;
517
- return this;
518
- }
519
-
520
- private _supersededByOpportunityId: string | undefined = undefined;
521
- public setSupersededBy(opportunityId: string | undefined): this {
522
- this._supersededByOpportunityId = opportunityId;
523
- return this;
524
- }
525
-
526
- private _nesTypePicked: 'llm' | 'diagnostics' | undefined;
527
- public setPickedNESType(nesTypePicked: 'llm' | 'diagnostics'): this {
528
- this._nesTypePicked = nesTypePicked;
529
- return this;
530
- }
531
-
532
- private _isActiveDocument?: boolean;
533
- public setIsActiveDocument(isActive: boolean): this {
534
- this._isActiveDocument = isActive;
535
- return this;
536
- }
537
-
538
- private _notebookCellMarkerCount: number = 0;
539
- public setNotebookCellMarkerCount(count: number): this {
540
- this._notebookCellMarkerCount = count;
541
- return this;
542
- }
543
-
544
- private _isMultilineEdit?: boolean;
545
- public setIsMultilineEdit(isMultiLine: boolean): this {
546
- this._isMultilineEdit = isMultiLine;
547
- return this;
548
- }
549
-
550
- private _isEolDifferent?: boolean;
551
- public setIsEolDifferent(isEolDifferent: boolean): this {
552
- this._isEolDifferent = isEolDifferent;
553
- return this;
554
- }
555
-
556
- private _isNextEditorVisible?: boolean;
557
- public setIsNextEditorVisible(isVisible: boolean): this {
558
- this._isNextEditorVisible = isVisible;
559
- return this;
560
- }
561
-
562
- private _isNextEditorRangeVisible?: boolean;
563
- public setIsNextEditorRangeVisible(isVisible: boolean): this {
564
- this._isNextEditorRangeVisible = isVisible;
565
- return this;
566
- }
567
-
568
- private _notebookId?: string;
569
- public setNotebookId(notebookId: string): this {
570
- this._notebookId = notebookId;
571
- return this;
572
- }
573
-
574
- private _notebookCellLines?: string;
575
- public setNotebookCellLines(notebookCellLines: string): this {
576
- this._notebookCellLines = notebookCellLines;
577
- return this;
578
- }
579
-
580
- private _notebookCellMarkerIndex: number = -1;
581
- public setNotebookCellMarkerIndex(index: number): this {
582
- this._notebookCellMarkerIndex = index;
583
- return this;
584
- }
585
-
586
- private _isNESForAnotherDoc: boolean = false;
587
- public setIsNESForOtherEditor(isForAnotherDoc: boolean): this {
588
- this._isNESForAnotherDoc = isForAnotherDoc;
589
- return this;
590
- }
591
-
592
- private _hadLlmNES: boolean = false;
593
- public setHadLlmNES(boolean: boolean): this {
594
- this._hadLlmNES = boolean;
595
- return this;
596
- }
597
-
598
- private _hadDiagnosticsNES: boolean = false;
599
- public setHadDiagnosticsNES(boolean: boolean): this {
600
- this._hadDiagnosticsNES = boolean;
601
- return this;
602
- }
603
-
604
- public setStatus(status: NextEditTelemetryStatus): this {
605
- this._nesBuilder.setStatus(status);
606
- return this;
607
- }
608
-
609
- private _configIsDiagnosticsNESEnabled: boolean = false;
610
- public setConfigIsDiagnosticsNESEnabled(boolean: boolean): this {
611
- this._configIsDiagnosticsNESEnabled = boolean;
612
- return this;
613
- }
614
-
615
- private _isNaturalLanguageDominated: boolean = false;
616
- public setIsNaturalLanguageDominated(isNaturalLanguageDominated: boolean): this {
617
- this._isNaturalLanguageDominated = isNaturalLanguageDominated;
618
- return this;
619
- }
620
-
621
- private _postProcessingOutcome: string | undefined;
622
- public setPostProcessingOutcome(suggestion: {
623
- edit: StringReplacement;
624
- isInlineCompletion: boolean;
625
- displayLocation?: INextEditDisplayLocation;
626
- }): this {
627
- const displayLocation = suggestion.displayLocation ? {
628
- label: suggestion.displayLocation.label,
629
- range: suggestion.displayLocation.range.toString()
630
- } : undefined;
631
-
632
- this._postProcessingOutcome = JSON.stringify({
633
- suggestedEdit: suggestion.edit.toString(),
634
- isInlineCompletion: suggestion.isInlineCompletion,
635
- displayLocation
636
- });
637
-
638
- return this;
639
- }
640
- }
641
-
642
- export class TelemetrySender implements IDisposable {
643
-
644
- private readonly _map = new Map<INextEditResult, { builder: NextEditProviderTelemetryBuilder; timeout: TimeoutHandle }>();
645
-
646
- constructor(
647
- @ITelemetryService private readonly _telemetryService: ITelemetryService,
648
- ) {
649
- }
650
-
651
- /**
652
- * Schedule sending telemetry for the next edit result in case it gets ignored by user (ie is not accepted or rejected, so gets replaced by another edit)
653
- */
654
- public scheduleSendingEnhancedTelemetry(nextEditResult: INextEditResult, builder: NextEditProviderTelemetryBuilder): void {
655
- const timeout = setTimeout(() => {
656
- let telemetry: INextEditProviderTelemetry;
657
- this._map.delete(nextEditResult);
658
- try {
659
- telemetry = builder.build(true);
660
- } finally {
661
- builder.dispose();
662
- }
663
- this._doSendEnhancedTelemetry(telemetry);
664
- }, /* 2 minutes */ 2 * 60 * 1000);
665
- this._map.set(nextEditResult, { builder, timeout });
666
- }
667
-
668
- /**
669
- * Send telemetry for the next edit result in case it has already been rejected or contains no edits to be shown.
670
- */
671
- public sendTelemetry(nextEditResult: INextEditResult | undefined, builder: NextEditProviderTelemetryBuilder): void {
672
- if (nextEditResult) {
673
- const data = this._map.get(nextEditResult);
674
- if (data) {
675
- clearTimeout(data.timeout);
676
- this._map.delete(nextEditResult);
677
- }
678
- }
679
- const telemetry = builder.build(true);
680
- if (!builder.isSent) {
681
- this._doSendTelemetry(telemetry);
682
- builder.markAsSent();
683
- }
684
- this._doSendEnhancedTelemetry(telemetry);
685
- }
686
-
687
- public sendTelemetryForBuilder(builder: NextEditProviderTelemetryBuilder): void {
688
- if (builder.isSent) {
689
- return;
690
- }
691
- const telemetry = builder.build(false); // disposal is done by enhanced telemetry sending in a setTimeout callback
692
- this._doSendTelemetry(telemetry);
693
- builder.markAsSent();
694
- }
695
-
696
- private async _doSendTelemetry(telemetry: INextEditProviderTelemetry): Promise<void> {
697
- const {
698
- opportunityId,
699
- headerRequestId,
700
- requestN,
701
- providerId,
702
- modelName,
703
- hadStatelessNextEditProviderCall,
704
- statelessNextEditProviderDuration,
705
- nextEditProviderDuration,
706
- isFromCache,
707
- subsequentEditOrder,
708
- activeDocumentLanguageId,
709
- activeDocumentOriginalLineCount,
710
- nLinesOfCurrentFileInPrompt,
711
- wasPreviouslyRejected,
712
- isShown,
713
- isNotebook,
714
- notebookType,
715
- isNESForAnotherDoc,
716
- isActiveDocument,
717
- isEolDifferent,
718
- isMultilineEdit,
719
- isNextEditorRangeVisible,
720
- isNextEditorVisible,
721
- acceptance,
722
- disposalReason,
723
- logProbThreshold,
724
- documentsCount,
725
- editsCount,
726
- activeDocumentEditsCount,
727
- promptLineCount,
728
- promptCharCount,
729
- hadLowLogProbSuggestion,
730
- nEditsSuggested,
731
- lineDistanceToMostRecentEdit,
732
- isCursorAtEndOfLine,
733
- debounceTime,
734
- artificialDelay,
735
- hasNextEdit,
736
- notebookCellMarkerCount,
737
- notebookCellMarkerIndex,
738
- notebookId,
739
- notebookCellLines,
740
- nextEditLogprob,
741
- supersededByOpportunityId,
742
- noNextEditReasonKind,
743
- noNextEditReasonMessage,
744
- fetchStartedAfterMs,
745
- response: responseWithStats,
746
- configIsDiagnosticsNESEnabled,
747
- isNaturalLanguageDominated,
748
- diagnosticType,
749
- diagnosticDroppedReasons,
750
- diagnosticHasExistingSameFileImport,
751
- diagnosticIsLocalImport,
752
- diagnosticAlternativeImportsCount,
753
- diagnosticDistanceToUnknownDiagnostic,
754
- diagnosticDistanceToAlternativeDiagnostic,
755
- diagnosticHasAlternativeDiagnosticForSameRange,
756
- hadDiagnosticsNES,
757
- hadLlmNES,
758
- pickedNES,
759
- } = telemetry;
760
-
761
- let usage: APIUsage | undefined;
762
- let ttft_: number | undefined;
763
- let fetchResult_: ChatFetchResponseType | undefined;
764
- let fetchTime_: number | undefined;
765
- if (responseWithStats !== undefined) {
766
- const { response, ttft, fetchResult, fetchTime } = await responseWithStats;
767
- if (response.type === ChatFetchResponseType.Success) {
768
- usage = response.usage;
769
- }
770
- ttft_ = ttft;
771
- fetchResult_ = fetchResult;
772
- fetchTime_ = fetchTime;
773
- }
774
-
775
- /* __GDPR__
776
- "provideInlineEdit" : {
777
- "owner": "ulugbekna",
778
- "comment": "Telemetry for inline edit (NES) provided",
779
- "opportunityId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Unique identifier for an opportunity to show an NES." },
780
- "headerRequestId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Unique identifier of the network request which is also included in the fetch request header." },
781
- "providerId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "NES provider identifier (StatelessNextEditProvider)" },
782
- "modelName": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Name of the model used to provide the NES" },
783
- "activeDocumentLanguageId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "LanguageId of the active document" },
784
- "acceptance": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "User acceptance of the edit" },
785
- "disposalReason": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Reason for disposal of NES" },
786
- "supersededByOpportunityId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "UUID of the opportunity that superseded this edit" },
787
- "endpoint": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Endpoint for the request" },
788
- "noNextEditReasonKind": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Reason kind for no next edit" },
789
- "noNextEditReasonMessage": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Reason message for no next edit" },
790
- "fetchResult": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Fetch result" },
791
- "fetchError": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Fetch error message" },
792
- "pickedNES": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request had picked NES" },
793
- "diagnosticType": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Type of diagnostics" },
794
- "diagnosticDroppedReasons": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Reasons for dropping diagnostics NES suggestions" },
795
- "requestN": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Request number", "isMeasurement": true },
796
- "hadStatelessNextEditProviderCall": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request had a stateless next edit provider call", "isMeasurement": true },
797
- "statelessNextEditProviderDuration": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Duration of stateless next edit provider", "isMeasurement": true },
798
- "nextEditProviderDuration": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Duration of next edit provider", "isMeasurement": true },
799
- "isFromCache": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the edit was provided from cache", "isMeasurement": true },
800
- "subsequentEditOrder": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Order of the subsequent edit", "isMeasurement": true },
801
- "activeDocumentOriginalLineCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of lines in the active document before shortening", "isMeasurement": true },
802
- "activeDocumentNLinesInPrompt": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of lines in the active document included in prompt", "isMeasurement": true },
803
- "wasPreviouslyRejected": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the edit was previously rejected", "isMeasurement": true },
804
- "isShown": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the edit was shown", "isMeasurement": true },
805
- "isNotebook": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the document is a notebook", "isMeasurement": true },
806
- "isNESForAnotherDoc": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the NES if for another document", "isMeasurement": true },
807
- "isMultilineEdit": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the NES is for a multiline edit", "isMeasurement": true },
808
- "isEolDifferent": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the NES edit and original text have different end of lines", "isMeasurement": true },
809
- "isNextEditorVisible": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the next editor is visible", "isMeasurement": true },
810
- "isNextEditorRangeVisible": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the next editor range is visible", "isMeasurement": true },
811
- "notebookCellMarkerIndex": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Index of the notebook cell marker in the edit", "isMeasurement": true },
812
- "isActiveDocument": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the document is the active document", "isMeasurement": true },
813
- "hasNotebookCellMarker": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the edit has a notebook cell marker", "isMeasurement": true },
814
- "notebookCellMarkerCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Count of notebook cell markers in the edit", "isMeasurement": true },
815
- "notebookId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Id of notebook" },
816
- "notebookCellLines": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Line counts of notebook cells" },
817
- "notebookType": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Type of notebook, if any" },
818
- "logProbThreshold": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Log probability threshold for the edit", "isMeasurement": true },
819
- "documentsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of documents", "isMeasurement": true },
820
- "editsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of edits", "isMeasurement": true },
821
- "activeDocumentEditsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of edits in the active document", "isMeasurement": true },
822
- "promptLineCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of lines in the prompt", "isMeasurement": true },
823
- "promptCharCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of characters in the prompt", "isMeasurement": true },
824
- "hadLowLogProbSuggestion": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the suggestion had low log probability", "isMeasurement": true },
825
- "nEditsSuggested": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of edits suggested", "isMeasurement": true },
826
- "hasNextEdit": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether next edit provider returned an edit (if an edit was previously rejected, this field is false)", "isMeasurement": true },
827
- "nextEditLogprob": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Log probability of the next edit", "isMeasurement": true },
828
- "lineDistanceToMostRecentEdit": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Line distance to most recent edit", "isMeasurement": true },
829
- "isCursorAtEndOfLine": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the cursor is at the end of the line", "isMeasurement": true },
830
- "debounceTime": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Debounce time", "isMeasurement": true },
831
- "artificialDelay": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Artificial delay (aka backoff) on the response based on previous user acceptance/rejection in milliseconds", "isMeasurement": true },
832
- "fetchStartedAfterMs": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Time from inline edit provider invocation to fetch init", "isMeasurement": true },
833
- "ttft": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Time to first token", "isMeasurement": true },
834
- "fetchTime": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Time from fetch init to end of stream", "isMeasurement": true },
835
- "promptTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prompt", "isMeasurement": true },
836
- "responseTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the response", "isMeasurement": true },
837
- "cachedTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of cached tokens in the response", "isMeasurement": true },
838
- "acceptedPredictionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prediction that appeared in the completion", "isMeasurement": true },
839
- "rejectedPredictionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prediction that appeared in the completion", "isMeasurement": true },
840
- "hadDiagnosticsNES": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request had diagnostics NES", "isMeasurement": true },
841
- "hadLlmNES": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request had LLM NES", "isMeasurement": true },
842
- "configIsDiagnosticsNESEnabled": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether diagnostics NES is enabled", "isMeasurement": true },
843
- "isNaturalLanguageDominated": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the context is dominated by natural language", "isMeasurement": true },
844
- "diagnosticHasExistingSameFileImport": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the diagnostic has an existing same file import", "isMeasurement": true },
845
- "diagnosticIsLocalImport": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the diagnostic is a local import", "isMeasurement": true },
846
- "diagnosticAlternativeImportsCount": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of alternative imports for the diagnostic", "isMeasurement": true },
847
- "diagnosticDistanceToUnknownDiagnostic": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Distance to the unknown diagnostic", "isMeasurement": true },
848
- "diagnosticDistanceToAlternativeDiagnostic": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Distance to the alternative diagnostic", "isMeasurement": true },
849
- "diagnosticHasAlternativeDiagnosticForSameRange": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether there is an alternative diagnostic for the same range", "isMeasurement": true }
850
- }
851
- */
852
- this._sendTelemetryToBoth(
853
- {
854
- opportunityId,
855
- headerRequestId,
856
- providerId,
857
- modelName,
858
- activeDocumentLanguageId,
859
- acceptance,
860
- disposalReason,
861
- supersededByOpportunityId,
862
- noNextEditReasonKind,
863
- noNextEditReasonMessage,
864
- fetchResult: fetchResult_,
865
- diagnosticType,
866
- diagnosticDroppedReasons,
867
- pickedNES,
868
- notebookType,
869
- notebookId,
870
- notebookCellLines
871
- },
872
- {
873
- requestN,
874
- hadStatelessNextEditProviderCall: this._boolToNum(hadStatelessNextEditProviderCall),
875
- statelessNextEditProviderDuration,
876
- nextEditProviderDuration,
877
- isFromCache: this._boolToNum(isFromCache),
878
- subsequentEditOrder,
879
- activeDocumentOriginalLineCount,
880
- activeDocumentNLinesInPrompt: nLinesOfCurrentFileInPrompt,
881
- wasPreviouslyRejected: this._boolToNum(wasPreviouslyRejected),
882
- isShown: this._boolToNum(isShown),
883
- isNotebook: this._boolToNum(isNotebook),
884
- isNESForAnotherDoc: this._boolToNum(isNESForAnotherDoc),
885
- isActiveDocument: this._boolToNum(isActiveDocument),
886
- isEolDifferent: this._boolToNum(isEolDifferent),
887
- isMultilineEdit: this._boolToNum(isMultilineEdit),
888
- isNextEditorRangeVisible: this._boolToNum(isNextEditorRangeVisible),
889
- isNextEditorVisible: this._boolToNum(isNextEditorVisible),
890
- hasNotebookCellMarker: notebookCellMarkerCount > 0 ? 1 : 0,
891
- notebookCellMarkerCount,
892
- notebookCellMarkerIndex,
893
- logProbThreshold,
894
- documentsCount,
895
- editsCount,
896
- activeDocumentEditsCount,
897
- promptLineCount,
898
- promptCharCount,
899
- hadLowLogProbSuggestion: this._boolToNum(hadLowLogProbSuggestion),
900
- nEditsSuggested,
901
- lineDistanceToMostRecentEdit,
902
- isCursorAtEndOfLine: this._boolToNum(isCursorAtEndOfLine),
903
- debounceTime,
904
- artificialDelay,
905
- fetchStartedAfterMs,
906
- ttft: ttft_,
907
- fetchTime: fetchTime_,
908
- promptTokens: usage?.prompt_tokens,
909
- responseTokens: usage?.completion_tokens,
910
- cachedTokens: usage?.prompt_tokens_details?.cached_tokens,
911
- acceptedPredictionTokens: usage?.completion_tokens_details?.accepted_prediction_tokens,
912
- rejectedPredictionTokens: usage?.completion_tokens_details?.rejected_prediction_tokens,
913
- hasNextEdit: this._boolToNum(hasNextEdit),
914
- nextEditLogprob,
915
- hadDiagnosticsNES: this._boolToNum(hadDiagnosticsNES),
916
- hadLlmNES: this._boolToNum(hadLlmNES),
917
- configIsDiagnosticsNESEnabled: this._boolToNum(configIsDiagnosticsNESEnabled),
918
- isNaturalLanguageDominated: this._boolToNum(isNaturalLanguageDominated),
919
- diagnosticHasExistingSameFileImport: this._boolToNum(diagnosticHasExistingSameFileImport),
920
- diagnosticIsLocalImport: this._boolToNum(diagnosticIsLocalImport),
921
- diagnosticAlternativeImportsCount: diagnosticAlternativeImportsCount,
922
- diagnosticDistanceToUnknownDiagnostic: diagnosticDistanceToUnknownDiagnostic,
923
- diagnosticDistanceToAlternativeDiagnostic: diagnosticDistanceToAlternativeDiagnostic,
924
- diagnosticHasAlternativeDiagnosticForSameRange: this._boolToNum(diagnosticHasAlternativeDiagnosticForSameRange)
925
- }
926
- );
927
- }
928
-
929
- private _sendTelemetryToBoth(properties?: TelemetryEventProperties, measurements?: TelemetryEventMeasurements): void {
930
- this._telemetryService.sendMSFTTelemetryEvent('provideInlineEdit', properties, measurements);
931
- this._telemetryService.sendGHTelemetryEvent('copilot-nes/provideInlineEdit', properties, measurements);
932
- }
933
-
934
- private async _doSendEnhancedTelemetry(telemetry: INextEditProviderTelemetry): Promise<void> {
935
-
936
- const {
937
- opportunityId,
938
- headerRequestId,
939
- providerId,
940
- activeDocumentLanguageId,
941
- status: suggestionStatus,
942
- prompt,
943
- response,
944
- alternativeAction,
945
- postProcessingOutcome,
946
- activeDocumentRepository,
947
- repositoryUrls,
948
- } = telemetry;
949
-
950
- const modelResponse = response === undefined ? response : await response;
951
-
952
- this._telemetryService.sendEnhancedGHTelemetryEvent('copilot-nes/provideInlineEdit',
953
- multiplexProperties({
954
- opportunityId,
955
- headerRequestId,
956
- providerId,
957
- activeDocumentLanguageId,
958
- suggestionStatus,
959
- prompt,
960
- modelResponse: modelResponse === undefined || modelResponse.response.type !== ChatFetchResponseType.Success ? undefined : modelResponse.response.value,
961
- alternativeAction: alternativeAction ? JSON.stringify(alternativeAction) : undefined,
962
- postProcessingOutcome,
963
- activeDocumentRepository,
964
- repositories: JSON.stringify(repositoryUrls),
965
- })
966
- );
967
- }
968
-
969
- /**
970
- * If `value` is undefined, return undefined, otherwise return 1 if `value` is true, 0 otherwise.
971
- */
972
- private _boolToNum(value: boolean | undefined): number | undefined {
973
- return value === undefined ? undefined : (value ? 1 : 0);
974
- }
975
-
976
- dispose(): void {
977
- for (const { timeout } of this._map.values()) {
978
- clearTimeout(timeout);
979
- }
980
-
981
- this._map.clear();
982
- }
983
- }