registry

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package registry stores immutable, content-addressed package records and agentpack revisions under the user's agentpack home.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("registry item not found")

Functions

func CaptureProjectIfEnabled

func CaptureProjectIfEnabled(home, definitionRoot, sourceProject, sourceNode, modeName string) (Agentpack, Revision, bool, error)

CaptureProjectIfEnabled returns without opening or creating registry storage when capture is disabled.

func PendingRestore

func PendingRestore(home, directory string) (bool, error)

PendingRestore reports an interrupted restore without changing project or registry files.

func RecoverDefinition

func RecoverDefinition(home, directory string) error

RecoverDefinition is a no-op without an interrupted restore and does not create registry storage.

Types

type Agentpack

type Agentpack struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Revisions []string `json:"revisions"`
	Heads     []string `json:"heads"`
}

type CaptureInput

type CaptureInput struct {
	ID         string
	Name       string
	Label      string
	Mode       string
	SourceNode string
	Project    string
	Manifest   []byte
	Lock       []byte
	CreatedAt  time.Time
	ParentIDs  []string
}

type DiffResult

type DiffResult struct {
	Add    []string `json:"add"`
	Update []string `json:"update"`
	Remove []string `json:"remove"`
	Mode   string   `json:"mode"`
}

type Draft

type Draft struct {
	ID             string                `json:"id"`
	Item           string                `json:"item"`
	Revision       string                `json:"revision,omitempty"`
	Node           string                `json:"node"`
	Directory      string                `json:"directory"`
	Reason         string                `json:"reason"`
	PackID         string                `json:"pack_id,omitempty"`
	FolderIdentity string                `json:"folder_identity"`
	ExpectedPins   map[string]PackagePin `json:"expected_pins"`
	NeededHolder   string                `json:"needed_holder,omitempty"`
	CreatedAt      time.Time             `json:"created_at"`
}

type DraftInput

type DraftInput struct {
	Item           string                `json:"item"`
	Revision       string                `json:"revision,omitempty"`
	Node           string                `json:"node"`
	Directory      string                `json:"directory"`
	Reason         string                `json:"reason"`
	PackID         string                `json:"pack_id,omitempty"`
	FolderIdentity string                `json:"folder_identity"`
	ExpectedPins   map[string]PackagePin `json:"expected_pins"`
	NeededHolder   string                `json:"needed_holder,omitempty"`
}

type DraftReview

type DraftReview struct {
	Draft       Draft       `json:"draft"`
	Ready       bool        `json:"ready"`
	PinsMatch   bool        `json:"pins_match"`
	FolderMatch bool        `json:"folder_match"`
	Reason      string      `json:"reason"`
	Diff        *DiffResult `json:"diff,omitempty"`
}

type DraftState

type DraftState struct {
	Reachable      bool                  `json:"reachable"`
	FolderIdentity string                `json:"folder_identity"`
	Pins           map[string]PackagePin `json:"pins"`
	CurrentDiff    *DiffResult           `json:"current_diff,omitempty"`
	MissingObjects []string              `json:"missing_objects,omitempty"`
	NeededHolder   string                `json:"needed_holder,omitempty"`
}

type Inventory

type Inventory struct {
	Schema     int      `json:"schema"`
	Objects    []string `json:"objects"`
	Tombstones []string `json:"tombstones"`
}

type InventoryDelta

type InventoryDelta struct {
	Objects    []string `json:"objects"`
	Tombstones []string `json:"tombstones"`
}

type Package

type Package struct {
	ID          string `json:"id"`
	Schema      int    `json:"schema,omitempty"`
	Module      string `json:"module"`
	Direct      bool   `json:"direct,omitempty"`
	Commit      string `json:"commit"`
	ContentHash string `json:"content_hash,omitempty"`
	Kind        string `json:"kind"`
	URL         string `json:"url"`
	Owner       string `json:"owner"`
	Repo        string `json:"repo"`
	Path        string `json:"path,omitempty"`
	CacheKey    string `json:"cache_key"`
	Name        string `json:"name,omitempty"`
	SourceNode  string `json:"source_node,omitempty"`
	Project     string `json:"project,omitempty"`
}

type PackagePin

type PackagePin struct {
	Commit      string `json:"commit"`
	ContentHash string `json:"content_hash,omitempty"`
	CacheKey    string `json:"cache_key"`
}

type PeerReplica

type PeerReplica struct {
	Node         string   `json:"node"`
	ReceiptCount int      `json:"receipt_count"`
	Digests      []string `json:"digests"`
}

type Revision

type Revision struct {
	ID                      string    `json:"id"`
	Schema                  int       `json:"schema,omitempty"`
	AgentpackID             string    `json:"agentpack_id"`
	ParentIDs               []string  `json:"parent_ids,omitempty"`
	Manifest                string    `json:"manifest"`
	Lock                    string    `json:"lock"`
	PackageIDs              []string  `json:"package_ids,omitempty"`
	SourceNode              string    `json:"source_node,omitempty"`
	Project                 string    `json:"project,omitempty"`
	CreatedAt               time.Time `json:"created_at"`
	Label                   string    `json:"label,omitempty"`
	Mode                    string    `json:"mode,omitempty"`
	NeedsLocalConfiguration bool      `json:"needs_local_configuration,omitempty"`
}

type Store

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

func New

func New(home string) (*Store, error)

New opens $AGENTPACK_HOME/registry. home is the already-resolved agentpack home.

func (*Store) Acknowledge

func (s *Store) Acknowledge(peer string, digests []string) error

func (*Store) Capture

func (s *Store) Capture(input CaptureInput) (Agentpack, Revision, error)

Capture appends a content-addressed revision, creating a stable agentpack ID when absent.

func (*Store) CollectGarbage

func (s *Store) CollectGarbage() ([]string, error)

func (*Store) DeleteAgentpack

func (s *Store) DeleteAgentpack(id string) (Tombstone, error)

func (*Store) DeleteDraft

func (s *Store) DeleteDraft(id string) error

func (*Store) Diff

func (s *Store) Diff(fromID, toID string) (DiffResult, error)

Diff compares package pins and selected mode from two verified revisions.

func (*Store) EnrollPeer

func (s *Store) EnrollPeer(node string) error

func (*Store) ExportObject

func (s *Store) ExportObject(id string) ([]byte, error)

func (*Store) Get

func (s *Store) Get(id string) (Agentpack, []Revision, error)

func (*Store) GetDraft

func (s *Store) GetDraft(id string) (Draft, error)

func (*Store) Heads

func (s *Store) Heads(id string) ([]string, error)

func (*Store) ImportObjects

func (s *Store) ImportObjects(documents map[string][]byte) ([]string, error)

ImportObjects validates the complete batch before publishing any object.

func (*Store) Inventory

func (s *Store) Inventory() (Inventory, error)

func (*Store) ListAgentpacks

func (s *Store) ListAgentpacks() ([]Agentpack, error)

ListAgentpacks returns named packs from the rebuildable index.

func (*Store) ListDrafts

func (s *Store) ListDrafts() ([]Draft, error)

func (*Store) ListPackages

func (s *Store) ListPackages() ([]Package, error)

ListPackages loads and verifies every indexed package object.

func (*Store) ListPeers

func (s *Store) ListPeers() ([]PeerReplica, error)

func (*Store) MissingFrom

func (s *Store) MissingFrom(remote Inventory) (InventoryDelta, error)

func (*Store) Preview

func (s *Store) Preview(id, revisionID, directory string) (Revision, DiffResult, error)

Preview exposes the redacted target snapshot; bindings are private to this machine.

func (*Store) Recover

func (s *Store) Recover(directory string) error

Recover rolls back an interrupted restore for one definition directory.

func (*Store) RemovePeer

func (s *Store) RemovePeer(node string) error

func (*Store) Rename

func (s *Store) Rename(id, name string) (Agentpack, error)

func (*Store) Restore

func (s *Store) Restore(id, revisionID, directory string, apply func() error) error

Restore writes the selected definition, runs apply, and restores both original files on any failure.

func (*Store) RevalidateDraft

func (s *Store) RevalidateDraft(id string, state DraftState) (DraftReview, error)

func (*Store) SaveDraft

func (s *Store) SaveDraft(input DraftInput) (Draft, error)

func (*Store) SetCapture

func (s *Store) SetCapture(directory, agentpackID string, enabled bool) error

SetCapture enables or disables automatic snapshots for one project directory.

type Tombstone

type Tombstone struct {
	ID        string    `json:"id"`
	Schema    int       `json:"schema"`
	Agentpack string    `json:"agentpack_id"`
	Revisions []string  `json:"revisions"`
	CreatedAt time.Time `json:"created_at"`
}

Jump to

Keyboard shortcuts

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