copilotAgent.ts ×8

Frontier kind: Code frontier

unlabeled · c_5184ceac1d2f

4 tests · 53286 LOC · 300 files · introduces 0 tests · 53 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges53 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
5411 ranges53286 lines · 300 files · Browse complete extent
All tests (intent)
4 testsBrowse complete intent

Neighbourhood graph

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.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 53 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/copilotAgent.ts 53 introduced LOC · 8 ranges

Open complete file

3108
3109 private async _doResumeSession(sessionId: string): Promise<CopilotAgentSession> {
3110 > this._logService.info(`[Copilot:${sessionId}] _resumeSession called — session not in memory, resuming...`); copilotAgent.ts
3111 > const client = await this._ensureClient();
3112 >
3113 > const sessionUri = AgentSession.uri(this.id, sessionId);
3114 > const storedMetadata = await this._readSessionMetadata(sessionUri);
3115 > const sessionMetadata = await client.getSessionMetadata(sessionId).catch(err => {
3116 this._logService.warn(`[Copilot:${sessionId}] getSessionMetadata failed`, err);
3117 return undefined;
3118 > }); copilotAgent.ts
3119 > const workingDirectory = storedMetadata.workingDirectory ?? (typeof sessionMetadata?.context?.workingDirectory === 'string' ? URI.file(sessionMetadata.context.workingDirectory) : undefined);
3120 > if (!workingDirectory) {
3121 throw new Error(`workingDirectory is required to resume Copilot session '${sessionId}'`);
3122 }
3123 > // A workspace-less chat's working directory is a stable per-session scratch dir copilotAgent.ts
3124 > // that may have been reaped (OS temp cleanup, reboot) while the session
3125 > // persisted. Recreate it (mkdir -p) so shell/git/scratch ops don't fail.
3126 > let resolvedWorkingDirectory = workingDirectory;
3127 > if (storedMetadata.workspaceless) {
3128 await this._ensureWorkspacelessScratchDir(workingDirectory, sessionId);
3129 > } else { copilotAgent.ts
3130 resolvedWorkingDirectory = await this._configurationService.resolveWorkingDirectoryForResume(sessionUri.toString(), workingDirectory);
3131 }
3132 > // Anchor customization discovery to the working directory (the worktree for copilotAgent.ts
3133 > // worktree-isolated sessions), matching how the session was materialized.
3134 > // Older sessions persisted `customizationDirectory` as the user-picked
3135 > // folder; preferring the working directory corrects them on resume.
3136 > const customizationDirectory = resolvedWorkingDirectory;
3137 > // Always create an ActiveClient so the snapshot includes host +
3138 > // session-discovered customizations, even when no client has
3139 > // registered an active-client handle yet.
3140 > const activeClient = this._getOrCreateActiveClient(sessionUri, customizationDirectory);
3141 > activeClient.pluginController.reanchor(customizationDirectory);
3142 > const snapshot = await activeClient.snapshot();
3143 >
3144 > const shellManager = this._instantiationService.createInstance(ShellManager, sessionUri, resolvedWorkingDirectory);
3145 > const resolvedAgentName = storedMetadata.agent ? this._resolveAgentName(snapshot, storedMetadata.agent) : undefined;
3146 > if (storedMetadata.agent && !resolvedAgentName) {
3147 this._logService.info(`[Copilot:${sessionId}] Stored custom agent is not available in the current plugin snapshot; resuming without a custom agent`);
3148 }
3149 > const launchPlan: CopilotSessionLaunchPlan = { copilotAgent.ts
3150 > kind: 'resume',
3151 > client,
3152 > sessionId,
3153 > workingDirectory: resolvedWorkingDirectory,
3154 > resolvedAgentName,
3155 > snapshot,
3156 > activeClientToolSet: activeClient.toolSet,
3157 > shellManager,
3158 > githubToken: this._githubToken,
3159 > workspaceless: storedMetadata.workspaceless,
3160 > fallback: {
3161 > model: storedMetadata.model,
3162 > longContextWindow: this._longContextWindowFor(storedMetadata.model?.id),
3163 > freeLongContext: this._isFreeLongContext(storedMetadata.model?.id),
3164 > },
3165 > };
3166 >
3167 > const agentSession = this._createAgentSession(launchPlan, customizationDirectory, activeClient);
3168 > try {
3169 > await agentSession.initializeSession();
3170 this._registerInitializedSession(sessionId, agentSession);
3171 > } catch (err) { copilotAgent.ts
3172 agentSession.dispose();
3173 throw err;
3175
3176 return agentSession;
3177 > } copilotAgent.ts
3178
3179 // ---- session metadata persistence --------------------------------------