productplugin

package
v0.1.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 21 Imported by: 1 module, 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

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

View Source
const MaxFileBytes = 64 << 20
View Source
const MaxManifestBytes = 1 << 20
View Source
const MaxPackageBytes = 256 << 20
View Source
const Protocol = 1

Variables

This section is empty.

Functions

func ValidID

func ValidID(id string) bool

Types

type ExitError

type ExitError struct{ Code int }

func (*ExitError) Error

func (e *ExitError) Error() string

func (*ExitError) ExitCode

func (e *ExitError) ExitCode() int

func (*ExitError) Silent

func (e *ExitError) Silent() bool

type Installed

type Installed struct {
	Manifest        Manifest `json:"manifest"`
	ManifestSHA256  string   `json:"manifest_sha256"`
	NativeExecution bool     `json:"native_execution"`
}

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.

func Decode

func Decode(raw []byte) (Manifest, error)

func Verify

func Verify(dir string) (Manifest, string, error)

Verify accepts regular, declared files only and checks all bytes before any executable is started. Symlinks and special files are never payloads.

func (Manifest) FileNames

func (m Manifest) FileNames() []string

func (Manifest) Validate

func (m Manifest) Validate() error

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

func (s Store) Install(ctx context.Context, staged string, grant, replace bool) (Installed, error)

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) List

func (s Store) List() ([]Installed, error)

func (Store) Remove

func (s Store) Remove(ctx context.Context, id string) error

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.

func (Store) Resolve

func (s Store) Resolve(id string) (Installed, string, error)

Resolve rechecks payload hashes and the granted manifest binding on every invocation. Store files belong to the installing user, not to a checkout.

func (Store) Run

func (s Store) Run(ctx context.Context, id, command string, args []string, inv Invocation, streams Streams) error

Run forwards arguments without a shell and preserves streams and exit code.

type Streams

type Streams struct {
	In       io.Reader
	Out, Err io.Writer
}

Jump to

Keyboard shortcuts

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