@theia/ai-copilot 1.76.0-next.4 → 1.76.0-next.42
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/README.md +87 -14
- package/lib/browser/copilot-auth-dialog.d.ts.map +1 -1
- package/lib/browser/copilot-auth-dialog.js +19 -11
- package/lib/browser/copilot-auth-dialog.js.map +1 -1
- package/lib/browser/copilot-frontend-application-contribution.d.ts +21 -1
- package/lib/browser/copilot-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/copilot-frontend-application-contribution.js +129 -26
- package/lib/browser/copilot-frontend-application-contribution.js.map +1 -1
- package/lib/common/copilot-auth-service.d.ts +27 -24
- package/lib/common/copilot-auth-service.d.ts.map +1 -1
- package/lib/common/copilot-language-models-manager.d.ts +6 -22
- package/lib/common/copilot-language-models-manager.d.ts.map +1 -1
- package/lib/common/copilot-language-models-manager.js +1 -13
- package/lib/common/copilot-language-models-manager.js.map +1 -1
- package/lib/common/copilot-preferences.d.ts +1 -0
- package/lib/common/copilot-preferences.d.ts.map +1 -1
- package/lib/common/copilot-preferences.js +24 -6
- package/lib/common/copilot-preferences.js.map +1 -1
- package/lib/common/index.d.ts +0 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +0 -1
- package/lib/common/index.js.map +1 -1
- package/lib/node/copilot-auth-service-impl.d.ts +25 -16
- package/lib/node/copilot-auth-service-impl.d.ts.map +1 -1
- package/lib/node/copilot-auth-service-impl.js +67 -183
- package/lib/node/copilot-auth-service-impl.js.map +1 -1
- package/lib/node/copilot-auth-service-impl.spec.js +104 -168
- package/lib/node/copilot-auth-service-impl.spec.js.map +1 -1
- package/lib/node/copilot-backend-module.d.ts.map +1 -1
- package/lib/node/copilot-backend-module.js +10 -2
- package/lib/node/copilot-backend-module.js.map +1 -1
- package/lib/node/copilot-cli-auth-provider.d.ts +146 -0
- package/lib/node/copilot-cli-auth-provider.d.ts.map +1 -0
- package/lib/node/copilot-cli-auth-provider.js +430 -0
- package/lib/node/copilot-cli-auth-provider.js.map +1 -0
- package/lib/node/copilot-cli-auth-provider.spec.d.ts +2 -0
- package/lib/node/copilot-cli-auth-provider.spec.d.ts.map +1 -0
- package/lib/node/copilot-cli-auth-provider.spec.js +249 -0
- package/lib/node/copilot-cli-auth-provider.spec.js.map +1 -0
- package/lib/node/copilot-cli-locator.d.ts +120 -0
- package/lib/node/copilot-cli-locator.d.ts.map +1 -0
- package/lib/node/copilot-cli-locator.js +348 -0
- package/lib/node/copilot-cli-locator.js.map +1 -0
- package/lib/node/copilot-cli-locator.spec.d.ts +2 -0
- package/lib/node/copilot-cli-locator.spec.d.ts.map +1 -0
- package/lib/node/copilot-cli-locator.spec.js +327 -0
- package/lib/node/copilot-cli-locator.spec.js.map +1 -0
- package/lib/node/copilot-credential-store.d.ts +45 -0
- package/lib/node/copilot-credential-store.d.ts.map +1 -0
- package/lib/node/copilot-credential-store.js +96 -0
- package/lib/node/copilot-credential-store.js.map +1 -0
- package/lib/node/copilot-credential-store.spec.d.ts +2 -0
- package/lib/node/copilot-credential-store.spec.d.ts.map +1 -0
- package/lib/node/copilot-credential-store.spec.js +93 -0
- package/lib/node/copilot-credential-store.spec.js.map +1 -0
- package/lib/node/copilot-language-models-manager-impl.d.ts +44 -20
- package/lib/node/copilot-language-models-manager-impl.d.ts.map +1 -1
- package/lib/node/copilot-language-models-manager-impl.js +112 -65
- package/lib/node/copilot-language-models-manager-impl.js.map +1 -1
- package/lib/node/copilot-language-models-manager-impl.spec.d.ts +2 -0
- package/lib/node/copilot-language-models-manager-impl.spec.d.ts.map +1 -0
- package/lib/node/copilot-language-models-manager-impl.spec.js +162 -0
- package/lib/node/copilot-language-models-manager-impl.spec.js.map +1 -0
- package/lib/node/copilot-runtime-env.d.ts +20 -0
- package/lib/node/copilot-runtime-env.d.ts.map +1 -0
- package/lib/node/copilot-runtime-env.js +49 -0
- package/lib/node/copilot-runtime-env.js.map +1 -0
- package/lib/node/copilot-sdk-client-provider.d.ts +103 -0
- package/lib/node/copilot-sdk-client-provider.d.ts.map +1 -0
- package/lib/node/copilot-sdk-client-provider.js +247 -0
- package/lib/node/copilot-sdk-client-provider.js.map +1 -0
- package/lib/node/copilot-sdk-client-provider.spec.d.ts +2 -0
- package/lib/node/copilot-sdk-client-provider.spec.d.ts.map +1 -0
- package/lib/node/copilot-sdk-client-provider.spec.js +215 -0
- package/lib/node/copilot-sdk-client-provider.spec.js.map +1 -0
- package/lib/node/copilot-sdk-language-model.d.ts +85 -0
- package/lib/node/copilot-sdk-language-model.d.ts.map +1 -0
- package/lib/node/copilot-sdk-language-model.js +301 -0
- package/lib/node/copilot-sdk-language-model.js.map +1 -0
- package/lib/node/copilot-sdk-language-model.spec.d.ts +2 -0
- package/lib/node/copilot-sdk-language-model.spec.d.ts.map +1 -0
- package/lib/node/copilot-sdk-language-model.spec.js +315 -0
- package/lib/node/copilot-sdk-language-model.spec.js.map +1 -0
- package/lib/node/copilot-sdk-loader.d.ts +57 -0
- package/lib/node/copilot-sdk-loader.d.ts.map +1 -0
- package/lib/node/copilot-sdk-loader.js +133 -0
- package/lib/node/copilot-sdk-loader.js.map +1 -0
- package/lib/node/copilot-sdk-loader.spec.d.ts +2 -0
- package/lib/node/copilot-sdk-loader.spec.d.ts.map +1 -0
- package/lib/node/copilot-sdk-loader.spec.js +113 -0
- package/lib/node/copilot-sdk-loader.spec.js.map +1 -0
- package/lib/node/copilot-sdk-mappers.d.ts +54 -0
- package/lib/node/copilot-sdk-mappers.d.ts.map +1 -0
- package/lib/node/copilot-sdk-mappers.js +158 -0
- package/lib/node/copilot-sdk-mappers.js.map +1 -0
- package/lib/node/copilot-sdk-mappers.spec.d.ts +2 -0
- package/lib/node/copilot-sdk-mappers.spec.d.ts.map +1 -0
- package/lib/node/copilot-sdk-mappers.spec.js +168 -0
- package/lib/node/copilot-sdk-mappers.spec.js.map +1 -0
- package/lib/node/copilot-sdk-types.d.ts +208 -0
- package/lib/node/copilot-sdk-types.d.ts.map +1 -0
- package/lib/{common/copilot-oauth-config.js → node/copilot-sdk-types.js} +2 -13
- package/lib/node/copilot-sdk-types.js.map +1 -0
- package/lib/node/index.d.ts +9 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +9 -1
- package/lib/node/index.js.map +1 -1
- package/package.json +4 -6
- package/src/browser/copilot-auth-dialog.tsx +20 -16
- package/src/browser/copilot-frontend-application-contribution.ts +144 -31
- package/src/common/copilot-auth-service.ts +28 -24
- package/src/common/copilot-language-models-manager.ts +6 -29
- package/src/common/copilot-preferences.ts +24 -5
- package/src/common/index.ts +0 -1
- package/src/node/copilot-auth-service-impl.spec.ts +122 -207
- package/src/node/copilot-auth-service-impl.ts +63 -218
- package/src/node/copilot-backend-module.ts +11 -2
- package/src/node/copilot-cli-auth-provider.spec.ts +315 -0
- package/src/node/copilot-cli-auth-provider.ts +444 -0
- package/src/node/copilot-cli-locator.spec.ts +386 -0
- package/src/node/copilot-cli-locator.ts +363 -0
- package/src/node/copilot-credential-store.spec.ts +106 -0
- package/src/node/copilot-credential-store.ts +99 -0
- package/src/node/copilot-language-models-manager-impl.spec.ts +188 -0
- package/src/node/copilot-language-models-manager-impl.ts +131 -84
- package/src/node/copilot-runtime-env.ts +46 -0
- package/src/node/copilot-sdk-client-provider.spec.ts +253 -0
- package/src/node/copilot-sdk-client-provider.ts +241 -0
- package/src/node/copilot-sdk-language-model.spec.ts +377 -0
- package/src/node/copilot-sdk-language-model.ts +330 -0
- package/src/node/copilot-sdk-loader.spec.ts +126 -0
- package/src/node/copilot-sdk-loader.ts +142 -0
- package/src/node/copilot-sdk-mappers.spec.ts +190 -0
- package/src/node/copilot-sdk-mappers.ts +172 -0
- package/src/node/copilot-sdk-types.ts +290 -0
- package/src/node/index.ts +9 -1
- package/lib/common/copilot-oauth-config.d.ts +0 -33
- package/lib/common/copilot-oauth-config.d.ts.map +0 -1
- package/lib/common/copilot-oauth-config.js.map +0 -1
- package/lib/node/copilot-language-model.d.ts +0 -34
- package/lib/node/copilot-language-model.d.ts.map +0 -1
- package/lib/node/copilot-language-model.js +0 -236
- package/lib/node/copilot-language-model.js.map +0 -1
- package/lib/node/copilot-language-model.spec.d.ts +0 -2
- package/lib/node/copilot-language-model.spec.d.ts.map +0 -1
- package/lib/node/copilot-language-model.spec.js +0 -89
- package/lib/node/copilot-language-model.spec.js.map +0 -1
- package/src/common/copilot-oauth-config.ts +0 -55
- package/src/node/copilot-language-model.spec.ts +0 -106
- package/src/node/copilot-language-model.ts +0 -273
|
@@ -1,39 +1,63 @@
|
|
|
1
|
-
import { LanguageModelRegistry, LanguageModelStatus } from '@theia/ai-core';
|
|
2
|
-
import {
|
|
1
|
+
import { LanguageModelRegistry, LanguageModelStatus, ModelDiscoveryResult } from '@theia/ai-core';
|
|
2
|
+
import { DisposableCollection, ILogger } from '@theia/core';
|
|
3
3
|
import { CopilotLanguageModelsManager, CopilotModelDescription } from '../common';
|
|
4
|
-
import {
|
|
4
|
+
import { CopilotSdkClientProvider } from './copilot-sdk-client-provider';
|
|
5
5
|
import { CopilotAuthServiceImpl } from './copilot-auth-service-impl';
|
|
6
6
|
/**
|
|
7
7
|
* Backend implementation of the Copilot language models manager.
|
|
8
8
|
* Manages registration and lifecycle of Copilot language models in the AI language model registry.
|
|
9
9
|
*/
|
|
10
|
-
export declare class CopilotLanguageModelsManagerImpl implements CopilotLanguageModelsManager
|
|
10
|
+
export declare class CopilotLanguageModelsManagerImpl implements CopilotLanguageModelsManager {
|
|
11
11
|
protected readonly languageModelRegistry: LanguageModelRegistry;
|
|
12
12
|
protected readonly authService: CopilotAuthServiceImpl;
|
|
13
|
-
protected readonly
|
|
13
|
+
protected readonly sdkClientProvider: CopilotSdkClientProvider;
|
|
14
14
|
protected readonly logger: ILogger;
|
|
15
|
-
protected enterpriseUrl: string | undefined;
|
|
16
15
|
protected readonly toDispose: DisposableCollection;
|
|
16
|
+
/**
|
|
17
|
+
* Why the last model discovery failed, if it did.
|
|
18
|
+
*
|
|
19
|
+
* Being signed in does not imply that requests are accepted: the credentials can lack the Copilot
|
|
20
|
+
* entitlement, be revoked, or belong to a subscription served by a different API host. Reporting
|
|
21
|
+
* the models as ready in those cases claims a working setup that is not there, so the failure is
|
|
22
|
+
* remembered and reflected in the status of the models.
|
|
23
|
+
*/
|
|
24
|
+
protected discoveryFailure: string | undefined;
|
|
17
25
|
protected init(): void;
|
|
18
|
-
|
|
19
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Detaches from the auth service when the container this manager lives in goes away.
|
|
28
|
+
* Unbinding a container runs `@preDestroy` rather than `dispose`, see the client provider.
|
|
29
|
+
*/
|
|
30
|
+
protected stop(): void;
|
|
20
31
|
protected calculateStatus(): Promise<LanguageModelStatus>;
|
|
21
32
|
createOrUpdateLanguageModels(...modelDescriptions: CopilotModelDescription[]): Promise<void>;
|
|
22
33
|
removeLanguageModels(...modelIds: string[]): void;
|
|
23
34
|
refreshModelsStatus(): Promise<void>;
|
|
24
|
-
|
|
35
|
+
fetchAvailableModels(): Promise<ModelDiscoveryResult>;
|
|
36
|
+
/**
|
|
37
|
+
* Nominates the models the chat input should show without the user asking, up to
|
|
38
|
+
* {@link NOMINATED_MODEL_COUNT}. Copilot serves models of several vendors under one provider, so
|
|
39
|
+
* ranking them against each other by the numbers in their ids would show several models of
|
|
40
|
+
* whichever vendor counts highest and none of the others. The list is therefore filled vendor by
|
|
41
|
+
* vendor: `auto` first, which lets Copilot itself choose and is the entry most users want, then the
|
|
42
|
+
* newest model of each major vendor, then the next of each in turn until the list is full.
|
|
43
|
+
*
|
|
44
|
+
* Everything else Copilot carries is left to be chosen deliberately: the list is meant to be the
|
|
45
|
+
* handful of models one switches between while chatting, not a survey of the catalogue.
|
|
46
|
+
*
|
|
47
|
+
* Release-pinned ids are left out: the undated id of the same model is nominated, and pinning a
|
|
48
|
+
* release is the deliberate choice the check on its row makes.
|
|
49
|
+
*/
|
|
50
|
+
protected selectFeaturedModelIds(modelIds: string[]): Set<string>;
|
|
51
|
+
/**
|
|
52
|
+
* The vendor a Copilot model id belongs to, or `undefined` for a vendor that is not nominated.
|
|
53
|
+
* Matching on the id is all there is — the CLI reports nothing else — and it is deliberately narrow:
|
|
54
|
+
* a model of a vendor this does not name is still registered and still selectable, it is simply not
|
|
55
|
+
* one of the few the chat input starts with.
|
|
56
|
+
*/
|
|
57
|
+
protected vendorOf(id: string): string | undefined;
|
|
25
58
|
/**
|
|
26
|
-
*
|
|
27
|
-
* The API returns both alias IDs (e.g., `gpt-4o`) and versioned IDs
|
|
28
|
-
* (e.g., `gpt-4o-2024-11-20`) for the same model family.
|
|
29
|
-
* We keep only the family alias when it exists, falling back to
|
|
30
|
-
* the versioned ID otherwise.
|
|
59
|
+
* Records the outcome of the last model discovery and reflects it in the status of the models.
|
|
31
60
|
*/
|
|
32
|
-
protected
|
|
33
|
-
id: string;
|
|
34
|
-
capabilities?: {
|
|
35
|
-
family?: string;
|
|
36
|
-
};
|
|
37
|
-
}>): string[];
|
|
61
|
+
protected setDiscoveryFailure(failure: string | undefined): Promise<void>;
|
|
38
62
|
}
|
|
39
63
|
//# sourceMappingURL=copilot-language-models-manager-impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-language-models-manager-impl.d.ts","sourceRoot":"","sources":["../../src/node/copilot-language-models-manager-impl.ts"],"names":[],"mappings":"AAgBA,OAAO,
|
|
1
|
+
{"version":3,"file":"copilot-language-models-manager-impl.d.ts","sourceRoot":"","sources":["../../src/node/copilot-language-models-manager-impl.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAoB,qBAAqB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAO,MAAM,aAAa,CAAC;AAEjE,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAuB,MAAM,WAAW,CAAC;AAoBvG,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO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|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
23
23
|
const common_1 = require("../common");
|
|
24
|
-
|
|
25
|
-
const
|
|
24
|
+
/** The id under which Copilot offers its own model selection; always worth showing. */
|
|
25
|
+
const COPILOT_AUTO_MODEL_ID = 'auto';
|
|
26
|
+
/** How many models Copilot nominates, matching what the other providers feature. */
|
|
27
|
+
const NOMINATED_MODEL_COUNT = 5;
|
|
28
|
+
/**
|
|
29
|
+
* The vendors one Copilot model each is nominated for, recognised by the prefix of the model id.
|
|
30
|
+
* Deliberately the three whose models the other providers of this application offer directly: those
|
|
31
|
+
* are the ones a user coming to the chat input expects to switch between. Copilot carries more, and
|
|
32
|
+
* they remain registered and selectable — just not preselected.
|
|
33
|
+
*/
|
|
34
|
+
const NOMINATED_VENDORS = [
|
|
35
|
+
{ vendor: 'anthropic', matches: /^claude/i },
|
|
36
|
+
{ vendor: 'openai', matches: /^(gpt|chatgpt|o\d)/i },
|
|
37
|
+
{ vendor: 'google', matches: /^gemini/i }
|
|
38
|
+
];
|
|
39
|
+
const copilot_sdk_language_model_1 = require("./copilot-sdk-language-model");
|
|
40
|
+
const copilot_sdk_client_provider_1 = require("./copilot-sdk-client-provider");
|
|
26
41
|
const copilot_auth_service_impl_1 = require("./copilot-auth-service-impl");
|
|
27
42
|
/**
|
|
28
43
|
* Backend implementation of the Copilot language models manager.
|
|
@@ -34,42 +49,46 @@ let CopilotLanguageModelsManagerImpl = class CopilotLanguageModelsManagerImpl {
|
|
|
34
49
|
}
|
|
35
50
|
init() {
|
|
36
51
|
this.toDispose.push(this.authService.onAuthStateChanged(() => {
|
|
37
|
-
|
|
52
|
+
// The listener cannot be awaited, so the failure is reported here rather than escaping as
|
|
53
|
+
// an unhandled rejection.
|
|
54
|
+
this.refreshModelsStatus().catch(error => this.logger.warn('Copilot: failed to update the status of the models:', error));
|
|
38
55
|
}));
|
|
39
56
|
}
|
|
40
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Detaches from the auth service when the container this manager lives in goes away.
|
|
59
|
+
* Unbinding a container runs `@preDestroy` rather than `dispose`, see the client provider.
|
|
60
|
+
*/
|
|
61
|
+
stop() {
|
|
41
62
|
this.toDispose.dispose();
|
|
42
63
|
}
|
|
43
|
-
setEnterpriseUrl(url) {
|
|
44
|
-
this.enterpriseUrl = url;
|
|
45
|
-
}
|
|
46
64
|
async calculateStatus() {
|
|
47
65
|
const authState = await this.authService.getAuthState();
|
|
48
|
-
if (authState.isAuthenticated) {
|
|
49
|
-
return { status: '
|
|
66
|
+
if (!authState.isAuthenticated) {
|
|
67
|
+
return { status: 'unavailable', message: core_1.nls.localize('theia/ai/copilot/notSignedIn', 'Not signed in to GitHub Copilot') };
|
|
68
|
+
}
|
|
69
|
+
if (this.discoveryFailure) {
|
|
70
|
+
return { status: 'unavailable', message: this.discoveryFailure };
|
|
50
71
|
}
|
|
51
|
-
return { status: '
|
|
72
|
+
return { status: 'ready' };
|
|
52
73
|
}
|
|
53
74
|
async createOrUpdateLanguageModels(...modelDescriptions) {
|
|
54
75
|
const status = await this.calculateStatus();
|
|
55
76
|
for (const modelDescription of modelDescriptions) {
|
|
56
77
|
const model = await this.languageModelRegistry.getLanguageModel(modelDescription.id);
|
|
57
78
|
if (model) {
|
|
58
|
-
if (!(model instanceof
|
|
79
|
+
if (!(model instanceof copilot_sdk_language_model_1.CopilotSdkLanguageModel)) {
|
|
59
80
|
this.logger.warn(`Copilot: model ${modelDescription.id} is not a Copilot model`);
|
|
60
81
|
continue;
|
|
61
82
|
}
|
|
62
83
|
await this.languageModelRegistry.patchLanguageModel(modelDescription.id, {
|
|
63
84
|
model: modelDescription.model,
|
|
64
|
-
enableStreaming: modelDescription.enableStreaming,
|
|
65
|
-
supportsStructuredOutput: modelDescription.supportsStructuredOutput,
|
|
66
85
|
status,
|
|
67
86
|
maxRetries: modelDescription.maxRetries
|
|
68
87
|
});
|
|
69
88
|
}
|
|
70
89
|
else {
|
|
71
90
|
this.languageModelRegistry.addLanguageModels([
|
|
72
|
-
new
|
|
91
|
+
new copilot_sdk_language_model_1.CopilotSdkLanguageModel(modelDescription.id, modelDescription.model, status, modelDescription.maxRetries, () => this.sdkClientProvider.getClient(), this.logger)
|
|
73
92
|
]);
|
|
74
93
|
}
|
|
75
94
|
}
|
|
@@ -81,73 +100,95 @@ let CopilotLanguageModelsManagerImpl = class CopilotLanguageModelsManagerImpl {
|
|
|
81
100
|
const status = await this.calculateStatus();
|
|
82
101
|
const allModels = await this.languageModelRegistry.getLanguageModels();
|
|
83
102
|
for (const model of allModels) {
|
|
84
|
-
if (model instanceof
|
|
103
|
+
if (model instanceof copilot_sdk_language_model_1.CopilotSdkLanguageModel && model.id.startsWith(`${common_1.COPILOT_PROVIDER_ID}/`)) {
|
|
85
104
|
await this.languageModelRegistry.patchLanguageModel(model.id, {
|
|
86
105
|
status
|
|
87
106
|
});
|
|
88
107
|
}
|
|
89
108
|
}
|
|
90
109
|
}
|
|
91
|
-
async
|
|
92
|
-
const accessToken = await this.authService.getAccessToken();
|
|
93
|
-
if (!accessToken) {
|
|
94
|
-
return [];
|
|
95
|
-
}
|
|
96
|
-
const baseURL = (0, common_1.getCopilotApiBaseUrl)(this.enterpriseUrl);
|
|
110
|
+
async fetchAvailableModels() {
|
|
97
111
|
try {
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
});
|
|
105
|
-
if (!response.ok) {
|
|
106
|
-
this.logger.warn(`Copilot: failed to fetch available models: ${response.status} ${response.statusText}`);
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
const data = await response.json();
|
|
110
|
-
const models = data.data ?? [];
|
|
111
|
-
const modelIds = this.deduplicateModels(models);
|
|
112
|
-
this.logger.info(`Copilot: discovered ${modelIds.length} available models: ${modelIds.join(', ')}`);
|
|
113
|
-
return modelIds;
|
|
112
|
+
const modelIds = await this.sdkClientProvider.listModelIds();
|
|
113
|
+
this.logger.info(`Copilot: discovered ${modelIds.length} models [${modelIds.join(', ')}]`);
|
|
114
|
+
await this.setDiscoveryFailure(undefined);
|
|
115
|
+
// The CLI reports nothing but the id: no display name, and no release date to order by.
|
|
116
|
+
const featured = this.selectFeaturedModelIds(modelIds);
|
|
117
|
+
return { models: modelIds.map(id => ({ id, featured: featured.has(id) })), fromCache: false };
|
|
114
118
|
}
|
|
115
119
|
catch (error) {
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
121
|
+
this.logger.warn('Copilot: failed to fetch available models via the Copilot CLI:', error);
|
|
122
|
+
await this.setDiscoveryFailure(message);
|
|
123
|
+
return { models: [], fromCache: false, error: message };
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* the
|
|
127
|
+
* Nominates the models the chat input should show without the user asking, up to
|
|
128
|
+
* {@link NOMINATED_MODEL_COUNT}. Copilot serves models of several vendors under one provider, so
|
|
129
|
+
* ranking them against each other by the numbers in their ids would show several models of
|
|
130
|
+
* whichever vendor counts highest and none of the others. The list is therefore filled vendor by
|
|
131
|
+
* vendor: `auto` first, which lets Copilot itself choose and is the entry most users want, then the
|
|
132
|
+
* newest model of each major vendor, then the next of each in turn until the list is full.
|
|
133
|
+
*
|
|
134
|
+
* Everything else Copilot carries is left to be chosen deliberately: the list is meant to be the
|
|
135
|
+
* handful of models one switches between while chatting, not a survey of the catalogue.
|
|
136
|
+
*
|
|
137
|
+
* Release-pinned ids are left out: the undated id of the same model is nominated, and pinning a
|
|
138
|
+
* release is the deliberate choice the check on its row makes.
|
|
126
139
|
*/
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
selectFeaturedModelIds(modelIds) {
|
|
141
|
+
const featured = new Set();
|
|
142
|
+
const byVendor = new Map();
|
|
143
|
+
for (const id of modelIds) {
|
|
144
|
+
if (id === COPILOT_AUTO_MODEL_ID) {
|
|
145
|
+
featured.add(id);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (ai_core_1.DiscoveredModels.undatedId(id) !== undefined) {
|
|
134
149
|
continue;
|
|
135
150
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
const vendor = this.vendorOf(id);
|
|
152
|
+
if (!vendor) {
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
byVendor.set(vendor, [...byVendor.get(vendor) ?? [], id]);
|
|
156
|
+
}
|
|
157
|
+
// Newest first within each vendor, the vendors themselves in the order they are named.
|
|
158
|
+
const ranked = NOMINATED_VENDORS.map(({ vendor }) => [...byVendor.get(vendor) ?? []].sort((left, right) => ai_core_1.DiscoveredModels.compareByVersion(left, right)));
|
|
159
|
+
for (let rank = 0; featured.size < NOMINATED_MODEL_COUNT && ranked.some(ids => ids.length > rank); rank++) {
|
|
160
|
+
for (const ids of ranked) {
|
|
161
|
+
if (featured.size >= NOMINATED_MODEL_COUNT) {
|
|
162
|
+
break;
|
|
141
163
|
}
|
|
142
|
-
|
|
143
|
-
|
|
164
|
+
if (ids[rank] !== undefined) {
|
|
165
|
+
featured.add(ids[rank]);
|
|
144
166
|
}
|
|
145
167
|
}
|
|
146
|
-
else {
|
|
147
|
-
result.push(model.id);
|
|
148
|
-
}
|
|
149
168
|
}
|
|
150
|
-
return
|
|
169
|
+
return featured;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* The vendor a Copilot model id belongs to, or `undefined` for a vendor that is not nominated.
|
|
173
|
+
* Matching on the id is all there is — the CLI reports nothing else — and it is deliberately narrow:
|
|
174
|
+
* a model of a vendor this does not name is still registered and still selectable, it is simply not
|
|
175
|
+
* one of the few the chat input starts with.
|
|
176
|
+
*/
|
|
177
|
+
vendorOf(id) {
|
|
178
|
+
// Matched against the last segment, so that an id the CLI qualifies with its vendor
|
|
179
|
+
// (`google/gemini-2.5-pro`) is recognised as readily as a bare one.
|
|
180
|
+
const name = id.substring(id.lastIndexOf('/') + 1);
|
|
181
|
+
return NOMINATED_VENDORS.find(candidate => candidate.matches.test(name))?.vendor;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Records the outcome of the last model discovery and reflects it in the status of the models.
|
|
185
|
+
*/
|
|
186
|
+
async setDiscoveryFailure(failure) {
|
|
187
|
+
if (this.discoveryFailure === failure) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
this.discoveryFailure = failure;
|
|
191
|
+
await this.refreshModelsStatus();
|
|
151
192
|
}
|
|
152
193
|
};
|
|
153
194
|
exports.CopilotLanguageModelsManagerImpl = CopilotLanguageModelsManagerImpl;
|
|
@@ -160,9 +201,9 @@ tslib_1.__decorate([
|
|
|
160
201
|
tslib_1.__metadata("design:type", copilot_auth_service_impl_1.CopilotAuthServiceImpl)
|
|
161
202
|
], CopilotLanguageModelsManagerImpl.prototype, "authService", void 0);
|
|
162
203
|
tslib_1.__decorate([
|
|
163
|
-
(0, inversify_1.inject)(
|
|
164
|
-
tslib_1.__metadata("design:type",
|
|
165
|
-
], CopilotLanguageModelsManagerImpl.prototype, "
|
|
204
|
+
(0, inversify_1.inject)(copilot_sdk_client_provider_1.CopilotSdkClientProvider),
|
|
205
|
+
tslib_1.__metadata("design:type", copilot_sdk_client_provider_1.CopilotSdkClientProvider)
|
|
206
|
+
], CopilotLanguageModelsManagerImpl.prototype, "sdkClientProvider", void 0);
|
|
166
207
|
tslib_1.__decorate([
|
|
167
208
|
(0, inversify_1.inject)(core_1.ILogger),
|
|
168
209
|
(0, inversify_1.named)('ai-copilot:CopilotLanguageModelsManagerImpl'),
|
|
@@ -174,6 +215,12 @@ tslib_1.__decorate([
|
|
|
174
215
|
tslib_1.__metadata("design:paramtypes", []),
|
|
175
216
|
tslib_1.__metadata("design:returntype", void 0)
|
|
176
217
|
], CopilotLanguageModelsManagerImpl.prototype, "init", null);
|
|
218
|
+
tslib_1.__decorate([
|
|
219
|
+
(0, inversify_1.preDestroy)(),
|
|
220
|
+
tslib_1.__metadata("design:type", Function),
|
|
221
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
222
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
223
|
+
], CopilotLanguageModelsManagerImpl.prototype, "stop", null);
|
|
177
224
|
exports.CopilotLanguageModelsManagerImpl = CopilotLanguageModelsManagerImpl = tslib_1.__decorate([
|
|
178
225
|
(0, inversify_1.injectable)()
|
|
179
226
|
], CopilotLanguageModelsManagerImpl);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-language-models-manager-impl.js","sourceRoot":"","sources":["../../src/node/copilot-language-models-manager-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,
|
|
1
|
+
{"version":3,"file":"copilot-language-models-manager-impl.js","sourceRoot":"","sources":["../../src/node/copilot-language-models-manager-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4CAAoH;AACpH,sCAAiE;AACjE,4DAAoG;AACpG,sCAAuG;AAEvG,uFAAuF;AACvF,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAErC,oFAAoF;AACpF,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC;;;;;GAKG;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AC,sDAAwB,CAAC;sCACK,sDAAwB;2EAAC;AAG5C;IADlB,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,6CAA6C,CAAC;;gEACnC;AAezB;IADT,IAAA,yBAAa,GAAE;;;;4DAOf;AAOS;IADT,IAAA,sBAAU,GAAE;;;;4DAGZ;2CA1CQ,gCAAgC;IAD5C,IAAA,sBAAU,GAAE;GACA,gCAAgC,CA6L5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-language-models-manager-impl.spec.d.ts","sourceRoot":"","sources":["../../src/node/copilot-language-models-manager-impl.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource GmbH and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const chai_1 = require("chai");
|
|
19
|
+
const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
|
|
20
|
+
const copilot_language_models_manager_impl_1 = require("./copilot-language-models-manager-impl");
|
|
21
|
+
/** A registry that records the models and the patches it received. */
|
|
22
|
+
class FakeRegistry {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.models = [];
|
|
25
|
+
this.patches = [];
|
|
26
|
+
}
|
|
27
|
+
async getLanguageModel(id) {
|
|
28
|
+
return this.models.find(model => model.id === id);
|
|
29
|
+
}
|
|
30
|
+
async getLanguageModels() {
|
|
31
|
+
return this.models;
|
|
32
|
+
}
|
|
33
|
+
addLanguageModels(models) {
|
|
34
|
+
this.models.push(...models);
|
|
35
|
+
}
|
|
36
|
+
removeLanguageModels(ids) {
|
|
37
|
+
for (const id of ids) {
|
|
38
|
+
const index = this.models.findIndex(model => model.id === id);
|
|
39
|
+
if (index >= 0) {
|
|
40
|
+
this.models.splice(index, 1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async patchLanguageModel(id, patch) {
|
|
45
|
+
this.patches.push({ id, patch });
|
|
46
|
+
Object.assign(this.models.find(model => model.id === id) ?? {}, patch);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
class TestableCopilotLanguageModelsManagerImpl extends copilot_language_models_manager_impl_1.CopilotLanguageModelsManagerImpl {
|
|
50
|
+
callVendorOf(id) {
|
|
51
|
+
return this.vendorOf(id);
|
|
52
|
+
}
|
|
53
|
+
constructor(registry) {
|
|
54
|
+
super();
|
|
55
|
+
this.registry = registry;
|
|
56
|
+
this.authState = { isAuthenticated: true };
|
|
57
|
+
this.modelIds = ['gpt-5'];
|
|
58
|
+
Object.assign(this, {
|
|
59
|
+
logger: new mock_logger_1.MockLogger(),
|
|
60
|
+
languageModelRegistry: registry,
|
|
61
|
+
authService: {
|
|
62
|
+
getAuthState: async () => this.authState,
|
|
63
|
+
onAuthStateChanged: () => ({ dispose: () => { } })
|
|
64
|
+
},
|
|
65
|
+
sdkClientProvider: {
|
|
66
|
+
listModelIds: async () => {
|
|
67
|
+
if (this.listFailure) {
|
|
68
|
+
throw this.listFailure;
|
|
69
|
+
}
|
|
70
|
+
return this.modelIds;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
callCalculateStatus() {
|
|
76
|
+
return this.calculateStatus();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
describe('CopilotLanguageModelsManagerImpl - status', () => {
|
|
80
|
+
let manager;
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
manager = new TestableCopilotLanguageModelsManagerImpl(new FakeRegistry());
|
|
83
|
+
});
|
|
84
|
+
it('should report a model as ready for a user who is signed in', async () => {
|
|
85
|
+
await manager.createOrUpdateLanguageModels({ id: 'copilot/gpt-5', model: 'gpt-5', maxRetries: 3 });
|
|
86
|
+
(0, chai_1.expect)(manager.registry.models[0].status).to.deep.equal({ status: 'ready' });
|
|
87
|
+
});
|
|
88
|
+
it('should report a model as unavailable while nobody is signed in', async () => {
|
|
89
|
+
manager.authState = { isAuthenticated: false };
|
|
90
|
+
(0, chai_1.expect)(await manager.callCalculateStatus()).to.deep.include({ status: 'unavailable' });
|
|
91
|
+
});
|
|
92
|
+
it('should report models as unavailable when they cannot be listed, rather than as ready', async () => {
|
|
93
|
+
manager.listFailure = new Error('not authorized to use this Copilot feature');
|
|
94
|
+
const result = await manager.fetchAvailableModels();
|
|
95
|
+
(0, chai_1.expect)(result.models).to.be.empty;
|
|
96
|
+
(0, chai_1.expect)(result.error).to.contain('not authorized');
|
|
97
|
+
const status = await manager.callCalculateStatus();
|
|
98
|
+
(0, chai_1.expect)(status.status).to.equal('unavailable');
|
|
99
|
+
(0, chai_1.expect)(status.message).to.contain('not authorized');
|
|
100
|
+
});
|
|
101
|
+
it('should reflect a failed listing in the models that are already registered', async () => {
|
|
102
|
+
await manager.createOrUpdateLanguageModels({ id: 'copilot/gpt-5', model: 'gpt-5', maxRetries: 3 });
|
|
103
|
+
manager.listFailure = new Error('socket hang up');
|
|
104
|
+
await manager.fetchAvailableModels();
|
|
105
|
+
(0, chai_1.expect)(manager.registry.patches.map(patch => patch.id)).to.deep.equal(['copilot/gpt-5']);
|
|
106
|
+
(0, chai_1.expect)(manager.registry.models[0].status).to.deep.include({ status: 'unavailable' });
|
|
107
|
+
});
|
|
108
|
+
it('should report ready again once the models can be listed', async () => {
|
|
109
|
+
await manager.createOrUpdateLanguageModels({ id: 'copilot/gpt-5', model: 'gpt-5', maxRetries: 3 });
|
|
110
|
+
manager.listFailure = new Error('socket hang up');
|
|
111
|
+
await manager.fetchAvailableModels();
|
|
112
|
+
manager.listFailure = undefined;
|
|
113
|
+
(0, chai_1.expect)((await manager.fetchAvailableModels()).models).to.deep.equal([{ id: 'gpt-5', featured: true }]);
|
|
114
|
+
(0, chai_1.expect)(manager.registry.models[0].status).to.deep.equal({ status: 'ready' });
|
|
115
|
+
});
|
|
116
|
+
it('nominates auto and one model of each major vendor before a second of any', async () => {
|
|
117
|
+
manager.modelIds = ['auto', 'gpt-5', 'gpt-4.1', 'claude-sonnet-4.5', 'claude-haiku-4', 'gemini-2.5-pro', 'gpt-5-2026-04-17'];
|
|
118
|
+
const featured = (await manager.fetchAvailableModels()).models.filter(model => model.featured).map(model => model.id);
|
|
119
|
+
// Five in total: auto, the newest of each vendor, then the next of the first vendor with one left.
|
|
120
|
+
(0, chai_1.expect)(featured).to.have.members(['auto', 'gpt-5', 'claude-sonnet-4.5', 'gemini-2.5-pro', 'claude-haiku-4']);
|
|
121
|
+
});
|
|
122
|
+
it('fills the list to five even when the CLI offers no auto', async () => {
|
|
123
|
+
manager.modelIds = ['gpt-5', 'gpt-4.1', 'claude-sonnet-4.5', 'claude-haiku-4', 'gemini-3-pro', 'gemini-2.5-pro'];
|
|
124
|
+
const featured = (await manager.fetchAvailableModels()).models.filter(model => model.featured).map(model => model.id);
|
|
125
|
+
(0, chai_1.expect)(featured).to.have.members(['gpt-5', 'claude-sonnet-4.5', 'gemini-3-pro', 'gpt-4.1', 'claude-haiku-4']);
|
|
126
|
+
});
|
|
127
|
+
it('nominates no more than the five, however much one vendor offers', async () => {
|
|
128
|
+
manager.modelIds = ['gpt-5', 'gpt-5-mini', 'gpt-4.1', 'gpt-4o', 'o5-preview', 'chatgpt-5-latest'];
|
|
129
|
+
const featured = (await manager.fetchAvailableModels()).models.filter(model => model.featured).map(model => model.id);
|
|
130
|
+
(0, chai_1.expect)(featured).to.have.lengthOf(5);
|
|
131
|
+
});
|
|
132
|
+
it('counts the reasoning models as OpenAI, rather than as a vendor of their own', () => {
|
|
133
|
+
(0, chai_1.expect)(manager.callVendorOf('o5-preview')).to.equal('openai');
|
|
134
|
+
(0, chai_1.expect)(manager.callVendorOf('gpt-4.1')).to.equal('openai');
|
|
135
|
+
(0, chai_1.expect)(manager.callVendorOf('claude-sonnet-4.5')).to.equal('anthropic');
|
|
136
|
+
(0, chai_1.expect)(manager.callVendorOf('grok-code-fast-1')).to.equal(undefined);
|
|
137
|
+
});
|
|
138
|
+
it('nominates nothing for the vendors beyond the three, which stay selectable but not preselected', async () => {
|
|
139
|
+
manager.modelIds = ['claude-sonnet-4.5', 'grok-code-fast-1', 'mistral-large', 'llama-4-maverick'];
|
|
140
|
+
const result = await manager.fetchAvailableModels();
|
|
141
|
+
(0, chai_1.expect)(result.models.map(model => model.id)).to.have.lengthOf(4);
|
|
142
|
+
(0, chai_1.expect)(result.models.filter(model => model.featured).map(model => model.id)).to.deep.equal(['claude-sonnet-4.5']);
|
|
143
|
+
});
|
|
144
|
+
it('recognises a vendor-qualified id, in case the CLI reports them that way', async () => {
|
|
145
|
+
manager.modelIds = ['google/gemini-2.5-pro', 'anthropic/claude-sonnet-4.5'];
|
|
146
|
+
const featured = (await manager.fetchAvailableModels()).models.filter(model => model.featured).map(model => model.id);
|
|
147
|
+
(0, chai_1.expect)(featured).to.have.members(['google/gemini-2.5-pro', 'anthropic/claude-sonnet-4.5']);
|
|
148
|
+
});
|
|
149
|
+
it('never nominates a release-pinned id, whose undated form is nominated instead', async () => {
|
|
150
|
+
manager.modelIds = ['gpt-5', 'gpt-5-2026-04-17'];
|
|
151
|
+
const featured = (await manager.fetchAvailableModels()).models.filter(model => model.featured).map(model => model.id);
|
|
152
|
+
(0, chai_1.expect)(featured).to.deep.equal(['gpt-5']);
|
|
153
|
+
});
|
|
154
|
+
it('should update an existing model instead of registering it twice', async () => {
|
|
155
|
+
await manager.createOrUpdateLanguageModels({ id: 'copilot/gpt-5', model: 'gpt-5', maxRetries: 3 });
|
|
156
|
+
await manager.createOrUpdateLanguageModels({ id: 'copilot/gpt-5', model: 'gpt-5', maxRetries: 5 });
|
|
157
|
+
(0, chai_1.expect)(manager.registry.models).to.have.lengthOf(1);
|
|
158
|
+
(0, chai_1.expect)(manager.registry.patches).to.have.lengthOf(1);
|
|
159
|
+
(0, chai_1.expect)(manager.registry.patches[0].patch).to.deep.include({ maxRetries: 5 });
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
//# sourceMappingURL=copilot-language-models-manager-impl.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-language-models-manager-impl.spec.js","sourceRoot":"","sources":["../../src/node/copilot-language-models-manager-impl.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,+BAA8B;AAE9B,yEAAqE;AAErE,iGAA0F;AAE1F,sEAAsE;AACtE,MAAM,YAAY;IAAlB;QAEa,WAAM,GAAoB,EAAE,CAAC;QAC7B,YAAO,GAAyD,EAAE,CAAC;IA2BhF,CAAC;IAzBG,KAAK,CAAC,gBAAgB,CAAC,EAAU;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC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,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;QACnG,MAAM,OAAO,CAAC,4BAA4B,CAAC,EAAE,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;QACnG,IAAA,aAAM,EAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACpD,IAAA,aAAM,EAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrD,IAAA,aAAM,EAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The environment of the processes this integration starts, which are the Copilot CLI of a sign-in
|
|
3
|
+
* and the one that serves the requests.
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace CopilotRuntimeEnv {
|
|
6
|
+
/**
|
|
7
|
+
* The variables the Copilot CLI accepts a token from. None of them is a sign-in of this
|
|
8
|
+
* application, so a token this application does not own must not reach the CLI through them.
|
|
9
|
+
*/
|
|
10
|
+
const TOKEN_VARIABLES: string[];
|
|
11
|
+
/**
|
|
12
|
+
* The given environment without the variables that carry a token.
|
|
13
|
+
*
|
|
14
|
+
* They are dropped by name and regardless of their case, rather than masked with `undefined`.
|
|
15
|
+
* Environment variables are case-insensitive on Windows, so a `Github_Token` of the backend would
|
|
16
|
+
* survive a `GITHUB_TOKEN: undefined` next to it and would still be read by the CLI.
|
|
17
|
+
*/
|
|
18
|
+
function withoutTokens(env: NodeJS.ProcessEnv): Record<string, string | undefined>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=copilot-runtime-env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-runtime-env.d.ts","sourceRoot":"","sources":["../../src/node/copilot-runtime-env.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,yBAAiB,iBAAiB,CAAC;IAE/B;;;OAGG;IACI,MAAM,eAAe,UAAuD,CAAC;IAEpF;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CASxF;CACJ"}
|