Documentation
¶
Overview ¶
Package agentslock is the single shared writer for .agentsrc.lock — the resolved-state companion to .agentsrc.json (config-distribution-model §7).
It is schema-agnostic: it owns the whole JSON document and treats top-level sections (config, packages, adapters, …) as opaque values, so the config/ package resolver and the graph-adapter lifecycle share one file without either importing the other's schema (§7.4). A writer stages only its own section and flushes; sibling sections are preserved verbatim. Flush is atomic (temp file + rename, via fsops.WriteFileAtomic). A single Lockfile is safe for concurrent SetSection from parallel resolver goroutines — the in-process mutex guards the document and the on-disk write is the one serialized step (§7.4 "parallel resolution, serialized write").
Index ¶
Constants ¶
const LockVersion = 1
LockVersion is the current .agentsrc.lock schema version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lockfile ¶
type Lockfile struct {
// contains filtered or unexported fields
}
Lockfile is the in-memory view of a .agentsrc.lock document: open it, read or stage sections, then Flush. Safe for concurrent use.
func Open ¶
Open loads the lockfile at path. A missing file yields a fresh document (lock_version only); a present file is parsed, preserving every top-level key — including sections this process does not know about.
func (*Lockfile) Flush ¶
Flush writes the whole document to path atomically, preserving every section. It is callable more than once (e.g. persist config before a slow adapter activation, then flush adapters after). The parent directory must exist.
func (*Lockfile) InputsDigest ¶
InputsDigest returns the top-level inputs_digest and whether it was present. An absent or empty field reports ("", false).
func (*Lockfile) Section ¶
Section decodes the named section into v and reports whether it was present. An absent section returns (false, nil) so callers can treat "no section yet" and "section exists" uniformly.
func (*Lockfile) SetInputsDigest ¶
SetInputsDigest stages the top-level inputs_digest field (§7A.3): the whole-normalized hash of all local config scopes that drives staleness. An empty digest clears the field. Safe for concurrent use.