shellCommandExecution.ts ×8

Frontier kind: Code frontier

unlabeled · c_9f186f5f08c7

15 tests · 27371 LOC · 121 files · introduces 0 tests · 45 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges45 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2310 ranges27371 lines · 121 files · Browse complete extent
All tests (intent)
15 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: 45 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/shellCommandExecution.ts 45 introduced LOC · 8 ranges

Open complete file

197 ): Promise<IShellCommandResult> {
198 return terminalManager.supportsCommandDetection(target.terminalUri)
199 > ? executeCommandWithShellIntegration(target, command, timeoutMs, terminalManager, logService) shellCommandExecution.ts
200 : executeCommandWithSentinel(target, command, timeoutMs, terminalManager, logService);
201 }
219 * provides the exit code and cleanly delineated output.
220 */
221 > async function executeCommandWithShellIntegration( shellCommandExecution.ts
222 > target: IShellCommandTarget,
223 > command: string,
224 > timeoutMs: number,
225 > terminalManager: IAgentHostTerminalManager,
226 > logService: ILogService,
227 > ): Promise<IShellCommandResult> {
228 > const disposables = new DisposableStore();
229 >
230 > const result = new Promise<IShellCommandResult>(resolve => {
231 > let resolved = false;
232 > const finish = (result: IShellCommandResult) => {
233 > if (resolved) {
234 return;
235 }
236 > resolved = true; shellCommandExecution.ts
237 > disposables.dispose();
238 > resolve(result);
239 > };
240 >
241 > disposables.add(terminalManager.onCommandFinished(target.terminalUri, event => {
242 const output = prepareOutputForModel(event.output);
243 const exitCode = event.exitCode ?? 0;
244 logService.info(`[ShellCommand] Command completed (shell integration) with exit code ${exitCode}`);
245 finish({ status: 'completed', exitCode, output });
247 >
248 > registerAltBufferHandler(target, terminalManager, logService, disposables, finish);
249 >
250 > disposables.add(terminalManager.onExit(target.terminalUri, (exitCode: number) => {
251 logService.info(`[ShellCommand] Shell exited unexpectedly with code ${exitCode}`);
252 const fullContent = terminalManager.getContent(target.terminalUri) ?? '';
253 finish({ status: 'shellExited', exitCode, output: prepareOutputForModel(fullContent) });
255 >
256 > disposables.add(terminalManager.onClaimChanged(target.terminalUri, (claim) => {
257 if (claim.kind === TerminalClaimKind.Session && !claim.toolCallId) {
258 logService.info(`[ShellCommand] Continuing in background (claim narrowed)`);
259 finish({ status: 'background', output: '' });
260 }
262 >
263 > const timer = setTimeout(() => {
264 logService.warn(`[ShellCommand] Command timed out after ${timeoutMs}ms`);
265 const fullContent = terminalManager.getContent(target.terminalUri) ?? '';
266 finish({ status: 'timeout', output: prepareOutputForModel(fullContent) });
267 > }, timeoutMs); shellCommandExecution.ts
268 > disposables.add(toDisposable(() => clearTimeout(timer)));
269 >
270 > });
271 >
272 > try {
273 > await terminalManager.sendText(target.terminalUri, `${prefixForHistorySuppression(target.shellType)}${command}`, {
274 > shouldExecute: true,
275 > bracketedPasteMode: shouldUseBracketedPasteMode(command),
276 > });
277 > } catch (err) {
278 disposables.dispose();
279 throw err;
280 }
282 > return result;
283 > }
284
285 /**