@@ -42,7 +42,7 @@ import { IChatAgentRequest, IChatAgentResult } from '../../contrib/chat/common/c
4242import { IChatRequestDraft } from '../../contrib/chat/common/chatEditingService.js' ;
4343import { IChatRequestVariableEntry , isImageVariableEntry } from '../../contrib/chat/common/chatVariableEntries.js' ;
4444import { IChatAgentMarkdownContentWithVulnerability , IChatCodeCitation , IChatCommandButton , IChatConfirmation , IChatContentInlineReference , IChatContentReference , IChatExtensionsContent , IChatFollowup , IChatMarkdownContent , IChatMoveMessage , IChatPrepareToolInvocationPart , IChatProgressMessage , IChatResponseCodeblockUriPart , IChatTaskDto , IChatTaskResult , IChatTextEdit , IChatTreeData , IChatUserActionEvent , IChatWarningMessage } from '../../contrib/chat/common/chatService.js' ;
45- import { IToolResult , ToolDataSource } from '../../contrib/chat/common/languageModelToolsService.js' ;
45+ import { IToolResult , IToolResultInputOutputDetails , IToolResultOutputDetails , ToolDataSource } from '../../contrib/chat/common/languageModelToolsService.js' ;
4646import * as chatProvider from '../../contrib/chat/common/languageModels.js' ;
4747import { IChatMessageDataPart , IChatResponseDataPart , IChatResponsePromptTsxPart , IChatResponseTextPart } from '../../contrib/chat/common/languageModels.js' ;
4848import { DebugTreeItemCollapsibleState , IDebugVisualizationTreeItem } from '../../contrib/debug/common/debug.js' ;
@@ -3346,12 +3346,30 @@ export namespace LanguageModelToolResult2 {
33463346 } ) ) ;
33473347 }
33483348
3349- export function from ( result : vscode . ExtendedLanguageModelToolResult , extension : IExtensionDescription ) : Dto < IToolResult > | SerializableObjectWithBuffers < Dto < IToolResult > > {
3349+ export function from ( result : vscode . ExtendedLanguageModelToolResult2 , extension : IExtensionDescription ) : Dto < IToolResult > | SerializableObjectWithBuffers < Dto < IToolResult > > {
33503350 if ( result . toolResultMessage ) {
33513351 checkProposedApiEnabled ( extension , 'chatParticipantPrivate' ) ;
33523352 }
33533353
33543354 let hasBuffers = false ;
3355+ let detailsDto : Dto < Array < URI | types . Location > | IToolResultInputOutputDetails | IToolResultOutputDetails | undefined > = undefined ;
3356+ if ( Array . isArray ( result . toolResultDetails ) ) {
3357+ detailsDto = result . toolResultDetails ?. map ( detail => {
3358+ return URI . isUri ( detail ) ? detail : Location . from ( detail as vscode . Location ) ;
3359+ } ) ;
3360+ } else {
3361+ if ( result . toolResultDetails2 ) {
3362+ detailsDto = {
3363+ output : {
3364+ type : 'data' ,
3365+ mimeType : ( result . toolResultDetails2 as vscode . ToolResultDataOutput ) . mime ,
3366+ value : VSBuffer . wrap ( ( result . toolResultDetails2 as vscode . ToolResultDataOutput ) . value ) ,
3367+ }
3368+ } satisfies IToolResultOutputDetails ;
3369+ hasBuffers = true ;
3370+ }
3371+ }
3372+
33553373 const dto : Dto < IToolResult > = {
33563374 content : result . content . map ( item => {
33573375 if ( item instanceof types . LanguageModelTextPart ) {
@@ -3378,7 +3396,7 @@ export namespace LanguageModelToolResult2 {
33783396 }
33793397 } ) ,
33803398 toolResultMessage : MarkdownString . fromStrict ( result . toolResultMessage ) ,
3381- toolResultDetails : result . toolResultDetails ?. map ( detail => URI . isUri ( detail ) ? detail : Location . from ( detail as vscode . Location ) ) ,
3399+ toolResultDetails : detailsDto ,
33823400 } ;
33833401
33843402 return hasBuffers ? new SerializableObjectWithBuffers ( dto ) : dto ;
0 commit comments