Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/** The editor's own entry in the shared local agent host endpoint registry. */
export
type
ILocalAgentHostEndpointMetadata
=
&
{
readonly
:
'editor'
;
readonly
:
{
readonly
:
'socket'
;
readonly
:
string
}
;
}
;
export
function
createLocalAgentHostEndpointMetadata
(
:
string
)
:
{
const
=
randomBytes
(
16
)
.
toString
(
'base64url'
)
;
return
{
:
AGENT_HOST_ENDPOINT_REGISTRY_SCHEMA_VERSION
,
:
'editor'
,
:
.
,
,
:
{
:
'socket'
,
:
getEndpointPath
(
,
)
}
,
:
randomBytes
(
32
)
.
toString
(
'base64url'
)
,
:
PROTOCOL_VERSION
,
}
;
}
export
async
function
prepareLocalAgentHostEndpointMetadataDirectory
(
:
string
)
:
Promise
<
void
>
{
// Secure both the registry root and the entries directory beneath it.
await
prepareOwnerOnlyDirectory
(
getMetadataDirectory
(
)
)
;
await
prepareOwnerOnlyDirectory
(
getEntriesDirectory
(
)
)
;
}
async
function
prepareOwnerOnlyDirectory
(
:
string
)
:
Promise
<
void
>
{
await
.
.
mkdir
(
,
{
:
true
,
:
0o700
}
)
;
const
=
await
.
.
lstat
(
)
;
if
(
!
.
isDirectory
(
)
||
.
isSymbolicLink
(
)
)
{
throw
new
Error
(
`Local agent host endpoint directory is not a directory: ${directory}`
)
;
}
if
(
.
===
'win32'
)
{
await
applyWindowsOwnerOnlyAcl
(
)
;
}
else
{
if
(
.
&&
.
!==
.
getuid
(
)
)
{
throw
new
Error
(
`Local agent host endpoint directory is not owned by the current user: ${directory}`
)
;
}
await
.
.
chmod
(
,
0o700
)
;
}
}
export
async
function
prepareLocalAgentHostEndpointSocketDirectory
(
:
string
)
:
Promise
<
void
>
{
if
(
.
!==
'win32'
)
{
const
=
getSocketDirectory
(
)
;
await
.
.
mkdir
(
,
{
:
true
,
:
0o700
}
)
;
const
=
await
.
.
lstat
(
)
;
if
(
!
.
isDirectory
(
)
||
.
isSymbolicLink
(
)
)
{
throw
new
Error
(
`Local agent host endpoint socket directory is not a directory: ${directory}`
)
;
}
if
(
.
&&
.
!==
.
getuid
(
)
)
{
throw
new
Error
(
`Local agent host endpoint socket directory is not owned by the current user: ${directory}`
)
;
}
await
.
.
chmod
(
,
0o700
)
;
}
}
/**
* Publishes (or refreshes) this host's own `entries/<sha256hex>.json` file by
* atomically renaming a freshly written temp file into place. Throws on any
* filesystem failure; callers must stay running but undiscoverable rather than
* retrying non-atomically.
*/
export
async
function
publishLocalAgentHostEndpointMetadata
(
:
string
,
:
,
?
:
)
:
Promise
<
void
>
{
await
prepareLocalAgentHostEndpointMetadataDirectory
(
)
;
const
=
getEntriesDirectory
(
)
;
const
=
join
(
,
getAgentHostEndpointEntryFileName
(
)
)
;
await
writeEntryFileAtomicAsync
(
,
,
,
)
;
}
/**
* Removes exactly `owner`'s own entry file. The path is derived from `owner`'s
* identity, so this can never delete another writer's entry. Best-effort: the
* shared entries directory is left in place to avoid racing concurrent
* publishers, and failures are logged, never thrown.
*/
export
function
cleanupLocalAgentHostEndpointMetadataSync
(
:
string
,
:
,
?
:
)
:
void
{
const
=
join
(
getEntriesDirectory
(
)
,
getAgentHostEndpointEntryFileName
(
)
)
;
try
{
.
rmSync
(
,
{
:
true
}
)
;
}
catch
(
)
{
?.
error
(
`[AgentHost] Failed to remove our local agent host endpoint entry ${entryPath}`
,
)
;
}
}
export
function
cleanupLocalAgentHostEndpointSocketSync
(
:
string
)
:
void
{
if
(
.
!==
'win32'
)
{
.
rmSync
(
,
{
:
true
}
)
;
}
}
/**
* Reads and validates every live entry in the registry without taking a lock,
* merging a read-only legacy `metadata.json` array left by older builds.
* Confirmed-dead entries are pruned (and their own files best-effort removed);
* the rest are deduped by identity — a live entry file winning over a colliding
* legacy entry — and returned in a deterministic order.
*/
export
async
function
readLocalAgentHostEndpointRegistry
(
:
string
,
?
:
)
:
Promise
<
[
]
>
{
const
=
await
readEntryFilesAsync
(
getEntriesDirectory
(
)
,
)
;
const
=
await
readLegacyRegistryAsync
(
getLegacyMetadataPath
(
)
,
)
;
const
:
[
]
=
[
]
;
// Legacy entries first so a live entry file wins the dedupe on collision.
for
(
const
of
)
{
if
(
isPidAlive
(
.
)
)
{
.
push
(
)
;
}
}
for
(
const
{
,
}
of
)
{
if
(
isPidAlive
(
.
)
)
{
.
push
(
)
;
}
else
{
?.
info
(
`[AgentHost] Pruning stale local endpoint registry entry: ${entry.type} PID ${entry.pid} (instance ${entry.instanceId}) is no longer running`
)
;
await
.
.
rm
(
,
{
:
true
}
)
.
catch
(
(
)
=>
{
/* best effort */
}
)
;
}
}
return
sortForDeterministicOrder
(
dedupeAgentHostEndpointMetadata
(
)
)
;
}
function
getMetadataDirectory
(
:
string
)
:
string
{
return
join
(
,
,
)
;
}
function
getEntriesDirectory
(
:
string
)
:
string
{
return
join
(
getMetadataDirectory
(
)
,
)
;
}
function
getLegacyMetadataPath
(
:
string
)
:
string
{
return
join
(
getMetadataDirectory
(
)
,
)
;
}
/**
* The canonical `<sha256hex>.json` file name for `identity`, hashed over the
* cross-language encoding from {@link getAgentHostEndpointIdentityHashInput} so
* the editor and Rust CLI agree and the raw `instanceId` stays out of the path.
*/