@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,706 +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 type { CancellationToken } from 'vscode';
8
- import { IAuthenticationService } from '../../../platform/authentication/common/authentication';
9
- import { FetchStreamRecorder, IChatMLFetcher, IFetchMLOptions, Source } from '../../../platform/chat/common/chatMLFetcher';
10
- import { IChatQuotaService } from '../../../platform/chat/common/chatQuotaService';
11
- import { ChatFetchError, ChatFetchResponseType, ChatFetchRetriableError, ChatLocation, ChatResponse, ChatResponses } from '../../../platform/chat/common/commonTypes';
12
- import { IConversationOptions } from '../../../platform/chat/common/conversationOptions';
13
- import { getTextPart, toTextParts } from '../../../platform/chat/common/globalStringUtils';
14
- import { IInteractionService } from '../../../platform/chat/common/interactionService';
15
- import { HARD_TOOL_LIMIT } from '../../../platform/configuration/common/configurationService';
16
- import { ICAPIClientService } from '../../../platform/endpoint/common/capiClient';
17
- import { IDomainService } from '../../../platform/endpoint/common/domainService';
18
- import { IEnvService } from '../../../platform/env/common/envService';
19
- import { ILogService } from '../../../platform/log/common/logService';
20
- import { OptionalChatRequestParams } from '../../../platform/networking/common/fetch';
21
- import { IFetcherService } from '../../../platform/networking/common/fetcherService';
22
- import { IChatEndpoint } from '../../../platform/networking/common/networking';
23
- import { ChatCompletion, FilterReason, FinishedCompletionReason } from '../../../platform/networking/common/openai';
24
- import { ChatFailKind, ChatRequestCanceled, ChatRequestFailed, ChatResults, fetchAndStreamChat, FetchResponseKind } from '../../../platform/openai/node/fetch';
25
- import { IRequestLogger } from '../../../platform/requestLogger/node/requestLogger';
26
- import { ITelemetryService, TelemetryProperties } from '../../../platform/telemetry/common/telemetry';
27
- import { TelemetryData } from '../../../platform/telemetry/common/telemetryData';
28
- import { calculateLineRepetitionStats, isRepetitive } from '../../../util/common/anomalyDetection';
29
- import * as errorsUtil from '../../../util/common/errors';
30
- import { isCancellationError } from '../../../util/vs/base/common/errors';
31
- import { Emitter } from '../../../util/vs/base/common/event';
32
- import { generateUuid } from '../../../util/vs/base/common/uuid';
33
- import { OpenAIEndpoint } from '../../byok/node/openAIEndpoint';
34
- import { EXTENSION_ID } from '../../common/constants';
35
-
36
- export interface IMadeChatRequestEvent {
37
- readonly messages: Raw.ChatMessage[];
38
- readonly model: string;
39
- readonly source?: Source;
40
- readonly tokenCount?: number;
41
- }
42
-
43
- export abstract class AbstractChatMLFetcher implements IChatMLFetcher {
44
-
45
- declare _serviceBrand: undefined;
46
-
47
- constructor(
48
- protected readonly options: IConversationOptions,
49
- ) { }
50
-
51
- protected preparePostOptions(requestOptions: OptionalChatRequestParams): OptionalChatRequestParams {
52
- return {
53
- temperature: this.options.temperature,
54
- top_p: this.options.topP,
55
- // we disallow `stream=false` because we don't support non-streamed response
56
- ...requestOptions,
57
- stream: true
58
- };
59
- }
60
-
61
- protected readonly _onDidMakeChatMLRequest = new Emitter<IMadeChatRequestEvent>();
62
- readonly onDidMakeChatMLRequest = this._onDidMakeChatMLRequest.event;
63
-
64
- public async fetchOne(opts: IFetchMLOptions, token: CancellationToken): Promise<ChatResponse> {
65
- const resp = await this.fetchMany({
66
- ...opts,
67
- requestOptions: { ...opts.requestOptions, n: 1 }
68
- }, token);
69
- if (resp.type === ChatFetchResponseType.Success) {
70
- return { ...resp, value: resp.value[0] };
71
- }
72
- return resp;
73
- }
74
-
75
- /**
76
- * Note: the returned array of strings may be less than `n` (e.g., in case there were errors during streaming)
77
- */
78
- public abstract fetchMany(opts: IFetchMLOptions, token: CancellationToken): Promise<ChatResponses>;
79
- }
80
-
81
- export class ChatMLFetcherImpl extends AbstractChatMLFetcher {
82
-
83
- constructor(
84
- @IFetcherService private readonly _fetcherService: IFetcherService,
85
- @ITelemetryService private readonly _telemetryService: ITelemetryService,
86
- @IRequestLogger private readonly _requestLogger: IRequestLogger,
87
- @ILogService private readonly _logService: ILogService,
88
- @IEnvService private readonly _envService: IEnvService,
89
- @IDomainService private readonly _domainService: IDomainService,
90
- @ICAPIClientService private readonly _capiClientService: ICAPIClientService,
91
- @IAuthenticationService private readonly _authenticationService: IAuthenticationService,
92
- @IInteractionService private readonly _interactionService: IInteractionService,
93
- @IChatQuotaService private readonly _chatQuotaService: IChatQuotaService,
94
- @IConversationOptions options: IConversationOptions,
95
- ) {
96
- super(options);
97
- }
98
-
99
- /**
100
- * Note: the returned array of strings may be less than `n` (e.g., in case there were errors during streaming)
101
- */
102
- public async fetchMany(opts: IFetchMLOptions, token: CancellationToken): Promise<ChatResponses> {
103
- let { debugName, endpoint: chatEndpoint, finishedCb, location, messages, requestOptions, source, telemetryProperties, userInitiatedRequest } = opts;
104
- if (!telemetryProperties) {
105
- telemetryProperties = {};
106
- }
107
-
108
- if (!telemetryProperties.messageSource) {
109
- telemetryProperties.messageSource = debugName;
110
- }
111
-
112
- // TODO @lramos15 telemetry should not drive request ids
113
- const ourRequestId = telemetryProperties.requestId ?? telemetryProperties.messageId ?? generateUuid();
114
-
115
- const maxResponseTokens = chatEndpoint.maxOutputTokens;
116
- if (!requestOptions?.prediction) {
117
- requestOptions = { max_tokens: maxResponseTokens, ...requestOptions };
118
- }
119
- // Avoid sending a prediction with no content as this will yield a 400 Bad Request
120
- if (!requestOptions.prediction?.content) {
121
- delete requestOptions['prediction'];
122
- }
123
-
124
- const postOptions = this.preparePostOptions(requestOptions);
125
- const requestBody = chatEndpoint.createRequestBody({
126
- ...opts,
127
- requestId: ourRequestId,
128
- postOptions
129
- });
130
-
131
-
132
- const baseTelemetry = TelemetryData.createAndMarkAsIssued({
133
- ...telemetryProperties,
134
- baseModel: chatEndpoint.model,
135
- uiKind: ChatLocation.toString(location)
136
- });
137
-
138
- const pendingLoggedChatRequest = this._requestLogger.logChatRequest(debugName, chatEndpoint, {
139
- messages: opts.messages,
140
- model: chatEndpoint.model,
141
- ourRequestId,
142
- location: opts.location,
143
- postOptions,
144
- body: requestBody,
145
- tools: requestBody.tools,
146
- ignoreStatefulMarker: opts.ignoreStatefulMarker
147
- });
148
- let tokenCount = -1;
149
- try {
150
- let response: ChatResults | ChatRequestFailed | ChatRequestCanceled;
151
- const streamRecorder = new FetchStreamRecorder(finishedCb);
152
- const payloadValidationResult = isValidChatPayload(opts.messages, postOptions);
153
- if (!payloadValidationResult.isValid) {
154
- response = {
155
- type: FetchResponseKind.Failed,
156
- modelRequestId: undefined,
157
- failKind: ChatFailKind.ValidationFailed,
158
- reason: payloadValidationResult.reason,
159
- };
160
- } else {
161
- response = await fetchAndStreamChat(
162
- this._logService,
163
- this._telemetryService,
164
- this._fetcherService,
165
- this._envService,
166
- this._chatQuotaService,
167
- this._domainService,
168
- this._capiClientService,
169
- this._authenticationService,
170
- this._interactionService,
171
- chatEndpoint,
172
- requestBody,
173
- baseTelemetry,
174
- streamRecorder.callback,
175
- requestOptions.secretKey,
176
- opts.location,
177
- ourRequestId,
178
- postOptions.n,
179
- userInitiatedRequest,
180
- token,
181
- telemetryProperties
182
- );
183
- tokenCount = await chatEndpoint.acquireTokenizer().countMessagesTokens(messages);
184
- const extensionId = source?.extensionId ?? EXTENSION_ID;
185
- this._onDidMakeChatMLRequest.fire({
186
- messages,
187
- model: chatEndpoint.model,
188
- source: { extensionId },
189
- tokenCount
190
- });
191
- }
192
- const timeToFirstToken = Date.now() - baseTelemetry.issuedTime;
193
- pendingLoggedChatRequest?.markTimeToFirstToken(timeToFirstToken);
194
- switch (response.type) {
195
- case FetchResponseKind.Success: {
196
- const result = await this.processSuccessfulResponse(response, messages, ourRequestId, maxResponseTokens, tokenCount, timeToFirstToken, baseTelemetry, chatEndpoint, userInitiatedRequest);
197
-
198
- // Handle FilteredRetry case with augmented messages
199
- if (result.type === ChatFetchResponseType.FilteredRetry) {
200
-
201
- if (opts.isFilterRetry !== true) {
202
- streamRecorder.callback("", 0, { text: "", retryReason: result.category });
203
-
204
- const filteredContent = result.value[0];
205
- if (filteredContent) {
206
- const retryMessage = (result.category === FilterReason.Copyright) ?
207
- `The previous response (copied below) was filtered due to being too similar to existing public code. Please suggest something similar in function that does not match public code. Here's the previous response: ${filteredContent}\n\n` :
208
- `The previous response (copied below) was filtered due to triggering our content safety filters, which looks for hateful, self-harm, sexual, or violent content. Please suggest something similar in content that does not trigger these filters. Here's the previous response: ${filteredContent}\n\n`;
209
- const augmentedMessages: Raw.ChatMessage[] = [
210
- ...messages,
211
- {
212
- role: Raw.ChatRole.User,
213
- content: toTextParts(retryMessage)
214
- }
215
- ];
216
-
217
- // Retry with augmented messages
218
- const retryResult = await this.fetchMany({
219
- debugName: 'retry-' + debugName,
220
- messages: augmentedMessages,
221
- finishedCb,
222
- location,
223
- endpoint: chatEndpoint,
224
- source,
225
- requestOptions,
226
- userInitiatedRequest: false, // do not mark the retry as user initiated
227
- telemetryProperties: { ...telemetryProperties, retryAfterFilterCategory: result.category ?? 'uncategorized' },
228
- isFilterRetry: true,
229
- }, token);
230
-
231
- pendingLoggedChatRequest?.resolve(retryResult, streamRecorder.deltas);
232
- if (retryResult.type === ChatFetchResponseType.Success) {
233
- return retryResult;
234
- }
235
- }
236
- }
237
-
238
- return {
239
- type: ChatFetchResponseType.Filtered,
240
- category: result.category,
241
- reason: 'Response got filtered.',
242
- requestId: result.requestId,
243
- serverRequestId: result.serverRequestId
244
- };
245
- }
246
-
247
- pendingLoggedChatRequest?.resolve(result, streamRecorder.deltas);
248
- return result;
249
- }
250
- case FetchResponseKind.Canceled:
251
- this._sendCancellationTelemetry({
252
- source: telemetryProperties.messageSource ?? 'unknown',
253
- requestId: ourRequestId,
254
- model: chatEndpoint.model,
255
- apiType: chatEndpoint.apiType,
256
- ...(telemetryProperties.retryAfterFilterCategory ? { retryAfterFilterCategory: telemetryProperties.retryAfterFilterCategory } : {}),
257
- }, {
258
- totalTokenMax: chatEndpoint.modelMaxPromptTokens ?? -1,
259
- promptTokenCount: tokenCount,
260
- tokenCountMax: maxResponseTokens,
261
- timeToFirstToken,
262
- timeToCancelled: baseTelemetry ? Date.now() - baseTelemetry.issuedTime : -1,
263
- isVisionRequest: this.filterImageMessages(messages) ? 1 : -1,
264
- isBYOK: chatEndpoint instanceof OpenAIEndpoint ? 1 : -1
265
- });
266
- pendingLoggedChatRequest?.resolveWithCancelation();
267
- return this.processCanceledResponse(response, ourRequestId);
268
- case FetchResponseKind.Failed: {
269
- const processed = this.processFailedResponse(response, ourRequestId);
270
- this._sendResponseErrorTelemetry(processed, telemetryProperties, ourRequestId, chatEndpoint, tokenCount, maxResponseTokens, timeToFirstToken, this.filterImageMessages(messages));
271
- pendingLoggedChatRequest?.resolve(processed);
272
- return processed;
273
- }
274
- }
275
- } catch (err: unknown) {
276
- const timeToError = Date.now() - baseTelemetry.issuedTime;
277
- const processed = this.processError(err, ourRequestId);
278
- if (processed.type === ChatFetchResponseType.Canceled) {
279
- this._sendCancellationTelemetry({
280
- source: telemetryProperties.messageSource ?? 'unknown',
281
- requestId: ourRequestId,
282
- model: chatEndpoint.model,
283
- apiType: chatEndpoint.apiType
284
- }, {
285
- totalTokenMax: chatEndpoint.modelMaxPromptTokens ?? -1,
286
- promptTokenCount: tokenCount,
287
- tokenCountMax: maxResponseTokens,
288
- timeToFirstToken: undefined,
289
- timeToCancelled: timeToError,
290
- isVisionRequest: this.filterImageMessages(messages) ? 1 : -1,
291
- isBYOK: chatEndpoint instanceof OpenAIEndpoint ? 1 : -1
292
- });
293
- } else {
294
- this._sendResponseErrorTelemetry(processed, telemetryProperties, ourRequestId, chatEndpoint, tokenCount, maxResponseTokens, timeToError, this.filterImageMessages(messages));
295
- }
296
- pendingLoggedChatRequest?.resolve(processed);
297
- return processed;
298
- }
299
- }
300
-
301
- private _sendCancellationTelemetry(
302
- {
303
- source,
304
- requestId,
305
- model,
306
- apiType
307
- }: {
308
- source: string;
309
- requestId: string;
310
- model: string;
311
- apiType: string | undefined;
312
- },
313
- {
314
- totalTokenMax,
315
- promptTokenCount,
316
- tokenCountMax,
317
- timeToFirstToken,
318
- timeToCancelled,
319
- isVisionRequest,
320
- isBYOK
321
- }: {
322
- totalTokenMax: number;
323
- promptTokenCount: number;
324
- tokenCountMax: number;
325
- timeToFirstToken: number | undefined;
326
- timeToCancelled: number;
327
- isVisionRequest: number;
328
- isBYOK: number;
329
- }
330
- ) {
331
- /* __GDPR__
332
- "response.cancelled" : {
333
- "owner": "digitarald",
334
- "comment": "Report canceled service responses for quality.",
335
- "model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
336
- "apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
337
- "source": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Source for why the request was made" },
338
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the request" },
339
- "totalTokenMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum total token window", "isMeasurement": true },
340
- "promptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens", "isMeasurement": true },
341
- "tokenCountMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum generated tokens", "isMeasurement": true },
342
- "timeToFirstToken": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
343
- "timeToCancelled": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
344
- "isVisionRequest": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the request was for a vision model", "isMeasurement": true },
345
- "isBYOK": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for a BYOK model", "isMeasurement": true },
346
- "retryAfterFilterCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response was filtered and this is a retry attempt, this contains the original filtered content category." }
347
- }
348
- */
349
- this._telemetryService.sendTelemetryEvent('response.cancelled', { github: true, microsoft: true }, {
350
- apiType,
351
- source,
352
- requestId,
353
- model,
354
- }, {
355
- totalTokenMax,
356
- promptTokenCount,
357
- tokenCountMax,
358
- timeToFirstToken,
359
- timeToCancelled,
360
- isVisionRequest,
361
- isBYOK
362
- });
363
- }
364
-
365
- private _sendResponseErrorTelemetry(
366
- processed: ChatFetchError,
367
- telemetryProperties: TelemetryProperties | undefined,
368
- ourRequestId: string,
369
- chatEndpointInfo: IChatEndpoint,
370
- tokenCount: number,
371
- maxResponseTokens: number,
372
- timeToFirstToken: number,
373
- isVisionRequest: boolean,
374
- ) {
375
- /* __GDPR__
376
- "response.error" : {
377
- "owner": "digitarald",
378
- "comment": "Report quality issue for when a service response failed.",
379
- "type": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Type of issue" },
380
- "reason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason of issue" },
381
- "model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
382
- "apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
383
- "source": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Source for why the request was made" },
384
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the request" },
385
- "totalTokenMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum total token window", "isMeasurement": true },
386
- "promptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens", "isMeasurement": true },
387
- "tokenCountMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum generated tokens", "isMeasurement": true },
388
- "timeToFirstToken": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
389
- "isVisionRequest": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the request was for a vision model", "isMeasurement": true },
390
- "isBYOK": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for a BYOK model", "isMeasurement": true },
391
- "retryAfterFilterCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response was filtered and this is a retry attempt, this contains the original filtered content category." }
392
- }
393
- */
394
- this._telemetryService.sendTelemetryEvent('response.error', { github: true, microsoft: true }, {
395
- type: processed.type,
396
- reason: processed.reason,
397
- source: telemetryProperties?.messageSource ?? 'unknown',
398
- requestId: ourRequestId,
399
- model: chatEndpointInfo.model,
400
- apiType: chatEndpointInfo.apiType,
401
- ...(telemetryProperties?.retryAfterFilterCategory ? { retryAfterFilterCategory: telemetryProperties.retryAfterFilterCategory } : {})
402
- }, {
403
- totalTokenMax: chatEndpointInfo.modelMaxPromptTokens ?? -1,
404
- promptTokenCount: tokenCount,
405
- tokenCountMax: maxResponseTokens,
406
- timeToFirstToken,
407
- isVisionRequest: isVisionRequest ? 1 : -1,
408
- isBYOK: chatEndpointInfo instanceof OpenAIEndpoint ? 1 : -1
409
- });
410
- }
411
-
412
- private async processSuccessfulResponse(
413
- response: ChatResults,
414
- messages: Raw.ChatMessage[],
415
- requestId: string,
416
- maxResponseTokens: number,
417
- promptTokenCount: number,
418
- timeToFirstToken: number,
419
- baseTelemetry?: TelemetryData,
420
- chatEndpointInfo?: IChatEndpoint,
421
- userInitiatedRequest?: boolean
422
- ): Promise<ChatResponses | ChatFetchRetriableError<string[]>> {
423
-
424
- const completions: ChatCompletion[] = [];
425
-
426
- for await (const chatCompletion of response.chatCompletions) {
427
- /* __GDPR__
428
- "response.success" : {
429
- "owner": "digitarald",
430
- "comment": "Report quality details for a successful service response.",
431
- "reason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason for why a response finished" },
432
- "filterReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason for why a response was filtered" },
433
- "source": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Source of the initial request" },
434
- "initiatorType": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was initiated by a user or an agent" },
435
- "model": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Model selection for the response" },
436
- "apiType": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "API type for the response- chat completions or responses" },
437
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id of the current turn request" },
438
- "totalTokenMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum total token window", "isMeasurement": true },
439
- "clientPromptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens, locally counted", "isMeasurement": true },
440
- "promptTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens, server side counted", "isMeasurement": true },
441
- "promptCacheTokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of prompt tokens hitting cache as reported by server", "isMeasurement": true },
442
- "tokenCountMax": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Maximum generated tokens", "isMeasurement": true },
443
- "tokenCount": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of generated tokens", "isMeasurement": true },
444
- "reasoning_tokens": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Number of reasoning tokens", "isMeasurement": true },
445
- "acceptedPredictionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prediction that appeared in the completion", "isMeasurement": true },
446
- "rejectedPredictionTokens": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Number of tokens in the prediction that appeared in the completion", "isMeasurement": true },
447
- "timeToFirstToken": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to first token", "isMeasurement": true },
448
- "timeToComplete": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Time to complete the request", "isMeasurement": true },
449
- "isVisionRequest": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Whether the request was for a vision model", "isMeasurement": true },
450
- "isBYOK": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Whether the request was for a BYOK model", "isMeasurement": true },
451
- "retryAfterFilterCategory": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "If the response was filtered and this is a retry attempt, this contains the original filtered content category." }
452
- }
453
- */
454
- this._telemetryService.sendTelemetryEvent('response.success', { github: true, microsoft: true }, {
455
- reason: chatCompletion.finishReason,
456
- filterReason: chatCompletion.filterReason,
457
- source: baseTelemetry?.properties.messageSource ?? 'unknown',
458
- initiatorType: userInitiatedRequest ? 'user' : 'agent',
459
- model: chatEndpointInfo?.model,
460
- apiType: chatEndpointInfo?.apiType,
461
- requestId,
462
- ...(baseTelemetry?.properties.retryAfterFilterCategory ? { retryAfterFilterCategory: baseTelemetry.properties.retryAfterFilterCategory } : {}),
463
- }, {
464
- totalTokenMax: chatEndpointInfo?.modelMaxPromptTokens ?? -1,
465
- tokenCountMax: maxResponseTokens,
466
- promptTokenCount: chatCompletion.usage?.prompt_tokens,
467
- promptCacheTokenCount: chatCompletion.usage?.prompt_tokens_details?.cached_tokens,
468
- clientPromptTokenCount: promptTokenCount,
469
- tokenCount: chatCompletion.usage?.total_tokens,
470
- reasoningTokens: chatCompletion.usage?.completion_tokens_details?.reasoning_tokens,
471
- acceptedPredictionTokens: chatCompletion.usage?.completion_tokens_details?.accepted_prediction_tokens,
472
- rejectedPredictionTokens: chatCompletion.usage?.completion_tokens_details?.rejected_prediction_tokens,
473
- timeToFirstToken,
474
- timeToComplete: baseTelemetry ? Date.now() - baseTelemetry.issuedTime : -1,
475
- isVisionRequest: this.filterImageMessages(messages) ? 1 : -1,
476
- isBYOK: chatEndpointInfo instanceof OpenAIEndpoint ? 1 : -1
477
- });
478
- if (!this.isRepetitive(chatCompletion, baseTelemetry?.properties)) {
479
- completions.push(chatCompletion);
480
- }
481
- }
482
- const successFinishReasons = new Set([FinishedCompletionReason.Stop, FinishedCompletionReason.ClientTrimmed, FinishedCompletionReason.FunctionCall, FinishedCompletionReason.ToolCalls]);
483
- const successfulCompletions = completions.filter(c => successFinishReasons.has(c.finishReason));
484
- if (successfulCompletions.length >= 1) {
485
- return {
486
- type: ChatFetchResponseType.Success,
487
- usage: successfulCompletions.length === 1 ? successfulCompletions[0].usage : undefined,
488
- value: successfulCompletions.map(c => getTextPart(c.message.content)),
489
- requestId,
490
- serverRequestId: successfulCompletions[0].requestId.headerRequestId,
491
- };
492
- }
493
-
494
- const result = completions.at(0);
495
-
496
- switch (result?.finishReason) {
497
- case FinishedCompletionReason.ContentFilter:
498
- return {
499
- type: ChatFetchResponseType.FilteredRetry,
500
- category: result.filterReason ?? FilterReason.Copyright,
501
- reason: 'Response got filtered.',
502
- value: completions.map(c => getTextPart(c.message.content)),
503
- requestId: requestId,
504
- serverRequestId: result.requestId.headerRequestId,
505
- };
506
- case FinishedCompletionReason.Length:
507
- return {
508
- type: ChatFetchResponseType.Length,
509
- reason: 'Response too long.',
510
- requestId: requestId,
511
- serverRequestId: result.requestId.headerRequestId,
512
- truncatedValue: getTextPart(result.message.content)
513
- };
514
- case FinishedCompletionReason.ServerError:
515
- return {
516
- type: ChatFetchResponseType.Failed,
517
- reason: 'Server error. Stream terminated',
518
- requestId: requestId,
519
- serverRequestId: result.requestId.headerRequestId,
520
- streamError: result.error
521
- };
522
- }
523
- return {
524
- type: ChatFetchResponseType.Unknown,
525
- reason: 'Response contained no choices.',
526
- requestId: requestId,
527
- serverRequestId: result?.requestId.headerRequestId,
528
- };
529
- }
530
-
531
- private filterImageMessages(messages: Raw.ChatMessage[]): boolean {
532
- return messages?.some(m => Array.isArray(m.content) ? m.content.some(c => 'imageUrl' in c) : false);
533
- }
534
-
535
- private isRepetitive(chatCompletion: ChatCompletion, telemetryProperties?: TelemetryProperties) {
536
- const lineRepetitionStats = calculateLineRepetitionStats(getTextPart(chatCompletion.message.content));
537
- const hasRepetition = isRepetitive(chatCompletion.tokens);
538
- if (hasRepetition) {
539
- const telemetryData = TelemetryData.createAndMarkAsIssued();
540
- telemetryData.extendWithRequestId(chatCompletion.requestId);
541
- const extended = telemetryData.extendedBy(telemetryProperties);
542
- this._telemetryService.sendEnhancedGHTelemetryEvent('conversation.repetition.detected', extended.properties, extended.measurements);
543
- }
544
- if (lineRepetitionStats.numberOfRepetitions >= 10) {
545
- /* __GDPR__
546
- "conversation.repetition.detected" : {
547
- "owner": "lramos15",
548
- "comment": "Calculates the number of repetitions in a response. Useful for loop detection",
549
- "finishReason": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Reason for why a response finished. Helps identify cancellation vs length limits" },
550
- "requestId": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "comment": "Id for this message request." },
551
- "lengthOfLine": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true, "comment": "Length of the repeating line, in characters." },
552
- "numberOfRepetitions": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true, "comment": "Number of times the line repeats." },
553
- "totalLines": { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth", "isMeasurement": true, "comment": "Number of total lines in the response." }
554
- }
555
- */
556
- this._telemetryService.sendMSFTTelemetryEvent('conversation.repetition.detected', {
557
- requestId: chatCompletion.requestId.headerRequestId,
558
- finishReason: chatCompletion.finishReason,
559
- }, {
560
- numberOfRepetitions: lineRepetitionStats.numberOfRepetitions,
561
- lengthOfLine: lineRepetitionStats.mostRepeatedLine.length,
562
- totalLines: lineRepetitionStats.totalLines
563
- });
564
- }
565
- return hasRepetition;
566
- }
567
-
568
- private processCanceledResponse(response: ChatRequestCanceled, requestId: string): ChatResponses {
569
- return {
570
- type: ChatFetchResponseType.Canceled,
571
- reason: response.reason,
572
- requestId: requestId,
573
- serverRequestId: undefined,
574
- };
575
- }
576
-
577
- private processFailedResponse(response: ChatRequestFailed, requestId: string): ChatFetchError {
578
- const serverRequestId = response.modelRequestId?.headerRequestId;
579
- const reason = response.reason;
580
- if (response.failKind === ChatFailKind.RateLimited) {
581
- return { type: ChatFetchResponseType.RateLimited, reason, requestId, serverRequestId, retryAfter: response.data?.retryAfter, rateLimitKey: (response.data?.rateLimitKey || ''), capiError: response.data?.capiError };
582
- }
583
- if (response.failKind === ChatFailKind.QuotaExceeded) {
584
- return { type: ChatFetchResponseType.QuotaExceeded, reason, requestId, serverRequestId, retryAfter: response.data?.retryAfter, capiError: response.data?.capiError };
585
- }
586
- if (response.failKind === ChatFailKind.OffTopic) {
587
- return { type: ChatFetchResponseType.OffTopic, reason, requestId, serverRequestId };
588
- }
589
- if (response.failKind === ChatFailKind.TokenExpiredOrInvalid || response.failKind === ChatFailKind.ClientNotSupported || reason.includes('Bad request: ')) {
590
- return { type: ChatFetchResponseType.BadRequest, reason, requestId, serverRequestId };
591
- }
592
- if (response.failKind === ChatFailKind.ServerError) {
593
- return { type: ChatFetchResponseType.Failed, reason, requestId, serverRequestId };
594
- }
595
- if (response.failKind === ChatFailKind.ContentFilter) {
596
- return { type: ChatFetchResponseType.PromptFiltered, reason, category: FilterReason.Prompt, requestId, serverRequestId };
597
- }
598
- if (response.failKind === ChatFailKind.AgentUnauthorized) {
599
- return { type: ChatFetchResponseType.AgentUnauthorized, reason, authorizationUrl: response.data!.authorize_url, requestId, serverRequestId };
600
- }
601
- if (response.failKind === ChatFailKind.AgentFailedDependency) {
602
- return { type: ChatFetchResponseType.AgentFailedDependency, reason, requestId, serverRequestId };
603
- }
604
- if (response.failKind === ChatFailKind.ExtensionBlocked) {
605
- const retryAfter = typeof response.data?.retryAfter === 'number' ? response.data.retryAfter : 300;
606
- return { type: ChatFetchResponseType.ExtensionBlocked, reason, requestId, retryAfter, learnMoreLink: response.data?.learnMoreLink ?? '', serverRequestId };
607
- }
608
- if (response.failKind === ChatFailKind.NotFound) {
609
- return { type: ChatFetchResponseType.NotFound, reason, requestId, serverRequestId };
610
- }
611
- if (response.failKind === ChatFailKind.InvalidPreviousResponseId) {
612
- return { type: ChatFetchResponseType.InvalidStatefulMarker, reason, requestId, serverRequestId };
613
- }
614
-
615
- return { type: ChatFetchResponseType.Failed, reason, requestId, serverRequestId };
616
- }
617
-
618
- private processError(err: unknown, requestId: string): ChatFetchError {
619
- const fetcher = this._fetcherService;
620
- // If we cancelled a network request, we don't want to log an error
621
- if (fetcher.isAbortError(err)) {
622
- return {
623
- type: ChatFetchResponseType.Canceled,
624
- reason: 'network request aborted',
625
- requestId: requestId,
626
- serverRequestId: undefined,
627
- };
628
- }
629
- if (isCancellationError(err)) {
630
- return {
631
- type: ChatFetchResponseType.Canceled,
632
- reason: 'Got a cancellation error',
633
- requestId: requestId,
634
- serverRequestId: undefined,
635
- };
636
- }
637
- if (err && (
638
- (err instanceof Error && err.message === 'Premature close') ||
639
- (typeof err === 'object' && (err as any).code === 'ERR_STREAM_PREMATURE_CLOSE') /* to be extra sure */)
640
- ) {
641
- return {
642
- type: ChatFetchResponseType.Canceled,
643
- reason: 'Stream closed prematurely',
644
- requestId: requestId,
645
- serverRequestId: undefined,
646
- };
647
- }
648
- this._logService.error(errorsUtil.fromUnknown(err), `Error on conversation request`);
649
- this._telemetryService.sendGHTelemetryException(err, 'Error on conversation request');
650
- // this.logger.exception(err, `Error on conversation request`);
651
- if (fetcher.isInternetDisconnectedError(err)) {
652
- return {
653
- type: ChatFetchResponseType.NetworkError,
654
- reason: `It appears you're not connected to the internet, please check your network connection and try again.`,
655
- requestId: requestId,
656
- serverRequestId: undefined,
657
- };
658
- } else if (fetcher.isFetcherError(err)) {
659
- return {
660
- type: ChatFetchResponseType.NetworkError,
661
- reason: fetcher.getUserMessageForFetcherError(err),
662
- requestId: requestId,
663
- serverRequestId: undefined,
664
- };
665
- } else {
666
- return {
667
- type: ChatFetchResponseType.Failed,
668
- reason: 'Error on conversation request. Check the log for more details.',
669
- requestId: requestId,
670
- serverRequestId: undefined,
671
- };
672
- }
673
- }
674
- }
675
-
676
- /**
677
- * Validates a chat request payload to ensure it is valid
678
- * @param params The params being sent in the chat request
679
- * @returns Whether the chat payload is valid
680
- */
681
- function isValidChatPayload(messages: Raw.ChatMessage[], postOptions: OptionalChatRequestParams): { isValid: boolean; reason: string } {
682
- if (messages.length === 0) {
683
- return { isValid: false, reason: asUnexpected('No messages provided') };
684
- }
685
- if (postOptions?.max_tokens && postOptions?.max_tokens < 1) {
686
- return { isValid: false, reason: asUnexpected('Invalid response token parameter') };
687
- }
688
-
689
- const functionNamePattern = /^[a-zA-Z0-9_-]+$/;
690
- if (
691
- postOptions?.functions?.some(f => !f.name.match(functionNamePattern)) ||
692
- postOptions?.function_call?.name && !postOptions.function_call.name.match(functionNamePattern)
693
- ) {
694
- return { isValid: false, reason: asUnexpected('Function names must match ^[a-zA-Z0-9_-]+$') };
695
- }
696
-
697
- if (postOptions?.tools && postOptions.tools.length > HARD_TOOL_LIMIT) {
698
- return { isValid: false, reason: `Tool limit exceeded (${postOptions.tools.length}/${HARD_TOOL_LIMIT}). Click "Configure Tools" in the chat input to disable ${postOptions.tools.length - HARD_TOOL_LIMIT} tools and retry.` };
699
- }
700
-
701
- return { isValid: true, reason: '' };
702
- }
703
-
704
- function asUnexpected(reason: string) {
705
- return `Prompt failed validation with the reason: ${reason}. Please file an issue.`;
706
- }