Documentation
¶
Index ¶
- Constants
- func BundledEntries(ctx context.Context) ([]protocol.PluginCatalogEntry, error)
- func BundledSkillEntries(ctx context.Context) ([]protocol.PluginSkillcatalogEntry, error)
- func CapturedOptions(info protocol.PluginInfo, config protocol.SessionConfig) (map[string]json.RawMessage, error)
- func CardAccepts(declaration protocol.PluginCardDeclaration, raw json.RawMessage) bool
- func CardSummaryValid(summary protocol.PluginCardSummary) bool
- func Compatibility(required *string) protocol.PluginCompatibility
- func DiscoverSkills(files map[string][]byte) ([]protocol.PluginSkill, []protocol.PluginIssue)
- func EnsureCompatible(compatibility protocol.PluginCompatibility) error
- func ExecuteHTTP(ctx context.Context, input HTTPInput, client *http.Client) (protocol.PluginHttpResponse, error)
- func FlowOperation(operation protocol.ToolOperation) bool
- func HTTPBinding(binding protocol.PluginSettingsBinding) (*url.URL, string, string, error)
- func IsNewer(installed, candidate *string) bool
- func NormalizeStorageValue(collection *protocol.PluginStorageCollection, previous, value json.RawMessage) (json.RawMessage, error)
- func OptionSchema(raw json.RawMessage) (protocol.PluginSettingsSchema, error)
- func PackageReference(info protocol.PluginInfo) protocol.PluginReference
- func ParseSkill(data []byte, name string) (protocol.PluginSkill, error)
- func ProjectStorageValue(collection *protocol.PluginStorageCollection, data json.RawMessage) (json.RawMessage, error)
- func ProtectHTTPResponse(response *protocol.PluginHttpResponse, secrets []protocol.Secret) error
- func ReadMCP(data []byte) ([]protocol.PluginMcp, map[string]protocol.PluginMcpServer, ...)
- func RegistrySourceURL(input string) (*protocol.PluginSkillsRegistrySource, error)
- func RetiredBundled() []string
- func RunCallback(ctx context.Context, bundle ScriptBundle, handler string, input any, ...) (json.RawMessage, error)
- func RunTool(ctx context.Context, bundle ScriptBundle, handler string, input any, ...) (json.RawMessage, error)
- func SettingDefaults(schema *protocol.PluginSettingsSchema) map[string]json.RawMessage
- func SkillBody(data []byte) ([]byte, error)
- func SkillImportDigest(data []byte) string
- func StampCards(result json.RawMessage, node protocol.NodeID, scope protocol.PluginContext, ...) json.RawMessage
- func StandaloneSkillName(repository, directory string) string
- func StorageCollection(info protocol.PluginInfo, scope protocol.PluginStorageScope, key string) *protocol.PluginStorageCollection
- func ToolAlias(packageName, tool string) string
- func ToolCallIdentity(turn protocol.TurnID, reference protocol.PluginReference, tool, call string) protocol.RequestID
- func ToolCommand(kind string, data json.RawMessage) (protocol.Command, error)
- func ToolOperation(info protocol.PluginInfo, name string) *protocol.ToolOperation
- func ToolOutput(output protocol.Output) any
- func Translate(ctx context.Context, bundle ScriptBundle, handler string, input any, ...) (json.RawMessage, error)
- func ValidateBinding(binding protocol.PluginSettingsBinding, ...) (string, error)
- func ValidateCards(extension protocol.PluginExtension) error
- func ValidateMCPServer(server protocol.PluginMcpServer) error
- func ValidateName(name string) bool
- func ValidatePublicSettings(schema protocol.PluginSettingsSchema, values map[string]json.RawMessage) error
- func ValidateRegistrySource(source protocol.PluginSkillsRegistrySource) error
- func ValidateSettings(data []byte, declarations ...map[string]protocol.PluginMcpServer) (protocol.PluginSettingsSchema, error)
- func ValidateStorage(declaration protocol.PluginStorageDeclaration) error
- func ValidateStorageIndex(index protocol.PluginStorageIndex) error
- type DefaultPackage
- type HTTPInput
- type Manager
- func (manager *Manager) CapturedInfo(ctx context.Context, reference protocol.PluginReference) (protocol.PluginInfo, error)
- func (manager *Manager) Catalog(ctx context.Context, source protocol.PluginCatalogSource, query string, ...) (protocol.PluginCatalogPage, error)
- func (manager *Manager) CatalogSource(ctx context.Context, source protocol.PluginCatalogSource, id string) (protocol.PluginSkillsSource, error)
- func (manager *Manager) CheckUpdate(ctx context.Context, current protocol.PluginInfo, worktreeRoot *string, ...) (protocol.PluginUpdatesReport, error)
- func (manager *Manager) Collect(retained map[string]struct{}) error
- func (manager *Manager) DiscoverRegistry(ctx context.Context, source protocol.PluginSkillsRegistrySource) (protocol.PluginSkillsRegistryDiscovery, error)
- func (manager *Manager) DiscoverRepositorySkills(ctx context.Context, source protocol.PluginSkillsSource) (protocol.PluginSkillsDiscovery, error)
- func (manager *Manager) DiscoverSkillImport(ctx context.Context, data []byte, stream protocol.StreamID, ...) (protocol.PluginSkillsImportDiscovery, error)
- func (manager *Manager) DiscoverSkillUpload(ctx context.Context, reader io.ReaderAt, size int64, stream protocol.StreamID, ...) (protocol.PluginSkillsImportDiscovery, error)
- func (manager *Manager) Inspect(ctx context.Context, directory, workingDirectory, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InspectArchive(ctx context.Context, reader io.ReaderAt, size int64, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InspectBundled(ctx context.Context, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InspectRepository(ctx context.Context, source protocol.PluginSkillsSource) (protocol.PluginCatalogSelection, error)
- func (manager *Manager) Install(ctx context.Context, directory, workingDirectory, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InstallArchive(ctx context.Context, reader io.ReaderAt, size int64, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InstallBundled(ctx context.Context, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InstallRegistry(ctx context.Context, source protocol.PluginSkillsRegistryResolved, name string) (protocol.PluginInfo, error)
- func (manager *Manager) InstallRepository(ctx context.Context, selection protocol.PluginCatalogSelection) (protocol.PluginInfo, error)
- func (manager *Manager) InstallRepositorySkill(ctx context.Context, source protocol.PluginSkillsResolved, ...) (protocol.PluginInfo, error)
- func (manager *Manager) InstallSkillImport(ctx context.Context, data []byte, format protocol.PluginSkillsArchiveFormat, ...) (protocol.PluginInfo, error)
- func (manager *Manager) InstallSkillUpload(ctx context.Context, reader io.ReaderAt, size int64, ...) (protocol.PluginInfo, error)
- func (manager *Manager) OfficialEntries(ctx context.Context, force bool) ([]protocol.PluginCatalogEntry, error)
- func (manager *Manager) PackageRoot(reference protocol.PluginReference) (string, error)
- func (manager *Manager) ReadBundle(ctx context.Context, reference protocol.PluginReference, entry string, ...) (map[string]string, error)
- func (manager *Manager) ReadDesktop(ctx context.Context, info protocol.PluginInfo, ...) (protocol.PluginDesktopBundle, error)
- func (manager *Manager) ReadResource(ctx context.Context, reference protocol.PluginReference, name string, ...) ([]byte, error)
- func (manager *Manager) ReadSkillDocument(ctx context.Context, source protocol.PluginSkillsDocumentSource) (protocol.PluginSkillsDocument, error)
- func (manager *Manager) RegistryDocument(ctx context.Context, source protocol.PluginSkillsRegistryResolved) (protocol.PluginSkillsDocument, error)
- func (manager *Manager) SkillCatalog(ctx context.Context, source protocol.PluginSkillcatalogSource, query string, ...) (protocol.PluginSkillcatalogPage, error)
- func (manager *Manager) SnapshotSkills(ctx context.Context, directory, workingDirectory string) ([]byte, protocol.PluginSkillsArchiveFormat, protocol.PluginUploadSource, error)
- type Manifest
- type MemoryTracker
- type RepositorySelection
- type ScriptBundle
- type ScriptDispatch
- type ScriptEnvironment
- type ScriptExecution
- type Translation
Constants ¶
const HTTPMaxBody = 1024 * 1024
const HTTPMaxTimeout = 60 * time.Second
const ManifestSchema = "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json"
const MaxCardPropsBytes = 16 * 1024
const MaxCardSchemaBytes = 32 * 1024
const MaxCards = 16
const MaxManifestBytes = 256 * 1024
const MaxPackageBytes = 128 * 1024 * 1024
const MaxPackageDepth = 32
const MaxPackageEntries = 1024
const MaxSettingsBytes = 64 * 1024
const MaxSkillDocumentBytes = 128 * 1024
const MaxSkills = 64
const MaxValueBytes = 256 * 1024
const OfficialCatalogURL = "https://sailry.dev/plugins/catalog.json"
const OfficialRepository = "https://github.com/sailry/sailry-plugins"
const ScriptCallTimeout = 60 * time.Second
const ScriptMaxBytes = 256 * 1024
const ScriptMaxDataBytes = 2 * 1024 * 1024
const ScriptMemoryBytes = 64 * 1024 * 1024
const SettingsSchema = "https://json-schema.org/draft/2020-12/schema"
const SkillRegistryURL = "https://api.skillhub.cn"
const ThirdPartyCatalogURL = "https://pluginsmp.com"
Variables ¶
This section is empty.
Functions ¶
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 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 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 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 ProjectStorageValue ¶
func ProjectStorageValue(collection *protocol.PluginStorageCollection, data json.RawMessage) (json.RawMessage, error)
func ProtectHTTPResponse ¶
func ProtectHTTPResponse(response *protocol.PluginHttpResponse, secrets []protocol.Secret) error
func ReadMCP ¶
func ReadMCP(data []byte) ([]protocol.PluginMcp, map[string]protocol.PluginMcpServer, []protocol.PluginIssue)
func RegistrySourceURL ¶
func RegistrySourceURL(input string) (*protocol.PluginSkillsRegistrySource, error)
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 SettingDefaults ¶
func SettingDefaults(schema *protocol.PluginSettingsSchema) map[string]json.RawMessage
func SkillImportDigest ¶
func StampCards ¶
func StampCards(result json.RawMessage, node protocol.NodeID, scope protocol.PluginContext, info protocol.PluginInfo, call protocol.RequestID) json.RawMessage
func StandaloneSkillName ¶
func StorageCollection ¶
func StorageCollection(info protocol.PluginInfo, scope protocol.PluginStorageScope, key string) *protocol.PluginStorageCollection
func ToolCallIdentity ¶
func ToolCommand ¶
func ToolOperation ¶
func ToolOperation(info protocol.PluginInfo, name string) *protocol.ToolOperation
func ToolOutput ¶
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 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
Types ¶
type DefaultPackage ¶
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 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 (*Manager) CapturedInfo ¶
func (manager *Manager) CapturedInfo(ctx context.Context, reference protocol.PluginReference) (protocol.PluginInfo, 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) Collect ¶
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) DiscoverRegistry ¶
func (manager *Manager) DiscoverRegistry(ctx context.Context, source protocol.PluginSkillsRegistrySource) (protocol.PluginSkillsRegistryDiscovery, error)
func (*Manager) DiscoverRepositorySkills ¶
func (manager *Manager) DiscoverRepositorySkills(ctx context.Context, source protocol.PluginSkillsSource) (protocol.PluginSkillsDiscovery, error)
func (*Manager) DiscoverSkillImport ¶
func (manager *Manager) DiscoverSkillImport(ctx context.Context, data []byte, stream protocol.StreamID, format protocol.PluginSkillsArchiveFormat, kind protocol.PluginUploadSource) (protocol.PluginSkillsImportDiscovery, error)
func (*Manager) DiscoverSkillUpload ¶
func (manager *Manager) DiscoverSkillUpload(ctx context.Context, reader io.ReaderAt, size int64, stream protocol.StreamID, format protocol.PluginSkillsArchiveFormat, kind protocol.PluginUploadSource) (protocol.PluginSkillsImportDiscovery, error)
func (*Manager) InspectArchive ¶
func (*Manager) InspectBundled ¶
func (*Manager) InspectRepository ¶
func (manager *Manager) InspectRepository(ctx context.Context, source protocol.PluginSkillsSource) (protocol.PluginCatalogSelection, error)
func (*Manager) InstallArchive ¶
func (*Manager) InstallBundled ¶
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) PackageRoot ¶
func (manager *Manager) PackageRoot(reference protocol.PluginReference) (string, error)
func (*Manager) ReadBundle ¶
func (*Manager) ReadDesktop ¶
func (manager *Manager) ReadDesktop(ctx context.Context, info protocol.PluginInfo, surface protocol.PluginDesktopSurface) (protocol.PluginDesktopBundle, error)
func (*Manager) ReadResource ¶
func (*Manager) ReadSkillDocument ¶
func (manager *Manager) ReadSkillDocument(ctx context.Context, source protocol.PluginSkillsDocumentSource) (protocol.PluginSkillsDocument, error)
func (*Manager) RegistryDocument ¶
func (manager *Manager) RegistryDocument(ctx context.Context, source protocol.PluginSkillsRegistryResolved) (protocol.PluginSkillsDocument, error)
func (*Manager) SkillCatalog ¶
func (*Manager) SnapshotSkills ¶
func (manager *Manager) SnapshotSkills(ctx context.Context, directory, workingDirectory string) ([]byte, protocol.PluginSkillsArchiveFormat, protocol.PluginUploadSource, error)
type Manifest ¶
type Manifest struct {
Name string
Version *string
Description *string
Homepage *string
Repository *string
License *string
Extension *protocol.PluginExtension
Issues []protocol.PluginIssue
}
func ValidateManifest ¶
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) 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() *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 ¶
func ParseRepositorySource ¶
func ParseRepositorySource(source protocol.PluginSkillsSource) (RepositorySelection, error)
type ScriptBundle ¶
type ScriptDispatch ¶
type ScriptEnvironment ¶
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()
Source Files
¶
- captured.go
- cards.go
- catalog.go
- catalog_skills.go
- desktop.go
- http.go
- manifest.go
- manifest_cards.go
- manifest_desktop.go
- manifest_status.go
- manifest_tools.go
- memory.go
- packages.go
- registry.go
- repository.go
- repository_local.go
- resources.go
- script.go
- script_errors.go
- script_revisions.go
- script_sdk.go
- script_translation.go
- settings.go
- skills.go
- skills_imports.go
- skills_repository.go
- stamp_cards.go
- storage.go
- storage_compiler.go
- tool_bridge.go
- tools.go
- updates.go