## Why PR #26797 was accidentally merged into the stale `graphite-base/26797` branch instead of `main` (Graphite picked the wrong base), so its changes never landed on `main`. This PR re-lands that work as a clean cherry-pick onto the current `main`. ## What Adds a `WatchAIProviders` streaming RPC to the `ProviderConfigurator` service so a running standalone AI Gateway refetches its provider set when the provider configuration changes. The server subscribes to `AIProvidersChangedChannel` (published by the provider CRUD endpoints) and forwards each event as a payload-free signal, plus one signal on subscribe; the gateway calls `GetAIProviders` on each signal to rebuild its pool. The aibridged API is bumped to v1.2. Env-seeded providers don't need a signal: seeding finishes before coderd serves the gateway connection, so the gateway's initial fetch already reflects the seeded set. ## For reviewers The change is split into two commits to make review easy: 1. **`feat: synchronise provider changes with WatchAIProviders`** is a faithful cherry-pick of #26797, identical to the originally reviewed PR. It is committed without pre-commit hooks because it does not build against current `main` on its own. 2. **`fix: resolve cherry-pick conflicts against main`** contains only the deltas needed to re-land on current `main`, and passes the full pre-commit suite: - `coderd/aibridged/proto/aibridged.pb.go` regenerated via the proto make target (the cherry-picked copy was generated against the older proto). - `enterprise/cli/aigatewaystart.go` import block unioned; `main` added `os` and `strings` while the PR added `sync`. - Three `aibridgedserver.NewServer` test call sites that landed on `main` after the original branch diverged now pass the new `pubsub` argument. Refs https://linear.app/codercom/issue/AIGOV-465 *This PR was produced by opencode (agent) using the `anthropic/claude-opus-4-8` model, under human direction and review.*
685 lines
25 KiB
Go
685 lines
25 KiB
Go
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
|
// protoc-gen-go-drpc version: v0.0.34
|
|
// source: coderd/aibridged/proto/aibridged.proto
|
|
|
|
package proto
|
|
|
|
import (
|
|
context "context"
|
|
errors "errors"
|
|
protojson "google.golang.org/protobuf/encoding/protojson"
|
|
proto "google.golang.org/protobuf/proto"
|
|
drpc "storj.io/drpc"
|
|
drpcerr "storj.io/drpc/drpcerr"
|
|
)
|
|
|
|
type drpcEncoding_File_coderd_aibridged_proto_aibridged_proto struct{}
|
|
|
|
func (drpcEncoding_File_coderd_aibridged_proto_aibridged_proto) Marshal(msg drpc.Message) ([]byte, error) {
|
|
return proto.Marshal(msg.(proto.Message))
|
|
}
|
|
|
|
func (drpcEncoding_File_coderd_aibridged_proto_aibridged_proto) MarshalAppend(buf []byte, msg drpc.Message) ([]byte, error) {
|
|
return proto.MarshalOptions{}.MarshalAppend(buf, msg.(proto.Message))
|
|
}
|
|
|
|
func (drpcEncoding_File_coderd_aibridged_proto_aibridged_proto) Unmarshal(buf []byte, msg drpc.Message) error {
|
|
return proto.Unmarshal(buf, msg.(proto.Message))
|
|
}
|
|
|
|
func (drpcEncoding_File_coderd_aibridged_proto_aibridged_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
|
|
return protojson.Marshal(msg.(proto.Message))
|
|
}
|
|
|
|
func (drpcEncoding_File_coderd_aibridged_proto_aibridged_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
|
|
return protojson.Unmarshal(buf, msg.(proto.Message))
|
|
}
|
|
|
|
type DRPCRecorderClient interface {
|
|
DRPCConn() drpc.Conn
|
|
|
|
RecordInterception(ctx context.Context, in *RecordInterceptionRequest) (*RecordInterceptionResponse, error)
|
|
RecordInterceptionEnded(ctx context.Context, in *RecordInterceptionEndedRequest) (*RecordInterceptionEndedResponse, error)
|
|
RecordTokenUsage(ctx context.Context, in *RecordTokenUsageRequest) (*RecordTokenUsageResponse, error)
|
|
RecordPromptUsage(ctx context.Context, in *RecordPromptUsageRequest) (*RecordPromptUsageResponse, error)
|
|
RecordToolUsage(ctx context.Context, in *RecordToolUsageRequest) (*RecordToolUsageResponse, error)
|
|
RecordModelThought(ctx context.Context, in *RecordModelThoughtRequest) (*RecordModelThoughtResponse, error)
|
|
}
|
|
|
|
type drpcRecorderClient struct {
|
|
cc drpc.Conn
|
|
}
|
|
|
|
func NewDRPCRecorderClient(cc drpc.Conn) DRPCRecorderClient {
|
|
return &drpcRecorderClient{cc}
|
|
}
|
|
|
|
func (c *drpcRecorderClient) DRPCConn() drpc.Conn { return c.cc }
|
|
|
|
func (c *drpcRecorderClient) RecordInterception(ctx context.Context, in *RecordInterceptionRequest) (*RecordInterceptionResponse, error) {
|
|
out := new(RecordInterceptionResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Recorder/RecordInterception", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcRecorderClient) RecordInterceptionEnded(ctx context.Context, in *RecordInterceptionEndedRequest) (*RecordInterceptionEndedResponse, error) {
|
|
out := new(RecordInterceptionEndedResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Recorder/RecordInterceptionEnded", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcRecorderClient) RecordTokenUsage(ctx context.Context, in *RecordTokenUsageRequest) (*RecordTokenUsageResponse, error) {
|
|
out := new(RecordTokenUsageResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Recorder/RecordTokenUsage", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcRecorderClient) RecordPromptUsage(ctx context.Context, in *RecordPromptUsageRequest) (*RecordPromptUsageResponse, error) {
|
|
out := new(RecordPromptUsageResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Recorder/RecordPromptUsage", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcRecorderClient) RecordToolUsage(ctx context.Context, in *RecordToolUsageRequest) (*RecordToolUsageResponse, error) {
|
|
out := new(RecordToolUsageResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Recorder/RecordToolUsage", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcRecorderClient) RecordModelThought(ctx context.Context, in *RecordModelThoughtRequest) (*RecordModelThoughtResponse, error) {
|
|
out := new(RecordModelThoughtResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Recorder/RecordModelThought", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
type DRPCRecorderServer interface {
|
|
RecordInterception(context.Context, *RecordInterceptionRequest) (*RecordInterceptionResponse, error)
|
|
RecordInterceptionEnded(context.Context, *RecordInterceptionEndedRequest) (*RecordInterceptionEndedResponse, error)
|
|
RecordTokenUsage(context.Context, *RecordTokenUsageRequest) (*RecordTokenUsageResponse, error)
|
|
RecordPromptUsage(context.Context, *RecordPromptUsageRequest) (*RecordPromptUsageResponse, error)
|
|
RecordToolUsage(context.Context, *RecordToolUsageRequest) (*RecordToolUsageResponse, error)
|
|
RecordModelThought(context.Context, *RecordModelThoughtRequest) (*RecordModelThoughtResponse, error)
|
|
}
|
|
|
|
type DRPCRecorderUnimplementedServer struct{}
|
|
|
|
func (s *DRPCRecorderUnimplementedServer) RecordInterception(context.Context, *RecordInterceptionRequest) (*RecordInterceptionResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCRecorderUnimplementedServer) RecordInterceptionEnded(context.Context, *RecordInterceptionEndedRequest) (*RecordInterceptionEndedResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCRecorderUnimplementedServer) RecordTokenUsage(context.Context, *RecordTokenUsageRequest) (*RecordTokenUsageResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCRecorderUnimplementedServer) RecordPromptUsage(context.Context, *RecordPromptUsageRequest) (*RecordPromptUsageResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCRecorderUnimplementedServer) RecordToolUsage(context.Context, *RecordToolUsageRequest) (*RecordToolUsageResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCRecorderUnimplementedServer) RecordModelThought(context.Context, *RecordModelThoughtRequest) (*RecordModelThoughtResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
type DRPCRecorderDescription struct{}
|
|
|
|
func (DRPCRecorderDescription) NumMethods() int { return 6 }
|
|
|
|
func (DRPCRecorderDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
|
switch n {
|
|
case 0:
|
|
return "/proto.Recorder/RecordInterception", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCRecorderServer).
|
|
RecordInterception(
|
|
ctx,
|
|
in1.(*RecordInterceptionRequest),
|
|
)
|
|
}, DRPCRecorderServer.RecordInterception, true
|
|
case 1:
|
|
return "/proto.Recorder/RecordInterceptionEnded", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCRecorderServer).
|
|
RecordInterceptionEnded(
|
|
ctx,
|
|
in1.(*RecordInterceptionEndedRequest),
|
|
)
|
|
}, DRPCRecorderServer.RecordInterceptionEnded, true
|
|
case 2:
|
|
return "/proto.Recorder/RecordTokenUsage", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCRecorderServer).
|
|
RecordTokenUsage(
|
|
ctx,
|
|
in1.(*RecordTokenUsageRequest),
|
|
)
|
|
}, DRPCRecorderServer.RecordTokenUsage, true
|
|
case 3:
|
|
return "/proto.Recorder/RecordPromptUsage", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCRecorderServer).
|
|
RecordPromptUsage(
|
|
ctx,
|
|
in1.(*RecordPromptUsageRequest),
|
|
)
|
|
}, DRPCRecorderServer.RecordPromptUsage, true
|
|
case 4:
|
|
return "/proto.Recorder/RecordToolUsage", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCRecorderServer).
|
|
RecordToolUsage(
|
|
ctx,
|
|
in1.(*RecordToolUsageRequest),
|
|
)
|
|
}, DRPCRecorderServer.RecordToolUsage, true
|
|
case 5:
|
|
return "/proto.Recorder/RecordModelThought", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCRecorderServer).
|
|
RecordModelThought(
|
|
ctx,
|
|
in1.(*RecordModelThoughtRequest),
|
|
)
|
|
}, DRPCRecorderServer.RecordModelThought, true
|
|
default:
|
|
return "", nil, nil, nil, false
|
|
}
|
|
}
|
|
|
|
func DRPCRegisterRecorder(mux drpc.Mux, impl DRPCRecorderServer) error {
|
|
return mux.Register(impl, DRPCRecorderDescription{})
|
|
}
|
|
|
|
type DRPCRecorder_RecordInterceptionStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*RecordInterceptionResponse) error
|
|
}
|
|
|
|
type drpcRecorder_RecordInterceptionStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcRecorder_RecordInterceptionStream) SendAndClose(m *RecordInterceptionResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCRecorder_RecordInterceptionEndedStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*RecordInterceptionEndedResponse) error
|
|
}
|
|
|
|
type drpcRecorder_RecordInterceptionEndedStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcRecorder_RecordInterceptionEndedStream) SendAndClose(m *RecordInterceptionEndedResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCRecorder_RecordTokenUsageStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*RecordTokenUsageResponse) error
|
|
}
|
|
|
|
type drpcRecorder_RecordTokenUsageStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcRecorder_RecordTokenUsageStream) SendAndClose(m *RecordTokenUsageResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCRecorder_RecordPromptUsageStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*RecordPromptUsageResponse) error
|
|
}
|
|
|
|
type drpcRecorder_RecordPromptUsageStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcRecorder_RecordPromptUsageStream) SendAndClose(m *RecordPromptUsageResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCRecorder_RecordToolUsageStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*RecordToolUsageResponse) error
|
|
}
|
|
|
|
type drpcRecorder_RecordToolUsageStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcRecorder_RecordToolUsageStream) SendAndClose(m *RecordToolUsageResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCRecorder_RecordModelThoughtStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*RecordModelThoughtResponse) error
|
|
}
|
|
|
|
type drpcRecorder_RecordModelThoughtStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcRecorder_RecordModelThoughtStream) SendAndClose(m *RecordModelThoughtResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCMCPConfiguratorClient interface {
|
|
DRPCConn() drpc.Conn
|
|
|
|
GetMCPServerConfigs(ctx context.Context, in *GetMCPServerConfigsRequest) (*GetMCPServerConfigsResponse, error)
|
|
GetMCPServerAccessTokensBatch(ctx context.Context, in *GetMCPServerAccessTokensBatchRequest) (*GetMCPServerAccessTokensBatchResponse, error)
|
|
}
|
|
|
|
type drpcMCPConfiguratorClient struct {
|
|
cc drpc.Conn
|
|
}
|
|
|
|
func NewDRPCMCPConfiguratorClient(cc drpc.Conn) DRPCMCPConfiguratorClient {
|
|
return &drpcMCPConfiguratorClient{cc}
|
|
}
|
|
|
|
func (c *drpcMCPConfiguratorClient) DRPCConn() drpc.Conn { return c.cc }
|
|
|
|
func (c *drpcMCPConfiguratorClient) GetMCPServerConfigs(ctx context.Context, in *GetMCPServerConfigsRequest) (*GetMCPServerConfigsResponse, error) {
|
|
out := new(GetMCPServerConfigsResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.MCPConfigurator/GetMCPServerConfigs", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcMCPConfiguratorClient) GetMCPServerAccessTokensBatch(ctx context.Context, in *GetMCPServerAccessTokensBatchRequest) (*GetMCPServerAccessTokensBatchResponse, error) {
|
|
out := new(GetMCPServerAccessTokensBatchResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.MCPConfigurator/GetMCPServerAccessTokensBatch", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
type DRPCMCPConfiguratorServer interface {
|
|
GetMCPServerConfigs(context.Context, *GetMCPServerConfigsRequest) (*GetMCPServerConfigsResponse, error)
|
|
GetMCPServerAccessTokensBatch(context.Context, *GetMCPServerAccessTokensBatchRequest) (*GetMCPServerAccessTokensBatchResponse, error)
|
|
}
|
|
|
|
type DRPCMCPConfiguratorUnimplementedServer struct{}
|
|
|
|
func (s *DRPCMCPConfiguratorUnimplementedServer) GetMCPServerConfigs(context.Context, *GetMCPServerConfigsRequest) (*GetMCPServerConfigsResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCMCPConfiguratorUnimplementedServer) GetMCPServerAccessTokensBatch(context.Context, *GetMCPServerAccessTokensBatchRequest) (*GetMCPServerAccessTokensBatchResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
type DRPCMCPConfiguratorDescription struct{}
|
|
|
|
func (DRPCMCPConfiguratorDescription) NumMethods() int { return 2 }
|
|
|
|
func (DRPCMCPConfiguratorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
|
switch n {
|
|
case 0:
|
|
return "/proto.MCPConfigurator/GetMCPServerConfigs", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCMCPConfiguratorServer).
|
|
GetMCPServerConfigs(
|
|
ctx,
|
|
in1.(*GetMCPServerConfigsRequest),
|
|
)
|
|
}, DRPCMCPConfiguratorServer.GetMCPServerConfigs, true
|
|
case 1:
|
|
return "/proto.MCPConfigurator/GetMCPServerAccessTokensBatch", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCMCPConfiguratorServer).
|
|
GetMCPServerAccessTokensBatch(
|
|
ctx,
|
|
in1.(*GetMCPServerAccessTokensBatchRequest),
|
|
)
|
|
}, DRPCMCPConfiguratorServer.GetMCPServerAccessTokensBatch, true
|
|
default:
|
|
return "", nil, nil, nil, false
|
|
}
|
|
}
|
|
|
|
func DRPCRegisterMCPConfigurator(mux drpc.Mux, impl DRPCMCPConfiguratorServer) error {
|
|
return mux.Register(impl, DRPCMCPConfiguratorDescription{})
|
|
}
|
|
|
|
type DRPCMCPConfigurator_GetMCPServerConfigsStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*GetMCPServerConfigsResponse) error
|
|
}
|
|
|
|
type drpcMCPConfigurator_GetMCPServerConfigsStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcMCPConfigurator_GetMCPServerConfigsStream) SendAndClose(m *GetMCPServerConfigsResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCMCPConfigurator_GetMCPServerAccessTokensBatchStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*GetMCPServerAccessTokensBatchResponse) error
|
|
}
|
|
|
|
type drpcMCPConfigurator_GetMCPServerAccessTokensBatchStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcMCPConfigurator_GetMCPServerAccessTokensBatchStream) SendAndClose(m *GetMCPServerAccessTokensBatchResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCAuthorizerClient interface {
|
|
DRPCConn() drpc.Conn
|
|
|
|
IsAuthorized(ctx context.Context, in *IsAuthorizedRequest) (*IsAuthorizedResponse, error)
|
|
IsBudgetExceeded(ctx context.Context, in *IsBudgetExceededRequest) (*IsBudgetExceededResponse, error)
|
|
}
|
|
|
|
type drpcAuthorizerClient struct {
|
|
cc drpc.Conn
|
|
}
|
|
|
|
func NewDRPCAuthorizerClient(cc drpc.Conn) DRPCAuthorizerClient {
|
|
return &drpcAuthorizerClient{cc}
|
|
}
|
|
|
|
func (c *drpcAuthorizerClient) DRPCConn() drpc.Conn { return c.cc }
|
|
|
|
func (c *drpcAuthorizerClient) IsAuthorized(ctx context.Context, in *IsAuthorizedRequest) (*IsAuthorizedResponse, error) {
|
|
out := new(IsAuthorizedResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Authorizer/IsAuthorized", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcAuthorizerClient) IsBudgetExceeded(ctx context.Context, in *IsBudgetExceededRequest) (*IsBudgetExceededResponse, error) {
|
|
out := new(IsBudgetExceededResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.Authorizer/IsBudgetExceeded", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
type DRPCAuthorizerServer interface {
|
|
IsAuthorized(context.Context, *IsAuthorizedRequest) (*IsAuthorizedResponse, error)
|
|
IsBudgetExceeded(context.Context, *IsBudgetExceededRequest) (*IsBudgetExceededResponse, error)
|
|
}
|
|
|
|
type DRPCAuthorizerUnimplementedServer struct{}
|
|
|
|
func (s *DRPCAuthorizerUnimplementedServer) IsAuthorized(context.Context, *IsAuthorizedRequest) (*IsAuthorizedResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCAuthorizerUnimplementedServer) IsBudgetExceeded(context.Context, *IsBudgetExceededRequest) (*IsBudgetExceededResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
type DRPCAuthorizerDescription struct{}
|
|
|
|
func (DRPCAuthorizerDescription) NumMethods() int { return 2 }
|
|
|
|
func (DRPCAuthorizerDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
|
switch n {
|
|
case 0:
|
|
return "/proto.Authorizer/IsAuthorized", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCAuthorizerServer).
|
|
IsAuthorized(
|
|
ctx,
|
|
in1.(*IsAuthorizedRequest),
|
|
)
|
|
}, DRPCAuthorizerServer.IsAuthorized, true
|
|
case 1:
|
|
return "/proto.Authorizer/IsBudgetExceeded", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCAuthorizerServer).
|
|
IsBudgetExceeded(
|
|
ctx,
|
|
in1.(*IsBudgetExceededRequest),
|
|
)
|
|
}, DRPCAuthorizerServer.IsBudgetExceeded, true
|
|
default:
|
|
return "", nil, nil, nil, false
|
|
}
|
|
}
|
|
|
|
func DRPCRegisterAuthorizer(mux drpc.Mux, impl DRPCAuthorizerServer) error {
|
|
return mux.Register(impl, DRPCAuthorizerDescription{})
|
|
}
|
|
|
|
type DRPCAuthorizer_IsAuthorizedStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*IsAuthorizedResponse) error
|
|
}
|
|
|
|
type drpcAuthorizer_IsAuthorizedStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcAuthorizer_IsAuthorizedStream) SendAndClose(m *IsAuthorizedResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCAuthorizer_IsBudgetExceededStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*IsBudgetExceededResponse) error
|
|
}
|
|
|
|
type drpcAuthorizer_IsBudgetExceededStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcAuthorizer_IsBudgetExceededStream) SendAndClose(m *IsBudgetExceededResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCProviderConfiguratorClient interface {
|
|
DRPCConn() drpc.Conn
|
|
|
|
GetAIProviders(ctx context.Context, in *GetAIProvidersRequest) (*GetAIProvidersResponse, error)
|
|
WatchAIProviders(ctx context.Context, in *WatchAIProvidersRequest) (DRPCProviderConfigurator_WatchAIProvidersClient, error)
|
|
}
|
|
|
|
type drpcProviderConfiguratorClient struct {
|
|
cc drpc.Conn
|
|
}
|
|
|
|
func NewDRPCProviderConfiguratorClient(cc drpc.Conn) DRPCProviderConfiguratorClient {
|
|
return &drpcProviderConfiguratorClient{cc}
|
|
}
|
|
|
|
func (c *drpcProviderConfiguratorClient) DRPCConn() drpc.Conn { return c.cc }
|
|
|
|
func (c *drpcProviderConfiguratorClient) GetAIProviders(ctx context.Context, in *GetAIProvidersRequest) (*GetAIProvidersResponse, error) {
|
|
out := new(GetAIProvidersResponse)
|
|
err := c.cc.Invoke(ctx, "/proto.ProviderConfigurator/GetAIProviders", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}, in, out)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *drpcProviderConfiguratorClient) WatchAIProviders(ctx context.Context, in *WatchAIProvidersRequest) (DRPCProviderConfigurator_WatchAIProvidersClient, error) {
|
|
stream, err := c.cc.NewStream(ctx, "/proto.ProviderConfigurator/WatchAIProviders", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
x := &drpcProviderConfigurator_WatchAIProvidersClient{stream}
|
|
if err := x.MsgSend(in, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := x.CloseSend(); err != nil {
|
|
return nil, err
|
|
}
|
|
return x, nil
|
|
}
|
|
|
|
type DRPCProviderConfigurator_WatchAIProvidersClient interface {
|
|
drpc.Stream
|
|
Recv() (*WatchAIProvidersResponse, error)
|
|
}
|
|
|
|
type drpcProviderConfigurator_WatchAIProvidersClient struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcProviderConfigurator_WatchAIProvidersClient) GetStream() drpc.Stream {
|
|
return x.Stream
|
|
}
|
|
|
|
func (x *drpcProviderConfigurator_WatchAIProvidersClient) Recv() (*WatchAIProvidersResponse, error) {
|
|
m := new(WatchAIProvidersResponse)
|
|
if err := x.MsgRecv(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return nil, err
|
|
}
|
|
return m, nil
|
|
}
|
|
|
|
func (x *drpcProviderConfigurator_WatchAIProvidersClient) RecvMsg(m *WatchAIProvidersResponse) error {
|
|
return x.MsgRecv(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{})
|
|
}
|
|
|
|
type DRPCProviderConfiguratorServer interface {
|
|
GetAIProviders(context.Context, *GetAIProvidersRequest) (*GetAIProvidersResponse, error)
|
|
WatchAIProviders(*WatchAIProvidersRequest, DRPCProviderConfigurator_WatchAIProvidersStream) error
|
|
}
|
|
|
|
type DRPCProviderConfiguratorUnimplementedServer struct{}
|
|
|
|
func (s *DRPCProviderConfiguratorUnimplementedServer) GetAIProviders(context.Context, *GetAIProvidersRequest) (*GetAIProvidersResponse, error) {
|
|
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
func (s *DRPCProviderConfiguratorUnimplementedServer) WatchAIProviders(*WatchAIProvidersRequest, DRPCProviderConfigurator_WatchAIProvidersStream) error {
|
|
return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
|
|
}
|
|
|
|
type DRPCProviderConfiguratorDescription struct{}
|
|
|
|
func (DRPCProviderConfiguratorDescription) NumMethods() int { return 2 }
|
|
|
|
func (DRPCProviderConfiguratorDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
|
|
switch n {
|
|
case 0:
|
|
return "/proto.ProviderConfigurator/GetAIProviders", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return srv.(DRPCProviderConfiguratorServer).
|
|
GetAIProviders(
|
|
ctx,
|
|
in1.(*GetAIProvidersRequest),
|
|
)
|
|
}, DRPCProviderConfiguratorServer.GetAIProviders, true
|
|
case 1:
|
|
return "/proto.ProviderConfigurator/WatchAIProviders", drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{},
|
|
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
|
|
return nil, srv.(DRPCProviderConfiguratorServer).
|
|
WatchAIProviders(
|
|
in1.(*WatchAIProvidersRequest),
|
|
&drpcProviderConfigurator_WatchAIProvidersStream{in2.(drpc.Stream)},
|
|
)
|
|
}, DRPCProviderConfiguratorServer.WatchAIProviders, true
|
|
default:
|
|
return "", nil, nil, nil, false
|
|
}
|
|
}
|
|
|
|
func DRPCRegisterProviderConfigurator(mux drpc.Mux, impl DRPCProviderConfiguratorServer) error {
|
|
return mux.Register(impl, DRPCProviderConfiguratorDescription{})
|
|
}
|
|
|
|
type DRPCProviderConfigurator_GetAIProvidersStream interface {
|
|
drpc.Stream
|
|
SendAndClose(*GetAIProvidersResponse) error
|
|
}
|
|
|
|
type drpcProviderConfigurator_GetAIProvidersStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcProviderConfigurator_GetAIProvidersStream) SendAndClose(m *GetAIProvidersResponse) error {
|
|
if err := x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{}); err != nil {
|
|
return err
|
|
}
|
|
return x.CloseSend()
|
|
}
|
|
|
|
type DRPCProviderConfigurator_WatchAIProvidersStream interface {
|
|
drpc.Stream
|
|
Send(*WatchAIProvidersResponse) error
|
|
}
|
|
|
|
type drpcProviderConfigurator_WatchAIProvidersStream struct {
|
|
drpc.Stream
|
|
}
|
|
|
|
func (x *drpcProviderConfigurator_WatchAIProvidersStream) Send(m *WatchAIProvidersResponse) error {
|
|
return x.MsgSend(m, drpcEncoding_File_coderd_aibridged_proto_aibridged_proto{})
|
|
}
|