File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { getFileSource } from '@/features/git' ;
22import { isServiceError } from "@/lib/utils" ;
3+ import { captureEvent } from "@/lib/posthog" ;
34import { ProviderOptions } from "@ai-sdk/provider-utils" ;
45import { createLogger , env } from "@sourcebot/shared" ;
56import { env as clientEnv } from "@sourcebot/shared/client" ;
@@ -82,6 +83,11 @@ export const createAgentStream = async ({
8283 toolChoice : "auto" ,
8384 onStepFinish : ( { toolResults } ) => {
8485 toolResults . forEach ( ( { toolName, output, dynamic } ) => {
86+ captureEvent ( 'wa_chat_tool_used' , {
87+ toolName,
88+ success : ! isServiceError ( output ) ,
89+ } ) ;
90+
8591 if ( dynamic || isServiceError ( output ) ) {
8692 return ;
8793 }
Original file line number Diff line number Diff line change @@ -154,6 +154,10 @@ export type PosthogEventMap = {
154154 wa_chat_message_sent : {
155155 messageCount : number ,
156156 } ,
157+ wa_chat_tool_used : {
158+ toolName : string ,
159+ success : boolean ,
160+ } ,
157161 //////////////////////////////////////////////////////////////////
158162 wa_demo_docs_link_pressed : { } ,
159163 wa_demo_search_example_card_pressed : {
You can’t perform that action at this time.
0 commit comments