ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / copilot / src / extension / contextKeys / vscode-node / contextKeys.contribution.ts 290 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
import { commands, extensions, window } from 'vscode' ;
import { IAuthenticationService, MinimalModeError } from '../../../platform/authentication/common/authentication' ;
import { TokenErrorReason } from '../../../platform/authentication/common/copilotToken' ;
import { ContactSupportError, EnterpriseManagedError, GitHubLoginFailedError, InvalidTokenError, NotSignedUpError, RateLimitedError, SubscriptionExpiredError } from '../../../platform/authentication/vscode-node/copilotTokenManager' ;
import { SESSION_LOGIN_MESSAGE } from '../../../platform/authentication/vscode-node/session' ;
import { ConfigKey IConfigurationService
IExperimentationService
IEnvService
ILogService
ITelemetryService
TelemetryData
Disposable
autorun
isClientBYOKAllowed
welcomeViewContextKeys
Activated
Offline
IndividualDisabled
IndividualExpired
ContactSupport
EnterpriseDisabled
InvalidToken
RateLimited
GitHubLoginFailed
chatQuotaExceededContextKey
showLogViewContextKey
debugReportFeedbackContextKey
previewFeaturesDisabledContextKey
blackbirdExternalIndexingDisabledContextKey
clientByokEnabledContextKey
debugContextKey
missingPermissiveSessionContextKey
prExtensionInstalledContextKey
sessionSearchEnabledContextKey
_needsOfflineCheck
_scheduledOfflineCheck TimeoutHandle
_showLogView
_lastContextKey
_authenticationService IAuthenticationService
_telemetryService ITelemetryService
_logService ILogService
_configService IConfigurationService
_envService IEnvService
_expService IExperimentationService
error
error
error
_authenticationService
_authenticationService
commands
commands
_showLogView
commands showLogViewContextKey
commands
window
debugReportFeedback _configService ConfigKey TeamInternal DebugReportFeedback
reader
commands debugReportFeedbackContextKey debugReportFeedback reader
sessionSearchEnabled _configService ConfigKey LocalIndexEnabled _expService
reader
commands sessionSearchEnabledContextKey sessionSearchEnabled reader
extensions
_needsOfflineCheck
_logService
window state active window state focused
delayInSeconds
_scheduledOfflineCheck
_scheduledOfflineCheck
delayInSeconds
trigger
_logService
_needsOfflineCheck window state active window state focused
err _logService err
_needsOfflineCheck
_scheduledOfflineCheck
_scheduledOfflineCheck
_scheduledOfflineCheck
_logService
allKeys Object welcomeViewContextKeys
error
key
_authenticationService
key welcomeViewContextKeys Activated
e
error e
reason e message e
data TelemetryData reason
_telemetryService data properties data measurements
reason satisfies TokenErrorReason
_logService
_logService
error
key welcomeViewContextKeys IndividualDisabled
error
key welcomeViewContextKeys IndividualExpired
error
key welcomeViewContextKeys EnterpriseDisabled
error
key welcomeViewContextKeys ContactSupport
error
key welcomeViewContextKeys InvalidToken
error
key welcomeViewContextKeys GitHubLoginFailed
error
extensions isActive
error
key welcomeViewContextKeys RateLimited
key welcomeViewContextKeys Offline
key
key _lastContextKey
_logService
_lastContextKey key
commands key
contextKey allKeys
contextKey key
commands contextKey
copilotToken _authenticationService
commands chatQuotaExceededContextKey copilotToken isChatQuotaExceeded
e
commands chatQuotaExceededContextKey
copilotToken _authenticationService
disabled copilotToken
disabled
_logService
commands previewFeaturesDisabledContextKey disabled
e
commands previewFeaturesDisabledContextKey
copilotToken _authenticationService
commands blackbirdExternalIndexingDisabledContextKey copilotToken
e
commands blackbirdExternalIndexingDisabledContextKey
hasGitHubSession _authenticationService anyGitHubSession
copilotToken _authenticationService
commands clientByokEnabledContextKey hasGitHubSession copilotToken
e
commands clientByokEnabledContextKey hasGitHubSession
_showLogView
_showLogView _authenticationService copilotToken isInternal _envService
_showLogView
commands showLogViewContextKey _showLogView
commands debugContextKey _envService
isPrExtensionInstalled extensions
commands prExtensionInstalledContextKey isPrExtensionInstalled
hasPermissiveSession
missingPermissiveSession
_authenticationService isMinimalMode
hasPermissiveSession _authenticationService silent
error
error
_logService
hasPermissiveSession _authenticationService permissiveGitHubSession
missingPermissiveSession hasPermissiveSession
commands missingPermissiveSessionContextKey missingPermissiveSession
,
}
from
'../../../platform/configuration/common/configurationService'
;
import
{
}
from
'../../../platform/telemetry/common/nullExperimentationService'
;
import
{
}
from
'../../../platform/env/common/envService'
;
import
{
}
from
'../../../platform/log/common/logService'
;
import
{
}
from
'../../../platform/telemetry/common/telemetry'
;
import
{
}
from
'../../../platform/telemetry/common/telemetryData'
;
import
{
}
from
'../../../util/vs/base/common/lifecycle'
;
import
{
}
from
'../../../util/vs/base/common/observableInternal'
;
import
{
GHPR_EXTENSION_ID
}
from
'../../chatSessions/vscode/chatSessionsUriHandler'
;
import
{
}
from
'../../byok/common/byokProvider'
;
import
{
EXTENSION_ID
}
from
'../../common/constants'
;
const
=
{
:
'github.copilot-chat.activated'
,
:
'github.copilot.offline'
,
:
'github.copilot.interactiveSession.individual.disabled'
,
:
'github.copilot.interactiveSession.individual.expired'
,
:
'github.copilot.interactiveSession.contactSupport'
,
:
'github.copilot.interactiveSession.enterprise.disabled'
,
:
'github.copilot.interactiveSession.invalidToken'
,
:
'github.copilot.interactiveSession.rateLimited'
,
:
'github.copilot.interactiveSession.gitHubLoginFailed'
,
}
;
const
=
'github.copilot.chat.quotaExceeded'
;
const
=
` github.copilot.chat.showLogView `
;
const
=
'github.copilot.debugReportFeedback'
;
const
=
'github.copilot.previewFeaturesDisabled'
;
const
=
'github.copilot.blackbirdExternalIndexingDisabled'
;
const
=
'github.copilot.clientByokEnabled'
;
const
=
'github.copilot.chat.debug'
;
const
=
'github.copilot.auth.missingPermissiveSession'
;
export
const
=
'github.copilot.prExtensionInstalled'
;
const
=
'github.copilot.sessionSearch.enabled'
;
export
class
ContextKeysContribution
extends
Disposable
{
private
=
false
;
private
:
|
undefined
;
private
=
false
;
private
:
string
|
undefined
;
constructor
(
@ IAuthenticationService
private
readonly
:
,
@ ITelemetryService
private
readonly
:
,
@ ILogService
private
readonly
:
,
@ IConfigurationService
private
readonly
:
,
@ IEnvService
private
readonly
:
,
@ IExperimentationService
private
readonly
:
)
{
super
(
)
;
void
this
.
_inspectContext
(
)
.
catch
(
console
.
)
;
void
this
.
_updatePermissiveSessionContext
(
)
.
catch
(
console
.
)
;
void
this
.
_updateClientByokEnabledContext
(
)
.
catch
(
console
.
)
;
this
.
_register
(
.
onDidAuthenticationChange
(
async
(
)
=>
await
this
.
_onAuthenticationChange
(
)
)
)
;
this
.
_register
(
.
onDidCopilotTokenChange
(
(
)
=>
this
.
_onCopilotTokenChange
(
)
)
)
;
this
.
_register
(
.
registerCommand
(
'github.copilot.refreshToken'
,
async
(
)
=>
await
this
.
_inspectContext
(
)
)
)
;
this
.
_register
(
.
registerCommand
(
'github.copilot.debug.showChatLogView'
,
async
(
)
=>
{
this
.
=
true
;
await
.
executeCommand
(
'setContext'
,
,
true
)
;
await
.
executeCommand
(
'copilot-chat.focus'
)
;
}
)
)
;
this
.
_register
(
{
dispose
:
(
)
=>
this
.
_cancelPendingOfflineCheck
(
)
}
)
;
this
.
_register
(
.
onDidChangeWindowState
(
(
)
=>
this
.
_runOfflineCheck
(
'Window state change'
)
)
)
;
this
.
_updateShowLogViewContext
(
)
;
this
.
_updateDebugContext
(
)
;
this
.
_updatePrExtensionInstalledContext
(
)
;
const
=
this
.
.
getConfigObservable
(
.
.
)
;
this
.
_register
(
autorun
(
=>
{
.
executeCommand
(
'setContext'
,
,
.
read
(
)
)
;
}
)
)
;
const
=
this
.
.
getExperimentBasedConfigObservable
(
.
,
this
.
)
;
this
.
_register
(
autorun
(
=>
{
.
executeCommand
(
'setContext'
,
,
.
read
(
)
)
;
}
)
)
;
this
.
_register
(
.
onDidChange
(
(
)
=>
{
this
.
_updatePrExtensionInstalledContext
(
)
;
}
)
)
;
}
private
_scheduleOfflineCheck
(
)
{
this
.
_cancelPendingOfflineCheck
(
)
;
this
.
=
true
;
this
.
.
debug
(
` [context keys] Scheduling offline check. Active: ${ window. state. active} , focused: ${ window. state. focused} . `
)
;
if
(
.
.
&&
.
.
)
{
const
=
60
;
this
.
=
setTimeout
(
(
)
=>
{
this
.
=
undefined
;
this
.
_runOfflineCheck
(
'Scheduled offline check'
)
;
}
,
*
1000
)
;
}
}
private
_runOfflineCheck
(
:
string
)
{
this
.
.
debug
(
` [context keys] ${ trigger} . Needs offline check: ${ this . _needsOfflineCheck} , active: ${ window. state. active} , focused: ${ window. state. focused} . `
)
;
if
(
this
.
&&
.
.
&&
.
.
)
{
this
.
_inspectContext
(
)
.
catch
(
=>
this
.
.
error
(
)
)
;
}
}
private
_cancelPendingOfflineCheck
(
)
{
this
.
=
false
;
if
(
this
.
)
{
clearTimeout
(
this
.
)
;
this
.
=
undefined
;
}
}
private
async
_inspectContext
(
)
{
this
.
.
debug
(
` [context keys] Updating context keys. `
)
;
this
.
_cancelPendingOfflineCheck
(
)
;
const
=
.
values
(
)
;
let
:
unknown
|
undefined
=
undefined
;
let
:
string
|
undefined
;
try
{
await
this
.
.
getCopilotToken
(
)
;
=
.
;
}
catch
(
:
any
)
{
=
;
const
=
.
||
;
const
=
.
createAndMarkAsIssued
(
{
}
)
;
this
.
.
sendGHTelemetryErrorEvent
(
'activationFailed'
,
.
,
.
)
;
if
(
===
(
'GitHubLoginFailed'
)
)
{
this
.
.
debug
(
SESSION_LOGIN_MESSAGE
)
;
}
else
{
this
.
.
error
(
` GitHub Copilot could not connect to server. Extension activation failed: " ${ reason} " `
)
;
}
}
if
(
instanceof
NotSignedUpError
)
{
=
.
;
}
else
if
(
instanceof
SubscriptionExpiredError
)
{
=
.
;
}
else
if
(
instanceof
EnterpriseManagedError
)
{
=
.
;
}
else
if
(
instanceof
ContactSupportError
)
{
=
.
;
}
else
if
(
instanceof
InvalidTokenError
)
{
=
.
;
}
else
if
(
instanceof
GitHubLoginFailedError
)
{
=
.
;
}
else
if
(
)
{
if
(
!
.
getExtension
(
EXTENSION_ID
)
?.
)
{
if
(
instanceof
RateLimitedError
)
{
=
.
;
}
else
{
=
.
;
}
}
this
.
_scheduleOfflineCheck
(
)
;
}
if
(
)
{
if
(
!==
this
.
)
{
this
.
.
info
(
` [context keys] Setting context key: ${ key} `
)
;
this
.
=
;
}
.
executeCommand
(
'setContext'
,
,
true
)
;
}
for
(
const
of
)
{
if
(
!==
)
{
.
executeCommand
(
'setContext'
,
,
false
)
;
}
}
await
this
.
_updatePermissiveSessionContext
(
)
;
}
private
async
_updateQuotaExceededContext
(
)
{
try
{
const
=
await
this
.
.
getCopilotToken
(
)
;
.
executeCommand
(
'setContext'
,
,
.
)
;
}
catch
(
)
{
.
executeCommand
(
'setContext'
,
,
false
)
;
}
}
private
async
_updatePreviewFeaturesDisabledContext
(
)
{
try
{
const
=
await
this
.
.
getCopilotToken
(
)
;
const
=
!
.
isEditorPreviewFeaturesEnabled
(
)
;
if
(
)
{
this
.
.
warn
(
` Copilot preview features are disabled by organizational policy. Learn more: https://aka.ms/github-copilot-org-enable-features `
)
;
}
.
executeCommand
(
'setContext'
,
,
)
;
}
catch
(
)
{
.
executeCommand
(
'setContext'
,
,
undefined
)
;
}
}
private
async
_updateBlackbirdExternalIndexingDisabledContext
(
)
{
try
{
const
=
await
this
.
.
getCopilotToken
(
)
;
.
executeCommand
(
'setContext'
,
,
!
.
isBlackbirdExternalIndexingEnabled
(
)
)
;
}
catch
(
)
{
.
executeCommand
(
'setContext'
,
,
undefined
)
;
}
}
private
async
_updateClientByokEnabledContext
(
)
{
const
=
!
!
this
.
.
;
try
{
const
=
await
this
.
.
getCopilotToken
(
)
;
.
executeCommand
(
'setContext'
,
,
isClientBYOKAllowed
(
,
)
)
;
}
catch
(
)
{
.
executeCommand
(
'setContext'
,
,
isClientBYOKAllowed
(
,
undefined
)
)
;
}
}
private
_updateShowLogViewContext
(
)
{
if
(
this
.
)
{
return
;
}
this
.
=
!
!
this
.
.
?.
||
!
this
.
.
isProduction
(
)
;
if
(
this
.
)
{
.
executeCommand
(
'setContext'
,
,
this
.
)
;
}
}
private
_updateDebugContext
(
)
{
.
executeCommand
(
'setContext'
,
,
!
this
.
.
isProduction
(
)
)
;
}
private
_updatePrExtensionInstalledContext
(
)
{
const
=
!
!
.
getExtension
(
GHPR_EXTENSION_ID
)
;
.
executeCommand
(
'setContext'
,
,
)
;
}
private
async
_onAuthenticationChange
(
)
{
this
.
_inspectContext
(
)
;
this
.
_updatePermissiveSessionContext
(
)
;
}
private
_onCopilotTokenChange
(
)
{
this
.
_updateQuotaExceededContext
(
)
;
this
.
_updatePreviewFeaturesDisabledContext
(
)
;
this
.
_updateBlackbirdExternalIndexingDisabledContext
(
)
;
this
.
_updateClientByokEnabledContext
(
)
;
this
.
_updateShowLogViewContext
(
)
;
}
private
async
_updatePermissiveSessionContext
(
)
{
let
=
false
;
let
=
false
;
if
(
!
this
.
.
)
{
try
{
=
!
!
(
await
this
.
.
getGitHubSession
(
'permissive'
,
{
:
true
}
)
)
;
}
catch
(
)
{
if
(
!
(
instanceof
MinimalModeError
)
)
{
this
.
.
trace
(
` [context keys] Failed to resolve permissive session: ${ error instanceof Error ? error. message : String ( error) } `
)
;
=
!
!
this
.
.
;
}
}
=
!
;
}
.
executeCommand
(
'setContext'
,
,
)
;
}
}