@vscode/chat-lib 0.62.0 → 0.63.0
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/byok/node/openAIEndpoint.d.ts.map +1 -1
- package/dist/src/_internal/extension/byok/node/openAIEndpoint.js +3 -1
- package/dist/src/_internal/extension/byok/node/openAIEndpoint.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/copilotTokenManager.d.ts +3 -3
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/copilotTokenManager.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/copilotTokenManager.js +19 -9
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/copilotTokenManager.js.map +1 -1
- package/dist/src/_internal/extension/conversation/common/languageModelAccess.d.ts +11 -1
- package/dist/src/_internal/extension/conversation/common/languageModelAccess.d.ts.map +1 -1
- package/dist/src/_internal/extension/conversation/common/languageModelAccess.js +23 -5
- package/dist/src/_internal/extension/conversation/common/languageModelAccess.js.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.d.ts +3 -1
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.d.ts.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.js +6 -3
- package/dist/src/_internal/extension/inlineEdits/common/userInteractionMonitor.js.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.d.ts.map +1 -1
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js +3 -2
- package/dist/src/_internal/extension/inlineEdits/node/nextEditProvider.js.map +1 -1
- package/dist/src/_internal/extension/xtab/common/promptCrafting.d.ts.map +1 -1
- package/dist/src/_internal/extension/xtab/common/promptCrafting.js +11 -5
- package/dist/src/_internal/extension/xtab/common/promptCrafting.js.map +1 -1
- package/dist/src/_internal/extension/xtab/node/xtabProvider.d.ts.map +1 -1
- package/dist/src/_internal/extension/xtab/node/xtabProvider.js +12 -9
- package/dist/src/_internal/extension/xtab/node/xtabProvider.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/authentication.d.ts +0 -1
- package/dist/src/_internal/platform/authentication/common/authentication.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/authentication.js +2 -9
- package/dist/src/_internal/platform/authentication/common/authentication.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts +2 -0
- package/dist/src/_internal/platform/authentication/common/copilotToken.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/node/copilotTokenManager.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js +12 -2
- package/dist/src/_internal/platform/authentication/node/copilotTokenManager.js.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +2 -2
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.js +2 -2
- package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts +4 -5
- package/dist/src/_internal/platform/endpoint/common/endpointProvider.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/endpointProvider.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts +2 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js +30 -1
- package/dist/src/_internal/platform/endpoint/node/chatEndpoint.js.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/responsesApi.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/node/responsesApi.js +73 -7
- package/dist/src/_internal/platform/endpoint/node/responsesApi.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts +84 -57
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js +110 -72
- package/dist/src/_internal/platform/inlineEdits/common/dataTypes/xtabPromptOptions.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditsModelService.d.ts +9 -0
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditsModelService.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditsModelService.js +25 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditsModelService.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/node/inlineEditsModelService.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/node/inlineEditsModelService.js +1 -1
- package/dist/src/_internal/platform/inlineEdits/node/inlineEditsModelService.js.map +1 -1
- package/dist/src/_internal/platform/networking/common/networking.d.ts +5 -0
- package/dist/src/_internal/platform/networking/common/networking.d.ts.map +1 -1
- package/dist/src/_internal/platform/networking/common/networking.js +3 -1
- package/dist/src/_internal/platform/networking/common/networking.js.map +1 -1
- package/dist/src/_internal/shared-fetch-utils/common/fetchTypes.d.ts +44 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchTypes.d.ts.map +1 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchTypes.js +15 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchTypes.js.map +1 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchedValue.d.ts +90 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchedValue.d.ts.map +1 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchedValue.js +148 -0
- package/dist/src/_internal/shared-fetch-utils/common/fetchedValue.js.map +1 -0
- package/dist/src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.d.ts +28 -0
- package/dist/src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.d.ts.map +1 -0
- package/dist/src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.js +83 -0
- package/dist/src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.js.map +1 -0
- package/dist/src/_internal/util/vs/nls.js +1 -1
- package/dist/src/_internal/util/vs/nls.js.map +1 -1
- package/dist/src/package.json +33 -24
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"networking.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/networking.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAgJhG,sEAKC;AAUD,sDAEC;AAMD,wCAEC;
|
|
1
|
+
{"version":3,"file":"networking.js","sourceRoot":"","sources":["../../../../../../src/_internal/platform/networking/common/networking.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAgJhG,sEAKC;AAUD,sDAEC;AAMD,wCAEC;AAwQD,sDAgBC;AAkHD,4DAYC;AAED,kCAKC;AAED,gCAKC;AAxkBD,4DAAwE;AACxE,8DAA2E;AAE3E,gEAAwE;AAIxE,iEAAsE;AAGtE,gEAA0F;AAI1F,qDAA2H;AAC3H,qCAAmH;AAoBtG,QAAA,sBAAsB,GAAG,qCAAqC,CAAC;AAW5E,sDAAsD;AACtD,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AA4FjD,SAAgB,6BAA6B,CAAC,oBAA8C;IAC3F,IAAI,OAAO,oBAAoB,KAAK,QAAQ,EAAE,CAAC;QAC9C,OAAO,oBAAoB,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CAAC,oBAA8C;IACnF,OAAO,OAAO,oBAAoB,KAAK,QAAQ,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,QAAmB;IACjD,OAAO,qBAAqB,CAAC,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAC7D,CAAC;AAuJD,2FAA2F;AAC9E,QAAA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<string, string>;
|
|
4
|
+
method?: 'GET' | 'POST' | 'PUT';
|
|
5
|
+
state?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export interface HttpHeaders {
|
|
8
|
+
get(name: string): string | null | undefined;
|
|
9
|
+
}
|
|
10
|
+
export interface HttpResponse {
|
|
11
|
+
readonly status: number;
|
|
12
|
+
readonly headers: HttpHeaders;
|
|
13
|
+
readonly body: ReadableStream<Uint8Array> | null;
|
|
14
|
+
json(): Promise<unknown>;
|
|
15
|
+
text(): Promise<string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A function that performs an HTTP fetch given a request.
|
|
19
|
+
*
|
|
20
|
+
* Callers bridge their particular HTTP client (e.g. `IFetcherService`) into
|
|
21
|
+
* this shape so the middleware stack can remain transport-agnostic.
|
|
22
|
+
*/
|
|
23
|
+
export type HttpFetchFn = (request: HttpRequest) => Promise<HttpResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* A middleware wraps an {@link HttpFetchFn} and returns a new one. Middleware
|
|
26
|
+
* can inspect/modify the request, short-circuit the call, or post-process
|
|
27
|
+
* the response.
|
|
28
|
+
*
|
|
29
|
+
* Middlewares are composed left-to-right: the first middleware in the array
|
|
30
|
+
* is the outermost wrapper and executes first.
|
|
31
|
+
*/
|
|
32
|
+
export type FetchMiddleware = (next: HttpFetchFn) => HttpFetchFn;
|
|
33
|
+
/**
|
|
34
|
+
* Minimal interface for checking window activity state. Compatible with
|
|
35
|
+
* `IEnvService` without depending on it directly.
|
|
36
|
+
*/
|
|
37
|
+
export interface WindowStateProvider {
|
|
38
|
+
readonly isActive: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare class FetchBlockedError extends Error {
|
|
41
|
+
readonly retryAfterMs: number;
|
|
42
|
+
constructor(message: string, retryAfterMs: number);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=fetchTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchTypes.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/shared-fetch-utils/common/fetchTypes.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IAEhC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7C;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACxB;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,WAAW,KAAK,WAAW,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC3B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IACd,QAAQ,CAAC,YAAY,EAAE,MAAM;gBAA9C,OAAO,EAAE,MAAM,EAAW,YAAY,EAAE,MAAM;CAG1D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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.FetchBlockedError = void 0;
|
|
8
|
+
class FetchBlockedError extends Error {
|
|
9
|
+
constructor(message, retryAfterMs) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.retryAfterMs = retryAfterMs;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.FetchBlockedError = FetchBlockedError;
|
|
15
|
+
//# sourceMappingURL=fetchTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchTypes.js","sourceRoot":"","sources":["../../../../../src/_internal/shared-fetch-utils/common/fetchTypes.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAgDhG,MAAa,iBAAkB,SAAQ,KAAK;IAC3C,YAAY,OAAe,EAAW,YAAoB;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QADsB,iBAAY,GAAZ,YAAY,CAAQ;IAE1D,CAAC;CACD;AAJD,8CAIC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export interface FetchedValueOptions<T> {
|
|
2
|
+
/**
|
|
3
|
+
* The async function that fetches the value from the network.
|
|
4
|
+
*/
|
|
5
|
+
fetch: () => Promise<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Determines whether the current cached value is stale and should be re-fetched.
|
|
8
|
+
* Called by {@link FetchedValue.resolve} to decide if a new fetch is needed.
|
|
9
|
+
*
|
|
10
|
+
* Before the value has been fetched for the first time, the value is always considered stale
|
|
11
|
+
* and this function is not called.
|
|
12
|
+
*/
|
|
13
|
+
isStale: (value: T) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When `true`, automatically calls {@link FetchedValue.resolve} once per minute so
|
|
16
|
+
* the synchronous {@link FetchedValue.value} getter stays up-to-date.
|
|
17
|
+
*
|
|
18
|
+
* **Caution:** enabling this will lead to more network requests because the value
|
|
19
|
+
* is re-fetched periodically regardless of whether it is being read.
|
|
20
|
+
*/
|
|
21
|
+
keepCacheHot?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns how long a failed fetch should prevent another attempt.
|
|
24
|
+
*
|
|
25
|
+
* {@link FetchBlockedError.retryAfterMs} always takes precedence.
|
|
26
|
+
*/
|
|
27
|
+
getRetryAfterMs?: (error: unknown) => number | undefined;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A cached value backed by an async fetch operation.
|
|
31
|
+
*
|
|
32
|
+
* Provides both a synchronous {@link value} accessor (returns the current cached value
|
|
33
|
+
* or `undefined`) and an asynchronous {@link resolve} method that only fetches when the
|
|
34
|
+
* value is stale, as determined by the caller-supplied {@link FetchedValueOptions.isStale}
|
|
35
|
+
* predicate.
|
|
36
|
+
*
|
|
37
|
+
* Concurrent calls to {@link resolve} are coalesced into a single in-flight fetch so the
|
|
38
|
+
* network is hit at most once per staleness window.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const token = new FetchedValue({
|
|
43
|
+
* fetch: () => fetchTokenFromServer(),
|
|
44
|
+
* isStale: (t) => t.expires_at - 300 < nowSeconds(),
|
|
45
|
+
* });
|
|
46
|
+
*
|
|
47
|
+
* // Synchronous read — may be undefined before first resolve
|
|
48
|
+
* const current = token.value;
|
|
49
|
+
*
|
|
50
|
+
* // Async — fetches only when stale
|
|
51
|
+
* const fresh = await token.resolve();
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare class FetchedValue<T> {
|
|
55
|
+
private _value;
|
|
56
|
+
private _hasFetched;
|
|
57
|
+
private _inflightFetch;
|
|
58
|
+
private _blockedFailure;
|
|
59
|
+
private _generation;
|
|
60
|
+
private _disposed;
|
|
61
|
+
private _keepCacheHotTimer;
|
|
62
|
+
private _fetch;
|
|
63
|
+
private readonly _isStale;
|
|
64
|
+
private readonly _getRetryAfterMs;
|
|
65
|
+
constructor(options: FetchedValueOptions<T>);
|
|
66
|
+
/**
|
|
67
|
+
* The current cached value, or `undefined` if no value has been fetched yet.
|
|
68
|
+
*
|
|
69
|
+
* This is a synchronous accessor — it never triggers a fetch.
|
|
70
|
+
*/
|
|
71
|
+
get value(): T | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the cached value if it is still fresh, otherwise fetches a new value.
|
|
74
|
+
*
|
|
75
|
+
* Concurrent calls while a fetch is in-flight share the same promise, so the
|
|
76
|
+
* network is never hit more than once per staleness window.
|
|
77
|
+
*
|
|
78
|
+
* @param force When `true`, bypasses the staleness check and always fetches.
|
|
79
|
+
*/
|
|
80
|
+
resolve(force?: boolean): Promise<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Clears the cached value and retry state. In-flight work may finish for its caller, but cannot
|
|
83
|
+
* repopulate this cache.
|
|
84
|
+
*/
|
|
85
|
+
invalidate(): void;
|
|
86
|
+
dispose(): void;
|
|
87
|
+
private _doFetch;
|
|
88
|
+
private _throwIfDisposed;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=fetchedValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchedValue.d.ts","sourceRoot":"","sources":["../../../../../src/_internal/shared-fetch-utils/common/fetchedValue.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB,CAAC,CAAC;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAExB;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IAE/B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAC;CACzD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,YAAY,CAAC,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,eAAe,CAAuG;IAC9H,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,kBAAkB,CAA6C;IAEvE,OAAO,CAAC,MAAM,CAAiC;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuD;gBAE5E,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAW3C;;;;OAIG;IACH,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzB;IAED;;;;;;;OAOG;IACG,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IA4B1C;;;OAGG;IACH,UAAU,IAAI,IAAI;IASlB,OAAO,IAAI,IAAI;YAcD,QAAQ;IAwBtB,OAAO,CAAC,gBAAgB;CAKxB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
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.FetchedValue = void 0;
|
|
8
|
+
const fetchTypes_1 = require("./fetchTypes");
|
|
9
|
+
/**
|
|
10
|
+
* A cached value backed by an async fetch operation.
|
|
11
|
+
*
|
|
12
|
+
* Provides both a synchronous {@link value} accessor (returns the current cached value
|
|
13
|
+
* or `undefined`) and an asynchronous {@link resolve} method that only fetches when the
|
|
14
|
+
* value is stale, as determined by the caller-supplied {@link FetchedValueOptions.isStale}
|
|
15
|
+
* predicate.
|
|
16
|
+
*
|
|
17
|
+
* Concurrent calls to {@link resolve} are coalesced into a single in-flight fetch so the
|
|
18
|
+
* network is hit at most once per staleness window.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const token = new FetchedValue({
|
|
23
|
+
* fetch: () => fetchTokenFromServer(),
|
|
24
|
+
* isStale: (t) => t.expires_at - 300 < nowSeconds(),
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Synchronous read — may be undefined before first resolve
|
|
28
|
+
* const current = token.value;
|
|
29
|
+
*
|
|
30
|
+
* // Async — fetches only when stale
|
|
31
|
+
* const fresh = await token.resolve();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
class FetchedValue {
|
|
35
|
+
constructor(options) {
|
|
36
|
+
this._hasFetched = false;
|
|
37
|
+
this._generation = 0;
|
|
38
|
+
this._disposed = false;
|
|
39
|
+
this._fetch = options.fetch;
|
|
40
|
+
this._isStale = options.isStale;
|
|
41
|
+
this._getRetryAfterMs = options.getRetryAfterMs;
|
|
42
|
+
if (options.keepCacheHot) {
|
|
43
|
+
this._keepCacheHotTimer = setInterval(() => {
|
|
44
|
+
this.resolve().catch(() => { });
|
|
45
|
+
}, 60_000);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The current cached value, or `undefined` if no value has been fetched yet.
|
|
50
|
+
*
|
|
51
|
+
* This is a synchronous accessor — it never triggers a fetch.
|
|
52
|
+
*/
|
|
53
|
+
get value() {
|
|
54
|
+
return this._value;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns the cached value if it is still fresh, otherwise fetches a new value.
|
|
58
|
+
*
|
|
59
|
+
* Concurrent calls while a fetch is in-flight share the same promise, so the
|
|
60
|
+
* network is never hit more than once per staleness window.
|
|
61
|
+
*
|
|
62
|
+
* @param force When `true`, bypasses the staleness check and always fetches.
|
|
63
|
+
*/
|
|
64
|
+
async resolve(force) {
|
|
65
|
+
this._throwIfDisposed();
|
|
66
|
+
if (!force && this._hasFetched && !this._isStale(this._value)) {
|
|
67
|
+
return this._value;
|
|
68
|
+
}
|
|
69
|
+
if (!force && this._blockedFailure) {
|
|
70
|
+
if (Date.now() < this._blockedFailure.until) {
|
|
71
|
+
if (this._blockedFailure.returnCachedValue && this._hasFetched) {
|
|
72
|
+
return this._value;
|
|
73
|
+
}
|
|
74
|
+
throw this._blockedFailure.error;
|
|
75
|
+
}
|
|
76
|
+
this._blockedFailure = undefined;
|
|
77
|
+
}
|
|
78
|
+
if (this._inflightFetch) {
|
|
79
|
+
return this._inflightFetch;
|
|
80
|
+
}
|
|
81
|
+
const inflightFetch = this._doFetch(this._generation);
|
|
82
|
+
this._inflightFetch = inflightFetch;
|
|
83
|
+
try {
|
|
84
|
+
return await inflightFetch;
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
if (this._inflightFetch === inflightFetch) {
|
|
88
|
+
this._inflightFetch = undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Clears the cached value and retry state. In-flight work may finish for its caller, but cannot
|
|
94
|
+
* repopulate this cache.
|
|
95
|
+
*/
|
|
96
|
+
invalidate() {
|
|
97
|
+
this._throwIfDisposed();
|
|
98
|
+
this._generation++;
|
|
99
|
+
this._value = undefined;
|
|
100
|
+
this._hasFetched = false;
|
|
101
|
+
this._inflightFetch = undefined;
|
|
102
|
+
this._blockedFailure = undefined;
|
|
103
|
+
}
|
|
104
|
+
dispose() {
|
|
105
|
+
this._disposed = true;
|
|
106
|
+
this._generation++;
|
|
107
|
+
this._value = undefined;
|
|
108
|
+
this._hasFetched = false;
|
|
109
|
+
this._inflightFetch = undefined;
|
|
110
|
+
this._blockedFailure = undefined;
|
|
111
|
+
this._fetch = undefined;
|
|
112
|
+
if (this._keepCacheHotTimer !== undefined) {
|
|
113
|
+
clearInterval(this._keepCacheHotTimer);
|
|
114
|
+
this._keepCacheHotTimer = undefined;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async _doFetch(generation) {
|
|
118
|
+
this._throwIfDisposed();
|
|
119
|
+
try {
|
|
120
|
+
const newValue = await this._fetch();
|
|
121
|
+
this._throwIfDisposed();
|
|
122
|
+
if (generation === this._generation) {
|
|
123
|
+
this._value = newValue;
|
|
124
|
+
this._hasFetched = true;
|
|
125
|
+
this._blockedFailure = undefined;
|
|
126
|
+
}
|
|
127
|
+
return newValue;
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
const retryAfterMs = err instanceof fetchTypes_1.FetchBlockedError ? err.retryAfterMs : this._getRetryAfterMs?.(err);
|
|
131
|
+
if (generation === this._generation && retryAfterMs !== undefined && retryAfterMs > 0) {
|
|
132
|
+
const returnCachedValue = err instanceof fetchTypes_1.FetchBlockedError;
|
|
133
|
+
this._blockedFailure = { error: err, until: Date.now() + retryAfterMs, returnCachedValue };
|
|
134
|
+
if (returnCachedValue && this._hasFetched) {
|
|
135
|
+
return this._value;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
_throwIfDisposed() {
|
|
142
|
+
if (this._disposed) {
|
|
143
|
+
throw new Error('FetchedValue has been disposed');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.FetchedValue = FetchedValue;
|
|
148
|
+
//# sourceMappingURL=fetchedValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchedValue.js","sourceRoot":"","sources":["../../../../../src/_internal/shared-fetch-utils/common/fetchedValue.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,6CAAiD;AAkCjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,YAAY;IAaxB,YAAY,OAA+B;QAXnC,gBAAW,GAAG,KA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
|
1
|
+
import { FetchBlockedError, type FetchMiddleware, type HttpHeaders } from '../fetchTypes';
|
|
2
|
+
export declare const DEFAULT_RATE_LIMIT_BACKOFF_MS = 60000;
|
|
3
|
+
export declare const MAX_RATE_LIMIT_BACKOFF_MS: number;
|
|
4
|
+
export declare class RateLimitBackoffError extends FetchBlockedError {
|
|
5
|
+
constructor(retryAfterMs: number);
|
|
6
|
+
}
|
|
7
|
+
export interface RateLimitBackoffOptions {
|
|
8
|
+
/** Delay applied to the first rate limit when the server sends no hint. */
|
|
9
|
+
readonly initialDelayMs?: number;
|
|
10
|
+
readonly maxDelayMs?: number;
|
|
11
|
+
readonly multiplier?: number;
|
|
12
|
+
/** Injectable clock, primarily so tests do not have to wait on the wall clock. */
|
|
13
|
+
readonly now?: () => number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Blocks subsequent requests once the server reports a rate limit, so a client that shares a
|
|
17
|
+
* quota with other callers cannot dig itself deeper.
|
|
18
|
+
*
|
|
19
|
+
* The wait is taken from the server whenever it says so, via `Retry-After` or GitHub's
|
|
20
|
+
* `x-ratelimit-remaining`/`x-ratelimit-reset` pair, and otherwise falls back to an
|
|
21
|
+
* exponentially increasing delay. Either way the wait is capped at {@link maxDelayMs}. The
|
|
22
|
+
* backoff resets on the first response that is not rate limited.
|
|
23
|
+
*
|
|
24
|
+
* This complements {@link serverErrorBackoffMiddleware}, which covers `5xx` responses.
|
|
25
|
+
*/
|
|
26
|
+
export declare function rateLimitBackoffMiddleware(options?: RateLimitBackoffOptions): FetchMiddleware;
|
|
27
|
+
export declare function retryAfterFromRateLimitHeaders(headers: HttpHeaders, now?: () => number): number | undefined;
|
|
28
|
+
//# sourceMappingURL=rateLimitBackoffMiddleware.d.ts.map
|
package/dist/src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimitBackoffMiddleware.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE1F,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,yBAAyB,QAAc,CAAC;AAErD,qBAAa,qBAAsB,SAAQ,iBAAiB;gBAC/C,YAAY,EAAE,MAAM;CAGhC;AAED,MAAM,WAAW,uBAAuB;IACvC,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,eAAe,CAqC7F;AAWD,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,GAAE,MAAM,MAAiB,GAAG,MAAM,GAAG,SAAS,CAUrH"}
|
|
@@ -0,0 +1,83 @@
|
|
|
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.RateLimitBackoffError = exports.MAX_RATE_LIMIT_BACKOFF_MS = exports.DEFAULT_RATE_LIMIT_BACKOFF_MS = void 0;
|
|
8
|
+
exports.rateLimitBackoffMiddleware = rateLimitBackoffMiddleware;
|
|
9
|
+
exports.retryAfterFromRateLimitHeaders = retryAfterFromRateLimitHeaders;
|
|
10
|
+
const fetchTypes_1 = require("../fetchTypes");
|
|
11
|
+
exports.DEFAULT_RATE_LIMIT_BACKOFF_MS = 60_000;
|
|
12
|
+
exports.MAX_RATE_LIMIT_BACKOFF_MS = 15 * 60_000;
|
|
13
|
+
class RateLimitBackoffError extends fetchTypes_1.FetchBlockedError {
|
|
14
|
+
constructor(retryAfterMs) {
|
|
15
|
+
super(`Rate limited, backing off for ${Math.round(retryAfterMs / 1000)}s`, retryAfterMs);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.RateLimitBackoffError = RateLimitBackoffError;
|
|
19
|
+
/**
|
|
20
|
+
* Blocks subsequent requests once the server reports a rate limit, so a client that shares a
|
|
21
|
+
* quota with other callers cannot dig itself deeper.
|
|
22
|
+
*
|
|
23
|
+
* The wait is taken from the server whenever it says so, via `Retry-After` or GitHub's
|
|
24
|
+
* `x-ratelimit-remaining`/`x-ratelimit-reset` pair, and otherwise falls back to an
|
|
25
|
+
* exponentially increasing delay. Either way the wait is capped at {@link maxDelayMs}. The
|
|
26
|
+
* backoff resets on the first response that is not rate limited.
|
|
27
|
+
*
|
|
28
|
+
* This complements {@link serverErrorBackoffMiddleware}, which covers `5xx` responses.
|
|
29
|
+
*/
|
|
30
|
+
function rateLimitBackoffMiddleware(options) {
|
|
31
|
+
const { initialDelayMs = exports.DEFAULT_RATE_LIMIT_BACKOFF_MS, maxDelayMs = exports.MAX_RATE_LIMIT_BACKOFF_MS, multiplier = 2, now = Date.now, } = options ?? {};
|
|
32
|
+
let consecutiveRateLimits = 0;
|
|
33
|
+
let blockedUntil = 0;
|
|
34
|
+
return (next) => async (request) => {
|
|
35
|
+
if (now() < blockedUntil) {
|
|
36
|
+
throw new RateLimitBackoffError(blockedUntil - now());
|
|
37
|
+
}
|
|
38
|
+
const response = await next(request);
|
|
39
|
+
if (!isRateLimited(response.status, response.headers)) {
|
|
40
|
+
// A response that was already in flight when a concurrent request hit a rate limit must
|
|
41
|
+
// not clear that newer block, otherwise later calls reach the server during the window
|
|
42
|
+
// the server asked us to wait out.
|
|
43
|
+
if (now() >= blockedUntil) {
|
|
44
|
+
consecutiveRateLimits = 0;
|
|
45
|
+
blockedUntil = 0;
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
consecutiveRateLimits++;
|
|
50
|
+
const hinted = retryAfterFromRateLimitHeaders(response.headers, now);
|
|
51
|
+
const backoff = hinted ?? initialDelayMs * Math.pow(multiplier, consecutiveRateLimits - 1);
|
|
52
|
+
// `maxDelayMs` caps the server's hint too, so a bogus or hostile `Retry-After` cannot stall
|
|
53
|
+
// the client indefinitely. Retrying a little early simply re-arms the backoff.
|
|
54
|
+
const delay = Math.min(backoff, maxDelayMs);
|
|
55
|
+
blockedUntil = now() + delay;
|
|
56
|
+
throw new RateLimitBackoffError(delay);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function isRateLimited(status, headers) {
|
|
60
|
+
if (status === 429) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
// GitHub reports an exhausted primary rate limit as a 403 carrying the quota headers, which
|
|
64
|
+
// has to be told apart from a plain authorization failure.
|
|
65
|
+
return status === 403 && readHeader(headers, 'x-ratelimit-remaining') === '0';
|
|
66
|
+
}
|
|
67
|
+
function retryAfterFromRateLimitHeaders(headers, now = Date.now) {
|
|
68
|
+
const retryAfter = Number(readHeader(headers, 'retry-after'));
|
|
69
|
+
if (Number.isFinite(retryAfter) && retryAfter > 0) {
|
|
70
|
+
return retryAfter * 1000;
|
|
71
|
+
}
|
|
72
|
+
const reset = Number(readHeader(headers, 'x-ratelimit-reset'));
|
|
73
|
+
if (Number.isFinite(reset) && reset > 0) {
|
|
74
|
+
return Math.max(0, reset * 1000 - now());
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
/** HTTP header names are case insensitive, but not every headers implementation normalises them. */
|
|
79
|
+
function readHeader(headers, lowerCaseName) {
|
|
80
|
+
const canonical = lowerCaseName.replace(/(^|-)([a-z])/g, (_, separator, char) => separator + char.toUpperCase());
|
|
81
|
+
return headers.get(lowerCaseName) ?? headers.get(canonical) ?? undefined;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=rateLimitBackoffMiddleware.js.map
|
package/dist/src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimitBackoffMiddleware.js","sourceRoot":"","sources":["../../../../../../src/_internal/shared-fetch-utils/common/middleware/rateLimitBackoffMiddleware.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAiChG,gEAqCC;AAWD,wEAUC;AAzFD,8CAA0F;AAE7E,QAAA,6BAA6B,GAAG,MAAM,CAAC;AACvC,QAAA,yBAAyB,GAAG,EAAE,GAAG,MAAM,CAAC;AAErD,MAAa,qBAAsB,SAAQ,8BAAiB;IAC3D,YAAY,YAAoB;QAC/B,KAAK,CAAC,iCAAiC,IAAI,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAC1F,CAAC;CACD;AAJD,sDAIC;AAWD;;;;;;;;;;GAUG;AACH,SAAgB,0BAA0B,CAAC,OAAiC;IAC3E,MAAM,EACL,cAAc,GAAG,qCAA6B,EAC9C,UAAU,GAAG,iCAAyB,EACtC,UAAU,GAAG,CAAC,EACd,GAAG,GAAG,IAAI,CAAC,GAAG,GACd,GAAG,OAAO,IAAI,EAAE,CAAC;IAClB,IAAI,qBAAqB,GAAG,CAAC,CAAC;IAC9B,IAAI,YAAY,GAAG,CAAC,CAAC;IAErB,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAClC,IAAI,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;YAC1B,MAAM,IAAI,qBAAqB,CAAC,YAAY,GAAG,GAAG,EAAE,CAAC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AC1C,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QACjC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,QAAQ,CAAC;QACjB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,MAAM,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAgCD;;GAEG;AACH,SAAgB,SAAS,CAAC,IAA4B,CAAC,yBAAyB,EAAE,eAAuB,EAAE,GAAG,IAAsD;IACnK,IAAI,OAAe,CAAC;IACpB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACP,OAAO,GAAG,eAAe,CAAC;IAC3B,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAErC,OAAO;QACN,KAAK;QACL,QAAQ,EAAE,eAAe,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC;KAC9E,CAAC;AACH,CAAC"}
|
package/dist/src/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "copilot-chat",
|
|
3
3
|
"displayName": "GitHub Copilot",
|
|
4
4
|
"description": "AI chat features powered by Copilot",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.63.0",
|
|
6
6
|
"build": "1",
|
|
7
7
|
"completionsCoreVersion": "1.378.1799",
|
|
8
8
|
"internalLargeStorageAriaKey": "ec712b3202c5462fb6877acae7f1f9d7-c19ad55e-3e3c-4f99-984b-827f6d95bd9e-6917",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"icon": "assets/copilot.png",
|
|
23
23
|
"pricing": "Trial",
|
|
24
24
|
"engines": {
|
|
25
|
-
"vscode": "^1.
|
|
25
|
+
"vscode": "^1.135.0",
|
|
26
26
|
"npm": ">=9.0.0",
|
|
27
27
|
"node": ">=22.14.0"
|
|
28
28
|
},
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"onStartupFinished",
|
|
82
82
|
"onLanguageModelChat:copilot",
|
|
83
83
|
"onUri",
|
|
84
|
+
"onCommand:_github.copilot.chat.reportModelFeedbackSurvey",
|
|
84
85
|
"onFileSystem:ccreq",
|
|
85
86
|
"onFileSystem:ccsettings"
|
|
86
87
|
],
|
|
@@ -160,7 +161,6 @@
|
|
|
160
161
|
"icon": "$(folder)",
|
|
161
162
|
"userDescription": "%copilot.codebase.tool.description%",
|
|
162
163
|
"modelDescription": "Run a natural language search for relevant code or documentation comments from the user's current workspace. Returns relevant code snippets from the user's current workspace if it is large, or the full contents of the workspace if it is small.",
|
|
163
|
-
"when": "config.github.copilot.chat.semanticSearchTool.mode != disabled",
|
|
164
164
|
"tags": [
|
|
165
165
|
"codesearch",
|
|
166
166
|
"vscode_codesearch"
|
|
@@ -3879,7 +3879,18 @@
|
|
|
3879
3879
|
"default": true
|
|
3880
3880
|
}
|
|
3881
3881
|
},
|
|
3882
|
-
"github.copilot.chat.languageContext.
|
|
3882
|
+
"github.copilot.chat.languageContext.typescript7.enabled": {
|
|
3883
|
+
"type": "boolean",
|
|
3884
|
+
"default": false,
|
|
3885
|
+
"scope": "resource",
|
|
3886
|
+
"tags": [
|
|
3887
|
+
"experimental"
|
|
3888
|
+
],
|
|
3889
|
+
"markdownDescription": "%github.copilot.chat.languageContext.typescript7.enabled%",
|
|
3890
|
+
"agentsWindow": {
|
|
3891
|
+
"default": false
|
|
3892
|
+
}
|
|
3893
|
+
}, "github.copilot.chat.languageContext.typescript.items": {
|
|
3883
3894
|
"type": "string",
|
|
3884
3895
|
"enum": [
|
|
3885
3896
|
"minimal",
|
|
@@ -4126,25 +4137,6 @@
|
|
|
4126
4137
|
"onExp"
|
|
4127
4138
|
]
|
|
4128
4139
|
},
|
|
4129
|
-
"github.copilot.chat.semanticSearchTool.mode": {
|
|
4130
|
-
"type": "string",
|
|
4131
|
-
"default": "enabled",
|
|
4132
|
-
"enum": [
|
|
4133
|
-
"enabled",
|
|
4134
|
-
"disabled",
|
|
4135
|
-
"preferred"
|
|
4136
|
-
],
|
|
4137
|
-
"markdownEnumDescriptions": [
|
|
4138
|
-
"%github.copilot.config.semanticSearchTool.mode.enabled%",
|
|
4139
|
-
"%github.copilot.config.semanticSearchTool.mode.disabled%",
|
|
4140
|
-
"%github.copilot.config.semanticSearchTool.mode.preferred%"
|
|
4141
|
-
],
|
|
4142
|
-
"markdownDescription": "%github.copilot.config.semanticSearchTool.mode%",
|
|
4143
|
-
"tags": [
|
|
4144
|
-
"experimental",
|
|
4145
|
-
"onExp"
|
|
4146
|
-
]
|
|
4147
|
-
},
|
|
4148
4140
|
"github.copilot.chat.anthropic.tools.websearch.enabled": {
|
|
4149
4141
|
"type": "boolean",
|
|
4150
4142
|
"default": false,
|
|
@@ -4341,6 +4333,23 @@
|
|
|
4341
4333
|
{
|
|
4342
4334
|
"id": "advanced",
|
|
4343
4335
|
"properties": {
|
|
4336
|
+
"github.copilot.chat.chatCompletionsTokenParameter": {
|
|
4337
|
+
"type": "string",
|
|
4338
|
+
"enum": [
|
|
4339
|
+
"max_completion_tokens",
|
|
4340
|
+
"max_tokens"
|
|
4341
|
+
],
|
|
4342
|
+
"enumDescriptions": [
|
|
4343
|
+
"%github.copilot.config.chatCompletionsTokenParameter.maxCompletionTokens%",
|
|
4344
|
+
"%github.copilot.config.chatCompletionsTokenParameter.maxTokens%"
|
|
4345
|
+
],
|
|
4346
|
+
"default": "max_tokens",
|
|
4347
|
+
"markdownDescription": "%github.copilot.config.chatCompletionsTokenParameter%",
|
|
4348
|
+
"tags": [
|
|
4349
|
+
"advanced",
|
|
4350
|
+
"onExp"
|
|
4351
|
+
]
|
|
4352
|
+
},
|
|
4344
4353
|
"github.copilot.chat.inlineEdits.xtabProvider.modelConfiguration": {
|
|
4345
4354
|
"type": [
|
|
4346
4355
|
"object",
|
|
@@ -7119,7 +7128,7 @@
|
|
|
7119
7128
|
"esbuild@0.28.1": true,
|
|
7120
7129
|
"keytar@7.9.0": true,
|
|
7121
7130
|
"@playwright/browser-chromium@1.61.1": true,
|
|
7122
|
-
"@vscode/vsce-sign@2.0
|
|
7131
|
+
"@vscode/vsce-sign@2.1.0": true,
|
|
7123
7132
|
"protobufjs": false,
|
|
7124
7133
|
"fsevents@2.3.3": true,
|
|
7125
7134
|
"fsevents@2.3.2": true
|