diff --git a/auth/grants.go b/auth/grants.go index e50e703ec..4fe7c57f5 100644 --- a/auth/grants.go +++ b/auth/grants.go @@ -581,6 +581,8 @@ type AgentGrant struct { Admin bool `json:"admin,omitempty"` // SimulationAdmin grants access to manage simulations and scenarios for evaluating agents. SimulationAdmin bool `json:"simulationAdmin,omitempty"` + // DatabaseAdmin grants access to a project's agent databases (AgentDB). + DatabaseAdmin bool `json:"databaseAdmin,omitempty"` } func (s *AgentGrant) Clone() *AgentGrant { @@ -600,6 +602,7 @@ func (s *AgentGrant) MarshalLogObject(e zapcore.ObjectEncoder) error { e.AddBool("Admin", s.Admin) e.AddBool("SimulationAdmin", s.SimulationAdmin) + e.AddBool("DatabaseAdmin", s.DatabaseAdmin) return nil } diff --git a/livekit/agentdb/livekit_agentdb.pb.go b/livekit/agentdb/livekit_agentdb.pb.go new file mode 100644 index 000000000..849bd0232 --- /dev/null +++ b/livekit/agentdb/livekit_agentdb.pb.go @@ -0,0 +1,768 @@ +// Copyright 2026 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.35.1 +// source: agentdb/livekit_agentdb.proto + +package agentdb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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 CreateDatabaseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Region string `protobuf:"bytes,1,opt,name=region,proto3" json:"region,omitempty"` + UserAttributes string `protobuf:"bytes,2,opt,name=user_attributes,json=userAttributes,proto3" json:"user_attributes,omitempty"` // opaque JSON metadata for the caller + TtlSeconds int64 `protobuf:"varint,3,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"` // unset: never expires. Otherwise clamped to the server cap, and never extended + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateDatabaseRequest) Reset() { + *x = CreateDatabaseRequest{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDatabaseRequest) ProtoMessage() {} + +func (x *CreateDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 CreateDatabaseRequest.ProtoReflect.Descriptor instead. +func (*CreateDatabaseRequest) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateDatabaseRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *CreateDatabaseRequest) GetUserAttributes() string { + if x != nil { + return x.UserAttributes + } + return "" +} + +func (x *CreateDatabaseRequest) GetTtlSeconds() int64 { + if x != nil { + return x.TtlSeconds + } + return 0 +} + +type CreateDatabaseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` // "DB_..." + ExpiresAtUnix int64 `protobuf:"varint,2,opt,name=expires_at_unix,json=expiresAtUnix,proto3" json:"expires_at_unix,omitempty"` // 0: never expires + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateDatabaseResponse) Reset() { + *x = CreateDatabaseResponse{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDatabaseResponse) ProtoMessage() {} + +func (x *CreateDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 CreateDatabaseResponse.ProtoReflect.Descriptor instead. +func (*CreateDatabaseResponse) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateDatabaseResponse) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +func (x *CreateDatabaseResponse) GetExpiresAtUnix() int64 { + if x != nil { + return x.ExpiresAtUnix + } + return 0 +} + +type GetDatabaseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetDatabaseRequest) Reset() { + *x = GetDatabaseRequest{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDatabaseRequest) ProtoMessage() {} + +func (x *GetDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 GetDatabaseRequest.ProtoReflect.Descriptor instead. +func (*GetDatabaseRequest) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{2} +} + +func (x *GetDatabaseRequest) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +type GetDatabaseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` + UserAttributes string `protobuf:"bytes,3,opt,name=user_attributes,json=userAttributes,proto3" json:"user_attributes,omitempty"` + CreatedAtUnix int64 `protobuf:"varint,4,opt,name=created_at_unix,json=createdAtUnix,proto3" json:"created_at_unix,omitempty"` + ExpiresAtUnix int64 `protobuf:"varint,5,opt,name=expires_at_unix,json=expiresAtUnix,proto3" json:"expires_at_unix,omitempty"` // 0: never expires + Tip int64 `protobuf:"varint,6,opt,name=tip,proto3" json:"tip,omitempty"` // latest durable commit sequence + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetDatabaseResponse) Reset() { + *x = GetDatabaseResponse{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetDatabaseResponse) ProtoMessage() {} + +func (x *GetDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 GetDatabaseResponse.ProtoReflect.Descriptor instead. +func (*GetDatabaseResponse) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{3} +} + +func (x *GetDatabaseResponse) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +func (x *GetDatabaseResponse) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *GetDatabaseResponse) GetUserAttributes() string { + if x != nil { + return x.UserAttributes + } + return "" +} + +func (x *GetDatabaseResponse) GetCreatedAtUnix() int64 { + if x != nil { + return x.CreatedAtUnix + } + return 0 +} + +func (x *GetDatabaseResponse) GetExpiresAtUnix() int64 { + if x != nil { + return x.ExpiresAtUnix + } + return 0 +} + +func (x *GetDatabaseResponse) GetTip() int64 { + if x != nil { + return x.Tip + } + return 0 +} + +type ListDatabasesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + PageSize int32 `protobuf:"varint,1,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // server-clamped + PageToken string `protobuf:"bytes,2,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // opaque cursor from a previous response + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListDatabasesRequest) Reset() { + *x = ListDatabasesRequest{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListDatabasesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDatabasesRequest) ProtoMessage() {} + +func (x *ListDatabasesRequest) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 ListDatabasesRequest.ProtoReflect.Descriptor instead. +func (*ListDatabasesRequest) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{4} +} + +func (x *ListDatabasesRequest) GetPageSize() int32 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *ListDatabasesRequest) GetPageToken() string { + if x != nil { + return x.PageToken + } + return "" +} + +type ListDatabasesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Databases []*DatabaseSummary `protobuf:"bytes,1,rep,name=databases,proto3" json:"databases,omitempty"` + NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` // empty when exhausted + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListDatabasesResponse) Reset() { + *x = ListDatabasesResponse{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListDatabasesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDatabasesResponse) ProtoMessage() {} + +func (x *ListDatabasesResponse) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 ListDatabasesResponse.ProtoReflect.Descriptor instead. +func (*ListDatabasesResponse) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{5} +} + +func (x *ListDatabasesResponse) GetDatabases() []*DatabaseSummary { + if x != nil { + return x.Databases + } + return nil +} + +func (x *ListDatabasesResponse) GetNextPageToken() string { + if x != nil { + return x.NextPageToken + } + return "" +} + +// DatabaseSummary is a database's immutable fields. No tip: it changes on every +// commit, so call GetDatabase for it. +type DatabaseSummary struct { + state protoimpl.MessageState `protogen:"open.v1"` + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + Region string `protobuf:"bytes,2,opt,name=region,proto3" json:"region,omitempty"` + UserAttributes string `protobuf:"bytes,3,opt,name=user_attributes,json=userAttributes,proto3" json:"user_attributes,omitempty"` + CreatedAtUnix int64 `protobuf:"varint,4,opt,name=created_at_unix,json=createdAtUnix,proto3" json:"created_at_unix,omitempty"` + ExpiresAtUnix int64 `protobuf:"varint,5,opt,name=expires_at_unix,json=expiresAtUnix,proto3" json:"expires_at_unix,omitempty"` // 0: never expires + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DatabaseSummary) Reset() { + *x = DatabaseSummary{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DatabaseSummary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DatabaseSummary) ProtoMessage() {} + +func (x *DatabaseSummary) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 DatabaseSummary.ProtoReflect.Descriptor instead. +func (*DatabaseSummary) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{6} +} + +func (x *DatabaseSummary) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +func (x *DatabaseSummary) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +func (x *DatabaseSummary) GetUserAttributes() string { + if x != nil { + return x.UserAttributes + } + return "" +} + +func (x *DatabaseSummary) GetCreatedAtUnix() int64 { + if x != nil { + return x.CreatedAtUnix + } + return 0 +} + +func (x *DatabaseSummary) GetExpiresAtUnix() int64 { + if x != nil { + return x.ExpiresAtUnix + } + return 0 +} + +type DeleteDatabaseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteDatabaseRequest) Reset() { + *x = DeleteDatabaseRequest{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDatabaseRequest) ProtoMessage() {} + +func (x *DeleteDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[7] + 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 DeleteDatabaseRequest.ProtoReflect.Descriptor instead. +func (*DeleteDatabaseRequest) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{7} +} + +func (x *DeleteDatabaseRequest) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +type DeleteDatabaseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteDatabaseResponse) Reset() { + *x = DeleteDatabaseResponse{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDatabaseResponse) ProtoMessage() {} + +func (x *DeleteDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_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 DeleteDatabaseResponse.ProtoReflect.Descriptor instead. +func (*DeleteDatabaseResponse) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{8} +} + +type DumpDatabaseRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + DatabaseId string `protobuf:"bytes,1,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DumpDatabaseRequest) Reset() { + *x = DumpDatabaseRequest{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DumpDatabaseRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DumpDatabaseRequest) ProtoMessage() {} + +func (x *DumpDatabaseRequest) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[9] + 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 DumpDatabaseRequest.ProtoReflect.Descriptor instead. +func (*DumpDatabaseRequest) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{9} +} + +func (x *DumpDatabaseRequest) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +type DumpDatabaseResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + DownloadUrl string `protobuf:"bytes,1,opt,name=download_url,json=downloadUrl,proto3" json:"download_url,omitempty"` // pre-authenticated object-storage URL + ExpiresAtUnix int64 `protobuf:"varint,2,opt,name=expires_at_unix,json=expiresAtUnix,proto3" json:"expires_at_unix,omitempty"` // URL expiry + Tip int64 `protobuf:"varint,3,opt,name=tip,proto3" json:"tip,omitempty"` // commit sequence the dump is consistent at + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DumpDatabaseResponse) Reset() { + *x = DumpDatabaseResponse{} + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DumpDatabaseResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DumpDatabaseResponse) ProtoMessage() {} + +func (x *DumpDatabaseResponse) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_proto_msgTypes[10] + 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 DumpDatabaseResponse.ProtoReflect.Descriptor instead. +func (*DumpDatabaseResponse) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_proto_rawDescGZIP(), []int{10} +} + +func (x *DumpDatabaseResponse) GetDownloadUrl() string { + if x != nil { + return x.DownloadUrl + } + return "" +} + +func (x *DumpDatabaseResponse) GetExpiresAtUnix() int64 { + if x != nil { + return x.ExpiresAtUnix + } + return 0 +} + +func (x *DumpDatabaseResponse) GetTip() int64 { + if x != nil { + return x.Tip + } + return 0 +} + +var File_agentdb_livekit_agentdb_proto protoreflect.FileDescriptor + +const file_agentdb_livekit_agentdb_proto_rawDesc = "" + + "\n" + + "\x1dagentdb/livekit_agentdb.proto\x12\x0flivekit.agentdb\"y\n" + + "\x15CreateDatabaseRequest\x12\x16\n" + + "\x06region\x18\x01 \x01(\tR\x06region\x12'\n" + + "\x0fuser_attributes\x18\x02 \x01(\tR\x0euserAttributes\x12\x1f\n" + + "\vttl_seconds\x18\x03 \x01(\x03R\n" + + "ttlSeconds\"a\n" + + "\x16CreateDatabaseResponse\x12\x1f\n" + + "\vdatabase_id\x18\x01 \x01(\tR\n" + + "databaseId\x12&\n" + + "\x0fexpires_at_unix\x18\x02 \x01(\x03R\rexpiresAtUnix\"5\n" + + "\x12GetDatabaseRequest\x12\x1f\n" + + "\vdatabase_id\x18\x01 \x01(\tR\n" + + "databaseId\"\xd9\x01\n" + + "\x13GetDatabaseResponse\x12\x1f\n" + + "\vdatabase_id\x18\x01 \x01(\tR\n" + + "databaseId\x12\x16\n" + + "\x06region\x18\x02 \x01(\tR\x06region\x12'\n" + + "\x0fuser_attributes\x18\x03 \x01(\tR\x0euserAttributes\x12&\n" + + "\x0fcreated_at_unix\x18\x04 \x01(\x03R\rcreatedAtUnix\x12&\n" + + "\x0fexpires_at_unix\x18\x05 \x01(\x03R\rexpiresAtUnix\x12\x10\n" + + "\x03tip\x18\x06 \x01(\x03R\x03tip\"R\n" + + "\x14ListDatabasesRequest\x12\x1b\n" + + "\tpage_size\x18\x01 \x01(\x05R\bpageSize\x12\x1d\n" + + "\n" + + "page_token\x18\x02 \x01(\tR\tpageToken\"\x7f\n" + + "\x15ListDatabasesResponse\x12>\n" + + "\tdatabases\x18\x01 \x03(\v2 .livekit.agentdb.DatabaseSummaryR\tdatabases\x12&\n" + + "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken\"\xc3\x01\n" + + "\x0fDatabaseSummary\x12\x1f\n" + + "\vdatabase_id\x18\x01 \x01(\tR\n" + + "databaseId\x12\x16\n" + + "\x06region\x18\x02 \x01(\tR\x06region\x12'\n" + + "\x0fuser_attributes\x18\x03 \x01(\tR\x0euserAttributes\x12&\n" + + "\x0fcreated_at_unix\x18\x04 \x01(\x03R\rcreatedAtUnix\x12&\n" + + "\x0fexpires_at_unix\x18\x05 \x01(\x03R\rexpiresAtUnix\"8\n" + + "\x15DeleteDatabaseRequest\x12\x1f\n" + + "\vdatabase_id\x18\x01 \x01(\tR\n" + + "databaseId\"\x18\n" + + "\x16DeleteDatabaseResponse\"6\n" + + "\x13DumpDatabaseRequest\x12\x1f\n" + + "\vdatabase_id\x18\x01 \x01(\tR\n" + + "databaseId\"s\n" + + "\x14DumpDatabaseResponse\x12!\n" + + "\fdownload_url\x18\x01 \x01(\tR\vdownloadUrl\x12&\n" + + "\x0fexpires_at_unix\x18\x02 \x01(\x03R\rexpiresAtUnix\x12\x10\n" + + "\x03tip\x18\x03 \x01(\x03R\x03tip2\xde\x03\n" + + "\aAgentDB\x12a\n" + + "\x0eCreateDatabase\x12&.livekit.agentdb.CreateDatabaseRequest\x1a'.livekit.agentdb.CreateDatabaseResponse\x12X\n" + + "\vGetDatabase\x12#.livekit.agentdb.GetDatabaseRequest\x1a$.livekit.agentdb.GetDatabaseResponse\x12^\n" + + "\rListDatabases\x12%.livekit.agentdb.ListDatabasesRequest\x1a&.livekit.agentdb.ListDatabasesResponse\x12a\n" + + "\x0eDeleteDatabase\x12&.livekit.agentdb.DeleteDatabaseRequest\x1a'.livekit.agentdb.DeleteDatabaseResponse\x12S\n" + + "\x04Dump\x12$.livekit.agentdb.DumpDatabaseRequest\x1a%.livekit.agentdb.DumpDatabaseResponseBNZ+github.com/livekit/protocol/livekit/agentdb\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + +var ( + file_agentdb_livekit_agentdb_proto_rawDescOnce sync.Once + file_agentdb_livekit_agentdb_proto_rawDescData []byte +) + +func file_agentdb_livekit_agentdb_proto_rawDescGZIP() []byte { + file_agentdb_livekit_agentdb_proto_rawDescOnce.Do(func() { + file_agentdb_livekit_agentdb_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_agentdb_livekit_agentdb_proto_rawDesc), len(file_agentdb_livekit_agentdb_proto_rawDesc))) + }) + return file_agentdb_livekit_agentdb_proto_rawDescData +} + +var file_agentdb_livekit_agentdb_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_agentdb_livekit_agentdb_proto_goTypes = []any{ + (*CreateDatabaseRequest)(nil), // 0: livekit.agentdb.CreateDatabaseRequest + (*CreateDatabaseResponse)(nil), // 1: livekit.agentdb.CreateDatabaseResponse + (*GetDatabaseRequest)(nil), // 2: livekit.agentdb.GetDatabaseRequest + (*GetDatabaseResponse)(nil), // 3: livekit.agentdb.GetDatabaseResponse + (*ListDatabasesRequest)(nil), // 4: livekit.agentdb.ListDatabasesRequest + (*ListDatabasesResponse)(nil), // 5: livekit.agentdb.ListDatabasesResponse + (*DatabaseSummary)(nil), // 6: livekit.agentdb.DatabaseSummary + (*DeleteDatabaseRequest)(nil), // 7: livekit.agentdb.DeleteDatabaseRequest + (*DeleteDatabaseResponse)(nil), // 8: livekit.agentdb.DeleteDatabaseResponse + (*DumpDatabaseRequest)(nil), // 9: livekit.agentdb.DumpDatabaseRequest + (*DumpDatabaseResponse)(nil), // 10: livekit.agentdb.DumpDatabaseResponse +} +var file_agentdb_livekit_agentdb_proto_depIdxs = []int32{ + 6, // 0: livekit.agentdb.ListDatabasesResponse.databases:type_name -> livekit.agentdb.DatabaseSummary + 0, // 1: livekit.agentdb.AgentDB.CreateDatabase:input_type -> livekit.agentdb.CreateDatabaseRequest + 2, // 2: livekit.agentdb.AgentDB.GetDatabase:input_type -> livekit.agentdb.GetDatabaseRequest + 4, // 3: livekit.agentdb.AgentDB.ListDatabases:input_type -> livekit.agentdb.ListDatabasesRequest + 7, // 4: livekit.agentdb.AgentDB.DeleteDatabase:input_type -> livekit.agentdb.DeleteDatabaseRequest + 9, // 5: livekit.agentdb.AgentDB.Dump:input_type -> livekit.agentdb.DumpDatabaseRequest + 1, // 6: livekit.agentdb.AgentDB.CreateDatabase:output_type -> livekit.agentdb.CreateDatabaseResponse + 3, // 7: livekit.agentdb.AgentDB.GetDatabase:output_type -> livekit.agentdb.GetDatabaseResponse + 5, // 8: livekit.agentdb.AgentDB.ListDatabases:output_type -> livekit.agentdb.ListDatabasesResponse + 8, // 9: livekit.agentdb.AgentDB.DeleteDatabase:output_type -> livekit.agentdb.DeleteDatabaseResponse + 10, // 10: livekit.agentdb.AgentDB.Dump:output_type -> livekit.agentdb.DumpDatabaseResponse + 6, // [6:11] is the sub-list for method output_type + 1, // [1:6] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_agentdb_livekit_agentdb_proto_init() } +func file_agentdb_livekit_agentdb_proto_init() { + if File_agentdb_livekit_agentdb_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_agentdb_livekit_agentdb_proto_rawDesc), len(file_agentdb_livekit_agentdb_proto_rawDesc)), + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_agentdb_livekit_agentdb_proto_goTypes, + DependencyIndexes: file_agentdb_livekit_agentdb_proto_depIdxs, + MessageInfos: file_agentdb_livekit_agentdb_proto_msgTypes, + }.Build() + File_agentdb_livekit_agentdb_proto = out.File + file_agentdb_livekit_agentdb_proto_goTypes = nil + file_agentdb_livekit_agentdb_proto_depIdxs = nil +} diff --git a/livekit/agentdb/livekit_agentdb.twirp.go b/livekit/agentdb/livekit_agentdb.twirp.go new file mode 100644 index 000000000..f9059f163 --- /dev/null +++ b/livekit/agentdb/livekit_agentdb.twirp.go @@ -0,0 +1,2250 @@ +// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. +// source: agentdb/livekit_agentdb.proto + +package agentdb + +import context "context" +import fmt "fmt" +import http "net/http" +import io "io" +import json "encoding/json" +import strconv "strconv" +import strings "strings" + +import protojson "google.golang.org/protobuf/encoding/protojson" +import proto "google.golang.org/protobuf/proto" +import twirp "github.com/twitchtv/twirp" +import ctxsetters "github.com/twitchtv/twirp/ctxsetters" + +import bytes "bytes" +import errors "errors" +import path "path" +import url "net/url" + +// Version compatibility assertion. +// If the constant is not defined in the package, that likely means +// the package needs to be updated to work with this generated code. +// See https://twitchtv.github.io/twirp/docs/version_matrix.html +const _ = twirp.TwirpPackageMinVersion_8_1_0 + +// ================= +// AgentDB Interface +// ================= + +// AgentDB hands out SQLite databases: lifecycle and export. Querying goes +// through the data plane in livekit_agentdb_data.proto. The project comes from +// the access token, never from a request field. +type AgentDB interface { + CreateDatabase(context.Context, *CreateDatabaseRequest) (*CreateDatabaseResponse, error) + + GetDatabase(context.Context, *GetDatabaseRequest) (*GetDatabaseResponse, error) + + ListDatabases(context.Context, *ListDatabasesRequest) (*ListDatabasesResponse, error) + + // Deletes the stored data too, not just the metadata row. + DeleteDatabase(context.Context, *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) + + // Exports a consistent SQLite file, returning a time-limited download URL. + Dump(context.Context, *DumpDatabaseRequest) (*DumpDatabaseResponse, error) +} + +// ======================= +// AgentDB Protobuf Client +// ======================= + +type agentDBProtobufClient struct { + client HTTPClient + urls [5]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentDBProtobufClient creates a Protobuf client that implements the AgentDB interface. +// It communicates using Protobuf and can be configured with a custom HTTPClient. +func NewAgentDBProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentDB { + if c, ok := client.(*http.Client); ok { + client = withoutRedirects(c) + } + + clientOpts := twirp.ClientOptions{} + for _, o := range opts { + o(&clientOpts) + } + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit.agentdb", "AgentDB") + urls := [5]string{ + serviceURL + "CreateDatabase", + serviceURL + "GetDatabase", + serviceURL + "ListDatabases", + serviceURL + "DeleteDatabase", + serviceURL + "Dump", + } + + return &agentDBProtobufClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentDBProtobufClient) CreateDatabase(ctx context.Context, in *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "CreateDatabase") + caller := c.callCreateDatabase + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateDatabaseRequest) when calling interceptor") + } + return c.callCreateDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBProtobufClient) callCreateDatabase(ctx context.Context, in *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + out := new(CreateDatabaseResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBProtobufClient) GetDatabase(ctx context.Context, in *GetDatabaseRequest) (*GetDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "GetDatabase") + caller := c.callGetDatabase + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetDatabaseRequest) (*GetDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetDatabaseRequest) when calling interceptor") + } + return c.callGetDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBProtobufClient) callGetDatabase(ctx context.Context, in *GetDatabaseRequest) (*GetDatabaseResponse, error) { + out := new(GetDatabaseResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBProtobufClient) ListDatabases(ctx context.Context, in *ListDatabasesRequest) (*ListDatabasesResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "ListDatabases") + caller := c.callListDatabases + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListDatabasesRequest) (*ListDatabasesResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListDatabasesRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListDatabasesRequest) when calling interceptor") + } + return c.callListDatabases(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListDatabasesResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListDatabasesResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBProtobufClient) callListDatabases(ctx context.Context, in *ListDatabasesRequest) (*ListDatabasesResponse, error) { + out := new(ListDatabasesResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBProtobufClient) DeleteDatabase(ctx context.Context, in *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "DeleteDatabase") + caller := c.callDeleteDatabase + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteDatabaseRequest) when calling interceptor") + } + return c.callDeleteDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBProtobufClient) callDeleteDatabase(ctx context.Context, in *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + out := new(DeleteDatabaseResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBProtobufClient) Dump(ctx context.Context, in *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "Dump") + caller := c.callDump + if c.interceptor != nil { + caller = func(ctx context.Context, req *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DumpDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DumpDatabaseRequest) when calling interceptor") + } + return c.callDump(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DumpDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DumpDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBProtobufClient) callDump(ctx context.Context, in *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + out := new(DumpDatabaseResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +// =================== +// AgentDB JSON Client +// =================== + +type agentDBJSONClient struct { + client HTTPClient + urls [5]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentDBJSONClient creates a JSON client that implements the AgentDB interface. +// It communicates using JSON and can be configured with a custom HTTPClient. +func NewAgentDBJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentDB { + if c, ok := client.(*http.Client); ok { + client = withoutRedirects(c) + } + + clientOpts := twirp.ClientOptions{} + for _, o := range opts { + o(&clientOpts) + } + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + literalURLs := false + _ = clientOpts.ReadOpt("literalURLs", &literalURLs) + var pathPrefix string + if ok := clientOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + // Build method URLs: []/./ + serviceURL := sanitizeBaseURL(baseURL) + serviceURL += baseServicePath(pathPrefix, "livekit.agentdb", "AgentDB") + urls := [5]string{ + serviceURL + "CreateDatabase", + serviceURL + "GetDatabase", + serviceURL + "ListDatabases", + serviceURL + "DeleteDatabase", + serviceURL + "Dump", + } + + return &agentDBJSONClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentDBJSONClient) CreateDatabase(ctx context.Context, in *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "CreateDatabase") + caller := c.callCreateDatabase + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateDatabaseRequest) when calling interceptor") + } + return c.callCreateDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBJSONClient) callCreateDatabase(ctx context.Context, in *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + out := new(CreateDatabaseResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBJSONClient) GetDatabase(ctx context.Context, in *GetDatabaseRequest) (*GetDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "GetDatabase") + caller := c.callGetDatabase + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetDatabaseRequest) (*GetDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetDatabaseRequest) when calling interceptor") + } + return c.callGetDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBJSONClient) callGetDatabase(ctx context.Context, in *GetDatabaseRequest) (*GetDatabaseResponse, error) { + out := new(GetDatabaseResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBJSONClient) ListDatabases(ctx context.Context, in *ListDatabasesRequest) (*ListDatabasesResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "ListDatabases") + caller := c.callListDatabases + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListDatabasesRequest) (*ListDatabasesResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListDatabasesRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListDatabasesRequest) when calling interceptor") + } + return c.callListDatabases(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListDatabasesResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListDatabasesResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBJSONClient) callListDatabases(ctx context.Context, in *ListDatabasesRequest) (*ListDatabasesResponse, error) { + out := new(ListDatabasesResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBJSONClient) DeleteDatabase(ctx context.Context, in *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "DeleteDatabase") + caller := c.callDeleteDatabase + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteDatabaseRequest) when calling interceptor") + } + return c.callDeleteDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBJSONClient) callDeleteDatabase(ctx context.Context, in *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + out := new(DeleteDatabaseResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[3], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentDBJSONClient) Dump(ctx context.Context, in *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithMethodName(ctx, "Dump") + caller := c.callDump + if c.interceptor != nil { + caller = func(ctx context.Context, req *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DumpDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DumpDatabaseRequest) when calling interceptor") + } + return c.callDump(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DumpDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DumpDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentDBJSONClient) callDump(ctx context.Context, in *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + out := new(DumpDatabaseResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[4], in, out) + if err != nil { + twerr, ok := err.(twirp.Error) + if !ok { + twerr = twirp.InternalErrorWith(err) + } + callClientError(ctx, c.opts.Hooks, twerr) + return nil, err + } + + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +// ====================== +// AgentDB Server Handler +// ====================== + +type agentDBServer struct { + AgentDB + interceptor twirp.Interceptor + hooks *twirp.ServerHooks + pathPrefix string // prefix for routing + jsonSkipDefaults bool // do not include unpopulated fields (default values) in the response + jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names +} + +// NewAgentDBServer builds a TwirpServer that can be used as an http.Handler to handle +// HTTP requests that are routed to the right method in the provided svc implementation. +// The opts are twirp.ServerOption modifiers, for example twirp.WithServerHooks(hooks). +func NewAgentDBServer(svc AgentDB, opts ...interface{}) TwirpServer { + serverOpts := newServerOpts(opts) + + // Using ReadOpt allows backwards and forwards compatibility with new options in the future + jsonSkipDefaults := false + _ = serverOpts.ReadOpt("jsonSkipDefaults", &jsonSkipDefaults) + jsonCamelCase := false + _ = serverOpts.ReadOpt("jsonCamelCase", &jsonCamelCase) + var pathPrefix string + if ok := serverOpts.ReadOpt("pathPrefix", &pathPrefix); !ok { + pathPrefix = "/twirp" // default prefix + } + + return &agentDBServer{ + AgentDB: svc, + hooks: serverOpts.Hooks, + interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), + pathPrefix: pathPrefix, + jsonSkipDefaults: jsonSkipDefaults, + jsonCamelCase: jsonCamelCase, + } +} + +// writeError writes an HTTP response with a valid Twirp error format, and triggers hooks. +// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) +func (s *agentDBServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { + writeError(ctx, resp, err, s.hooks) +} + +// handleRequestBodyError is used to handle error when the twirp server cannot read request +func (s *agentDBServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { + if context.Canceled == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.Canceled, "failed to read request: context canceled")) + return + } + if context.DeadlineExceeded == ctx.Err() { + s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) + return + } + s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) +} + +// AgentDBPathPrefix is a convenience constant that may identify URL paths. +// Should be used with caution, it only matches routes generated by Twirp Go clients, +// with the default "/twirp" prefix and default CamelCase service and method names. +// More info: https://twitchtv.github.io/twirp/docs/routing.html +const AgentDBPathPrefix = "/twirp/livekit.agentdb.AgentDB/" + +func (s *agentDBServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + ctx := req.Context() + ctx = ctxsetters.WithPackageName(ctx, "livekit.agentdb") + ctx = ctxsetters.WithServiceName(ctx, "AgentDB") + ctx = ctxsetters.WithResponseWriter(ctx, resp) + + var err error + ctx, err = callRequestReceived(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + if req.Method != "POST" { + msg := fmt.Sprintf("unsupported method %q (only POST is allowed)", req.Method) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + + // Verify path format: []/./ + prefix, pkgService, method := parseTwirpPath(req.URL.Path) + if pkgService != "livekit.agentdb.AgentDB" { + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + if prefix != s.pathPrefix { + msg := fmt.Sprintf("invalid path prefix %q, expected %q, on path %q", prefix, s.pathPrefix, req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } + + switch method { + case "CreateDatabase": + s.serveCreateDatabase(ctx, resp, req) + return + case "GetDatabase": + s.serveGetDatabase(ctx, resp, req) + return + case "ListDatabases": + s.serveListDatabases(ctx, resp, req) + return + case "DeleteDatabase": + s.serveDeleteDatabase(ctx, resp, req) + return + case "Dump": + s.serveDump(ctx, resp, req) + return + default: + msg := fmt.Sprintf("no handler for path %q", req.URL.Path) + s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) + return + } +} + +func (s *agentDBServer) serveCreateDatabase(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveCreateDatabaseJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateDatabaseProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentDBServer) serveCreateDatabaseJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateDatabase") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(CreateDatabaseRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentDB.CreateDatabase + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateDatabaseRequest) when calling interceptor") + } + return s.AgentDB.CreateDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateDatabaseResponse and nil error while calling CreateDatabase. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveCreateDatabaseProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateDatabase") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(CreateDatabaseRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentDB.CreateDatabase + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateDatabaseRequest) (*CreateDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateDatabaseRequest) when calling interceptor") + } + return s.AgentDB.CreateDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateDatabaseResponse and nil error while calling CreateDatabase. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveGetDatabase(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveGetDatabaseJSON(ctx, resp, req) + case "application/protobuf": + s.serveGetDatabaseProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentDBServer) serveGetDatabaseJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetDatabase") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(GetDatabaseRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentDB.GetDatabase + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetDatabaseRequest) (*GetDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetDatabaseRequest) when calling interceptor") + } + return s.AgentDB.GetDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *GetDatabaseResponse and nil error while calling GetDatabase. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveGetDatabaseProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetDatabase") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(GetDatabaseRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentDB.GetDatabase + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetDatabaseRequest) (*GetDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetDatabaseRequest) when calling interceptor") + } + return s.AgentDB.GetDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *GetDatabaseResponse and nil error while calling GetDatabase. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveListDatabases(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveListDatabasesJSON(ctx, resp, req) + case "application/protobuf": + s.serveListDatabasesProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentDBServer) serveListDatabasesJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListDatabases") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(ListDatabasesRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentDB.ListDatabases + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListDatabasesRequest) (*ListDatabasesResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListDatabasesRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListDatabasesRequest) when calling interceptor") + } + return s.AgentDB.ListDatabases(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListDatabasesResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListDatabasesResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListDatabasesResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListDatabasesResponse and nil error while calling ListDatabases. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveListDatabasesProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListDatabases") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(ListDatabasesRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentDB.ListDatabases + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListDatabasesRequest) (*ListDatabasesResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListDatabasesRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListDatabasesRequest) when calling interceptor") + } + return s.AgentDB.ListDatabases(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListDatabasesResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListDatabasesResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListDatabasesResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListDatabasesResponse and nil error while calling ListDatabases. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveDeleteDatabase(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDeleteDatabaseJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteDatabaseProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentDBServer) serveDeleteDatabaseJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteDatabase") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DeleteDatabaseRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentDB.DeleteDatabase + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteDatabaseRequest) when calling interceptor") + } + return s.AgentDB.DeleteDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteDatabaseResponse and nil error while calling DeleteDatabase. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveDeleteDatabaseProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteDatabase") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DeleteDatabaseRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentDB.DeleteDatabase + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteDatabaseRequest) (*DeleteDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteDatabaseRequest) when calling interceptor") + } + return s.AgentDB.DeleteDatabase(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteDatabaseResponse and nil error while calling DeleteDatabase. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveDump(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + header := req.Header.Get("Content-Type") + i := strings.Index(header, ";") + if i == -1 { + i = len(header) + } + switch strings.TrimSpace(strings.ToLower(header[:i])) { + case "application/json": + s.serveDumpJSON(ctx, resp, req) + case "application/protobuf": + s.serveDumpProtobuf(ctx, resp, req) + default: + msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) + twerr := badRouteError(msg, req.Method, req.URL.Path) + s.writeError(ctx, resp, twerr) + } +} + +func (s *agentDBServer) serveDumpJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "Dump") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + d := json.NewDecoder(req.Body) + rawReqBody := json.RawMessage{} + if err := d.Decode(&rawReqBody); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + reqContent := new(DumpDatabaseRequest) + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawReqBody, reqContent); err != nil { + s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) + return + } + + handler := s.AgentDB.Dump + if s.interceptor != nil { + handler = func(ctx context.Context, req *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DumpDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DumpDatabaseRequest) when calling interceptor") + } + return s.AgentDB.Dump(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DumpDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DumpDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DumpDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DumpDatabaseResponse and nil error while calling Dump. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + marshaler := &protojson.MarshalOptions{UseProtoNames: !s.jsonCamelCase, EmitUnpopulated: !s.jsonSkipDefaults} + respBytes, err := marshaler.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal json response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/json") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) serveDumpProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "Dump") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } + + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) + return + } + reqContent := new(DumpDatabaseRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentDB.Dump + if s.interceptor != nil { + handler = func(ctx context.Context, req *DumpDatabaseRequest) (*DumpDatabaseResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DumpDatabaseRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DumpDatabaseRequest) when calling interceptor") + } + return s.AgentDB.Dump(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DumpDatabaseResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DumpDatabaseResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DumpDatabaseResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + + if err != nil { + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *DumpDatabaseResponse and nil error while calling Dump. nil responses are not supported")) + return + } + + ctx = callResponsePrepared(ctx, s.hooks) + + respBytes, err := proto.Marshal(respContent) + if err != nil { + s.writeError(ctx, resp, wrapInternal(err, "failed to marshal proto response")) + return + } + + ctx = ctxsetters.WithStatusCode(ctx, http.StatusOK) + resp.Header().Set("Content-Type", "application/protobuf") + resp.Header().Set("Content-Length", strconv.Itoa(len(respBytes))) + resp.WriteHeader(http.StatusOK) + if n, err := resp.Write(respBytes); err != nil { + msg := fmt.Sprintf("failed to write response, %d of %d bytes written: %s", n, len(respBytes), err.Error()) + twerr := twirp.NewError(twirp.Unknown, msg) + ctx = callError(ctx, s.hooks, twerr) + } + callResponseSent(ctx, s.hooks) +} + +func (s *agentDBServer) ServiceDescriptor() ([]byte, int) { + return twirpFileDescriptor0, 0 +} + +func (s *agentDBServer) ProtocGenTwirpVersion() string { + return "v8.1.3" +} + +// PathPrefix returns the base service path, in the form: "//./" +// that is everything in a Twirp route except for the . This can be used for routing, +// for example to identify the requests that are targeted to this service in a mux. +func (s *agentDBServer) PathPrefix() string { + return baseServicePath(s.pathPrefix, "livekit.agentdb", "AgentDB") +} + +// ===== +// Utils +// ===== + +// HTTPClient is the interface used by generated clients to send HTTP requests. +// It is fulfilled by *(net/http).Client, which is sufficient for most users. +// Users can provide their own implementation for special retry policies. +// +// HTTPClient implementations should not follow redirects. Redirects are +// automatically disabled if *(net/http).Client is passed to client +// constructors. See the withoutRedirects function in this file for more +// details. +type HTTPClient interface { + Do(req *http.Request) (*http.Response, error) +} + +// TwirpServer is the interface generated server structs will support: they're +// HTTP handlers with additional methods for accessing metadata about the +// service. Those accessors are a low-level API for building reflection tools. +// Most people can think of TwirpServers as just http.Handlers. +type TwirpServer interface { + http.Handler + + // ServiceDescriptor returns gzipped bytes describing the .proto file that + // this service was generated from. Once unzipped, the bytes can be + // unmarshalled as a + // google.golang.org/protobuf/types/descriptorpb.FileDescriptorProto. + // + // The returned integer is the index of this particular service within that + // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a + // low-level field, expected to be used for reflection. + ServiceDescriptor() ([]byte, int) + + // ProtocGenTwirpVersion is the semantic version string of the version of + // twirp used to generate this file. + ProtocGenTwirpVersion() string + + // PathPrefix returns the HTTP URL path prefix for all methods handled by this + // service. This can be used with an HTTP mux to route Twirp requests. + // The path prefix is in the form: "//./" + // that is, everything in a Twirp route except for the at the end. + PathPrefix() string +} + +func newServerOpts(opts []interface{}) *twirp.ServerOptions { + serverOpts := &twirp.ServerOptions{} + for _, opt := range opts { + switch o := opt.(type) { + case twirp.ServerOption: + o(serverOpts) + case *twirp.ServerHooks: // backwards compatibility, allow to specify hooks as an argument + twirp.WithServerHooks(o)(serverOpts) + case nil: // backwards compatibility, allow nil value for the argument + continue + default: + panic(fmt.Sprintf("Invalid option type %T, please use a twirp.ServerOption", o)) + } + } + return serverOpts +} + +// WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). +// Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. +// If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err) +func WriteError(resp http.ResponseWriter, err error) { + writeError(context.Background(), resp, err, nil) +} + +// writeError writes Twirp errors in the response and triggers hooks. +func writeError(ctx context.Context, resp http.ResponseWriter, err error, hooks *twirp.ServerHooks) { + // Convert to a twirp.Error. Non-twirp errors are converted to internal errors. + var twerr twirp.Error + if !errors.As(err, &twerr) { + twerr = twirp.InternalErrorWith(err) + } + + statusCode := twirp.ServerHTTPStatusFromErrorCode(twerr.Code()) + ctx = ctxsetters.WithStatusCode(ctx, statusCode) + ctx = callError(ctx, hooks, twerr) + + respBody := marshalErrorToJSON(twerr) + + resp.Header().Set("Content-Type", "application/json") // Error responses are always JSON + resp.Header().Set("Content-Length", strconv.Itoa(len(respBody))) + resp.WriteHeader(statusCode) // set HTTP status code and send response + + _, writeErr := resp.Write(respBody) + if writeErr != nil { + // We have three options here. We could log the error, call the Error + // hook, or just silently ignore the error. + // + // Logging is unacceptable because we don't have a user-controlled + // logger; writing out to stderr without permission is too rude. + // + // Calling the Error hook would confuse users: it would mean the Error + // hook got called twice for one request, which is likely to lead to + // duplicated log messages and metrics, no matter how well we document + // the behavior. + // + // Silently ignoring the error is our least-bad option. It's highly + // likely that the connection is broken and the original 'err' says + // so anyway. + _ = writeErr + } + + callResponseSent(ctx, hooks) +} + +// sanitizeBaseURL parses the the baseURL, and adds the "http" scheme if needed. +// If the URL is unparsable, the baseURL is returned unchanged. +func sanitizeBaseURL(baseURL string) string { + u, err := url.Parse(baseURL) + if err != nil { + return baseURL // invalid URL will fail later when making requests + } + if u.Scheme == "" { + u.Scheme = "http" + } + return u.String() +} + +// baseServicePath composes the path prefix for the service (without ). +// e.g.: baseServicePath("/twirp", "my.pkg", "MyService") +// +// returns => "/twirp/my.pkg.MyService/" +// +// e.g.: baseServicePath("", "", "MyService") +// +// returns => "/MyService/" +func baseServicePath(prefix, pkg, service string) string { + fullServiceName := service + if pkg != "" { + fullServiceName = pkg + "." + service + } + return path.Join("/", prefix, fullServiceName) + "/" +} + +// parseTwirpPath extracts path components form a valid Twirp route. +// Expected format: "[]/./" +// e.g.: prefix, pkgService, method := parseTwirpPath("/twirp/pkg.Svc/MakeHat") +func parseTwirpPath(path string) (string, string, string) { + parts := strings.Split(path, "/") + if len(parts) < 2 { + return "", "", "" + } + method := parts[len(parts)-1] + pkgService := parts[len(parts)-2] + prefix := strings.Join(parts[0:len(parts)-2], "/") + return prefix, pkgService, method +} + +// getCustomHTTPReqHeaders retrieves a copy of any headers that are set in +// a context through the twirp.WithHTTPRequestHeaders function. +// If there are no headers set, or if they have the wrong type, nil is returned. +func getCustomHTTPReqHeaders(ctx context.Context) http.Header { + header, ok := twirp.HTTPRequestHeaders(ctx) + if !ok || header == nil { + return nil + } + copied := make(http.Header) + for k, vv := range header { + if vv == nil { + copied[k] = nil + continue + } + copied[k] = make([]string, len(vv)) + copy(copied[k], vv) + } + return copied +} + +// newRequest makes an http.Request from a client, adding common headers. +func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { + req, err := http.NewRequest("POST", url, reqBody) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if customHeader := getCustomHTTPReqHeaders(ctx); customHeader != nil { + req.Header = customHeader + } + req.Header.Set("Accept", contentType) + req.Header.Set("Content-Type", contentType) + req.Header.Set("Twirp-Version", "v8.1.3") + return req, nil +} + +// JSON serialization for errors +type twerrJSON struct { + Code string `json:"code"` + Msg string `json:"msg"` + Meta map[string]string `json:"meta,omitempty"` +} + +// marshalErrorToJSON returns JSON from a twirp.Error, that can be used as HTTP error response body. +// If serialization fails, it will use a descriptive Internal error instead. +func marshalErrorToJSON(twerr twirp.Error) []byte { + // make sure that msg is not too large + msg := twerr.Msg() + if len(msg) > 1e6 { + msg = msg[:1e6] + } + + tj := twerrJSON{ + Code: string(twerr.Code()), + Msg: msg, + Meta: twerr.MetaMap(), + } + + buf, err := json.Marshal(&tj) + if err != nil { + buf = []byte("{\"type\": \"" + twirp.Internal + "\", \"msg\": \"There was an error but it could not be serialized into JSON\"}") // fallback + } + + return buf +} + +// errorFromResponse builds a twirp.Error from a non-200 HTTP response. +// If the response has a valid serialized Twirp error, then it's returned. +// If not, the response status code is used to generate a similar twirp +// error. See twirpErrorFromIntermediary for more info on intermediary errors. +func errorFromResponse(resp *http.Response) twirp.Error { + statusCode := resp.StatusCode + statusText := http.StatusText(statusCode) + + if isHTTPRedirect(statusCode) { + // Unexpected redirect: it must be an error from an intermediary. + // Twirp clients don't follow redirects automatically, Twirp only handles + // POST requests, redirects should only happen on GET and HEAD requests. + location := resp.Header.Get("Location") + msg := fmt.Sprintf("unexpected HTTP status code %d %q received, Location=%q", statusCode, statusText, location) + return twirpErrorFromIntermediary(statusCode, msg, location) + } + + respBodyBytes, err := io.ReadAll(resp.Body) + if err != nil { + return wrapInternal(err, "failed to read server error response body") + } + + var tj twerrJSON + dec := json.NewDecoder(bytes.NewReader(respBodyBytes)) + dec.DisallowUnknownFields() + if err := dec.Decode(&tj); err != nil || tj.Code == "" { + // Invalid JSON response; it must be an error from an intermediary. + msg := fmt.Sprintf("Error from intermediary with HTTP status code %d %q", statusCode, statusText) + return twirpErrorFromIntermediary(statusCode, msg, string(respBodyBytes)) + } + + errorCode := twirp.ErrorCode(tj.Code) + if !twirp.IsValidErrorCode(errorCode) { + msg := "invalid type returned from server error response: " + tj.Code + return twirp.InternalError(msg).WithMeta("body", string(respBodyBytes)) + } + + twerr := twirp.NewError(errorCode, tj.Msg) + for k, v := range tj.Meta { + twerr = twerr.WithMeta(k, v) + } + return twerr +} + +// twirpErrorFromIntermediary maps HTTP errors from non-twirp sources to twirp errors. +// The mapping is similar to gRPC: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md. +// Returned twirp Errors have some additional metadata for inspection. +func twirpErrorFromIntermediary(status int, msg string, bodyOrLocation string) twirp.Error { + var code twirp.ErrorCode + if isHTTPRedirect(status) { // 3xx + code = twirp.Internal + } else { + switch status { + case 400: // Bad Request + code = twirp.Internal + case 401: // Unauthorized + code = twirp.Unauthenticated + case 403: // Forbidden + code = twirp.PermissionDenied + case 404: // Not Found + code = twirp.BadRoute + case 429: // Too Many Requests + code = twirp.ResourceExhausted + case 502, 503, 504: // Bad Gateway, Service Unavailable, Gateway Timeout + code = twirp.Unavailable + default: // All other codes + code = twirp.Unknown + } + } + + twerr := twirp.NewError(code, msg) + twerr = twerr.WithMeta("http_error_from_intermediary", "true") // to easily know if this error was from intermediary + twerr = twerr.WithMeta("status_code", strconv.Itoa(status)) + if isHTTPRedirect(status) { + twerr = twerr.WithMeta("location", bodyOrLocation) + } else { + twerr = twerr.WithMeta("body", bodyOrLocation) + } + return twerr +} + +func isHTTPRedirect(status int) bool { + return status >= 300 && status <= 399 +} + +// wrapInternal wraps an error with a prefix as an Internal error. +// The original error cause is accessible by github.com/pkg/errors.Cause. +func wrapInternal(err error, prefix string) twirp.Error { + return twirp.InternalErrorWith(&wrappedError{prefix: prefix, cause: err}) +} + +type wrappedError struct { + prefix string + cause error +} + +func (e *wrappedError) Error() string { return e.prefix + ": " + e.cause.Error() } +func (e *wrappedError) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As +func (e *wrappedError) Cause() error { return e.cause } // for github.com/pkg/errors + +// ensurePanicResponses makes sure that rpc methods causing a panic still result in a Twirp Internal +// error response (status 500), and error hooks are properly called with the panic wrapped as an error. +// The panic is re-raised so it can be handled normally with middleware. +func ensurePanicResponses(ctx context.Context, resp http.ResponseWriter, hooks *twirp.ServerHooks) { + if r := recover(); r != nil { + // Wrap the panic as an error so it can be passed to error hooks. + // The original error is accessible from error hooks, but not visible in the response. + err := errFromPanic(r) + twerr := &internalWithCause{msg: "Internal service panic", cause: err} + // Actually write the error + writeError(ctx, resp, twerr, hooks) + // If possible, flush the error to the wire. + f, ok := resp.(http.Flusher) + if ok { + f.Flush() + } + + panic(r) + } +} + +// errFromPanic returns the typed error if the recovered panic is an error, otherwise formats as error. +func errFromPanic(p interface{}) error { + if err, ok := p.(error); ok { + return err + } + return fmt.Errorf("panic: %v", p) +} + +// internalWithCause is a Twirp Internal error wrapping an original error cause, +// but the original error message is not exposed on Msg(). The original error +// can be checked with go1.13+ errors.Is/As, and also by (github.com/pkg/errors).Unwrap +type internalWithCause struct { + msg string + cause error +} + +func (e *internalWithCause) Unwrap() error { return e.cause } // for go1.13 + errors.Is/As +func (e *internalWithCause) Cause() error { return e.cause } // for github.com/pkg/errors +func (e *internalWithCause) Error() string { return e.msg + ": " + e.cause.Error() } +func (e *internalWithCause) Code() twirp.ErrorCode { return twirp.Internal } +func (e *internalWithCause) Msg() string { return e.msg } +func (e *internalWithCause) Meta(key string) string { return "" } +func (e *internalWithCause) MetaMap() map[string]string { return nil } +func (e *internalWithCause) WithMeta(key string, val string) twirp.Error { return e } + +// malformedRequestError is used when the twirp server cannot unmarshal a request +func malformedRequestError(msg string) twirp.Error { + return twirp.NewError(twirp.Malformed, msg) +} + +// badRouteError is used when the twirp server cannot route a request +func badRouteError(msg string, method, url string) twirp.Error { + err := twirp.NewError(twirp.BadRoute, msg) + err = err.WithMeta("twirp_invalid_route", method+" "+url) + return err +} + +// withoutRedirects makes sure that the POST request can not be redirected. +// The standard library will, by default, redirect requests (including POSTs) if it gets a 302 or +// 303 response, and also 301s in go1.8. It redirects by making a second request, changing the +// method to GET and removing the body. This produces very confusing error messages, so instead we +// set a redirect policy that always errors. This stops Go from executing the redirect. +// +// We have to be a little careful in case the user-provided http.Client has its own CheckRedirect +// policy - if so, we'll run through that policy first. +// +// Because this requires modifying the http.Client, we make a new copy of the client and return it. +func withoutRedirects(in *http.Client) *http.Client { + copy := *in + copy.CheckRedirect = func(req *http.Request, via []*http.Request) error { + if in.CheckRedirect != nil { + // Run the input's redirect if it exists, in case it has side effects, but ignore any error it + // returns, since we want to use ErrUseLastResponse. + err := in.CheckRedirect(req, via) + _ = err // Silly, but this makes sure generated code passes errcheck -blank, which some people use. + } + return http.ErrUseLastResponse + } + return © +} + +// doProtobufRequest makes a Protobuf request to the remote Twirp service. +func doProtobufRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { + reqBodyBytes, err := proto.Marshal(in) + if err != nil { + return ctx, wrapInternal(err, "failed to marshal proto request") + } + reqBody := bytes.NewBuffer(reqBodyBytes) + if err = ctx.Err(); err != nil { + return ctx, wrapInternal(err, "aborted because context was done") + } + + req, err := newRequest(ctx, url, reqBody, "application/protobuf") + if err != nil { + return ctx, wrapInternal(err, "could not build request") + } + ctx, err = callClientRequestPrepared(ctx, hooks, req) + if err != nil { + return ctx, err + } + + req = req.WithContext(ctx) + resp, err := client.Do(req) + if err != nil { + return ctx, wrapInternal(err, "failed to do request") + } + defer func() { _ = resp.Body.Close() }() + + if err = ctx.Err(); err != nil { + return ctx, wrapInternal(err, "aborted because context was done") + } + + if resp.StatusCode != 200 { + return ctx, errorFromResponse(resp) + } + + respBodyBytes, err := io.ReadAll(resp.Body) + if err != nil { + return ctx, wrapInternal(err, "failed to read response body") + } + if err = ctx.Err(); err != nil { + return ctx, wrapInternal(err, "aborted because context was done") + } + + if err = proto.Unmarshal(respBodyBytes, out); err != nil { + return ctx, wrapInternal(err, "failed to unmarshal proto response") + } + return ctx, nil +} + +// doJSONRequest makes a JSON request to the remote Twirp service. +func doJSONRequest(ctx context.Context, client HTTPClient, hooks *twirp.ClientHooks, url string, in, out proto.Message) (_ context.Context, err error) { + marshaler := &protojson.MarshalOptions{UseProtoNames: true} + reqBytes, err := marshaler.Marshal(in) + if err != nil { + return ctx, wrapInternal(err, "failed to marshal json request") + } + if err = ctx.Err(); err != nil { + return ctx, wrapInternal(err, "aborted because context was done") + } + + req, err := newRequest(ctx, url, bytes.NewReader(reqBytes), "application/json") + if err != nil { + return ctx, wrapInternal(err, "could not build request") + } + ctx, err = callClientRequestPrepared(ctx, hooks, req) + if err != nil { + return ctx, err + } + + req = req.WithContext(ctx) + resp, err := client.Do(req) + if err != nil { + return ctx, wrapInternal(err, "failed to do request") + } + + defer func() { + cerr := resp.Body.Close() + if err == nil && cerr != nil { + err = wrapInternal(cerr, "failed to close response body") + } + }() + + if err = ctx.Err(); err != nil { + return ctx, wrapInternal(err, "aborted because context was done") + } + + if resp.StatusCode != 200 { + return ctx, errorFromResponse(resp) + } + + d := json.NewDecoder(resp.Body) + rawRespBody := json.RawMessage{} + if err := d.Decode(&rawRespBody); err != nil { + return ctx, wrapInternal(err, "failed to unmarshal json response") + } + unmarshaler := protojson.UnmarshalOptions{DiscardUnknown: true} + if err = unmarshaler.Unmarshal(rawRespBody, out); err != nil { + return ctx, wrapInternal(err, "failed to unmarshal json response") + } + if err = ctx.Err(); err != nil { + return ctx, wrapInternal(err, "aborted because context was done") + } + return ctx, nil +} + +// Call twirp.ServerHooks.RequestReceived if the hook is available +func callRequestReceived(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { + if h == nil || h.RequestReceived == nil { + return ctx, nil + } + return h.RequestReceived(ctx) +} + +// Call twirp.ServerHooks.RequestRouted if the hook is available +func callRequestRouted(ctx context.Context, h *twirp.ServerHooks) (context.Context, error) { + if h == nil || h.RequestRouted == nil { + return ctx, nil + } + return h.RequestRouted(ctx) +} + +// Call twirp.ServerHooks.ResponsePrepared if the hook is available +func callResponsePrepared(ctx context.Context, h *twirp.ServerHooks) context.Context { + if h == nil || h.ResponsePrepared == nil { + return ctx + } + return h.ResponsePrepared(ctx) +} + +// Call twirp.ServerHooks.ResponseSent if the hook is available +func callResponseSent(ctx context.Context, h *twirp.ServerHooks) { + if h == nil || h.ResponseSent == nil { + return + } + h.ResponseSent(ctx) +} + +// Call twirp.ServerHooks.Error if the hook is available +func callError(ctx context.Context, h *twirp.ServerHooks, err twirp.Error) context.Context { + if h == nil || h.Error == nil { + return ctx + } + return h.Error(ctx, err) +} + +func callClientResponseReceived(ctx context.Context, h *twirp.ClientHooks) { + if h == nil || h.ResponseReceived == nil { + return + } + h.ResponseReceived(ctx) +} + +func callClientRequestPrepared(ctx context.Context, h *twirp.ClientHooks, req *http.Request) (context.Context, error) { + if h == nil || h.RequestPrepared == nil { + return ctx, nil + } + return h.RequestPrepared(ctx, req) +} + +func callClientError(ctx context.Context, h *twirp.ClientHooks, err twirp.Error) { + if h == nil || h.Error == nil { + return + } + h.Error(ctx, err) +} + +var twirpFileDescriptor0 = []byte{ + // 594 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x55, 0x61, 0x6b, 0xd3, 0x40, + 0x18, 0x26, 0xcd, 0x36, 0xed, 0x5b, 0xdb, 0xca, 0x6d, 0x2d, 0xa1, 0x32, 0xac, 0xd1, 0x75, 0x05, + 0x21, 0x83, 0x89, 0x22, 0xfb, 0x20, 0x74, 0x16, 0x44, 0x1c, 0x32, 0x52, 0x07, 0xe2, 0x07, 0xc3, + 0xb5, 0x79, 0xa9, 0xc7, 0xd2, 0x24, 0xe6, 0x2e, 0xb3, 0xdb, 0x17, 0xff, 0x8f, 0x7f, 0xc3, 0x5f, + 0xe1, 0x17, 0x7f, 0x80, 0xbf, 0x42, 0x92, 0x5e, 0x32, 0x9b, 0x1c, 0x66, 0x7e, 0xf4, 0x5b, 0xee, + 0xc9, 0xfb, 0xbc, 0xb9, 0xe7, 0xb9, 0xe7, 0xbd, 0xc0, 0x2e, 0x9d, 0xa3, 0x2f, 0xdc, 0xe9, 0x81, + 0xc7, 0x2e, 0xf0, 0x9c, 0x09, 0x47, 0xae, 0xad, 0x30, 0x0a, 0x44, 0x40, 0xda, 0x12, 0xb6, 0x24, + 0x6c, 0x5e, 0x42, 0xe7, 0x65, 0x84, 0x54, 0xe0, 0x98, 0x0a, 0x3a, 0xa5, 0x1c, 0x6d, 0xfc, 0x1c, + 0x23, 0x17, 0xa4, 0x0b, 0x5b, 0x11, 0xce, 0x59, 0xe0, 0x1b, 0x5a, 0x5f, 0x1b, 0xd6, 0x6d, 0xb9, + 0x22, 0xfb, 0xd0, 0x8e, 0x39, 0x46, 0x0e, 0x15, 0x22, 0x62, 0xd3, 0x58, 0x20, 0x37, 0x6a, 0x69, + 0x41, 0x2b, 0x81, 0x47, 0x39, 0x4a, 0xee, 0x43, 0x43, 0x08, 0xcf, 0xe1, 0x38, 0x0b, 0x7c, 0x97, + 0x1b, 0x7a, 0x5f, 0x1b, 0xea, 0x36, 0x08, 0xe1, 0x4d, 0x56, 0x88, 0x49, 0xa1, 0x5b, 0xfc, 0x34, + 0x0f, 0x03, 0x9f, 0x63, 0x42, 0x75, 0x25, 0xe6, 0x30, 0x57, 0x6e, 0x00, 0x32, 0xe8, 0xb5, 0x4b, + 0x06, 0xd0, 0xc6, 0x65, 0xc8, 0x22, 0xe4, 0x0e, 0x15, 0x4e, 0xec, 0xb3, 0x65, 0xba, 0x09, 0xdd, + 0x6e, 0x4a, 0x78, 0x24, 0xce, 0x7c, 0xb6, 0x34, 0x9f, 0x02, 0x79, 0x85, 0xa2, 0x28, 0xad, 0xaa, + 0xbd, 0xf9, 0x43, 0x83, 0xed, 0x35, 0xde, 0x4d, 0xf7, 0x75, 0x6d, 0x5a, 0xad, 0xca, 0x34, 0x5d, + 0x69, 0xda, 0x00, 0xda, 0xb3, 0xd4, 0x13, 0x37, 0x17, 0xb6, 0xb1, 0x12, 0x26, 0xe1, 0x95, 0x30, + 0x95, 0x01, 0x9b, 0x0a, 0x03, 0xc8, 0x5d, 0xd0, 0x05, 0x0b, 0x8d, 0xad, 0xf4, 0x5d, 0xf2, 0x68, + 0xda, 0xb0, 0x73, 0xc2, 0x78, 0xae, 0x8d, 0x67, 0xa6, 0xdc, 0x83, 0x7a, 0x48, 0xe7, 0xe8, 0x70, + 0x76, 0x85, 0xa9, 0xb2, 0x4d, 0xfb, 0x76, 0x02, 0x4c, 0xd8, 0x15, 0x92, 0x5d, 0x80, 0xf4, 0xa5, + 0x08, 0xce, 0x31, 0xd3, 0x96, 0x96, 0xbf, 0x4b, 0x00, 0xf3, 0x2b, 0x74, 0x0a, 0x3d, 0xa5, 0x61, + 0x2f, 0xa0, 0x9e, 0xb9, 0xc3, 0x0d, 0xad, 0xaf, 0x0f, 0x1b, 0x87, 0x7d, 0xab, 0x10, 0x41, 0x2b, + 0xa3, 0x4d, 0xe2, 0xc5, 0x82, 0x46, 0x97, 0xf6, 0x35, 0x25, 0x91, 0xe9, 0xe3, 0x52, 0x38, 0xa5, + 0x8f, 0x37, 0x13, 0xf8, 0x34, 0xdf, 0xc0, 0x77, 0x0d, 0xda, 0x85, 0x36, 0xff, 0xdf, 0x61, 0x99, + 0xcf, 0xa1, 0x33, 0x46, 0x0f, 0xcb, 0xb3, 0x58, 0x19, 0x58, 0x03, 0xba, 0x45, 0xe6, 0xea, 0x04, + 0xcc, 0x67, 0xb0, 0x3d, 0x8e, 0x17, 0xe1, 0x3f, 0x77, 0xe4, 0xb0, 0xb3, 0xce, 0x93, 0x27, 0xfa, + 0x00, 0xee, 0xb8, 0xc1, 0x17, 0xdf, 0x0b, 0xa8, 0xeb, 0xc4, 0x91, 0x27, 0x99, 0x8d, 0x0c, 0x3b, + 0x8b, 0xbc, 0x9b, 0x0e, 0x67, 0x96, 0x4d, 0x3d, 0xcf, 0xe6, 0xe1, 0x4f, 0x1d, 0x6e, 0x8d, 0x92, + 0x54, 0x8c, 0x8f, 0x09, 0x85, 0xd6, 0xfa, 0xed, 0x40, 0x06, 0xa5, 0xe4, 0x28, 0x6f, 0xae, 0xde, + 0x7e, 0x65, 0x9d, 0xd4, 0xf2, 0x1e, 0x1a, 0x7f, 0x4c, 0x39, 0x79, 0x58, 0xe2, 0x95, 0xef, 0x8e, + 0xde, 0xa3, 0xbf, 0x17, 0xc9, 0xce, 0x1f, 0xa1, 0xb9, 0x36, 0x10, 0x64, 0xaf, 0x44, 0x53, 0x0d, + 0x61, 0x6f, 0x50, 0x55, 0x26, 0xfb, 0x53, 0x68, 0xad, 0x9f, 0xb7, 0xc2, 0x1c, 0x65, 0x94, 0x14, + 0xe6, 0xa8, 0x83, 0x43, 0x26, 0xb0, 0x91, 0x04, 0x80, 0x94, 0x05, 0x2b, 0xf2, 0xd4, 0xdb, 0xab, + 0xa8, 0x5a, 0x35, 0x3d, 0x7e, 0xfb, 0xe1, 0xf1, 0x9c, 0x89, 0x4f, 0xf1, 0xd4, 0x9a, 0x05, 0x8b, + 0xec, 0x17, 0x75, 0x90, 0xfe, 0x9a, 0x66, 0x81, 0x97, 0x03, 0xb2, 0xc7, 0xb7, 0x5a, 0xf3, 0x84, + 0x5d, 0xe0, 0x1b, 0x26, 0xac, 0xd3, 0xa4, 0xe4, 0x57, 0xad, 0x25, 0xd7, 0x47, 0x47, 0x29, 0x30, + 0xdd, 0x4a, 0xa9, 0x4f, 0x7e, 0x07, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x24, 0x1a, 0xfb, 0xf6, 0x06, + 0x00, 0x00, +} diff --git a/livekit/agentdb/livekit_agentdb_data.pb.go b/livekit/agentdb/livekit_agentdb_data.pb.go new file mode 100644 index 000000000..47cef38a8 --- /dev/null +++ b/livekit/agentdb/livekit_agentdb_data.pb.go @@ -0,0 +1,1741 @@ +// Copyright 2026 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v7.35.1 +// source: agentdb/livekit_agentdb_data.proto + +package agentdb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + 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) +) + +// QueryLang selects the query language of a statement; both execute +// against the same database. +type QueryLang int32 + +const ( + QueryLang_QUERY_LANG_SQL QueryLang = 0 + QueryLang_QUERY_LANG_CYPHER QueryLang = 1 +) + +// Enum value maps for QueryLang. +var ( + QueryLang_name = map[int32]string{ + 0: "QUERY_LANG_SQL", + 1: "QUERY_LANG_CYPHER", + } + QueryLang_value = map[string]int32{ + "QUERY_LANG_SQL": 0, + "QUERY_LANG_CYPHER": 1, + } +) + +func (x QueryLang) Enum() *QueryLang { + p := new(QueryLang) + *p = x + return p +} + +func (x QueryLang) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (QueryLang) Descriptor() protoreflect.EnumDescriptor { + return file_agentdb_livekit_agentdb_data_proto_enumTypes[0].Descriptor() +} + +func (QueryLang) Type() protoreflect.EnumType { + return &file_agentdb_livekit_agentdb_data_proto_enumTypes[0] +} + +func (x QueryLang) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use QueryLang.Descriptor instead. +func (QueryLang) EnumDescriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{0} +} + +// ValueType tags one value's storage class within a Column. +type ValueType int32 + +const ( + ValueType_VALUE_TYPE_NULL ValueType = 0 + ValueType_VALUE_TYPE_INT ValueType = 1 + ValueType_VALUE_TYPE_DOUBLE ValueType = 2 + ValueType_VALUE_TYPE_TEXT ValueType = 3 + ValueType_VALUE_TYPE_BLOB ValueType = 4 +) + +// Enum value maps for ValueType. +var ( + ValueType_name = map[int32]string{ + 0: "VALUE_TYPE_NULL", + 1: "VALUE_TYPE_INT", + 2: "VALUE_TYPE_DOUBLE", + 3: "VALUE_TYPE_TEXT", + 4: "VALUE_TYPE_BLOB", + } + ValueType_value = map[string]int32{ + "VALUE_TYPE_NULL": 0, + "VALUE_TYPE_INT": 1, + "VALUE_TYPE_DOUBLE": 2, + "VALUE_TYPE_TEXT": 3, + "VALUE_TYPE_BLOB": 4, + } +) + +func (x ValueType) Enum() *ValueType { + p := new(ValueType) + *p = x + return p +} + +func (x ValueType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ValueType) Descriptor() protoreflect.EnumDescriptor { + return file_agentdb_livekit_agentdb_data_proto_enumTypes[1].Descriptor() +} + +func (ValueType) Type() protoreflect.EnumType { + return &file_agentdb_livekit_agentdb_data_proto_enumTypes[1] +} + +func (x ValueType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ValueType.Descriptor instead. +func (ValueType) EnumDescriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{1} +} + +type ClientMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + RequestId uint32 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // Types that are valid to be assigned to Message: + // + // *ClientMessage_Hello + // *ClientMessage_Exec + // *ClientMessage_Query + // *ClientMessage_Batch + // *ClientMessage_Begin + // *ClientMessage_Commit + // *ClientMessage_Rollback + // *ClientMessage_Cancel + // *ClientMessage_Credit + // *ClientMessage_Ping + Message isClientMessage_Message `protobuf_oneof:"message"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ClientMessage) Reset() { + *x = ClientMessage{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ClientMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientMessage) ProtoMessage() {} + +func (x *ClientMessage) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 ClientMessage.ProtoReflect.Descriptor instead. +func (*ClientMessage) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{0} +} + +func (x *ClientMessage) GetRequestId() uint32 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *ClientMessage) GetMessage() isClientMessage_Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *ClientMessage) GetHello() *Hello { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Hello); ok { + return x.Hello + } + } + return nil +} + +func (x *ClientMessage) GetExec() *Statement { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Exec); ok { + return x.Exec + } + } + return nil +} + +func (x *ClientMessage) GetQuery() *Statement { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Query); ok { + return x.Query + } + } + return nil +} + +func (x *ClientMessage) GetBatch() *Batch { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Batch); ok { + return x.Batch + } + } + return nil +} + +func (x *ClientMessage) GetBegin() *Begin { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Begin); ok { + return x.Begin + } + } + return nil +} + +func (x *ClientMessage) GetCommit() *Commit { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Commit); ok { + return x.Commit + } + } + return nil +} + +func (x *ClientMessage) GetRollback() *Rollback { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Rollback); ok { + return x.Rollback + } + } + return nil +} + +func (x *ClientMessage) GetCancel() *Cancel { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Cancel); ok { + return x.Cancel + } + } + return nil +} + +func (x *ClientMessage) GetCredit() *Credit { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Credit); ok { + return x.Credit + } + } + return nil +} + +func (x *ClientMessage) GetPing() *Ping { + if x != nil { + if x, ok := x.Message.(*ClientMessage_Ping); ok { + return x.Ping + } + } + return nil +} + +type isClientMessage_Message interface { + isClientMessage_Message() +} + +type ClientMessage_Hello struct { + Hello *Hello `protobuf:"bytes,2,opt,name=hello,proto3,oneof"` // must be first on the socket +} + +type ClientMessage_Exec struct { + Exec *Statement `protobuf:"bytes,3,opt,name=exec,proto3,oneof"` // no result rows; answers ExecResult +} + +type ClientMessage_Query struct { + Query *Statement `protobuf:"bytes,4,opt,name=query,proto3,oneof"` // answers Columns + ColumnBatch* + Done +} + +type ClientMessage_Batch struct { + Batch *Batch `protobuf:"bytes,5,opt,name=batch,proto3,oneof"` // atomic multi-statement exec +} + +type ClientMessage_Begin struct { + Begin *Begin `protobuf:"bytes,6,opt,name=begin,proto3,oneof"` // interactive transaction (server enforces idle/duration timeouts) +} + +type ClientMessage_Commit struct { + Commit *Commit `protobuf:"bytes,7,opt,name=commit,proto3,oneof"` +} + +type ClientMessage_Rollback struct { + Rollback *Rollback `protobuf:"bytes,8,opt,name=rollback,proto3,oneof"` +} + +type ClientMessage_Cancel struct { + Cancel *Cancel `protobuf:"bytes,9,opt,name=cancel,proto3,oneof"` // stop a running query's stream/cursor +} + +type ClientMessage_Credit struct { + Credit *Credit `protobuf:"bytes,10,opt,name=credit,proto3,oneof"` // grant more batch credits for request_id +} + +type ClientMessage_Ping struct { + Ping *Ping `protobuf:"bytes,11,opt,name=ping,proto3,oneof"` +} + +func (*ClientMessage_Hello) isClientMessage_Message() {} + +func (*ClientMessage_Exec) isClientMessage_Message() {} + +func (*ClientMessage_Query) isClientMessage_Message() {} + +func (*ClientMessage_Batch) isClientMessage_Message() {} + +func (*ClientMessage_Begin) isClientMessage_Message() {} + +func (*ClientMessage_Commit) isClientMessage_Message() {} + +func (*ClientMessage_Rollback) isClientMessage_Message() {} + +func (*ClientMessage_Cancel) isClientMessage_Message() {} + +func (*ClientMessage_Credit) isClientMessage_Message() {} + +func (*ClientMessage_Ping) isClientMessage_Message() {} + +type ServerMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + RequestId uint32 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"request_id,omitempty"` + // Types that are valid to be assigned to Message: + // + // *ServerMessage_HelloOk + // *ServerMessage_Columns + // *ServerMessage_ColumnBatch + // *ServerMessage_ExecResult + // *ServerMessage_Done + // *ServerMessage_Error + // *ServerMessage_Pong + Message isServerMessage_Message `protobuf_oneof:"message"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerMessage) Reset() { + *x = ServerMessage{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerMessage) ProtoMessage() {} + +func (x *ServerMessage) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 ServerMessage.ProtoReflect.Descriptor instead. +func (*ServerMessage) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{1} +} + +func (x *ServerMessage) GetRequestId() uint32 { + if x != nil { + return x.RequestId + } + return 0 +} + +func (x *ServerMessage) GetMessage() isServerMessage_Message { + if x != nil { + return x.Message + } + return nil +} + +func (x *ServerMessage) GetHelloOk() *HelloOk { + if x != nil { + if x, ok := x.Message.(*ServerMessage_HelloOk); ok { + return x.HelloOk + } + } + return nil +} + +func (x *ServerMessage) GetColumns() *Columns { + if x != nil { + if x, ok := x.Message.(*ServerMessage_Columns); ok { + return x.Columns + } + } + return nil +} + +func (x *ServerMessage) GetColumnBatch() *ColumnBatch { + if x != nil { + if x, ok := x.Message.(*ServerMessage_ColumnBatch); ok { + return x.ColumnBatch + } + } + return nil +} + +func (x *ServerMessage) GetExecResult() *ExecResult { + if x != nil { + if x, ok := x.Message.(*ServerMessage_ExecResult); ok { + return x.ExecResult + } + } + return nil +} + +func (x *ServerMessage) GetDone() *Done { + if x != nil { + if x, ok := x.Message.(*ServerMessage_Done); ok { + return x.Done + } + } + return nil +} + +func (x *ServerMessage) GetError() *Error { + if x != nil { + if x, ok := x.Message.(*ServerMessage_Error); ok { + return x.Error + } + } + return nil +} + +func (x *ServerMessage) GetPong() *Pong { + if x != nil { + if x, ok := x.Message.(*ServerMessage_Pong); ok { + return x.Pong + } + } + return nil +} + +type isServerMessage_Message interface { + isServerMessage_Message() +} + +type ServerMessage_HelloOk struct { + HelloOk *HelloOk `protobuf:"bytes,2,opt,name=hello_ok,json=helloOk,proto3,oneof"` +} + +type ServerMessage_Columns struct { + Columns *Columns `protobuf:"bytes,3,opt,name=columns,proto3,oneof"` +} + +type ServerMessage_ColumnBatch struct { + ColumnBatch *ColumnBatch `protobuf:"bytes,4,opt,name=column_batch,json=columnBatch,proto3,oneof"` +} + +type ServerMessage_ExecResult struct { + ExecResult *ExecResult `protobuf:"bytes,5,opt,name=exec_result,json=execResult,proto3,oneof"` +} + +type ServerMessage_Done struct { + Done *Done `protobuf:"bytes,6,opt,name=done,proto3,oneof"` +} + +type ServerMessage_Error struct { + Error *Error `protobuf:"bytes,7,opt,name=error,proto3,oneof"` +} + +type ServerMessage_Pong struct { + Pong *Pong `protobuf:"bytes,8,opt,name=pong,proto3,oneof"` +} + +func (*ServerMessage_HelloOk) isServerMessage_Message() {} + +func (*ServerMessage_Columns) isServerMessage_Message() {} + +func (*ServerMessage_ColumnBatch) isServerMessage_Message() {} + +func (*ServerMessage_ExecResult) isServerMessage_Message() {} + +func (*ServerMessage_Done) isServerMessage_Message() {} + +func (*ServerMessage_Error) isServerMessage_Message() {} + +func (*ServerMessage_Pong) isServerMessage_Message() {} + +// Value mirrors SQLite's five storage classes exactly. +type Value struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Value: + // + // *Value_NullValue + // *Value_IntValue + // *Value_DoubleValue + // *Value_TextValue + // *Value_BlobValue + Value isValue_Value `protobuf_oneof:"value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Value) Reset() { + *x = Value{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Value) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Value) ProtoMessage() {} + +func (x *Value) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 Value.ProtoReflect.Descriptor instead. +func (*Value) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{2} +} + +func (x *Value) GetValue() isValue_Value { + if x != nil { + return x.Value + } + return nil +} + +func (x *Value) GetNullValue() bool { + if x != nil { + if x, ok := x.Value.(*Value_NullValue); ok { + return x.NullValue + } + } + return false +} + +func (x *Value) GetIntValue() int64 { + if x != nil { + if x, ok := x.Value.(*Value_IntValue); ok { + return x.IntValue + } + } + return 0 +} + +func (x *Value) GetDoubleValue() float64 { + if x != nil { + if x, ok := x.Value.(*Value_DoubleValue); ok { + return x.DoubleValue + } + } + return 0 +} + +func (x *Value) GetTextValue() string { + if x != nil { + if x, ok := x.Value.(*Value_TextValue); ok { + return x.TextValue + } + } + return "" +} + +func (x *Value) GetBlobValue() []byte { + if x != nil { + if x, ok := x.Value.(*Value_BlobValue); ok { + return x.BlobValue + } + } + return nil +} + +type isValue_Value interface { + isValue_Value() +} + +type Value_NullValue struct { + NullValue bool `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,oneof"` // always true when set +} + +type Value_IntValue struct { + IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof"` +} + +type Value_DoubleValue struct { + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue,proto3,oneof"` +} + +type Value_TextValue struct { + TextValue string `protobuf:"bytes,4,opt,name=text_value,json=textValue,proto3,oneof"` +} + +type Value_BlobValue struct { + BlobValue []byte `protobuf:"bytes,5,opt,name=blob_value,json=blobValue,proto3,oneof"` +} + +func (*Value_NullValue) isValue_Value() {} + +func (*Value_IntValue) isValue_Value() {} + +func (*Value_DoubleValue) isValue_Value() {} + +func (*Value_TextValue) isValue_Value() {} + +func (*Value_BlobValue) isValue_Value() {} + +type Statement struct { + state protoimpl.MessageState `protogen:"open.v1"` + Sql string `protobuf:"bytes,1,opt,name=sql,proto3" json:"sql,omitempty"` // statement text in the selected lang + Params []*Value `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` // positional bind parameters + Lang QueryLang `protobuf:"varint,3,opt,name=lang,proto3,enum=livekit.agentdb.QueryLang" json:"lang,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Statement) Reset() { + *x = Statement{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Statement) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Statement) ProtoMessage() {} + +func (x *Statement) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 Statement.ProtoReflect.Descriptor instead. +func (*Statement) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{3} +} + +func (x *Statement) GetSql() string { + if x != nil { + return x.Sql + } + return "" +} + +func (x *Statement) GetParams() []*Value { + if x != nil { + return x.Params + } + return nil +} + +func (x *Statement) GetLang() QueryLang { + if x != nil { + return x.Lang + } + return QueryLang_QUERY_LANG_SQL +} + +type Batch struct { + state protoimpl.MessageState `protogen:"open.v1"` + Statements []*Statement `protobuf:"bytes,1,rep,name=statements,proto3" json:"statements,omitempty"` // applied atomically, in order + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Batch) Reset() { + *x = Batch{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Batch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Batch) ProtoMessage() {} + +func (x *Batch) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 Batch.ProtoReflect.Descriptor instead. +func (*Batch) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{4} +} + +func (x *Batch) GetStatements() []*Statement { + if x != nil { + return x.Statements + } + return nil +} + +type Begin struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Begin) Reset() { + *x = Begin{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Begin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Begin) ProtoMessage() {} + +func (x *Begin) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 Begin.ProtoReflect.Descriptor instead. +func (*Begin) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{5} +} + +type Commit struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Commit) Reset() { + *x = Commit{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Commit) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Commit) ProtoMessage() {} + +func (x *Commit) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 Commit.ProtoReflect.Descriptor instead. +func (*Commit) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{6} +} + +type Rollback struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Rollback) Reset() { + *x = Rollback{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Rollback) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Rollback) ProtoMessage() {} + +func (x *Rollback) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[7] + 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 Rollback.ProtoReflect.Descriptor instead. +func (*Rollback) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{7} +} + +type Cancel struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Cancel) Reset() { + *x = Cancel{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Cancel) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Cancel) ProtoMessage() {} + +func (x *Cancel) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_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 Cancel.ProtoReflect.Descriptor instead. +func (*Cancel) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{8} +} + +type Credit struct { + state protoimpl.MessageState `protogen:"open.v1"` + Batches uint32 `protobuf:"varint,1,opt,name=batches,proto3" json:"batches,omitempty"` // additional batch frames the client can absorb + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Credit) Reset() { + *x = Credit{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Credit) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Credit) ProtoMessage() {} + +func (x *Credit) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[9] + 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 Credit.ProtoReflect.Descriptor instead. +func (*Credit) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{9} +} + +func (x *Credit) GetBatches() uint32 { + if x != nil { + return x.Batches + } + return 0 +} + +type Ping struct { + state protoimpl.MessageState `protogen:"open.v1"` + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Ping) Reset() { + *x = Ping{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Ping) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ping) ProtoMessage() {} + +func (x *Ping) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[10] + 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 Ping.ProtoReflect.Descriptor instead. +func (*Ping) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{10} +} + +func (x *Ping) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type Pong struct { + state protoimpl.MessageState `protogen:"open.v1"` + LastPingTimestamp int64 `protobuf:"varint,1,opt,name=last_ping_timestamp,json=lastPingTimestamp,proto3" json:"last_ping_timestamp,omitempty"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Pong) Reset() { + *x = Pong{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Pong) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pong) ProtoMessage() {} + +func (x *Pong) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[11] + 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 Pong.ProtoReflect.Descriptor instead. +func (*Pong) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{11} +} + +func (x *Pong) GetLastPingTimestamp() int64 { + if x != nil { + return x.LastPingTimestamp + } + return 0 +} + +func (x *Pong) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +type Hello struct { + state protoimpl.MessageState `protogen:"open.v1"` + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` // access token; authorization is checked here + DatabaseId string `protobuf:"bytes,2,opt,name=database_id,json=databaseId,proto3" json:"database_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Hello) Reset() { + *x = Hello{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Hello) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Hello) ProtoMessage() {} + +func (x *Hello) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[12] + 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 Hello.ProtoReflect.Descriptor instead. +func (*Hello) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{12} +} + +func (x *Hello) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *Hello) GetDatabaseId() string { + if x != nil { + return x.DatabaseId + } + return "" +} + +type HelloOk struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tip int64 `protobuf:"varint,1,opt,name=tip,proto3" json:"tip,omitempty"` // latest durable commit sequence + PingIntervalMs uint32 `protobuf:"varint,2,opt,name=ping_interval_ms,json=pingIntervalMs,proto3" json:"ping_interval_ms,omitempty"` // server-advertised keepalive cadence + PingTimeoutMs uint32 `protobuf:"varint,3,opt,name=ping_timeout_ms,json=pingTimeoutMs,proto3" json:"ping_timeout_ms,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HelloOk) Reset() { + *x = HelloOk{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HelloOk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HelloOk) ProtoMessage() {} + +func (x *HelloOk) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[13] + 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 HelloOk.ProtoReflect.Descriptor instead. +func (*HelloOk) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{13} +} + +func (x *HelloOk) GetTip() int64 { + if x != nil { + return x.Tip + } + return 0 +} + +func (x *HelloOk) GetPingIntervalMs() uint32 { + if x != nil { + return x.PingIntervalMs + } + return 0 +} + +func (x *HelloOk) GetPingTimeoutMs() uint32 { + if x != nil { + return x.PingTimeoutMs + } + return 0 +} + +type Columns struct { + state protoimpl.MessageState `protogen:"open.v1"` + Names []string `protobuf:"bytes,1,rep,name=names,proto3" json:"names,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Columns) Reset() { + *x = Columns{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Columns) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Columns) ProtoMessage() {} + +func (x *Columns) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[14] + 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 Columns.ProtoReflect.Descriptor instead. +func (*Columns) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{14} +} + +func (x *Columns) GetNames() []string { + if x != nil { + return x.Names + } + return nil +} + +// Column is one column of a batch. Values are typed individually, as +// SQLite types them, so a column may mix classes: walk `types` and take the next +// entry from the matching array. A NULL occupies a tag only. +type Column struct { + state protoimpl.MessageState `protogen:"open.v1"` + Types []byte `protobuf:"bytes,1,opt,name=types,proto3" json:"types,omitempty"` // one ValueType per row + Ints []int64 `protobuf:"zigzag64,2,rep,packed,name=ints,proto3" json:"ints,omitempty"` + Doubles []float64 `protobuf:"fixed64,3,rep,packed,name=doubles,proto3" json:"doubles,omitempty"` + // Values concatenated, one exclusive end offset each: value i is + // data[ends[i-1]:ends[i]], with 0 implied before the first. + TextData []byte `protobuf:"bytes,4,opt,name=text_data,json=textData,proto3" json:"text_data,omitempty"` + TextEnds []uint32 `protobuf:"varint,5,rep,packed,name=text_ends,json=textEnds,proto3" json:"text_ends,omitempty"` + BlobData []byte `protobuf:"bytes,6,opt,name=blob_data,json=blobData,proto3" json:"blob_data,omitempty"` + BlobEnds []uint32 `protobuf:"varint,7,rep,packed,name=blob_ends,json=blobEnds,proto3" json:"blob_ends,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Column) Reset() { + *x = Column{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Column) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Column) ProtoMessage() {} + +func (x *Column) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[15] + 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 Column.ProtoReflect.Descriptor instead. +func (*Column) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{15} +} + +func (x *Column) GetTypes() []byte { + if x != nil { + return x.Types + } + return nil +} + +func (x *Column) GetInts() []int64 { + if x != nil { + return x.Ints + } + return nil +} + +func (x *Column) GetDoubles() []float64 { + if x != nil { + return x.Doubles + } + return nil +} + +func (x *Column) GetTextData() []byte { + if x != nil { + return x.TextData + } + return nil +} + +func (x *Column) GetTextEnds() []uint32 { + if x != nil { + return x.TextEnds + } + return nil +} + +func (x *Column) GetBlobData() []byte { + if x != nil { + return x.BlobData + } + return nil +} + +func (x *Column) GetBlobEnds() []uint32 { + if x != nil { + return x.BlobEnds + } + return nil +} + +type ColumnBatch struct { + state protoimpl.MessageState `protogen:"open.v1"` + Columns []*Column `protobuf:"bytes,1,rep,name=columns,proto3" json:"columns,omitempty"` // one per column of Columns + Rows uint32 `protobuf:"varint,2,opt,name=rows,proto3" json:"rows,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ColumnBatch) Reset() { + *x = ColumnBatch{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ColumnBatch) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ColumnBatch) ProtoMessage() {} + +func (x *ColumnBatch) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[16] + 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 ColumnBatch.ProtoReflect.Descriptor instead. +func (*ColumnBatch) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{16} +} + +func (x *ColumnBatch) GetColumns() []*Column { + if x != nil { + return x.Columns + } + return nil +} + +func (x *ColumnBatch) GetRows() uint32 { + if x != nil { + return x.Rows + } + return 0 +} + +type ExecResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + RowsAffected int64 `protobuf:"varint,1,opt,name=rows_affected,json=rowsAffected,proto3" json:"rows_affected,omitempty"` + LastInsertId int64 `protobuf:"varint,2,opt,name=last_insert_id,json=lastInsertId,proto3" json:"last_insert_id,omitempty"` + Tip int64 `protobuf:"varint,3,opt,name=tip,proto3" json:"tip,omitempty"` // durable commit sequence after this exec + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExecResult) Reset() { + *x = ExecResult{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExecResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExecResult) ProtoMessage() {} + +func (x *ExecResult) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[17] + 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 ExecResult.ProtoReflect.Descriptor instead. +func (*ExecResult) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{17} +} + +func (x *ExecResult) GetRowsAffected() int64 { + if x != nil { + return x.RowsAffected + } + return 0 +} + +func (x *ExecResult) GetLastInsertId() int64 { + if x != nil { + return x.LastInsertId + } + return 0 +} + +func (x *ExecResult) GetTip() int64 { + if x != nil { + return x.Tip + } + return 0 +} + +type Done struct { + state protoimpl.MessageState `protogen:"open.v1"` + Tip int64 `protobuf:"varint,1,opt,name=tip,proto3" json:"tip,omitempty"` // snapshot the query ran at + TotalRows uint64 `protobuf:"varint,2,opt,name=total_rows,json=totalRows,proto3" json:"total_rows,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Done) Reset() { + *x = Done{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Done) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Done) ProtoMessage() {} + +func (x *Done) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[18] + 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 Done.ProtoReflect.Descriptor instead. +func (*Done) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{18} +} + +func (x *Done) GetTip() int64 { + if x != nil { + return x.Tip + } + return 0 +} + +func (x *Done) GetTotalRows() uint64 { + if x != nil { + return x.TotalRows + } + return 0 +} + +type Error struct { + state protoimpl.MessageState `protogen:"open.v1"` + Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` // stable machine-readable code + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Error) Reset() { + *x = Error{} + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Error) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Error) ProtoMessage() {} + +func (x *Error) ProtoReflect() protoreflect.Message { + mi := &file_agentdb_livekit_agentdb_data_proto_msgTypes[19] + 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 Error.ProtoReflect.Descriptor instead. +func (*Error) Descriptor() ([]byte, []int) { + return file_agentdb_livekit_agentdb_data_proto_rawDescGZIP(), []int{19} +} + +func (x *Error) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Error) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +var File_agentdb_livekit_agentdb_data_proto protoreflect.FileDescriptor + +const file_agentdb_livekit_agentdb_data_proto_rawDesc = "" + + "\n" + + "\"agentdb/livekit_agentdb_data.proto\x12\x0flivekit.agentdb\"\xae\x04\n" + + "\rClientMessage\x12\x1d\n" + + "\n" + + "request_id\x18\x01 \x01(\rR\trequestId\x12.\n" + + "\x05hello\x18\x02 \x01(\v2\x16.livekit.agentdb.HelloH\x00R\x05hello\x120\n" + + "\x04exec\x18\x03 \x01(\v2\x1a.livekit.agentdb.StatementH\x00R\x04exec\x122\n" + + "\x05query\x18\x04 \x01(\v2\x1a.livekit.agentdb.StatementH\x00R\x05query\x12.\n" + + "\x05batch\x18\x05 \x01(\v2\x16.livekit.agentdb.BatchH\x00R\x05batch\x12.\n" + + "\x05begin\x18\x06 \x01(\v2\x16.livekit.agentdb.BeginH\x00R\x05begin\x121\n" + + "\x06commit\x18\a \x01(\v2\x17.livekit.agentdb.CommitH\x00R\x06commit\x127\n" + + "\brollback\x18\b \x01(\v2\x19.livekit.agentdb.RollbackH\x00R\brollback\x121\n" + + "\x06cancel\x18\t \x01(\v2\x17.livekit.agentdb.CancelH\x00R\x06cancel\x121\n" + + "\x06credit\x18\n" + + " \x01(\v2\x17.livekit.agentdb.CreditH\x00R\x06credit\x12+\n" + + "\x04ping\x18\v \x01(\v2\x15.livekit.agentdb.PingH\x00R\x04pingB\t\n" + + "\amessage\"\xb3\x03\n" + + "\rServerMessage\x12\x1d\n" + + "\n" + + "request_id\x18\x01 \x01(\rR\trequestId\x125\n" + + "\bhello_ok\x18\x02 \x01(\v2\x18.livekit.agentdb.HelloOkH\x00R\ahelloOk\x124\n" + + "\acolumns\x18\x03 \x01(\v2\x18.livekit.agentdb.ColumnsH\x00R\acolumns\x12A\n" + + "\fcolumn_batch\x18\x04 \x01(\v2\x1c.livekit.agentdb.ColumnBatchH\x00R\vcolumnBatch\x12>\n" + + "\vexec_result\x18\x05 \x01(\v2\x1b.livekit.agentdb.ExecResultH\x00R\n" + + "execResult\x12+\n" + + "\x04done\x18\x06 \x01(\v2\x15.livekit.agentdb.DoneH\x00R\x04done\x12.\n" + + "\x05error\x18\a \x01(\v2\x16.livekit.agentdb.ErrorH\x00R\x05error\x12+\n" + + "\x04pong\x18\b \x01(\v2\x15.livekit.agentdb.PongH\x00R\x04pongB\t\n" + + "\amessage\"\xb7\x01\n" + + "\x05Value\x12\x1f\n" + + "\n" + + "null_value\x18\x01 \x01(\bH\x00R\tnullValue\x12\x1d\n" + + "\tint_value\x18\x02 \x01(\x03H\x00R\bintValue\x12#\n" + + "\fdouble_value\x18\x03 \x01(\x01H\x00R\vdoubleValue\x12\x1f\n" + + "\n" + + "text_value\x18\x04 \x01(\tH\x00R\ttextValue\x12\x1f\n" + + "\n" + + "blob_value\x18\x05 \x01(\fH\x00R\tblobValueB\a\n" + + "\x05value\"}\n" + + "\tStatement\x12\x10\n" + + "\x03sql\x18\x01 \x01(\tR\x03sql\x12.\n" + + "\x06params\x18\x02 \x03(\v2\x16.livekit.agentdb.ValueR\x06params\x12.\n" + + "\x04lang\x18\x03 \x01(\x0e2\x1a.livekit.agentdb.QueryLangR\x04lang\"C\n" + + "\x05Batch\x12:\n" + + "\n" + + "statements\x18\x01 \x03(\v2\x1a.livekit.agentdb.StatementR\n" + + "statements\"\a\n" + + "\x05Begin\"\b\n" + + "\x06Commit\"\n" + + "\n" + + "\bRollback\"\b\n" + + "\x06Cancel\"\"\n" + + "\x06Credit\x12\x18\n" + + "\abatches\x18\x01 \x01(\rR\abatches\"$\n" + + "\x04Ping\x12\x1c\n" + + "\ttimestamp\x18\x01 \x01(\x03R\ttimestamp\"T\n" + + "\x04Pong\x12.\n" + + "\x13last_ping_timestamp\x18\x01 \x01(\x03R\x11lastPingTimestamp\x12\x1c\n" + + "\ttimestamp\x18\x02 \x01(\x03R\ttimestamp\">\n" + + "\x05Hello\x12\x14\n" + + "\x05token\x18\x01 \x01(\tR\x05token\x12\x1f\n" + + "\vdatabase_id\x18\x02 \x01(\tR\n" + + "databaseId\"m\n" + + "\aHelloOk\x12\x10\n" + + "\x03tip\x18\x01 \x01(\x03R\x03tip\x12(\n" + + "\x10ping_interval_ms\x18\x02 \x01(\rR\x0epingIntervalMs\x12&\n" + + "\x0fping_timeout_ms\x18\x03 \x01(\rR\rpingTimeoutMs\"\x1f\n" + + "\aColumns\x12\x14\n" + + "\x05names\x18\x01 \x03(\tR\x05names\"\xc0\x01\n" + + "\x06Column\x12\x14\n" + + "\x05types\x18\x01 \x01(\fR\x05types\x12\x12\n" + + "\x04ints\x18\x02 \x03(\x12R\x04ints\x12\x18\n" + + "\adoubles\x18\x03 \x03(\x01R\adoubles\x12\x1b\n" + + "\ttext_data\x18\x04 \x01(\fR\btextData\x12\x1b\n" + + "\ttext_ends\x18\x05 \x03(\rR\btextEnds\x12\x1b\n" + + "\tblob_data\x18\x06 \x01(\fR\bblobData\x12\x1b\n" + + "\tblob_ends\x18\a \x03(\rR\bblobEnds\"T\n" + + "\vColumnBatch\x121\n" + + "\acolumns\x18\x01 \x03(\v2\x17.livekit.agentdb.ColumnR\acolumns\x12\x12\n" + + "\x04rows\x18\x02 \x01(\rR\x04rows\"i\n" + + "\n" + + "ExecResult\x12#\n" + + "\rrows_affected\x18\x01 \x01(\x03R\frowsAffected\x12$\n" + + "\x0elast_insert_id\x18\x02 \x01(\x03R\flastInsertId\x12\x10\n" + + "\x03tip\x18\x03 \x01(\x03R\x03tip\"7\n" + + "\x04Done\x12\x10\n" + + "\x03tip\x18\x01 \x01(\x03R\x03tip\x12\x1d\n" + + "\n" + + "total_rows\x18\x02 \x01(\x04R\ttotalRows\"5\n" + + "\x05Error\x12\x12\n" + + "\x04code\x18\x01 \x01(\tR\x04code\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage*6\n" + + "\tQueryLang\x12\x12\n" + + "\x0eQUERY_LANG_SQL\x10\x00\x12\x15\n" + + "\x11QUERY_LANG_CYPHER\x10\x01*u\n" + + "\tValueType\x12\x13\n" + + "\x0fVALUE_TYPE_NULL\x10\x00\x12\x12\n" + + "\x0eVALUE_TYPE_INT\x10\x01\x12\x15\n" + + "\x11VALUE_TYPE_DOUBLE\x10\x02\x12\x13\n" + + "\x0fVALUE_TYPE_TEXT\x10\x03\x12\x13\n" + + "\x0fVALUE_TYPE_BLOB\x10\x04BNZ+github.com/livekit/protocol/livekit/agentdb\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + +var ( + file_agentdb_livekit_agentdb_data_proto_rawDescOnce sync.Once + file_agentdb_livekit_agentdb_data_proto_rawDescData []byte +) + +func file_agentdb_livekit_agentdb_data_proto_rawDescGZIP() []byte { + file_agentdb_livekit_agentdb_data_proto_rawDescOnce.Do(func() { + file_agentdb_livekit_agentdb_data_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_agentdb_livekit_agentdb_data_proto_rawDesc), len(file_agentdb_livekit_agentdb_data_proto_rawDesc))) + }) + return file_agentdb_livekit_agentdb_data_proto_rawDescData +} + +var file_agentdb_livekit_agentdb_data_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_agentdb_livekit_agentdb_data_proto_msgTypes = make([]protoimpl.MessageInfo, 20) +var file_agentdb_livekit_agentdb_data_proto_goTypes = []any{ + (QueryLang)(0), // 0: livekit.agentdb.QueryLang + (ValueType)(0), // 1: livekit.agentdb.ValueType + (*ClientMessage)(nil), // 2: livekit.agentdb.ClientMessage + (*ServerMessage)(nil), // 3: livekit.agentdb.ServerMessage + (*Value)(nil), // 4: livekit.agentdb.Value + (*Statement)(nil), // 5: livekit.agentdb.Statement + (*Batch)(nil), // 6: livekit.agentdb.Batch + (*Begin)(nil), // 7: livekit.agentdb.Begin + (*Commit)(nil), // 8: livekit.agentdb.Commit + (*Rollback)(nil), // 9: livekit.agentdb.Rollback + (*Cancel)(nil), // 10: livekit.agentdb.Cancel + (*Credit)(nil), // 11: livekit.agentdb.Credit + (*Ping)(nil), // 12: livekit.agentdb.Ping + (*Pong)(nil), // 13: livekit.agentdb.Pong + (*Hello)(nil), // 14: livekit.agentdb.Hello + (*HelloOk)(nil), // 15: livekit.agentdb.HelloOk + (*Columns)(nil), // 16: livekit.agentdb.Columns + (*Column)(nil), // 17: livekit.agentdb.Column + (*ColumnBatch)(nil), // 18: livekit.agentdb.ColumnBatch + (*ExecResult)(nil), // 19: livekit.agentdb.ExecResult + (*Done)(nil), // 20: livekit.agentdb.Done + (*Error)(nil), // 21: livekit.agentdb.Error +} +var file_agentdb_livekit_agentdb_data_proto_depIdxs = []int32{ + 14, // 0: livekit.agentdb.ClientMessage.hello:type_name -> livekit.agentdb.Hello + 5, // 1: livekit.agentdb.ClientMessage.exec:type_name -> livekit.agentdb.Statement + 5, // 2: livekit.agentdb.ClientMessage.query:type_name -> livekit.agentdb.Statement + 6, // 3: livekit.agentdb.ClientMessage.batch:type_name -> livekit.agentdb.Batch + 7, // 4: livekit.agentdb.ClientMessage.begin:type_name -> livekit.agentdb.Begin + 8, // 5: livekit.agentdb.ClientMessage.commit:type_name -> livekit.agentdb.Commit + 9, // 6: livekit.agentdb.ClientMessage.rollback:type_name -> livekit.agentdb.Rollback + 10, // 7: livekit.agentdb.ClientMessage.cancel:type_name -> livekit.agentdb.Cancel + 11, // 8: livekit.agentdb.ClientMessage.credit:type_name -> livekit.agentdb.Credit + 12, // 9: livekit.agentdb.ClientMessage.ping:type_name -> livekit.agentdb.Ping + 15, // 10: livekit.agentdb.ServerMessage.hello_ok:type_name -> livekit.agentdb.HelloOk + 16, // 11: livekit.agentdb.ServerMessage.columns:type_name -> livekit.agentdb.Columns + 18, // 12: livekit.agentdb.ServerMessage.column_batch:type_name -> livekit.agentdb.ColumnBatch + 19, // 13: livekit.agentdb.ServerMessage.exec_result:type_name -> livekit.agentdb.ExecResult + 20, // 14: livekit.agentdb.ServerMessage.done:type_name -> livekit.agentdb.Done + 21, // 15: livekit.agentdb.ServerMessage.error:type_name -> livekit.agentdb.Error + 13, // 16: livekit.agentdb.ServerMessage.pong:type_name -> livekit.agentdb.Pong + 4, // 17: livekit.agentdb.Statement.params:type_name -> livekit.agentdb.Value + 0, // 18: livekit.agentdb.Statement.lang:type_name -> livekit.agentdb.QueryLang + 5, // 19: livekit.agentdb.Batch.statements:type_name -> livekit.agentdb.Statement + 17, // 20: livekit.agentdb.ColumnBatch.columns:type_name -> livekit.agentdb.Column + 21, // [21:21] is the sub-list for method output_type + 21, // [21:21] is the sub-list for method input_type + 21, // [21:21] is the sub-list for extension type_name + 21, // [21:21] is the sub-list for extension extendee + 0, // [0:21] is the sub-list for field type_name +} + +func init() { file_agentdb_livekit_agentdb_data_proto_init() } +func file_agentdb_livekit_agentdb_data_proto_init() { + if File_agentdb_livekit_agentdb_data_proto != nil { + return + } + file_agentdb_livekit_agentdb_data_proto_msgTypes[0].OneofWrappers = []any{ + (*ClientMessage_Hello)(nil), + (*ClientMessage_Exec)(nil), + (*ClientMessage_Query)(nil), + (*ClientMessage_Batch)(nil), + (*ClientMessage_Begin)(nil), + (*ClientMessage_Commit)(nil), + (*ClientMessage_Rollback)(nil), + (*ClientMessage_Cancel)(nil), + (*ClientMessage_Credit)(nil), + (*ClientMessage_Ping)(nil), + } + file_agentdb_livekit_agentdb_data_proto_msgTypes[1].OneofWrappers = []any{ + (*ServerMessage_HelloOk)(nil), + (*ServerMessage_Columns)(nil), + (*ServerMessage_ColumnBatch)(nil), + (*ServerMessage_ExecResult)(nil), + (*ServerMessage_Done)(nil), + (*ServerMessage_Error)(nil), + (*ServerMessage_Pong)(nil), + } + file_agentdb_livekit_agentdb_data_proto_msgTypes[2].OneofWrappers = []any{ + (*Value_NullValue)(nil), + (*Value_IntValue)(nil), + (*Value_DoubleValue)(nil), + (*Value_TextValue)(nil), + (*Value_BlobValue)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_agentdb_livekit_agentdb_data_proto_rawDesc), len(file_agentdb_livekit_agentdb_data_proto_rawDesc)), + NumEnums: 2, + NumMessages: 20, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_agentdb_livekit_agentdb_data_proto_goTypes, + DependencyIndexes: file_agentdb_livekit_agentdb_data_proto_depIdxs, + EnumInfos: file_agentdb_livekit_agentdb_data_proto_enumTypes, + MessageInfos: file_agentdb_livekit_agentdb_data_proto_msgTypes, + }.Build() + File_agentdb_livekit_agentdb_data_proto = out.File + file_agentdb_livekit_agentdb_data_proto_goTypes = nil + file_agentdb_livekit_agentdb_data_proto_depIdxs = nil +} diff --git a/magefile.go b/magefile.go index 087bbf623..7fd8b2854 100644 --- a/magefile.go +++ b/magefile.go @@ -170,6 +170,28 @@ func Proto() error { } } + // Own go_package, so its own invocation: protoc-gen-twirp refuses to mix + // packages in one run. + fmt.Println("generating protobuf (livekit/agentdb)") + { + args := []string{ + "--go_out", target, + "--twirp_out", target, + "--go_opt=paths=source_relative", + "--twirp_opt=paths=source_relative", + "--plugin=go=" + protocGoPath, + "--plugin=twirp=" + twirpPath, + "-I=./protobufs", + "agentdb/livekit_agentdb.proto", + "agentdb/livekit_agentdb_data.proto", + } + cmd := exec.Command(protoc, args...) + connectStd(cmd) + if err := cmd.Run(); err != nil { + return err + } + } + fmt.Println("generating protobuf (livekit/roomrpc)") for _, protoName := range roomrpcTypeNames { pkgName := "roomrpc/" + protoName + "rpc" diff --git a/protobufs/agentdb/livekit_agentdb.proto b/protobufs/agentdb/livekit_agentdb.proto new file mode 100644 index 000000000..a8bdd347d --- /dev/null +++ b/protobufs/agentdb/livekit_agentdb.proto @@ -0,0 +1,96 @@ +// Copyright 2026 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package livekit.agentdb; + +option go_package = "github.com/livekit/protocol/livekit/agentdb"; +option csharp_namespace = "LiveKit.Proto"; +option ruby_package = "LiveKit::Proto"; + +// AgentDB hands out SQLite databases: lifecycle and export. Querying goes +// through the data plane in livekit_agentdb_data.proto. The project comes from +// the access token, never from a request field. +service AgentDB { + rpc CreateDatabase(CreateDatabaseRequest) returns (CreateDatabaseResponse); + rpc GetDatabase(GetDatabaseRequest) returns (GetDatabaseResponse); + rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse); + + // Deletes the stored data too, not just the metadata row. + rpc DeleteDatabase(DeleteDatabaseRequest) returns (DeleteDatabaseResponse); + + // Exports a consistent SQLite file, returning a time-limited download URL. + rpc Dump(DumpDatabaseRequest) returns (DumpDatabaseResponse); +} + +message CreateDatabaseRequest { + string region = 1; + string user_attributes = 2; // opaque JSON metadata for the caller + int64 ttl_seconds = 3; // unset: never expires. Otherwise clamped to the server cap, and never extended +} + +message CreateDatabaseResponse { + string database_id = 1; // "DB_..." + int64 expires_at_unix = 2; // 0: never expires +} + +message GetDatabaseRequest { + string database_id = 1; +} + +message GetDatabaseResponse { + string database_id = 1; + string region = 2; + string user_attributes = 3; + int64 created_at_unix = 4; + int64 expires_at_unix = 5; // 0: never expires + int64 tip = 6; // latest durable commit sequence +} + +message ListDatabasesRequest { + int32 page_size = 1; // server-clamped + string page_token = 2; // opaque cursor from a previous response +} + +message ListDatabasesResponse { + repeated DatabaseSummary databases = 1; + string next_page_token = 2; // empty when exhausted +} + +// DatabaseSummary is a database's immutable fields. No tip: it changes on every +// commit, so call GetDatabase for it. +message DatabaseSummary { + string database_id = 1; + string region = 2; + string user_attributes = 3; + int64 created_at_unix = 4; + int64 expires_at_unix = 5; // 0: never expires +} + +message DeleteDatabaseRequest { + string database_id = 1; +} + +message DeleteDatabaseResponse {} + +message DumpDatabaseRequest { + string database_id = 1; +} + +message DumpDatabaseResponse { + string download_url = 1; // pre-authenticated object-storage URL + int64 expires_at_unix = 2; // URL expiry + int64 tip = 3; // commit sequence the dump is consistent at +} diff --git a/protobufs/agentdb/livekit_agentdb_data.proto b/protobufs/agentdb/livekit_agentdb_data.proto new file mode 100644 index 000000000..417612cc6 --- /dev/null +++ b/protobufs/agentdb/livekit_agentdb_data.proto @@ -0,0 +1,164 @@ +// Copyright 2026 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package livekit.agentdb; + +option go_package = "github.com/livekit/protocol/livekit/agentdb"; +option csharp_namespace = "LiveKit.Proto"; +option ruby_package = "LiveKit::Proto"; + +// Data plane for AgentDB databases: one WebSocket per database, one +// protobuf message per frame, requests and responses correlated by a +// client-chosen request_id. +// +// Query results stream as ColumnBatch frames paced by the credits the +// client advertises (Credit): the server never sends more un-consumed +// batches than granted. + +message ClientMessage { + uint32 request_id = 1; + oneof message { + Hello hello = 2; // must be first on the socket + Statement exec = 3; // no result rows; answers ExecResult + Statement query = 4; // answers Columns + ColumnBatch* + Done + Batch batch = 5; // atomic multi-statement exec + Begin begin = 6; // interactive transaction (server enforces idle/duration timeouts) + Commit commit = 7; + Rollback rollback = 8; + Cancel cancel = 9; // stop a running query's stream/cursor + Credit credit = 10; // grant more batch credits for request_id + Ping ping = 11; + } +} + +message ServerMessage { + uint32 request_id = 1; + oneof message { + HelloOk hello_ok = 2; + Columns columns = 3; + ColumnBatch column_batch = 4; + ExecResult exec_result = 5; + Done done = 6; + Error error = 7; + Pong pong = 8; + } +} + +// QueryLang selects the query language of a statement; both execute +// against the same database. +enum QueryLang { + QUERY_LANG_SQL = 0; + QUERY_LANG_CYPHER = 1; +} + +// Value mirrors SQLite's five storage classes exactly. +message Value { + oneof value { + bool null_value = 1; // always true when set + int64 int_value = 2; + double double_value = 3; + string text_value = 4; + bytes blob_value = 5; + } +} + +message Statement { + string sql = 1; // statement text in the selected lang + repeated Value params = 2; // positional bind parameters + QueryLang lang = 3; +} + +message Batch { + repeated Statement statements = 1; // applied atomically, in order +} + +message Begin {} +message Commit {} +message Rollback {} +message Cancel {} + +message Credit { + uint32 batches = 1; // additional batch frames the client can absorb +} + +message Ping { + int64 timestamp = 1; +} + +message Pong { + int64 last_ping_timestamp = 1; + int64 timestamp = 2; +} + +message Hello { + string token = 1; // access token; authorization is checked here + string database_id = 2; +} + +message HelloOk { + int64 tip = 1; // latest durable commit sequence + uint32 ping_interval_ms = 2; // server-advertised keepalive cadence + uint32 ping_timeout_ms = 3; +} + +message Columns { + repeated string names = 1; +} + +// ValueType tags one value's storage class within a Column. +enum ValueType { + VALUE_TYPE_NULL = 0; + VALUE_TYPE_INT = 1; + VALUE_TYPE_DOUBLE = 2; + VALUE_TYPE_TEXT = 3; + VALUE_TYPE_BLOB = 4; +} + +// Column is one column of a batch. Values are typed individually, as +// SQLite types them, so a column may mix classes: walk `types` and take the next +// entry from the matching array. A NULL occupies a tag only. +message Column { + bytes types = 1; // one ValueType per row + repeated sint64 ints = 2; + repeated double doubles = 3; + // Values concatenated, one exclusive end offset each: value i is + // data[ends[i-1]:ends[i]], with 0 implied before the first. + bytes text_data = 4; + repeated uint32 text_ends = 5; + bytes blob_data = 6; + repeated uint32 blob_ends = 7; +} + +message ColumnBatch { + repeated Column columns = 1; // one per column of Columns + uint32 rows = 2; +} + +message ExecResult { + int64 rows_affected = 1; + int64 last_insert_id = 2; + int64 tip = 3; // durable commit sequence after this exec +} + +message Done { + int64 tip = 1; // snapshot the query ran at + uint64 total_rows = 2; +} + +message Error { + string code = 1; // stable machine-readable code + string message = 2; +} diff --git a/rpc/agent.psrpc.go b/rpc/agent.psrpc.go index 434d66530..40f7489e5 100644 --- a/rpc/agent.psrpc.go +++ b/rpc/agent.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/agent.proto package rpc diff --git a/rpc/agent_dispatch.psrpc.go b/rpc/agent_dispatch.psrpc.go index 29d546646..2715d016a 100644 --- a/rpc/agent_dispatch.psrpc.go +++ b/rpc/agent_dispatch.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/agent_dispatch.proto package rpc diff --git a/rpc/egress.psrpc.go b/rpc/egress.psrpc.go index 2cd187b02..f41b6491d 100644 --- a/rpc/egress.psrpc.go +++ b/rpc/egress.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/egress.proto package rpc diff --git a/rpc/ingress.psrpc.go b/rpc/ingress.psrpc.go index 25faf9c1d..3c433b129 100644 --- a/rpc/ingress.psrpc.go +++ b/rpc/ingress.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/ingress.proto package rpc diff --git a/rpc/io.psrpc.go b/rpc/io.psrpc.go index 6f225e1b5..6a00fcc92 100644 --- a/rpc/io.psrpc.go +++ b/rpc/io.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/io.proto package rpc diff --git a/rpc/keepalive.psrpc.go b/rpc/keepalive.psrpc.go index 4735f8d58..107bb8fa8 100644 --- a/rpc/keepalive.psrpc.go +++ b/rpc/keepalive.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/keepalive.proto package rpc diff --git a/rpc/participant.psrpc.go b/rpc/participant.psrpc.go index 5a3fd5e7a..b8d1293d2 100644 --- a/rpc/participant.psrpc.go +++ b/rpc/participant.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/participant.proto package rpc diff --git a/rpc/room.psrpc.go b/rpc/room.psrpc.go index 0b1a8b622..83818a5e4 100644 --- a/rpc/room.psrpc.go +++ b/rpc/room.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/room.proto package rpc diff --git a/rpc/roommanager.psrpc.go b/rpc/roommanager.psrpc.go index 9dbc22974..5df0da239 100644 --- a/rpc/roommanager.psrpc.go +++ b/rpc/roommanager.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/roommanager.proto package rpc diff --git a/rpc/signal.psrpc.go b/rpc/signal.psrpc.go index acd68bb05..5ac766af3 100644 --- a/rpc/signal.psrpc.go +++ b/rpc/signal.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/signal.proto package rpc diff --git a/rpc/sip.psrpc.go b/rpc/sip.psrpc.go index b1012975c..26979c257 100644 --- a/rpc/sip.psrpc.go +++ b/rpc/sip.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/sip.proto package rpc diff --git a/rpc/whip_signal.psrpc.go b/rpc/whip_signal.psrpc.go index 29707b064..0f4f4ddf7 100644 --- a/rpc/whip_signal.psrpc.go +++ b/rpc/whip_signal.psrpc.go @@ -1,4 +1,4 @@ -// Code generated by protoc-gen-psrpc v0.7.2, DO NOT EDIT. +// Code generated by protoc-gen-psrpc v0.7.3, DO NOT EDIT. // source: rpc/whip_signal.proto package rpc