Documentation
¶
Index ¶
- Constants
- Variables
- type AddInput
- type AddResult
- type BindingChangeInput
- type BindingChangeMode
- type BindingChangePlan
- type BindingChangeResult
- type ClientPreparation
- type FormatSummary
- type GroupInput
- type GroupPhase
- type GroupProgressEvent
- type GroupProgressPhase
- type GroupResult
- type GroupTargetError
- type GroupTargetFailure
- type GroupTargetPhase
- type InterruptedAttemptInput
- type InterruptedAttemptResult
- type LegacyRemoveInput
- type LegacyRemoveResult
- type MCPNamespacePreflight
- type NativeIdentityObservation
- type NativeIdentityObserver
- type NativeIdentityState
- type NativeIntentReconciler
- type PluginDataManager
- type PreparedIdentityObserver
- type ProvenanceSummary
- type RemoveGroupInput
- type RemoveGroupResult
- type RemoveInput
- type RemoveResult
- type Service
- func (service Service) Add(ctx context.Context, input AddInput) (AddResult, error)
- func (service Service) AddGroup(ctx context.Context, input GroupInput) (GroupResult, error)
- func (service Service) ConfirmInterruptedNativeAttempt(ctx context.Context, input InterruptedAttemptInput) (InterruptedAttemptResult, error)
- func (service Service) ConfirmsInterruptedAttempt(id domain.ClientID, scope domain.InstallScope) bool
- func (service Service) InspectOwnedBinding(ctx context.Context, input AddInput, plan domain.DeliveryPlan, ...) (bool, error)
- func (service Service) InspectOwnedMaterialization(ctx context.Context, input AddInput, plan domain.DeliveryPlan, ...) (bool, error)
- func (service Service) InspectOwnedProjection(ctx context.Context, input AddInput, plan domain.DeliveryPlan, ...) (bool, error)
- func (service Service) MigrateFormat(ctx context.Context, input BindingChangeInput) (BindingChangeResult, error)
- func (service Service) PurgeRetainedData(ctx context.Context, selector string, confirmed bool) error
- func (service Service) Rebind(ctx context.Context, input BindingChangeInput) (BindingChangeResult, error)
- func (service Service) RecoverNativeIntent(ctx context.Context, installationID, bindingID, attemptID string, ...) error
- func (service Service) RefreshProjection(ctx context.Context, input AddInput) (AddResult, error)
- func (service Service) Remove(ctx context.Context, input RemoveInput) (RemoveResult, error)
- func (service Service) RemoveGroup(ctx context.Context, input RemoveGroupInput) (RemoveGroupResult, error)
- func (service Service) RemoveLegacy(ctx context.Context, input LegacyRemoveInput) (LegacyRemoveResult, error)
- func (service Service) Repair(ctx context.Context, input AddInput) (AddResult, error)
- func (service Service) RepairGroup(ctx context.Context, input GroupInput) (GroupResult, error)
- func (service Service) SwitchGroup(ctx context.Context, input GroupInput) (GroupResult, error)
- func (service Service) SwitchRetained(ctx context.Context, input BindingChangeInput, origin domain.OriginMode, ...) (BindingChangeResult, error)
- func (service Service) Update(ctx context.Context, input AddInput) (AddResult, error)
- func (service Service) UpdateGroup(ctx context.Context, input GroupInput) (GroupResult, error)
- type TargetChange
Constants ¶
const ( NativeIdentityAbsent = domain.NativeIdentityAbsent NativeIdentityManaged = domain.NativeIdentityManaged NativeIdentityUnmanaged = domain.NativeIdentityUnmanaged NativeIdentityIndeterminate = domain.NativeIdentityIndeterminate )
const OpenCodeNamespaceCheckedCode = "opencode_global_namespace_checked"
Variables ¶
var ErrProjectionPinChangeRequired = domain.ErrProjectionPinChangeRequired
ErrProjectionPinChangeRequired is what a saved dependency gets instead of ErrProjectionRefreshRequired: an update cannot refresh it, so the new rules wait for its next pin change.
var ErrProjectionRefreshRequired = domain.ErrProjectionRefreshRequired
ErrProjectionRefreshRequired means an intact package with installer-rendered components would be staged differently today than the recorded projection. Repair, a repeated add and a resumed activation keep the installed tree; only update applies the current rules. It is domain.ErrProjectionRefreshRequired, which the stager also returns.
Functions ¶
This section is empty.
Types ¶
type AddInput ¶
type AddInput struct {
ConfirmPluginEnable bool `json:"-"`
InstallIntent domain.InstallIntent
Envelope domain.PackageEnvelope
Client domain.DetectedClient
Scope domain.InstallScope
// OnlinePreview permits host probing during a read-only normal-operation preview.
// It grants no mutation or confirmation permission.
OnlinePreview bool
DryRun bool
Confirmed bool
Interactive bool
Hints domain.CompatibilityHints
InstallationID string
OperationID string
BackendExecutable string
ActivationComplete bool
AuthComplete bool
// CompatibilityBindingID freezes the observed unselected binding across
// the facade preflight and usecase mutation lock. Selected inputs leave it empty.
CompatibilityBindingID string `json:"-"`
// EnvironmentAuthority is mandatory for managed update/remove/repair and is
// copied into the durable receipt before the first managed effect.
EnvironmentAuthority *domain.EnvironmentAuthority
// OriginMode and DirectoryResolution are supplied by the resolver. Omitting
// OriginMode is treated as an explicit direct source for compatibility with
// exact/local callers; Directory authority is never inferred from a name.
OriginMode domain.OriginMode
DirectoryResolution *domain.DirectoryOrigin
DistributionSuspended bool
ReleaseRevoked bool
// ProjectTrustConsent is set only by an explicit user add and is passed to
// every activation of that operation, including finishing prepared setup.
ProjectTrustConsent bool
// PersistAuthoritativeObservations allows a read-only client verifier to
// record negative evidence even during a plan-first CLI pass. It does not
// authorize package, client, or user-requested lifecycle mutations.
PersistAuthoritativeObservations bool
// contains filtered or unexported fields
}
type AddResult ¶
type AddResult struct {
InstallationID string `json:"installation_id"`
Plan domain.DeliveryPlan `json:"plan"`
Activation domain.ActivationOutcome `json:"activation,omitempty"`
RequiresConfirmation bool `json:"requires_confirmation"`
Mutated bool `json:"mutated"`
NoChange bool `json:"no_change,omitempty"`
Receipt domain.MutationReceipt `json:"-"`
GroupPhase GroupTargetPhase `json:"group_phase,omitempty"`
Failure *GroupTargetFailure `json:"failure,omitempty"`
}
type BindingChangeInput ¶
type BindingChangeInput struct {
Selector string
Envelope domain.PackageEnvelope
Confirmed bool
}
type BindingChangeMode ¶
type BindingChangeMode string
const ( BindingChangeRebind BindingChangeMode = "rebind" BindingChangeMigrateFormat BindingChangeMode = "migrate_format" BindingChangeSwitch BindingChangeMode = "switch" )
type BindingChangePlan ¶
type BindingChangePlan struct {
Mode BindingChangeMode `json:"mode"`
InstallationID string `json:"installation_id"`
OldName string `json:"old_name"`
NewName string `json:"new_name"`
OldSource ProvenanceSummary `json:"old_source"`
NewSource ProvenanceSummary `json:"new_source"`
OldFormat FormatSummary `json:"old_format"`
NewFormat FormatSummary `json:"new_format"`
OldComponents domain.ComponentInventory `json:"old_components"`
NewComponents domain.ComponentInventory `json:"new_components"`
Targets []TargetChange `json:"targets,omitempty"`
NativeObjectCount int `json:"native_object_count"`
PluginDataDecision string `json:"plugin_data_decision"`
CanApply bool `json:"can_apply"`
Blockers []string `json:"blockers,omitempty"`
}
type BindingChangeResult ¶
type BindingChangeResult struct {
Plan BindingChangePlan `json:"plan"`
PluginData domain.PluginDataDecision `json:"plugin_data"`
RequiresConfirmation bool `json:"requires_confirmation"`
Mutated bool `json:"mutated"`
NoChange bool `json:"no_change,omitempty"`
}
type ClientPreparation ¶
type ClientPreparation interface {
PrepareClient(context.Context, domain.PackageEnvelope, domain.DetectedClient, []domain.NativeObjectOwnership, string, bool) (domain.OpenCodeHostAuthority, error)
RevalidateClient(context.Context, domain.DetectedClient, domain.DeliveryPlan) error
}
ClientPreparation freezes explicit host authority before a desired native plan. Process-inert planning must never launch a host executable.
type FormatSummary ¶
type GroupInput ¶
type GroupPhase ¶
type GroupPhase string
const ( GroupPhasePlanned GroupPhase = "planned" GroupPhasePreparationFailed GroupPhase = "preparation_failed" GroupPhaseManagedUnchanged GroupPhase = "managed_unchanged" GroupPhaseManagedRolledBack GroupPhase = "managed_rolled_back" GroupPhaseManagedCommitUnknown GroupPhase = "managed_commit_unknown" GroupPhaseManagedCommitted GroupPhase = "managed_committed" GroupPhaseManagedActivationFailed GroupPhase = "managed_committed_activation_failed" GroupPhaseExternalPartialFailure GroupPhase = "external_partial_failure" GroupPhaseCompleted GroupPhase = "completed" )
type GroupProgressEvent ¶
type GroupProgressEvent struct {
ClientID domain.ClientID
Phase GroupProgressPhase
Result AddResult
}
GroupProgressEvent reports observed checkpoints; it never grants consent or changes the outcome of an installation.
type GroupProgressPhase ¶
type GroupProgressPhase string
const ( GroupProgressPreparing GroupProgressPhase = "preparing" GroupProgressConfiguring GroupProgressPhase = "configuring" GroupProgressConfigured GroupProgressPhase = "configured" GroupProgressActivating GroupProgressPhase = "activating" GroupProgressActivated GroupProgressPhase = "activated" )
type GroupResult ¶
type GroupResult struct {
// PreparedClients carries immutable host snapshots to this operation's apply.
PreparedClients []domain.DetectedClient `json:"-"`
InstallationID string `json:"installation_id"`
OperationGroupID string `json:"operation_group_id,omitempty"`
Targets []AddResult `json:"targets"`
PluginData domain.PluginDataDecision `json:"plugin_data"`
Receipts []domain.MutationReceipt `json:"-"`
Mutated bool `json:"mutated"`
Phase GroupPhase `json:"phase"`
}
type GroupTargetError ¶
GroupTargetError attributes a failed group to the selected clients whose own preflight or package preparation failed. It is returned only before any managed state or client changed, only by the steps that plan, check and stage that target, and only while the group-wide profile and recovery checks still pass. Cross-target, input, state and lifecycle refusals are never attributed. Its text is the cause's text, unchanged.
A caller may run the remaining clients as a new group. Running them is the same as selecting only them: the group plans, checks and stages again under its own lock and commits as one transaction.
func (*GroupTargetError) Error ¶
func (err *GroupTargetError) Error() string
func (*GroupTargetError) Unwrap ¶
func (err *GroupTargetError) Unwrap() error
type GroupTargetFailure ¶
GroupTargetFailure records why one logical surface failed or was skipped during external activation. Retry commands belong in CLI presentation.
type GroupTargetPhase ¶
type GroupTargetPhase string
const ( GroupTargetPlanned GroupTargetPhase = "planned" GroupTargetManagedRolledBack GroupTargetPhase = "managed_rolled_back" GroupTargetManagedCommitted GroupTargetPhase = "managed_committed" GroupTargetManagedUnknown GroupTargetPhase = "managed_commit_unknown" GroupTargetExternalCompleted GroupTargetPhase = "external_completed" GroupTargetExternalFailed GroupTargetPhase = "external_failed" GroupTargetExternalPartial GroupTargetPhase = "external_completed_managed_incomplete" GroupTargetExternalNotAttempted GroupTargetPhase = "external_not_attempted" )
type InterruptedAttemptInput ¶
type InterruptedAttemptInput struct {
InstallationID string
Client domain.DetectedClient
Scope domain.InstallScope
BackendExecutable string
EnvironmentAuthority *domain.EnvironmentAuthority
DryRun bool
Confirmed bool
}
InterruptedAttemptInput selects the one binding whose native attempt a killed agentplugins process left open without a persisted intent.
type InterruptedAttemptResult ¶
InterruptedAttemptResult names the attempt and whether its confirmation was recorded; a dry run records nothing.
type LegacyRemoveInput ¶
type LegacyRemoveResult ¶
type LegacyRemoveResult struct {
InstallationID string `json:"installation_id"`
Plugin string `json:"plugin"`
Targets []string `json:"targets"`
LegacyPlan ports.LegacyRemovalPlan `json:"legacy_plan"`
RequiresConfirmation bool `json:"requires_confirmation"`
Reconciled bool `json:"reconciled,omitempty"`
Mutated bool `json:"mutated"`
}
type MCPNamespacePreflight ¶
type MCPNamespacePreflight interface {
CheckMCPNamespace(context.Context, domain.DetectedClient, domain.DeliveryPlan, *domain.ClientBinding) error
}
MCPNamespacePreflight is process-inert and checks the final selected MCP server names against a client's observable user-level configuration.
type NativeIdentityObservation ¶
type NativeIdentityObservation = domain.NativeIdentityObservation
type NativeIdentityObserver ¶
type NativeIdentityObserver interface {
ObserveNativeIdentity(context.Context, domain.DetectedClient, domain.DeliveryPlan, *domain.ClientBinding) (domain.NativeIdentityObservation, error)
}
NativeIdentityObserver lets a backend prove that a same-name native object is absent or already owned. Unmanaged and indeterminate observations are always blocking; there is deliberately no adoption result.
type NativeIdentityState ¶
type NativeIdentityState = domain.NativeIdentityState
type NativeIntentReconciler ¶
type NativeIntentReconciler interface {
ReconcileNativeIntent(context.Context, domain.PendingNativeIntent) (domain.ActivationOutcome, error)
}
NativeIntentReconciler is the selected adapter's narrow recovery operation. It must re-read the recorded physical settings and reconcile only the pending selector, refusing drift. It must not restore a document backup, rediscover a profile, or infer ownership from identical bytes without this pending intent. The future facade composes this explicitly; no production Local writer exists.
type PluginDataManager ¶
type PluginDataManager interface {
EnsureData(context.Context, string, string, string) (domain.DataReceipt, bool, error)
ValidateData(context.Context, domain.DataReceipt) error
ValidateDataAt(context.Context, domain.DataReceipt, string) error
PrepareRuntime(context.Context, domain.PackageEnvelope, domain.DeliveryPlan, string) error
PurgeData(context.Context, domain.DataReceipt) error
}
type PreparedIdentityObserver ¶
type PreparedIdentityObserver interface {
ObservePreparedIdentity(context.Context, domain.DetectedClient, domain.DeliveryPlan, *domain.ClientBinding) (domain.NativeIdentityObservation, error)
}
PreparedIdentityObserver is the process-inert subset used by dry-run. It may inspect package files and prepared registries, but must not launch a client executable or query a remote registry.
type ProvenanceSummary ¶
type RemoveGroupInput ¶
type RemoveGroupResult ¶
type RemoveGroupResult struct {
InstallationID string `json:"installation_id"`
OperationGroupID string `json:"operation_group_id,omitempty"`
Targets []RemoveResult `json:"targets"`
Receipts []domain.MutationReceipt `json:"-"`
Mutated bool `json:"mutated"`
Phase GroupPhase `json:"phase"`
ManagedPhase GroupPhase `json:"managed_phase,omitempty"`
}
type RemoveInput ¶
type RemoveInput struct {
SelectedDelivery domain.SelectedDelivery
Selector string
Client domain.DetectedClient
Scope domain.InstallScope
DryRun bool
Confirmed bool
Interactive bool
ExternalUninstalled bool
OperationID string
BackendExecutable string
PurgeData bool
EnvironmentAuthority *domain.EnvironmentAuthority
}
type RemoveResult ¶
type RemoveResult struct {
InstallationID string `json:"installation_id"`
Plugin string `json:"plugin"`
ClientID domain.ClientID `json:"client_id"`
RequiresConfirmation bool `json:"requires_confirmation"`
Mutated bool `json:"mutated"`
Deactivation domain.DeactivationOutcome `json:"deactivation,omitempty"`
Receipt domain.MutationReceipt `json:"-"`
AffectedSurfaces []string `json:"affected_surfaces,omitempty"`
GroupPhase GroupTargetPhase `json:"group_phase,omitempty"`
}
type Service ¶
type Service struct {
CheckNamespace func() error `json:"-"`
ProjectRoot string `json:"-"`
ClientPreparation ClientPreparation
// OpenCodeHosts retains the explicit legacy preparation seam for callers
// without ClientPreparation; production composition uses ClientPreparation.
OpenCodeHosts ports.OpenCodeHostPreparer
// PrepareHostsForPreview authorizes online host preparation for a mutation's
// plan-first pass. Offline callers leave this false, including CLI --dry-run.
PrepareHostsForPreview bool
PhysicalAuthority ports.PhysicalProfileAuthority
PhysicalProfiles []domain.DetectedClient
StateStore transaction.StateStore
// Paths is required. There is deliberately no default: a silently supplied
// one would let a caller that forgot to wire it keep running with whatever
// containment rules that default happened to carry.
Paths ports.PathPolicy
Planner ports.DeliveryPlanner
Targets ports.DeliveryTargetResolver
// Detected is the surface map for this operation. The planner is stateless
// about detection; the use case copies this onto every PlanRequest.
Detected map[domain.ClientID]domain.DetectedClient
Stager ports.PackageStager
Activator ports.ClientActivator
Legacy ports.LegacyLifecycle
LegacyLock ports.MutationLock
Lock ports.MutationLock
Kernel transaction.Kernel
NativeObserver NativeIdentityObserver
NamespacePreflight MCPNamespacePreflight
PluginData PluginDataManager
Now func() time.Time
// contains filtered or unexported fields
}
func (Service) AddGroup ¶
func (service Service) AddGroup(ctx context.Context, input GroupInput) (GroupResult, error)
func (Service) ConfirmInterruptedNativeAttempt ¶
func (service Service) ConfirmInterruptedNativeAttempt(ctx context.Context, input InterruptedAttemptInput) (InterruptedAttemptResult, error)
ConfirmInterruptedNativeAttempt settles a native attempt that a killed agentplugins process left open. Under the mutation lock it verifies the binding and its installed package, lets the client adapter prove that no client command of that run is alive and read the client state once, and records only a certain effect: the attempt is closed, the confirmed ownership kept and the binding marked failed, so the ordinary repair or removal decides the rest. A dry run performs the same checks and writes nothing.
func (Service) ConfirmsInterruptedAttempt ¶
func (service Service) ConfirmsInterruptedAttempt(id domain.ClientID, scope domain.InstallScope) bool
ConfirmsInterruptedAttempt reports whether the client can confirm such an attempt in scope.
func (Service) InspectOwnedBinding ¶
func (service Service) InspectOwnedBinding(ctx context.Context, input AddInput, plan domain.DeliveryPlan, installation domain.Installation, binding domain.ClientBinding) (bool, error)
InspectOwnedBinding proves the complete recorded materialization through the same projection and verify-only adapter paths used by repair. It never repairs, acknowledges an attempt, or persists readiness. Known manual registration can be coherent while authentication and activation remain incomplete.
func (Service) InspectOwnedMaterialization ¶
func (service Service) InspectOwnedMaterialization(ctx context.Context, input AddInput, plan domain.DeliveryPlan, installation domain.Installation, binding domain.ClientBinding) (bool, error)
InspectOwnedMaterialization accepts a fresh, adapter-qualified prepared installation without treating it as observed native runtime readiness.
func (Service) InspectOwnedProjection ¶
func (service Service) InspectOwnedProjection(ctx context.Context, input AddInput, plan domain.DeliveryPlan, installation domain.Installation, binding domain.ClientBinding) (bool, error)
InspectOwnedProjection verifies immutable ownership and current projection without asserting that the client has activated or loaded those components.
func (Service) MigrateFormat ¶
func (service Service) MigrateFormat(ctx context.Context, input BindingChangeInput) (BindingChangeResult, error)
func (Service) PurgeRetainedData ¶
func (service Service) PurgeRetainedData(ctx context.Context, selector string, confirmed bool) error
PurgeRetainedData handles the only target-less removal: an explicit purge of a data_retained installation after complete ownership preflight.
func (Service) Rebind ¶
func (service Service) Rebind(ctx context.Context, input BindingChangeInput) (BindingChangeResult, error)
func (Service) RecoverNativeIntent ¶
func (service Service) RecoverNativeIntent(ctx context.Context, installationID, bindingID, attemptID string, reconciler NativeIntentReconciler) error
RecoverNativeIntents uses the same mutation lock, journal and binding state as installation. Its scope is one observed attempt, not every pending profile. A stale observation, missing reconciler or changed package refuses before the native callback. Persisted delivery facts are the only recovery input.
func (Service) RefreshProjection ¶
RefreshProjection restages an intact, exactly bound package with the caller's current host projection inputs. It is intended for host configuration changes that do not change the resolved package revision. Unlike Repair, it can commit a new projected digest even when the installed package is intact. A repeated refresh with identical projection output is a no-op.
func (Service) Remove ¶
func (service Service) Remove(ctx context.Context, input RemoveInput) (RemoveResult, error)
func (Service) RemoveGroup ¶
func (service Service) RemoveGroup(ctx context.Context, input RemoveGroupInput) (RemoveGroupResult, error)
func (Service) RemoveLegacy ¶
func (service Service) RemoveLegacy(ctx context.Context, input LegacyRemoveInput) (LegacyRemoveResult, error)
func (Service) Repair ¶
Repair replaces a missing or modified managed directory from a freshly resolved package. It never uses a persisted target until that target has been matched to the target resolver's current safe result.
func (Service) RepairGroup ¶
func (service Service) RepairGroup(ctx context.Context, input GroupInput) (GroupResult, error)
func (Service) SwitchGroup ¶
func (service Service) SwitchGroup(ctx context.Context, input GroupInput) (GroupResult, error)
func (Service) SwitchRetained ¶
func (service Service) SwitchRetained(ctx context.Context, input BindingChangeInput, origin domain.OriginMode, directory *domain.DirectoryOrigin) (BindingChangeResult, error)
SwitchRetained changes source only for a data_retained installation. Active installations must use SwitchGroup so every physical binding participates in the staged group transaction.
func (Service) Update ¶
Update applies a new package revision. For an unchanged revision whose delivered tree also depends on installer rendering, it first refreshes the projection, so newer rules reach the installed tree; the ordinary update then runs as before, including runtime preparation and resume. Its preview is never reported as unchanged.
func (Service) UpdateGroup ¶
func (service Service) UpdateGroup(ctx context.Context, input GroupInput) (GroupResult, error)
UpdateGroup refreshes every eligible target in turn before the group update. A preview marks those targets as needing confirmation and never as unchanged, and a refresh failure stops before the group update starts.
type TargetChange ¶
type TargetChange struct {
ClientID string `json:"client_id"`
Scope string `json:"scope"`
Materialization domain.MaterializationState `json:"materialization"`
Decision string `json:"decision"`
}
Source Files
¶
- apply.go
- apply_commit.go
- apply_outcomes.go
- apply_prepared_setup.go
- binding.go
- binding_policy.go
- capacity.go
- client_traits.go
- component_readiness.go
- component_stdio_policy.go
- delivery.go
- directory_recovery.go
- group_activate.go
- group_activate_independent.go
- group_activation_outcome.go
- group_commit.go
- group_commit_transaction.go
- group_compatibility_preflight.go
- group_contracts.go
- group_operations.go
- group_plan.go
- group_prepared_setup.go
- group_reconciliation.go
- group_session.go
- group_stage.go
- group_verification.go
- host_preparation.go
- identity.go
- installation.go
- installation_profile_authority.go
- intent.go
- legacy_remove.go
- lifecycle.go
- lifecycle_observation.go
- local_observation.go
- managed_selection.go
- namespace.go
- native_activation_readiness.go
- native_attempt.go
- native_attempt_confirmation.go
- native_binding.go
- native_environment.go
- native_profile_effects.go
- native_projection.go
- native_recovery.go
- native_remove_attempt.go
- native_remove_decision.go
- native_retained_authority.go
- observe_owned_binding.go
- prepared_project_verifier.go
- prepared_setup.go
- project_context.go
- projection_refresh.go
- refresh_projection.go
- remove.go
- remove_data_purge.go
- remove_group.go
- remove_group_native.go
- remove_group_persist.go
- remove_group_session.go
- remove_prepare.go
- remove_session.go
- repair.go
- repair_native.go
- repair_package.go
- repair_package_commit.go
- repair_project.go
- repair_session.go
- resume_authentication.go
- runtime_preparation.go
- selected_delivery.go
- service_contracts.go
- service_mutation.go
- service_revision_policy.go