- Add new gRPC endpoint for Heartbeat in the Yao service, enabling communication with the sandbox. - Update Makefile to include a dedicated unit test target for Sandbox V2, ensuring proper testing of new features. - Enhance CI workflows to incorporate Sandbox V2 tests, allowing for dual-mode testing (local and remote) with Docker. - Modify .gitignore to exclude specific Docker files while allowing shell scripts for Sandbox V2. - Update documentation in DESIGN.md to reflect the new architecture and capabilities of the Sandbox V2. These changes enhance the Yao SDK's functionality, providing improved support for sandbox operations and testing.
646 lines
24 KiB
Go
646 lines
24 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.6.1
|
|
// - protoc v4.25.0
|
|
// source: grpc/pb/yao.proto
|
|
|
|
package pb
|
|
|
|
import (
|
|
context "context"
|
|
grpc "google.golang.org/grpc"
|
|
codes "google.golang.org/grpc/codes"
|
|
status "google.golang.org/grpc/status"
|
|
)
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the grpc package it is being compiled against.
|
|
// Requires gRPC-Go v1.64.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion9
|
|
|
|
const (
|
|
Yao_Run_FullMethodName = "/yao.Yao/Run"
|
|
Yao_Stream_FullMethodName = "/yao.Yao/Stream"
|
|
Yao_Shell_FullMethodName = "/yao.Yao/Shell"
|
|
Yao_ShellStream_FullMethodName = "/yao.Yao/ShellStream"
|
|
Yao_API_FullMethodName = "/yao.Yao/API"
|
|
Yao_MCPListTools_FullMethodName = "/yao.Yao/MCPListTools"
|
|
Yao_MCPCallTool_FullMethodName = "/yao.Yao/MCPCallTool"
|
|
Yao_MCPListResources_FullMethodName = "/yao.Yao/MCPListResources"
|
|
Yao_MCPReadResource_FullMethodName = "/yao.Yao/MCPReadResource"
|
|
Yao_ChatCompletions_FullMethodName = "/yao.Yao/ChatCompletions"
|
|
Yao_ChatCompletionsStream_FullMethodName = "/yao.Yao/ChatCompletionsStream"
|
|
Yao_AgentStream_FullMethodName = "/yao.Yao/AgentStream"
|
|
Yao_Healthz_FullMethodName = "/yao.Yao/Healthz"
|
|
Yao_Heartbeat_FullMethodName = "/yao.Yao/Heartbeat"
|
|
)
|
|
|
|
// YaoClient is the client API for Yao service.
|
|
//
|
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
|
//
|
|
// Yao gRPC gateway. Shares OAuth + ACL scope system with openapi.
|
|
type YaoClient interface {
|
|
// Base
|
|
Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (*RunResponse, error)
|
|
Stream(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Chunk], error)
|
|
Shell(ctx context.Context, in *ShellRequest, opts ...grpc.CallOption) (*ShellResponse, error)
|
|
ShellStream(ctx context.Context, in *ShellRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Chunk], error)
|
|
// API gateway
|
|
API(ctx context.Context, in *APIRequest, opts ...grpc.CallOption) (*APIResponse, error)
|
|
// MCP
|
|
MCPListTools(ctx context.Context, in *MCPListRequest, opts ...grpc.CallOption) (*MCPListResponse, error)
|
|
MCPCallTool(ctx context.Context, in *MCPCallRequest, opts ...grpc.CallOption) (*MCPCallResponse, error)
|
|
MCPListResources(ctx context.Context, in *MCPListRequest, opts ...grpc.CallOption) (*MCPResourcesResponse, error)
|
|
MCPReadResource(ctx context.Context, in *MCPResourceRequest, opts ...grpc.CallOption) (*MCPResourceResponse, error)
|
|
// AI - LLM
|
|
ChatCompletions(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (*ChatResponse, error)
|
|
ChatCompletionsStream(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ChatChunk], error)
|
|
// AI - Agent
|
|
AgentStream(ctx context.Context, in *AgentRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[AgentChunk], error)
|
|
// Health
|
|
Healthz(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HealthzResponse, error)
|
|
// Sandbox
|
|
Heartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*HeartbeatResponse, error)
|
|
}
|
|
|
|
type yaoClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewYaoClient(cc grpc.ClientConnInterface) YaoClient {
|
|
return &yaoClient{cc}
|
|
}
|
|
|
|
func (c *yaoClient) Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (*RunResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(RunResponse)
|
|
err := c.cc.Invoke(ctx, Yao_Run_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) Stream(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Chunk], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &Yao_ServiceDesc.Streams[0], Yao_Stream_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[RunRequest, Chunk]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_StreamClient = grpc.ServerStreamingClient[Chunk]
|
|
|
|
func (c *yaoClient) Shell(ctx context.Context, in *ShellRequest, opts ...grpc.CallOption) (*ShellResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ShellResponse)
|
|
err := c.cc.Invoke(ctx, Yao_Shell_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) ShellStream(ctx context.Context, in *ShellRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Chunk], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &Yao_ServiceDesc.Streams[1], Yao_ShellStream_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[ShellRequest, Chunk]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_ShellStreamClient = grpc.ServerStreamingClient[Chunk]
|
|
|
|
func (c *yaoClient) API(ctx context.Context, in *APIRequest, opts ...grpc.CallOption) (*APIResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(APIResponse)
|
|
err := c.cc.Invoke(ctx, Yao_API_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) MCPListTools(ctx context.Context, in *MCPListRequest, opts ...grpc.CallOption) (*MCPListResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(MCPListResponse)
|
|
err := c.cc.Invoke(ctx, Yao_MCPListTools_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) MCPCallTool(ctx context.Context, in *MCPCallRequest, opts ...grpc.CallOption) (*MCPCallResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(MCPCallResponse)
|
|
err := c.cc.Invoke(ctx, Yao_MCPCallTool_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) MCPListResources(ctx context.Context, in *MCPListRequest, opts ...grpc.CallOption) (*MCPResourcesResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(MCPResourcesResponse)
|
|
err := c.cc.Invoke(ctx, Yao_MCPListResources_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) MCPReadResource(ctx context.Context, in *MCPResourceRequest, opts ...grpc.CallOption) (*MCPResourceResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(MCPResourceResponse)
|
|
err := c.cc.Invoke(ctx, Yao_MCPReadResource_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) ChatCompletions(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (*ChatResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ChatResponse)
|
|
err := c.cc.Invoke(ctx, Yao_ChatCompletions_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) ChatCompletionsStream(ctx context.Context, in *ChatRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[ChatChunk], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &Yao_ServiceDesc.Streams[2], Yao_ChatCompletionsStream_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[ChatRequest, ChatChunk]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_ChatCompletionsStreamClient = grpc.ServerStreamingClient[ChatChunk]
|
|
|
|
func (c *yaoClient) AgentStream(ctx context.Context, in *AgentRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[AgentChunk], error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
stream, err := c.cc.NewStream(ctx, &Yao_ServiceDesc.Streams[3], Yao_AgentStream_FullMethodName, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &grpc.GenericClientStream[AgentRequest, AgentChunk]{ClientStream: stream}
|
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.ClientStream.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_AgentStreamClient = grpc.ServerStreamingClient[AgentChunk]
|
|
|
|
func (c *yaoClient) Healthz(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*HealthzResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(HealthzResponse)
|
|
err := c.cc.Invoke(ctx, Yao_Healthz_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *yaoClient) Heartbeat(ctx context.Context, in *HeartbeatRequest, opts ...grpc.CallOption) (*HeartbeatResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(HeartbeatResponse)
|
|
err := c.cc.Invoke(ctx, Yao_Heartbeat_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// YaoServer is the server API for Yao service.
|
|
// All implementations must embed UnimplementedYaoServer
|
|
// for forward compatibility.
|
|
//
|
|
// Yao gRPC gateway. Shares OAuth + ACL scope system with openapi.
|
|
type YaoServer interface {
|
|
// Base
|
|
Run(context.Context, *RunRequest) (*RunResponse, error)
|
|
Stream(*RunRequest, grpc.ServerStreamingServer[Chunk]) error
|
|
Shell(context.Context, *ShellRequest) (*ShellResponse, error)
|
|
ShellStream(*ShellRequest, grpc.ServerStreamingServer[Chunk]) error
|
|
// API gateway
|
|
API(context.Context, *APIRequest) (*APIResponse, error)
|
|
// MCP
|
|
MCPListTools(context.Context, *MCPListRequest) (*MCPListResponse, error)
|
|
MCPCallTool(context.Context, *MCPCallRequest) (*MCPCallResponse, error)
|
|
MCPListResources(context.Context, *MCPListRequest) (*MCPResourcesResponse, error)
|
|
MCPReadResource(context.Context, *MCPResourceRequest) (*MCPResourceResponse, error)
|
|
// AI - LLM
|
|
ChatCompletions(context.Context, *ChatRequest) (*ChatResponse, error)
|
|
ChatCompletionsStream(*ChatRequest, grpc.ServerStreamingServer[ChatChunk]) error
|
|
// AI - Agent
|
|
AgentStream(*AgentRequest, grpc.ServerStreamingServer[AgentChunk]) error
|
|
// Health
|
|
Healthz(context.Context, *Empty) (*HealthzResponse, error)
|
|
// Sandbox
|
|
Heartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error)
|
|
mustEmbedUnimplementedYaoServer()
|
|
}
|
|
|
|
// UnimplementedYaoServer must be embedded to have
|
|
// forward compatible implementations.
|
|
//
|
|
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
|
// pointer dereference when methods are called.
|
|
type UnimplementedYaoServer struct{}
|
|
|
|
func (UnimplementedYaoServer) Run(context.Context, *RunRequest) (*RunResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Run not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) Stream(*RunRequest, grpc.ServerStreamingServer[Chunk]) error {
|
|
return status.Error(codes.Unimplemented, "method Stream not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) Shell(context.Context, *ShellRequest) (*ShellResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Shell not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) ShellStream(*ShellRequest, grpc.ServerStreamingServer[Chunk]) error {
|
|
return status.Error(codes.Unimplemented, "method ShellStream not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) API(context.Context, *APIRequest) (*APIResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method API not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) MCPListTools(context.Context, *MCPListRequest) (*MCPListResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method MCPListTools not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) MCPCallTool(context.Context, *MCPCallRequest) (*MCPCallResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method MCPCallTool not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) MCPListResources(context.Context, *MCPListRequest) (*MCPResourcesResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method MCPListResources not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) MCPReadResource(context.Context, *MCPResourceRequest) (*MCPResourceResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method MCPReadResource not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) ChatCompletions(context.Context, *ChatRequest) (*ChatResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method ChatCompletions not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) ChatCompletionsStream(*ChatRequest, grpc.ServerStreamingServer[ChatChunk]) error {
|
|
return status.Error(codes.Unimplemented, "method ChatCompletionsStream not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) AgentStream(*AgentRequest, grpc.ServerStreamingServer[AgentChunk]) error {
|
|
return status.Error(codes.Unimplemented, "method AgentStream not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) Healthz(context.Context, *Empty) (*HealthzResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Healthz not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) Heartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error) {
|
|
return nil, status.Error(codes.Unimplemented, "method Heartbeat not implemented")
|
|
}
|
|
func (UnimplementedYaoServer) mustEmbedUnimplementedYaoServer() {}
|
|
func (UnimplementedYaoServer) testEmbeddedByValue() {}
|
|
|
|
// UnsafeYaoServer may be embedded to opt out of forward compatibility for this service.
|
|
// Use of this interface is not recommended, as added methods to YaoServer will
|
|
// result in compilation errors.
|
|
type UnsafeYaoServer interface {
|
|
mustEmbedUnimplementedYaoServer()
|
|
}
|
|
|
|
func RegisterYaoServer(s grpc.ServiceRegistrar, srv YaoServer) {
|
|
// If the following call panics, it indicates UnimplementedYaoServer was
|
|
// embedded by pointer and is nil. This will cause panics if an
|
|
// unimplemented method is ever invoked, so we test this at initialization
|
|
// time to prevent it from happening at runtime later due to I/O.
|
|
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
|
t.testEmbeddedByValue()
|
|
}
|
|
s.RegisterService(&Yao_ServiceDesc, srv)
|
|
}
|
|
|
|
func _Yao_Run_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(RunRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).Run(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_Run_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).Run(ctx, req.(*RunRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_Stream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(RunRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(YaoServer).Stream(m, &grpc.GenericServerStream[RunRequest, Chunk]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_StreamServer = grpc.ServerStreamingServer[Chunk]
|
|
|
|
func _Yao_Shell_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ShellRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).Shell(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_Shell_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).Shell(ctx, req.(*ShellRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_ShellStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(ShellRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(YaoServer).ShellStream(m, &grpc.GenericServerStream[ShellRequest, Chunk]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_ShellStreamServer = grpc.ServerStreamingServer[Chunk]
|
|
|
|
func _Yao_API_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(APIRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).API(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_API_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).API(ctx, req.(*APIRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_MCPListTools_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(MCPListRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).MCPListTools(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_MCPListTools_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).MCPListTools(ctx, req.(*MCPListRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_MCPCallTool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(MCPCallRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).MCPCallTool(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_MCPCallTool_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).MCPCallTool(ctx, req.(*MCPCallRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_MCPListResources_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(MCPListRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).MCPListResources(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_MCPListResources_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).MCPListResources(ctx, req.(*MCPListRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_MCPReadResource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(MCPResourceRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).MCPReadResource(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_MCPReadResource_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).MCPReadResource(ctx, req.(*MCPResourceRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_ChatCompletions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ChatRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).ChatCompletions(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_ChatCompletions_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).ChatCompletions(ctx, req.(*ChatRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_ChatCompletionsStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(ChatRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(YaoServer).ChatCompletionsStream(m, &grpc.GenericServerStream[ChatRequest, ChatChunk]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_ChatCompletionsStreamServer = grpc.ServerStreamingServer[ChatChunk]
|
|
|
|
func _Yao_AgentStream_Handler(srv interface{}, stream grpc.ServerStream) error {
|
|
m := new(AgentRequest)
|
|
if err := stream.RecvMsg(m); err != nil {
|
|
return err
|
|
}
|
|
return srv.(YaoServer).AgentStream(m, &grpc.GenericServerStream[AgentRequest, AgentChunk]{ServerStream: stream})
|
|
}
|
|
|
|
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
|
|
type Yao_AgentStreamServer = grpc.ServerStreamingServer[AgentChunk]
|
|
|
|
func _Yao_Healthz_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(Empty)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).Healthz(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_Healthz_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).Healthz(ctx, req.(*Empty))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _Yao_Heartbeat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(HeartbeatRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(YaoServer).Heartbeat(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: Yao_Heartbeat_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(YaoServer).Heartbeat(ctx, req.(*HeartbeatRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// Yao_ServiceDesc is the grpc.ServiceDesc for Yao service.
|
|
// It's only intended for direct use with grpc.RegisterService,
|
|
// and not to be introspected or modified (even as a copy)
|
|
var Yao_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "yao.Yao",
|
|
HandlerType: (*YaoServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Run",
|
|
Handler: _Yao_Run_Handler,
|
|
},
|
|
{
|
|
MethodName: "Shell",
|
|
Handler: _Yao_Shell_Handler,
|
|
},
|
|
{
|
|
MethodName: "API",
|
|
Handler: _Yao_API_Handler,
|
|
},
|
|
{
|
|
MethodName: "MCPListTools",
|
|
Handler: _Yao_MCPListTools_Handler,
|
|
},
|
|
{
|
|
MethodName: "MCPCallTool",
|
|
Handler: _Yao_MCPCallTool_Handler,
|
|
},
|
|
{
|
|
MethodName: "MCPListResources",
|
|
Handler: _Yao_MCPListResources_Handler,
|
|
},
|
|
{
|
|
MethodName: "MCPReadResource",
|
|
Handler: _Yao_MCPReadResource_Handler,
|
|
},
|
|
{
|
|
MethodName: "ChatCompletions",
|
|
Handler: _Yao_ChatCompletions_Handler,
|
|
},
|
|
{
|
|
MethodName: "Healthz",
|
|
Handler: _Yao_Healthz_Handler,
|
|
},
|
|
{
|
|
MethodName: "Heartbeat",
|
|
Handler: _Yao_Heartbeat_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{
|
|
{
|
|
StreamName: "Stream",
|
|
Handler: _Yao_Stream_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
{
|
|
StreamName: "ShellStream",
|
|
Handler: _Yao_ShellStream_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
{
|
|
StreamName: "ChatCompletionsStream",
|
|
Handler: _Yao_ChatCompletionsStream_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
{
|
|
StreamName: "AgentStream",
|
|
Handler: _Yao_AgentStream_Handler,
|
|
ServerStreams: true,
|
|
},
|
|
},
|
|
Metadata: "grpc/pb/yao.proto",
|
|
}
|