Documentation
¶
Index ¶
- func RenderFrontmatter(fm Frontmatter) string
- type CaseResource
- func (cr *CaseResource) Create(ctx *agentops.AppContext, slug string, opts map[string]string) (*resource.Record, error)
- func (cr *CaseResource) Get(ctx *agentops.AppContext, id string) (*resource.Record, error)
- func (cr *CaseResource) List(ctx *agentops.AppContext, filter resource.Filter) ([]resource.Record, error)
- func (cr *CaseResource) Schema() resource.ResourceSchema
- func (cr *CaseResource) Transition(ctx *agentops.AppContext, id string, action string) (*resource.Record, error)
- func (cr *CaseResource) Validate(ctx *agentops.AppContext, id string) (*agentops.DoctorReport, error)
- type Frontmatter
- type StateMachine
- func (sm *StateMachine) AllStatuses() []string
- func (sm *StateMachine) Apply(currentStatus, action string) (string, error)
- func (sm *StateMachine) CategoryForStatus(status string) string
- func (sm *StateMachine) ExpandStatusFilter(filter string) (map[string]bool, error)
- func (sm *StateMachine) Initial() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderFrontmatter ¶
func RenderFrontmatter(fm Frontmatter) string
RenderFrontmatter renders a Frontmatter as a YAML frontmatter block.
Types ¶
type CaseResource ¶
type CaseResource struct {
// contains filtered or unexported fields
}
CaseResource implements the Resource, Validator, and Transitioner interfaces.
func New ¶
func New(fs dal.FileSystem, exec dal.Executor, strat *strategy.Strategy) *CaseResource
New creates a new CaseResource.
func (*CaseResource) Create ¶
func (cr *CaseResource) Create(ctx *agentops.AppContext, slug string, opts map[string]string) (*resource.Record, error)
Create creates a new case directory and case.md file.
func (*CaseResource) Get ¶
func (cr *CaseResource) Get(ctx *agentops.AppContext, id string) (*resource.Record, error)
Get retrieves a case record by its ID.
func (*CaseResource) List ¶
func (cr *CaseResource) List(ctx *agentops.AppContext, filter resource.Filter) ([]resource.Record, error)
List walks the cases directory and returns matching records.
func (*CaseResource) Schema ¶
func (cr *CaseResource) Schema() resource.ResourceSchema
Schema returns the resource schema for cases.
func (*CaseResource) Transition ¶
func (cr *CaseResource) Transition(ctx *agentops.AppContext, id string, action string) (*resource.Record, error)
Transition applies a state machine action to a case and returns the updated record.
func (*CaseResource) Validate ¶
func (cr *CaseResource) Validate(ctx *agentops.AppContext, id string) (*agentops.DoctorReport, error)
Validate checks that a case has all required frontmatter fields.
type Frontmatter ¶
type Frontmatter struct {
Type string `yaml:"type"`
Status string `yaml:"status"`
ClaimedBy string `yaml:"claimed_by"`
Created string `yaml:"created"`
}
Frontmatter represents YAML frontmatter in case.md files.
func ParseFrontmatter ¶
func ParseFrontmatter(content string) (Frontmatter, string, error)
ParseFrontmatter extracts YAML frontmatter from case.md content. Returns the parsed frontmatter and the remaining body content.
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
StateMachine enforces valid state transitions loaded from strategy config.
func NewStateMachine ¶
func NewStateMachine(config strategy.TransitionsConfig) *StateMachine
NewStateMachine creates a StateMachine from a TransitionsConfig.
func (*StateMachine) AllStatuses ¶
func (sm *StateMachine) AllStatuses() []string
AllStatuses returns all known statuses from the categories config.
func (*StateMachine) Apply ¶
func (sm *StateMachine) Apply(currentStatus, action string) (string, error)
Apply applies an action to the current status and returns the new status.
func (*StateMachine) CategoryForStatus ¶
func (sm *StateMachine) CategoryForStatus(status string) string
CategoryForStatus returns the category name for a given status.
func (*StateMachine) ExpandStatusFilter ¶
func (sm *StateMachine) ExpandStatusFilter(filter string) (map[string]bool, error)
ExpandStatusFilter expands a status filter (status name or category) into a set of statuses.
func (*StateMachine) Initial ¶
func (sm *StateMachine) Initial() string
Initial returns the initial status for new cases.