@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,468 +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 { Raw } from '@vscode/prompt-tsx';
7
- import { Result } from '../../../util/common/result';
8
- import { assert, assertNever } from '../../../util/vs/base/common/assert';
9
- import { DeferredPromise } from '../../../util/vs/base/common/async';
10
- import { CancellationToken, CancellationTokenSource } from '../../../util/vs/base/common/cancellation';
11
- import { URI } from '../../../util/vs/base/common/uri';
12
- import { LineEdit, LineReplacement, SerializedLineEdit } from '../../../util/vs/editor/common/core/edits/lineEdit';
13
- import { StringEdit } from '../../../util/vs/editor/common/core/edits/stringEdit';
14
- import { OffsetRange } from '../../../util/vs/editor/common/core/ranges/offsetRange';
15
- import { StringText } from '../../../util/vs/editor/common/core/text/abstractText';
16
- import { ChatFetchResponseType, FetchResponse } from '../../chat/common/commonTypes';
17
- import { ISerializedOffsetRange, LogEntry, serializeOffsetRange } from '../../workspaceRecorder/common/workspaceLog';
18
- import { DocumentId } from './dataTypes/documentId';
19
- import { Edits } from './dataTypes/edit';
20
- import { SerializedEdit } from './dataTypes/editUtils';
21
- import { LanguageId } from './dataTypes/languageId';
22
- import { DebugRecorderBookmark } from './debugRecorderBookmark';
23
- import { InlineEditRequestLogContext } from './inlineEditLogContext';
24
- import { stringifyChatMessages } from './utils/stringifyChatMessages';
25
- import { IXtabHistoryEntry } from './workspaceEditTracker/nesXtabHistoryTracker';
26
-
27
- export const enum ShowNextEditPreference {
28
- Always = 'always',
29
- AroundEdit = 'aroundEdit',
30
- }
31
-
32
- export type PushEdit = (edit: Result<{ edit: LineReplacement; window?: OffsetRange; targetDocument?: DocumentId }, NoNextEditReason>) => void;
33
-
34
- export interface IStatelessNextEditProvider {
35
- readonly ID: string;
36
- readonly dependsOnSelection?: boolean;
37
- readonly showNextEditPreference?: ShowNextEditPreference;
38
- provideNextEdit(request: StatelessNextEditRequest, pushEdit: PushEdit, logContext: InlineEditRequestLogContext, cancellationToken: CancellationToken): Promise<StatelessNextEditResult>;
39
- handleAcceptance?(): void;
40
- handleRejection?(): void;
41
- }
42
-
43
- export class StatelessNextEditRequest<TFirstEdit = any> {
44
-
45
- private static ID = 0;
46
- public readonly seqid = String(++StatelessNextEditRequest.ID);
47
-
48
- public readonly cancellationTokenSource = new CancellationTokenSource();
49
- public liveDependentants = 0; // number of invocations which haven't been canceled and depend on this request
50
- public fetchIssued = false;
51
- public intermediateUserEdit: StringEdit | undefined = StringEdit.empty;
52
-
53
- private readonly _result: DeferredPromise<StatelessNextEditResult> = new DeferredPromise<StatelessNextEditResult>();
54
- public get result(): Promise<StatelessNextEditResult> {
55
- return this._result.p;
56
- }
57
-
58
- constructor(
59
- public readonly id: string,
60
- public readonly opportunityId: string,
61
- public readonly documentBeforeEdits: StringText,
62
- public readonly documents: readonly StatelessNextEditDocument[],
63
- public readonly activeDocumentIdx: number,
64
- public readonly xtabEditHistory: IXtabHistoryEntry[],
65
- public readonly firstEdit: DeferredPromise<Result<TFirstEdit, NoNextEditReason>>,
66
- public readonly expandedEditWindowNLines: number | undefined,
67
- public readonly logContext: InlineEditRequestLogContext,
68
- public readonly recordingBookmark: DebugRecorderBookmark | undefined,
69
- public readonly recording: LogEntry[] | undefined,
70
- public readonly providerRequestStartDateTime: number | undefined,
71
- ) {
72
- assert(documents.length > 0);
73
- assert(activeDocumentIdx >= 0 && activeDocumentIdx < documents.length);
74
- }
75
-
76
- public setResult(nextEditResult: StatelessNextEditResult) {
77
- this._result.complete(nextEditResult);
78
- }
79
-
80
- public setResultError(err: any) {
81
- this._result.error(err);
82
- }
83
-
84
- public hasDocument(docId: DocumentId): boolean {
85
- return this.documents.find(d => d.id === docId) !== undefined;
86
- }
87
-
88
- getActiveDocument(): StatelessNextEditDocument {
89
- return this.documents[this.activeDocumentIdx];
90
- }
91
-
92
- serialize(): ISerializedNextEditRequest {
93
- return {
94
- id: this.id,
95
- documents: this.documents.map(d => d.serialize()),
96
- activeDocumentIdx: this.activeDocumentIdx,
97
- recording: this.recording,
98
- };
99
- }
100
-
101
- toString(): string {
102
- return this.toMarkdown();
103
- }
104
-
105
- toMarkdown(): string {
106
- const docs = this.documents.map((d, idx) => ` * [${idx + 1}/${this.documents.length}] ${idx === this.activeDocumentIdx ? '(active document) ' : ''}` + d.toMarkdown()).join('\n\n');
107
- return `### StatelessNextEditRequest\n\n${docs}`;
108
- }
109
- }
110
-
111
- export interface ISerializedNextEditRequest {
112
- id: string;
113
- documents: ISerializedNextEditDocument[];
114
- activeDocumentIdx: number;
115
- recording: LogEntry[] | undefined;
116
- }
117
-
118
- export class StatelessNextEditDocument {
119
- public readonly documentAfterEdits = new StringText(this.recentEdits.apply(this.documentBeforeEdits.value));
120
- public readonly documentAfterEditsLines: string[] = this.documentAfterEdits.getLines();
121
-
122
- /**
123
- * NOTE: if you add new public fields to this class, please also update {@link ISerializedNextEditDocument} and {@link serialize()} methods,
124
- * which are used to send this to http-server-powered NES provider.
125
- */
126
- constructor(
127
- public readonly id: DocumentId,
128
- public readonly workspaceRoot: URI | undefined,
129
- public readonly languageId: LanguageId,
130
- public readonly documentLinesBeforeEdit: string[],
131
- public readonly recentEdit: LineEdit,
132
- public readonly documentBeforeEdits: StringText,
133
- public readonly recentEdits: Edits,
134
- public readonly lastSelectionInAfterEdit: OffsetRange | undefined = undefined,
135
- ) { }
136
-
137
- serialize(): ISerializedNextEditDocument {
138
- return {
139
- id: this.id.uri,
140
- workspaceRoot: this.workspaceRoot?.toString(),
141
- languageId: this.languageId,
142
- documentLinesBeforeEdit: this.documentLinesBeforeEdit,
143
- recentEdit: this.recentEdit.serialize(),
144
- documentBeforeEdits: this.documentBeforeEdits.value,
145
- recentEdits: this.recentEdits.serialize(),
146
- lastSelectionInAfterEdit: this.lastSelectionInAfterEdit === undefined ? undefined : serializeOffsetRange(this.lastSelectionInAfterEdit),
147
- };
148
- }
149
-
150
- toString(): string {
151
- return this.toMarkdown();
152
- }
153
-
154
- toMarkdown(): string {
155
- const lines: string[] = [];
156
-
157
- lines.push(`StatelessNextEditDocument: **${this.id.uri}**\n`);
158
- lines.push('```patch');
159
- lines.push(this.recentEdit.humanReadablePatch(this.documentLinesBeforeEdit));
160
- lines.push('```');
161
- lines.push('');
162
-
163
- return lines.join('\n');
164
- }
165
- }
166
-
167
- export interface ISerializedNextEditDocument {
168
- id: string;
169
- workspaceRoot: string | undefined;
170
- languageId: string;
171
- documentLinesBeforeEdit: string[];
172
- recentEdit: SerializedLineEdit;
173
- documentBeforeEdits: string;
174
- recentEdits: SerializedEdit[];
175
- lastSelectionInAfterEdit: ISerializedOffsetRange | undefined;
176
- }
177
-
178
- export enum FilteredOutReason {
179
- LowLogProbSuggestions = 'lowLogProbSuggestions',
180
- EnforcingNextEditOptions = 'enforcingNextEditOptions',
181
- PromptTooLarge = 'promptTooLarge',
182
- Uncategorized = 'uncategorized',
183
- }
184
-
185
- export namespace NoNextEditReason {
186
- export class ActiveDocumentHasNoEdits {
187
- public readonly kind = 'activeDocumentHasNoEdits';
188
- }
189
- export class NoSuggestions {
190
- public readonly kind = 'noSuggestions';
191
- constructor(
192
- public readonly documentBeforeEdits: StringText,
193
- public readonly window: OffsetRange | undefined
194
- ) {
195
- }
196
- }
197
- export class GotCancelled {
198
- public readonly kind = 'gotCancelled';
199
- constructor(public readonly message: 'afterDebounce' | 'afterGettingEndpoint' | 'afterPromptConstruction' | 'afterFetchCall' | 'duringStreaming' | 'afterResponse' | 'afterFailedRebase' | 'beforeExecutingNewRequest') {
200
- }
201
- }
202
- export class FetchFailure {
203
- public readonly kind = 'fetchFailure';
204
- constructor(public readonly error: Error) {
205
- }
206
- }
207
- export class FilteredOut {
208
- public readonly kind = 'filteredOut';
209
- constructor(public readonly message: FilteredOutReason | string) {
210
- }
211
- }
212
- export class Uncategorized {
213
- public readonly kind = 'uncategorized';
214
- constructor(public readonly error: Error) {
215
- }
216
- }
217
- export class Unexpected {
218
- public readonly kind = 'unexpected';
219
- constructor(public readonly error: Error) {
220
- }
221
- }
222
- }
223
-
224
- export type NoNextEditReason =
225
- | NoNextEditReason.ActiveDocumentHasNoEdits
226
- | NoNextEditReason.NoSuggestions
227
- | NoNextEditReason.GotCancelled
228
- | NoNextEditReason.FetchFailure
229
- | NoNextEditReason.FilteredOut
230
- | NoNextEditReason.Uncategorized
231
- | NoNextEditReason.Unexpected
232
- ;
233
-
234
- export class StatelessNextEditResult {
235
- public static noEdit(reason: NoNextEditReason, telemetryBuilder: StatelessNextEditTelemetryBuilder): StatelessNextEditResult {
236
- const result = Result.error(reason);
237
- const telemetry = telemetryBuilder.build(result);
238
- return new StatelessNextEditResult(result, telemetry);
239
- }
240
-
241
- public static streaming(telemetryBuilder: StatelessNextEditTelemetryBuilder): StatelessNextEditResult {
242
- const result = Result.ok<void>(undefined);
243
- const telemetry = telemetryBuilder.build(result);
244
- return new StatelessNextEditResult(result, telemetry);
245
- }
246
-
247
- constructor(
248
- public readonly nextEdit: Result<void, NoNextEditReason>,
249
- public readonly telemetry: IStatelessNextEditTelemetry,
250
- ) {
251
- }
252
- }
253
-
254
- export interface IStatelessNextEditTelemetry {
255
-
256
- readonly hadStatelessNextEditProviderCall: boolean;
257
-
258
- /* general info */
259
- readonly statelessNextEditProviderDuration: number;
260
- readonly isCursorAtEndOfLine: boolean | undefined;
261
- readonly nLinesOfCurrentFileInPrompt: number | undefined;
262
- readonly modelName: string | undefined;
263
-
264
- /* options info */
265
- readonly logProbThreshold: number | undefined;
266
-
267
- /* prompt info */
268
-
269
- readonly prompt: string | undefined;
270
- readonly promptLineCount: number | undefined;
271
- readonly promptCharCount: number | undefined;
272
-
273
- /* fetch request info */
274
-
275
- readonly debounceTime: number | undefined;
276
- /** This's only used to compute time from inline edit provider call to fetch init. Not included in telemetry. */
277
- readonly fetchStartedAt: number | undefined;
278
-
279
- /* response info */
280
-
281
- /** Artificial delay (aka backoff) on the response based on previous user acceptance/rejection in milliseconds */
282
- readonly artificialDelay: number | undefined;
283
-
284
- readonly hadLowLogProbSuggestion: boolean | undefined;
285
- readonly response: undefined | Promise<FetchResultWithStats>;
286
-
287
- /* suggestions info */
288
-
289
- readonly nEditsSuggested: number | undefined;
290
- readonly lineDistanceToMostRecentEdit: number | undefined;
291
-
292
- /* result info */
293
- readonly nextEditLogprob: number | undefined;
294
- readonly noNextEditReasonKind: string | undefined;
295
- readonly noNextEditReasonMessage: string | undefined;
296
- readonly summarizedEditWindow: any;
297
- }
298
-
299
- export type FetchResultWithStats = {
300
- readonly ttft: number | undefined;
301
- readonly response: FetchResponse<string>;
302
- readonly fetchTime: number;
303
- readonly fetchResult: ChatFetchResponseType;
304
- }
305
-
306
- export class StatelessNextEditTelemetryBuilder {
307
-
308
- public readonly startTime: number;
309
- public readonly requestUuid: string;
310
-
311
- /**
312
- * It takes a request to automatically capture some properties from the request.
313
- */
314
- constructor(request: StatelessNextEditRequest) {
315
- this.startTime = Date.now();
316
- this.requestUuid = request.id;
317
- }
318
-
319
- public build(result: Result<void, NoNextEditReason>): IStatelessNextEditTelemetry {
320
- const endTime = Date.now();
321
- const timeSpent = endTime - this.startTime;
322
-
323
- const prompt = this._prompt ? JSON.stringify(this._prompt.map(({ role, content }) => ({ role, content }))) : undefined;
324
- const promptText = this._prompt ? stringifyChatMessages(this._prompt) : undefined;
325
- const promptLineCount = promptText?.split('\n').length;
326
- const promptCharCount = promptText?.length;
327
-
328
- const noNextEditReasonKind = result.isOk() ? undefined : result.err.kind;
329
-
330
- let noNextEditReasonMessage: string | undefined;
331
- if (result.isError()) {
332
- if (result.err instanceof NoNextEditReason.ActiveDocumentHasNoEdits || result.err instanceof NoNextEditReason.NoSuggestions) {
333
- // ignore
334
- } else if (result.err instanceof NoNextEditReason.GotCancelled || result.err instanceof NoNextEditReason.FilteredOut) {
335
- noNextEditReasonMessage = result.err.message;
336
- } else if (result.err instanceof NoNextEditReason.FetchFailure || result.err instanceof NoNextEditReason.Uncategorized || result.err instanceof NoNextEditReason.Unexpected) {
337
- noNextEditReasonMessage = result.err.error.stack ? result.err.error.stack : result.err.error.message;
338
- } else {
339
- assertNever(result.err);
340
- }
341
- }
342
-
343
- return {
344
- hadStatelessNextEditProviderCall: true,
345
-
346
- noNextEditReasonKind,
347
- noNextEditReasonMessage,
348
-
349
- statelessNextEditProviderDuration: timeSpent,
350
- logProbThreshold: this._logProbThreshold,
351
- nLinesOfCurrentFileInPrompt: this._nLinesOfCurrentFileInPrompt,
352
- modelName: this._modelName,
353
- prompt,
354
- promptLineCount,
355
- promptCharCount,
356
- isCursorAtEndOfLine: this._isCursorAtLineEnd,
357
- debounceTime: this._debounceTime,
358
- artificialDelay: this._artificialDelay,
359
- fetchStartedAt: this._fetchStartedAt,
360
- hadLowLogProbSuggestion: this._hadLowLogProbSuggestion,
361
- response: this._response,
362
- nEditsSuggested: this._nEditsSuggested,
363
- nextEditLogprob: this._nextEditLogProb,
364
- lineDistanceToMostRecentEdit: this._lineDistanceToMostRecentEdit,
365
- summarizedEditWindow: this._summarizedEditWindow,
366
- };
367
- }
368
-
369
- private _logProbThreshold: number | undefined;
370
- public setLogProbThreshold(logProbThreshold: number): this {
371
- this._logProbThreshold = logProbThreshold;
372
- return this;
373
- }
374
-
375
- private _hadLowLogProbSuggestion: boolean | undefined;
376
- public setHadLowLogProbSuggestion(hadLowLogProbSuggestions: boolean): this {
377
- this._hadLowLogProbSuggestion = hadLowLogProbSuggestions;
378
- return this;
379
- }
380
-
381
- private _nLinesOfCurrentFileInPrompt: number | undefined;
382
- public setNLinesOfCurrentFileInPrompt(nLines: number): this {
383
- this._nLinesOfCurrentFileInPrompt = nLines;
384
- return this;
385
- }
386
-
387
- private _modelName: string | undefined;
388
- public setModelName(modelName: string): this {
389
- this._modelName = modelName;
390
- return this;
391
- }
392
-
393
- private _prompt: Raw.ChatMessage[] | undefined;
394
- public setPrompt(prompt: Raw.ChatMessage[]): this {
395
- this._prompt = prompt;
396
- return this;
397
- }
398
-
399
- private _isCursorAtLineEnd: boolean | undefined;
400
- public setIsCursorAtLineEnd(isCursorAtLineEnd: boolean): this {
401
- this._isCursorAtLineEnd = isCursorAtLineEnd;
402
- return this;
403
- }
404
-
405
- private _debounceTime: number | undefined;
406
- public setDebounceTime(debounceTime: number): this {
407
- this._debounceTime = debounceTime;
408
- return this;
409
- }
410
-
411
- private _artificialDelay: number | undefined;
412
- public setArtificialDelay(artificialDelay: number): this {
413
- this._artificialDelay = artificialDelay;
414
- return this;
415
- }
416
-
417
- private _fetchStartedAt: number | undefined;
418
- public setFetchStartedAt(): this {
419
- this._fetchStartedAt = Date.now();
420
- return this;
421
- }
422
- public get fetchStartedAt(): number | undefined {
423
- return this._fetchStartedAt;
424
- }
425
-
426
- private _response: Promise<FetchResultWithStats> | undefined;
427
- public setResponse(response: Promise<{ ttft: number | undefined; response: FetchResponse<string> }>): this {
428
- this._response = response.then(({ response, ttft }) => {
429
-
430
- const fetchTime = Date.now() - this._fetchStartedAt!;
431
-
432
- const fetchResult = response.type;
433
-
434
- return {
435
- ttft,
436
- response,
437
- fetchTime,
438
- fetchResult,
439
- };
440
- });
441
-
442
- return this;
443
- }
444
-
445
- private _nextEditLogProb: number | undefined;
446
- public setNextEditLogProb(logProb: number): this {
447
- this._nextEditLogProb = logProb;
448
- return this;
449
- }
450
-
451
- private _nEditsSuggested: number | undefined;
452
- public setNEditsSuggested(nEditsSuggested: number): this {
453
- this._nEditsSuggested = nEditsSuggested;
454
- return this;
455
- }
456
-
457
- private _lineDistanceToMostRecentEdit: number | undefined;
458
- public setLineDistanceToMostRecentEdit(distanceToMostRecentEdit: number): this {
459
- this._lineDistanceToMostRecentEdit = distanceToMostRecentEdit;
460
- return this;
461
- }
462
-
463
- private _summarizedEditWindow: any;
464
- public setSummarizedEditWindow(summarizedEditWindow: any): this {
465
- this._summarizedEditWindow = summarizedEditWindow;
466
- return this;
467
- }
468
- }
@@ -1,59 +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 { LineReplacement } from '../../../util/vs/editor/common/core/edits/lineEdit';
7
- import { StatelessNextEditDocument } from './statelessNextEditProvider';
8
-
9
- export class IgnoreEmptyLineAndLeadingTrailingWhitespaceChanges {
10
- public static filterEdit(resultDocument: StatelessNextEditDocument, singleEdits: readonly LineReplacement[]): readonly LineReplacement[] {
11
- const filteredEdits = singleEdits.filter(e => !IgnoreEmptyLineAndLeadingTrailingWhitespaceChanges._isWhitespaceOnlyChange(e, resultDocument.documentAfterEditsLines));
12
- return filteredEdits;
13
- }
14
-
15
- private static _isWhitespaceOnlyChange(edit: LineReplacement, baseLines: string[]): boolean {
16
- const originalLines = edit.lineRange.toOffsetRange().slice(baseLines);
17
- const newLines = edit.newLines;
18
-
19
- const isRemoval = newLines.length === 0;
20
-
21
- // is removing empty lines
22
- if (isRemoval && originalLines.every(line => line.trim() === '')) {
23
- return true;
24
- }
25
-
26
- // is adding empty lines
27
- if (!isRemoval && newLines.every(line => line.trim() === '')) {
28
- return true;
29
- }
30
-
31
- if (originalLines.length !== newLines.length) {
32
- return false;
33
- }
34
-
35
- for (let i = 0; i < originalLines.length; i++) {
36
- const originalLine = originalLines[i];
37
- const newLine = newLines[i];
38
- if (originalLine.trim() !== newLine.trim()) {
39
- return false;
40
- }
41
- }
42
- return true;
43
- }
44
- }
45
-
46
- export class IgnoreWhitespaceOnlyChanges {
47
- public static filterEdit(resultDocument: StatelessNextEditDocument, singleEdits: readonly LineReplacement[]): readonly LineReplacement[] {
48
- return singleEdits.filter(e => !IgnoreWhitespaceOnlyChanges._isFormattingOnlyChange(resultDocument.documentAfterEditsLines, e));
49
- }
50
-
51
- /**
52
- * @remarks public only for testing
53
- */
54
- public static _isFormattingOnlyChange(baseLines: string[], singleEdit: LineReplacement): boolean {
55
- const originalLines = singleEdit.lineRange.toOffsetRange().slice(baseLines).join('').replace(/\s/g, '');
56
- const newLines = singleEdit.newLines.join('').replace(/\s/g, '');
57
- return originalLines === newLines;
58
- }
59
- }
@@ -1,54 +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 { IDisposable } from '../../../../util/vs/base/common/lifecycle';
7
- import { autorunHandleChanges, IObservableWithChange } from '../../../../util/vs/base/common/observable';
8
-
9
- type ObservableResult<T> = T extends IObservableWithChange<infer U, any> ? U : never;
10
-
11
- type ObservableArrayToChangesData<T extends Record<string, IObservableWithChange<any, any>>> = {
12
- [Key in keyof T]: {
13
- value: ObservableResult<T[Key]>;
14
- changes: T[Key]['TChange'][];
15
- /**
16
- * The value of the observable before the changes. `undefined` if
17
- */
18
- previous: ObservableResult<T[Key]> | undefined;
19
- }
20
- };
21
-
22
- export function autorunWithChanges<T extends Record<string, IObservableWithChange<any, any>>>(owner: object, observables: T, handler: (data: ObservableArrayToChangesData<T>) => void): IDisposable {
23
- const observableToKey = new Map(Object.entries(observables).map(([key, value]) => [value, key] as const));
24
-
25
- const previousValues = new Map(Object.keys(observables).map(key => [key, undefined]));
26
-
27
- return autorunHandleChanges({
28
- owner,
29
- changeTracker: {
30
- createChangeSummary: () => ({}) as ObservableArrayToChangesData<T>,
31
- handleChange: (ctx, changeSummary) => {
32
- const key = observableToKey.get(ctx.changedObservable)!;
33
-
34
- if (changeSummary[key] === undefined) {
35
- (changeSummary as any)[key] = { value: undefined!, changes: [] };
36
- }
37
- changeSummary[key].changes.push(ctx.change);
38
- return true;
39
- }
40
- }
41
- }, (reader, data) => {
42
- for (const [key, value] of Object.entries(observables)) {
43
- const v = value.read(reader);
44
-
45
- if (data[key] === undefined) {
46
- (data as any)[key] = { value: v, changes: [], previous: previousValues.get(key) };
47
- }
48
- data[key].value = v;
49
- data[key].previous = previousValues.get(key) === undefined ? undefined : previousValues.get(key);
50
- previousValues.set(key, v);
51
- }
52
- handler(data);
53
- });
54
- }
@@ -1,29 +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 { Raw } from '@vscode/prompt-tsx';
7
-
8
- export function stringifyChatMessages(messages: Raw.ChatMessage[]) {
9
- return messages.map(stringifyMessage).join('\n');
10
- }
11
-
12
- function stringifyMessage({ role, content }: Raw.ChatMessage) {
13
- if (role !== Raw.ChatRole.User && role !== Raw.ChatRole.System) {
14
- return 'omitted because of non-user and non-system role'; // should be impossible
15
- }
16
-
17
- const roleStr = role === Raw.ChatRole.User ? 'User' : 'System';
18
-
19
- const textContentPart = content.at(0);
20
- if (textContentPart?.type !== Raw.ChatCompletionContentPartKind.Text) {
21
- return 'omitted because of non-text content'; // should be impossible
22
- }
23
-
24
- return (
25
- `${roleStr}
26
- ------
27
- ${textContentPart.text}
28
- ==================`);
29
- }
@@ -1,56 +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 { ThemeIcon } from '../../../../util/vs/base/common/themables';
7
-
8
- /**
9
- * Represents a specific point in time.
10
- */
11
- export type Instant = number;
12
-
13
- let overridenNowValue = -1;
14
-
15
- export function overrideNowValue(value: number): void {
16
- overridenNowValue = value;
17
- }
18
-
19
- export function now(): Instant {
20
- if (overridenNowValue !== -1) {
21
- return overridenNowValue;
22
- }
23
- return Date.now();
24
- }
25
-
26
- export namespace Icon {
27
- export type t = {
28
- themeIcon: ThemeIcon;
29
- svg: string;
30
- };
31
-
32
- export const circleSlash: t = {
33
- themeIcon: ThemeIcon.fromId('circle-slash'),
34
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="currentColor" d="M8 1a7 7 0 1 1-7 7a7.01 7.01 0 0 1 7-7M2 8c0 1.418.504 2.79 1.423 3.87l8.447-8.447A5.993 5.993 0 0 0 2 8m12 0c0-1.418-.504-2.79-1.423-3.87L4.13 12.577A5.993 5.993 0 0 0 14 8"/></svg>`,
35
- };
36
-
37
- export const error: t = {
38
- themeIcon: ThemeIcon.fromId('error'),
39
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M8.6 1c1.6.1 3.1.9 4.2 2c1.3 1.4 2 3.1 2 5.1c0 1.6-.6 3.1-1.6 4.4c-1 1.2-2.4 2.1-4 2.4s-3.2.1-4.6-.7s-2.5-2-3.1-3.5S.8 7.5 1.3 6c.5-1.6 1.4-2.9 2.8-3.8C5.4 1.3 7 .9 8.6 1m.5 12.9c1.3-.3 2.5-1 3.4-2.1c.8-1.1 1.3-2.4 1.2-3.8c0-1.6-.6-3.2-1.7-4.3c-1-1-2.2-1.6-3.6-1.7c-1.3-.1-2.7.2-3.8 1S2.7 4.9 2.3 6.3c-.4 1.3-.4 2.7.2 4q.9 1.95 2.7 3c1.2.7 2.6.9 3.9.6M7.9 7.5L10.3 5l.7.7l-2.4 2.5l2.4 2.5l-.7.7l-2.4-2.5l-2.4 2.5l-.7-.7l2.4-2.5l-2.4-2.5l.7-.7z" clip-rule="evenodd"/></svg>`,
40
- };
41
-
42
- export const skipped: t = {
43
- themeIcon: ThemeIcon.fromId('testing-skipped-icon'),
44
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M14.25 5.75v-4h-1.5v2.542c-1.145-1.359-2.911-2.209-4.84-2.209c-3.177 0-5.92 2.307-6.16 5.398l-.02.269h1.501l.022-.226c.212-2.195 2.202-3.94 4.656-3.94c1.736 0 3.244.875 4.05 2.166h-2.83v1.5h4.163l.962-.975V5.75zM8 14a2 2 0 1 0 0-4a2 2 0 0 0 0 4" clip-rule="evenodd"/></svg>`,
45
- };
46
-
47
- export const lightbulbFull: t = {
48
- themeIcon: ThemeIcon.fromId('refactor-preview-view-icon'),
49
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M11.67 8.658a3.7 3.7 0 0 0-.781 1.114a3.3 3.3 0 0 0-.268 1.329v1.6a1.3 1.3 0 0 1-.794 1.197a1.3 1.3 0 0 1-.509.102H7.712a1.3 1.3 0 0 1-.922-.379a1.3 1.3 0 0 1-.38-.92v-1.6q0-.718-.274-1.329a3.6 3.6 0 0 0-.776-1.114a4.7 4.7 0 0 1-1.006-1.437A4.2 4.2 0 0 1 4 5.5a4.43 4.43 0 0 1 .616-2.27q.296-.504.705-.914a4.6 4.6 0 0 1 .911-.702q.508-.294 1.084-.454a4.5 4.5 0 0 1 1.2-.16a4.5 4.5 0 0 1 2.276.614a4.5 4.5 0 0 1 1.622 1.616a4.44 4.44 0 0 1 .616 2.27q0 .926-.353 1.721a4.7 4.7 0 0 1-1.006 1.437zM9.623 10.5H7.409v2.201q-.001.12.09.212a.3.3 0 0 0 .213.09h1.606a.3.3 0 0 0 .213-.09a.3.3 0 0 0 .09-.212V10.5z" clip-rule="evenodd"/></svg>`
50
- };
51
-
52
- export const database: t = {
53
- themeIcon: ThemeIcon.fromId('database'),
54
- svg: `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="currentColor" d="M13 3.5C13 2.119 10.761 1 8 1S3 2.119 3 3.5c0 .04.02.077.024.117H3v8.872l.056.357C3.336 14.056 5.429 15 8 15s4.664-.944 4.944-2.154l.056-.357V3.617h-.024c.004-.04.024-.077.024-.117M8 2.032c2.442 0 4 .964 4 1.468s-1.558 1.468-4 1.468S4 4 4 3.5s1.558-1.468 4-1.468m4 10.458l-.03.131C11.855 13.116 10.431 14 8 14s-3.855-.884-3.97-1.379L4 12.49v-7.5A7.4 7.4 0 0 0 8 6a7.4 7.4 0 0 0 4-1.014z"/></svg>`,
55
- };
56
- }