copilotShellTools.ts ×10

Frontier kind: Code frontier

unlabeled · c_60e55eb59e88

16 tests · 28884 LOC · 131 files · introduces 0 tests · 34 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges34 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2514 ranges28884 lines · 131 files · Browse complete extent
All tests (intent)
16 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: 34 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/copilot/copilotShellTools.ts 34 introduced LOC · 10 ranges

Open complete file

292 }
293
294 > function makeExecutionResult(toolResult: ToolResultObject, options?: { keepShellBusy?: boolean }): IShellExecutionResult { copilotShellTools.ts
295 > return { toolResult, keepShellBusy: options?.keepShellBusy };
296 > }
297
298 /**
301 * shell tools.
302 */
303 > function shellCommandResultToExecutionResult(result: IShellCommandResult, timeoutMs: number): IShellExecutionResult { copilotShellTools.ts
304 > switch (result.status) {
305 > case 'completed': {
306 const exitCode = result.exitCode ?? 0;
307 const text = `Exit code: ${exitCode}\n${result.output}`;
308 return makeExecutionResult(exitCode === 0 ? makeSuccessResult(text) : makeFailureResult(text));
309 }
310 > case 'shellExited': copilotShellTools.ts
311 return makeExecutionResult(makeFailureResult(`Shell exited with code ${result.exitCode}\n${result.output}`));
312 > case 'timeout': copilotShellTools.ts
313 return makeExecutionResult(makeFailureResult(
314 `Command timed out after ${Math.round(timeoutMs / 1000)}s. Partial output:\n${result.output}`,
315 'timeout',
316 ));
317 > case 'background': copilotShellTools.ts
318 return makeExecutionResult(
319 makeSuccessResult('The user chose to continue this command in the background. The terminal is still running.'),
320 { keepShellBusy: true },
321 );
322 > case 'altBuffer': copilotShellTools.ts
323 return makeExecutionResult(makeFailureResult(ALT_BUFFER_MESSAGE, 'alternateBuffer'), { keepShellBusy: true });
325 > }
326
327 > async function executeCommandInShell( copilotShellTools.ts
328 > shell: IManagedShell,
329 > command: string,
330 > timeoutMs: number,
331 > terminalManager: IAgentHostTerminalManager,
332 > logService: ILogService,
333 > ): Promise<IShellExecutionResult> {
334 > const result = shellCommandResultToExecutionResult(
335 > await executeShellCommand(shell, command, timeoutMs, terminalManager, logService),
336 > timeoutMs,
337 > );
338 > return {
339 > ...result,
340 > toolResult: {
341 > ...result.toolResult,
342 > textResultForLlm: `Shell ID: ${shell.id}\n${result.toolResult.textResultForLlm}`,
343 > },
344 > };
345 > }
346
347 // ---------------------------------------------------------------------------
502 commandToRun = wrapped.command;
503 }
504 > const result = await executeCommandInShell(ref.object, commandToRun, timeoutMs, terminalManager, logService); copilotShellTools.ts
505 > if (result.keepShellBusy) {
506 shouldReleaseShell = false;
507 shellManager.holdShellUntilCommandFinishes(ref.object);
508 }
509 > return result.toolResult; copilotShellTools.ts
510 } finally {
511 if (shouldReleaseShell) {