@theia/ai-copilot 1.77.0-next.95 → 1.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/lib/browser/copilot-auth-dialog-messages.js +7 -10
  2. package/lib/browser/copilot-auth-dialog-messages.js.map +1 -1
  3. package/lib/browser/copilot-auth-dialog.d.ts +2 -2
  4. package/lib/browser/copilot-auth-dialog.d.ts.map +1 -1
  5. package/lib/browser/copilot-auth-dialog.js +43 -55
  6. package/lib/browser/copilot-auth-dialog.js.map +1 -1
  7. package/lib/browser/copilot-command-contribution.d.ts +2 -2
  8. package/lib/browser/copilot-command-contribution.d.ts.map +1 -1
  9. package/lib/browser/copilot-command-contribution.js +35 -46
  10. package/lib/browser/copilot-command-contribution.js.map +1 -1
  11. package/lib/browser/copilot-frontend-application-contribution.d.ts +1 -1
  12. package/lib/browser/copilot-frontend-application-contribution.d.ts.map +1 -1
  13. package/lib/browser/copilot-frontend-application-contribution.js +61 -71
  14. package/lib/browser/copilot-frontend-application-contribution.js.map +1 -1
  15. package/lib/browser/copilot-frontend-module.js +31 -33
  16. package/lib/browser/copilot-frontend-module.js.map +1 -1
  17. package/lib/browser/copilot-status-bar-contribution.d.ts +1 -1
  18. package/lib/browser/copilot-status-bar-contribution.d.ts.map +1 -1
  19. package/lib/browser/copilot-status-bar-contribution.js +30 -40
  20. package/lib/browser/copilot-status-bar-contribution.js.map +1 -1
  21. package/lib/browser/index.d.ts +5 -5
  22. package/lib/browser/index.d.ts.map +1 -1
  23. package/lib/browser/index.js +5 -8
  24. package/lib/browser/index.js.map +1 -1
  25. package/lib/common/copilot-auth-service.js +3 -6
  26. package/lib/common/copilot-auth-service.js.map +1 -1
  27. package/lib/common/copilot-language-models-manager.js +3 -6
  28. package/lib/common/copilot-language-models-manager.js.map +1 -1
  29. package/lib/common/copilot-preferences.js +20 -23
  30. package/lib/common/copilot-preferences.js.map +1 -1
  31. package/lib/common/index.d.ts +3 -3
  32. package/lib/common/index.d.ts.map +1 -1
  33. package/lib/common/index.js +3 -6
  34. package/lib/common/index.js.map +1 -1
  35. package/lib/node/copilot-auth-service-impl.d.ts +4 -4
  36. package/lib/node/copilot-auth-service-impl.d.ts.map +1 -1
  37. package/lib/node/copilot-auth-service-impl.js +21 -31
  38. package/lib/node/copilot-auth-service-impl.js.map +1 -1
  39. package/lib/node/copilot-auth-service-impl.spec.js +17 -19
  40. package/lib/node/copilot-auth-service-impl.spec.js.map +1 -1
  41. package/lib/node/copilot-backend-module.js +26 -28
  42. package/lib/node/copilot-backend-module.js.map +1 -1
  43. package/lib/node/copilot-cli-auth-provider.d.ts +4 -4
  44. package/lib/node/copilot-cli-auth-provider.d.ts.map +1 -1
  45. package/lib/node/copilot-cli-auth-provider.js +43 -53
  46. package/lib/node/copilot-cli-auth-provider.js.map +1 -1
  47. package/lib/node/copilot-cli-auth-provider.spec.js +60 -63
  48. package/lib/node/copilot-cli-auth-provider.spec.js.map +1 -1
  49. package/lib/node/copilot-cli-locator.js +34 -38
  50. package/lib/node/copilot-cli-locator.js.map +1 -1
  51. package/lib/node/copilot-cli-locator.spec.js +90 -93
  52. package/lib/node/copilot-cli-locator.spec.js.map +1 -1
  53. package/lib/node/copilot-credential-store.js +12 -17
  54. package/lib/node/copilot-credential-store.js.map +1 -1
  55. package/lib/node/copilot-credential-store.spec.js +16 -18
  56. package/lib/node/copilot-credential-store.spec.js.map +1 -1
  57. package/lib/node/copilot-language-models-manager-impl.d.ts +3 -3
  58. package/lib/node/copilot-language-models-manager-impl.d.ts.map +1 -1
  59. package/lib/node/copilot-language-models-manager-impl.js +31 -44
  60. package/lib/node/copilot-language-models-manager-impl.js.map +1 -1
  61. package/lib/node/copilot-language-models-manager-impl.spec.js +29 -31
  62. package/lib/node/copilot-language-models-manager-impl.spec.js.map +1 -1
  63. package/lib/node/copilot-runtime-env.js +2 -5
  64. package/lib/node/copilot-runtime-env.js.map +1 -1
  65. package/lib/node/copilot-sdk-client-provider.d.ts +4 -4
  66. package/lib/node/copilot-sdk-client-provider.d.ts.map +1 -1
  67. package/lib/node/copilot-sdk-client-provider.js +35 -46
  68. package/lib/node/copilot-sdk-client-provider.js.map +1 -1
  69. package/lib/node/copilot-sdk-client-provider.spec.js +43 -46
  70. package/lib/node/copilot-sdk-client-provider.spec.js.map +1 -1
  71. package/lib/node/copilot-sdk-language-model.d.ts +1 -1
  72. package/lib/node/copilot-sdk-language-model.d.ts.map +1 -1
  73. package/lib/node/copilot-sdk-language-model.js +9 -15
  74. package/lib/node/copilot-sdk-language-model.js.map +1 -1
  75. package/lib/node/copilot-sdk-language-model.spec.js +54 -56
  76. package/lib/node/copilot-sdk-language-model.spec.js.map +1 -1
  77. package/lib/node/copilot-sdk-loader.d.ts +2 -2
  78. package/lib/node/copilot-sdk-loader.d.ts.map +1 -1
  79. package/lib/node/copilot-sdk-loader.js +19 -24
  80. package/lib/node/copilot-sdk-loader.js.map +1 -1
  81. package/lib/node/copilot-sdk-loader.spec.js +22 -24
  82. package/lib/node/copilot-sdk-loader.spec.js.map +1 -1
  83. package/lib/node/copilot-sdk-mappers.d.ts +1 -1
  84. package/lib/node/copilot-sdk-mappers.d.ts.map +1 -1
  85. package/lib/node/copilot-sdk-mappers.js +11 -16
  86. package/lib/node/copilot-sdk-mappers.js.map +1 -1
  87. package/lib/node/copilot-sdk-mappers.spec.js +45 -47
  88. package/lib/node/copilot-sdk-mappers.spec.js.map +1 -1
  89. package/lib/node/copilot-sdk-types.js +1 -2
  90. package/lib/node/copilot-sdk-types.js.map +1 -1
  91. package/lib/node/index.d.ts +11 -11
  92. package/lib/node/index.d.ts.map +1 -1
  93. package/lib/node/index.js +11 -14
  94. package/lib/node/index.js.map +1 -1
  95. package/lib/package.spec.d.ts +1 -0
  96. package/lib/package.spec.js +1 -1
  97. package/lib/package.spec.js.map +1 -1
  98. package/package.json +16 -5
  99. package/src/browser/copilot-auth-dialog.tsx +2 -2
  100. package/src/browser/copilot-command-contribution.ts +3 -3
  101. package/src/browser/copilot-frontend-application-contribution.ts +3 -3
  102. package/src/browser/copilot-frontend-module.ts +7 -7
  103. package/src/browser/copilot-status-bar-contribution.ts +3 -3
  104. package/src/browser/index.ts +5 -5
  105. package/src/common/index.ts +3 -3
  106. package/src/node/copilot-auth-service-impl.spec.ts +2 -2
  107. package/src/node/copilot-auth-service-impl.ts +4 -4
  108. package/src/node/copilot-backend-module.ts +8 -8
  109. package/src/node/copilot-cli-auth-provider.spec.ts +2 -2
  110. package/src/node/copilot-cli-auth-provider.ts +5 -5
  111. package/src/node/copilot-cli-locator.spec.ts +1 -1
  112. package/src/node/copilot-cli-locator.ts +2 -2
  113. package/src/node/copilot-credential-store.spec.ts +1 -1
  114. package/src/node/copilot-language-models-manager-impl.spec.ts +2 -2
  115. package/src/node/copilot-language-models-manager-impl.ts +4 -4
  116. package/src/node/copilot-sdk-client-provider.spec.ts +3 -3
  117. package/src/node/copilot-sdk-client-provider.ts +6 -6
  118. package/src/node/copilot-sdk-language-model.spec.ts +2 -2
  119. package/src/node/copilot-sdk-language-model.ts +2 -2
  120. package/src/node/copilot-sdk-loader.spec.ts +1 -1
  121. package/src/node/copilot-sdk-loader.ts +3 -3
  122. package/src/node/copilot-sdk-mappers.spec.ts +2 -2
  123. package/src/node/copilot-sdk-mappers.ts +1 -1
  124. package/src/node/index.ts +11 -11
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2026 EclipseSource GmbH and others.
4
3
  //
@@ -14,21 +13,19 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.CopilotCliLocator = exports.COPILOT_CLI_PATH_ENV = void 0;
19
- const tslib_1 = require("tslib");
20
- const child_process_1 = require("child_process");
21
- const fs_1 = require("fs");
22
- const module_1 = require("module");
23
- const path_1 = require("path");
24
- const util_1 = require("util");
25
- const inversify_1 = require("@theia/core/shared/inversify");
26
- const core_1 = require("@theia/core");
27
- const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
16
+ import { __decorate } from "tslib";
17
+ import { execFile } from 'child_process';
18
+ import { constants, promises as fs } from 'fs';
19
+ import { createRequire } from 'module';
20
+ import { delimiter, dirname, join } from 'path';
21
+ import { promisify } from 'util';
22
+ import { inject, injectable, named } from '@theia/core/shared/inversify';
23
+ import { ILogger, nls } from '@theia/core';
24
+ const execFileAsync = promisify(execFile);
28
25
  /**
29
26
  * Environment variable that points at the Copilot CLI, honored by the Copilot SDK as well.
30
27
  */
31
- exports.COPILOT_CLI_PATH_ENV = 'COPILOT_CLI_PATH';
28
+ export const COPILOT_CLI_PATH_ENV = 'COPILOT_CLI_PATH';
32
29
  /**
33
30
  * Time after which looking up the global npm installation directory is given up on.
34
31
  */
@@ -81,7 +78,7 @@ let CopilotCliLocator = class CopilotCliLocator {
81
78
  if (this.configuredPath) {
82
79
  const configured = await this.resolveConfiguredPath(this.configuredPath);
83
80
  if (!configured) {
84
- throw new Error(core_1.nls.localize('theia/ai/copilot/cliNotFoundAt', 'The configured GitHub Copilot CLI does not exist or is not executable: {0}', this.configuredPath));
81
+ throw new Error(nls.localize('theia/ai/copilot/cliNotFoundAt', 'The configured GitHub Copilot CLI does not exist or is not executable: {0}', this.configuredPath));
85
82
  }
86
83
  return configured;
87
84
  }
@@ -109,7 +106,7 @@ let CopilotCliLocator = class CopilotCliLocator {
109
106
  }
110
107
  }
111
108
  this.logger.warn(`Copilot: no Copilot CLI found, searched:\n${attempted.join('\n')}`);
112
- throw new Error(core_1.nls.localize('theia/ai/copilot/cliNotFound', 'Could not find the GitHub Copilot CLI on the machine running the backend. Install it with '
109
+ throw new Error(nls.localize('theia/ai/copilot/cliNotFound', 'Could not find the GitHub Copilot CLI on the machine running the backend. Install it with '
113
110
  + '`npm install -g @github/copilot`, or set the `ai-features.copilot.executablePath` preference to the location of '
114
111
  + 'its executable. {0} locations were searched, see the backend log for the full list.', attempted.length));
115
112
  }
@@ -122,12 +119,12 @@ let CopilotCliLocator = class CopilotCliLocator {
122
119
  * for as long as a Node.js is on the `PATH` of the backend, which is nothing to rely on.
123
120
  */
124
121
  async resolveConfiguredPath(configured) {
125
- const candidates = [configured, ...this.getCliFileNames().map(name => (0, path_1.join)(configured, name))];
122
+ const candidates = [configured, ...this.getCliFileNames().map(name => join(configured, name))];
126
123
  for (const candidate of candidates) {
127
124
  if (!await this.isExecutable(candidate)) {
128
125
  continue;
129
126
  }
130
- const target = await fs_1.promises.realpath(candidate).catch(() => candidate);
127
+ const target = await fs.realpath(candidate).catch(() => candidate);
131
128
  for (const mapped of this.toCandidatesOnPath(target)) {
132
129
  if (await this.isExecutable(mapped)) {
133
130
  return mapped;
@@ -149,7 +146,7 @@ let CopilotCliLocator = class CopilotCliLocator {
149
146
  * turned into an error, so that the remaining sources still get their chance.
150
147
  */
151
148
  async environmentCandidates() {
152
- const configured = process.env[exports.COPILOT_CLI_PATH_ENV]?.trim();
149
+ const configured = process.env[COPILOT_CLI_PATH_ENV]?.trim();
153
150
  if (!configured) {
154
151
  return [];
155
152
  }
@@ -159,7 +156,7 @@ let CopilotCliLocator = class CopilotCliLocator {
159
156
  }
160
157
  // A launcher that could not be followed is dropped rather than kept as a candidate, because it
161
158
  // would be spawned and cannot work. Everything else is kept, so that the error names it.
162
- this.logger.warn(`Copilot: ${exports.COPILOT_CLI_PATH_ENV} does not point at a usable Copilot CLI: ${configured}`);
159
+ this.logger.warn(`Copilot: ${COPILOT_CLI_PATH_ENV} does not point at a usable Copilot CLI: ${configured}`);
163
160
  return this.isLauncher(configured) ? [] : [configured];
164
161
  }
165
162
  /**
@@ -169,9 +166,9 @@ let CopilotCliLocator = class CopilotCliLocator {
169
166
  * package is found whether the installation hoisted it or nested it below the SDK.
170
167
  */
171
168
  async bundledCandidates() {
172
- const candidates = [...this.resolvedCandidates(__filename)];
169
+ const candidates = [...this.resolvedCandidates(import.meta.filename)];
173
170
  try {
174
- const resolver = (0, module_1.createRequire)(__filename);
171
+ const resolver = createRequire(import.meta.filename);
175
172
  candidates.push(...this.resolvedCandidates(resolver.resolve('@github/copilot-sdk')));
176
173
  for (const base of resolver.resolve.paths('@github/copilot') ?? []) {
177
174
  candidates.push(...this.toPlatformPackageCandidates(base));
@@ -194,7 +191,7 @@ let CopilotCliLocator = class CopilotCliLocator {
194
191
  const candidates = [];
195
192
  for (const packageName of this.getCliPlatformPackageNames()) {
196
193
  try {
197
- candidates.push((0, path_1.join)((0, path_1.dirname)((0, module_1.createRequire)(anchor).resolve(packageName)), this.getBinaryName()));
194
+ candidates.push(join(dirname(createRequire(anchor).resolve(packageName)), this.getBinaryName()));
198
195
  }
199
196
  catch (error) {
200
197
  // No such package below this anchor.
@@ -211,14 +208,14 @@ let CopilotCliLocator = class CopilotCliLocator {
211
208
  */
212
209
  async pathCandidates() {
213
210
  const candidates = [];
214
- for (const entry of (process.env.PATH ?? '').split(path_1.delimiter)) {
211
+ for (const entry of (process.env.PATH ?? '').split(delimiter)) {
215
212
  if (!entry) {
216
213
  continue;
217
214
  }
218
215
  for (const name of this.getCliFileNames()) {
219
- const candidate = (0, path_1.join)(entry, name);
216
+ const candidate = join(entry, name);
220
217
  try {
221
- candidates.push(...this.toCandidatesOnPath(await fs_1.promises.realpath(candidate)));
218
+ candidates.push(...this.toCandidatesOnPath(await fs.realpath(candidate)));
222
219
  }
223
220
  catch (error) {
224
221
  // No CLI of this name in this entry of the PATH.
@@ -236,12 +233,12 @@ let CopilotCliLocator = class CopilotCliLocator {
236
233
  if (this.isJsEntryPoint(target)) {
237
234
  // `<node_modules>/@github/copilot/npm-loader.js`, so resolve from the launcher itself and
238
235
  // fall back to `<node_modules>`, which is where a hoisting installation puts the package.
239
- return [...this.resolvedCandidates(target), ...this.moduleDirectoryCandidates((0, path_1.dirname)((0, path_1.dirname)((0, path_1.dirname)(target))))];
236
+ return [...this.resolvedCandidates(target), ...this.moduleDirectoryCandidates(dirname(dirname(dirname(target))))];
240
237
  }
241
238
  if (this.isShim(target)) {
242
239
  // `<npm prefix>/copilot.cmd` on Windows, which is not a link to the entry point but a batch
243
240
  // file next to the module directory the installation wrote.
244
- return this.moduleDirectoryCandidates((0, path_1.join)((0, path_1.dirname)(target), 'node_modules'));
241
+ return this.moduleDirectoryCandidates(join(dirname(target), 'node_modules'));
245
242
  }
246
243
  return [target];
247
244
  }
@@ -276,7 +273,7 @@ let CopilotCliLocator = class CopilotCliLocator {
276
273
  return [];
277
274
  }
278
275
  return [
279
- ...this.resolvedCandidates((0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js')),
276
+ ...this.resolvedCandidates(join(modules, '@github', 'copilot', 'npm-loader.js')),
280
277
  ...this.toPlatformPackageCandidates(modules)
281
278
  ];
282
279
  }
@@ -287,7 +284,7 @@ let CopilotCliLocator = class CopilotCliLocator {
287
284
  if (!base) {
288
285
  return [];
289
286
  }
290
- return this.getCliPlatformPackageNames().map(packageName => (0, path_1.join)(base, ...packageName.split('/'), this.getBinaryName()));
287
+ return this.getCliPlatformPackageNames().map(packageName => join(base, ...packageName.split('/'), this.getBinaryName()));
291
288
  }
292
289
  /**
293
290
  * The platform-specific packages that can carry the CLI for this host.
@@ -323,12 +320,12 @@ let CopilotCliLocator = class CopilotCliLocator {
323
320
  }
324
321
  async isExecutable(path) {
325
322
  try {
326
- const stats = await fs_1.promises.stat(path);
323
+ const stats = await fs.stat(path);
327
324
  if (!stats.isFile()) {
328
325
  return false;
329
326
  }
330
327
  // The executable bit is not modelled on Windows, where every file passes this check.
331
- await fs_1.promises.access(path, fs_1.constants.X_OK);
328
+ await fs.access(path, constants.X_OK);
332
329
  return true;
333
330
  }
334
331
  catch (error) {
@@ -336,13 +333,12 @@ let CopilotCliLocator = class CopilotCliLocator {
336
333
  }
337
334
  }
338
335
  };
339
- exports.CopilotCliLocator = CopilotCliLocator;
340
- tslib_1.__decorate([
341
- (0, inversify_1.inject)(core_1.ILogger),
342
- (0, inversify_1.named)('ai-copilot:CopilotCliLocator'),
343
- tslib_1.__metadata("design:type", Object)
336
+ __decorate([
337
+ inject(ILogger),
338
+ named('ai-copilot:CopilotCliLocator')
344
339
  ], CopilotCliLocator.prototype, "logger", void 0);
345
- exports.CopilotCliLocator = CopilotCliLocator = tslib_1.__decorate([
346
- (0, inversify_1.injectable)()
340
+ CopilotCliLocator = __decorate([
341
+ injectable()
347
342
  ], CopilotCliLocator);
343
+ export { CopilotCliLocator };
348
344
  //# sourceMappingURL=copilot-cli-locator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-cli-locator.js","sourceRoot":"","sources":["../../src/node/copilot-cli-locator.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,iDAAyC;AACzC,2BAA+C;AAC/C,mCAAuC;AACvC,+BAAgD;AAChD,+BAAiC;AACjC,4DAAyE;AACzE,sCAA2C;AAE3C,MAAM,aAAa,GAAG,IAAA,gBAAS,EAAC,wBAAQ,CAAC,CAAC;AAE1C;;GAEG;AACU,QAAA,oBAAoB,GAAG,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC;;;;;;;;;;;;;GAaG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAQ1B;;;OAGG;IACH,iBAAiB,CAAC,IAAwB;QACtC,MAAM,UAAU,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;QAC7C,IAAI,UAAU,KAAK,IAAI,CAAC,cAAc,EAAE,CAAC;YACrC,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC;YACjC,IAAI,CAAC,UAAU,GAAG,SAAS,CA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,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;IACzG,CAAC;IAED;;;OAGG;IACO,UAAU,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC;IAES,cAAc,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAES,MAAM,CAAC,IAAY;QACzB,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,IAAY;QACrC,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;gBAClB,OAAO,KAAK,CAAC;YACjB,CAAC;YACD,qFAAqF;YACrF,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;CACJ,CAAA;AApTsB;IADlB,MAAM,CAAC,OAAO,CAAC;IAAE,KAAK,CAAC,8BAA8B,CAAC;iDACpB;AAH1B,iBAAiB;IAD7B,UAAU,EAAE;GACA,iBAAiB,CAuT7B"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2026 EclipseSource GmbH and others.
4
3
  //
@@ -14,19 +13,17 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- const chai_1 = require("chai");
20
- const fs_1 = require("fs");
21
- const os = tslib_1.__importStar(require("os"));
22
- const path_1 = require("path");
23
- const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
24
- const copilot_cli_locator_1 = require("./copilot-cli-locator");
25
- class TestableCopilotCliLocator extends copilot_cli_locator_1.CopilotCliLocator {
16
+ import { expect } from 'chai';
17
+ import { promises as fs } from 'fs';
18
+ import * as os from 'os';
19
+ import { join } from 'path';
20
+ import { MockLogger } from '@theia/core/lib/common/test/mock-logger';
21
+ import { CopilotCliLocator, COPILOT_CLI_PATH_ENV } from './copilot-cli-locator.js';
22
+ class TestableCopilotCliLocator extends CopilotCliLocator {
26
23
  constructor() {
27
24
  super();
28
25
  // The logger is injected in production, and read-only for everyone else.
29
- Object.assign(this, { logger: new mock_logger_1.MockLogger() });
26
+ Object.assign(this, { logger: new MockLogger() });
30
27
  }
31
28
  callToPlatformPackageCandidates(base) {
32
29
  return this.toPlatformPackageCandidates(base);
@@ -60,14 +57,14 @@ const BINARY_NAME = names.callGetBinaryName();
60
57
  * resolution of Node.js, while the temporary directory is a symlink on macOS.
61
58
  */
62
59
  async function createTempDirectory(prefix) {
63
- return fs_1.promises.realpath(await fs_1.promises.mkdtemp((0, path_1.join)(os.tmpdir(), prefix)));
60
+ return fs.realpath(await fs.mkdtemp(join(os.tmpdir(), prefix)));
64
61
  }
65
62
  /**
66
63
  * Creates a file that passes the executable check of the locator.
67
64
  */
68
65
  async function writeExecutable(path) {
69
- await fs_1.promises.mkdir((0, path_1.join)(path, '..'), { recursive: true });
70
- await fs_1.promises.writeFile(path, '', { mode: 0o755 });
66
+ await fs.mkdir(join(path, '..'), { recursive: true });
67
+ await fs.writeFile(path, '', { mode: 0o755 });
71
68
  return path;
72
69
  }
73
70
  /**
@@ -75,14 +72,14 @@ async function writeExecutable(path) {
75
72
  * by GitHub do: `@github/copilot-win32-x64` exports `./copilot.exe`, the others `./copilot`.
76
73
  */
77
74
  async function installPlatformPackage(at, packageName = PLATFORM_PACKAGE, binaryName = BINARY_NAME) {
78
- const directory = (0, path_1.join)(at, ...packageName.split('/'));
79
- await fs_1.promises.mkdir(directory, { recursive: true });
80
- await fs_1.promises.writeFile((0, path_1.join)(directory, 'package.json'), JSON.stringify({
75
+ const directory = join(at, ...packageName.split('/'));
76
+ await fs.mkdir(directory, { recursive: true });
77
+ await fs.writeFile(join(directory, 'package.json'), JSON.stringify({
81
78
  name: packageName,
82
79
  version: '1.0.0',
83
80
  exports: { '.': `./${binaryName}` }
84
81
  }));
85
- return writeExecutable((0, path_1.join)(directory, binaryName));
82
+ return writeExecutable(join(directory, binaryName));
86
83
  }
87
84
  /** A locator that looks for what a Windows host has, so that the lookup can be tested from anywhere. */
88
85
  class WindowsLikeCopilotCliLocator extends TestableCopilotCliLocator {
@@ -98,11 +95,11 @@ class WindowsLikeCopilotCliLocator extends TestableCopilotCliLocator {
98
95
  describe('CopilotCliLocator - candidates', () => {
99
96
  const locator = new TestableCopilotCliLocator();
100
97
  it('should look for the executable of the platform package below a module directory', () => {
101
- const candidates = locator.callToPlatformPackageCandidates((0, path_1.join)('/app', 'node_modules'));
102
- (0, chai_1.expect)(candidates).to.not.be.empty;
98
+ const candidates = locator.callToPlatformPackageCandidates(join('/app', 'node_modules'));
99
+ expect(candidates).to.not.be.empty;
103
100
  for (const candidate of candidates) {
104
- (0, chai_1.expect)(candidate).to.contain((0, path_1.join)('node_modules', '@github', 'copilot-'));
105
- (0, chai_1.expect)(candidate.endsWith(locator.callGetBinaryName())).to.be.true;
101
+ expect(candidate).to.contain(join('node_modules', '@github', 'copilot-'));
102
+ expect(candidate.endsWith(locator.callGetBinaryName())).to.be.true;
106
103
  }
107
104
  });
108
105
  it('should consider the glibc and the musl build on Linux', function () {
@@ -110,45 +107,45 @@ describe('CopilotCliLocator - candidates', () => {
110
107
  this.skip();
111
108
  }
112
109
  const candidates = locator.callToPlatformPackageCandidates('/app/node_modules');
113
- (0, chai_1.expect)(candidates).to.have.lengthOf(2);
114
- (0, chai_1.expect)(candidates.some(candidate => candidate.includes('copilot-linux-'))).to.be.true;
115
- (0, chai_1.expect)(candidates.some(candidate => candidate.includes('copilot-linuxmusl-'))).to.be.true;
110
+ expect(candidates).to.have.lengthOf(2);
111
+ expect(candidates.some(candidate => candidate.includes('copilot-linux-'))).to.be.true;
112
+ expect(candidates.some(candidate => candidate.includes('copilot-linuxmusl-'))).to.be.true;
116
113
  });
117
114
  it('should return nothing for an empty module directory', () => {
118
- (0, chai_1.expect)(locator.callToPlatformPackageCandidates('')).to.be.empty;
115
+ expect(locator.callToPlatformPackageCandidates('')).to.be.empty;
119
116
  });
120
117
  it('should map the JavaScript launcher of a global installation to the platform package', () => {
121
- const launcher = (0, path_1.join)('/usr', 'lib', 'node_modules', '@github', 'copilot', 'npm-loader.js');
118
+ const launcher = join('/usr', 'lib', 'node_modules', '@github', 'copilot', 'npm-loader.js');
122
119
  const candidates = locator.callToCandidatesOnPath(launcher);
123
- (0, chai_1.expect)(candidates).to.not.be.empty;
120
+ expect(candidates).to.not.be.empty;
124
121
  for (const candidate of candidates) {
125
- (0, chai_1.expect)(candidate).to.contain((0, path_1.join)('/usr', 'lib', 'node_modules', '@github', 'copilot-'));
126
- (0, chai_1.expect)(candidate).to.not.contain('npm-loader.js');
122
+ expect(candidate).to.contain(join('/usr', 'lib', 'node_modules', '@github', 'copilot-'));
123
+ expect(candidate).to.not.contain('npm-loader.js');
127
124
  }
128
125
  });
129
126
  it('should map the shim of a global installation to the platform package next to it', () => {
130
127
  // What a global npm installation on Windows puts into its prefix, instead of a link.
131
- const candidates = locator.callToCandidatesOnPath((0, path_1.join)('/prefix', 'copilot.cmd'));
132
- (0, chai_1.expect)(candidates).to.not.be.empty;
128
+ const candidates = locator.callToCandidatesOnPath(join('/prefix', 'copilot.cmd'));
129
+ expect(candidates).to.not.be.empty;
133
130
  for (const candidate of candidates) {
134
- (0, chai_1.expect)(candidate).to.contain((0, path_1.join)('/prefix', 'node_modules', '@github', 'copilot-'));
131
+ expect(candidate).to.contain(join('/prefix', 'node_modules', '@github', 'copilot-'));
135
132
  }
136
133
  });
137
134
  it('should take a native executable on the PATH as it is', () => {
138
- const executable = (0, path_1.join)('/opt', 'copilot', 'copilot');
139
- (0, chai_1.expect)(locator.callToCandidatesOnPath(executable)).to.deep.equal([executable]);
135
+ const executable = join('/opt', 'copilot', 'copilot');
136
+ expect(locator.callToCandidatesOnPath(executable)).to.deep.equal([executable]);
140
137
  });
141
138
  it('should look for the shim of a global installation on Windows, which has no other entry', function () {
142
139
  if (process.platform !== 'win32') {
143
140
  this.skip();
144
141
  }
145
- (0, chai_1.expect)(locator.callGetCliFileNames()).to.deep.equal(['copilot.exe', 'copilot.cmd']);
142
+ expect(locator.callGetCliFileNames()).to.deep.equal(['copilot.exe', 'copilot.cmd']);
146
143
  });
147
144
  it('should look for the executable only where an installation links to it', function () {
148
145
  if (process.platform === 'win32') {
149
146
  this.skip();
150
147
  }
151
- (0, chai_1.expect)(locator.callGetCliFileNames()).to.deep.equal(['copilot']);
148
+ expect(locator.callGetCliFileNames()).to.deep.equal(['copilot']);
152
149
  });
153
150
  });
154
151
  describe('CopilotCliLocator - installed platform package', () => {
@@ -157,43 +154,43 @@ describe('CopilotCliLocator - installed platform package', () => {
157
154
  const locator = new TestableCopilotCliLocator();
158
155
  beforeEach(async () => {
159
156
  root = await createTempDirectory('theia-copilot-install-');
160
- modules = (0, path_1.join)(root, 'node_modules');
161
- await fs_1.promises.mkdir((0, path_1.join)(modules, '@github', 'copilot'), { recursive: true });
157
+ modules = join(root, 'node_modules');
158
+ await fs.mkdir(join(modules, '@github', 'copilot'), { recursive: true });
162
159
  // The launcher of the CLI is executable, and linked to from the global binary directory.
163
- await writeExecutable((0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js'));
160
+ await writeExecutable(join(modules, '@github', 'copilot', 'npm-loader.js'));
164
161
  });
165
162
  afterEach(async () => {
166
- await fs_1.promises.rm(root, { recursive: true, force: true });
163
+ await fs.rm(root, { recursive: true, force: true });
167
164
  });
168
165
  it('should find a package that the installation hoisted next to the launcher', async () => {
169
166
  const executable = await installPlatformPackage(modules);
170
- const launcher = (0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js');
171
- (0, chai_1.expect)(locator.callResolvedCandidates(launcher)).to.contain(executable);
172
- (0, chai_1.expect)(locator.callToCandidatesOnPath(launcher)).to.contain(executable);
167
+ const launcher = join(modules, '@github', 'copilot', 'npm-loader.js');
168
+ expect(locator.callResolvedCandidates(launcher)).to.contain(executable);
169
+ expect(locator.callToCandidatesOnPath(launcher)).to.contain(executable);
173
170
  });
174
171
  it('should find a package that a global installation nested below the launcher', async () => {
175
- const executable = await installPlatformPackage((0, path_1.join)(modules, '@github', 'copilot', 'node_modules'));
176
- const launcher = (0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js');
177
- (0, chai_1.expect)(locator.callResolvedCandidates(launcher)).to.contain(executable);
178
- (0, chai_1.expect)(locator.callToCandidatesOnPath(launcher)).to.contain(executable);
172
+ const executable = await installPlatformPackage(join(modules, '@github', 'copilot', 'node_modules'));
173
+ const launcher = join(modules, '@github', 'copilot', 'npm-loader.js');
174
+ expect(locator.callResolvedCandidates(launcher)).to.contain(executable);
175
+ expect(locator.callToCandidatesOnPath(launcher)).to.contain(executable);
179
176
  });
180
177
  it('should return nothing when no platform package is installed', () => {
181
- (0, chai_1.expect)(locator.callResolvedCandidates((0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js'))).to.be.empty;
178
+ expect(locator.callResolvedCandidates(join(modules, '@github', 'copilot', 'npm-loader.js'))).to.be.empty;
182
179
  });
183
180
  it('should find the package of a global installation from the shim next to its module directory', async () => {
184
- const executable = await installPlatformPackage((0, path_1.join)(modules, '@github', 'copilot', 'node_modules'));
185
- (0, chai_1.expect)(locator.callToCandidatesOnPath((0, path_1.join)(root, 'copilot.cmd'))).to.contain(executable);
181
+ const executable = await installPlatformPackage(join(modules, '@github', 'copilot', 'node_modules'));
182
+ expect(locator.callToCandidatesOnPath(join(root, 'copilot.cmd'))).to.contain(executable);
186
183
  });
187
184
  it('should reject a configured shim that leads nowhere, since it cannot be spawned', async () => {
188
- const shim = await writeExecutable((0, path_1.join)(root, 'copilot.cmd'));
185
+ const shim = await writeExecutable(join(root, 'copilot.cmd'));
189
186
  const configured = new TestableCopilotCliLocator();
190
187
  configured.setConfiguredPath(shim);
191
188
  try {
192
189
  await configured.resolve();
193
- chai_1.expect.fail('should have rejected');
190
+ expect.fail('should have rejected');
194
191
  }
195
192
  catch (error) {
196
- (0, chai_1.expect)(String(error)).to.contain(shim);
193
+ expect(String(error)).to.contain(shim);
197
194
  }
198
195
  });
199
196
  it('should follow a configured launcher to the executable it would start', async function () {
@@ -201,54 +198,54 @@ describe('CopilotCliLocator - installed platform package', () => {
201
198
  // A global installation writes a shim rather than a link there.
202
199
  this.skip();
203
200
  }
204
- const executable = await installPlatformPackage((0, path_1.join)(modules, '@github', 'copilot', 'node_modules'));
205
- const launcher = (0, path_1.join)(root, 'bin', 'copilot');
206
- await fs_1.promises.mkdir((0, path_1.join)(root, 'bin'), { recursive: true });
207
- await fs_1.promises.symlink((0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js'), launcher);
201
+ const executable = await installPlatformPackage(join(modules, '@github', 'copilot', 'node_modules'));
202
+ const launcher = join(root, 'bin', 'copilot');
203
+ await fs.mkdir(join(root, 'bin'), { recursive: true });
204
+ await fs.symlink(join(modules, '@github', 'copilot', 'npm-loader.js'), launcher);
208
205
  const configured = new TestableCopilotCliLocator();
209
206
  configured.setConfiguredPath(launcher);
210
- (0, chai_1.expect)(await configured.resolve()).to.equal(executable);
207
+ expect(await configured.resolve()).to.equal(executable);
211
208
  });
212
209
  });
213
210
  describe('CopilotCliLocator - environment', () => {
214
211
  const locator = new TestableCopilotCliLocator();
215
- const previous = process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV];
212
+ const previous = process.env[COPILOT_CLI_PATH_ENV];
216
213
  let root;
217
214
  beforeEach(async () => {
218
215
  root = await createTempDirectory('theia-copilot-env-');
219
216
  });
220
217
  afterEach(async () => {
221
218
  if (previous === undefined) {
222
- delete process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV];
219
+ delete process.env[COPILOT_CLI_PATH_ENV];
223
220
  }
224
221
  else {
225
- process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV] = previous;
222
+ process.env[COPILOT_CLI_PATH_ENV] = previous;
226
223
  }
227
- await fs_1.promises.rm(root, { recursive: true, force: true });
224
+ await fs.rm(root, { recursive: true, force: true });
228
225
  });
229
226
  it('should honor the location given in the environment', async () => {
230
- process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV] = '/opt/copilot/copilot';
231
- (0, chai_1.expect)(await locator.callEnvironmentCandidates()).to.deep.equal(['/opt/copilot/copilot']);
227
+ process.env[COPILOT_CLI_PATH_ENV] = '/opt/copilot/copilot';
228
+ expect(await locator.callEnvironmentCandidates()).to.deep.equal(['/opt/copilot/copilot']);
232
229
  });
233
230
  it('should ignore a blank value', async () => {
234
- process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV] = ' ';
235
- (0, chai_1.expect)(await locator.callEnvironmentCandidates()).to.be.empty;
231
+ process.env[COPILOT_CLI_PATH_ENV] = ' ';
232
+ expect(await locator.callEnvironmentCandidates()).to.be.empty;
236
233
  });
237
234
  it('should follow a launcher given in the environment, the way a configured one is followed', async () => {
238
- const modules = (0, path_1.join)(root, 'node_modules');
235
+ const modules = join(root, 'node_modules');
239
236
  const executable = await installPlatformPackage(modules);
240
- const launcher = await writeExecutable((0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js'));
241
- process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV] = launcher;
242
- (0, chai_1.expect)(await locator.callEnvironmentCandidates()).to.deep.equal([executable]);
237
+ const launcher = await writeExecutable(join(modules, '@github', 'copilot', 'npm-loader.js'));
238
+ process.env[COPILOT_CLI_PATH_ENV] = launcher;
239
+ expect(await locator.callEnvironmentCandidates()).to.deep.equal([executable]);
243
240
  });
244
241
  it('should accept the directory holding the executable', async () => {
245
- const executable = await writeExecutable((0, path_1.join)(root, 'bin', BINARY_NAME));
246
- process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV] = (0, path_1.join)(root, 'bin');
247
- (0, chai_1.expect)(await locator.callEnvironmentCandidates()).to.deep.equal([executable]);
242
+ const executable = await writeExecutable(join(root, 'bin', BINARY_NAME));
243
+ process.env[COPILOT_CLI_PATH_ENV] = join(root, 'bin');
244
+ expect(await locator.callEnvironmentCandidates()).to.deep.equal([executable]);
248
245
  });
249
246
  it('should drop a launcher that leads nowhere instead of offering it for spawning', async () => {
250
- process.env[copilot_cli_locator_1.COPILOT_CLI_PATH_ENV] = await writeExecutable((0, path_1.join)(root, 'copilot.cmd'));
251
- (0, chai_1.expect)(await locator.callEnvironmentCandidates()).to.be.empty;
247
+ process.env[COPILOT_CLI_PATH_ENV] = await writeExecutable(join(root, 'copilot.cmd'));
248
+ expect(await locator.callEnvironmentCandidates()).to.be.empty;
252
249
  });
253
250
  });
254
251
  describe('CopilotCliLocator - configured path', () => {
@@ -256,39 +253,39 @@ describe('CopilotCliLocator - configured path', () => {
256
253
  let executable;
257
254
  beforeEach(async () => {
258
255
  home = await createTempDirectory('theia-copilot-locator-');
259
- executable = await writeExecutable((0, path_1.join)(home, 'bin', process.platform === 'win32' ? 'copilot.exe' : 'copilot'));
256
+ executable = await writeExecutable(join(home, 'bin', process.platform === 'win32' ? 'copilot.exe' : 'copilot'));
260
257
  });
261
258
  afterEach(async () => {
262
- await fs_1.promises.rm(home, { recursive: true, force: true });
259
+ await fs.rm(home, { recursive: true, force: true });
263
260
  });
264
261
  it('should use the configured executable', async () => {
265
262
  const locator = new TestableCopilotCliLocator();
266
263
  locator.setConfiguredPath(executable);
267
- (0, chai_1.expect)(await locator.resolve()).to.equal(executable);
264
+ expect(await locator.resolve()).to.equal(executable);
268
265
  });
269
266
  it('should accept the directory holding the executable', async () => {
270
267
  const locator = new TestableCopilotCliLocator();
271
- locator.setConfiguredPath((0, path_1.join)(home, 'bin'));
272
- (0, chai_1.expect)(await locator.resolve()).to.equal(executable);
268
+ locator.setConfiguredPath(join(home, 'bin'));
269
+ expect(await locator.resolve()).to.equal(executable);
273
270
  });
274
271
  it('should report a configured location that does not exist', async () => {
275
272
  const locator = new TestableCopilotCliLocator();
276
- const missing = (0, path_1.join)(home, 'nowhere', 'copilot');
273
+ const missing = join(home, 'nowhere', 'copilot');
277
274
  locator.setConfiguredPath(missing);
278
275
  try {
279
276
  await locator.resolve();
280
- chai_1.expect.fail('should have rejected');
277
+ expect.fail('should have rejected');
281
278
  }
282
279
  catch (error) {
283
- (0, chai_1.expect)(String(error)).to.contain(missing);
280
+ expect(String(error)).to.contain(missing);
284
281
  }
285
282
  });
286
283
  it('should search again after the configured location changed', async () => {
287
284
  const locator = new TestableCopilotCliLocator();
288
- locator.setConfiguredPath((0, path_1.join)(home, 'nowhere', 'copilot'));
285
+ locator.setConfiguredPath(join(home, 'nowhere', 'copilot'));
289
286
  await locator.resolve().catch(() => { });
290
287
  locator.setConfiguredPath(executable);
291
- (0, chai_1.expect)(await locator.resolve()).to.equal(executable);
288
+ expect(await locator.resolve()).to.equal(executable);
292
289
  });
293
290
  });
294
291
  describe('CopilotCliLocator - a Windows host', () => {
@@ -298,27 +295,27 @@ describe('CopilotCliLocator - a Windows host', () => {
298
295
  root = await createTempDirectory('theia-copilot-windows-');
299
296
  });
300
297
  afterEach(async () => {
301
- await fs_1.promises.rm(root, { recursive: true, force: true });
298
+ await fs.rm(root, { recursive: true, force: true });
302
299
  });
303
300
  /**
304
301
  * Writes what a global npm installation leaves on Windows: a `copilot.cmd` shim in the prefix, and
305
302
  * the platform package nested below the launcher, exporting its executable under the `.exe` name.
306
303
  */
307
304
  async function installGlobally() {
308
- const modules = (0, path_1.join)(root, 'node_modules');
309
- await writeExecutable((0, path_1.join)(modules, '@github', 'copilot', 'npm-loader.js'));
310
- const executable = await installPlatformPackage((0, path_1.join)(modules, '@github', 'copilot', 'node_modules'), WindowsLikeCopilotCliLocator.PACKAGE, WindowsLikeCopilotCliLocator.BINARY);
311
- return { shim: await writeExecutable((0, path_1.join)(root, 'copilot.cmd')), executable };
305
+ const modules = join(root, 'node_modules');
306
+ await writeExecutable(join(modules, '@github', 'copilot', 'npm-loader.js'));
307
+ const executable = await installPlatformPackage(join(modules, '@github', 'copilot', 'node_modules'), WindowsLikeCopilotCliLocator.PACKAGE, WindowsLikeCopilotCliLocator.BINARY);
308
+ return { shim: await writeExecutable(join(root, 'copilot.cmd')), executable };
312
309
  }
313
310
  it('should follow the shim of a global installation to the executable', async () => {
314
311
  const { shim, executable } = await installGlobally();
315
- (0, chai_1.expect)(locator.callToCandidatesOnPath(shim)).to.contain(executable);
312
+ expect(locator.callToCandidatesOnPath(shim)).to.contain(executable);
316
313
  });
317
314
  it('should follow a configured shim to the executable, which is what can be spawned', async () => {
318
315
  const { shim, executable } = await installGlobally();
319
316
  locator.setConfiguredPath(shim);
320
317
  try {
321
- (0, chai_1.expect)(await locator.resolve()).to.equal(executable);
318
+ expect(await locator.resolve()).to.equal(executable);
322
319
  }
323
320
  finally {
324
321
  locator.setConfiguredPath(undefined);