sync

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const FullVerifyEnv = "AGENTPACK_FULL_VERIFY"

FullVerifyEnv makes a launch whose inputs are unchanged hash every cache entry again, instead of comparing file metadata with the last full check.

View Source
const RequireVerifiedEnv = "AGENTPACK_REQUIRE_VERIFIED"

RequireVerifiedEnv makes sync and the launchers refuse a lock that still has packages without a content hash, instead of staging them with a warning.

Variables

This section is empty.

Functions

func ComputeLaunchDigest

func ComputeLaunchDigest(projectRoot, workspace string, effective mode.Effective, target *base.Target) (string, error)

func EnvironmentDigest added in v0.8.0

func EnvironmentDigest(definitionRoot, workspace, selectedMode string, target harness.Target) (string, error)

EnvironmentDigest compares selected runtime inputs across a package mutation. It excludes lock bookkeeping and generation paths. MCP credentials influence the digest, so persist it only in private local state and never publish it.

func ReadLaunchDigest

func ReadLaunchDigest(projectRoot, modeName string, target base.Target) (string, bool, error)

func RecordFetched

func RecordFetched(pkg lockfile.Package, shorthand string) error

func ResolveRemoveSpec

func ResolveRemoveSpec(cwd, rawSpec string, project *manifest.Manifest) (string, error)

func WriteLaunchDigest

func WriteLaunchDigest(projectRoot, modeName string, target base.Target, digest string) error

Types

type AddResolver

type AddResolver struct {
	Client      *http.Client
	Materialize cacheMaterializeFunc
}

func NewAddResolver

func NewAddResolver(client *http.Client) AddResolver

func (AddResolver) Resolve

func (resolver AddResolver) Resolve(ctx context.Context, cwd, rawSpec string) (ResolvedAdd, error)

type LockOptions

type LockOptions struct {
	Refresh bool
	// AllowUnpinnedMCP records an MCP server as unpinned when its registry
	// cannot be asked for an exact version, instead of failing.
	AllowUnpinnedMCP bool
}

LockOptions tunes the commands that are allowed to add records to pack.lock.

type PreflightInputError added in v0.9.0

type PreflightInputError struct{ Err error }

PreflightInputError marks malformed or inconsistent definition inputs. Filesystem failures remain their original errors so callers can keep them classified as operational failures.

func (*PreflightInputError) Error added in v0.9.0

func (err *PreflightInputError) Error() string

func (*PreflightInputError) Unwrap added in v0.9.0

func (err *PreflightInputError) Unwrap() error

type PreflightOptions

type PreflightOptions struct {
	Mode           string
	Target         *base.Target
	Policy         environment.Policy
	StrictExternal bool
	WorkspaceRoot  string
	ContractPath   string // optional; empty loads <definition>/contract.json when present
	ReceiptID      string // optional; compare a prior native probe receipt (read-only)
}

PreflightOptions selects the pure offline check surface.

type ResolvedAdd

type ResolvedAdd struct {
	Package   lockfile.Package
	Shorthand string
	GitRef    string
}

type Service

type Service struct {
	Client *http.Client
	// Notify receives one-line integrity reports. Nil writes them to stderr.
	Notify func(message string)
	// Info receives lines that report what a command did and need no action.
	// Nil drops them, which is what --quiet asks for.
	Info func(message string)
	// Progress reports work about to perform potentially slow I/O.
	Progress func(message string)
}

func NewService

func NewService() Service

func (Service) Add

func (service Service) Add(ctx context.Context, projectRoot, spec string, noSync bool) (lockfile.Package, error)

Add records a package in agentpack.toml, locks it and stages it. When any of that fails, agentpack.toml and pack.lock are left exactly as they were: a package that could not be staged is not half-added.

func (Service) AddAll

func (service Service) AddAll(ctx context.Context, projectRoot, spec string, noSync bool) ([]lockfile.Package, error)

AddAll adds spec like Add. When spec is a marketplace catalog that lists several plugins, it adds every plugin the catalog lists, each as its own package, and syncs once at the end. Either all of them are added or the project files are left as they were.

func (Service) AddPlugin

func (service Service) AddPlugin(ctx context.Context, projectRoot, marketplace, plugin string, noSync bool) (lockfile.Package, error)

AddPlugin adds one named plugin of a marketplace catalog. The catalog entry says where the plugin lives: a directory of the marketplace repository, or another repository (optionally a directory of it) at a ref or commit. The plugin is then added like any other package, so the manifest names the plugin's own repository and path and pack.lock pins its commit.

func (Service) Lock

func (service Service) Lock(ctx context.Context, projectRoot string, refresh bool) (lockfile.PackLock, error)

func (Service) LockWithOptions

func (service Service) LockWithOptions(ctx context.Context, projectRoot string, options LockOptions) (lockfile.PackLock, error)

LockWithOptions resolves the manifest, records a content hash for every package, and pins the MCP servers the project stages.

func (Service) Preflight

func (service Service) Preflight(definitionRoot string, options PreflightOptions) (environment.Report, error)

Preflight inspects an already-available definition without repairing cache, downloading, amending the lock, rebuilding staging, or writing overlays.

func (Service) RefreshMCPRecords

func (service Service) RefreshMCPRecords(ctx context.Context, projectRoot string, pin, allowUnpinned bool) error

RefreshMCPRecords rewrites only the MCP records of an existing lock, without resolving packages. With pin set it also records servers that are new or changed (`mcp add`); without it it only drops records that no longer match (`mcp remove`), which needs no network.

func (Service) Remove

func (service Service) Remove(ctx context.Context, projectRoot, spec string, noSync bool) (string, error)

func (Service) RestoreFrozen

func (service Service) RestoreFrozen(ctx context.Context, definitionRoot string) error

RestoreFrozen ensures locked cache trees exist and rebuilds staging without re-resolving pins or rewriting pack.lock. Missing locked inputs fail hard.

func (Service) RestoreFrozenOptions

func (service Service) RestoreFrozenOptions(ctx context.Context, definitionRoot string, options SyncOptions) error

RestoreFrozenOptions is RestoreFrozen with workspace / strict-external controls.

func (Service) Sync

func (service Service) Sync(ctx context.Context, projectRoot string, options SyncOptions) (SyncResult, error)

func (Service) SyncForLaunch

func (service Service) SyncForLaunch(ctx context.Context, projectRoot, selectedMode string, target base.Target) (mode.Effective, bool, error)

func (Service) SyncForLaunchOptions

func (service Service) SyncForLaunchOptions(ctx context.Context, projectRoot string, options SyncOptions) (mode.Effective, bool, error)

SyncForLaunchOptions is SyncForLaunch with workspace/strict-external controls.

func (Service) Update

func (service Service) Update(ctx context.Context, projectRoot string, specs []string, noSync bool) (lockfile.PackLock, error)

Update refreshes every floating dependency when specs is empty. Otherwise it refreshes only the requested direct dependencies, using their manifest pins.

func (*Service) ValidateLaunchInputs

func (service *Service) ValidateLaunchInputs(definition, workspace string, effective mode.Effective, target base.Target) error

ValidateLaunchInputs runs under the launch lease so a concurrent rebuild between sync and lease acquisition cannot launch another workspace's staging.

type SyncOptions

type SyncOptions struct {
	DryRun, VerifyOnly, UpdateLock bool
	// Repair re-fetches cache entries that fail content verification.
	Repair bool
	// Frozen restores exact locked cache inputs and rebuilds staging without
	// re-resolving pins or rewriting pack.lock. Missing locked inputs fail.
	Frozen bool
	Mode   string
	Target *base.Target
	// WorkspaceRoot selects checkout inputs (.agents); empty means projectRoot.
	WorkspaceRoot string
	// StrictExternal refuses Cursor/Agy workspace overlay writes.
	StrictExternal bool
}

type SyncResult

type SyncResult struct {
	Skills, Plugins, Shadowed, IndexEntries int
	Mode                                    mode.Effective
	Warnings                                []string
}

Jump to

Keyboard shortcuts

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