config

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: AGPL-3.0 Imports: 10 Imported by: 2 modules, 9 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 config defines plugin manifests, host configuration, and artifact provenance.

Index

Constants

View Source
const (
	// StateIsolationCapability identifies the SDK's per-profile state-root isolation contract.
	StateIsolationCapability = "state-root-v1"
	// StateIsolationSDKModule identifies the module whose revision the trusted builder attests.
	StateIsolationSDKModule = "github.com/omniviewdev/plugin-sdk"
)

Variables

This section is empty.

Functions

func WithGlobalConfig

func WithGlobalConfig(ctx context.Context, config *GlobalConfig) context.Context

WithGlobalConfig injects the IDE global configuration into context.

func WithPluginConfig

func WithPluginConfig(ctx context.Context, config *PluginConfig) context.Context

WithPluginConfig injects the IDE plugin configuration into context.

Types

type ConnectionExport added in v0.13.0

type ConnectionExport struct {
	Operations    []string `json:"operations" yaml:"operations"`
	ResourceTypes []string `json:"resource_types" yaml:"resource_types"`
}

ConnectionExport limits exported operations to explicit resource patterns.

type ConnectionGrant added in v0.13.0

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

ConnectionGrant is an immutable snapshot of an admitted consumer requirement.

func GrantConnections added in v0.13.0

func GrantConnections(consumer, owner PluginMeta) (ConnectionGrant, error)

GrantConnections requires full owner coverage and never returns a partial grant.

func (ConnectionGrant) Allows added in v0.13.0

func (g ConnectionGrant) Allows(operation, resourceType string) bool

Allows checks an operation and literal resource type against the admitted requirement.

type ConnectionRequirement added in v0.13.0

type ConnectionRequirement struct {
	Plugin        string   `json:"plugin" yaml:"plugin"`
	Operations    []string `json:"operations" yaml:"operations"`
	ResourceTypes []string `json:"resource_types" yaml:"resource_types"`
}

ConnectionRequirement names one owner and the complete access a consumer needs.

type ExportsSpec added in v0.13.0

type ExportsSpec struct {
	Connections *ConnectionExport `json:"connections,omitempty" yaml:"connections,omitempty"`
}

ExportsSpec declares services this plugin offers to installed consumers.

type GlobalConfig

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

GlobalConfig holds the global configuration for the IDE.

func GlobalConfigFromContext

func GlobalConfigFromContext(ctx context.Context) *GlobalConfig

GlobalConfigFromContext returns the global configuration from the context.

func NewGlobalConfig

func NewGlobalConfig(config map[string]any) *GlobalConfig

NewGlobalConfig creates a new global configuration.

func (*GlobalConfig) Get

func (c *GlobalConfig) Get(key string) any

Get returns the value for the given key on the config.

type PluginAuthor

type PluginAuthor struct {
	Name  string `json:"name"  yaml:"name"`
	Email string `json:"email" yaml:"email,omitempty"`
	URL   string `json:"url"   yaml:"url,omitempty"`
}

PluginAuthor identifies the original author and optional contact links.

type PluginComponentArea

type PluginComponentArea string

PluginComponentArea selects the host surface where a resource component appears.

const (
	// PluginComponentAreaEditor places a component in the resource editor.
	PluginComponentAreaEditor PluginComponentArea = "EDITOR"
	// PluginComponentAreaSidebar places a component in the resource sidebar.
	PluginComponentAreaSidebar PluginComponentArea = "SIDEBAR"
)

type PluginComponents

type PluginComponents struct {
	Resource []PluginResourceComponent `json:"resource" yaml:"resource"`
}

PluginComponents declares frontend components associated with resource views.

type PluginConfig

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

PluginConfig holds the plugin configuration for the IDE.

func NewEmptyPluginConfig

func NewEmptyPluginConfig() *PluginConfig

NewEmptyPluginConfig creates a new empty plugin configuration.

func NewPluginConfig

func NewPluginConfig(config map[string]string) *PluginConfig

NewPluginConfig creates a new plugin configuration.

func PluginConfigFromContext

func PluginConfigFromContext(ctx context.Context) *PluginConfig

PluginConfigFromContext returns the plugin configuration from the context.

func (*PluginConfig) Get

func (c *PluginConfig) Get(key string) string

Get returns the value for the given key on the config.

type PluginMaintainer

type PluginMaintainer struct {
	Name  string `json:"name"  yaml:"name"`
	Email string `json:"email" yaml:"email"`
}

PluginMaintainer identifies a contact responsible for maintaining the plugin.

type PluginMeta

type PluginMeta struct {
	ID                 string             `json:"id"                   yaml:"id"`
	Version            string             `json:"version"              yaml:"version"`
	Name               string             `json:"name"                 yaml:"name"`
	Icon               string             `json:"icon"                 yaml:"icon"`
	IconURL            string             `json:"icon_url"             yaml:"icon_url,omitempty"`
	Description        string             `json:"description"          yaml:"description"`
	Repository         string             `json:"repository"           yaml:"repository"`
	Website            string             `json:"website"              yaml:"website"`
	Category           string             `json:"category"             yaml:"category,omitempty"`
	License            string             `json:"license"              yaml:"license,omitempty"`
	Markdown           string             `json:"-"                    yaml:"-"`
	Author             *PluginAuthor      `json:"author,omitempty"     yaml:"author,omitempty"`
	Maintainers        []PluginMaintainer `json:"maintainers"          yaml:"maintainers"`
	Tags               []string           `json:"tags"                 yaml:"tags"`
	Dependencies       []string           `json:"dependencies"         yaml:"dependencies"`
	Capabilities       []string           `json:"capabilities"         yaml:"capabilities"`
	Theme              PluginTheme        `json:"theme"                yaml:"theme"`
	Components         PluginComponents   `json:"components"           yaml:"components"`
	SchemaVersion      int                `json:"schema_version"       yaml:"schema_version,omitempty"`
	SDKProtocolVersion int                `json:"sdk_protocol_version" yaml:"sdk_protocol_version,omitempty"`
	Exports            *ExportsSpec       `json:"exports,omitempty" yaml:"exports,omitempty"`
	Requires           *RequiresSpec      `json:"requires,omitempty" yaml:"requires,omitempty"`
	// StateIsolation is inspectable before launch; only a trusted builder's
	// attestation may authorize isolated startup, never self-asserted YAML.
	StateIsolation *StateIsolationProvenance `json:"state_isolation,omitempty" yaml:"state_isolation,omitempty"`
}

PluginMeta is the plugin description file located at the root of a plugin.

func (*PluginMeta) GenerateHandshakeConfig

func (m *PluginMeta) GenerateHandshakeConfig() plugin.HandshakeConfig

GenerateHandshakeConfig generates a handshake config for the plugin. The magic cookie value uses only the plugin ID (not version) so that version bumps don't force binary rebuilds just for the handshake. Version negotiation is handled by the PluginLifecycle.GetInfo() RPC.

func (*PluginMeta) HasBackendCapabilities

func (m *PluginMeta) HasBackendCapabilities() bool

HasBackendCapabilities checks if the plugin has any backend capabilities.

func (*PluginMeta) HasUICapabilities

func (m *PluginMeta) HasUICapabilities() bool

HasUICapabilities checks if the plugin has UI capabilities.

func (*PluginMeta) Load

func (m *PluginMeta) Load(reader io.Reader) error

Load decodes one YAML manifest from reader into m, retaining decoder handling of omitted fields.

func (*PluginMeta) LoadMarkdown

func (m *PluginMeta) LoadMarkdown(path string) error

LoadMarkdown loads a plugin Markdown file from a given path (if it exists) into the plugin config.

func (PluginMeta) Validate added in v0.13.0

func (m PluginMeta) Validate() error

Validate checks connection declarations only; absent declarations remain valid.

type PluginMetaFormat

type PluginMetaFormat int

PluginMetaFormat selects the serialized format of a plugin manifest.

const (
	// PluginMetaFormatYAML is the YAML format for a plugin config.
	PluginMetaFormatYAML PluginMetaFormat = iota
	// PluginMetaFormatJSON is the JSON format for a plugin config.
	PluginMetaFormatJSON
)

type PluginResourceComponent

type PluginResourceComponent struct {
	Name           string              `json:"name"      yaml:"name"`
	Plugin         string              `json:"plugin"    yaml:"plugin"`
	Area           PluginComponentArea `json:"area"      yaml:"area"`
	Resources      []string            `json:"resources" yaml:"resources"`
	ExtensionPoint string              `json:"extension" yaml:"extension"`
}

PluginResourceComponent binds a named frontend extension to resource types and a host surface.

type PluginTheme

type PluginTheme struct {
	Colors PluginThemeColors `json:"colors" yaml:"colors"`
}

PluginTheme supplies presentation defaults for the plugin's frontend.

type PluginThemeColors

type PluginThemeColors struct {
	Primary   string `json:"primary"   yaml:"primary"`
	Secondary string `json:"secondary" yaml:"secondary"`
	Tertiary  string `json:"tertiary"  yaml:"tertiary"`
}

PluginThemeColors defines the plugin's primary, secondary, and tertiary accent colors.

type RequiresSpec added in v0.13.0

type RequiresSpec struct {
	Connections []ConnectionRequirement `json:"connections" yaml:"connections"`
}

RequiresSpec declares services this plugin needs from installed owners.

type StateIsolationProvenance added in v0.6.0

type StateIsolationProvenance struct {
	SchemaVersion int    `json:"schema_version" yaml:"schema_version"`
	Capability    string `json:"capability"     yaml:"capability"`
	SDKModule     string `json:"sdk_module"     yaml:"sdk_module"`
	// SDKRevision identifies the selected SDK checkout commit observed by the builder.
	SDKRevision string `json:"sdk_revision"   yaml:"sdk_revision"`
	// SDKSourceSHA256 identifies the trusted builder's exact selected working-tree
	// snapshot, including live edits to that checkout.
	// Empty is reserved for immutable, clean, commit-only trusted builds.
	SDKSourceSHA256 string `json:"sdk_source_sha256,omitempty" yaml:"sdk_source_sha256,omitempty"`
	BinarySHA256    string `json:"binary_sha256"               yaml:"binary_sha256"`
}

StateIsolationProvenance is a trusted builder's attestation, not a declaration an arbitrary plugin may use to grant itself permission to start. It is checked without executing the artifact. Absence means unsupported, not legacy-safe. The host must establish the attestation's trusted origin separately. No lifecycle RPC/protocol change is required to inspect this metadata.

func BuildStateIsolationProvenance added in v0.6.0

func BuildStateIsolationProvenance(binaryPath, sdkRevision, sdkSourceSHA256 string) (*StateIsolationProvenance, error)

BuildStateIsolationProvenance is called only by a trusted build pipeline after validating the selected SDK module/source and observing its checkout commit. For editable sources the caller supplies the same stable source snapshot digest observed before and after building. Hashes do NOT prove SDK source inclusion.

func (*StateIsolationProvenance) VerifyArtifact added in v0.6.0

func (p *StateIsolationProvenance) VerifyArtifact(
	binaryPath, expectedSDKRevision, expectedSDKSourceSHA256 string,
) error

VerifyArtifact binds a trusted attestation to artifact bytes, the host's expected SDK checkout commit, and its expected source snapshot. An empty expected snapshot accepts only a commit-only attestation; source-bound attestations cannot downgrade. It never starts the plugin, authenticates a registry/source, proves source inclusion, or trusts plugin.yaml.

Jump to

Keyboard shortcuts

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