src/vs/platform/agentHost/node/workspacelessScratchDir.ts

25 LOC · 25 covered · 0 uncovered · 4 ranges · 764 concepts · 3 introducers · 371 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

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 related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- workspacelessScratchDir.ts ×2
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import * as fs from 'fs/promises';
7 > import { joinPath } from '../../../base/common/resources.js';
8 > import { URI } from '../../../base/common/uri.js';
9 >
10 > /**
11 > * Stable, deterministic per-session scratch directory for a workspace-less
12 > * (workspace-less chat) session: `<userHome>/.copilot/chats/<sessionId>`. Shared by the
13 > * Copilot and Claude agents so both resolve the same cwd for a session that was
14 > * created with no `workingDirectory`.
15 > */
16 > export function workspacelessScratchDir(userHome: URI, sessionId: string): URI {
17 > return joinPath(userHome, '.copilot', 'chats', sessionId); workspacelessScratchDir.ts ×1
18 > }
20 > /** Ensures the workspace-less scratch dir exists (mkdir -p), returning it. */
21 > export async function ensureWorkspacelessScratchDir(userHome: URI, sessionId: string): Promise<URI> { claudeAgent.ts ×2
22 > const dir = workspacelessScratchDir(userHome, sessionId);
23 > await fs.mkdir(dir.fsPath, { recursive: true });
24 > return dir;
25 > }