mirror of
https://github.com/coder/coder.git
synced 2026-06-03 04:58:23 +00:00
ddec110b0e
In order to allow Coder Agents to use AI Gateway in OSS, we need to rehome the `aibridged`\-related code into the AGPL path. The HTTP API is only registered under enterprise so will still require the AI Governance Add-on to be present in order to use it, whereas Coder Agents uses an in-memory pipe to the same handlers.
35 lines
631 B
Go
35 lines
631 B
Go
package aibridged
|
|
|
|
import (
|
|
"context"
|
|
|
|
"storj.io/drpc"
|
|
|
|
"github.com/coder/coder/v2/coderd/aibridged/proto"
|
|
)
|
|
|
|
type Dialer func(ctx context.Context) (DRPCClient, error)
|
|
|
|
type ClientFunc func() (DRPCClient, error)
|
|
|
|
// DRPCClient is the union of various service interfaces the client must support.
|
|
type DRPCClient interface {
|
|
proto.DRPCRecorderClient
|
|
proto.DRPCMCPConfiguratorClient
|
|
proto.DRPCAuthorizerClient
|
|
}
|
|
|
|
var _ DRPCClient = &Client{}
|
|
|
|
type Client struct {
|
|
proto.DRPCRecorderClient
|
|
proto.DRPCMCPConfiguratorClient
|
|
proto.DRPCAuthorizerClient
|
|
|
|
Conn drpc.Conn
|
|
}
|
|
|
|
func (c *Client) DRPCConn() drpc.Conn {
|
|
return c.Conn
|
|
}
|