service

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareVersions

func CompareVersions(version1 string, version2 string, timestamp1 time.Time, timestamp2 time.Time) int

CompareVersions implements the versioning strategy agreed upon in the discussion: 1. If both versions are valid semver, use semantic version comparison 2. If neither are valid semver, use publication timestamp (return 0 to indicate equal for sorting) 3. If one is semver and one is not, the semver version is always considered higher

func IsSemanticVersion

func IsSemanticVersion(version string) bool

IsSemanticVersion checks if a version string follows semantic versioning format Uses the official golang.org/x/mod/semver package for validation Requires exactly three parts: major.minor.patch (optionally with prerelease/build)

Types

type Reconciler

type Reconciler interface {
	ReconcileAll(ctx context.Context) error
}

Reconciler handles server-side reconciliation of deployed resources (MCP servers, agents)

type RegistryService

type RegistryService interface {
	// ListServers retrieve all servers with optional filtering
	ListServers(ctx context.Context, filter *database.ServerFilter, cursor string, limit int) ([]*apiv0.ServerResponse, string, error)
	// GetServerByName retrieve latest version of a server by server name
	GetServerByName(ctx context.Context, serverName string) (*apiv0.ServerResponse, error)
	// GetServerByNameAndVersion retrieve specific version of a server by server name and version
	GetServerByNameAndVersion(ctx context.Context, serverName string, version string, publishedOnly bool) (*apiv0.ServerResponse, error)
	// GetAllVersionsByServerName retrieve all versions of a server by server name
	GetAllVersionsByServerName(ctx context.Context, serverName string, publishedOnly bool) ([]*apiv0.ServerResponse, error)
	// CreateServer creates a new server version
	CreateServer(ctx context.Context, req *apiv0.ServerJSON) (*apiv0.ServerResponse, error)
	// UpdateServer updates an existing server and optionally its status
	UpdateServer(ctx context.Context, serverName, version string, req *apiv0.ServerJSON, newStatus *string) (*apiv0.ServerResponse, error)
	// StoreServerReadme stores or updates the README for a server version
	StoreServerReadme(ctx context.Context, serverName, version string, content []byte, contentType string) error
	// GetServerReadmeLatest retrieves the README for the latest server version
	GetServerReadmeLatest(ctx context.Context, serverName string) (*database.ServerReadme, error)
	// GetServerReadmeByVersion retrieves the README for a specific server version
	GetServerReadmeByVersion(ctx context.Context, serverName, version string) (*database.ServerReadme, error)
	// PublishServer marks a server as published
	PublishServer(ctx context.Context, serverName, version string) error
	// UnpublishServer marks a server as unpublished
	UnpublishServer(ctx context.Context, serverName, version string) error
	// DeleteServer permanently removes a server version from the registry
	DeleteServer(ctx context.Context, serverName, version string) error
	// UpsertServerEmbedding stores semantic embedding metadata for a server version
	UpsertServerEmbedding(ctx context.Context, serverName, version string, embedding *database.SemanticEmbedding) error
	// GetServerEmbeddingMetadata retrieves the embedding metadata for a server version
	GetServerEmbeddingMetadata(ctx context.Context, serverName, version string) (*database.SemanticEmbeddingMetadata, error)

	// Agents APIs
	// ListAgents retrieve all agents with optional filtering
	ListAgents(ctx context.Context, filter *database.AgentFilter, cursor string, limit int) ([]*models.AgentResponse, string, error)
	// GetAgentByName retrieve latest version of an agent by name
	GetAgentByName(ctx context.Context, agentName string) (*models.AgentResponse, error)
	// GetAgentByNameAndVersion retrieve specific version of an agent by name and version
	GetAgentByNameAndVersion(ctx context.Context, agentName string, version string) (*models.AgentResponse, error)
	// GetAllVersionsByAgentName retrieve all versions of an agent by name
	GetAllVersionsByAgentName(ctx context.Context, agentName string) ([]*models.AgentResponse, error)
	// CreateAgent creates a new agent version
	CreateAgent(ctx context.Context, req *models.AgentJSON) (*models.AgentResponse, error)
	// PublishAgent marks an agent as published
	PublishAgent(ctx context.Context, agentName, version string) error
	// UnpublishAgent marks an agent as unpublished
	UnpublishAgent(ctx context.Context, agentName, version string) error
	// DeleteAgent permanently removes an agent version from the registry
	DeleteAgent(ctx context.Context, agentName, version string) error
	// UpsertAgentEmbedding stores semantic embedding metadata for an agent version
	UpsertAgentEmbedding(ctx context.Context, agentName, version string, embedding *database.SemanticEmbedding) error
	// GetAgentEmbeddingMetadata retrieves the embedding metadata for an agent version
	GetAgentEmbeddingMetadata(ctx context.Context, agentName, version string) (*database.SemanticEmbeddingMetadata, error)
	// Skills APIs
	// ListSkills retrieve all skills with optional filtering
	ListSkills(ctx context.Context, filter *database.SkillFilter, cursor string, limit int) ([]*models.SkillResponse, string, error)
	// GetSkillByName retrieve latest version of a skill by name
	GetSkillByName(ctx context.Context, skillName string) (*models.SkillResponse, error)
	// GetSkillByNameAndVersion retrieve specific version of a skill by name and version
	GetSkillByNameAndVersion(ctx context.Context, skillName string, version string) (*models.SkillResponse, error)
	// GetAllVersionsBySkillName retrieve all versions of a skill by name
	GetAllVersionsBySkillName(ctx context.Context, skillName string) ([]*models.SkillResponse, error)
	// CreateSkill creates a new skill version
	CreateSkill(ctx context.Context, req *models.SkillJSON) (*models.SkillResponse, error)
	// PublishSkill marks a skill as published
	PublishSkill(ctx context.Context, skillName, version string) error
	// UnpublishSkill marks a skill as unpublished
	UnpublishSkill(ctx context.Context, skillName, version string) error

	// Deployments APIs
	// GetDeployments retrieves all deployed resources (MCP servers, agents)
	GetDeployments(ctx context.Context, filter *models.DeploymentFilter) ([]*models.Deployment, error)
	// GetDeploymentByName retrieves a specific deployment by resource name
	GetDeploymentByNameAndVersion(ctx context.Context, resourceName string, version string) (*models.Deployment, error)
	// DeployServer deploys an MCP server with configuration
	DeployServer(ctx context.Context, serverName, version string, config map[string]string, preferRemote bool, runtime string) (*models.Deployment, error)
	// DeployAgent deploys an agent with configuration (to be implemented)
	DeployAgent(ctx context.Context, agentName, version string, config map[string]string, preferRemote bool, runtime string) (*models.Deployment, error)
	// UpdateDeploymentConfig updates the configuration for a deployment
	UpdateDeploymentConfig(ctx context.Context, resourceName string, version string, config map[string]string) (*models.Deployment, error)
	// RemoveServer removes a deployment (works for any resource type)
	RemoveServer(ctx context.Context, resourceName string, version string) error

	Reconciler
}

RegistryService defines the interface for registry operations

func NewRegistryService

func NewRegistryService(
	db database.Database,
	cfg *config.Config,
	embeddingProvider embeddings.Provider,
) RegistryService

NewRegistryService creates a new registry service with the provided database and configuration

Jump to

Keyboard shortcuts

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