ports

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ports defines interfaces for infrastructure dependencies. CapabilityInfo contains metadata about a capability request. This is placed in ports to avoid circular imports between services and ports.

Package ports defines interfaces for infrastructure dependencies. These are the "ports" in hexagonal architecture - abstractions that the application layer depends on but doesn't implement.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapabilityAnalyzer

type CapabilityAnalyzer interface {
	ExtractCapabilities(profile entities.ProfileReader) map[string][]capabilities.Capability
}

CapabilityAnalyzer extracts specific capability requirements from profiles. This allows the orchestrator to be tested with mock analyzers.

type CapabilityCollector

type CapabilityCollector interface {
	CollectRequiredCapabilities(ctx context.Context, profile entities.ProfileReader, runtime PluginRuntime, pluginDir string) (map[string][]capabilities.Capability, error)
}

CapabilityCollector collects required capabilities from plugins.

type CapabilityGatekeeperPort

type CapabilityGatekeeperPort interface {
	GrantCapabilities(
		required capabilities.Grant,
		capabilityInfo map[string]CapabilityInfo,
		trustAll bool,
	) (capabilities.Grant, error)
}

CapabilityGatekeeperPort grants capabilities based on security policy. Named with "Port" suffix to avoid collision with the concrete CapabilityGatekeeper type.

type CapabilityGranter

type CapabilityGranter interface {
	GrantCapabilities(ctx context.Context, required map[string][]capabilities.Capability, trustAll bool) (map[string][]capabilities.Capability, error)
}

CapabilityGranter grants capabilities (interactively or automatically).

type CapabilityInfo

type CapabilityInfo struct {
	Capability      capabilities.Capability
	IsProfileBased  bool                     // True if extracted from profile config
	PluginName      string                   // Which plugin requested this
	IsBroad         bool                     // True if pattern is overly permissive
	ProfileSpecific *capabilities.Capability // Profile-specific alternative if available
}

CapabilityInfo contains metadata about a capability request.

type Closer

type Closer interface {
	io.Closer
}

Closer is a common interface for resources that need cleanup.

type EngineFactory

type EngineFactory interface {
	CreateEngine(ctx context.Context, profile entities.ProfileReader, grantedCaps map[string][]capabilities.Capability, pluginDir string, filters dto.FilterOptions, execution dto.ExecutionOptions, skipSchemaValidation bool) (ExecutionEngine, error)
}

EngineFactory creates execution engines with capabilities.

type ExecutionEngine

type ExecutionEngine interface {
	Execute(ctx context.Context, profile entities.ProfileReader) (*execution.ExecutionResult, error)
	Close(ctx context.Context) error
}

ExecutionEngine executes profiles and returns results.

type OutputFormatter

type OutputFormatter interface {
	Format(result *execution.ExecutionResult) error
}

OutputFormatter formats execution results.

type OutputWriter

type OutputWriter interface {
	Write(ctx context.Context, data []byte, dest string) error
}

OutputWriter writes formatted output to destination.

type Plugin

type Plugin interface {
	// Describe returns plugin metadata including declared capabilities.
	Describe(ctx context.Context) (*PluginInfo, error)
}

Plugin represents a loaded WASM plugin that can be inspected and executed. This interface abstracts the concrete wasm.Plugin implementation.

type PluginDirectoryResolver

type PluginDirectoryResolver interface {
	ResolvePluginDir(ctx context.Context) (string, error)
}

PluginDirectoryResolver resolves the plugin directory path.

type PluginInfo

type PluginInfo struct {
	Name         string
	Version      string
	Description  string
	Capabilities []capabilities.Capability
}

PluginInfo contains metadata about a plugin. This is the application-layer representation of plugin metadata.

type PluginRuntime

type PluginRuntime interface {
	// LoadPlugin compiles and caches a plugin from WASM bytes.
	LoadPlugin(ctx context.Context, name string, wasmBytes []byte) (Plugin, error)

	// Close releases runtime resources.
	Close(ctx context.Context) error
}

PluginRuntime abstracts the WASM runtime for plugin loading and management. This interface allows the application layer to work with plugins without depending on concrete infrastructure types like wasm.Runtime.

type PluginRuntimeFactory

type PluginRuntimeFactory interface {
	// NewRuntime creates a new plugin runtime for capability collection.
	NewRuntime(ctx context.Context) (PluginRuntime, error)

	// NewRuntimeWithCapabilities creates a runtime with granted capabilities.
	NewRuntimeWithCapabilities(
		ctx context.Context,
		caps map[string][]capabilities.Capability,
		memoryLimitMB int,
	) (PluginRuntime, error)
}

PluginRuntimeFactory creates runtime instances. This allows the application layer to create runtimes without importing infrastructure.

type ProfileLoader

type ProfileLoader interface {
	LoadProfile(path string) (*entities.Profile, error)
}

ProfileLoader loads profiles from storage.

type ProfileValidator

type ProfileValidator interface {
	Validate(profile *entities.Profile) error
	ValidateWithSchemas(ctx context.Context, profile *entities.Profile, runtime PluginRuntime) error
}

ProfileValidator validates profile structure and schemas.

type SystemConfigProvider

type SystemConfigProvider interface {
	LoadConfig(ctx context.Context, path string) (*system.Config, error)
}

SystemConfigProvider loads system configuration.

Jump to

Keyboard shortcuts

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