schema

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SchemaTypeManifest = "manifest"
	SchemaTypeMCP      = "mcp"

	CanonicalPluginSchemaURL = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
	CanonicalMCPSchemaURL    = "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json"

	CachePluginFileName = "plugin.schema.json"
	CacheMCPFileName    = "mcp.schema.json"
)

Variables

This section is empty.

Functions

func CanonicalURL added in v1.2.0

func CanonicalURL(schemaType string) string

CanonicalURL returns the default canonical schema URL for a schema type.

func DetectType added in v1.2.0

func DetectType(inputData []byte, filename string) string

DetectType inspects input document content and filename to determine if it is "mcp" or "manifest".

func EmbeddedSchema

func EmbeddedSchema(schemaType string) []byte

EmbeddedSchema returns the raw byte content for the given schema type ("manifest" or "mcp").

func EmbeddedSchemaInfo

func EmbeddedSchemaInfo(schemaType string) (id string, title string)

EmbeddedSchemaInfo parses basic metadata ($id, title) from the embedded schema.

Types

type Manager

type Manager struct {
	CacheDir string
}

Manager manages local schema caching, resolution, and updating.

func NewManager

func NewManager() (*Manager, error)

NewManager creates a Manager with the default cache directory (~/.apv/schemas).

func (*Manager) CachedPath

func (m *Manager) CachedPath(schemaType string) string

CachedPath returns the absolute path to the cached schema file for a schema type.

func (*Manager) Reset

func (m *Manager) Reset(schemaType string) error

Reset removes the cached schema for a schema type (or all if schemaType is empty).

func (*Manager) Resolve

func (m *Manager) Resolve(schemaType string, override string) (*SchemaInfo, error)

Resolve resolves the active schema based on precedence: 1. Explicit override (file path or URL) 2. Cached schema in ~/.apv/schemas/ 3. Embedded default schema

func (*Manager) Show

func (m *Manager) Show(schemaType string) (*SchemaInfo, error)

Show returns information about the active schema for a schema type.

func (*Manager) Update

func (m *Manager) Update(schemaType string, targetURL string) (*SchemaInfo, error)

Update fetches a schema from targetURL (or default canonical URL) and caches it locally.

type SchemaInfo

type SchemaInfo struct {
	Type      string `json:"type"`   // "manifest" | "mcp"
	Source    string `json:"source"` // "embedded default" | "cached" | "override"
	Path      string `json:"path"`   // filesystem path, URL, or "(embedded)"
	ID        string `json:"id"`     // $id value from the schema
	Title     string `json:"title"`  // title from the schema
	RawSchema []byte `json:"-"`      // Raw schema byte content
}

SchemaInfo holds information about a resolved or loaded schema.

Jump to

Keyboard shortcuts

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