From 2d58fe579b69e25980768556780e393385befb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Sat, 7 Feb 2026 21:43:59 -0800 Subject: [PATCH 1/8] wip --- magefile.go | 1 + protobufs/livekit_agent_simulation.proto | 33 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 protobufs/livekit_agent_simulation.proto diff --git a/magefile.go b/magefile.go index 8679a9d6d..7d42d63c9 100644 --- a/magefile.go +++ b/magefile.go @@ -53,6 +53,7 @@ func Proto() error { "livekit_connector.proto", "livekit_connector_whatsapp.proto", "livekit_connector_twilio.proto", + "livekit_agent_simulation.proto", } agentProtoFiles := []string{ diff --git a/protobufs/livekit_agent_simulation.proto b/protobufs/livekit_agent_simulation.proto new file mode 100644 index 000000000..b12a15642 --- /dev/null +++ b/protobufs/livekit_agent_simulation.proto @@ -0,0 +1,33 @@ +// Copyright 2024 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; +option go_package = "github.com/livekit/protocol/livekit"; +option csharp_namespace = "LiveKit.Proto"; +option ruby_package = "LiveKit::Proto"; + +message CreateSimulationRunRequest { + string agent_name = 1; + string agent_description = 2; + int32 num_simulations = 3; +} +message CreateSimulationRunResponse { + string simulation_run_id = 1; +} + +service AgentSimulationService { + rpc CreateSimulationRun(CreateSimulationRunRequest) returns (CreateSimulationRunResponse); +} From d08dd97dbf8ebe95ce37ef29292fc1bb3fc2afa2 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 8 Feb 2026 05:45:27 +0000 Subject: [PATCH 2/8] generated protobuf --- livekit/livekit_agent_simulation.pb.go | 206 +++++++++ livekit/livekit_agent_simulation.twirp.go | 539 ++++++++++++++++++++++ 2 files changed, 745 insertions(+) create mode 100644 livekit/livekit_agent_simulation.pb.go create mode 100644 livekit/livekit_agent_simulation.twirp.go diff --git a/livekit/livekit_agent_simulation.pb.go b/livekit/livekit_agent_simulation.pb.go new file mode 100644 index 000000000..fa64f346f --- /dev/null +++ b/livekit/livekit_agent_simulation.pb.go @@ -0,0 +1,206 @@ +// Copyright 2024 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 v4.23.4 +// source: livekit_agent_simulation.proto + +package livekit + +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 CreateSimulationRunRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + AgentName string `protobuf:"bytes,1,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` + AgentDescription string `protobuf:"bytes,2,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` + NumSimulations int32 `protobuf:"varint,3,opt,name=num_simulations,json=numSimulations,proto3" json:"num_simulations,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSimulationRunRequest) Reset() { + *x = CreateSimulationRunRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSimulationRunRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSimulationRunRequest) ProtoMessage() {} + +func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateSimulationRunRequest.ProtoReflect.Descriptor instead. +func (*CreateSimulationRunRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateSimulationRunRequest) GetAgentName() string { + if x != nil { + return x.AgentName + } + return "" +} + +func (x *CreateSimulationRunRequest) GetAgentDescription() string { + if x != nil { + return x.AgentDescription + } + return "" +} + +func (x *CreateSimulationRunRequest) GetNumSimulations() int32 { + if x != nil { + return x.NumSimulations + } + return 0 +} + +type CreateSimulationRunResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + SimulationRunId string `protobuf:"bytes,1,opt,name=simulation_run_id,json=simulationRunId,proto3" json:"simulation_run_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSimulationRunResponse) Reset() { + *x = CreateSimulationRunResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSimulationRunResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSimulationRunResponse) ProtoMessage() {} + +func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateSimulationRunResponse.ProtoReflect.Descriptor instead. +func (*CreateSimulationRunResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateSimulationRunResponse) GetSimulationRunId() string { + if x != nil { + return x.SimulationRunId + } + return "" +} + +var File_livekit_agent_simulation_proto protoreflect.FileDescriptor + +const file_livekit_agent_simulation_proto_rawDesc = "" + + "\n" + + "\x1elivekit_agent_simulation.proto\x12\alivekit\"\x91\x01\n" + + "\x1aCreateSimulationRunRequest\x12\x1d\n" + + "\n" + + "agent_name\x18\x01 \x01(\tR\tagentName\x12+\n" + + "\x11agent_description\x18\x02 \x01(\tR\x10agentDescription\x12'\n" + + "\x0fnum_simulations\x18\x03 \x01(\x05R\x0enumSimulations\"I\n" + + "\x1bCreateSimulationRunResponse\x12*\n" + + "\x11simulation_run_id\x18\x01 \x01(\tR\x0fsimulationRunId2z\n" + + "\x16AgentSimulationService\x12`\n" + + "\x13CreateSimulationRun\x12#.livekit.CreateSimulationRunRequest\x1a$.livekit.CreateSimulationRunResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + +var ( + file_livekit_agent_simulation_proto_rawDescOnce sync.Once + file_livekit_agent_simulation_proto_rawDescData []byte +) + +func file_livekit_agent_simulation_proto_rawDescGZIP() []byte { + file_livekit_agent_simulation_proto_rawDescOnce.Do(func() { + file_livekit_agent_simulation_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_livekit_agent_simulation_proto_rawDesc), len(file_livekit_agent_simulation_proto_rawDesc))) + }) + return file_livekit_agent_simulation_proto_rawDescData +} + +var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_livekit_agent_simulation_proto_goTypes = []any{ + (*CreateSimulationRunRequest)(nil), // 0: livekit.CreateSimulationRunRequest + (*CreateSimulationRunResponse)(nil), // 1: livekit.CreateSimulationRunResponse +} +var file_livekit_agent_simulation_proto_depIdxs = []int32{ + 0, // 0: livekit.AgentSimulationService.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest + 1, // 1: livekit.AgentSimulationService.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_livekit_agent_simulation_proto_init() } +func file_livekit_agent_simulation_proto_init() { + if File_livekit_agent_simulation_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_livekit_agent_simulation_proto_rawDesc), len(file_livekit_agent_simulation_proto_rawDesc)), + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_livekit_agent_simulation_proto_goTypes, + DependencyIndexes: file_livekit_agent_simulation_proto_depIdxs, + MessageInfos: file_livekit_agent_simulation_proto_msgTypes, + }.Build() + File_livekit_agent_simulation_proto = out.File + file_livekit_agent_simulation_proto_goTypes = nil + file_livekit_agent_simulation_proto_depIdxs = nil +} diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go new file mode 100644 index 000000000..b9fd4bd85 --- /dev/null +++ b/livekit/livekit_agent_simulation.twirp.go @@ -0,0 +1,539 @@ +// Code generated by protoc-gen-twirp v8.1.3, DO NOT EDIT. +// source: livekit_agent_simulation.proto + +package livekit + +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" + +// 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 + +// ================================ +// AgentSimulationService Interface +// ================================ + +type AgentSimulationService interface { + CreateSimulationRun(context.Context, *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) +} + +// ====================================== +// AgentSimulationService Protobuf Client +// ====================================== + +type agentSimulationServiceProtobufClient struct { + client HTTPClient + urls [1]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentSimulationServiceProtobufClient creates a Protobuf client that implements the AgentSimulationService interface. +// It communicates using Protobuf and can be configured with a custom HTTPClient. +func NewAgentSimulationServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulationService { + 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", "AgentSimulationService") + urls := [1]string{ + serviceURL + "CreateSimulationRun", + } + + return &agentSimulationServiceProtobufClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentSimulationServiceProtobufClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + caller := c.callCreateSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return c.callCreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationServiceProtobufClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + out := new(CreateSimulationRunResponse) + 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 +} + +// ================================== +// AgentSimulationService JSON Client +// ================================== + +type agentSimulationServiceJSONClient struct { + client HTTPClient + urls [1]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentSimulationServiceJSONClient creates a JSON client that implements the AgentSimulationService interface. +// It communicates using JSON and can be configured with a custom HTTPClient. +func NewAgentSimulationServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulationService { + 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", "AgentSimulationService") + urls := [1]string{ + serviceURL + "CreateSimulationRun", + } + + return &agentSimulationServiceJSONClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentSimulationServiceJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + caller := c.callCreateSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return c.callCreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationServiceJSONClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + out := new(CreateSimulationRunResponse) + 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 +} + +// ===================================== +// AgentSimulationService Server Handler +// ===================================== + +type agentSimulationServiceServer struct { + AgentSimulationService + 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 +} + +// NewAgentSimulationServiceServer 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 NewAgentSimulationServiceServer(svc AgentSimulationService, 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 &agentSimulationServiceServer{ + AgentSimulationService: 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 *agentSimulationServiceServer) 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 *agentSimulationServiceServer) 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)) +} + +// AgentSimulationServicePathPrefix 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 AgentSimulationServicePathPrefix = "/twirp/livekit.AgentSimulationService/" + +func (s *agentSimulationServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + ctx := req.Context() + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") + 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.AgentSimulationService" { + 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 "CreateSimulationRun": + s.serveCreateSimulationRun(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 *agentSimulationServiceServer) serveCreateSimulationRun(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.serveCreateSimulationRunJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateSimulationRunProtobuf(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 *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + 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(CreateSimulationRunRequest) + 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.AgentSimulationService.CreateSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulationService.CreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateSimulationRunResponse + 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 *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. 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 *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + 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(CreateSimulationRunRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulationService.CreateSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulationService.CreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateSimulationRunResponse + 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 *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. 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 *agentSimulationServiceServer) ServiceDescriptor() ([]byte, int) { + return twirpFileDescriptor8, 0 +} + +func (s *agentSimulationServiceServer) 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 *agentSimulationServiceServer) PathPrefix() string { + return baseServicePath(s.pathPrefix, "livekit", "AgentSimulationService") +} + +var twirpFileDescriptor8 = []byte{ + // 280 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x50, 0xcd, 0x4a, 0xc3, 0x40, + 0x10, 0x26, 0x15, 0x95, 0x0e, 0xd8, 0xda, 0x15, 0x24, 0x54, 0x94, 0xd2, 0x0a, 0x16, 0x85, 0x14, + 0xf4, 0xd6, 0x9b, 0x3f, 0x08, 0x45, 0x11, 0x49, 0x6f, 0x5e, 0x62, 0x9a, 0x0c, 0x75, 0x30, 0xbb, + 0x1b, 0xb3, 0xbb, 0x39, 0xf8, 0x16, 0xbe, 0x86, 0x8f, 0xe6, 0x53, 0x48, 0x36, 0xab, 0xe9, 0xa1, + 0x7a, 0x9c, 0xef, 0x6f, 0x3e, 0x3e, 0x38, 0xca, 0xa8, 0xc4, 0x57, 0xd2, 0x51, 0xbc, 0x44, 0xa1, + 0x23, 0x45, 0xdc, 0x64, 0xb1, 0x26, 0x29, 0x82, 0xbc, 0x90, 0x5a, 0xb2, 0x6d, 0xc7, 0x0f, 0x3f, + 0x3c, 0xe8, 0x5f, 0x17, 0x18, 0x6b, 0x9c, 0xff, 0x6a, 0x42, 0x23, 0x42, 0x7c, 0x33, 0xa8, 0x34, + 0x3b, 0x04, 0xa8, 0x13, 0x44, 0xcc, 0xd1, 0xf7, 0x06, 0xde, 0xb8, 0x1d, 0xb6, 0x2d, 0xf2, 0x10, + 0x73, 0x64, 0x67, 0xd0, 0xab, 0xe9, 0x14, 0x55, 0x52, 0x50, 0x5e, 0xb9, 0xfd, 0x96, 0x55, 0xed, + 0x5a, 0xe2, 0xa6, 0xc1, 0xd9, 0x09, 0x74, 0x85, 0xe1, 0x2b, 0x5d, 0x94, 0xbf, 0x31, 0xf0, 0xc6, + 0x9b, 0x61, 0x47, 0x18, 0xde, 0x7c, 0x57, 0xc3, 0x19, 0x1c, 0xac, 0xad, 0xa4, 0x72, 0x29, 0x14, + 0xb2, 0x53, 0xe8, 0x35, 0x19, 0x51, 0x61, 0x44, 0x44, 0xa9, 0xab, 0xd6, 0x55, 0xab, 0x8e, 0x59, + 0x7a, 0xfe, 0x0e, 0xfb, 0x97, 0x55, 0x8f, 0x26, 0x69, 0x8e, 0x45, 0x49, 0x09, 0xb2, 0x67, 0xd8, + 0x5b, 0xf3, 0x84, 0x8d, 0x02, 0xb7, 0x4c, 0xf0, 0xf7, 0x2a, 0xfd, 0xe3, 0xff, 0x45, 0x75, 0xcf, + 0xab, 0xdb, 0xa7, 0xd1, 0x92, 0xf4, 0x8b, 0x59, 0x04, 0x89, 0xe4, 0x13, 0xe7, 0x98, 0xd8, 0xfd, + 0x13, 0x99, 0xfd, 0x00, 0x9f, 0xad, 0x9d, 0x7b, 0x2a, 0xf1, 0x8e, 0x74, 0xf0, 0x58, 0x51, 0x5f, + 0xad, 0x8e, 0xbb, 0xa7, 0x53, 0x0b, 0x2c, 0xb6, 0xac, 0xe5, 0xe2, 0x3b, 0x00, 0x00, 0xff, 0xff, + 0xa5, 0x43, 0x3b, 0x84, 0xd4, 0x01, 0x00, 0x00, +} From 4a7927ba7d583381ddc81b72b01b94725a886518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Tue, 10 Feb 2026 15:26:46 -0800 Subject: [PATCH 3/8] Update livekit_agent_simulation.proto --- protobufs/livekit_agent_simulation.proto | 49 +++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/protobufs/livekit_agent_simulation.proto b/protobufs/livekit_agent_simulation.proto index b12a15642..a920563b7 100644 --- a/protobufs/livekit_agent_simulation.proto +++ b/protobufs/livekit_agent_simulation.proto @@ -19,6 +19,36 @@ option go_package = "github.com/livekit/protocol/livekit"; option csharp_namespace = "LiveKit.Proto"; option ruby_package = "LiveKit::Proto"; +message SimulationRun { + enum Status { + STATUS_GENERATING = 0; + STATUS_RUNNING = 1; + STATUS_COMPLETED = 2; + STATUS_FAILED = 3; + } + + message Job { + enum Status { + STATUS_PENDING = 0; + STATUS_RUNNING = 1; + STATUS_COMPLETED = 2; + STATUS_FAILED = 3; + } + string id = 1; + Status status = 2; + string instructions = 3; + string error = 4; + } + + string id = 1; + string project_id = 2; + Status status = 3; + string agent_description = 4; + string error = 5; + int64 created_at = 6; + repeated Job jobs = 7; +} + message CreateSimulationRunRequest { string agent_name = 1; string agent_description = 2; @@ -28,6 +58,23 @@ message CreateSimulationRunResponse { string simulation_run_id = 1; } -service AgentSimulationService { +message GetSimulationRunRequest { + string project_id = 1; + string simulation_run_id = 2; +} +message GetSimulationRunResponse { + SimulationRun run = 1; +} + +message ListSimulationRunsRequest { + string project_id = 1; +} +message ListSimulationRunsResponse { + repeated SimulationRun runs = 1; +} + +service AgentSimulation { rpc CreateSimulationRun(CreateSimulationRunRequest) returns (CreateSimulationRunResponse); + rpc GetSimulationRun(GetSimulationRunRequest) returns (GetSimulationRunResponse); + rpc ListSimulationRuns(ListSimulationRunsRequest) returns (ListSimulationRunsResponse); } From 52062a4ca1e3a6c5a1cbc4b8342102c094c0c337 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 23:27:40 +0000 Subject: [PATCH 4/8] generated protobuf --- livekit/livekit_agent_simulation.pb.go | 549 +++++++++++++++- livekit/livekit_agent_simulation.twirp.go | 741 +++++++++++++++++++--- 2 files changed, 1187 insertions(+), 103 deletions(-) diff --git a/livekit/livekit_agent_simulation.pb.go b/livekit/livekit_agent_simulation.pb.go index fa64f346f..d45ac2dc2 100644 --- a/livekit/livekit_agent_simulation.pb.go +++ b/livekit/livekit_agent_simulation.pb.go @@ -35,6 +35,202 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type SimulationRun_Status int32 + +const ( + SimulationRun_STATUS_GENERATING SimulationRun_Status = 0 + SimulationRun_STATUS_RUNNING SimulationRun_Status = 1 + SimulationRun_STATUS_COMPLETED SimulationRun_Status = 2 + SimulationRun_STATUS_FAILED SimulationRun_Status = 3 +) + +// Enum value maps for SimulationRun_Status. +var ( + SimulationRun_Status_name = map[int32]string{ + 0: "STATUS_GENERATING", + 1: "STATUS_RUNNING", + 2: "STATUS_COMPLETED", + 3: "STATUS_FAILED", + } + SimulationRun_Status_value = map[string]int32{ + "STATUS_GENERATING": 0, + "STATUS_RUNNING": 1, + "STATUS_COMPLETED": 2, + "STATUS_FAILED": 3, + } +) + +func (x SimulationRun_Status) Enum() *SimulationRun_Status { + p := new(SimulationRun_Status) + *p = x + return p +} + +func (x SimulationRun_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SimulationRun_Status) Descriptor() protoreflect.EnumDescriptor { + return file_livekit_agent_simulation_proto_enumTypes[0].Descriptor() +} + +func (SimulationRun_Status) Type() protoreflect.EnumType { + return &file_livekit_agent_simulation_proto_enumTypes[0] +} + +func (x SimulationRun_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SimulationRun_Status.Descriptor instead. +func (SimulationRun_Status) EnumDescriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0} +} + +type SimulationRun_Job_Status int32 + +const ( + SimulationRun_Job_STATUS_PENDING SimulationRun_Job_Status = 0 + SimulationRun_Job_STATUS_RUNNING SimulationRun_Job_Status = 1 + SimulationRun_Job_STATUS_COMPLETED SimulationRun_Job_Status = 2 + SimulationRun_Job_STATUS_FAILED SimulationRun_Job_Status = 3 +) + +// Enum value maps for SimulationRun_Job_Status. +var ( + SimulationRun_Job_Status_name = map[int32]string{ + 0: "STATUS_PENDING", + 1: "STATUS_RUNNING", + 2: "STATUS_COMPLETED", + 3: "STATUS_FAILED", + } + SimulationRun_Job_Status_value = map[string]int32{ + "STATUS_PENDING": 0, + "STATUS_RUNNING": 1, + "STATUS_COMPLETED": 2, + "STATUS_FAILED": 3, + } +) + +func (x SimulationRun_Job_Status) Enum() *SimulationRun_Job_Status { + p := new(SimulationRun_Job_Status) + *p = x + return p +} + +func (x SimulationRun_Job_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (SimulationRun_Job_Status) Descriptor() protoreflect.EnumDescriptor { + return file_livekit_agent_simulation_proto_enumTypes[1].Descriptor() +} + +func (SimulationRun_Job_Status) Type() protoreflect.EnumType { + return &file_livekit_agent_simulation_proto_enumTypes[1] +} + +func (x SimulationRun_Job_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use SimulationRun_Job_Status.Descriptor instead. +func (SimulationRun_Job_Status) EnumDescriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0, 0} +} + +type SimulationRun struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Status SimulationRun_Status `protobuf:"varint,3,opt,name=status,proto3,enum=livekit.SimulationRun_Status" json:"status,omitempty"` + AgentDescription string `protobuf:"bytes,4,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` + Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"` + CreatedAt int64 `protobuf:"varint,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Jobs []*SimulationRun_Job `protobuf:"bytes,7,rep,name=jobs,proto3" json:"jobs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulationRun) Reset() { + *x = SimulationRun{} + mi := &file_livekit_agent_simulation_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulationRun) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulationRun) ProtoMessage() {} + +func (x *SimulationRun) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 SimulationRun.ProtoReflect.Descriptor instead. +func (*SimulationRun) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0} +} + +func (x *SimulationRun) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SimulationRun) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *SimulationRun) GetStatus() SimulationRun_Status { + if x != nil { + return x.Status + } + return SimulationRun_STATUS_GENERATING +} + +func (x *SimulationRun) GetAgentDescription() string { + if x != nil { + return x.AgentDescription + } + return "" +} + +func (x *SimulationRun) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *SimulationRun) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *SimulationRun) GetJobs() []*SimulationRun_Job { + if x != nil { + return x.Jobs + } + return nil +} + type CreateSimulationRunRequest struct { state protoimpl.MessageState `protogen:"open.v1"` AgentName string `protobuf:"bytes,1,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` @@ -46,7 +242,7 @@ type CreateSimulationRunRequest struct { func (x *CreateSimulationRunRequest) Reset() { *x = CreateSimulationRunRequest{} - mi := &file_livekit_agent_simulation_proto_msgTypes[0] + mi := &file_livekit_agent_simulation_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -58,7 +254,7 @@ func (x *CreateSimulationRunRequest) String() string { func (*CreateSimulationRunRequest) ProtoMessage() {} func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[0] + mi := &file_livekit_agent_simulation_proto_msgTypes[1] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -71,7 +267,7 @@ func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSimulationRunRequest.ProtoReflect.Descriptor instead. func (*CreateSimulationRunRequest) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} } func (x *CreateSimulationRunRequest) GetAgentName() string { @@ -104,7 +300,7 @@ type CreateSimulationRunResponse struct { func (x *CreateSimulationRunResponse) Reset() { *x = CreateSimulationRunResponse{} - mi := &file_livekit_agent_simulation_proto_msgTypes[1] + mi := &file_livekit_agent_simulation_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -116,7 +312,7 @@ func (x *CreateSimulationRunResponse) String() string { func (*CreateSimulationRunResponse) ProtoMessage() {} func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[1] + mi := &file_livekit_agent_simulation_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -129,7 +325,7 @@ func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSimulationRunResponse.ProtoReflect.Descriptor instead. func (*CreateSimulationRunResponse) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{2} } func (x *CreateSimulationRunResponse) GetSimulationRunId() string { @@ -139,20 +335,310 @@ func (x *CreateSimulationRunResponse) GetSimulationRunId() string { return "" } +type GetSimulationRunRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + SimulationRunId string `protobuf:"bytes,2,opt,name=simulation_run_id,json=simulationRunId,proto3" json:"simulation_run_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSimulationRunRequest) Reset() { + *x = GetSimulationRunRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSimulationRunRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSimulationRunRequest) ProtoMessage() {} + +func (x *GetSimulationRunRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 GetSimulationRunRequest.ProtoReflect.Descriptor instead. +func (*GetSimulationRunRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{3} +} + +func (x *GetSimulationRunRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *GetSimulationRunRequest) GetSimulationRunId() string { + if x != nil { + return x.SimulationRunId + } + return "" +} + +type GetSimulationRunResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Run *SimulationRun `protobuf:"bytes,1,opt,name=run,proto3" json:"run,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSimulationRunResponse) Reset() { + *x = GetSimulationRunResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSimulationRunResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSimulationRunResponse) ProtoMessage() {} + +func (x *GetSimulationRunResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 GetSimulationRunResponse.ProtoReflect.Descriptor instead. +func (*GetSimulationRunResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{4} +} + +func (x *GetSimulationRunResponse) GetRun() *SimulationRun { + if x != nil { + return x.Run + } + return nil +} + +type ListSimulationRunsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSimulationRunsRequest) Reset() { + *x = ListSimulationRunsRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSimulationRunsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSimulationRunsRequest) ProtoMessage() {} + +func (x *ListSimulationRunsRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 ListSimulationRunsRequest.ProtoReflect.Descriptor instead. +func (*ListSimulationRunsRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{5} +} + +func (x *ListSimulationRunsRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +type ListSimulationRunsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Runs []*SimulationRun `protobuf:"bytes,1,rep,name=runs,proto3" json:"runs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListSimulationRunsResponse) Reset() { + *x = ListSimulationRunsResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListSimulationRunsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListSimulationRunsResponse) ProtoMessage() {} + +func (x *ListSimulationRunsResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 ListSimulationRunsResponse.ProtoReflect.Descriptor instead. +func (*ListSimulationRunsResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{6} +} + +func (x *ListSimulationRunsResponse) GetRuns() []*SimulationRun { + if x != nil { + return x.Runs + } + return nil +} + +type SimulationRun_Job struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status SimulationRun_Job_Status `protobuf:"varint,2,opt,name=status,proto3,enum=livekit.SimulationRun_Job_Status" json:"status,omitempty"` + Instructions string `protobuf:"bytes,3,opt,name=instructions,proto3" json:"instructions,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulationRun_Job) Reset() { + *x = SimulationRun_Job{} + mi := &file_livekit_agent_simulation_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulationRun_Job) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulationRun_Job) ProtoMessage() {} + +func (x *SimulationRun_Job) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 SimulationRun_Job.ProtoReflect.Descriptor instead. +func (*SimulationRun_Job) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SimulationRun_Job) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SimulationRun_Job) GetStatus() SimulationRun_Job_Status { + if x != nil { + return x.Status + } + return SimulationRun_Job_STATUS_PENDING +} + +func (x *SimulationRun_Job) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *SimulationRun_Job) GetError() string { + if x != nil { + return x.Error + } + return "" +} + var File_livekit_agent_simulation_proto protoreflect.FileDescriptor const file_livekit_agent_simulation_proto_rawDesc = "" + "\n" + - "\x1elivekit_agent_simulation.proto\x12\alivekit\"\x91\x01\n" + + "\x1elivekit_agent_simulation.proto\x12\alivekit\"\xcd\x04\n" + + "\rSimulationRun\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "project_id\x18\x02 \x01(\tR\tprojectId\x125\n" + + "\x06status\x18\x03 \x01(\x0e2\x1d.livekit.SimulationRun.StatusR\x06status\x12+\n" + + "\x11agent_description\x18\x04 \x01(\tR\x10agentDescription\x12\x14\n" + + "\x05error\x18\x05 \x01(\tR\x05error\x12\x1d\n" + + "\n" + + "created_at\x18\x06 \x01(\x03R\tcreatedAt\x12.\n" + + "\x04jobs\x18\a \x03(\v2\x1a.livekit.SimulationRun.JobR\x04jobs\x1a\xe5\x01\n" + + "\x03Job\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x129\n" + + "\x06status\x18\x02 \x01(\x0e2!.livekit.SimulationRun.Job.StatusR\x06status\x12\"\n" + + "\finstructions\x18\x03 \x01(\tR\finstructions\x12\x14\n" + + "\x05error\x18\x04 \x01(\tR\x05error\"Y\n" + + "\x06Status\x12\x12\n" + + "\x0eSTATUS_PENDING\x10\x00\x12\x12\n" + + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + + "\x10STATUS_COMPLETED\x10\x02\x12\x11\n" + + "\rSTATUS_FAILED\x10\x03\"\\\n" + + "\x06Status\x12\x15\n" + + "\x11STATUS_GENERATING\x10\x00\x12\x12\n" + + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + + "\x10STATUS_COMPLETED\x10\x02\x12\x11\n" + + "\rSTATUS_FAILED\x10\x03\"\x91\x01\n" + "\x1aCreateSimulationRunRequest\x12\x1d\n" + "\n" + "agent_name\x18\x01 \x01(\tR\tagentName\x12+\n" + "\x11agent_description\x18\x02 \x01(\tR\x10agentDescription\x12'\n" + "\x0fnum_simulations\x18\x03 \x01(\x05R\x0enumSimulations\"I\n" + "\x1bCreateSimulationRunResponse\x12*\n" + - "\x11simulation_run_id\x18\x01 \x01(\tR\x0fsimulationRunId2z\n" + - "\x16AgentSimulationService\x12`\n" + - "\x13CreateSimulationRun\x12#.livekit.CreateSimulationRunRequest\x1a$.livekit.CreateSimulationRunResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + "\x11simulation_run_id\x18\x01 \x01(\tR\x0fsimulationRunId\"d\n" + + "\x17GetSimulationRunRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12*\n" + + "\x11simulation_run_id\x18\x02 \x01(\tR\x0fsimulationRunId\"D\n" + + "\x18GetSimulationRunResponse\x12(\n" + + "\x03run\x18\x01 \x01(\v2\x16.livekit.SimulationRunR\x03run\":\n" + + "\x19ListSimulationRunsRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\"H\n" + + "\x1aListSimulationRunsResponse\x12*\n" + + "\x04runs\x18\x01 \x03(\v2\x16.livekit.SimulationRunR\x04runs2\xab\x02\n" + + "\x0fAgentSimulation\x12`\n" + + "\x13CreateSimulationRun\x12#.livekit.CreateSimulationRunRequest\x1a$.livekit.CreateSimulationRunResponse\x12W\n" + + "\x10GetSimulationRun\x12 .livekit.GetSimulationRunRequest\x1a!.livekit.GetSimulationRunResponse\x12]\n" + + "\x12ListSimulationRuns\x12\".livekit.ListSimulationRunsRequest\x1a#.livekit.ListSimulationRunsResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" var ( file_livekit_agent_simulation_proto_rawDescOnce sync.Once @@ -166,19 +652,37 @@ func file_livekit_agent_simulation_proto_rawDescGZIP() []byte { return file_livekit_agent_simulation_proto_rawDescData } -var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_livekit_agent_simulation_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_livekit_agent_simulation_proto_goTypes = []any{ - (*CreateSimulationRunRequest)(nil), // 0: livekit.CreateSimulationRunRequest - (*CreateSimulationRunResponse)(nil), // 1: livekit.CreateSimulationRunResponse + (SimulationRun_Status)(0), // 0: livekit.SimulationRun.Status + (SimulationRun_Job_Status)(0), // 1: livekit.SimulationRun.Job.Status + (*SimulationRun)(nil), // 2: livekit.SimulationRun + (*CreateSimulationRunRequest)(nil), // 3: livekit.CreateSimulationRunRequest + (*CreateSimulationRunResponse)(nil), // 4: livekit.CreateSimulationRunResponse + (*GetSimulationRunRequest)(nil), // 5: livekit.GetSimulationRunRequest + (*GetSimulationRunResponse)(nil), // 6: livekit.GetSimulationRunResponse + (*ListSimulationRunsRequest)(nil), // 7: livekit.ListSimulationRunsRequest + (*ListSimulationRunsResponse)(nil), // 8: livekit.ListSimulationRunsResponse + (*SimulationRun_Job)(nil), // 9: livekit.SimulationRun.Job } var file_livekit_agent_simulation_proto_depIdxs = []int32{ - 0, // 0: livekit.AgentSimulationService.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest - 1, // 1: livekit.AgentSimulationService.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: livekit.SimulationRun.status:type_name -> livekit.SimulationRun.Status + 9, // 1: livekit.SimulationRun.jobs:type_name -> livekit.SimulationRun.Job + 2, // 2: livekit.GetSimulationRunResponse.run:type_name -> livekit.SimulationRun + 2, // 3: livekit.ListSimulationRunsResponse.runs:type_name -> livekit.SimulationRun + 1, // 4: livekit.SimulationRun.Job.status:type_name -> livekit.SimulationRun.Job.Status + 3, // 5: livekit.AgentSimulation.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest + 5, // 6: livekit.AgentSimulation.GetSimulationRun:input_type -> livekit.GetSimulationRunRequest + 7, // 7: livekit.AgentSimulation.ListSimulationRuns:input_type -> livekit.ListSimulationRunsRequest + 4, // 8: livekit.AgentSimulation.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse + 6, // 9: livekit.AgentSimulation.GetSimulationRun:output_type -> livekit.GetSimulationRunResponse + 8, // 10: livekit.AgentSimulation.ListSimulationRuns:output_type -> livekit.ListSimulationRunsResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_livekit_agent_simulation_proto_init() } @@ -191,13 +695,14 @@ func file_livekit_agent_simulation_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_livekit_agent_simulation_proto_rawDesc), len(file_livekit_agent_simulation_proto_rawDesc)), - NumEnums: 0, - NumMessages: 2, + NumEnums: 2, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, GoTypes: file_livekit_agent_simulation_proto_goTypes, DependencyIndexes: file_livekit_agent_simulation_proto_depIdxs, + EnumInfos: file_livekit_agent_simulation_proto_enumTypes, MessageInfos: file_livekit_agent_simulation_proto_msgTypes, }.Build() File_livekit_agent_simulation_proto = out.File diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go index b9fd4bd85..534dac367 100644 --- a/livekit/livekit_agent_simulation.twirp.go +++ b/livekit/livekit_agent_simulation.twirp.go @@ -22,28 +22,32 @@ import ctxsetters "github.com/twitchtv/twirp/ctxsetters" // See https://twitchtv.github.io/twirp/docs/version_matrix.html const _ = twirp.TwirpPackageMinVersion_8_1_0 -// ================================ -// AgentSimulationService Interface -// ================================ +// ========================= +// AgentSimulation Interface +// ========================= -type AgentSimulationService interface { +type AgentSimulation interface { CreateSimulationRun(context.Context, *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) + + GetSimulationRun(context.Context, *GetSimulationRunRequest) (*GetSimulationRunResponse, error) + + ListSimulationRuns(context.Context, *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) } -// ====================================== -// AgentSimulationService Protobuf Client -// ====================================== +// =============================== +// AgentSimulation Protobuf Client +// =============================== -type agentSimulationServiceProtobufClient struct { +type agentSimulationProtobufClient struct { client HTTPClient - urls [1]string + urls [3]string interceptor twirp.Interceptor opts twirp.ClientOptions } -// NewAgentSimulationServiceProtobufClient creates a Protobuf client that implements the AgentSimulationService interface. +// NewAgentSimulationProtobufClient creates a Protobuf client that implements the AgentSimulation interface. // It communicates using Protobuf and can be configured with a custom HTTPClient. -func NewAgentSimulationServiceProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulationService { +func NewAgentSimulationProtobufClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { if c, ok := client.(*http.Client); ok { client = withoutRedirects(c) } @@ -63,12 +67,14 @@ func NewAgentSimulationServiceProtobufClient(baseURL string, client HTTPClient, // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulationService") - urls := [1]string{ + serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") + urls := [3]string{ serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", } - return &agentSimulationServiceProtobufClient{ + return &agentSimulationProtobufClient{ client: client, urls: urls, interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), @@ -76,9 +82,9 @@ func NewAgentSimulationServiceProtobufClient(baseURL string, client HTTPClient, } } -func (c *agentSimulationServiceProtobufClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { +func (c *agentSimulationProtobufClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") caller := c.callCreateSimulationRun if c.interceptor != nil { @@ -105,7 +111,7 @@ func (c *agentSimulationServiceProtobufClient) CreateSimulationRun(ctx context.C return caller(ctx, in) } -func (c *agentSimulationServiceProtobufClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { +func (c *agentSimulationProtobufClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { out := new(CreateSimulationRunResponse) ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) if err != nil { @@ -122,20 +128,112 @@ func (c *agentSimulationServiceProtobufClient) callCreateSimulationRun(ctx conte return out, nil } -// ================================== -// AgentSimulationService JSON Client -// ================================== +func (c *agentSimulationProtobufClient) GetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + caller := c.callGetSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return c.callGetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callGetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + out := new(GetSimulationRunResponse) + 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 *agentSimulationProtobufClient) ListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + caller := c.callListSimulationRuns + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return c.callListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} -type agentSimulationServiceJSONClient struct { +func (c *agentSimulationProtobufClient) callListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + out := new(ListSimulationRunsResponse) + 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 +} + +// =========================== +// AgentSimulation JSON Client +// =========================== + +type agentSimulationJSONClient struct { client HTTPClient - urls [1]string + urls [3]string interceptor twirp.Interceptor opts twirp.ClientOptions } -// NewAgentSimulationServiceJSONClient creates a JSON client that implements the AgentSimulationService interface. +// NewAgentSimulationJSONClient creates a JSON client that implements the AgentSimulation interface. // It communicates using JSON and can be configured with a custom HTTPClient. -func NewAgentSimulationServiceJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulationService { +func NewAgentSimulationJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { if c, ok := client.(*http.Client); ok { client = withoutRedirects(c) } @@ -155,12 +253,14 @@ func NewAgentSimulationServiceJSONClient(baseURL string, client HTTPClient, opts // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulationService") - urls := [1]string{ + serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") + urls := [3]string{ serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", } - return &agentSimulationServiceJSONClient{ + return &agentSimulationJSONClient{ client: client, urls: urls, interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), @@ -168,9 +268,9 @@ func NewAgentSimulationServiceJSONClient(baseURL string, client HTTPClient, opts } } -func (c *agentSimulationServiceJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { +func (c *agentSimulationJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") caller := c.callCreateSimulationRun if c.interceptor != nil { @@ -197,7 +297,7 @@ func (c *agentSimulationServiceJSONClient) CreateSimulationRun(ctx context.Conte return caller(ctx, in) } -func (c *agentSimulationServiceJSONClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { +func (c *agentSimulationJSONClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { out := new(CreateSimulationRunResponse) ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) if err != nil { @@ -214,12 +314,104 @@ func (c *agentSimulationServiceJSONClient) callCreateSimulationRun(ctx context.C return out, nil } -// ===================================== -// AgentSimulationService Server Handler -// ===================================== +func (c *agentSimulationJSONClient) GetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + caller := c.callGetSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return c.callGetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callGetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + out := new(GetSimulationRunResponse) + 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 + } -type agentSimulationServiceServer struct { - AgentSimulationService + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationJSONClient) ListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + caller := c.callListSimulationRuns + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return c.callListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + out := new(ListSimulationRunsResponse) + 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 +} + +// ============================== +// AgentSimulation Server Handler +// ============================== + +type agentSimulationServer struct { + AgentSimulation interceptor twirp.Interceptor hooks *twirp.ServerHooks pathPrefix string // prefix for routing @@ -227,10 +419,10 @@ type agentSimulationServiceServer struct { jsonCamelCase bool // JSON fields are serialized as lowerCamelCase rather than keeping the original proto names } -// NewAgentSimulationServiceServer builds a TwirpServer that can be used as an http.Handler to handle +// NewAgentSimulationServer 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 NewAgentSimulationServiceServer(svc AgentSimulationService, opts ...interface{}) TwirpServer { +func NewAgentSimulationServer(svc AgentSimulation, opts ...interface{}) TwirpServer { serverOpts := newServerOpts(opts) // Using ReadOpt allows backwards and forwards compatibility with new options in the future @@ -243,24 +435,24 @@ func NewAgentSimulationServiceServer(svc AgentSimulationService, opts ...interfa pathPrefix = "/twirp" // default prefix } - return &agentSimulationServiceServer{ - AgentSimulationService: svc, - hooks: serverOpts.Hooks, - interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), - pathPrefix: pathPrefix, - jsonSkipDefaults: jsonSkipDefaults, - jsonCamelCase: jsonCamelCase, + return &agentSimulationServer{ + AgentSimulation: 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 *agentSimulationServiceServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { +func (s *agentSimulationServer) 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 *agentSimulationServiceServer) handleRequestBodyError(ctx context.Context, resp http.ResponseWriter, msg string, err error) { +func (s *agentSimulationServer) 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 @@ -272,16 +464,16 @@ func (s *agentSimulationServiceServer) handleRequestBodyError(ctx context.Contex s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) } -// AgentSimulationServicePathPrefix is a convenience constant that may identify URL paths. +// AgentSimulationPathPrefix 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 AgentSimulationServicePathPrefix = "/twirp/livekit.AgentSimulationService/" +const AgentSimulationPathPrefix = "/twirp/livekit.AgentSimulation/" -func (s *agentSimulationServiceServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { ctx := req.Context() ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulationService") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") ctx = ctxsetters.WithResponseWriter(ctx, resp) var err error @@ -299,7 +491,7 @@ func (s *agentSimulationServiceServer) ServeHTTP(resp http.ResponseWriter, req * // Verify path format: []/./ prefix, pkgService, method := parseTwirpPath(req.URL.Path) - if pkgService != "livekit.AgentSimulationService" { + if pkgService != "livekit.AgentSimulation" { msg := fmt.Sprintf("no handler for path %q", req.URL.Path) s.writeError(ctx, resp, badRouteError(msg, req.Method, req.URL.Path)) return @@ -314,6 +506,12 @@ func (s *agentSimulationServiceServer) ServeHTTP(resp http.ResponseWriter, req * case "CreateSimulationRun": s.serveCreateSimulationRun(ctx, resp, req) return + case "GetSimulationRun": + s.serveGetSimulationRun(ctx, resp, req) + return + case "ListSimulationRuns": + s.serveListSimulationRuns(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)) @@ -321,7 +519,7 @@ func (s *agentSimulationServiceServer) ServeHTTP(resp http.ResponseWriter, req * } } -func (s *agentSimulationServiceServer) serveCreateSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveCreateSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") if i == -1 { @@ -339,7 +537,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRun(ctx context.Cont } } -func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") ctx, err = callRequestRouted(ctx, s.hooks) @@ -361,7 +559,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. return } - handler := s.AgentSimulationService.CreateSimulationRun + handler := s.AgentSimulation.CreateSimulationRun if s.interceptor != nil { handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { resp, err := s.interceptor( @@ -370,7 +568,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. if !ok { return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") } - return s.AgentSimulationService.CreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) }, )(ctx, req) if resp != nil { @@ -422,7 +620,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunJSON(ctx context. callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") ctx, err = callRequestRouted(ctx, s.hooks) @@ -442,7 +640,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont return } - handler := s.AgentSimulationService.CreateSimulationRun + handler := s.AgentSimulation.CreateSimulationRun if s.interceptor != nil { handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { resp, err := s.interceptor( @@ -451,7 +649,7 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont if !ok { return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") } - return s.AgentSimulationService.CreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) }, )(ctx, req) if resp != nil { @@ -501,39 +699,420 @@ func (s *agentSimulationServiceServer) serveCreateSimulationRunProtobuf(ctx cont callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServiceServer) ServiceDescriptor() ([]byte, int) { +func (s *agentSimulationServer) serveGetSimulationRun(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.serveGetSimulationRunJSON(ctx, resp, req) + case "application/protobuf": + s.serveGetSimulationRunProtobuf(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 *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + 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(GetSimulationRunRequest) + 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.AgentSimulation.GetSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetSimulationRunResponse + 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 *GetSimulationRunResponse and nil error while calling GetSimulationRun. 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 *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + 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(GetSimulationRunRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.GetSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetSimulationRunResponse + 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 *GetSimulationRunResponse and nil error while calling GetSimulationRun. 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 *agentSimulationServer) serveListSimulationRuns(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.serveListSimulationRunsJSON(ctx, resp, req) + case "application/protobuf": + s.serveListSimulationRunsProtobuf(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 *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + 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(ListSimulationRunsRequest) + 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.AgentSimulation.ListSimulationRuns + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSimulationRunsResponse + 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 *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. 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 *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + 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(ListSimulationRunsRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.ListSimulationRuns + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSimulationRunsResponse + 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 *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. 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 *agentSimulationServer) ServiceDescriptor() ([]byte, int) { return twirpFileDescriptor8, 0 } -func (s *agentSimulationServiceServer) ProtocGenTwirpVersion() string { +func (s *agentSimulationServer) 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 *agentSimulationServiceServer) PathPrefix() string { - return baseServicePath(s.pathPrefix, "livekit", "AgentSimulationService") +func (s *agentSimulationServer) PathPrefix() string { + return baseServicePath(s.pathPrefix, "livekit", "AgentSimulation") } var twirpFileDescriptor8 = []byte{ - // 280 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x50, 0xcd, 0x4a, 0xc3, 0x40, - 0x10, 0x26, 0x15, 0x95, 0x0e, 0xd8, 0xda, 0x15, 0x24, 0x54, 0x94, 0xd2, 0x0a, 0x16, 0x85, 0x14, - 0xf4, 0xd6, 0x9b, 0x3f, 0x08, 0x45, 0x11, 0x49, 0x6f, 0x5e, 0x62, 0x9a, 0x0c, 0x75, 0x30, 0xbb, - 0x1b, 0xb3, 0xbb, 0x39, 0xf8, 0x16, 0xbe, 0x86, 0x8f, 0xe6, 0x53, 0x48, 0x36, 0xab, 0xe9, 0xa1, - 0x7a, 0x9c, 0xef, 0x6f, 0x3e, 0x3e, 0x38, 0xca, 0xa8, 0xc4, 0x57, 0xd2, 0x51, 0xbc, 0x44, 0xa1, - 0x23, 0x45, 0xdc, 0x64, 0xb1, 0x26, 0x29, 0x82, 0xbc, 0x90, 0x5a, 0xb2, 0x6d, 0xc7, 0x0f, 0x3f, - 0x3c, 0xe8, 0x5f, 0x17, 0x18, 0x6b, 0x9c, 0xff, 0x6a, 0x42, 0x23, 0x42, 0x7c, 0x33, 0xa8, 0x34, - 0x3b, 0x04, 0xa8, 0x13, 0x44, 0xcc, 0xd1, 0xf7, 0x06, 0xde, 0xb8, 0x1d, 0xb6, 0x2d, 0xf2, 0x10, - 0x73, 0x64, 0x67, 0xd0, 0xab, 0xe9, 0x14, 0x55, 0x52, 0x50, 0x5e, 0xb9, 0xfd, 0x96, 0x55, 0xed, - 0x5a, 0xe2, 0xa6, 0xc1, 0xd9, 0x09, 0x74, 0x85, 0xe1, 0x2b, 0x5d, 0x94, 0xbf, 0x31, 0xf0, 0xc6, - 0x9b, 0x61, 0x47, 0x18, 0xde, 0x7c, 0x57, 0xc3, 0x19, 0x1c, 0xac, 0xad, 0xa4, 0x72, 0x29, 0x14, - 0xb2, 0x53, 0xe8, 0x35, 0x19, 0x51, 0x61, 0x44, 0x44, 0xa9, 0xab, 0xd6, 0x55, 0xab, 0x8e, 0x59, - 0x7a, 0xfe, 0x0e, 0xfb, 0x97, 0x55, 0x8f, 0x26, 0x69, 0x8e, 0x45, 0x49, 0x09, 0xb2, 0x67, 0xd8, - 0x5b, 0xf3, 0x84, 0x8d, 0x02, 0xb7, 0x4c, 0xf0, 0xf7, 0x2a, 0xfd, 0xe3, 0xff, 0x45, 0x75, 0xcf, - 0xab, 0xdb, 0xa7, 0xd1, 0x92, 0xf4, 0x8b, 0x59, 0x04, 0x89, 0xe4, 0x13, 0xe7, 0x98, 0xd8, 0xfd, - 0x13, 0x99, 0xfd, 0x00, 0x9f, 0xad, 0x9d, 0x7b, 0x2a, 0xf1, 0x8e, 0x74, 0xf0, 0x58, 0x51, 0x5f, - 0xad, 0x8e, 0xbb, 0xa7, 0x53, 0x0b, 0x2c, 0xb6, 0xac, 0xe5, 0xe2, 0x3b, 0x00, 0x00, 0xff, 0xff, - 0xa5, 0x43, 0x3b, 0x84, 0xd4, 0x01, 0x00, 0x00, + // 614 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x51, 0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 0x13, 0xd3, 0x8f, 0xc3, 0x7d, 0x91, 0xb0, 0xcf, 0xff, 0xd9, 0x7e, 0x7c, 0xf9, 0x17, + 0xf8, 0x2e, 0x6f, 0x0e, 0xc9, 0x15, 0x7e, 0x45, 0x98, 0x79, 0x9a, 0x85, 0x7e, 0xcb, 0x4d, 0xf1, + 0x7d, 0x70, 0xc0, 0x81, 0x49, 0x9d, 0xa7, 0x3c, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0x13, 0x6c, + 0x92, 0x7e, 0x08, 0x06, 0x00, 0x00, } From 0c419ce95c84f7b7955f768d214fc5577988d936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Wed, 18 Feb 2026 13:11:14 -0800 Subject: [PATCH 5/8] add Simulation scenarios (#1417) --- protobufs/livekit_agent_simulation.proto | 121 ++++++++++++++++++++++- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/protobufs/livekit_agent_simulation.proto b/protobufs/livekit_agent_simulation.proto index a920563b7..e1a54c2c4 100644 --- a/protobufs/livekit_agent_simulation.proto +++ b/protobufs/livekit_agent_simulation.proto @@ -49,10 +49,43 @@ message SimulationRun { repeated Job jobs = 7; } +message Scenario { + enum Status { + // Scenario is being generated from a session by an LLM. + // instructions and agent_expectations are not yet available. + STATUS_GENERATING = 0; + STATUS_READY = 1; + STATUS_FAILED = 2; + } + string id = 1; + string project_id = 2; + string label = 3; + string instructions = 4; + string agent_expectations = 5; + string source_room_id = 6; + int64 created_at = 7; + Status status = 8; + string error = 9; + string group_id = 10; + // Set as participant attributes on the simulation participant's access token. + map metadata = 11; +} + +message ScenarioGroup { + string id = 1; + string project_id = 2; + string label = 3; + int64 created_at = 4; + repeated Scenario scenarios = 5; +} + message CreateSimulationRunRequest { - string agent_name = 1; - string agent_description = 2; - int32 num_simulations = 3; + string project_id = 1; + string agent_name = 2; + string agent_description = 3; + int32 num_simulations = 4; + string group_id = 5; + string region = 6; } message CreateSimulationRunResponse { string simulation_run_id = 1; @@ -73,8 +106,90 @@ message ListSimulationRunsResponse { repeated SimulationRun runs = 1; } +message CreateScenarioRequest { + string project_id = 1; + string label = 2; + string instructions = 3; + string agent_expectations = 4; + string group_id = 5; + map metadata = 6; +} +message CreateScenarioResponse { + Scenario scenario = 1; +} + +message CreateScenarioFromSessionRequest { + string project_id = 1; + string room_id = 2; + string group_id = 3; + string label = 4; + string region = 5; +} +message CreateScenarioFromSessionResponse { + Scenario scenario = 1; +} + +message DeleteScenarioRequest { + string project_id = 1; + string scenario_id = 2; +} +message DeleteScenarioResponse {} + +message UpdateScenarioRequest { + string project_id = 1; + string scenario_id = 2; + string label = 3; + string instructions = 4; + string agent_expectations = 5; + string group_id = 6; + map metadata = 7; +} +message UpdateScenarioResponse { + Scenario scenario = 1; +} + +message CreateScenarioGroupRequest { + string project_id = 1; + string label = 2; +} +message CreateScenarioGroupResponse { + ScenarioGroup scenario_group = 1; +} + +message DeleteScenarioGroupRequest { + string project_id = 1; + string group_id = 2; +} +message DeleteScenarioGroupResponse {} + +message ListScenarioGroupsRequest { + string project_id = 1; +} +message ListScenarioGroupsResponse { + repeated ScenarioGroup scenario_groups = 1; +} + +message ListScenariosRequest { + string project_id = 1; + string group_id = 2; +} +message ListScenariosResponse { + repeated Scenario scenarios = 1; +} + service AgentSimulation { rpc CreateSimulationRun(CreateSimulationRunRequest) returns (CreateSimulationRunResponse); rpc GetSimulationRun(GetSimulationRunRequest) returns (GetSimulationRunResponse); rpc ListSimulationRuns(ListSimulationRunsRequest) returns (ListSimulationRunsResponse); + + rpc CreateScenario(CreateScenarioRequest) returns (CreateScenarioResponse); + rpc CreateScenarioFromSession(CreateScenarioFromSessionRequest) returns (CreateScenarioFromSessionResponse); + rpc DeleteScenario(DeleteScenarioRequest) returns (DeleteScenarioResponse); + rpc UpdateScenario(UpdateScenarioRequest) returns (UpdateScenarioResponse); + + rpc CreateScenarioGroup(CreateScenarioGroupRequest) returns (CreateScenarioGroupResponse); + rpc DeleteScenarioGroup(DeleteScenarioGroupRequest) returns (DeleteScenarioGroupResponse); + rpc ListScenarioGroups(ListScenarioGroupsRequest) returns (ListScenarioGroupsResponse); + + rpc ListScenarios(ListScenariosRequest) returns (ListScenariosResponse); } From b04fce3eb259492c85c20b6e35bb36ee212395b3 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 21:12:24 +0000 Subject: [PATCH 6/8] generated protobuf --- livekit/livekit_agent_simulation.pb.go | 1450 ++++++++++- livekit/livekit_agent_simulation.twirp.go | 2856 ++++++++++++++++++--- 2 files changed, 3925 insertions(+), 381 deletions(-) diff --git a/livekit/livekit_agent_simulation.pb.go b/livekit/livekit_agent_simulation.pb.go index d45ac2dc2..9b95e06a8 100644 --- a/livekit/livekit_agent_simulation.pb.go +++ b/livekit/livekit_agent_simulation.pb.go @@ -139,6 +139,57 @@ func (SimulationRun_Job_Status) EnumDescriptor() ([]byte, []int) { return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0, 0} } +type Scenario_Status int32 + +const ( + // Scenario is being generated from a session by an LLM. + // instructions and agent_expectations are not yet available. + Scenario_STATUS_GENERATING Scenario_Status = 0 + Scenario_STATUS_READY Scenario_Status = 1 + Scenario_STATUS_FAILED Scenario_Status = 2 +) + +// Enum value maps for Scenario_Status. +var ( + Scenario_Status_name = map[int32]string{ + 0: "STATUS_GENERATING", + 1: "STATUS_READY", + 2: "STATUS_FAILED", + } + Scenario_Status_value = map[string]int32{ + "STATUS_GENERATING": 0, + "STATUS_READY": 1, + "STATUS_FAILED": 2, + } +) + +func (x Scenario_Status) Enum() *Scenario_Status { + p := new(Scenario_Status) + *p = x + return p +} + +func (x Scenario_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Scenario_Status) Descriptor() protoreflect.EnumDescriptor { + return file_livekit_agent_simulation_proto_enumTypes[2].Descriptor() +} + +func (Scenario_Status) Type() protoreflect.EnumType { + return &file_livekit_agent_simulation_proto_enumTypes[2] +} + +func (x Scenario_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Scenario_Status.Descriptor instead. +func (Scenario_Status) EnumDescriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1, 0} +} + type SimulationRun struct { state protoimpl.MessageState `protogen:"open.v1"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` @@ -231,18 +282,222 @@ func (x *SimulationRun) GetJobs() []*SimulationRun_Job { return nil } +type Scenario struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + Instructions string `protobuf:"bytes,4,opt,name=instructions,proto3" json:"instructions,omitempty"` + AgentExpectations string `protobuf:"bytes,5,opt,name=agent_expectations,json=agentExpectations,proto3" json:"agent_expectations,omitempty"` + SourceRoomId string `protobuf:"bytes,6,opt,name=source_room_id,json=sourceRoomId,proto3" json:"source_room_id,omitempty"` + CreatedAt int64 `protobuf:"varint,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Status Scenario_Status `protobuf:"varint,8,opt,name=status,proto3,enum=livekit.Scenario_Status" json:"status,omitempty"` + Error string `protobuf:"bytes,9,opt,name=error,proto3" json:"error,omitempty"` + GroupId string `protobuf:"bytes,10,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + // Set as participant attributes on the simulation participant's access token. + Metadata map[string]string `protobuf:"bytes,11,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Scenario) Reset() { + *x = Scenario{} + mi := &file_livekit_agent_simulation_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Scenario) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Scenario) ProtoMessage() {} + +func (x *Scenario) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 Scenario.ProtoReflect.Descriptor instead. +func (*Scenario) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} +} + +func (x *Scenario) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *Scenario) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *Scenario) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *Scenario) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *Scenario) GetAgentExpectations() string { + if x != nil { + return x.AgentExpectations + } + return "" +} + +func (x *Scenario) GetSourceRoomId() string { + if x != nil { + return x.SourceRoomId + } + return "" +} + +func (x *Scenario) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *Scenario) GetStatus() Scenario_Status { + if x != nil { + return x.Status + } + return Scenario_STATUS_GENERATING +} + +func (x *Scenario) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +func (x *Scenario) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *Scenario) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type ScenarioGroup struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ProjectId string `protobuf:"bytes,2,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + Scenarios []*Scenario `protobuf:"bytes,5,rep,name=scenarios,proto3" json:"scenarios,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ScenarioGroup) Reset() { + *x = ScenarioGroup{} + mi := &file_livekit_agent_simulation_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ScenarioGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ScenarioGroup) ProtoMessage() {} + +func (x *ScenarioGroup) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 ScenarioGroup.ProtoReflect.Descriptor instead. +func (*ScenarioGroup) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{2} +} + +func (x *ScenarioGroup) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ScenarioGroup) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *ScenarioGroup) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *ScenarioGroup) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *ScenarioGroup) GetScenarios() []*Scenario { + if x != nil { + return x.Scenarios + } + return nil +} + type CreateSimulationRunRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - AgentName string `protobuf:"bytes,1,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` - AgentDescription string `protobuf:"bytes,2,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` - NumSimulations int32 `protobuf:"varint,3,opt,name=num_simulations,json=numSimulations,proto3" json:"num_simulations,omitempty"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + AgentName string `protobuf:"bytes,2,opt,name=agent_name,json=agentName,proto3" json:"agent_name,omitempty"` + AgentDescription string `protobuf:"bytes,3,opt,name=agent_description,json=agentDescription,proto3" json:"agent_description,omitempty"` + NumSimulations int32 `protobuf:"varint,4,opt,name=num_simulations,json=numSimulations,proto3" json:"num_simulations,omitempty"` + GroupId string `protobuf:"bytes,5,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Region string `protobuf:"bytes,6,opt,name=region,proto3" json:"region,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } func (x *CreateSimulationRunRequest) Reset() { *x = CreateSimulationRunRequest{} - mi := &file_livekit_agent_simulation_proto_msgTypes[1] + mi := &file_livekit_agent_simulation_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -254,7 +509,7 @@ func (x *CreateSimulationRunRequest) String() string { func (*CreateSimulationRunRequest) ProtoMessage() {} func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[1] + mi := &file_livekit_agent_simulation_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -267,7 +522,14 @@ func (x *CreateSimulationRunRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSimulationRunRequest.ProtoReflect.Descriptor instead. func (*CreateSimulationRunRequest) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{1} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateSimulationRunRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" } func (x *CreateSimulationRunRequest) GetAgentName() string { @@ -291,6 +553,20 @@ func (x *CreateSimulationRunRequest) GetNumSimulations() int32 { return 0 } +func (x *CreateSimulationRunRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *CreateSimulationRunRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + type CreateSimulationRunResponse struct { state protoimpl.MessageState `protogen:"open.v1"` SimulationRunId string `protobuf:"bytes,1,opt,name=simulation_run_id,json=simulationRunId,proto3" json:"simulation_run_id,omitempty"` @@ -300,7 +576,7 @@ type CreateSimulationRunResponse struct { func (x *CreateSimulationRunResponse) Reset() { *x = CreateSimulationRunResponse{} - mi := &file_livekit_agent_simulation_proto_msgTypes[2] + mi := &file_livekit_agent_simulation_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -312,7 +588,7 @@ func (x *CreateSimulationRunResponse) String() string { func (*CreateSimulationRunResponse) ProtoMessage() {} func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[2] + mi := &file_livekit_agent_simulation_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -325,7 +601,7 @@ func (x *CreateSimulationRunResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateSimulationRunResponse.ProtoReflect.Descriptor instead. func (*CreateSimulationRunResponse) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{2} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{4} } func (x *CreateSimulationRunResponse) GetSimulationRunId() string { @@ -345,7 +621,7 @@ type GetSimulationRunRequest struct { func (x *GetSimulationRunRequest) Reset() { *x = GetSimulationRunRequest{} - mi := &file_livekit_agent_simulation_proto_msgTypes[3] + mi := &file_livekit_agent_simulation_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -357,7 +633,7 @@ func (x *GetSimulationRunRequest) String() string { func (*GetSimulationRunRequest) ProtoMessage() {} func (x *GetSimulationRunRequest) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[3] + mi := &file_livekit_agent_simulation_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -370,7 +646,7 @@ func (x *GetSimulationRunRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSimulationRunRequest.ProtoReflect.Descriptor instead. func (*GetSimulationRunRequest) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{3} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{5} } func (x *GetSimulationRunRequest) GetProjectId() string { @@ -396,7 +672,7 @@ type GetSimulationRunResponse struct { func (x *GetSimulationRunResponse) Reset() { *x = GetSimulationRunResponse{} - mi := &file_livekit_agent_simulation_proto_msgTypes[4] + mi := &file_livekit_agent_simulation_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -408,7 +684,7 @@ func (x *GetSimulationRunResponse) String() string { func (*GetSimulationRunResponse) ProtoMessage() {} func (x *GetSimulationRunResponse) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[4] + mi := &file_livekit_agent_simulation_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -421,7 +697,7 @@ func (x *GetSimulationRunResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetSimulationRunResponse.ProtoReflect.Descriptor instead. func (*GetSimulationRunResponse) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{4} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{6} } func (x *GetSimulationRunResponse) GetRun() *SimulationRun { @@ -440,7 +716,7 @@ type ListSimulationRunsRequest struct { func (x *ListSimulationRunsRequest) Reset() { *x = ListSimulationRunsRequest{} - mi := &file_livekit_agent_simulation_proto_msgTypes[5] + mi := &file_livekit_agent_simulation_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -452,7 +728,7 @@ func (x *ListSimulationRunsRequest) String() string { func (*ListSimulationRunsRequest) ProtoMessage() {} func (x *ListSimulationRunsRequest) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[5] + mi := &file_livekit_agent_simulation_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -465,7 +741,7 @@ func (x *ListSimulationRunsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSimulationRunsRequest.ProtoReflect.Descriptor instead. func (*ListSimulationRunsRequest) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{5} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{7} } func (x *ListSimulationRunsRequest) GetProjectId() string { @@ -484,7 +760,7 @@ type ListSimulationRunsResponse struct { func (x *ListSimulationRunsResponse) Reset() { *x = ListSimulationRunsResponse{} - mi := &file_livekit_agent_simulation_proto_msgTypes[6] + mi := &file_livekit_agent_simulation_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -496,7 +772,7 @@ func (x *ListSimulationRunsResponse) String() string { func (*ListSimulationRunsResponse) ProtoMessage() {} func (x *ListSimulationRunsResponse) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[6] + mi := &file_livekit_agent_simulation_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -509,7 +785,7 @@ func (x *ListSimulationRunsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSimulationRunsResponse.ProtoReflect.Descriptor instead. func (*ListSimulationRunsResponse) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{6} + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{8} } func (x *ListSimulationRunsResponse) GetRuns() []*SimulationRun { @@ -519,31 +795,33 @@ func (x *ListSimulationRunsResponse) GetRuns() []*SimulationRun { return nil } -type SimulationRun_Job struct { - state protoimpl.MessageState `protogen:"open.v1"` - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Status SimulationRun_Job_Status `protobuf:"varint,2,opt,name=status,proto3,enum=livekit.SimulationRun_Job_Status" json:"status,omitempty"` - Instructions string `protobuf:"bytes,3,opt,name=instructions,proto3" json:"instructions,omitempty"` - Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache +type CreateScenarioRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + Instructions string `protobuf:"bytes,3,opt,name=instructions,proto3" json:"instructions,omitempty"` + AgentExpectations string `protobuf:"bytes,4,opt,name=agent_expectations,json=agentExpectations,proto3" json:"agent_expectations,omitempty"` + GroupId string `protobuf:"bytes,5,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Metadata map[string]string `protobuf:"bytes,6,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } -func (x *SimulationRun_Job) Reset() { - *x = SimulationRun_Job{} - mi := &file_livekit_agent_simulation_proto_msgTypes[7] +func (x *CreateScenarioRequest) Reset() { + *x = CreateScenarioRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } -func (x *SimulationRun_Job) String() string { +func (x *CreateScenarioRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*SimulationRun_Job) ProtoMessage() {} +func (*CreateScenarioRequest) ProtoMessage() {} -func (x *SimulationRun_Job) ProtoReflect() protoreflect.Message { - mi := &file_livekit_agent_simulation_proto_msgTypes[7] +func (x *CreateScenarioRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -554,46 +832,884 @@ func (x *SimulationRun_Job) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use SimulationRun_Job.ProtoReflect.Descriptor instead. -func (*SimulationRun_Job) Descriptor() ([]byte, []int) { - return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0} +// Deprecated: Use CreateScenarioRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{9} } -func (x *SimulationRun_Job) GetId() string { +func (x *CreateScenarioRequest) GetProjectId() string { if x != nil { - return x.Id + return x.ProjectId } return "" } -func (x *SimulationRun_Job) GetStatus() SimulationRun_Job_Status { +func (x *CreateScenarioRequest) GetLabel() string { if x != nil { - return x.Status + return x.Label } - return SimulationRun_Job_STATUS_PENDING + return "" } -func (x *SimulationRun_Job) GetInstructions() string { +func (x *CreateScenarioRequest) GetInstructions() string { if x != nil { return x.Instructions } return "" } -func (x *SimulationRun_Job) GetError() string { +func (x *CreateScenarioRequest) GetAgentExpectations() string { if x != nil { - return x.Error + return x.AgentExpectations } return "" } -var File_livekit_agent_simulation_proto protoreflect.FileDescriptor +func (x *CreateScenarioRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} -const file_livekit_agent_simulation_proto_rawDesc = "" + - "\n" + - "\x1elivekit_agent_simulation.proto\x12\alivekit\"\xcd\x04\n" + - "\rSimulationRun\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + +func (x *CreateScenarioRequest) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type CreateScenarioResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenario *Scenario `protobuf:"bytes,1,opt,name=scenario,proto3" json:"scenario,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioResponse) Reset() { + *x = CreateScenarioResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioResponse) ProtoMessage() {} + +func (x *CreateScenarioResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateScenarioResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{10} +} + +func (x *CreateScenarioResponse) GetScenario() *Scenario { + if x != nil { + return x.Scenario + } + return nil +} + +type CreateScenarioFromSessionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + RoomId string `protobuf:"bytes,2,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"` + GroupId string `protobuf:"bytes,3,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + Region string `protobuf:"bytes,5,opt,name=region,proto3" json:"region,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioFromSessionRequest) Reset() { + *x = CreateScenarioFromSessionRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioFromSessionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioFromSessionRequest) ProtoMessage() {} + +func (x *CreateScenarioFromSessionRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateScenarioFromSessionRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioFromSessionRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateScenarioFromSessionRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetRoomId() string { + if x != nil { + return x.RoomId + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *CreateScenarioFromSessionRequest) GetRegion() string { + if x != nil { + return x.Region + } + return "" +} + +type CreateScenarioFromSessionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenario *Scenario `protobuf:"bytes,1,opt,name=scenario,proto3" json:"scenario,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioFromSessionResponse) Reset() { + *x = CreateScenarioFromSessionResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioFromSessionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioFromSessionResponse) ProtoMessage() {} + +func (x *CreateScenarioFromSessionResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateScenarioFromSessionResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioFromSessionResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{12} +} + +func (x *CreateScenarioFromSessionResponse) GetScenario() *Scenario { + if x != nil { + return x.Scenario + } + return nil +} + +type DeleteScenarioRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioId string `protobuf:"bytes,2,opt,name=scenario_id,json=scenarioId,proto3" json:"scenario_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioRequest) Reset() { + *x = DeleteScenarioRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioRequest) ProtoMessage() {} + +func (x *DeleteScenarioRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 DeleteScenarioRequest.ProtoReflect.Descriptor instead. +func (*DeleteScenarioRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{13} +} + +func (x *DeleteScenarioRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *DeleteScenarioRequest) GetScenarioId() string { + if x != nil { + return x.ScenarioId + } + return "" +} + +type DeleteScenarioResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioResponse) Reset() { + *x = DeleteScenarioResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioResponse) ProtoMessage() {} + +func (x *DeleteScenarioResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 DeleteScenarioResponse.ProtoReflect.Descriptor instead. +func (*DeleteScenarioResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{14} +} + +type UpdateScenarioRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + ScenarioId string `protobuf:"bytes,2,opt,name=scenario_id,json=scenarioId,proto3" json:"scenario_id,omitempty"` + Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + Instructions string `protobuf:"bytes,4,opt,name=instructions,proto3" json:"instructions,omitempty"` + AgentExpectations string `protobuf:"bytes,5,opt,name=agent_expectations,json=agentExpectations,proto3" json:"agent_expectations,omitempty"` + GroupId string `protobuf:"bytes,6,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + Metadata map[string]string `protobuf:"bytes,7,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateScenarioRequest) Reset() { + *x = UpdateScenarioRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateScenarioRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateScenarioRequest) ProtoMessage() {} + +func (x *UpdateScenarioRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 UpdateScenarioRequest.ProtoReflect.Descriptor instead. +func (*UpdateScenarioRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{15} +} + +func (x *UpdateScenarioRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *UpdateScenarioRequest) GetScenarioId() string { + if x != nil { + return x.ScenarioId + } + return "" +} + +func (x *UpdateScenarioRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +func (x *UpdateScenarioRequest) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *UpdateScenarioRequest) GetAgentExpectations() string { + if x != nil { + return x.AgentExpectations + } + return "" +} + +func (x *UpdateScenarioRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +func (x *UpdateScenarioRequest) GetMetadata() map[string]string { + if x != nil { + return x.Metadata + } + return nil +} + +type UpdateScenarioResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenario *Scenario `protobuf:"bytes,1,opt,name=scenario,proto3" json:"scenario,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateScenarioResponse) Reset() { + *x = UpdateScenarioResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateScenarioResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateScenarioResponse) ProtoMessage() {} + +func (x *UpdateScenarioResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 UpdateScenarioResponse.ProtoReflect.Descriptor instead. +func (*UpdateScenarioResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{16} +} + +func (x *UpdateScenarioResponse) GetScenario() *Scenario { + if x != nil { + return x.Scenario + } + return nil +} + +type CreateScenarioGroupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + Label string `protobuf:"bytes,2,opt,name=label,proto3" json:"label,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioGroupRequest) Reset() { + *x = CreateScenarioGroupRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioGroupRequest) ProtoMessage() {} + +func (x *CreateScenarioGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateScenarioGroupRequest.ProtoReflect.Descriptor instead. +func (*CreateScenarioGroupRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{17} +} + +func (x *CreateScenarioGroupRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *CreateScenarioGroupRequest) GetLabel() string { + if x != nil { + return x.Label + } + return "" +} + +type CreateScenarioGroupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScenarioGroup *ScenarioGroup `protobuf:"bytes,1,opt,name=scenario_group,json=scenarioGroup,proto3" json:"scenario_group,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateScenarioGroupResponse) Reset() { + *x = CreateScenarioGroupResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateScenarioGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateScenarioGroupResponse) ProtoMessage() {} + +func (x *CreateScenarioGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 CreateScenarioGroupResponse.ProtoReflect.Descriptor instead. +func (*CreateScenarioGroupResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{18} +} + +func (x *CreateScenarioGroupResponse) GetScenarioGroup() *ScenarioGroup { + if x != nil { + return x.ScenarioGroup + } + return nil +} + +type DeleteScenarioGroupRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioGroupRequest) Reset() { + *x = DeleteScenarioGroupRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioGroupRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioGroupRequest) ProtoMessage() {} + +func (x *DeleteScenarioGroupRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_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 DeleteScenarioGroupRequest.ProtoReflect.Descriptor instead. +func (*DeleteScenarioGroupRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{19} +} + +func (x *DeleteScenarioGroupRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *DeleteScenarioGroupRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +type DeleteScenarioGroupResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteScenarioGroupResponse) Reset() { + *x = DeleteScenarioGroupResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteScenarioGroupResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteScenarioGroupResponse) ProtoMessage() {} + +func (x *DeleteScenarioGroupResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[20] + 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 DeleteScenarioGroupResponse.ProtoReflect.Descriptor instead. +func (*DeleteScenarioGroupResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{20} +} + +type ListScenarioGroupsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenarioGroupsRequest) Reset() { + *x = ListScenarioGroupsRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenarioGroupsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenarioGroupsRequest) ProtoMessage() {} + +func (x *ListScenarioGroupsRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[21] + 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 ListScenarioGroupsRequest.ProtoReflect.Descriptor instead. +func (*ListScenarioGroupsRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{21} +} + +func (x *ListScenarioGroupsRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +type ListScenarioGroupsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ScenarioGroups []*ScenarioGroup `protobuf:"bytes,1,rep,name=scenario_groups,json=scenarioGroups,proto3" json:"scenario_groups,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenarioGroupsResponse) Reset() { + *x = ListScenarioGroupsResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenarioGroupsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenarioGroupsResponse) ProtoMessage() {} + +func (x *ListScenarioGroupsResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[22] + 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 ListScenarioGroupsResponse.ProtoReflect.Descriptor instead. +func (*ListScenarioGroupsResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{22} +} + +func (x *ListScenarioGroupsResponse) GetScenarioGroups() []*ScenarioGroup { + if x != nil { + return x.ScenarioGroups + } + return nil +} + +type ListScenariosRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"project_id,omitempty"` + GroupId string `protobuf:"bytes,2,opt,name=group_id,json=groupId,proto3" json:"group_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenariosRequest) Reset() { + *x = ListScenariosRequest{} + mi := &file_livekit_agent_simulation_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenariosRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenariosRequest) ProtoMessage() {} + +func (x *ListScenariosRequest) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[23] + 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 ListScenariosRequest.ProtoReflect.Descriptor instead. +func (*ListScenariosRequest) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{23} +} + +func (x *ListScenariosRequest) GetProjectId() string { + if x != nil { + return x.ProjectId + } + return "" +} + +func (x *ListScenariosRequest) GetGroupId() string { + if x != nil { + return x.GroupId + } + return "" +} + +type ListScenariosResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Scenarios []*Scenario `protobuf:"bytes,1,rep,name=scenarios,proto3" json:"scenarios,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListScenariosResponse) Reset() { + *x = ListScenariosResponse{} + mi := &file_livekit_agent_simulation_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListScenariosResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListScenariosResponse) ProtoMessage() {} + +func (x *ListScenariosResponse) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[24] + 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 ListScenariosResponse.ProtoReflect.Descriptor instead. +func (*ListScenariosResponse) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{24} +} + +func (x *ListScenariosResponse) GetScenarios() []*Scenario { + if x != nil { + return x.Scenarios + } + return nil +} + +type SimulationRun_Job struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Status SimulationRun_Job_Status `protobuf:"varint,2,opt,name=status,proto3,enum=livekit.SimulationRun_Job_Status" json:"status,omitempty"` + Instructions string `protobuf:"bytes,3,opt,name=instructions,proto3" json:"instructions,omitempty"` + Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulationRun_Job) Reset() { + *x = SimulationRun_Job{} + mi := &file_livekit_agent_simulation_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulationRun_Job) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulationRun_Job) ProtoMessage() {} + +func (x *SimulationRun_Job) ProtoReflect() protoreflect.Message { + mi := &file_livekit_agent_simulation_proto_msgTypes[25] + 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 SimulationRun_Job.ProtoReflect.Descriptor instead. +func (*SimulationRun_Job) Descriptor() ([]byte, []int) { + return file_livekit_agent_simulation_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *SimulationRun_Job) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SimulationRun_Job) GetStatus() SimulationRun_Job_Status { + if x != nil { + return x.Status + } + return SimulationRun_Job_STATUS_PENDING +} + +func (x *SimulationRun_Job) GetInstructions() string { + if x != nil { + return x.Instructions + } + return "" +} + +func (x *SimulationRun_Job) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +var File_livekit_agent_simulation_proto protoreflect.FileDescriptor + +const file_livekit_agent_simulation_proto_rawDesc = "" + + "\n" + + "\x1elivekit_agent_simulation.proto\x12\alivekit\"\xcd\x04\n" + + "\rSimulationRun\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + "\n" + "project_id\x18\x02 \x01(\tR\tprojectId\x125\n" + "\x06status\x18\x03 \x01(\x0e2\x1d.livekit.SimulationRun.StatusR\x06status\x12+\n" + @@ -616,12 +1732,46 @@ const file_livekit_agent_simulation_proto_rawDesc = "" + "\x11STATUS_GENERATING\x10\x00\x12\x12\n" + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + "\x10STATUS_COMPLETED\x10\x02\x12\x11\n" + - "\rSTATUS_FAILED\x10\x03\"\x91\x01\n" + + "\rSTATUS_FAILED\x10\x03\"\x8a\x04\n" + + "\bScenario\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "project_id\x18\x02 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12\"\n" + + "\finstructions\x18\x04 \x01(\tR\finstructions\x12-\n" + + "\x12agent_expectations\x18\x05 \x01(\tR\x11agentExpectations\x12$\n" + + "\x0esource_room_id\x18\x06 \x01(\tR\fsourceRoomId\x12\x1d\n" + + "\n" + + "created_at\x18\a \x01(\x03R\tcreatedAt\x120\n" + + "\x06status\x18\b \x01(\x0e2\x18.livekit.Scenario.StatusR\x06status\x12\x14\n" + + "\x05error\x18\t \x01(\tR\x05error\x12\x19\n" + + "\bgroup_id\x18\n" + + " \x01(\tR\agroupId\x12;\n" + + "\bmetadata\x18\v \x03(\v2\x1f.livekit.Scenario.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"D\n" + + "\x06Status\x12\x15\n" + + "\x11STATUS_GENERATING\x10\x00\x12\x10\n" + + "\fSTATUS_READY\x10\x01\x12\x11\n" + + "\rSTATUS_FAILED\x10\x02\"\xa4\x01\n" + + "\rScenarioGroup\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + + "\n" + + "project_id\x18\x02 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12\x1d\n" + + "\n" + + "created_at\x18\x04 \x01(\x03R\tcreatedAt\x12/\n" + + "\tscenarios\x18\x05 \x03(\v2\x11.livekit.ScenarioR\tscenarios\"\xe3\x01\n" + "\x1aCreateSimulationRunRequest\x12\x1d\n" + "\n" + - "agent_name\x18\x01 \x01(\tR\tagentName\x12+\n" + - "\x11agent_description\x18\x02 \x01(\tR\x10agentDescription\x12'\n" + - "\x0fnum_simulations\x18\x03 \x01(\x05R\x0enumSimulations\"I\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x1d\n" + + "\n" + + "agent_name\x18\x02 \x01(\tR\tagentName\x12+\n" + + "\x11agent_description\x18\x03 \x01(\tR\x10agentDescription\x12'\n" + + "\x0fnum_simulations\x18\x04 \x01(\x05R\x0enumSimulations\x12\x19\n" + + "\bgroup_id\x18\x05 \x01(\tR\agroupId\x12\x16\n" + + "\x06region\x18\x06 \x01(\tR\x06region\"I\n" + "\x1bCreateSimulationRunResponse\x12*\n" + "\x11simulation_run_id\x18\x01 \x01(\tR\x0fsimulationRunId\"d\n" + "\x17GetSimulationRunRequest\x12\x1d\n" + @@ -634,11 +1784,84 @@ const file_livekit_agent_simulation_proto_rawDesc = "" + "\n" + "project_id\x18\x01 \x01(\tR\tprojectId\"H\n" + "\x1aListSimulationRunsResponse\x12*\n" + - "\x04runs\x18\x01 \x03(\v2\x16.livekit.SimulationRunR\x04runs2\xab\x02\n" + + "\x04runs\x18\x01 \x03(\v2\x16.livekit.SimulationRunR\x04runs\"\xc1\x02\n" + + "\x15CreateScenarioRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x02 \x01(\tR\x05label\x12\"\n" + + "\finstructions\x18\x03 \x01(\tR\finstructions\x12-\n" + + "\x12agent_expectations\x18\x04 \x01(\tR\x11agentExpectations\x12\x19\n" + + "\bgroup_id\x18\x05 \x01(\tR\agroupId\x12H\n" + + "\bmetadata\x18\x06 \x03(\v2,.livekit.CreateScenarioRequest.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"G\n" + + "\x16CreateScenarioResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"\xa3\x01\n" + + " CreateScenarioFromSessionRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x17\n" + + "\aroom_id\x18\x02 \x01(\tR\x06roomId\x12\x19\n" + + "\bgroup_id\x18\x03 \x01(\tR\agroupId\x12\x14\n" + + "\x05label\x18\x04 \x01(\tR\x05label\x12\x16\n" + + "\x06region\x18\x05 \x01(\tR\x06region\"R\n" + + "!CreateScenarioFromSessionResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"W\n" + + "\x15DeleteScenarioRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x1f\n" + + "\vscenario_id\x18\x02 \x01(\tR\n" + + "scenarioId\"\x18\n" + + "\x16DeleteScenarioResponse\"\xe2\x02\n" + + "\x15UpdateScenarioRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x1f\n" + + "\vscenario_id\x18\x02 \x01(\tR\n" + + "scenarioId\x12\x14\n" + + "\x05label\x18\x03 \x01(\tR\x05label\x12\"\n" + + "\finstructions\x18\x04 \x01(\tR\finstructions\x12-\n" + + "\x12agent_expectations\x18\x05 \x01(\tR\x11agentExpectations\x12\x19\n" + + "\bgroup_id\x18\x06 \x01(\tR\agroupId\x12H\n" + + "\bmetadata\x18\a \x03(\v2,.livekit.UpdateScenarioRequest.MetadataEntryR\bmetadata\x1a;\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"G\n" + + "\x16UpdateScenarioResponse\x12-\n" + + "\bscenario\x18\x01 \x01(\v2\x11.livekit.ScenarioR\bscenario\"Q\n" + + "\x1aCreateScenarioGroupRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x14\n" + + "\x05label\x18\x02 \x01(\tR\x05label\"\\\n" + + "\x1bCreateScenarioGroupResponse\x12=\n" + + "\x0escenario_group\x18\x01 \x01(\v2\x16.livekit.ScenarioGroupR\rscenarioGroup\"V\n" + + "\x1aDeleteScenarioGroupRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x19\n" + + "\bgroup_id\x18\x02 \x01(\tR\agroupId\"\x1d\n" + + "\x1bDeleteScenarioGroupResponse\":\n" + + "\x19ListScenarioGroupsRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\"]\n" + + "\x1aListScenarioGroupsResponse\x12?\n" + + "\x0fscenario_groups\x18\x01 \x03(\v2\x16.livekit.ScenarioGroupR\x0escenarioGroups\"P\n" + + "\x14ListScenariosRequest\x12\x1d\n" + + "\n" + + "project_id\x18\x01 \x01(\tR\tprojectId\x12\x19\n" + + "\bgroup_id\x18\x02 \x01(\tR\agroupId\"H\n" + + "\x15ListScenariosResponse\x12/\n" + + "\tscenarios\x18\x01 \x03(\v2\x11.livekit.ScenarioR\tscenarios2\x8b\b\n" + "\x0fAgentSimulation\x12`\n" + "\x13CreateSimulationRun\x12#.livekit.CreateSimulationRunRequest\x1a$.livekit.CreateSimulationRunResponse\x12W\n" + "\x10GetSimulationRun\x12 .livekit.GetSimulationRunRequest\x1a!.livekit.GetSimulationRunResponse\x12]\n" + - "\x12ListSimulationRuns\x12\".livekit.ListSimulationRunsRequest\x1a#.livekit.ListSimulationRunsResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" + "\x12ListSimulationRuns\x12\".livekit.ListSimulationRunsRequest\x1a#.livekit.ListSimulationRunsResponse\x12Q\n" + + "\x0eCreateScenario\x12\x1e.livekit.CreateScenarioRequest\x1a\x1f.livekit.CreateScenarioResponse\x12r\n" + + "\x19CreateScenarioFromSession\x12).livekit.CreateScenarioFromSessionRequest\x1a*.livekit.CreateScenarioFromSessionResponse\x12Q\n" + + "\x0eDeleteScenario\x12\x1e.livekit.DeleteScenarioRequest\x1a\x1f.livekit.DeleteScenarioResponse\x12Q\n" + + "\x0eUpdateScenario\x12\x1e.livekit.UpdateScenarioRequest\x1a\x1f.livekit.UpdateScenarioResponse\x12`\n" + + "\x13CreateScenarioGroup\x12#.livekit.CreateScenarioGroupRequest\x1a$.livekit.CreateScenarioGroupResponse\x12`\n" + + "\x13DeleteScenarioGroup\x12#.livekit.DeleteScenarioGroupRequest\x1a$.livekit.DeleteScenarioGroupResponse\x12]\n" + + "\x12ListScenarioGroups\x12\".livekit.ListScenarioGroupsRequest\x1a#.livekit.ListScenarioGroupsResponse\x12N\n" + + "\rListScenarios\x12\x1d.livekit.ListScenariosRequest\x1a\x1e.livekit.ListScenariosResponseBFZ#github.com/livekit/protocol/livekit\xaa\x02\rLiveKit.Proto\xea\x02\x0eLiveKit::Protob\x06proto3" var ( file_livekit_agent_simulation_proto_rawDescOnce sync.Once @@ -652,37 +1875,86 @@ func file_livekit_agent_simulation_proto_rawDescGZIP() []byte { return file_livekit_agent_simulation_proto_rawDescData } -var file_livekit_agent_simulation_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_livekit_agent_simulation_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_livekit_agent_simulation_proto_msgTypes = make([]protoimpl.MessageInfo, 29) var file_livekit_agent_simulation_proto_goTypes = []any{ - (SimulationRun_Status)(0), // 0: livekit.SimulationRun.Status - (SimulationRun_Job_Status)(0), // 1: livekit.SimulationRun.Job.Status - (*SimulationRun)(nil), // 2: livekit.SimulationRun - (*CreateSimulationRunRequest)(nil), // 3: livekit.CreateSimulationRunRequest - (*CreateSimulationRunResponse)(nil), // 4: livekit.CreateSimulationRunResponse - (*GetSimulationRunRequest)(nil), // 5: livekit.GetSimulationRunRequest - (*GetSimulationRunResponse)(nil), // 6: livekit.GetSimulationRunResponse - (*ListSimulationRunsRequest)(nil), // 7: livekit.ListSimulationRunsRequest - (*ListSimulationRunsResponse)(nil), // 8: livekit.ListSimulationRunsResponse - (*SimulationRun_Job)(nil), // 9: livekit.SimulationRun.Job + (SimulationRun_Status)(0), // 0: livekit.SimulationRun.Status + (SimulationRun_Job_Status)(0), // 1: livekit.SimulationRun.Job.Status + (Scenario_Status)(0), // 2: livekit.Scenario.Status + (*SimulationRun)(nil), // 3: livekit.SimulationRun + (*Scenario)(nil), // 4: livekit.Scenario + (*ScenarioGroup)(nil), // 5: livekit.ScenarioGroup + (*CreateSimulationRunRequest)(nil), // 6: livekit.CreateSimulationRunRequest + (*CreateSimulationRunResponse)(nil), // 7: livekit.CreateSimulationRunResponse + (*GetSimulationRunRequest)(nil), // 8: livekit.GetSimulationRunRequest + (*GetSimulationRunResponse)(nil), // 9: livekit.GetSimulationRunResponse + (*ListSimulationRunsRequest)(nil), // 10: livekit.ListSimulationRunsRequest + (*ListSimulationRunsResponse)(nil), // 11: livekit.ListSimulationRunsResponse + (*CreateScenarioRequest)(nil), // 12: livekit.CreateScenarioRequest + (*CreateScenarioResponse)(nil), // 13: livekit.CreateScenarioResponse + (*CreateScenarioFromSessionRequest)(nil), // 14: livekit.CreateScenarioFromSessionRequest + (*CreateScenarioFromSessionResponse)(nil), // 15: livekit.CreateScenarioFromSessionResponse + (*DeleteScenarioRequest)(nil), // 16: livekit.DeleteScenarioRequest + (*DeleteScenarioResponse)(nil), // 17: livekit.DeleteScenarioResponse + (*UpdateScenarioRequest)(nil), // 18: livekit.UpdateScenarioRequest + (*UpdateScenarioResponse)(nil), // 19: livekit.UpdateScenarioResponse + (*CreateScenarioGroupRequest)(nil), // 20: livekit.CreateScenarioGroupRequest + (*CreateScenarioGroupResponse)(nil), // 21: livekit.CreateScenarioGroupResponse + (*DeleteScenarioGroupRequest)(nil), // 22: livekit.DeleteScenarioGroupRequest + (*DeleteScenarioGroupResponse)(nil), // 23: livekit.DeleteScenarioGroupResponse + (*ListScenarioGroupsRequest)(nil), // 24: livekit.ListScenarioGroupsRequest + (*ListScenarioGroupsResponse)(nil), // 25: livekit.ListScenarioGroupsResponse + (*ListScenariosRequest)(nil), // 26: livekit.ListScenariosRequest + (*ListScenariosResponse)(nil), // 27: livekit.ListScenariosResponse + (*SimulationRun_Job)(nil), // 28: livekit.SimulationRun.Job + nil, // 29: livekit.Scenario.MetadataEntry + nil, // 30: livekit.CreateScenarioRequest.MetadataEntry + nil, // 31: livekit.UpdateScenarioRequest.MetadataEntry } var file_livekit_agent_simulation_proto_depIdxs = []int32{ - 0, // 0: livekit.SimulationRun.status:type_name -> livekit.SimulationRun.Status - 9, // 1: livekit.SimulationRun.jobs:type_name -> livekit.SimulationRun.Job - 2, // 2: livekit.GetSimulationRunResponse.run:type_name -> livekit.SimulationRun - 2, // 3: livekit.ListSimulationRunsResponse.runs:type_name -> livekit.SimulationRun - 1, // 4: livekit.SimulationRun.Job.status:type_name -> livekit.SimulationRun.Job.Status - 3, // 5: livekit.AgentSimulation.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest - 5, // 6: livekit.AgentSimulation.GetSimulationRun:input_type -> livekit.GetSimulationRunRequest - 7, // 7: livekit.AgentSimulation.ListSimulationRuns:input_type -> livekit.ListSimulationRunsRequest - 4, // 8: livekit.AgentSimulation.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse - 6, // 9: livekit.AgentSimulation.GetSimulationRun:output_type -> livekit.GetSimulationRunResponse - 8, // 10: livekit.AgentSimulation.ListSimulationRuns:output_type -> livekit.ListSimulationRunsResponse - 8, // [8:11] is the sub-list for method output_type - 5, // [5:8] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 0, // 0: livekit.SimulationRun.status:type_name -> livekit.SimulationRun.Status + 28, // 1: livekit.SimulationRun.jobs:type_name -> livekit.SimulationRun.Job + 2, // 2: livekit.Scenario.status:type_name -> livekit.Scenario.Status + 29, // 3: livekit.Scenario.metadata:type_name -> livekit.Scenario.MetadataEntry + 4, // 4: livekit.ScenarioGroup.scenarios:type_name -> livekit.Scenario + 3, // 5: livekit.GetSimulationRunResponse.run:type_name -> livekit.SimulationRun + 3, // 6: livekit.ListSimulationRunsResponse.runs:type_name -> livekit.SimulationRun + 30, // 7: livekit.CreateScenarioRequest.metadata:type_name -> livekit.CreateScenarioRequest.MetadataEntry + 4, // 8: livekit.CreateScenarioResponse.scenario:type_name -> livekit.Scenario + 4, // 9: livekit.CreateScenarioFromSessionResponse.scenario:type_name -> livekit.Scenario + 31, // 10: livekit.UpdateScenarioRequest.metadata:type_name -> livekit.UpdateScenarioRequest.MetadataEntry + 4, // 11: livekit.UpdateScenarioResponse.scenario:type_name -> livekit.Scenario + 5, // 12: livekit.CreateScenarioGroupResponse.scenario_group:type_name -> livekit.ScenarioGroup + 5, // 13: livekit.ListScenarioGroupsResponse.scenario_groups:type_name -> livekit.ScenarioGroup + 4, // 14: livekit.ListScenariosResponse.scenarios:type_name -> livekit.Scenario + 1, // 15: livekit.SimulationRun.Job.status:type_name -> livekit.SimulationRun.Job.Status + 6, // 16: livekit.AgentSimulation.CreateSimulationRun:input_type -> livekit.CreateSimulationRunRequest + 8, // 17: livekit.AgentSimulation.GetSimulationRun:input_type -> livekit.GetSimulationRunRequest + 10, // 18: livekit.AgentSimulation.ListSimulationRuns:input_type -> livekit.ListSimulationRunsRequest + 12, // 19: livekit.AgentSimulation.CreateScenario:input_type -> livekit.CreateScenarioRequest + 14, // 20: livekit.AgentSimulation.CreateScenarioFromSession:input_type -> livekit.CreateScenarioFromSessionRequest + 16, // 21: livekit.AgentSimulation.DeleteScenario:input_type -> livekit.DeleteScenarioRequest + 18, // 22: livekit.AgentSimulation.UpdateScenario:input_type -> livekit.UpdateScenarioRequest + 20, // 23: livekit.AgentSimulation.CreateScenarioGroup:input_type -> livekit.CreateScenarioGroupRequest + 22, // 24: livekit.AgentSimulation.DeleteScenarioGroup:input_type -> livekit.DeleteScenarioGroupRequest + 24, // 25: livekit.AgentSimulation.ListScenarioGroups:input_type -> livekit.ListScenarioGroupsRequest + 26, // 26: livekit.AgentSimulation.ListScenarios:input_type -> livekit.ListScenariosRequest + 7, // 27: livekit.AgentSimulation.CreateSimulationRun:output_type -> livekit.CreateSimulationRunResponse + 9, // 28: livekit.AgentSimulation.GetSimulationRun:output_type -> livekit.GetSimulationRunResponse + 11, // 29: livekit.AgentSimulation.ListSimulationRuns:output_type -> livekit.ListSimulationRunsResponse + 13, // 30: livekit.AgentSimulation.CreateScenario:output_type -> livekit.CreateScenarioResponse + 15, // 31: livekit.AgentSimulation.CreateScenarioFromSession:output_type -> livekit.CreateScenarioFromSessionResponse + 17, // 32: livekit.AgentSimulation.DeleteScenario:output_type -> livekit.DeleteScenarioResponse + 19, // 33: livekit.AgentSimulation.UpdateScenario:output_type -> livekit.UpdateScenarioResponse + 21, // 34: livekit.AgentSimulation.CreateScenarioGroup:output_type -> livekit.CreateScenarioGroupResponse + 23, // 35: livekit.AgentSimulation.DeleteScenarioGroup:output_type -> livekit.DeleteScenarioGroupResponse + 25, // 36: livekit.AgentSimulation.ListScenarioGroups:output_type -> livekit.ListScenarioGroupsResponse + 27, // 37: livekit.AgentSimulation.ListScenarios:output_type -> livekit.ListScenariosResponse + 27, // [27:38] is the sub-list for method output_type + 16, // [16:27] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_livekit_agent_simulation_proto_init() } @@ -695,8 +1967,8 @@ func file_livekit_agent_simulation_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_livekit_agent_simulation_proto_rawDesc), len(file_livekit_agent_simulation_proto_rawDesc)), - NumEnums: 2, - NumMessages: 8, + NumEnums: 3, + NumMessages: 29, NumExtensions: 0, NumServices: 1, }, diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go index 534dac367..eedbf8920 100644 --- a/livekit/livekit_agent_simulation.twirp.go +++ b/livekit/livekit_agent_simulation.twirp.go @@ -32,6 +32,22 @@ type AgentSimulation interface { GetSimulationRun(context.Context, *GetSimulationRunRequest) (*GetSimulationRunResponse, error) ListSimulationRuns(context.Context, *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) + + CreateScenario(context.Context, *CreateScenarioRequest) (*CreateScenarioResponse, error) + + CreateScenarioFromSession(context.Context, *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) + + DeleteScenario(context.Context, *DeleteScenarioRequest) (*DeleteScenarioResponse, error) + + UpdateScenario(context.Context, *UpdateScenarioRequest) (*UpdateScenarioResponse, error) + + CreateScenarioGroup(context.Context, *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) + + DeleteScenarioGroup(context.Context, *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) + + ListScenarioGroups(context.Context, *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) + + ListScenarios(context.Context, *ListScenariosRequest) (*ListScenariosResponse, error) } // =============================== @@ -40,7 +56,7 @@ type AgentSimulation interface { type agentSimulationProtobufClient struct { client HTTPClient - urls [3]string + urls [11]string interceptor twirp.Interceptor opts twirp.ClientOptions } @@ -68,10 +84,18 @@ func NewAgentSimulationProtobufClient(baseURL string, client HTTPClient, opts .. // Build method URLs: []/./ serviceURL := sanitizeBaseURL(baseURL) serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") - urls := [3]string{ + urls := [11]string{ serviceURL + "CreateSimulationRun", serviceURL + "GetSimulationRun", serviceURL + "ListSimulationRuns", + serviceURL + "CreateScenario", + serviceURL + "CreateScenarioFromSession", + serviceURL + "DeleteScenario", + serviceURL + "UpdateScenario", + serviceURL + "CreateScenarioGroup", + serviceURL + "DeleteScenarioGroup", + serviceURL + "ListScenarioGroups", + serviceURL + "ListScenarios", } return &agentSimulationProtobufClient{ @@ -220,74 +244,210 @@ func (c *agentSimulationProtobufClient) callListSimulationRuns(ctx context.Conte return out, nil } -// =========================== -// AgentSimulation JSON Client -// =========================== +func (c *agentSimulationProtobufClient) CreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + caller := c.callCreateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return c.callCreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} -type agentSimulationJSONClient struct { - client HTTPClient - urls [3]string - interceptor twirp.Interceptor - opts twirp.ClientOptions +func (c *agentSimulationProtobufClient) callCreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + out := new(CreateScenarioResponse) + 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 } -// NewAgentSimulationJSONClient creates a JSON client that implements the AgentSimulation interface. -// It communicates using JSON and can be configured with a custom HTTPClient. -func NewAgentSimulationJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { - if c, ok := client.(*http.Client); ok { - client = withoutRedirects(c) +func (c *agentSimulationProtobufClient) CreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + caller := c.callCreateScenarioFromSession + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return c.callCreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } } + return caller(ctx, in) +} - clientOpts := twirp.ClientOptions{} - for _, o := range opts { - o(&clientOpts) +func (c *agentSimulationProtobufClient) callCreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + out := new(CreateScenarioFromSessionResponse) + 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 } - // 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 + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) DeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + caller := c.callDeleteScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return c.callDeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } } + return caller(ctx, in) +} - // Build method URLs: []/./ - serviceURL := sanitizeBaseURL(baseURL) - serviceURL += baseServicePath(pathPrefix, "livekit", "AgentSimulation") - urls := [3]string{ - serviceURL + "CreateSimulationRun", - serviceURL + "GetSimulationRun", - serviceURL + "ListSimulationRuns", +func (c *agentSimulationProtobufClient) callDeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + out := new(DeleteScenarioResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[5], 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 } - return &agentSimulationJSONClient{ - client: client, - urls: urls, - interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), - opts: clientOpts, + callClientResponseReceived(ctx, c.opts.Hooks) + + return out, nil +} + +func (c *agentSimulationProtobufClient) UpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + caller := c.callUpdateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return c.callUpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } } + return caller(ctx, in) } -func (c *agentSimulationJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { +func (c *agentSimulationProtobufClient) callUpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + out := new(UpdateScenarioResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[6], 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 *agentSimulationProtobufClient) CreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") - ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") - caller := c.callCreateSimulationRun + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + caller := c.callCreateScenarioGroup if c.interceptor != nil { - caller = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + caller = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*CreateScenarioGroupRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") } - return c.callCreateSimulationRun(ctx, typedReq) + return c.callCreateScenarioGroup(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*CreateScenarioGroupResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") } return typedResp, err } @@ -297,9 +457,9 @@ func (c *agentSimulationJSONClient) CreateSimulationRun(ctx context.Context, in return caller(ctx, in) } -func (c *agentSimulationJSONClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { - out := new(CreateSimulationRunResponse) - ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[0], in, out) +func (c *agentSimulationProtobufClient) callCreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + out := new(CreateScenarioGroupResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[7], in, out) if err != nil { twerr, ok := err.(twirp.Error) if !ok { @@ -314,26 +474,26 @@ func (c *agentSimulationJSONClient) callCreateSimulationRun(ctx context.Context, return out, nil } -func (c *agentSimulationJSONClient) GetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { +func (c *agentSimulationProtobufClient) DeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") - ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") - caller := c.callGetSimulationRun + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") + caller := c.callDeleteScenarioGroup if c.interceptor != nil { - caller = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + caller = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*GetSimulationRunRequest) + typedReq, ok := req.(*DeleteScenarioGroupRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") } - return c.callGetSimulationRun(ctx, typedReq) + return c.callDeleteScenarioGroup(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*GetSimulationRunResponse) + typedResp, ok := resp.(*DeleteScenarioGroupResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") } return typedResp, err } @@ -343,9 +503,9 @@ func (c *agentSimulationJSONClient) GetSimulationRun(ctx context.Context, in *Ge return caller(ctx, in) } -func (c *agentSimulationJSONClient) callGetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { - out := new(GetSimulationRunResponse) - ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[1], in, out) +func (c *agentSimulationProtobufClient) callDeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + out := new(DeleteScenarioGroupResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[8], in, out) if err != nil { twerr, ok := err.(twirp.Error) if !ok { @@ -360,166 +520,2238 @@ func (c *agentSimulationJSONClient) callGetSimulationRun(ctx context.Context, in return out, nil } -func (c *agentSimulationJSONClient) ListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { +func (c *agentSimulationProtobufClient) ListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { ctx = ctxsetters.WithPackageName(ctx, "livekit") ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") - ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") - caller := c.callListSimulationRuns + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") + caller := c.callListScenarioGroups if c.interceptor != nil { - caller = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + caller = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { resp, err := c.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*ListSimulationRunsRequest) + typedReq, ok := req.(*ListScenarioGroupsRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") } - return c.callListSimulationRuns(ctx, typedReq) + return c.callListScenarioGroups(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*ListSimulationRunsResponse) + typedResp, ok := resp.(*ListScenarioGroupsResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + out := new(ListScenarioGroupsResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[9], 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 *agentSimulationProtobufClient) ListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") + caller := c.callListScenarios + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenariosRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") + } + return c.callListScenarios(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenariosResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationProtobufClient) callListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + out := new(ListScenariosResponse) + ctx, err := doProtobufRequest(ctx, c.client, c.opts.Hooks, c.urls[10], 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 +} + +// =========================== +// AgentSimulation JSON Client +// =========================== + +type agentSimulationJSONClient struct { + client HTTPClient + urls [11]string + interceptor twirp.Interceptor + opts twirp.ClientOptions +} + +// NewAgentSimulationJSONClient creates a JSON client that implements the AgentSimulation interface. +// It communicates using JSON and can be configured with a custom HTTPClient. +func NewAgentSimulationJSONClient(baseURL string, client HTTPClient, opts ...twirp.ClientOption) AgentSimulation { + 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", "AgentSimulation") + urls := [11]string{ + serviceURL + "CreateSimulationRun", + serviceURL + "GetSimulationRun", + serviceURL + "ListSimulationRuns", + serviceURL + "CreateScenario", + serviceURL + "CreateScenarioFromSession", + serviceURL + "DeleteScenario", + serviceURL + "UpdateScenario", + serviceURL + "CreateScenarioGroup", + serviceURL + "DeleteScenarioGroup", + serviceURL + "ListScenarioGroups", + serviceURL + "ListScenarios", + } + + return &agentSimulationJSONClient{ + client: client, + urls: urls, + interceptor: twirp.ChainInterceptors(clientOpts.Interceptors...), + opts: clientOpts, + } +} + +func (c *agentSimulationJSONClient) CreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + caller := c.callCreateSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return c.callCreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateSimulationRun(ctx context.Context, in *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + out := new(CreateSimulationRunResponse) + 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 *agentSimulationJSONClient) GetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + caller := c.callGetSimulationRun + if c.interceptor != nil { + caller = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return c.callGetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callGetSimulationRun(ctx context.Context, in *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + out := new(GetSimulationRunResponse) + 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 *agentSimulationJSONClient) ListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + caller := c.callListSimulationRuns + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return c.callListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + out := new(ListSimulationRunsResponse) + 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 *agentSimulationJSONClient) CreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + caller := c.callCreateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return c.callCreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenario(ctx context.Context, in *CreateScenarioRequest) (*CreateScenarioResponse, error) { + out := new(CreateScenarioResponse) + 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 *agentSimulationJSONClient) CreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + caller := c.callCreateScenarioFromSession + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return c.callCreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenarioFromSession(ctx context.Context, in *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + out := new(CreateScenarioFromSessionResponse) + 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 +} + +func (c *agentSimulationJSONClient) DeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + caller := c.callDeleteScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return c.callDeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callDeleteScenario(ctx context.Context, in *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + out := new(DeleteScenarioResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[5], 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 *agentSimulationJSONClient) UpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + caller := c.callUpdateScenario + if c.interceptor != nil { + caller = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return c.callUpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callUpdateScenario(ctx context.Context, in *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + out := new(UpdateScenarioResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[6], 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 *agentSimulationJSONClient) CreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + caller := c.callCreateScenarioGroup + if c.interceptor != nil { + caller = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return c.callCreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callCreateScenarioGroup(ctx context.Context, in *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + out := new(CreateScenarioGroupResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[7], 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 *agentSimulationJSONClient) DeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") + caller := c.callDeleteScenarioGroup + if c.interceptor != nil { + caller = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") + } + return c.callDeleteScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callDeleteScenarioGroup(ctx context.Context, in *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { + out := new(DeleteScenarioGroupResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[8], 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 *agentSimulationJSONClient) ListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") + caller := c.callListScenarioGroups + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenarioGroupsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") + } + return c.callListScenarioGroups(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenarioGroupsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListScenarioGroups(ctx context.Context, in *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { + out := new(ListScenarioGroupsResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[9], 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 *agentSimulationJSONClient) ListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") + caller := c.callListScenarios + if c.interceptor != nil { + caller = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { + resp, err := c.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListScenariosRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") + } + return c.callListScenarios(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListScenariosResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + return caller(ctx, in) +} + +func (c *agentSimulationJSONClient) callListScenarios(ctx context.Context, in *ListScenariosRequest) (*ListScenariosResponse, error) { + out := new(ListScenariosResponse) + ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[10], 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 +} + +// ============================== +// AgentSimulation Server Handler +// ============================== + +type agentSimulationServer struct { + AgentSimulation + 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 +} + +// NewAgentSimulationServer 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 NewAgentSimulationServer(svc AgentSimulation, 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 &agentSimulationServer{ + AgentSimulation: 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 *agentSimulationServer) 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 *agentSimulationServer) 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)) +} + +// AgentSimulationPathPrefix 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 AgentSimulationPathPrefix = "/twirp/livekit.AgentSimulation/" + +func (s *agentSimulationServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + ctx := req.Context() + ctx = ctxsetters.WithPackageName(ctx, "livekit") + ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") + 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.AgentSimulation" { + 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 "CreateSimulationRun": + s.serveCreateSimulationRun(ctx, resp, req) + return + case "GetSimulationRun": + s.serveGetSimulationRun(ctx, resp, req) + return + case "ListSimulationRuns": + s.serveListSimulationRuns(ctx, resp, req) + return + case "CreateScenario": + s.serveCreateScenario(ctx, resp, req) + return + case "CreateScenarioFromSession": + s.serveCreateScenarioFromSession(ctx, resp, req) + return + case "DeleteScenario": + s.serveDeleteScenario(ctx, resp, req) + return + case "UpdateScenario": + s.serveUpdateScenario(ctx, resp, req) + return + case "CreateScenarioGroup": + s.serveCreateScenarioGroup(ctx, resp, req) + return + case "DeleteScenarioGroup": + s.serveDeleteScenarioGroup(ctx, resp, req) + return + case "ListScenarioGroups": + s.serveListScenarioGroups(ctx, resp, req) + return + case "ListScenarios": + s.serveListScenarios(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 *agentSimulationServer) serveCreateSimulationRun(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.serveCreateSimulationRunJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateSimulationRunProtobuf(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 *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + 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(CreateSimulationRunRequest) + 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.AgentSimulation.CreateSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateSimulationRunResponse + 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 *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. 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 *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + 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(CreateSimulationRunRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateSimulationRunResponse + 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 *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. 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 *agentSimulationServer) serveGetSimulationRun(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.serveGetSimulationRunJSON(ctx, resp, req) + case "application/protobuf": + s.serveGetSimulationRunProtobuf(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 *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + 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(GetSimulationRunRequest) + 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.AgentSimulation.GetSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetSimulationRunResponse + 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 *GetSimulationRunResponse and nil error while calling GetSimulationRun. 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 *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + 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(GetSimulationRunRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.GetSimulationRun + if s.interceptor != nil { + handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*GetSimulationRunRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + } + return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*GetSimulationRunResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *GetSimulationRunResponse + 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 *GetSimulationRunResponse and nil error while calling GetSimulationRun. 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 *agentSimulationServer) serveListSimulationRuns(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.serveListSimulationRunsJSON(ctx, resp, req) + case "application/protobuf": + s.serveListSimulationRunsProtobuf(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 *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + 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(ListSimulationRunsRequest) + 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.AgentSimulation.ListSimulationRuns + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSimulationRunsResponse + 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 *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. 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 *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + 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(ListSimulationRunsRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.ListSimulationRuns + if s.interceptor != nil { + handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*ListSimulationRunsRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + } + return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*ListSimulationRunsResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *ListSimulationRunsResponse + 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 *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. 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 *agentSimulationServer) serveCreateScenario(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.serveCreateScenarioJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioProtobuf(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 *agentSimulationServer) serveCreateScenarioJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + 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(CreateScenarioRequest) + 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.AgentSimulation.CreateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioResponse + 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 *CreateScenarioResponse and nil error while calling CreateScenario. 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 *agentSimulationServer) serveCreateScenarioProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenario") + 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(CreateScenarioRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioRequest) (*CreateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioResponse + 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 *CreateScenarioResponse and nil error while calling CreateScenario. 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 *agentSimulationServer) serveCreateScenarioFromSession(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.serveCreateScenarioFromSessionJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioFromSessionProtobuf(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 *agentSimulationServer) serveCreateScenarioFromSessionJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + 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(CreateScenarioFromSessionRequest) + 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.AgentSimulation.CreateScenarioFromSession + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioFromSessionResponse + 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 *CreateScenarioFromSessionResponse and nil error while calling CreateScenarioFromSession. 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 *agentSimulationServer) serveCreateScenarioFromSessionProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioFromSession") + 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(CreateScenarioFromSessionRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.CreateScenarioFromSession + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioFromSessionRequest) (*CreateScenarioFromSessionResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioFromSessionRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioFromSessionRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioFromSession(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioFromSessionResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioFromSessionResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *CreateScenarioFromSessionResponse + 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 *CreateScenarioFromSessionResponse and nil error while calling CreateScenarioFromSession. 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 *agentSimulationServer) serveDeleteScenario(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.serveDeleteScenarioJSON(ctx, resp, req) + case "application/protobuf": + s.serveDeleteScenarioProtobuf(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 *agentSimulationServer) serveDeleteScenarioJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + 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(DeleteScenarioRequest) + 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.AgentSimulation.DeleteScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioResponse + 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 *DeleteScenarioResponse and nil error while calling DeleteScenario. 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 *agentSimulationServer) serveDeleteScenarioProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenario") + 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(DeleteScenarioRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.DeleteScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *DeleteScenarioRequest) (*DeleteScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*DeleteScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.DeleteScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*DeleteScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *DeleteScenarioResponse + 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 *DeleteScenarioResponse and nil error while calling DeleteScenario. 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 *agentSimulationServer) serveUpdateScenario(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.serveUpdateScenarioJSON(ctx, resp, req) + case "application/protobuf": + s.serveUpdateScenarioProtobuf(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 *agentSimulationServer) serveUpdateScenarioJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + 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(UpdateScenarioRequest) + 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.AgentSimulation.UpdateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.UpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *UpdateScenarioResponse + 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 *UpdateScenarioResponse and nil error while calling UpdateScenario. 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 *agentSimulationServer) serveUpdateScenarioProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "UpdateScenario") + 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(UpdateScenarioRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) + return + } + + handler := s.AgentSimulation.UpdateScenario + if s.interceptor != nil { + handler = func(ctx context.Context, req *UpdateScenarioRequest) (*UpdateScenarioResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*UpdateScenarioRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*UpdateScenarioRequest) when calling interceptor") + } + return s.AgentSimulation.UpdateScenario(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*UpdateScenarioResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*UpdateScenarioResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } + + // Call service method + var respContent *UpdateScenarioResponse + 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 *UpdateScenarioResponse and nil error while calling UpdateScenario. 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 *agentSimulationServer) serveCreateScenarioGroup(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.serveCreateScenarioGroupJSON(ctx, resp, req) + case "application/protobuf": + s.serveCreateScenarioGroupProtobuf(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 *agentSimulationServer) serveCreateScenarioGroupJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + 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(CreateScenarioGroupRequest) + 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.AgentSimulation.CreateScenarioGroup + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") } return typedResp, err } return nil, err } } - return caller(ctx, in) -} -func (c *agentSimulationJSONClient) callListSimulationRuns(ctx context.Context, in *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { - out := new(ListSimulationRunsResponse) - ctx, err := doJSONRequest(ctx, c.client, c.opts.Hooks, c.urls[2], in, out) + // Call service method + var respContent *CreateScenarioGroupResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() + if err != nil { - twerr, ok := err.(twirp.Error) - if !ok { - twerr = twirp.InternalErrorWith(err) - } - callClientError(ctx, c.opts.Hooks, twerr) - return nil, err + s.writeError(ctx, resp, err) + return + } + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioGroupResponse and nil error while calling CreateScenarioGroup. nil responses are not supported")) + return } - callClientResponseReceived(ctx, c.opts.Hooks) - - return out, nil -} - -// ============================== -// AgentSimulation Server Handler -// ============================== - -type agentSimulationServer struct { - AgentSimulation - 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 -} - -// NewAgentSimulationServer 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 NewAgentSimulationServer(svc AgentSimulation, opts ...interface{}) TwirpServer { - serverOpts := newServerOpts(opts) + ctx = callResponsePrepared(ctx, s.hooks) - // 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 + 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 } - return &agentSimulationServer{ - AgentSimulation: svc, - hooks: serverOpts.Hooks, - interceptor: twirp.ChainInterceptors(serverOpts.Interceptors...), - pathPrefix: pathPrefix, - jsonSkipDefaults: jsonSkipDefaults, - jsonCamelCase: jsonCamelCase, + 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) } -// 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 *agentSimulationServer) writeError(ctx context.Context, resp http.ResponseWriter, err error) { - writeError(ctx, resp, err, s.hooks) -} +func (s *agentSimulationServer) serveCreateScenarioGroupProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { + var err error + ctx = ctxsetters.WithMethodName(ctx, "CreateScenarioGroup") + ctx, err = callRequestRouted(ctx, s.hooks) + if err != nil { + s.writeError(ctx, resp, err) + return + } -// handleRequestBodyError is used to handle error when the twirp server cannot read request -func (s *agentSimulationServer) 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")) + buf, err := io.ReadAll(req.Body) + if err != nil { + s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } - if context.DeadlineExceeded == ctx.Err() { - s.writeError(ctx, resp, twirp.NewError(twirp.DeadlineExceeded, "failed to read request: deadline exceeded")) + reqContent := new(CreateScenarioGroupRequest) + if err = proto.Unmarshal(buf, reqContent); err != nil { + s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return } - s.writeError(ctx, resp, twirp.WrapError(malformedRequestError(msg), err)) -} -// AgentSimulationPathPrefix 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 AgentSimulationPathPrefix = "/twirp/livekit.AgentSimulation/" + handler := s.AgentSimulation.CreateScenarioGroup + if s.interceptor != nil { + handler = func(ctx context.Context, req *CreateScenarioGroupRequest) (*CreateScenarioGroupResponse, error) { + resp, err := s.interceptor( + func(ctx context.Context, req interface{}) (interface{}, error) { + typedReq, ok := req.(*CreateScenarioGroupRequest) + if !ok { + return nil, twirp.InternalError("failed type assertion req.(*CreateScenarioGroupRequest) when calling interceptor") + } + return s.AgentSimulation.CreateScenarioGroup(ctx, typedReq) + }, + )(ctx, req) + if resp != nil { + typedResp, ok := resp.(*CreateScenarioGroupResponse) + if !ok { + return nil, twirp.InternalError("failed type assertion resp.(*CreateScenarioGroupResponse) when calling interceptor") + } + return typedResp, err + } + return nil, err + } + } -func (s *agentSimulationServer) ServeHTTP(resp http.ResponseWriter, req *http.Request) { - ctx := req.Context() - ctx = ctxsetters.WithPackageName(ctx, "livekit") - ctx = ctxsetters.WithServiceName(ctx, "AgentSimulation") - ctx = ctxsetters.WithResponseWriter(ctx, resp) + // Call service method + var respContent *CreateScenarioGroupResponse + func() { + defer ensurePanicResponses(ctx, resp, s.hooks) + respContent, err = handler(ctx, reqContent) + }() - 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)) + if respContent == nil { + s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateScenarioGroupResponse and nil error while calling CreateScenarioGroup. nil responses are not supported")) return } - // Verify path format: []/./ - prefix, pkgService, method := parseTwirpPath(req.URL.Path) - if pkgService != "livekit.AgentSimulation" { - 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)) + 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 } - switch method { - case "CreateSimulationRun": - s.serveCreateSimulationRun(ctx, resp, req) - return - case "GetSimulationRun": - s.serveGetSimulationRun(ctx, resp, req) - return - case "ListSimulationRuns": - s.serveListSimulationRuns(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 + 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 *agentSimulationServer) serveCreateSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveDeleteScenarioGroup(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") if i == -1 { @@ -527,9 +2759,9 @@ func (s *agentSimulationServer) serveCreateSimulationRun(ctx context.Context, re } switch strings.TrimSpace(strings.ToLower(header[:i])) { case "application/json": - s.serveCreateSimulationRunJSON(ctx, resp, req) + s.serveDeleteScenarioGroupJSON(ctx, resp, req) case "application/protobuf": - s.serveCreateSimulationRunProtobuf(ctx, resp, req) + s.serveDeleteScenarioGroupProtobuf(ctx, resp, req) default: msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) twerr := badRouteError(msg, req.Method, req.URL.Path) @@ -537,9 +2769,9 @@ func (s *agentSimulationServer) serveCreateSimulationRun(ctx context.Context, re } } -func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveDeleteScenarioGroupJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -552,29 +2784,29 @@ func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } - reqContent := new(CreateSimulationRunRequest) + reqContent := new(DeleteScenarioGroupRequest) 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.AgentSimulation.CreateSimulationRun + handler := s.AgentSimulation.DeleteScenarioGroup if s.interceptor != nil { - handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + handler = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*DeleteScenarioGroupRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") } - return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.DeleteScenarioGroup(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*DeleteScenarioGroupResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") } return typedResp, err } @@ -583,7 +2815,7 @@ func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context } // Call service method - var respContent *CreateSimulationRunResponse + var respContent *DeleteScenarioGroupResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -594,7 +2826,7 @@ func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteScenarioGroupResponse and nil error while calling DeleteScenarioGroup. nil responses are not supported")) return } @@ -620,9 +2852,9 @@ func (s *agentSimulationServer) serveCreateSimulationRunJSON(ctx context.Context callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveDeleteScenarioGroupProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "CreateSimulationRun") + ctx = ctxsetters.WithMethodName(ctx, "DeleteScenarioGroup") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -634,28 +2866,28 @@ func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Con s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } - reqContent := new(CreateSimulationRunRequest) + reqContent := new(DeleteScenarioGroupRequest) if err = proto.Unmarshal(buf, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return } - handler := s.AgentSimulation.CreateSimulationRun + handler := s.AgentSimulation.DeleteScenarioGroup if s.interceptor != nil { - handler = func(ctx context.Context, req *CreateSimulationRunRequest) (*CreateSimulationRunResponse, error) { + handler = func(ctx context.Context, req *DeleteScenarioGroupRequest) (*DeleteScenarioGroupResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*CreateSimulationRunRequest) + typedReq, ok := req.(*DeleteScenarioGroupRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*CreateSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*DeleteScenarioGroupRequest) when calling interceptor") } - return s.AgentSimulation.CreateSimulationRun(ctx, typedReq) + return s.AgentSimulation.DeleteScenarioGroup(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*CreateSimulationRunResponse) + typedResp, ok := resp.(*DeleteScenarioGroupResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*CreateSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*DeleteScenarioGroupResponse) when calling interceptor") } return typedResp, err } @@ -664,7 +2896,7 @@ func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Con } // Call service method - var respContent *CreateSimulationRunResponse + var respContent *DeleteScenarioGroupResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -675,7 +2907,7 @@ func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Con return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *CreateSimulationRunResponse and nil error while calling CreateSimulationRun. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *DeleteScenarioGroupResponse and nil error while calling DeleteScenarioGroup. nil responses are not supported")) return } @@ -699,7 +2931,7 @@ func (s *agentSimulationServer) serveCreateSimulationRunProtobuf(ctx context.Con callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServer) serveGetSimulationRun(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveListScenarioGroups(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") if i == -1 { @@ -707,9 +2939,9 @@ func (s *agentSimulationServer) serveGetSimulationRun(ctx context.Context, resp } switch strings.TrimSpace(strings.ToLower(header[:i])) { case "application/json": - s.serveGetSimulationRunJSON(ctx, resp, req) + s.serveListScenarioGroupsJSON(ctx, resp, req) case "application/protobuf": - s.serveGetSimulationRunProtobuf(ctx, resp, req) + s.serveListScenarioGroupsProtobuf(ctx, resp, req) default: msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) twerr := badRouteError(msg, req.Method, req.URL.Path) @@ -717,9 +2949,9 @@ func (s *agentSimulationServer) serveGetSimulationRun(ctx context.Context, resp } } -func (s *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveListScenarioGroupsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -732,29 +2964,29 @@ func (s *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, r s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } - reqContent := new(GetSimulationRunRequest) + reqContent := new(ListScenarioGroupsRequest) 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.AgentSimulation.GetSimulationRun + handler := s.AgentSimulation.ListScenarioGroups if s.interceptor != nil { - handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + handler = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*GetSimulationRunRequest) + typedReq, ok := req.(*ListScenarioGroupsRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") } - return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + return s.AgentSimulation.ListScenarioGroups(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*GetSimulationRunResponse) + typedResp, ok := resp.(*ListScenarioGroupsResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") } return typedResp, err } @@ -763,7 +2995,7 @@ func (s *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, r } // Call service method - var respContent *GetSimulationRunResponse + var respContent *ListScenarioGroupsResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -774,7 +3006,7 @@ func (s *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, r return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *GetSimulationRunResponse and nil error while calling GetSimulationRun. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenarioGroupsResponse and nil error while calling ListScenarioGroups. nil responses are not supported")) return } @@ -800,9 +3032,9 @@ func (s *agentSimulationServer) serveGetSimulationRunJSON(ctx context.Context, r callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveListScenarioGroupsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "GetSimulationRun") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarioGroups") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -814,28 +3046,28 @@ func (s *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Contex s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } - reqContent := new(GetSimulationRunRequest) + reqContent := new(ListScenarioGroupsRequest) if err = proto.Unmarshal(buf, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return } - handler := s.AgentSimulation.GetSimulationRun + handler := s.AgentSimulation.ListScenarioGroups if s.interceptor != nil { - handler = func(ctx context.Context, req *GetSimulationRunRequest) (*GetSimulationRunResponse, error) { + handler = func(ctx context.Context, req *ListScenarioGroupsRequest) (*ListScenarioGroupsResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*GetSimulationRunRequest) + typedReq, ok := req.(*ListScenarioGroupsRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*GetSimulationRunRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ListScenarioGroupsRequest) when calling interceptor") } - return s.AgentSimulation.GetSimulationRun(ctx, typedReq) + return s.AgentSimulation.ListScenarioGroups(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*GetSimulationRunResponse) + typedResp, ok := resp.(*ListScenarioGroupsResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*GetSimulationRunResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*ListScenarioGroupsResponse) when calling interceptor") } return typedResp, err } @@ -844,7 +3076,7 @@ func (s *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Contex } // Call service method - var respContent *GetSimulationRunResponse + var respContent *ListScenarioGroupsResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -855,7 +3087,7 @@ func (s *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Contex return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *GetSimulationRunResponse and nil error while calling GetSimulationRun. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenarioGroupsResponse and nil error while calling ListScenarioGroups. nil responses are not supported")) return } @@ -879,7 +3111,7 @@ func (s *agentSimulationServer) serveGetSimulationRunProtobuf(ctx context.Contex callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServer) serveListSimulationRuns(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveListScenarios(ctx context.Context, resp http.ResponseWriter, req *http.Request) { header := req.Header.Get("Content-Type") i := strings.Index(header, ";") if i == -1 { @@ -887,9 +3119,9 @@ func (s *agentSimulationServer) serveListSimulationRuns(ctx context.Context, res } switch strings.TrimSpace(strings.ToLower(header[:i])) { case "application/json": - s.serveListSimulationRunsJSON(ctx, resp, req) + s.serveListScenariosJSON(ctx, resp, req) case "application/protobuf": - s.serveListSimulationRunsProtobuf(ctx, resp, req) + s.serveListScenariosProtobuf(ctx, resp, req) default: msg := fmt.Sprintf("unexpected Content-Type: %q", req.Header.Get("Content-Type")) twerr := badRouteError(msg, req.Method, req.URL.Path) @@ -897,9 +3129,9 @@ func (s *agentSimulationServer) serveListSimulationRuns(ctx context.Context, res } } -func (s *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveListScenariosJSON(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -912,29 +3144,29 @@ func (s *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, s.handleRequestBodyError(ctx, resp, "the json request could not be decoded", err) return } - reqContent := new(ListSimulationRunsRequest) + reqContent := new(ListScenariosRequest) 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.AgentSimulation.ListSimulationRuns + handler := s.AgentSimulation.ListScenarios if s.interceptor != nil { - handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + handler = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*ListSimulationRunsRequest) + typedReq, ok := req.(*ListScenariosRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") } - return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + return s.AgentSimulation.ListScenarios(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*ListSimulationRunsResponse) + typedResp, ok := resp.(*ListScenariosResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") } return typedResp, err } @@ -943,7 +3175,7 @@ func (s *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, } // Call service method - var respContent *ListSimulationRunsResponse + var respContent *ListScenariosResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -954,7 +3186,7 @@ func (s *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenariosResponse and nil error while calling ListScenarios. nil responses are not supported")) return } @@ -980,9 +3212,9 @@ func (s *agentSimulationServer) serveListSimulationRunsJSON(ctx context.Context, callResponseSent(ctx, s.hooks) } -func (s *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { +func (s *agentSimulationServer) serveListScenariosProtobuf(ctx context.Context, resp http.ResponseWriter, req *http.Request) { var err error - ctx = ctxsetters.WithMethodName(ctx, "ListSimulationRuns") + ctx = ctxsetters.WithMethodName(ctx, "ListScenarios") ctx, err = callRequestRouted(ctx, s.hooks) if err != nil { s.writeError(ctx, resp, err) @@ -994,28 +3226,28 @@ func (s *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Cont s.handleRequestBodyError(ctx, resp, "failed to read request body", err) return } - reqContent := new(ListSimulationRunsRequest) + reqContent := new(ListScenariosRequest) if err = proto.Unmarshal(buf, reqContent); err != nil { s.writeError(ctx, resp, malformedRequestError("the protobuf request could not be decoded")) return } - handler := s.AgentSimulation.ListSimulationRuns + handler := s.AgentSimulation.ListScenarios if s.interceptor != nil { - handler = func(ctx context.Context, req *ListSimulationRunsRequest) (*ListSimulationRunsResponse, error) { + handler = func(ctx context.Context, req *ListScenariosRequest) (*ListScenariosResponse, error) { resp, err := s.interceptor( func(ctx context.Context, req interface{}) (interface{}, error) { - typedReq, ok := req.(*ListSimulationRunsRequest) + typedReq, ok := req.(*ListScenariosRequest) if !ok { - return nil, twirp.InternalError("failed type assertion req.(*ListSimulationRunsRequest) when calling interceptor") + return nil, twirp.InternalError("failed type assertion req.(*ListScenariosRequest) when calling interceptor") } - return s.AgentSimulation.ListSimulationRuns(ctx, typedReq) + return s.AgentSimulation.ListScenarios(ctx, typedReq) }, )(ctx, req) if resp != nil { - typedResp, ok := resp.(*ListSimulationRunsResponse) + typedResp, ok := resp.(*ListScenariosResponse) if !ok { - return nil, twirp.InternalError("failed type assertion resp.(*ListSimulationRunsResponse) when calling interceptor") + return nil, twirp.InternalError("failed type assertion resp.(*ListScenariosResponse) when calling interceptor") } return typedResp, err } @@ -1024,7 +3256,7 @@ func (s *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Cont } // Call service method - var respContent *ListSimulationRunsResponse + var respContent *ListScenariosResponse func() { defer ensurePanicResponses(ctx, resp, s.hooks) respContent, err = handler(ctx, reqContent) @@ -1035,7 +3267,7 @@ func (s *agentSimulationServer) serveListSimulationRunsProtobuf(ctx context.Cont return } if respContent == nil { - s.writeError(ctx, resp, twirp.InternalError("received a nil *ListSimulationRunsResponse and nil error while calling ListSimulationRuns. nil responses are not supported")) + s.writeError(ctx, resp, twirp.InternalError("received a nil *ListScenariosResponse and nil error while calling ListScenarios. nil responses are not supported")) return } @@ -1075,44 +3307,84 @@ func (s *agentSimulationServer) PathPrefix() string { } var twirpFileDescriptor8 = []byte{ - // 614 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x51, 0x6e, 0xd3, 0x40, - 0x10, 0xc5, 0x76, 0x9a, 0x2a, 0x53, 0x9a, 0x3a, 0x4b, 0x01, 0x63, 0x54, 0x94, 0xba, 0x48, 0x44, - 0x20, 0xb9, 0x52, 0x10, 0x1f, 0xf4, 0x2f, 0x34, 0x6e, 0x49, 0x09, 0xa6, 0x72, 0x52, 0x21, 0x10, - 0xc8, 0x38, 0xf6, 0xaa, 0x6c, 0xa9, 0xed, 0xe0, 0x5d, 0xf7, 0x1e, 0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x6c, - 0x92, 0x7e, 0x08, 0x06, 0x00, 0x00, + // 1259 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xef, 0x6e, 0xdb, 0x54, + 0x14, 0xc7, 0xce, 0xff, 0xd3, 0x25, 0x4d, 0xef, 0xda, 0xce, 0xf5, 0xd4, 0x36, 0x75, 0x27, 0x51, + 0x06, 0x4b, 0x51, 0x11, 0x12, 0x74, 0x42, 0x28, 0x2c, 0x69, 0x9b, 0xd1, 0x85, 0xce, 0x69, 0x99, + 0x86, 0x36, 0x65, 0x4e, 0x7c, 0x55, 0xbc, 0x25, 0x76, 0xf0, 0x9f, 0x8a, 0xbd, 0x02, 0x3c, 0x06, + 0x7c, 0xe2, 0x2d, 0x78, 0x00, 0x5e, 0x02, 0xc4, 0x17, 0x9e, 0x02, 0xd9, 0xbe, 0xb1, 0xef, 0x75, + 0xae, 0xb3, 0xb4, 0xeb, 0xf6, 0xad, 0x3e, 0xf7, 0xdc, 0xdf, 0xf9, 0xf7, 0x3b, 0xe7, 0xdc, 0x06, + 0x36, 0x86, 0xc6, 0x05, 0x7e, 0x65, 0xb8, 0x3d, 0xed, 0x1c, 0x9b, 0x6e, 0xcf, 0x31, 0x46, 0xde, + 0x50, 0x73, 0x0d, 0xcb, 0xac, 0x8f, 0x6d, 0xcb, 0xb5, 0x50, 0x81, 0x9c, 0x2b, 0x7f, 0x65, 0xa1, + 0xdc, 0x8d, 0x4e, 0x55, 0xcf, 0x44, 0x15, 0x10, 0x0d, 0x5d, 0x12, 0x6a, 0xc2, 0x4e, 0x49, 0x15, + 0x0d, 0x1d, 0xad, 0x03, 0x8c, 0x6d, 0xeb, 0x25, 0x1e, 0xb8, 0x3d, 0x43, 0x97, 0xc4, 0x40, 0x5e, + 0x22, 0x92, 0xb6, 0x8e, 0x3e, 0x87, 0xbc, 0xe3, 0x6a, 0xae, 0xe7, 0x48, 0x99,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0xf5, 0x55, + 0x94, 0x7d, 0x58, 0x3b, 0x36, 0x1c, 0x16, 0xc6, 0x99, 0xcf, 0x5b, 0xe5, 0x08, 0x64, 0xde, 0xdd, + 0x28, 0x63, 0x59, 0xdb, 0x33, 0x1d, 0x49, 0x08, 0x28, 0x96, 0xe6, 0x44, 0xa0, 0xa3, 0xfc, 0x29, + 0xc2, 0x0a, 0xc9, 0xfe, 0x84, 0x80, 0xf3, 0x25, 0x2c, 0xea, 0x00, 0x71, 0xd6, 0x4c, 0xcc, 0xcc, + 0x3d, 0x13, 0xb3, 0x69, 0x33, 0x71, 0x06, 0xa3, 0x8e, 0xa8, 0x31, 0x94, 0x0f, 0x82, 0xfd, 0x24, + 0x0a, 0x96, 0x1b, 0xd4, 0xbb, 0x99, 0x49, 0x87, 0xb0, 0x9a, 0xb4, 0x46, 0x2a, 0x71, 0x0f, 0x8a, + 0x93, 0x6e, 0x26, 0x94, 0xe0, 0x34, 0x7c, 0xa4, 0xa2, 0xfc, 0x26, 0x40, 0x8d, 0x45, 0x3a, 0xb0, + 0xad, 0x51, 0x17, 0x3b, 0x8e, 0x5f, 0xb3, 0xf9, 0xea, 0x72, 0x0b, 0x0a, 0x93, 0xdd, 0x21, 0x92, + 0x36, 0x0b, 0xb7, 0x06, 0x9d, 0xc7, 0x0c, 0x9b, 0xc7, 0xa8, 0x96, 0x59, 0xba, 0x96, 0x71, 0xbf, + 0xe6, 0x98, 0x7e, 0x55, 0x61, 0x6b, 0x86, 0x93, 0x57, 0x8b, 0xfc, 0x09, 0xac, 0x34, 0xf1, 0x10, + 0x5f, 0x9a, 0x85, 0x9b, 0xb0, 0x30, 0xc1, 0x88, 0x23, 0x86, 0x89, 0xa8, 0xad, 0x2b, 0x12, 0xac, + 0x26, 0x81, 0x43, 0x0f, 0x95, 0xbf, 0x45, 0x58, 0x39, 0x1b, 0xeb, 0xda, 0xb5, 0xdb, 0x7c, 0x7f, + 0xcf, 0x05, 0xba, 0xa4, 0xf9, 0xf4,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 0x73, 0xd0, 0xc6, 0xec, + 0xbd, 0x2b, 0x6f, 0xa6, 0x9e, 0x13, 0x48, 0x1b, 0xd6, 0x52, 0x97, 0x0a, 0xfa, 0x28, 0xe5, 0xf6, + 0xf4, 0x76, 0x94, 0xef, 0xce, 0xa3, 0x1a, 0x87, 0xc1, 0xb6, 0x12, 0x15, 0x06, 0x77, 0x1b, 0x51, + 0x61, 0xf0, 0x97, 0x8a, 0x0f, 0xc9, 0xce, 0x3b, 0x0a, 0x92, 0x3b, 0x76, 0x29, 0xc8, 0x94, 0x41, + 0x19, 0xd3, 0x90, 0xf9, 0x87, 0x65, 0x3b, 0x25, 0x50, 0x7a, 0xcc, 0x4c, 0xd3, 0x90, 0x3b, 0xe9, + 0x5e, 0xc0, 0x4d, 0xce, 0x48, 0xa1, 0x2c, 0xa4, 0x0f, 0x32, 0xca, 0xc2, 0x8c, 0xa9, 0x14, 0xf1, + 0x91, 0x19, 0x08, 0x49, 0x3e, 0xf2, 0x46, 0x56, 0x92, 0x8f, 0xfc, 0xd1, 0xd4, 0x81, 0x32, 0x33, + 0x07, 0xd0, 0x3a, 0xf7, 0x56, 0x04, 0xba, 0x91, 0x76, 0x1c, 0xe2, 0x7d, 0x73, 0xf0, 0xc3, 0xf6, + 0xb9, 0xe1, 0xfe, 0xe8, 0xf5, 0xeb, 0x03, 0x6b, 0xb4, 0x4b, 0x74, 0x77, 0x83, 0x1f, 0xa8, 0x06, + 0xd6, 0x70, 0x22, 0xf8, 0x43, 0x2c, 0x1f, 0x1b, 0x17, 0xf8, 0x5b, 0xc3, 0xad, 0x9f, 0xf8, 0x47, + 0xff, 0x89, 0x15, 0xf2, 0xbd, 0xbf, 0x1f, 0x08, 0xfa, 0xf9, 0xe0, 0xca, 0x67, 0xff, 0x07, 0x00, + 0x00, 0xff, 0xff, 0x87, 0xb4, 0xa3, 0xd1, 0xf5, 0x12, 0x00, 0x00, } From 166e02fa092ffbaf28cd7ef0f5b826191d38db19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Monnom?= Date: Wed, 18 Feb 2026 13:26:13 -0800 Subject: [PATCH 7/8] add cancelled --- protobufs/livekit_agent_simulation.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/protobufs/livekit_agent_simulation.proto b/protobufs/livekit_agent_simulation.proto index e1a54c2c4..533f19991 100644 --- a/protobufs/livekit_agent_simulation.proto +++ b/protobufs/livekit_agent_simulation.proto @@ -33,6 +33,7 @@ message SimulationRun { STATUS_RUNNING = 1; STATUS_COMPLETED = 2; STATUS_FAILED = 3; + STATUS_CANCELLED = 4; } string id = 1; Status status = 2; From 5550b30860f6e1e27e3e911717867f2f21464c9f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 21:26:53 +0000 Subject: [PATCH 8/8] generated protobuf --- livekit/livekit_agent_simulation.pb.go | 12 +- livekit/livekit_agent_simulation.twirp.go | 161 +++++++++++----------- 2 files changed, 89 insertions(+), 84 deletions(-) diff --git a/livekit/livekit_agent_simulation.pb.go b/livekit/livekit_agent_simulation.pb.go index 9b95e06a8..e2e9b5715 100644 --- a/livekit/livekit_agent_simulation.pb.go +++ b/livekit/livekit_agent_simulation.pb.go @@ -94,6 +94,7 @@ const ( SimulationRun_Job_STATUS_RUNNING SimulationRun_Job_Status = 1 SimulationRun_Job_STATUS_COMPLETED SimulationRun_Job_Status = 2 SimulationRun_Job_STATUS_FAILED SimulationRun_Job_Status = 3 + SimulationRun_Job_STATUS_CANCELLED SimulationRun_Job_Status = 4 ) // Enum value maps for SimulationRun_Job_Status. @@ -103,12 +104,14 @@ var ( 1: "STATUS_RUNNING", 2: "STATUS_COMPLETED", 3: "STATUS_FAILED", + 4: "STATUS_CANCELLED", } SimulationRun_Job_Status_value = map[string]int32{ "STATUS_PENDING": 0, "STATUS_RUNNING": 1, "STATUS_COMPLETED": 2, "STATUS_FAILED": 3, + "STATUS_CANCELLED": 4, } ) @@ -1707,7 +1710,7 @@ var File_livekit_agent_simulation_proto protoreflect.FileDescriptor const file_livekit_agent_simulation_proto_rawDesc = "" + "\n" + - "\x1elivekit_agent_simulation.proto\x12\alivekit\"\xcd\x04\n" + + "\x1elivekit_agent_simulation.proto\x12\alivekit\"\xe3\x04\n" + "\rSimulationRun\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x12\x1d\n" + "\n" + @@ -1717,17 +1720,18 @@ const file_livekit_agent_simulation_proto_rawDesc = "" + "\x05error\x18\x05 \x01(\tR\x05error\x12\x1d\n" + "\n" + "created_at\x18\x06 \x01(\x03R\tcreatedAt\x12.\n" + - "\x04jobs\x18\a \x03(\v2\x1a.livekit.SimulationRun.JobR\x04jobs\x1a\xe5\x01\n" + + "\x04jobs\x18\a \x03(\v2\x1a.livekit.SimulationRun.JobR\x04jobs\x1a\xfb\x01\n" + "\x03Job\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\x129\n" + "\x06status\x18\x02 \x01(\x0e2!.livekit.SimulationRun.Job.StatusR\x06status\x12\"\n" + "\finstructions\x18\x03 \x01(\tR\finstructions\x12\x14\n" + - "\x05error\x18\x04 \x01(\tR\x05error\"Y\n" + + "\x05error\x18\x04 \x01(\tR\x05error\"o\n" + "\x06Status\x12\x12\n" + "\x0eSTATUS_PENDING\x10\x00\x12\x12\n" + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + "\x10STATUS_COMPLETED\x10\x02\x12\x11\n" + - "\rSTATUS_FAILED\x10\x03\"\\\n" + + "\rSTATUS_FAILED\x10\x03\x12\x14\n" + + "\x10STATUS_CANCELLED\x10\x04\"\\\n" + "\x06Status\x12\x15\n" + "\x11STATUS_GENERATING\x10\x00\x12\x12\n" + "\x0eSTATUS_RUNNING\x10\x01\x12\x14\n" + diff --git a/livekit/livekit_agent_simulation.twirp.go b/livekit/livekit_agent_simulation.twirp.go index eedbf8920..cea1cce83 100644 --- a/livekit/livekit_agent_simulation.twirp.go +++ b/livekit/livekit_agent_simulation.twirp.go @@ -3307,84 +3307,85 @@ func (s *agentSimulationServer) PathPrefix() string { } var twirpFileDescriptor8 = []byte{ - // 1259 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xef, 0x6e, 0xdb, 0x54, - 0x14, 0xc7, 0xce, 0xff, 0xd3, 0x25, 0x4d, 0xef, 0xda, 0xce, 0xf5, 0xd4, 0x36, 0x75, 0x27, 0x51, - 0x06, 0x4b, 0x51, 0x11, 0x12, 0x74, 0x42, 0x28, 0x2c, 0x69, 0x9b, 0xd1, 0x85, 0xce, 0x69, 0x99, - 0x86, 0x36, 0x65, 0x4e, 0x7c, 0x55, 0xbc, 0x25, 0x76, 0xf0, 0x9f, 0x8a, 0xbd, 0x02, 0x3c, 0x06, - 0x7c, 0xe2, 0x2d, 0x78, 0x00, 0x5e, 0x02, 0xc4, 0x17, 0x9e, 0x02, 0xd9, 0xbe, 0xb1, 0xef, 0x75, - 0xae, 0xb3, 0xb4, 0xeb, 0xf6, 0xad, 0x3e, 0xf7, 0xdc, 0xdf, 0xf9, 0xf7, 0x3b, 0xe7, 0xdc, 0x06, - 0x36, 0x86, 0xc6, 0x05, 0x7e, 0x65, 0xb8, 0x3d, 0xed, 0x1c, 0x9b, 0x6e, 0xcf, 0x31, 0x46, 0xde, - 0x50, 0x73, 0x0d, 0xcb, 0xac, 0x8f, 0x6d, 0xcb, 0xb5, 0x50, 0x81, 0x9c, 0x2b, 0x7f, 0x65, 0xa1, - 0xdc, 0x8d, 0x4e, 0x55, 0xcf, 0x44, 0x15, 0x10, 0x0d, 0x5d, 0x12, 0x6a, 0xc2, 0x4e, 0x49, 0x15, - 0x0d, 0x1d, 0xad, 0x03, 0x8c, 0x6d, 0xeb, 0x25, 0x1e, 0xb8, 0x3d, 0x43, 0x97, 0xc4, 0x40, 0x5e, - 0x22, 0x92, 0xb6, 0x8e, 0x3e, 0x87, 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0xf0, 0x17, 0xf6, 0x56, 0xf9, 0x13, 0x59, 0xf5, 0x55, - 0x94, 0x7d, 0x58, 0x3b, 0x36, 0x1c, 0x16, 0xc6, 0x99, 0xcf, 0x5b, 0xe5, 0x08, 0x64, 0xde, 0xdd, - 0x28, 0x63, 0x59, 0xdb, 0x33, 0x1d, 0x49, 0x08, 0x28, 0x96, 0xe6, 0x44, 0xa0, 0xa3, 0xfc, 0x29, - 0xc2, 0x0a, 0xc9, 0xfe, 0x84, 0x80, 0xf3, 0x25, 0x2c, 0xea, 0x00, 0x71, 0xd6, 0x4c, 0xcc, 0xcc, - 0x3d, 0x13, 0xb3, 0x69, 0x33, 0x71, 0x06, 0xa3, 0x8e, 0xa8, 0x31, 0x94, 0x0f, 0x82, 0xfd, 0x24, - 0x0a, 0x96, 0x1b, 0xd4, 0xbb, 0x99, 0x49, 0x87, 0xb0, 0x9a, 0xb4, 0x46, 0x2a, 0x71, 0x0f, 0x8a, - 0x93, 0x6e, 0x26, 0x94, 0xe0, 0x34, 0x7c, 0xa4, 0xa2, 0xfc, 0x26, 0x40, 0x8d, 0x45, 0x3a, 0xb0, - 0xad, 0x51, 0x17, 0x3b, 0x8e, 0x5f, 0xb3, 0xf9, 0xea, 0x72, 0x0b, 0x0a, 0x93, 0xdd, 0x21, 0x92, - 0x36, 0x0b, 0xb7, 0x06, 0x9d, 0xc7, 0x0c, 0x9b, 0xc7, 0xa8, 0x96, 0x59, 0xba, 0x96, 0x71, 0xbf, - 0xe6, 0x98, 0x7e, 0x55, 0x61, 0x6b, 0x86, 0x93, 0x57, 0x8b, 0xfc, 0x09, 0xac, 0x34, 0xf1, 0x10, - 0x5f, 0x9a, 0x85, 0x9b, 0xb0, 0x30, 0xc1, 0x88, 0x23, 0x86, 0x89, 0xa8, 0xad, 0x2b, 0x12, 0xac, - 0x26, 0x81, 0x43, 0x0f, 0x95, 0xbf, 0x45, 0x58, 0x39, 0x1b, 0xeb, 0xda, 0xb5, 0xdb, 0x7c, 0x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bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x72, 0xdb, 0x44, + 0x14, 0x46, 0xf2, 0xff, 0x49, 0xed, 0x38, 0xdb, 0x24, 0x55, 0xd4, 0x49, 0xe2, 0x28, 0x9d, 0x21, + 0x14, 0xea, 0x30, 0x61, 0x98, 0x81, 0x74, 0x18, 0xc6, 0xc4, 0x4e, 0xe2, 0x92, 0x9a, 0x54, 0x4e, + 0xe8, 0xc0, 0xb4, 0xe3, 0xca, 0xd6, 0x4e, 0x50, 0x6b, 0x4b, 0x46, 0x3f, 0x19, 0xfa, 0x0a, 0xf0, + 0x18, 0x70, 0xc5, 0x5b, 0xf0, 0x2a, 0xf4, 0x8e, 0x57, 0xe0, 0x86, 0x91, 0xb4, 0x96, 0x76, 0xe5, + 0x95, 0xeb, 0x24, 0x2d, 0x77, 0xd1, 0xd9, 0xb3, 0xe7, 0xf7, 0x3b, 0xdf, 0xd9, 0x18, 0x36, 0x86, + 0xc6, 0x25, 0x7e, 0x65, 0xb8, 0x3d, 0xed, 0x02, 0x9b, 0x6e, 0xcf, 0x31, 0x46, 0xde, 0x50, 0x73, + 0x0d, 0xcb, 0xac, 0x8f, 0x6d, 0xcb, 0xb5, 0x50, 0x81, 0x9c, 0x2b, 0x6f, 0xb2, 0x50, 0xee, 0x46, + 0xa7, 0xaa, 0x67, 0xa2, 0x0a, 0x88, 0x86, 0x2e, 0x09, 0x35, 0x61, 0xa7, 0xa4, 0x8a, 0x86, 0x8e, + 0xd6, 0x01, 0xc6, 0xb6, 0xf5, 0x12, 0x0f, 0xdc, 0x9e, 0xa1, 0x4b, 0x62, 0x20, 0x2f, 0x11, 0x49, + 0x5b, 0x47, 0x9f, 0x43, 0xde, 0x71, 0x35, 0xd7, 0x73, 0xa4, 0x4c, 0x4d, 0xd8, 0xa9, 0xec, 0xad, + 0xd7, 0x89, 0xe9, 0x3a,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a, 0x85, + 0xc4, 0x68, 0x70, 0xb3, 0x7e, 0x6f, 0xa3, 0x91, 0xf4, 0x76, 0x3d, 0x80, 0x3c, 0x89, 0x36, 0x21, + 0xbd, 0xb6, 0x6f, 0xc2, 0x55, 0xca, 0xb3, 0x68, 0xef, 0xb0, 0x26, 0x49, 0x80, 0x5f, 0x41, 0x25, + 0x6a, 0x73, 0x50, 0xd5, 0x69, 0x52, 0x67, 0xee, 0x95, 0x1d, 0xfa, 0x53, 0xf9, 0x1e, 0x64, 0x16, + 0x78, 0x57, 0x09, 0x98, 0x6e, 0xac, 0xc8, 0x34, 0x56, 0x59, 0x87, 0xbb, 0x5c, 0xbb, 0x04, 0xd5, + 0x93, 0xad, 0x42, 0x1f, 0xce, 0xbb, 0x55, 0x9e, 0x93, 0xad, 0x92, 0xb8, 0x4b, 0xea, 0xf1, 0x35, + 0x2c, 0xb2, 0xf5, 0xe0, 0x2c, 0x18, 0x26, 0xa4, 0x0a, 0x53, 0x10, 0x47, 0x39, 0x85, 0x65, 0xda, + 0xbc, 0x73, 0xf3, 0x5a, 0x1c, 0xc3, 0x4a, 0xc2, 0x22, 0x89, 0x95, 0x79, 0x69, 0x09, 0x6f, 0x7f, + 0x69, 0xed, 0xfd, 0x56, 0x84, 0xc5, 0x86, 0x3f, 0x5f, 0xf1, 0x8e, 0x44, 0x2f, 0xe0, 0x36, 0xe7, + 0x5d, 0x82, 0xb6, 0x93, 0x2b, 0x86, 0xf3, 0xda, 0x90, 0xef, 0xcd, 0x56, 0x22, 0x61, 0x3e, 0x85, + 0x6a, 0xf2, 0x21, 0x81, 0x6a, 0xd1, 0xcd, 0x94, 0x97, 0x8c, 0xbc, 0x35, 0x43, 0x83, 0x18, 0x7e, + 0x0e, 0x68, 0xfa, 0x7d, 0x80, 0x94, 0xe8, 0x62, 0xea, 0xc3, 0x43, 0xde, 0x9e, 0xa9, 0x43, 0xcc, + 0x3f, 0x81, 0x0a, 0x3b, 0x39, 0x68, 0x63, 0xf6, 0xde, 0x95, 0x37, 0x53, 0xcf, 0x89, 0x49, 0x1b, + 0xd6, 0x52, 0x97, 0x0a, 0xfa, 0x28, 0xe5, 0xf6, 0xf4, 0x76, 0x94, 0xef, 0xcf, 0xa3, 0x1a, 0xa7, + 0xc1, 0x8e, 0x12, 0x95, 0x06, 0x77, 0x1b, 0x51, 0x69, 0xf0, 0x97, 0x8a, 0x6f, 0x92, 0xe5, 0x3b, + 0xca, 0x24, 0x97, 0x76, 0x29, 0x93, 0x29, 0x44, 0x19, 0xc3, 0x90, 0xf9, 0x87, 0x65, 0x3b, 0x25, + 0x51, 0x9a, 0x66, 0xa6, 0x61, 0xc8, 0x65, 0xba, 0x17, 0x70, 0x9b, 0x43, 0x29, 0x94, 0x87, 0x74, + 0x22, 0xa3, 0x3c, 0xcc, 0x60, 0xa5, 0x08, 0x8f, 0x0c, 0x21, 0x24, 0xf1, 0xc8, 0xa3, 0xac, 0x24, + 0x1e, 0xf9, 0xd4, 0xd4, 0x81, 0x32, 0xc3, 0x03, 0x68, 0x9d, 0x7b, 0x2b, 0x32, 0xba, 0x91, 0x76, + 0x1c, 0xda, 0xfb, 0xe6, 0xf0, 0xc7, 0xed, 0x0b, 0xc3, 0xfd, 0xc9, 0xeb, 0xd7, 0x07, 0xd6, 0x68, + 0x97, 0xe8, 0xee, 0x06, 0x3f, 0x5b, 0x0d, 0xac, 0xe1, 0x44, 0xf0, 0xa7, 0x58, 0x3e, 0x31, 0x2e, + 0xf1, 0xb7, 0x86, 0x5b, 0x3f, 0xf5, 0x8f, 0xfe, 0x11, 0x2b, 0xe4, 0x7b, 0x7f, 0x3f, 0x10, 0xf4, + 0xf3, 0xc1, 0x95, 0xcf, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x22, 0x71, 0x15, 0x0b, 0x13, + 0x00, 0x00, }