bundle

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MPL-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionKind basespec.CollectionKind = builtinSchema.SkillCollectionV1Kind

	CollectionSchemaVersion = "v1"
	DiscoveryPolicyRevision = "skill.bundle.discovery.v1"

	RoleManaged  basespec.AttachmentRole = "managed"
	RoleBuiltIn  basespec.AttachmentRole = "builtin"
	RoleExternal basespec.AttachmentRole = "external"
	RoleLibrary  basespec.AttachmentRole = "library"
)
View Source
const AttachmentDataSchemaVersion = "v1"

Variables

This section is empty.

Functions

func EncodeAttachmentData

func EncodeAttachmentData(
	value AttachmentData,
) (json.RawMessage, error)

func EncodeCollectionData

func EncodeCollectionData(value CollectionData) (json.RawMessage, error)

func NewShareableCodec added in v0.2.16

func NewShareableCodec() shareable.Codec

func ValidateCollectionData

func ValidateCollectionData(value CollectionData) error

Types

type API

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

func New

func New(dependencies Dependencies) (*API, error)

func (*API) AdoptSkill

func (a *API) AdoptSkill(
	ctx context.Context,
	request AdoptSkillRequest,
) (artifact.Artifact, error)

func (*API) AttachSource

func (a *API) AttachSource(
	ctx context.Context,
	bundle collection.CollectionRef,
	expectedCollectionRevision uint64,
	draft AttachmentDraft,
) (Bundle, error)

func (*API) Close

func (a *API) Close() error

func (*API) CreateBundle

func (a *API) CreateBundle(
	ctx context.Context,
	request CreateBundleRequest,
) (Bundle, error)

func (*API) CreateManagedSkill

func (a *API) CreateManagedSkill(
	ctx context.Context,
	request CreateManagedSkillRequest,
) (CreateManagedSkillResponse, error)

func (*API) EnsureBuiltInBundleCurrent

func (a *API) EnsureBuiltInBundleCurrent(
	ctx context.Context,
	ref collection.CollectionRef,
) error

EnsureBuiltInBundleCurrent preserves startup convergence without publishing a new catalog when the protected bundle is already current. It is reserved for the trusted built-in installer and explicit built-in update paths.

func (*API) EnsureBuiltInBundleTopology

func (a *API) EnsureBuiltInBundleTopology(
	ctx context.Context,
	request BuiltInBundleTopology,
) (Bundle, error)

func (*API) GetBundle

func (a *API) GetBundle(
	ctx context.Context,
	ref collection.CollectionRef,
) (Bundle, error)

func (*API) GetManagedSkillDocument

func (a *API) GetManagedSkillDocument(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (ManagedSkillDocument, error)

GetManagedSkillDocument reads the canonical definition for a managed Skill package. External and discovered Skills remain source-owned and intentionally do not expose an editable document through this API.

func (*API) GetSkill

func (a *API) GetSkill(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (artifact.Artifact, error)

func (*API) InstallBuiltInCollection

func (a *API) InstallBuiltInCollection(
	ctx context.Context,
	request BuiltInCollectionInstallRequest,
) ([]CreateManagedSkillResponse, error)

func (*API) InstallBuiltInSkill

func (a *API) InstallBuiltInSkill(
	ctx context.Context,
	_ CreateManagedSkillRequest,
) (CreateManagedSkillResponse, error)

func (*API) ListBundles

func (a *API) ListBundles(
	ctx context.Context,
	rootID basespec.RootID,
) ([]Bundle, error)

func (*API) ListRuntimeSkills

func (a *API) ListRuntimeSkills(
	ctx context.Context,
	bundle collection.CollectionRef,
) (output []RuntimeSkill, returnErr error)

ListRuntimeSkills is deliberately fail-closed. A collection reconciliation must not retain a previous runtime definition when a current Artifact can no longer be projected.

func (*API) ListSkills

func (a *API) ListSkills(
	ctx context.Context,
	bundle collection.CollectionRef,
) ([]artifact.Artifact, error)

func (*API) LoadRuntimeSkill

func (a *API) LoadRuntimeSkill(
	ctx context.Context,
	ref artifact.ArtifactRef,
) (RuntimeSkill, error)

LoadRuntimeSkill resolves one Artifact-backed Skill Bundle member.

It verifies Artifact membership, Collection kind, Collection and Artifact enablement, catalog currentness, definition compatibility, and the source snapshot generation. Source adapters and MapStore remain responsible for their own containment and filesystem behavior.

func (*API) PinSkill

func (a *API) PinSkill(
	ctx context.Context,
	request PinSkillRequest,
) (artifact.Artifact, error)

func (*API) PurgeBundle

func (a *API) PurgeBundle(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
) error

func (*API) PurgeSkill

func (a *API) PurgeSkill(
	ctx context.Context,
	ref artifact.ArtifactRef,
	expectedRevision uint64,
) error

func (*API) Ready

func (a *API) Ready() error

func (*API) RefreshBuiltInBundle

func (a *API) RefreshBuiltInBundle(
	ctx context.Context,
	ref collection.CollectionRef,
) (refresh.Result, error)

RefreshBuiltInBundle is the trusted feature-level refresh path for a protected built-in Skill Bundle. It is intentionally unavailable through ordinary Skill Bundle mutation APIs.

func (*API) RefreshBundle

func (a *API) RefreshBundle(
	ctx context.Context,
	ref collection.CollectionRef,
) (refresh.Result, error)

func (*API) RetireBundle

func (a *API) RetireBundle(
	ctx context.Context,
	ref collection.CollectionRef,
	expectedRevision uint64,
) (collection.Collection, error)

func (*API) SetSkillEnabled

func (a *API) SetSkillEnabled(
	ctx context.Context,
	ref artifact.ArtifactRef,
	expectedRevision uint64,
	enabled bool,
) (artifact.Artifact, error)

func (*API) SkillBundleRefs

func (a *API) SkillBundleRefs(
	ctx context.Context,
) ([]collection.CollectionRef, error)

SkillBundleRefs returns every active Skill Bundle Collection. Runtime startup inventory and maintenance code may use this without treating a runtime ref shape as a source-of-truth ownership discriminator. Process-local runtime registration is resolved and reconciled lazily from Artifact identity.

func (*API) UnadoptSkill

func (a *API) UnadoptSkill(
	ctx context.Context,
	ref artifact.ArtifactRef,
	expectedRevision uint64,
	suppress bool,
) error

func (*API) UpdateBundle

func (a *API) UpdateBundle(
	ctx context.Context,
	request UpdateBundleRequest,
) (Bundle, error)

type AdoptSkillRequest

type AdoptSkillRequest struct {
	Bundle                  collection.CollectionRef
	Occurrence              catalog.OccurrenceKey
	ArtifactID              basespec.ArtifactID
	ExpectedCatalogRevision uint64
	Name                    string
	Enabled                 bool
}

type AttachmentData

type AttachmentData struct {
	SchemaVersion         string                                 `json:"schemaVersion"`
	DiscoveryRoot         basespec.Locator                       `json:"discoveryRoot"`
	ExpectedMemberDigests map[basespec.Locator]cryptoutil.Digest `json:"expectedMemberDigests,omitempty"`
}

AttachmentData is Collection-owned local mount configuration. It is never portable Collection payload data. ExpectedMemberDigests keys are relative to DiscoveryRoot, not to the Source root.

func DecodeAttachmentData

func DecodeAttachmentData(
	raw json.RawMessage,
) (AttachmentData, error)

func NewAttachmentData

func NewAttachmentData(
	discoveryRoot basespec.Locator,
	expectedMemberDigests map[basespec.Locator]cryptoutil.Digest,
) (AttachmentData, error)

func (AttachmentData) Clone

func (d AttachmentData) Clone() AttachmentData

func (AttachmentData) SourceExpectedContentDigests

func (d AttachmentData) SourceExpectedContentDigests() (
	map[basespec.Locator]cryptoutil.Digest,
	error,
)

SourceExpectedContentDigests maps Collection-relative expected members into Source-relative locators used by generic Artifact Store discovery.

func (AttachmentData) Validate

func (d AttachmentData) Validate() error

type AttachmentDraft

type AttachmentDraft struct {
	SourceID              basespec.SourceID
	Role                  basespec.AttachmentRole
	Enabled               bool
	DiscoveryRoot         basespec.Locator
	ExpectedMemberDigests map[basespec.Locator]cryptoutil.Digest
}

type BuiltInBundleTopology

type BuiltInBundleTopology struct {
	RootID                basespec.RootID                        `json:"-"`
	CollectionID          basespec.CollectionID                  `json:"-"`
	SourceID              basespec.SourceID                      `json:"-"`
	LogicalName           basespec.LogicalName                   `json:"-"`
	LogicalVersion        basespec.LogicalVersion                `json:"-"`
	DisplayName           string                                 `json:"-"`
	Description           string                                 `json:"-"`
	Labels                map[string]string                      `json:"-"`
	Enabled               bool                                   `json:"-"`
	DiscoveryRoot         basespec.Locator                       `json:"-"`
	ExpectedMemberDigests map[basespec.Locator]cryptoutil.Digest `json:"-"`
}

type BuiltInCollectionInstallRequest

type BuiltInCollectionInstallRequest struct {
	Bundle                     collection.CollectionRef
	ExpectedCollectionRevision uint64
	PackageDirectory           basespec.Locator
	PackageFiles               []source.ManagedPackageFile
	Skills                     []BuiltInCollectionSkill
}

BuiltInCollectionInstallRequest is trusted installer input. It materializes exactly one complete portable Collection package in one managed Source package directory, pins all static Artifacts, and then refreshes once.

type BuiltInCollectionSkill

type BuiltInCollectionSkill struct {
	ArtifactID basespec.ArtifactID
	Member     basespec.Locator
	Enabled    bool
}

type Bundle

type Bundle struct {
	Collection  collection.Collection
	Data        CollectionData
	Attachments []collection.Attachment
	Sources     []source.Summary
}

type CollectionData

type CollectionData struct {
	SchemaVersion           string                  `json:"schemaVersion"`
	DiscoveryPolicyRevision string                  `json:"discoveryPolicyRevision"`
	LogicalName             basespec.LogicalName    `json:"logicalName"`
	LogicalVersion          basespec.LogicalVersion `json:"logicalVersion,omitempty"`
	Labels                  map[string]string       `json:"labels,omitempty"`

	// ManagedSourceID identifies the managed Source provisioned exclusively
	// for this bundle. An empty value means attached Sources are externally
	// administered and are not deleted with the bundle.
	ManagedSourceID basespec.SourceID `json:"managedSourceID,omitempty"`
}

func DecodeCollectionData

func DecodeCollectionData(
	raw json.RawMessage,
) (CollectionData, error)

func (CollectionData) Clone

func (d CollectionData) Clone() CollectionData

type CreateBundleRequest

type CreateBundleRequest struct {
	RootID          basespec.RootID
	CollectionID    basespec.CollectionID
	ManagedSourceID basespec.SourceID
	DisplayName     string
	Description     string
	Enabled         bool
	LogicalName     basespec.LogicalName
	LogicalVersion  basespec.LogicalVersion
	Labels          map[string]string
	Attachments     []AttachmentDraft
}

type CreateManagedSkillRequest

type CreateManagedSkillRequest struct {
	Bundle                     collection.CollectionRef
	ExpectedCollectionRevision uint64
	ArtifactID                 basespec.ArtifactID
	SkillName                  string
	SKILLMD                    []byte
	ExpectedArtifactRevision   uint64

	// Document is an optional structured authoring input. Serialization is
	// delegated to agentskills-go. It is mutually exclusive with SKILLMD.
	Document *agentskillsSpec.SkillDocument
	Files    []source.ManagedPackageFile
	Enabled  bool
}

type CreateManagedSkillResponse

type CreateManagedSkillResponse struct {
	Artifact artifact.Artifact
	Address  artifact.ArtifactAddress
}

type Dependencies

type Dependencies struct {
	Roots                  RootLister
	Sources                *source.Service
	Collections            *collection.Service
	Artifacts              *artifact.Service
	Refresh                refresh.Runner
	Catalogs               catalog.Reader
	Definitions            definition.Reader
	ManagedArtifacts       *managedartifact.Service
	SourceRuntime          source.Runtime
	HasDecoder             func(basespec.DecoderID) bool
	DecoderFingerprint     func() (cryptoutil.Digest, error)
	RootMutationPolicy     protection.RootPolicy
	AutoAdoptionIDProvider artifact.ArtifactIDProvider
}

func (Dependencies) Validate

func (d Dependencies) Validate() error

type ManagedSkillDocument

type ManagedSkillDocument struct {
	Artifact artifact.Artifact
	Document agentskillsSpec.SkillDocument
}

ManagedSkillDocument is the editable projection for a managed Skill. It deliberately contains the canonical SKILL.md document only. It never exposes Source configuration, a native filesystem path, or package internals.

type PinSkillRequest

type PinSkillRequest struct {
	Bundle                     collection.CollectionRef
	ExpectedCollectionRevision uint64
	ArtifactID                 basespec.ArtifactID
	Binding                    artifact.SourceBinding
	Name                       string
	Enabled                    bool
}

type RootLister

type RootLister interface {
	List(ctx context.Context) ([]root.Root, error)
}

type RuntimeResolver

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

RuntimeResolver is the Skill Bundle feature adapter registered with the Artifact-backed Skill Runtime router. It owns only skill.bundle projection; collection ownership itself is resolved by the generic router.

func NewRuntimeResolver

func NewRuntimeResolver(api *API) (*RuntimeResolver, error)

func (*RuntimeResolver) ListCollectionSkills

func (*RuntimeResolver) ResolveArtifactSkill

type RuntimeSkill

type RuntimeSkill struct {
	Artifact   artifact.ArtifactRef
	Collection collection.CollectionRef

	Name     string
	Location string
	Version  string
}

RuntimeSkill is the typed Skill Bundle handoff to application composition. It is not persisted and is never exposed as a durable runtime identity.

type UpdateBundleRequest

type UpdateBundleRequest struct {
	Bundle           collection.CollectionRef
	ExpectedRevision uint64
	DisplayName      string
	Description      string
	Enabled          bool
}

Jump to

Keyboard shortcuts

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