Documentation
¶
Overview ¶
Package productplugin defines the portable executable product protocol. It has no dependency on FACET's registry or any product implementation.
@facet: delivery/distribution/product-runtime @facet-role: primary
@facet: delivery/distribution/product-runtime @facet-role: primary
@facet: delivery/distribution/product-runtime @facet-role: primary
Index ¶
- Constants
- func ValidID(id string) bool
- type ExitError
- type Installed
- type Invocation
- type Manifest
- type Request
- type Response
- type ServiceLimits
- type Store
- func (s Store) Call(ctx context.Context, id, service string, payload json.RawMessage, ...) (json.RawMessage, error)
- func (s Store) CallWithLimits(ctx context.Context, id, service string, payload json.RawMessage, ...) (json.RawMessage, error)
- func (s Store) Install(ctx context.Context, staged string, grant, replace bool) (Installed, error)
- func (s Store) List() ([]Installed, error)
- func (s Store) Remove(ctx context.Context, id string) error
- func (s Store) Resolve(id string) (Installed, string, error)
- func (s Store) Run(ctx context.Context, id, command string, args []string, inv Invocation, ...) error
- type Streams
Constants ¶
const MaxFileBytes = 64 << 20
const MaxManifestBytes = 1 << 20
const MaxPackageBytes = 256 << 20
const Protocol = 1
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Invocation ¶
type Invocation struct {
Root string `json:"root"`
SourceView string `json:"source_view,omitempty"`
HostExecutable string `json:"host_executable"`
HostCommands []string `json:"host_commands,omitempty"`
}
Invocation is supplied by the host, never read from package-controlled env. A product can call HostExecutable for Core data using the same selection.
type Manifest ¶
type Manifest struct {
Kind string `json:"kind"`
ID string `json:"id"`
Version string `json:"version"`
Protocol int `json:"protocol"`
Platform string `json:"platform"`
Executable string `json:"executable"`
Commands []string `json:"commands"`
Services []string `json:"services,omitempty"`
Requires []string `json:"requires,omitempty"`
Env []string `json:"env,omitempty"`
Files map[string]string `json:"files"`
}
Manifest is plugin.json for kind=product. Core compatibility is determined by protocol, independently of the product's release version. Files binds every payload to a digest; the installer separately binds the manifest itself. Native execution grants ordinary user-level OS access, not a sandbox.
type Request ¶
type Request struct {
Protocol int `json:"protocol"`
Payload json.RawMessage `json:"payload"`
}
type Response ¶
type Response struct {
Protocol int `json:"protocol"`
Result json.RawMessage `json:"result,omitempty"`
Error string `json:"error,omitempty"`
}
type ServiceLimits ¶
type ServiceLimits struct{ RequestBytes, ResponseBytes int }
ServiceLimits bounds the bytes a service call may send and receive.
type Store ¶
type Store struct{ Dir string }
func DefaultStore ¶
func DefaultStore() Store
DefaultStore is shared by every host command (CLI and MCP) so installation has one scope.
func (Store) Call ¶
func (s Store) Call(ctx context.Context, id, service string, payload json.RawMessage, inv Invocation) (json.RawMessage, error)
Call uses one process per service call, bounded input/output and a host-owned deadline. Plugin errors are explicit; an absent response is never success.
func (Store) CallWithLimits ¶
func (s Store) CallWithLimits(ctx context.Context, id, service string, payload json.RawMessage, inv Invocation, limits ServiceLimits) (json.RawMessage, error)
CallWithLimits lets trusted host adapters accommodate existing bounded data contracts. Packages cannot raise these limits; the hard cap is 64 MiB.
func (Store) Install ¶
Install copies a verified staged package to an immutable generation, then atomically selects it. Every install requires an explicit native-code grant. The caller stages downloads through the existing Core package loader.
func (Store) Remove ¶
Remove revokes discovery and removes installed generations without touching repository data. A running executable may prevent file removal on Windows; the error is reported and removal can be retried after the process exits.