@theia/ai-copilot 1.76.0-next.4 → 1.76.0-next.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.
Files changed (150) hide show
  1. package/README.md +86 -14
  2. package/lib/browser/copilot-auth-dialog.d.ts.map +1 -1
  3. package/lib/browser/copilot-auth-dialog.js +12 -4
  4. package/lib/browser/copilot-auth-dialog.js.map +1 -1
  5. package/lib/browser/copilot-frontend-application-contribution.d.ts +15 -1
  6. package/lib/browser/copilot-frontend-application-contribution.d.ts.map +1 -1
  7. package/lib/browser/copilot-frontend-application-contribution.js +52 -24
  8. package/lib/browser/copilot-frontend-application-contribution.js.map +1 -1
  9. package/lib/common/copilot-auth-service.d.ts +27 -24
  10. package/lib/common/copilot-auth-service.d.ts.map +1 -1
  11. package/lib/common/copilot-language-models-manager.d.ts +3 -21
  12. package/lib/common/copilot-language-models-manager.d.ts.map +1 -1
  13. package/lib/common/copilot-language-models-manager.js +1 -13
  14. package/lib/common/copilot-language-models-manager.js.map +1 -1
  15. package/lib/common/copilot-preferences.d.ts +1 -0
  16. package/lib/common/copilot-preferences.d.ts.map +1 -1
  17. package/lib/common/copilot-preferences.js +24 -6
  18. package/lib/common/copilot-preferences.js.map +1 -1
  19. package/lib/common/index.d.ts +0 -1
  20. package/lib/common/index.d.ts.map +1 -1
  21. package/lib/common/index.js +0 -1
  22. package/lib/common/index.js.map +1 -1
  23. package/lib/node/copilot-auth-service-impl.d.ts +25 -16
  24. package/lib/node/copilot-auth-service-impl.d.ts.map +1 -1
  25. package/lib/node/copilot-auth-service-impl.js +67 -183
  26. package/lib/node/copilot-auth-service-impl.js.map +1 -1
  27. package/lib/node/copilot-auth-service-impl.spec.js +104 -168
  28. package/lib/node/copilot-auth-service-impl.spec.js.map +1 -1
  29. package/lib/node/copilot-backend-module.d.ts.map +1 -1
  30. package/lib/node/copilot-backend-module.js +10 -2
  31. package/lib/node/copilot-backend-module.js.map +1 -1
  32. package/lib/node/copilot-cli-auth-provider.d.ts +146 -0
  33. package/lib/node/copilot-cli-auth-provider.d.ts.map +1 -0
  34. package/lib/node/copilot-cli-auth-provider.js +430 -0
  35. package/lib/node/copilot-cli-auth-provider.js.map +1 -0
  36. package/lib/node/copilot-cli-auth-provider.spec.d.ts +2 -0
  37. package/lib/node/copilot-cli-auth-provider.spec.d.ts.map +1 -0
  38. package/lib/node/copilot-cli-auth-provider.spec.js +249 -0
  39. package/lib/node/copilot-cli-auth-provider.spec.js.map +1 -0
  40. package/lib/node/copilot-cli-locator.d.ts +120 -0
  41. package/lib/node/copilot-cli-locator.d.ts.map +1 -0
  42. package/lib/node/copilot-cli-locator.js +348 -0
  43. package/lib/node/copilot-cli-locator.js.map +1 -0
  44. package/lib/node/copilot-cli-locator.spec.d.ts +2 -0
  45. package/lib/node/copilot-cli-locator.spec.d.ts.map +1 -0
  46. package/lib/node/copilot-cli-locator.spec.js +327 -0
  47. package/lib/node/copilot-cli-locator.spec.js.map +1 -0
  48. package/lib/node/copilot-credential-store.d.ts +45 -0
  49. package/lib/node/copilot-credential-store.d.ts.map +1 -0
  50. package/lib/node/copilot-credential-store.js +96 -0
  51. package/lib/node/copilot-credential-store.js.map +1 -0
  52. package/lib/node/copilot-credential-store.spec.d.ts +2 -0
  53. package/lib/node/copilot-credential-store.spec.d.ts.map +1 -0
  54. package/lib/node/copilot-credential-store.spec.js +93 -0
  55. package/lib/node/copilot-credential-store.spec.js.map +1 -0
  56. package/lib/node/copilot-language-models-manager-impl.d.ts +20 -18
  57. package/lib/node/copilot-language-models-manager-impl.d.ts.map +1 -1
  58. package/lib/node/copilot-language-models-manager-impl.js +39 -67
  59. package/lib/node/copilot-language-models-manager-impl.js.map +1 -1
  60. package/lib/node/copilot-language-models-manager-impl.spec.d.ts +2 -0
  61. package/lib/node/copilot-language-models-manager-impl.spec.d.ts.map +1 -0
  62. package/lib/node/copilot-language-models-manager-impl.spec.js +119 -0
  63. package/lib/node/copilot-language-models-manager-impl.spec.js.map +1 -0
  64. package/lib/node/copilot-runtime-env.d.ts +20 -0
  65. package/lib/node/copilot-runtime-env.d.ts.map +1 -0
  66. package/lib/node/copilot-runtime-env.js +49 -0
  67. package/lib/node/copilot-runtime-env.js.map +1 -0
  68. package/lib/node/copilot-sdk-client-provider.d.ts +103 -0
  69. package/lib/node/copilot-sdk-client-provider.d.ts.map +1 -0
  70. package/lib/node/copilot-sdk-client-provider.js +247 -0
  71. package/lib/node/copilot-sdk-client-provider.js.map +1 -0
  72. package/lib/node/copilot-sdk-client-provider.spec.d.ts +2 -0
  73. package/lib/node/copilot-sdk-client-provider.spec.d.ts.map +1 -0
  74. package/lib/node/copilot-sdk-client-provider.spec.js +215 -0
  75. package/lib/node/copilot-sdk-client-provider.spec.js.map +1 -0
  76. package/lib/node/copilot-sdk-language-model.d.ts +85 -0
  77. package/lib/node/copilot-sdk-language-model.d.ts.map +1 -0
  78. package/lib/node/copilot-sdk-language-model.js +301 -0
  79. package/lib/node/copilot-sdk-language-model.js.map +1 -0
  80. package/lib/node/copilot-sdk-language-model.spec.d.ts +2 -0
  81. package/lib/node/copilot-sdk-language-model.spec.d.ts.map +1 -0
  82. package/lib/node/copilot-sdk-language-model.spec.js +302 -0
  83. package/lib/node/copilot-sdk-language-model.spec.js.map +1 -0
  84. package/lib/node/copilot-sdk-loader.d.ts +57 -0
  85. package/lib/node/copilot-sdk-loader.d.ts.map +1 -0
  86. package/lib/node/copilot-sdk-loader.js +133 -0
  87. package/lib/node/copilot-sdk-loader.js.map +1 -0
  88. package/lib/node/copilot-sdk-loader.spec.d.ts +2 -0
  89. package/lib/node/copilot-sdk-loader.spec.d.ts.map +1 -0
  90. package/lib/node/copilot-sdk-loader.spec.js +113 -0
  91. package/lib/node/copilot-sdk-loader.spec.js.map +1 -0
  92. package/lib/node/copilot-sdk-mappers.d.ts +49 -0
  93. package/lib/node/copilot-sdk-mappers.d.ts.map +1 -0
  94. package/lib/node/copilot-sdk-mappers.js +147 -0
  95. package/lib/node/copilot-sdk-mappers.js.map +1 -0
  96. package/lib/node/copilot-sdk-mappers.spec.d.ts +2 -0
  97. package/lib/node/copilot-sdk-mappers.spec.d.ts.map +1 -0
  98. package/lib/node/copilot-sdk-mappers.spec.js +133 -0
  99. package/lib/node/copilot-sdk-mappers.spec.js.map +1 -0
  100. package/lib/node/copilot-sdk-types.d.ts +198 -0
  101. package/lib/node/copilot-sdk-types.d.ts.map +1 -0
  102. package/lib/{common/copilot-oauth-config.js → node/copilot-sdk-types.js} +2 -13
  103. package/lib/node/copilot-sdk-types.js.map +1 -0
  104. package/lib/node/index.d.ts +9 -1
  105. package/lib/node/index.d.ts.map +1 -1
  106. package/lib/node/index.js +9 -1
  107. package/lib/node/index.js.map +1 -1
  108. package/package.json +4 -6
  109. package/src/browser/copilot-auth-dialog.tsx +12 -8
  110. package/src/browser/copilot-frontend-application-contribution.ts +62 -29
  111. package/src/common/copilot-auth-service.ts +28 -24
  112. package/src/common/copilot-language-models-manager.ts +3 -28
  113. package/src/common/copilot-preferences.ts +24 -5
  114. package/src/common/index.ts +0 -1
  115. package/src/node/copilot-auth-service-impl.spec.ts +122 -207
  116. package/src/node/copilot-auth-service-impl.ts +63 -218
  117. package/src/node/copilot-backend-module.ts +11 -2
  118. package/src/node/copilot-cli-auth-provider.spec.ts +315 -0
  119. package/src/node/copilot-cli-auth-provider.ts +444 -0
  120. package/src/node/copilot-cli-locator.spec.ts +386 -0
  121. package/src/node/copilot-cli-locator.ts +363 -0
  122. package/src/node/copilot-credential-store.spec.ts +106 -0
  123. package/src/node/copilot-credential-store.ts +99 -0
  124. package/src/node/copilot-language-models-manager-impl.spec.ts +137 -0
  125. package/src/node/copilot-language-models-manager-impl.ts +51 -85
  126. package/src/node/copilot-runtime-env.ts +46 -0
  127. package/src/node/copilot-sdk-client-provider.spec.ts +253 -0
  128. package/src/node/copilot-sdk-client-provider.ts +241 -0
  129. package/src/node/copilot-sdk-language-model.spec.ts +363 -0
  130. package/src/node/copilot-sdk-language-model.ts +329 -0
  131. package/src/node/copilot-sdk-loader.spec.ts +126 -0
  132. package/src/node/copilot-sdk-loader.ts +142 -0
  133. package/src/node/copilot-sdk-mappers.spec.ts +151 -0
  134. package/src/node/copilot-sdk-mappers.ts +161 -0
  135. package/src/node/copilot-sdk-types.ts +276 -0
  136. package/src/node/index.ts +9 -1
  137. package/lib/common/copilot-oauth-config.d.ts +0 -33
  138. package/lib/common/copilot-oauth-config.d.ts.map +0 -1
  139. package/lib/common/copilot-oauth-config.js.map +0 -1
  140. package/lib/node/copilot-language-model.d.ts +0 -34
  141. package/lib/node/copilot-language-model.d.ts.map +0 -1
  142. package/lib/node/copilot-language-model.js +0 -236
  143. package/lib/node/copilot-language-model.js.map +0 -1
  144. package/lib/node/copilot-language-model.spec.d.ts +0 -2
  145. package/lib/node/copilot-language-model.spec.d.ts.map +0 -1
  146. package/lib/node/copilot-language-model.spec.js +0 -89
  147. package/lib/node/copilot-language-model.spec.js.map +0 -1
  148. package/src/common/copilot-oauth-config.ts +0 -55
  149. package/src/node/copilot-language-model.spec.ts +0 -106
  150. package/src/node/copilot-language-model.ts +0 -273
@@ -0,0 +1,430 @@
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
+ exports.CopilotCliAuthProvider = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const child_process_1 = require("child_process");
21
+ const fs_1 = require("fs");
22
+ const os = require("os");
23
+ const path_1 = require("path");
24
+ const inversify_1 = require("@theia/core/shared/inversify");
25
+ const promise_util_1 = require("@theia/core/lib/common/promise-util");
26
+ const core_1 = require("@theia/core");
27
+ const copilot_cli_locator_1 = require("./copilot-cli-locator");
28
+ const copilot_credential_store_1 = require("./copilot-credential-store");
29
+ const copilot_runtime_env_1 = require("./copilot-runtime-env");
30
+ const copilot_sdk_client_provider_1 = require("./copilot-sdk-client-provider");
31
+ /**
32
+ * Time after which a login that never reports a code is given up on.
33
+ */
34
+ const LOGIN_CODE_TIMEOUT_MS = 30_000;
35
+ /**
36
+ * Shape of the GitHub tokens the CLI persists, used to recognize one in the files it wrote.
37
+ */
38
+ const TOKEN_PATTERN = /\bgh[a-z]_[A-Za-z0-9_]{16,}\b/;
39
+ /**
40
+ * Upper bound for the files inspected for the token, so that a stray large file is not read.
41
+ */
42
+ const MAX_INSPECTED_FILE_BYTES = 1024 * 1024;
43
+ /**
44
+ * Authentication against GitHub Copilot, performed by the official Copilot CLI on our behalf.
45
+ *
46
+ * Access to the Copilot features is granted per OAuth application and the built-in Theia OAuth app
47
+ * is not entitled for them, whereas the Copilot CLI is. This provider therefore does not run an
48
+ * OAuth flow of its own but drives `copilot login --device-code` and reports its progress, so that
49
+ * the familiar sign-in dialog can be used.
50
+ *
51
+ * The credentials end up owned by this application rather than by the CLI: the login is run against
52
+ * a private, temporary Copilot home with the system keychain disabled, so that the CLI writes its
53
+ * token there instead of into the user's keyring. The token is then moved into
54
+ * {@link CopilotCredentialStore} and the temporary home is removed. Signing out consequently only
55
+ * has to delete our own entry, and never touches credentials of the user's machine such as their
56
+ * keyring entries or their GitHub CLI sign-in.
57
+ */
58
+ let CopilotCliAuthProvider = class CopilotCliAuthProvider {
59
+ /**
60
+ * Stops a sign-in that is still in progress when the connection this provider belongs to closes.
61
+ * Unbinding a container runs `@preDestroy` rather than `dispose`, matching the client provider.
62
+ * Without this, the `copilot login` child process and the temporary home holding its token would
63
+ * be left behind.
64
+ */
65
+ stop() {
66
+ this.cancelLogin().catch(error => this.logger.warn('Copilot: failed to cancel the sign-in on shutdown:', error));
67
+ }
68
+ /**
69
+ * Starts `copilot login --device-code` and resolves once it reported the code the user has to
70
+ * enter. The process keeps running and polls GitHub itself until {@link waitForLogin} is awaited.
71
+ */
72
+ async startLogin(enterpriseUrl) {
73
+ await this.cancelLogin();
74
+ this.loginAccountLabel = undefined;
75
+ const args = ['login', '--device-code'];
76
+ if (enterpriseUrl) {
77
+ args.push('--host', this.toHostUrl(enterpriseUrl));
78
+ }
79
+ // Resolved before anything is written, so that a missing CLI does not leave a directory behind.
80
+ const cli = await this.cliLocator.resolve();
81
+ const home = await this.createLoginHome();
82
+ const noopBrowser = await this.createNoopBrowser(home);
83
+ this.loginHome = home;
84
+ this.loginEnterpriseUrl = enterpriseUrl;
85
+ // The device code flow is requested explicitly so that the CLI reports a code for the dialog
86
+ // instead of opening a browser on the backend host, which is not where the user is sitting.
87
+ const child = (0, child_process_1.spawn)(cli, args, {
88
+ stdio: ['ignore', 'pipe', 'pipe'],
89
+ env: this.createLoginEnv(home, noopBrowser)
90
+ });
91
+ this.loginProcess = child;
92
+ const result = new promise_util_1.Deferred();
93
+ this.loginResult = result;
94
+ // The outcome may settle before anyone awaits it, e.g. when the authorization is denied while
95
+ // the dialog still shows the code. Observe it here so that such a rejection is never unhandled;
96
+ // `waitForLogin` still sees the outcome through its own await of the same promise.
97
+ result.promise.catch(() => { });
98
+ const code = new promise_util_1.Deferred();
99
+ let output = '';
100
+ const onOutput = (chunk) => {
101
+ output += String(chunk);
102
+ const parsed = this.parseDeviceCode(output);
103
+ if (parsed) {
104
+ code.resolve(parsed);
105
+ }
106
+ this.loginAccountLabel = this.parseAccountLabel(output) ?? this.loginAccountLabel;
107
+ };
108
+ child.stdout?.on('data', onOutput);
109
+ child.stderr?.on('data', onOutput);
110
+ // A login that was given up on has no one waiting for its outcome anymore, and rejecting it
111
+ // would surface as an unhandled rejection. Only the login that is still the current one is
112
+ // reported to, because that is the one `waitForLogin` can be awaiting.
113
+ const rejectResult = (error) => {
114
+ if (this.loginResult === result) {
115
+ result.reject(error);
116
+ }
117
+ };
118
+ child.on('error', error => {
119
+ code.reject(error);
120
+ rejectResult(error);
121
+ });
122
+ child.on('close', exitCode => {
123
+ if (this.loginProcess === child) {
124
+ this.loginProcess = undefined;
125
+ }
126
+ if (exitCode === 0) {
127
+ code.reject(new Error('The Copilot CLI finished before reporting a device code.'));
128
+ result.resolve(true);
129
+ }
130
+ else {
131
+ const message = this.extractFailure(output) ?? `The Copilot CLI login exited with code ${exitCode}.`;
132
+ code.reject(new Error(message));
133
+ rejectResult(new Error(message));
134
+ }
135
+ });
136
+ const timeout = setTimeout(() => code.reject(new Error('Timed out waiting for the Copilot CLI to report a device code.')), LOGIN_CODE_TIMEOUT_MS);
137
+ try {
138
+ return await code.promise;
139
+ }
140
+ catch (error) {
141
+ await this.cancelLogin();
142
+ throw error;
143
+ }
144
+ finally {
145
+ clearTimeout(timeout);
146
+ }
147
+ }
148
+ /**
149
+ * Waits for the login started by {@link startLogin} to complete.
150
+ * Resolves `false` when the authorization was denied or expired.
151
+ */
152
+ async waitForLogin() {
153
+ const result = this.loginResult;
154
+ const home = this.loginHome;
155
+ if (!result || !home) {
156
+ throw new Error(core_1.nls.localize('theia/ai/copilot/noLoginInProgress', 'No Copilot CLI login is in progress. Please start the sign-in again.'));
157
+ }
158
+ try {
159
+ if (!await result.promise) {
160
+ return false;
161
+ }
162
+ await this.storeCredentials(home);
163
+ return true;
164
+ }
165
+ finally {
166
+ this.loginResult = undefined;
167
+ this.loginHome = undefined;
168
+ // The token was moved into our own store, so the plain copy must not linger.
169
+ await this.removeLoginHome(home);
170
+ // The runtime caches the credentials it started with, so pick up the new ones.
171
+ await this.sdkClientProvider.reset();
172
+ }
173
+ }
174
+ /**
175
+ * Moves the token the CLI just persisted into our own credential store.
176
+ */
177
+ async storeCredentials(home) {
178
+ const token = await this.findStoredToken(home);
179
+ if (!token) {
180
+ throw new Error(core_1.nls.localize('theia/ai/copilot/tokenNotPersisted', 'The Copilot CLI reported a successful sign-in but did not persist a token where it was expected. '
181
+ + 'This can happen when the Copilot CLI changes how it stores credentials.'));
182
+ }
183
+ await this.credentialStore.set({
184
+ token,
185
+ accountLabel: this.loginAccountLabel,
186
+ enterpriseUrl: this.loginEnterpriseUrl
187
+ });
188
+ }
189
+ /**
190
+ * Terminates a login that is still in progress, if any.
191
+ *
192
+ * Resolves once the token the CLI may already have written has been removed again, so that a
193
+ * caller which cancels a sign-in can rely on nothing being left behind in plain text.
194
+ */
195
+ async cancelLogin() {
196
+ // Settle a login that may be awaited in `waitForLogin`, so that closing the dialog while it is
197
+ // still polling does not leave that request pending for the rest of the session.
198
+ this.loginResult?.resolve(false);
199
+ this.loginResult = undefined;
200
+ // Killing an already exited process is a no-op, so the state does not have to be tracked.
201
+ this.loginProcess?.kill();
202
+ this.loginProcess = undefined;
203
+ const home = this.loginHome;
204
+ this.loginHome = undefined;
205
+ if (home) {
206
+ await this.removeLoginHome(home);
207
+ }
208
+ }
209
+ /**
210
+ * Reports whether this application holds Copilot credentials.
211
+ *
212
+ * Deliberately based on our own store rather than on what the Copilot CLI reports: the CLI also
213
+ * accepts a token from the environment or the sign-in of the GitHub CLI, and neither of those is
214
+ * a sign-in of this application, so neither may make it appear signed in.
215
+ */
216
+ async getAuthState() {
217
+ const credentials = await this.credentialStore.get();
218
+ if (!credentials) {
219
+ return { isAuthenticated: false };
220
+ }
221
+ return {
222
+ isAuthenticated: true,
223
+ accountLabel: credentials.accountLabel,
224
+ enterpriseUrl: credentials.enterpriseUrl
225
+ };
226
+ }
227
+ /**
228
+ * Discards the credentials of this application. Nothing outside of it is touched.
229
+ */
230
+ async signOut() {
231
+ await this.cancelLogin();
232
+ await this.credentialStore.delete();
233
+ await this.sdkClientProvider.reset();
234
+ }
235
+ /**
236
+ * Creates the private Copilot home the login is run against.
237
+ */
238
+ async createLoginHome() {
239
+ const home = await fs_1.promises.mkdtemp((0, path_1.join)(os.tmpdir(), 'theia-copilot-login-'));
240
+ // With the keychain disabled, the CLI only persists the token when it is allowed to write it
241
+ // plainly. It lands in this private directory and is removed again right after it was taken over.
242
+ await fs_1.promises.writeFile((0, path_1.join)(home, 'settings.json'), JSON.stringify({ storeTokenPlaintext: true }, undefined, 2), 'utf8');
243
+ return home;
244
+ }
245
+ /**
246
+ * Writes the opener the CLI is pointed at instead of a real browser, and returns its path.
247
+ *
248
+ * The CLI opens a browser whenever it believes one is available, even for the device code flow, and
249
+ * prefers the command in `BROWSER` over the opener of the platform. Pointing it at a script that
250
+ * does nothing is therefore the reliable way to keep the flow in the dialog, where the user can read
251
+ * and copy the code. Opening a browser would also be wrong whenever the backend does not run on the
252
+ * user's own machine.
253
+ */
254
+ async createNoopBrowser(home) {
255
+ if (process.platform === 'win32') {
256
+ const batch = (0, path_1.join)(home, 'no-browser.cmd');
257
+ await fs_1.promises.writeFile(batch, '@exit /b 0\r\n', 'utf8');
258
+ return batch;
259
+ }
260
+ const shell = (0, path_1.join)(home, 'no-browser.sh');
261
+ await fs_1.promises.writeFile(shell, '#!/bin/sh\nexit 0\n', { encoding: 'utf8', mode: 0o755 });
262
+ return shell;
263
+ }
264
+ /**
265
+ * Removes the private Copilot home, including the token the CLI wrote into it.
266
+ */
267
+ async removeLoginHome(home) {
268
+ try {
269
+ await fs_1.promises.rm(home, { recursive: true, force: true });
270
+ }
271
+ catch (error) {
272
+ this.logger.warn(`Copilot: failed to remove the temporary sign-in directory ${home}:`, error);
273
+ }
274
+ }
275
+ /**
276
+ * Builds the environment for the login process.
277
+ *
278
+ * The CLI is pointed at a private home and its use of the system keychain is disabled, so that
279
+ * it persists the token where we can take it over instead of in the keyring of the user. Tokens
280
+ * from the environment are removed so that a sign-in always establishes fresh credentials rather
281
+ * than silently succeeding with something the user configured elsewhere.
282
+ */
283
+ createLoginEnv(home, noopBrowser) {
284
+ return {
285
+ ...copilot_runtime_env_1.CopilotRuntimeEnv.withoutTokens(process.env),
286
+ COPILOT_HOME: home,
287
+ COPILOT_DISABLE_KEYTAR: '1',
288
+ // Keep the flow in the dialog, see createNoopBrowser. The display variables are dropped as
289
+ // well so that nothing can open a window even if the opener were ignored.
290
+ BROWSER: noopBrowser,
291
+ DISPLAY: undefined,
292
+ WAYLAND_DISPLAY: undefined
293
+ };
294
+ }
295
+ /**
296
+ * Searches the configuration the CLI wrote in its private home for the persisted token.
297
+ *
298
+ * The file and the field the CLI uses are not part of its public interface, so every JSON file it
299
+ * wrote is searched for a value shaped like a GitHub token rather than relying on a fixed layout.
300
+ */
301
+ async findStoredToken(home) {
302
+ for (const file of await this.listCandidateFiles(home)) {
303
+ try {
304
+ // Checked before reading, so that a stray large file is never held in memory.
305
+ if ((await fs_1.promises.stat(file)).size > MAX_INSPECTED_FILE_BYTES) {
306
+ continue;
307
+ }
308
+ const token = this.findTokenInText(await fs_1.promises.readFile(file, 'utf8'));
309
+ if (token) {
310
+ return token;
311
+ }
312
+ }
313
+ catch (error) {
314
+ this.logger.warn(`Copilot: failed to inspect ${file} for the persisted token:`, error);
315
+ }
316
+ }
317
+ return undefined;
318
+ }
319
+ /**
320
+ * The files of the private home that are inspected for the token.
321
+ *
322
+ * The logs are skipped, and the configuration the CLI writes is not plain JSON but carries
323
+ * comments, so the files are searched as text rather than parsed.
324
+ */
325
+ async listCandidateFiles(home) {
326
+ try {
327
+ const entries = await fs_1.promises.readdir(home, { withFileTypes: true });
328
+ return entries
329
+ .filter(entry => entry.isFile() && entry.name !== 'settings.json' && !entry.name.startsWith('no-browser.'))
330
+ .map(entry => (0, path_1.join)(home, entry.name));
331
+ }
332
+ catch (error) {
333
+ this.logger.warn(`Copilot: failed to list ${home}:`, error);
334
+ return [];
335
+ }
336
+ }
337
+ /**
338
+ * Searches text for a value shaped like a GitHub token.
339
+ *
340
+ * Only the files the CLI wrote into the private home of this sign-in are searched, so anything
341
+ * shaped like a token in them is the token that was just obtained.
342
+ */
343
+ findTokenInText(text) {
344
+ return text.match(TOKEN_PATTERN)?.[0];
345
+ }
346
+ /**
347
+ * Extracts the login the CLI reported for the account that signed in, if it reported one.
348
+ */
349
+ parseAccountLabel(output) {
350
+ return output.match(/Signed in successfully as\s+([^\s.]+)/)?.[1];
351
+ }
352
+ /**
353
+ * Extracts the verification URL and the user code from the output of the CLI.
354
+ * Returns `undefined` while the output does not contain both yet.
355
+ */
356
+ parseDeviceCode(output) {
357
+ const url = output.match(/https?:\/\/\S*\/login\/device\b/)?.[0];
358
+ const userCode = output.match(/\b([A-Z0-9]{4}-[A-Z0-9]{4})\b/)?.[1];
359
+ if (!url || !userCode) {
360
+ return undefined;
361
+ }
362
+ return {
363
+ verification_uri: url,
364
+ user_code: userCode
365
+ };
366
+ }
367
+ /**
368
+ * Describes why a login failed, based on what the CLI reported.
369
+ *
370
+ * A line that names the problem is preferred, and the tail of the output is used otherwise, since
371
+ * the wording of the CLI is not stable enough to rely on and a bare exit code is not diagnosable.
372
+ */
373
+ extractFailure(output) {
374
+ const lines = output.split('\n').map(entry => entry.trim())
375
+ // The CLI reports a failure to copy the code to the clipboard even on a healthy login,
376
+ // which must not be mistaken for the reason a login failed.
377
+ .filter(entry => entry.length > 0 && !/clipboard/i.test(entry));
378
+ const reported = [...lines].reverse().find(entry => /error|denied|failed|unauthorized|policy/i.test(entry));
379
+ if (reported) {
380
+ return reported;
381
+ }
382
+ const tail = lines.slice(-3).join(' ');
383
+ return tail.length > 0 ? `The Copilot CLI login failed: ${tail}` : undefined;
384
+ }
385
+ /**
386
+ * Turns the configured GitHub Enterprise deployment into the URL the CLI is pointed at.
387
+ *
388
+ * A bare domain is the expected form and gets a scheme. Plain HTTP is upgraded rather than passed
389
+ * on: the sign-in carries credentials, and a host that only matched "http" at the start of its
390
+ * name, such as `httpbin.example.com`, must not be mistaken for a URL that already has a scheme.
391
+ */
392
+ toHostUrl(enterpriseUrl) {
393
+ const url = enterpriseUrl.trim();
394
+ if (/^https:\/\//i.test(url)) {
395
+ return url;
396
+ }
397
+ if (/^http:\/\//i.test(url)) {
398
+ return url.replace(/^http:\/\//i, 'https://');
399
+ }
400
+ return `https://${url}`;
401
+ }
402
+ };
403
+ exports.CopilotCliAuthProvider = CopilotCliAuthProvider;
404
+ tslib_1.__decorate([
405
+ (0, inversify_1.inject)(copilot_sdk_client_provider_1.CopilotSdkClientProvider),
406
+ tslib_1.__metadata("design:type", copilot_sdk_client_provider_1.CopilotSdkClientProvider)
407
+ ], CopilotCliAuthProvider.prototype, "sdkClientProvider", void 0);
408
+ tslib_1.__decorate([
409
+ (0, inversify_1.inject)(copilot_cli_locator_1.CopilotCliLocator),
410
+ tslib_1.__metadata("design:type", copilot_cli_locator_1.CopilotCliLocator)
411
+ ], CopilotCliAuthProvider.prototype, "cliLocator", void 0);
412
+ tslib_1.__decorate([
413
+ (0, inversify_1.inject)(copilot_credential_store_1.CopilotCredentialStore),
414
+ tslib_1.__metadata("design:type", copilot_credential_store_1.CopilotCredentialStore)
415
+ ], CopilotCliAuthProvider.prototype, "credentialStore", void 0);
416
+ tslib_1.__decorate([
417
+ (0, inversify_1.inject)(core_1.ILogger),
418
+ (0, inversify_1.named)('ai-copilot:CopilotCliAuthProvider'),
419
+ tslib_1.__metadata("design:type", Object)
420
+ ], CopilotCliAuthProvider.prototype, "logger", void 0);
421
+ tslib_1.__decorate([
422
+ (0, inversify_1.preDestroy)(),
423
+ tslib_1.__metadata("design:type", Function),
424
+ tslib_1.__metadata("design:paramtypes", []),
425
+ tslib_1.__metadata("design:returntype", void 0)
426
+ ], CopilotCliAuthProvider.prototype, "stop", null);
427
+ exports.CopilotCliAuthProvider = CopilotCliAuthProvider = tslib_1.__decorate([
428
+ (0, inversify_1.injectable)()
429
+ ], CopilotCliAuthProvider);
430
+ //# sourceMappingURL=copilot-cli-auth-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-cli-auth-provider.js","sourceRoot":"","sources":["../../src/node/copilot-cli-auth-provider.ts"],"names":[],"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EAAC,uCAAiB,CAAC;sCACK,uCAAiB;0DAAC;AAG9B;IADlB,IAAA,kBAAM,EAAC,iDAAsB,CAAC;sCACK,iDAAsB;+DAAC;AAGxC;IADlB,IAAA,kBAAM,EAAC,cAAO,CAAC;IAAE,IAAA,iBAAK,EAAC,mCAAmC,CAAC;;sDACzB;AAezB;IADT,IAAA,sBAAU,GAAE;;;;kDAGZ;iCA7BQ,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CA+XlC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=copilot-cli-auth-provider.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-cli-auth-provider.spec.d.ts","sourceRoot":"","sources":["../../src/node/copilot-cli-auth-provider.spec.ts"],"names":[],"mappings":""}