diff --git a/livekit/agent/livekit_agent_session.pb.go b/livekit/agent/livekit_agent_session.pb.go new file mode 100644 index 00000000..b16f8079 --- /dev/null +++ b/livekit/agent/livekit_agent_session.pb.go @@ -0,0 +1,892 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v4.23.4 +// source: agent/livekit_agent_session.proto + +package agent + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ChatRole int32 + +const ( + ChatRole_DEVELOPER ChatRole = 0 + ChatRole_SYSTEM ChatRole = 1 + ChatRole_USER ChatRole = 2 + ChatRole_ASSISTANT ChatRole = 3 +) + +// Enum value maps for ChatRole. +var ( + ChatRole_name = map[int32]string{ + 0: "DEVELOPER", + 1: "SYSTEM", + 2: "USER", + 3: "ASSISTANT", + } + ChatRole_value = map[string]int32{ + "DEVELOPER": 0, + "SYSTEM": 1, + "USER": 2, + "ASSISTANT": 3, + } +) + +func (x ChatRole) Enum() *ChatRole { + p := new(ChatRole) + *p = x + return p +} + +func (x ChatRole) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ChatRole) Descriptor() protoreflect.EnumDescriptor { + return file_agent_livekit_agent_session_proto_enumTypes[0].Descriptor() +} + +func (ChatRole) Type() protoreflect.EnumType { + return &file_agent_livekit_agent_session_proto_enumTypes[0] +} + +func (x ChatRole) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ChatRole.Descriptor instead. +func (ChatRole) EnumDescriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{0} +} + +type MetricsReport struct { + state protoimpl.MessageState `protogen:"open.v1"` + StartedSpeakingAt *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=started_speaking_at,json=startedSpeakingAt,proto3" json:"started_speaking_at,omitempty"` + StoppedSpeakingAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=stopped_speaking_at,json=stoppedSpeakingAt,proto3" json:"stopped_speaking_at,omitempty"` + TranscriptionDelay *float64 `protobuf:"fixed64,3,opt,name=transcription_delay,json=transcriptionDelay,proto3,oneof" json:"transcription_delay,omitempty"` + EndOfTurnDelay *float64 `protobuf:"fixed64,4,opt,name=end_of_turn_delay,json=endOfTurnDelay,proto3,oneof" json:"end_of_turn_delay,omitempty"` + OnUserTurnCompletedDelay *float64 `protobuf:"fixed64,5,opt,name=on_user_turn_completed_delay,json=onUserTurnCompletedDelay,proto3,oneof" json:"on_user_turn_completed_delay,omitempty"` + LlmNodeTtft *float64 `protobuf:"fixed64,6,opt,name=llm_node_ttft,json=llmNodeTtft,proto3,oneof" json:"llm_node_ttft,omitempty"` + TtsNodeTtfb *float64 `protobuf:"fixed64,7,opt,name=tts_node_ttfb,json=ttsNodeTtfb,proto3,oneof" json:"tts_node_ttfb,omitempty"` + E2ELatency *float64 `protobuf:"fixed64,8,opt,name=e2e_latency,json=e2eLatency,proto3,oneof" json:"e2e_latency,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MetricsReport) Reset() { + *x = MetricsReport{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MetricsReport) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetricsReport) ProtoMessage() {} + +func (x *MetricsReport) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MetricsReport.ProtoReflect.Descriptor instead. +func (*MetricsReport) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{0} +} + +func (x *MetricsReport) GetStartedSpeakingAt() *timestamppb.Timestamp { + if x != nil { + return x.StartedSpeakingAt + } + return nil +} + +func (x *MetricsReport) GetStoppedSpeakingAt() *timestamppb.Timestamp { + if x != nil { + return x.StoppedSpeakingAt + } + return nil +} + +func (x *MetricsReport) GetTranscriptionDelay() float64 { + if x != nil && x.TranscriptionDelay != nil { + return *x.TranscriptionDelay + } + return 0 +} + +func (x *MetricsReport) GetEndOfTurnDelay() float64 { + if x != nil && x.EndOfTurnDelay != nil { + return *x.EndOfTurnDelay + } + return 0 +} + +func (x *MetricsReport) GetOnUserTurnCompletedDelay() float64 { + if x != nil && x.OnUserTurnCompletedDelay != nil { + return *x.OnUserTurnCompletedDelay + } + return 0 +} + +func (x *MetricsReport) GetLlmNodeTtft() float64 { + if x != nil && x.LlmNodeTtft != nil { + return *x.LlmNodeTtft + } + return 0 +} + +func (x *MetricsReport) GetTtsNodeTtfb() float64 { + if x != nil && x.TtsNodeTtfb != nil { + return *x.TtsNodeTtfb + } + return 0 +} + +func (x *MetricsReport) GetE2ELatency() float64 { + if x != nil && x.E2ELatency != nil { + return *x.E2ELatency + } + return 0 +} + +type ChatMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Role ChatRole `protobuf:"varint,2,opt,name=role,proto3,enum=livekit.agent.ChatRole" json:"role,omitempty"` + Content []*ChatMessage_ChatContent `protobuf:"bytes,3,rep,name=content,proto3" json:"content,omitempty"` + Interrupted bool `protobuf:"varint,4,opt,name=interrupted,proto3" json:"interrupted,omitempty"` + TranscriptConfidence *float64 `protobuf:"fixed64,5,opt,name=transcript_confidence,json=transcriptConfidence,proto3,oneof" json:"transcript_confidence,omitempty"` + Extra map[string]string `protobuf:"bytes,6,rep,name=extra,proto3" json:"extra,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + Metrics *MetricsReport `protobuf:"bytes,7,opt,name=metrics,proto3" json:"metrics,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChatMessage) Reset() { + *x = ChatMessage{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChatMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatMessage) ProtoMessage() {} + +func (x *ChatMessage) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatMessage.ProtoReflect.Descriptor instead. +func (*ChatMessage) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{1} +} + +func (x *ChatMessage) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ChatMessage) GetRole() ChatRole { + if x != nil { + return x.Role + } + return ChatRole_DEVELOPER +} + +func (x *ChatMessage) GetContent() []*ChatMessage_ChatContent { + if x != nil { + return x.Content + } + return nil +} + +func (x *ChatMessage) GetInterrupted() bool { + if x != nil { + return x.Interrupted + } + return false +} + +func (x *ChatMessage) GetTranscriptConfidence() float64 { + if x != nil && x.TranscriptConfidence != nil { + return *x.TranscriptConfidence + } + return 0 +} + +func (x *ChatMessage) GetExtra() map[string]string { + if x != nil { + return x.Extra + } + return nil +} + +func (x *ChatMessage) GetMetrics() *MetricsReport { + if x != nil { + return x.Metrics + } + return nil +} + +func (x *ChatMessage) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type FunctionCall struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + CallId string `protobuf:"bytes,2,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"` + Arguments string `protobuf:"bytes,3,opt,name=arguments,proto3" json:"arguments,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionCall) Reset() { + *x = FunctionCall{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionCall) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionCall) ProtoMessage() {} + +func (x *FunctionCall) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionCall.ProtoReflect.Descriptor instead. +func (*FunctionCall) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{2} +} + +func (x *FunctionCall) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *FunctionCall) GetCallId() string { + if x != nil { + return x.CallId + } + return "" +} + +func (x *FunctionCall) GetArguments() string { + if x != nil { + return x.Arguments + } + return "" +} + +func (x *FunctionCall) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FunctionCall) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type FunctionCallOutput struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + CallId string `protobuf:"bytes,3,opt,name=call_id,json=callId,proto3" json:"call_id,omitempty"` + Output string `protobuf:"bytes,4,opt,name=output,proto3" json:"output,omitempty"` + IsError bool `protobuf:"varint,5,opt,name=is_error,json=isError,proto3" json:"is_error,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FunctionCallOutput) Reset() { + *x = FunctionCallOutput{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FunctionCallOutput) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FunctionCallOutput) ProtoMessage() {} + +func (x *FunctionCallOutput) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FunctionCallOutput.ProtoReflect.Descriptor instead. +func (*FunctionCallOutput) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{3} +} + +func (x *FunctionCallOutput) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *FunctionCallOutput) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *FunctionCallOutput) GetCallId() string { + if x != nil { + return x.CallId + } + return "" +} + +func (x *FunctionCallOutput) GetOutput() string { + if x != nil { + return x.Output + } + return "" +} + +func (x *FunctionCallOutput) GetIsError() bool { + if x != nil { + return x.IsError + } + return false +} + +func (x *FunctionCallOutput) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type AgentHandoff struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + OldAgentId *string `protobuf:"bytes,2,opt,name=old_agent_id,json=oldAgentId,proto3,oneof" json:"old_agent_id,omitempty"` + NewAgentId string `protobuf:"bytes,3,opt,name=new_agent_id,json=newAgentId,proto3" json:"new_agent_id,omitempty"` + CreatedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AgentHandoff) Reset() { + *x = AgentHandoff{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AgentHandoff) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AgentHandoff) ProtoMessage() {} + +func (x *AgentHandoff) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AgentHandoff.ProtoReflect.Descriptor instead. +func (*AgentHandoff) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{4} +} + +func (x *AgentHandoff) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AgentHandoff) GetOldAgentId() string { + if x != nil && x.OldAgentId != nil { + return *x.OldAgentId + } + return "" +} + +func (x *AgentHandoff) GetNewAgentId() string { + if x != nil { + return x.NewAgentId + } + return "" +} + +func (x *AgentHandoff) GetCreatedAt() *timestamppb.Timestamp { + if x != nil { + return x.CreatedAt + } + return nil +} + +type ChatContext struct { + state protoimpl.MessageState `protogen:"open.v1"` + Items []*ChatContext_ChatItem `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChatContext) Reset() { + *x = ChatContext{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChatContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatContext) ProtoMessage() {} + +func (x *ChatContext) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatContext.ProtoReflect.Descriptor instead. +func (*ChatContext) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{5} +} + +func (x *ChatContext) GetItems() []*ChatContext_ChatItem { + if x != nil { + return x.Items + } + return nil +} + +type ChatMessage_ChatContent struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Payload: + // + // *ChatMessage_ChatContent_Text + Payload isChatMessage_ChatContent_Payload `protobuf_oneof:"payload"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChatMessage_ChatContent) Reset() { + *x = ChatMessage_ChatContent{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChatMessage_ChatContent) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatMessage_ChatContent) ProtoMessage() {} + +func (x *ChatMessage_ChatContent) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatMessage_ChatContent.ProtoReflect.Descriptor instead. +func (*ChatMessage_ChatContent) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{1, 0} +} + +func (x *ChatMessage_ChatContent) GetPayload() isChatMessage_ChatContent_Payload { + if x != nil { + return x.Payload + } + return nil +} + +func (x *ChatMessage_ChatContent) GetText() string { + if x != nil { + if x, ok := x.Payload.(*ChatMessage_ChatContent_Text); ok { + return x.Text + } + } + return "" +} + +type isChatMessage_ChatContent_Payload interface { + isChatMessage_ChatContent_Payload() +} + +type ChatMessage_ChatContent_Text struct { + Text string `protobuf:"bytes,1,opt,name=text,proto3,oneof"` +} + +func (*ChatMessage_ChatContent_Text) isChatMessage_ChatContent_Payload() {} + +type ChatContext_ChatItem struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Item: + // + // *ChatContext_ChatItem_Message + // *ChatContext_ChatItem_FunctionCall + // *ChatContext_ChatItem_FunctionCallOutput + // *ChatContext_ChatItem_AgentHandoff + Item isChatContext_ChatItem_Item `protobuf_oneof:"item"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChatContext_ChatItem) Reset() { + *x = ChatContext_ChatItem{} + mi := &file_agent_livekit_agent_session_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChatContext_ChatItem) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatContext_ChatItem) ProtoMessage() {} + +func (x *ChatContext_ChatItem) ProtoReflect() protoreflect.Message { + mi := &file_agent_livekit_agent_session_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatContext_ChatItem.ProtoReflect.Descriptor instead. +func (*ChatContext_ChatItem) Descriptor() ([]byte, []int) { + return file_agent_livekit_agent_session_proto_rawDescGZIP(), []int{5, 0} +} + +func (x *ChatContext_ChatItem) GetItem() isChatContext_ChatItem_Item { + if x != nil { + return x.Item + } + return nil +} + +func (x *ChatContext_ChatItem) GetMessage() *ChatMessage { + if x != nil { + if x, ok := x.Item.(*ChatContext_ChatItem_Message); ok { + return x.Message + } + } + return nil +} + +func (x *ChatContext_ChatItem) GetFunctionCall() *FunctionCall { + if x != nil { + if x, ok := x.Item.(*ChatContext_ChatItem_FunctionCall); ok { + return x.FunctionCall + } + } + return nil +} + +func (x *ChatContext_ChatItem) GetFunctionCallOutput() *FunctionCallOutput { + if x != nil { + if x, ok := x.Item.(*ChatContext_ChatItem_FunctionCallOutput); ok { + return x.FunctionCallOutput + } + } + return nil +} + +func (x *ChatContext_ChatItem) GetAgentHandoff() *AgentHandoff { + if x != nil { + if x, ok := x.Item.(*ChatContext_ChatItem_AgentHandoff); ok { + return x.AgentHandoff + } + } + return nil +} + +type isChatContext_ChatItem_Item interface { + isChatContext_ChatItem_Item() +} + +type ChatContext_ChatItem_Message struct { + Message *ChatMessage `protobuf:"bytes,1,opt,name=message,proto3,oneof"` +} + +type ChatContext_ChatItem_FunctionCall struct { + FunctionCall *FunctionCall `protobuf:"bytes,2,opt,name=function_call,json=functionCall,proto3,oneof"` +} + +type ChatContext_ChatItem_FunctionCallOutput struct { + FunctionCallOutput *FunctionCallOutput `protobuf:"bytes,3,opt,name=function_call_output,json=functionCallOutput,proto3,oneof"` +} + +type ChatContext_ChatItem_AgentHandoff struct { + AgentHandoff *AgentHandoff `protobuf:"bytes,4,opt,name=agent_handoff,json=agentHandoff,proto3,oneof"` +} + +func (*ChatContext_ChatItem_Message) isChatContext_ChatItem_Item() {} + +func (*ChatContext_ChatItem_FunctionCall) isChatContext_ChatItem_Item() {} + +func (*ChatContext_ChatItem_FunctionCallOutput) isChatContext_ChatItem_Item() {} + +func (*ChatContext_ChatItem_AgentHandoff) isChatContext_ChatItem_Item() {} + +var File_agent_livekit_agent_session_proto protoreflect.FileDescriptor + +const file_agent_livekit_agent_session_proto_rawDesc = "" + + "\n" + + "!agent/livekit_agent_session.proto\x12\rlivekit.agent\x1a\x1fgoogle/protobuf/timestamp.proto\"\xcd\x04\n" + + "\rMetricsReport\x12J\n" + + "\x13started_speaking_at\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\x11startedSpeakingAt\x12J\n" + + "\x13stopped_speaking_at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x11stoppedSpeakingAt\x124\n" + + "\x13transcription_delay\x18\x03 \x01(\x01H\x00R\x12transcriptionDelay\x88\x01\x01\x12.\n" + + "\x11end_of_turn_delay\x18\x04 \x01(\x01H\x01R\x0eendOfTurnDelay\x88\x01\x01\x12C\n" + + "\x1con_user_turn_completed_delay\x18\x05 \x01(\x01H\x02R\x18onUserTurnCompletedDelay\x88\x01\x01\x12'\n" + + "\rllm_node_ttft\x18\x06 \x01(\x01H\x03R\vllmNodeTtft\x88\x01\x01\x12'\n" + + "\rtts_node_ttfb\x18\a \x01(\x01H\x04R\vttsNodeTtfb\x88\x01\x01\x12$\n" + + "\ve2e_latency\x18\b \x01(\x01H\x05R\n" + + "e2eLatency\x88\x01\x01B\x16\n" + + "\x14_transcription_delayB\x14\n" + + "\x12_end_of_turn_delayB\x1f\n" + + "\x1d_on_user_turn_completed_delayB\x10\n" + + "\x0e_llm_node_ttftB\x10\n" + + "\x0e_tts_node_ttfbB\x0e\n" + + "\f_e2e_latency\"\x9c\x04\n" + + "\vChatMessage\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12+\n" + + "\x04role\x18\x02 \x01(\x0e2\x17.livekit.agent.ChatRoleR\x04role\x12@\n" + + "\acontent\x18\x03 \x03(\v2&.livekit.agent.ChatMessage.ChatContentR\acontent\x12 \n" + + "\vinterrupted\x18\x04 \x01(\bR\vinterrupted\x128\n" + + "\x15transcript_confidence\x18\x05 \x01(\x01H\x00R\x14transcriptConfidence\x88\x01\x01\x12;\n" + + "\x05extra\x18\x06 \x03(\v2%.livekit.agent.ChatMessage.ExtraEntryR\x05extra\x126\n" + + "\ametrics\x18\a \x01(\v2\x1c.livekit.agent.MetricsReportR\ametrics\x129\n" + + "\n" + + "created_at\x18\b \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x1a.\n" + + "\vChatContent\x12\x14\n" + + "\x04text\x18\x01 \x01(\tH\x00R\x04textB\t\n" + + "\apayload\x1a8\n" + + "\n" + + "ExtraEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x18\n" + + "\x16_transcript_confidence\"\xa4\x01\n" + + "\fFunctionCall\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\acall_id\x18\x02 \x01(\tR\x06callId\x12\x1c\n" + + "\targuments\x18\x03 \x01(\tR\targuments\x12\x12\n" + + "\x04name\x18\x04 \x01(\tR\x04name\x129\n" + + "\n" + + "created_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\"\xbf\x01\n" + + "\x12FunctionCallOutput\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x17\n" + + "\acall_id\x18\x03 \x01(\tR\x06callId\x12\x16\n" + + "\x06output\x18\x04 \x01(\tR\x06output\x12\x19\n" + + "\bis_error\x18\x05 \x01(\bR\aisError\x129\n" + + "\n" + + "created_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\"\xb3\x01\n" + + "\fAgentHandoff\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12%\n" + + "\fold_agent_id\x18\x02 \x01(\tH\x00R\n" + + "oldAgentId\x88\x01\x01\x12 \n" + + "\fnew_agent_id\x18\x03 \x01(\tR\n" + + "newAgentId\x129\n" + + "\n" + + "created_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAtB\x0f\n" + + "\r_old_agent_id\"\xf4\x02\n" + + "\vChatContext\x129\n" + + "\x05items\x18\x01 \x03(\v2#.livekit.agent.ChatContext.ChatItemR\x05items\x1a\xa9\x02\n" + + "\bChatItem\x126\n" + + "\amessage\x18\x01 \x01(\v2\x1a.livekit.agent.ChatMessageH\x00R\amessage\x12B\n" + + "\rfunction_call\x18\x02 \x01(\v2\x1b.livekit.agent.FunctionCallH\x00R\ffunctionCall\x12U\n" + + "\x14function_call_output\x18\x03 \x01(\v2!.livekit.agent.FunctionCallOutputH\x00R\x12functionCallOutput\x12B\n" + + "\ragent_handoff\x18\x04 \x01(\v2\x1b.livekit.agent.AgentHandoffH\x00R\fagentHandoffB\x06\n" + + "\x04item*>\n" + + "\bChatRole\x12\r\n" + + "\tDEVELOPER\x10\x00\x12\n" + + "\n" + + "\x06SYSTEM\x10\x01\x12\b\n" + + "\x04USER\x10\x02\x12\r\n" + + "\tASSISTANT\x10\x03B+Z)github.com/livekit/protocol/livekit/agentb\x06proto3" + +var ( + file_agent_livekit_agent_session_proto_rawDescOnce sync.Once + file_agent_livekit_agent_session_proto_rawDescData []byte +) + +func file_agent_livekit_agent_session_proto_rawDescGZIP() []byte { + file_agent_livekit_agent_session_proto_rawDescOnce.Do(func() { + file_agent_livekit_agent_session_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_agent_livekit_agent_session_proto_rawDesc), len(file_agent_livekit_agent_session_proto_rawDesc))) + }) + return file_agent_livekit_agent_session_proto_rawDescData +} + +var file_agent_livekit_agent_session_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_agent_livekit_agent_session_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_agent_livekit_agent_session_proto_goTypes = []any{ + (ChatRole)(0), // 0: livekit.agent.ChatRole + (*MetricsReport)(nil), // 1: livekit.agent.MetricsReport + (*ChatMessage)(nil), // 2: livekit.agent.ChatMessage + (*FunctionCall)(nil), // 3: livekit.agent.FunctionCall + (*FunctionCallOutput)(nil), // 4: livekit.agent.FunctionCallOutput + (*AgentHandoff)(nil), // 5: livekit.agent.AgentHandoff + (*ChatContext)(nil), // 6: livekit.agent.ChatContext + (*ChatMessage_ChatContent)(nil), // 7: livekit.agent.ChatMessage.ChatContent + nil, // 8: livekit.agent.ChatMessage.ExtraEntry + (*ChatContext_ChatItem)(nil), // 9: livekit.agent.ChatContext.ChatItem + (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp +} +var file_agent_livekit_agent_session_proto_depIdxs = []int32{ + 10, // 0: livekit.agent.MetricsReport.started_speaking_at:type_name -> google.protobuf.Timestamp + 10, // 1: livekit.agent.MetricsReport.stopped_speaking_at:type_name -> google.protobuf.Timestamp + 0, // 2: livekit.agent.ChatMessage.role:type_name -> livekit.agent.ChatRole + 7, // 3: livekit.agent.ChatMessage.content:type_name -> livekit.agent.ChatMessage.ChatContent + 8, // 4: livekit.agent.ChatMessage.extra:type_name -> livekit.agent.ChatMessage.ExtraEntry + 1, // 5: livekit.agent.ChatMessage.metrics:type_name -> livekit.agent.MetricsReport + 10, // 6: livekit.agent.ChatMessage.created_at:type_name -> google.protobuf.Timestamp + 10, // 7: livekit.agent.FunctionCall.created_at:type_name -> google.protobuf.Timestamp + 10, // 8: livekit.agent.FunctionCallOutput.created_at:type_name -> google.protobuf.Timestamp + 10, // 9: livekit.agent.AgentHandoff.created_at:type_name -> google.protobuf.Timestamp + 9, // 10: livekit.agent.ChatContext.items:type_name -> livekit.agent.ChatContext.ChatItem + 2, // 11: livekit.agent.ChatContext.ChatItem.message:type_name -> livekit.agent.ChatMessage + 3, // 12: livekit.agent.ChatContext.ChatItem.function_call:type_name -> livekit.agent.FunctionCall + 4, // 13: livekit.agent.ChatContext.ChatItem.function_call_output:type_name -> livekit.agent.FunctionCallOutput + 5, // 14: livekit.agent.ChatContext.ChatItem.agent_handoff:type_name -> livekit.agent.AgentHandoff + 15, // [15:15] is the sub-list for method output_type + 15, // [15:15] is the sub-list for method input_type + 15, // [15:15] is the sub-list for extension type_name + 15, // [15:15] is the sub-list for extension extendee + 0, // [0:15] is the sub-list for field type_name +} + +func init() { file_agent_livekit_agent_session_proto_init() } +func file_agent_livekit_agent_session_proto_init() { + if File_agent_livekit_agent_session_proto != nil { + return + } + file_agent_livekit_agent_session_proto_msgTypes[0].OneofWrappers = []any{} + file_agent_livekit_agent_session_proto_msgTypes[1].OneofWrappers = []any{} + file_agent_livekit_agent_session_proto_msgTypes[4].OneofWrappers = []any{} + file_agent_livekit_agent_session_proto_msgTypes[6].OneofWrappers = []any{ + (*ChatMessage_ChatContent_Text)(nil), + } + file_agent_livekit_agent_session_proto_msgTypes[8].OneofWrappers = []any{ + (*ChatContext_ChatItem_Message)(nil), + (*ChatContext_ChatItem_FunctionCall)(nil), + (*ChatContext_ChatItem_FunctionCallOutput)(nil), + (*ChatContext_ChatItem_AgentHandoff)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_agent_livekit_agent_session_proto_rawDesc), len(file_agent_livekit_agent_session_proto_rawDesc)), + NumEnums: 1, + NumMessages: 9, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_agent_livekit_agent_session_proto_goTypes, + DependencyIndexes: file_agent_livekit_agent_session_proto_depIdxs, + EnumInfos: file_agent_livekit_agent_session_proto_enumTypes, + MessageInfos: file_agent_livekit_agent_session_proto_msgTypes, + }.Build() + File_agent_livekit_agent_session_proto = out.File + file_agent_livekit_agent_session_proto_goTypes = nil + file_agent_livekit_agent_session_proto_depIdxs = nil +} diff --git a/magefile.go b/magefile.go index f2a1f523..54d32beb 100644 --- a/magefile.go +++ b/magefile.go @@ -51,6 +51,11 @@ func Proto() error { "livekit_cloud_agent.proto", "livekit_phone_number.proto", } + + agentProtoFiles := []string{ + "agent/livekit_agent_session.proto", + } + protoFiles := []string{ "livekit_agent.proto", "livekit_analytics.proto", @@ -148,6 +153,23 @@ func Proto() error { if err := cmd.Run(); err != nil { return err } + + fmt.Println("generating protobuf (livekit/agent)") + { + args := []string{ + "--go_out", target, + "--go_opt=paths=source_relative", + "--plugin=go=" + protocGoPath, + "-I=./protobufs", + } + args = append(args, agentProtoFiles...) + cmd := exec.Command(protoc, args...) + connectStd(cmd) + if err := cmd.Run(); err != nil { + return err + } + } + fmt.Println("generating grpc protobuf") args = append([]string{ "--go_out", ".", diff --git a/protobufs/agent/livekit_agent_session.proto b/protobufs/agent/livekit_agent_session.proto new file mode 100644 index 00000000..63063930 --- /dev/null +++ b/protobufs/agent/livekit_agent_session.proto @@ -0,0 +1,81 @@ +syntax = "proto3"; + +package livekit.agent; + +option go_package = "github.com/livekit/protocol/livekit/agent"; + +import "google/protobuf/timestamp.proto"; + +enum ChatRole { + DEVELOPER = 0; + SYSTEM = 1; + USER = 2; + ASSISTANT = 3; +} + +message MetricsReport { + google.protobuf.Timestamp started_speaking_at = 1; + google.protobuf.Timestamp stopped_speaking_at = 2; + + optional double transcription_delay = 3; + optional double end_of_turn_delay = 4; + optional double on_user_turn_completed_delay = 5; + optional double llm_node_ttft = 6; + optional double tts_node_ttfb = 7; + optional double e2e_latency = 8; +} + +message ChatMessage { + message ChatContent { + oneof payload { + string text = 1; + } + } + + string id = 1; + ChatRole role = 2; + repeated ChatContent content = 3; + bool interrupted = 4; + optional double transcript_confidence = 5; + map extra = 6; + MetricsReport metrics = 7; + google.protobuf.Timestamp created_at = 8; +} + +message FunctionCall { + string id = 1; + string call_id = 2; + string arguments = 3; + string name = 4; + google.protobuf.Timestamp created_at = 5; +} + +message FunctionCallOutput { + string id = 1; + string name = 2; + string call_id = 3; + string output = 4; + bool is_error = 5; + google.protobuf.Timestamp created_at = 6; +} + +message AgentHandoff { + string id = 1; + optional string old_agent_id = 2; + string new_agent_id = 3; + google.protobuf.Timestamp created_at = 4; +} + +message ChatContext { + message ChatItem { + oneof item { + ChatMessage message = 1; + FunctionCall function_call = 2; + FunctionCallOutput function_call_output = 3; + AgentHandoff agent_handoff = 4; + } + } + + repeated ChatItem items = 1; +} +