extHostTypeConverters.ts ×13

Frontier kind: Joint frontier

unlabeled · c_3f16e35154ba

1 test · 68953 LOC · 244 files · introduces 1 test · 70 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
15 ranges70 lines · 2 files
Tests
1 test

Contains — complete concept membership

All code (extent)
4689 ranges68953 lines · 244 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.

2 files ranked by introduced lines: 70 introduced LOC across 15 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/api/common/extHostTypeConverters.ts 59 introduced LOC · 13 ranges

Open complete file

2951 export namespace ChatToolInvocationPart {
2952 export function from(part: vscode.ChatToolInvocationPart): IChatToolInvocationSerialized | IChatExternalToolInvocationUpdate {
2953 > // Check if toolSpecificData is ChatMcpToolInvocationData (has input and output) extHostTypeConverters.ts
2954 > // If so, convert to resultDetails for rendering via ChatInputOutputMarkdownProgressPart
2955 > let resultDetails: IToolResultInputOutputDetails | undefined;
2956 > let toolSpecificData: any;
2957 >
2958 > if (part.toolSpecificData && isChatMcpToolInvocationData(part.toolSpecificData)) {
2959 // Convert ChatMcpToolInvocationData to IToolResultInputOutputDetails
2960 resultDetails = convertMcpToResultDetails(part.toolSpecificData, part.isError);
2961 toolSpecificData = undefined; // MCP data goes to resultDetails, not toolSpecificData
2962 > } else { extHostTypeConverters.ts
2963 > toolSpecificData = part.toolSpecificData ? convertToolSpecificData(part.toolSpecificData) : undefined;
2964 > }
2965 >
2966 > const presentation = part.presentation === 'hidden'
2967 ? ToolInvocationPresentation.Hidden
2968 > : part.presentation === 'hiddenAfterComplete' extHostTypeConverters.ts
2969 ? ToolInvocationPresentation.HiddenAfterComplete
2970 > : undefined; extHostTypeConverters.ts
2971 >
2972 > // When isComplete is explicitly set (not undefined), use the update DTO to enable
2973 > // live tool invocation updates. Extensions can push with isComplete: false to start
2974 > // an in-progress invocation, then push again with isComplete: true to complete it.
2975 > if (part.enablePartialUpdate) {
2976 return {
2977 kind: 'externalToolInvocationUpdate',
2986 };
2987 }
2989 > // Convert extension API ChatToolInvocationPart to internal serialized format (legacy path)
2990 > return {
2991 > kind: 'toolInvocationSerialized',
2992 > toolCallId: part.toolCallId,
2993 > toolId: part.toolName,
2994 > invocationMessage: part.invocationMessage ? MarkdownString.from(part.invocationMessage) : part.toolName,
2995 > originMessage: part.originMessage ? MarkdownString.from(part.originMessage) : undefined,
2996 > pastTenseMessage: part.pastTenseMessage ? MarkdownString.from(part.pastTenseMessage) : undefined,
2997 > isConfirmed: part.isConfirmed,
2998 > isComplete: true,
2999 > source: ToolDataSource.External,
3000 > // isError: part.isError ?? false,
3001 > toolSpecificData,
3002 > resultDetails,
3003 > presentation,
3004 > subAgentInvocationId: part.subAgentInvocationId
3005 > };
3006 > }
3007
3008 function isChatMcpToolInvocationData(data: any): data is vscode.ChatMcpToolInvocationData {
3009 > return data !== null && typeof data === 'object' && extHostTypeConverters.ts
3010 > 'input' in data && typeof data.input === 'string' &&
3011 > 'output' in data && Array.isArray(data.output);
3012 > }
3013
3014 function convertMcpToResultDetails(data: vscode.ChatMcpToolInvocationData, isError?: boolean): IToolResultInputOutputDetails {
3029
3030 function convertToolSpecificData(data: any): any {
3031 > // Convert extension API terminal tool data to internal format extHostTypeConverters.ts
3032 > if ('command' in data && 'language' in data) {
3033 return {
3034 kind: 'terminal',
3036 language: data.language
3037 };
3038 > } else if ('commandLine' in data && 'language' in data) { extHostTypeConverters.ts
3039 const presentationOverrides = data.presentationOverrides && typeof data.presentationOverrides.commandLine === 'string' ? {
3040 commandLine: data.presentationOverrides.commandLine,
3056
3057 return result;
3058 > } else if ('todoList' in data && Array.isArray(data.todoList)) { extHostTypeConverters.ts
3059 // Convert extension API todo tool data to internal format
3060 return {
3066 }))
3067 };
3068 > } else if ('input' in data && 'output' in data && !Array.isArray(data.output)) { extHostTypeConverters.ts
3069 // Convert extension API simple tool invocation data to internal format
3070 return {
3073 output: typeof data.output === 'string' ? data.output : ''
3074 };
3075 > } else if (data && 'values' in data && Array.isArray(data.values)) { extHostTypeConverters.ts
3076 // Convert extension API resources tool data to internal format
3077 return {
3085 })
3086 };
3087 > } else if (data instanceof types.ChatSubagentToolInvocationData) { extHostTypeConverters.ts
3088 > // Convert extension API subagent tool data to internal format
3089 > return {
3090 > kind: 'subagent',
3091 > description: data.description,
3092 > agentName: data.agentName,
3093 > prompt: data.prompt,
3094 > result: data.result,
3095 > modelName: data.modelName,
3096 > };
3097 > }
3098 return data;
3100
3101 function todoStatusEnumToString(status: types.ChatTodoStatus | string): string {
src/vs/workbench/api/common/extHostTypes.ts 11 introduced LOC · 2 ranges

Open complete file

3196 modelName?: string;
3197 constructor(description?: string, agentName?: string, prompt?: string, result?: string) {
3198 > this.description = description; extHostTypes.ts
3199 > this.agentName = agentName;
3200 > this.prompt = prompt;
3201 > this.result = result;
3202 > }
3203 }
3204
3546
3547 constructor(toolName: string,
3548 > toolCallId: string, extHostTypes.ts
3549 > errorMessage?: string) {
3550 > this.toolName = toolName;
3551 > this.toolCallId = toolCallId;
3552 > this.errorMessage = errorMessage;
3553 > }
3554 }
3555