@theia/ai-copilot 1.75.0 → 1.76.0-next.10

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
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-preferences.d.ts","sourceRoot":"","sources":["../../src/common/copilot-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAO,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,4BAA4B,uCAAuC,CAAC;AACjF,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAE/E,eAAO,MAAM,wBAAwB,EAAE,gBA+BtC,CAAC"}
1
+ {"version":3,"file":"copilot-preferences.d.ts","sourceRoot":"","sources":["../../src/common/copilot-preferences.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAO,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,4BAA4B,uCAAuC,CAAC;AACjF,eAAO,MAAM,2BAA2B,sCAAsC,CAAC;AAC/E,eAAO,MAAM,4BAA4B,uCAAuC,CAAC;AAEjF,eAAO,MAAM,wBAAwB,EAAE,gBAiDtC,CAAC"}
@@ -15,21 +15,26 @@
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.CopilotPreferencesSchema = exports.COPILOT_ENTERPRISE_URL_PREF = exports.COPILOT_MODEL_OVERRIDES_PREF = exports.COPILOT_ENABLED_PREF = void 0;
18
+ exports.CopilotPreferencesSchema = exports.COPILOT_EXECUTABLE_PATH_PREF = exports.COPILOT_ENTERPRISE_URL_PREF = exports.COPILOT_MODEL_OVERRIDES_PREF = exports.COPILOT_ENABLED_PREF = void 0;
19
19
  const ai_core_preferences_1 = require("@theia/ai-core/lib/common/ai-core-preferences");
20
20
  const core_1 = require("@theia/core");
21
21
  exports.COPILOT_ENABLED_PREF = 'ai-features.copilot.enabled';
22
22
  exports.COPILOT_MODEL_OVERRIDES_PREF = 'ai-features.copilot.modelOverrides';
23
23
  exports.COPILOT_ENTERPRISE_URL_PREF = 'ai-features.copilot.enterpriseUrl';
24
+ exports.COPILOT_EXECUTABLE_PATH_PREF = 'ai-features.copilot.executablePath';
24
25
  exports.CopilotPreferencesSchema = {
25
26
  properties: {
26
27
  [exports.COPILOT_ENABLED_PREF]: {
27
28
  type: 'boolean',
28
29
  typeDetails: { [ai_core_preferences_1.MODEL_PROVIDER_TYPE_DETAIL]: { label: 'GitHub Copilot' } },
29
30
  markdownDescription: core_1.nls.localize('theia/ai/copilot/enabled/mdDescription', 'Enable the GitHub Copilot provider. When enabled, a status bar entry '
30
- + 'appears for authentication and available models are discovered from your Copilot subscription.'),
31
+ + 'appears for authentication and available models are discovered from your Copilot subscription.\n\n'
32
+ + 'Requests are routed through the official GitHub Copilot CLI, which runs as a background process on the '
33
+ + 'machine hosting the backend. It is given the credentials of your Copilot sign-in and nothing else, so a '
34
+ + 'token in the environment or an existing sign-in of the GitHub CLI is not used.'),
31
35
  title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
32
- default: true
36
+ default: true,
37
+ tags: ['experimental']
33
38
  },
34
39
  [exports.COPILOT_MODEL_OVERRIDES_PREF]: {
35
40
  type: 'array',
@@ -40,13 +45,26 @@ exports.CopilotPreferencesSchema = {
40
45
  default: [],
41
46
  items: {
42
47
  type: 'string'
43
- }
48
+ },
49
+ tags: ['experimental']
44
50
  },
45
51
  [exports.COPILOT_ENTERPRISE_URL_PREF]: {
46
52
  type: 'string',
47
- markdownDescription: core_1.nls.localize('theia/ai/copilot/enterpriseUrl/mdDescription', 'GitHub Enterprise domain for Copilot API (e.g., `github.mycompany.com`). Leave empty for GitHub.com.'),
53
+ markdownDescription: core_1.nls.localize('theia/ai/copilot/enterpriseUrl/mdDescription', 'GitHub Enterprise domain to authenticate and send requests against (e.g., `github.mycompany.com`). '
54
+ + 'Leave empty for GitHub.com.'),
48
55
  title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
49
- default: ''
56
+ default: '',
57
+ tags: ['experimental']
58
+ },
59
+ [exports.COPILOT_EXECUTABLE_PATH_PREF]: {
60
+ type: 'string',
61
+ markdownDescription: core_1.nls.localize('theia/ai/copilot/executablePath/mdDescription', 'Location of the GitHub Copilot CLI executable on the machine hosting the backend. '
62
+ + 'When empty (default), the CLI is searched for in the installation of the application, on the `PATH` '
63
+ + 'and in the global `npm` directory. Set this when the CLI is installed somewhere else.\n\n'
64
+ + 'The CLI is not shipped with the application, install it with `npm install -g @github/copilot`.'),
65
+ title: ai_core_preferences_1.AI_CORE_PREFERENCES_TITLE,
66
+ default: '',
67
+ tags: ['experimental']
50
68
  }
51
69
  }
52
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-preferences.js","sourceRoot":"","sources":["../../src/common/copilot-preferences.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yC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C,QAAQ,CAAC,8CAA8C,EAC5E,qGAAqG;kBACnG,6BAA6B,CAAC;YACpC,KAAK,EAAE,+CAAyB;YAChC,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,CAAC,cAAc,CAAC;SACzB;QACD,CAAC,oCAA4B,CAAC,EAAE;YAC5B,IAAI,EAAE,QAAQ;YACd,mBAAmB,EAAE,UAAG,CAAC,QAAQ,CAAC,+CAA+C,EAC7E,oFAAoF;kBAClF,sGAAsG;kBACtG,2FAA2F;kBAC3F,gGAAgG,CAAC;YACvG,KAAK,EAAE,+CAAyB;YAChC,OAAO,EAAE,EAAE;YACX,IAAI,EAAE,CAAC,cAAc,CAAC;SACzB;KACJ;CACJ,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export * from './copilot-language-models-manager';
2
2
  export * from './copilot-auth-service';
3
- export * from './copilot-oauth-config';
4
3
  export * from './copilot-preferences';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAgBA,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAgBA,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC"}
@@ -18,6 +18,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const tslib_1 = require("tslib");
19
19
  tslib_1.__exportStar(require("./copilot-language-models-manager"), exports);
20
20
  tslib_1.__exportStar(require("./copilot-auth-service"), exports);
21
- tslib_1.__exportStar(require("./copilot-oauth-config"), exports);
22
21
  tslib_1.__exportStar(require("./copilot-preferences"), exports);
23
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.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,4EAAkD;AAClD,iEAAuC;AACvC,iEAAuC;AACvC,gEAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.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,4EAAkD;AAClD,iEAAuC;AACvC,gEAAsC"}
@@ -1,31 +1,40 @@
1
1
  import { Emitter, Event, ILogger } from '@theia/core';
2
- import { KeyStoreService } from '@theia/core/lib/common/key-store';
3
2
  import { CopilotAuthService, CopilotAuthServiceClient, CopilotAuthState, DeviceCodeResponse } from '../common/copilot-auth-service';
4
- import { CopilotOAuthConfig } from '../common/copilot-oauth-config';
3
+ import { CopilotCliAuthProvider } from './copilot-cli-auth-provider';
4
+ import { CopilotCliLocator } from './copilot-cli-locator';
5
+ import { CopilotCredentialStore } from './copilot-credential-store';
5
6
  /**
6
- * Backend implementation of the GitHub Copilot OAuth Device Flow authentication service.
7
- * Handles device code generation, token polling, and credential storage.
7
+ * Backend implementation of the GitHub Copilot authentication service.
8
+ *
9
+ * All Copilot requests are served by the official Copilot CLI, which owns its credentials, so this
10
+ * service only drives the sign-in of the CLI and reports its state, see {@link CopilotCliAuthProvider}.
8
11
  */
9
12
  export declare class CopilotAuthServiceImpl implements CopilotAuthService {
10
- protected readonly keyStoreService: KeyStoreService;
13
+ protected readonly cliAuthProvider: CopilotCliAuthProvider;
14
+ protected readonly credentialStore: CopilotCredentialStore;
15
+ protected readonly cliLocator: CopilotCliLocator;
11
16
  protected readonly logger: ILogger;
12
- protected readonly oauthConfig: CopilotOAuthConfig;
13
17
  protected client: CopilotAuthServiceClient | undefined;
14
18
  protected cachedState: CopilotAuthState | undefined;
19
+ protected migrationRequired: boolean;
20
+ protected legacyCleanup: Promise<void>;
21
+ protected init(): void;
15
22
  protected readonly onAuthStateChangedEmitter: Emitter<CopilotAuthState>;
16
23
  readonly onAuthStateChanged: Event<CopilotAuthState>;
17
24
  setClient(client: CopilotAuthServiceClient | undefined): void;
18
- protected getOAuthEndpoints(enterpriseUrl?: string): {
19
- deviceCodeUrl: string;
20
- accessTokenUrl: string;
21
- };
22
- initiateDeviceFlow(enterpriseUrl?: string): Promise<DeviceCodeResponse>;
23
- pollForToken(deviceCode: string, interval: number, enterpriseUrl?: string): Promise<boolean>;
24
- protected fetchAccountLabel(accessToken: string, enterpriseUrl?: string): Promise<string | undefined>;
25
- getAuthState(): Promise<CopilotAuthState>;
26
- getAccessToken(): Promise<string | undefined>;
25
+ setExecutablePath(path: string | undefined): Promise<void>;
26
+ startSignIn(enterpriseUrl?: string): Promise<DeviceCodeResponse>;
27
+ waitForSignIn(): Promise<boolean>;
28
+ cancelSignIn(): Promise<void>;
27
29
  signOut(): Promise<void>;
30
+ getAuthState(): Promise<CopilotAuthState>;
31
+ /**
32
+ * The state as it currently is, with the request for a new sign-in attached when the credentials
33
+ * of the previous integration had to be discarded and none have been established since.
34
+ *
35
+ * Does not await the cleanup, so that it can be used from it.
36
+ */
37
+ protected computeAuthState(): Promise<CopilotAuthState>;
28
38
  protected updateAuthState(state: CopilotAuthState): void;
29
- protected delay(ms: number): Promise<void>;
30
39
  }
31
40
  //# sourceMappingURL=copilot-auth-service-impl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-auth-service-impl.d.ts","sourceRo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AAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAGvC,SAAS,CAAC,IAAI,IAAI,IAAI;IAYtB,SAAS,CAAC,QAAQ,CAAC,yBAAyB,4BAAmC;IAC/E,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAwC;IAE5F,SAAS,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,GAAG,IAAI;IAIvD,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1D,WAAW,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIhE,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IASjC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAMxB,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAW/C;;;;;OAKG;cACa,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAK7D,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;CAK3D"}
@@ -19,223 +19,107 @@ exports.CopilotAuthServiceImpl = void 0;
19
19
  const tslib_1 = require("tslib");
20
20
  const inversify_1 = require("@theia/core/shared/inversify");
21
21
  const core_1 = require("@theia/core");
22
- const key_store_1 = require("@theia/core/lib/common/key-store");
23
- const copilot_oauth_config_1 = require("../common/copilot-oauth-config");
24
- const COPILOT_SCOPE = 'read:user';
25
- const COPILOT_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code';
22
+ const copilot_cli_auth_provider_1 = require("./copilot-cli-auth-provider");
23
+ const copilot_cli_locator_1 = require("./copilot-cli-locator");
24
+ const copilot_credential_store_1 = require("./copilot-credential-store");
26
25
  /**
27
- * Maximum number of polling attempts for token retrieval.
28
- * With a default 5-second interval, this allows approximately 5 minutes of polling.
29
- */
30
- const MAX_POLLING_ATTEMPTS = 60;
31
- /**
32
- * Backend implementation of the GitHub Copilot OAuth Device Flow authentication service.
33
- * Handles device code generation, token polling, and credential storage.
26
+ * Backend implementation of the GitHub Copilot authentication service.
27
+ *
28
+ * All Copilot requests are served by the official Copilot CLI, which owns its credentials, so this
29
+ * service only drives the sign-in of the CLI and reports its state, see {@link CopilotCliAuthProvider}.
34
30
  */
35
31
  let CopilotAuthServiceImpl = class CopilotAuthServiceImpl {
36
32
  constructor() {
33
+ this.migrationRequired = false;
37
34
  this.onAuthStateChangedEmitter = new core_1.Emitter();
38
35
  this.onAuthStateChanged = this.onAuthStateChangedEmitter.event;
39
36
  }
37
+ init() {
38
+ // The previous integration signed in with an OAuth application of its own and stored a token
39
+ // that is of no use here. Remove it instead of leaving it on the machine of the user.
40
+ this.legacyCleanup = this.credentialStore.deleteLegacy().then(async (removed) => {
41
+ this.migrationRequired = removed;
42
+ if (removed) {
43
+ this.logger.info('Copilot: discarded the sign-in of the previous integration, a new sign-in is required.');
44
+ this.updateAuthState(await this.computeAuthState());
45
+ }
46
+ }, error => this.logger.warn('Copilot: failed to clean up the previous sign-in:', error));
47
+ }
40
48
  setClient(client) {
41
49
  this.client = client;
42
50
  }
43
- getOAuthEndpoints(enterpriseUrl) {
44
- if (enterpriseUrl) {
45
- const domain = enterpriseUrl
46
- .replace(/^https?:\/\//, '')
47
- .replace(/\/$/, '');
48
- return {
49
- deviceCodeUrl: `https://${domain}/login/device/code`,
50
- accessTokenUrl: `https://${domain}/login/oauth/access_token`
51
- };
52
- }
53
- return {
54
- deviceCodeUrl: 'https://github.com/login/device/code',
55
- accessTokenUrl: 'https://github.com/login/oauth/access_token'
56
- };
51
+ async setExecutablePath(path) {
52
+ this.cliLocator.setConfiguredPath(path);
57
53
  }
58
- async initiateDeviceFlow(enterpriseUrl) {
59
- const endpoints = this.getOAuthEndpoints(enterpriseUrl);
60
- const response = await fetch(endpoints.deviceCodeUrl, {
61
- method: 'POST',
62
- headers: {
63
- 'Accept': 'application/json',
64
- 'Content-Type': 'application/json',
65
- 'User-Agent': this.oauthConfig.userAgent
66
- },
67
- body: JSON.stringify({
68
- client_id: this.oauthConfig.clientId,
69
- scope: COPILOT_SCOPE
70
- })
71
- });
72
- if (!response.ok) {
73
- const errorText = await response.text();
74
- throw new Error(`Failed to initiate device authorization: ${response.status} - ${errorText}`);
75
- }
76
- const data = await response.json();
77
- return data;
54
+ async startSignIn(enterpriseUrl) {
55
+ return this.cliAuthProvider.startLogin(enterpriseUrl);
78
56
  }
79
- async pollForToken(deviceCode, interval, enterpriseUrl) {
80
- const endpoints = this.getOAuthEndpoints(enterpriseUrl);
81
- let attempts = 0;
82
- while (attempts < MAX_POLLING_ATTEMPTS) {
83
- await this.delay(interval * 1000);
84
- attempts++;
85
- const response = await fetch(endpoints.accessTokenUrl, {
86
- method: 'POST',
87
- headers: {
88
- 'Accept': 'application/json',
89
- 'Content-Type': 'application/json',
90
- 'User-Agent': this.oauthConfig.userAgent
91
- },
92
- body: JSON.stringify({
93
- client_id: this.oauthConfig.clientId,
94
- device_code: deviceCode,
95
- grant_type: COPILOT_GRANT_TYPE
96
- })
97
- });
98
- if (!response.ok) {
99
- this.logger.error(`Token request failed: ${response.status}`);
100
- continue;
101
- }
102
- const data = await response.json();
103
- if (data.access_token) {
104
- // Get user info for account label
105
- const accountLabel = await this.fetchAccountLabel(data.access_token, enterpriseUrl);
106
- // Store credentials
107
- const credentials = {
108
- accessToken: data.access_token,
109
- accountLabel,
110
- enterpriseUrl
111
- };
112
- await this.keyStoreService.setPassword(this.oauthConfig.keystoreService, this.oauthConfig.keystoreAccount, JSON.stringify(credentials));
113
- // Update cached state and notify
114
- const newState = {
115
- isAuthenticated: true,
116
- accountLabel,
117
- enterpriseUrl
118
- };
119
- this.updateAuthState(newState);
120
- return true;
121
- }
122
- if (data.error === 'authorization_pending') {
123
- // User hasn't authorized yet, continue polling
124
- continue;
125
- }
126
- if (data.error === 'slow_down') {
127
- // Increase polling interval
128
- interval += 5;
129
- continue;
130
- }
131
- if (data.error === 'expired_token' || data.error === 'access_denied') {
132
- this.logger.error(`Authorization failed: ${data.error} - ${data.error_description}`);
133
- return false;
134
- }
135
- if (data.error) {
136
- this.logger.error(`Unexpected error: ${data.error} - ${data.error_description}`);
137
- return false;
138
- }
57
+ async waitForSignIn() {
58
+ const success = await this.cliAuthProvider.waitForLogin();
59
+ if (success) {
60
+ this.cachedState = undefined;
61
+ this.updateAuthState(await this.cliAuthProvider.getAuthState());
139
62
  }
140
- return false;
63
+ return success;
141
64
  }
142
- async fetchAccountLabel(accessToken, enterpriseUrl) {
143
- try {
144
- const apiBaseUrl = enterpriseUrl
145
- ? `https://${enterpriseUrl.replace(/^https?:\/\//, '').replace(/\/$/, '')}/api/v3`
146
- : 'https://api.github.com';
147
- const response = await fetch(`${apiBaseUrl}/user`, {
148
- headers: {
149
- 'Authorization': `Bearer ${accessToken}`,
150
- 'User-Agent': this.oauthConfig.userAgent,
151
- 'Accept': 'application/vnd.github.v3+json'
152
- }
153
- });
154
- if (response.ok) {
155
- const userData = await response.json();
156
- return userData.login;
157
- }
158
- }
159
- catch (error) {
160
- this.logger.warn('Failed to fetch GitHub user info:', error);
161
- }
162
- return undefined;
65
+ async cancelSignIn() {
66
+ await this.cliAuthProvider.cancelLogin();
67
+ }
68
+ async signOut() {
69
+ await this.cliAuthProvider.signOut();
70
+ this.cachedState = undefined;
71
+ this.updateAuthState(await this.getAuthState());
163
72
  }
164
73
  async getAuthState() {
165
- if (this.cachedState) {
166
- return this.cachedState;
167
- }
168
- try {
169
- const stored = await this.keyStoreService.getPassword(this.oauthConfig.keystoreService, this.oauthConfig.keystoreAccount);
170
- if (stored) {
171
- const credentials = JSON.parse(stored);
172
- // Tokens from the current OAuth App start with 'gho_'; other prefixes (e.g. 'ghu_') indicate a token from the previous GitHub App (Iv-prefixed client ID).
173
- if (!credentials.accessToken.startsWith('gho_')) {
174
- this.logger.info('Copilot: clearing outdated GitHub App token. Please sign in again.');
175
- await this.keyStoreService.deletePassword(this.oauthConfig.keystoreService, this.oauthConfig.keystoreAccount);
176
- this.cachedState = { isAuthenticated: false, migrationRequired: true };
177
- return this.cachedState;
178
- }
179
- this.cachedState = {
180
- isAuthenticated: true,
181
- accountLabel: credentials.accountLabel,
182
- enterpriseUrl: credentials.enterpriseUrl
183
- };
184
- return this.cachedState;
185
- }
186
- }
187
- catch (error) {
188
- this.logger.warn('Failed to retrieve Copilot credentials:', error);
74
+ // Awaited so that a state requested early cannot be cached without the migration flag, which
75
+ // is the only thing that tells the user why they were signed out. The frontend evaluates it
76
+ // once at startup, so losing it there means losing it altogether.
77
+ await this.legacyCleanup;
78
+ if (!this.cachedState) {
79
+ this.cachedState = await this.computeAuthState();
189
80
  }
190
- this.cachedState = { isAuthenticated: false };
191
81
  return this.cachedState;
192
82
  }
193
- async getAccessToken() {
194
- try {
195
- const stored = await this.keyStoreService.getPassword(this.oauthConfig.keystoreService, this.oauthConfig.keystoreAccount);
196
- if (stored) {
197
- const credentials = JSON.parse(stored);
198
- return credentials.accessToken;
199
- }
200
- }
201
- catch (error) {
202
- this.logger.warn('Failed to retrieve Copilot access token:', error);
203
- }
204
- return undefined;
205
- }
206
- async signOut() {
207
- try {
208
- await this.keyStoreService.deletePassword(this.oauthConfig.keystoreService, this.oauthConfig.keystoreAccount);
209
- }
210
- catch (error) {
211
- this.logger.warn('Failed to delete Copilot credentials:', error);
212
- }
213
- const newState = { isAuthenticated: false };
214
- this.updateAuthState(newState);
83
+ /**
84
+ * The state as it currently is, with the request for a new sign-in attached when the credentials
85
+ * of the previous integration had to be discarded and none have been established since.
86
+ *
87
+ * Does not await the cleanup, so that it can be used from it.
88
+ */
89
+ async computeAuthState() {
90
+ const state = await this.cliAuthProvider.getAuthState();
91
+ return state.isAuthenticated || !this.migrationRequired ? state : { ...state, migrationRequired: true };
215
92
  }
216
93
  updateAuthState(state) {
217
94
  this.cachedState = state;
218
95
  this.onAuthStateChangedEmitter.fire(state);
219
96
  this.client?.onAuthStateChanged(state);
220
97
  }
221
- delay(ms) {
222
- return new Promise(resolve => setTimeout(resolve, ms));
223
- }
224
98
  };
225
99
  exports.CopilotAuthServiceImpl = CopilotAuthServiceImpl;
226
100
  tslib_1.__decorate([
227
- (0, inversify_1.inject)(key_store_1.KeyStoreService),
228
- tslib_1.__metadata("design:type", Object)
229
- ], CopilotAuthServiceImpl.prototype, "keyStoreService", void 0);
101
+ (0, inversify_1.inject)(copilot_cli_auth_provider_1.CopilotCliAuthProvider),
102
+ tslib_1.__metadata("design:type", copilot_cli_auth_provider_1.CopilotCliAuthProvider)
103
+ ], CopilotAuthServiceImpl.prototype, "cliAuthProvider", void 0);
104
+ tslib_1.__decorate([
105
+ (0, inversify_1.inject)(copilot_credential_store_1.CopilotCredentialStore),
106
+ tslib_1.__metadata("design:type", copilot_credential_store_1.CopilotCredentialStore)
107
+ ], CopilotAuthServiceImpl.prototype, "credentialStore", void 0);
108
+ tslib_1.__decorate([
109
+ (0, inversify_1.inject)(copilot_cli_locator_1.CopilotCliLocator),
110
+ tslib_1.__metadata("design:type", copilot_cli_locator_1.CopilotCliLocator)
111
+ ], CopilotAuthServiceImpl.prototype, "cliLocator", void 0);
230
112
  tslib_1.__decorate([
231
113
  (0, inversify_1.inject)(core_1.ILogger),
232
114
  (0, inversify_1.named)('ai-copilot:CopilotAuthServiceImpl'),
233
115
  tslib_1.__metadata("design:type", Object)
234
116
  ], CopilotAuthServiceImpl.prototype, "logger", void 0);
235
117
  tslib_1.__decorate([
236
- (0, inversify_1.inject)(copilot_oauth_config_1.CopilotOAuthConfig),
237
- tslib_1.__metadata("design:type", Object)
238
- ], CopilotAuthServiceImpl.prototype, "oauthConfig", void 0);
118
+ (0, inversify_1.postConstruct)(),
119
+ tslib_1.__metadata("design:type", Function),
120
+ tslib_1.__metadata("design:paramtypes", []),
121
+ tslib_1.__metadata("design:returntype", void 0)
122
+ ], CopilotAuthServiceImpl.prototype, "init", null);
239
123
  exports.CopilotAuthServiceImpl = CopilotAuthServiceImpl = tslib_1.__decorate([
240
124
  (0, inversify_1.injectable)()
241
125
  ], CopilotAuthServiceImpl);
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-auth-service-impl.js","sourceRoot":"","sources":["../../src/node/copilot-auth-service-impl.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAyE;AACzE,sCAAsD;AACtD,gEAAmE;AAOnE,yEAAoE;AAEpE,MAAM,aAAa,GAAG,WAAW,CAAC;AAClC,MAAM,kBAAkB,GAAG,8CAA8C,CAAC;AAE1E;;;GAGG;AACH,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAQhC;;;GAGG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QAcgB,8BAAyB,GAAG,IAAI,cAAO,EAAoB,CAAC;QACtE,uBAAkB,GAA4B,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;IA6NhG,CAAC;IA3NG,SAAS,CAAC,MAA4C;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAES,iBAAiB,CAAC,aAAsB;QAC9C,IAAI,aAAa,EAAE,CAAC;YAChB,MAAM,MAAM,GAAG,aAAa;iBACvB,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;iBAC3B,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACxB,OAAO;gBACH,aAAa,EAAE,WAAW,MAAM,oBAAoB;gBACpD,cAAc,EAAE,WAAW,MAAM,2BAA2B;aAC/D,CAAC;QACN,CAAC;QACD,OAAO;YACH,aAAa,EAAE,sCAAsC;YACrD,cAAc,EAAE,6CAA6C;SAChE,CAAC;IACN,CAAC;IAED,KAAK,CAA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