# System map — microsoft/vscode

> Canonical page: https://codevetter.com/unpack/vscode/system-map

# System map — microsoft/vscode

Scanned commit f6439326f6891a1eaf254a19fc1a78243cbb8f9d (2026-09-22). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

The system is a multi-process Electron application with parallel web and server builds. src/main.ts is the Electron main entry that reads argv.json, configures sandboxing and privileged schemes, then loads src/vs/code/electron-main/main.ts, which manually assembles a DI ServiceCollection, claims a single-instance IPC socket, and hands off to CodeApplication. The renderer boots the workbench through import-barrel entrypoints (workbench.desktop.main.ts / workbench.web.main.ts / workbench.common.main.ts) that register singleton services and contributions. Auxiliary processes — shared process, pty host, extension hosts, agent host — are spawned as Electron utility processes or Node forks and communicate over named IPC channels. A separate Rust crate under cli/ implements the `code` command-line launcher, tunnel daemon, and web server host, while src/vs/server and remote/ implement the remote extension host agent (vscode-reh).
- src/main.ts is the real Electron main entry: it configures portable mode, parses CLI args, reads/creates argv.json, toggles the Chromium sandbox, registers the privileged schemes vscode-webview/vscode-file/vscode-remote-resource/vscode-managed-remote-resource, and on app 'ready' calls bootstrapESM() then imports ./vs/code/electron-main/main.js. — [src/main.ts#L235-L249](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/main.ts#L235-L249) [src/main.ts#L109-L128](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/main.ts#L109-L128) [src/bootstrap-esm.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/bootstrap-esm.ts)
- CodeMain.startup() in src/vs/code/electron-main/main.ts builds a ServiceCollection by hand (EnvironmentMainService, LoggerMainService, FileService+DiskFileSystemProvider, UriIdentityService, StateService, UserDataProfilesMainService, policy services, ConfigurationService) and wraps it in an InstantiationService before creating CodeApplication. — [src/vs/code/electron-main/main.ts#L102-L161](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/main.ts#L102-L161) [src/vs/code/electron-main/main.ts#L163-L293](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/main.ts#L163-L293)
- Single-instance behavior is enforced by claimInstance(): the first process serves a node IPC socket at environmentMainService.mainIPCHandle (exported to child processes as VSCODE_IPC_HOOK) and writes a pid lockfile; a second instance forwards args to the running one and quits. — [src/vs/code/electron-main/main.ts#L295-L310](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/main.ts#L295-L310) [src/vs/code/electron-main/main.ts#L348-L357](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/main.ts#L348-L357) [src/vs/base/parts/ipc/node/ipc.net.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/base/parts/ipc/node/ipc.net.ts)
- CodeApplication.startup() creates an ElectronIPCServer, resolves machineId/sqmId/devDeviceId, spawns the SharedProcess via a MessagePortClient, installs ErrorTelemetry, lazily starts the AgentHostProcessManager, then calls initChannels() which registers roughly 30 channels (storage, policy, nativeManagedSettings, fileManagedSettings, local file system, userDataProfiles, update, encryption, nativeHost, webview, workspaces, menubar, url, localPty, externalTerminal, sandboxHelper, mcpGateway, extensionHostStarter, utilityProcessWorker, …) on both the renderer server and the shared-process client. — [src/vs/code/electron-main/app.ts#L694-L800](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/app.ts#L694-L800) [src/vs/code/electron-main/app.ts#L1336-L1490](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/app.ts#L1336-L1490) [src/vs/platform/sharedProcess/electron-main/sharedProcess.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/platform/sharedProcess/electron-main/sharedProcess.ts)
- The workbench ships three parallel entrypoint barrels: workbench.common.main.ts holds shared imports/singletons, workbench.web.main.ts adds web-only services and contribs, and workbench.desktop.main.ts layers desktop-only ones; comments in workbench.ts explicitly forbid registering services locally and direct authors to registerSingleton(). — [src/vs/workbench/workbench.web.main.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/workbench/workbench.web.main.ts) [src/vs/workbench/workbench.desktop.main.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/workbench/workbench.desktop.main.ts) [src/vs/workbench/workbench.common.main.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/workbench/workbench.common.main.ts) [src/vs/workbench/browser/workbench.ts#L172-L180](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/workbench/browser/workbench.ts#L172-L180)
- Architectural layering base→platform→editor→workbench is machine-enforced: 'npm run valid-layers-check' invokes build/checker/layersChecker.ts, and 'npm run check-cyclic-dependencies' runs build/lib/checkCyclicDependencies.ts over out/. — [package.json#L22-L30](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/package.json#L22-L30) [build/checker/layersChecker.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/build/checker/layersChecker.ts) [.github/copilot-instructions.md#L29-L34](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/.github/copilot-instructions.md#L29-L34)
- Process model: main process (electron-main), one renderer per window, a shared process for cross-window work (sharedProcessMain.ts), a pty host for terminals (ptyHostMain.ts/PtyService), extension hosts (local process, web worker, or remote), and an agent host utility process managed by AgentHostProcessManager/ElectronAgentHostStarter. — [src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts) [src/vs/platform/terminal/node/ptyHostMain.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/platform/terminal/node/ptyHostMain.ts) [src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts) [src/vs/code/electron-main/app.ts#L756-L766](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/app.ts#L756-L766)
- A remote-server variant lives in src/vs/server (server.main.ts, serverServices.ts, remoteExtensionHostAgentServer.ts) packaged as vscode-reh via remote/package.json, and web serving is driven by the Rust CLI's serve_web command. — [src/vs/server/node/server.main.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/server/node/server.main.ts) [src/vs/server/node/serverServices.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/server/node/serverServices.ts) [remote/package.json](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/remote/package.json) [cli/src/commands/serve_web.rs](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/cli/src/commands/serve_web.rs)
- The Rust CLI crate 'code' (cli/Cargo.toml, cli/src/bin/code/main.rs) parses args with clap, distinguishes integrated vs standalone mode, and dispatches subcommands including tunnel, serve-web, update, and a family of agent_* commands (agent_host, agent_ps, agent_kill, agent_logs, agent_relay, agent_stop, agent_endpoints). — [cli/src/bin/code/main.rs](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/cli/src/bin/code/main.rs) [cli/src/commands.rs](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/cli/src/commands.rs) [cli/src/commands/tunnels.rs](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/cli/src/commands/tunnels.rs) [cli/Cargo.toml](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/cli/Cargo.toml)
- src/vs/sessions is a separate workbench layer ('agent sessions window') with its own entry barrels (sessions.desktop.main.ts, sessions.web.main.ts) that may import from vs/workbench but not vice versa, per the documented layering rules. — [src/vs/sessions/sessions.desktop.main.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/sessions/sessions.desktop.main.ts) [src/vs/sessions/SESSIONS.md](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/sessions/SESSIONS.md) [.github/copilot-instructions.md#L27](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/.github/copilot-instructions.md#L27)
- product.json is the branding/config manifest (nameShort 'Code - OSS', dataFolderName '.vscode-oss', urlProtocol 'code-oss', win32/darwin ids, builtInExtensions list with sha256 pins); build commands are npm scripts wrapping gulp (npm run compile → gulp compile via gulpfile.mjs; npm run watch; npm run typecheck-client). — [product.json#L1-L56](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/product.json#L1-L56) [package.json#L25-L56](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/package.json#L25-L56) [gulpfile.mjs](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/gulpfile.mjs)
- Runtime boundaries are bridged by a channel abstraction: ProxyChannel/IPCServer in src/vs/base/parts/ipc, validatedIpcMain for renderer→main calls, and getDelayedChannel(ProxyChannel.toService(...)) used to lazily expose shared-process services like diagnostics and telemetryAppender as local DI services. — [src/vs/base/parts/ipc/common/ipc.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/base/parts/ipc/common/ipc.ts) [src/vs/base/parts/ipc/electron-main/ipcMain.ts](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/base/parts/ipc/electron-main/ipcMain.ts) [src/vs/code/electron-main/app.ts#L1219-L1299](https://github.com/microsoft/vscode/blob/f6439326f6891a1eaf254a19fc1a78243cbb8f9d/src/vs/code/electron-main/app.ts#L1219-L1299)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
