service

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 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)

func IsUnsupportedDeploymentPlatformError added in v0.2.1

func IsUnsupportedDeploymentPlatformError(err error) bool

IsUnsupportedDeploymentPlatformError reports whether err indicates an unsupported deployment platform.

Types

type DeploymentPlatformStaleCleaner added in v0.3.0

type DeploymentPlatformStaleCleaner interface {
	CleanupStale(ctx context.Context, deployment *models.Deployment) error
}

DeploymentPlatformStaleCleaner is an optional adapter hook for stale deployment replacement.

type IndexOptions added in v0.1.21

type IndexOptions struct {
	BatchSize      int  `json:"batchSize"`
	Force          bool `json:"force"`
	DryRun         bool `json:"dryRun"`
	IncludeServers bool `json:"includeServers"`
	IncludeAgents  bool `json:"includeAgents"`
}

IndexOptions configures an indexing operation.

type IndexProgressCallback added in v0.1.21

type IndexProgressCallback func(resource string, stats IndexStats)

IndexProgressCallback is called with progress updates during indexing. resource is "servers" or "agents".

type IndexResult added in v0.1.21

type IndexResult struct {
	Servers IndexStats `json:"servers"`
	Agents  IndexStats `json:"agents"`
}

IndexResult contains the final result of an indexing operation.

type IndexStats added in v0.1.21

type IndexStats struct {
	Processed int `json:"processed"`
	Updated   int `json:"updated"`
	Skipped   int `json:"skipped"`
	Failures  int `json:"failures"`
}

IndexStats tracks progress for a resource type.

type Indexer added in v0.1.21

type Indexer interface {
	Run(ctx context.Context, opts IndexOptions, onProgress IndexProgressCallback) (*IndexResult, error)
}

Indexer defines the interface for embedding indexing operations.

func NewIndexer added in v0.1.21

func NewIndexer(registry RegistryService, provider embeddings.Provider, dimensions int) Indexer

NewIndexer creates a new embeddings indexer.

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) (*apiv0.ServerResponse, error)
	// GetAllVersionsByServerName retrieve all versions of a server by server name
	GetAllVersionsByServerName(ctx context.Context, serverName string) ([]*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)
	// 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)
	// ResolveAgentManifestSkills resolves manifest skill refs to concrete image or repo refs.
	ResolveAgentManifestSkills(ctx context.Context, manifest *models.AgentManifest) ([]platformtypes.AgentSkillRef, error)
	// ResolveAgentManifestPrompts resolves manifest prompt refs to concrete prompt content.
	ResolveAgentManifestPrompts(ctx context.Context, manifest *models.AgentManifest) ([]platformtypes.ResolvedPrompt, 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)
	// DeleteSkill permanently removes a skill version from the registry
	DeleteSkill(ctx context.Context, skillName, version string) error

	// Prompts APIs
	// ListPrompts retrieve all prompts with optional filtering
	ListPrompts(ctx context.Context, filter *database.PromptFilter, cursor string, limit int) ([]*models.PromptResponse, string, error)
	// GetPromptByName retrieve latest version of a prompt by name
	GetPromptByName(ctx context.Context, promptName string) (*models.PromptResponse, error)
	// GetPromptByNameAndVersion retrieve specific version of a prompt by name and version
	GetPromptByNameAndVersion(ctx context.Context, promptName string, version string) (*models.PromptResponse, error)
	// GetAllVersionsByPromptName retrieve all versions of a prompt by name
	GetAllVersionsByPromptName(ctx context.Context, promptName string) ([]*models.PromptResponse, error)
	// CreatePrompt creates a new prompt version
	CreatePrompt(ctx context.Context, req *models.PromptJSON) (*models.PromptResponse, error)
	// DeletePrompt permanently removes a prompt version from the registry
	DeletePrompt(ctx context.Context, promptName, version string) error

	// Deployments APIs
	// ListProviders retrieves deployment target providers, optionally filtered by provider platform type.
	ListProviders(ctx context.Context, platform *string) ([]*models.Provider, error)
	// GetProviderByID retrieves a provider by ID.
	GetProviderByID(ctx context.Context, providerID string) (*models.Provider, error)
	// CreateProvider creates a deployment target provider.
	CreateProvider(ctx context.Context, in *models.CreateProviderInput) (*models.Provider, error)
	// UpdateProvider updates mutable fields for a provider.
	UpdateProvider(ctx context.Context, providerID string, in *models.UpdateProviderInput) (*models.Provider, error)
	// DeleteProvider deletes a provider by ID.
	DeleteProvider(ctx context.Context, providerID string) error

	// GetDeployments retrieves all deployed resources (MCP servers, agents)
	GetDeployments(ctx context.Context, filter *models.DeploymentFilter) ([]*models.Deployment, error)
	// GetDeploymentByID retrieves a specific deployment by UUID.
	GetDeploymentByID(ctx context.Context, id string) (*models.Deployment, error)
	// DeployServer deploys an MCP server with configuration
	DeployServer(ctx context.Context, serverName, version string, config map[string]string, preferRemote bool, providerID 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, providerID string) (*models.Deployment, error)
	// RemoveDeploymentByID removes a deployment by UUID.
	RemoveDeploymentByID(ctx context.Context, id string) error
	// CreateDeployment dispatches deployment creation via provider-resolved platform adapter.
	CreateDeployment(ctx context.Context, req *models.Deployment) (*models.Deployment, error)
	// UndeployDeployment dispatches undeploy via provider-resolved platform adapter.
	UndeployDeployment(ctx context.Context, deployment *models.Deployment) error
	// GetDeploymentLogs dispatches deployment log retrieval via provider-resolved platform adapter.
	GetDeploymentLogs(ctx context.Context, deployment *models.Deployment) ([]string, error)
	// CancelDeployment dispatches deployment cancellation via provider-resolved platform adapter.
	CancelDeployment(ctx context.Context, deployment *models.Deployment) error
}

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

type UnsupportedDeploymentPlatformError added in v0.2.1

type UnsupportedDeploymentPlatformError struct {
	Platform string
}

UnsupportedDeploymentPlatformError is returned when no deployment adapter is registered for a provider platform.

func (*UnsupportedDeploymentPlatformError) Error added in v0.2.1

func (*UnsupportedDeploymentPlatformError) Unwrap added in v0.2.1

Directories

Path Synopsis
Package testing provides test utilities for the registry service.
Package testing provides test utilities for the registry service.

Jump to

Keyboard shortcuts

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