extensions

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 24 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MCPAccessModeDefault = "default"
	MCPAccessModeCustom  = "custom"
	MCPAccessModeNone    = "none"
)
View Source
const ManifestVersion = 1

Variables

This section is empty.

Functions

func DigestDirectory

func DigestDirectory(sourceDir string) (string, error)

DigestDirectory returns the immutable object digest for a local package.

func MaterializeRuntimeBundle

func MaterializeRuntimeBundle(base fs.FS, snapshot CatalogSnapshot) (fs.FS, error)

MaterializeRuntimeBundle overlays active managed extension content onto the immutable bundled runtime so agent/skill registries can execute managed items.

func SaveMCPAccess

func SaveMCPAccess(stateDir string, state MCPAccessState) error

func ValidateIdentity

func ValidateIdentity(identity string) error

ValidateIdentity accepts one portable agent/skill identity that is safe to use as both a manifest key and a runtime overlay path component.

func ValidateMCPAccessRule

func ValidateMCPAccessRule(rule MCPAccessRule) error

ValidateMCPAccessRule verifies a rule before a CLI preview or update.

Types

type ActivationDiagnostic

type ActivationDiagnostic struct {
	Code    string `yaml:"code" json:"code"`
	Message string `yaml:"message" json:"message"`
}

type CatalogItem

type CatalogItem struct {
	ID          string                 `json:"id"`
	Kind        string                 `json:"kind"`
	Origin      string                 `json:"origin"` // bundled | managed
	Active      bool                   `json:"active"`
	Digest      string                 `json:"digest,omitempty"`
	Source      string                 `json:"source,omitempty"`
	ObjectPath  string                 `json:"object_path,omitempty"`
	ObjectRoot  string                 `json:"-"`
	Reason      string                 `json:"reason,omitempty"`
	Metadata    map[string]string      `json:"metadata,omitempty"`
	Diagnostics []ActivationDiagnostic `json:"diagnostics,omitempty"`
	Runtime     *RuntimeTarget         `json:"runtime_target,omitempty"`
}

type CatalogSnapshot

type CatalogSnapshot struct {
	CreatedAt time.Time     `json:"created_at"`
	Agents    []CatalogItem `json:"agents"`
	Skills    []CatalogItem `json:"skills"`
}

func ComposeCatalog

func ComposeCatalog(input ComposeInput) (CatalogSnapshot, error)

type ComposeInput

type ComposeInput struct {
	BundleFS         fs.FS
	Manifest         Manifest
	ObjectStoreRoot  string
	AgentOverride    bool
	SkillOverride    bool
	RejectCollisions bool
	Now              func() time.Time
}

type DiscoverSkillsOptions

type DiscoverSkillsOptions struct {
	All   bool
	Names []string
}

type DiscoveredSkill

type DiscoveredSkill struct {
	Name string
	Path string
}

func DiscoverLocalSkills

func DiscoverLocalSkills(source string, opts DiscoverSkillsOptions) ([]DiscoveredSkill, error)

func DiscoverSkillsFS

func DiscoverSkillsFS(fsys fs.FS, rootName string, opts DiscoverSkillsOptions) ([]DiscoveredSkill, error)

DiscoverSkillsFS discovers Agent Skills from a filesystem returned by a bounded source resolver. Paths are slash-separated and relative to fsys.

type InstallLocalAgentRequest

type InstallLocalAgentRequest struct {
	Source        string
	As            string
	Replace       bool
	DryRun        bool
	SourceURI     string
	Revision      string
	Subpath       string
	Runtime       *RuntimeTarget
	Provenance    Provenance
	SkillBindings []SkillBinding
}

type InstallLocalSkillsRequest

type InstallLocalSkillsRequest struct {
	Source   string
	Discover DiscoverSkillsOptions
	As       string
	Replace  bool
	DryRun   bool
}

type LocalAgentService

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

func NewLocalAgentService

func NewLocalAgentService(stateDir string) *LocalAgentService

func (*LocalAgentService) CopyBundledAgent

func (s *LocalAgentService) CopyBundledAgent(ctx context.Context, bundle fs.FS, bundleDigest, from, to string, dryRun bool) (ManifestEntry, error)

CopyBundledAgent creates an independent managed package from one immutable bundled agent, including a materialized constitution when the source uses a constitution_path.

func (*LocalAgentService) CopyManagedAgent

func (s *LocalAgentService) CopyManagedAgent(ctx context.Context, from, to string, dryRun bool) (bool, error)

func (*LocalAgentService) InstallAgentContent

func (s *LocalAgentService) InstallAgentContent(ctx context.Context, name string, data []byte, req InstallLocalAgentRequest) (ManifestEntry, error)

InstallAgentContent stores a fully translated agent definition without requiring a temporary source file. It is used by guided imports and copies.

func (*LocalAgentService) InstallLocalAgent

func (*LocalAgentService) InstallTranslatedAgent

func (s *LocalAgentService) InstallTranslatedAgent(ctx context.Context, name string, normalized, source []byte, sourceName string, importConfig []byte, req InstallLocalAgentRequest) (ManifestEntry, error)

InstallTranslatedAgent preserves the original source and optional import decisions beside the normalized runtime definition in one immutable object.

func (*LocalAgentService) InstallTranslatedAgents

func (s *LocalAgentService) InstallTranslatedAgents(ctx context.Context, installs []TranslatedAgentInstall) ([]ManifestEntry, error)

InstallTranslatedAgents activates a selected import batch atomically. Source bytes and import decisions are published in the same immutable objects; no agent from the batch becomes visible if validation or publication fails.

func (*LocalAgentService) ListManagedAgents

func (s *LocalAgentService) ListManagedAgents(ctx context.Context) ([]ManifestEntry, error)

func (*LocalAgentService) RemoveManagedAgent

func (s *LocalAgentService) RemoveManagedAgent(ctx context.Context, name string, dryRun bool) (bool, error)

func (*LocalAgentService) RenameManagedAgent

func (s *LocalAgentService) RenameManagedAgent(ctx context.Context, from, to string, dryRun bool) (bool, error)

func (*LocalAgentService) SetManagedAgentRuntime

func (s *LocalAgentService) SetManagedAgentRuntime(ctx context.Context, agentID string, target RuntimeTarget, dryRun bool) (ManifestEntry, error)

SetManagedAgentRuntime updates the normalized model and its selected runtime target together so execution drift can be detected.

func (*LocalAgentService) UpdateManagedAgentSkillBinding

func (s *LocalAgentService) UpdateManagedAgentSkillBinding(ctx context.Context, agentID, skillName, origin string, add, dryRun bool) (ManifestEntry, error)

func (*LocalAgentService) UpdateManagedAgentSkills

func (s *LocalAgentService) UpdateManagedAgentSkills(ctx context.Context, agentID, skillName string, add, dryRun bool) (ManifestEntry, error)

UpdateManagedAgentSkills adds or removes one explicit managed-agent skill binding. Availability is validated by the caller against the effective catalog before an addition.

type LocalSkillService

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

func NewLocalSkillService

func NewLocalSkillService(stateDir string) *LocalSkillService

func (*LocalSkillService) InstallLocalSkills

func (s *LocalSkillService) InstallLocalSkills(ctx context.Context, req InstallLocalSkillsRequest) ([]ManifestEntry, error)

func (*LocalSkillService) InstallResolvedSkills

func (s *LocalSkillService) InstallResolvedSkills(ctx context.Context, fsys fs.FS, rootName, source string, opts DiscoverSkillsOptions, replace, dryRun bool) ([]ManifestEntry, error)

InstallResolvedSkills materializes selected skills from a resolver-owned filesystem into the content-addressed store before the resolver is cleaned up. It supports local and remote resolvers without exposing source paths in runtime object references.

func (*LocalSkillService) InstallResolvedSkillsWithProvenance

func (s *LocalSkillService) InstallResolvedSkillsWithProvenance(ctx context.Context, fsys fs.FS, rootName, source, revision, subpath, sourceDigest string, opts DiscoverSkillsOptions, replace, dryRun bool) ([]ManifestEntry, error)

func (*LocalSkillService) ListManagedSkills

func (s *LocalSkillService) ListManagedSkills(ctx context.Context) ([]ManifestEntry, error)

func (*LocalSkillService) RemoveManagedSkill

func (s *LocalSkillService) RemoveManagedSkill(ctx context.Context, name string, dryRun bool) (bool, error)

func (*LocalSkillService) RenameManagedSkill

func (s *LocalSkillService) RenameManagedSkill(ctx context.Context, from, to string, dryRun bool) (bool, error)

RenameManagedSkill creates a new immutable object whose SKILL.md name matches the manifest identity. Existing managed-agent bindings are updated in the same transaction.

type MCPAccessRule

type MCPAccessRule struct {
	Mode    string   `yaml:"mode" json:"mode"`
	Servers []string `yaml:"servers,omitempty" json:"servers,omitempty"`
}

type MCPAccessState

type MCPAccessState struct {
	DefaultServers []string                 `yaml:"default_servers,omitempty" json:"default_servers,omitempty"`
	Agents         map[string]MCPAccessRule `yaml:"agents,omitempty" json:"agents,omitempty"`
}

func LoadMCPAccess

func LoadMCPAccess(stateDir string) (MCPAccessState, bool, error)

func UpdateMCPAccess

func UpdateMCPAccess(ctx context.Context, stateDir string, update func(*MCPAccessState) error) (MCPAccessState, error)

UpdateMCPAccess serializes the full read-modify-write operation with the extension manifest lock and recovery journal so batch activation can include access policy without exposing partial state.

func (MCPAccessState) AllowedServers

func (s MCPAccessState) AllowedServers(agentID string, all []string, hasConfig bool) []string

type Manifest

type Manifest struct {
	Version   int             `yaml:"version" json:"version"`
	Entries   []ManifestEntry `yaml:"entries" json:"entries"`
	MCPAccess *MCPAccessState `yaml:"mcp_access,omitempty" json:"mcp_access,omitempty"`
}

func EmptyManifest

func EmptyManifest() Manifest

func (Manifest) Clone

func (m Manifest) Clone() Manifest

type ManifestEntry

type ManifestEntry struct {
	Identity      string                 `yaml:"identity" json:"identity"`
	Kind          string                 `yaml:"kind" json:"kind"`
	Source        string                 `yaml:"source" json:"source"`
	Revision      string                 `yaml:"revision,omitempty" json:"revision,omitempty"`
	Subpath       string                 `yaml:"subpath,omitempty" json:"subpath,omitempty"`
	Digest        string                 `yaml:"digest" json:"digest"`
	ObjectPath    string                 `yaml:"object_path" json:"object_path"`
	InstalledAt   time.Time              `yaml:"installed_at" json:"installed_at"`
	Provenance    Provenance             `yaml:"provenance,omitempty" json:"provenance,omitempty"`
	Runtime       *RuntimeTarget         `yaml:"runtime_target,omitempty" json:"runtime_target,omitempty"`
	SkillBindings []SkillBinding         `yaml:"skill_bindings,omitempty" json:"skill_bindings,omitempty"`
	Diagnostics   []ActivationDiagnostic `yaml:"activation_diagnostics,omitempty" json:"activation_diagnostics,omitempty"`
}

func ActivateRuntimeBatch

func ActivateRuntimeBatch(ctx context.Context, stateDir string, req RuntimeBatchRequest) ([]ManifestEntry, error)

func (ManifestEntry) Clone

func (e ManifestEntry) Clone() ManifestEntry

type Provenance

type Provenance struct {
	Installer     string `yaml:"installer,omitempty" json:"installer,omitempty"`
	Host          string `yaml:"host,omitempty" json:"host,omitempty"`
	Actor         string `yaml:"actor,omitempty" json:"actor,omitempty"`
	SourceDigest  string `yaml:"source_digest,omitempty" json:"source_digest,omitempty"`
	SourceModel   string `yaml:"source_model,omitempty" json:"source_model,omitempty"`
	Adapter       string `yaml:"adapter,omitempty" json:"adapter,omitempty"`
	AdapterDigest string `yaml:"adapter_digest,omitempty" json:"adapter_digest,omitempty"`
	ImportConfig  string `yaml:"import_config_digest,omitempty" json:"import_config_digest,omitempty"`
	CopiedFrom    string `yaml:"copied_from,omitempty" json:"copied_from,omitempty"`
	BundleDigest  string `yaml:"bundle_digest,omitempty" json:"bundle_digest,omitempty"`
}

type RuntimeBatchObject

type RuntimeBatchObject struct {
	Entry          ManifestEntry
	Files          map[string][]byte
	Replace        bool
	ExpectedDigest string
}

RuntimeBatchObject is a validated immutable package waiting for one manifest publication. Files are relative to the content-addressed object root.

func PlanBundledAgentCopy

func PlanBundledAgentCopy(bundle fs.FS, bundleDigest, from, to string) (RuntimeBatchObject, error)

func PlanBundledAgentCopyWithOptions

func PlanBundledAgentCopyWithOptions(bundle fs.FS, bundleDigest, from, to, displayName string, skills []string, overrideSkills bool) (RuntimeBatchObject, error)

PlanBundledAgentCopyWithOptions creates an independent managed copy while applying the operator's final display-name and skill choices before digesting the package.

func PlanExistingAgentUpdate

func PlanExistingAgentUpdate(stateDir, identity, displayName string, skills []string, overrideSkills bool, bindings []SkillBinding) (RuntimeBatchObject, error)

PlanExistingAgentUpdate includes an existing managed package in a runtime batch, retaining its support/provenance files and replacing only explicitly selected agent fields.

func PlanSkillObject

func PlanSkillObject(fsys fs.FS, root, identity, source, revision, subpath, sourceDigest string, replace bool) (RuntimeBatchObject, error)

func PlanTranslatedAgentObject

func PlanTranslatedAgentObject(item TranslatedAgentInstall) (RuntimeBatchObject, error)

type RuntimeBatchRequest

type RuntimeBatchRequest struct {
	Objects   []RuntimeBatchObject
	MCPAccess *MCPAccessState
	DryRun    bool
}

type RuntimeTarget

type RuntimeTarget struct {
	Engine         string `yaml:"engine" json:"engine"`
	BaseURL        string `yaml:"base_url" json:"base_url"`
	Model          string `yaml:"model" json:"model"`
	ResolvedDigest string `yaml:"resolved_digest,omitempty" json:"resolved_digest,omitempty"`
}

func (RuntimeTarget) Drifted

func (t RuntimeTarget) Drifted(current RuntimeTarget) bool

func (RuntimeTarget) Validate

func (t RuntimeTarget) Validate() error

type SkillBinding

type SkillBinding struct {
	Name   string `yaml:"name" json:"name"`
	Origin string `yaml:"origin" json:"origin"` // bundled | managed | development
}

type Store

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

func NewStore

func NewStore(stateDir string) *Store

func (*Store) BeginTransaction

func (s *Store) BeginTransaction(ctx context.Context) (*Transaction, error)

func (*Store) EnsureInitialized

func (s *Store) EnsureInitialized(ctx context.Context) error

EnsureInitialized creates an empty manifest through the normal transaction path. It intentionally creates no objects or extension bindings.

func (*Store) LoadManifest

func (s *Store) LoadManifest() (Manifest, error)

func (*Store) LockPath

func (s *Store) LockPath() string

func (*Store) ManifestPath

func (s *Store) ManifestPath() string

func (*Store) ObjectRoot

func (s *Store) ObjectRoot() string

ObjectRoot returns the canonical root expected to contain content-addressed extension objects.

func (*Store) ObjectsDir

func (s *Store) ObjectsDir() string

func (*Store) PutObject

func (s *Store) PutObject(content []byte) (digest string, objectPath string, err error)

func (*Store) Recover

func (s *Store) Recover(ctx context.Context) (bool, error)

func (*Store) RecoverAndLoadManifest

func (s *Store) RecoverAndLoadManifest(ctx context.Context) (Manifest, bool, error)

func (*Store) SaveManifest

func (s *Store) SaveManifest(manifest Manifest) error

func (*Store) TxnDir

func (s *Store) TxnDir() string

type Transaction

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

func (*Transaction) AbortUnchanged

func (tx *Transaction) AbortUnchanged() error

AbortUnchanged releases a transaction that planned no mutable changes without rewriting the manifest or creating a new activation timestamp.

func (*Transaction) Commit

func (tx *Transaction) Commit() error

func (*Transaction) ReplaceManifest

func (tx *Transaction) ReplaceManifest(manifest Manifest)

ReplaceManifest stages a complete, previously validated manifest. It is intended for compensating a multi-step activation after a later step fails.

func (*Transaction) Rollback

func (tx *Transaction) Rollback() error

func (*Transaction) StageMCPAccess

func (tx *Transaction) StageMCPAccess(state MCPAccessState) error

StageMCPAccess includes the access policy in the same recovery journal and publication boundary as the extension manifest.

func (*Transaction) UpsertEntry

func (tx *Transaction) UpsertEntry(entry ManifestEntry)

type TranslatedAgentInstall

type TranslatedAgentInstall struct {
	Name         string
	Normalized   []byte
	Source       []byte
	SourceName   string
	SupportFiles map[string][]byte
	ImportConfig []byte
	Request      InstallLocalAgentRequest
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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