opencodehost

package
v0.1.1-0...-58c1890 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package opencodehost is the closed, pure OpenCode qualification contract. It performs no discovery, process execution or filesystem mutation.

Index

Constants

View Source
const (
	Unknown               Family     = "unknown"
	LegacyV1              Family     = "legacy_v1"
	ModernV1              Family     = "modern_v1"
	V2                    Family     = "v2"
	Unsupported           Family     = "unsupported"
	DialectUnknown        Dialect    = "unknown"
	DialectV1             Dialect    = "opencode_v1"
	DialectV2             Dialect    = "opencode_v2"
	Supported             Support    = "supported"
	Unverified            Support    = "unverified"
	SupportUnsupported    Support    = "unsupported"
	LocalPluginDual       Capability = "local_plugin_dual"
	GlobalSkillDirectory  Capability = "global_skill_directory"
	MCPStdio              Capability = "mcp_stdio"
	MCPStreamableHTTP     Capability = "mcp_streamable_http"
	ObserverCompletion    Capability = "observer_completion"
	ObserverQuestion      Capability = "observer_question"
	ObserverPermission    Capability = "observer_permission"
	ObserverTerminalError Capability = "observer_terminal_error"
	DualPlacement         AdapterID  = "dual_placement"
	SkillDirectory        AdapterID  = "skill_directory"
	ConfigV1              AdapterID  = "config_v1"
	ConfigV2              AdapterID  = "config_v2"
	ObserverV1            AdapterID  = "observer_v1"
	ObserverV2            AdapterID  = "observer_v2"
)

Variables

View Source
var (
	ErrInvalidRequirement    = errors.New("invalid_requirement")
	ErrUnverifiedCapability  = errors.New("unverified_capability")
	ErrUnsupportedCapability = errors.New("unsupported_capability")
	ErrNoAdapter             = errors.New("no_adapter")
)
View Source
var ErrNativeTransportUnsupported = errors.New("host_transport_unsupported")

NativePrepared is immutable, private operational evidence. Accessors return copies. The domain carries only its validation port, keeping it free of adapter and parent-module imports. No fields enter public JSON.

Functions

func ValidVersion

func ValidVersion(v string) bool

ValidVersion accepts complete SemVer, including its numeric prerelease rule.

Types

type AdapterID

type AdapterID string

type ArtifactRequirement

type ArtifactRequirement struct {
	ID       string
	Adapter  AdapterID
	Required []Capability
}

type Capability

type Capability string

type Dialect

type Dialect string

type Family

type Family string

type NativeObserverDescriptor

type NativeObserverDescriptor struct {
	Tuple        NativeObserverTuple
	NativeStatus string
	Capabilities [4]Capability
}

NativeObserverDescriptor is a detached value snapshot. NativeStatus describes host source evidence; it does not qualify an installed product or its clock.

func NativeObserverEvidence

func NativeObserverEvidence(version string) (NativeObserverDescriptor, bool)

NativeObserverEvidence returns only the three exact Linux amd64 native serve descriptors. Lookup alone grants nothing; there is no version inheritance.

func NativeObserverEvidenceForEntry

func NativeObserverEvidenceForEntry(version, goos, goarch, imageSHA256, entry string) (NativeObserverDescriptor, bool)

NativeObserverEvidenceForEntry selects one exact independently qualified entry. Recognizing another entry never inherits the serve descriptor or its evidence.

func NativeObserverEvidenceForImage

func NativeObserverEvidenceForImage(version, goos, goarch, imageSHA256 string) (NativeObserverDescriptor, bool)

NativeObserverEvidenceForImage recognizes only literal exact image cells. A native_source_pending descriptor records byte identity, not qualification; neither lookup nor its informational capability names grant runtime authority. No platform, image or version is inferred when an input is missing.

type NativeObserverTuple

type NativeObserverTuple struct {
	Version, ImageSHA256, GOOS, GOARCH, Entry string
	ReaderContract, ProvenanceBasis           string
	Adapter                                   AdapterID
	UpstreamCommit, NativeAdapterSHA256       string
	EvidenceID                                string
	// Amendment, live-image proof, official artifact manifest, current discriminators.
	EvidenceHashes [4]string
}

NativeObserverTuple describes fixed source eligibility, never a live image attestation. Only trusted runtime composition may supply it to the binder.

type NativePrepared

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

func NewNativePrepared

func NewNativePrepared(executable, root string, environment []string, evidence VersionEvidence, profile Profile, selections []Selection) *NativePrepared

func (*NativePrepared) ConfigDialect

func (h *NativePrepared) ConfigDialect() string

ConfigDialect exposes only the immutable prepared config selection.

func (*NativePrepared) Evidence

func (h *NativePrepared) Evidence() VersionEvidence

func (*NativePrepared) Profile

func (h *NativePrepared) Profile() Profile

func (*NativePrepared) Root

func (h *NativePrepared) Root() string

func (*NativePrepared) Selections

func (h *NativePrepared) Selections() []Selection

func (*NativePrepared) Target

func (h *NativePrepared) Target() (string, []string)

func (*NativePrepared) ValidateNative

func (h *NativePrepared) ValidateNative(skills bool, transports []string) error

type Profile

type Profile struct {
	Schema        int
	Family        Family
	Version       string
	ConfigDialect Dialect
	PluginEntry   string
	Qualification string
	EvidenceID    string
	Capabilities  map[Capability]Support
	Reason        string
	// contains filtered or unexported fields
}

func BindNativeObserver

func BindNativeObserver(e VersionEvidence, actual NativeObserverTuple) Profile

BindNativeObserver is a TRUSTED-CALLER boundary, not an authentication API. The AN Go helper must derive e from OS-verified live identity plus the shared target probe and independently validate the actual reader/adapter. Never call with config, event/IPC assertions, PATH or an install-time cached target. This pure comparison cannot verify that the claimed image is executing. Retain the result only within that verified runtime/reader lifetime; changes revoke it.

func Resolve

func Resolve(e VersionEvidence) Profile

Resolve grants only the per-capability facts frozen in lane-a-freeze.md. Explicit declarations do not bind a runtime and cannot grant eligibility.

func (Profile) Clone

func (p Profile) Clone() Profile

Clone returns a separately owned snapshot, including the capability map.

type Selection

type Selection struct {
	ArtifactID          string
	Adapter             AdapterID
	Missing, Unverified []Capability
}

func Select

func Select(p Profile, requirements []ArtifactRequirement) (Selection, error)

Select validates every candidate before choosing. Failure returns diagnostics only: ArtifactID and Adapter are empty, so it cannot be used as a codec choice.

func SelectNative

func SelectNative(profile Profile, skills bool, transports []string) ([]Selection, error)

SelectNative selects skills and MCP independently of observers. The selected config candidate binds the native projection to the prepared profile.

func (Selection) Clone

func (s Selection) Clone() Selection

type Support

type Support string

type VersionEvidence

type VersionEvidence struct {
	Version            string
	Source             string
	ProbeStatus        string
	ExecutableIdentity string `json:"-"`
}

Jump to

Keyboard shortcuts

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