@vscode/chat-lib 0.1.3-5 → 0.1.3-7
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.js +2 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/copilotTokenManager.d.ts +2 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/copilotTokenNotifier.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/auth/orgs.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/config.js +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/experiments/defaultExpFilters.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/configBlockMode.d.ts +2 -2
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/contextualFilterConstants.js +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/contextualFilterConstants.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.d.ts +2 -11
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.d.ts.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.js +54 -73
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.js.map +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/errorCreator.js +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry/userConfig.d.ts +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/prompt/src/components/reconciler.js +1 -1
- package/dist/src/_internal/extension/completions-core/vscode-node/prompt/src/languageMarker.js +7 -7
- package/dist/src/_internal/extension/completions-core/vscode-node/prompt/src/parseBlock.js +4 -4
- package/dist/src/_internal/extension/xtab/common/promptCrafting.js +1 -1
- package/dist/src/_internal/extension/xtab/common/tags.js +7 -7
- package/dist/src/_internal/platform/authentication/common/authentication.d.ts +27 -47
- package/dist/src/_internal/platform/authentication/common/authentication.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/authentication.js +2 -2
- package/dist/src/_internal/platform/authentication/common/authentication.js.map +1 -1
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.d.ts +3 -8
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js +9 -11
- package/dist/src/_internal/platform/authentication/common/staticGitHubAuthenticationService.js.map +1 -1
- package/dist/src/_internal/platform/chat/common/commonTypes.js +7 -7
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts +9 -34
- package/dist/src/_internal/platform/configuration/common/configurationService.d.ts.map +1 -1
- package/dist/src/_internal/platform/configuration/common/configurationService.js +42 -43
- package/dist/src/_internal/platform/configuration/common/configurationService.js.map +1 -1
- package/dist/src/_internal/platform/configuration/common/jsonSchema.d.ts +1 -1
- package/dist/src/_internal/platform/configuration/common/jsonSchema.js +22 -22
- package/dist/src/_internal/platform/configuration/common/validator.js +14 -14
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts +0 -1
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.d.ts.map +1 -1
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js +6 -14
- package/dist/src/_internal/platform/endpoint/common/chatModelCapabilities.js.map +1 -1
- package/dist/src/_internal/platform/github/common/githubService.d.ts +3 -5
- package/dist/src/_internal/platform/github/common/githubService.d.ts.map +1 -1
- package/dist/src/_internal/platform/github/common/githubService.js.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.d.ts.map +1 -1
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js +41 -46
- package/dist/src/_internal/platform/inlineEdits/common/inlineEditLogContext.js.map +1 -1
- package/dist/src/_internal/platform/telemetry/common/telemetry.d.ts +1 -1
- package/dist/src/_internal/platform/workspaceRecorder/common/workspaceLog.d.ts +6 -6
- package/dist/src/_internal/util/common/crypto.js +2 -2
- package/dist/src/_internal/util/common/imageUtils.js +9 -9
- package/dist/src/_internal/util/common/languages.js +4 -4
- package/dist/src/_internal/util/vs/base/common/types.d.ts +0 -27
- package/dist/src/_internal/util/vs/base/common/types.d.ts.map +1 -1
- package/dist/src/_internal/util/vs/base/common/types.js +0 -28
- package/dist/src/_internal/util/vs/base/common/types.js.map +1 -1
- package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.d.ts +5 -2
- package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.d.ts.map +1 -1
- package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
- package/dist/src/_internal/util/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
- package/dist/src/main.js +1 -2
- package/dist/src/main.js.map +1 -1
- package/dist/src/package.json +142 -79
- package/package.json +1 -1
|
@@ -238,7 +238,7 @@ let OpenAIEndpoint = class OpenAIEndpoint extends chatEndpoint_1.ChatEndpoint {
|
|
|
238
238
|
if (body?.tools) {
|
|
239
239
|
body.tools = body.tools.map(tool => {
|
|
240
240
|
if ((0, fetch_1.isOpenAiFunctionTool)(tool) && tool.function.parameters === undefined) {
|
|
241
|
-
tool.function.parameters = { type:
|
|
241
|
+
tool.function.parameters = { type: "object", properties: {} };
|
|
242
242
|
}
|
|
243
243
|
return tool;
|
|
244
244
|
});
|
|
@@ -261,7 +261,7 @@ let OpenAIEndpoint = class OpenAIEndpoint extends chatEndpoint_1.ChatEndpoint {
|
|
|
261
261
|
}
|
|
262
262
|
getExtraHeaders() {
|
|
263
263
|
const headers = {
|
|
264
|
-
|
|
264
|
+
"Content-Type": "application/json"
|
|
265
265
|
};
|
|
266
266
|
if (this._modelUrl.includes('openai.azure')) {
|
|
267
267
|
headers['api-key'] = this._apiKey;
|
|
@@ -9,7 +9,7 @@ export interface ICompletionsCopilotTokenManager {
|
|
|
9
9
|
primeToken(): Promise<boolean>;
|
|
10
10
|
getToken(): Promise<CopilotToken>;
|
|
11
11
|
resetToken(httpError?: number): void;
|
|
12
|
-
getLastToken(): Omit<CopilotToken,
|
|
12
|
+
getLastToken(): Omit<CopilotToken, "token"> | undefined;
|
|
13
13
|
}
|
|
14
14
|
export declare class CopilotTokenManagerImpl extends Disposable implements ICompletionsCopilotTokenManager {
|
|
15
15
|
protected primed: boolean;
|
|
@@ -26,6 +26,6 @@ export declare class CopilotTokenManagerImpl extends Disposable implements IComp
|
|
|
26
26
|
getToken(): Promise<CopilotToken>;
|
|
27
27
|
private updateCachedToken;
|
|
28
28
|
resetToken(httpError?: number): void;
|
|
29
|
-
getLastToken(): Omit<CopilotToken,
|
|
29
|
+
getLastToken(): Omit<CopilotToken, "token"> | undefined;
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=copilotTokenManager.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IAuthenticationService } from '../../../../../../platform/authentication/common/authentication';
|
|
2
2
|
import { CopilotToken } from '../../../../../../platform/authentication/common/copilotToken';
|
|
3
|
-
export declare function onCopilotToken(authService: IAuthenticationService, listener: (token: Omit<CopilotToken,
|
|
3
|
+
export declare function onCopilotToken(authService: IAuthenticationService, listener: (token: Omit<CopilotToken, "token">) => unknown): import("../../../../../../util/vs/base/common/lifecycle").IDisposable;
|
|
4
4
|
//# sourceMappingURL=copilotTokenNotifier.d.ts.map
|
|
@@ -264,7 +264,7 @@ const configDefaults = new Map([
|
|
|
264
264
|
[exports.ConfigKey.FilterCompletions, undefined],
|
|
265
265
|
[exports.ConfigKey.UseSplitContextPrompt, true],
|
|
266
266
|
// These are defaults from package.json
|
|
267
|
-
[exports.ConfigKey.Enable, {
|
|
267
|
+
[exports.ConfigKey.Enable, { "*": true, "plaintext": false, "markdown": false, "scminput": false }],
|
|
268
268
|
[exports.ConfigKey.UserSelectedCompletionModel, ''],
|
|
269
269
|
// These are advanced defaults from package.json
|
|
270
270
|
[exports.ConfigKey.DebugOverrideEngineLegacy, ''],
|
|
@@ -3,5 +3,5 @@ import { ServicesAccessor } from '../../../../../../util/vs/platform/instantiati
|
|
|
3
3
|
import { CopilotToken } from '../auth/copilotTokenManager';
|
|
4
4
|
import { Filter } from './filters';
|
|
5
5
|
export declare function setupCompletionsExperimentationService(accessor: ServicesAccessor): IDisposable;
|
|
6
|
-
export declare function createCompletionsFilters(accessor: ServicesAccessor, token: Omit<CopilotToken,
|
|
6
|
+
export declare function createCompletionsFilters(accessor: ServicesAccessor, token: Omit<CopilotToken, "token"> | undefined): Map<Filter, string>;
|
|
7
7
|
//# sourceMappingURL=defaultExpFilters.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IInstantiationService } from '../../../../../../util/vs/platform/instantiation/common/instantiation';
|
|
2
|
-
import { BlockMode } from
|
|
2
|
+
import { BlockMode } from "../../../../../completions/common/config";
|
|
3
3
|
import { ICompletionsFeaturesService } from '../experiments/featuresService';
|
|
4
|
-
import { TelemetryWithExp } from
|
|
4
|
+
import { TelemetryWithExp } from "../telemetry";
|
|
5
5
|
export declare const ICompletionsBlockModeConfig: import("../../../../../../util/common/services").ServiceIdentifier<ICompletionsBlockModeConfig>;
|
|
6
6
|
export interface ICompletionsBlockModeConfig {
|
|
7
7
|
readonly _serviceBrand: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextualFilterConstants.js","sourceRoot":"","sources":["../../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/contextualFilterConstants.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AACnF,QAAA,4BAA4B,GAA8B;IACtE,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,
|
|
1
|
+
{"version":3,"file":"contextualFilterConstants.js","sourceRoot":"","sources":["../../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/ghostText/contextualFilterConstants.ts"],"names":[],"mappings":";;;AAAA;;;gGAGgG;AACnF,QAAA,4BAA4B,GAA8B;IACtE,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,GAAG,EAAE,EAAE;IACP,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,CAAC,EAAE,EAAE;IACL,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/src/inlineCompletion.d.ts
CHANGED
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
import { CancellationToken, Position } from 'vscode-languageserver-protocol';
|
|
2
|
-
import {
|
|
2
|
+
import { ServicesAccessor } from '../../../../../util/vs/platform/instantiation/common/instantiation';
|
|
3
3
|
import { CopilotCompletion } from './ghostText/copilotCompletion';
|
|
4
4
|
import { GetGhostTextOptions } from './ghostText/ghostText';
|
|
5
5
|
import { ITextEditorOptions } from './ghostText/normalizeIndent';
|
|
6
|
-
import { ICompletionsSpeculativeRequestCache } from './ghostText/speculativeRequestCache';
|
|
7
|
-
import { ICompletionsLogTargetService } from './logger';
|
|
8
6
|
import { ITextDocument } from './textDocument';
|
|
9
7
|
type GetInlineCompletionsOptions = Partial<GetGhostTextOptions> & {
|
|
10
8
|
formattingOptions?: ITextEditorOptions;
|
|
11
9
|
};
|
|
12
|
-
export declare
|
|
13
|
-
private readonly instantiationService;
|
|
14
|
-
private readonly logTargetService;
|
|
15
|
-
private readonly speculativeRequestCache;
|
|
16
|
-
constructor(instantiationService: IInstantiationService, logTargetService: ICompletionsLogTargetService, speculativeRequestCache: ICompletionsSpeculativeRequestCache);
|
|
17
|
-
getInlineCompletions(textDocument: ITextDocument, position: Position, token?: CancellationToken, options?: Exclude<Partial<GetInlineCompletionsOptions>, 'promptOnly'>): Promise<CopilotCompletion[] | undefined>;
|
|
18
|
-
private getInlineCompletionsResult;
|
|
19
|
-
}
|
|
10
|
+
export declare function getInlineCompletions(accessor: ServicesAccessor, textDocument: ITextDocument, position: Position, token?: CancellationToken, options?: Exclude<Partial<GetInlineCompletionsOptions>, 'promptOnly'>): Promise<CopilotCompletion[] | undefined>;
|
|
20
11
|
export {};
|
|
21
12
|
//# sourceMappingURL=inlineCompletion.d.ts.map
|
package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineCompletion.d.ts","sourceRoot":"","sources":["../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAS,MAAM,gCAAgC,CAAC;AACpF,OAAO,
|
|
1
|
+
{"version":3,"file":"inlineCompletion.d.ts","sourceRoot":"","sources":["../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAS,MAAM,gCAAgC,CAAC;AACpF,OAAO,EAAyB,gBAAgB,EAAE,MAAM,oEAAoE,CAAC;AAE7H,OAAO,EAAmC,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACnG,OAAO,EAAgB,mBAAmB,EAAc,MAAM,uBAAuB,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAIjE,OAAO,EAAE,aAAa,EAAwB,MAAM,gBAAgB,CAAC;AAErE,KAAK,2BAA2B,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG;IACjE,iBAAiB,CAAC,EAAE,kBAAkB,CAAC;CACvC,CAAC;AAsEF,wBAAsB,oBAAoB,CACzC,QAAQ,EAAE,gBAAgB,EAC1B,YAAY,EAAE,aAAa,EAC3B,QAAQ,EAAE,QAAQ,EAClB,KAAK,CAAC,EAAE,iBAAiB,EACzB,OAAO,GAAE,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,EAAE,YAAY,CAAM,GACvE,OAAO,CAAC,iBAAiB,EAAE,GAAG,SAAS,CAAC,CAM1C"}
|
package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
9
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
3
|
+
exports.getInlineCompletions = getInlineCompletions;
|
|
13
4
|
/*---------------------------------------------------------------------------------------------
|
|
14
5
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15
6
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
@@ -23,72 +14,62 @@ const last_1 = require("./ghostText/last");
|
|
|
23
14
|
const speculativeRequestCache_1 = require("./ghostText/speculativeRequestCache");
|
|
24
15
|
const telemetry_1 = require("./ghostText/telemetry");
|
|
25
16
|
const logger_1 = require("./logger");
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
async function getInlineCompletionsResult(accessor, completionState, token, options = {}) {
|
|
18
|
+
const instantiationService = accessor.get(instantiation_1.IInstantiationService);
|
|
19
|
+
const speculativeRequestCache = accessor.get(speculativeRequestCache_1.ICompletionsSpeculativeRequestCache);
|
|
20
|
+
let lineLengthIncrease = 0;
|
|
21
|
+
// The golang.go extension (and quite possibly others) uses snippets for function completions, which collapse down
|
|
22
|
+
// to look like empty function calls (e.g., `foo()`) in selectedCompletionInfo.text. Injecting that directly into
|
|
23
|
+
// the prompt produces low quality completions, so don't.
|
|
24
|
+
if (options.selectedCompletionInfo?.text && !options.selectedCompletionInfo.text.includes(')')) {
|
|
25
|
+
completionState = completionState.addSelectedCompletionInfo(options.selectedCompletionInfo);
|
|
26
|
+
lineLengthIncrease = completionState.position.character - options.selectedCompletionInfo.range.end.character;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return this.instantiationService.invokeFunction(telemetry_1.handleGhostTextResultTelemetry, result);
|
|
28
|
+
const result = await instantiationService.invokeFunction(ghostText_1.getGhostText, completionState, token, options);
|
|
29
|
+
if (result.type !== 'success') {
|
|
30
|
+
return result;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
lineLengthIncrease = completionState.position.character - options.selectedCompletionInfo.range.end.character;
|
|
45
|
-
}
|
|
46
|
-
const result = await this.instantiationService.invokeFunction(ghostText_1.getGhostText, completionState, token, options);
|
|
47
|
-
if (result.type !== 'success') {
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
const [resultArray, resultType] = result.value;
|
|
51
|
-
if (token?.isCancellationRequested) {
|
|
52
|
-
return {
|
|
53
|
-
type: 'canceled',
|
|
54
|
-
reason: 'after getGhostText',
|
|
55
|
-
telemetryData: { telemetryBlob: result.telemetryBlob },
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const index = this.instantiationService.invokeFunction(last_1.setLastShown, completionState.textDocument, completionState.position, resultType);
|
|
59
|
-
const completions = (0, copilotCompletion_1.completionsFromGhostTextResults)(resultArray, resultType, completionState.textDocument, completionState.position, options.formattingOptions, index);
|
|
60
|
-
if (completions.length === 0) {
|
|
61
|
-
// This is a backstop, most/all cases of an empty completions list should be caught earlier
|
|
62
|
-
// TODO: figure out how this accounts for 7% of ghostText.empty when it looks unreachable
|
|
63
|
-
return { type: 'empty', reason: 'no completions in final result', telemetryData: result.telemetryData };
|
|
64
|
-
}
|
|
65
|
-
// Speculatively request a new completion including the newly returned completion in the document
|
|
66
|
-
if (resultType !== ghostText_1.ResultType.TypingAsSuggested) {
|
|
67
|
-
completionState = completionState.applyEdits([
|
|
68
|
-
{
|
|
69
|
-
newText: completions[0].insertText,
|
|
70
|
-
range: completions[0].range,
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
73
|
-
// Cache speculative request to be triggered when telemetryShown is called
|
|
74
|
-
const specOpts = { isSpeculative: true, opportunityId: options.opportunityId };
|
|
75
|
-
const fn = () => this.instantiationService.invokeFunction(ghostText_1.getGhostText, completionState, undefined, specOpts);
|
|
76
|
-
this.speculativeRequestCache.set(completions[0].clientCompletionId, fn);
|
|
77
|
-
}
|
|
78
|
-
const value = completions.map(completion => {
|
|
79
|
-
const { start, end } = completion.range;
|
|
80
|
-
const range = vscode_languageserver_protocol_1.Range.create(start, vscode_languageserver_protocol_1.Position.create(end.line, end.character - lineLengthIncrease));
|
|
81
|
-
return { ...completion, range };
|
|
82
|
-
});
|
|
83
|
-
return { ...result, value };
|
|
32
|
+
const [resultArray, resultType] = result.value;
|
|
33
|
+
if (token?.isCancellationRequested) {
|
|
34
|
+
return {
|
|
35
|
+
type: 'canceled',
|
|
36
|
+
reason: 'after getGhostText',
|
|
37
|
+
telemetryData: { telemetryBlob: result.telemetryBlob },
|
|
38
|
+
};
|
|
84
39
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
40
|
+
const index = instantiationService.invokeFunction(last_1.setLastShown, completionState.textDocument, completionState.position, resultType);
|
|
41
|
+
const completions = (0, copilotCompletion_1.completionsFromGhostTextResults)(resultArray, resultType, completionState.textDocument, completionState.position, options.formattingOptions, index);
|
|
42
|
+
if (completions.length === 0) {
|
|
43
|
+
// This is a backstop, most/all cases of an empty completions list should be caught earlier
|
|
44
|
+
// TODO: figure out how this accounts for 7% of ghostText.empty when it looks unreachable
|
|
45
|
+
return { type: 'empty', reason: 'no completions in final result', telemetryData: result.telemetryData };
|
|
46
|
+
}
|
|
47
|
+
// Speculatively request a new completion including the newly returned completion in the document
|
|
48
|
+
if (resultType !== ghostText_1.ResultType.TypingAsSuggested) {
|
|
49
|
+
completionState = completionState.applyEdits([
|
|
50
|
+
{
|
|
51
|
+
newText: completions[0].insertText,
|
|
52
|
+
range: completions[0].range,
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
55
|
+
// Cache speculative request to be triggered when telemetryShown is called
|
|
56
|
+
const specOpts = { isSpeculative: true, opportunityId: options.opportunityId };
|
|
57
|
+
const fn = () => instantiationService.invokeFunction(ghostText_1.getGhostText, completionState, undefined, specOpts);
|
|
58
|
+
speculativeRequestCache.set(completions[0].clientCompletionId, fn);
|
|
59
|
+
}
|
|
60
|
+
const value = completions.map(completion => {
|
|
61
|
+
const { start, end } = completion.range;
|
|
62
|
+
const range = vscode_languageserver_protocol_1.Range.create(start, vscode_languageserver_protocol_1.Position.create(end.line, end.character - lineLengthIncrease));
|
|
63
|
+
return { ...completion, range };
|
|
64
|
+
});
|
|
65
|
+
return { ...result, value };
|
|
66
|
+
}
|
|
67
|
+
async function getInlineCompletions(accessor, textDocument, position, token, options = {}) {
|
|
68
|
+
const instantiationService = accessor.get(instantiation_1.IInstantiationService);
|
|
69
|
+
logCompletionLocation(accessor.get(logger_1.ICompletionsLogTargetService), textDocument, position);
|
|
70
|
+
const result = await getInlineCompletionsResult(accessor, (0, completionState_1.createCompletionState)(textDocument, position), token, options);
|
|
71
|
+
return instantiationService.invokeFunction(telemetry_1.handleGhostTextResultTelemetry, result);
|
|
72
|
+
}
|
|
92
73
|
function logCompletionLocation(logTarget, textDocument, position) {
|
|
93
74
|
const prefix = textDocument.getText({
|
|
94
75
|
start: { line: Math.max(position.line - 1, 0), character: 0 },
|
package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inlineCompletion.js","sourceRoot":"","sources":["../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inlineCompletion.js","sourceRoot":"","sources":["../../../../../../../../src/_internal/extension/completions-core/vscode-node/lib/src/inlineCompletion.ts"],"names":[],"mappings":";;AAwFA,oDAYC;AApGD;;;gGAGgG;AAChG,mFAAoF;AACpF,sGAA6H;AAC7H,uDAA2E;AAC3E,qEAAmG;AACnG,qDAAsF;AACtF,2CAAgD;AAEhD,iFAA0F;AAC1F,qDAA6G;AAC7G,qCAAwD;AAOxD,KAAK,UAAU,0BAA0B,CACxC,QAA0B,EAC1B,eAAgC,EAChC,KAAyB,EACzB,UAAuC,EAAE;IAEzC,MAAM,oBAAoB,GAAG,QAAQ,CAAC,GAAG,CAAC,qCAAqB,CAAC,CAAC;IACjE,MAAM,uBAAuB,GAAG,QAAQ,CAAC,GAAG,CAAC,6DAAmC,CAAC,CAAC;IAClF,IAAI,kBAAkB,GAAG,CAAC,CAAC;IAC3B,kHAAkH;IAClH,kHAAkH;IAClH,yDAAyD;IACzD,IAAI,OAAO,CAAC,sBAAsB,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAChG,eAAe,GAAG,eAAe,CAAC,yBAAyB,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;QAC5F,kBAAkB,GAAG,eAAe,CAAC,QAAQ,CAAC,SAAS,GAAG,OAAO,CAAC,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IAC9G,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,cAAc,CAAC,wBAAY,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxG,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,MAAM,CAAC;IAAC,CAAC;IACjD,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;IAE/C,IAAI,KAAK,EA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GAAG,EAAE,QAAQ;KACb,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC;QACnC,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC;YAC7D,SAAS,EAAE,YAAY,CAAC,SAAS,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS;SAC9E;KACD,CAAC,CAAC;IAEH,kBAAM,CAAC,KAAK,CACX,SAAS,EACT,kBAAkB,YAAY,CAAC,GAAG,OAAO,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,SAAS,EAAE,EAC9E,WAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAClE,CAAC;AACH,CAAC"}
|
package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/snippy/errorCreator.js
CHANGED
|
@@ -15,7 +15,7 @@ exports.ErrorReasons = {
|
|
|
15
15
|
exports.ErrorMessages = {
|
|
16
16
|
[exports.ErrorReasons.Unauthorized]: 'Invalid GitHub token. Please sign out from your GitHub account using VSCode UI and try again',
|
|
17
17
|
[exports.ErrorReasons.InternalError]: 'Internal error: matches to public code will not be detected. It is advised to disable Copilot completions until the service is reconnected.',
|
|
18
|
-
[exports.ErrorReasons.RateLimit]:
|
|
18
|
+
[exports.ErrorReasons.RateLimit]: "You've reached your quota and limit, code matching will be unavailable until the limit resets",
|
|
19
19
|
};
|
|
20
20
|
function getErrorType(code) {
|
|
21
21
|
if (code === 401) {
|
package/dist/src/_internal/extension/completions-core/vscode-node/lib/src/telemetry/userConfig.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare class TelemetryUserConfig extends Disposable implements ICompleti
|
|
|
23
23
|
constructor(authenticationService: IAuthenticationService);
|
|
24
24
|
getProperties(): Partial<UserConfigProperties>;
|
|
25
25
|
get trackingId(): string | undefined;
|
|
26
|
-
updateFromToken(copilotToken: Omit<CopilotToken,
|
|
26
|
+
updateFromToken(copilotToken: Omit<CopilotToken, "token">): void;
|
|
27
27
|
}
|
|
28
28
|
export {};
|
|
29
29
|
//# sourceMappingURL=userConfig.d.ts.map
|
|
@@ -159,7 +159,7 @@ class VirtualPromptReconciler {
|
|
|
159
159
|
}
|
|
160
160
|
async recursivelyPumpData(data, node) {
|
|
161
161
|
if (!node) {
|
|
162
|
-
throw new Error(
|
|
162
|
+
throw new Error("Can't pump data into undefined node.");
|
|
163
163
|
}
|
|
164
164
|
await node.lifecycle?.dataHook.updateData(data);
|
|
165
165
|
for (const child of node.children || []) {
|
package/dist/src/_internal/extension/completions-core/vscode-node/prompt/src/languageMarker.js
CHANGED
|
@@ -278,7 +278,7 @@ exports.languageMarkers = {
|
|
|
278
278
|
markdownLanguageIds: ['tsx'],
|
|
279
279
|
},
|
|
280
280
|
vb: {
|
|
281
|
-
lineComment: { start:
|
|
281
|
+
lineComment: { start: "'", end: '' },
|
|
282
282
|
markdownLanguageIds: ['vb', 'vbscript'],
|
|
283
283
|
},
|
|
284
284
|
verilog: {
|
|
@@ -322,11 +322,11 @@ const dontAddLanguageMarker = [
|
|
|
322
322
|
];
|
|
323
323
|
// prettier-ignore
|
|
324
324
|
const shebangLines = {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
325
|
+
"html": "<!DOCTYPE html>",
|
|
326
|
+
"python": "#!/usr/bin/env python3",
|
|
327
|
+
"ruby": "#!/usr/bin/env ruby",
|
|
328
|
+
"shellscript": "#!/bin/sh",
|
|
329
|
+
"yaml": "# YAML data"
|
|
330
330
|
};
|
|
331
331
|
/**
|
|
332
332
|
* Determine if a line is a shebang line for a known language
|
|
@@ -344,7 +344,7 @@ function isShebangLine(line) {
|
|
|
344
344
|
*/
|
|
345
345
|
// prettier-ignore
|
|
346
346
|
function hasLanguageMarker({ source }) {
|
|
347
|
-
return source.startsWith(
|
|
347
|
+
return source.startsWith("#!") || source.startsWith("<!DOCTYPE");
|
|
348
348
|
}
|
|
349
349
|
/**
|
|
350
350
|
* Comment a single line of text in a given language.
|
|
@@ -342,7 +342,7 @@ class TreeSitterBasedBlockParser extends BaseBlockParser {
|
|
|
342
342
|
const prevSibling = blockNode.previousSibling;
|
|
343
343
|
if (prevSibling !== null &&
|
|
344
344
|
prevSibling.hasError &&
|
|
345
|
-
(prevSibling.text.startsWith('"""') || prevSibling.text.startsWith(
|
|
345
|
+
(prevSibling.text.startsWith('"""') || prevSibling.text.startsWith("'''"))) {
|
|
346
346
|
return true;
|
|
347
347
|
}
|
|
348
348
|
}
|
|
@@ -364,7 +364,7 @@ class TreeSitterBasedBlockParser extends BaseBlockParser {
|
|
|
364
364
|
if (this.languageId === 'python' && version >= 14) {
|
|
365
365
|
// In version 14 and later, we need to account for the possibility of
|
|
366
366
|
// an unfinished docstring being represented as an ERROR node.
|
|
367
|
-
if (errorNode.hasError && (errorNode.text.startsWith('"') || errorNode.text.startsWith(
|
|
367
|
+
if (errorNode.hasError && (errorNode.text.startsWith('"') || errorNode.text.startsWith("'"))) {
|
|
368
368
|
const parentType = errorNode.parent?.type;
|
|
369
369
|
if (parentType === 'function_definition' ||
|
|
370
370
|
parentType === 'class_definition' ||
|
|
@@ -420,10 +420,10 @@ class TreeSitterBasedBlockParser extends BaseBlockParser {
|
|
|
420
420
|
// horrible hack to handle unfinished docstrings :(
|
|
421
421
|
if (keyword.type === 'def') {
|
|
422
422
|
const sibling = colonNode.nextSibling;
|
|
423
|
-
if (sibling.type === '"' || sibling.type ===
|
|
423
|
+
if (sibling.type === '"' || sibling.type === "'") {
|
|
424
424
|
return true;
|
|
425
425
|
}
|
|
426
|
-
if (sibling.type === 'ERROR' && (sibling.text === '"""' || sibling.text ===
|
|
426
|
+
if (sibling.type === 'ERROR' && (sibling.text === '"""' || sibling.text === "'''")) {
|
|
427
427
|
return true;
|
|
428
428
|
}
|
|
429
429
|
}
|
|
@@ -173,7 +173,7 @@ function getEditDiffHistory(activeDoc, xtabHistory, docsInPrompt, computeTokens,
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
const diffsFromOldestToNewest = allDiffs.reverse();
|
|
176
|
-
let promptPiece = diffsFromOldestToNewest.join(
|
|
176
|
+
let promptPiece = diffsFromOldestToNewest.join("\n\n");
|
|
177
177
|
// to preserve old behavior where we always had trailing whitespace
|
|
178
178
|
if (diffsFromOldestToNewest.length > 0) {
|
|
179
179
|
promptPiece += '\n';
|
|
@@ -7,19 +7,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.ResponseTags = exports.PromptTags = void 0;
|
|
8
8
|
var PromptTags;
|
|
9
9
|
(function (PromptTags) {
|
|
10
|
-
PromptTags.CURSOR =
|
|
10
|
+
PromptTags.CURSOR = "<|cursor|>";
|
|
11
11
|
function createTag(key) {
|
|
12
12
|
return {
|
|
13
13
|
start: `<|${key}|>`,
|
|
14
14
|
end: `<|/${key}|>`
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
PromptTags.EDIT_WINDOW = createTag(
|
|
18
|
-
PromptTags.AREA_AROUND = createTag(
|
|
19
|
-
PromptTags.CURRENT_FILE = createTag(
|
|
20
|
-
PromptTags.EDIT_HISTORY = createTag(
|
|
21
|
-
PromptTags.RECENT_FILES = createTag(
|
|
22
|
-
PromptTags.RECENT_FILE = createTag(
|
|
17
|
+
PromptTags.EDIT_WINDOW = createTag("code_to_edit");
|
|
18
|
+
PromptTags.AREA_AROUND = createTag("area_around_code_to_edit");
|
|
19
|
+
PromptTags.CURRENT_FILE = createTag("current_file_content");
|
|
20
|
+
PromptTags.EDIT_HISTORY = createTag("edit_diff_history");
|
|
21
|
+
PromptTags.RECENT_FILES = createTag("recently_viewed_code_snippets");
|
|
22
|
+
PromptTags.RECENT_FILE = createTag("recently_viewed_code_snippet");
|
|
23
23
|
})(PromptTags || (exports.PromptTags = PromptTags = {}));
|
|
24
24
|
var ResponseTags;
|
|
25
25
|
(function (ResponseTags) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthenticationGetSessionOptions,
|
|
1
|
+
import type { AuthenticationGetSessionOptions, AuthenticationSession } from 'vscode';
|
|
2
2
|
import { Emitter, Event } from '../../../util/vs/base/common/event';
|
|
3
3
|
import { Disposable } from '../../../util/vs/base/common/lifecycle';
|
|
4
4
|
import { AuthProviderId, IConfigurationService } from '../../configuration/common/configurationService';
|
|
@@ -18,8 +18,8 @@ export interface IAuthenticationService {
|
|
|
18
18
|
/**
|
|
19
19
|
* Whether the authentication service is in minimal mode. If true, the authentication service will not attempt to
|
|
20
20
|
* fetch the permissive token. This means that:
|
|
21
|
-
* * {@link
|
|
22
|
-
* * {@link
|
|
21
|
+
* * {@link getPermissiveGitHubSession} interactive flows will always throw an error
|
|
22
|
+
* * {@link getPermissiveGitHubSession} silent flows and {@link permissiveGitHubSession} will always return undefined
|
|
23
23
|
*/
|
|
24
24
|
readonly isMinimalMode: boolean;
|
|
25
25
|
/**
|
|
@@ -37,57 +37,42 @@ export interface IAuthenticationService {
|
|
|
37
37
|
* Checks if there is currently any session available in the cache. Does not make any network requests and does not
|
|
38
38
|
* call out to the underlying authentication provider.
|
|
39
39
|
*
|
|
40
|
-
* @note See {@link getAnyGitHubToken} for more information and for an async version by calling {@link
|
|
40
|
+
* @note See {@link getAnyGitHubToken} for more information and for an async version by calling {@link getAnyGitHubSession} with `{ silent: true }`.
|
|
41
41
|
* @note For best practice of handling of the user's authentication state, you should react to {@link onDidAuthenticationChange}.
|
|
42
42
|
* @note This token will have at least the `user:email` scope to be able to access the minimum Copilot API.
|
|
43
43
|
*/
|
|
44
44
|
readonly anyGitHubSession: AuthenticationSession | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Returns a currently valid GitHub session, also known as session or auth session. Skips the cache and calls
|
|
47
|
+
* the underlying authentication provider using the options passed in.
|
|
48
|
+
*
|
|
49
|
+
* @note You should typically use the synchronous version {@link anyGitHubToken} if you are fetching a session silently.
|
|
50
|
+
* @note For best practice of handling of the user's authentication state, you should react to {@link onDidAuthenticationChange}.
|
|
51
|
+
* @note This token will have at least the `user:email` scope to be able to access the minimum Copilot API.
|
|
52
|
+
* @returns an auth session or undefined if none is found.
|
|
53
|
+
*/
|
|
54
|
+
getAnyGitHubSession(options?: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
|
|
45
55
|
/**
|
|
46
56
|
* Checks if there is currently a permissive session available in the cache. Does not make any network requests and does not
|
|
47
57
|
* call out to the underlying authentication provider.
|
|
48
58
|
*
|
|
49
|
-
* @note See {@link getPermissiveGitHubToken} for more information and for an async version by calling {@link
|
|
59
|
+
* @note See {@link getPermissiveGitHubToken} for more information and for an async version by calling {@link getPermissiveGitHubSession} with `{ silent: true }`.
|
|
50
60
|
* @note For best practice of handling of the user's authentication state, you should react to {@link onDidAuthenticationChange}.
|
|
51
61
|
* @returns undefined if no auth session is available or Minimal Mode is enabled. Otherwise, returns an auth session with the `repo` scope.
|
|
52
62
|
*/
|
|
53
63
|
readonly permissiveGitHubSession: AuthenticationSession | undefined;
|
|
54
64
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* @
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
63
|
-
|
|
64
|
-
getGitHubSession(kind: 'permissive' | 'any', options: AuthenticationGetSessionOptions & {
|
|
65
|
-
createIfNone: boolean | AuthenticationGetSessionPresentationOptions;
|
|
66
|
-
}): Promise<AuthenticationSession>;
|
|
67
|
-
/**
|
|
68
|
-
* Gets a GitHub session capable of calling GitHub APIs.
|
|
69
|
-
* @param kind - The kind of session that you need. **Your choice here should be thoughtful.**
|
|
70
|
-
* - 'permissive': You need a session that can access the user's private repositories or needs write access.
|
|
71
|
-
* - 'any': You only need a session that can access public information about the user.
|
|
72
|
-
* @param options - Options for getting the session.
|
|
73
|
-
* @returns Promise<AuthenticationSession> - The requested authentication session.
|
|
74
|
-
* @throws MinimalModeError - If kind is 'permissive' and the authentication service is in minimal mode.
|
|
75
|
-
* @throws Error - If no session is acquired (user cancels).
|
|
76
|
-
*/
|
|
77
|
-
getGitHubSession(kind: 'permissive' | 'any', options: AuthenticationGetSessionOptions & {
|
|
78
|
-
forceNewSession: boolean | AuthenticationGetSessionPresentationOptions;
|
|
79
|
-
}): Promise<AuthenticationSession>;
|
|
80
|
-
/**
|
|
81
|
-
* Gets a GitHub session capable of calling GitHub APIs.
|
|
82
|
-
* @param kind - The kind of session that you need. **Your choice here should be thoughtful.**
|
|
83
|
-
* - 'permissive': You need a session that can access the user's private repositories or needs write access.
|
|
84
|
-
* - 'any': You only need a session that can access public information about the user.
|
|
85
|
-
* @param options - Options for getting the session.
|
|
86
|
-
* @returns Promise<AuthenticationSession> - The requested authentication session. OR
|
|
87
|
-
* @returns Promise<undefined> - If no session is available or kind is 'permissive' and the authentication service is in minimal mode.
|
|
88
|
-
* @see {@link isMinimalMode} for more information about minimal mode.
|
|
65
|
+
* Returns a currently valid permissive GitHub session, also known as session or auth session. Skips the cache and calls
|
|
66
|
+
* the underlying authentication provider using the options passed in.
|
|
67
|
+
*
|
|
68
|
+
* @note We have the {@link IAuthenticationChatUpgradeService} to upgrade the session to a permissive one. Use this for confirmation in Chat/Edits instead of showing the modal.
|
|
69
|
+
* @note You should typically use the synchronous version {@link getPermissiveGitHubToken} if you are fetching a session silently.
|
|
70
|
+
* @note For best practice of handling of the user's authentication state, you should react to {@link onDidAuthenticationChange}.
|
|
71
|
+
* @note This token will have at least the `repo` scope to be able to access the extended features of the Copilot API.
|
|
72
|
+
* @returns an auth session or undefined if none is found.
|
|
73
|
+
* @throws MinimalModeError {@link MinimalModeError} if the authentication service is in minimal mode.
|
|
89
74
|
*/
|
|
90
|
-
|
|
75
|
+
getPermissiveGitHubSession(options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
|
|
91
76
|
/**
|
|
92
77
|
* Checks if there is currently a Copilot token available in the cache. Does not make any network requests.
|
|
93
78
|
* See {@link getCopilotToken} for more information and for an async version.
|
|
@@ -142,15 +127,10 @@ export declare abstract class BaseAuthenticationService extends Disposable imple
|
|
|
142
127
|
get isMinimalMode(): boolean;
|
|
143
128
|
protected _anyGitHubSession: AuthenticationSession | undefined;
|
|
144
129
|
get anyGitHubSession(): AuthenticationSession | undefined;
|
|
130
|
+
abstract getAnyGitHubSession(options?: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
|
|
145
131
|
protected _permissiveGitHubSession: AuthenticationSession | undefined;
|
|
146
132
|
get permissiveGitHubSession(): AuthenticationSession | undefined;
|
|
147
|
-
abstract
|
|
148
|
-
createIfNone: boolean | AuthenticationGetSessionPresentationOptions;
|
|
149
|
-
}): Promise<AuthenticationSession>;
|
|
150
|
-
abstract getGitHubSession(kind: 'permissive' | 'any', options: AuthenticationGetSessionOptions & {
|
|
151
|
-
forceNewSession: boolean | AuthenticationGetSessionPresentationOptions;
|
|
152
|
-
}): Promise<AuthenticationSession>;
|
|
153
|
-
abstract getGitHubSession(kind: 'permissive' | 'any', options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
|
|
133
|
+
abstract getPermissiveGitHubSession(options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
|
|
154
134
|
protected _anyAdoSession: AuthenticationSession | undefined;
|
|
155
135
|
get anyAdoSession(): AuthenticationSession | undefined;
|
|
156
136
|
protected abstract getAnyAdoSession(options?: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/authentication/common/authentication.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../../../src/_internal/platform/authentication/common/authentication.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAErF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AAEpE,OAAO,EAAsB,cAAc,EAAa,qBAAqB,EAAE,MAAM,iDAAiD,CAAC;AACvI,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAGzD,eAAO,MAAM,uBAAuB,UAAiB,CAAC;AAGtD,eAAO,MAAM,sBAAsB,UAAgB,CAAC;AAGpD,eAAO,MAAM,oBAAoB,UAAkD,CAAC;AAEpF,qBAAa,gBAAiB,SAAQ,KAAK;;CAK1C;AAED,eAAO,MAAM,sBAAsB,mFAA4E,CAAC;AAChH,MAAM,WAAW,sBAAsB;IAEtC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAElC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAEhC;;;;;OAKG;IACH,QAAQ,CAAC,yBAAyB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,sBAAsB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAE7C;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAE7D;;;;;;;;OAQG;IACH,mBAAmB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,OAAO,CAAC,qBAAqB,GAAG,SA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,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,+BAA+B,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;cAGxF,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;CAwDvD;AAED,wBAAgB,cAAc,CAAC,oBAAoB,EAAE,qBAAqB,GAAG,cAAc,CAM1F"}
|
|
@@ -102,8 +102,8 @@ let BaseAuthenticationService = class BaseAuthenticationService extends lifecycl
|
|
|
102
102
|
const copilotTokenErrorBefore = this._copilotTokenError;
|
|
103
103
|
// Update caches
|
|
104
104
|
const resolved = await Promise.allSettled([
|
|
105
|
-
this.
|
|
106
|
-
this.
|
|
105
|
+
this.getAnyGitHubSession({ silent: true }),
|
|
106
|
+
this.getPermissiveGitHubSession({ silent: true }),
|
|
107
107
|
this.getAnyAdoSession({ silent: true }),
|
|
108
108
|
]);
|
|
109
109
|
for (const res of resolved) {
|