@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,6 +1,6 @@
1
1
  "use strict";
2
2
  // *****************************************************************************
3
- // Copyright (C) 2026 EclipseSource and others.
3
+ // Copyright (C) 2026 EclipseSource GmbH and others.
4
4
  //
5
5
  // This program and the accompanying materials are made available under the
6
6
  // terms of the Eclipse Public License v. 2.0 which is available at
@@ -16,183 +16,119 @@
16
16
  // *****************************************************************************
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const chai_1 = require("chai");
19
- const sinon = require("sinon");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const key_store_1 = require("@theia/core/lib/common/key-store");
22
- const copilot_oauth_config_1 = require("../common/copilot-oauth-config");
23
- const copilot_auth_service_impl_1 = require("./copilot-auth-service-impl");
24
- const logger_1 = require("@theia/core/lib/common/logger");
25
19
  const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
26
- describe('CopilotAuthServiceImpl', () => {
27
- let authService;
28
- let keyStoreService;
29
- let getPasswordStub;
30
- beforeEach(() => {
31
- const container = new inversify_1.Container();
32
- getPasswordStub = sinon.stub();
33
- keyStoreService = {
34
- setPassword: sinon.stub().resolves(),
35
- getPassword: getPasswordStub.resolves(undefined),
36
- deletePassword: sinon.stub().resolves(true),
37
- findPassword: sinon.stub().resolves(undefined),
38
- findCredentials: sinon.stub().resolves([]),
39
- keys: sinon.stub().resolves([])
20
+ const copilot_auth_service_impl_1 = require("./copilot-auth-service-impl");
21
+ class TestableCopilotAuthServiceImpl extends copilot_auth_service_impl_1.CopilotAuthServiceImpl {
22
+ constructor() {
23
+ super();
24
+ this.stubs = {
25
+ legacyRemoved: false,
26
+ legacyDelay: 0,
27
+ authState: { isAuthenticated: false },
28
+ authStateCalls: 0,
29
+ configuredPath: undefined,
30
+ deleted: 0
40
31
  };
41
- container.bind(key_store_1.KeyStoreService).toConstantValue(keyStoreService);
42
- container.bind(copilot_oauth_config_1.CopilotOAuthConfig).toConstantValue(copilot_oauth_config_1.DEFAULT_COPILOT_OAUTH_CONFIG);
43
- container.bind(copilot_auth_service_impl_1.CopilotAuthServiceImpl).toSelf().inSingletonScope();
44
- container.bind(logger_1.ILogger).to(mock_logger_1.MockLogger).inSingletonScope();
45
- authService = container.get(copilot_auth_service_impl_1.CopilotAuthServiceImpl);
46
- });
47
- afterEach(() => {
48
- sinon.restore();
49
- });
50
- describe('getAccessToken', () => {
51
- it('should return undefined when no credentials are stored', async () => {
52
- getPasswordStub.resolves(undefined);
53
- const token = await authService.getAccessToken();
54
- (0, chai_1.expect)(token).to.be.undefined;
55
- });
56
- it('should return the stored access token directly', async () => {
57
- const oauthToken = 'ghu_test_token';
58
- getPasswordStub.resolves(JSON.stringify({
59
- accessToken: oauthToken,
60
- accountLabel: 'testuser'
61
- }));
62
- const token = await authService.getAccessToken();
63
- (0, chai_1.expect)(token).to.equal(oauthToken);
64
- });
65
- it('should return undefined when stored data is malformed', async () => {
66
- getPasswordStub.resolves('not-valid-json');
67
- const token = await authService.getAccessToken();
68
- (0, chai_1.expect)(token).to.be.undefined;
32
+ const stubs = this.stubs;
33
+ Object.assign(this, {
34
+ logger: new mock_logger_1.MockLogger(),
35
+ credentialStore: {
36
+ deleteLegacy: async () => {
37
+ await new Promise(resolve => setTimeout(resolve, stubs.legacyDelay));
38
+ return stubs.legacyRemoved;
39
+ }
40
+ },
41
+ cliLocator: { setConfiguredPath: (path) => { stubs.configuredPath = path; } },
42
+ cliAuthProvider: {
43
+ getAuthState: async () => {
44
+ stubs.authStateCalls++;
45
+ return stubs.authState;
46
+ },
47
+ signOut: async () => {
48
+ stubs.deleted++;
49
+ stubs.authState = { isAuthenticated: false };
50
+ },
51
+ waitForLogin: async () => true
52
+ }
69
53
  });
54
+ }
55
+ /** Runs what `@postConstruct` runs in production. */
56
+ start() {
57
+ this.init();
58
+ }
59
+ }
60
+ describe('CopilotAuthServiceImpl - migration of the previous sign-in', () => {
61
+ it('should report that a new sign-in is required, even when asked before the cleanup finished', async () => {
62
+ const service = new TestableCopilotAuthServiceImpl();
63
+ service.stubs.legacyRemoved = true;
64
+ // The frontend evaluates the flag once at startup, so a state cached without it loses it.
65
+ service.stubs.legacyDelay = 20;
66
+ service.start();
67
+ (0, chai_1.expect)(await service.getAuthState()).to.deep.include({ isAuthenticated: false, migrationRequired: true });
70
68
  });
71
- describe('getAuthState', () => {
72
- it('should return not authenticated when no credentials are stored', async () => {
73
- getPasswordStub.resolves(undefined);
74
- const state = await authService.getAuthState();
75
- (0, chai_1.expect)(state.isAuthenticated).to.be.false;
76
- (0, chai_1.expect)(state.accountLabel).to.be.undefined;
77
- });
78
- it('should return authenticated with account label when credentials exist', async () => {
79
- getPasswordStub.resolves(JSON.stringify({
80
- accessToken: 'gho_test',
81
- accountLabel: 'testuser',
82
- enterpriseUrl: undefined
83
- }));
84
- const state = await authService.getAuthState();
85
- (0, chai_1.expect)(state.isAuthenticated).to.be.true;
86
- (0, chai_1.expect)(state.accountLabel).to.equal('testuser');
87
- });
88
- it('should return enterprise URL when stored', async () => {
89
- getPasswordStub.resolves(JSON.stringify({
90
- accessToken: 'gho_test',
91
- accountLabel: 'testuser',
92
- enterpriseUrl: 'github.mycompany.com'
93
- }));
94
- const state = await authService.getAuthState();
95
- (0, chai_1.expect)(state.isAuthenticated).to.be.true;
96
- (0, chai_1.expect)(state.enterpriseUrl).to.equal('github.mycompany.com');
97
- });
98
- it('should clear outdated non-gho_ token and flag migration', async () => {
99
- getPasswordStub.resolves(JSON.stringify({
100
- accessToken: 'ghu_old_token',
101
- accountLabel: 'testuser'
102
- }));
103
- const state = await authService.getAuthState();
104
- (0, chai_1.expect)(state.isAuthenticated).to.be.false;
105
- (0, chai_1.expect)(state.migrationRequired).to.be.true;
106
- (0, chai_1.expect)(keyStoreService.deletePassword.calledOnce).to.be.true;
107
- });
108
- it('should cache the auth state after first retrieval', async () => {
109
- getPasswordStub.resolves(JSON.stringify({
110
- accessToken: 'gho_test',
111
- accountLabel: 'testuser'
112
- }));
113
- const state1 = await authService.getAuthState();
114
- const state2 = await authService.getAuthState();
115
- (0, chai_1.expect)(state1).to.equal(state2);
116
- (0, chai_1.expect)(getPasswordStub.calledOnce).to.be.true;
117
- });
69
+ it('should not claim a migration when there was nothing to discard', async () => {
70
+ const service = new TestableCopilotAuthServiceImpl();
71
+ service.start();
72
+ (0, chai_1.expect)(await service.getAuthState()).to.not.have.property('migrationRequired');
118
73
  });
119
- describe('signOut', () => {
120
- it('should clear cached auth state on sign out', async () => {
121
- getPasswordStub.resolves(JSON.stringify({
122
- accessToken: 'gho_test',
123
- accountLabel: 'testuser'
124
- }));
125
- const stateBefore = await authService.getAuthState();
126
- (0, chai_1.expect)(stateBefore.isAuthenticated).to.be.true;
127
- await authService.signOut();
128
- // After sign out, cached state should be cleared
129
- // getAuthState should now return the new state without hitting keystore cache
130
- const stateAfter = await authService.getAuthState();
131
- (0, chai_1.expect)(stateAfter.isAuthenticated).to.be.false;
132
- });
133
- it('should fire auth state changed event on sign out', async () => {
134
- const stateChanges = [];
135
- authService.onAuthStateChanged(state => stateChanges.push(state));
136
- await authService.signOut();
137
- (0, chai_1.expect)(stateChanges).to.have.lengthOf(1);
138
- (0, chai_1.expect)(stateChanges[0].isAuthenticated).to.be.false;
139
- });
140
- it('should delete credentials from keystore on sign out', async () => {
141
- await authService.signOut();
142
- (0, chai_1.expect)(keyStoreService.deletePassword.calledOnce).to.be.true;
143
- });
144
- it('should notify client on sign out', async () => {
145
- const client = { onAuthStateChanged: sinon.stub() };
146
- authService.setClient(client);
147
- await authService.signOut();
148
- (0, chai_1.expect)(client.onAuthStateChanged.calledOnce).to.be.true;
149
- (0, chai_1.expect)(client.onAuthStateChanged.firstCall.args[0].isAuthenticated).to.be.false;
150
- });
74
+ it('should not claim a migration for a user who is signed in', async () => {
75
+ const service = new TestableCopilotAuthServiceImpl();
76
+ service.stubs.legacyRemoved = true;
77
+ service.stubs.authState = { isAuthenticated: true, accountLabel: 'octocat' };
78
+ service.start();
79
+ (0, chai_1.expect)(await service.getAuthState()).to.not.have.property('migrationRequired');
80
+ });
81
+ it('should survive a keychain that cannot be read', async () => {
82
+ const service = new TestableCopilotAuthServiceImpl();
83
+ Object.assign(service, { credentialStore: { deleteLegacy: async () => { throw new Error('keychain unavailable'); } } });
84
+ service.start();
85
+ (0, chai_1.expect)(await service.getAuthState()).to.deep.equal({ isAuthenticated: false });
151
86
  });
152
87
  });
153
- describe('CopilotAuthServiceImpl with custom CopilotOAuthConfig', () => {
154
- const customConfig = {
155
- clientId: 'CustomClientId',
156
- userAgent: 'MyApp/1.0.0',
157
- keystoreService: 'myapp-copilot',
158
- keystoreAccount: 'myapp-github'
159
- };
160
- let authService;
161
- let getPasswordStub;
162
- let deletePasswordStub;
163
- beforeEach(() => {
164
- const container = new inversify_1.Container();
165
- container.bind(logger_1.ILogger).to(mock_logger_1.MockLogger).inSingletonScope();
166
- getPasswordStub = sinon.stub().resolves(undefined);
167
- deletePasswordStub = sinon.stub().resolves(true);
168
- const keyStoreService = {
169
- setPassword: sinon.stub().resolves(),
170
- getPassword: getPasswordStub,
171
- deletePassword: deletePasswordStub,
172
- findPassword: sinon.stub().resolves(undefined),
173
- findCredentials: sinon.stub().resolves([]),
174
- keys: sinon.stub().resolves([])
175
- };
176
- container.bind(key_store_1.KeyStoreService).toConstantValue(keyStoreService);
177
- container.bind(copilot_oauth_config_1.CopilotOAuthConfig).toConstantValue(customConfig);
178
- container.bind(copilot_auth_service_impl_1.CopilotAuthServiceImpl).toSelf().inSingletonScope();
179
- authService = container.get(copilot_auth_service_impl_1.CopilotAuthServiceImpl);
88
+ describe('CopilotAuthServiceImpl - state', () => {
89
+ it('should ask the provider once and serve the cached state afterwards', async () => {
90
+ const service = new TestableCopilotAuthServiceImpl();
91
+ service.start();
92
+ await service.getAuthState();
93
+ await service.getAuthState();
94
+ (0, chai_1.expect)(service.stubs.authStateCalls).to.equal(1);
180
95
  });
181
- afterEach(() => {
182
- sinon.restore();
96
+ it('should report the new state after a sign-in', async () => {
97
+ const service = new TestableCopilotAuthServiceImpl();
98
+ service.start();
99
+ await service.getAuthState();
100
+ service.stubs.authState = { isAuthenticated: true, accountLabel: 'octocat' };
101
+ const reported = [];
102
+ service.onAuthStateChanged(state => reported.push(state));
103
+ (0, chai_1.expect)(await service.waitForSignIn()).to.be.true;
104
+ (0, chai_1.expect)(reported).to.deep.equal([{ isAuthenticated: true, accountLabel: 'octocat' }]);
105
+ (0, chai_1.expect)(await service.getAuthState()).to.deep.equal({ isAuthenticated: true, accountLabel: 'octocat' });
183
106
  });
184
- it('should read credentials from the custom keystore service and account', async () => {
185
- getPasswordStub.resolves(JSON.stringify({
186
- accessToken: 'gho_custom_token',
187
- accountLabel: 'customuser'
188
- }));
189
- const token = await authService.getAccessToken();
190
- (0, chai_1.expect)(token).to.equal('gho_custom_token');
191
- (0, chai_1.expect)(getPasswordStub.calledOnceWith(customConfig.keystoreService, customConfig.keystoreAccount)).to.be.true;
107
+ it('should report the new state after signing out', async () => {
108
+ const service = new TestableCopilotAuthServiceImpl();
109
+ service.stubs.authState = { isAuthenticated: true, accountLabel: 'octocat' };
110
+ service.start();
111
+ await service.getAuthState();
112
+ const reported = [];
113
+ service.onAuthStateChanged(state => reported.push(state));
114
+ await service.signOut();
115
+ (0, chai_1.expect)(service.stubs.deleted).to.equal(1);
116
+ (0, chai_1.expect)(reported).to.deep.equal([{ isAuthenticated: false }]);
117
+ });
118
+ });
119
+ describe('CopilotAuthServiceImpl - executable path', () => {
120
+ it('should hand the configured location to the lookup, which cannot read preferences itself', async () => {
121
+ const service = new TestableCopilotAuthServiceImpl();
122
+ service.start();
123
+ await service.setExecutablePath('/opt/copilot/copilot');
124
+ (0, chai_1.expect)(service.stubs.configuredPath).to.equal('/opt/copilot/copilot');
192
125
  });
193
- it('should delete credentials from the custom keystore service and account on sign out', async () => {
194
- await authService.signOut();
195
- (0, chai_1.expect)(deletePasswordStub.calledOnceWith(customConfig.keystoreService, customConfig.keystoreAccount)).to.be.true;
126
+ it('should hand on that nothing is configured, so that the CLI is searched for', async () => {
127
+ const service = new TestableCopilotAuthServiceImpl();
128
+ service.start();
129
+ await service.setExecutablePath('/opt/copilot/copilot');
130
+ await service.setExecutablePath(undefined);
131
+ (0, chai_1.expect)(service.stubs.configuredPath).to.be.undefined;
196
132
  });
197
133
  });
198
134
  //# sourceMappingURL=copilot-auth-service-impl.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-auth-service-impl.spec.js","sourceRoot":"","sources":["../../src/node/copilot-auth-service-impl.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,+BAA8B;AAC9B,+BAA+B;AAC/B,4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C;QAE5B,IAAA,aAAM,EAAC,kBAAkB,CAAC,cAAc,CAAC,YAAY,CAAC,eAAe,EAAE,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IACrH,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"copilot-auth-service-impl.spec.js","sourceRoot":"","sources":["../../src/node/copilot-auth-service-impl.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,+BAA8B;AAC9B,yEAAqE;AAErE,2EAAqE;AAarE,MAAM,8BAA+B,SAAQ,kDAAsB;IAW/D;QACI,KAAK,EAAE,CAAC;QAVH,UAAK,GAAU;YACpB,aAAa,EAAE,KAAK;YACpB,WAAW,EAAE,CAAC;YACd,SAAS,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE;YACrC,cAAc,EAAE,CAAC;YACjB,cAAc,EAAE,SAAS;YACzB,OAAO,EAAE,CAAC;SACb,CAAC;QAIE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;YAChB,MAAM,EAAE,IAAI,wBAAU,EAAE;YACxB,eAAe,EAAE;gBACb,YAAY,EAAE,KAAK,IAAI,EAAE;oBACrB,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;oBACrE,OAAO,KAAK,CAAC,aAAa,CAAC;gBAC/B,CAAC;aACJ;YACD,UAAU,EAAE,EAAE,iBAAiB,EAAE,CAAC,IAAwB,EAAE,EAAE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AO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC3C,IAAA,aAAM,EAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/copilot-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAwC/D,wBAGG"}
1
+ {"version":3,"file":"copilot-backend-module.d.ts","sourceRoot":"","sources":["../../src/node/copilot-backend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAkD/D,wBAEG"}
@@ -19,10 +19,19 @@ const inversify_1 = require("@theia/core/shared/inversify");
19
19
  const core_1 = require("@theia/core");
20
20
  const connection_container_module_1 = require("@theia/core/lib/node/messaging/connection-container-module");
21
21
  const common_1 = require("../common");
22
- const copilot_oauth_config_1 = require("../common/copilot-oauth-config");
23
22
  const copilot_language_models_manager_impl_1 = require("./copilot-language-models-manager-impl");
23
+ const copilot_sdk_client_provider_1 = require("./copilot-sdk-client-provider");
24
+ const copilot_sdk_loader_1 = require("./copilot-sdk-loader");
25
+ const copilot_cli_auth_provider_1 = require("./copilot-cli-auth-provider");
26
+ const copilot_cli_locator_1 = require("./copilot-cli-locator");
27
+ const copilot_credential_store_1 = require("./copilot-credential-store");
24
28
  const copilot_auth_service_impl_1 = require("./copilot-auth-service-impl");
25
29
  const copilotConnectionModule = connection_container_module_1.ConnectionContainerModule.create(({ bind }) => {
30
+ bind(copilot_cli_locator_1.CopilotCliLocator).toSelf().inSingletonScope();
31
+ bind(copilot_sdk_loader_1.CopilotSdkLoader).toSelf().inSingletonScope();
32
+ bind(copilot_credential_store_1.CopilotCredentialStore).toSelf().inSingletonScope();
33
+ bind(copilot_sdk_client_provider_1.CopilotSdkClientProvider).toSelf().inSingletonScope();
34
+ bind(copilot_cli_auth_provider_1.CopilotCliAuthProvider).toSelf().inSingletonScope();
26
35
  bind(copilot_auth_service_impl_1.CopilotAuthServiceImpl).toSelf().inSingletonScope();
27
36
  bind(common_1.CopilotAuthService).toService(copilot_auth_service_impl_1.CopilotAuthServiceImpl);
28
37
  bind(copilot_language_models_manager_impl_1.CopilotLanguageModelsManagerImpl).toSelf().inSingletonScope();
@@ -35,7 +44,6 @@ const copilotConnectionModule = connection_container_module_1.ConnectionContaine
35
44
  bind(core_1.ConnectionHandler).toDynamicValue(ctx => new core_1.RpcConnectionHandler(common_1.COPILOT_LANGUAGE_MODELS_MANAGER_PATH, () => ctx.container.get(common_1.CopilotLanguageModelsManager))).inSingletonScope();
36
45
  });
37
46
  exports.default = new inversify_1.ContainerModule(bind => {
38
- bind(copilot_oauth_config_1.CopilotOAuthConfig).toConstantValue(copilot_oauth_config_1.DEFAULT_COPILOT_OAUTH_CONFIG);
39
47
  bind(connection_container_module_1.ConnectionContainerModule).toConstantValue(copilotConnectionModule);
40
48
  });
41
49
  //# sourceMappingURL=copilot-backend-module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"copilot-backend-module.js","sourceRoot":"","sources":["../../src/node/copilot-backend-module.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,4DAA+D;AAC/D,sCAAsE;AACtE,4GAAuG;AACvG,sCAMmB;AACnB,yEAAkG;AAClG,iGAA0F;AAC1F,2EAAqE;AAErE,MAAM,uBAAuB,GAAG,uDAAyB,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;IAC1E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GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAyB,2BAAkB,CAAC,CAAC;QAClF,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9B,OAAO,WAAW,CAAC;IACvB,CAAC,CACJ,CACJ,CAAC,gBAAgB,EAAE,CAAC;IAErB,IAAI,CAAC,wBAAiB,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CACzC,IAAI,2BAAoB,CACpB,6CAAoC,EACpC,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,qCAA4B,CAAC,CACxD,CACJ,CAAC,gBAAgB,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC;AAEH,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAI,CAAC,uDAAyB,CAAC,CAAC,eAAe,CAAC,uBAAuB,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC"}
@@ -0,0 +1,146 @@
1
+ import { ChildProcess } from 'child_process';
2
+ import { Deferred } from '@theia/core/lib/common/promise-util';
3
+ import { ILogger } from '@theia/core';
4
+ import { CopilotAuthState, DeviceCodeResponse } from '../common/copilot-auth-service';
5
+ import { CopilotCliLocator } from './copilot-cli-locator';
6
+ import { CopilotCredentialStore } from './copilot-credential-store';
7
+ import { CopilotSdkClientProvider } from './copilot-sdk-client-provider';
8
+ /**
9
+ * Authentication against GitHub Copilot, performed by the official Copilot CLI on our behalf.
10
+ *
11
+ * Access to the Copilot features is granted per OAuth application and the built-in Theia OAuth app
12
+ * is not entitled for them, whereas the Copilot CLI is. This provider therefore does not run an
13
+ * OAuth flow of its own but drives `copilot login --device-code` and reports its progress, so that
14
+ * the familiar sign-in dialog can be used.
15
+ *
16
+ * The credentials end up owned by this application rather than by the CLI: the login is run against
17
+ * a private, temporary Copilot home with the system keychain disabled, so that the CLI writes its
18
+ * token there instead of into the user's keyring. The token is then moved into
19
+ * {@link CopilotCredentialStore} and the temporary home is removed. Signing out consequently only
20
+ * has to delete our own entry, and never touches credentials of the user's machine such as their
21
+ * keyring entries or their GitHub CLI sign-in.
22
+ */
23
+ export declare class CopilotCliAuthProvider {
24
+ protected readonly sdkClientProvider: CopilotSdkClientProvider;
25
+ protected readonly cliLocator: CopilotCliLocator;
26
+ protected readonly credentialStore: CopilotCredentialStore;
27
+ protected readonly logger: ILogger;
28
+ protected loginProcess: ChildProcess | undefined;
29
+ protected loginResult: Deferred<boolean> | undefined;
30
+ protected loginHome: string | undefined;
31
+ protected loginEnterpriseUrl: string | undefined;
32
+ protected loginAccountLabel: string | undefined;
33
+ /**
34
+ * Stops a sign-in that is still in progress when the connection this provider belongs to closes.
35
+ * Unbinding a container runs `@preDestroy` rather than `dispose`, matching the client provider.
36
+ * Without this, the `copilot login` child process and the temporary home holding its token would
37
+ * be left behind.
38
+ */
39
+ protected stop(): void;
40
+ /**
41
+ * Starts `copilot login --device-code` and resolves once it reported the code the user has to
42
+ * enter. The process keeps running and polls GitHub itself until {@link waitForLogin} is awaited.
43
+ */
44
+ startLogin(enterpriseUrl?: string): Promise<DeviceCodeResponse>;
45
+ /**
46
+ * Waits for the login started by {@link startLogin} to complete.
47
+ * Resolves `false` when the authorization was denied or expired.
48
+ */
49
+ waitForLogin(): Promise<boolean>;
50
+ /**
51
+ * Moves the token the CLI just persisted into our own credential store.
52
+ */
53
+ protected storeCredentials(home: string): Promise<void>;
54
+ /**
55
+ * Terminates a login that is still in progress, if any.
56
+ *
57
+ * Resolves once the token the CLI may already have written has been removed again, so that a
58
+ * caller which cancels a sign-in can rely on nothing being left behind in plain text.
59
+ */
60
+ cancelLogin(): Promise<void>;
61
+ /**
62
+ * Reports whether this application holds Copilot credentials.
63
+ *
64
+ * Deliberately based on our own store rather than on what the Copilot CLI reports: the CLI also
65
+ * accepts a token from the environment or the sign-in of the GitHub CLI, and neither of those is
66
+ * a sign-in of this application, so neither may make it appear signed in.
67
+ */
68
+ getAuthState(): Promise<CopilotAuthState>;
69
+ /**
70
+ * Discards the credentials of this application. Nothing outside of it is touched.
71
+ */
72
+ signOut(): Promise<void>;
73
+ /**
74
+ * Creates the private Copilot home the login is run against.
75
+ */
76
+ protected createLoginHome(): Promise<string>;
77
+ /**
78
+ * Writes the opener the CLI is pointed at instead of a real browser, and returns its path.
79
+ *
80
+ * The CLI opens a browser whenever it believes one is available, even for the device code flow, and
81
+ * prefers the command in `BROWSER` over the opener of the platform. Pointing it at a script that
82
+ * does nothing is therefore the reliable way to keep the flow in the dialog, where the user can read
83
+ * and copy the code. Opening a browser would also be wrong whenever the backend does not run on the
84
+ * user's own machine.
85
+ */
86
+ protected createNoopBrowser(home: string): Promise<string>;
87
+ /**
88
+ * Removes the private Copilot home, including the token the CLI wrote into it.
89
+ */
90
+ protected removeLoginHome(home: string): Promise<void>;
91
+ /**
92
+ * Builds the environment for the login process.
93
+ *
94
+ * The CLI is pointed at a private home and its use of the system keychain is disabled, so that
95
+ * it persists the token where we can take it over instead of in the keyring of the user. Tokens
96
+ * from the environment are removed so that a sign-in always establishes fresh credentials rather
97
+ * than silently succeeding with something the user configured elsewhere.
98
+ */
99
+ protected createLoginEnv(home: string, noopBrowser: string): Record<string, string | undefined>;
100
+ /**
101
+ * Searches the configuration the CLI wrote in its private home for the persisted token.
102
+ *
103
+ * The file and the field the CLI uses are not part of its public interface, so every JSON file it
104
+ * wrote is searched for a value shaped like a GitHub token rather than relying on a fixed layout.
105
+ */
106
+ protected findStoredToken(home: string): Promise<string | undefined>;
107
+ /**
108
+ * The files of the private home that are inspected for the token.
109
+ *
110
+ * The logs are skipped, and the configuration the CLI writes is not plain JSON but carries
111
+ * comments, so the files are searched as text rather than parsed.
112
+ */
113
+ protected listCandidateFiles(home: string): Promise<string[]>;
114
+ /**
115
+ * Searches text for a value shaped like a GitHub token.
116
+ *
117
+ * Only the files the CLI wrote into the private home of this sign-in are searched, so anything
118
+ * shaped like a token in them is the token that was just obtained.
119
+ */
120
+ protected findTokenInText(text: string): string | undefined;
121
+ /**
122
+ * Extracts the login the CLI reported for the account that signed in, if it reported one.
123
+ */
124
+ protected parseAccountLabel(output: string): string | undefined;
125
+ /**
126
+ * Extracts the verification URL and the user code from the output of the CLI.
127
+ * Returns `undefined` while the output does not contain both yet.
128
+ */
129
+ protected parseDeviceCode(output: string): DeviceCodeResponse | undefined;
130
+ /**
131
+ * Describes why a login failed, based on what the CLI reported.
132
+ *
133
+ * A line that names the problem is preferred, and the tail of the output is used otherwise, since
134
+ * the wording of the CLI is not stable enough to rely on and a bare exit code is not diagnosable.
135
+ */
136
+ protected extractFailure(output: string): string | undefined;
137
+ /**
138
+ * Turns the configured GitHub Enterprise deployment into the URL the CLI is pointed at.
139
+ *
140
+ * A bare domain is the expected form and gets a scheme. Plain HTTP is upgraded rather than passed
141
+ * on: the sign-in carries credentials, and a host that only matched "http" at the start of its
142
+ * name, such as `httpbin.example.com`, must not be mistaken for a URL that already has a scheme.
143
+ */
144
+ protected toHostUrl(enterpriseUrl: string): string;
145
+ }
146
+ //# sourceMappingURL=copilot-cli-auth-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-cli-auth-provider.d.ts","sourceRoot":"","sources":["../../src/node/copilot-cli-auth-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,YAAY,EAAS,MAAM,eAAe,CAAC;AAKpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAO,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAiBzE;;;;;;;;;;;;;;GAcG;AACH,qBACa,sBAAsB;IAG/B,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,wB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