Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Builds common headers for update requests, including those issued
* via Electron's auto-updater (e.g. setFeedURL({ url, headers })) and
* manual HTTP requests that bypass the auto-updater. The headers include
* OS version information which the update server uses for EOL detection.
*
* On macOS, the User-Agent includes the Darwin kernel version.
* On Windows, the User-Agent includes accurate Windows version from the registry.
*/
export
function
getUpdateRequestHeaders
(
:
string
)
:
<
string
,
string
>
|
undefined
{
if
(
)
{
const
=
.
release
(
)
;
return
{
'User-Agent'
:
`Code/${productVersion} Darwin/${darwinVersion}`
}
;
}
if
(
)
{
const
=
getWindowsReleaseSync
(
)
.
match
(
/^(\d+\.\d+)/
)
;
if
(
)
{
return
{
'User-Agent'
:
`Code/${productVersion} Electron/${process.versions.electron} Windows NT ${match[1]}`
}
;
}
}
return
undefined
;
}
export
type
UpdateErrorClassification
=
{
:
'joaomoreno'
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The hash of the error message.'
}
;
:
'This is used to know how often VS Code updates have failed.'
;
}
;
/**
* States representing in-flight or pending update work that takes time to tear down when updates
* are disabled at runtime. Used to decide whether to surface a transient `Cancelling` state.
*/
function
isCancellableState
(
:
)
:
boolean
{
switch
(
)
{
case
.
:
case
.
:
case
.
:
case
.
:
case
.
:
case
.
:
case
.
:
return
true
;
default
:
return
false
;
}
}
interface
IInternalUpdateState
{
readonly
:
;
readonly
:
boolean
;
}
export
abstract
class
AbstractUpdateService
extends
Disposable
implements
IUpdateService
{
declare
readonly
:
undefined
;
protected
:
string
|
undefined
;
private
:
=
{
:
.
,
:
false
}
;
protected
:
boolean
=
false
;
private
:
boolean
=
false
;
private
readonly
=
this
.
_register
(
new
IntervalTimer
(
)
)
;
private
:
string
|
undefined
=
undefined
;
/** Disabled for a non-reversible reason (e.g. not built, missing config); ignores `update.mode` changes. */
/** Cancels the pending scheduled update check, if any. */
private
readonly
=
this
.
_register
(
new
MutableDisposable<IDisposable>
(
)
)
;
/** Serializes reconfiguration so overlapping `update.mode` changes settle on the latest value. */
private
readonly
=
this
.
_register
(
new
Throttler
(
)
)
;
private
readonly
=
this
.
_register
(
new
Emitter<State>
(
)
)
;
readonly
:
<
>
=
this
.
.
;
get
state
(
)
:
{
return
this
.
.
;
}
protected
setState
(
:
,
?
:
{
?
:
boolean
}
)
:
void
{
if
(
.
===
.
)
{
this
.
.
trace
(
'update#setState'
,
.
)
;
}
else
{
this
.
.
info
(
'update#setState'
,
.
)
;
}
this
.
=
{
,
:
?.
??
false
}
;
this
.
.
fire
(
)
;
// Clear transient one-time properties from Idle state after delivering the event.
// This prevents new windows from seeing stale error/notAvailable messages.
if
(
.
===
.
&&
(
.
||
.
)
)
{
this
.
=
{
:
.
Idle
(
.
)
,
:
false
}
;
}
// Schedule 5-minute checks when in Ready state and overwrite is supported
if
(
this
.
)
{
if
(
.
===
.
)
{
this
.
.
cancelAndSet
(
(
)
=>
this
.
checkForOverwriteUpdates
(
)
,
5
*
60
*
1000
)
;
}
else
{
this
.
.
cancel
(
)
;
}
}
}
private
setDeferred
(
:
boolean
)
:
void
{
if
(
this
.
.
!==
)
{
this
.
=
{
...
this
.
,
}
;
}
}
constructor
(
@ILifecycleMainService
protected
readonly
:
,
@IConfigurationService
protected
:
,
@IEnvironmentMainService
protected
:
,
@IRequestService
protected
:
,
@ILogService
protected
:
,
@IProductService
protected
readonly
:
,
@ITelemetryService
protected
readonly
:
,
@IApplicationStorageMainService
protected
readonly
:
,
@IMeteredConnectionService
protected
readonly
:
,
protected
readonly
:
boolean
,
)
{
super
(
)
;
.
when
(
.
)
.
finally
(
(
)
=>
this
.
initialize
(
)
)
;
this
.
_register
(
this
.
.
onDidChangeIsConnectionMetered
(
=>
{
if
(
!
)
{
this
.
resumeAutomaticUpdates
(
)
;
}
}
)
)
;
}
/**
* This must be called before any other call. This is a performance
* optimization, to avoid using extra CPU cycles before first window open.
* https://github.com/microsoft/vscode/issues/89784
*/
protected
async
initialize
(
)
:
Promise
<
void
>
{
if
(
!
this
.
.
)
{
this
.
setDisabledPermanently
(
.
)
;
return
;
// updates are never enabled when running out of sources
}
await
this
.
trackVersionChange
(
)
;
if
(
this
.
.
)
{
this
.
setDisabledPermanently
(
.
)
;
this
.
.
info
(
'update#ctor - updates are disabled by the environment'
)
;
return
;
}
if
(
!
this
.
.
||
!
this
.
.
)
{
this
.
setDisabledPermanently
(
.
)
;
this
.
.
info
(
'update#ctor - updates are disabled as there is no update URL'
)
;
return
;
}
await
this
.
.
;
// React to runtime `update.mode`/policy changes so switching to/from `none` applies without a restart.
this
.
_register
(
this
.
.
onDidChangeConfiguration
(
=>
{
if
(
.
affectsConfiguration
(
'update.mode'
)
)
{
this
.
reconfigure
(
)
.
catch
(
=>
this
.
.
error
(
'update#reconfigure - failed to apply update mode change'
,
)
)
;
}
}
)
)
;
// Apply the currently configured update mode.
await
this
.
reconfigure
(
)
;
}
/**
* Evaluates the current `update.mode` setting (and its policy) and brings the service into the matching state.
* Runs on startup and on every change, enabling or disabling updates without a restart.
*/
private
reconfigure
(
)
:
Promise
<
void
>
{
return
this
.
.
queue
(
(
)
=>
this
.
doReconfigure
(
)
)
;
}
private
async
doReconfigure
(
)
:
Promise
<
void
>
{
if
(
this
.
)
{
return
;
}
const
=
this
.
.
getValue<'none'|'manual'|'start'|'default'>
(
'update.mode'
)
;
const
=
this
.
.
inspect<'none'|'manual'|'start'|'default'>
(
'update.mode'
)
;
const
=
.
!==
undefined
&&
!
this
.
getProductQuality
(
.
)
;
const
=
this
.
getProductQuality
(
)
;
if
(
!
)
{
const
=
?
.
:
.
;
// Skip if already disabled for this reason, so a repeated write or policy refresh is a no-op.
if
(
this
.
.
===
.
&&
this
.
.
===
)
{
return
;
}
await
this
.
disable
(
)
;
return
;
}
if
(
!
this
.
buildUpdateFeedUrl
(
,
this
.
.
!
)
)
{
this
.
setDisabledPermanently
(
.
)
;
this
.
.
info
(
'update#ctor - updates are disabled as the update URL is badly formed'
)
;
return
;
}
this
.
=
;
// Move to Idle so one-time platform init (which may resume a pending update) can act; it requires Idle.
if
(
this
.
.
===
.
||
this
.
.
===
.
)
{
this
.
setState
(
.
Idle
(
this
.
getUpdateType
(
)
)
)
;
}
// One-time platform init, gated behind updates being enabled so a pending update is never resumed under `none`.
if
(
!
this
.
)
{
await
this
.
postInitialize
(
)
;
this
.
=
true
;
}
this
.
scheduleAccordingToMode
(
)
;
}
/**
* Disables updates for a reversible reason (user preference or policy), cancelling the scheduled check loop
* and any in-flight or pending update before moving to Disabled.
*/
private
async
disable
(
:
)
:
Promise
<
void
>
{
this
.
.
clear
(
)
;
// Show a transient Cancelling state only when there is in-flight or pending work to tear down.
if
(
isCancellableState
(
this
.
.
)
)
{
this
.
setState
(
.
)
;
}
try
{
await
this
.
cancelUpdate
(
)
;
}
catch
(
)
{
this
.
.
warn
(
'update#disable - failed to cancel pending update'
,
)
;
}
this
.
=
undefined
;
if
(
===
.
)
{
this
.
.
info
(
'update#disable - updates are disabled by policy'
)
;
}
else
{
this
.
.
info
(
'update#disable - updates are disabled by user preference'
)
;
}
this
.
setState
(
.
Disabled
(
)
)
;
}
/** Disables updates for a non-reversible reason; subsequent `update.mode` changes are ignored. */
private
setDisabledPermanently
(
:
)
:
void
{
this
.
=
true
;
this
.
.
clear
(
)
;
this
.
setState
(
.
Disabled
(
)
)
;
}
private
scheduleAccordingToMode
(
:
'none'
|
'manual'
|
'start'
|
'default'
)
:
void
{
this
.
.
clear
(
)
;
if
(
===
'manual'
)
{
this
.
.
info
(
'update#ctor - manual checks only; automatic updates are disabled by user preference'
)
;
return
;
}
if
(
this
.
.
&&
!
this
.
.
)
{
this
.
resumeAutomaticUpdates
(
)
;
return
;
}
if
(
this
.
.
!==
.
)
{
return
;
}
this
.
setDeferred
(
false
)
;
if
(
===
'start'
)
{
this
.
.
info
(
'update#ctor - startup checks only; automatic updates are disabled by user preference'
)
;
// Check for updates only once after 30 seconds
this
.
scheduleCheckForUpdates
(
30
*
1000
,
false
)
;
}
else
{
// Start checking for updates after 30 seconds
this
.
scheduleCheckForUpdates
(
30
*
1000
,
true
)
;
}
}
private
resumeAutomaticUpdates
(
)
:
void
{
if
(
this
.
||
!
this
.
||
!
this
.
)
{
return
;
}
const
=
this
.
.
getValue<'none'|'manual'|'start'|'default'>
(
'update.mode'
)
;
if
(
===
'none'
||
===
'manual'
)
{
return
;
}
if
(
this
.
.
===
.
)
{
if
(
this
.
.
)
{
this
.
resumeDeferredDownload
(
)
;
}
return
;
}
if
(
this
.
.
===
.
)
{
if
(
this
.
.
)
{
void
this
.
checkForOverwriteUpdates
(
)
;
}
return
;
}
if
(
this
.
.
!==
.
)
{
return
;
}
if
(
===
'start'
&&
!
this
.
.
)
{
return
;
}
this
.
setDeferred
(
false
)
;
this
.
scheduleCheckForUpdates
(
0
,
===
'default'
)
;
}
private
async
trackVersionChange
(
)
:
Promise
<
void
>
{
await
this
.
.
;
interface
ILastKnownVersion
{
readonly
:
string
;
readonly
:
string
|
undefined
;
readonly
:
number
;
}
let
:
|
undefined
;
const
=
this
.
.
get
(
LAST_KNOWN_VERSION_STORAGE_KEY
,
.
APPLICATION
)
;
if
(
typeof
===
'string'
)
{
try
{
=
JSON
.
parse
(
)
;
}
catch
(
)
{
// ignore
}
}
const
:
=
{
:
this
.
.
,
:
this
.
.
,
:
.
now
(
)
,
}
;
if
(
?.
===
.
)
{
return
;
}
this
.
.
store
(
LAST_KNOWN_VERSION_STORAGE_KEY
,
JSON
.
stringify
(
)
,
.
APPLICATION
,
.
MACHINE
)
;
if
(
!
)
{
return
;
}
type
VersionChangeEvent
=
{
:
string
|
undefined
;
:
string
|
undefined
;
:
number
|
undefined
;
:
string
;
:
string
|
undefined
;
:
number
|
undefined
;
:
string
|
undefined
;
}
;
type
VersionChangeClassification
=
{
:
'dmitriv'
;
:
'Fired when VS Code detects a version change on startup.'
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The previous version of VS Code.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The commit hash of the previous version.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'Timestamp when the previous version was first detected.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The current version of VS Code.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
'The commit hash of the current version.'
}
;
:
{
:
'SystemMetaData'
;
:
'FeatureInsight'
;
:
true
;
:
'Milliseconds between the previous version install and this version install.'
// The update server replies with 204 (No Content) when no update is available.
return
===
204
;
}
catch
(
)
{
this
.
.
error
(
'update#isLatestVersion(): failed to check for updates'
)
;
this
.
.
error
(
)
;
return
undefined
;
}
}
async
_applySpecificUpdate
(
:
string
)
:
Promise
<
void
>
{
// noop
}
async
setInternalOrg
(
:
string
|
undefined
)
:
Promise
<
void
>
{
if
(
this
.
===
)
{
return
;
}
this
.
.
info
(
'update#setInternalOrg'
,
)
;
this
.
=
;
}
protected
getInternalOrg
(
)
:
string
|
undefined
{
return
this
.
;
}
protected
getUpdateType
(
)
:
{
return
.
;
}
protected
doQuitAndInstall
(
)
:
void
{
// noop
}
protected
async
postInitialize
(
)
:
Promise
<
void
>
{
// noop
}
protected
async
cancelPendingUpdate
(
)
:
Promise
<
void
>
{
// noop
}
/**
* Aborts in-flight or pending update work when updates are being disabled at runtime. The default cancels a
* pending update; platform services override this to also abort in-flight checks/downloads.
*/