*/
export function buildSandboxConfigForSdk(
sandbox: ISandboxConfigValue | undefined,
): ISdkSandboxConfig | undefined {
if (!sandbox) {
return undefined;
}
Frontier kind: Code frontier
unlabeled · c_c33eb589455c
74 tests · 6949 LOC · 37 files · introduces 0 tests · 37 LOC · 1 file
The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.
Introduced files, introduced tests, and structurally relevant concept specialization
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.
Every exact file and test below is linked only from the concept that introduces it.
mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent contextSize to contextTier mapping maps the default numeric context size to default|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent contextSize to contextTier mapping maps the largest numeric context size to long_context|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent provisional sessions materialization forwards the GitHub token to the SDK at the session level (#318693)|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent provisional sessions materialization passes VS Code-specific system message to the SDK|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent customization anchoring materialization re-anchors customization discovery to the resolved worktree|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent customization anchoring materialization without a worktree keeps the anchor on the original folder|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgent.test|title=CopilotAgent provisional sessions sendMessage on the default chat materializes the parent provisional session|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession falls back to file attachment when selection text cannot be read|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession falls back to file reference when reading a symbol Resource attachment fails|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession `/env` falls through to a normal SDK send when not listed|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession `/security-review` falls through to normal send when runtime command is unavailable|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession forwards an embedded resource with a selection as its already-sliced inline blob|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession sends an embedded resource without a selection as the full blob|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession permission handling per-request permissions: Autopilot with Ask When Needed keeps SDK approval mode off|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotAgentSession.test|title=CopilotAgentSession permission handling per-request sandbox: applies the configured policy under default approvals|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotSessionLauncher.test|title=CopilotSessionLauncher resume fallback falls back to createSession after a Start Over truncate leaves the session empty|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/copilotSessionLauncher.test|title=CopilotSessionLauncher resume fallback falls back to createSession for an unknown -32603 from resumeSession|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/sandboxConfigForSdk.test|title=buildSandboxConfigForSdk enablement enables sandbox and outbound network for `allowNetwork` on non-Windows platforms|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/sandboxConfigForSdk.test|title=buildSandboxConfigForSdk enablement enables sandbox for `on` on non-Windows platforms|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/sandboxConfigForSdk.test|title=buildSandboxConfigForSdk network hosts drops host lists and keeps outbound closed when sandbox is `on` (host lists disabled on all platforms)|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/sandboxConfigForSdk.test|title=buildSandboxConfigForSdk network hosts ignores host lists when sandbox is `allowNetwork` (allow all)|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/sandboxConfigForSdk.test|title=buildSandboxConfigForSdk enablement returns undefined for `off`|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/platform/agentHost/test/node/sandboxConfigForSdk.test|title=buildSandboxConfigForSdk enablement returns undefined when the bag is empty|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/charCode.test|title=CharCode has good values|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/path.test|title=Paths (Node Implementation) path|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI File paths containing apostrophes break URI parsing and cannot be opened #276075|occurrence=1mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/common/uri.test|title=URI URI#file, win-speciale|occurrence=1Every collected test enters the hierarchy at exactly one concept.
No tests are introduced at this concept. Its intent tests are introduced by other concepts.
Every collected source range enters the hierarchy at exactly one concept.
1 file ranked by introduced lines: 37 introduced LOC across 7 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
*/
export function buildSandboxConfigForSdk(
sandbox: ISandboxConfigValue | undefined,
): ISdkSandboxConfig | undefined {
if (!sandbox) {
return undefined;
}
// Typed as `boolean` (not the `false` literal) so the Windows branches below
// are not flagged as unreachable by control-flow narrowing.
return undefined;
}
? sandbox[AgentHostSandboxKey.WindowsEnabled]
: sandbox[AgentHostSandboxKey.Enabled];
if (enabledRaw !== AgentSandboxEnabledValue.On && enabledRaw !== AgentSandboxEnabledValue.AllowNetwork) {
sandboxConfigForSdk.ts
return undefined;
}
? sandbox[AgentHostSandboxKey.MacFileSystem]
: sandbox[AgentHostSandboxKey.LinuxFileSystem];
const fs = (fsRaw && typeof fsRaw === 'object') ? fsRaw as IAgentSandboxFileSystemSetting : {};
sandboxConfigForSdk.ts
const denied = new Set<string>(fs.denyRead ?? []);
const readonly = new Set<string>();
const readwrite = new Set<string>();
for (const p of fs.denyWrite ?? []) {
if (!denied.has(p)) {
readonly.add(p);
}
}
if (!denied.has(p) && !readonly.has(p)) {
readwrite.add(p);
}
}
if (!denied.has(p) && !readonly.has(p) && !readwrite.has(p)) {
readonly.add(p);
const legacyAllowAllNetwork = enabledRaw === AgentSandboxEnabledValue.AllowNetwork;
const allowAllNetwork = legacyAllowAllNetwork || (enabledRaw === AgentSandboxEnabledValue.On && sandbox[AgentHostSandboxKey.AllowNetwork] === true);
const rawAllow = sandbox[AgentHostSandboxKey.AllowedNetworkDomains];
const rawBlock = sandbox[AgentHostSandboxKey.DeniedNetworkDomains];
const allowedHosts = !allowAllNetwork && hostListsEnforceable && rawAllow?.length ? [...rawAllow] : undefined;
const blockedHosts = !allowAllNetwork && hostListsEnforceable && rawBlock?.length ? [...rawBlock] : undefined;
const allowOutbound = allowAllNetwork || !!allowedHosts || !!blockedHosts;
return {
enabled: true,
allowBypass: true,
userPolicy: {
filesystem: {
...(readwrite.size ? { readwritePaths: [...readwrite] } : {}),
...(readonly.size ? { readonlyPaths: [...readonly] } : {}),
...(denied.size ? { deniedPaths: [...denied] } : {}),
},
network: {
allowOutbound,
...(allowOutbound && allowedHosts ? { allowedHosts } : {}),
...(allowOutbound && blockedHosts ? { blockedHosts } : {}),
},
},
};
}