@vscode/chat-lib 0.2.1-26 → 0.2.1-28
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.
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.js +0 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/copilotCompletion.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.d.ts +71 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js +254 -229
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/ghostText.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.d.ts +2 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.js +5 -5
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/last.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/streamedCompletionSplitter.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/streamedCompletionSplitter.js +0 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/streamedCompletionSplitter.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.d.ts +2 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.js +4 -3
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/telemetry.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/networking.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.d.ts +25 -7
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.js +316 -23
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/fetch.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.d.ts +5 -9
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.js +0 -3
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/openai.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.d.ts +3 -27
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.js +16 -61
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/openai/stream.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.js +0 -4
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/postInsertion.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.d.ts +2 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.js +12 -7
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/completionsPromptFactory/componentsCompletionsPromptFactory.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.d.ts +10 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.js +92 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/diagnostics.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/splitContextPrompt.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/splitContextPrompt.js +2 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/components/splitContextPrompt.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.d.ts +6 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.js +106 -43
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/contextItemSchemas.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.d.ts +5 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.d.ts.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.js +59 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/prompt/contextProviders/diagnostics.js.map +1 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/anomalyDetection.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/anomalyDetection.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/suggestions/anomalyDetection.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry.d.ts +2 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.d.ts +10 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.js +8 -0
- package/dist/src/_internal/extension/completions-core/vscode-node/types/src/contextProviderApiV1.js.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.d.ts.map +1 -1
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js +3 -4
- package/dist/src/_internal/extension/prompt/node/chatMLFetcher.js.map +1 -1
- package/dist/src/_internal/platform/chat/common/chatMLFetcher.js +1 -1
- package/dist/src/_internal/platform/chat/common/chatMLFetcher.js.map +1 -1
- package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.d.ts +27 -0
- package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.d.ts.map +1 -0
- package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.js +35 -0
- package/dist/src/_internal/platform/completions-core/common/openai/copilotAnnotations.js.map +1 -0
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +34 -25
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.js +17 -7
- package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +4 -8
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +5 -0
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts +11 -2
- package/dist/src/_internal/platform/endpoint/node/messagesApi.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/messagesApi.js +116 -10
- package/dist/src/_internal/platform/endpoint/node/messagesApi.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts +2 -0
- package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/responsesApi.js +23 -5
- package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -1
- package/dist/src/_internal/platform/inlineCompletions/common/api.d.ts +5 -1
- package/dist/src/_internal/platform/inlineCompletions/common/api.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.d.ts +7 -1
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.js +18 -2
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/languageContext.js.map +1 -1
- package/dist/src/_internal/platform/languageServer/common/languageContextService.d.ts +27 -2
- package/dist/src/_internal/platform/languageServer/common/languageContextService.d.ts.map +1 -1
- package/dist/src/_internal/platform/languageServer/common/languageContextService.js +1 -0
- package/dist/src/_internal/platform/languageServer/common/languageContextService.js.map +1 -1
- package/dist/src/_internal/platform/nesFetch/common/completionsAPI.d.ts +74 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsAPI.d.ts.map +1 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsAPI.js +23 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsAPI.js.map +1 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.d.ts +72 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.d.ts.map +1 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.js +44 -0
- package/dist/src/_internal/platform/nesFetch/common/completionsFetchService.js.map +1 -0
- package/dist/src/_internal/platform/nesFetch/common/responseStream.d.ts +35 -0
- package/dist/src/_internal/platform/nesFetch/common/responseStream.d.ts.map +1 -0
- package/dist/src/_internal/platform/nesFetch/common/responseStream.js +162 -0
- package/dist/src/_internal/platform/nesFetch/common/responseStream.js.map +1 -0
- package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts +29 -0
- package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.d.ts.map +1 -0
- package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js +171 -0
- package/dist/src/_internal/platform/nesFetch/node/completionsFetchServiceImpl.js.map +1 -0
- package/dist/src/_internal/platform/nesFetch/node/streamTransformer.d.ts +10 -0
- package/dist/src/_internal/platform/nesFetch/node/streamTransformer.d.ts.map +1 -0
- package/dist/src/_internal/platform/nesFetch/node/streamTransformer.js +86 -0
- package/dist/src/_internal/platform/nesFetch/node/streamTransformer.js.map +1 -0
- package/dist/src/_internal/platform/networking/common/anthropic.d.ts +42 -1
- package/dist/src/_internal/platform/networking/common/anthropic.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/anthropic.js +28 -0
- package/dist/src/_internal/platform/networking/common/anthropic.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetch.d.ts +15 -2
- package/dist/src/_internal/platform/networking/common/fetch.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetch.js +5 -5
- package/dist/src/_internal/platform/networking/common/fetch.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetcherService.d.ts +33 -6
- package/dist/src/_internal/platform/networking/common/fetcherService.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/fetcherService.js +85 -11
- package/dist/src/_internal/platform/networking/common/fetcherService.js.map +1 -1
- package/dist/src/_internal/platform/networking/node/stream.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/node/stream.js +50 -23
- package/dist/src/_internal/platform/networking/node/stream.js.map +1 -1
- package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts +1 -0
- package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.d.ts.map +1 -1
- package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js +2 -0
- package/dist/src/_internal/platform/requestLogger/node/nullRequestLogger.js.map +1 -1
- package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts +2 -0
- package/dist/src/_internal/platform/requestLogger/node/requestLogger.d.ts.map +1 -1
- package/dist/src/_internal/platform/requestLogger/node/requestLogger.js.map +1 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts +7 -7
- package/dist/src/_internal/util/common/test/shims/chatTypes.d.ts.map +1 -1
- package/dist/src/_internal/util/common/test/shims/chatTypes.js +11 -11
- package/dist/src/_internal/util/common/test/shims/chatTypes.js.map +1 -1
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js +3 -3
- package/dist/src/_internal/util/common/test/shims/vscodeTypesShim.js.map +1 -1
- package/dist/src/_internal/vscodeTypes.d.ts +1 -1
- package/dist/src/_internal/vscodeTypes.d.ts.map +1 -1
- package/dist/src/_internal/vscodeTypes.js +3 -3
- package/dist/src/_internal/vscodeTypes.js.map +1 -1
- package/dist/src/main.d.ts.map +1 -1
- package/dist/src/main.js +3 -0
- package/dist/src/main.js.map +1 -1
- package/dist/src/package.json +313 -210
- package/package.json +1 -1
|
@@ -3,16 +3,57 @@ import { IExperimentationService } from '../../telemetry/common/nullExperimentat
|
|
|
3
3
|
/**
|
|
4
4
|
* Types for Anthropic Messages API
|
|
5
5
|
* Based on https://platform.claude.com/docs/en/api/messages
|
|
6
|
+
*
|
|
7
|
+
* This interface supports both regular tools and server tools (web search, tool search):
|
|
8
|
+
* - Regular tools: require name, description, and input_schema
|
|
9
|
+
* - Tool search tools: require only type and name
|
|
6
10
|
*/
|
|
7
11
|
export interface AnthropicMessagesTool {
|
|
8
12
|
name: string;
|
|
13
|
+
type?: string;
|
|
9
14
|
description?: string;
|
|
10
|
-
input_schema
|
|
15
|
+
input_schema?: {
|
|
11
16
|
type: 'object';
|
|
12
17
|
properties?: Record<string, unknown>;
|
|
13
18
|
required?: string[];
|
|
14
19
|
};
|
|
20
|
+
defer_loading?: boolean;
|
|
15
21
|
}
|
|
22
|
+
export interface ToolReference {
|
|
23
|
+
type: 'tool_reference';
|
|
24
|
+
tool_name: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ToolSearchToolSearchResult {
|
|
27
|
+
type: 'tool_search_tool_search_result';
|
|
28
|
+
tool_references: ToolReference[];
|
|
29
|
+
}
|
|
30
|
+
export interface ToolSearchToolResultError {
|
|
31
|
+
type: 'tool_search_tool_result_error';
|
|
32
|
+
error_code: 'too_many_requests' | 'invalid_pattern' | 'pattern_too_long' | 'unavailable';
|
|
33
|
+
}
|
|
34
|
+
export interface ServerToolUse {
|
|
35
|
+
type: 'server_tool_use';
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
input: {
|
|
39
|
+
query: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface ToolSearchToolResult {
|
|
43
|
+
type: 'tool_search_tool_result';
|
|
44
|
+
tool_use_id: string;
|
|
45
|
+
content: ToolSearchToolSearchResult | ToolSearchToolResultError;
|
|
46
|
+
}
|
|
47
|
+
export interface ToolSearchUsage {
|
|
48
|
+
tool_search_requests: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Tools that should not use deferred loading when tool search is enabled.
|
|
52
|
+
* These are frequently used tools that benefit from being immediately available.
|
|
53
|
+
*
|
|
54
|
+
* TODO: @bhavyaus Replace these hardcoded strings with constants from ToolName enum
|
|
55
|
+
*/
|
|
56
|
+
export declare const nonDeferredToolNames: Set<string>;
|
|
16
57
|
/**
|
|
17
58
|
* Context management types for Anthropic Messages API
|
|
18
59
|
* Based on https://platform.claude.com/docs/en/build-with-claude/context-editing
|
|
@@ -1 +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;AAE5F
|
|
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;AAE5F;;;;;;;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,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,0BAA0B;IAC1C,IAAI,EAAE,gCAAgC,CAAC;IACvC,eAAe,EAAE,aAAa,EAAE,CAAC;C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EAC3C,sBAAsB,EAAE,uBAAuB,EAC/C,cAAc,EAAE,MAAM,GAAG,SAAS,EAClC,mBAAmB,EAAE,MAAM,GACzB,iBAAiB,GAAG,SAAS,CAiB/B"}
|
|
@@ -4,10 +4,38 @@
|
|
|
4
4
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.nonDeferredToolNames = void 0;
|
|
7
8
|
exports.isAnthropicContextEditingEnabled = isAnthropicContextEditingEnabled;
|
|
8
9
|
exports.buildContextManagement = buildContextManagement;
|
|
9
10
|
exports.getContextManagementFromConfig = getContextManagementFromConfig;
|
|
10
11
|
const configurationService_1 = require("../../configuration/common/configurationService");
|
|
12
|
+
/**
|
|
13
|
+
* Tools that should not use deferred loading when tool search is enabled.
|
|
14
|
+
* These are frequently used tools that benefit from being immediately available.
|
|
15
|
+
*
|
|
16
|
+
* TODO: @bhavyaus Replace these hardcoded strings with constants from ToolName enum
|
|
17
|
+
*/
|
|
18
|
+
exports.nonDeferredToolNames = new Set([
|
|
19
|
+
// Read/navigate
|
|
20
|
+
'read_file',
|
|
21
|
+
'list_dir',
|
|
22
|
+
// Search
|
|
23
|
+
'grep_search',
|
|
24
|
+
'semantic_search',
|
|
25
|
+
'file_search',
|
|
26
|
+
// Edit
|
|
27
|
+
'replace_string_in_file',
|
|
28
|
+
'multi_replace_string_in_file',
|
|
29
|
+
'insert_edit_into_file',
|
|
30
|
+
'apply_patch',
|
|
31
|
+
'create_file',
|
|
32
|
+
// Terminal
|
|
33
|
+
'run_in_terminal',
|
|
34
|
+
'get_terminal_output',
|
|
35
|
+
// Other high-usage tools
|
|
36
|
+
'get_errors',
|
|
37
|
+
'manage_todo_list',
|
|
38
|
+
]);
|
|
11
39
|
/**
|
|
12
40
|
* Checks if Anthropic context editing is enabled.
|
|
13
41
|
* This requires both the Messages API to be enabled and context editing to be enabled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/anthropic.ts"],"names":[],"mappings":";AAAA;;;gGAGgG
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/anthropic.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA+IhG,4EAOC;AAmBD,wDAiCC;AAWD,wEAsBC;AAzOD,0FAAmG;AAyDnG;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,IAAI,GAAG,CAAC;IAC3C,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,SAAS;IACT,aAAa;IACb,iBAAiB;IACjB,aAAa;IACb,OAAO;IACP,wBAAwB;IACxB,8BAA8B;IAC9B,uBAAuB;IACvB,aAAa;IACb,aAAa;IACb,WAAW;IACX,iBAAiB;IACjB,qBAAqB;IACrB,yBAAyB;IACzB,YAAY;IACZ,kBAAkB;CAClB,CAAC,CAAC;AAmDH;;;;;;GAMG;AACH,SAAgB,gCAAgC,CAC/C,oBAA2C,EAC3C,sBAA+C;IAE/C,MAAM,cAAc,GAAG,oBAAoB,CAAC,wBAAwB,CAAC,gCAAS,CAAC,uBAAuB,EAAE,sBAAsB,CAAC,CAAC;IAChI,MAAM,qBAAqB,GAAG,oBAAoB,CAAC,SAAS,CAAC,gCAAS,CAAC,8BAA8B,CAAC,CAAC;IACvG,OAAO,CAAC,CAAC,CAAC,cAAc,IAAI,qBAAqB,CAAC,CAAC;AACpD,CAAC;AAYD;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACrC,MAA4B,EAC5B,WAA+B,EAC/B,cAAsB;IAEtB,MAAM,KAAK,GAA4B,EAAE,CAAC;IAE1C,8DAA8D;IAC9D,IAAI,WAAW,EAAE,CAAC;QACjB,MAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,KAAK,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,yB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SAAS,CAAC,gCAAS,CAAC,8BAA8B,CAAC,CAAC;IACvG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,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,6 +1,6 @@
|
|
|
1
1
|
import { EncryptedThinkingDelta, ThinkingData, ThinkingDelta } from '../../thinking/common/thinking';
|
|
2
2
|
import { AnthropicMessagesTool, ContextManagementResponse } from './anthropic';
|
|
3
|
-
import {
|
|
3
|
+
import { IHeaders } from './fetcherService';
|
|
4
4
|
import { ChoiceLogProbs, FilterReason } from './openai';
|
|
5
5
|
export interface RequestId {
|
|
6
6
|
headerRequestId: string;
|
|
@@ -10,7 +10,7 @@ export interface RequestId {
|
|
|
10
10
|
serverExperiments: string;
|
|
11
11
|
deploymentId: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function getRequestId(
|
|
13
|
+
export declare function getRequestId(headers: IHeaders, json?: any): RequestId;
|
|
14
14
|
export interface ICodeVulnerabilityAnnotation {
|
|
15
15
|
details: {
|
|
16
16
|
type: string;
|
|
@@ -41,8 +41,18 @@ export interface ICopilotToolCall {
|
|
|
41
41
|
arguments: string;
|
|
42
42
|
id: string;
|
|
43
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
|
+
}
|
|
44
53
|
export interface ICopilotBeginToolCall {
|
|
45
54
|
name: string;
|
|
55
|
+
id?: string;
|
|
46
56
|
}
|
|
47
57
|
/**
|
|
48
58
|
* @deprecated
|
|
@@ -77,6 +87,7 @@ export interface IResponseDelta {
|
|
|
77
87
|
copilotReferences?: ICopilotReference[];
|
|
78
88
|
copilotErrors?: ICopilotError[];
|
|
79
89
|
copilotToolCalls?: ICopilotToolCall[];
|
|
90
|
+
copilotToolCallStreamUpdates?: ICopilotToolCallStreamUpdate[];
|
|
80
91
|
beginToolCalls?: ICopilotBeginToolCall[];
|
|
81
92
|
_deprecatedCopilotFunctionCalls?: ICopilotFunctionCall[];
|
|
82
93
|
copilotConfirmation?: ICopilotConfirmation;
|
|
@@ -86,6 +97,8 @@ export interface IResponseDelta {
|
|
|
86
97
|
statefulMarker?: string;
|
|
87
98
|
/** Context management information from Anthropic Messages API */
|
|
88
99
|
contextManagement?: ContextManagementResponse;
|
|
100
|
+
/** Server-side tool calls (e.g., tool_search) - reported for logging but not validated/executed */
|
|
101
|
+
serverToolCalls?: IServerToolCall[];
|
|
89
102
|
}
|
|
90
103
|
export declare const enum ResponsePartKind {
|
|
91
104
|
ContentDelta = 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":"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AAC;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(
|
|
12
|
+
function getRequestId(headers, json) {
|
|
13
13
|
return {
|
|
14
|
-
headerRequestId:
|
|
15
|
-
gitHubRequestId:
|
|
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:
|
|
19
|
-
deploymentId:
|
|
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;;AAmBhG,oCASC;AAmBD,kDAQC;AAED,4DAQC;
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetch.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAmBhG,oCASC;AAmBD,kDAQC;AAED,4DAQC;AAmDD,sDAEC;AAmKD,oDAEC;AAxQD,SAAg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KAAwB,CAAC;IAC/C,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,IAAI;QACzD,KAAK,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,SAAS,CAAC,GAAG,KAAK,QAAQ,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,13 @@ 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
|
-
|
|
21
|
+
readonly body: DestroyableStream<Uint8Array>;
|
|
22
|
+
constructor(status: number, statusText: string, headers: IHeaders, body: ReadableStream<Uint8Array> | null, fetcher: FetcherId);
|
|
23
|
+
static fromText(status: number, statusText: string, headers: IHeaders, body: string, fetcher: FetcherId): Response;
|
|
25
24
|
text(): Promise<string>;
|
|
26
25
|
json(): Promise<any>;
|
|
27
|
-
/** Async version of the standard .body field. */
|
|
28
|
-
body(): Promise<unknown | null>;
|
|
29
26
|
}
|
|
30
27
|
export type FetcherId = 'electron-fetch' | 'node-fetch' | 'node-http' | 'test-stub' | 'helix-fetch';
|
|
31
28
|
/** These are the options we currently use, for ease of reference. */
|
|
@@ -65,5 +62,35 @@ export interface IAbortController {
|
|
|
65
62
|
export interface IHeaders extends Iterable<[string, string]> {
|
|
66
63
|
get(name: string): string | null;
|
|
67
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Wraps a ReadableStream to allow cancellation even while a `for await` loop
|
|
67
|
+
* holds the stream locked. Use `destroy()` to safely cancel from an external
|
|
68
|
+
* callback (e.g., `onReturn`) - it cancels through the reader if locked.
|
|
69
|
+
*
|
|
70
|
+
* When `pipeThrough()` is called, destroy() will forward to the piped stream.
|
|
71
|
+
*/
|
|
72
|
+
export declare class DestroyableStream<T> implements AsyncIterable<T> {
|
|
73
|
+
private readonly stream;
|
|
74
|
+
private reader;
|
|
75
|
+
private pipedHead;
|
|
76
|
+
constructor(stream: ReadableStream<T>);
|
|
77
|
+
/**
|
|
78
|
+
* Returns the underlying ReadableStream for APIs that require it
|
|
79
|
+
* (e.g., Readable.fromWeb). Use with caution as operations on the
|
|
80
|
+
* returned stream bypass the DestroyableStream's reader tracking.
|
|
81
|
+
*/
|
|
82
|
+
toReadableStream(): ReadableStream<T>;
|
|
83
|
+
/**
|
|
84
|
+
* Pipes this stream through a transform stream.
|
|
85
|
+
* Returns a new DestroyableStream wrapping the transformed stream.
|
|
86
|
+
* Calling destroy() on this stream will forward to the piped stream.
|
|
87
|
+
*/
|
|
88
|
+
pipeThrough<U>(transform: {
|
|
89
|
+
readable: ReadableStream<U>;
|
|
90
|
+
writable: WritableStream<T>;
|
|
91
|
+
}): DestroyableStream<U>;
|
|
92
|
+
[Symbol.asyncIterator](): AsyncGenerator<T, void, undefined>;
|
|
93
|
+
destroy(): Promise<void>;
|
|
94
|
+
}
|
|
68
95
|
export declare function jsonVerboseError(resp: Response): Promise<any>;
|
|
69
96
|
//# sourceMappingURL=fetcherService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcherService.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetcherService.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,4EAA8D,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,mBAAmB,IAAI,MAAM,CAAC;IAC9B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,mBAAmB,IAAI,gBAAgB,CAAC;IACxC,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IAC9B,2BAA2B,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IAC7C,cAAc,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IAChC,6BAA6B,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;IAChD,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;CACrF;AAED,kFAAkF;AAClF,qBAAa,QAAQ;
|
|
1
|
+
{"version":3,"file":"fetcherService.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetcherService.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,4EAA8D,CAAC;AAE3F,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,mBAAmB,IAAI,MAAM,CAAC;IAC9B,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7D,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAClC,mBAAmB,IAAI,gBAAgB,CAAC;IACxC,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IAC9B,2BAA2B,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;IAC7C,cAAc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AAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,OAAO,CAAC,MAAM,CAA6C;IAC3D,OAAO,CAAC,SAAS,CAAyC;gBAE7B,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IAEtD;;;;OAIG;IACH,gBAAgB,IAAI,cAAc,CAAC,CAAC,CAAC;IAIrC;;;;OAIG;IACH,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE;QAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAMtG,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;IAgBnE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAaxB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,gBAUpD"}
|
|
@@ -4,34 +4,108 @@
|
|
|
4
4
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.Response = exports.IFetcherService = void 0;
|
|
7
|
+
exports.DestroyableStream = exports.Response = exports.IFetcherService = void 0;
|
|
8
8
|
exports.jsonVerboseError = jsonVerboseError;
|
|
9
9
|
const services_1 = require("../../../util/common/services");
|
|
10
10
|
exports.IFetcherService = (0, services_1.createServiceIdentifier)('IFetcherService');
|
|
11
11
|
/** A basic version of http://developer.mozilla.org/en-US/docs/Web/API/Response */
|
|
12
12
|
class Response {
|
|
13
|
-
constructor(status, statusText, headers,
|
|
13
|
+
constructor(status, statusText, headers, body, fetcher) {
|
|
14
14
|
this.status = status;
|
|
15
15
|
this.statusText = statusText;
|
|
16
16
|
this.headers = headers;
|
|
17
|
-
this.getText = getText;
|
|
18
|
-
this.getJson = getJson;
|
|
19
|
-
this.getBody = getBody;
|
|
20
17
|
this.fetcher = fetcher;
|
|
21
18
|
this.ok = this.status >= 200 && this.status < 300;
|
|
19
|
+
this.body = new DestroyableStream(body ?? new ReadableStream({ start(c) { c.close(); } }));
|
|
20
|
+
}
|
|
21
|
+
static fromText(status, statusText, headers, body, fetcher) {
|
|
22
|
+
return new Response(status, statusText, headers, new ReadableStream({
|
|
23
|
+
start(controller) {
|
|
24
|
+
controller.enqueue(new TextEncoder().encode(body));
|
|
25
|
+
controller.close();
|
|
26
|
+
}
|
|
27
|
+
}), fetcher);
|
|
22
28
|
}
|
|
23
29
|
async text() {
|
|
24
|
-
|
|
30
|
+
const chunks = [];
|
|
31
|
+
for await (const chunk of this.body) {
|
|
32
|
+
chunks.push(chunk);
|
|
33
|
+
}
|
|
34
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
35
|
+
const result = new Uint8Array(totalLength);
|
|
36
|
+
let offset = 0;
|
|
37
|
+
for (const chunk of chunks) {
|
|
38
|
+
result.set(chunk, offset);
|
|
39
|
+
offset += chunk.length;
|
|
40
|
+
}
|
|
41
|
+
return new TextDecoder().decode(result);
|
|
25
42
|
}
|
|
26
43
|
async json() {
|
|
27
|
-
return this.
|
|
28
|
-
}
|
|
29
|
-
/** Async version of the standard .body field. */
|
|
30
|
-
async body() {
|
|
31
|
-
return this.getBody();
|
|
44
|
+
return JSON.parse(await this.text());
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
exports.Response = Response;
|
|
48
|
+
/**
|
|
49
|
+
* Wraps a ReadableStream to allow cancellation even while a `for await` loop
|
|
50
|
+
* holds the stream locked. Use `destroy()` to safely cancel from an external
|
|
51
|
+
* callback (e.g., `onReturn`) - it cancels through the reader if locked.
|
|
52
|
+
*
|
|
53
|
+
* When `pipeThrough()` is called, destroy() will forward to the piped stream.
|
|
54
|
+
*/
|
|
55
|
+
class DestroyableStream {
|
|
56
|
+
constructor(stream) {
|
|
57
|
+
this.stream = stream;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns the underlying ReadableStream for APIs that require it
|
|
61
|
+
* (e.g., Readable.fromWeb). Use with caution as operations on the
|
|
62
|
+
* returned stream bypass the DestroyableStream's reader tracking.
|
|
63
|
+
*/
|
|
64
|
+
toReadableStream() {
|
|
65
|
+
return this.stream;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Pipes this stream through a transform stream.
|
|
69
|
+
* Returns a new DestroyableStream wrapping the transformed stream.
|
|
70
|
+
* Calling destroy() on this stream will forward to the piped stream.
|
|
71
|
+
*/
|
|
72
|
+
pipeThrough(transform) {
|
|
73
|
+
const piped = new DestroyableStream(this.stream.pipeThrough(transform));
|
|
74
|
+
this.pipedHead = piped;
|
|
75
|
+
return piped;
|
|
76
|
+
}
|
|
77
|
+
async *[Symbol.asyncIterator]() {
|
|
78
|
+
this.reader = this.stream.getReader();
|
|
79
|
+
try {
|
|
80
|
+
while (true) {
|
|
81
|
+
const { done, value } = await this.reader.read();
|
|
82
|
+
if (done) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
yield value;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
this.reader.releaseLock();
|
|
90
|
+
this.reader = undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
destroy() {
|
|
94
|
+
// Forward to piped stream if pipeThrough was called
|
|
95
|
+
if (this.pipedHead) {
|
|
96
|
+
return this.pipedHead.destroy();
|
|
97
|
+
}
|
|
98
|
+
if (this.reader) {
|
|
99
|
+
// Cancels the underlying stream and releases the lock
|
|
100
|
+
return this.reader.cancel();
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
// If stream was consumed and unlocked, cancel() is a no-op
|
|
104
|
+
return this.stream.cancel();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.DestroyableStream = DestroyableStream;
|
|
35
109
|
async function jsonVerboseError(resp) {
|
|
36
110
|
const text = await resp.text();
|
|
37
111
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcherService.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetcherService.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;
|
|
1
|
+
{"version":3,"file":"fetcherService.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/fetcherService.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA+KhG,4CAUC;AAvLD,4DAAwE;AAE3D,QAAA,eAAe,GAAG,IAAA,kCAAuB,EAAkB,iBAAiB,CAAC,CAAC;AAe3F,kFAAkF;AAClF,MAAa,QAAQ;IAIpB,YACU,MAAc,EACd,UAAkB,EAClB,OAAiB,EAC1B,IAAuC,EAC9B,OAAkB;QAJlB,WAAM,GAAN,MAAM,CAAQ;QACd,eAAU,GAAV,UAAU,CAAQ;QAClB,YAAO,GAAP,OAAO,CAAU;QAEjB,YAAO,GAAP,OAAO,CAAW;QAR5B,OAAE,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;QAU5C,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAiB,CAAC,IAAI,IAAI,IAAI,cAAc,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC;IAED,MAAM,CAAC,QAAQ,CAAC,MAAc,EAAE,UAAkB,EAAE,OAAiB,EAAE,IAAY,EAAE,OAAkB;QACtG,OAAO,IAAI,QAAQ,CAClB,MAAM,EACN,UAAU,EACV,OAAO,EACP,IAAI,cAAc,CAAC;YAClB,KAAK,CAAC,UAAU;gBACf,UAAU,CAAC,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;gBACnD,UAAU,CAAC,KAAK,EAAE,CAAC;Y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AG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1H,GAAG,CAAC,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,eAAe,OAAO,EAAE,CAAC;QACrD,MAAM,GAAG,CAAC;IACX,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/node/stream.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/node/stream.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,WAAW,EAAY,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAiB,MAAM,gCAAgC,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAgB,4BAA4B,EAAuJ,eAAe,EAAiD,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/T,OAAO,EAAqB,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,wBAAwB,EAAc,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE1J,kEAAkE;AAClE,cAAM,oBAAoB;aAEG,KAAK,EAAE,MAAM;gBAAb,KAAK,EAAE,MAAM;IAEzC,IAAI,IAAI,IAAI,SAAS,MAAM,EAAE,CAE5B;IAED,OAAO,CAAC,KAAK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