Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
/**
* Converts VS Code build platform/arch to the values that Node.js reports
* at runtime via `process.platform` and `process.arch`.
*
* The copilot SDK's `loadNativeModule` looks up native binaries under
* `prebuilds/${process.platform}-${process.arch}/`, so the directory names
* must match these runtime values exactly.
*/
function
toNodePlatformArch
(
:
string
,
:
string
)
:
{
:
string
;
:
string
}
{
// alpine is musl-linux; Node still reports process.platform === 'linux'
// Legacy: { platform: 'linux', arch: 'alpine' } means alpine-x64
=
'linux'
;
=
'x64'
;
}
return
{
,
}
;
}
/**
* The platform-arch directories shipped by @vscode/ripgrep-universal.
* These follow Node's `${process.platform}-${process.arch}` naming.
* Alpine builds reuse the regular `linux-*` binaries (ripgrep is statically
* linked enough to run on both glibc and musl).
*/
const
=
[
'darwin-arm64'
,
'darwin-x64'
,
'linux-arm'
,
'linux-arm64'
,
'linux-ia32'
,
'linux-x64'
,
'linux-ppc64'
,
'linux-riscv64'
,
'linux-s390x'
,
'win32-arm64'
,
'win32-ia32'
,
'win32-x64'
,
]
;
const
=
[
'darwin-arm64'
,
'darwin-x64'
,
'linux-arm64'
,
'linux-x64'
,
'linuxmusl-arm64'
,
'linuxmusl-x64'
,
'win32-arm64'
,
'win32-x64'
,
]
;
const
=
[
'x64'
,
'arm64'
]
;
const
=
[
'copilot-runtime'
,
'copilot-runtime-bin'
,
'copilot-runtime.exe'
,
'copilot-runtime-bin.exe'
,
]
;
function
toCopilotTgrepPlatformArch
(
:
string
,
:
string
)
:
string
{
if
(
===
'alpine'
)
{
return
`linuxmusl-${arch}`
;
}
if
(
===
'alpine'
)
{
return
'linuxmusl-x64'
;
}
const
{
,
}
=
toNodePlatformArch
(
,
)
;
return
`${nodePlatform}-${nodeArch}`
;
}
function
toCopilotPackagePlatformArch
(
:
string
,
:
string
)
:
string
{
if
(
===
'alpine'
)
{
return
`linuxmusl-${arch}`
;
}
if
(
===
'alpine'
)
{
return
'linuxmusl-x64'
;
}
const
{
,
}
=
toNodePlatformArch
(
,
)
;
return
`${nodePlatform}-${nodeArch}`
;
}
const
=
[
'clipboard'
,
'foundry-local-sdk'
,
'mxc-bin'
,
'pvrecorder'
,
'webview'
,
]
;
function
getCopilotOptionalNativePayloadFiles
(
:
string
)
:
string
[
]
{
const
=
[
// Computer Use ships under plugins/computer-use/** in current
// @github/copilot platform packages. Do not productize it.
'plugins/computer-use/**'
,
'prebuilds/*/computer.node'
,
'prebuilds/*/keytar.node'
,
// macOS voice media-pause helper (MediaRemote adapter). Optional and
// nested under prebuilds; keep it out of the product so universal
// merge does not need to special-case the framework binary tree.
'prebuilds/*/mediaremote-adapter/**'
,
]
;
if
(
!==
'win32'
)
{
.
push
(
'prebuilds/*/cli-native.node'
)
;
}
return
;
}
/**
* Returns a glob filter that strips @microsoft/mxc-sdk `bin/<arch>` payload for
* architectures other than the build target. `@microsoft/mxc-sdk` ships a full
* set of sandbox binaries for every architecture under `bin/<arch>/`; only the
* build target's architecture is needed. Architectures that mxc-sdk does not
* ship (e.g. armhf) strip every `bin/<arch>` directory.
*/
export
function
getMxcExcludeFilter
(
:
string
)
:
string
[
]
{
const
=
.
includes
(
)
?
:
undefined
;
const
=
.
filter
(
=>
!==
)
;
return
[
'**'
,
...
.
map
(
=>
`!**/node_modules/@microsoft/mxc-sdk/bin/${a}/**`
)
,
]
;
}
/**
* Returns a glob filter that strips @vscode/ripgrep-universal bin directories
* for architectures other than the build target.
*/
/**
* Returns a glob filter that strips @github/copilot platform packages
* for architectures other than the build target.
*
* Alpine uses the linuxmusl-* packages. Other platform package names follow
* Node's `${process.platform}-${process.arch}` naming. If Copilot does not
* ship the computed platform package (for example linux-arm for armhf builds),
* this strips every known @github/copilot-* platform package.
*/
/**
* Returns the public @github/copilot package files that must survive
* app/remote packaging for the target platform.
*
* .moduleignore strips all @github/copilot-* platform packages globally.
* Re-add the selected runtime package so Agent Host can launch its index.js
* entrypoint and load runtime prebuilds. Keep the standalone SEA executable
* and optional native payload trees out of the product build.
*/
/**
* Ensures the selected @github/copilot-{platform} package is present before
* packaging. npm only installs the host-compatible optional dependency, but
* VS Code packaging can cross-build targets such as darwin-x64 on arm64 hosts.
*/
export
function
ensureCopilotPlatformPackage
(
:
string
,
:
string
,
=
'node_modules'
,
:
=
{
}
)
:
void
{
const
=
toCopilotPackagePlatformArch
(
,
)
;
if
(
!
.
includes
(
)
)
{
return
;
}
const
=
`@github/copilot-${copilotPackagePlatformArch}`
;
ensureNpmPackage
(
,
,
)
;
}
/**
* Materializes target-platform Copilot CLI SDK files directly inside the built-in copilot extension.
*
* This is used when copilot is shipped as a built-in extension so startup does
* not need to create the shim at runtime. The Copilot VSIX is built once on the
* Linux x64 host, so product packaging also restores target-platform SDK
* natives from the selected @github/copilot-{platform} package.
*
* Note: `node-pty` is no longer shimmed. The copilot CLI SDK resolves
* `node-pty` from the embedder (VS Code) via `hostRequire` and falls back to
* its bundled copy only if that fails.
*
* Failures throw to fail the build because built-in packaging must guarantee
* this artifact is present.
*/
export
function
prepareBuiltInCopilotRipgrepShim
(
:
string
,
:
string
,
:
string
,
:
string
,
:
=
{
}
)
:
void
{
const
{
,
}
=
toNodePlatformArch
(
,
)
;
const
=
`${nodePlatform}-${nodeArch}`
;
const
=
toCopilotPackagePlatformArch
(
,
)
;
const
=
toCopilotTgrepPlatformArch
(
,
)
;
const
=
.
join
(
,
'node_modules'
)
;
const
=
.
join
(
,
'@github'
,
'copilot'
)
;
const
=
.
join
(
,
'sdk'
)
;
if
(
!
.
existsSync
(
)
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] Copilot SDK directory not found at ${copilotSdkBase}`
)
;
}
materializeBuiltInCopilotSdkPlatformFiles
(
,
,
,
,
)
;
pruneNonTargetCopilotSdkPrebuilds
(
,
.
join
(
,
'prebuilds'
)
,
)
;
pruneNonTargetCopilotSdkPrebuilds
(
,
.
join
(
,
.
join
(
'tgrep'
,
'bin'
)
)
,
)
;
pruneNonTargetCopilotSdkPrebuilds
(
,
.
join
(
,
.
join
(
'tgrep'
,
'bin'
)
)
,
)
;
const
=
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
,
)
;
if
(
!
.
existsSync
(
)
)
{
const
=
.
join
(
,
'@vscode'
,
'ripgrep-universal'
,
'bin'
)
;
let
:
string
;
try
{
=
.
existsSync
(
)
?
`Available bin entries: ${JSON.stringify(fs.readdirSync(binDir))}`
:
`bin directory does not exist at ${binDir}`
;
}
catch
(
)
{
=
`Failed to enumerate bin directory: ${err}`
;
}
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] ripgrep source not found at ${ripgrepSource} (build platform=${platform}, arch=${arch}, computed platformArch=${platformArch}). ${diagnostics}`
)
;
}
const
=
.
join
(
,
'ripgrep'
,
'bin'
,
)
;
const
=
.
join
(
,
'shims.txt'
)
;
try
{
.
mkdirSync
(
,
{
:
true
}
)
;
.
cpSync
(
,
,
{
:
true
}
)
;
.
writeFileSync
(
,
'Shims created successfully'
)
;
console
.
log
(
`[prepareBuiltInCopilotRipgrepShim] Materialized ripgrep shim for ${platformArch} in ${builtInCopilotExtensionDir}`
)
;
}
catch
(
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] Failed to materialize ripgrep shim for ${platformArch}: ${err}`
)
;
}
}
function
materializeBuiltInCopilotSdkPlatformFiles
(
:
string
,
:
string
,
:
string
,
:
string
,
:
=
{
}
)
:
void
{
if
(
!
.
includes
(
)
)
{
return
;
}
// The SDK JavaScript shipped inside the built-in extension and the native
// `runtime.node` it loads MUST be the same @github/copilot version: the JS
// calls native functions the binary may not export (e.g. a newer CLI that
// removed one), which throws at load. Source the native from a platform
// package matching the EXTENSION's version rather than whatever app-root
// currently has — the extension is intentionally pinned to a fixed CLI
// version for the extension host while the agent host (app-root) keeps
// updating, so the two versions diverge by design.
const
=
readCopilotPackageVersion
(
)
;
const
{
:
,
}
=
resolveVersionMatchedCopilotPlatformPackage
(
,
,
,
)
;
try
{
const
=
.
join
(
,
'sdk'
,
'prebuilds'
,
)
;
copyRequiredDirectory
(
.
join
(
,
'prebuilds'
,
)
,
,
`Copilot SDK native prebuilds for ${copilotPackagePlatformArch}`
)
;
// Built-in materialization copies the whole prebuilds tree (not the gulp
// exclude globs above), so drop mediaremote-adapter explicitly afterward.
.
rmSync
(
.
join
(
,
'mediaremote-adapter'
)
,
{
:
true
,
:
true
}
)
;
// The out-of-process runtime wrappers are not used by the built-in extension.
for
(
const
of
)
{
.
rmSync
(
.
join
(
,
)
,
{
:
true
}
)
;
}
if
(
!
.
includes
(
)
)
{
return
;
}
const
=
.
join
(
,
'tgrep'
,
'bin'
,
)
;
copyRequiredDirectory
(
,
.
join
(
,
'tgrep'
,
'bin'
,
)
,
`Copilot tgrep for ${tgrepPlatformArch}`
)
;
copyRequiredDirectory
(
,
.
join
(
,
'sdk'
,
'tgrep'
,
'bin'
,
)
,
`Copilot SDK tgrep for ${tgrepPlatformArch}`
)
;
}
finally
{
cleanup
(
)
;
}
}
/**
* Resolves a `@github/copilot-{platform}` package directory whose version
* matches `extVersion`, so the native copied into the built-in extension always
* matches the extension's own SDK JavaScript.
*
* Prefers the app-root package when it already matches (no extra work), and
* otherwise fetches the exact extension version into a temp dir. The extension
* is pinned to a fixed CLI version for the extension host while the agent host
* (app-root) keeps updating, so app-root will normally NOT match and the fetch
* is the expected path once the two versions diverge. The fetched tarball is
* verified against the SHA-512 the extension lockfile pins for that version
* before extraction; resolution fails closed if that integrity is missing.
*/
function
resolveVersionMatchedCopilotPlatformPackage
(
:
string
,
:
string
,
:
string
,
:
)
:
{
:
string
;
cleanup
:
(
)
=>
void
}
{
const
noop
=
(
)
=>
{
}
;
const
=
`@github/copilot-${copilotPackagePlatformArch}`
;
const
=
.
join
(
,
'@github'
,
`copilot-${copilotPackagePlatformArch}`
)
;
if
(
readOptionalPackageVersion
(
)
===
)
{
return
{
:
,
:
}
;
}
const
=
resolvePinnedPlatformPackageIntegrity
(
,
,
)
;
const
=
.
mkdtempSync
(
.
join
(
.
tmpdir
(
)
,
'vscode-copilot-native-'
)
)
;
try
{
const
=
.
join
(
,
`copilot-${copilotPackagePlatformArch}`
)
;
materializeNpmPackageVersion
(
,
,
,
,
)
;
console
.
log
(
`[prepareBuiltInCopilotRipgrepShim] ${packageName} in app-root does not match the built-in extension's @github/copilot@${extVersion}; using the version-matched package instead.`
)
;
return
{
:
,
cleanup
:
(
)
=>
.
rmSync
(
,
{
:
true
,
:
true
}
)
}
;
}
catch
(
)
{
.
rmSync
(
,
{
:
true
,
:
true
}
)
;
throw
;
}
}
/**
* Reads the `sha512-...` integrity the built-in extension's lockfile pins for
* `packageName` at `extVersion`. Fails closed: a missing lockfile, entry,
* version mismatch, or integrity means the fetched native cannot be verified,
* so the build must stop rather than ship an unverified binary.
*/
function
resolvePinnedPlatformPackageIntegrity
(
:
string
,
:
string
,
:
)
:
string
{
const
=
.
??
.
join
(
import
.
.
,
'..'
,
'..'
,
'extensions'
,
'copilot'
,
'package-lock.json'
)
;
let
:
{
?
:
<
string
,
{
?
:
string
;
?
:
string
}
>
}
;
try
{
=
JSON
.
parse
(
.
readFileSync
(
,
'utf8'
)
)
;
}
catch
(
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] Could not read ${lockfilePath} to verify ${packageName}@${extVersion}: ${err instanceofError? err.message :String(err)}`
)
;
}
const
=
.
?.
[
.
.
join
(
'node_modules'
,
)
]
;
if
(
!
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] ${packageName} is not recorded in ${lockfilePath}; refusing to fetch an unverifiable native.`
)
;
}
if
(
.
!==
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] ${packageName} is pinned to ${entry.version} in ${lockfilePath} but the built-in extension is @github/copilot@${extVersion}; refusing to fetch an unverifiable native.`
)
;
}
if
(
!
.
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] ${packageName}@${extVersion} has no integrity in ${lockfilePath}; refusing to fetch an unverifiable native.`
)
;
}
return
.
;
}
function
readCopilotPackageVersion
(
:
string
)
:
string
{
const
=
readOptionalPackageVersion
(
)
;
if
(
!
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] Could not read a version from ${path.join(copilotBase,'package.json')}`
)
;
}
return
;
}
function
readOptionalPackageVersion
(
:
string
)
:
string
|
undefined
{
try
{
const
=
JSON
.
parse
(
.
readFileSync
(
.
join
(
,
'package.json'
)
,
'utf8'
)
)
.
;
return
typeof
===
'string'
?
:
undefined
;
}
catch
{
return
undefined
;
}
}
function
copyRequiredDirectory
(
:
string
,
:
string
,
:
string
)
:
void
{
if
(
!
.
existsSync
(
)
)
{
throw
new
Error
(
`[prepareBuiltInCopilotRipgrepShim] ${description} not found at ${source}`