Documentation
¶
Overview ¶
Package catalog builds discovery inventory from native definitions and optional project runtime declarations. Discovery does not enroll an agent or make it eligible for routing. The enrollment package applies project policy, user roster, driver reach, action requirements and budget first.
Index ¶
Constants ¶
const ( ViaNative = "native" ViaRuntime = "runtime" )
Provenance values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
ID string
Rubric string
Via string // ViaNative or ViaRuntime
// Native reach: the host subagent this id delegates to. Equal to ID for
// an agent discovered directly from the host's own agent definitions;
// distinct from ID for a ledger entry that augments a native subagent
// under a narrower id and rubric (agents.yaml's local-security-reviewer
// pattern).
Subagent string
// Runtime reach.
Runtime string
Model string
RuntimeAgent string // the foreign runtime's own named agent, e.g. opencode --agent
Binary string // override path for the runtime's CLI
RuntimeArgs string // additional CLI arguments; parsed without a shell
WriteScopes []string
ReadOnly bool
Tools *enrollment.ToolPolicy
// Source names where this entry came from, for `sdlc agents` and
// diagnostics: "native:<path>", "ledger:<path>" or "ledger-override:<path>".
Source string
}
Agent is one discovered inventory entry. Rubric is a suggested enrollment rubric; it is not permission to present this ID to Jev.
type Catalog ¶
type Catalog struct {
Warnings []string
// contains filtered or unexported fields
}
Catalog is the merged, validated discovery inventory.
func Merge ¶
func Merge(native []NativeAgent, ledgers ...LedgerFile) (*Catalog, error)
Merge combines discovered native agents and ledger-declared agents into one namespace, validated for id collisions and readOnly enforceability. Native discovery warnings (a skipped, unparseable agent file) are carried through on the result rather than failing the merge; a ledger problem (a duplicate id, or readOnly declared for a runtime that cannot enforce it) does fail it, since the ledger is authored and reviewable, unlike scanned agent files.
func (*Catalog) ApplyUserOverride ¶
func (c *Catalog) ApplyUserOverride(l LedgerFile) error
ApplyUserOverride applies a user-level ledger as an override: it may adjust an existing entry's reach (runtime, model, runtime agent, binary) but must name an id already in the catalog, and must not change that entry's rubric or write scopes — model access varies per machine, but capability claims are project knowledge (internal/redact/config's additive-only precedent). readOnly is a capability claim, not reach, and is likewise not overridable.
type LedgerAgent ¶
type LedgerAgent struct {
ID string `yaml:"id"`
Rubric string `yaml:"rubric"`
Via string `yaml:"via"`
Subagent string `yaml:"subagent"`
Runtime string `yaml:"runtime"`
Model string `yaml:"model"`
Agent string `yaml:"agent"` // the foreign runtime's own named agent
Binary string `yaml:"binary"`
RuntimeArgs string `yaml:"runtimeArgs,omitempty"`
WriteScopes []string `yaml:"writeScopes"`
ReadOnly bool `yaml:"readOnly"`
Tools *enrollment.ToolPolicy `yaml:"tools,omitempty"`
}
LedgerAgent is one .jevkit/sdlc/agents.yaml entry.
type LedgerFile ¶
type LedgerFile struct {
Version int `yaml:"version"`
Agents []LedgerAgent `yaml:"agents"`
Path string `yaml:"-"`
}
LedgerFile is one parsed agents.yaml, with Path kept for diagnostics and Source attribution.
func LoadLedger ¶
func LoadLedger(path string) (LedgerFile, error)
LoadLedger reads and validates path. A missing file returns a zero-value, empty LedgerFile (no ledger is a valid, if unusual, configuration): the caller decides whether that is acceptable.
type NativeAgent ¶
type NativeAgent struct {
Name string
Description string
Model string
Path string
Runtime string
Warnings []string
}
NativeAgent is one agent discovered from the host's own agent definitions. A file that fails to parse yields a zero-value NativeAgent (Name == "") plus an entry in Warnings; discovery never fails outright over one bad file.
func DiscoverNative ¶
func DiscoverNative(dirs ...string) []NativeAgent
DiscoverNative scans dirs (typically the project's .claude/agents and the user's ~/.claude/agents, in that order) for *.md subagent definitions. Absent directories are skipped silently; a present but unparseable file is skipped with a warning, never fatal — matching how a missing or malformed agent definition should never block the rest of a catalog from loading. The first directory to define a given subagent name wins; callers pass the project directory before the user directory so a project definition overrides a same-named user one, mirroring how Claude Code itself layers project and user agent definitions.
func DiscoverRuntimeAgents ¶
func DiscoverRuntimeAgents(runtime string, dirs ...string) []NativeAgent
DiscoverRuntimeAgents inventories runtime-owned definitions. IDs are namespaced so similarly named native agents from different CLIs coexist. A project definition takes precedence over the global definition.