Documentation
¶
Overview ¶
Package marketplace owns Compozy-curated discovery feeds and their durable projection.
Index ¶
- Constants
- Variables
- func DigestFile(path string) (digest string, err error)
- func NormalizeMCPInputValue(inputType string, raw string) (string, error)
- func ValidateCatalogDirectory(directory string) error
- func ValidateMCPInputValue(value string) error
- type BrowseResult
- type CatalogService
- func (s *CatalogService) Browse(ctx context.Context, kind Kind, query string, offset int, limit int) (BrowseResult, error)
- func (s *CatalogService) Close(ctx context.Context) error
- func (s *CatalogService) Detail(ctx context.Context, kind Kind, entryID string) (*Entry, error)
- func (s *CatalogService) Refresh(ctx context.Context, kinds ...Kind) (RefreshReport, error)
- func (s *CatalogService) ResolveExtensionInstall(ctx context.Context, installSlug string, version string) (*Entry, error)
- func (s *CatalogService) ResolveSkillInstalls(ctx context.Context, installSlugs []string) ([]Entry, error)
- func (s *CatalogService) Status(ctx context.Context) ([]KindState, error)
- type DirectorySource
- type Document
- type Entry
- type EntryDetails
- type ExtensionEntryDetails
- type ExtensionInstallResolutionError
- type HTTPSource
- type HTTPSourceOption
- type InstallOutcome
- type Kind
- type KindState
- type ListResult
- type MCPAuthDetails
- type MCPEntryDetails
- type MCPInputBindingDetails
- type MCPInputDetails
- type MCPLaunchDetails
- type Notifier
- type RefreshOutcome
- type RefreshReport
- type SQLiteStore
- func (s *SQLiteStore) GetEntry(ctx context.Context, kind Kind, entryID string) (*Entry, error)
- func (s *SQLiteStore) GetExtensionByInstallSlug(ctx context.Context, installSlug string, version string) (*Entry, error)
- func (s *SQLiteStore) KindState(ctx context.Context, kind Kind) (*KindState, error)
- func (s *SQLiteStore) ListKind(ctx context.Context, kind Kind, query string, offset int, limit int) (ListResult, error)
- func (s *SQLiteStore) ListSkillsByInstallSlugs(ctx context.Context, installSlugs []string) ([]Entry, error)
- func (s *SQLiteStore) MarkKindStale(ctx context.Context, kind Kind, errorClass string, lastError string) error
- func (s *SQLiteStore) ReplaceKind(ctx context.Context, kind Kind, document *Document) error
- type Service
- type ServiceOption
- type SkillEntryDetails
- type SkillInstallResolver
- type Source
- type Store
- type UnsupportedManifestVersionError
Constants ¶
const ( ExtensionFormatCompozy = "compozy" ExtensionFormatAgentPlugin = "agent-plugin" )
Display-only format markers. Install-time detection stays authoritative — an entry may omit the marker and still resolve to a portable package.
const ( RefreshOutcomeSucceeded = "succeeded" RefreshOutcomeFailed = "failed" InstallOutcomeSucceeded = "succeeded" InstallOutcomeFailed = "failed" InstallPolicyGatePassed = "passed" )
const CatalogSource = "compozy-catalog"
const ManifestVersion = 2
const RemoteSkillEntryPrefix = "skill_"
RemoteSkillEntryPrefix reserves the synthetic ID namespace used for registry-only skills.
Variables ¶
var ( ErrResponseTooLarge = errors.New("marketplace catalog: response exceeds size limit") ErrEntryNotFound = errors.New("marketplace catalog: entry not found") ErrKindStateMissing = errors.New("marketplace catalog: kind state missing") ErrServiceClosed = errors.New("marketplace catalog: service is closed") )
var ( // ErrCatalogDecode reports malformed JSON or multiple JSON values in a catalog document. ErrCatalogDecode = errors.New("marketplace catalog: document decode failed") // ErrCatalogValidation reports a decoded catalog document that violates the catalog contract. ErrCatalogValidation = errors.New("marketplace catalog: document validation failed") )
Functions ¶
func DigestFile ¶
DigestFile computes the lowercase SHA-256 digest required by extension feed entries.
func NormalizeMCPInputValue ¶
NormalizeMCPInputValue validates and canonicalizes a catalog input value.
func ValidateCatalogDirectory ¶
ValidateCatalogDirectory validates the complete publishable catalog using runtime schemas.
func ValidateMCPInputValue ¶
ValidateMCPInputValue enforces transport-safe bounds shared by feed defaults and install values.
Types ¶
type BrowseResult ¶
BrowseResult returns projected rows with their truthful freshness state.
type CatalogService ¶
type CatalogService struct {
// contains filtered or unexported fields
}
CatalogService coordinates TTL freshness and durable projections.
func NewService ¶
func NewService( store Store, sources []Source, ttl time.Duration, refreshTimeout time.Duration, options ...ServiceOption, ) (*CatalogService, error)
NewService creates the internal curated catalog service.
func (*CatalogService) Browse ¶
func (s *CatalogService) Browse( ctx context.Context, kind Kind, query string, offset int, limit int, ) (BrowseResult, error)
Browse refreshes stale state on demand, then returns the durable projection.
func (*CatalogService) Close ¶
func (s *CatalogService) Close(ctx context.Context) error
Close cancels and joins every refresh flight owned by this service generation.
func (*CatalogService) Detail ¶
Detail refreshes stale state on demand and resolves by immutable entry id.
func (*CatalogService) Refresh ¶
func (s *CatalogService) Refresh(ctx context.Context, kinds ...Kind) (RefreshReport, error)
Refresh force-fetches selected kinds even when their TTL is still fresh.
func (*CatalogService) ResolveExtensionInstall ¶
func (s *CatalogService) ResolveExtensionInstall( ctx context.Context, installSlug string, version string, ) (*Entry, error)
ResolveExtensionInstall returns a curated extension by exact slug and optional version.
func (*CatalogService) ResolveSkillInstalls ¶
func (s *CatalogService) ResolveSkillInstalls( ctx context.Context, installSlugs []string, ) ([]Entry, error)
ResolveSkillInstalls returns the curated identities for exact remote skill slugs.
type DirectorySource ¶
type DirectorySource struct {
// contains filtered or unexported fields
}
DirectorySource reads one per-kind document from an absolute file URL.
func NewDirectorySource ¶
func NewDirectorySource(kind Kind, baseURL string) (*DirectorySource, error)
NewDirectorySource creates a bounded local-checkout catalog source.
func (*DirectorySource) Fetch ¶
func (s *DirectorySource) Fetch(ctx context.Context) (document *Document, err error)
Fetch reads and validates the local document without mutating projection state.
func (*DirectorySource) Kind ¶
func (s *DirectorySource) Kind() Kind
type Document ¶
type Document struct {
ManifestVersion int
GeneratedAt time.Time
FetchedAt time.Time
Entries []Entry
}
Document is one validated per-kind catalog snapshot.
type Entry ¶
type Entry struct {
Kind Kind
EntryID string
Name string
Description string
Version string
PublishedAt *time.Time
UpdatedAt *time.Time
DigestSHA256 string
Tier string
InstallSlug string
Payload json.RawMessage
FetchedAt time.Time
}
Entry is the durable common projection plus the kind-specific payload.
type EntryDetails ¶
type EntryDetails struct {
Author string
Source string
MCP *MCPEntryDetails
Extension *ExtensionEntryDetails
Skill *SkillEntryDetails
}
EntryDetails is the typed public projection of one validated catalog payload.
func ProjectEntry ¶
func ProjectEntry(entry Entry) (EntryDetails, error)
ProjectEntry decodes one already-validated catalog row without duplicating feed schemas downstream.
type ExtensionEntryDetails ¶
type ExtensionInstallResolutionError ¶
ExtensionInstallResolutionError preserves refresh and last-known lookup failures.
func (*ExtensionInstallResolutionError) Error ¶
func (e *ExtensionInstallResolutionError) Error() string
func (*ExtensionInstallResolutionError) Unwrap ¶
func (e *ExtensionInstallResolutionError) Unwrap() []error
type HTTPSource ¶
type HTTPSource struct {
// contains filtered or unexported fields
}
HTTPSource fetches one per-kind document from the configured base URL.
func NewHTTPSource ¶
func NewHTTPSource(kind Kind, baseURL string, client *http.Client, options ...HTTPSourceOption) (*HTTPSource, error)
NewHTTPSource creates one explicit-timeout feed source.
func (*HTTPSource) Fetch ¶
func (s *HTTPSource) Fetch(ctx context.Context) (document *Document, err error)
Fetch downloads and validates the source document without mutating projection state.
func (*HTTPSource) Kind ¶
func (s *HTTPSource) Kind() Kind
type HTTPSourceOption ¶
type HTTPSourceOption func(*HTTPSource)
HTTPSourceOption customizes bounded feed fetching.
func WithMaxResponseBytes ¶
func WithMaxResponseBytes(limit int64) HTTPSourceOption
WithMaxResponseBytes overrides the response cap, primarily for constrained deployments and tests.
type InstallOutcome ¶
type InstallOutcome struct {
Kind Kind `json:"kind"`
EntryID string `json:"entry_id"`
Outcome string `json:"outcome"`
PolicyGate string `json:"policy_gate"`
}
InstallOutcome is the redacted canonical observation for one marketplace install attempt.
type KindState ¶
type KindState struct {
Kind Kind
ManifestVersion int
GeneratedAt time.Time
FetchedAt time.Time
Stale bool
LastError string
ErrorClass string
EntryCount int
}
KindState reports the freshness and failure state for one feed projection.
type ListResult ¶
ListResult is one deterministic page from the durable catalog projection.
type MCPAuthDetails ¶
type MCPEntryDetails ¶
type MCPEntryDetails struct {
Launch MCPLaunchDetails
Auth *MCPAuthDetails
Inputs []MCPInputDetails
DefaultScope string
}
MCPEntryDetails contains the feed-locked MCP install template.
type MCPInputBindingDetails ¶
type MCPInputDetails ¶
type MCPInputDetails struct {
ID string
Prompt string
Type string
Required bool
Binding MCPInputBindingDetails
Default json.RawMessage
}
type MCPLaunchDetails ¶
type Notifier ¶
type Notifier interface {
NotifyCatalogRefresh(ctx context.Context, outcome RefreshOutcome) error
NotifyInstall(ctx context.Context, outcome InstallOutcome) error
}
Notifier persists canonical marketplace observations.
type RefreshOutcome ¶
type RefreshOutcome struct {
Kind Kind `json:"kind"`
Outcome string `json:"outcome"`
EntryCount int `json:"entry_count"`
Stale bool `json:"stale"`
ErrorClass string `json:"error_class,omitempty"`
}
RefreshOutcome is the canonical per-kind refresh result.
type RefreshReport ¶
type RefreshReport struct {
Outcomes []RefreshOutcome `json:"outcomes"`
}
RefreshReport contains deterministic per-kind refresh outcomes.
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
SQLiteStore maps validated catalog domain values to the global repository.
func NewSQLiteStore ¶
func NewSQLiteStore(repository storepkg.MarketplaceCatalogRepository) (*SQLiteStore, error)
NewSQLiteStore binds the projection to the global SQLite repository.
func (*SQLiteStore) GetExtensionByInstallSlug ¶
func (s *SQLiteStore) GetExtensionByInstallSlug( ctx context.Context, installSlug string, version string, ) (*Entry, error)
GetExtensionByInstallSlug resolves one exact feed-authoritative extension acquisition row.
func (*SQLiteStore) KindState ¶
KindState returns persisted freshness plus the current projected row count.
func (*SQLiteStore) ListKind ¶
func (s *SQLiteStore) ListKind( ctx context.Context, kind Kind, query string, offset int, limit int, ) (ListResult, error)
ListKind returns deterministic projected entries matching name or description.
func (*SQLiteStore) ListSkillsByInstallSlugs ¶
func (s *SQLiteStore) ListSkillsByInstallSlugs( ctx context.Context, installSlugs []string, ) ([]Entry, error)
ListSkillsByInstallSlugs resolves exact curated skill acquisition identities in one read.
func (*SQLiteStore) MarkKindStale ¶
func (s *SQLiteStore) MarkKindStale( ctx context.Context, kind Kind, errorClass string, lastError string, ) error
MarkKindStale records a redacted failure without touching projected entries.
func (*SQLiteStore) ReplaceKind ¶
ReplaceKind validates and atomically replaces one kind's projection.
type Service ¶
type Service interface {
Browse(ctx context.Context, kind Kind, query string, offset int, limit int) (BrowseResult, error)
Detail(ctx context.Context, kind Kind, entryID string) (*Entry, error)
ResolveExtensionInstall(ctx context.Context, installSlug string, version string) (*Entry, error)
Refresh(ctx context.Context, kinds ...Kind) (RefreshReport, error)
Status(ctx context.Context) ([]KindState, error)
Close(ctx context.Context) error
}
Service exposes internal curated browse, detail, refresh, and status operations.
type ServiceOption ¶
type ServiceOption func(*CatalogService)
ServiceOption customizes service time and observability seams.
func WithNotifier ¶
func WithNotifier(notifier Notifier) ServiceOption
WithNotifier attaches the failure-isolated canonical refresh notifier.
func WithNow ¶
func WithNow(now func() time.Time) ServiceOption
WithNow injects the UTC clock used for freshness decisions.
type SkillEntryDetails ¶
type SkillInstallResolver ¶
type SkillInstallResolver interface {
ResolveSkillInstalls(ctx context.Context, installSlugs []string) ([]Entry, error)
}
SkillInstallResolver batches curated identity reads for remote skill listings.
type Store ¶
type Store interface {
ReplaceKind(ctx context.Context, kind Kind, document *Document) error
MarkKindStale(ctx context.Context, kind Kind, errorClass string, lastError string) error
ListKind(ctx context.Context, kind Kind, query string, offset int, limit int) (ListResult, error)
GetEntry(ctx context.Context, kind Kind, entryID string) (*Entry, error)
GetExtensionByInstallSlug(ctx context.Context, installSlug string, version string) (*Entry, error)
ListSkillsByInstallSlugs(ctx context.Context, installSlugs []string) ([]Entry, error)
KindState(ctx context.Context, kind Kind) (*KindState, error)
}
Store persists the curated projection and freshness state.
type UnsupportedManifestVersionError ¶
UnsupportedManifestVersionError reports a feed and client manifest-version mismatch.
func (*UnsupportedManifestVersionError) Error ¶
func (e *UnsupportedManifestVersionError) Error() string
Source Files
¶
- catalog_files.go
- digest.go
- directory_source.go
- document_validation.go
- entry_common.go
- entry_extension.go
- entry_mcp.go
- entry_mcp_input.go
- entry_mcp_launch.go
- entry_skill.go
- errors.go
- projection.go
- service.go
- service_extension_install.go
- service_lifecycle.go
- service_refresh.go
- service_skill_install.go
- source.go
- source_factory.go
- store.go
- store_extension_install.go
- store_skill_install.go
- types.go
- unicode_fold.go