plugins

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 58 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 HTTPMaxBody = 1024 * 1024
View Source
const HTTPMaxTimeout = 60 * time.Second
View Source
const ManifestSchema = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
View Source
const MaxCardPropsBytes = 16 * 1024
View Source
const MaxCardSchemaBytes = 32 * 1024
View Source
const MaxCards = 16
View Source
const MaxManifestBytes = 256 * 1024
View Source
const MaxPackageBytes = 128 * 1024 * 1024
View Source
const MaxPackageDepth = 32
View Source
const MaxPackageEntries = 1024
View Source
const MaxSettingsBytes = 64 * 1024
View Source
const MaxSkillDocumentBytes = 128 * 1024
View Source
const MaxSkills = 64
View Source
const MaxValueBytes = 256 * 1024
View Source
const OfficialCatalogURL = "https://sailry.dev/plugins/catalog.json"
View Source
const OfficialRepository = "https://github.com/sailry/sailry-plugins"
View Source
const ScriptCallTimeout = 60 * time.Second
View Source
const ScriptMaxBytes = 256 * 1024
View Source
const ScriptMaxDataBytes = 2 * 1024 * 1024
View Source
const ScriptMemoryBytes = 64 * 1024 * 1024
View Source
const SettingsSchema = "https://json-schema.org/draft/2020-12/schema"
View Source
const SkillRegistryURL = "https://api.skillhub.cn"
View Source
const ThirdPartyCatalogURL = "https://agentpluginsdirectory.com"

Variables

View Source
var ErrResourceMissing = &protocol.Fault{Code: protocol.ErrorCodeNotFound, Message: "plugin resource is missing"}

Functions

func AssessUpdate

func AssessUpdate(current, candidate protocol.PluginInfo, runtimes ...Runtime) (protocol.PluginUpdatesReport, error)

AssessUpdate applies this Node's update policy to an already captured package, including packages uploaded from a controller's local directory.

func BundledEntries

func BundledEntries(ctx context.Context) ([]protocol.PluginCatalogEntry, error)

func BundledSkillEntries

func BundledSkillEntries(ctx context.Context) ([]protocol.PluginSkillcatalogEntry, error)

func CapturedOptions

func CapturedOptions(info protocol.PluginInfo, config protocol.SessionConfig) (map[string]json.RawMessage, error)

CapturedOptions are the package's conversation options as the turn froze them: the declared defaults overlaid with the saved values of declared keys.

func CardAccepts

func CardAccepts(declaration protocol.PluginCardDeclaration, raw json.RawMessage) bool

func CardSummaryValid

func CardSummaryValid(summary protocol.PluginCardSummary) bool

func CatalogVersionCompatibility

func CatalogVersionCompatibility(version protocol.PluginCatalogVersion, runtimes ...Runtime) protocol.PluginCompatibility

func Compatibility

func Compatibility(required *string) protocol.PluginCompatibility

func DiscoverSkills

func DiscoverSkills(files map[string][]byte) ([]protocol.PluginSkill, []protocol.PluginIssue)

func EnsureCompatible

func EnsureCompatible(compatibility protocol.PluginCompatibility) error

func ExecuteHTTP

func ExecuteHTTP(ctx context.Context, input HTTPInput, client *http.Client) (protocol.PluginHttpResponse, error)

func FlowOperation

func FlowOperation(operation protocol.ToolOperation) bool

FlowOperation reports whether a flow may declare an operation, which is whether a flow step may run it. Installation and the turn share this rule.

func HTTPBinding

func HTTPBinding(binding protocol.PluginSettingsBinding) (*url.URL, string, string, error)

func InfoCompatibility

func InfoCompatibility(info protocol.PluginInfo, runtimes ...Runtime) protocol.PluginCompatibility

InfoCompatibility also reads older stored records whose requirements had not yet been separated from their parsed functionality.

func IsLegacyDesktopPackage

func IsLegacyDesktopPackage(name, digest string) bool

IsLegacyDesktopPackage matches the official content used by legacy Desktop views. The extra digests do not add loader requirements or native tool aliases.

func IsLegacyNativeToolPackage

func IsLegacyNativeToolPackage(name, digest string) bool

IsLegacyNativeToolPackage matches the frozen package identity used by native tool adapters and historical aliases.

func IsLegacyOfficialPackage

func IsLegacyOfficialPackage(name, digest string) bool

IsLegacyOfficialPackage checks the immutable content identity of a known official release, independent of its installation origin and compatibility.

func IsNewer

func IsNewer(installed, candidate *string) bool

func IsWithdrawn

func IsWithdrawn(info protocol.PluginInfo) bool

IsWithdrawn checks installation eligibility without disabling captured or already installed content when a release is withdrawn from the catalog.

func LegacyDesktopControlRetired

func LegacyDesktopControlRetired(ref protocol.PluginReference, slot protocol.PluginUiSlot, id string) bool

LegacyDesktopControlRetired covers the project selector built into every composer, including windows without the optional worktree workflow.

func NormalizeStorageValue

func NormalizeStorageValue(collection *protocol.PluginStorageCollection, previous, value json.RawMessage) (json.RawMessage, error)

func OptionSchema

func OptionSchema(raw json.RawMessage) (protocol.PluginSettingsSchema, error)

OptionSchema parses a package's conversation option schema: public scalar values only, with distinct imports.

func PackageReference

func PackageReference(info protocol.PluginInfo) protocol.PluginReference

func ParseSkill

func ParseSkill(data []byte, name string) (protocol.PluginSkill, error)

func ProjectScriptTools

func ProjectScriptTools(ref protocol.PluginReference, declarations []protocol.ToolDeclaration, unavailable func(protocol.ToolOperation) bool) ([]protocol.ToolDeclaration, string)

ProjectScriptTools hides declarations the host cannot serve and projects supported subsets only for known historical package ABIs.

func ProjectStorageValue

func ProjectStorageValue(collection *protocol.PluginStorageCollection, data json.RawMessage) (json.RawMessage, error)

func ProtectHTTPResponse

func ProtectHTTPResponse(response *protocol.PluginHttpResponse, secrets []protocol.Secret) error

func RegistrySourceURL

func RegistrySourceURL(input string) (*protocol.PluginSkillsRegistrySource, error)

func ResolveArtifactView

func ResolveArtifactView(ctx context.Context, declared protocol.ArtifactView, readFile func(string) ([]byte, error)) (*protocol.ArtifactViewContent, error)

ResolveArtifactView reads a declaration from a verified package capture or the embedded files of a native module, enforcing the same resource budget.

func RetiredBundled

func RetiredBundled() []string

RetiredBundled names packages the application once bundled and now provides itself. Startup removes a bundled installation of one; the removal record and the captured versions stay, so earlier turns still resolve.

func RunCallback

func RunCallback(ctx context.Context, bundle ScriptBundle, handler string, input any, environment ScriptEnvironment, readOnly bool, dispatch ScriptDispatch) (json.RawMessage, error)

func RunTool

func RunTool(ctx context.Context, bundle ScriptBundle, handler string, input any, environment ScriptEnvironment, dispatch ScriptDispatch, execution *ScriptExecution) (json.RawMessage, error)

func SelectCompatibleVersion

func SelectCompatibleVersion(entry protocol.PluginCatalogEntry, installed *string, runtimes ...Runtime) *protocol.PluginCatalogVersion

SelectCompatibleVersion keeps catalog presentation independent from the installed Node's candidate. Prereleases enter automatic selection only when the installed package already follows a prerelease channel.

func SettingDefaults

func SettingDefaults(schema *protocol.PluginSettingsSchema) map[string]json.RawMessage

func SkillImportDigest

func SkillImportDigest(data []byte) string

func StandaloneSkillName

func StandaloneSkillName(repository, directory string) string

func ToolAlias

func ToolAlias(packageName, tool string) string

func ToolCallIdentity

func ToolCallIdentity(turn protocol.TurnID, reference protocol.PluginReference, tool, call string) protocol.RequestID

func ToolCommand

func ToolCommand(kind string, data json.RawMessage) (protocol.Command, error)

func ToolOperation

func ToolOperation(info protocol.PluginInfo, name string) *protocol.ToolOperation

func ToolOutput

func ToolOutput(output protocol.Output) any

func ToolWriteIdentity added in v0.2.4

func ToolWriteIdentity(call protocol.RequestID, sequence uint64) protocol.RequestID

ToolWriteIdentity preserves the request identity of each durable write made by one recorded tool call, including when a core executor replaces a script.

func Translate

func Translate(ctx context.Context, bundle ScriptBundle, handler string, input any, maxBytes int, budget time.Duration) (json.RawMessage, error)

func ValidateBinding

func ValidateBinding(binding protocol.PluginSettingsBinding, servers map[string]protocol.PluginMcpServer) (string, error)

func ValidateCards

func ValidateCards(extension protocol.PluginExtension) error

func ValidateMCPServer

func ValidateMCPServer(server protocol.PluginMcpServer) error

func ValidateName

func ValidateName(name string) bool

func ValidatePublicSettings

func ValidatePublicSettings(schema protocol.PluginSettingsSchema, values map[string]json.RawMessage) error

func ValidateRegistrySource

func ValidateRegistrySource(source protocol.PluginSkillsRegistrySource) error

func ValidateSettings

func ValidateSettings(data []byte, declarations ...map[string]protocol.PluginMcpServer) (protocol.PluginSettingsSchema, error)

func ValidateStorage

func ValidateStorage(declaration protocol.PluginStorageDeclaration) error

func ValidateStorageIndex

func ValidateStorageIndex(index protocol.PluginStorageIndex) error

func WithRuntime

func WithRuntime(ctx context.Context, runtime Runtime) context.Context

Types

type DefaultPackage

type DefaultPackage struct {
	Name    string
	Enabled bool
}

func BundledDefaults

func BundledDefaults() []DefaultPackage

type HTTPInput

type HTTPInput struct {
	URL        *url.URL
	Method     string
	Headers    http.Header
	Body       *string
	Timeout    time.Duration
	Protection []protocol.Secret
}

func BindConnectorHTTP

func BindConnectorHTTP(input HTTPInput, declaration protocol.PluginConnectorDeclaration, method protocol.PluginConnectorKind, secrets map[string]protocol.Secret, grant *protocol.Secret) (HTTPInput, error)

func PrepareHTTP

func PrepareHTTP(request protocol.PluginHttpRequest, schema *protocol.PluginSettingsSchema, secrets map[string]protocol.Secret) (HTTPInput, error)

type Manager

type Manager struct {
	Client             *http.Client
	OfficialURL        string
	ThirdPartyURL      string
	RegistryURL        string
	SkillsDirectoryURL string
	// contains filtered or unexported fields
}

func NewManager

func NewManager(profile string, bundled ...fs.FS) *Manager

func (*Manager) CapturedInfo

func (manager *Manager) CapturedInfo(ctx context.Context, reference protocol.PluginReference) (protocol.PluginInfo, error)

func (*Manager) Catalog

func (manager *Manager) Catalog(ctx context.Context, source protocol.PluginCatalogSource, query string, page uint32, force bool) (protocol.PluginCatalogPage, error)

func (*Manager) CatalogSource

func (manager *Manager) CatalogSource(ctx context.Context, source protocol.PluginCatalogSource, id string) (protocol.PluginSkillsSource, error)

func (*Manager) CheckUpdate

func (manager *Manager) CheckUpdate(ctx context.Context, current protocol.PluginInfo, worktreeRoot *string, force bool) (protocol.PluginUpdatesReport, error)

func (*Manager) Close

func (manager *Manager) Close()

Close releases retained inspection buffers and unregisters memory hooks.

func (*Manager) Collect

func (manager *Manager) Collect(retained map[string]struct{}) error

Collect removes the published package directories whose digest is not retained. Only canonical content-addressed directories belong to it; staging directories and foreign entries stay. An interrupted run leaves an orphan for the next one.

func (*Manager) DiscoverRepositorySkills

func (manager *Manager) DiscoverRepositorySkills(ctx context.Context, source protocol.PluginSkillsSource) (protocol.PluginSkillsDiscovery, error)

func (*Manager) Inspect

func (manager *Manager) Inspect(ctx context.Context, directory, workingDirectory, name string) (protocol.PluginInfo, error)

func (*Manager) InspectArchive

func (manager *Manager) InspectArchive(ctx context.Context, reader io.ReaderAt, size int64, name string) (protocol.PluginInfo, error)

func (*Manager) InspectBundled

func (manager *Manager) InspectBundled(ctx context.Context, name string) (protocol.PluginInfo, error)

func (*Manager) InspectOfficial

func (manager *Manager) InspectOfficial(ctx context.Context, name string, version *string, force bool) (protocol.PluginCatalogSelection, error)

func (*Manager) InspectRepository

func (manager *Manager) InspectRepository(ctx context.Context, source protocol.PluginSkillsSource) (protocol.PluginCatalogSelection, error)

func (*Manager) Install

func (manager *Manager) Install(ctx context.Context, directory, workingDirectory, name string) (protocol.PluginInfo, error)

func (*Manager) InstallArchive

func (manager *Manager) InstallArchive(ctx context.Context, reader io.ReaderAt, size int64, name string) (protocol.PluginInfo, error)

func (*Manager) InstallBundled

func (manager *Manager) InstallBundled(ctx context.Context, name string) (protocol.PluginInfo, error)

func (*Manager) InstallOfficial

func (manager *Manager) InstallOfficial(ctx context.Context, selection protocol.PluginCatalogSelection) (protocol.PluginInfo, error)

InstallOfficial rechecks the catalog at the installation boundary. A reviewed selection cannot install a withdrawn or reassigned version from cached bytes.

func (*Manager) InstallRegistry

func (manager *Manager) InstallRegistry(ctx context.Context, source protocol.PluginSkillsRegistryResolved, name string) (protocol.PluginInfo, error)

func (*Manager) InstallRepository

func (manager *Manager) InstallRepository(ctx context.Context, selection protocol.PluginCatalogSelection) (protocol.PluginInfo, error)

func (*Manager) InstallRepositorySkill

func (manager *Manager) InstallRepositorySkill(ctx context.Context, source protocol.PluginSkillsResolved, directory, name string) (protocol.PluginInfo, error)

func (*Manager) InstallSkillImport

func (manager *Manager) InstallSkillImport(ctx context.Context, data []byte, format protocol.PluginSkillsArchiveFormat, source protocol.PluginSkillsImported, name string) (protocol.PluginInfo, error)

func (*Manager) InstallSkillUpload

func (manager *Manager) InstallSkillUpload(ctx context.Context, reader io.ReaderAt, size int64, format protocol.PluginSkillsArchiveFormat, source protocol.PluginSkillsImported, name string) (protocol.PluginInfo, error)

func (*Manager) OfficialEntries

func (manager *Manager) OfficialEntries(ctx context.Context, force bool) ([]protocol.PluginCatalogEntry, error)

func (*Manager) PackageRoot

func (manager *Manager) PackageRoot(reference protocol.PluginReference) (string, error)

func (*Manager) ReadArtifactView added in v0.2.5

func (manager *Manager) ReadArtifactView(ctx context.Context, reference protocol.PluginReference) (*protocol.ArtifactViewContent, error)

ReadArtifactView returns the renderer a captured package declares for its session documents: the template, styles and scripts in declared order, and the names of the visual libraries the controller supplies. A package without a renderer returns nil.

func (*Manager) ReadBundle

func (manager *Manager) ReadBundle(ctx context.Context, reference protocol.PluginReference, entry string, resources []string) (map[string]string, error)

func (*Manager) ReadBundledResource

func (manager *Manager) ReadBundledResource(reference protocol.PluginReference, name string, limit int) ([]byte, bool, error)

ReadBundledResource reads a single resource from the cached embedded package matching reference without re-walking the published directory. It returns ok=false when reference does not match an embedded package in this build.

func (*Manager) ReadDesktop

func (*Manager) ReadResource

func (manager *Manager) ReadResource(ctx context.Context, reference protocol.PluginReference, name string, limit int) ([]byte, error)

func (*Manager) ReadSkillDocument

func (manager *Manager) ReadSkillDocument(ctx context.Context, source protocol.PluginSkillsDocumentSource) (protocol.PluginSkillsDocument, error)

func (*Manager) RegistryDocument

func (*Manager) RestoreBundled

func (manager *Manager) RestoreBundled(ctx context.Context, reference protocol.PluginReference) (protocol.PluginInfo, error)

RestoreBundled repairs only a digest that this build can reproduce from its embedded package. A damaged published entry is retained outside the digest namespace.

func (*Manager) SkillCatalog

func (manager *Manager) SkillCatalog(ctx context.Context, source protocol.PluginSkillcatalogSource, query string, page uint32, force bool) (protocol.PluginSkillcatalogPage, error)

func (*Manager) SnapshotSkills

func (manager *Manager) SnapshotSkills(ctx context.Context, directory, workingDirectory string) ([]byte, protocol.PluginSkillsArchiveFormat, protocol.PluginUploadSource, error)

func (*Manager) VerifyPackage

func (manager *Manager) VerifyPackage(ctx context.Context, reference protocol.PluginReference) error

type Manifest

type Manifest struct {
	Name         string
	Version      *string
	Description  *string
	Homepage     *string
	Repository   *string
	License      *string
	Requirements *protocol.PluginRequirements
	Extension    *protocol.PluginExtension
	Issues       []protocol.PluginIssue
}

func ValidateManifest

func ValidateManifest(data []byte) (Manifest, error)

type MemoryTracker

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

MemoryTracker belongs to one Node. It tracks real JavaScript lifetimes, not installed packages, and publishes retained-heap estimates separately from Go/native memory. Only a VM's owner, or an idle Translation holding its existing mutex, may walk that VM; readers never inspect a busy VM.

func NewMemoryTracker

func NewMemoryTracker() *MemoryTracker

func (*MemoryTracker) Context

func (tracker *MemoryTracker) Context(ctx context.Context, pkg protocol.PluginReference, kind string, users ...string) context.Context

Context carries the captured package identity to a VM constructor. It changes neither the script's authority nor its cancellation and budgets.

func (*MemoryTracker) Read

func (tracker *MemoryTracker) Read(users ...string) *protocol.PluginMemorySnapshot

Read renews diagnostic demand and samples idle translations without waiting for executing JavaScript. A busy instance retains its older estimate or nil; a call starting during a walk uses the existing mutex.

type RepositorySelection

type RepositorySelection struct {
	Repository string
	GitRef     string
	Path       string
}

func ParseRepositorySource

func ParseRepositorySource(source protocol.PluginSkillsSource) (RepositorySelection, error)

type Runtime

type Runtime struct {
	ProductID string
	Modules   []string
}

Runtime identifies the execution product and the modules it actually assembled. An unset runtime leaves controller-local version checks independent of the Node.

func RuntimeFromContext

func RuntimeFromContext(ctx context.Context) Runtime

type ScriptBundle

type ScriptBundle struct {
	Entry string
	Files map[string]string
}

type ScriptDispatch

type ScriptDispatch func(context.Context, protocol.Request) (protocol.Output, error)

type ScriptEnvironment

type ScriptEnvironment struct {
	Context  protocol.PluginContext
	Target   protocol.NodeID
	Deadline time.Time
}

type ScriptExecution

type ScriptExecution struct {
	CallID     *protocol.RequestID
	Mode       protocol.WorkMode
	ReadOnly   bool
	Turn       json.RawMessage
	StagedTurn json.RawMessage
	// Writes counts the durable writes of this tool call: in the first
	// evaluation's count, out the count the next evaluation of the same
	// call continues from, so each write has its own request ID.
	Writes uint64
}

type Translation

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

func NewTranslation

func NewTranslation(ctx context.Context, bundle ScriptBundle) (*Translation, error)

func NewTranslationBounded

func NewTranslationBounded(ctx context.Context, bundle ScriptBundle, budget time.Duration) (*Translation, error)

func (*Translation) Call

func (session *Translation) Call(handler string, input any, maxBytes int) (json.RawMessage, error)

func (*Translation) Close

func (session *Translation) Close()

func (*Translation) HasExport

func (session *Translation) HasExport(handler string) (bool, error)

Jump to

Keyboard shortcuts

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