routecore

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRouteNotConfigured  = errors.New("route is not configured")
	ErrStaticRouteReadOnly = errors.New("static route is read-only")
)

Functions

func DecodeStoredAgentRouteConfig

func DecodeStoredAgentRouteConfig(data []byte) (any, error)

Types

type AgentRouteConfig

type AgentRouteConfig struct {
	ID           string           `json:"id"`
	Kind         RouteKind        `json:"kind"`
	Protocol     RouteProtocol    `json:"protocol"`
	Description  string           `json:"description,omitempty"`
	Disabled     bool             `json:"disabled"`
	AuthPolicy   RouteAuthPolicy  `json:"auth_policy"`
	MatchPolicy  RouteMatchPolicy `json:"match_policy"`
	TargetPolicy json.RawMessage  `json:"target_policy"`
	CreatedAt    time.Time        `json:"created_at"`
	UpdatedAt    time.Time        `json:"updated_at"`
}

func MatchManagers

func MatchManagers(ctx context.Context, r *http.Request, managers ...*AgentRouteConfigManager) (AgentRouteConfig, bool, error)

func MatchRouteConfigs

func MatchRouteConfigs(routes []AgentRouteConfig, r *http.Request) (AgentRouteConfig, bool)

type AgentRouteConfigManager

type AgentRouteConfigManager struct {
	// contains filtered or unexported fields
}

func NewAgentRouteConfigManager

func NewAgentRouteConfigManager(store configstore.ConfigStore) *AgentRouteConfigManager

func (*AgentRouteConfigManager) Create

func (*AgentRouteConfigManager) Delete

func (m *AgentRouteConfigManager) Delete(ctx context.Context, routeID string) error

func (*AgentRouteConfigManager) Get

func (*AgentRouteConfigManager) InitStaticRoutes

func (m *AgentRouteConfigManager) InitStaticRoutes(routes []AgentRouteConfig)

func (*AgentRouteConfigManager) IsStatic

func (m *AgentRouteConfigManager) IsStatic(routeID string) bool

func (*AgentRouteConfigManager) List

func (*AgentRouteConfigManager) Match

Match resolves the most specific route config whose MatchPolicy accepts the request.

func (*AgentRouteConfigManager) Reset

func (m *AgentRouteConfigManager) Reset()

func (*AgentRouteConfigManager) Update

func (m *AgentRouteConfigManager) Update(ctx context.Context, routeID string, route AgentRouteConfig) error

type RouteAuthPolicy

type RouteAuthPolicy struct {
	RequireVirtualKey bool `json:"require_virtual_key"`
}

type RouteKind

type RouteKind string
const (
	RouteKindLLM RouteKind = "llm"
	RouteKindMCP RouteKind = "mcp"
)

type RouteListOptions

type RouteListOptions struct {
	Tag       string
	TagPrefix string
}

type RouteMatchPolicy

type RouteMatchPolicy struct {
	Host       string   `json:"host,omitempty"`
	PathPrefix string   `json:"path_prefix,omitempty"`
	Methods    []string `json:"methods,omitempty"`
}

RouteMatchPolicy contains transport-facing match fields for binding requests to a route.

type RouteProtocol

type RouteProtocol string
const (
	RouteProtocolOpenAI    RouteProtocol = "openai"
	RouteProtocolAnthropic RouteProtocol = "anthropic"
	RouteProtocolCC        RouteProtocol = "cc"
	RouteProtocolMCP       RouteProtocol = "mcp"
)

type RouteTargetPolicyKind

type RouteTargetPolicyKind string
const (
	RouteTargetPolicyKindDirectProvider RouteTargetPolicyKind = "direct-provider"
	RouteTargetPolicyKindLogicalModel   RouteTargetPolicyKind = "logical-model"
	RouteTargetPolicyKindMCPService     RouteTargetPolicyKind = "mcp-service"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL