@vscode/chat-lib 0.0.1

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 (1561) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +13 -0
  3. package/dist/src/_internal/extension/byok/node/openAIEndpoint.d.ts +32 -0
  4. package/dist/src/_internal/extension/byok/node/openAIEndpoint.d.ts.map +1 -0
  5. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js +159 -0
  6. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js.map +1 -0
  7. package/dist/src/_internal/extension/common/constants.d.ts +37 -0
  8. package/dist/src/_internal/extension/common/constants.d.ts.map +1 -0
  9. package/dist/src/_internal/extension/common/constants.js +59 -0
  10. package/dist/src/_internal/extension/common/constants.js.map +1 -0
  11. package/dist/src/_internal/extension/inlineEdits/common/delayer.d.ts +24 -0
  12. package/dist/src/_internal/extension/inlineEdits/common/delayer.d.ts.map +1 -0
  13. package/dist/src/_internal/extension/inlineEdits/common/delayer.js +100 -0
  14. package/dist/src/_internal/extension/inlineEdits/common/delayer.js.map +1 -0
  15. package/dist/src/_internal/extension/inlineEdits/common/editRebase.d.ts +19 -0
  16. package/dist/src/_internal/extension/inlineEdits/common/editRebase.d.ts.map +1 -0
  17. package/dist/src/_internal/extension/inlineEdits/common/editRebase.js +275 -0
  18. package/dist/src/_internal/extension/inlineEdits/common/editRebase.js.map +1 -0
  19. package/dist/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.d.ts +16 -0
  20. package/dist/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.d.ts.map +1 -0
  21. package/dist/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.js +147 -0
  22. package/dist/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.js.map +1 -0
  23. package/dist/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.d.ts +47 -0
  24. package/dist/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.d.ts.map +1 -0
  25. package/dist/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.js +189 -0
  26. package/dist/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.js.map +1 -0
  27. package/dist/src/_internal/extension/inlineEdits/common/rejectionCollector.d.ts +15 -0
  28. package/dist/src/_internal/extension/inlineEdits/common/rejectionCollector.d.ts.map +1 -0
  29. package/dist/src/_internal/extension/inlineEdits/common/rejectionCollector.js +137 -0
  30. package/dist/src/_internal/extension/inlineEdits/common/rejectionCollector.js.map +1 -0
  31. package/dist/src/_internal/extension/inlineEdits/node/debugRecorder.d.ts +18 -0
  32. package/dist/src/_internal/extension/inlineEdits/node/debugRecorder.d.ts.map +1 -0
  33. package/dist/src/_internal/extension/inlineEdits/node/debugRecorder.js +156 -0
  34. package/dist/src/_internal/extension/inlineEdits/node/debugRecorder.js.map +1 -0
  35. package/dist/src/_internal/extension/inlineEdits/node/importFiltering.d.ts +7 -0
  36. package/dist/src/_internal/extension/inlineEdits/node/importFiltering.d.ts.map +1 -0
  37. package/dist/src/_internal/extension/inlineEdits/node/importFiltering.js +24 -0
  38. package/dist/src/_internal/extension/inlineEdits/node/importFiltering.js.map +1 -0
  39. package/dist/src/_internal/extension/inlineEdits/node/nesConfigs.d.ts +8 -0
  40. package/dist/src/_internal/extension/inlineEdits/node/nesConfigs.d.ts.map +1 -0
  41. package/dist/src/_internal/extension/inlineEdits/node/nesConfigs.js +7 -0
  42. package/dist/src/_internal/extension/inlineEdits/node/nesConfigs.js.map +1 -0
  43. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.d.ts +47 -0
  44. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.d.ts.map +1 -0
  45. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.js +230 -0
  46. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.js.map +1 -0
  47. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts +73 -0
  48. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -0
  49. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +629 -0
  50. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -0
  51. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.d.ts +241 -0
  52. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.d.ts.map +1 -0
  53. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.js +680 -0
  54. package/dist/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.js.map +1 -0
  55. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.d.ts +38 -0
  56. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.d.ts.map +1 -0
  57. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.js +16 -0
  58. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.js.map +1 -0
  59. package/dist/src/_internal/extension/prompt/common/importStatement.d.ts +2 -0
  60. package/dist/src/_internal/extension/prompt/common/importStatement.d.ts.map +1 -0
  61. package/dist/src/_internal/extension/prompt/common/importStatement.js +28 -0
  62. package/dist/src/_internal/extension/prompt/common/importStatement.js.map +1 -0
  63. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +62 -0
  64. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -0
  65. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +639 -0
  66. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -0
  67. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.d.ts +42 -0
  68. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.d.ts.map +1 -0
  69. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.js +125 -0
  70. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.js.map +1 -0
  71. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.d.ts +60 -0
  72. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.d.ts.map +1 -0
  73. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.js +416 -0
  74. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.js.map +1 -0
  75. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.d.ts +30 -0
  76. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.d.ts.map +1 -0
  77. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.js +64 -0
  78. package/dist/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.js.map +1 -0
  79. package/dist/src/_internal/extension/prompts/node/inline/visualization.d.ts +26 -0
  80. package/dist/src/_internal/extension/prompts/node/inline/visualization.d.ts.map +1 -0
  81. package/dist/src/_internal/extension/prompts/node/inline/visualization.js +41 -0
  82. package/dist/src/_internal/extension/prompts/node/inline/visualization.js.map +1 -0
  83. package/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts +51 -0
  84. package/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts.map +1 -0
  85. package/dist/src/_internal/extension/xtab/common/promptCrafting.js +517 -0
  86. package/dist/src/_internal/extension/xtab/common/promptCrafting.js.map +1 -0
  87. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.d.ts +23 -0
  88. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.d.ts.map +1 -0
  89. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.js +96 -0
  90. package/dist/src/_internal/extension/xtab/node/xtabEndpoint.js.map +1 -0
  91. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts +75 -0
  92. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -0
  93. package/dist/src/_internal/extension/xtab/node/xtabProvider.js +796 -0
  94. package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -0
  95. package/dist/src/_internal/extension/xtab/node/xtabUtils.d.ts +8 -0
  96. package/dist/src/_internal/extension/xtab/node/xtabUtils.d.ts.map +1 -0
  97. package/dist/src/_internal/extension/xtab/node/xtabUtils.js +55 -0
  98. package/dist/src/_internal/extension/xtab/node/xtabUtils.js.map +1 -0
  99. package/dist/src/_internal/platform/authentication/common/authentication.d.ts +145 -0
  100. package/dist/src/_internal/platform/authentication/common/authentication.d.ts.map +1 -0
  101. package/dist/src/_internal/platform/authentication/common/authentication.js +156 -0
  102. package/dist/src/_internal/platform/authentication/common/authentication.js.map +1 -0
  103. package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts +190 -0
  104. package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts.map +1 -0
  105. package/dist/src/_internal/platform/authentication/common/copilotToken.js +181 -0
  106. package/dist/src/_internal/platform/authentication/common/copilotToken.js.map +1 -0
  107. package/dist/src/_internal/platform/authentication/common/copilotTokenManager.d.ts +50 -0
  108. package/dist/src/_internal/platform/authentication/common/copilotTokenManager.d.ts.map +1 -0
  109. package/dist/src/_internal/platform/authentication/common/copilotTokenManager.js +14 -0
  110. package/dist/src/_internal/platform/authentication/common/copilotTokenManager.js.map +1 -0
  111. package/dist/src/_internal/platform/authentication/common/copilotTokenStore.d.ts +23 -0
  112. package/dist/src/_internal/platform/authentication/common/copilotTokenStore.d.ts.map +1 -0
  113. package/dist/src/_internal/platform/authentication/common/copilotTokenStore.js +30 -0
  114. package/dist/src/_internal/platform/authentication/common/copilotTokenStore.js.map +1 -0
  115. package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.d.ts +23 -0
  116. package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.d.ts.map +1 -0
  117. package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js +92 -0
  118. package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js.map +1 -0
  119. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts +80 -0
  120. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts.map +1 -0
  121. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js +274 -0
  122. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js.map +1 -0
  123. package/dist/src/_internal/platform/chat/common/chatMLFetcher.d.ts +48 -0
  124. package/dist/src/_internal/platform/chat/common/chatMLFetcher.d.ts.map +1 -0
  125. package/dist/src/_internal/platform/chat/common/chatMLFetcher.js +77 -0
  126. package/dist/src/_internal/platform/chat/common/chatMLFetcher.js.map +1 -0
  127. package/dist/src/_internal/platform/chat/common/chatQuotaService.d.ts +54 -0
  128. package/dist/src/_internal/platform/chat/common/chatQuotaService.d.ts.map +1 -0
  129. package/dist/src/_internal/platform/chat/common/chatQuotaService.js +10 -0
  130. package/dist/src/_internal/platform/chat/common/chatQuotaService.js.map +1 -0
  131. package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.d.ts +16 -0
  132. package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.d.ts.map +1 -0
  133. package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.js +99 -0
  134. package/dist/src/_internal/platform/chat/common/chatQuotaServiceImpl.js.map +1 -0
  135. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts +264 -0
  136. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts.map +1 -0
  137. package/dist/src/_internal/platform/chat/common/commonTypes.js +299 -0
  138. package/dist/src/_internal/platform/chat/common/commonTypes.js.map +1 -0
  139. package/dist/src/_internal/platform/chat/common/conversationOptions.d.ts +9 -0
  140. package/dist/src/_internal/platform/chat/common/conversationOptions.d.ts.map +1 -0
  141. package/dist/src/_internal/platform/chat/common/conversationOptions.js +10 -0
  142. package/dist/src/_internal/platform/chat/common/conversationOptions.js.map +1 -0
  143. package/dist/src/_internal/platform/chat/common/globalStringUtils.d.ts +10 -0
  144. package/dist/src/_internal/platform/chat/common/globalStringUtils.d.ts.map +1 -0
  145. package/dist/src/_internal/platform/chat/common/globalStringUtils.js +52 -0
  146. package/dist/src/_internal/platform/chat/common/globalStringUtils.js.map +1 -0
  147. package/dist/src/_internal/platform/chat/common/interactionService.d.ts +18 -0
  148. package/dist/src/_internal/platform/chat/common/interactionService.d.ts.map +1 -0
  149. package/dist/src/_internal/platform/chat/common/interactionService.js +28 -0
  150. package/dist/src/_internal/platform/chat/common/interactionService.js.map +1 -0
  151. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +513 -0
  152. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -0
  153. package/dist/src/_internal/platform/configuration/common/configurationService.js +529 -0
  154. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -0
  155. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.d.ts +15 -0
  156. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.d.ts.map +1 -0
  157. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.js +33 -0
  158. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.js.map +1 -0
  159. package/dist/src/_internal/platform/configuration/common/jsonSchema.d.ts +94 -0
  160. package/dist/src/_internal/platform/configuration/common/jsonSchema.d.ts.map +1 -0
  161. package/dist/src/_internal/platform/configuration/common/jsonSchema.js +36 -0
  162. package/dist/src/_internal/platform/configuration/common/jsonSchema.js.map +1 -0
  163. package/dist/src/_internal/platform/configuration/common/validator.d.ts +35 -0
  164. package/dist/src/_internal/platform/configuration/common/validator.d.ts.map +1 -0
  165. package/dist/src/_internal/platform/configuration/common/validator.js +195 -0
  166. package/dist/src/_internal/platform/configuration/common/validator.js.map +1 -0
  167. package/dist/src/_internal/platform/diff/common/diffService.d.ts +27 -0
  168. package/dist/src/_internal/platform/diff/common/diffService.d.ts.map +1 -0
  169. package/dist/src/_internal/platform/diff/common/diffService.js +10 -0
  170. package/dist/src/_internal/platform/diff/common/diffService.js.map +1 -0
  171. package/dist/src/_internal/platform/diff/common/diffWorker.d.ts +34 -0
  172. package/dist/src/_internal/platform/diff/common/diffWorker.d.ts.map +1 -0
  173. package/dist/src/_internal/platform/diff/common/diffWorker.js +44 -0
  174. package/dist/src/_internal/platform/diff/common/diffWorker.js.map +1 -0
  175. package/dist/src/_internal/platform/diff/node/diffServiceImpl.d.ts +14 -0
  176. package/dist/src/_internal/platform/diff/node/diffServiceImpl.d.ts.map +1 -0
  177. package/dist/src/_internal/platform/diff/node/diffServiceImpl.js +95 -0
  178. package/dist/src/_internal/platform/diff/node/diffServiceImpl.js.map +1 -0
  179. package/dist/src/_internal/platform/editing/common/abstractText.d.ts +58 -0
  180. package/dist/src/_internal/platform/editing/common/abstractText.d.ts.map +1 -0
  181. package/dist/src/_internal/platform/editing/common/abstractText.js +129 -0
  182. package/dist/src/_internal/platform/editing/common/abstractText.js.map +1 -0
  183. package/dist/src/_internal/platform/editing/common/notebookDocumentSnapshot.d.ts +38 -0
  184. package/dist/src/_internal/platform/editing/common/notebookDocumentSnapshot.d.ts.map +1 -0
  185. package/dist/src/_internal/platform/editing/common/notebookDocumentSnapshot.js +96 -0
  186. package/dist/src/_internal/platform/editing/common/notebookDocumentSnapshot.js.map +1 -0
  187. package/dist/src/_internal/platform/editing/common/positionOffsetTransformer.d.ts +28 -0
  188. package/dist/src/_internal/platform/editing/common/positionOffsetTransformer.d.ts.map +1 -0
  189. package/dist/src/_internal/platform/editing/common/positionOffsetTransformer.js +158 -0
  190. package/dist/src/_internal/platform/editing/common/positionOffsetTransformer.js.map +1 -0
  191. package/dist/src/_internal/platform/editing/common/textDocumentSnapshot.d.ts +55 -0
  192. package/dist/src/_internal/platform/editing/common/textDocumentSnapshot.d.ts.map +1 -0
  193. package/dist/src/_internal/platform/editing/common/textDocumentSnapshot.js +195 -0
  194. package/dist/src/_internal/platform/editing/common/textDocumentSnapshot.js.map +1 -0
  195. package/dist/src/_internal/platform/endpoint/common/capiClient.d.ts +15 -0
  196. package/dist/src/_internal/platform/endpoint/common/capiClient.d.ts.map +1 -0
  197. package/dist/src/_internal/platform/endpoint/common/capiClient.js +25 -0
  198. package/dist/src/_internal/platform/endpoint/common/capiClient.js.map +1 -0
  199. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts +55 -0
  200. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -0
  201. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +111 -0
  202. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -0
  203. package/dist/src/_internal/platform/endpoint/common/domainService.d.ts +18 -0
  204. package/dist/src/_internal/platform/endpoint/common/domainService.d.ts.map +1 -0
  205. package/dist/src/_internal/platform/endpoint/common/domainService.js +12 -0
  206. package/dist/src/_internal/platform/endpoint/common/domainService.js.map +1 -0
  207. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts +83 -0
  208. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts.map +1 -0
  209. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js +23 -0
  210. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js.map +1 -0
  211. package/dist/src/_internal/platform/endpoint/common/endpointTypes.d.ts +7 -0
  212. package/dist/src/_internal/platform/endpoint/common/endpointTypes.d.ts.map +1 -0
  213. package/dist/src/_internal/platform/endpoint/common/endpointTypes.js +15 -0
  214. package/dist/src/_internal/platform/endpoint/common/endpointTypes.js.map +1 -0
  215. package/dist/src/_internal/platform/endpoint/common/licenseAgreement.d.ts +7 -0
  216. package/dist/src/_internal/platform/endpoint/common/licenseAgreement.d.ts.map +1 -0
  217. package/dist/src/_internal/platform/endpoint/common/licenseAgreement.js +14 -0
  218. package/dist/src/_internal/platform/endpoint/common/licenseAgreement.js.map +1 -0
  219. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.d.ts +31 -0
  220. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.d.ts.map +1 -0
  221. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.js +73 -0
  222. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.js.map +1 -0
  223. package/dist/src/_internal/platform/endpoint/common/thinkingDataContainer.d.ts +17 -0
  224. package/dist/src/_internal/platform/endpoint/common/thinkingDataContainer.d.ts.map +1 -0
  225. package/dist/src/_internal/platform/endpoint/common/thinkingDataContainer.js +37 -0
  226. package/dist/src/_internal/platform/endpoint/common/thinkingDataContainer.js.map +1 -0
  227. package/dist/src/_internal/platform/endpoint/node/capiClientImpl.d.ts +7 -0
  228. package/dist/src/_internal/platform/endpoint/node/capiClientImpl.d.ts.map +1 -0
  229. package/dist/src/_internal/platform/endpoint/node/capiClientImpl.js +30 -0
  230. package/dist/src/_internal/platform/endpoint/node/capiClientImpl.js.map +1 -0
  231. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts +90 -0
  232. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -0
  233. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +349 -0
  234. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -0
  235. package/dist/src/_internal/platform/endpoint/node/domainServiceImpl.d.ts +19 -0
  236. package/dist/src/_internal/platform/endpoint/node/domainServiceImpl.d.ts.map +1 -0
  237. package/dist/src/_internal/platform/endpoint/node/domainServiceImpl.js +80 -0
  238. package/dist/src/_internal/platform/endpoint/node/domainServiceImpl.js.map +1 -0
  239. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.d.ts +4 -0
  240. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.d.ts.map +1 -0
  241. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.js +39 -0
  242. package/dist/src/_internal/platform/endpoint/node/proxyXtabEndpoint.js.map +1 -0
  243. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts +13 -0
  244. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -0
  245. package/dist/src/_internal/platform/endpoint/node/responsesApi.js +308 -0
  246. package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -0
  247. package/dist/src/_internal/platform/env/common/envService.d.ts +84 -0
  248. package/dist/src/_internal/platform/env/common/envService.d.ts.map +1 -0
  249. package/dist/src/_internal/platform/env/common/envService.js +64 -0
  250. package/dist/src/_internal/platform/env/common/envService.js.map +1 -0
  251. package/dist/src/_internal/platform/env/common/nullEnvService.d.ts +21 -0
  252. package/dist/src/_internal/platform/env/common/nullEnvService.d.ts.map +1 -0
  253. package/dist/src/_internal/platform/env/common/nullEnvService.js +57 -0
  254. package/dist/src/_internal/platform/env/common/nullEnvService.js.map +1 -0
  255. package/dist/src/_internal/platform/env/common/packagejson.d.ts +42 -0
  256. package/dist/src/_internal/platform/env/common/packagejson.d.ts.map +1 -0
  257. package/dist/src/_internal/platform/env/common/packagejson.js +12 -0
  258. package/dist/src/_internal/platform/env/common/packagejson.js.map +1 -0
  259. package/dist/src/_internal/platform/git/common/gitExtensionService.d.ts +12 -0
  260. package/dist/src/_internal/platform/git/common/gitExtensionService.d.ts.map +1 -0
  261. package/dist/src/_internal/platform/git/common/gitExtensionService.js +10 -0
  262. package/dist/src/_internal/platform/git/common/gitExtensionService.js.map +1 -0
  263. package/dist/src/_internal/platform/git/common/nullGitExtensionService.d.ts +11 -0
  264. package/dist/src/_internal/platform/git/common/nullGitExtensionService.d.ts.map +1 -0
  265. package/dist/src/_internal/platform/git/common/nullGitExtensionService.js +19 -0
  266. package/dist/src/_internal/platform/git/common/nullGitExtensionService.js.map +1 -0
  267. package/dist/src/_internal/platform/github/common/githubAPI.d.ts +7 -0
  268. package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -0
  269. package/dist/src/_internal/platform/github/common/githubAPI.js +42 -0
  270. package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -0
  271. package/dist/src/_internal/platform/github/common/githubService.d.ts +63 -0
  272. package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -0
  273. package/dist/src/_internal/platform/github/common/githubService.js +37 -0
  274. package/dist/src/_internal/platform/github/common/githubService.js.map +1 -0
  275. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts +9 -0
  276. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.d.ts.map +1 -0
  277. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js +21 -0
  278. package/dist/src/_internal/platform/github/common/nullOctokitServiceImpl.js.map +1 -0
  279. package/dist/src/_internal/platform/ignore/common/ignoreService.d.ts +30 -0
  280. package/dist/src/_internal/platform/ignore/common/ignoreService.d.ts.map +1 -0
  281. package/dist/src/_internal/platform/ignore/common/ignoreService.js +73 -0
  282. package/dist/src/_internal/platform/ignore/common/ignoreService.js.map +1 -0
  283. package/dist/src/_internal/platform/inlineCompletions/common/api.d.ts +162 -0
  284. package/dist/src/_internal/platform/inlineCompletions/common/api.d.ts.map +1 -0
  285. package/dist/src/_internal/platform/inlineCompletions/common/api.js +3 -0
  286. package/dist/src/_internal/platform/inlineCompletions/common/api.js.map +1 -0
  287. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.d.ts +14 -0
  288. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.d.ts.map +1 -0
  289. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.js +31 -0
  290. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.js.map +1 -0
  291. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/documentId.d.ts +20 -0
  292. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/documentId.d.ts.map +1 -0
  293. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/documentId.js +44 -0
  294. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/documentId.js.map +1 -0
  295. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/edit.d.ts +73 -0
  296. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/edit.d.ts.map +1 -0
  297. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/edit.js +142 -0
  298. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/edit.js.map +1 -0
  299. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.d.ts +14 -0
  300. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.d.ts.map +1 -0
  301. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.js +59 -0
  302. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.js.map +1 -0
  303. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.d.ts +6 -0
  304. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.d.ts.map +1 -0
  305. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.js +16 -0
  306. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.js.map +1 -0
  307. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.d.ts +44 -0
  308. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.d.ts.map +1 -0
  309. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.js +57 -0
  310. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.js.map +1 -0
  311. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageId.d.ts +8 -0
  312. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageId.d.ts.map +1 -0
  313. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageId.js +16 -0
  314. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageId.js.map +1 -0
  315. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/permutation.d.ts +36 -0
  316. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/permutation.d.ts.map +1 -0
  317. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/permutation.js +68 -0
  318. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/permutation.js.map +1 -0
  319. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.d.ts +16 -0
  320. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.d.ts.map +1 -0
  321. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.js +42 -0
  322. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.js.map +1 -0
  323. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.d.ts +24 -0
  324. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.d.ts.map +1 -0
  325. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.js +62 -0
  326. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.js.map +1 -0
  327. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.d.ts +3 -0
  328. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.d.ts.map +1 -0
  329. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.js +125 -0
  330. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.js.map +1 -0
  331. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.d.ts +46 -0
  332. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.d.ts.map +1 -0
  333. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.js +171 -0
  334. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.js.map +1 -0
  335. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.d.ts +9 -0
  336. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.d.ts.map +1 -0
  337. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.js +32 -0
  338. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.js.map +1 -0
  339. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts +50 -0
  340. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts.map +1 -0
  341. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js +54 -0
  342. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js.map +1 -0
  343. package/dist/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.d.ts +5 -0
  344. package/dist/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.d.ts.map +1 -0
  345. package/dist/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.js +14 -0
  346. package/dist/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.js.map +1 -0
  347. package/dist/src/_internal/platform/inlineEdits/common/editReason.d.ts +98 -0
  348. package/dist/src/_internal/platform/inlineEdits/common/editReason.d.ts.map +1 -0
  349. package/dist/src/_internal/platform/inlineEdits/common/editReason.js +111 -0
  350. package/dist/src/_internal/platform/inlineEdits/common/editReason.js.map +1 -0
  351. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts +132 -0
  352. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts.map +1 -0
  353. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js +398 -0
  354. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js.map +1 -0
  355. package/dist/src/_internal/platform/inlineEdits/common/observableGit.d.ts +11 -0
  356. package/dist/src/_internal/platform/inlineEdits/common/observableGit.d.ts.map +1 -0
  357. package/dist/src/_internal/platform/inlineEdits/common/observableGit.js +50 -0
  358. package/dist/src/_internal/platform/inlineEdits/common/observableGit.js.map +1 -0
  359. package/dist/src/_internal/platform/inlineEdits/common/observableWorkspace.d.ts +90 -0
  360. package/dist/src/_internal/platform/inlineEdits/common/observableWorkspace.d.ts.map +1 -0
  361. package/dist/src/_internal/platform/inlineEdits/common/observableWorkspace.js +169 -0
  362. package/dist/src/_internal/platform/inlineEdits/common/observableWorkspace.js.map +1 -0
  363. package/dist/src/_internal/platform/inlineEdits/common/responseProcessor.d.ts +34 -0
  364. package/dist/src/_internal/platform/inlineEdits/common/responseProcessor.d.ts.map +1 -0
  365. package/dist/src/_internal/platform/inlineEdits/common/responseProcessor.js +185 -0
  366. package/dist/src/_internal/platform/inlineEdits/common/responseProcessor.js.map +1 -0
  367. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts +223 -0
  368. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts.map +1 -0
  369. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js +315 -0
  370. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js.map +1 -0
  371. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.d.ts +14 -0
  372. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.d.ts.map +1 -0
  373. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.js +53 -0
  374. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.js.map +1 -0
  375. package/dist/src/_internal/platform/inlineEdits/common/utils/observable.d.ts +16 -0
  376. package/dist/src/_internal/platform/inlineEdits/common/utils/observable.d.ts.map +1 -0
  377. package/dist/src/_internal/platform/inlineEdits/common/utils/observable.js +38 -0
  378. package/dist/src/_internal/platform/inlineEdits/common/utils/observable.js.map +1 -0
  379. package/dist/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.d.ts +3 -0
  380. package/dist/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.d.ts.map +1 -0
  381. package/dist/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.js +26 -0
  382. package/dist/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.js.map +1 -0
  383. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.d.ts +19 -0
  384. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.d.ts.map +1 -0
  385. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.js +44 -0
  386. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.js.map +1 -0
  387. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.d.ts +45 -0
  388. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.d.ts.map +1 -0
  389. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.js +49 -0
  390. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.js.map +1 -0
  391. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.d.ts +17 -0
  392. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.d.ts.map +1 -0
  393. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.js +300 -0
  394. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.js.map +1 -0
  395. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.d.ts +37 -0
  396. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.d.ts.map +1 -0
  397. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.js +116 -0
  398. package/dist/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.js.map +1 -0
  399. package/dist/src/_internal/platform/languageContextProvider/common/languageContextProviderService.d.ts +13 -0
  400. package/dist/src/_internal/platform/languageContextProvider/common/languageContextProviderService.d.ts.map +1 -0
  401. package/dist/src/_internal/platform/languageContextProvider/common/languageContextProviderService.js +10 -0
  402. package/dist/src/_internal/platform/languageContextProvider/common/languageContextProviderService.js.map +1 -0
  403. package/dist/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.d.ts +13 -0
  404. package/dist/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.d.ts.map +1 -0
  405. package/dist/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.js +31 -0
  406. package/dist/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.js.map +1 -0
  407. package/dist/src/_internal/platform/languageServer/common/languageContextService.d.ts +146 -0
  408. package/dist/src/_internal/platform/languageServer/common/languageContextService.d.ts.map +1 -0
  409. package/dist/src/_internal/platform/languageServer/common/languageContextService.js +42 -0
  410. package/dist/src/_internal/platform/languageServer/common/languageContextService.js.map +1 -0
  411. package/dist/src/_internal/platform/languages/common/languageDiagnosticsService.d.ts +26 -0
  412. package/dist/src/_internal/platform/languages/common/languageDiagnosticsService.d.ts.map +1 -0
  413. package/dist/src/_internal/platform/languages/common/languageDiagnosticsService.js +53 -0
  414. package/dist/src/_internal/platform/languages/common/languageDiagnosticsService.js.map +1 -0
  415. package/dist/src/_internal/platform/languages/common/testLanguageDiagnosticsService.d.ts +11 -0
  416. package/dist/src/_internal/platform/languages/common/testLanguageDiagnosticsService.d.ts.map +1 -0
  417. package/dist/src/_internal/platform/languages/common/testLanguageDiagnosticsService.js +30 -0
  418. package/dist/src/_internal/platform/languages/common/testLanguageDiagnosticsService.js.map +1 -0
  419. package/dist/src/_internal/platform/log/common/logService.d.ts +100 -0
  420. package/dist/src/_internal/platform/log/common/logService.d.ts.map +1 -0
  421. package/dist/src/_internal/platform/log/common/logService.js +178 -0
  422. package/dist/src/_internal/platform/log/common/logService.js.map +1 -0
  423. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.d.ts +69 -0
  424. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.d.ts.map +1 -0
  425. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.js +23 -0
  426. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.js.map +1 -0
  427. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.d.ts +80 -0
  428. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.d.ts.map +1 -0
  429. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.js +77 -0
  430. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.js.map +1 -0
  431. package/dist/src/_internal/platform/nesFetch/common/responseStream.d.ts +26 -0
  432. package/dist/src/_internal/platform/nesFetch/common/responseStream.d.ts.map +1 -0
  433. package/dist/src/_internal/platform/nesFetch/common/responseStream.js +125 -0
  434. package/dist/src/_internal/platform/nesFetch/common/responseStream.js.map +1 -0
  435. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts +27 -0
  436. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts.map +1 -0
  437. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js +222 -0
  438. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js.map +1 -0
  439. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.d.ts +10 -0
  440. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.d.ts.map +1 -0
  441. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.js +86 -0
  442. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.js.map +1 -0
  443. package/dist/src/_internal/platform/networking/common/fetch.d.ts +256 -0
  444. package/dist/src/_internal/platform/networking/common/fetch.d.ts.map +1 -0
  445. package/dist/src/_internal/platform/networking/common/fetch.js +51 -0
  446. package/dist/src/_internal/platform/networking/common/fetch.js.map +1 -0
  447. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts +53 -0
  448. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts.map +1 -0
  449. package/dist/src/_internal/platform/networking/common/fetcherService.js +46 -0
  450. package/dist/src/_internal/platform/networking/common/fetcherService.js.map +1 -0
  451. package/dist/src/_internal/platform/networking/common/networking.d.ts +213 -0
  452. package/dist/src/_internal/platform/networking/common/networking.d.ts.map +1 -0
  453. package/dist/src/_internal/platform/networking/common/networking.js +148 -0
  454. package/dist/src/_internal/platform/networking/common/networking.js.map +1 -0
  455. package/dist/src/_internal/platform/networking/common/openai.d.ts +202 -0
  456. package/dist/src/_internal/platform/networking/common/openai.d.ts.map +1 -0
  457. package/dist/src/_internal/platform/networking/common/openai.js +144 -0
  458. package/dist/src/_internal/platform/networking/common/openai.js.map +1 -0
  459. package/dist/src/_internal/platform/networking/node/chatStream.d.ts +9 -0
  460. package/dist/src/_internal/platform/networking/node/chatStream.d.ts.map +1 -0
  461. package/dist/src/_internal/platform/networking/node/chatStream.js +117 -0
  462. package/dist/src/_internal/platform/networking/node/chatStream.js.map +1 -0
  463. package/dist/src/_internal/platform/networking/node/stream.d.ts +145 -0
  464. package/dist/src/_internal/platform/networking/node/stream.d.ts.map +1 -0
  465. package/dist/src/_internal/platform/networking/node/stream.js +595 -0
  466. package/dist/src/_internal/platform/networking/node/stream.js.map +1 -0
  467. package/dist/src/_internal/platform/notebook/common/alternativeContent.d.ts +28 -0
  468. package/dist/src/_internal/platform/notebook/common/alternativeContent.d.ts.map +1 -0
  469. package/dist/src/_internal/platform/notebook/common/alternativeContent.js +85 -0
  470. package/dist/src/_internal/platform/notebook/common/alternativeContent.js.map +1 -0
  471. package/dist/src/_internal/platform/notebook/common/alternativeContentFormat.d.ts +6 -0
  472. package/dist/src/_internal/platform/notebook/common/alternativeContentFormat.d.ts.map +1 -0
  473. package/dist/src/_internal/platform/notebook/common/alternativeContentFormat.js +14 -0
  474. package/dist/src/_internal/platform/notebook/common/alternativeContentFormat.js.map +1 -0
  475. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.d.ts +31 -0
  476. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.d.ts.map +1 -0
  477. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.js +14 -0
  478. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.js.map +1 -0
  479. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.json.d.ts +15 -0
  480. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.json.d.ts.map +1 -0
  481. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.json.js +232 -0
  482. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.json.js.map +1 -0
  483. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.text.d.ts +16 -0
  484. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.text.d.ts.map +1 -0
  485. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.text.js +231 -0
  486. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.text.js.map +1 -0
  487. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.xml.d.ts +13 -0
  488. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.xml.d.ts.map +1 -0
  489. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.xml.js +191 -0
  490. package/dist/src/_internal/platform/notebook/common/alternativeContentProvider.xml.js.map +1 -0
  491. package/dist/src/_internal/platform/notebook/common/alternativeNotebookDocument.d.ts +34 -0
  492. package/dist/src/_internal/platform/notebook/common/alternativeNotebookDocument.d.ts.map +1 -0
  493. package/dist/src/_internal/platform/notebook/common/alternativeNotebookDocument.js +123 -0
  494. package/dist/src/_internal/platform/notebook/common/alternativeNotebookDocument.js.map +1 -0
  495. package/dist/src/_internal/platform/notebook/common/helpers.d.ts +79 -0
  496. package/dist/src/_internal/platform/notebook/common/helpers.d.ts.map +1 -0
  497. package/dist/src/_internal/platform/notebook/common/helpers.js +157 -0
  498. package/dist/src/_internal/platform/notebook/common/helpers.js.map +1 -0
  499. package/dist/src/_internal/platform/notebook/common/notebookService.d.ts +34 -0
  500. package/dist/src/_internal/platform/notebook/common/notebookService.d.ts.map +1 -0
  501. package/dist/src/_internal/platform/notebook/common/notebookService.js +10 -0
  502. package/dist/src/_internal/platform/notebook/common/notebookService.js.map +1 -0
  503. package/dist/src/_internal/platform/openai/node/fetch.d.ts +77 -0
  504. package/dist/src/_internal/platform/openai/node/fetch.d.ts.map +1 -0
  505. package/dist/src/_internal/platform/openai/node/fetch.js +408 -0
  506. package/dist/src/_internal/platform/openai/node/fetch.js.map +1 -0
  507. package/dist/src/_internal/platform/parser/node/nodes.d.ts +93 -0
  508. package/dist/src/_internal/platform/parser/node/nodes.d.ts.map +1 -0
  509. package/dist/src/_internal/platform/parser/node/nodes.js +133 -0
  510. package/dist/src/_internal/platform/parser/node/nodes.js.map +1 -0
  511. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts +14 -0
  512. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts.map +1 -0
  513. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js +28 -0
  514. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js.map +1 -0
  515. package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts +198 -0
  516. package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts.map +1 -0
  517. package/dist/src/_internal/platform/requestLogger/node/requestLogger.js +177 -0
  518. package/dist/src/_internal/platform/requestLogger/node/requestLogger.js.map +1 -0
  519. package/dist/src/_internal/platform/simulationTestContext/common/simulationTestContext.d.ts +12 -0
  520. package/dist/src/_internal/platform/simulationTestContext/common/simulationTestContext.d.ts.map +1 -0
  521. package/dist/src/_internal/platform/simulationTestContext/common/simulationTestContext.js +19 -0
  522. package/dist/src/_internal/platform/simulationTestContext/common/simulationTestContext.js.map +1 -0
  523. package/dist/src/_internal/platform/snippy/common/snippyService.d.ts +13 -0
  524. package/dist/src/_internal/platform/snippy/common/snippyService.d.ts.map +1 -0
  525. package/dist/src/_internal/platform/snippy/common/snippyService.js +16 -0
  526. package/dist/src/_internal/platform/snippy/common/snippyService.js.map +1 -0
  527. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.d.ts +46 -0
  528. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.d.ts.map +1 -0
  529. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.js +23 -0
  530. package/dist/src/_internal/platform/telemetry/common/nullExperimentationService.js.map +1 -0
  531. package/dist/src/_internal/platform/telemetry/common/nullTelemetryService.d.ts +18 -0
  532. package/dist/src/_internal/platform/telemetry/common/nullTelemetryService.d.ts.map +1 -0
  533. package/dist/src/_internal/platform/telemetry/common/nullTelemetryService.js +50 -0
  534. package/dist/src/_internal/platform/telemetry/common/nullTelemetryService.js.map +1 -0
  535. package/dist/src/_internal/platform/telemetry/common/telemetry.d.ts +145 -0
  536. package/dist/src/_internal/platform/telemetry/common/telemetry.d.ts.map +1 -0
  537. package/dist/src/_internal/platform/telemetry/common/telemetry.js +87 -0
  538. package/dist/src/_internal/platform/telemetry/common/telemetry.js.map +1 -0
  539. package/dist/src/_internal/platform/telemetry/common/telemetryData.d.ts +60 -0
  540. package/dist/src/_internal/platform/telemetry/common/telemetryData.d.ts.map +1 -0
  541. package/dist/src/_internal/platform/telemetry/common/telemetryData.js +169 -0
  542. package/dist/src/_internal/platform/telemetry/common/telemetryData.js.map +1 -0
  543. package/dist/src/_internal/platform/thinking/common/thinking.d.ts +49 -0
  544. package/dist/src/_internal/platform/thinking/common/thinking.d.ts.map +1 -0
  545. package/dist/src/_internal/platform/thinking/common/thinking.js +11 -0
  546. package/dist/src/_internal/platform/thinking/common/thinking.js.map +1 -0
  547. package/dist/src/_internal/platform/thinking/common/thinkingUtils.d.ts +6 -0
  548. package/dist/src/_internal/platform/thinking/common/thinkingUtils.d.ts.map +1 -0
  549. package/dist/src/_internal/platform/thinking/common/thinkingUtils.js +56 -0
  550. package/dist/src/_internal/platform/thinking/common/thinkingUtils.js.map +1 -0
  551. package/dist/src/_internal/platform/tokenizer/node/cl100k_base.tiktoken +100256 -0
  552. package/dist/src/_internal/platform/tokenizer/node/o200k_base.tiktoken +199998 -0
  553. package/dist/src/_internal/platform/tokenizer/node/parseTikTokens.d.ts +3 -0
  554. package/dist/src/_internal/platform/tokenizer/node/parseTikTokens.d.ts.map +1 -0
  555. package/dist/src/_internal/platform/tokenizer/node/parseTikTokens.js +24 -0
  556. package/dist/src/_internal/platform/tokenizer/node/parseTikTokens.js.map +1 -0
  557. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerImpl.d.ts +17 -0
  558. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerImpl.d.ts.map +1 -0
  559. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerImpl.js +58 -0
  560. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerImpl.js.map +1 -0
  561. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerWorker.d.ts +2 -0
  562. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerWorker.d.ts.map +1 -0
  563. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerWorker.js +25 -0
  564. package/dist/src/_internal/platform/tokenizer/node/tikTokenizerWorker.js.map +1 -0
  565. package/dist/src/_internal/platform/tokenizer/node/tokenizer.d.ts +32 -0
  566. package/dist/src/_internal/platform/tokenizer/node/tokenizer.d.ts.map +1 -0
  567. package/dist/src/_internal/platform/tokenizer/node/tokenizer.js +308 -0
  568. package/dist/src/_internal/platform/tokenizer/node/tokenizer.js.map +1 -0
  569. package/dist/src/_internal/platform/workspace/common/workspaceService.d.ts +104 -0
  570. package/dist/src/_internal/platform/workspace/common/workspaceService.d.ts.map +1 -0
  571. package/dist/src/_internal/platform/workspace/common/workspaceService.js +176 -0
  572. package/dist/src/_internal/platform/workspace/common/workspaceService.js.map +1 -0
  573. package/dist/src/_internal/platform/workspaceRecorder/common/workspaceLog.d.ts +115 -0
  574. package/dist/src/_internal/platform/workspaceRecorder/common/workspaceLog.d.ts.map +1 -0
  575. package/dist/src/_internal/platform/workspaceRecorder/common/workspaceLog.js +33 -0
  576. package/dist/src/_internal/platform/workspaceRecorder/common/workspaceLog.js.map +1 -0
  577. package/dist/src/_internal/util/common/anomalyDetection.d.ts +16 -0
  578. package/dist/src/_internal/util/common/anomalyDetection.d.ts.map +1 -0
  579. package/dist/src/_internal/util/common/anomalyDetection.js +100 -0
  580. package/dist/src/_internal/util/common/anomalyDetection.js.map +1 -0
  581. package/dist/src/_internal/util/common/arrays.d.ts +18 -0
  582. package/dist/src/_internal/util/common/arrays.d.ts.map +1 -0
  583. package/dist/src/_internal/util/common/arrays.js +80 -0
  584. package/dist/src/_internal/util/common/arrays.js.map +1 -0
  585. package/dist/src/_internal/util/common/async.d.ts +35 -0
  586. package/dist/src/_internal/util/common/async.d.ts.map +1 -0
  587. package/dist/src/_internal/util/common/async.js +146 -0
  588. package/dist/src/_internal/util/common/async.js.map +1 -0
  589. package/dist/src/_internal/util/common/cache.d.ts +42 -0
  590. package/dist/src/_internal/util/common/cache.d.ts.map +1 -0
  591. package/dist/src/_internal/util/common/cache.js +157 -0
  592. package/dist/src/_internal/util/common/cache.js.map +1 -0
  593. package/dist/src/_internal/util/common/crypto.d.ts +3 -0
  594. package/dist/src/_internal/util/common/crypto.d.ts.map +1 -0
  595. package/dist/src/_internal/util/common/crypto.js +33 -0
  596. package/dist/src/_internal/util/common/crypto.js.map +1 -0
  597. package/dist/src/_internal/util/common/errors.d.ts +3 -0
  598. package/dist/src/_internal/util/common/errors.d.ts.map +1 -0
  599. package/dist/src/_internal/util/common/errors.js +22 -0
  600. package/dist/src/_internal/util/common/errors.js.map +1 -0
  601. package/dist/src/_internal/util/common/imageUtils.d.ts +23 -0
  602. package/dist/src/_internal/util/common/imageUtils.d.ts.map +1 -0
  603. package/dist/src/_internal/util/common/imageUtils.js +148 -0
  604. package/dist/src/_internal/util/common/imageUtils.js.map +1 -0
  605. package/dist/src/_internal/util/common/languages.d.ts +560 -0
  606. package/dist/src/_internal/util/common/languages.d.ts.map +1 -0
  607. package/dist/src/_internal/util/common/languages.js +901 -0
  608. package/dist/src/_internal/util/common/languages.js.map +1 -0
  609. package/dist/src/_internal/util/common/notebooks.d.ts +88 -0
  610. package/dist/src/_internal/util/common/notebooks.d.ts.map +1 -0
  611. package/dist/src/_internal/util/common/notebooks.js +270 -0
  612. package/dist/src/_internal/util/common/notebooks.js.map +1 -0
  613. package/dist/src/_internal/util/common/result.d.ts +32 -0
  614. package/dist/src/_internal/util/common/result.d.ts.map +1 -0
  615. package/dist/src/_internal/util/common/result.js +65 -0
  616. package/dist/src/_internal/util/common/result.js.map +1 -0
  617. package/dist/src/_internal/util/common/services.d.ts +17 -0
  618. package/dist/src/_internal/util/common/services.d.ts.map +1 -0
  619. package/dist/src/_internal/util/common/services.js +32 -0
  620. package/dist/src/_internal/util/common/services.js.map +1 -0
  621. package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts +301 -0
  622. package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts.map +1 -0
  623. package/dist/src/_internal/util/common/test/shims/chatTypes.js +380 -0
  624. package/dist/src/_internal/util/common/test/shims/chatTypes.js.map +1 -0
  625. package/dist/src/_internal/util/common/test/shims/editing.d.ts +101 -0
  626. package/dist/src/_internal/util/common/test/shims/editing.d.ts.map +1 -0
  627. package/dist/src/_internal/util/common/test/shims/editing.js +149 -0
  628. package/dist/src/_internal/util/common/test/shims/editing.js.map +1 -0
  629. package/dist/src/_internal/util/common/test/shims/enums.d.ts +50 -0
  630. package/dist/src/_internal/util/common/test/shims/enums.d.ts.map +1 -0
  631. package/dist/src/_internal/util/common/test/shims/enums.js +65 -0
  632. package/dist/src/_internal/util/common/test/shims/enums.js.map +1 -0
  633. package/dist/src/_internal/util/common/test/shims/l10n.d.ts +8 -0
  634. package/dist/src/_internal/util/common/test/shims/l10n.d.ts.map +1 -0
  635. package/dist/src/_internal/util/common/test/shims/l10n.js +26 -0
  636. package/dist/src/_internal/util/common/test/shims/l10n.js.map +1 -0
  637. package/dist/src/_internal/util/common/test/shims/newSymbolName.d.ts +13 -0
  638. package/dist/src/_internal/util/common/test/shims/newSymbolName.d.ts.map +1 -0
  639. package/dist/src/_internal/util/common/test/shims/newSymbolName.js +24 -0
  640. package/dist/src/_internal/util/common/test/shims/newSymbolName.js.map +1 -0
  641. package/dist/src/_internal/util/common/test/shims/terminal.d.ts +26 -0
  642. package/dist/src/_internal/util/common/test/shims/terminal.d.ts.map +1 -0
  643. package/dist/src/_internal/util/common/test/shims/terminal.js +34 -0
  644. package/dist/src/_internal/util/common/test/shims/terminal.js.map +1 -0
  645. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.d.ts +4 -0
  646. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.d.ts.map +1 -0
  647. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js +113 -0
  648. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js.map +1 -0
  649. package/dist/src/_internal/util/common/time.d.ts +8 -0
  650. package/dist/src/_internal/util/common/time.d.ts.map +1 -0
  651. package/dist/src/_internal/util/common/time.js +30 -0
  652. package/dist/src/_internal/util/common/time.js.map +1 -0
  653. package/dist/src/_internal/util/common/tokenizer.d.ts +19 -0
  654. package/dist/src/_internal/util/common/tokenizer.d.ts.map +1 -0
  655. package/dist/src/_internal/util/common/tokenizer.js +14 -0
  656. package/dist/src/_internal/util/common/tokenizer.js.map +1 -0
  657. package/dist/src/_internal/util/common/tracing.d.ts +8 -0
  658. package/dist/src/_internal/util/common/tracing.d.ts.map +1 -0
  659. package/dist/src/_internal/util/common/tracing.js +49 -0
  660. package/dist/src/_internal/util/common/tracing.js.map +1 -0
  661. package/dist/src/_internal/util/common/types.d.ts +7 -0
  662. package/dist/src/_internal/util/common/types.d.ts.map +1 -0
  663. package/dist/src/_internal/util/common/types.js +35 -0
  664. package/dist/src/_internal/util/common/types.js.map +1 -0
  665. package/dist/src/_internal/util/common/variableLengthQuantity.d.ts +9 -0
  666. package/dist/src/_internal/util/common/variableLengthQuantity.d.ts.map +1 -0
  667. package/dist/src/_internal/util/common/variableLengthQuantity.js +38 -0
  668. package/dist/src/_internal/util/common/variableLengthQuantity.js.map +1 -0
  669. package/dist/src/_internal/util/node/worker.d.ts +44 -0
  670. package/dist/src/_internal/util/node/worker.d.ts.map +1 -0
  671. package/dist/src/_internal/util/node/worker.js +115 -0
  672. package/dist/src/_internal/util/node/worker.js.map +1 -0
  673. package/dist/src/_internal/util/vs/base/common/arrays.d.ts +299 -0
  674. package/dist/src/_internal/util/vs/base/common/arrays.d.ts.map +1 -0
  675. package/dist/src/_internal/util/vs/base/common/arrays.js +836 -0
  676. package/dist/src/_internal/util/vs/base/common/arrays.js.map +1 -0
  677. package/dist/src/_internal/util/vs/base/common/arraysFind.d.ts +69 -0
  678. package/dist/src/_internal/util/vs/base/common/arraysFind.d.ts.map +1 -0
  679. package/dist/src/_internal/util/vs/base/common/arraysFind.js +193 -0
  680. package/dist/src/_internal/util/vs/base/common/arraysFind.js.map +1 -0
  681. package/dist/src/_internal/util/vs/base/common/assert.d.ts +35 -0
  682. package/dist/src/_internal/util/vs/base/common/assert.d.ts.map +1 -0
  683. package/dist/src/_internal/util/vs/base/common/assert.js +86 -0
  684. package/dist/src/_internal/util/vs/base/common/assert.js.map +1 -0
  685. package/dist/src/_internal/util/vs/base/common/async.d.ts +764 -0
  686. package/dist/src/_internal/util/vs/base/common/async.d.ts.map +1 -0
  687. package/dist/src/_internal/util/vs/base/common/async.js +2037 -0
  688. package/dist/src/_internal/util/vs/base/common/async.js.map +1 -0
  689. package/dist/src/_internal/util/vs/base/common/buffer.d.ts +92 -0
  690. package/dist/src/_internal/util/vs/base/common/buffer.d.ts.map +1 -0
  691. package/dist/src/_internal/util/vs/base/common/buffer.js +480 -0
  692. package/dist/src/_internal/util/vs/base/common/buffer.js.map +1 -0
  693. package/dist/src/_internal/util/vs/base/common/cache.d.ts +47 -0
  694. package/dist/src/_internal/util/vs/base/common/cache.d.ts.map +1 -0
  695. package/dist/src/_internal/util/vs/base/common/cache.js +95 -0
  696. package/dist/src/_internal/util/vs/base/common/cache.js.map +1 -0
  697. package/dist/src/_internal/util/vs/base/common/cancellation.d.ts +31 -0
  698. package/dist/src/_internal/util/vs/base/common/cancellation.d.ts.map +1 -0
  699. package/dist/src/_internal/util/vs/base/common/cancellation.js +120 -0
  700. package/dist/src/_internal/util/vs/base/common/cancellation.js.map +1 -0
  701. package/dist/src/_internal/util/vs/base/common/charCode.d.ts +428 -0
  702. package/dist/src/_internal/util/vs/base/common/charCode.d.ts.map +1 -0
  703. package/dist/src/_internal/util/vs/base/common/charCode.js +4 -0
  704. package/dist/src/_internal/util/vs/base/common/charCode.js.map +1 -0
  705. package/dist/src/_internal/util/vs/base/common/codicons.d.ts +681 -0
  706. package/dist/src/_internal/util/vs/base/common/codicons.d.ts.map +1 -0
  707. package/dist/src/_internal/util/vs/base/common/codicons.js +59 -0
  708. package/dist/src/_internal/util/vs/base/common/codicons.js.map +1 -0
  709. package/dist/src/_internal/util/vs/base/common/codiconsLibrary.d.ts +607 -0
  710. package/dist/src/_internal/util/vs/base/common/codiconsLibrary.d.ts.map +1 -0
  711. package/dist/src/_internal/util/vs/base/common/codiconsLibrary.js +619 -0
  712. package/dist/src/_internal/util/vs/base/common/codiconsLibrary.js.map +1 -0
  713. package/dist/src/_internal/util/vs/base/common/codiconsUtil.d.ts +9 -0
  714. package/dist/src/_internal/util/vs/base/common/codiconsUtil.d.ts.map +1 -0
  715. package/dist/src/_internal/util/vs/base/common/codiconsUtil.js +25 -0
  716. package/dist/src/_internal/util/vs/base/common/codiconsUtil.js.map +1 -0
  717. package/dist/src/_internal/util/vs/base/common/collections.d.ts +49 -0
  718. package/dist/src/_internal/util/vs/base/common/collections.d.ts.map +1 -0
  719. package/dist/src/_internal/util/vs/base/common/collections.js +134 -0
  720. package/dist/src/_internal/util/vs/base/common/collections.js.map +1 -0
  721. package/dist/src/_internal/util/vs/base/common/diff/diff.d.ts +151 -0
  722. package/dist/src/_internal/util/vs/base/common/diff/diff.d.ts.map +1 -0
  723. package/dist/src/_internal/util/vs/base/common/diff/diff.js +1064 -0
  724. package/dist/src/_internal/util/vs/base/common/diff/diff.js.map +1 -0
  725. package/dist/src/_internal/util/vs/base/common/diff/diffChange.d.ts +39 -0
  726. package/dist/src/_internal/util/vs/base/common/diff/diffChange.d.ts.map +1 -0
  727. package/dist/src/_internal/util/vs/base/common/diff/diffChange.js +38 -0
  728. package/dist/src/_internal/util/vs/base/common/diff/diffChange.js.map +1 -0
  729. package/dist/src/_internal/util/vs/base/common/equals.d.ts +38 -0
  730. package/dist/src/_internal/util/vs/base/common/equals.d.ts.map +1 -0
  731. package/dist/src/_internal/util/vs/base/common/equals.js +166 -0
  732. package/dist/src/_internal/util/vs/base/common/equals.js.map +1 -0
  733. package/dist/src/_internal/util/vs/base/common/errors.d.ts +114 -0
  734. package/dist/src/_internal/util/vs/base/common/errors.d.ts.map +1 -0
  735. package/dist/src/_internal/util/vs/base/common/errors.js +274 -0
  736. package/dist/src/_internal/util/vs/base/common/errors.js.map +1 -0
  737. package/dist/src/_internal/util/vs/base/common/event.d.ts +567 -0
  738. package/dist/src/_internal/util/vs/base/common/event.d.ts.map +1 -0
  739. package/dist/src/_internal/util/vs/base/common/event.js +1405 -0
  740. package/dist/src/_internal/util/vs/base/common/event.js.map +1 -0
  741. package/dist/src/_internal/util/vs/base/common/extpath.d.ts +58 -0
  742. package/dist/src/_internal/util/vs/base/common/extpath.d.ts.map +1 -0
  743. package/dist/src/_internal/util/vs/base/common/extpath.js +363 -0
  744. package/dist/src/_internal/util/vs/base/common/extpath.js.map +1 -0
  745. package/dist/src/_internal/util/vs/base/common/filters.d.ts +63 -0
  746. package/dist/src/_internal/util/vs/base/common/filters.d.ts.map +1 -0
  747. package/dist/src/_internal/util/vs/base/common/filters.js +821 -0
  748. package/dist/src/_internal/util/vs/base/common/filters.js.map +1 -0
  749. package/dist/src/_internal/util/vs/base/common/functional.d.ts +5 -0
  750. package/dist/src/_internal/util/vs/base/common/functional.d.ts.map +1 -0
  751. package/dist/src/_internal/util/vs/base/common/functional.js +35 -0
  752. package/dist/src/_internal/util/vs/base/common/functional.js.map +1 -0
  753. package/dist/src/_internal/util/vs/base/common/glob.d.ts +72 -0
  754. package/dist/src/_internal/util/vs/base/common/glob.d.ts.map +1 -0
  755. package/dist/src/_internal/util/vs/base/common/glob.js +622 -0
  756. package/dist/src/_internal/util/vs/base/common/glob.js.map +1 -0
  757. package/dist/src/_internal/util/vs/base/common/hash.d.ts +41 -0
  758. package/dist/src/_internal/util/vs/base/common/hash.d.ts.map +1 -0
  759. package/dist/src/_internal/util/vs/base/common/hash.js +320 -0
  760. package/dist/src/_internal/util/vs/base/common/hash.js.map +1 -0
  761. package/dist/src/_internal/util/vs/base/common/htmlContent.d.ts +59 -0
  762. package/dist/src/_internal/util/vs/base/common/htmlContent.d.ts.map +1 -0
  763. package/dist/src/_internal/util/vs/base/common/htmlContent.js +179 -0
  764. package/dist/src/_internal/util/vs/base/common/htmlContent.js.map +1 -0
  765. package/dist/src/_internal/util/vs/base/common/iconLabels.d.ts +21 -0
  766. package/dist/src/_internal/util/vs/base/common/iconLabels.d.ts.map +1 -0
  767. package/dist/src/_internal/util/vs/base/common/iconLabels.js +95 -0
  768. package/dist/src/_internal/util/vs/base/common/iconLabels.js.map +1 -0
  769. package/dist/src/_internal/util/vs/base/common/iterator.d.ts +33 -0
  770. package/dist/src/_internal/util/vs/base/common/iterator.d.ts.map +1 -0
  771. package/dist/src/_internal/util/vs/base/common/iterator.js +188 -0
  772. package/dist/src/_internal/util/vs/base/common/iterator.js.map +1 -0
  773. package/dist/src/_internal/util/vs/base/common/lazy.d.ts +23 -0
  774. package/dist/src/_internal/util/vs/base/common/lazy.d.ts.map +1 -0
  775. package/dist/src/_internal/util/vs/base/common/lazy.js +57 -0
  776. package/dist/src/_internal/util/vs/base/common/lazy.js.map +1 -0
  777. package/dist/src/_internal/util/vs/base/common/lifecycle.d.ts +262 -0
  778. package/dist/src/_internal/util/vs/base/common/lifecycle.d.ts.map +1 -0
  779. package/dist/src/_internal/util/vs/base/common/lifecycle.js +703 -0
  780. package/dist/src/_internal/util/vs/base/common/lifecycle.js.map +1 -0
  781. package/dist/src/_internal/util/vs/base/common/linkedList.d.ts +16 -0
  782. package/dist/src/_internal/util/vs/base/common/linkedList.d.ts.map +1 -0
  783. package/dist/src/_internal/util/vs/base/common/linkedList.js +130 -0
  784. package/dist/src/_internal/util/vs/base/common/linkedList.js.map +1 -0
  785. package/dist/src/_internal/util/vs/base/common/map.d.ts +175 -0
  786. package/dist/src/_internal/util/vs/base/common/map.d.ts.map +1 -0
  787. package/dist/src/_internal/util/vs/base/common/map.js +796 -0
  788. package/dist/src/_internal/util/vs/base/common/map.js.map +1 -0
  789. package/dist/src/_internal/util/vs/base/common/marshallingIds.d.ts +29 -0
  790. package/dist/src/_internal/util/vs/base/common/marshallingIds.d.ts.map +1 -0
  791. package/dist/src/_internal/util/vs/base/common/marshallingIds.js +4 -0
  792. package/dist/src/_internal/util/vs/base/common/marshallingIds.js.map +1 -0
  793. package/dist/src/_internal/util/vs/base/common/mime.d.ts +19 -0
  794. package/dist/src/_internal/util/vs/base/common/mime.d.ts.map +1 -0
  795. package/dist/src/_internal/util/vs/base/common/mime.js +127 -0
  796. package/dist/src/_internal/util/vs/base/common/mime.js.map +1 -0
  797. package/dist/src/_internal/util/vs/base/common/naturalLanguage/korean.d.ts +10 -0
  798. package/dist/src/_internal/util/vs/base/common/naturalLanguage/korean.d.ts.map +1 -0
  799. package/dist/src/_internal/util/vs/base/common/naturalLanguage/korean.js +324 -0
  800. package/dist/src/_internal/util/vs/base/common/naturalLanguage/korean.js.map +1 -0
  801. package/dist/src/_internal/util/vs/base/common/network.d.ts +189 -0
  802. package/dist/src/_internal/util/vs/base/common/network.d.ts.map +1 -0
  803. package/dist/src/_internal/util/vs/base/common/network.js +386 -0
  804. package/dist/src/_internal/util/vs/base/common/network.js.map +1 -0
  805. package/dist/src/_internal/util/vs/base/common/numbers.d.ts +71 -0
  806. package/dist/src/_internal/util/vs/base/common/numbers.d.ts.map +1 -0
  807. package/dist/src/_internal/util/vs/base/common/numbers.js +148 -0
  808. package/dist/src/_internal/util/vs/base/common/numbers.js.map +1 -0
  809. package/dist/src/_internal/util/vs/base/common/objects.d.ts +36 -0
  810. package/dist/src/_internal/util/vs/base/common/objects.d.ts.map +1 -0
  811. package/dist/src/_internal/util/vs/base/common/objects.js +231 -0
  812. package/dist/src/_internal/util/vs/base/common/objects.js.map +1 -0
  813. package/dist/src/_internal/util/vs/base/common/observable.d.ts +2 -0
  814. package/dist/src/_internal/util/vs/base/common/observable.d.ts.map +1 -0
  815. package/dist/src/_internal/util/vs/base/common/observable.js +24 -0
  816. package/dist/src/_internal/util/vs/base/common/observable.js.map +1 -0
  817. package/dist/src/_internal/util/vs/base/common/observableInternal/base.d.ts +169 -0
  818. package/dist/src/_internal/util/vs/base/common/observableInternal/base.d.ts.map +1 -0
  819. package/dist/src/_internal/util/vs/base/common/observableInternal/base.js +18 -0
  820. package/dist/src/_internal/util/vs/base/common/observableInternal/base.js.map +1 -0
  821. package/dist/src/_internal/util/vs/base/common/observableInternal/changeTracker.d.ts +45 -0
  822. package/dist/src/_internal/util/vs/base/common/observableInternal/changeTracker.d.ts.map +1 -0
  823. package/dist/src/_internal/util/vs/base/common/observableInternal/changeTracker.js +76 -0
  824. package/dist/src/_internal/util/vs/base/common/observableInternal/changeTracker.js.map +1 -0
  825. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.d.ts +3 -0
  826. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.d.ts.map +1 -0
  827. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.js +15 -0
  828. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.js.map +1 -0
  829. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.d.ts +6 -0
  830. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.d.ts.map +1 -0
  831. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.js +24 -0
  832. package/dist/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.js.map +1 -0
  833. package/dist/src/_internal/util/vs/base/common/observableInternal/debugLocation.d.ts +21 -0
  834. package/dist/src/_internal/util/vs/base/common/observableInternal/debugLocation.d.ts.map +1 -0
  835. package/dist/src/_internal/util/vs/base/common/observableInternal/debugLocation.js +64 -0
  836. package/dist/src/_internal/util/vs/base/common/observableInternal/debugLocation.js.map +1 -0
  837. package/dist/src/_internal/util/vs/base/common/observableInternal/debugName.d.ts +34 -0
  838. package/dist/src/_internal/util/vs/base/common/observableInternal/debugName.d.ts.map +1 -0
  839. package/dist/src/_internal/util/vs/base/common/observableInternal/debugName.js +112 -0
  840. package/dist/src/_internal/util/vs/base/common/observableInternal/debugName.js.map +1 -0
  841. package/dist/src/_internal/util/vs/base/common/observableInternal/experimental/utils.d.ts +16 -0
  842. package/dist/src/_internal/util/vs/base/common/observableInternal/experimental/utils.d.ts.map +1 -0
  843. package/dist/src/_internal/util/vs/base/common/observableInternal/experimental/utils.js +57 -0
  844. package/dist/src/_internal/util/vs/base/common/observableInternal/experimental/utils.js.map +1 -0
  845. package/dist/src/_internal/util/vs/base/common/observableInternal/index.d.ts +25 -0
  846. package/dist/src/_internal/util/vs/base/common/observableInternal/index.d.ts.map +1 -0
  847. package/dist/src/_internal/util/vs/base/common/observableInternal/index.js +101 -0
  848. package/dist/src/_internal/util/vs/base/common/observableInternal/index.js.map +1 -0
  849. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.d.ts +41 -0
  850. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.d.ts.map +1 -0
  851. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.js +346 -0
  852. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.js.map +1 -0
  853. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.d.ts +5 -0
  854. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.d.ts.map +1 -0
  855. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.js +68 -0
  856. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.js.map +1 -0
  857. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.d.ts +44 -0
  858. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.d.ts.map +1 -0
  859. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.js +445 -0
  860. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.js.map +1 -0
  861. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.d.ts +42 -0
  862. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.d.ts.map +1 -0
  863. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.js +59 -0
  864. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.js.map +1 -0
  865. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.d.ts +14 -0
  866. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.d.ts.map +1 -0
  867. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.js +69 -0
  868. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.js.map +1 -0
  869. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/logging.d.ts +31 -0
  870. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/logging.d.ts.map +1 -0
  871. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/logging.js +97 -0
  872. package/dist/src/_internal/util/vs/base/common/observableInternal/logging/logging.js.map +1 -0
  873. package/dist/src/_internal/util/vs/base/common/observableInternal/map.d.ts +19 -0
  874. package/dist/src/_internal/util/vs/base/common/observableInternal/map.d.ts.map +1 -0
  875. package/dist/src/_internal/util/vs/base/common/observableInternal/map.js +65 -0
  876. package/dist/src/_internal/util/vs/base/common/observableInternal/map.js.map +1 -0
  877. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.d.ts +55 -0
  878. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.d.ts.map +1 -0
  879. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.js +133 -0
  880. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.js.map +1 -0
  881. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.d.ts +6 -0
  882. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.d.ts.map +1 -0
  883. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.js +36 -0
  884. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.js.map +1 -0
  885. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derived.d.ts +47 -0
  886. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derived.d.ts.map +1 -0
  887. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derived.js +99 -0
  888. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derived.js.map +1 -0
  889. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.d.ts +83 -0
  890. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.d.ts.map +1 -0
  891. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.js +355 -0
  892. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.js.map +1 -0
  893. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.d.ts +28 -0
  894. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.d.ts.map +1 -0
  895. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.js +124 -0
  896. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.js.map +1 -0
  897. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.d.ts +34 -0
  898. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.d.ts.map +1 -0
  899. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.js +118 -0
  900. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -0
  901. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.d.ts +12 -0
  902. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.d.ts.map +1 -0
  903. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.js +45 -0
  904. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.js.map +1 -0
  905. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.d.ts +6 -0
  906. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.d.ts.map +1 -0
  907. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.js +39 -0
  908. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.js.map +1 -0
  909. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.d.ts +38 -0
  910. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.d.ts.map +1 -0
  911. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.js +105 -0
  912. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.js.map +1 -0
  913. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.d.ts +9 -0
  914. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.d.ts.map +1 -0
  915. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.js +16 -0
  916. package/dist/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.js.map +1 -0
  917. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.d.ts +57 -0
  918. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.d.ts.map +1 -0
  919. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.js +139 -0
  920. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.js.map +1 -0
  921. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.d.ts +53 -0
  922. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.d.ts.map +1 -0
  923. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.js +212 -0
  924. package/dist/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -0
  925. package/dist/src/_internal/util/vs/base/common/observableInternal/set.d.ts +18 -0
  926. package/dist/src/_internal/util/vs/base/common/observableInternal/set.d.ts.map +1 -0
  927. package/dist/src/_internal/util/vs/base/common/observableInternal/set.js +63 -0
  928. package/dist/src/_internal/util/vs/base/common/observableInternal/set.js.map +1 -0
  929. package/dist/src/_internal/util/vs/base/common/observableInternal/transaction.d.ts +28 -0
  930. package/dist/src/_internal/util/vs/base/common/observableInternal/transaction.d.ts.map +1 -0
  931. package/dist/src/_internal/util/vs/base/common/observableInternal/transaction.js +116 -0
  932. package/dist/src/_internal/util/vs/base/common/observableInternal/transaction.js.map +1 -0
  933. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/promise.d.ts +76 -0
  934. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/promise.d.ts.map +1 -0
  935. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/promise.js +113 -0
  936. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/promise.js.map +1 -0
  937. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.d.ts +8 -0
  938. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.d.ts.map +1 -0
  939. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.js +59 -0
  940. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.js.map +1 -0
  941. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utils.d.ts +44 -0
  942. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utils.d.ts.map +1 -0
  943. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utils.js +256 -0
  944. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utils.js.map +1 -0
  945. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.d.ts +11 -0
  946. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.d.ts.map +1 -0
  947. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.js +85 -0
  948. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.js.map +1 -0
  949. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.d.ts +11 -0
  950. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.d.ts.map +1 -0
  951. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.js +26 -0
  952. package/dist/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.js.map +1 -0
  953. package/dist/src/_internal/util/vs/base/common/path.d.ts +40 -0
  954. package/dist/src/_internal/util/vs/base/common/path.d.ts.map +1 -0
  955. package/dist/src/_internal/util/vs/base/common/path.js +1494 -0
  956. package/dist/src/_internal/util/vs/base/common/path.js.map +1 -0
  957. package/dist/src/_internal/util/vs/base/common/platform.d.ts +100 -0
  958. package/dist/src/_internal/util/vs/base/common/platform.d.ts.map +1 -0
  959. package/dist/src/_internal/util/vs/base/common/platform.js +254 -0
  960. package/dist/src/_internal/util/vs/base/common/platform.js.map +1 -0
  961. package/dist/src/_internal/util/vs/base/common/process.d.ts +28 -0
  962. package/dist/src/_internal/util/vs/base/common/process.d.ts.map +1 -0
  963. package/dist/src/_internal/util/vs/base/common/process.js +69 -0
  964. package/dist/src/_internal/util/vs/base/common/process.js.map +1 -0
  965. package/dist/src/_internal/util/vs/base/common/resources.d.ts +188 -0
  966. package/dist/src/_internal/util/vs/base/common/resources.d.ts.map +1 -0
  967. package/dist/src/_internal/util/vs/base/common/resources.js +324 -0
  968. package/dist/src/_internal/util/vs/base/common/resources.js.map +1 -0
  969. package/dist/src/_internal/util/vs/base/common/sequence.d.ts +20 -0
  970. package/dist/src/_internal/util/vs/base/common/sequence.d.ts.map +1 -0
  971. package/dist/src/_internal/util/vs/base/common/sequence.js +22 -0
  972. package/dist/src/_internal/util/vs/base/common/sequence.js.map +1 -0
  973. package/dist/src/_internal/util/vs/base/common/sseParser.d.ts +78 -0
  974. package/dist/src/_internal/util/vs/base/common/sseParser.d.ts.map +1 -0
  975. package/dist/src/_internal/util/vs/base/common/sseParser.js +175 -0
  976. package/dist/src/_internal/util/vs/base/common/sseParser.js.map +1 -0
  977. package/dist/src/_internal/util/vs/base/common/stopwatch.d.ts +11 -0
  978. package/dist/src/_internal/util/vs/base/common/stopwatch.d.ts.map +1 -0
  979. package/dist/src/_internal/util/vs/base/common/stopwatch.js +30 -0
  980. package/dist/src/_internal/util/vs/base/common/stopwatch.js.map +1 -0
  981. package/dist/src/_internal/util/vs/base/common/stream.d.ts +212 -0
  982. package/dist/src/_internal/util/vs/base/common/stream.d.ts.map +1 -0
  983. package/dist/src/_internal/util/vs/base/common/stream.js +495 -0
  984. package/dist/src/_internal/util/vs/base/common/stream.js.map +1 -0
  985. package/dist/src/_internal/util/vs/base/common/strings.d.ts +264 -0
  986. package/dist/src/_internal/util/vs/base/common/strings.d.ts.map +1 -0
  987. package/dist/src/_internal/util/vs/base/common/strings.js +1162 -0
  988. package/dist/src/_internal/util/vs/base/common/strings.js.map +1 -0
  989. package/dist/src/_internal/util/vs/base/common/symbols.d.ts +5 -0
  990. package/dist/src/_internal/util/vs/base/common/symbols.d.ts.map +1 -0
  991. package/dist/src/_internal/util/vs/base/common/symbols.js +13 -0
  992. package/dist/src/_internal/util/vs/base/common/symbols.js.map +1 -0
  993. package/dist/src/_internal/util/vs/base/common/themables.d.ts +31 -0
  994. package/dist/src/_internal/util/vs/base/common/themables.d.ts.map +1 -0
  995. package/dist/src/_internal/util/vs/base/common/themables.js +92 -0
  996. package/dist/src/_internal/util/vs/base/common/themables.js.map +1 -0
  997. package/dist/src/_internal/util/vs/base/common/types.d.ts +184 -0
  998. package/dist/src/_internal/util/vs/base/common/types.d.ts.map +1 -0
  999. package/dist/src/_internal/util/vs/base/common/types.js +265 -0
  1000. package/dist/src/_internal/util/vs/base/common/types.js.map +1 -0
  1001. package/dist/src/_internal/util/vs/base/common/uint.d.ts +32 -0
  1002. package/dist/src/_internal/util/vs/base/common/uint.d.ts.map +1 -0
  1003. package/dist/src/_internal/util/vs/base/common/uint.js +24 -0
  1004. package/dist/src/_internal/util/vs/base/common/uint.js.map +1 -0
  1005. package/dist/src/_internal/util/vs/base/common/uri.d.ts +172 -0
  1006. package/dist/src/_internal/util/vs/base/common/uri.d.ts.map +1 -0
  1007. package/dist/src/_internal/util/vs/base/common/uri.js +653 -0
  1008. package/dist/src/_internal/util/vs/base/common/uri.js.map +1 -0
  1009. package/dist/src/_internal/util/vs/base/common/uuid.d.ts +5 -0
  1010. package/dist/src/_internal/util/vs/base/common/uuid.d.ts.map +1 -0
  1011. package/dist/src/_internal/util/vs/base/common/uuid.js +66 -0
  1012. package/dist/src/_internal/util/vs/base/common/uuid.js.map +1 -0
  1013. package/dist/src/_internal/util/vs/editor/common/core/editOperation.d.ts +28 -0
  1014. package/dist/src/_internal/util/vs/editor/common/core/editOperation.d.ts.map +1 -0
  1015. package/dist/src/_internal/util/vs/editor/common/core/editOperation.js +35 -0
  1016. package/dist/src/_internal/util/vs/editor/common/core/editOperation.js.map +1 -0
  1017. package/dist/src/_internal/util/vs/editor/common/core/edits/edit.d.ts +109 -0
  1018. package/dist/src/_internal/util/vs/editor/common/core/edits/edit.d.ts.map +1 -0
  1019. package/dist/src/_internal/util/vs/editor/common/core/edits/edit.js +341 -0
  1020. package/dist/src/_internal/util/vs/editor/common/core/edits/edit.js.map +1 -0
  1021. package/dist/src/_internal/util/vs/editor/common/core/edits/lineEdit.d.ts +53 -0
  1022. package/dist/src/_internal/util/vs/editor/common/core/edits/lineEdit.d.ts.map +1 -0
  1023. package/dist/src/_internal/util/vs/editor/common/core/edits/lineEdit.js +322 -0
  1024. package/dist/src/_internal/util/vs/editor/common/core/edits/lineEdit.js.map +1 -0
  1025. package/dist/src/_internal/util/vs/editor/common/core/edits/stringEdit.d.ts +135 -0
  1026. package/dist/src/_internal/util/vs/editor/common/core/edits/stringEdit.d.ts.map +1 -0
  1027. package/dist/src/_internal/util/vs/editor/common/core/edits/stringEdit.js +437 -0
  1028. package/dist/src/_internal/util/vs/editor/common/core/edits/stringEdit.js.map +1 -0
  1029. package/dist/src/_internal/util/vs/editor/common/core/edits/textEdit.d.ts +50 -0
  1030. package/dist/src/_internal/util/vs/editor/common/core/edits/textEdit.d.ts.map +1 -0
  1031. package/dist/src/_internal/util/vs/editor/common/core/edits/textEdit.js +348 -0
  1032. package/dist/src/_internal/util/vs/editor/common/core/edits/textEdit.js.map +1 -0
  1033. package/dist/src/_internal/util/vs/editor/common/core/position.d.ts +91 -0
  1034. package/dist/src/_internal/util/vs/editor/common/core/position.d.ts.map +1 -0
  1035. package/dist/src/_internal/util/vs/editor/common/core/position.js +142 -0
  1036. package/dist/src/_internal/util/vs/editor/common/core/position.js.map +1 -0
  1037. package/dist/src/_internal/util/vs/editor/common/core/range.d.ts +195 -0
  1038. package/dist/src/_internal/util/vs/editor/common/core/range.d.ts.map +1 -0
  1039. package/dist/src/_internal/util/vs/editor/common/core/range.js +424 -0
  1040. package/dist/src/_internal/util/vs/editor/common/core/range.js.map +1 -0
  1041. package/dist/src/_internal/util/vs/editor/common/core/ranges/lineRange.d.ts +108 -0
  1042. package/dist/src/_internal/util/vs/editor/common/core/ranges/lineRange.d.ts.map +1 -0
  1043. package/dist/src/_internal/util/vs/editor/common/core/ranges/lineRange.js +357 -0
  1044. package/dist/src/_internal/util/vs/editor/common/core/ranges/lineRange.js.map +1 -0
  1045. package/dist/src/_internal/util/vs/editor/common/core/ranges/offsetRange.d.ts +79 -0
  1046. package/dist/src/_internal/util/vs/editor/common/core/ranges/offsetRange.d.ts.map +1 -0
  1047. package/dist/src/_internal/util/vs/editor/common/core/ranges/offsetRange.js +242 -0
  1048. package/dist/src/_internal/util/vs/editor/common/core/ranges/offsetRange.js.map +1 -0
  1049. package/dist/src/_internal/util/vs/editor/common/core/text/abstractText.d.ts +40 -0
  1050. package/dist/src/_internal/util/vs/editor/common/core/text/abstractText.d.ts.map +1 -0
  1051. package/dist/src/_internal/util/vs/editor/common/core/text/abstractText.js +105 -0
  1052. package/dist/src/_internal/util/vs/editor/common/core/text/abstractText.js.map +1 -0
  1053. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffset.d.ts +3 -0
  1054. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffset.d.ts.map +1 -0
  1055. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffset.js +28 -0
  1056. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffset.js.map +1 -0
  1057. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.d.ts +39 -0
  1058. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.d.ts.map +1 -0
  1059. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.js +110 -0
  1060. package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -0
  1061. package/dist/src/_internal/util/vs/editor/common/core/text/textLength.d.ts +34 -0
  1062. package/dist/src/_internal/util/vs/editor/common/core/text/textLength.d.ts.map +1 -0
  1063. package/dist/src/_internal/util/vs/editor/common/core/text/textLength.js +134 -0
  1064. package/dist/src/_internal/util/vs/editor/common/core/text/textLength.js.map +1 -0
  1065. package/dist/src/_internal/util/vs/editor/common/core/wordHelper.d.ts +28 -0
  1066. package/dist/src/_internal/util/vs/editor/common/core/wordHelper.d.ts.map +1 -0
  1067. package/dist/src/_internal/util/vs/editor/common/core/wordHelper.js +137 -0
  1068. package/dist/src/_internal/util/vs/editor/common/core/wordHelper.js.map +1 -0
  1069. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.d.ts +83 -0
  1070. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.d.ts.map +1 -0
  1071. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js +154 -0
  1072. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.js.map +1 -0
  1073. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.d.ts +9 -0
  1074. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.d.ts.map +1 -0
  1075. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.js +104 -0
  1076. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.js.map +1 -0
  1077. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.d.ts +8 -0
  1078. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.d.ts.map +1 -0
  1079. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.js +165 -0
  1080. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.js.map +1 -0
  1081. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.d.ts +4 -0
  1082. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.d.ts.map +1 -0
  1083. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.js +251 -0
  1084. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.js.map +1 -0
  1085. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.d.ts +9 -0
  1086. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.d.ts.map +1 -0
  1087. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js +213 -0
  1088. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.js.map +1 -0
  1089. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.d.ts +10 -0
  1090. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.d.ts.map +1 -0
  1091. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js +380 -0
  1092. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.js.map +1 -0
  1093. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.d.ts +13 -0
  1094. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.d.ts.map +1 -0
  1095. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.js +36 -0
  1096. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.js.map +1 -0
  1097. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.d.ts +32 -0
  1098. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.d.ts.map +1 -0
  1099. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js +208 -0
  1100. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.js.map +1 -0
  1101. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.d.ts +23 -0
  1102. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.d.ts.map +1 -0
  1103. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.js +64 -0
  1104. package/dist/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.js.map +1 -0
  1105. package/dist/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.d.ts +70 -0
  1106. package/dist/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.d.ts.map +1 -0
  1107. package/dist/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.js +501 -0
  1108. package/dist/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.js.map +1 -0
  1109. package/dist/src/_internal/util/vs/editor/common/diff/linesDiffComputer.d.ts +46 -0
  1110. package/dist/src/_internal/util/vs/editor/common/diff/linesDiffComputer.d.ts.map +1 -0
  1111. package/dist/src/_internal/util/vs/editor/common/diff/linesDiffComputer.js +33 -0
  1112. package/dist/src/_internal/util/vs/editor/common/diff/linesDiffComputer.js.map +1 -0
  1113. package/dist/src/_internal/util/vs/editor/common/diff/rangeMapping.d.ts +84 -0
  1114. package/dist/src/_internal/util/vs/editor/common/diff/rangeMapping.d.ts.map +1 -0
  1115. package/dist/src/_internal/util/vs/editor/common/diff/rangeMapping.js +287 -0
  1116. package/dist/src/_internal/util/vs/editor/common/diff/rangeMapping.js.map +1 -0
  1117. package/dist/src/_internal/util/vs/editor/common/model/prefixSumComputer.d.ts +71 -0
  1118. package/dist/src/_internal/util/vs/editor/common/model/prefixSumComputer.d.ts.map +1 -0
  1119. package/dist/src/_internal/util/vs/editor/common/model/prefixSumComputer.js +234 -0
  1120. package/dist/src/_internal/util/vs/editor/common/model/prefixSumComputer.js.map +1 -0
  1121. package/dist/src/_internal/util/vs/nls.d.ts +143 -0
  1122. package/dist/src/_internal/util/vs/nls.d.ts.map +1 -0
  1123. package/dist/src/_internal/util/vs/nls.js +84 -0
  1124. package/dist/src/_internal/util/vs/nls.js.map +1 -0
  1125. package/dist/src/_internal/util/vs/nls.messages.d.ts +3 -0
  1126. package/dist/src/_internal/util/vs/nls.messages.d.ts.map +1 -0
  1127. package/dist/src/_internal/util/vs/nls.messages.js +22 -0
  1128. package/dist/src/_internal/util/vs/nls.messages.js.map +1 -0
  1129. package/dist/src/_internal/util/vs/platform/instantiation/common/descriptors.d.ts +10 -0
  1130. package/dist/src/_internal/util/vs/platform/instantiation/common/descriptors.d.ts.map +1 -0
  1131. package/dist/src/_internal/util/vs/platform/instantiation/common/descriptors.js +17 -0
  1132. package/dist/src/_internal/util/vs/platform/instantiation/common/descriptors.js.map +1 -0
  1133. package/dist/src/_internal/util/vs/platform/instantiation/common/graph.d.ts +26 -0
  1134. package/dist/src/_internal/util/vs/platform/instantiation/common/graph.d.ts.map +1 -0
  1135. package/dist/src/_internal/util/vs/platform/instantiation/common/graph.js +99 -0
  1136. package/dist/src/_internal/util/vs/platform/instantiation/common/graph.js.map +1 -0
  1137. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiation.d.ts +70 -0
  1138. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiation.d.ts.map +1 -0
  1139. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiation.js +48 -0
  1140. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiation.js.map +1 -0
  1141. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiationService.d.ts +56 -0
  1142. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiationService.d.ts.map +1 -0
  1143. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiationService.js +406 -0
  1144. package/dist/src/_internal/util/vs/platform/instantiation/common/instantiationService.js.map +1 -0
  1145. package/dist/src/_internal/util/vs/platform/instantiation/common/serviceCollection.d.ts +10 -0
  1146. package/dist/src/_internal/util/vs/platform/instantiation/common/serviceCollection.d.ts.map +1 -0
  1147. package/dist/src/_internal/util/vs/platform/instantiation/common/serviceCollection.js +25 -0
  1148. package/dist/src/_internal/util/vs/platform/instantiation/common/serviceCollection.js.map +1 -0
  1149. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.d.ts +32 -0
  1150. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.d.ts.map +1 -0
  1151. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.js +103 -0
  1152. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.js.map +1 -0
  1153. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.d.ts +8 -0
  1154. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.d.ts.map +1 -0
  1155. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.js +38 -0
  1156. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.js.map +1 -0
  1157. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/location.d.ts +12 -0
  1158. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/location.d.ts.map +1 -0
  1159. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/location.js +53 -0
  1160. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/location.js.map +1 -0
  1161. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.d.ts +21 -0
  1162. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.d.ts.map +1 -0
  1163. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.js +72 -0
  1164. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.js.map +1 -0
  1165. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.d.ts +85 -0
  1166. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.d.ts.map +1 -0
  1167. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.js +243 -0
  1168. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.js.map +1 -0
  1169. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/position.d.ts +30 -0
  1170. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/position.d.ts.map +1 -0
  1171. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/position.js +178 -0
  1172. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/position.js.map +1 -0
  1173. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/range.d.ts +27 -0
  1174. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/range.d.ts.map +1 -0
  1175. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/range.js +148 -0
  1176. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/range.js.map +1 -0
  1177. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.d.ts +21 -0
  1178. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.d.ts.map +1 -0
  1179. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.js +84 -0
  1180. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.js.map +1 -0
  1181. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.d.ts +13 -0
  1182. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.d.ts.map +1 -0
  1183. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.js +95 -0
  1184. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.js.map +1 -0
  1185. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.d.ts +14 -0
  1186. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.d.ts.map +1 -0
  1187. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.js +30 -0
  1188. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.js.map +1 -0
  1189. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.d.ts +46 -0
  1190. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.d.ts.map +1 -0
  1191. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.js +82 -0
  1192. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.js.map +1 -0
  1193. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.d.ts +25 -0
  1194. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.d.ts.map +1 -0
  1195. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.js +93 -0
  1196. package/dist/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.js.map +1 -0
  1197. package/dist/src/_internal/vscodeTypes.d.ts +95 -0
  1198. package/dist/src/_internal/vscodeTypes.d.ts.map +1 -0
  1199. package/dist/src/_internal/vscodeTypes.js +133 -0
  1200. package/dist/src/_internal/vscodeTypes.js.map +1 -0
  1201. package/dist/src/main.d.ts +13 -0
  1202. package/dist/src/main.d.ts.map +1 -0
  1203. package/dist/src/main.js +190 -0
  1204. package/dist/src/main.js.map +1 -0
  1205. package/dist/src/package.json +4063 -0
  1206. package/package.json +64 -0
  1207. package/src/_internal/extension/byok/node/openAIEndpoint.ts +171 -0
  1208. package/src/_internal/extension/common/constants.ts +90 -0
  1209. package/src/_internal/extension/inlineEdits/common/delayer.ts +108 -0
  1210. package/src/_internal/extension/inlineEdits/common/editRebase.ts +268 -0
  1211. package/src/_internal/extension/inlineEdits/common/ghNearbyNesProvider.tsx +163 -0
  1212. package/src/_internal/extension/inlineEdits/common/nearbyCursorInlineEditProvider.ts +225 -0
  1213. package/src/_internal/extension/inlineEdits/common/rejectionCollector.ts +164 -0
  1214. package/src/_internal/extension/inlineEdits/node/debugRecorder.ts +205 -0
  1215. package/src/_internal/extension/inlineEdits/node/importFiltering.ts +25 -0
  1216. package/src/_internal/extension/inlineEdits/node/nesConfigs.ts +12 -0
  1217. package/src/_internal/extension/inlineEdits/node/nextEditCache.ts +278 -0
  1218. package/src/_internal/extension/inlineEdits/node/nextEditProvider.ts +778 -0
  1219. package/src/_internal/extension/inlineEdits/node/nextEditProviderTelemetry.ts +983 -0
  1220. package/src/_internal/extension/inlineEdits/node/nextEditResult.ts +40 -0
  1221. package/src/_internal/extension/prompt/common/importStatement.ts +25 -0
  1222. package/src/_internal/extension/prompt/node/chatMLFetcher.ts +706 -0
  1223. package/src/_internal/extension/prompts/node/inline/summarizedDocument/fragments.ts +146 -0
  1224. package/src/_internal/extension/prompts/node/inline/summarizedDocument/implementation.ts +527 -0
  1225. package/src/_internal/extension/prompts/node/inline/summarizedDocument/projectedText.ts +76 -0
  1226. package/src/_internal/extension/prompts/node/inline/visualization.ts +65 -0
  1227. package/src/_internal/extension/vscode.proposed.activeComment.d.ts +23 -0
  1228. package/src/_internal/extension/vscode.proposed.aiRelatedInformation.d.ts +49 -0
  1229. package/src/_internal/extension/vscode.proposed.aiSettingsSearch.d.ts +31 -0
  1230. package/src/_internal/extension/vscode.proposed.aiTextSearchProvider.d.ts +41 -0
  1231. package/src/_internal/extension/vscode.proposed.authLearnMore.d.ts +16 -0
  1232. package/src/_internal/extension/vscode.proposed.chatBinaryReferenceData.d.ts +41 -0
  1233. package/src/_internal/extension/vscode.proposed.chatEditing.d.ts +29 -0
  1234. package/src/_internal/extension/vscode.proposed.chatParticipantAdditions.d.ts +636 -0
  1235. package/src/_internal/extension/vscode.proposed.chatParticipantPrivate.d.ts +276 -0
  1236. package/src/_internal/extension/vscode.proposed.chatProvider.d.ts +62 -0
  1237. package/src/_internal/extension/vscode.proposed.chatReadonlyPromptReference.d.ts +17 -0
  1238. package/src/_internal/extension/vscode.proposed.chatReferenceDiagnostic.d.ts +23 -0
  1239. package/src/_internal/extension/vscode.proposed.chatSessionsProvider.d.ts +218 -0
  1240. package/src/_internal/extension/vscode.proposed.chatStatusItem.d.ts +61 -0
  1241. package/src/_internal/extension/vscode.proposed.codeActionAI.d.ts +16 -0
  1242. package/src/_internal/extension/vscode.proposed.commentReveal.d.ts +32 -0
  1243. package/src/_internal/extension/vscode.proposed.contribCommentThreadAdditionalMenu.d.ts +8 -0
  1244. package/src/_internal/extension/vscode.proposed.contribCommentsViewThreadMenus.d.ts +6 -0
  1245. package/src/_internal/extension/vscode.proposed.contribSourceControlInputBoxMenu.d.ts +7 -0
  1246. package/src/_internal/extension/vscode.proposed.dataChannels.d.ts +19 -0
  1247. package/src/_internal/extension/vscode.proposed.defaultChatParticipant.d.ts +52 -0
  1248. package/src/_internal/extension/vscode.proposed.documentFiltersExclusive.d.ts +13 -0
  1249. package/src/_internal/extension/vscode.proposed.embeddings.d.ts +33 -0
  1250. package/src/_internal/extension/vscode.proposed.extensionsAny.d.ts +40 -0
  1251. package/src/_internal/extension/vscode.proposed.findFiles2.d.ts +125 -0
  1252. package/src/_internal/extension/vscode.proposed.findTextInFiles.d.ts +104 -0
  1253. package/src/_internal/extension/vscode.proposed.findTextInFiles2.d.ts +144 -0
  1254. package/src/_internal/extension/vscode.proposed.inlineCompletionsAdditions.d.ts +202 -0
  1255. package/src/_internal/extension/vscode.proposed.interactive.d.ts +11 -0
  1256. package/src/_internal/extension/vscode.proposed.languageModelCapabilities.d.ts +25 -0
  1257. package/src/_internal/extension/vscode.proposed.languageModelDataPart.d.ts +163 -0
  1258. package/src/_internal/extension/vscode.proposed.languageModelSystem.d.ts +17 -0
  1259. package/src/_internal/extension/vscode.proposed.languageModelThinkingPart.d.ts +49 -0
  1260. package/src/_internal/extension/vscode.proposed.languageModelToolResultAudience.d.ts +36 -0
  1261. package/src/_internal/extension/vscode.proposed.mappedEditsProvider.d.ts +110 -0
  1262. package/src/_internal/extension/vscode.proposed.newSymbolNamesProvider.d.ts +47 -0
  1263. package/src/_internal/extension/vscode.proposed.readonlyMessage.d.ts +14 -0
  1264. package/src/_internal/extension/vscode.proposed.resolvers.d.ts +475 -0
  1265. package/src/_internal/extension/vscode.proposed.scmInputBoxValueProvider.d.ts +25 -0
  1266. package/src/_internal/extension/vscode.proposed.taskProblemMatcherStatus.d.ts +42 -0
  1267. package/src/_internal/extension/vscode.proposed.terminalDataWriteEvent.d.ts +32 -0
  1268. package/src/_internal/extension/vscode.proposed.terminalExecuteCommandEvent.d.ts +48 -0
  1269. package/src/_internal/extension/vscode.proposed.terminalQuickFixProvider.d.ts +87 -0
  1270. package/src/_internal/extension/vscode.proposed.terminalSelection.d.ts +16 -0
  1271. package/src/_internal/extension/vscode.proposed.testObserver.d.ts +199 -0
  1272. package/src/_internal/extension/vscode.proposed.textDocumentChangeReason.d.ts +30 -0
  1273. package/src/_internal/extension/vscode.proposed.textSearchProvider.d.ts +281 -0
  1274. package/src/_internal/extension/vscode.proposed.textSearchProvider2.d.ts +297 -0
  1275. package/src/_internal/extension/xtab/common/promptCrafting.ts +670 -0
  1276. package/src/_internal/extension/xtab/node/xtabEndpoint.ts +102 -0
  1277. package/src/_internal/extension/xtab/node/xtabProvider.ts +976 -0
  1278. package/src/_internal/extension/xtab/node/xtabUtils.ts +62 -0
  1279. package/src/_internal/platform/authentication/common/authentication.ts +309 -0
  1280. package/src/_internal/platform/authentication/common/copilotToken.ts +300 -0
  1281. package/src/_internal/platform/authentication/common/copilotTokenManager.ts +59 -0
  1282. package/src/_internal/platform/authentication/common/copilotTokenStore.ts +40 -0
  1283. package/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.ts +96 -0
  1284. package/src/_internal/platform/authentication/node/copilotTokenManager.ts +303 -0
  1285. package/src/_internal/platform/chat/common/chatMLFetcher.ts +124 -0
  1286. package/src/_internal/platform/chat/common/chatQuotaService.ts +63 -0
  1287. package/src/_internal/platform/chat/common/chatQuotaServiceImpl.ts +96 -0
  1288. package/src/_internal/platform/chat/common/commonTypes.ts +353 -0
  1289. package/src/_internal/platform/chat/common/conversationOptions.ts +16 -0
  1290. package/src/_internal/platform/chat/common/globalStringUtils.ts +54 -0
  1291. package/src/_internal/platform/chat/common/interactionService.ts +35 -0
  1292. package/src/_internal/platform/configuration/common/configurationService.ts +803 -0
  1293. package/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.ts +39 -0
  1294. package/src/_internal/platform/configuration/common/jsonSchema.ts +139 -0
  1295. package/src/_internal/platform/configuration/common/validator.ts +242 -0
  1296. package/src/_internal/platform/diff/common/diffService.ts +41 -0
  1297. package/src/_internal/platform/diff/common/diffWorker.ts +83 -0
  1298. package/src/_internal/platform/diff/node/diffServiceImpl.ts +85 -0
  1299. package/src/_internal/platform/editing/common/abstractText.ts +177 -0
  1300. package/src/_internal/platform/editing/common/notebookDocumentSnapshot.ts +122 -0
  1301. package/src/_internal/platform/editing/common/positionOffsetTransformer.ts +202 -0
  1302. package/src/_internal/platform/editing/common/textDocumentSnapshot.ts +274 -0
  1303. package/src/_internal/platform/endpoint/common/capiClient.ts +37 -0
  1304. package/src/_internal/platform/endpoint/common/chatModelCapabilities.ts +115 -0
  1305. package/src/_internal/platform/endpoint/common/domainService.ts +27 -0
  1306. package/src/_internal/platform/endpoint/common/endpointProvider.ts +104 -0
  1307. package/src/_internal/platform/endpoint/common/endpointTypes.ts +12 -0
  1308. package/src/_internal/platform/endpoint/common/licenseAgreement.ts +11 -0
  1309. package/src/_internal/platform/endpoint/common/statefulMarkerContainer.tsx +85 -0
  1310. package/src/_internal/platform/endpoint/common/thinkingDataContainer.tsx +44 -0
  1311. package/src/_internal/platform/endpoint/node/capiClientImpl.ts +18 -0
  1312. package/src/_internal/platform/endpoint/node/chatEndpoint.ts +435 -0
  1313. package/src/_internal/platform/endpoint/node/domainServiceImpl.ts +80 -0
  1314. package/src/_internal/platform/endpoint/node/proxyXtabEndpoint.ts +43 -0
  1315. package/src/_internal/platform/endpoint/node/responsesApi.ts +326 -0
  1316. package/src/_internal/platform/env/common/envService.ts +134 -0
  1317. package/src/_internal/platform/env/common/nullEnvService.ts +68 -0
  1318. package/src/_internal/platform/env/common/packagejson.ts +49 -0
  1319. package/src/_internal/platform/git/common/gitExtensionService.ts +21 -0
  1320. package/src/_internal/platform/git/common/nullGitExtensionService.ts +20 -0
  1321. package/src/_internal/platform/git/vscode/git.d.ts +414 -0
  1322. package/src/_internal/platform/github/common/githubAPI.ts +44 -0
  1323. package/src/_internal/platform/github/common/githubService.ts +87 -0
  1324. package/src/_internal/platform/github/common/nullOctokitServiceImpl.ts +21 -0
  1325. package/src/_internal/platform/ignore/common/ignoreService.ts +72 -0
  1326. package/src/_internal/platform/inlineCompletions/common/api.ts +198 -0
  1327. package/src/_internal/platform/inlineEdits/common/dataTypes/diagnosticData.ts +32 -0
  1328. package/src/_internal/platform/inlineEdits/common/dataTypes/documentId.ts +52 -0
  1329. package/src/_internal/platform/inlineEdits/common/dataTypes/edit.ts +165 -0
  1330. package/src/_internal/platform/inlineEdits/common/dataTypes/editUtils.ts +74 -0
  1331. package/src/_internal/platform/inlineEdits/common/dataTypes/fetchCancellationError.ts +14 -0
  1332. package/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.ts +107 -0
  1333. package/src/_internal/platform/inlineEdits/common/dataTypes/languageId.ts +14 -0
  1334. package/src/_internal/platform/inlineEdits/common/dataTypes/permutation.ts +69 -0
  1335. package/src/_internal/platform/inlineEdits/common/dataTypes/rootedLineEdit.ts +49 -0
  1336. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLength.ts +74 -0
  1337. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/combineTextEditInfos.ts +132 -0
  1338. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/length.ts +184 -0
  1339. package/src/_internal/platform/inlineEdits/common/dataTypes/textEditLengthHelper/textEditInfo.ts +32 -0
  1340. package/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.ts +89 -0
  1341. package/src/_internal/platform/inlineEdits/common/debugRecorderBookmark.ts +10 -0
  1342. package/src/_internal/platform/inlineEdits/common/editReason.ts +134 -0
  1343. package/src/_internal/platform/inlineEdits/common/inlineEditLogContext.ts +490 -0
  1344. package/src/_internal/platform/inlineEdits/common/observableGit.ts +49 -0
  1345. package/src/_internal/platform/inlineEdits/common/observableWorkspace.ts +239 -0
  1346. package/src/_internal/platform/inlineEdits/common/responseProcessor.ts +249 -0
  1347. package/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.ts +468 -0
  1348. package/src/_internal/platform/inlineEdits/common/statelessNextEditProviders.ts +59 -0
  1349. package/src/_internal/platform/inlineEdits/common/utils/observable.ts +54 -0
  1350. package/src/_internal/platform/inlineEdits/common/utils/stringifyChatMessages.ts +29 -0
  1351. package/src/_internal/platform/inlineEdits/common/utils/utils.ts +56 -0
  1352. package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/historyContextProvider.ts +60 -0
  1353. package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesHistoryContextProvider.ts +353 -0
  1354. package/src/_internal/platform/inlineEdits/common/workspaceEditTracker/nesXtabHistoryTracker.ts +176 -0
  1355. package/src/_internal/platform/languageContextProvider/common/languageContextProviderService.ts +25 -0
  1356. package/src/_internal/platform/languageContextProvider/common/nullLanguageContextProviderService.ts +38 -0
  1357. package/src/_internal/platform/languageServer/common/languageContextService.ts +186 -0
  1358. package/src/_internal/platform/languages/common/languageDiagnosticsService.ts +67 -0
  1359. package/src/_internal/platform/languages/common/testLanguageDiagnosticsService.ts +28 -0
  1360. package/src/_internal/platform/log/common/logService.ts +232 -0
  1361. package/src/_internal/platform/nesFetch/common/completionsAPI.ts +78 -0
  1362. package/src/_internal/platform/nesFetch/common/completionsFetchService.ts +118 -0
  1363. package/src/_internal/platform/nesFetch/common/responseStream.ts +151 -0
  1364. package/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.ts +236 -0
  1365. package/src/_internal/platform/nesFetch/node/streamTransformer.ts +95 -0
  1366. package/src/_internal/platform/networking/common/fetch.ts +349 -0
  1367. package/src/_internal/platform/networking/common/fetcherService.ts +84 -0
  1368. package/src/_internal/platform/networking/common/networking.ts +442 -0
  1369. package/src/_internal/platform/networking/common/openai.ts +273 -0
  1370. package/src/_internal/platform/networking/node/chatStream.ts +137 -0
  1371. package/src/_internal/platform/networking/node/stream.ts +749 -0
  1372. package/src/_internal/platform/notebook/common/alternativeContent.ts +89 -0
  1373. package/src/_internal/platform/notebook/common/alternativeContentFormat.ts +10 -0
  1374. package/src/_internal/platform/notebook/common/alternativeContentProvider.json.ts +262 -0
  1375. package/src/_internal/platform/notebook/common/alternativeContentProvider.text.ts +243 -0
  1376. package/src/_internal/platform/notebook/common/alternativeContentProvider.ts +41 -0
  1377. package/src/_internal/platform/notebook/common/alternativeContentProvider.xml.ts +205 -0
  1378. package/src/_internal/platform/notebook/common/alternativeNotebookDocument.ts +155 -0
  1379. package/src/_internal/platform/notebook/common/helpers.ts +212 -0
  1380. package/src/_internal/platform/notebook/common/notebookService.ts +43 -0
  1381. package/src/_internal/platform/openai/node/fetch.ts +596 -0
  1382. package/src/_internal/platform/parser/node/nodes.ts +190 -0
  1383. package/src/_internal/platform/requestLogger/node/nullRequestLogger.ts +26 -0
  1384. package/src/_internal/platform/requestLogger/node/requestLogger.ts +383 -0
  1385. package/src/_internal/platform/simulationTestContext/common/simulationTestContext.ts +29 -0
  1386. package/src/_internal/platform/snippy/common/snippyService.ts +25 -0
  1387. package/src/_internal/platform/telemetry/common/nullExperimentationService.ts +64 -0
  1388. package/src/_internal/platform/telemetry/common/nullTelemetryService.ts +53 -0
  1389. package/src/_internal/platform/telemetry/common/telemetry.ts +215 -0
  1390. package/src/_internal/platform/telemetry/common/telemetryData.ts +205 -0
  1391. package/src/_internal/platform/thinking/common/thinking.ts +61 -0
  1392. package/src/_internal/platform/thinking/common/thinkingUtils.ts +57 -0
  1393. package/src/_internal/platform/tokenizer/node/parseTikTokens.ts +23 -0
  1394. package/src/_internal/platform/tokenizer/node/tikTokenizerImpl.ts +74 -0
  1395. package/src/_internal/platform/tokenizer/node/tikTokenizerWorker.ts +24 -0
  1396. package/src/_internal/platform/tokenizer/node/tokenizer.ts +357 -0
  1397. package/src/_internal/platform/workspace/common/workspaceService.ts +226 -0
  1398. package/src/_internal/platform/workspaceRecorder/common/workspaceLog.ts +118 -0
  1399. package/src/_internal/util/common/anomalyDetection.ts +112 -0
  1400. package/src/_internal/util/common/arrays.ts +81 -0
  1401. package/src/_internal/util/common/async.ts +155 -0
  1402. package/src/_internal/util/common/cache.ts +183 -0
  1403. package/src/_internal/util/common/crypto.ts +41 -0
  1404. package/src/_internal/util/common/errors.ts +22 -0
  1405. package/src/_internal/util/common/globals.d.ts +12 -0
  1406. package/src/_internal/util/common/imageUtils.ts +154 -0
  1407. package/src/_internal/util/common/languages.ts +940 -0
  1408. package/src/_internal/util/common/notebooks.ts +286 -0
  1409. package/src/_internal/util/common/result.ts +71 -0
  1410. package/src/_internal/util/common/services.ts +43 -0
  1411. package/src/_internal/util/common/test/shims/chatTypes.ts +448 -0
  1412. package/src/_internal/util/common/test/shims/editing.ts +233 -0
  1413. package/src/_internal/util/common/test/shims/enums.ts +61 -0
  1414. package/src/_internal/util/common/test/shims/l10n.ts +37 -0
  1415. package/src/_internal/util/common/test/shims/newSymbolName.ts +23 -0
  1416. package/src/_internal/util/common/test/shims/terminal.ts +33 -0
  1417. package/src/_internal/util/common/test/shims/vscodeTypesShim.ts +115 -0
  1418. package/src/_internal/util/common/time.ts +31 -0
  1419. package/src/_internal/util/common/tokenizer.ts +30 -0
  1420. package/src/_internal/util/common/tracing.ts +52 -0
  1421. package/src/_internal/util/common/types.ts +33 -0
  1422. package/src/_internal/util/common/variableLengthQuantity.ts +40 -0
  1423. package/src/_internal/util/node/worker.ts +130 -0
  1424. package/src/_internal/util/vs/base/common/arrays.ts +926 -0
  1425. package/src/_internal/util/vs/base/common/arraysFind.ts +206 -0
  1426. package/src/_internal/util/vs/base/common/assert.ts +89 -0
  1427. package/src/_internal/util/vs/base/common/async.ts +2582 -0
  1428. package/src/_internal/util/vs/base/common/buffer.ts +501 -0
  1429. package/src/_internal/util/vs/base/common/cache.ts +122 -0
  1430. package/src/_internal/util/vs/base/common/cancellation.ts +150 -0
  1431. package/src/_internal/util/vs/base/common/charCode.ts +452 -0
  1432. package/src/_internal/util/vs/base/common/codicons.ts +66 -0
  1433. package/src/_internal/util/vs/base/common/codiconsLibrary.ts +618 -0
  1434. package/src/_internal/util/vs/base/common/codiconsUtil.ts +30 -0
  1435. package/src/_internal/util/vs/base/common/collections.ts +156 -0
  1436. package/src/_internal/util/vs/base/common/diff/diff.ts +1317 -0
  1437. package/src/_internal/util/vs/base/common/diff/diffChange.ts +62 -0
  1438. package/src/_internal/util/vs/base/common/equals.ts +148 -0
  1439. package/src/_internal/util/vs/base/common/errors.ts +342 -0
  1440. package/src/_internal/util/vs/base/common/event.ts +1782 -0
  1441. package/src/_internal/util/vs/base/common/extpath.ts +425 -0
  1442. package/src/_internal/util/vs/base/common/filters.ts +928 -0
  1443. package/src/_internal/util/vs/base/common/functional.ts +34 -0
  1444. package/src/_internal/util/vs/base/common/glob.ts +839 -0
  1445. package/src/_internal/util/vs/base/common/hash.ts +326 -0
  1446. package/src/_internal/util/vs/base/common/htmlContent.ts +212 -0
  1447. package/src/_internal/util/vs/base/common/iconLabels.ts +118 -0
  1448. package/src/_internal/util/vs/base/common/iterator.ts +196 -0
  1449. package/src/_internal/util/vs/base/common/lazy.ts +59 -0
  1450. package/src/_internal/util/vs/base/common/lifecycle.ts +845 -0
  1451. package/src/_internal/util/vs/base/common/linkedList.ts +144 -0
  1452. package/src/_internal/util/vs/base/common/map.ts +954 -0
  1453. package/src/_internal/util/vs/base/common/marshallingIds.ts +35 -0
  1454. package/src/_internal/util/vs/base/common/mime.ts +136 -0
  1455. package/src/_internal/util/vs/base/common/naturalLanguage/korean.ts +425 -0
  1456. package/src/_internal/util/vs/base/common/network.ts +429 -0
  1457. package/src/_internal/util/vs/base/common/numbers.ts +166 -0
  1458. package/src/_internal/util/vs/base/common/objects.ts +242 -0
  1459. package/src/_internal/util/vs/base/common/observable.ts +10 -0
  1460. package/src/_internal/util/vs/base/common/observableInternal/base.ts +208 -0
  1461. package/src/_internal/util/vs/base/common/observableInternal/changeTracker.ts +96 -0
  1462. package/src/_internal/util/vs/base/common/observableInternal/commonFacade/cancellation.ts +9 -0
  1463. package/src/_internal/util/vs/base/common/observableInternal/commonFacade/deps.ts +12 -0
  1464. package/src/_internal/util/vs/base/common/observableInternal/debugLocation.ts +88 -0
  1465. package/src/_internal/util/vs/base/common/observableInternal/debugName.ts +150 -0
  1466. package/src/_internal/util/vs/base/common/observableInternal/experimental/utils.ts +62 -0
  1467. package/src/_internal/util/vs/base/common/observableInternal/index.ts +61 -0
  1468. package/src/_internal/util/vs/base/common/observableInternal/logging/consoleObservableLogger.ts +388 -0
  1469. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerApi.d.ts +154 -0
  1470. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/debuggerRpc.ts +80 -0
  1471. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/devToolsLogger.ts +485 -0
  1472. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/rpc.ts +103 -0
  1473. package/src/_internal/util/vs/base/common/observableInternal/logging/debugger/utils.ts +69 -0
  1474. package/src/_internal/util/vs/base/common/observableInternal/logging/logging.ts +133 -0
  1475. package/src/_internal/util/vs/base/common/observableInternal/map.ts +81 -0
  1476. package/src/_internal/util/vs/base/common/observableInternal/observables/baseObservable.ts +172 -0
  1477. package/src/_internal/util/vs/base/common/observableInternal/observables/constObservable.ts +44 -0
  1478. package/src/_internal/util/vs/base/common/observableInternal/observables/derived.ts +190 -0
  1479. package/src/_internal/util/vs/base/common/observableInternal/observables/derivedImpl.ts +445 -0
  1480. package/src/_internal/util/vs/base/common/observableInternal/observables/lazyObservableValue.ts +154 -0
  1481. package/src/_internal/util/vs/base/common/observableInternal/observables/observableFromEvent.ts +174 -0
  1482. package/src/_internal/util/vs/base/common/observableInternal/observables/observableSignal.ts +67 -0
  1483. package/src/_internal/util/vs/base/common/observableInternal/observables/observableSignalFromEvent.ts +62 -0
  1484. package/src/_internal/util/vs/base/common/observableInternal/observables/observableValue.ts +131 -0
  1485. package/src/_internal/util/vs/base/common/observableInternal/observables/observableValueOpts.ts +37 -0
  1486. package/src/_internal/util/vs/base/common/observableInternal/reactions/autorun.ts +188 -0
  1487. package/src/_internal/util/vs/base/common/observableInternal/reactions/autorunImpl.ts +256 -0
  1488. package/src/_internal/util/vs/base/common/observableInternal/set.ts +78 -0
  1489. package/src/_internal/util/vs/base/common/observableInternal/transaction.ts +115 -0
  1490. package/src/_internal/util/vs/base/common/observableInternal/utils/promise.ts +129 -0
  1491. package/src/_internal/util/vs/base/common/observableInternal/utils/runOnChange.ts +65 -0
  1492. package/src/_internal/util/vs/base/common/observableInternal/utils/utils.ts +281 -0
  1493. package/src/_internal/util/vs/base/common/observableInternal/utils/utilsCancellation.ts +101 -0
  1494. package/src/_internal/util/vs/base/common/observableInternal/utils/valueWithChangeEvent.ts +31 -0
  1495. package/src/_internal/util/vs/base/common/path.ts +1591 -0
  1496. package/src/_internal/util/vs/base/common/platform.ts +282 -0
  1497. package/src/_internal/util/vs/base/common/process.ts +78 -0
  1498. package/src/_internal/util/vs/base/common/resources.ts +446 -0
  1499. package/src/_internal/util/vs/base/common/sequence.ts +36 -0
  1500. package/src/_internal/util/vs/base/common/sseParser.ts +247 -0
  1501. package/src/_internal/util/vs/base/common/stopwatch.ts +43 -0
  1502. package/src/_internal/util/vs/base/common/stream.ts +792 -0
  1503. package/src/_internal/util/vs/base/common/strings.ts +1364 -0
  1504. package/src/_internal/util/vs/base/common/symbols.ts +11 -0
  1505. package/src/_internal/util/vs/base/common/themables.ts +106 -0
  1506. package/src/_internal/util/vs/base/common/types.ts +345 -0
  1507. package/src/_internal/util/vs/base/common/uint.ts +61 -0
  1508. package/src/_internal/util/vs/base/common/uri.ts +752 -0
  1509. package/src/_internal/util/vs/base/common/uuid.ts +72 -0
  1510. package/src/_internal/util/vs/base-common.d.ts +42 -0
  1511. package/src/_internal/util/vs/editor/common/core/editOperation.ts +62 -0
  1512. package/src/_internal/util/vs/editor/common/core/edits/edit.ts +399 -0
  1513. package/src/_internal/util/vs/editor/common/core/edits/lineEdit.ts +414 -0
  1514. package/src/_internal/util/vs/editor/common/core/edits/stringEdit.ts +568 -0
  1515. package/src/_internal/util/vs/editor/common/core/edits/textEdit.ts +411 -0
  1516. package/src/_internal/util/vs/editor/common/core/position.ts +186 -0
  1517. package/src/_internal/util/vs/editor/common/core/range.ts +519 -0
  1518. package/src/_internal/util/vs/editor/common/core/ranges/lineRange.ts +416 -0
  1519. package/src/_internal/util/vs/editor/common/core/ranges/offsetRange.ts +275 -0
  1520. package/src/_internal/util/vs/editor/common/core/text/abstractText.ts +127 -0
  1521. package/src/_internal/util/vs/editor/common/core/text/positionToOffset.ts +26 -0
  1522. package/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.ts +144 -0
  1523. package/src/_internal/util/vs/editor/common/core/text/textLength.ts +150 -0
  1524. package/src/_internal/util/vs/editor/common/core/wordHelper.ts +177 -0
  1525. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/diffAlgorithm.ts +210 -0
  1526. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/dynamicProgrammingDiffing.ts +109 -0
  1527. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/algorithms/myersDiffAlgorithm.ts +178 -0
  1528. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/computeMovedLines.ts +331 -0
  1529. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/defaultLinesDiffComputer.ts +273 -0
  1530. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/heuristicSequenceOptimizations.ts +475 -0
  1531. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/lineSequence.ts +47 -0
  1532. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/linesSliceCharSequence.ts +248 -0
  1533. package/src/_internal/util/vs/editor/common/diff/defaultLinesDiffComputer/utils.ts +76 -0
  1534. package/src/_internal/util/vs/editor/common/diff/legacyLinesDiffComputer.ts +693 -0
  1535. package/src/_internal/util/vs/editor/common/diff/linesDiffComputer.ts +61 -0
  1536. package/src/_internal/util/vs/editor/common/diff/rangeMapping.ts +418 -0
  1537. package/src/_internal/util/vs/editor/common/model/prefixSumComputer.ts +304 -0
  1538. package/src/_internal/util/vs/nls.messages.ts +21 -0
  1539. package/src/_internal/util/vs/nls.ts +243 -0
  1540. package/src/_internal/util/vs/platform/instantiation/common/descriptors.ts +23 -0
  1541. package/src/_internal/util/vs/platform/instantiation/common/graph.ts +113 -0
  1542. package/src/_internal/util/vs/platform/instantiation/common/instantiation.ts +127 -0
  1543. package/src/_internal/util/vs/platform/instantiation/common/instantiationService.ts +483 -0
  1544. package/src/_internal/util/vs/platform/instantiation/common/serviceCollection.ts +34 -0
  1545. package/src/_internal/util/vs/vscode-globals-nls.d.ts +42 -0
  1546. package/src/_internal/util/vs/vscode-globals-product.d.ts +35 -0
  1547. package/src/_internal/util/vs/workbench/api/common/extHostTypes/diagnostic.ts +109 -0
  1548. package/src/_internal/util/vs/workbench/api/common/extHostTypes/es5ClassCompat.ts +34 -0
  1549. package/src/_internal/util/vs/workbench/api/common/extHostTypes/location.ts +51 -0
  1550. package/src/_internal/util/vs/workbench/api/common/extHostTypes/markdownString.ts +83 -0
  1551. package/src/_internal/util/vs/workbench/api/common/extHostTypes/notebooks.ts +296 -0
  1552. package/src/_internal/util/vs/workbench/api/common/extHostTypes/position.ts +195 -0
  1553. package/src/_internal/util/vs/workbench/api/common/extHostTypes/range.ts +167 -0
  1554. package/src/_internal/util/vs/workbench/api/common/extHostTypes/selection.ts +94 -0
  1555. package/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetString.ts +103 -0
  1556. package/src/_internal/util/vs/workbench/api/common/extHostTypes/snippetTextEdit.ts +44 -0
  1557. package/src/_internal/util/vs/workbench/api/common/extHostTypes/symbolInformation.ts +89 -0
  1558. package/src/_internal/util/vs/workbench/api/common/extHostTypes/textEdit.ts +99 -0
  1559. package/src/_internal/vscodeTypes.ts +100 -0
  1560. package/src/main.ts +207 -0
  1561. package/src/package.json +4063 -0
@@ -0,0 +1,2582 @@
1
+ //!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'
2
+
3
+ /*---------------------------------------------------------------------------------------------
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License. See License.txt in the project root for license information.
6
+ *--------------------------------------------------------------------------------------------*/
7
+
8
+ import { CancellationToken, CancellationTokenSource } from './cancellation';
9
+ import { BugIndicatingError, CancellationError } from './errors';
10
+ import { Emitter, Event } from './event';
11
+ import { Disposable, DisposableMap, DisposableStore, IDisposable, isDisposable, MutableDisposable, toDisposable } from './lifecycle';
12
+ import { extUri as defaultExtUri, IExtUri } from './resources';
13
+ import { URI } from './uri';
14
+ import { setTimeout0 } from './platform';
15
+ import { MicrotaskDelay } from './symbols';
16
+ import { Lazy } from './lazy';
17
+
18
+ export function isThenable<T>(obj: unknown): obj is Promise<T> {
19
+ return !!obj && typeof (obj as unknown as Promise<T>).then === 'function';
20
+ }
21
+
22
+ export interface CancelablePromise<T> extends Promise<T> {
23
+ cancel(): void;
24
+ }
25
+
26
+ /**
27
+ * Returns a promise that can be cancelled using the provided cancellation token.
28
+ *
29
+ * @remarks When cancellation is requested, the promise will be rejected with a {@link CancellationError}.
30
+ * If the promise resolves to a disposable object, it will be automatically disposed when cancellation
31
+ * is requested.
32
+ *
33
+ * @param callback A function that accepts a cancellation token and returns a promise
34
+ * @returns A promise that can be cancelled
35
+ */
36
+ export function createCancelablePromise<T>(callback: (token: CancellationToken) => Promise<T>): CancelablePromise<T> {
37
+ const source = new CancellationTokenSource();
38
+
39
+ const thenable = callback(source.token);
40
+
41
+ let isCancelled = false;
42
+
43
+ const promise = new Promise<T>((resolve, reject) => {
44
+ const subscription = source.token.onCancellationRequested(() => {
45
+ isCancelled = true;
46
+ subscription.dispose();
47
+ reject(new CancellationError());
48
+ });
49
+ Promise.resolve(thenable).then(value => {
50
+ subscription.dispose();
51
+ source.dispose();
52
+
53
+ if (!isCancelled) {
54
+ resolve(value);
55
+
56
+ } else if (isDisposable(value)) {
57
+ // promise has been cancelled, result is disposable and will
58
+ // be cleaned up
59
+ value.dispose();
60
+ }
61
+ }, err => {
62
+ subscription.dispose();
63
+ source.dispose();
64
+ reject(err);
65
+ });
66
+ });
67
+
68
+ return <CancelablePromise<T>>new class {
69
+ cancel() {
70
+ source.cancel();
71
+ source.dispose();
72
+ }
73
+ then<TResult1 = T, TResult2 = never>(resolve?: ((value: T) => TResult1 | Promise<TResult1>) | undefined | null, reject?: ((reason: unknown) => TResult2 | Promise<TResult2>) | undefined | null): Promise<TResult1 | TResult2> {
74
+ return promise.then(resolve, reject);
75
+ }
76
+ catch<TResult = never>(reject?: ((reason: unknown) => TResult | Promise<TResult>) | undefined | null): Promise<T | TResult> {
77
+ return this.then(undefined, reject);
78
+ }
79
+ finally(onfinally?: (() => void) | undefined | null): Promise<T> {
80
+ return promise.finally(onfinally);
81
+ }
82
+ };
83
+ }
84
+
85
+ /**
86
+ * Returns a promise that resolves with `undefined` as soon as the passed token is cancelled.
87
+ * @see {@link raceCancellationError}
88
+ */
89
+ export function raceCancellation<T>(promise: Promise<T>, token: CancellationToken): Promise<T | undefined>;
90
+
91
+ /**
92
+ * Returns a promise that resolves with `defaultValue` as soon as the passed token is cancelled.
93
+ * @see {@link raceCancellationError}
94
+ */
95
+ export function raceCancellation<T>(promise: Promise<T>, token: CancellationToken, defaultValue: T): Promise<T>;
96
+
97
+ export function raceCancellation<T>(promise: Promise<T>, token: CancellationToken, defaultValue?: T): Promise<T | undefined> {
98
+ return new Promise((resolve, reject) => {
99
+ const ref = token.onCancellationRequested(() => {
100
+ ref.dispose();
101
+ resolve(defaultValue);
102
+ });
103
+ promise.then(resolve, reject).finally(() => ref.dispose());
104
+ });
105
+ }
106
+
107
+ /**
108
+ * Returns a promise that rejects with an {@CancellationError} as soon as the passed token is cancelled.
109
+ * @see {@link raceCancellation}
110
+ */
111
+ export function raceCancellationError<T>(promise: Promise<T>, token: CancellationToken): Promise<T> {
112
+ return new Promise((resolve, reject) => {
113
+ const ref = token.onCancellationRequested(() => {
114
+ ref.dispose();
115
+ reject(new CancellationError());
116
+ });
117
+ promise.then(resolve, reject).finally(() => ref.dispose());
118
+ });
119
+ }
120
+
121
+ /**
122
+ * Wraps a cancellable promise such that it is no cancellable. Can be used to
123
+ * avoid issues with shared promises that would normally be returned as
124
+ * cancellable to consumers.
125
+ */
126
+ export function notCancellablePromise<T>(promise: CancelablePromise<T>): Promise<T> {
127
+ return new Promise<T>((resolve, reject) => {
128
+ promise.then(resolve, reject);
129
+ });
130
+ }
131
+
132
+ /**
133
+ * Returns as soon as one of the promises resolves or rejects and cancels remaining promises
134
+ */
135
+ export function raceCancellablePromises<T>(cancellablePromises: (CancelablePromise<T> | Promise<T>)[]): CancelablePromise<T> {
136
+ let resolvedPromiseIndex = -1;
137
+ const promises = cancellablePromises.map((promise, index) => promise.then(result => { resolvedPromiseIndex = index; return result; }));
138
+ const promise = Promise.race(promises) as CancelablePromise<T>;
139
+ promise.cancel = () => {
140
+ cancellablePromises.forEach((cancellablePromise, index) => {
141
+ if (index !== resolvedPromiseIndex && (cancellablePromise as CancelablePromise<T>).cancel) {
142
+ (cancellablePromise as CancelablePromise<T>).cancel();
143
+ }
144
+ });
145
+ };
146
+ promise.finally(() => {
147
+ promise.cancel();
148
+ });
149
+ return promise;
150
+ }
151
+
152
+ export function raceTimeout<T>(promise: Promise<T>, timeout: number, onTimeout?: () => void): Promise<T | undefined> {
153
+ let promiseResolve: ((value: T | undefined) => void) | undefined = undefined;
154
+
155
+ const timer = setTimeout(() => {
156
+ promiseResolve?.(undefined);
157
+ onTimeout?.();
158
+ }, timeout);
159
+
160
+ return Promise.race([
161
+ promise.finally(() => clearTimeout(timer)),
162
+ new Promise<T | undefined>(resolve => promiseResolve = resolve)
163
+ ]);
164
+ }
165
+
166
+ export function asPromise<T>(callback: () => T | Thenable<T>): Promise<T> {
167
+ return new Promise<T>((resolve, reject) => {
168
+ const item = callback();
169
+ if (isThenable<T>(item)) {
170
+ item.then(resolve, reject);
171
+ } else {
172
+ resolve(item);
173
+ }
174
+ });
175
+ }
176
+
177
+ /**
178
+ * Creates and returns a new promise, plus its `resolve` and `reject` callbacks.
179
+ *
180
+ * Replace with standardized [`Promise.withResolvers`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers) once it is supported
181
+ */
182
+ export function promiseWithResolvers<T>(): { promise: Promise<T>; resolve: (value: T | PromiseLike<T>) => void; reject: (err?: any) => void } {
183
+ let resolve: (value: T | PromiseLike<T>) => void;
184
+ let reject: (reason?: any) => void;
185
+ const promise = new Promise<T>((res, rej) => {
186
+ resolve = res;
187
+ reject = rej;
188
+ });
189
+ return { promise, resolve: resolve!, reject: reject! };
190
+ }
191
+
192
+ export interface ITask<T> {
193
+ (): T;
194
+ }
195
+
196
+ /**
197
+ * A helper to prevent accumulation of sequential async tasks.
198
+ *
199
+ * Imagine a mail man with the sole task of delivering letters. As soon as
200
+ * a letter submitted for delivery, he drives to the destination, delivers it
201
+ * and returns to his base. Imagine that during the trip, N more letters were submitted.
202
+ * When the mail man returns, he picks those N letters and delivers them all in a
203
+ * single trip. Even though N+1 submissions occurred, only 2 deliveries were made.
204
+ *
205
+ * The throttler implements this via the queue() method, by providing it a task
206
+ * factory. Following the example:
207
+ *
208
+ * const throttler = new Throttler();
209
+ * const letters = [];
210
+ *
211
+ * function deliver() {
212
+ * const lettersToDeliver = letters;
213
+ * letters = [];
214
+ * return makeTheTrip(lettersToDeliver);
215
+ * }
216
+ *
217
+ * function onLetterReceived(l) {
218
+ * letters.push(l);
219
+ * throttler.queue(deliver);
220
+ * }
221
+ */
222
+ export class Throttler implements IDisposable {
223
+
224
+ private activePromise: Promise<any> | null;
225
+ private queuedPromise: Promise<any> | null;
226
+ private queuedPromiseFactory: ITask<Promise<any>> | null;
227
+
228
+ private isDisposed = false;
229
+
230
+ constructor() {
231
+ this.activePromise = null;
232
+ this.queuedPromise = null;
233
+ this.queuedPromiseFactory = null;
234
+ }
235
+
236
+ queue<T>(promiseFactory: ITask<Promise<T>>): Promise<T> {
237
+ if (this.isDisposed) {
238
+ return Promise.reject(new Error('Throttler is disposed'));
239
+ }
240
+
241
+ if (this.activePromise) {
242
+ this.queuedPromiseFactory = promiseFactory;
243
+
244
+ if (!this.queuedPromise) {
245
+ const onComplete = () => {
246
+ this.queuedPromise = null;
247
+
248
+ if (this.isDisposed) {
249
+ return;
250
+ }
251
+
252
+ const result = this.queue(this.queuedPromiseFactory!);
253
+ this.queuedPromiseFactory = null;
254
+
255
+ return result;
256
+ };
257
+
258
+ this.queuedPromise = new Promise(resolve => {
259
+ this.activePromise!.then(onComplete, onComplete).then(resolve);
260
+ });
261
+ }
262
+
263
+ return new Promise((resolve, reject) => {
264
+ this.queuedPromise!.then(resolve, reject);
265
+ });
266
+ }
267
+
268
+ this.activePromise = promiseFactory();
269
+
270
+ return new Promise((resolve, reject) => {
271
+ this.activePromise!.then((result: T) => {
272
+ this.activePromise = null;
273
+ resolve(result);
274
+ }, (err: unknown) => {
275
+ this.activePromise = null;
276
+ reject(err);
277
+ });
278
+ });
279
+ }
280
+
281
+ dispose(): void {
282
+ this.isDisposed = true;
283
+ }
284
+ }
285
+
286
+ export class Sequencer {
287
+
288
+ private current: Promise<unknown> = Promise.resolve(null);
289
+
290
+ queue<T>(promiseTask: ITask<Promise<T>>): Promise<T> {
291
+ return this.current = this.current.then(() => promiseTask(), () => promiseTask());
292
+ }
293
+ }
294
+
295
+ export class SequencerByKey<TKey> {
296
+
297
+ private promiseMap = new Map<TKey, Promise<unknown>>();
298
+
299
+ queue<T>(key: TKey, promiseTask: ITask<Promise<T>>): Promise<T> {
300
+ const runningPromise = this.promiseMap.get(key) ?? Promise.resolve();
301
+ const newPromise = runningPromise
302
+ .catch(() => { })
303
+ .then(promiseTask)
304
+ .finally(() => {
305
+ if (this.promiseMap.get(key) === newPromise) {
306
+ this.promiseMap.delete(key);
307
+ }
308
+ });
309
+ this.promiseMap.set(key, newPromise);
310
+ return newPromise;
311
+ }
312
+
313
+ keys(): IterableIterator<TKey> {
314
+ return this.promiseMap.keys();
315
+ }
316
+ }
317
+
318
+ interface IScheduledLater extends IDisposable {
319
+ isTriggered(): boolean;
320
+ }
321
+
322
+ const timeoutDeferred = (timeout: number, fn: () => void): IScheduledLater => {
323
+ let scheduled = true;
324
+ const handle = setTimeout(() => {
325
+ scheduled = false;
326
+ fn();
327
+ }, timeout);
328
+ return {
329
+ isTriggered: () => scheduled,
330
+ dispose: () => {
331
+ clearTimeout(handle);
332
+ scheduled = false;
333
+ },
334
+ };
335
+ };
336
+
337
+ const microtaskDeferred = (fn: () => void): IScheduledLater => {
338
+ let scheduled = true;
339
+ queueMicrotask(() => {
340
+ if (scheduled) {
341
+ scheduled = false;
342
+ fn();
343
+ }
344
+ });
345
+
346
+ return {
347
+ isTriggered: () => scheduled,
348
+ dispose: () => { scheduled = false; },
349
+ };
350
+ };
351
+
352
+ /**
353
+ * A helper to delay (debounce) execution of a task that is being requested often.
354
+ *
355
+ * Following the throttler, now imagine the mail man wants to optimize the number of
356
+ * trips proactively. The trip itself can be long, so he decides not to make the trip
357
+ * as soon as a letter is submitted. Instead he waits a while, in case more
358
+ * letters are submitted. After said waiting period, if no letters were submitted, he
359
+ * decides to make the trip. Imagine that N more letters were submitted after the first
360
+ * one, all within a short period of time between each other. Even though N+1
361
+ * submissions occurred, only 1 delivery was made.
362
+ *
363
+ * The delayer offers this behavior via the trigger() method, into which both the task
364
+ * to be executed and the waiting period (delay) must be passed in as arguments. Following
365
+ * the example:
366
+ *
367
+ * const delayer = new Delayer(WAITING_PERIOD);
368
+ * const letters = [];
369
+ *
370
+ * function letterReceived(l) {
371
+ * letters.push(l);
372
+ * delayer.trigger(() => { return makeTheTrip(); });
373
+ * }
374
+ */
375
+ export class Delayer<T> implements IDisposable {
376
+
377
+ private deferred: IScheduledLater | null;
378
+ private completionPromise: Promise<any> | null;
379
+ private doResolve: ((value?: any | Promise<any>) => void) | null;
380
+ private doReject: ((err: unknown) => void) | null;
381
+ private task: ITask<T | Promise<T>> | null;
382
+
383
+ constructor(public defaultDelay: number | typeof MicrotaskDelay) {
384
+ this.deferred = null;
385
+ this.completionPromise = null;
386
+ this.doResolve = null;
387
+ this.doReject = null;
388
+ this.task = null;
389
+ }
390
+
391
+ trigger(task: ITask<T | Promise<T>>, delay = this.defaultDelay): Promise<T> {
392
+ this.task = task;
393
+ this.cancelTimeout();
394
+
395
+ if (!this.completionPromise) {
396
+ this.completionPromise = new Promise((resolve, reject) => {
397
+ this.doResolve = resolve;
398
+ this.doReject = reject;
399
+ }).then(() => {
400
+ this.completionPromise = null;
401
+ this.doResolve = null;
402
+ if (this.task) {
403
+ const task = this.task;
404
+ this.task = null;
405
+ return task();
406
+ }
407
+ return undefined;
408
+ });
409
+ }
410
+
411
+ const fn = () => {
412
+ this.deferred = null;
413
+ this.doResolve?.(null);
414
+ };
415
+
416
+ this.deferred = delay === MicrotaskDelay ? microtaskDeferred(fn) : timeoutDeferred(delay, fn);
417
+
418
+ return this.completionPromise;
419
+ }
420
+
421
+ isTriggered(): boolean {
422
+ return !!this.deferred?.isTriggered();
423
+ }
424
+
425
+ cancel(): void {
426
+ this.cancelTimeout();
427
+
428
+ if (this.completionPromise) {
429
+ this.doReject?.(new CancellationError());
430
+ this.completionPromise = null;
431
+ }
432
+ }
433
+
434
+ private cancelTimeout(): void {
435
+ this.deferred?.dispose();
436
+ this.deferred = null;
437
+ }
438
+
439
+ dispose(): void {
440
+ this.cancel();
441
+ }
442
+ }
443
+
444
+ /**
445
+ * A helper to delay execution of a task that is being requested often, while
446
+ * preventing accumulation of consecutive executions, while the task runs.
447
+ *
448
+ * The mail man is clever and waits for a certain amount of time, before going
449
+ * out to deliver letters. While the mail man is going out, more letters arrive
450
+ * and can only be delivered once he is back. Once he is back the mail man will
451
+ * do one more trip to deliver the letters that have accumulated while he was out.
452
+ */
453
+ export class ThrottledDelayer<T> {
454
+
455
+ private delayer: Delayer<Promise<T>>;
456
+ private throttler: Throttler;
457
+
458
+ constructor(defaultDelay: number) {
459
+ this.delayer = new Delayer(defaultDelay);
460
+ this.throttler = new Throttler();
461
+ }
462
+
463
+ trigger(promiseFactory: ITask<Promise<T>>, delay?: number): Promise<T> {
464
+ return this.delayer.trigger(() => this.throttler.queue(promiseFactory), delay) as unknown as Promise<T>;
465
+ }
466
+
467
+ isTriggered(): boolean {
468
+ return this.delayer.isTriggered();
469
+ }
470
+
471
+ cancel(): void {
472
+ this.delayer.cancel();
473
+ }
474
+
475
+ dispose(): void {
476
+ this.delayer.dispose();
477
+ this.throttler.dispose();
478
+ }
479
+ }
480
+
481
+ /**
482
+ * A barrier that is initially closed and then becomes opened permanently.
483
+ */
484
+ export class Barrier {
485
+ private _isOpen: boolean;
486
+ private _promise: Promise<boolean>;
487
+ private _completePromise!: (v: boolean) => void;
488
+
489
+ constructor() {
490
+ this._isOpen = false;
491
+ this._promise = new Promise<boolean>((c, e) => {
492
+ this._completePromise = c;
493
+ });
494
+ }
495
+
496
+ isOpen(): boolean {
497
+ return this._isOpen;
498
+ }
499
+
500
+ open(): void {
501
+ this._isOpen = true;
502
+ this._completePromise(true);
503
+ }
504
+
505
+ wait(): Promise<boolean> {
506
+ return this._promise;
507
+ }
508
+ }
509
+
510
+ /**
511
+ * A barrier that is initially closed and then becomes opened permanently after a certain period of
512
+ * time or when open is called explicitly
513
+ */
514
+ export class AutoOpenBarrier extends Barrier {
515
+
516
+ private readonly _timeout: Timeout;
517
+
518
+ constructor(autoOpenTimeMs: number) {
519
+ super();
520
+ this._timeout = setTimeout(() => this.open(), autoOpenTimeMs);
521
+ }
522
+
523
+ override open(): void {
524
+ clearTimeout(this._timeout);
525
+ super.open();
526
+ }
527
+ }
528
+
529
+ export function timeout(millis: number): CancelablePromise<void>;
530
+ export function timeout(millis: number, token: CancellationToken): Promise<void>;
531
+ export function timeout(millis: number, token?: CancellationToken): CancelablePromise<void> | Promise<void> {
532
+ if (!token) {
533
+ return createCancelablePromise(token => timeout(millis, token));
534
+ }
535
+
536
+ return new Promise((resolve, reject) => {
537
+ const handle = setTimeout(() => {
538
+ disposable.dispose();
539
+ resolve();
540
+ }, millis);
541
+ const disposable = token.onCancellationRequested(() => {
542
+ clearTimeout(handle);
543
+ disposable.dispose();
544
+ reject(new CancellationError());
545
+ });
546
+ });
547
+ }
548
+
549
+ /**
550
+ * Creates a timeout that can be disposed using its returned value.
551
+ * @param handler The timeout handler.
552
+ * @param timeout An optional timeout in milliseconds.
553
+ * @param store An optional {@link DisposableStore} that will have the timeout disposable managed automatically.
554
+ *
555
+ * @example
556
+ * const store = new DisposableStore;
557
+ * // Call the timeout after 1000ms at which point it will be automatically
558
+ * // evicted from the store.
559
+ * const timeoutDisposable = disposableTimeout(() => {}, 1000, store);
560
+ *
561
+ * if (foo) {
562
+ * // Cancel the timeout and evict it from store.
563
+ * timeoutDisposable.dispose();
564
+ * }
565
+ */
566
+ export function disposableTimeout(handler: () => void, timeout = 0, store?: DisposableStore): IDisposable {
567
+ const timer = setTimeout(() => {
568
+ handler();
569
+ if (store) {
570
+ disposable.dispose();
571
+ }
572
+ }, timeout);
573
+ const disposable = toDisposable(() => {
574
+ clearTimeout(timer);
575
+ store?.delete(disposable);
576
+ });
577
+ store?.add(disposable);
578
+ return disposable;
579
+ }
580
+
581
+ /**
582
+ * Runs the provided list of promise factories in sequential order. The returned
583
+ * promise will complete to an array of results from each promise.
584
+ */
585
+
586
+ export function sequence<T>(promiseFactories: ITask<Promise<T>>[]): Promise<T[]> {
587
+ const results: T[] = [];
588
+ let index = 0;
589
+ const len = promiseFactories.length;
590
+
591
+ function next(): Promise<T> | null {
592
+ return index < len ? promiseFactories[index++]() : null;
593
+ }
594
+
595
+ function thenHandler(result: unknown): Promise<any> {
596
+ if (result !== undefined && result !== null) {
597
+ results.push(result as T);
598
+ }
599
+
600
+ const n = next();
601
+ if (n) {
602
+ return n.then(thenHandler);
603
+ }
604
+
605
+ return Promise.resolve(results);
606
+ }
607
+
608
+ return Promise.resolve(null).then(thenHandler);
609
+ }
610
+
611
+ export function first<T>(promiseFactories: ITask<Promise<T>>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null): Promise<T | null> {
612
+ let index = 0;
613
+ const len = promiseFactories.length;
614
+
615
+ const loop: () => Promise<T | null> = () => {
616
+ if (index >= len) {
617
+ return Promise.resolve(defaultValue);
618
+ }
619
+
620
+ const factory = promiseFactories[index++];
621
+ const promise = Promise.resolve(factory());
622
+
623
+ return promise.then(result => {
624
+ if (shouldStop(result)) {
625
+ return Promise.resolve(result);
626
+ }
627
+
628
+ return loop();
629
+ });
630
+ };
631
+
632
+ return loop();
633
+ }
634
+
635
+ /**
636
+ * Returns the result of the first promise that matches the "shouldStop",
637
+ * running all promises in parallel. Supports cancelable promises.
638
+ */
639
+ export function firstParallel<T>(promiseList: Promise<T>[], shouldStop?: (t: T) => boolean, defaultValue?: T | null): Promise<T | null>;
640
+ export function firstParallel<T, R extends T>(promiseList: Promise<T>[], shouldStop: (t: T) => t is R, defaultValue?: R | null): Promise<R | null>;
641
+ export function firstParallel<T>(promiseList: Promise<T>[], shouldStop: (t: T) => boolean = t => !!t, defaultValue: T | null = null) {
642
+ if (promiseList.length === 0) {
643
+ return Promise.resolve(defaultValue);
644
+ }
645
+
646
+ let todo = promiseList.length;
647
+ const finish = () => {
648
+ todo = -1;
649
+ for (const promise of promiseList) {
650
+ (promise as Partial<CancelablePromise<T>>).cancel?.();
651
+ }
652
+ };
653
+
654
+ return new Promise<T | null>((resolve, reject) => {
655
+ for (const promise of promiseList) {
656
+ promise.then(result => {
657
+ if (--todo >= 0 && shouldStop(result)) {
658
+ finish();
659
+ resolve(result);
660
+ } else if (todo === 0) {
661
+ resolve(defaultValue);
662
+ }
663
+ })
664
+ .catch(err => {
665
+ if (--todo >= 0) {
666
+ finish();
667
+ reject(err);
668
+ }
669
+ });
670
+ }
671
+ });
672
+ }
673
+
674
+ interface ILimitedTaskFactory<T> {
675
+ factory: ITask<Promise<T>>;
676
+ c: (value: T | Promise<T>) => void;
677
+ e: (error?: unknown) => void;
678
+ }
679
+
680
+ export interface ILimiter<T> {
681
+
682
+ readonly size: number;
683
+
684
+ queue(factory: ITask<Promise<T>>): Promise<T>;
685
+
686
+ clear(): void;
687
+ }
688
+
689
+ /**
690
+ * A helper to queue N promises and run them all with a max degree of parallelism. The helper
691
+ * ensures that at any time no more than M promises are running at the same time.
692
+ */
693
+ export class Limiter<T> implements ILimiter<T> {
694
+
695
+ private _size = 0;
696
+ private _isDisposed = false;
697
+ private runningPromises: number;
698
+ private readonly maxDegreeOfParalellism: number;
699
+ private readonly outstandingPromises: ILimitedTaskFactory<T>[];
700
+ private readonly _onDrained: Emitter<void>;
701
+
702
+ constructor(maxDegreeOfParalellism: number) {
703
+ this.maxDegreeOfParalellism = maxDegreeOfParalellism;
704
+ this.outstandingPromises = [];
705
+ this.runningPromises = 0;
706
+ this._onDrained = new Emitter<void>();
707
+ }
708
+
709
+ /**
710
+ *
711
+ * @returns A promise that resolved when all work is done (onDrained) or when
712
+ * there is nothing to do
713
+ */
714
+ whenIdle(): Promise<void> {
715
+ return this.size > 0
716
+ ? Event.toPromise(this.onDrained)
717
+ : Promise.resolve();
718
+ }
719
+
720
+ get onDrained(): Event<void> {
721
+ return this._onDrained.event;
722
+ }
723
+
724
+ get size(): number {
725
+ return this._size;
726
+ }
727
+
728
+ queue(factory: ITask<Promise<T>>): Promise<T> {
729
+ if (this._isDisposed) {
730
+ throw new Error('Object has been disposed');
731
+ }
732
+ this._size++;
733
+
734
+ return new Promise<T>((c, e) => {
735
+ this.outstandingPromises.push({ factory, c, e });
736
+ this.consume();
737
+ });
738
+ }
739
+
740
+ private consume(): void {
741
+ while (this.outstandingPromises.length && this.runningPromises < this.maxDegreeOfParalellism) {
742
+ const iLimitedTask = this.outstandingPromises.shift()!;
743
+ this.runningPromises++;
744
+
745
+ const promise = iLimitedTask.factory();
746
+ promise.then(iLimitedTask.c, iLimitedTask.e);
747
+ promise.then(() => this.consumed(), () => this.consumed());
748
+ }
749
+ }
750
+
751
+ private consumed(): void {
752
+ if (this._isDisposed) {
753
+ return;
754
+ }
755
+ this.runningPromises--;
756
+ if (--this._size === 0) {
757
+ this._onDrained.fire();
758
+ }
759
+
760
+ if (this.outstandingPromises.length > 0) {
761
+ this.consume();
762
+ }
763
+ }
764
+
765
+ clear(): void {
766
+ if (this._isDisposed) {
767
+ throw new Error('Object has been disposed');
768
+ }
769
+ this.outstandingPromises.length = 0;
770
+ this._size = this.runningPromises;
771
+ }
772
+
773
+ dispose(): void {
774
+ this._isDisposed = true;
775
+ this.outstandingPromises.length = 0; // stop further processing
776
+ this._size = 0;
777
+ this._onDrained.dispose();
778
+ }
779
+ }
780
+
781
+ /**
782
+ * A queue is handles one promise at a time and guarantees that at any time only one promise is executing.
783
+ */
784
+ export class Queue<T> extends Limiter<T> {
785
+
786
+ constructor() {
787
+ super(1);
788
+ }
789
+ }
790
+
791
+ /**
792
+ * Same as `Queue`, ensures that only 1 task is executed at the same time. The difference to `Queue` is that
793
+ * there is only 1 task about to be scheduled next. As such, calling `queue` while a task is executing will
794
+ * replace the currently queued task until it executes.
795
+ *
796
+ * As such, the returned promise may not be from the factory that is passed in but from the next factory that
797
+ * is running after having called `queue`.
798
+ */
799
+ export class LimitedQueue {
800
+
801
+ private readonly sequentializer = new TaskSequentializer();
802
+
803
+ private tasks = 0;
804
+
805
+ queue(factory: ITask<Promise<void>>): Promise<void> {
806
+ if (!this.sequentializer.isRunning()) {
807
+ return this.sequentializer.run(this.tasks++, factory());
808
+ }
809
+
810
+ return this.sequentializer.queue(() => {
811
+ return this.sequentializer.run(this.tasks++, factory());
812
+ });
813
+ }
814
+ }
815
+
816
+ /**
817
+ * A helper to organize queues per resource. The ResourceQueue makes sure to manage queues per resource
818
+ * by disposing them once the queue is empty.
819
+ */
820
+ export class ResourceQueue implements IDisposable {
821
+
822
+ private readonly queues = new Map<string, Queue<void>>();
823
+
824
+ private readonly drainers = new Set<DeferredPromise<void>>();
825
+
826
+ private drainListeners: DisposableMap<number> | undefined = undefined;
827
+ private drainListenerCount = 0;
828
+
829
+ async whenDrained(): Promise<void> {
830
+ if (this.isDrained()) {
831
+ return;
832
+ }
833
+
834
+ const promise = new DeferredPromise<void>();
835
+ this.drainers.add(promise);
836
+
837
+ return promise.p;
838
+ }
839
+
840
+ private isDrained(): boolean {
841
+ for (const [, queue] of this.queues) {
842
+ if (queue.size > 0) {
843
+ return false;
844
+ }
845
+ }
846
+
847
+ return true;
848
+ }
849
+
850
+ queueSize(resource: URI, extUri: IExtUri = defaultExtUri): number {
851
+ const key = extUri.getComparisonKey(resource);
852
+
853
+ return this.queues.get(key)?.size ?? 0;
854
+ }
855
+
856
+ queueFor(resource: URI, factory: ITask<Promise<void>>, extUri: IExtUri = defaultExtUri): Promise<void> {
857
+ const key = extUri.getComparisonKey(resource);
858
+
859
+ let queue = this.queues.get(key);
860
+ if (!queue) {
861
+ queue = new Queue<void>();
862
+ const drainListenerId = this.drainListenerCount++;
863
+ const drainListener = Event.once(queue.onDrained)(() => {
864
+ queue?.dispose();
865
+ this.queues.delete(key);
866
+ this.onDidQueueDrain();
867
+
868
+ this.drainListeners?.deleteAndDispose(drainListenerId);
869
+
870
+ if (this.drainListeners?.size === 0) {
871
+ this.drainListeners.dispose();
872
+ this.drainListeners = undefined;
873
+ }
874
+ });
875
+
876
+ if (!this.drainListeners) {
877
+ this.drainListeners = new DisposableMap();
878
+ }
879
+ this.drainListeners.set(drainListenerId, drainListener);
880
+
881
+ this.queues.set(key, queue);
882
+ }
883
+
884
+ return queue.queue(factory);
885
+ }
886
+
887
+ private onDidQueueDrain(): void {
888
+ if (!this.isDrained()) {
889
+ return; // not done yet
890
+ }
891
+
892
+ this.releaseDrainers();
893
+ }
894
+
895
+ private releaseDrainers(): void {
896
+ for (const drainer of this.drainers) {
897
+ drainer.complete();
898
+ }
899
+
900
+ this.drainers.clear();
901
+ }
902
+
903
+ dispose(): void {
904
+ for (const [, queue] of this.queues) {
905
+ queue.dispose();
906
+ }
907
+
908
+ this.queues.clear();
909
+
910
+ // Even though we might still have pending
911
+ // tasks queued, after the queues have been
912
+ // disposed, we can no longer track them, so
913
+ // we release drainers to prevent hanging
914
+ // promises when the resource queue is being
915
+ // disposed.
916
+ this.releaseDrainers();
917
+
918
+ this.drainListeners?.dispose();
919
+ }
920
+ }
921
+
922
+ export type Task<T = void> = () => (Promise<T> | T);
923
+
924
+ /**
925
+ * Processes tasks in the order they were scheduled.
926
+ */
927
+ export class TaskQueue {
928
+ private _runningTask: Task<any> | undefined = undefined;
929
+ private _pendingTasks: { task: Task<any>; deferred: DeferredPromise<any>; setUndefinedWhenCleared: boolean }[] = [];
930
+
931
+ /**
932
+ * Waits for the current and pending tasks to finish, then runs and awaits the given task.
933
+ * If the task is skipped because of clearPending, the promise is rejected with a CancellationError.
934
+ */
935
+ public schedule<T>(task: Task<T>): Promise<T> {
936
+ const deferred = new DeferredPromise<T>();
937
+ this._pendingTasks.push({ task, deferred, setUndefinedWhenCleared: false });
938
+ this._runIfNotRunning();
939
+ return deferred.p;
940
+ }
941
+
942
+ /**
943
+ * Waits for the current and pending tasks to finish, then runs and awaits the given task.
944
+ * If the task is skipped because of clearPending, the promise is resolved with undefined.
945
+ */
946
+ public scheduleSkipIfCleared<T>(task: Task<T>): Promise<T | undefined> {
947
+ const deferred = new DeferredPromise<T>();
948
+ this._pendingTasks.push({ task, deferred, setUndefinedWhenCleared: true });
949
+ this._runIfNotRunning();
950
+ return deferred.p;
951
+ }
952
+
953
+ private _runIfNotRunning(): void {
954
+ if (this._runningTask === undefined) {
955
+ this._processQueue();
956
+ }
957
+ }
958
+
959
+ private async _processQueue(): Promise<void> {
960
+ if (this._pendingTasks.length === 0) {
961
+ return;
962
+ }
963
+
964
+ const next = this._pendingTasks.shift();
965
+ if (!next) {
966
+ return;
967
+ }
968
+
969
+ if (this._runningTask) {
970
+ throw new BugIndicatingError();
971
+ }
972
+
973
+ this._runningTask = next.task;
974
+
975
+ try {
976
+ const result = await next.task();
977
+ next.deferred.complete(result);
978
+ } catch (e) {
979
+ next.deferred.error(e);
980
+ } finally {
981
+ this._runningTask = undefined;
982
+ this._processQueue();
983
+ }
984
+ }
985
+
986
+ /**
987
+ * Clears all pending tasks. Does not cancel the currently running task.
988
+ */
989
+ public clearPending(): void {
990
+ const tasks = this._pendingTasks;
991
+ this._pendingTasks = [];
992
+ for (const task of tasks) {
993
+ if (task.setUndefinedWhenCleared) {
994
+ task.deferred.complete(undefined);
995
+ } else {
996
+ task.deferred.error(new CancellationError());
997
+ }
998
+ }
999
+ }
1000
+ }
1001
+
1002
+ export class TimeoutTimer implements IDisposable {
1003
+ private _token: Timeout | undefined;
1004
+ private _isDisposed = false;
1005
+
1006
+ constructor();
1007
+ constructor(runner: () => void, timeout: number);
1008
+ constructor(runner?: () => void, timeout?: number) {
1009
+ this._token = undefined;
1010
+
1011
+ if (typeof runner === 'function' && typeof timeout === 'number') {
1012
+ this.setIfNotSet(runner, timeout);
1013
+ }
1014
+ }
1015
+
1016
+ dispose(): void {
1017
+ this.cancel();
1018
+ this._isDisposed = true;
1019
+ }
1020
+
1021
+ cancel(): void {
1022
+ if (this._token !== undefined) {
1023
+ clearTimeout(this._token);
1024
+ this._token = undefined;
1025
+ }
1026
+ }
1027
+
1028
+ cancelAndSet(runner: () => void, timeout: number): void {
1029
+ if (this._isDisposed) {
1030
+ throw new BugIndicatingError(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);
1031
+ }
1032
+
1033
+ this.cancel();
1034
+ this._token = setTimeout(() => {
1035
+ this._token = undefined;
1036
+ runner();
1037
+ }, timeout);
1038
+ }
1039
+
1040
+ setIfNotSet(runner: () => void, timeout: number): void {
1041
+ if (this._isDisposed) {
1042
+ throw new BugIndicatingError(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);
1043
+ }
1044
+
1045
+ if (this._token !== undefined) {
1046
+ // timer is already set
1047
+ return;
1048
+ }
1049
+ this._token = setTimeout(() => {
1050
+ this._token = undefined;
1051
+ runner();
1052
+ }, timeout);
1053
+ }
1054
+ }
1055
+
1056
+ export class IntervalTimer implements IDisposable {
1057
+
1058
+ private disposable: IDisposable | undefined = undefined;
1059
+ private isDisposed = false;
1060
+
1061
+ cancel(): void {
1062
+ this.disposable?.dispose();
1063
+ this.disposable = undefined;
1064
+ }
1065
+
1066
+ cancelAndSet(runner: () => void, interval: number, context = globalThis): void {
1067
+ if (this.isDisposed) {
1068
+ throw new BugIndicatingError(`Calling 'cancelAndSet' on a disposed IntervalTimer`);
1069
+ }
1070
+
1071
+ this.cancel();
1072
+ const handle = context.setInterval(() => {
1073
+ runner();
1074
+ }, interval);
1075
+
1076
+ this.disposable = toDisposable(() => {
1077
+ context.clearInterval(handle);
1078
+ this.disposable = undefined;
1079
+ });
1080
+ }
1081
+
1082
+ dispose(): void {
1083
+ this.cancel();
1084
+ this.isDisposed = true;
1085
+ }
1086
+ }
1087
+
1088
+ export class RunOnceScheduler implements IDisposable {
1089
+
1090
+ protected runner: ((...args: unknown[]) => void) | null;
1091
+
1092
+ private timeoutToken: Timeout | undefined;
1093
+ private timeout: number;
1094
+ private timeoutHandler: () => void;
1095
+
1096
+ constructor(runner: (...args: any[]) => void, delay: number) {
1097
+ this.timeoutToken = undefined;
1098
+ this.runner = runner;
1099
+ this.timeout = delay;
1100
+ this.timeoutHandler = this.onTimeout.bind(this);
1101
+ }
1102
+
1103
+ /**
1104
+ * Dispose RunOnceScheduler
1105
+ */
1106
+ dispose(): void {
1107
+ this.cancel();
1108
+ this.runner = null;
1109
+ }
1110
+
1111
+ /**
1112
+ * Cancel current scheduled runner (if any).
1113
+ */
1114
+ cancel(): void {
1115
+ if (this.isScheduled()) {
1116
+ clearTimeout(this.timeoutToken);
1117
+ this.timeoutToken = undefined;
1118
+ }
1119
+ }
1120
+
1121
+ /**
1122
+ * Cancel previous runner (if any) & schedule a new runner.
1123
+ */
1124
+ schedule(delay = this.timeout): void {
1125
+ this.cancel();
1126
+ this.timeoutToken = setTimeout(this.timeoutHandler, delay);
1127
+ }
1128
+
1129
+ get delay(): number {
1130
+ return this.timeout;
1131
+ }
1132
+
1133
+ set delay(value: number) {
1134
+ this.timeout = value;
1135
+ }
1136
+
1137
+ /**
1138
+ * Returns true if scheduled.
1139
+ */
1140
+ isScheduled(): boolean {
1141
+ return this.timeoutToken !== undefined;
1142
+ }
1143
+
1144
+ flush(): void {
1145
+ if (this.isScheduled()) {
1146
+ this.cancel();
1147
+ this.doRun();
1148
+ }
1149
+ }
1150
+
1151
+ private onTimeout() {
1152
+ this.timeoutToken = undefined;
1153
+ if (this.runner) {
1154
+ this.doRun();
1155
+ }
1156
+ }
1157
+
1158
+ protected doRun(): void {
1159
+ this.runner?.();
1160
+ }
1161
+ }
1162
+
1163
+ /**
1164
+ * Same as `RunOnceScheduler`, but doesn't count the time spent in sleep mode.
1165
+ * > **NOTE**: Only offers 1s resolution.
1166
+ *
1167
+ * When calling `setTimeout` with 3hrs, and putting the computer immediately to sleep
1168
+ * for 8hrs, `setTimeout` will fire **as soon as the computer wakes from sleep**. But
1169
+ * this scheduler will execute 3hrs **after waking the computer from sleep**.
1170
+ */
1171
+ export class ProcessTimeRunOnceScheduler {
1172
+
1173
+ private runner: (() => void) | null;
1174
+ private timeout: number;
1175
+
1176
+ private counter: number;
1177
+ private intervalToken: Timeout | undefined;
1178
+ private intervalHandler: () => void;
1179
+
1180
+ constructor(runner: () => void, delay: number) {
1181
+ if (delay % 1000 !== 0) {
1182
+ console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);
1183
+ }
1184
+ this.runner = runner;
1185
+ this.timeout = delay;
1186
+ this.counter = 0;
1187
+ this.intervalToken = undefined;
1188
+ this.intervalHandler = this.onInterval.bind(this);
1189
+ }
1190
+
1191
+ dispose(): void {
1192
+ this.cancel();
1193
+ this.runner = null;
1194
+ }
1195
+
1196
+ cancel(): void {
1197
+ if (this.isScheduled()) {
1198
+ clearInterval(this.intervalToken);
1199
+ this.intervalToken = undefined;
1200
+ }
1201
+ }
1202
+
1203
+ /**
1204
+ * Cancel previous runner (if any) & schedule a new runner.
1205
+ */
1206
+ schedule(delay = this.timeout): void {
1207
+ if (delay % 1000 !== 0) {
1208
+ console.warn(`ProcessTimeRunOnceScheduler resolution is 1s, ${delay}ms is not a multiple of 1000ms.`);
1209
+ }
1210
+ this.cancel();
1211
+ this.counter = Math.ceil(delay / 1000);
1212
+ this.intervalToken = setInterval(this.intervalHandler, 1000);
1213
+ }
1214
+
1215
+ /**
1216
+ * Returns true if scheduled.
1217
+ */
1218
+ isScheduled(): boolean {
1219
+ return this.intervalToken !== undefined;
1220
+ }
1221
+
1222
+ private onInterval() {
1223
+ this.counter--;
1224
+ if (this.counter > 0) {
1225
+ // still need to wait
1226
+ return;
1227
+ }
1228
+
1229
+ // time elapsed
1230
+ clearInterval(this.intervalToken);
1231
+ this.intervalToken = undefined;
1232
+ this.runner?.();
1233
+ }
1234
+ }
1235
+
1236
+ export class RunOnceWorker<T> extends RunOnceScheduler {
1237
+
1238
+ private units: T[] = [];
1239
+
1240
+ constructor(runner: (units: T[]) => void, timeout: number) {
1241
+ super(runner, timeout);
1242
+ }
1243
+
1244
+ work(unit: T): void {
1245
+ this.units.push(unit);
1246
+
1247
+ if (!this.isScheduled()) {
1248
+ this.schedule();
1249
+ }
1250
+ }
1251
+
1252
+ protected override doRun(): void {
1253
+ const units = this.units;
1254
+ this.units = [];
1255
+
1256
+ this.runner?.(units);
1257
+ }
1258
+
1259
+ override dispose(): void {
1260
+ this.units = [];
1261
+
1262
+ super.dispose();
1263
+ }
1264
+ }
1265
+
1266
+ export interface IThrottledWorkerOptions {
1267
+
1268
+ /**
1269
+ * maximum of units the worker will pass onto handler at once
1270
+ */
1271
+ maxWorkChunkSize: number;
1272
+
1273
+ /**
1274
+ * maximum of units the worker will keep in memory for processing
1275
+ */
1276
+ maxBufferedWork: number | undefined;
1277
+
1278
+ /**
1279
+ * delay before processing the next round of chunks when chunk size exceeds limits
1280
+ */
1281
+ throttleDelay: number;
1282
+
1283
+ /**
1284
+ * When enabled will guarantee that two distinct calls to `work()` are not executed
1285
+ * without throttle delay between them.
1286
+ * Otherwise if the worker isn't currently throttling it will execute work immediately.
1287
+ */
1288
+ waitThrottleDelayBetweenWorkUnits?: boolean;
1289
+ }
1290
+
1291
+ /**
1292
+ * The `ThrottledWorker` will accept units of work `T`
1293
+ * to handle. The contract is:
1294
+ * * there is a maximum of units the worker can handle at once (via `maxWorkChunkSize`)
1295
+ * * there is a maximum of units the worker will keep in memory for processing (via `maxBufferedWork`)
1296
+ * * after having handled `maxWorkChunkSize` units, the worker needs to rest (via `throttleDelay`)
1297
+ */
1298
+ export class ThrottledWorker<T> extends Disposable {
1299
+
1300
+ private readonly pendingWork: T[] = [];
1301
+
1302
+ private readonly throttler = this._register(new MutableDisposable<RunOnceScheduler>());
1303
+ private disposed = false;
1304
+ private lastExecutionTime = 0;
1305
+
1306
+ constructor(
1307
+ private options: IThrottledWorkerOptions,
1308
+ private readonly handler: (units: T[]) => void
1309
+ ) {
1310
+ super();
1311
+ }
1312
+
1313
+ /**
1314
+ * The number of work units that are pending to be processed.
1315
+ */
1316
+ get pending(): number { return this.pendingWork.length; }
1317
+
1318
+ /**
1319
+ * Add units to be worked on. Use `pending` to figure out
1320
+ * how many units are not yet processed after this method
1321
+ * was called.
1322
+ *
1323
+ * @returns whether the work was accepted or not. If the
1324
+ * worker is disposed, it will not accept any more work.
1325
+ * If the number of pending units would become larger
1326
+ * than `maxPendingWork`, more work will also not be accepted.
1327
+ */
1328
+ work(units: readonly T[]): boolean {
1329
+ if (this.disposed) {
1330
+ return false; // work not accepted: disposed
1331
+ }
1332
+
1333
+ // Check for reaching maximum of pending work
1334
+ if (typeof this.options.maxBufferedWork === 'number') {
1335
+
1336
+ // Throttled: simple check if pending + units exceeds max pending
1337
+ if (this.throttler.value) {
1338
+ if (this.pending + units.length > this.options.maxBufferedWork) {
1339
+ return false; // work not accepted: too much pending work
1340
+ }
1341
+ }
1342
+
1343
+ // Unthrottled: same as throttled, but account for max chunk getting
1344
+ // worked on directly without being pending
1345
+ else {
1346
+ if (this.pending + units.length - this.options.maxWorkChunkSize > this.options.maxBufferedWork) {
1347
+ return false; // work not accepted: too much pending work
1348
+ }
1349
+ }
1350
+ }
1351
+
1352
+ // Add to pending units first
1353
+ for (const unit of units) {
1354
+ this.pendingWork.push(unit);
1355
+ }
1356
+
1357
+ const timeSinceLastExecution = Date.now() - this.lastExecutionTime;
1358
+
1359
+ if (!this.throttler.value && (!this.options.waitThrottleDelayBetweenWorkUnits || timeSinceLastExecution >= this.options.throttleDelay)) {
1360
+ // Work directly if we are not throttling and we are not
1361
+ // enforced to throttle between `work()` calls.
1362
+ this.doWork();
1363
+ } else if (!this.throttler.value && this.options.waitThrottleDelayBetweenWorkUnits) {
1364
+ // Otherwise, schedule the throttler to work.
1365
+ this.scheduleThrottler(Math.max(this.options.throttleDelay - timeSinceLastExecution, 0));
1366
+ } else {
1367
+ // Otherwise, our work will be picked up by the running throttler
1368
+ }
1369
+
1370
+ return true; // work accepted
1371
+ }
1372
+
1373
+ private doWork(): void {
1374
+ this.lastExecutionTime = Date.now();
1375
+
1376
+ // Extract chunk to handle and handle it
1377
+ this.handler(this.pendingWork.splice(0, this.options.maxWorkChunkSize));
1378
+
1379
+ // If we have remaining work, schedule it after a delay
1380
+ if (this.pendingWork.length > 0) {
1381
+ this.scheduleThrottler();
1382
+ }
1383
+ }
1384
+
1385
+ private scheduleThrottler(delay = this.options.throttleDelay): void {
1386
+ this.throttler.value = new RunOnceScheduler(() => {
1387
+ this.throttler.clear();
1388
+
1389
+ this.doWork();
1390
+ }, delay);
1391
+ this.throttler.value.schedule();
1392
+ }
1393
+
1394
+ override dispose(): void {
1395
+ super.dispose();
1396
+
1397
+ this.pendingWork.length = 0;
1398
+ this.disposed = true;
1399
+ }
1400
+ }
1401
+
1402
+ //#region -- run on idle tricks ------------
1403
+
1404
+ export interface IdleDeadline {
1405
+ readonly didTimeout: boolean;
1406
+ timeRemaining(): number;
1407
+ }
1408
+
1409
+ type IdleApi = Pick<typeof globalThis, 'requestIdleCallback' | 'cancelIdleCallback'>;
1410
+
1411
+
1412
+ /**
1413
+ * Execute the callback the next time the browser is idle, returning an
1414
+ * {@link IDisposable} that will cancel the callback when disposed. This wraps
1415
+ * [requestIdleCallback] so it will fallback to [setTimeout] if the environment
1416
+ * doesn't support it.
1417
+ *
1418
+ * @param callback The callback to run when idle, this includes an
1419
+ * [IdleDeadline] that provides the time alloted for the idle callback by the
1420
+ * browser. Not respecting this deadline will result in a degraded user
1421
+ * experience.
1422
+ * @param timeout A timeout at which point to queue no longer wait for an idle
1423
+ * callback but queue it on the regular event loop (like setTimeout). Typically
1424
+ * this should not be used.
1425
+ *
1426
+ * [IdleDeadline]: https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline
1427
+ * [requestIdleCallback]: https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback
1428
+ * [setTimeout]: https://developer.mozilla.org/en-US/docs/Web/API/Window/setTimeout
1429
+ *
1430
+ * **Note** that there is `dom.ts#runWhenWindowIdle` which is better suited when running inside a browser
1431
+ * context
1432
+ */
1433
+ export let runWhenGlobalIdle: (callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;
1434
+
1435
+ export let _runWhenIdle: (targetWindow: IdleApi, callback: (idle: IdleDeadline) => void, timeout?: number) => IDisposable;
1436
+
1437
+ (function () {
1438
+ const safeGlobal: any = globalThis;
1439
+ if (typeof safeGlobal.requestIdleCallback !== 'function' || typeof safeGlobal.cancelIdleCallback !== 'function') {
1440
+ _runWhenIdle = (_targetWindow, runner, timeout?) => {
1441
+ setTimeout0(() => {
1442
+ if (disposed) {
1443
+ return;
1444
+ }
1445
+ const end = Date.now() + 15; // one frame at 64fps
1446
+ const deadline: IdleDeadline = {
1447
+ didTimeout: true,
1448
+ timeRemaining() {
1449
+ return Math.max(0, end - Date.now());
1450
+ }
1451
+ };
1452
+ runner(Object.freeze(deadline));
1453
+ });
1454
+ let disposed = false;
1455
+ return {
1456
+ dispose() {
1457
+ if (disposed) {
1458
+ return;
1459
+ }
1460
+ disposed = true;
1461
+ }
1462
+ };
1463
+ };
1464
+ } else {
1465
+ _runWhenIdle = (targetWindow: typeof safeGlobal, runner, timeout?) => {
1466
+ const handle: number = targetWindow.requestIdleCallback(runner, typeof timeout === 'number' ? { timeout } : undefined);
1467
+ let disposed = false;
1468
+ return {
1469
+ dispose() {
1470
+ if (disposed) {
1471
+ return;
1472
+ }
1473
+ disposed = true;
1474
+ targetWindow.cancelIdleCallback(handle);
1475
+ }
1476
+ };
1477
+ };
1478
+ }
1479
+ runWhenGlobalIdle = (runner, timeout) => _runWhenIdle(globalThis, runner, timeout);
1480
+ })();
1481
+
1482
+ export abstract class AbstractIdleValue<T> {
1483
+
1484
+ private readonly _executor: () => void;
1485
+ private readonly _handle: IDisposable;
1486
+
1487
+ private _didRun: boolean = false;
1488
+ private _value?: T;
1489
+ private _error: unknown;
1490
+
1491
+ constructor(targetWindow: IdleApi, executor: () => T) {
1492
+ this._executor = () => {
1493
+ try {
1494
+ this._value = executor();
1495
+ } catch (err) {
1496
+ this._error = err;
1497
+ } finally {
1498
+ this._didRun = true;
1499
+ }
1500
+ };
1501
+ this._handle = _runWhenIdle(targetWindow, () => this._executor());
1502
+ }
1503
+
1504
+ dispose(): void {
1505
+ this._handle.dispose();
1506
+ }
1507
+
1508
+ get value(): T {
1509
+ if (!this._didRun) {
1510
+ this._handle.dispose();
1511
+ this._executor();
1512
+ }
1513
+ if (this._error) {
1514
+ throw this._error;
1515
+ }
1516
+ return this._value!;
1517
+ }
1518
+
1519
+ get isInitialized(): boolean {
1520
+ return this._didRun;
1521
+ }
1522
+ }
1523
+
1524
+ /**
1525
+ * An `IdleValue` that always uses the current window (which might be throttled or inactive)
1526
+ *
1527
+ * **Note** that there is `dom.ts#WindowIdleValue` which is better suited when running inside a browser
1528
+ * context
1529
+ */
1530
+ export class GlobalIdleValue<T> extends AbstractIdleValue<T> {
1531
+
1532
+ constructor(executor: () => T) {
1533
+ super(globalThis, executor);
1534
+ }
1535
+ }
1536
+
1537
+ //#endregion
1538
+
1539
+ export async function retry<T>(task: ITask<Promise<T>>, delay: number, retries: number): Promise<T> {
1540
+ let lastError: Error | undefined;
1541
+
1542
+ for (let i = 0; i < retries; i++) {
1543
+ try {
1544
+ return await task();
1545
+ } catch (error) {
1546
+ lastError = error;
1547
+
1548
+ await timeout(delay);
1549
+ }
1550
+ }
1551
+
1552
+ throw lastError;
1553
+ }
1554
+
1555
+ //#region Task Sequentializer
1556
+
1557
+ interface IRunningTask {
1558
+ readonly taskId: number;
1559
+ readonly cancel: () => void;
1560
+ readonly promise: Promise<void>;
1561
+ }
1562
+
1563
+ interface IQueuedTask {
1564
+ readonly promise: Promise<void>;
1565
+ readonly promiseResolve: () => void;
1566
+ readonly promiseReject: (error: Error) => void;
1567
+ run: ITask<Promise<void>>;
1568
+ }
1569
+
1570
+ export interface ITaskSequentializerWithRunningTask {
1571
+ readonly running: Promise<void>;
1572
+ }
1573
+
1574
+ export interface ITaskSequentializerWithQueuedTask {
1575
+ readonly queued: IQueuedTask;
1576
+ }
1577
+
1578
+ /**
1579
+ * @deprecated use `LimitedQueue` instead for an easier to use API
1580
+ */
1581
+ export class TaskSequentializer {
1582
+
1583
+ private _running?: IRunningTask;
1584
+ private _queued?: IQueuedTask;
1585
+
1586
+ isRunning(taskId?: number): this is ITaskSequentializerWithRunningTask {
1587
+ if (typeof taskId === 'number') {
1588
+ return this._running?.taskId === taskId;
1589
+ }
1590
+
1591
+ return !!this._running;
1592
+ }
1593
+
1594
+ get running(): Promise<void> | undefined {
1595
+ return this._running?.promise;
1596
+ }
1597
+
1598
+ cancelRunning(): void {
1599
+ this._running?.cancel();
1600
+ }
1601
+
1602
+ run(taskId: number, promise: Promise<void>, onCancel?: () => void,): Promise<void> {
1603
+ this._running = { taskId, cancel: () => onCancel?.(), promise };
1604
+
1605
+ promise.then(() => this.doneRunning(taskId), () => this.doneRunning(taskId));
1606
+
1607
+ return promise;
1608
+ }
1609
+
1610
+ private doneRunning(taskId: number): void {
1611
+ if (this._running && taskId === this._running.taskId) {
1612
+
1613
+ // only set running to done if the promise finished that is associated with that taskId
1614
+ this._running = undefined;
1615
+
1616
+ // schedule the queued task now that we are free if we have any
1617
+ this.runQueued();
1618
+ }
1619
+ }
1620
+
1621
+ private runQueued(): void {
1622
+ if (this._queued) {
1623
+ const queued = this._queued;
1624
+ this._queued = undefined;
1625
+
1626
+ // Run queued task and complete on the associated promise
1627
+ queued.run().then(queued.promiseResolve, queued.promiseReject);
1628
+ }
1629
+ }
1630
+
1631
+ /**
1632
+ * Note: the promise to schedule as next run MUST itself call `run`.
1633
+ * Otherwise, this sequentializer will report `false` for `isRunning`
1634
+ * even when this task is running. Missing this detail means that
1635
+ * suddenly multiple tasks will run in parallel.
1636
+ */
1637
+ queue(run: ITask<Promise<void>>): Promise<void> {
1638
+
1639
+ // this is our first queued task, so we create associated promise with it
1640
+ // so that we can return a promise that completes when the task has
1641
+ // completed.
1642
+ if (!this._queued) {
1643
+ const { promise, resolve: promiseResolve, reject: promiseReject } = promiseWithResolvers<void>();
1644
+ this._queued = {
1645
+ run,
1646
+ promise,
1647
+ promiseResolve: promiseResolve!,
1648
+ promiseReject: promiseReject!
1649
+ };
1650
+ }
1651
+
1652
+ // we have a previous queued task, just overwrite it
1653
+ else {
1654
+ this._queued.run = run;
1655
+ }
1656
+
1657
+ return this._queued.promise;
1658
+ }
1659
+
1660
+ hasQueued(): this is ITaskSequentializerWithQueuedTask {
1661
+ return !!this._queued;
1662
+ }
1663
+
1664
+ async join(): Promise<void> {
1665
+ return this._queued?.promise ?? this._running?.promise;
1666
+ }
1667
+ }
1668
+
1669
+ //#endregion
1670
+
1671
+ //#region
1672
+
1673
+ /**
1674
+ * The `IntervalCounter` allows to count the number
1675
+ * of calls to `increment()` over a duration of
1676
+ * `interval`. This utility can be used to conditionally
1677
+ * throttle a frequent task when a certain threshold
1678
+ * is reached.
1679
+ */
1680
+ export class IntervalCounter {
1681
+
1682
+ private lastIncrementTime = 0;
1683
+
1684
+ private value = 0;
1685
+
1686
+ constructor(private readonly interval: number, private readonly nowFn = () => Date.now()) { }
1687
+
1688
+ increment(): number {
1689
+ const now = this.nowFn();
1690
+
1691
+ // We are outside of the range of `interval` and as such
1692
+ // start counting from 0 and remember the time
1693
+ if (now - this.lastIncrementTime > this.interval) {
1694
+ this.lastIncrementTime = now;
1695
+ this.value = 0;
1696
+ }
1697
+
1698
+ this.value++;
1699
+
1700
+ return this.value;
1701
+ }
1702
+ }
1703
+
1704
+ //#endregion
1705
+
1706
+ //#region
1707
+
1708
+ export type ValueCallback<T = unknown> = (value: T | Promise<T>) => void;
1709
+
1710
+ const enum DeferredOutcome {
1711
+ Resolved,
1712
+ Rejected
1713
+ }
1714
+
1715
+ /**
1716
+ * Creates a promise whose resolution or rejection can be controlled imperatively.
1717
+ */
1718
+ export class DeferredPromise<T> {
1719
+
1720
+ private completeCallback!: ValueCallback<T>;
1721
+ private errorCallback!: (err: unknown) => void;
1722
+ private outcome?: { outcome: DeferredOutcome.Rejected; value: unknown } | { outcome: DeferredOutcome.Resolved; value: T };
1723
+
1724
+ public get isRejected() {
1725
+ return this.outcome?.outcome === DeferredOutcome.Rejected;
1726
+ }
1727
+
1728
+ public get isResolved() {
1729
+ return this.outcome?.outcome === DeferredOutcome.Resolved;
1730
+ }
1731
+
1732
+ public get isSettled() {
1733
+ return !!this.outcome;
1734
+ }
1735
+
1736
+ public get value() {
1737
+ return this.outcome?.outcome === DeferredOutcome.Resolved ? this.outcome?.value : undefined;
1738
+ }
1739
+
1740
+ public readonly p: Promise<T>;
1741
+
1742
+ constructor() {
1743
+ this.p = new Promise<T>((c, e) => {
1744
+ this.completeCallback = c;
1745
+ this.errorCallback = e;
1746
+ });
1747
+ }
1748
+
1749
+ public complete(value: T) {
1750
+ return new Promise<void>(resolve => {
1751
+ this.completeCallback(value);
1752
+ this.outcome = { outcome: DeferredOutcome.Resolved, value };
1753
+ resolve();
1754
+ });
1755
+ }
1756
+
1757
+ public error(err: unknown) {
1758
+ return new Promise<void>(resolve => {
1759
+ this.errorCallback(err);
1760
+ this.outcome = { outcome: DeferredOutcome.Rejected, value: err };
1761
+ resolve();
1762
+ });
1763
+ }
1764
+
1765
+ public settleWith(promise: Promise<T>): Promise<void> {
1766
+ return promise.then(
1767
+ value => this.complete(value),
1768
+ error => this.error(error)
1769
+ );
1770
+ }
1771
+
1772
+ public cancel() {
1773
+ return this.error(new CancellationError());
1774
+ }
1775
+ }
1776
+
1777
+ //#endregion
1778
+
1779
+ //#region Promises
1780
+
1781
+ export namespace Promises {
1782
+
1783
+ /**
1784
+ * A drop-in replacement for `Promise.all` with the only difference
1785
+ * that the method awaits every promise to either fulfill or reject.
1786
+ *
1787
+ * Similar to `Promise.all`, only the first error will be returned
1788
+ * if any.
1789
+ */
1790
+ export async function settled<T>(promises: Promise<T>[]): Promise<T[]> {
1791
+ let firstError: Error | undefined = undefined;
1792
+
1793
+ const result = await Promise.all(promises.map(promise => promise.then(value => value, error => {
1794
+ if (!firstError) {
1795
+ firstError = error;
1796
+ }
1797
+
1798
+ return undefined; // do not rethrow so that other promises can settle
1799
+ })));
1800
+
1801
+ if (typeof firstError !== 'undefined') {
1802
+ throw firstError;
1803
+ }
1804
+
1805
+ return result as unknown as T[]; // cast is needed and protected by the `throw` above
1806
+ }
1807
+
1808
+ /**
1809
+ * A helper to create a new `Promise<T>` with a body that is a promise
1810
+ * itself. By default, an error that raises from the async body will
1811
+ * end up as a unhandled rejection, so this utility properly awaits the
1812
+ * body and rejects the promise as a normal promise does without async
1813
+ * body.
1814
+ *
1815
+ * This method should only be used in rare cases where otherwise `async`
1816
+ * cannot be used (e.g. when callbacks are involved that require this).
1817
+ */
1818
+ export function withAsyncBody<T, E = Error>(bodyFn: (resolve: (value: T) => unknown, reject: (error: E) => unknown) => Promise<unknown>): Promise<T> {
1819
+ // eslint-disable-next-line no-async-promise-executor
1820
+ return new Promise<T>(async (resolve, reject) => {
1821
+ try {
1822
+ await bodyFn(resolve, reject);
1823
+ } catch (error) {
1824
+ reject(error);
1825
+ }
1826
+ });
1827
+ }
1828
+ }
1829
+
1830
+ export class StatefulPromise<T> {
1831
+ private _value: T | undefined = undefined;
1832
+ get value(): T | undefined { return this._value; }
1833
+
1834
+ private _error: unknown = undefined;
1835
+ get error(): unknown { return this._error; }
1836
+
1837
+ private _isResolved = false;
1838
+ get isResolved() { return this._isResolved; }
1839
+
1840
+ public readonly promise: Promise<T>;
1841
+
1842
+ constructor(promise: Promise<T>) {
1843
+ this.promise = promise.then(
1844
+ value => {
1845
+ this._value = value;
1846
+ this._isResolved = true;
1847
+ return value;
1848
+ },
1849
+ error => {
1850
+ this._error = error;
1851
+ this._isResolved = true;
1852
+ throw error;
1853
+ }
1854
+ );
1855
+ }
1856
+
1857
+ /**
1858
+ * Returns the resolved value.
1859
+ * Throws if the promise is not resolved yet.
1860
+ */
1861
+ public requireValue(): T {
1862
+ if (!this._isResolved) {
1863
+ throw new BugIndicatingError('Promise is not resolved yet');
1864
+ }
1865
+ if (this._error) {
1866
+ throw this._error;
1867
+ }
1868
+ return this._value!;
1869
+ }
1870
+ }
1871
+
1872
+ export class LazyStatefulPromise<T> {
1873
+ private readonly _promise = new Lazy(() => new StatefulPromise(this._compute()));
1874
+
1875
+ constructor(
1876
+ private readonly _compute: () => Promise<T>,
1877
+ ) { }
1878
+
1879
+ /**
1880
+ * Returns the resolved value.
1881
+ * Throws if the promise is not resolved yet.
1882
+ */
1883
+ public requireValue(): T {
1884
+ return this._promise.value.requireValue();
1885
+ }
1886
+
1887
+ /**
1888
+ * Returns the promise (and triggers a computation of the promise if not yet done so).
1889
+ */
1890
+ public getPromise(): Promise<T> {
1891
+ return this._promise.value.promise;
1892
+ }
1893
+
1894
+ /**
1895
+ * Reads the current value without triggering a computation of the promise.
1896
+ */
1897
+ public get currentValue(): T | undefined {
1898
+ return this._promise.rawValue?.value;
1899
+ }
1900
+ }
1901
+
1902
+ //#endregion
1903
+
1904
+ //#region
1905
+
1906
+ const enum AsyncIterableSourceState {
1907
+ Initial,
1908
+ DoneOK,
1909
+ DoneError,
1910
+ }
1911
+
1912
+ /**
1913
+ * An object that allows to emit async values asynchronously or bring the iterable to an error state using `reject()`.
1914
+ * This emitter is valid only for the duration of the executor (until the promise returned by the executor settles).
1915
+ */
1916
+ export interface AsyncIterableEmitter<T> {
1917
+ /**
1918
+ * The value will be appended at the end.
1919
+ *
1920
+ * **NOTE** If `reject()` has already been called, this method has no effect.
1921
+ */
1922
+ emitOne(value: T): void;
1923
+ /**
1924
+ * The values will be appended at the end.
1925
+ *
1926
+ * **NOTE** If `reject()` has already been called, this method has no effect.
1927
+ */
1928
+ emitMany(values: T[]): void;
1929
+ /**
1930
+ * Writing an error will permanently invalidate this iterable.
1931
+ * The current users will receive an error thrown, as will all future users.
1932
+ *
1933
+ * **NOTE** If `reject()` have already been called, this method has no effect.
1934
+ */
1935
+ reject(error: Error): void;
1936
+ }
1937
+
1938
+ /**
1939
+ * An executor for the `AsyncIterableObject` that has access to an emitter.
1940
+ */
1941
+ export interface AsyncIterableExecutor<T> {
1942
+ /**
1943
+ * @param emitter An object that allows to emit async values valid only for the duration of the executor.
1944
+ */
1945
+ (emitter: AsyncIterableEmitter<T>): unknown | Promise<unknown>;
1946
+ }
1947
+
1948
+ /**
1949
+ * A rich implementation for an `AsyncIterable<T>`.
1950
+ */
1951
+ export class AsyncIterableObject<T> implements AsyncIterable<T> {
1952
+
1953
+ public static fromArray<T>(items: T[]): AsyncIterableObject<T> {
1954
+ return new AsyncIterableObject<T>((writer) => {
1955
+ writer.emitMany(items);
1956
+ });
1957
+ }
1958
+
1959
+ public static fromPromise<T>(promise: Promise<T[]>): AsyncIterableObject<T> {
1960
+ return new AsyncIterableObject<T>(async (emitter) => {
1961
+ emitter.emitMany(await promise);
1962
+ });
1963
+ }
1964
+
1965
+ public static fromPromisesResolveOrder<T>(promises: Promise<T>[]): AsyncIterableObject<T> {
1966
+ return new AsyncIterableObject<T>(async (emitter) => {
1967
+ await Promise.all(promises.map(async (p) => emitter.emitOne(await p)));
1968
+ });
1969
+ }
1970
+
1971
+ public static merge<T>(iterables: AsyncIterable<T>[]): AsyncIterableObject<T> {
1972
+ return new AsyncIterableObject(async (emitter) => {
1973
+ await Promise.all(iterables.map(async (iterable) => {
1974
+ for await (const item of iterable) {
1975
+ emitter.emitOne(item);
1976
+ }
1977
+ }));
1978
+ });
1979
+ }
1980
+
1981
+ public static EMPTY = AsyncIterableObject.fromArray<any>([]);
1982
+
1983
+ private _state: AsyncIterableSourceState;
1984
+ private _results: T[];
1985
+ private _error: Error | null;
1986
+ private readonly _onReturn?: () => void | Promise<void>;
1987
+ private readonly _onStateChanged: Emitter<void>;
1988
+
1989
+ constructor(executor: AsyncIterableExecutor<T>, onReturn?: () => void | Promise<void>) {
1990
+ this._state = AsyncIterableSourceState.Initial;
1991
+ this._results = [];
1992
+ this._error = null;
1993
+ this._onReturn = onReturn;
1994
+ this._onStateChanged = new Emitter<void>();
1995
+
1996
+ queueMicrotask(async () => {
1997
+ const writer: AsyncIterableEmitter<T> = {
1998
+ emitOne: (item) => this.emitOne(item),
1999
+ emitMany: (items) => this.emitMany(items),
2000
+ reject: (error) => this.reject(error)
2001
+ };
2002
+ try {
2003
+ await Promise.resolve(executor(writer));
2004
+ this.resolve();
2005
+ } catch (err) {
2006
+ this.reject(err);
2007
+ } finally {
2008
+ writer.emitOne = undefined!;
2009
+ writer.emitMany = undefined!;
2010
+ writer.reject = undefined!;
2011
+ }
2012
+ });
2013
+ }
2014
+
2015
+ [Symbol.asyncIterator](): AsyncIterator<T, undefined, undefined> {
2016
+ let i = 0;
2017
+ return {
2018
+ next: async () => {
2019
+ do {
2020
+ if (this._state === AsyncIterableSourceState.DoneError) {
2021
+ throw this._error;
2022
+ }
2023
+ if (i < this._results.length) {
2024
+ return { done: false, value: this._results[i++] };
2025
+ }
2026
+ if (this._state === AsyncIterableSourceState.DoneOK) {
2027
+ return { done: true, value: undefined };
2028
+ }
2029
+ await Event.toPromise(this._onStateChanged.event);
2030
+ } while (true);
2031
+ },
2032
+ return: async () => {
2033
+ this._onReturn?.();
2034
+ return { done: true, value: undefined };
2035
+ }
2036
+ };
2037
+ }
2038
+
2039
+ public static map<T, R>(iterable: AsyncIterable<T>, mapFn: (item: T) => R): AsyncIterableObject<R> {
2040
+ return new AsyncIterableObject<R>(async (emitter) => {
2041
+ for await (const item of iterable) {
2042
+ emitter.emitOne(mapFn(item));
2043
+ }
2044
+ });
2045
+ }
2046
+
2047
+ public map<R>(mapFn: (item: T) => R): AsyncIterableObject<R> {
2048
+ return AsyncIterableObject.map(this, mapFn);
2049
+ }
2050
+
2051
+ public static filter<T>(iterable: AsyncIterable<T>, filterFn: (item: T) => boolean): AsyncIterableObject<T> {
2052
+ return new AsyncIterableObject<T>(async (emitter) => {
2053
+ for await (const item of iterable) {
2054
+ if (filterFn(item)) {
2055
+ emitter.emitOne(item);
2056
+ }
2057
+ }
2058
+ });
2059
+ }
2060
+
2061
+ public filter<T2 extends T>(filterFn: (item: T) => item is T2): AsyncIterableObject<T2>;
2062
+ public filter(filterFn: (item: T) => boolean): AsyncIterableObject<T>;
2063
+ public filter(filterFn: (item: T) => boolean): AsyncIterableObject<T> {
2064
+ return AsyncIterableObject.filter(this, filterFn);
2065
+ }
2066
+
2067
+ public static coalesce<T>(iterable: AsyncIterable<T | undefined | null>): AsyncIterableObject<T> {
2068
+ return <AsyncIterableObject<T>>AsyncIterableObject.filter(iterable, item => !!item);
2069
+ }
2070
+
2071
+ public coalesce(): AsyncIterableObject<NonNullable<T>> {
2072
+ return AsyncIterableObject.coalesce(this) as AsyncIterableObject<NonNullable<T>>;
2073
+ }
2074
+
2075
+ public static async toPromise<T>(iterable: AsyncIterable<T>): Promise<T[]> {
2076
+ const result: T[] = [];
2077
+ for await (const item of iterable) {
2078
+ result.push(item);
2079
+ }
2080
+ return result;
2081
+ }
2082
+
2083
+ public toPromise(): Promise<T[]> {
2084
+ return AsyncIterableObject.toPromise(this);
2085
+ }
2086
+
2087
+ /**
2088
+ * The value will be appended at the end.
2089
+ *
2090
+ * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
2091
+ */
2092
+ private emitOne(value: T): void {
2093
+ if (this._state !== AsyncIterableSourceState.Initial) {
2094
+ return;
2095
+ }
2096
+ // it is important to add new values at the end,
2097
+ // as we may have iterators already running on the array
2098
+ this._results.push(value);
2099
+ this._onStateChanged.fire();
2100
+ }
2101
+
2102
+ /**
2103
+ * The values will be appended at the end.
2104
+ *
2105
+ * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
2106
+ */
2107
+ private emitMany(values: T[]): void {
2108
+ if (this._state !== AsyncIterableSourceState.Initial) {
2109
+ return;
2110
+ }
2111
+ // it is important to add new values at the end,
2112
+ // as we may have iterators already running on the array
2113
+ this._results = this._results.concat(values);
2114
+ this._onStateChanged.fire();
2115
+ }
2116
+
2117
+ /**
2118
+ * Calling `resolve()` will mark the result array as complete.
2119
+ *
2120
+ * **NOTE** `resolve()` must be called, otherwise all consumers of this iterable will hang indefinitely, similar to a non-resolved promise.
2121
+ * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
2122
+ */
2123
+ private resolve(): void {
2124
+ if (this._state !== AsyncIterableSourceState.Initial) {
2125
+ return;
2126
+ }
2127
+ this._state = AsyncIterableSourceState.DoneOK;
2128
+ this._onStateChanged.fire();
2129
+ }
2130
+
2131
+ /**
2132
+ * Writing an error will permanently invalidate this iterable.
2133
+ * The current users will receive an error thrown, as will all future users.
2134
+ *
2135
+ * **NOTE** If `resolve()` or `reject()` have already been called, this method has no effect.
2136
+ */
2137
+ private reject(error: Error) {
2138
+ if (this._state !== AsyncIterableSourceState.Initial) {
2139
+ return;
2140
+ }
2141
+ this._state = AsyncIterableSourceState.DoneError;
2142
+ this._error = error;
2143
+ this._onStateChanged.fire();
2144
+ }
2145
+ }
2146
+
2147
+
2148
+ export function createCancelableAsyncIterableProducer<T>(callback: (token: CancellationToken) => AsyncIterable<T>): CancelableAsyncIterableProducer<T> {
2149
+ const source = new CancellationTokenSource();
2150
+ const innerIterable = callback(source.token);
2151
+
2152
+ return new CancelableAsyncIterableProducer<T>(source, async (emitter) => {
2153
+ const subscription = source.token.onCancellationRequested(() => {
2154
+ subscription.dispose();
2155
+ source.dispose();
2156
+ emitter.reject(new CancellationError());
2157
+ });
2158
+ try {
2159
+ for await (const item of innerIterable) {
2160
+ if (source.token.isCancellationRequested) {
2161
+ // canceled in the meantime
2162
+ return;
2163
+ }
2164
+ emitter.emitOne(item);
2165
+ }
2166
+ subscription.dispose();
2167
+ source.dispose();
2168
+ } catch (err) {
2169
+ subscription.dispose();
2170
+ source.dispose();
2171
+ emitter.reject(err);
2172
+ }
2173
+ });
2174
+ }
2175
+
2176
+ export class AsyncIterableSource<T> {
2177
+
2178
+ private readonly _deferred = new DeferredPromise<void>();
2179
+ private readonly _asyncIterable: AsyncIterableObject<T>;
2180
+
2181
+ private _errorFn: (error: Error) => void;
2182
+ private _emitOneFn: (item: T) => void;
2183
+ private _emitManyFn: (item: T[]) => void;
2184
+
2185
+ /**
2186
+ *
2187
+ * @param onReturn A function that will be called when consuming the async iterable
2188
+ * has finished by the consumer, e.g the for-await-loop has be existed (break, return) early.
2189
+ * This is NOT called when resolving this source by its owner.
2190
+ */
2191
+ constructor(onReturn?: () => Promise<void> | void) {
2192
+ this._asyncIterable = new AsyncIterableObject(emitter => {
2193
+
2194
+ if (earlyError) {
2195
+ emitter.reject(earlyError);
2196
+ return;
2197
+ }
2198
+ if (earlyItems) {
2199
+ emitter.emitMany(earlyItems);
2200
+ }
2201
+ this._errorFn = (error: Error) => emitter.reject(error);
2202
+ this._emitOneFn = (item: T) => emitter.emitOne(item);
2203
+ this._emitManyFn = (items: T[]) => emitter.emitMany(items);
2204
+ return this._deferred.p;
2205
+ }, onReturn);
2206
+
2207
+ let earlyError: Error | undefined;
2208
+ let earlyItems: T[] | undefined;
2209
+
2210
+
2211
+ this._errorFn = (error: Error) => {
2212
+ if (!earlyError) {
2213
+ earlyError = error;
2214
+ }
2215
+ };
2216
+ this._emitOneFn = (item: T) => {
2217
+ if (!earlyItems) {
2218
+ earlyItems = [];
2219
+ }
2220
+ earlyItems.push(item);
2221
+ };
2222
+ this._emitManyFn = (items: T[]) => {
2223
+ if (!earlyItems) {
2224
+ earlyItems = items.slice();
2225
+ } else {
2226
+ items.forEach(item => earlyItems!.push(item));
2227
+ }
2228
+ };
2229
+ }
2230
+
2231
+ get asyncIterable(): AsyncIterableObject<T> {
2232
+ return this._asyncIterable;
2233
+ }
2234
+
2235
+ resolve(): void {
2236
+ this._deferred.complete();
2237
+ }
2238
+
2239
+ reject(error: Error): void {
2240
+ this._errorFn(error);
2241
+ this._deferred.complete();
2242
+ }
2243
+
2244
+ emitOne(item: T): void {
2245
+ this._emitOneFn(item);
2246
+ }
2247
+
2248
+ emitMany(items: T[]) {
2249
+ this._emitManyFn(items);
2250
+ }
2251
+ }
2252
+
2253
+ export function cancellableIterable<T>(iterableOrIterator: AsyncIterator<T> | AsyncIterable<T>, token: CancellationToken): AsyncIterableIterator<T> {
2254
+ const iterator = Symbol.asyncIterator in iterableOrIterator ? iterableOrIterator[Symbol.asyncIterator]() : iterableOrIterator;
2255
+
2256
+ return {
2257
+ async next(): Promise<IteratorResult<T>> {
2258
+ if (token.isCancellationRequested) {
2259
+ return { done: true, value: undefined };
2260
+ }
2261
+ const result = await raceCancellation(iterator.next(), token);
2262
+ return result || { done: true, value: undefined };
2263
+ },
2264
+ throw: iterator.throw?.bind(iterator),
2265
+ return: iterator.return?.bind(iterator),
2266
+ [Symbol.asyncIterator]() {
2267
+ return this;
2268
+ }
2269
+ };
2270
+ }
2271
+
2272
+ type ProducerConsumerValue<T> = {
2273
+ ok: true;
2274
+ value: T;
2275
+ } | {
2276
+ ok: false;
2277
+ error: Error;
2278
+ };
2279
+
2280
+ class ProducerConsumer<T> {
2281
+ private readonly _unsatisfiedConsumers: DeferredPromise<T>[] = [];
2282
+ private readonly _unconsumedValues: ProducerConsumerValue<T>[] = [];
2283
+ private _finalValue: ProducerConsumerValue<T> | undefined;
2284
+
2285
+ public get hasFinalValue(): boolean {
2286
+ return !!this._finalValue;
2287
+ }
2288
+
2289
+ produce(value: ProducerConsumerValue<T>): void {
2290
+ this._ensureNoFinalValue();
2291
+ if (this._unsatisfiedConsumers.length > 0) {
2292
+ const deferred = this._unsatisfiedConsumers.shift()!;
2293
+ this._resolveOrRejectDeferred(deferred, value);
2294
+ } else {
2295
+ this._unconsumedValues.push(value);
2296
+ }
2297
+ }
2298
+
2299
+ produceFinal(value: ProducerConsumerValue<T>): void {
2300
+ this._ensureNoFinalValue();
2301
+ this._finalValue = value;
2302
+ for (const deferred of this._unsatisfiedConsumers) {
2303
+ this._resolveOrRejectDeferred(deferred, value);
2304
+ }
2305
+ this._unsatisfiedConsumers.length = 0;
2306
+ }
2307
+
2308
+ private _ensureNoFinalValue(): void {
2309
+ if (this._finalValue) {
2310
+ throw new BugIndicatingError('ProducerConsumer: cannot produce after final value has been set');
2311
+ }
2312
+ }
2313
+
2314
+ private _resolveOrRejectDeferred(deferred: DeferredPromise<T>, value: ProducerConsumerValue<T>): void {
2315
+ if (value.ok) {
2316
+ deferred.complete(value.value);
2317
+ } else {
2318
+ deferred.error(value.error);
2319
+ }
2320
+ }
2321
+
2322
+ consume(): Promise<T> {
2323
+ if (this._unconsumedValues.length > 0 || this._finalValue) {
2324
+ const value = this._unconsumedValues.length > 0 ? this._unconsumedValues.shift()! : this._finalValue!;
2325
+ if (value.ok) {
2326
+ return Promise.resolve(value.value);
2327
+ } else {
2328
+ return Promise.reject(value.error);
2329
+ }
2330
+ } else {
2331
+ const deferred = new DeferredPromise<T>();
2332
+ this._unsatisfiedConsumers.push(deferred);
2333
+ return deferred.p;
2334
+ }
2335
+ }
2336
+ }
2337
+
2338
+ /**
2339
+ * Important difference to AsyncIterableObject:
2340
+ * If it is iterated two times, the second iterator will not see the values emitted by the first iterator.
2341
+ */
2342
+ export class AsyncIterableProducer<T> implements AsyncIterable<T> {
2343
+ private readonly _producerConsumer = new ProducerConsumer<IteratorResult<T>>();
2344
+
2345
+ constructor(executor: AsyncIterableExecutor<T>, private readonly _onReturn?: () => void) {
2346
+ queueMicrotask(async () => {
2347
+ const p = executor({
2348
+ emitOne: value => this._producerConsumer.produce({ ok: true, value: { done: false, value: value } }),
2349
+ emitMany: values => {
2350
+ for (const value of values) {
2351
+ this._producerConsumer.produce({ ok: true, value: { done: false, value: value } });
2352
+ }
2353
+ },
2354
+ reject: error => this._finishError(error),
2355
+ });
2356
+
2357
+ if (!this._producerConsumer.hasFinalValue) {
2358
+ try {
2359
+ await p;
2360
+ this._finishOk();
2361
+ } catch (error) {
2362
+ this._finishError(error);
2363
+ }
2364
+ }
2365
+ });
2366
+ }
2367
+
2368
+ public static fromArray<T>(items: T[]): AsyncIterableProducer<T> {
2369
+ return new AsyncIterableProducer<T>((writer) => {
2370
+ writer.emitMany(items);
2371
+ });
2372
+ }
2373
+
2374
+ public static fromPromise<T>(promise: Promise<T[]>): AsyncIterableProducer<T> {
2375
+ return new AsyncIterableProducer<T>(async (emitter) => {
2376
+ emitter.emitMany(await promise);
2377
+ });
2378
+ }
2379
+
2380
+ public static fromPromisesResolveOrder<T>(promises: Promise<T>[]): AsyncIterableProducer<T> {
2381
+ return new AsyncIterableProducer<T>(async (emitter) => {
2382
+ await Promise.all(promises.map(async (p) => emitter.emitOne(await p)));
2383
+ });
2384
+ }
2385
+
2386
+ public static merge<T>(iterables: AsyncIterable<T>[]): AsyncIterableProducer<T> {
2387
+ return new AsyncIterableProducer(async (emitter) => {
2388
+ await Promise.all(iterables.map(async (iterable) => {
2389
+ for await (const item of iterable) {
2390
+ emitter.emitOne(item);
2391
+ }
2392
+ }));
2393
+ });
2394
+ }
2395
+
2396
+ public static EMPTY = AsyncIterableProducer.fromArray<any>([]);
2397
+
2398
+ public static map<T, R>(iterable: AsyncIterable<T>, mapFn: (item: T) => R): AsyncIterableProducer<R> {
2399
+ return new AsyncIterableProducer<R>(async (emitter) => {
2400
+ for await (const item of iterable) {
2401
+ emitter.emitOne(mapFn(item));
2402
+ }
2403
+ });
2404
+ }
2405
+
2406
+ public map<R>(mapFn: (item: T) => R): AsyncIterableProducer<R> {
2407
+ return AsyncIterableProducer.map(this, mapFn);
2408
+ }
2409
+
2410
+ public static coalesce<T>(iterable: AsyncIterable<T | undefined | null>): AsyncIterableProducer<T> {
2411
+ return <AsyncIterableProducer<T>>AsyncIterableProducer.filter(iterable, item => !!item);
2412
+ }
2413
+
2414
+ public coalesce(): AsyncIterableProducer<NonNullable<T>> {
2415
+ return AsyncIterableProducer.coalesce(this) as AsyncIterableProducer<NonNullable<T>>;
2416
+ }
2417
+
2418
+ public static filter<T>(iterable: AsyncIterable<T>, filterFn: (item: T) => boolean): AsyncIterableProducer<T> {
2419
+ return new AsyncIterableProducer<T>(async (emitter) => {
2420
+ for await (const item of iterable) {
2421
+ if (filterFn(item)) {
2422
+ emitter.emitOne(item);
2423
+ }
2424
+ }
2425
+ });
2426
+ }
2427
+
2428
+ public filter<T2 extends T>(filterFn: (item: T) => item is T2): AsyncIterableProducer<T2>;
2429
+ public filter(filterFn: (item: T) => boolean): AsyncIterableProducer<T>;
2430
+ public filter(filterFn: (item: T) => boolean): AsyncIterableProducer<T> {
2431
+ return AsyncIterableProducer.filter(this, filterFn);
2432
+ }
2433
+
2434
+ private _finishOk(): void {
2435
+ if (!this._producerConsumer.hasFinalValue) {
2436
+ this._producerConsumer.produceFinal({ ok: true, value: { done: true, value: undefined } });
2437
+ }
2438
+ }
2439
+
2440
+ private _finishError(error: Error): void {
2441
+ if (!this._producerConsumer.hasFinalValue) {
2442
+ this._producerConsumer.produceFinal({ ok: false, error: error });
2443
+ }
2444
+ // Warning: this can cause to dropped errors.
2445
+ }
2446
+
2447
+ private readonly _iterator: AsyncIterator<T, void, void> = {
2448
+ next: () => this._producerConsumer.consume(),
2449
+ return: () => {
2450
+ this._onReturn?.();
2451
+ return Promise.resolve({ done: true, value: undefined });
2452
+ },
2453
+ throw: async (e) => {
2454
+ this._finishError(e);
2455
+ return { done: true, value: undefined };
2456
+ },
2457
+ };
2458
+
2459
+ [Symbol.asyncIterator](): AsyncIterator<T, void, void> {
2460
+ return this._iterator;
2461
+ }
2462
+ }
2463
+
2464
+ export class CancelableAsyncIterableProducer<T> extends AsyncIterableProducer<T> {
2465
+ constructor(
2466
+ private readonly _source: CancellationTokenSource,
2467
+ executor: AsyncIterableExecutor<T>
2468
+ ) {
2469
+ super(executor);
2470
+ }
2471
+
2472
+ cancel(): void {
2473
+ this._source.cancel();
2474
+ }
2475
+ }
2476
+
2477
+ //#endregion
2478
+
2479
+ export const AsyncReaderEndOfStream = Symbol('AsyncReaderEndOfStream');
2480
+
2481
+ export class AsyncReader<T> {
2482
+ private _buffer: T[] = [];
2483
+ private _atEnd = false;
2484
+
2485
+ public get endOfStream(): boolean { return this._buffer.length === 0 && this._atEnd; }
2486
+ private _extendBufferPromise: Promise<void> | undefined;
2487
+
2488
+ constructor(
2489
+ private readonly _source: AsyncIterator<T>
2490
+ ) {
2491
+ }
2492
+
2493
+ public async read(): Promise<T | typeof AsyncReaderEndOfStream> {
2494
+ if (this._buffer.length === 0 && !this._atEnd) {
2495
+ await this._extendBuffer();
2496
+ }
2497
+ if (this._buffer.length === 0) {
2498
+ return AsyncReaderEndOfStream;
2499
+ }
2500
+ return this._buffer.shift()!;
2501
+ }
2502
+
2503
+ public async readWhile(predicate: (value: T) => boolean, callback: (element: T) => unknown): Promise<void> {
2504
+ do {
2505
+ const piece = await this.peek();
2506
+ if (piece === AsyncReaderEndOfStream) {
2507
+ break;
2508
+ }
2509
+ if (!predicate(piece)) {
2510
+ break;
2511
+ }
2512
+ await this.read(); // consume
2513
+ await callback(piece);
2514
+ } while (true);
2515
+ }
2516
+
2517
+ public readBufferedOrThrow(): T | typeof AsyncReaderEndOfStream {
2518
+ const value = this.peekBufferedOrThrow();
2519
+ this._buffer.shift();
2520
+ return value;
2521
+ }
2522
+
2523
+ public async consumeToEnd(): Promise<void> {
2524
+ while (!this.endOfStream) {
2525
+ await this.read();
2526
+ }
2527
+ }
2528
+
2529
+ public async peek(): Promise<T | typeof AsyncReaderEndOfStream> {
2530
+ if (this._buffer.length === 0 && !this._atEnd) {
2531
+ await this._extendBuffer();
2532
+ }
2533
+ if (this._buffer.length === 0) {
2534
+ return AsyncReaderEndOfStream;
2535
+ }
2536
+ return this._buffer[0];
2537
+ }
2538
+
2539
+ public peekBufferedOrThrow(): T | typeof AsyncReaderEndOfStream {
2540
+ if (this._buffer.length === 0) {
2541
+ if (this._atEnd) {
2542
+ return AsyncReaderEndOfStream;
2543
+ }
2544
+ throw new BugIndicatingError('No buffered elements');
2545
+ }
2546
+
2547
+ return this._buffer[0];
2548
+ }
2549
+
2550
+ public async peekTimeout(timeoutMs: number): Promise<T | typeof AsyncReaderEndOfStream | undefined> {
2551
+ if (this._buffer.length === 0 && !this._atEnd) {
2552
+ await raceTimeout(this._extendBuffer(), timeoutMs);
2553
+ }
2554
+ if (this._atEnd) {
2555
+ return AsyncReaderEndOfStream;
2556
+ }
2557
+ if (this._buffer.length === 0) {
2558
+ return undefined;
2559
+ }
2560
+ return this._buffer[0];
2561
+ }
2562
+
2563
+ private _extendBuffer(): Promise<void> {
2564
+ if (this._atEnd) {
2565
+ return Promise.resolve();
2566
+ }
2567
+
2568
+ if (!this._extendBufferPromise) {
2569
+ this._extendBufferPromise = (async () => {
2570
+ const { value, done } = await this._source.next();
2571
+ this._extendBufferPromise = undefined;
2572
+ if (done) {
2573
+ this._atEnd = true;
2574
+ } else {
2575
+ this._buffer.push(value);
2576
+ }
2577
+ })();
2578
+ }
2579
+
2580
+ return this._extendBufferPromise;
2581
+ }
2582
+ }