chatModel.ts ×6

Frontier kind: Joint frontier

unlabeled · c_7886a655de7b

3 tests · 44423 LOC · 194 files · introduces 1 test · 46 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
11 ranges46 lines · 3 files
Tests
1 test

Contains — complete concept membership

All code (extent)
4069 ranges44423 lines · 194 files · Browse complete extent
All tests (intent)
3 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.

1 test introduced at this concept.

Introduced code

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

3 files ranked by introduced lines: 46 introduced LOC across 11 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/model/chatModel.ts 37 introduced LOC · 6 ranges

Open complete file

644 case 'toolInvocation':
645 case 'toolInvocationSerialized':
646 > // Include tool invocations in the copy text chatModel.ts
647 > segment = this.getToolInvocationText(part);
648 > break;
649 case 'inlineReference':
650 segment = { text: this.inlineRefToRepr(part) };
714
715 private getToolInvocationText(toolInvocation: IChatToolInvocation | IChatToolInvocationSerialized): { text: string; isBlock?: boolean } {
716 > const getTerminalDisplayInput = (terminalData: ReturnType<typeof migrateLegacyTerminalToolSpecificData>) => terminalData.presentationOverrides?.commandLine chatModel.ts
717 ?? terminalData.commandLine.forDisplay
718 ?? terminalData.commandLine.userEdited
719 ?? terminalData.commandLine.toolEdited
720 ?? terminalData.commandLine.original;
721 > chatModel.ts
722 > // Extract the message and input details
723 > let message = '';
724 > let input = '';
725 >
726 > if (toolInvocation.pastTenseMessage) {
727 > message = typeof toolInvocation.pastTenseMessage === 'string'
728 > ? toolInvocation.pastTenseMessage
729 : toolInvocation.pastTenseMessage.value;
730 > } else { chatModel.ts
731 message = typeof toolInvocation.invocationMessage === 'string'
732 ? toolInvocation.invocationMessage
733 : toolInvocation.invocationMessage.value;
734 }
735 > chatModel.ts
736 > // Handle different types of tool invocations
737 > if (toolInvocation.toolSpecificData) {
738 > if (toolInvocation.toolSpecificData.kind === 'terminal') {
739 > message = 'Ran terminal command';
740 > const terminalData = migrateLegacyTerminalToolSpecificData(toolInvocation.toolSpecificData);
741 > input = getTerminalDisplayInput(terminalData);
742 > }
743 > }
744 >
745 > // Format the tool invocation text
746 > let text = message;
747 > if (input) {
748 > text += `: ${input}`;
749 > }
750 >
751 > // For completed tool invocations, also include the result details if available
752 > if (toolInvocation.kind === 'toolInvocationSerialized' || (toolInvocation.kind === 'toolInvocation' && IChatToolInvocation.isComplete(toolInvocation))) {
753 > const resultDetails = IChatToolInvocation.resultDetails(toolInvocation);
754 > if (resultDetails && 'input' in resultDetails) {
755 const resultPrefix = toolInvocation.kind === 'toolInvocationSerialized' || IChatToolInvocation.isComplete(toolInvocation) ? 'Completed' : 'Errored';
756 const resultInput = toolInvocation.toolSpecificData?.kind === 'terminal'
759 text += `\n${resultPrefix} with input: ${resultInput}`;
760 }
761 > } chatModel.ts
762 >
763 > return { text, isBlock: true };
764 > }
765
766 private uriToRepr(uri: URI): string {
src/vs/workbench/contrib/chat/common/chatService/chatService.ts 6 introduced LOC · 3 ranges

Open complete file

681
682 export function isLegacyChatTerminalToolInvocationData(data: unknown): data is ILegacyChatTerminalToolInvocationData {
683 > return !!data && typeof data === 'object' && 'command' in data && 'language' in data; chatService.ts
684 > }
685
686 /**
961 return invocation.resultDetails;
962 }
964 > const state = invocation.state.read(reader);
965 if (state.type === StateKind.Completed || state.type === StateKind.WaitingForPostApproval) {
966 > return state.resultDetails; chatService.ts
967 > }
968
969 return undefined;
src/vs/workbench/contrib/chat/common/chat.ts 3 introduced LOC · 2 ranges

Open complete file

25 */
26 export function migrateLegacyTerminalToolSpecificData(data: IChatTerminalToolInvocationData | ILegacyChatTerminalToolInvocationData): IChatTerminalToolInvocationData {
27 > if (isLegacyChatTerminalToolInvocationData(data)) { chat.ts
28 data = {
29 kind: 'terminal',
36 } satisfies IChatTerminalToolInvocationData;
37 }
38 > return data; chat.ts
39 > }
40
41 export async function awaitStatsForSession(model: IChatModel): Promise<IChatSessionStats | undefined> {