agentHostTerminalManager.ts ×10

Frontier kind: Joint frontier

unlabeled · c_fe12714d9636

1 test · 25965 LOC · 110 files · introduces 1 test · 93 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges93 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
2365 ranges25965 lines · 110 files · Browse complete extent
All tests (intent)
1 testBrowse 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.

1 test introduced at this concept.

Introduced code

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

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

src/vs/platform/agentHost/node/agentHostTerminalManager.ts 93 introduced LOC · 10 ranges

Open complete file

537 /** Register a callback for command completion events (requires shell integration). */
538 onCommandFinished(uri: string, cb: (event: ICommandFinishedEvent) => void): IDisposable {
539 > const terminal = this._terminals.get(uri); agentHostTerminalManager.ts
540 > if (!terminal) {
541 return toDisposable(() => { });
542 }
543 > return terminal.onCommandFinishedEmitter.event(cb); agentHostTerminalManager.ts
544 > }
545
546 createAltBufferPromise(uri: string, store: DisposableStore): Promise<void> {
642 const flushClientData = (): void => {
643 if (pendingClientData.length === 0) {
645 > }
646 managed.onDataEmitter.fire(pendingClientData);
647 this._stateManager.dispatchServerAction(managed.uri, {
654 for (const segment of segments) {
655 if (segment.kind === 'event') {
656 > flushClientData(); agentHostTerminalManager.ts
657 > this._handleOsc633Event(managed, tracker!, segment.event);
658 > continue;
659 > }
660
661 // Agent Host's server-side headless terminal answers CPR so terminals
677 /** Handle a parsed OSC 633 event by dispatching the appropriate protocol actions. */
678 private _handleOsc633Event(managed: IManagedTerminal, tracker: ICommandTracker, event: Osc633Event): void {
679 > // Emit TerminalCommandDetectionAvailable on first sequence agentHostTerminalManager.ts
680 > if (!tracker.detectionAvailableEmitted) {
681 > tracker.detectionAvailableEmitted = true;
682 > this._stateManager.dispatchServerAction(managed.uri, {
683 > type: ActionType.TerminalCommandDetectionAvailable,
684 > });
685 > }
686 >
687 > switch (event.type) {
688 > case Osc633EventType.CommandLine: {
689 // Only trust command lines with a valid nonce
690 if (event.nonce === tracker.nonce) {
693 break;
694 }
696 > case Osc633EventType.CommandExecuted: {
697 > const commandId = `cmd-${++tracker.commandCounter}`;
698 > const commandLine = tracker.pendingCommandLine ?? '';
699 > const timestamp = Date.now();
700 > tracker.pendingCommandLine = undefined;
701 > tracker.activeCommandId = commandId;
702 > tracker.activeCommandTimestamp = timestamp;
703 >
704 > // Push a new command content part
705 > managed.content.push({
706 > type: 'command',
707 > commandId,
708 > commandLine,
709 > output: '',
710 > timestamp,
711 > isComplete: false,
712 > });
713 >
714 > this._stateManager.dispatchServerAction(managed.uri, {
715 > type: ActionType.TerminalCommandExecuted,
716 > commandId,
717 > commandLine,
718 > timestamp,
719 > });
720 > break;
721 > }
722 >
723 > case Osc633EventType.CommandFinished: {
724 > const finishedCommandId = tracker.activeCommandId;
725 > if (!finishedCommandId) {
726 break;
727 }
728 > const durationMs = tracker.activeCommandTimestamp !== undefined agentHostTerminalManager.ts
729 > ? Date.now() - tracker.activeCommandTimestamp
730 : undefined;
732 > // Mark the command content part as complete and collect output
733 > let commandLine = '';
734 > let commandOutput = '';
735 > for (const part of managed.content) {
736 > if (part.type === 'command' && part.commandId === finishedCommandId) {
737 > part.isComplete = true;
738 > part.exitCode = event.exitCode;
739 > part.durationMs = durationMs;
740 > commandLine = part.commandLine;
741 > commandOutput = part.output;
742 > break;
743 > }
744 > }
745 >
746 > tracker.activeCommandId = undefined;
747 > tracker.activeCommandTimestamp = undefined;
748 >
749 > managed.onCommandFinishedEmitter.fire({
750 > commandId: finishedCommandId,
751 > exitCode: event.exitCode,
752 > command: commandLine,
753 > output: commandOutput,
754 > });
755 >
756 > this._stateManager.dispatchServerAction(managed.uri, {
757 > type: ActionType.TerminalCommandFinished,
758 > commandId: finishedCommandId,
759 > exitCode: event.exitCode,
760 > durationMs,
761 > });
762 > break;
763 > }
764 >
765 > case Osc633EventType.Property: {
766 if (event.key === 'Cwd') {
767 managed.cwd = event.value;
773 break;
774 }
776 > }
777
778 /** Append cleaned data to the terminal's structured content array. */
781
782 if (tail?.type === 'command' && !tail.isComplete) {
783 > // Active command — append to its output agentHostTerminalManager.ts
784 > tail.output += data;
785 > managed.contentSize += data.length;
786 } else if (tail?.type === 'unclassified') {
787 // Extend the existing unclassified part