Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Resolves when the welcome/setup flow has completed (or immediately
* if it is not currently active). Use this to defer work until after
* the user has finished the initial sign-in or setup dialog.
*/
/** True while the window is open for a signed-out user via the conditional-auth opt-in. */
private
=
false
;
/**
* Set once the initial default-account resolution has completed. Until then
* the synchronous {@link IDefaultAccountService.currentDefaultAccount} snapshot
* is `null` even for a signed-in user, so a `null` reading means "not known
* yet", not "signed out". The conditional-auth reaction stays inert until this
* flips, otherwise it forces a sign-in modal on a signed-in user during the
* startup gap — one nothing can retire, since the account resolves silently.
*/
private
=
false
;
private
=
false
;
/** Whether the window may proceed without GitHub sign-in. */
private
readonly
:
<
boolean
>
;
// Non-service params must come before @-decorated service params
constructor
(
private
readonly
onCompleted
:
(
)
=>
void
,
private
readonly
serviceWhenSetupDone
:
(
)
=>
Promise
<
boolean
>
,
private
readonly
serviceMarkDone
:
(
)
=>
void
,
private
readonly
onInitialSignInDialogShown
:
(
)
=>
void
,
@IDefaultAccountService
private
readonly
:
,
@IProductService
private
readonly
:
,
@IStorageService
private
readonly
:
,
@IContextKeyService
private
readonly
:
,
@IWorkbenchEnvironmentService
private
readonly
:
,
@IAuthenticationService
private
readonly
:
,
@ILogService
private
readonly
:
,
@ICommandService
private
readonly
:
,
@IConfigurationService
private
readonly
:
,
@IWorkbenchLayoutService
private
readonly
:
,
@IKeybindingService
private
readonly
:
,
@IHostService
private
readonly
:
,
@IMarkdownRendererService
private
readonly
:
,
@IInstantiationService
private
readonly
:
,
@ISessionsManagementService
private
readonly
:
,
)
{
super
(
)
;
this
.
=
observeAllowSignedOutWhenUsable
(
this
.
)
;
this
.
_register
(
runOnChange
(
this
.
,
(
)
=>
this
.
_onAllowSignedOutWhenUsableChanged
(
)
)
)
;
this
.
_register
(
this
.
.
onDidChangeSessionTypes
(
(
)
=>
this
.
_onSessionTypesChanged
(
)
)
)
;
this
.
_start
(
)
;
}
private
_onSessionTypesChanged
(
)
:
void
{
const
=
this
.
.
!==
null
;
if
(
conditionalAuthState
(
this
.
,
)
===
.
)
{
this
.
_reevaluateSignedOut
(
)
;
}
}
/**
* The opt-in was toggled while the window is open. Ignored until the account
* has resolved (see {@link _accountResolved}) and for signed-in users. For a
* signed-out user, turning it on retires an already-open sign-in modal (it was
* raised before the account resolved); turning it off falls back to demanding
* sign-in.
*/
private
_onAllowSignedOutWhenUsableChanged
(
)
:
void
{
// Only act once the account has resolved AND the user is signed out; while
// unresolved or signed in, the sign-in watch owns the decision.
const
=
this
.
.
!==
null
;
if
(
conditionalAuthState
(
this
.
,
)
!==
.
)
{
return
;
}
this
.
_reevaluateSignedOut
(
)
;
}
private
_start
(
)
:
void
{
if
(
!
this
.
.
?.
)
{
this
.
onCompleted
(
)
;
return
;
}
if
(
shouldSkipSessionsWelcome
(
this
.
)
)
{
this
.
onCompleted
(
)
;
return
;
}
// Learn when the default account resolves so the conditional-auth reaction
// can tell "signed out" from "not resolved yet". On first load the account
// is populated silently (no change event fires), so awaiting it once is the
// only signal that resolution has happened.
this
.
.
getDefaultAccount
(
)
.
then
(
(
)
=>
{
if
(
this
.
.
)
{
return
;
}
this
.
=
true
;
// The initial setup flow re-reads the setting after this account promise.
if
(
!
this
.
&&
this
.
.
get
(
)
)
{
this
.
_onAllowSignedOutWhenUsableChanged
(
)
;
}
}
)
;
if
(
)
{
void
this
.
_checkWebAuth
(
)
.
finally
(
(
)
=>
this
.
=
false
)
;
this
.
_watchWebAuth
(
)
;
return
;
}
const
=
!
this
.
.
getBoolean
(
WELCOME_COMPLETE_KEY
,
.
APPLICATION
,
false
)
;
if
(
this
.
.
get
(
)
)
{
// Signed-out operation is permitted by configuration: skip the forced
// sign-in/welcome dialogs entirely (including the first-launch flow)
// and open the window directly.
this
.
.
store
(
WELCOME_COMPLETE_KEY
,
true
,
.
APPLICATION
,
.
MACHINE
)
;
void
this
.
_proceedWithoutGitHub
(
)
.
finally
(
(
)
=>
this
.
=
false
)
;
}
else
if
(
)
{
void
this
.
_showWelcome
(
true
)
.
finally
(
(
)
=>
this
.
=
false
)
;
}
else
{
void
this
.
_watchSignInState
(
)
.
finally
(
(
)
=>
this
.
=
false
)
;
}
}
private
async
_checkWebAuth
(
)
:
Promise
<
void
>
{
try
{
const
=
await
this
.
.
getSessions
(
'github'
)
;
if
(
.
>
0
)
{
this
.
.
info
(
'[sessions welcome] GitHub session found on web, skipping welcome'
)
;
this
.
.
store
(
WELCOME_COMPLETE_KEY
,
true
,
.
APPLICATION
,
.
MACHINE
)
;
this
.
onCompleted
(
)
;
return
;
}
}
catch
{
// Provider not available yet — show dialog
}
this
.
_showWelcome
(
false
)
;
}
private
_watchWebAuth
(
)
:
void
{
this
.
_register
(
this
.
.
onDidChangeSessions
(
async
=>
{
if
(
.
!==
'github'
||
!
.
.
?.
)
{
return
;
}
try
{
const
=
await
this
.
.
getSessions
(
'github'
)
;
if
(
.
>
0
)
{
return
;
}
}
catch
{
// Provider became unavailable — treat as signed out
}
this
.
.
info
(
'[sessions welcome] GitHub session removed on web, re-showing welcome'
)
;
this
.
.
remove
(
WELCOME_COMPLETE_KEY
,
.
APPLICATION
)
;
this
.
_showWelcome
(
false
)
;
}
)
)
;
}
private
async
_watchSignInState
(
)
:
Promise
<
void
>
{
const
=
await
this
.
.
getDefaultAccount
(
)
;
if
(
this
.
.
)
{
return
;
}
if
(
!
)
{
const
=
this
.
.
getBoolean
(
WELCOME_COMPLETE_KEY
,
.
APPLICATION
,
false
)
;
if
(
&&
this
.
.
get
(
)
)
{
await
this
.
_proceedWithoutGitHub
(
)
;
}
else
{
this
.
_showWelcome
(
false
)
;
}
return
;
}
await
this
.
_ensureAIFeaturesEnabled
(
)
;
this
.
onCompleted
(
)
;
this
.
.
=
this
.
_watchActiveState
(
true
)
;
}
private
_watchActiveState
(
:
boolean
)
:
{
const
=
new
DisposableStore
(
)
;
.
add
(
this
.
.
onDidChangeDefaultAccount
(
=>
{
const
=
!==
null
;
if
(
&&
!
)
{
// Signed out: drop the completion marker and re-consult the gate.
this
.
.
remove
(
WELCOME_COMPLETE_KEY
,
.
APPLICATION
)
;
this
.
_reevaluateSignedOut
(
)
;
}
else
if
(
!
&&
)
{
// Signed in while running signed-out: the window is already open.
this
.
=
false
;
}
=
;
}
)
)
;
.
add
(
this
.
.
onDidChangeConfiguration
(
=>
{
if
(
.
affectsConfiguration
(
)
)
{
if
(
this
.
.
getValue<boolean>
(
)
)
{
this
.
_showAIDisabledDialog
(
)
;
}
else
{
// AI features re-enabled — dismiss any AI disabled dialog
this
.
.
clear
(
)
;
}
}
}
)
)
;
return
;
}
/**
* Resolve the window-level signed-out gate from the opt-in and the live auth
* requirement of every advertised session type.
*/
private
_signedOutWindowGate
(
)
:
{
return
resolveSignedOutWindowGate
(
this
.
.
get
(
)
,
this
.
.
getAllProviderSessionTypes
(
)
.
map
(
(
{
}
)
=>
.
)
,
)
;
}
/**
* Re-run the signed-out decision after an input change: force GitHub sign-in
* when the gate demands it, otherwise open the window without GitHub. A no-op
* while a dialog is up — that dialog owns the next transition.
*/
private
_reevaluateSignedOut
(
)
:
void
{
if
(
this
.
)
{
return
;
}
if
(
this
.
&&
this
.
.
get
(
)
)
{
return
;
}
const
=
this
.
_signedOutWindowGate
(
)
;
if
(
===
.
)
{
this
.
=
true
;
return
;
}
if
(
this
.
)
{
this
.
=
false
;
this
.
.
clear
(
)
;
}
if
(
===
.
)
{
if
(
this
.
.
)
{
return
;
}
this
.
=
false
;
void
this
.
_showWelcome
(
false
)
;
}
else
{
this
.
.
?.
cancel
(
)
;
this
.
.
clear
(
)
;
void
this
.
_proceedWithoutGitHub
(
)
;
}
}
/**
* Open the Agents window for a signed-out user because the opt-in permits it.
* Mirrors the signed-in completion path and remains active until sign-in or the
* opt-in changes. Idempotent while already proceeding.
*/
private
async
_proceedWithoutGitHub
(
)
:
Promise
<
void
>
{
if
(
this
.
)
{
return
;
}
this
.
=
true
;
this
.
.
info
(
'[sessions welcome] Proceeding without GitHub sign-in; signed-out operation is enabled'
)
;
await
this
.
_ensureAIFeaturesEnabled
(
)
;
if
(
this
.
.
)
{
return
;
}
this
.
onCompleted
(
)
;
this
.
.
=
this
.
_watchActiveState
(
false
)
;
}
private
async
_ensureAIFeaturesEnabled
(
)
:
Promise
<
void
>
{
if
(
this
.
.
getValue<boolean>
(
)
)
{
this
.
.
info
(
'[sessions welcome] AI features disabled, enabling'
)
;
await
this
.
.
updateValue
(
,
false
)
;
}
}
private
async
_showAIDisabledDialog
(
)
:
Promise
<
void
>
{
if
(
this
.
.
)
{
return
;
}
this
.
.
info
(
'[sessions welcome] AI features disabled, showing enable dialog'
)
;
const
=
new
DisposableStore
(
)
;
this
.
.
=
;
const
=
.
bindTo
(
this
.
)
;
.
set
(
true
)
;
.
add
(
toDisposable
(
(
)
=>
.
reset
(
)
)
)
;
const
=
.
add
(
new
Dialog
(
this
.
.
,
''
,
[
localize
(
'sessions.aiDisabled.enable'
,
"Enable AI Features"
)
]
,
createWorkbenchDialogOptions
(
{
:
'none'
,
:
[
'chat-setup-dialog'
,
'sessions-welcome-dialog'
]
,
:
localize
(
'sessions.aiDisabled.detail'
,
"Enable AI features to continue using Agents."
)
,
:
.
,
:
.
,
:
1
,
:
true
,
:
true
,
}
,
this
.
,
this
.
,
this
.
)
)
)
;
const
{
}
=
await
.
show
(
)
;
.
dispose
(
)
;
this
.
.
clear
(
)
;
if
(
===
0
)
{
this
.
.
info
(
'[sessions welcome] User chose to enable AI features'
)
;
await
this
.
.
updateValue
(
,
false
)
;
}
}
private
async
_showWelcome
(
:
boolean
)
:
Promise
<
void
>
{
if
(
this
.
.
)
{
return
;
}
// A non-first-launch _showWelcome means the user is signed out. Consult the
// last-resort GitHub gate before forcing sign-in: with the opt-in on, open
// the window instead.
if
(
!
)
{
const
=
this
.
_signedOutWindowGate
(
)
;
if
(
===
.
)
{
this
.
=
true
;
return
;
}
if
(
===
.
)
{
await
this
.
_proceedWithoutGitHub
(
)
;
return
;
}
}
this
.
.
clear
(
)
;
this
.
.
=
new
DisposableStore
(
)
;
const
=
.
bindTo
(
this
.
)
;
.
set
(
true
)
;
this
.
.
.
add
(
toDisposable
(
(
)
=>
.
reset
(
)
)
)
;
if
(
)
{
const
=
this
.
_showLoadingOverlay
(
)
;
this
.
.
.
add
(
)
;
const
=
await
this
.
.
getDefaultAccount
(
)
;
if
(
this
.
.
)
{
return
;
}
.
.
.
add
(
'sessions-loading-dismissed'
)
;
this
.
.
.
add
(
disposableTimeout
(
(
)
=>
.
.
remove
(
)
,
200
)
)
;
if
(
)
{
const
=
await
this
.
serviceWhenSetupDone
(
)
;
if
(
this
.
.
)
{
return
;
}
if
(
)
{
this
.
.
store
(
WELCOME_COMPLETE_KEY
,
true
,
.
APPLICATION
,
.
MACHINE
)
;
this
.
.
clear
(
)
;
this
.
_watchSignInState
(
)
;
return
;
}
await
this
.
_showWelcomeDialog
(
)
;
}
else
{
const
=
this
.
.
get
(
)
;
const
=
await
this
.
_showSignInDialog
(
)
;
if
(
)
{
this
.
.
store
(
WELCOME_COMPLETE_KEY
,
true
,
.
APPLICATION
,
.
MACHINE
)
;
this
.
serviceMarkDone
(
)
;
this
.
.
clear
(
)
;
await
this
.
_proceedWithoutGitHub
(
)
;
return
;
}
}
}
else
{
await
this
.
_showSignInDialog
(
)
;
}
this
.
.
clear
(
)
;
await
this
.
_ensureAIFeaturesEnabled
(
)
;
this
.
_watchSignInState
(
)
;
}
private
_showLoadingOverlay
(
)
:
{
:
}
&
{
const
=
append
(
this
.
.
,
$
(
'div.sessions-loading-overlay'
)
)
;
.
setAttribute
(
'role'
,
'status'
)
;
.
setAttribute
(
'aria-busy'
,
'true'
)
;
.
setAttribute
(
'aria-label'
,
localize
(
'loading'
,
"Loading"
)
)
;
append
(
,
$
(
'div.sessions-loading-icon.codicon.codicon-agent'
)
)
;
return
{
:
,
dispose
:
(
)
=>
.
remove
(
)
}
;
}
private
async
_showSignInDialog
(
=
false
)
:
Promise
<
boolean
>
{
if
(
this
.
)
{
this
.
onInitialSignInDialogShown
(
)
;
}
this
.
.
info
(
'[sessions welcome] Showing sign-in dialog'
)
;
const
=
new
CancellationTokenSource
(
)
;
this
.
.
=
;
while
(
true
)
{
const
=
new
DisposableStore
(
)
;
const
=
.
add
(
new
MutableDisposable<SessionsSigningInDialog>
(
)
)
;
let
=
false
;
let
=
false
;
const
=
!
&&
(
await
this
.
.
executeCommand<boolean>
(
SHOULD_SHOW_RETURN_TO_VSCODE_EDITOR_COMMAND_ID
)
)
===
true
;
const
onContinueWithoutSignIn
=
(
)
=>
{
if
(
!
this
.
.
get
(
)
)
{
return
;
}
=
true
;
.
cancel
(
)
;
}
;
let
:
boolean
|
undefined
;
try
{
=
await
this
.
.
executeCommand<boolean>
(
'workbench.action.chat.triggerSetup'
,
undefined
,
{
...
createSessionsSignInDialogOptions
(
this
.
,
,
,
)
,
:
.
,
onSignInStarted
:
(
cancel
:
(
)
=>
void
)
=>
{
.
=
this
.
.
createInstance
(
,
(
)
=>
{
=
true
;
cancel
(
)
;
}
)
;
}
}
)
;
}
finally
{
.
dispose
(
)
;
}
if
(
)
{
this
.
.
info
(
'[sessions welcome] User chose to continue without GitHub sign-in'
)
;
this
.
.
clear
(
)
;
return
true
;
}
if
(
.
.
)
{
this
.
.
info
(
'[sessions welcome] Sign-in dialog retired because another agent became usable'
)
;
this
.
.
clear
(
)
;
return
false
;
}
if
(
)
{
this
.
.
info
(
'[sessions welcome] Sign-in canceled; returning to sign-in dialog'
'[sessions welcome] Sign-in was canceled or failed'
)
;
}
this
.
.
clear
(
)
;
return
false
;
}
}
private
async
_showWelcomeDialog
(
)
:
Promise
<
void
>
{
this
.
.
info
(
'[sessions welcome] Showing welcome dialog'
)
;
const
=
new
DisposableStore
(
)
;
const
=
localize
(
'walkthrough.productName'
,
"{0} - Agents"
,
this
.
.
)
;
const
=
.
add
(
new
Dialog
(
this
.
.
,
localize
(
'sessions.welcome.title'
,
"Welcome to {0}"
,
)
,
[
localize
(
'sessions.welcome.getStarted'
,
"Get Started"
)
]
,
createWorkbenchDialogOptions
(
{
:
'none'
,
:
[
'chat-setup-dialog'
,
'sessions-welcome-dialog'
,
'sessions-main-welcome-dialog'
]
,
:
localize
(
'sessions.welcome.detail'
,
"Your AI-powered coding experience where agents explore, build, and iterate with you."
)
,
:
.
,
:
.
,
:
1
,
:
true
,
renderFooter
:
=>
.
appendChild
(
this
.
_createWelcomeFooter
(
)
)
,
}
,
this
.
,
this
.
,
this
.
)
)
)
;
await
.
show
(
)
;
.
dispose
(
)
;
this
.
.
store
(
WELCOME_COMPLETE_KEY
,
true
,
.
APPLICATION
,
.
MACHINE
)
;
this
.
serviceMarkDone
(
)
;
}
private
_createWelcomeFooter
(
:
)
:
{
const
=
$
(
'.chat-setup-dialog-footer'
)
;
const
=
this
.
.
;
const
=
?.
?.
?.
??
'GitHub'
;
const
=
?.
??
''
;
const
=
?.
??
''
;
const
=
?.
??
''
;
const
=
this
.
.
resolveGitHubUrl
(
.
)
;
const
=
localize
(
{
:
'welcomeFooter'
,
:
[
'{Locked="["}'
,
'{Locked="]({1})"}'
,
'{Locked="]({2})"}'
,
'{Locked="]({4})"}'
,
'{Locked="]({5})"}'
]
}
,
"By continuing, you agree to {0}'s [Terms]({1}) and [Privacy Statement]({2}). {3} Copilot may show [public code]({4}) suggestions and use your data to improve the product. You can change these [settings]({5}) anytime."