@vscode/chat-lib 0.43.2026040705 → 0.44.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 (152) hide show
  1. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.d.ts +1 -5
  2. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.d.ts.map +1 -1
  3. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.js +3 -11
  4. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/completionsFromNetwork.js.map +1 -1
  5. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts +0 -30
  6. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts.map +1 -1
  7. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js +4 -82
  8. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js.map +1 -1
  9. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.d.ts +2 -10
  10. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.d.ts.map +1 -1
  11. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.js +6 -160
  12. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.js.map +1 -1
  13. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.d.ts +11 -0
  14. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.d.ts.map +1 -1
  15. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.js +21 -3
  16. package/dist/src/_internal/extension/inlineEdits/node/nextEditCache.js.map +1 -1
  17. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts +2 -2
  18. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -1
  19. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +34 -12
  20. package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -1
  21. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts +1 -1
  22. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
  23. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +22 -15
  24. package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
  25. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js +2 -2
  26. package/dist/src/_internal/extension/prompt/node/chatMLFetcherTelemetry.js.map +1 -1
  27. package/dist/src/_internal/extension/xtab/node/cursorLineDivergence.d.ts +41 -0
  28. package/dist/src/_internal/extension/xtab/node/cursorLineDivergence.d.ts.map +1 -0
  29. package/dist/src/_internal/extension/xtab/node/cursorLineDivergence.js +181 -0
  30. package/dist/src/_internal/extension/xtab/node/cursorLineDivergence.js.map +1 -0
  31. package/dist/src/_internal/extension/xtab/node/editIntent.d.ts +31 -0
  32. package/dist/src/_internal/extension/xtab/node/editIntent.d.ts.map +1 -0
  33. package/dist/src/_internal/extension/xtab/node/editIntent.js +193 -0
  34. package/dist/src/_internal/extension/xtab/node/editIntent.js.map +1 -0
  35. package/dist/src/_internal/extension/xtab/node/responseFormatHandlers.d.ts +52 -0
  36. package/dist/src/_internal/extension/xtab/node/responseFormatHandlers.d.ts.map +1 -0
  37. package/dist/src/_internal/extension/xtab/node/responseFormatHandlers.js +159 -0
  38. package/dist/src/_internal/extension/xtab/node/responseFormatHandlers.js.map +1 -0
  39. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts +10 -37
  40. package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
  41. package/dist/src/_internal/extension/xtab/node/xtabProvider.js +277 -349
  42. package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
  43. package/dist/src/_internal/extension/xtab/node/xtabUtils.d.ts +10 -0
  44. package/dist/src/_internal/extension/xtab/node/xtabUtils.d.ts.map +1 -1
  45. package/dist/src/_internal/extension/xtab/node/xtabUtils.js +24 -0
  46. package/dist/src/_internal/extension/xtab/node/xtabUtils.js.map +1 -1
  47. package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts +1 -0
  48. package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts.map +1 -1
  49. package/dist/src/_internal/platform/authentication/common/copilotToken.js +3 -0
  50. package/dist/src/_internal/platform/authentication/common/copilotToken.js.map +1 -1
  51. package/dist/src/_internal/platform/chat/common/commonTypes.d.ts.map +1 -1
  52. package/dist/src/_internal/platform/chat/common/commonTypes.js +34 -4
  53. package/dist/src/_internal/platform/chat/common/commonTypes.js.map +1 -1
  54. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +17 -4
  55. package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
  56. package/dist/src/_internal/platform/configuration/common/configurationService.js +22 -9
  57. package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
  58. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.d.ts +1 -1
  59. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.d.ts.map +1 -1
  60. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.js +1 -1
  61. package/dist/src/_internal/platform/configuration/common/defaultsOnlyConfigurationService.js.map +1 -1
  62. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts +20 -0
  63. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
  64. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +45 -1
  65. package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
  66. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts +2 -0
  67. package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts.map +1 -1
  68. package/dist/src/_internal/platform/endpoint/common/endpointProvider.js.map +1 -1
  69. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.d.ts +5 -0
  70. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.d.ts.map +1 -1
  71. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.js +13 -0
  72. package/dist/src/_internal/platform/endpoint/common/statefulMarkerContainer.js.map +1 -1
  73. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts +3 -1
  74. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -1
  75. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +14 -14
  76. package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
  77. package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts.map +1 -1
  78. package/dist/src/_internal/platform/endpoint/node/messagesApi.js +28 -12
  79. package/dist/src/_internal/platform/endpoint/node/messagesApi.js.map +1 -1
  80. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts +12 -2
  81. package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -1
  82. package/dist/src/_internal/platform/endpoint/node/responsesApi.js +201 -23
  83. package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -1
  84. package/dist/src/_internal/platform/git/common/gitService.d.ts +7 -3
  85. package/dist/src/_internal/platform/git/common/gitService.d.ts.map +1 -1
  86. package/dist/src/_internal/platform/git/common/gitService.js.map +1 -1
  87. package/dist/src/_internal/platform/github/common/githubAPI.d.ts +1 -0
  88. package/dist/src/_internal/platform/github/common/githubAPI.d.ts.map +1 -1
  89. package/dist/src/_internal/platform/github/common/githubAPI.js +2 -0
  90. package/dist/src/_internal/platform/github/common/githubAPI.js.map +1 -1
  91. package/dist/src/_internal/platform/github/common/githubService.d.ts +3 -2
  92. package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -1
  93. package/dist/src/_internal/platform/github/common/githubService.js.map +1 -1
  94. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts +12 -3
  95. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts.map +1 -1
  96. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js +72 -46
  97. package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js.map +1 -1
  98. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.d.ts +3 -0
  99. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.d.ts.map +1 -1
  100. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.js +12 -0
  101. package/dist/src/_internal/platform/inlineEdits/common/utils/utils.js.map +1 -1
  102. package/dist/src/_internal/platform/log/common/logService.d.ts +5 -0
  103. package/dist/src/_internal/platform/log/common/logService.d.ts.map +1 -1
  104. package/dist/src/_internal/platform/log/common/logService.js +22 -0
  105. package/dist/src/_internal/platform/log/common/logService.js.map +1 -1
  106. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts +1 -1
  107. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts.map +1 -1
  108. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js +1 -1
  109. package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js.map +1 -1
  110. package/dist/src/_internal/platform/networking/common/anthropic.d.ts +0 -16
  111. package/dist/src/_internal/platform/networking/common/anthropic.d.ts.map +1 -1
  112. package/dist/src/_internal/platform/networking/common/anthropic.js +10 -42
  113. package/dist/src/_internal/platform/networking/common/anthropic.js.map +1 -1
  114. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts +1 -0
  115. package/dist/src/_internal/platform/networking/common/fetcherService.d.ts.map +1 -1
  116. package/dist/src/_internal/platform/networking/common/fetcherService.js.map +1 -1
  117. package/dist/src/_internal/platform/networking/common/networking.d.ts +22 -4
  118. package/dist/src/_internal/platform/networking/common/networking.d.ts.map +1 -1
  119. package/dist/src/_internal/platform/networking/common/networking.js.map +1 -1
  120. package/dist/src/_internal/platform/networking/node/chatStream.d.ts +10 -0
  121. package/dist/src/_internal/platform/networking/node/chatStream.d.ts.map +1 -1
  122. package/dist/src/_internal/platform/networking/node/chatStream.js +28 -0
  123. package/dist/src/_internal/platform/networking/node/chatStream.js.map +1 -1
  124. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts +23 -5
  125. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.d.ts.map +1 -1
  126. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js +67 -20
  127. package/dist/src/_internal/platform/networking/node/chatWebSocketManager.js.map +1 -1
  128. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts +15 -1
  129. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.d.ts.map +1 -1
  130. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js +51 -7
  131. package/dist/src/_internal/platform/networking/node/chatWebSocketTelemetry.js.map +1 -1
  132. package/dist/src/_internal/platform/requestLogger/common/requestLogger.d.ts +171 -0
  133. package/dist/src/_internal/platform/requestLogger/common/requestLogger.d.ts.map +1 -0
  134. package/dist/src/_internal/platform/requestLogger/common/requestLogger.js +145 -0
  135. package/dist/src/_internal/platform/requestLogger/common/requestLogger.js.map +1 -0
  136. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts +2 -1
  137. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts.map +1 -1
  138. package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js.map +1 -1
  139. package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts +4 -166
  140. package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts.map +1 -1
  141. package/dist/src/_internal/platform/requestLogger/node/requestLogger.js +3 -139
  142. package/dist/src/_internal/platform/requestLogger/node/requestLogger.js.map +1 -1
  143. package/dist/src/main.d.ts +2 -0
  144. package/dist/src/main.d.ts.map +1 -1
  145. package/dist/src/main.js +48 -6
  146. package/dist/src/main.js.map +1 -1
  147. package/dist/src/package.json +106 -96
  148. package/package.json +71 -71
  149. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.d.ts +0 -182
  150. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.d.ts.map +0 -1
  151. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.js +0 -558
  152. package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.js.map +0 -1
package/package.json CHANGED
@@ -1,73 +1,73 @@
1
1
  {
2
- "name": "@vscode/chat-lib",
3
- "version": "0.43.2026040705",
4
- "description": "Chat and inline editing SDK extracted from VS Code Copilot Chat",
5
- "main": "dist/src/main.js",
6
- "types": "dist/src/main.d.ts",
7
- "author": "Microsoft Corporation",
8
- "repository": {
9
- "type": "git",
10
- "url": "https://github.com/microsoft/vscode-copilot-chat.git"
11
- },
12
- "license": "SEE LICENSE IN LICENSE.txt",
13
- "engines": {
14
- "node": ">=22.14.0"
15
- },
16
- "dependencies": {
17
- "@microsoft/tiktokenizer": "^1.0.10",
18
- "@sinclair/typebox": "^0.34.41",
19
- "@vscode/copilot-api": "^0.2.19",
20
- "@vscode/l10n": "^0.0.18",
21
- "@vscode/prompt-tsx": "^0.4.0-alpha.8",
22
- "@vscode/tree-sitter-wasm": "0.0.5-php.2",
23
- "applicationinsights": "^2.9.7",
24
- "jsonc-parser": "^3.3.1",
25
- "monaco-editor": "0.44.0",
26
- "openai": "^6.7.0",
27
- "undici": "^7.24.1",
28
- "vscode-languageserver-protocol": "^3.17.5",
29
- "vscode-languageserver-textdocument": "^1.0.12",
30
- "web-tree-sitter": "^0.23.0",
31
- "yaml": "^2.8.0"
32
- },
33
- "devDependencies": {
34
- "@anthropic-ai/sdk": "^0.82.0",
35
- "@octokit/types": "^14.1.0",
36
- "@types/node": "^22.16.3",
37
- "@types/vscode": "^1.109.0",
38
- "copyfiles": "^2.4.1",
39
- "dotenv": "^17.2.0",
40
- "npm-run-all": "^4.1.5",
41
- "outdent": "^0.8.0",
42
- "rimraf": "^6.0.1",
43
- "tsx": "^4.20.3",
44
- "typescript": "^5.8.3",
45
- "vitest": "^3.0.5"
46
- },
47
- "keywords": [
48
- "chat",
49
- "ai",
50
- "sdk",
51
- "vscode",
52
- "copilot"
53
- ],
54
- "files": [
55
- "dist/src",
56
- "README.md",
57
- "LICENSE.txt",
58
- "!**/test/**",
59
- "dist/src/_internal/util/common/test/shims",
60
- "script"
61
- ],
62
- "scripts": {
63
- "clean": "rimraf dist",
64
- "build": "npm-run-all compile copy",
65
- "compile": "tsc",
66
- "copy": "copyfiles src/package.json \"src/**/*.tiktoken\" dist",
67
- "package": "npm pack",
68
- "postinstall": "tsx script/postinstall.js",
69
- "publish": "npm publish",
70
- "test": "vitest run",
71
- "test:watch": "vitest"
72
- }
2
+ "name": "@vscode/chat-lib",
3
+ "version": "0.44.1",
4
+ "description": "Chat and inline editing SDK extracted from VS Code Copilot Chat",
5
+ "main": "dist/src/main.js",
6
+ "types": "dist/src/main.d.ts",
7
+ "author": "Microsoft Corporation",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/microsoft/vscode-copilot-chat.git"
11
+ },
12
+ "license": "SEE LICENSE IN LICENSE.txt",
13
+ "engines": {
14
+ "node": ">=22.14.0"
15
+ },
16
+ "dependencies": {
17
+ "@microsoft/tiktokenizer": "^1.0.10",
18
+ "@sinclair/typebox": "^0.34.41",
19
+ "@vscode/copilot-api": "^0.2.19",
20
+ "@vscode/l10n": "^0.0.18",
21
+ "@vscode/prompt-tsx": "^0.4.0-alpha.8",
22
+ "@vscode/tree-sitter-wasm": "0.0.5-php.2",
23
+ "applicationinsights": "^2.9.7",
24
+ "jsonc-parser": "^3.3.1",
25
+ "monaco-editor": "0.44.0",
26
+ "openai": "^6.7.0",
27
+ "undici": "^7.24.1",
28
+ "vscode-languageserver-protocol": "^3.17.5",
29
+ "vscode-languageserver-textdocument": "^1.0.12",
30
+ "web-tree-sitter": "^0.23.0",
31
+ "yaml": "^2.8.0"
32
+ },
33
+ "devDependencies": {
34
+ "@anthropic-ai/sdk": "^0.82.0",
35
+ "@octokit/types": "^14.1.0",
36
+ "@types/node": "^22.16.3",
37
+ "@types/vscode": "^1.109.0",
38
+ "copyfiles": "^2.4.1",
39
+ "dotenv": "^17.2.0",
40
+ "npm-run-all": "^4.1.5",
41
+ "outdent": "^0.8.0",
42
+ "rimraf": "^6.0.1",
43
+ "tsx": "^4.20.3",
44
+ "typescript": "^5.8.3",
45
+ "vitest": "^3.0.5"
46
+ },
47
+ "keywords": [
48
+ "chat",
49
+ "ai",
50
+ "sdk",
51
+ "vscode",
52
+ "copilot"
53
+ ],
54
+ "files": [
55
+ "dist/src",
56
+ "README.md",
57
+ "LICENSE.txt",
58
+ "!**/test/**",
59
+ "dist/src/_internal/util/common/test/shims",
60
+ "script"
61
+ ],
62
+ "scripts": {
63
+ "clean": "rimraf dist",
64
+ "build": "npm-run-all compile copy",
65
+ "compile": "tsc",
66
+ "copy": "copyfiles src/package.json \"src/**/*.tiktoken\" dist",
67
+ "package": "npm pack",
68
+ "postinstall": "tsx script/postinstall.js",
69
+ "publish": "npm publish",
70
+ "test": "vitest run",
71
+ "test:watch": "vitest"
72
+ }
73
73
  }
@@ -1,182 +0,0 @@
1
- import { CopilotAnnotation, CopilotAnnotations, CopilotNamedAnnotationList } from '../../../../../../platform/completions-core/common/openai/copilotAnnotations';
2
- import { RequestId } from '../../../../../../platform/networking/common/fetch';
3
- import { ServicesAccessor } from '../../../../../../util/vs/platform/instantiation/common/instantiation';
4
- import { CancellationToken as ICancellationToken } from '../../../types/src';
5
- import { Response } from '../networking';
6
- import { TelemetryWithExp } from '../telemetry';
7
- import { CopilotReference } from './fetch';
8
- import { APIChoice, APILogprobs, FinishedCallback } from './openai';
9
- /** Gathers together many chunks of a single completion choice. */
10
- declare class APIJsonDataStreaming {
11
- logprobs: number[][];
12
- top_logprobs: {
13
- [key: string]: number;
14
- }[][];
15
- text: string[];
16
- tokens: string[][];
17
- text_offset: number[][];
18
- copilot_annotations: CopilotAnnotations;
19
- tool_calls: StreamingToolCalls;
20
- function_call: StreamingFunctionCall;
21
- copilot_references: CopilotReference[];
22
- finish_reason?: string;
23
- yielded: boolean;
24
- append(choice: ChoiceJSON): void;
25
- }
26
- export declare function splitChunk(chunk: string): [string[], string];
27
- type ModelUsage = {
28
- completion_tokens: number;
29
- prompt_tokens: number;
30
- total_tokens: number;
31
- };
32
- /**
33
- * A single finished completion returned from the model or proxy, along with
34
- * some metadata.
35
- */
36
- export interface FinishedCompletion {
37
- solution: APIJsonDataStreaming;
38
- /** An optional offset into `solution.text.join('')` where the completion finishes. */
39
- finishOffset: number | undefined;
40
- /** A copilot-specific human-readable reason for the completion finishing. */
41
- reason: string | null;
42
- requestId: RequestId;
43
- index: number;
44
- model?: string;
45
- usage?: ModelUsage;
46
- }
47
- declare class StreamingToolCall {
48
- name?: string;
49
- arguments: string[];
50
- id?: string;
51
- update(toolCall: {
52
- type: 'function';
53
- id?: string;
54
- function: {
55
- name?: string;
56
- arguments: string;
57
- };
58
- }): void;
59
- }
60
- declare class StreamingToolCalls {
61
- private toolCalls;
62
- constructor();
63
- update(toolCallsArray: {
64
- type: 'function';
65
- id?: string;
66
- index?: number;
67
- function: {
68
- name?: string;
69
- arguments: string;
70
- };
71
- }[]): void;
72
- getToolCalls(): StreamingToolCall[];
73
- }
74
- declare class StreamingFunctionCall {
75
- name?: string;
76
- arguments: string[];
77
- update(functionCall: {
78
- name?: string;
79
- arguments: string;
80
- }): void;
81
- }
82
- interface FunctionCallJSON {
83
- name?: string;
84
- arguments: string;
85
- }
86
- interface ToolCallJSON {
87
- id: string;
88
- function: FunctionCallJSON;
89
- index: number;
90
- type: 'function';
91
- }
92
- /** What comes back from the OpenAI API for a single choice in an SSE chunk. */
93
- interface ChoiceJSON {
94
- index: number;
95
- /**
96
- * The text attribute as defined in completions streaming.
97
- * See https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#event_stream_format
98
- */
99
- text: string;
100
- copilot_annotations: {
101
- [key: string]: CopilotAnnotation[];
102
- };
103
- /**
104
- * The delta attribute as defined in chat streaming.
105
- * See https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb
106
- */
107
- delta: {
108
- content: string;
109
- copilot_annotations?: {
110
- [key: string]: CopilotAnnotation[];
111
- };
112
- role?: string;
113
- function_call?: FunctionCallJSON;
114
- tool_calls?: ToolCallJSON[];
115
- };
116
- finish_reason: string | null;
117
- logprobs?: APILogprobs;
118
- copilot_annotation?: CopilotNamedAnnotationList;
119
- copilot_references?: CopilotReference[];
120
- }
121
- /**
122
- * Processes an HTTP request containing what is assumed to be an SSE stream of
123
- * OpenAI API data. Yields a stream of `FinishedCompletion` objects, each as
124
- * soon as it's finished.
125
- */
126
- export declare class SSEProcessor {
127
- private readonly expectedNumChoices;
128
- private readonly response;
129
- private readonly body;
130
- private readonly telemetryData;
131
- private readonly dropCompletionReasons;
132
- private readonly cancellationToken;
133
- private readonly instantiationService;
134
- private readonly logTarget;
135
- private requestId;
136
- private stats;
137
- /**
138
- * A key & value being here means at least one chunk with that choice index
139
- * has been received. A null value means we've already finished the given
140
- * solution and should not process incoming tokens further.
141
- */
142
- private readonly solutions;
143
- private constructor();
144
- /**
145
- * Creates a new instance of SSEProcessor.
146
- *
147
- * Supports dropping completions with specific finish reasons.
148
- * Historically, this was used to drop RAI ('content_filter') completions, instead of showing partially finished completions to the user. We've gone back and forth on this.
149
- */
150
- static create(accessor: ServicesAccessor, expectedNumChoices: number, response: Response, telemetryData: TelemetryWithExp, dropCompletionReasons?: string[], cancellationToken?: ICancellationToken): Promise<SSEProcessor>;
151
- /**
152
- * Yields finished completions as soon as they are available. The finishedCb
153
- * is used to determine when a completion is done and should be truncated.
154
- * It is called on the whole of the received solution text, once at the end
155
- * of the completion (if it stops by itself) and also on any chunk that has
156
- * a newline in it.
157
- *
158
- * Closes the server request stream when all choices are finished/truncated.
159
- *
160
- * Note that for this to work, the caller must consume the entire stream.
161
- * This happens automatically when using a `for await` loop, but when
162
- * iterating manually this needs to be done by calling `.next()` until it
163
- * returns an item with done = true (or calling `.return()`).
164
- */
165
- processSSE(finishedCb?: FinishedCallback): AsyncIterable<FinishedCompletion>;
166
- private processSSEInner;
167
- private asSolutionDecision;
168
- /** Yields the solutions that weren't yet finished, with a 'DONE' reason. */
169
- private finishSolutions;
170
- /**
171
- * Returns whether the cancellation token was cancelled and closes the
172
- * stream if it was.
173
- */
174
- private maybeCancel;
175
- /** Cancels the network request to the proxy. */
176
- private cancel;
177
- /** Returns whether we've finished receiving all expected solutions. */
178
- private allSolutionsDone;
179
- }
180
- export declare function prepareSolutionForReturn(accessor: ServicesAccessor, c: FinishedCompletion, telemetryData: TelemetryWithExp): APIChoice;
181
- export {};
182
- //# sourceMappingURL=stream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,0BAA0B,EAA4B,MAAM,8EAA8E,CAAC;AAC3L,OAAO,EAAgB,SAAS,EAAE,MAAM,oDAAoD,CAAC;AAE7F,OAAO,EAAyB,gBAAgB,EAAE,MAAM,uEAAuE,CAAC;AAChI,OAAO,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAqC,gBAAgB,EAAoB,MAAM,SAAS,CAAC;AAChG,OAAO,EACN,SAAS,EAET,WAAW,EAEX,gBAAgB,EAChB,MAAM,UAAU,CAAC;AAIlB,kEAAkE;AAClE,cAAM,oBAAoB;IACzB,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAM;IAC1B,YAAY,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,EAAE,EAAE,CAAM;IACjD,IAAI,EAAE,MAA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