@vscode/chat-lib 0.2.1-3 → 0.2.1-30

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 (281) hide show
  1. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js +1 -1
  2. package/dist/src/_internal/extension/byok/node/openAIEndpoint.js.map +1 -1
  3. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.d.ts +1 -1
  4. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.d.ts.map +1 -1
  5. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.js +0 -4
  6. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.js.map +1 -1
  7. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.d.ts +71 -4
  8. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.d.ts.map +1 -1
  9. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js +260 -235
  10. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js.map +1 -1
  11. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.d.ts +2 -4
  12. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.d.ts.map +1 -1
  13. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.js +5 -5
  14. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.js.map +1 -1
  15. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/streamedCompletionSplitter.d.ts.map +1 -1
  16. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/streamedCompletionSplitter.js +3 -5
  17. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/streamedCompletionSplitter.js.map +1 -1
  18. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.d.ts +2 -1
  19. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.d.ts.map +1 -1
  20. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.js +4 -3
  21. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.js.map +1 -1
  22. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networkConfiguration.d.ts +1 -6
  23. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networkConfiguration.d.ts.map +1 -1
  24. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts +1 -0
  25. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts.map +1 -1
  26. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js +1 -0
  27. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js.map +1 -1
  28. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.d.ts +25 -7
  29. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.d.ts.map +1 -1
  30. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.js +316 -23
  31. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.js.map +1 -1
  32. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.d.ts +5 -9
  33. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.d.ts.map +1 -1
  34. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.js +0 -3
  35. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.js.map +1 -1
  36. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.d.ts +3 -27
  37. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.d.ts.map +1 -1
  38. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.js +17 -62
  39. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.js.map +1 -1
  40. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.d.ts +1 -1
  41. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.d.ts.map +1 -1
  42. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.js +0 -4
  43. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.js.map +1 -1
  44. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.d.ts +2 -1
  45. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.d.ts.map +1 -1
  46. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.js +12 -7
  47. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.js.map +1 -1
  48. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.d.ts +10 -0
  49. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.d.ts.map +1 -0
  50. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.js +92 -0
  51. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.js.map +1 -0
  52. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/splitContextPrompt.d.ts.map +1 -1
  53. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/splitContextPrompt.js +2 -1
  54. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/splitContextPrompt.js.map +1 -1
  55. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.d.ts +6 -2
  56. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.d.ts.map +1 -1
  57. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.js +106 -43
  58. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.js.map +1 -1
  59. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.d.ts +5 -0
  60. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.d.ts.map +1 -0
  61. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.js +59 -0
  62. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.js.map +1 -0
  63. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/anomalyDetection.d.ts +1 -1
  64. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/anomalyDetection.d.ts.map +1 -1
  65. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/anomalyDetection.js.map +1 -1
  66. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry.d.ts +2 -1
  67. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry.d.ts.map +1 -1
  68. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry.js.map +1 -1
  69. package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.d.ts +10 -2
  70. package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.d.ts.map +1 -1
  71. package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.js +8 -0
  72. package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.js.map +1 -1
  73. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.d.ts +6 -2
  74. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.d.ts.map +1 -1
  75. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.js +5 -5
  76. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.js.map +1 -1
  77. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -1
  78. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +10 -7
  79. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -1
  80. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.d.ts +3 -0
  81. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.d.ts.map +1 -1
  82. package/dist/src/_internal/extension/inlineEdits/node/nextEditResult.js.map +1 -1
  83. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
  84. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +32 -18
  85. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
  86. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts +7 -5
  87. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.d.ts.map +1 -1
  88. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js +26 -14
  89. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js.map +1 -1
  90. package/dist/src/_internal/extension/xtab/common/lintErrors.d.ts +2 -0
  91. package/dist/src/_internal/extension/xtab/common/lintErrors.d.ts.map +1 -1
  92. package/dist/src/_internal/extension/xtab/common/lintErrors.js +31 -7
  93. package/dist/src/_internal/extension/xtab/common/lintErrors.js.map +1 -1
  94. package/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts +1 -1
  95. package/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts.map +1 -1
  96. package/dist/src/_internal/extension/xtab/common/promptCrafting.js +18 -10
  97. package/dist/src/_internal/extension/xtab/common/promptCrafting.js.map +1 -1
  98. package/dist/src/_internal/extension/xtab/common/tags.d.ts +1 -0
  99. package/dist/src/_internal/extension/xtab/common/tags.d.ts.map +1 -1
  100. package/dist/src/_internal/extension/xtab/common/tags.js +1 -0
  101. package/dist/src/_internal/extension/xtab/common/tags.js.map +1 -1
  102. package/dist/src/_internal/extension/xtab/node/xtabCustomDiffPatchResponseHandler.d.ts +21 -0
  103. package/dist/src/_internal/extension/xtab/node/xtabCustomDiffPatchResponseHandler.d.ts.map +1 -0
  104. package/dist/src/_internal/extension/xtab/node/xtabCustomDiffPatchResponseHandler.js +97 -0
  105. package/dist/src/_internal/extension/xtab/node/xtabCustomDiffPatchResponseHandler.js.map +1 -0
  106. package/dist/src/_internal/extension/xtab/node/xtabNextCursorPredictor.d.ts.map +1 -1
  107. package/dist/src/_internal/extension/xtab/node/xtabNextCursorPredictor.js +12 -9
  108. package/dist/src/_internal/extension/xtab/node/xtabNextCursorPredictor.js.map +1 -1
  109. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts +12 -6
  110. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
  111. package/dist/src/_internal/extension/xtab/node/xtabProvider.js +46 -16
  112. package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
  113. package/dist/src/_internal/platform/authentication/common/authentication.d.ts +2 -1
  114. package/dist/src/_internal/platform/authentication/common/authentication.d.ts.map +1 -1
  115. package/dist/src/_internal/platform/authentication/common/authentication.js +7 -2
  116. package/dist/src/_internal/platform/authentication/common/authentication.js.map +1 -1
  117. package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts +148 -47
  118. package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts.map +1 -1
  119. package/dist/src/_internal/platform/authentication/common/copilotToken.js +138 -14
  120. package/dist/src/_internal/platform/authentication/common/copilotToken.js.map +1 -1
  121. package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js +1 -1
  122. package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js.map +1 -1
  123. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts +10 -0
  124. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts.map +1 -1
  125. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js +110 -40
  126. package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js.map +1 -1
  127. package/dist/src/_internal/platform/chat/common/chatMLFetcher.js +1 -1
  128. package/dist/src/_internal/platform/chat/common/chatMLFetcher.js.map +1 -1
  129. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts +5 -1
  130. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts.map +1 -1
  131. package/dist/src/_internal/platform/chat/common/commonTypes.js +5 -1
  132. package/dist/src/_internal/platform/chat/common/commonTypes.js.map +1 -1
  133. package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.d.ts +27 -0
  134. package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.d.ts.map +1 -0
  135. package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.js +35 -0
  136. package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.js.map +1 -0
  137. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +46 -30
  138. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
  139. package/dist/src/_internal/platform/configuration/common/configurationService.js +32 -15
  140. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
  141. package/dist/src/_internal/platform/configuration/common/validator.d.ts +2 -0
  142. package/dist/src/_internal/platform/configuration/common/validator.d.ts.map +1 -1
  143. package/dist/src/_internal/platform/configuration/common/validator.js +18 -0
  144. package/dist/src/_internal/platform/configuration/common/validator.js.map +1 -1
  145. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts +1 -0
  146. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
  147. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +27 -20
  148. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
  149. package/dist/src/_internal/platform/endpoint/common/endpointTypes.d.ts +1 -0
  150. package/dist/src/_internal/platform/endpoint/common/endpointTypes.d.ts.map +1 -1
  151. package/dist/src/_internal/platform/endpoint/common/endpointTypes.js +1 -0
  152. package/dist/src/_internal/platform/endpoint/common/endpointTypes.js.map +1 -1
  153. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts +1 -0
  154. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -1
  155. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +49 -10
  156. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
  157. package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts +18 -5
  158. package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts.map +1 -1
  159. package/dist/src/_internal/platform/endpoint/node/messagesApi.js +262 -90
  160. package/dist/src/_internal/platform/endpoint/node/messagesApi.js.map +1 -1
  161. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts +2 -0
  162. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -1
  163. package/dist/src/_internal/platform/endpoint/node/responsesApi.js +23 -5
  164. package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -1
  165. package/dist/src/_internal/platform/git/common/gitService.d.ts +8 -1
  166. package/dist/src/_internal/platform/git/common/gitService.d.ts.map +1 -1
  167. package/dist/src/_internal/platform/git/common/gitService.js.map +1 -1
  168. package/dist/src/_internal/platform/github/common/githubAPI.d.ts +34 -0
  169. package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -1
  170. package/dist/src/_internal/platform/github/common/githubAPI.js +94 -0
  171. package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -1
  172. package/dist/src/_internal/platform/github/common/githubService.d.ts +53 -18
  173. package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -1
  174. package/dist/src/_internal/platform/github/common/githubService.js +62 -2
  175. package/dist/src/_internal/platform/github/common/githubService.js.map +1 -1
  176. package/dist/src/_internal/platform/inlineCompletions/common/api.d.ts +5 -1
  177. package/dist/src/_internal/platform/inlineCompletions/common/api.d.ts.map +1 -1
  178. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.d.ts +10 -2
  179. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.d.ts.map +1 -1
  180. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.js +23 -4
  181. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.js.map +1 -1
  182. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/nextCursorLinePrediction.d.ts +1 -2
  183. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/nextCursorLinePrediction.d.ts.map +1 -1
  184. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/nextCursorLinePrediction.js +0 -1
  185. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/nextCursorLinePrediction.js.map +1 -1
  186. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts +6 -3
  187. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts.map +1 -1
  188. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js +5 -0
  189. package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js.map +1 -1
  190. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts +1 -0
  191. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts.map +1 -1
  192. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js +120 -0
  193. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js.map +1 -1
  194. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts +7 -5
  195. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.d.ts.map +1 -1
  196. package/dist/src/_internal/platform/inlineEdits/common/statelessNextEditProvider.js.map +1 -1
  197. package/dist/src/_internal/platform/inlineEdits/node/inlineEditsModelService.d.ts.map +1 -1
  198. package/dist/src/_internal/platform/inlineEdits/node/inlineEditsModelService.js +5 -0
  199. package/dist/src/_internal/platform/inlineEdits/node/inlineEditsModelService.js.map +1 -1
  200. package/dist/src/_internal/platform/languageServer/common/languageContextService.d.ts +27 -2
  201. package/dist/src/_internal/platform/languageServer/common/languageContextService.d.ts.map +1 -1
  202. package/dist/src/_internal/platform/languageServer/common/languageContextService.js +1 -0
  203. package/dist/src/_internal/platform/languageServer/common/languageContextService.js.map +1 -1
  204. package/dist/src/_internal/platform/log/common/logService.d.ts +12 -0
  205. package/dist/src/_internal/platform/log/common/logService.d.ts.map +1 -1
  206. package/dist/src/_internal/platform/log/common/logService.js +39 -0
  207. package/dist/src/_internal/platform/log/common/logService.js.map +1 -1
  208. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.d.ts +74 -0
  209. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.d.ts.map +1 -0
  210. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.js +23 -0
  211. package/dist/src/_internal/platform/nesFetch/common/completionsAPI.js.map +1 -0
  212. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.d.ts +72 -0
  213. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.d.ts.map +1 -0
  214. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.js +44 -0
  215. package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.js.map +1 -0
  216. package/dist/src/_internal/platform/nesFetch/common/responseStream.d.ts +35 -0
  217. package/dist/src/_internal/platform/nesFetch/common/responseStream.d.ts.map +1 -0
  218. package/dist/src/_internal/platform/nesFetch/common/responseStream.js +162 -0
  219. package/dist/src/_internal/platform/nesFetch/common/responseStream.js.map +1 -0
  220. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts +29 -0
  221. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts.map +1 -0
  222. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js +171 -0
  223. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js.map +1 -0
  224. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.d.ts +10 -0
  225. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.d.ts.map +1 -0
  226. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.js +86 -0
  227. package/dist/src/_internal/platform/nesFetch/node/streamTransformer.js.map +1 -0
  228. package/dist/src/_internal/platform/networking/common/anthropic.d.ts +167 -0
  229. package/dist/src/_internal/platform/networking/common/anthropic.d.ts.map +1 -0
  230. package/dist/src/_internal/platform/networking/common/anthropic.js +172 -0
  231. package/dist/src/_internal/platform/networking/common/anthropic.js.map +1 -0
  232. package/dist/src/_internal/platform/networking/common/fetch.d.ts +18 -11
  233. package/dist/src/_internal/platform/networking/common/fetch.d.ts.map +1 -1
  234. package/dist/src/_internal/platform/networking/common/fetch.js +5 -5
  235. package/dist/src/_internal/platform/networking/common/fetch.js.map +1 -1
  236. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts +40 -7
  237. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts.map +1 -1
  238. package/dist/src/_internal/platform/networking/common/fetcherService.js +96 -11
  239. package/dist/src/_internal/platform/networking/common/fetcherService.js.map +1 -1
  240. package/dist/src/_internal/platform/networking/common/networking.d.ts +4 -3
  241. package/dist/src/_internal/platform/networking/common/networking.d.ts.map +1 -1
  242. package/dist/src/_internal/platform/networking/common/networking.js.map +1 -1
  243. package/dist/src/_internal/platform/networking/common/openai.d.ts.map +1 -1
  244. package/dist/src/_internal/platform/networking/common/openai.js +13 -1
  245. package/dist/src/_internal/platform/networking/common/openai.js.map +1 -1
  246. package/dist/src/_internal/platform/networking/node/stream.d.ts.map +1 -1
  247. package/dist/src/_internal/platform/networking/node/stream.js +50 -23
  248. package/dist/src/_internal/platform/networking/node/stream.js.map +1 -1
  249. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts +1 -0
  250. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts.map +1 -1
  251. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js +2 -0
  252. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js.map +1 -1
  253. package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts +2 -0
  254. package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts.map +1 -1
  255. package/dist/src/_internal/platform/requestLogger/node/requestLogger.js.map +1 -1
  256. package/dist/src/_internal/platform/thinking/common/thinkingUtils.d.ts +2 -2
  257. package/dist/src/_internal/platform/thinking/common/thinkingUtils.d.ts.map +1 -1
  258. package/dist/src/_internal/platform/thinking/common/thinkingUtils.js +4 -0
  259. package/dist/src/_internal/platform/thinking/common/thinkingUtils.js.map +1 -1
  260. package/dist/src/_internal/platform/tokenizer/node/tokenizer.d.ts +1 -1
  261. package/dist/src/_internal/platform/tokenizer/node/tokenizer.d.ts.map +1 -1
  262. package/dist/src/_internal/platform/tokenizer/node/tokenizer.js.map +1 -1
  263. package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts +7 -7
  264. package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts.map +1 -1
  265. package/dist/src/_internal/util/common/test/shims/chatTypes.js +11 -11
  266. package/dist/src/_internal/util/common/test/shims/chatTypes.js.map +1 -1
  267. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js +3 -3
  268. package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js.map +1 -1
  269. package/dist/src/_internal/util/common/tracing.d.ts +13 -0
  270. package/dist/src/_internal/util/common/tracing.d.ts.map +1 -1
  271. package/dist/src/_internal/util/common/tracing.js +7 -0
  272. package/dist/src/_internal/util/common/tracing.js.map +1 -1
  273. package/dist/src/_internal/vscodeTypes.d.ts +1 -1
  274. package/dist/src/_internal/vscodeTypes.d.ts.map +1 -1
  275. package/dist/src/_internal/vscodeTypes.js +3 -3
  276. package/dist/src/_internal/vscodeTypes.js.map +1 -1
  277. package/dist/src/main.d.ts.map +1 -1
  278. package/dist/src/main.js +3 -0
  279. package/dist/src/main.js.map +1 -1
  280. package/dist/src/package.json +450 -221
  281. package/package.json +4 -4
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.streamToLines = streamToLines;
8
+ exports.jsonlStreamToCompletions = jsonlStreamToCompletions;
9
+ const async_1 = require("../../../util/vs/base/common/async");
10
+ /**
11
+ * Transforms a stream of strings into a stream of lines.
12
+ *
13
+ * Listener should handle the errors coming from the input stream.
14
+ */
15
+ function streamToLines(stream) {
16
+ return new async_1.AsyncIterableObject(async (emitter) => {
17
+ let buffer = '';
18
+ for await (const str of stream) {
19
+ buffer += str;
20
+ do {
21
+ const newlineIndex = buffer.indexOf('\n');
22
+ if (newlineIndex === -1) {
23
+ break;
24
+ }
25
+ // take the first line
26
+ const line = buffer.substring(0, newlineIndex);
27
+ buffer = buffer.substring(newlineIndex + 1);
28
+ emitter.emitOne(line);
29
+ } while (true);
30
+ }
31
+ if (buffer.length > 0) {
32
+ // last line which doesn't end with \n
33
+ emitter.emitOne(buffer);
34
+ }
35
+ });
36
+ }
37
+ function jsonlStreamToCompletions(jsonlStream) {
38
+ return new async_1.AsyncIterableObject(async (emitter) => {
39
+ for await (const line of jsonlStream) {
40
+ if (line.trim() === 'data: [DONE]') {
41
+ continue;
42
+ }
43
+ if (line.startsWith('data: ')) {
44
+ try {
45
+ const message = JSON.parse(line.substring('data: '.length));
46
+ if (message.error) {
47
+ emitter.reject(new Error(message.error.message));
48
+ return;
49
+ }
50
+ emitter.emitOne(message);
51
+ }
52
+ catch (err) {
53
+ emitter.reject(err);
54
+ return;
55
+ }
56
+ }
57
+ }
58
+ });
59
+ }
60
+ // function replaceBytes(s: string): string {
61
+ // if (!s.startsWith('bytes:')) {
62
+ // return s;
63
+ // }
64
+ // const bytes: number[] = [];
65
+ // let i = 'bytes:'.length;
66
+ // const textEncoder = new TextEncoder();
67
+ // while (i < s.length) {
68
+ // if (s.slice(i, i + 3) === '\\\\x') {
69
+ // bytes.push(parseInt(s.slice(i + 3, i + 5), 16));
70
+ // i += 5;
71
+ // } else if (s.slice(i, i + 2) === '\\x') {
72
+ // bytes.push(parseInt(s.slice(i + 2, i + 4), 16));
73
+ // i += 4;
74
+ // } else {
75
+ // const encoded = textEncoder.encode(s.slice(i, i + 1));
76
+ // for (const b of encoded) {
77
+ // bytes.push(b);
78
+ // }
79
+ // i += 1;
80
+ // }
81
+ // }
82
+ // return new TextDecoder('utf8', { fatal: false }).decode(
83
+ // new Uint8Array(bytes)
84
+ // );
85
+ // }
86
+ //# sourceMappingURL=streamTransformer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamTransformer.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/nesFetch/node/streamTransformer.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAUhG,sCAyBC;AAED,4DA2BC;AA9DD,8DAAyE;AAGzE;;;;GAIG;AACH,SAAgB,aAAa,CAAC,MAAmC;IAChE,OAAO,IAAI,2BAAmB,CAAS,KAAK,EAAE,OAAO,EAAE,EAAE;QACxD,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;YAChC,MAAM,IAAI,GAAG,CAAC;YACd,GAAG,CAAC;gBACH,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC1C,IAAI,YAAY,KAAK,CAAC,CAAC,EAAE,CAAC;oBACzB,MAAM;gBACP,CAAC;gBAED,sBAAsB;gBACtB,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;gBAC/C,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;gBAE5C,OAAO,CAAC,OAA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C,sDAAsD;AACtD,aAAa;AACb,aAAa;AACb,4DAA4D;AAC5D,gCAAgC;AAChC,qBAAqB;AACrB,OAAO;AACP,aAAa;AACb,MAAM;AACN,KAAK;AACL,4DAA4D;AAC5D,0BAA0B;AAC1B,MAAM;AACN,IAAI"}
@@ -0,0 +1,167 @@
1
+ import { IConfigurationService } from '../../configuration/common/configurationService';
2
+ import { IExperimentationService } from '../../telemetry/common/nullExperimentationService';
3
+ import { IChatEndpoint } from './networking';
4
+ /**
5
+ * Types for Anthropic Messages API
6
+ * Based on https://platform.claude.com/docs/en/api/messages
7
+ *
8
+ * This interface supports both regular tools and server tools (web search, tool search):
9
+ * - Regular tools: require name, description, and input_schema
10
+ * - Tool search tools: require only type and name
11
+ */
12
+ export interface AnthropicMessagesTool {
13
+ name: string;
14
+ type?: string;
15
+ description?: string;
16
+ input_schema?: {
17
+ type: 'object';
18
+ properties?: Record<string, unknown>;
19
+ required?: string[];
20
+ };
21
+ defer_loading?: boolean;
22
+ }
23
+ export interface ToolReference {
24
+ type: 'tool_reference';
25
+ tool_name: string;
26
+ }
27
+ export interface ToolSearchToolSearchResult {
28
+ type: 'tool_search_tool_search_result';
29
+ tool_references: ToolReference[];
30
+ }
31
+ export interface ToolSearchToolResultError {
32
+ type: 'tool_search_tool_result_error';
33
+ error_code: 'too_many_requests' | 'invalid_pattern' | 'pattern_too_long' | 'unavailable';
34
+ }
35
+ export interface ServerToolUse {
36
+ type: 'server_tool_use';
37
+ id: string;
38
+ name: string;
39
+ input: {
40
+ query: string;
41
+ };
42
+ }
43
+ export interface ToolSearchToolResult {
44
+ type: 'tool_search_tool_result';
45
+ tool_use_id: string;
46
+ content: ToolSearchToolSearchResult | ToolSearchToolResultError;
47
+ }
48
+ export interface ToolSearchUsage {
49
+ tool_search_requests: number;
50
+ }
51
+ /**
52
+ * Tools that should not use deferred loading when tool search is enabled.
53
+ * These are frequently used tools that benefit from being immediately available.
54
+ *
55
+ * TODO: @bhavyaus Replace these hardcoded strings with constants from ToolName enum
56
+ */
57
+ export declare const nonDeferredToolNames: Set<string>;
58
+ /**
59
+ * Context management types for Anthropic Messages API
60
+ * Based on https://platform.claude.com/docs/en/build-with-claude/context-editing
61
+ */
62
+ export type ContextManagementTrigger = {
63
+ type: 'input_tokens';
64
+ value: number;
65
+ } | {
66
+ type: 'tool_uses';
67
+ value: number;
68
+ };
69
+ export type ContextManagementKeep = {
70
+ type: 'tool_uses';
71
+ value: number;
72
+ } | {
73
+ type: 'thinking_turns';
74
+ value: number;
75
+ } | 'all';
76
+ export type ContextManagementClearAtLeast = {
77
+ type: 'input_tokens';
78
+ value: number;
79
+ };
80
+ export interface ClearToolUsesEdit {
81
+ type: 'clear_tool_uses_20250919';
82
+ trigger?: ContextManagementTrigger;
83
+ keep?: ContextManagementKeep;
84
+ clear_at_least?: ContextManagementClearAtLeast;
85
+ exclude_tools?: string[];
86
+ clear_tool_inputs?: boolean;
87
+ }
88
+ export interface ClearThinkingEdit {
89
+ type: 'clear_thinking_20251015';
90
+ keep?: ContextManagementKeep;
91
+ }
92
+ export type ContextManagementEdit = ClearToolUsesEdit | ClearThinkingEdit;
93
+ export interface ContextManagement {
94
+ edits: ContextManagementEdit[];
95
+ }
96
+ export interface AppliedContextEdit {
97
+ type: 'clear_thinking_20251015' | 'clear_tool_uses_20250919';
98
+ cleared_thinking_turns?: number;
99
+ cleared_tool_uses?: number;
100
+ cleared_input_tokens?: number;
101
+ }
102
+ export interface ContextManagementResponse {
103
+ applied_edits: AppliedContextEdit[];
104
+ }
105
+ /**
106
+ * Context editing is supported by:
107
+ * - Claude Haiku 4.5 (claude-haiku-4-5-* or claude-haiku-4.5-*)
108
+ * - Claude Sonnet 4.5 (claude-sonnet-4-5-* or claude-sonnet-4.5-*)
109
+ * - Claude Sonnet 4 (claude-sonnet-4-*)
110
+ * - Claude Opus 4.5 (claude-opus-4-5-* or claude-opus-4.5-*)
111
+ * - Claude Opus 4.1 (claude-opus-4-1-* or claude-opus-4.1-*)
112
+ * - Claude Opus 4 (claude-opus-4-*)
113
+ * @param modelId The model ID to check
114
+ * @returns true if the model supports context editing
115
+ */
116
+ export declare function modelSupportsContextEditing(modelId: string): boolean;
117
+ /**
118
+ * Tool search is only supported by:
119
+ * - Claude Sonnet 4.5 (claude-sonnet-4-5-* or claude-sonnet-4.5-*)
120
+ * - Claude Opus 4.5 (claude-opus-4-5-* or claude-opus-4.5-*)
121
+ * @param modelId The model ID to check
122
+ * @returns true if the model supports tool search
123
+ */
124
+ export declare function modelSupportsToolSearch(modelId: string): boolean;
125
+ /**
126
+ * Memory is supported by:
127
+ * - Claude Haiku 4.5 (claude-haiku-4-5-* or claude-haiku-4.5-*)
128
+ * - Claude Sonnet 4.5 (claude-sonnet-4-5-* or claude-sonnet-4.5-*)
129
+ * - Claude Sonnet 4 (claude-sonnet-4-*)
130
+ * - Claude Opus 4.5 (claude-opus-4-5-* or claude-opus-4.5-*)
131
+ * - Claude Opus 4.1 (claude-opus-4-1-* or claude-opus-4.1-*)
132
+ * - Claude Opus 4 (claude-opus-4-*)
133
+ * @param modelId The model ID to check
134
+ * @returns true if the model supports memory
135
+ */
136
+ export declare function modelSupportsMemory(modelId: string): boolean;
137
+ export declare function isAnthropicMemoryEnabled(endpoint: IChatEndpoint | string, configurationService: IConfigurationService, experimentationService: IExperimentationService): boolean;
138
+ export declare function isAnthropicToolSearchEnabled(endpoint: IChatEndpoint | string, configurationService: IConfigurationService, experimentationService: IExperimentationService): boolean;
139
+ export declare function isAnthropicContextEditingEnabled(endpoint: IChatEndpoint | string, configurationService: IConfigurationService, experimentationService: IExperimentationService): boolean;
140
+ export interface ContextEditingConfig {
141
+ triggerType: 'input_tokens' | 'tool_uses';
142
+ triggerValue: number;
143
+ keepCount: number;
144
+ clearAtLeastTokens: number | undefined;
145
+ excludeTools: string[];
146
+ clearInputs: boolean;
147
+ thinkingKeepTurns: number;
148
+ }
149
+ /**
150
+ * Builds the context_management configuration object for the Messages API request.
151
+ * @param config The context editing configuration from individual settings
152
+ * @param hasThinking Whether extended thinking is enabled (the thinking budget value)
153
+ * @param modelMaxTokens The maximum input tokens supported by the model
154
+ * @returns The context_management object to include in the request, or undefined if no edits
155
+ */
156
+ export declare function buildContextManagement(config: ContextEditingConfig, hasThinking: number | undefined, modelMaxTokens: number): ContextManagement | undefined;
157
+ /**
158
+ * Reads context editing configuration from settings and builds the context_management object.
159
+ * This is a convenience function that combines reading configuration with buildContextManagement.
160
+ * @param configurationService The configuration service to read settings from
161
+ * @param experimentationService The experimentation service for experiment-based config
162
+ * @param thinkingBudget The thinking budget value (undefined if thinking is disabled)
163
+ * @param modelMaxInputTokens The maximum input tokens supported by the model
164
+ * @returns The context_management object to include in the request, or undefined if disabled
165
+ */
166
+ export declare function getContextManagementFromConfig(experimentationService: IExperimentationService, thinkingBudget: number | undefined, modelMaxInputTokens: number): ContextManagement | undefined;
167
+ //# sourceMappingURL=anthropic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/anthropic.ts"],"names":[],"mappings":"AAKA,OAAO,EAAa,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE;QACd,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAA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,EAC3C,sBAAsB,EAAE,uBAAuB,GAC7C,OAAO,CAQT;AAED,wBAAgB,gCAAgC,CAC/C,QAAQ,EAAE,aAAa,GAAG,MAAM,EAChC,oBAAoB,EAAE,qBAAqB,EAC3C,sBAAsB,EAAE,uBAAuB,GAC7C,OAAO,CAOT;AAED,MAAM,WAAW,oBAAoB;IACpC,WAAW,EAAE,cAAc,GAAG,WAAW,CAAC;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,cAAc,EAAE,MAAM,GACpB,iBAAiB,GAAG,SAAS,CA6B/B;AAED;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAC7C,sBAAsB,EAAE,uBAAuB,EAC/C,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,mBAAmB,EAAE,MAAM,GACzB,iBAAiB,GAAG,SAAS,CAa/B"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Microsoft Corporation. All rights reserved.
4
+ * Licensed under the MIT License. See License.txt in the project root for license information.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.nonDeferredToolNames = void 0;
8
+ exports.modelSupportsContextEditing = modelSupportsContextEditing;
9
+ exports.modelSupportsToolSearch = modelSupportsToolSearch;
10
+ exports.modelSupportsMemory = modelSupportsMemory;
11
+ exports.isAnthropicMemoryEnabled = isAnthropicMemoryEnabled;
12
+ exports.isAnthropicToolSearchEnabled = isAnthropicToolSearchEnabled;
13
+ exports.isAnthropicContextEditingEnabled = isAnthropicContextEditingEnabled;
14
+ exports.buildContextManagement = buildContextManagement;
15
+ exports.getContextManagementFromConfig = getContextManagementFromConfig;
16
+ const configurationService_1 = require("../../configuration/common/configurationService");
17
+ /**
18
+ * Tools that should not use deferred loading when tool search is enabled.
19
+ * These are frequently used tools that benefit from being immediately available.
20
+ *
21
+ * TODO: @bhavyaus Replace these hardcoded strings with constants from ToolName enum
22
+ */
23
+ exports.nonDeferredToolNames = new Set([
24
+ // Read/navigate
25
+ 'read_file',
26
+ 'list_dir',
27
+ // Search
28
+ 'grep_search',
29
+ 'semantic_search',
30
+ 'file_search',
31
+ // Edit
32
+ 'replace_string_in_file',
33
+ 'multi_replace_string_in_file',
34
+ 'insert_edit_into_file',
35
+ 'apply_patch',
36
+ 'create_file',
37
+ // Terminal
38
+ 'run_in_terminal',
39
+ 'get_terminal_output',
40
+ // Other high-usage tools
41
+ 'get_errors',
42
+ 'manage_todo_list',
43
+ ]);
44
+ /**
45
+ * Context editing is supported by:
46
+ * - Claude Haiku 4.5 (claude-haiku-4-5-* or claude-haiku-4.5-*)
47
+ * - Claude Sonnet 4.5 (claude-sonnet-4-5-* or claude-sonnet-4.5-*)
48
+ * - Claude Sonnet 4 (claude-sonnet-4-*)
49
+ * - Claude Opus 4.5 (claude-opus-4-5-* or claude-opus-4.5-*)
50
+ * - Claude Opus 4.1 (claude-opus-4-1-* or claude-opus-4.1-*)
51
+ * - Claude Opus 4 (claude-opus-4-*)
52
+ * @param modelId The model ID to check
53
+ * @returns true if the model supports context editing
54
+ */
55
+ function modelSupportsContextEditing(modelId) {
56
+ // Normalize: lowercase and replace dots with dashes so "4.5" matches "4-5"
57
+ const normalized = modelId.toLowerCase().replace(/\./g, '-');
58
+ return normalized.startsWith('claude-haiku-4-5') ||
59
+ normalized.startsWith('claude-sonnet-4-5') ||
60
+ normalized.startsWith('claude-sonnet-4') ||
61
+ normalized.startsWith('claude-opus-4-5') ||
62
+ normalized.startsWith('claude-opus-4-1') ||
63
+ normalized.startsWith('claude-opus-4');
64
+ }
65
+ /**
66
+ * Tool search is only supported by:
67
+ * - Claude Sonnet 4.5 (claude-sonnet-4-5-* or claude-sonnet-4.5-*)
68
+ * - Claude Opus 4.5 (claude-opus-4-5-* or claude-opus-4.5-*)
69
+ * @param modelId The model ID to check
70
+ * @returns true if the model supports tool search
71
+ */
72
+ function modelSupportsToolSearch(modelId) {
73
+ // Normalize: lowercase and replace dots with dashes so "4.5" matches "4-5"
74
+ const normalized = modelId.toLowerCase().replace(/\./g, '-');
75
+ return normalized.startsWith('claude-sonnet-4-5') ||
76
+ normalized.startsWith('claude-opus-4-5');
77
+ }
78
+ /**
79
+ * Memory is supported by:
80
+ * - Claude Haiku 4.5 (claude-haiku-4-5-* or claude-haiku-4.5-*)
81
+ * - Claude Sonnet 4.5 (claude-sonnet-4-5-* or claude-sonnet-4.5-*)
82
+ * - Claude Sonnet 4 (claude-sonnet-4-*)
83
+ * - Claude Opus 4.5 (claude-opus-4-5-* or claude-opus-4.5-*)
84
+ * - Claude Opus 4.1 (claude-opus-4-1-* or claude-opus-4.1-*)
85
+ * - Claude Opus 4 (claude-opus-4-*)
86
+ * @param modelId The model ID to check
87
+ * @returns true if the model supports memory
88
+ */
89
+ function modelSupportsMemory(modelId) {
90
+ const normalized = modelId.toLowerCase().replace(/\./g, '-');
91
+ return normalized.startsWith('claude-haiku-4-5') ||
92
+ normalized.startsWith('claude-sonnet-4-5') ||
93
+ normalized.startsWith('claude-sonnet-4') ||
94
+ normalized.startsWith('claude-opus-4-5') ||
95
+ normalized.startsWith('claude-opus-4-1') ||
96
+ normalized.startsWith('claude-opus-4');
97
+ }
98
+ function isAnthropicMemoryEnabled(endpoint, configurationService, experimentationService) {
99
+ const effectiveModelId = typeof endpoint === 'string' ? endpoint : endpoint.model;
100
+ if (!modelSupportsMemory(effectiveModelId)) {
101
+ return false;
102
+ }
103
+ return configurationService.getExperimentBasedConfig(configurationService_1.ConfigKey.MemoryToolEnabled, experimentationService);
104
+ }
105
+ function isAnthropicToolSearchEnabled(endpoint, configurationService, experimentationService) {
106
+ const effectiveModelId = typeof endpoint === 'string' ? endpoint : endpoint.model;
107
+ if (!modelSupportsToolSearch(effectiveModelId)) {
108
+ return false;
109
+ }
110
+ return configurationService.getExperimentBasedConfig(configurationService_1.ConfigKey.AnthropicToolSearchEnabled, experimentationService);
111
+ }
112
+ function isAnthropicContextEditingEnabled(endpoint, configurationService, experimentationService) {
113
+ const effectiveModelId = typeof endpoint === 'string' ? endpoint : endpoint.model;
114
+ if (!modelSupportsContextEditing(effectiveModelId)) {
115
+ return false;
116
+ }
117
+ return configurationService.getExperimentBasedConfig(configurationService_1.ConfigKey.AnthropicContextEditingEnabled, experimentationService);
118
+ }
119
+ /**
120
+ * Builds the context_management configuration object for the Messages API request.
121
+ * @param config The context editing configuration from individual settings
122
+ * @param hasThinking Whether extended thinking is enabled (the thinking budget value)
123
+ * @param modelMaxTokens The maximum input tokens supported by the model
124
+ * @returns The context_management object to include in the request, or undefined if no edits
125
+ */
126
+ function buildContextManagement(config, hasThinking, modelMaxTokens) {
127
+ const edits = [];
128
+ // Add thinking block clearing if extended thinking is enabled
129
+ if (hasThinking) {
130
+ const thinkingKeepTurns = config.thinkingKeepTurns;
131
+ edits.push({
132
+ type: 'clear_thinking_20251015',
133
+ keep: { type: 'thinking_turns', value: Math.max(1, thinkingKeepTurns) },
134
+ });
135
+ }
136
+ // Add tool result clearing configuration
137
+ const { triggerType, triggerValue, keepCount, clearAtLeastTokens, excludeTools, clearInputs } = config;
138
+ // Build trigger based on type - use configured values directly (defaults match Anthropic's recommendations)
139
+ const trigger = { type: triggerType, value: triggerValue };
140
+ const toolEdit = {
141
+ type: 'clear_tool_uses_20250919',
142
+ trigger,
143
+ keep: { type: 'tool_uses', value: keepCount },
144
+ ...(clearAtLeastTokens ? { clear_at_least: { type: 'input_tokens', value: clearAtLeastTokens } } : {}),
145
+ ...(excludeTools.length > 0 ? { exclude_tools: excludeTools } : {}),
146
+ ...(clearInputs ? { clear_tool_inputs: clearInputs } : {}),
147
+ };
148
+ edits.push(toolEdit);
149
+ return edits.length > 0 ? { edits } : undefined;
150
+ }
151
+ /**
152
+ * Reads context editing configuration from settings and builds the context_management object.
153
+ * This is a convenience function that combines reading configuration with buildContextManagement.
154
+ * @param configurationService The configuration service to read settings from
155
+ * @param experimentationService The experimentation service for experiment-based config
156
+ * @param thinkingBudget The thinking budget value (undefined if thinking is disabled)
157
+ * @param modelMaxInputTokens The maximum input tokens supported by the model
158
+ * @returns The context_management object to include in the request, or undefined if disabled
159
+ */
160
+ function getContextManagementFromConfig(experimentationService, thinkingBudget, modelMaxInputTokens) {
161
+ const contextEditingConfig = {
162
+ triggerType: (experimentationService.getTreatmentVariable('copilotchat.anthropic.contextEditing.toolResult.triggerType') ?? 'input_tokens'),
163
+ triggerValue: experimentationService.getTreatmentVariable('copilotchat.anthropic.contextEditing.toolResult.triggerValue') ?? 75000,
164
+ keepCount: experimentationService.getTreatmentVariable('copilotchat.anthropic.contextEditing.toolResult.keepCount') ?? 5,
165
+ clearAtLeastTokens: experimentationService.getTreatmentVariable('copilotchat.anthropic.contextEditing.toolResult.clearAtLeastTokens') ?? 5000,
166
+ excludeTools: [],
167
+ clearInputs: experimentationService.getTreatmentVariable('copilotchat.anthropic.contextEditing.toolResult.clearInputs') ?? true,
168
+ thinkingKeepTurns: experimentationService.getTreatmentVariable('copilotchat.anthropic.contextEditing.thinking.keepTurns') ?? 1,
169
+ };
170
+ return buildContextManagement(contextEditingConfig, thinkingBudget, modelMaxInputTokens);
171
+ }
172
+ //# sourceMappingURL=anthropic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/anthropic.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAoJhG,kEASC;AASD,0DAKC;AAaD,kDAQC;AAGD,4DAYC;AAED,oEAYC;AAED,4EAWC;AAmBD,wDAiCC;A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,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1D,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAErB,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAC7C,sBAA+C,EAC/C,cAAkC,EAClC,mBAA2B;IAG3B,MAAM,oBAAoB,GAAyB;QAClD,WAAW,EAAE,CAAC,sBAAsB,CAAC,oBAAoB,CAAS,6DAA6D,CAAC,IAAI,cAAc,CAAiC;QACnL,YAAY,EAAE,sBAAsB,CAAC,oBAAoB,CAAS,8DAA8D,CAAC,IAAI,KAAK;QAC1I,SAAS,EAAE,sBAAsB,CAAC,oBAAoB,CAAS,2DAA2D,CAAC,IAAI,CAAC;QAChI,kBAAkB,EAAE,sBAAsB,CAAC,oBAAoB,CAAS,oEAAoE,CAAC,IAAI,IAAI;QACrJ,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,sBAAsB,CAAC,oBAAoB,CAAU,6DAA6D,CAAC,IAAI,IAAI;QACxI,iBAAiB,EAAE,sBAAsB,CAAC,oBAAoB,CAAS,yDAAyD,CAAC,IAAI,CAAC;KACtI,CAAC;IAEF,OAAO,sBAAsB,CAAC,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC;AAC1F,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { EncryptedThinkingDelta, ThinkingData, ThinkingDelta } from '../../thinking/common/thinking';
2
- import { Response } from './fetcherService';
2
+ import { AnthropicMessagesTool, ContextManagementResponse } from './anthropic';
3
+ import { IHeaders } from './fetcherService';
3
4
  import { ChoiceLogProbs, FilterReason } from './openai';
4
5
  export interface RequestId {
5
6
  headerRequestId: string;
@@ -9,7 +10,7 @@ export interface RequestId {
9
10
  serverExperiments: string;
10
11
  deploymentId: string;
11
12
  }
12
- export declare function getRequestId(response: Response, json?: any): RequestId;
13
+ export declare function getRequestId(headers: IHeaders, json?: any): RequestId;
13
14
  export interface ICodeVulnerabilityAnnotation {
14
15
  details: {
15
16
  type: string;
@@ -40,8 +41,18 @@ export interface ICopilotToolCall {
40
41
  arguments: string;
41
42
  id: string;
42
43
  }
44
+ export interface IServerToolCall extends ICopilotToolCall {
45
+ /** Indicates this is a server-side tool call (e.g., tool_search, websearch) - not validated/executed by client */
46
+ isServer: true;
47
+ }
48
+ export interface ICopilotToolCallStreamUpdate {
49
+ name: string;
50
+ arguments: string;
51
+ id?: string;
52
+ }
43
53
  export interface ICopilotBeginToolCall {
44
54
  name: string;
55
+ id?: string;
45
56
  }
46
57
  /**
47
58
  * @deprecated
@@ -76,6 +87,7 @@ export interface IResponseDelta {
76
87
  copilotReferences?: ICopilotReference[];
77
88
  copilotErrors?: ICopilotError[];
78
89
  copilotToolCalls?: ICopilotToolCall[];
90
+ copilotToolCallStreamUpdates?: ICopilotToolCallStreamUpdate[];
79
91
  beginToolCalls?: ICopilotBeginToolCall[];
80
92
  _deprecatedCopilotFunctionCalls?: ICopilotFunctionCall[];
81
93
  copilotConfirmation?: ICopilotConfirmation;
@@ -83,6 +95,10 @@ export interface IResponseDelta {
83
95
  retryReason?: FilterReason | 'network_error';
84
96
  /** Marker for the current response, which should be presented in `IMakeChatRequestOptions` on the next call */
85
97
  statefulMarker?: string;
98
+ /** Context management information from Anthropic Messages API */
99
+ contextManagement?: ContextManagementResponse;
100
+ /** Server-side tool calls (e.g., tool_search) - reported for logging but not validated/executed */
101
+ serverToolCalls?: IServerToolCall[];
86
102
  }
87
103
  export declare const enum ResponsePartKind {
88
104
  ContentDelta = 0,
@@ -187,15 +203,6 @@ export interface OpenAiResponsesFunctionTool extends OpenAiFunctionDef {
187
203
  type: 'function';
188
204
  }
189
205
  export declare function isOpenAiFunctionTool(tool: OpenAiResponsesFunctionTool | OpenAiFunctionTool | AnthropicMessagesTool): tool is OpenAiFunctionTool;
190
- export interface AnthropicMessagesTool {
191
- name: string;
192
- description?: string;
193
- input_schema: {
194
- type: 'object';
195
- properties?: Record<string, any>;
196
- required?: string[];
197
- };
198
- }
199
206
  /**
200
207
  * Options for streaming response. Only set this when you set stream: true.
201
208
  *
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxD,MAAM,WAAW,SAAS;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,SAAS,CAStE;AAID,MAAM,WAAW,4BAA4B;IAC5C,OAAO,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACpB,CAAC;CACF;AAED,MAAM,WAAW,eAAe;IAC/B,SAAS,EAAE;QACV,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KAChB,CAAC;CACF;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,4BAA4B,CAQ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AAM,CAAC;IAEpB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+BAA+B;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAChC,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAEjF,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oBAAoB;IACpB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC9B"}
@@ -9,14 +9,14 @@ exports.isCopilotAnnotation = isCopilotAnnotation;
9
9
  exports.isCodeCitationAnnotation = isCodeCitationAnnotation;
10
10
  exports.isCopilotWebReference = isCopilotWebReference;
11
11
  exports.isOpenAiFunctionTool = isOpenAiFunctionTool;
12
- function getRequestId(response, json) {
12
+ function getRequestId(headers, json) {
13
13
  return {
14
- headerRequestId: response.headers.get('x-request-id') || '',
15
- gitHubRequestId: response.headers.get('x-github-request-id') || '',
14
+ headerRequestId: headers.get('x-request-id') || '',
15
+ gitHubRequestId: headers.get('x-github-request-id') || '',
16
16
  completionId: json && json.id ? json.id : '',
17
17
  created: json && json.created ? json.created : 0,
18
- serverExperiments: response.headers.get('X-Copilot-Experiment') || '',
19
- deploymentId: response.headers.get('azureml-model-deployment') || '',
18
+ serverExperiments: headers.get('X-Copilot-Experiment') || '',
19
+ deploymentId: headers.get('azureml-model-deployment') || '',
20
20
  };
21
21
  }
22
22
  function isCopilotAnnotation(thing) {
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAkBhG,oCASC;AAmBD,kDAQC;AAED,4DAQC;AAuCD,sDAEC;AA8JD,oDAEC;AAvPD,SAAgB,YAAY,CAAC,QAAkB,EAAE,IAAU;IAC1D,OAAO;QACN,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE;QAC3D,eAAe,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,EAAE;QAClE,YAAY,EAAE,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;QAC5C,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAChD,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,IAAI,EAAE;QACrE,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,IAAI,EAAE;KACpE,CAAC;AACH,CAAC;AAmBD,SAAgB,mBAAmB,CAAC,KAAc;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,KAAK,CAAC;IACd,CAAC;IAED,MAAM,EAAE,OAAO,EAAE,GAAG,KAAqC,CAAC;IAC1D,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;QACrD,MAAM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AAQ,IAAI,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ,CAAC;AAC7H,CAAC;AAmDD,SAAgB,qBAAqB,CAAC,SAAkB;IACvD,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,CAAC;AAC7H,CAAC;AAmKD,SAAgB,oBAAoB,CAAC,IAA8E;IAClH,OAAQ,IAA2B,CAAC,QAAQ,KAAK,SAAS,CAAC;AAC5D,CAAC"}
@@ -16,16 +16,15 @@ export declare class Response {
16
16
  readonly status: number;
17
17
  readonly statusText: string;
18
18
  readonly headers: IHeaders;
19
- private readonly getText;
20
- private readonly getJson;
21
- private readonly getBody;
22
19
  readonly fetcher: FetcherId;
23
20
  ok: boolean;
24
- constructor(status: number, statusText: string, headers: IHeaders, getText: () => Promise<string>, getJson: () => Promise<any>, getBody: () => Promise<unknown | null>, fetcher: FetcherId);
21
+ readonly body: DestroyableStream<Uint8Array>;
22
+ private _bytesReceived;
23
+ get bytesReceived(): number;
24
+ constructor(status: number, statusText: string, headers: IHeaders, body: ReadableStream<Uint8Array> | null, fetcher: FetcherId);
25
+ static fromText(status: number, statusText: string, headers: IHeaders, body: string, fetcher: FetcherId): Response;
25
26
  text(): Promise<string>;
26
27
  json(): Promise<any>;
27
- /** Async version of the standard .body field. */
28
- body(): Promise<unknown | null>;
29
28
  }
30
29
  export type FetcherId = 'electron-fetch' | 'node-fetch' | 'node-http' | 'test-stub' | 'helix-fetch';
31
30
  /** These are the options we currently use, for ease of reference. */
@@ -35,7 +34,11 @@ export interface FetchOptions {
35
34
  };
36
35
  body?: string;
37
36
  timeout?: number;
38
- json?: any;
37
+ /**
38
+ * If `json` is provided, it will be stringified using `JSON.stringify` and sent as the body with
39
+ * the `Content-Type` header set to `application/json`.
40
+ */
41
+ json?: unknown;
39
42
  method?: 'GET' | 'POST';
40
43
  signal?: IAbortSignal;
41
44
  retryFallbacks?: boolean;
@@ -61,5 +64,35 @@ export interface IAbortController {
61
64
  export interface IHeaders extends Iterable<[string, string]> {
62
65
  get(name: string): string | null;
63
66
  }
67
+ /**
68
+ * Wraps a ReadableStream to allow cancellation even while a `for await` loop
69
+ * holds the stream locked. Use `destroy()` to safely cancel from an external
70
+ * callback (e.g., `onReturn`) - it cancels through the reader if locked.
71
+ *
72
+ * When `pipeThrough()` is called, destroy() will forward to the piped stream.
73
+ */
74
+ export declare class DestroyableStream<T> implements AsyncIterable<T> {
75
+ private readonly stream;
76
+ private reader;
77
+ private pipedHead;
78
+ constructor(stream: ReadableStream<T>);
79
+ /**
80
+ * Returns the underlying ReadableStream for APIs that require it
81
+ * (e.g., Readable.fromWeb). Use with caution as operations on the
82
+ * returned stream bypass the DestroyableStream's reader tracking.
83
+ */
84
+ toReadableStream(): ReadableStream<T>;
85
+ /**
86
+ * Pipes this stream through a transform stream.
87
+ * Returns a new DestroyableStream wrapping the transformed stream.
88
+ * Calling destroy() on this stream will forward to the piped stream.
89
+ */
90
+ pipeThrough<U>(transform: {
91
+ readable: ReadableStream<U>;
92
+ writable: WritableStream<T>;
93
+ }): DestroyableStream<U>;
94
+ [Symbol.asyncIterator](): AsyncGenerator<T, void, undefined>;
95
+ destroy(): Promise<void>;
96
+ }
64
97
  export declare function jsonVerboseError(resp: Response): Promise<any>;
65
98
  //# sourceMappingURL=fetcherService.d.ts.map