Internal

internal/core/agentcontract

Package agentcontract models role contracts delivered to agents.

import "github.com/nilstate/scafld/v2/internal/core/agentcontract"

Package agentcontract models role contracts delivered to agents.

Constants

Source: internal/core/agentcontract/model.go:17

const (
	RolePlan     Role = "plan"
	RoleHarden   Role = "harden"
	RoleBuild    Role = "build"
	RoleReview   Role = "review"
	RoleRecovery Role = "recovery"
)

Functions

func New(role Role, path string, body []byte) (Contract, error)

Source: internal/core/agentcontract/model.go:54

New returns a normalized contract with digest provenance.

func Roles() []Role

Source: internal/core/agentcontract/model.go:25

Roles returns every managed role contract.

Types

type Contract

Source: internal/core/agentcontract/model.go:45

Contract is a source-backed role contract resolved by an adapter.

type Contract struct {
	Role   Role   `json:"role"`
	Path   string `json:"path"`
	Body   string `json:"body"`
	SHA256 string `json:"sha256"`
	Bytes  int    `json:"bytes"`
}
Fields
  • Role Role `json:"role"`
  • Path string `json:"path"`
  • Body string `json:"body"`
  • SHA256 string `json:"sha256"`
  • Bytes int `json:"bytes"`

func Empty() bool

Source: internal/core/agentcontract/model.go:69

Empty reports whether the contract has no body.

func Section(key string, title string, order int) reviewcontext.Section

Source: internal/core/agentcontract/model.go:74

Section converts the contract into a required review context section.

type Role

Source: internal/core/agentcontract/model.go:14

Role names one agent-facing contract.

type Role string

func Filename() string

Source: internal/core/agentcontract/model.go:30

Filename returns the managed prompt filename for role.

func Valid() bool

Source: internal/core/agentcontract/model.go:35

Valid reports whether role is one of the managed contract roles.