File tree Expand file tree Collapse file tree
packages/opencode/src/tool Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,8 +80,14 @@ export namespace Tool {
8080 Effect . gen ( function * ( ) {
8181 const toolInfo = init instanceof Function ? { ...( yield * init ( ) ) } : { ...init }
8282 const execute = toolInfo . execute
83- toolInfo . execute = ( args , ctx ) =>
84- Effect . gen ( function * ( ) {
83+ toolInfo . execute = ( args , ctx ) => {
84+ const attrs = {
85+ "tool.name" : id ,
86+ "session.id" : ctx . sessionID ,
87+ "message.id" : ctx . messageID ,
88+ ...( ctx . callID ? { "tool.call_id" : ctx . callID } : { } ) ,
89+ }
90+ return Effect . gen ( function * ( ) {
8591 yield * Effect . try ( {
8692 try : ( ) => toolInfo . parameters . parse ( args ) ,
8793 catch : ( error ) => {
@@ -109,7 +115,8 @@ export namespace Tool {
109115 ...( truncated . truncated && { outputPath : truncated . outputPath } ) ,
110116 } ,
111117 }
112- } ) . pipe ( Effect . orDie )
118+ } ) . pipe ( Effect . orDie , Effect . withSpan ( "Tool.execute" , { attributes : attrs } ) )
119+ }
113120 return toolInfo
114121 } )
115122 }
You can’t perform that action at this time.
0 commit comments