agents

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agents keeps the synchronisation state of the project's ADE integrations. The project agent registry itself is the Bootstrap's (its ADE registry and participation state); this package only records what the CLI observed and did, and that record can always be rebuilt.

Index

Constants

View Source
const (
	ArtifactSynchronized = "synchronized"
	ArtifactChanged      = "changed"
	ArtifactMissing      = "missing"
	ArtifactUnexpected   = "unexpected"
)

States of one managed artifact.

View Source
const (
	Synchronized = "synchronized"
	Missing      = "missing or changed"
	NotRequired  = "not required"
)

Context states of one agent.

Variables

This section is empty.

Functions

func ArtifactStatus

func ArtifactStatus(ledger string) string

ArtifactStatus maps a Bootstrap ownership status to an artifact state. An unknown status is passed through rather than guessed.

Types

type Adapter

type Adapter struct{ ADE ports.ADE }

Adapter is the AgentAdapter built from one Bootstrap registry entry.

func (Adapter) ContextLocations

func (a Adapter) ContextLocations() []string

ContextLocations returns the project paths the Bootstrap declares as owned.

func (Adapter) Detect

func (a Adapter) Detect(projectRoot string, runner ports.Runner) []string

Detect returns the signals the registry entry declares that are present.

func (Adapter) ID

func (a Adapter) ID() string

ID returns the agent id.

func (Adapter) InstructionEntry

func (a Adapter) InstructionEntry() string

InstructionEntry returns the file the agent reads first.

func (Adapter) Name

func (a Adapter) Name() string

Name returns the display name.

func (Adapter) Version

func (a Adapter) Version() int

Version returns the version of the registry entry.

type Agent

type Agent struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Enabled  bool     `json:"enabled"`  // participating: the human chose it
	Primary  bool     `json:"primary"`  // workflow identifier, no authority
	Excluded bool     `json:"excluded"` // the human declined it
	Detected bool     `json:"detected"`
	Signals  []string `json:"signals,omitempty"`
	Context  string   `json:"context"`
	Detail   string   `json:"detail,omitempty"`
	// From the agent's adapter and the Bootstrap ownership ledger.
	AdapterVersion int        `json:"adapter_version,omitempty"`
	Entry          string     `json:"instruction_entry,omitempty"`
	Locations      []string   `json:"context_locations,omitempty"`
	Artifacts      []Artifact `json:"artifacts,omitempty"`
}

Agent is one registry ADE seen from this project and this machine.

func (Agent) Count

func (a Agent) Count(status string) int

Count returns how many managed artifacts are in the given state.

type Artifact

type Artifact struct {
	Path   string `json:"path"`
	Status string `json:"status"`
	Basis  string `json:"basis,omitempty"`
}

Artifact is one file of an agent's managed context, as the Bootstrap ownership ledger reports it.

type Environment

type Environment struct {
	Schema     int      `json:"schema"`
	Configured bool     `json:"configured"`
	Agents     []Agent  `json:"agents"`
	Undeclared []string `json:"undeclared_detected"`
	Problems   []string `json:"problems"`
}

Environment is the result of an agent check.

func (Environment) OK

func (e Environment) OK() bool

OK reports whether every declared agent has its context.

type Record

type Record struct {
	Status   string `json:"status"`
	LastSync string `json:"last_sync,omitempty"`
}

Record is the sync state of one agent.

type Registry

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

Registry is the AgentRegistry over the Bootstrap ADE registry.

func NewRegistry

func NewRegistry(entries []ports.ADE) Registry

NewRegistry builds one adapter per registry entry, in registry order.

func (Registry) Adapter

func (r Registry) Adapter(id string) (ports.AgentAdapter, bool)

Adapter returns the adapter of one agent. An unknown id has none: GTT does not synchronise an environment it has no integration for.

func (Registry) Adapters

func (r Registry) Adapters() []ports.AgentAdapter

Adapters returns every adapter.

type State

type State struct {
	Version int               `json:"version"`
	Notice  string            `json:"notice"`
	Agents  map[string]Record `json:"agents"`
}

State is .gtt/cli/agents.json.

type Store

type Store struct{ Root string }

Store persists the sync state.

func (Store) Load

func (s Store) Load() (State, error)

Load returns the state; absent means empty.

func (Store) Save

func (s Store) Save(env Environment, synced map[string]bool) error

Save rewrites the state from an environment. It is idempotent: the same environment produces the same file apart from the sync time of agents whose status changed.

Jump to

Keyboard shortcuts

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