Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
`
query commitAuthor($owner: String!, $repo: String!, $commit: String!) {
repository(owner: $owner, name: $repo) {
object(expression: $commit) {
... on Commit {
author {
name
email
avatarUrl
user {
id
login
}
}
}
}
}
}
`
;
interface
GitHubRepositoryStore
{
readonly
:
[
]
;
readonly
:
<
string
>
;
}
interface
GitHubUser
{
readonly
:
string
;
readonly
:
string
;
readonly
?
:
<
string
>
;
readonly
:
string
;
readonly
:
string
;
}
function
getUserIdFromNoReplyEmail
(
:
string
|
undefined
)
:
string
|
undefined
{
const
=
?.
match
(
/^([0-9]+)\+[^@]+@users\.noreply\.github\.com$/
)
;
return
?.
[
1
]
;
}
function
compareAvatarQuery
(
:
,
:
)
:
number
{
// Email
const
=
(
.
??
''
)
.
localeCompare
(
.
??
''
)
;
if
(
!==
0
)
{
return
;
}
// Name
return
(
.
??
''
)
.
localeCompare
(
.
??
''
)
;
}
export
class
GitHubSourceControlHistoryItemDetailsProvider
implements
SourceControlHistoryItemDetailsProvider
{
private
=
true
;
private
readonly
=
new
Map<string, GitHubRepositoryStore>
(
)
;
private
readonly
=
new
DisposableStore
(
)
;
constructor
(
private
readonly
:
API
,
private
readonly
:
,
private
readonly
:
)
{
this
.
.
add
(
this
.
.
onDidCloseRepository
(
=>
this
.
_onDidCloseRepository
(
)
)
)
;
this
.
.
add
(
this
.
.
onDidChangeSessions
(
(
)
=>
{
this
.
=
true
;
this
.
.
clear
(
)
;
}
)
)
;
this
.
.
add
(
.
onDidChangeConfiguration
(
=>
{
if
(
!
.
affectsConfiguration
(
'github.showAvatar'
)
)
{
return
;
}
this
.
.
clear
(
)
;
}
)
)
;
}
async
provideAvatar
(
:
,
:
)
:
Promise
<
<
string
,
string
|
undefined
>
|
undefined
>
{
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][provideAvatar] Avatar resolution for ${query.commits.length} commit(s) in ${repository.rootUri.fsPath}.`
)
;
const
=
.
getConfiguration
(
'github'
,
.
)
;
const
=
.
get<boolean>
(
'showAvatar'
,
true
)
===
true
;
if
(
!
this
.
||
!
)
{
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][provideAvatar] Avatar resolution is disabled. (${showAvatar ===false?'setting':'auth'})`
)
;
return
undefined
;
}
// upstream -> origin -> first
const
=
getRepositoryDefaultRemote
(
,
[
'upstream'
,
'origin'
]
)
;
if
(
!
)
{
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][provideAvatar] Repository does not have a GitHub remote.`
)
;
return
undefined
;
}
try
{
const
=
{
:
0
,
:
0
,
:
0
,
:
0
}
;
// Warm up the in-memory cache with the first page
// (100 users) from this list of assignable users
await
this
.
_loadAssignableUsers
(
)
;
const
=
this
.
.
get
(
this
.
_getRepositoryKey
(
)
)
;
if
(
!
)
{
return
undefined
;
}
// Group the query by author
const
=
groupBy<AvatarQueryCommit>
(
.
,
)
;
const
=
new
Map<string,string|undefined>
(
)
;
await
Promise
.
all
(
.
map
(
async
=>
{
if
(
.
===
0
)
{
return
;
}
// Query the in-memory cache for the user
const
=
.
.
find
(
=>
.
===
[
0
]
.
||
.
===
[
0
]
.
)
?.
;
// Cache hit
if
(
)
{
// Add avatar for each commit
.
+=
.
;
.
forEach
(
(
{
}
)
=>
.
set
(
,
`${avatarUrl}&s=${query.size}`
)
)
;
return
;
}
// Check if any of the commit are being tracked in the list
// of known commits that have incomplte author information
if
(
.
some
(
(
{
}
)
=>
.
.
has
(
)
)
)
{
.
forEach
(
(
{
}
)
=>
.
set
(
,
undefined
)
)
;
return
;
}
// Try to extract the user identifier from GitHub no-reply emails
const
=
getUserIdFromNoReplyEmail
(
[
0
]
.
)
;
if
(
)
{
.
+=
.
;
const
=
getAvatarLink
(
,
.
)
;
.
forEach
(
(
{
}
)
=>
.
set
(
,
)
)
;
return
;
}
// Get the commit details
const
=
await
this
.
_getCommitAuthor
(
,
[
0
]
.
)
;
if
(
!
)
{
// The commit has incomplete author information, so
// we should not try to query the authors details again
.
+=
.
;
for
(
const
{
}
of
)
{
.
.
add
(
)
;
.
set
(
,
undefined
)
;
}
return
;
}
// Save the user to the cache
.
.
push
(
)
;
// Add avatar for each commit
.
+=
.
;
.
forEach
(
(
{
}
)
=>
.
set
(
,
`${commitAuthor.avatarUrl}&s=${query.size}`
)
)
;
}
)
)
;
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][provideAvatar] Avatar resolution for ${query.commits.length} commit(s) in ${repository.rootUri.fsPath} complete: ${JSON.stringify(logs)}.`
)
;
return
;
}
catch
(
)
{
// A GitHub authentication session could be missing if the user has not yet
// signed in with their GitHub account or they have signed out. Disable the
// avatar resolution until the user signes in with their GitHub account.
`[GitHubSourceControlHistoryItemDetailsProvider][_loadAssignableUsers] Querying assignable user(s) for ${descriptor.owner}/${descriptor.repo}.`
)
;
try
{
const
=
await
this
.
.
getOctokitGraphql
(
)
;
const
{
}
=
await
graphql<{ repository: GitHubRepository }>
(
ASSIGNABLE_USERS_QUERY
,
)
;
const
:
[
]
=
[
]
;
for
(
const
of
.
.
??
[
]
)
{
if
(
!
)
{
continue
;
}
.
push
(
{
:
.
,
:
.
,
:
.
,
:
.
,
:
.
,
}
)
;
}
this
.
.
set
(
this
.
_getRepositoryKey
(
)
,
{
,
:
new
Set
(
)
}
)
;
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][_loadAssignableUsers] Successfully queried assignable user(s) for ${descriptor.owner}/${descriptor.repo}: ${users.length} user(s).`
)
;
}
catch
(
)
{
this
.
.
warn
(
`[GitHubSourceControlHistoryItemDetailsProvider][_loadAssignableUsers] Failed to load assignable user(s) for ${descriptor.owner}/${descriptor.repo}: ${err}`
)
;
throw
;
}
}
private
async
_getCommitAuthor
(
:
{
:
string
;
:
string
}
,
:
string
)
:
Promise
<
|
undefined
>
{
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][_getCommitAuthor] Querying commit author for ${descriptor.owner}/${descriptor.repo}/${commit}.`
)
;
try
{
const
=
await
this
.
.
getOctokitGraphql
(
)
;
const
{
}
=
await
graphql<{ repository: GitHubRepository }>
(
COMMIT_AUTHOR_QUERY
,
{
...
,
}
)
;
const
=
(
.
as
)
.
;
if
(
!
?.
?.
||
!
.
?.
||
!
?.
||
!
?.
||
!
?.
)
{
this
.
.
info
(
`[GitHubSourceControlHistoryItemDetailsProvider][_getCommitAuthor] Incomplete commit author for ${descriptor.owner}/${descriptor.repo}/${commit}: ${JSON.stringify(repository.object)}`
)
;
return
undefined
;
}
const
=
{
:
.
.
,
:
.
.
,
:
.
,
:
.
,
:
.
,
}
;
this
.
.
trace
(
`[GitHubSourceControlHistoryItemDetailsProvider][_getCommitAuthor] Successfully queried commit author for ${descriptor.owner}/${descriptor.repo}/${commit}: ${user.login}.`
)
;
return
;
}
catch
(
)
{
this
.
.
warn
(
`[GitHubSourceControlHistoryItemDetailsProvider][_getCommitAuthor] Failed to get commit author for ${descriptor.owner}/${descriptor.repo}/${commit}: ${err}`