registry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package registry persists REST-registered agents (operational key + TCP target).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	AID            a2al.Address
	ServiceTCP     string
	OpPriv         ed25519.PrivateKey
	DelegationCBOR []byte
	Seq            uint64
	// Services lists published service payloads for auto-renewal (user-facing name for DHT topics).
	Services []ServiceRecord
	// Profile holds user-supplied overrides for the RecType 0x02 sovereign record.
	// Nil means use inferred values from Services only.
	Profile *ProfileOverride
}

Entry is one registered application agent (not the node identity).

type ProfileOverride added in v0.2.0

type ProfileOverride struct {
	Name       string         `json:"name,omitempty"`
	Brief      string         `json:"brief,omitempty"`
	Protocols  []string       `json:"protocols,omitempty"`
	Skills     []string       `json:"skills,omitempty"`
	CardHash   []byte         `json:"card_hash,omitempty"`
	Modalities []string       `json:"modalities,omitempty"`
	Meta       map[string]any `json:"meta,omitempty"`
}

ProfileOverride holds user-supplied agent profile fields. Non-zero fields take precedence over values inferred from Services when assembling the RecType 0x02 sovereign record payload.

type Registry

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

Registry is a file-backed map of agent AID → registration.

func Load

func Load(path string) (*Registry, error)

Load reads agents.json; missing file is OK.

func New

func New(path string) *Registry

New returns an empty registry; call Load to populate from disk.

func (*Registry) Delete

func (r *Registry) Delete(aid a2al.Address) error

Delete removes an agent; no-op if missing.

func (*Registry) Get

func (r *Registry) Get(aid a2al.Address) *Entry

Get returns a copy-safe view (caller must not mutate OpPriv).

func (*Registry) List

func (r *Registry) List() []*Entry

List returns all entries (for GET /agents).

func (*Registry) Put

func (r *Registry) Put(e *Entry) error

Put adds or replaces an entry (in-memory + Save).

func (*Registry) Save

func (r *Registry) Save() error

Save writes agents.json atomically.

type ServiceRecord

type ServiceRecord struct {
	Topic     string         `json:"topic"`
	Name      string         `json:"name,omitempty"`
	Protocols []string       `json:"protocols,omitempty"`
	Tags      []string       `json:"tags,omitempty"`
	Brief     string         `json:"brief,omitempty"`
	Meta      map[string]any `json:"meta,omitempty"`
	TTL       uint32         `json:"ttl,omitempty"`
}

ServiceRecord persists a published service (full payload) for auto-renewal. JSON key is "services" to align with user-facing terminology.

Jump to

Keyboard shortcuts

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