Documentation
¶
Overview ¶
Package agents loads trusted review agent definitions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalid identifies malformed agent definitions or unsafe agent names. ErrInvalid = errors.New("agents: invalid") // ErrNotFound identifies a requested agent absent from a loaded catalog. ErrNotFound = errors.New("agents: not found") // ErrUnsafeSource identifies profile agent sources that are mutable or // ambiguous for PR review execution. ErrUnsafeSource = errors.New("agents: unsafe source") )
Functions ¶
func RequireSafeProfileSources ¶ added in v0.1.43
RequireSafeProfileSources fails when profile sources are mutable or ambiguous for PR review execution.
Types ¶
type Agent ¶
type Agent struct {
ID string `json:"id"`
Name string `json:"name"`
Category Category `json:"category"`
Description string `json:"description,omitempty"`
ModelTier string `json:"model_tier,omitempty"`
ModelID string `json:"model_id,omitempty"`
Effort string `json:"effort,omitempty"`
FileGlobs []string `json:"file_globs,omitempty"`
AppliesWhen []string `json:"applies_when,omitempty"`
NeedsFullFileContent bool `json:"needs_full_file_content"`
Prompt string `json:"prompt,omitempty"`
Provenance Provenance `json:"provenance"`
Overridden []string `json:"overridden,omitempty"`
}
Agent is one loaded review agent.
type Catalog ¶
type Catalog struct {
Agents []Agent `json:"agents"`
Repo *RepoInfo `json:"repo,omitempty"`
Sources []SourceInfo `json:"sources,omitempty"`
}
Catalog is the merged, precedence-resolved agent catalog.
type Category ¶
type Category struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Owner string `json:"owner,omitempty"`
}
Category is one agent category definition.
type LoadOptions ¶
type LoadOptions struct {
ProfileDirs []string
Repo *RepoSource
FlagDirs []string
RequireSafeProfileSources bool
SafeProfileSourceRoot string
AllowSoftRepoFailures bool
}
LoadOptions configures catalog loading.
type Provenance ¶
type Provenance struct {
Kind SourceKind `json:"kind"`
Label string `json:"label,omitempty"`
Ref string `json:"ref,omitempty"`
SHA string `json:"sha,omitempty"`
Index int `json:"index,omitempty"`
ConfiguredPath string `json:"configured_path,omitempty"`
CanonicalPath string `json:"canonical_path,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
Provenance identifies the winning source for one loaded agent.
func (Provenance) SourceInfo ¶ added in v0.1.35
func (p Provenance) SourceInfo() SourceInfo
SourceInfo returns the structured source details for this provenance.
func (Provenance) String ¶
func (p Provenance) String() string
String returns the user-facing provenance label.
type RepoInfo ¶
type RepoInfo struct {
Ref string `json:"ref"`
SHA string `json:"sha"`
Provenance string `json:"provenance"`
}
RepoInfo describes the trusted repo-local source, when one was considered.
type RepoReader ¶
type RepoReader interface {
ListTreeAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, treePath string) ([]gitprovider.TreeEntry, error)
GetFileAtRef(ctx context.Context, ref gitprovider.PRRef, gitRef string, filePath string) ([]byte, error)
}
RepoReader is the narrow read seam needed to load repo-local agent files.
type RepoSource ¶
type RepoSource struct {
Reader RepoReader
Ref gitprovider.PRRef
PR gitprovider.PR
}
RepoSource pins repo-local agents to a resolved pull request base SHA.
type SourceInfo ¶ added in v0.1.35
type SourceInfo struct {
Kind SourceKind `json:"kind"`
Label string `json:"label,omitempty"`
Ref string `json:"ref,omitempty"`
SHA string `json:"sha,omitempty"`
Index int `json:"index,omitempty"`
ProvenanceLabel string `json:"provenance"`
ConfiguredPath string `json:"configured_path,omitempty"`
CanonicalPath string `json:"canonical_path,omitempty"`
Present bool `json:"present"`
Status SourceStatus `json:"status"`
Fingerprint string `json:"fingerprint,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Error string `json:"error,omitempty"`
}
SourceInfo describes one configured agent source for operator audit.
func InspectProfileSources ¶ added in v0.1.35
func InspectProfileSources(dirs []string) []SourceInfo
InspectProfileSources reports active-profile source status without failing on missing or unreadable deployment material.
type SourceKind ¶
type SourceKind string
SourceKind identifies where an agent definition came from.
const ( SourceProfile SourceKind = "profile" SourceRepo SourceKind = "repo" SourceFlag SourceKind = "flag" )
Supported source kinds.
type SourceStatus ¶ added in v0.1.35
type SourceStatus string
SourceStatus reports whether a configured source is usable.
const ( SourceStatusAvailable SourceStatus = "available" SourceStatusMissing SourceStatus = "missing" SourceStatusUnreadable SourceStatus = "unreadable" SourceStatusInvalid SourceStatus = "invalid" )
Supported source statuses.