aibridgedserver
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- type Server
- func (s *Server) GetMCPServerAccessTokensBatch(ctx context.Context, in *proto.GetMCPServerAccessTokensBatchRequest) (*proto.GetMCPServerAccessTokensBatchResponse, error)
- func (s *Server) GetMCPServerConfigs(_ context.Context, _ *proto.GetMCPServerConfigsRequest) (*proto.GetMCPServerConfigsResponse, error)
- func (s *Server) IsAuthorized(ctx context.Context, in *proto.IsAuthorizedRequest) (*proto.IsAuthorizedResponse, error)
- func (s *Server) RecordInterception(ctx context.Context, in *proto.RecordInterceptionRequest) (*proto.RecordInterceptionResponse, error)
- func (s *Server) RecordInterceptionEnded(ctx context.Context, in *proto.RecordInterceptionEndedRequest) (*proto.RecordInterceptionEndedResponse, error)
- func (s *Server) RecordPromptUsage(ctx context.Context, in *proto.RecordPromptUsageRequest) (*proto.RecordPromptUsageResponse, error)
- func (s *Server) RecordTokenUsage(ctx context.Context, in *proto.RecordTokenUsageRequest) (*proto.RecordTokenUsageResponse, error)
- func (s *Server) RecordToolUsage(ctx context.Context, in *proto.RecordToolUsageRequest) (*proto.RecordToolUsageResponse, error)
Constants¶
This section is empty.
Variables¶
var (ErrExpiredOrInvalidOAuthToken =xerrors.New("expired or invalid OAuth2 token")ErrNoMCPConfigFound =xerrors.New("no MCP config found")// These errors are returned by IsAuthorized. Since they're just returned as// a generic dRPC error, it's difficult to tell them apart without string// matching.// TODO: return these errors to the client in a more structured/comparable// way.ErrInvalidKey =xerrors.New("invalid key")ErrUnknownKey =xerrors.New("unknown key")ErrExpired =xerrors.New("expired")ErrUnknownUser =xerrors.New("unknown user")ErrDeletedUser =xerrors.New("deleted user")ErrSystemUser =xerrors.New("system user")ErrNoExternalAuthLinkFound =xerrors.New("no external auth link found"))
Functions¶
This section is empty.
Types¶
typeServer¶
type Server struct {// contains filtered or unexported fields}func (*Server)GetMCPServerAccessTokensBatch¶
func (s *Server) GetMCPServerAccessTokensBatch(ctxcontext.Context, in *proto.GetMCPServerAccessTokensBatchRequest) (*proto.GetMCPServerAccessTokensBatchResponse,error)
func (*Server)GetMCPServerConfigs¶
func (s *Server) GetMCPServerConfigs(_context.Context, _ *proto.GetMCPServerConfigsRequest) (*proto.GetMCPServerConfigsResponse,error)
func (*Server)IsAuthorized¶
func (s *Server) IsAuthorized(ctxcontext.Context, in *proto.IsAuthorizedRequest) (*proto.IsAuthorizedResponse,error)
IsAuthorized validates a given Coder API key and returns the user ID to which it belongs (if valid).
NOTE: this should really be using the code fromhttpmw.ExtractAPIKey. That function not only validates the keybut handles many other cases like updating last used, expiry, etc. This code does not currently use it fora few reasons:
- httpmw.ExtractAPIKey relies on keys being given in specific headershttpmw.APITokenFromRequest which AIbridge requests will not conform to.
- The code mixes many different concerns, and handles HTTP responses too, which is undesirable here.
- The core logic would need to be extracted, but that will surely be a complex & time-consuming distraction right now.
- Once we have an Early Access release of AI Bridge, we need to return to this.
TODO: replace with logic fromhttpmw.ExtractAPIKey.
func (*Server)RecordInterception¶
func (s *Server) RecordInterception(ctxcontext.Context, in *proto.RecordInterceptionRequest) (*proto.RecordInterceptionResponse,error)
func (*Server)RecordInterceptionEnded¶
func (s *Server) RecordInterceptionEnded(ctxcontext.Context, in *proto.RecordInterceptionEndedRequest) (*proto.RecordInterceptionEndedResponse,error)
func (*Server)RecordPromptUsage¶
func (s *Server) RecordPromptUsage(ctxcontext.Context, in *proto.RecordPromptUsageRequest) (*proto.RecordPromptUsageResponse,error)
func (*Server)RecordTokenUsage¶
func (s *Server) RecordTokenUsage(ctxcontext.Context, in *proto.RecordTokenUsageRequest) (*proto.RecordTokenUsageResponse,error)
func (*Server)RecordToolUsage¶
func (s *Server) RecordToolUsage(ctxcontext.Context, in *proto.RecordToolUsageRequest) (*proto.RecordToolUsageResponse,error)