@theia/ai-copilot 1.76.0-next.4 → 1.76.0-next.6
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 +86 -14
- package/lib/browser/copilot-auth-dialog.d.ts.map +1 -1
- package/lib/browser/copilot-auth-dialog.js +12 -4
- package/lib/browser/copilot-auth-dialog.js.map +1 -1
- package/lib/browser/copilot-frontend-application-contribution.d.ts +15 -1
- package/lib/browser/copilot-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/copilot-frontend-application-contribution.js +52 -24
- 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 +3 -21
- 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 +20 -18
- package/lib/node/copilot-language-models-manager-impl.d.ts.map +1 -1
- package/lib/node/copilot-language-models-manager-impl.js +39 -67
- 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 +119 -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 +302 -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 +49 -0
- package/lib/node/copilot-sdk-mappers.d.ts.map +1 -0
- package/lib/node/copilot-sdk-mappers.js +147 -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 +133 -0
- package/lib/node/copilot-sdk-mappers.spec.js.map +1 -0
- package/lib/node/copilot-sdk-types.d.ts +198 -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 +12 -8
- package/src/browser/copilot-frontend-application-contribution.ts +62 -29
- package/src/common/copilot-auth-service.ts +28 -24
- package/src/common/copilot-language-models-manager.ts +3 -28
- 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 +137 -0
- package/src/node/copilot-language-models-manager-impl.ts +51 -85
- 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 +363 -0
- package/src/node/copilot-sdk-language-model.ts +329 -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 +151 -0
- package/src/node/copilot-sdk-mappers.ts +161 -0
- package/src/node/copilot-sdk-types.ts +276 -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
package/README.md
CHANGED
|
@@ -13,37 +13,96 @@
|
|
|
13
13
|
## Description
|
|
14
14
|
|
|
15
15
|
The `@theia/ai-copilot` extension integrates GitHub Copilot language models with Theia AI.
|
|
16
|
-
This allows users to authenticate with their GitHub Copilot subscription and use Copilot models (e.g., GPT-
|
|
16
|
+
This allows users to authenticate with their GitHub Copilot subscription and use Copilot models (e.g., GPT-5, Claude Sonnet) through Theia's AI features.
|
|
17
|
+
|
|
18
|
+
> **Experimental:** This integration is under development and may be unstable. Its preferences are marked as experimental
|
|
19
|
+
> and are subject to change or removal.
|
|
20
|
+
|
|
21
|
+
Requests are served by the official GitHub Copilot CLI via [`@github/copilot-sdk`](https://www.npmjs.com/package/@github/copilot-sdk).
|
|
22
|
+
The CLI is launched as a background process on the machine hosting the Theia backend and is spoken to over JSON-RPC.
|
|
23
|
+
|
|
24
|
+
> **Note:** This extension requires an active GitHub Copilot subscription and the GitHub Copilot CLI.
|
|
25
|
+
|
|
26
|
+
### Installing the Copilot CLI
|
|
27
|
+
|
|
28
|
+
The CLI is not shipped with the application and has to be available on the machine hosting the backend:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
npm install -g @github/copilot
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
It is looked up in the installation of the application, on the `PATH` of the backend process and in the global `npm` directory.
|
|
35
|
+
When it is installed somewhere else, point at its executable with the `ai-features.copilot.executablePath` preference:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"ai-features.copilot.executablePath": "/opt/copilot/copilot"
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The `COPILOT_CLI_PATH` environment variable of the backend process does the same, for a deployment that configures this
|
|
44
|
+
centrally rather than per user.
|
|
45
|
+
|
|
46
|
+
The CLI is not bundled because it is a large platform-specific binary under a proprietary license, and because a packaged
|
|
47
|
+
application cannot execute a binary from inside its own archive. An application that wants to ship it has to install it
|
|
48
|
+
next to itself and make sure it stays extracted.
|
|
49
|
+
|
|
50
|
+
Only the CLI has to be installed. It ships the Copilot SDK next to its executable, and that is the copy this integration
|
|
51
|
+
loads, so `@github/copilot-sdk` does not have to be installed separately. Should a CLI distribution ever ship without that
|
|
52
|
+
copy, an installed `@github/copilot-sdk` is used as a fallback:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm install -g @github/copilot-sdk
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Why the Copilot CLI
|
|
59
|
+
|
|
60
|
+
Access to the Copilot models is granted per OAuth application, not per user or per subscription.
|
|
61
|
+
An application that GitHub has not entitled only sees a small legacy subset of the models, regardless of the subscription or of the request headers it sends.
|
|
62
|
+
The Copilot CLI is an entitled first-party application, so routing through it makes the current model lineup available without Theia having to obtain an entitlement of its own.
|
|
17
63
|
|
|
18
64
|
### Authentication
|
|
19
65
|
|
|
20
|
-
The
|
|
66
|
+
The sign-in is a device code flow performed by the Copilot CLI, driven from within the application:
|
|
21
67
|
|
|
22
68
|
1. Click the "Copilot" status bar item or run the **Copilot: Sign In** command
|
|
23
|
-
2. A dialog appears with a device code
|
|
24
|
-
3. Enter the code and authorize
|
|
25
|
-
4. The dialog
|
|
69
|
+
2. A dialog appears with a device code, click the link to open GitHub's device authorization page
|
|
70
|
+
3. Enter the code and authorize
|
|
71
|
+
4. The dialog reports success and the status bar reflects the signed-in state
|
|
26
72
|
|
|
27
73
|
Once authenticated, Copilot models become available in the AI Configuration for use with any Theia AI agent.
|
|
28
74
|
|
|
29
|
-
|
|
75
|
+
The credentials are owned by the application, not by the CLI: the sign-in runs against a private, temporary Copilot home so that
|
|
76
|
+
the token is not written into the credential store of the machine, and it is then kept in the credential store of Theia.
|
|
77
|
+
The CLI is given that token for its requests and nothing else, so a token in the environment or an existing sign-in of the
|
|
78
|
+
GitHub CLI is never used, and **Copilot: Sign Out** removes the credentials of this application without touching either.
|
|
30
79
|
|
|
31
80
|
### Configuration
|
|
32
81
|
|
|
33
|
-
Available models can be configured via the `ai-features.copilot.
|
|
82
|
+
Available models can be configured via the `ai-features.copilot.modelOverrides` preference.
|
|
83
|
+
When it is empty, the models are discovered from your Copilot subscription:
|
|
34
84
|
|
|
35
85
|
```json
|
|
36
86
|
{
|
|
37
|
-
"ai-features.copilot.
|
|
38
|
-
"gpt-
|
|
39
|
-
"claude-sonnet-
|
|
87
|
+
"ai-features.copilot.modelOverrides": [
|
|
88
|
+
"gpt-5.5",
|
|
89
|
+
"claude-sonnet-5"
|
|
40
90
|
]
|
|
41
91
|
}
|
|
42
92
|
```
|
|
43
93
|
|
|
44
|
-
###
|
|
94
|
+
### Copilot Business and Enterprise
|
|
95
|
+
|
|
96
|
+
Copilot Business and Enterprise seats are served by their own API host, but nothing has to be configured for them:
|
|
97
|
+
the endpoint belonging to the subscription is resolved from the credentials of the sign-in.
|
|
98
|
+
|
|
99
|
+
Should that resolution ever fail for a deployment, the host can be forced with the `COPILOT_API_URL` environment variable
|
|
100
|
+
of the process running the backend, for example `https://api.business.githubcopilot.com`. This is a last resort rather than
|
|
101
|
+
part of the normal setup: a value that does not match the subscription makes every request fail, and GitHub reports that
|
|
102
|
+
the same way as a missing entitlement, which is hard to tell apart.
|
|
45
103
|
|
|
46
|
-
For GitHub Enterprise
|
|
104
|
+
For GitHub Enterprise deployments, configure the domain via the `ai-features.copilot.enterpriseUrl` preference.
|
|
105
|
+
It is used for the sign-in, and remembered with the credentials so that requests go to the same deployment:
|
|
47
106
|
|
|
48
107
|
```json
|
|
49
108
|
{
|
|
@@ -53,8 +112,21 @@ For GitHub Enterprise users, configure the enterprise URL via the `ai-features.c
|
|
|
53
112
|
|
|
54
113
|
### Commands
|
|
55
114
|
|
|
56
|
-
- **Copilot: Sign In** -
|
|
57
|
-
- **Copilot: Sign Out** -
|
|
115
|
+
- **Copilot: Sign In** - Signs in via the device code flow
|
|
116
|
+
- **Copilot: Sign Out** - Removes the stored credentials
|
|
117
|
+
|
|
118
|
+
### Known limitations
|
|
119
|
+
|
|
120
|
+
- The Copilot CLI has to be installed on the machine hosting the backend, see above.
|
|
121
|
+
- The Copilot CLI runs as a process on the machine hosting the backend, one per frontend connection.
|
|
122
|
+
This is not suitable for multi-user backend deployments, where every connected frontend would share a single identity.
|
|
123
|
+
- Structured output is not available on this path.
|
|
124
|
+
- The request mapping is lossy, because the CLI is an agent that takes a single prompt per turn rather than a message history:
|
|
125
|
+
- The conversation is flattened into one prompt. A single user turn is forwarded as it is, a longer history is rendered as a
|
|
126
|
+
role-labelled transcript. The system prompt of the Theia agent is not part of that, it becomes the system message of the
|
|
127
|
+
session and takes the place of the agent instructions the CLI would use.
|
|
128
|
+
- Images in a request are dropped and only noted as omitted.
|
|
129
|
+
- Tool calls and tool results of the history are rendered as text rather than as the structured entries they were.
|
|
58
130
|
|
|
59
131
|
## Additional Information
|
|
60
132
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-auth-dialog.d.ts","sourceRoot":"","sources":["../../src/browser/copilot-auth-dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,8CAA8C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,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IAAI,IAAI;IAgBrB,IAAI,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAU1C,MAAM,IAAI,IAAI;cAKP,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;cAepB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IA2BhD,IAAI,KAAK,IAAI,OAAO,CAEnB;cAEkB,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,GAAG,WAAW;IAU5E,SAAS,CAAC,cAAc,QAAa,OAAO,CAAC,IAAI,CAAC,CAUhD;IAEF,SAAS,CAAC,aAAa,QAAO,IAAI,CAIhC;IAEF,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,SAAS;IAQnC,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS;IAiB1C,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS;IAW1C,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS;IA6D1C,SAAS,CAAC,aAAa,GAAI,GAAG,KAAK,CAAC,UAAU,KAAG,IAAI,CAGnD;IAEF,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS;IAW1C,SAAS,CAAC,aAAa,IAAI,KAAK,CAAC,SAAS;IAgB1C,SAAS,CAAC,kBAAkB,GAAI,GAAG,KAAK,CAAC,UAAU,KAAG,IAAI,CAGxD;IAEF,SAAS,CAAC,WAAW,QAAO,IAAI,CAE9B;IAEF,SAAS,CAAC,WAAW,IAAI,KAAK,CAAC,SAAS;CAc3C"}
|
|
@@ -75,7 +75,12 @@ let CopilotAuthDialog = class CopilotAuthDialog extends react_dialog_1.ReactDial
|
|
|
75
75
|
}
|
|
76
76
|
async open() {
|
|
77
77
|
this.initiateFlow();
|
|
78
|
-
|
|
78
|
+
const result = await super.open();
|
|
79
|
+
if (this.state !== 'success') {
|
|
80
|
+
// Leave no Copilot CLI process behind when the dialog is dismissed or retried.
|
|
81
|
+
await this.authService.cancelSignIn();
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
79
84
|
}
|
|
80
85
|
update() {
|
|
81
86
|
super.update();
|
|
@@ -85,7 +90,7 @@ let CopilotAuthDialog = class CopilotAuthDialog extends react_dialog_1.ReactDial
|
|
|
85
90
|
try {
|
|
86
91
|
this.state = 'loading';
|
|
87
92
|
this.update();
|
|
88
|
-
this.deviceCodeResponse = await this.authService.
|
|
93
|
+
this.deviceCodeResponse = await this.authService.startSignIn(this.props.enterpriseUrl);
|
|
89
94
|
this.state = 'waiting';
|
|
90
95
|
this.update();
|
|
91
96
|
}
|
|
@@ -102,7 +107,7 @@ let CopilotAuthDialog = class CopilotAuthDialog extends react_dialog_1.ReactDial
|
|
|
102
107
|
this.state = 'polling';
|
|
103
108
|
this.update();
|
|
104
109
|
try {
|
|
105
|
-
const success = await this.authService.
|
|
110
|
+
const success = await this.authService.waitForSignIn();
|
|
106
111
|
if (success) {
|
|
107
112
|
this.state = 'success';
|
|
108
113
|
this.update();
|
|
@@ -124,7 +129,10 @@ let CopilotAuthDialog = class CopilotAuthDialog extends react_dialog_1.ReactDial
|
|
|
124
129
|
}
|
|
125
130
|
isValid(_value, _mode) {
|
|
126
131
|
if (this.state === 'error') {
|
|
127
|
-
|
|
132
|
+
// The error is shown in the dialog body by renderError, where it can wrap. Returning only a
|
|
133
|
+
// failed result keeps the accept button disabled without repeating the (often long) message
|
|
134
|
+
// next to it, where it does not fit.
|
|
135
|
+
return { result: false, message: '' };
|
|
128
136
|
}
|
|
129
137
|
return '';
|
|
130
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-auth-dialog.js","sourceRoot":"","sources":["../../src/browser/copilot-auth-dialog.tsx"],"names":[],"mappings":";;;;;AAiBA,4DAAiF;AACjF,6DAA2E;AAC3E,+EAA2E;AAC3E,iFAA6E;AAC7E,kFAA8E;AAC9E,sCAAkD;AAClD,yEAAwF;AACxF,iFAA2E;AAE3E,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAKp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IAAA,kBAAM,EAAC,oCAAgB,CAAC;;2DAC6B;AAGnC;IADlB,IAAA,kBAAM,EAAC,8BAAa,CAAC;;wDAC0B;AAG7B;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;;yDAC2B;AAG/B;IADlB,IAAA,kBAAM,EAAC,wDAAyB,CAAC;;mDACqB;AAgB7C;IADT,IAAA,yBAAa,GAAE;;;;6CAKf;4BAnCQ,iBAAiB;IAD7B,IAAA,sBAAU,GAAE;IA0BJ,mBAAA,IAAA,kBAAM,EAAC,sBAAsB,CAAC,CAAA;6CAAoC,sBAAsB;GAzBpF,iBAAiB,CAsS7B"}
|
|
@@ -14,12 +14,26 @@ export declare class CopilotFrontendApplicationContribution implements FrontendA
|
|
|
14
14
|
protected useAutoDiscovery: boolean;
|
|
15
15
|
onStart(): void;
|
|
16
16
|
protected isCopilotEnabled(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Hands the configured location of the Copilot CLI to the backend, which searches for it when
|
|
19
|
+
* none is configured.
|
|
20
|
+
*/
|
|
21
|
+
protected updateExecutablePath(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Tells the user why they are signed out after an update, since the sign-in of the previous
|
|
24
|
+
* version cannot be carried over: it belonged to an OAuth application that is no longer used.
|
|
25
|
+
*/
|
|
26
|
+
protected notifySignInRequired(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Tells the user that a changed GitHub Copilot domain only takes effect on the next sign-in, since
|
|
29
|
+
* the domain is read when signing in and not while a session is already established.
|
|
30
|
+
*/
|
|
31
|
+
protected notifyEnterpriseUrlChanged(): Promise<void>;
|
|
17
32
|
protected initializeModels(): Promise<void>;
|
|
18
33
|
protected discoverAndRegisterModels(): Promise<void>;
|
|
19
34
|
protected removeAllCopilotModels(): void;
|
|
20
35
|
protected handleModelChanges(newModels: string[]): void;
|
|
21
36
|
protected updateAllModels(): void;
|
|
22
|
-
protected notifyTokenMigration(): Promise<void>;
|
|
23
37
|
protected createCopilotModelDescription(modelId: string): CopilotModelDescription;
|
|
24
38
|
}
|
|
25
39
|
//# sourceMappingURL=copilot-frontend-application-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/copilot-frontend-application-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,cAAc,EAAO,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,uBAAuB,EAAuB,MAAM,WAAW,CAAC;AAE3H,OAAO,EAAE,iBAAiB,EAA+B,MAAM,+CAA+C,CAAC;AAG/G,qBACa,sCAAuC,YAAW,+BAA+B;IAG1F,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,4BAA4B,CAAC;IAGzD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,kBAAkB,CAAC;IAGnD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IAElD,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,CAAM;IACpC,SAAS,CAAC,gBAAgB,UAAS;IAEnC,OAAO,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"copilot-frontend-application-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/copilot-frontend-application-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,cAAc,EAAO,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBA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-31,17 +31,25 @@ let CopilotFrontendApplicationContribution = class CopilotFrontendApplicationCon
|
|
|
31
31
|
}
|
|
32
32
|
onStart() {
|
|
33
33
|
this.preferenceService.ready.then(async () => {
|
|
34
|
-
|
|
35
|
-
this.
|
|
34
|
+
// Before anything reaches for the CLI: the backend cannot read the preferences itself.
|
|
35
|
+
await this.updateExecutablePath();
|
|
36
36
|
if (this.isCopilotEnabled()) {
|
|
37
37
|
const authState = await this.authService.getAuthState();
|
|
38
38
|
if (authState.migrationRequired) {
|
|
39
|
-
this.
|
|
39
|
+
this.notifySignInRequired();
|
|
40
40
|
}
|
|
41
41
|
await this.initializeModels();
|
|
42
42
|
}
|
|
43
43
|
this.preferenceService.onPreferenceChanged(event => {
|
|
44
|
-
if (event.preferenceName === copilot_preferences_1.
|
|
44
|
+
if (event.preferenceName === copilot_preferences_1.COPILOT_EXECUTABLE_PATH_PREF) {
|
|
45
|
+
this.updateExecutablePath().then(() => {
|
|
46
|
+
if (this.isCopilotEnabled() && this.useAutoDiscovery) {
|
|
47
|
+
// A CLI that could not be found before may be reachable now.
|
|
48
|
+
this.discoverAndRegisterModels();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
else if (event.preferenceName === copilot_preferences_1.COPILOT_ENABLED_PREF) {
|
|
45
53
|
if (this.isCopilotEnabled()) {
|
|
46
54
|
this.initializeModels();
|
|
47
55
|
}
|
|
@@ -49,6 +57,11 @@ let CopilotFrontendApplicationContribution = class CopilotFrontendApplicationCon
|
|
|
49
57
|
this.removeAllCopilotModels();
|
|
50
58
|
}
|
|
51
59
|
}
|
|
60
|
+
else if (event.preferenceName === copilot_preferences_1.COPILOT_ENTERPRISE_URL_PREF) {
|
|
61
|
+
// The domain is only read at sign-in time, so a change while signed in has no effect
|
|
62
|
+
// until the next sign-in. Let the user know instead of silently ignoring it.
|
|
63
|
+
this.notifyEnterpriseUrlChanged();
|
|
64
|
+
}
|
|
52
65
|
else if (event.preferenceName === copilot_preferences_1.COPILOT_MODEL_OVERRIDES_PREF && this.isCopilotEnabled()) {
|
|
53
66
|
const newModels = this.preferenceService.get(copilot_preferences_1.COPILOT_MODEL_OVERRIDES_PREF, []);
|
|
54
67
|
if (newModels.length > 0) {
|
|
@@ -61,17 +74,6 @@ let CopilotFrontendApplicationContribution = class CopilotFrontendApplicationCon
|
|
|
61
74
|
this.discoverAndRegisterModels();
|
|
62
75
|
}
|
|
63
76
|
}
|
|
64
|
-
else if (event.preferenceName === copilot_preferences_1.COPILOT_ENTERPRISE_URL_PREF && this.isCopilotEnabled()) {
|
|
65
|
-
const url = this.preferenceService.get(copilot_preferences_1.COPILOT_ENTERPRISE_URL_PREF);
|
|
66
|
-
this.manager.setEnterpriseUrl(url || undefined);
|
|
67
|
-
if (this.useAutoDiscovery) {
|
|
68
|
-
this.removeAllCopilotModels();
|
|
69
|
-
this.discoverAndRegisterModels();
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
this.manager.refreshModelsStatus();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
77
|
});
|
|
76
78
|
this.authService.onAuthStateChanged(async (state) => {
|
|
77
79
|
if (this.isCopilotEnabled() && this.useAutoDiscovery) {
|
|
@@ -93,6 +95,41 @@ let CopilotFrontendApplicationContribution = class CopilotFrontendApplicationCon
|
|
|
93
95
|
isCopilotEnabled() {
|
|
94
96
|
return this.preferenceService.get(copilot_preferences_1.COPILOT_ENABLED_PREF, true);
|
|
95
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Hands the configured location of the Copilot CLI to the backend, which searches for it when
|
|
100
|
+
* none is configured.
|
|
101
|
+
*/
|
|
102
|
+
async updateExecutablePath() {
|
|
103
|
+
const executablePath = this.preferenceService.get(copilot_preferences_1.COPILOT_EXECUTABLE_PATH_PREF, '').trim();
|
|
104
|
+
await this.authService.setExecutablePath(executablePath || undefined);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Tells the user why they are signed out after an update, since the sign-in of the previous
|
|
108
|
+
* version cannot be carried over: it belonged to an OAuth application that is no longer used.
|
|
109
|
+
*/
|
|
110
|
+
async notifySignInRequired() {
|
|
111
|
+
const signIn = core_1.nls.localize('theia/ai/copilot/commands/signIn', 'Sign in to GitHub Copilot');
|
|
112
|
+
const action = await this.messageService.info(core_1.nls.localize('theia/ai/copilot/signInAgain', 'GitHub Copilot now signs in through the GitHub Copilot CLI. Your previous sign-in could not be carried over and has been '
|
|
113
|
+
+ 'removed, please sign in again to use Copilot models.'), signIn);
|
|
114
|
+
if (action === signIn) {
|
|
115
|
+
this.commandService.executeCommand(copilot_command_contribution_1.CopilotCommands.SIGN_IN.id);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Tells the user that a changed GitHub Copilot domain only takes effect on the next sign-in, since
|
|
120
|
+
* the domain is read when signing in and not while a session is already established.
|
|
121
|
+
*/
|
|
122
|
+
async notifyEnterpriseUrlChanged() {
|
|
123
|
+
const authState = await this.authService.getAuthState();
|
|
124
|
+
if (!authState.isAuthenticated) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const signIn = core_1.nls.localize('theia/ai/copilot/commands/signIn', 'Sign in to GitHub Copilot');
|
|
128
|
+
const action = await this.messageService.info(core_1.nls.localize('theia/ai/copilot/enterpriseUrlChanged', 'The GitHub Copilot domain changed. Sign in again for it to take effect.'), signIn);
|
|
129
|
+
if (action === signIn) {
|
|
130
|
+
this.commandService.executeCommand(copilot_command_contribution_1.CopilotCommands.SIGN_IN.id);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
96
133
|
async initializeModels() {
|
|
97
134
|
const configuredModels = this.preferenceService.get(copilot_preferences_1.COPILOT_MODEL_OVERRIDES_PREF, []);
|
|
98
135
|
if (configuredModels.length > 0) {
|
|
@@ -139,21 +176,12 @@ let CopilotFrontendApplicationContribution = class CopilotFrontendApplicationCon
|
|
|
139
176
|
const models = this.preferenceService.get(copilot_preferences_1.COPILOT_MODEL_OVERRIDES_PREF, []);
|
|
140
177
|
this.manager.createOrUpdateLanguageModels(...models.map((modelId) => this.createCopilotModelDescription(modelId)));
|
|
141
178
|
}
|
|
142
|
-
async notifyTokenMigration() {
|
|
143
|
-
const signIn = core_1.nls.localize('theia/ai/copilot/commands/signIn', 'Sign in to GitHub Copilot');
|
|
144
|
-
const action = await this.messageService.info(core_1.nls.localize('theia/ai/copilot/tokenMigration', 'Your GitHub Copilot session used an outdated authentication method and has been cleared. Please sign in again to access all available models.'), signIn);
|
|
145
|
-
if (action === signIn) {
|
|
146
|
-
this.commandService.executeCommand(copilot_command_contribution_1.CopilotCommands.SIGN_IN.id);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
179
|
createCopilotModelDescription(modelId) {
|
|
150
180
|
const id = `${common_1.COPILOT_PROVIDER_ID}/${modelId}`;
|
|
151
181
|
const maxRetries = this.aiCorePreferences.get(ai_core_preferences_1.PREFERENCE_NAME_MAX_RETRIES) ?? 3;
|
|
152
182
|
return {
|
|
153
183
|
id,
|
|
154
184
|
model: modelId,
|
|
155
|
-
enableStreaming: true,
|
|
156
|
-
supportsStructuredOutput: true,
|
|
157
185
|
maxRetries
|
|
158
186
|
};
|
|
159
187
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/copilot-frontend-application-contribution.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,4DAAkE;AAClE,sCAAqE;AAErE,4EAAwE;AACxE,sCAA2H;AAC3H,
|
|
1
|
+
{"version":3,"file":"copilot-frontend-application-contribution.js","sourceRoot":"","sources":["../../src/browser/copilot-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,CAAC;;iFAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,qCAA4B,CAAC;;uEACoB;AAGtC;IADlB,IAAA,kBAAM,EAAC,uCAAiB,CAAC;;iFAC8B;AAGrC;IADlB,IAAA,kBAAM,EAAC,2BAAkB,CAAC;;2EACwB;AAGhC;IADlB,IAAA,kBAAM,EAAC,gCAAc,CAAC;sCACY,gCAAc;8EAAC;AAG/B;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;;8EAC2B;iDAlBzC,sCAAsC;IADlD,IAAA,sBAAU,GAAE;GACA,sCAAsC,CA4MlD"}
|
|
@@ -3,19 +3,13 @@ export declare const COPILOT_AUTH_SERVICE_PATH = "/services/copilot/auth";
|
|
|
3
3
|
export declare const CopilotAuthService: unique symbol;
|
|
4
4
|
export declare const CopilotAuthServiceClient: unique symbol;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* The device code flow information reported by the Copilot CLI for the UI to display.
|
|
7
7
|
*/
|
|
8
8
|
export interface DeviceCodeResponse {
|
|
9
9
|
/** URL where user should enter the code (e.g., https://github.com/login/device) */
|
|
10
10
|
verification_uri: string;
|
|
11
11
|
/** Code to display to the user (e.g., XXXX-XXXX) */
|
|
12
12
|
user_code: string;
|
|
13
|
-
/** Device code used for polling */
|
|
14
|
-
device_code: string;
|
|
15
|
-
/** Polling interval in seconds */
|
|
16
|
-
interval: number;
|
|
17
|
-
/** Expiration time in seconds */
|
|
18
|
-
expires_in: number;
|
|
19
13
|
}
|
|
20
14
|
/**
|
|
21
15
|
* Current authentication state.
|
|
@@ -27,7 +21,10 @@ export interface CopilotAuthState {
|
|
|
27
21
|
accountLabel?: string;
|
|
28
22
|
/** GitHub Enterprise URL if using enterprise */
|
|
29
23
|
enterpriseUrl?: string;
|
|
30
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* True when the credentials of a previous version were found and discarded, so that the user can
|
|
26
|
+
* be told why they have to sign in again.
|
|
27
|
+
*/
|
|
31
28
|
migrationRequired?: boolean;
|
|
32
29
|
}
|
|
33
30
|
/**
|
|
@@ -37,36 +34,42 @@ export interface CopilotAuthServiceClient {
|
|
|
37
34
|
onAuthStateChanged(state: CopilotAuthState): void;
|
|
38
35
|
}
|
|
39
36
|
/**
|
|
40
|
-
* Service for
|
|
37
|
+
* Service for signing the GitHub Copilot CLI in, which serves all Copilot requests.
|
|
38
|
+
*
|
|
39
|
+
* The sign-in is a device code flow that the CLI runs and polls itself. This service starts it and
|
|
40
|
+
* reports its progress, so that it can be presented like any other device code flow.
|
|
41
41
|
*/
|
|
42
42
|
export interface CopilotAuthService {
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* Tells the backend where the Copilot CLI is, as configured by the user.
|
|
45
|
+
*
|
|
46
|
+
* The CLI is not shipped with the application and has to be found on the machine hosting the
|
|
47
|
+
* backend, which cannot read the preferences of the user itself.
|
|
48
|
+
* @param path Location of the CLI executable, or `undefined` to search for it
|
|
47
49
|
*/
|
|
48
|
-
|
|
50
|
+
setExecutablePath(path: string | undefined): Promise<void>;
|
|
49
51
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @param deviceCode The device code from initiateDeviceFlow
|
|
52
|
-
* @param interval Polling interval in seconds
|
|
52
|
+
* Starts the sign-in and resolves once the code the user has to enter is known.
|
|
53
53
|
* @param enterpriseUrl Optional GitHub Enterprise domain
|
|
54
|
-
* @returns true if authentication succeeded, false if expired/denied
|
|
55
54
|
*/
|
|
56
|
-
|
|
55
|
+
startSignIn(enterpriseUrl?: string): Promise<DeviceCodeResponse>;
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
57
|
+
* Waits for the sign-in started by {@link startSignIn} to complete.
|
|
58
|
+
* @returns true if the sign-in succeeded, false if it was denied or expired
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
waitForSignIn(): Promise<boolean>;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @returns The access token or undefined if not authenticated
|
|
62
|
+
* Aborts a sign-in that is still in progress, if any.
|
|
64
63
|
*/
|
|
65
|
-
|
|
64
|
+
cancelSignIn(): Promise<void>;
|
|
66
65
|
/**
|
|
67
|
-
*
|
|
66
|
+
* Discards the stored credentials of this application.
|
|
68
67
|
*/
|
|
69
68
|
signOut(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Get the current authentication state.
|
|
71
|
+
*/
|
|
72
|
+
getAuthState(): Promise<CopilotAuthState>;
|
|
70
73
|
/**
|
|
71
74
|
* Set the client to receive auth state change notifications.
|
|
72
75
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-auth-service.d.ts","sourceRoot":"","sources":["../../src/common/copilot-auth-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAClE,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,mFAAmF;IACnF,gBAAgB,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"copilot-auth-service.d.ts","sourceRoot":"","sources":["../../src/common/copilot-auth-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAClE,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAE3E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,mFAAmF;IACnF,gBAAgB,EAAE,MAAM,CAAC;IACzB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,wCAAwC;IACxC,eAAe,EAAE,OAAO,CAAC;IACzB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACrD;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3D;;;OAGG;IACH,WAAW,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEjE;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9B;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,GAAG,IAAI,CAAC;IAE9D;;OAEG;IACH,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACxD"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
export declare const COPILOT_LANGUAGE_MODELS_MANAGER_PATH = "/services/copilot/language-model-manager";
|
|
2
2
|
export declare const CopilotLanguageModelsManager: unique symbol;
|
|
3
3
|
export declare const COPILOT_PROVIDER_ID = "copilot";
|
|
4
|
-
export declare const COPILOT_API_BASE_URL = "https://api.githubcopilot.com";
|
|
5
|
-
/**
|
|
6
|
-
* Returns the Copilot API base URL, taking an optional GitHub Enterprise domain into account.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCopilotApiBaseUrl(enterpriseUrl?: string): string;
|
|
9
4
|
export interface CopilotModelDescription {
|
|
10
5
|
/**
|
|
11
6
|
* The identifier of the model which will be shown in the UI.
|
|
@@ -13,17 +8,9 @@ export interface CopilotModelDescription {
|
|
|
13
8
|
*/
|
|
14
9
|
id: string;
|
|
15
10
|
/**
|
|
16
|
-
* The model ID as used by the Copilot API (e.g., 'gpt-
|
|
11
|
+
* The model ID as used by the Copilot API (e.g., 'gpt-5.5', 'claude-sonnet-5').
|
|
17
12
|
*/
|
|
18
13
|
model: string;
|
|
19
|
-
/**
|
|
20
|
-
* Indicate whether the streaming API shall be used.
|
|
21
|
-
*/
|
|
22
|
-
enableStreaming: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Flag to configure whether the model supports structured output.
|
|
25
|
-
*/
|
|
26
|
-
supportsStructuredOutput: boolean;
|
|
27
14
|
/**
|
|
28
15
|
* Maximum number of retry attempts when a request fails.
|
|
29
16
|
*/
|
|
@@ -38,18 +25,13 @@ export interface CopilotLanguageModelsManager {
|
|
|
38
25
|
* Remove language models from the registry.
|
|
39
26
|
*/
|
|
40
27
|
removeLanguageModels(...modelIds: string[]): void;
|
|
41
|
-
/**
|
|
42
|
-
* Set the GitHub Enterprise URL for Copilot API requests.
|
|
43
|
-
*/
|
|
44
|
-
setEnterpriseUrl(url: string | undefined): void;
|
|
45
28
|
/**
|
|
46
29
|
* Refresh the status of all Copilot models (e.g., after authentication state changes).
|
|
47
30
|
*/
|
|
48
31
|
refreshModelsStatus(): Promise<void>;
|
|
49
32
|
/**
|
|
50
|
-
* Fetches the list of available model IDs from the Copilot
|
|
51
|
-
* Requires
|
|
52
|
-
* or if the API call fails.
|
|
33
|
+
* Fetches the list of available model IDs from the Copilot CLI.
|
|
34
|
+
* Requires the CLI to be signed in. Returns an empty array otherwise or if the call fails.
|
|
53
35
|
*/
|
|
54
36
|
fetchAvailableModelIds(): Promise<string[]>;
|
|
55
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-language-models-manager.d.ts","sourceRoot":"","sources":["../../src/common/copilot-language-models-manager.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,oCAAoC,6CAA6C,CAAC;AAC/F,eAAO,MAAM,4BAA4B,eAAyC,CAAC;AAEnF,eAAO,MAAM,mBAAmB,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"copilot-language-models-manager.d.ts","sourceRoot":"","sources":["../../src/common/copilot-language-models-manager.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,oCAAoC,6CAA6C,CAAC;AAC/F,eAAO,MAAM,4BAA4B,eAAyC,CAAC;AAEnF,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,MAAM,WAAW,uBAAuB;IACpC;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,4BAA4B;IACzC;;OAEG;IACH,4BAA4B,CAAC,GAAG,MAAM,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF;;OAEG;IACH,oBAAoB,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClD;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC;;;OAGG;IACH,sBAAsB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC/C"}
|
|
@@ -15,20 +15,8 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
exports.getCopilotApiBaseUrl = getCopilotApiBaseUrl;
|
|
18
|
+
exports.COPILOT_PROVIDER_ID = exports.CopilotLanguageModelsManager = exports.COPILOT_LANGUAGE_MODELS_MANAGER_PATH = void 0;
|
|
20
19
|
exports.COPILOT_LANGUAGE_MODELS_MANAGER_PATH = '/services/copilot/language-model-manager';
|
|
21
20
|
exports.CopilotLanguageModelsManager = Symbol('CopilotLanguageModelsManager');
|
|
22
21
|
exports.COPILOT_PROVIDER_ID = 'copilot';
|
|
23
|
-
exports.COPILOT_API_BASE_URL = 'https://api.githubcopilot.com';
|
|
24
|
-
/**
|
|
25
|
-
* Returns the Copilot API base URL, taking an optional GitHub Enterprise domain into account.
|
|
26
|
-
*/
|
|
27
|
-
function getCopilotApiBaseUrl(enterpriseUrl) {
|
|
28
|
-
if (enterpriseUrl) {
|
|
29
|
-
const domain = enterpriseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '');
|
|
30
|
-
return `https://copilot-api.${domain}`;
|
|
31
|
-
}
|
|
32
|
-
return exports.COPILOT_API_BASE_URL;
|
|
33
|
-
}
|
|
34
22
|
//# sourceMappingURL=copilot-language-models-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-language-models-manager.js","sourceRoot":"","sources":["../../src/common/copilot-language-models-manager.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;;;
|
|
1
|
+
{"version":3,"file":"copilot-language-models-manager.js","sourceRoot":"","sources":["../../src/common/copilot-language-models-manager.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;;;AAEnE,QAAA,oCAAoC,GAAG,0CAA0C,CAAC;AAClF,QAAA,4BAA4B,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAEtE,QAAA,mBAAmB,GAAG,SAAS,CAAC"}
|
|
@@ -2,5 +2,6 @@ import { PreferenceSchema } from '@theia/core';
|
|
|
2
2
|
export declare const COPILOT_ENABLED_PREF = "ai-features.copilot.enabled";
|
|
3
3
|
export declare const COPILOT_MODEL_OVERRIDES_PREF = "ai-features.copilot.modelOverrides";
|
|
4
4
|
export declare const COPILOT_ENTERPRISE_URL_PREF = "ai-features.copilot.enterpriseUrl";
|
|
5
|
+
export declare const COPILOT_EXECUTABLE_PATH_PREF = "ai-features.copilot.executablePath";
|
|
5
6
|
export declare const CopilotPreferencesSchema: PreferenceSchema;
|
|
6
7
|
//# sourceMappingURL=copilot-preferences.d.ts.map
|