Documentation
¶
Overview ¶
Package opencode is the client adapter for OpenCode.
Index ¶
- Constants
- func ActivateOpenCodeNativeWithKernel(ctx context.Context, request domain.ActivationRequest, ...) error
- func ApplyOpenCodeNative(configRoot, activePath string, ...) error
- func ApplyOpenCodeNativeWithOps(configRoot, activePath string, ...) (resultErr error)
- func ApplyOpenCodeNativeWithRename(configRoot, activePath string, ...) (resultErr error)
- func BuildOpenCodeNativeObjects(stagingRoot string, envelope domain.PackageEnvelope, plan domain.DeliveryPlan) ([]domain.NativeObjectOwnership, error)
- func DeactivateOpenCodeNativeWithKernel(ctx context.Context, request domain.DeactivationRequest, ...) error
- func DesiredOpenCodeCodec(host domain.OpenCodeHostAuthority) (nativeconfig.Codec, error)
- func InspectOpenCodeRegistry(plan domain.DeliveryPlan, managed *domain.ClientBinding, ...) (clients.RegistryFinding, error)
- func NeutralOpenCodeServer(server domain.MCPServer) (nativeconfig.Server, error)
- func OpenCodeObjects(objects []domain.NativeObjectOwnership) []domain.NativeObjectOwnership
- func ProjectOpenCodeNative(root string, envelope domain.PackageEnvelope, plan domain.DeliveryPlan, ...) error
- func VerifyOpenCodeNativeObjects(configRoot, activePath string, objects []domain.NativeObjectOwnership, ...) error
- type Adapter
- func (*Adapter) Activate(ctx context.Context, env clients.Env, request domain.ActivationRequest) (domain.ActivationOutcome, error)
- func (*Adapter) AutomaticallyActivates(_ clients.Env, request domain.ActivationRequest) bool
- func (*Adapter) Deactivate(ctx context.Context, env clients.Env, request domain.DeactivationRequest) (domain.DeactivationOutcome, error)
- func (*Adapter) DetectSurfaces(host clients.Host) clients.Detection
- func (*Adapter) ID() domain.ClientID
- func (*Adapter) InspectNativeRegistry(ctx context.Context, env clients.Env, _ domain.DetectedClient, ...) (clients.RegistryFinding, error)
- func (*Adapter) OwnedOpenCodeNativeRequirements(objects []domain.NativeObjectOwnership) (skills, config bool)
- func (*Adapter) Project(_ context.Context, in clients.ProjectionInput) ([]domain.NativeObjectOwnership, error)
- func (*Adapter) ProjectActiveNative(_ context.Context, root string, envelope domain.PackageEnvelope, ...) ([]domain.NativeObjectOwnership, error)
- func (*Adapter) RefinePlan(_ context.Context, in clients.PlanInput, plan *domain.DeliveryPlan) error
- func (*Adapter) UsesNativeRegistryExecutable() bool
- func (*Adapter) UsesOpenCodeHostProfile() bool
- func (*Adapter) VerifierAvailable(_ domain.DetectedClient, plan domain.DeliveryPlan, _ string) bool
- type NativeTransitions
- func (t NativeTransitions) HoldsActivation(installationID, bindingID string) (bool, error)
- func (t NativeTransitions) Pending() ([]PendingNativeTransition, error)
- func (t NativeTransitions) PersistPrepared(ctx context.Context, id domain.NativeAttemptIdentity, root string, ...) error
- func (t NativeTransitions) Reconcile(ctx context.Context, root string) (domain.NativeEffectState, error)
- func (t NativeTransitions) Recover(ctx context.Context) error
- type OpenCodeProjection
- type PendingNativeTransition
Constants ¶
const ( OpenCodeProjectionFile = ".agentplugins-opencode.json" OpenCodeMCPObjectKind = nativeconfig.OpenCodeMCPObjectKind OpenCodeV2MCPObjectKind = nativeconfig.OpenCodeV2MCPObjectKind )
Variables ¶
This section is empty.
Functions ¶
func ActivateOpenCodeNativeWithKernel ¶
func ActivateOpenCodeNativeWithKernel(ctx context.Context, request domain.ActivationRequest, kernel nativeconfig.Kernel) error
func ApplyOpenCodeNative ¶
func ApplyOpenCodeNative(configRoot, activePath string, previous, desired []domain.NativeObjectOwnership) error
func ApplyOpenCodeNativeWithRename ¶
func ApplyOpenCodeNativeWithRename(configRoot, activePath string, previous, desired []domain.NativeObjectOwnership, rename openCodeRenameFunc) (resultErr error)
func BuildOpenCodeNativeObjects ¶
func BuildOpenCodeNativeObjects(stagingRoot string, envelope domain.PackageEnvelope, plan domain.DeliveryPlan) ([]domain.NativeObjectOwnership, error)
func DeactivateOpenCodeNativeWithKernel ¶
func DeactivateOpenCodeNativeWithKernel(ctx context.Context, request domain.DeactivationRequest, kernel nativeconfig.Kernel) error
func DesiredOpenCodeCodec ¶
func DesiredOpenCodeCodec(host domain.OpenCodeHostAuthority) (nativeconfig.Codec, error)
DesiredOpenCodeCodec reads only the immutable prepared profile. Missing or unknown authority never selects a default dialect for desired effects.
func InspectOpenCodeRegistry ¶
func InspectOpenCodeRegistry(plan domain.DeliveryPlan, managed *domain.ClientBinding, kernel nativeconfig.Kernel) (clients.RegistryFinding, error)
func NeutralOpenCodeServer ¶
func NeutralOpenCodeServer(server domain.MCPServer) (nativeconfig.Server, error)
func OpenCodeObjects ¶
func OpenCodeObjects(objects []domain.NativeObjectOwnership) []domain.NativeObjectOwnership
func ProjectOpenCodeNative ¶
func ProjectOpenCodeNative(root string, envelope domain.PackageEnvelope, plan domain.DeliveryPlan, dataRoot string) error
func VerifyOpenCodeNativeObjects ¶
func VerifyOpenCodeNativeObjects(configRoot, activePath string, objects []domain.NativeObjectOwnership, kernel nativeconfig.Kernel, allowMissing bool) error
Types ¶
type Adapter ¶
type Adapter struct{}
Adapter implements the client contract for OpenCode.
func New ¶
func New() *Adapter
New builds the adapter. The composition root registers it in clients/all.
func (*Adapter) Activate ¶
func (*Adapter) Activate(ctx context.Context, env clients.Env, request domain.ActivationRequest) (domain.ActivationOutcome, error)
Activate installs or verifies managed OpenCode skills and MCP servers through the native config kernel.
func (*Adapter) AutomaticallyActivates ¶
AutomaticallyActivates reports that Activate will write managed OpenCode native objects for this exact request.
func (*Adapter) Deactivate ¶
func (*Adapter) Deactivate(ctx context.Context, env clients.Env, request domain.DeactivationRequest) (domain.DeactivationOutcome, error)
Deactivate removes managed OpenCode native objects.
func (*Adapter) DetectSurfaces ¶
DetectSurfaces probes the OpenCode CLI, its XDG configuration directory and the desktop application.
func (*Adapter) InspectNativeRegistry ¶
func (*Adapter) InspectNativeRegistry(ctx context.Context, env clients.Env, _ domain.DetectedClient, plan domain.DeliveryPlan, managed *domain.ClientBinding) (clients.RegistryFinding, error)
func (*Adapter) OwnedOpenCodeNativeRequirements ¶
func (*Adapter) OwnedOpenCodeNativeRequirements(objects []domain.NativeObjectOwnership) (skills, config bool)
Prior MCP receipts also require the config codec when the desired set is empty. Directory skill removal does not use that codec.
func (*Adapter) Project ¶
func (*Adapter) Project(_ context.Context, in clients.ProjectionInput) ([]domain.NativeObjectOwnership, error)
Project writes OpenCode's native projection and records the objects it owns.
func (*Adapter) ProjectActiveNative ¶
func (*Adapter) ProjectActiveNative(_ context.Context, root string, envelope domain.PackageEnvelope, plan domain.DeliveryPlan, _ string) ([]domain.NativeObjectOwnership, error)
func (*Adapter) RefinePlan ¶
func (*Adapter) UsesNativeRegistryExecutable ¶
func (*Adapter) UsesOpenCodeHostProfile ¶
UsesOpenCodeHostProfile opts native mutations into explicit runtime authority.
func (*Adapter) VerifierAvailable ¶
func (*Adapter) VerifierAvailable(_ domain.DetectedClient, plan domain.DeliveryPlan, _ string) bool
VerifierAvailable reports that an exact native configuration listing can be observed. It does not need a client executable.
type NativeTransitions ¶
type NativeTransitions struct {
PackageVerifier interface {
Verify(context.Context, string, string) error
}
State ports.NativeTransitionState
Kernel nativeconfig.Kernel
}
NativeTransitions consumes only stored roots and receipt/state authority. It never resolves a host and never acquires the outer operation lock itself.
func (NativeTransitions) HoldsActivation ¶
func (t NativeTransitions) HoldsActivation(installationID, bindingID string) (bool, error)
func (NativeTransitions) Pending ¶
func (t NativeTransitions) Pending() ([]PendingNativeTransition, error)
func (NativeTransitions) PersistPrepared ¶
func (t NativeTransitions) PersistPrepared(ctx context.Context, id domain.NativeAttemptIdentity, root string, d domain.OpenCodeTransitionPrepared, previous, desired []domain.NativeObjectOwnership) error
func (NativeTransitions) Reconcile ¶
func (t NativeTransitions) Reconcile(ctx context.Context, root string) (domain.NativeEffectState, error)
type OpenCodeProjection ¶
type OpenCodeProjection struct {
ResolvedCWD map[string]bool `json:"resolved_cwd,omitempty"`
Dialect opencodehost.Dialect `json:"dialect,omitempty"`
Version int `json:"version"`
ConfigPath string `json:"config_path"`
ConfigJSON string `json:"config_json"`
ConfigJSONC string `json:"config_jsonc"`
PackageRoot string `json:"package_root"`
DataRoot string `json:"data_root,omitempty"`
MCPServers map[string]nativeconfig.Server `json:"mcp_servers,omitempty"`
}
func ReadOpenCodeProjection ¶
func ReadOpenCodeProjection(root string) (OpenCodeProjection, error)