agentprofile

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package agentprofile implements the AgentProfile server-side resource: the declarative image/engine/limits, secret:// model-credential references, session budgets, and default playbook a job's metadata.remediation.profile field references (docs/design-agent-in-the-loop.md "Declarative policy", Stream E2). It mirrors the api/rest/service/notification channel CRUD shape.

Index

Constants

View Source
const DefaultTriageOnlyProfileName = models.DefaultTriageOnlyProfileName

DefaultTriageOnlyProfileName is the shipped zero-risk default profile name. It is defined canonically on the model so internal/jobdef's server-side lint can treat it as always resolvable; re-exported here for callers of this package.

Variables

View Source
var (
	ErrInvalidProfile      = errors.New("invalid agent profile")
	ErrProfileNameConflict = errors.New("agent profile name conflict")
)

Functions

func SeedDefaults

func SeedDefaults(ctx context.Context, conn *gorm.DB) error

SeedDefaults idempotently creates the shipped triage-only default profile (tier 0 + escalate; zero-risk) if it does not already exist, so a fresh deployment always has one AgentProfile a job can reference to adopt remediation incrementally. Safe to call concurrently / repeatedly: the unique name index makes the create a no-op race rather than a duplicate. A nil connection is a retryable failure (not a silent no-op) so ensureSeeded tries again once the DB is reachable rather than marking seeding done.

Types

type CreateRequest

type CreateRequest struct {
	Name       string            `json:"name"`
	Image      string            `json:"image"`
	Engine     models.AtomEngine `json:"engine,omitempty"`
	Limits     map[string]any    `json:"limits,omitempty"`
	SecretRefs map[string]string `json:"secret_refs,omitempty"`
	Budgets    map[string]any    `json:"budgets,omitempty"`
	Playbook   map[string]any    `json:"playbook,omitempty"`
}

type ListRequest

type ListRequest struct {
	Limit   uint64
	Offset  uint64
	OrderBy []string
}

type Service

type Service interface {
	List(req *ListRequest) ([]models.AgentProfile, error)
	Get(id uuid.UUID) (*models.AgentProfile, error)
	Create(req *CreateRequest) (*models.AgentProfile, error)
	Update(id uuid.UUID, req *UpdateRequest) (*models.AgentProfile, error)
	Delete(id uuid.UUID) error
}

Service manages AgentProfile resources.

func New

func New(ctx context.Context) Service

New returns a new AgentProfile service. It lazily seeds the shipped triage-only default profile (idempotent — guarded by the unique name index as well as the double-checked flag) so a fresh deployment has a zero-risk profile to reference without an operator having to author one by hand. A failed seed is retried on a later call.

type UpdateRequest

type UpdateRequest struct {
	Name       *string            `json:"name,omitempty"`
	Image      *string            `json:"image,omitempty"`
	Engine     *models.AtomEngine `json:"engine,omitempty"`
	Limits     map[string]any     `json:"limits,omitempty"`
	SecretRefs map[string]string  `json:"secret_refs,omitempty"`
	Budgets    map[string]any     `json:"budgets,omitempty"`
	Playbook   map[string]any     `json:"playbook,omitempty"`
}

Jump to

Keyboard shortcuts

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