database

package
v0.1.11 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound          = errors.New("record not found")
	ErrAlreadyExists     = errors.New("record already exists")
	ErrInvalidInput      = errors.New("invalid input")
	ErrDatabase          = errors.New("database error")
	ErrInvalidVersion    = errors.New("invalid version: cannot publish duplicate version")
	ErrMaxServersReached = errors.New("maximum number of versions for this server reached (10000): please reach out at https://github.com/modelcontextprotocol/registry to explain your use case")
)

Common database errors

Functions

func InTransactionT

func InTransactionT[T any](ctx context.Context, db Database, fn func(ctx context.Context, tx pgx.Tx) (T, error)) (T, error)

InTransactionT is a generic helper that wraps InTransaction for functions returning a value This exists because Go does not support generic methods on interfaces - only the Database interface method InTransaction (without generics) can exist, so we provide this generic wrapper function. This is a common pattern in Go for working around this language limitation.

Types

type AgentFilter

type AgentFilter struct {
	Name          *string    // for finding versions of same agent
	RemoteURL     *string    // for duplicate URL detection
	UpdatedSince  *time.Time // for incremental sync filtering
	SubstringName *string    // for substring search on name
	Version       *string    // for exact version matching
	IsLatest      *bool      // for filtering latest versions only
	Published     *bool      // for filtering by published status (nil = no filter)
	Semantic      *SemanticSearchOptions
}

AgentFilter defines filtering options for agent queries (mirrors ServerFilter)

type Database

type Database interface {
	// DeleteServer permanently removes a server version from the database
	DeleteServer(ctx context.Context, tx pgx.Tx, serverName, version string) error
	// CreateServer inserts a new server version with official metadata
	CreateServer(ctx context.Context, tx pgx.Tx, serverJSON *apiv0.ServerJSON, officialMeta *apiv0.RegistryExtensions) (*apiv0.ServerResponse, error)
	// UpdateServer updates an existing server record
	UpdateServer(ctx context.Context, tx pgx.Tx, serverName, version string, serverJSON *apiv0.ServerJSON) (*apiv0.ServerResponse, error)
	// SetServerStatus updates the status of a specific server version
	SetServerStatus(ctx context.Context, tx pgx.Tx, serverName, version string, status string) (*apiv0.ServerResponse, error)
	// ListServers retrieve server entries with optional filtering
	ListServers(ctx context.Context, tx pgx.Tx, filter *ServerFilter, cursor string, limit int) ([]*apiv0.ServerResponse, string, error)
	// GetServerByName retrieve a single server by its name
	GetServerByName(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error)
	// GetServerByNameAndVersion retrieve specific version of a server by server name and version
	GetServerByNameAndVersion(ctx context.Context, tx pgx.Tx, serverName string, version string, publishedOnly bool) (*apiv0.ServerResponse, error)
	// GetAllVersionsByServerName retrieve all versions of a server by server name
	GetAllVersionsByServerName(ctx context.Context, tx pgx.Tx, serverName string, publishedOnly bool) ([]*apiv0.ServerResponse, error)
	// GetCurrentLatestVersion retrieve the current latest version of a server by server name
	GetCurrentLatestVersion(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error)
	// CountServerVersions count the number of versions for a server
	CountServerVersions(ctx context.Context, tx pgx.Tx, serverName string) (int, error)
	// CheckVersionExists check if a specific version exists for a server
	CheckVersionExists(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error)
	// UnmarkAsLatest marks the current latest version of a server as no longer latest
	UnmarkAsLatest(ctx context.Context, tx pgx.Tx, serverName string) error
	// AcquirePublishLock acquires an exclusive advisory lock for publishing a server
	// This prevents race conditions when multiple versions are published concurrently
	AcquirePublishLock(ctx context.Context, tx pgx.Tx, serverName string) error
	// PublishServer marks a server as published
	PublishServer(ctx context.Context, tx pgx.Tx, serverName, version string) error
	// UnpublishServer marks a server as unpublished
	UnpublishServer(ctx context.Context, tx pgx.Tx, serverName, version string) error
	// IsServerPublished checks if a server is published
	IsServerPublished(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error)
	// SetServerEmbedding upserts the semantic embedding metadata for a server version
	SetServerEmbedding(ctx context.Context, tx pgx.Tx, serverName, version string, embedding *SemanticEmbedding) error
	// GetServerEmbeddingMetadata returns metadata about a server's embedding without loading the vector
	GetServerEmbeddingMetadata(ctx context.Context, tx pgx.Tx, serverName, version string) (*SemanticEmbeddingMetadata, error)
	// UpsertServerReadme stores or updates a README blob for a server version
	UpsertServerReadme(ctx context.Context, tx pgx.Tx, readme *ServerReadme) error
	// GetServerReadme retrieves the README blob for a specific server version
	GetServerReadme(ctx context.Context, tx pgx.Tx, serverName, version string) (*ServerReadme, error)
	// GetLatestServerReadme retrieves the README blob for the latest server version
	GetLatestServerReadme(ctx context.Context, tx pgx.Tx, serverName string) (*ServerReadme, error)
	// InTransaction executes a function within a database transaction
	InTransaction(ctx context.Context, fn func(ctx context.Context, tx pgx.Tx) error) error
	// Close closes the database connection
	Close() error

	// Agents API
	// CreateAgent inserts a new agent version with official metadata
	CreateAgent(ctx context.Context, tx pgx.Tx, agentJSON *models.AgentJSON, officialMeta *models.AgentRegistryExtensions) (*models.AgentResponse, error)
	// UpdateAgent updates an existing agent record
	UpdateAgent(ctx context.Context, tx pgx.Tx, agentName, version string, agentJSON *models.AgentJSON) (*models.AgentResponse, error)
	// SetAgentStatus updates the status of a specific agent version
	SetAgentStatus(ctx context.Context, tx pgx.Tx, agentName, version string, status string) (*models.AgentResponse, error)
	// ListAgents retrieve agent entries with optional filtering
	ListAgents(ctx context.Context, tx pgx.Tx, filter *AgentFilter, cursor string, limit int) ([]*models.AgentResponse, string, error)
	// GetAgentByName retrieve a single agent by its name (latest)
	GetAgentByName(ctx context.Context, tx pgx.Tx, agentName string) (*models.AgentResponse, error)
	// GetAgentByNameAndVersion retrieve specific version of an agent by name and version
	GetAgentByNameAndVersion(ctx context.Context, tx pgx.Tx, agentName string, version string) (*models.AgentResponse, error)
	// GetAllVersionsByAgentName retrieve all versions of an agent
	GetAllVersionsByAgentName(ctx context.Context, tx pgx.Tx, agentName string) ([]*models.AgentResponse, error)
	// GetCurrentLatestAgentVersion retrieve current latest version of an agent
	GetCurrentLatestAgentVersion(ctx context.Context, tx pgx.Tx, agentName string) (*models.AgentResponse, error)
	// CountAgentVersions count the number of versions for an agent
	CountAgentVersions(ctx context.Context, tx pgx.Tx, agentName string) (int, error)
	// CheckAgentVersionExists check if a specific version exists for an agent
	CheckAgentVersionExists(ctx context.Context, tx pgx.Tx, agentName, version string) (bool, error)
	// UnmarkAgentAsLatest marks the current latest version of an agent as no longer latest
	UnmarkAgentAsLatest(ctx context.Context, tx pgx.Tx, agentName string) error
	// PublishAgent marks an agent as published
	PublishAgent(ctx context.Context, tx pgx.Tx, agentName, version string) error
	// UnpublishAgent marks an agent as unpublished
	UnpublishAgent(ctx context.Context, tx pgx.Tx, agentName, version string) error
	// IsAgentPublished checks if an agent is published
	IsAgentPublished(ctx context.Context, tx pgx.Tx, agentName, version string) (bool, error)
	// DeleteAgent permanently removes an agent version from the database
	DeleteAgent(ctx context.Context, tx pgx.Tx, agentName, version string) error
	// SetAgentEmbedding upserts the semantic embedding metadata for an agent version
	SetAgentEmbedding(ctx context.Context, tx pgx.Tx, agentName, version string, embedding *SemanticEmbedding) error
	// GetAgentEmbeddingMetadata returns metadata about an agent's embedding without loading the vector
	GetAgentEmbeddingMetadata(ctx context.Context, tx pgx.Tx, agentName, version string) (*SemanticEmbeddingMetadata, error)

	// Skills API
	// CreateSkill inserts a new skill version with official metadata
	CreateSkill(ctx context.Context, tx pgx.Tx, skillJSON *models.SkillJSON, officialMeta *models.SkillRegistryExtensions) (*models.SkillResponse, error)
	// UpdateSkill updates an existing skill record
	UpdateSkill(ctx context.Context, tx pgx.Tx, skillName, version string, skillJSON *models.SkillJSON) (*models.SkillResponse, error)
	// SetSkillStatus updates the status of a specific skill version
	SetSkillStatus(ctx context.Context, tx pgx.Tx, skillName, version string, status string) (*models.SkillResponse, error)
	// ListSkills retrieve skill entries with optional filtering
	ListSkills(ctx context.Context, tx pgx.Tx, filter *SkillFilter, cursor string, limit int) ([]*models.SkillResponse, string, error)
	// GetSkillByName retrieve a single skill by its name (latest)
	GetSkillByName(ctx context.Context, tx pgx.Tx, skillName string) (*models.SkillResponse, error)
	// GetSkillByNameAndVersion retrieve specific version of a skill by name and version
	GetSkillByNameAndVersion(ctx context.Context, tx pgx.Tx, skillName string, version string) (*models.SkillResponse, error)
	// GetAllVersionsBySkillName retrieve all versions of a skill
	GetAllVersionsBySkillName(ctx context.Context, tx pgx.Tx, skillName string) ([]*models.SkillResponse, error)
	// GetCurrentLatestSkillVersion retrieve current latest version of a skill
	GetCurrentLatestSkillVersion(ctx context.Context, tx pgx.Tx, skillName string) (*models.SkillResponse, error)
	// CountSkillVersions count the number of versions for a skill
	CountSkillVersions(ctx context.Context, tx pgx.Tx, skillName string) (int, error)
	// CheckSkillVersionExists check if a specific version exists for a skill
	CheckSkillVersionExists(ctx context.Context, tx pgx.Tx, skillName, version string) (bool, error)
	// UnmarkSkillAsLatest marks the current latest version of a skill as no longer latest
	UnmarkSkillAsLatest(ctx context.Context, tx pgx.Tx, skillName string) error
	// PublishSkill marks a skill as published
	PublishSkill(ctx context.Context, tx pgx.Tx, skillName, version string) error
	// UnpublishSkill marks a skill as unpublished
	UnpublishSkill(ctx context.Context, tx pgx.Tx, skillName, version string) error
	// IsSkillPublished checks if a skill is published
	IsSkillPublished(ctx context.Context, tx pgx.Tx, skillName, version string) (bool, error)

	// Deployments API
	// CreateDeployment creates a new deployment record
	CreateDeployment(ctx context.Context, tx pgx.Tx, deployment *models.Deployment) error
	// GetDeployments retrieves all deployed servers
	GetDeployments(ctx context.Context, tx pgx.Tx) ([]*models.Deployment, error)
	// GetDeploymentByName retrieves a specific deployment
	GetDeploymentByNameAndVersion(ctx context.Context, tx pgx.Tx, serverName string, version string) (*models.Deployment, error)
	// UpdateDeploymentConfig updates the configuration for a deployment
	UpdateDeploymentConfig(ctx context.Context, tx pgx.Tx, serverName string, config map[string]string) error
	// UpdateDeploymentStatus updates the status of a deployment
	UpdateDeploymentStatus(ctx context.Context, tx pgx.Tx, serverName, version, status string) error
	// RemoveDeployment removes a deployment
	RemoveDeployment(ctx context.Context, tx pgx.Tx, serverName string, version string) error
}

Database defines the interface for database operations

func NewTestDB

func NewTestDB(t *testing.T) Database

NewTestDB creates an isolated PostgreSQL database for each test by copying a template. The template database has migrations pre-applied, so each test is fast. Requires PostgreSQL to be running on localhost:5432 (e.g., via docker-compose).

type Executor

type Executor interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}

Executor is an interface for executing queries (satisfied by both pgx.Tx and pgxpool.Pool)

type Migration

type Migration struct {
	Version int
	Name    string
	SQL     string
}

Migration represents a database migration

type Migrator

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

Migrator handles database migrations

func NewMigrator

func NewMigrator(conn *pgx.Conn) *Migrator

NewMigrator creates a new migrator instance

func (*Migrator) Migrate

func (m *Migrator) Migrate(ctx context.Context) error

Migrate runs all pending migrations

type PostgreSQL

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

PostgreSQL is an implementation of the Database interface using PostgreSQL

func NewPostgreSQL

func NewPostgreSQL(ctx context.Context, connectionURI string) (*PostgreSQL, error)

NewPostgreSQL creates a new instance of the PostgreSQL database

func (*PostgreSQL) AcquirePublishLock

func (db *PostgreSQL) AcquirePublishLock(ctx context.Context, tx pgx.Tx, serverName string) error

AcquirePublishLock acquires an exclusive advisory lock for publishing a server This prevents race conditions when multiple versions are published concurrently Using pg_advisory_xact_lock which auto-releases on transaction end

func (*PostgreSQL) CheckAgentVersionExists

func (db *PostgreSQL) CheckAgentVersionExists(ctx context.Context, tx pgx.Tx, agentName, version string) (bool, error)

func (*PostgreSQL) CheckSkillVersionExists

func (db *PostgreSQL) CheckSkillVersionExists(ctx context.Context, tx pgx.Tx, skillName, version string) (bool, error)

func (*PostgreSQL) CheckVersionExists

func (db *PostgreSQL) CheckVersionExists(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error)

CheckVersionExists checks if a specific version exists for a server

func (*PostgreSQL) Close

func (db *PostgreSQL) Close() error

Close closes the database connection

func (*PostgreSQL) CountAgentVersions

func (db *PostgreSQL) CountAgentVersions(ctx context.Context, tx pgx.Tx, agentName string) (int, error)

func (*PostgreSQL) CountServerVersions

func (db *PostgreSQL) CountServerVersions(ctx context.Context, tx pgx.Tx, serverName string) (int, error)

CountServerVersions counts the number of versions for a server

func (*PostgreSQL) CountSkillVersions

func (db *PostgreSQL) CountSkillVersions(ctx context.Context, tx pgx.Tx, skillName string) (int, error)

func (*PostgreSQL) CreateAgent

func (db *PostgreSQL) CreateAgent(ctx context.Context, tx pgx.Tx, agentJSON *models.AgentJSON, officialMeta *models.AgentRegistryExtensions) (*models.AgentResponse, error)

func (*PostgreSQL) CreateDeployment

func (db *PostgreSQL) CreateDeployment(ctx context.Context, tx pgx.Tx, deployment *models.Deployment) error

CreateDeployment creates a new deployment record

func (*PostgreSQL) CreateServer

func (db *PostgreSQL) CreateServer(ctx context.Context, tx pgx.Tx, serverJSON *apiv0.ServerJSON, officialMeta *apiv0.RegistryExtensions) (*apiv0.ServerResponse, error)

CreateServer inserts a new server version with official metadata

func (*PostgreSQL) CreateSkill

func (db *PostgreSQL) CreateSkill(ctx context.Context, tx pgx.Tx, skillJSON *models.SkillJSON, officialMeta *models.SkillRegistryExtensions) (*models.SkillResponse, error)

func (*PostgreSQL) DeleteAgent

func (db *PostgreSQL) DeleteAgent(ctx context.Context, tx pgx.Tx, agentName, version string) error

DeleteAgent permanently removes an agent version from the database

func (*PostgreSQL) DeleteServer

func (db *PostgreSQL) DeleteServer(ctx context.Context, tx pgx.Tx, serverName, version string) error

DeleteServer permanently removes a server version from the database

func (*PostgreSQL) GetAgentByName

func (db *PostgreSQL) GetAgentByName(ctx context.Context, tx pgx.Tx, agentName string) (*models.AgentResponse, error)

func (*PostgreSQL) GetAgentByNameAndVersion

func (db *PostgreSQL) GetAgentByNameAndVersion(ctx context.Context, tx pgx.Tx, agentName, version string) (*models.AgentResponse, error)

func (*PostgreSQL) GetAgentEmbeddingMetadata added in v0.1.11

func (db *PostgreSQL) GetAgentEmbeddingMetadata(ctx context.Context, tx pgx.Tx, agentName, version string) (*SemanticEmbeddingMetadata, error)

GetAgentEmbeddingMetadata retrieves embedding metadata for an agent version without loading the vector.

func (*PostgreSQL) GetAllVersionsByAgentName

func (db *PostgreSQL) GetAllVersionsByAgentName(ctx context.Context, tx pgx.Tx, agentName string) ([]*models.AgentResponse, error)

func (*PostgreSQL) GetAllVersionsByServerName

func (db *PostgreSQL) GetAllVersionsByServerName(ctx context.Context, tx pgx.Tx, serverName string, publishedOnly bool) ([]*apiv0.ServerResponse, error)

GetAllVersionsByServerName retrieves all versions of a server by server name If publishedOnly is true, only returns versions where published = true

func (*PostgreSQL) GetAllVersionsBySkillName

func (db *PostgreSQL) GetAllVersionsBySkillName(ctx context.Context, tx pgx.Tx, skillName string) ([]*models.SkillResponse, error)

func (*PostgreSQL) GetCurrentLatestAgentVersion

func (db *PostgreSQL) GetCurrentLatestAgentVersion(ctx context.Context, tx pgx.Tx, agentName string) (*models.AgentResponse, error)

func (*PostgreSQL) GetCurrentLatestSkillVersion

func (db *PostgreSQL) GetCurrentLatestSkillVersion(ctx context.Context, tx pgx.Tx, skillName string) (*models.SkillResponse, error)

func (*PostgreSQL) GetCurrentLatestVersion

func (db *PostgreSQL) GetCurrentLatestVersion(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error)

GetCurrentLatestVersion retrieves the current latest version of a server by server name

func (*PostgreSQL) GetDeploymentByNameAndVersion

func (db *PostgreSQL) GetDeploymentByNameAndVersion(ctx context.Context, tx pgx.Tx, serverName string, version string) (*models.Deployment, error)

GetDeploymentByName retrieves a specific deployment

func (*PostgreSQL) GetDeployments

func (db *PostgreSQL) GetDeployments(ctx context.Context, tx pgx.Tx) ([]*models.Deployment, error)

GetDeployments retrieves all deployed servers

func (*PostgreSQL) GetLatestServerReadme

func (db *PostgreSQL) GetLatestServerReadme(ctx context.Context, tx pgx.Tx, serverName string) (*ServerReadme, error)

func (*PostgreSQL) GetServerByName

func (db *PostgreSQL) GetServerByName(ctx context.Context, tx pgx.Tx, serverName string) (*apiv0.ServerResponse, error)

GetServerByName retrieves the latest version of a server by server name

func (*PostgreSQL) GetServerByNameAndVersion

func (db *PostgreSQL) GetServerByNameAndVersion(ctx context.Context, tx pgx.Tx, serverName string, version string, publishedOnly bool) (*apiv0.ServerResponse, error)

GetServerByNameAndVersion retrieves a specific version of a server by server name and version

func (*PostgreSQL) GetServerEmbeddingMetadata added in v0.1.11

func (db *PostgreSQL) GetServerEmbeddingMetadata(ctx context.Context, tx pgx.Tx, serverName, version string) (*SemanticEmbeddingMetadata, error)

GetServerEmbeddingMetadata retrieves embedding metadata for a server version without loading the underlying vector payload. This is useful for maintenance tasks that only need to know whether an embedding exists or if its checksum is stale.

func (*PostgreSQL) GetServerReadme

func (db *PostgreSQL) GetServerReadme(ctx context.Context, tx pgx.Tx, serverName, version string) (*ServerReadme, error)

func (*PostgreSQL) GetSkillByName

func (db *PostgreSQL) GetSkillByName(ctx context.Context, tx pgx.Tx, skillName string) (*models.SkillResponse, error)

func (*PostgreSQL) GetSkillByNameAndVersion

func (db *PostgreSQL) GetSkillByNameAndVersion(ctx context.Context, tx pgx.Tx, skillName, version string) (*models.SkillResponse, error)

func (*PostgreSQL) InTransaction

func (db *PostgreSQL) InTransaction(ctx context.Context, fn func(ctx context.Context, tx pgx.Tx) error) error

InTransaction executes a function within a database transaction

func (*PostgreSQL) IsAgentPublished

func (db *PostgreSQL) IsAgentPublished(ctx context.Context, tx pgx.Tx, agentName, version string) (bool, error)

IsAgentPublished checks if an agent is published

func (*PostgreSQL) IsServerPublished

func (db *PostgreSQL) IsServerPublished(ctx context.Context, tx pgx.Tx, serverName, version string) (bool, error)

IsServerPublished checks if a server is published

func (*PostgreSQL) IsSkillPublished

func (db *PostgreSQL) IsSkillPublished(ctx context.Context, tx pgx.Tx, skillName, version string) (bool, error)

IsSkillPublished checks if a skill is published

func (*PostgreSQL) ListAgents

func (db *PostgreSQL) ListAgents(ctx context.Context, tx pgx.Tx, filter *AgentFilter, cursor string, limit int) ([]*models.AgentResponse, string, error)

ListAgents returns paginated agents with filtering

func (*PostgreSQL) ListServers

func (db *PostgreSQL) ListServers(
	ctx context.Context,
	tx pgx.Tx,
	filter *ServerFilter,
	cursor string,
	limit int,
) ([]*apiv0.ServerResponse, string, error)

func (*PostgreSQL) ListSkills

func (db *PostgreSQL) ListSkills(ctx context.Context, tx pgx.Tx, filter *SkillFilter, cursor string, limit int) ([]*models.SkillResponse, string, error)

ListSkills returns paginated skills with filtering

func (*PostgreSQL) PublishAgent

func (db *PostgreSQL) PublishAgent(ctx context.Context, tx pgx.Tx, agentName, version string) error

PublishAgent marks an agent as published

func (*PostgreSQL) PublishServer

func (db *PostgreSQL) PublishServer(ctx context.Context, tx pgx.Tx, serverName, version string) error

PublishServer marks a server as published

func (*PostgreSQL) PublishSkill

func (db *PostgreSQL) PublishSkill(ctx context.Context, tx pgx.Tx, skillName, version string) error

PublishSkill marks a skill as published

func (*PostgreSQL) RemoveDeployment

func (db *PostgreSQL) RemoveDeployment(ctx context.Context, tx pgx.Tx, serverName string, version string) error

RemoveDeployment removes a deployment

func (*PostgreSQL) SetAgentEmbedding added in v0.1.11

func (db *PostgreSQL) SetAgentEmbedding(ctx context.Context, tx pgx.Tx, agentName, version string, embedding *SemanticEmbedding) error

SetAgentEmbedding stores semantic embedding metadata for an agent version.

func (*PostgreSQL) SetAgentStatus

func (db *PostgreSQL) SetAgentStatus(ctx context.Context, tx pgx.Tx, agentName, version string, status string) (*models.AgentResponse, error)

func (*PostgreSQL) SetServerEmbedding added in v0.1.11

func (db *PostgreSQL) SetServerEmbedding(ctx context.Context, tx pgx.Tx, serverName, version string, embedding *SemanticEmbedding) error

SetServerEmbedding stores semantic embedding metadata for a server version.

func (*PostgreSQL) SetServerStatus

func (db *PostgreSQL) SetServerStatus(ctx context.Context, tx pgx.Tx, serverName, version string, status string) (*apiv0.ServerResponse, error)

SetServerStatus updates the status of a specific server version

func (*PostgreSQL) SetSkillStatus

func (db *PostgreSQL) SetSkillStatus(ctx context.Context, tx pgx.Tx, skillName, version string, status string) (*models.SkillResponse, error)

func (*PostgreSQL) UnmarkAgentAsLatest

func (db *PostgreSQL) UnmarkAgentAsLatest(ctx context.Context, tx pgx.Tx, agentName string) error

func (*PostgreSQL) UnmarkAsLatest

func (db *PostgreSQL) UnmarkAsLatest(ctx context.Context, tx pgx.Tx, serverName string) error

UnmarkAsLatest marks the current latest version of a server as no longer latest

func (*PostgreSQL) UnmarkSkillAsLatest

func (db *PostgreSQL) UnmarkSkillAsLatest(ctx context.Context, tx pgx.Tx, skillName string) error

func (*PostgreSQL) UnpublishAgent

func (db *PostgreSQL) UnpublishAgent(ctx context.Context, tx pgx.Tx, agentName, version string) error

UnpublishAgent marks an agent as unpublished

func (*PostgreSQL) UnpublishServer

func (db *PostgreSQL) UnpublishServer(ctx context.Context, tx pgx.Tx, serverName, version string) error

UnpublishServer marks a server as unpublished

func (*PostgreSQL) UnpublishSkill

func (db *PostgreSQL) UnpublishSkill(ctx context.Context, tx pgx.Tx, skillName, version string) error

UnpublishSkill marks a skill as unpublished

func (*PostgreSQL) UpdateAgent

func (db *PostgreSQL) UpdateAgent(ctx context.Context, tx pgx.Tx, agentName, version string, agentJSON *models.AgentJSON) (*models.AgentResponse, error)

func (*PostgreSQL) UpdateDeploymentConfig

func (db *PostgreSQL) UpdateDeploymentConfig(ctx context.Context, tx pgx.Tx, serverName string, config map[string]string) error

UpdateDeploymentConfig updates the configuration for a deployment

func (*PostgreSQL) UpdateDeploymentStatus

func (db *PostgreSQL) UpdateDeploymentStatus(ctx context.Context, tx pgx.Tx, serverName, version string, status string) error

UpdateDeploymentStatus updates the status of a deployment

func (*PostgreSQL) UpdateServer

func (db *PostgreSQL) UpdateServer(ctx context.Context, tx pgx.Tx, serverName, version string, serverJSON *apiv0.ServerJSON) (*apiv0.ServerResponse, error)

UpdateServer updates an existing server record with new server details

func (*PostgreSQL) UpdateSkill

func (db *PostgreSQL) UpdateSkill(ctx context.Context, tx pgx.Tx, skillName, version string, skillJSON *models.SkillJSON) (*models.SkillResponse, error)

func (*PostgreSQL) UpsertServerReadme

func (db *PostgreSQL) UpsertServerReadme(ctx context.Context, tx pgx.Tx, readme *ServerReadme) error

type SemanticEmbedding added in v0.1.11

type SemanticEmbedding struct {
	Vector     []float32
	Provider   string
	Model      string
	Dimensions int
	Checksum   string
	Generated  time.Time
}

SemanticEmbedding captures data stored alongside registry resources for semantic search.

type SemanticEmbeddingMetadata added in v0.1.11

type SemanticEmbeddingMetadata struct {
	HasEmbedding bool
	Provider     string
	Model        string
	Dimensions   int
	Checksum     string
	Generated    time.Time
}

SemanticEmbeddingMetadata captures stored metadata about an embedding without the vector payload.

type SemanticSearchOptions added in v0.1.11

type SemanticSearchOptions struct {
	// RawQuery retains the original search string for embedding generation (service layer use only).
	RawQuery string
	// QueryEmbedding holds the vector representation expected by the database layer.
	QueryEmbedding []float32
	// Threshold filters out matches whose distance exceeds this value (distance metric specific).
	Threshold float64
	// HybridSubstring preserves substring conditions for hybrid search.
	HybridSubstring *string
}

SemanticSearchOptions drives vector similarity queries when listing resources.

type ServerFilter

type ServerFilter struct {
	Name          *string    // for finding versions of same server
	RemoteURL     *string    // for duplicate URL detection
	UpdatedSince  *time.Time // for incremental sync filtering
	SubstringName *string    // for substring search on name
	Version       *string    // for exact version matching
	IsLatest      *bool      // for filtering latest versions only
	Published     *bool      // for filtering by published status (nil = no filter)
	Semantic      *SemanticSearchOptions
}

ServerFilter defines filtering options for server queries

type ServerReadme

type ServerReadme struct {
	ServerName  string
	Version     string
	Content     []byte
	ContentType string
	SizeBytes   int
	SHA256      []byte
	FetchedAt   time.Time
}

ServerReadme represents a stored README blob for a server version

type SkillFilter

type SkillFilter struct {
	Name          *string    // for finding versions of same skill
	RemoteURL     *string    // for duplicate URL detection
	UpdatedSince  *time.Time // for incremental sync filtering
	SubstringName *string    // for substring search on name
	Version       *string    // for exact version matching
	IsLatest      *bool      // for filtering latest versions only
	Published     *bool      // for filtering by published status (nil = no filter)
	Semantic      *SemanticSearchOptions
}

SkillFilter defines filtering options for skill queries (mirrors ServerFilter)

Jump to

Keyboard shortcuts

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