requirements

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLayer = errors.New("requirements: invalid layer")
	ErrConflict     = errors.New("requirements: conflicting layers")
)

Functions

This section is empty.

Types

type ApprovalMode

type ApprovalMode string
const (
	ApprovalUnspecified ApprovalMode = ""
	ApprovalNever       ApprovalMode = "never"
	ApprovalOnRequest   ApprovalMode = "on_request"
	ApprovalAlways      ApprovalMode = "always"
)

type ApprovalRequirement

type ApprovalRequirement struct {
	Mode ApprovalMode
}

type CatalogKind

type CatalogKind string
const (
	CatalogPlugin CatalogKind = "plugin"
	CatalogAgent  CatalogKind = "agent"
	CatalogSkill  CatalogKind = "skill"
)

type CatalogSource

type CatalogSource struct {
	Name string
	Kind CatalogKind
	Path string
	URI  string
}

type ConflictError

type ConflictError struct {
	Field          string
	ExistingSource Source
	IncomingSource Source
	Message        string
}

func (*ConflictError) Error

func (e *ConflictError) Error() string

func (*ConflictError) Is

func (e *ConflictError) Is(target error) bool

type FeatureGate

type FeatureGate struct {
	Name    string
	Enabled bool
}

type FileStorePath

type FileStorePath struct {
	Name string
	Path string
}

type HookRequirement

type HookRequirement struct {
	Config hooks.Config
	Hooks  []hooks.CommandHook
}

type Layer

type Layer struct {
	Source       Source
	Approval     *ApprovalRequirement
	ToolPolicy   *ToolPolicyRequirement
	Hooks        *HookRequirement
	MCPServers   []mcp.ServerConfig
	Catalogs     []CatalogSource
	Models       []ModelChoice
	FileStores   []FileStorePath
	FeatureGates []FeatureGate
}

type ModelChoice

type ModelChoice struct {
	Role  string
	Model string
}

type Requirements

type Requirements struct {
	Approval     *Sourced[ApprovalRequirement]        `json:"approval,omitempty"`
	ToolPolicy   SourcedToolPolicy                    `json:"tool_policy"`
	Hooks        SourcedHooks                         `json:"hooks"`
	MCPServers   map[string]Sourced[mcp.ServerConfig] `json:"mcp_servers,omitempty"`
	Catalogs     map[string]Sourced[CatalogSource]    `json:"catalogs,omitempty"`
	Models       map[string]Sourced[ModelChoice]      `json:"models,omitempty"`
	FileStores   map[string]Sourced[FileStorePath]    `json:"file_stores,omitempty"`
	FeatureGates map[string]Sourced[FeatureGate]      `json:"feature_gates,omitempty"`
}

func Compose

func Compose(layers ...Layer) (Requirements, error)

func (Requirements) CommandPolicyConfig

func (r Requirements) CommandPolicyConfig() tools.CommandPolicyConfig

func (Requirements) HookRuntimeConfig

func (r Requirements) HookRuntimeConfig() (hooks.Config, []hooks.CommandHook)

type Source

type Source struct {
	Label string `json:"label"`
	Kind  string `json:"kind,omitempty"`
	Path  string `json:"path,omitempty"`
}

func NewSource

func NewSource(label string) Source

type Sourced

type Sourced[T any] struct {
	Value  T      `json:"value"`
	Source Source `json:"source"`
}

type SourcedHooks

type SourcedHooks struct {
	Config *Sourced[hooks.Config]       `json:"config,omitempty"`
	Hooks  []Sourced[hooks.CommandHook] `json:"hooks,omitempty"`
}

type SourcedToolPolicy

type SourcedToolPolicy struct {
	DefaultDecision        *Sourced[tools.DecisionCode]    `json:"default_decision,omitempty"`
	ResolveHostExecutables *Sourced[bool]                  `json:"resolve_host_executables,omitempty"`
	Rules                  []Sourced[tools.CommandRule]    `json:"rules,omitempty"`
	HostExecutables        []Sourced[tools.HostExecutable] `json:"host_executables,omitempty"`
}

type ToolPolicyRequirement

type ToolPolicyRequirement struct {
	DefaultDecision        tools.DecisionCode
	ResolveHostExecutables *bool
	Rules                  []tools.CommandRule
	HostExecutables        []tools.HostExecutable
}

Jump to

Keyboard shortcuts

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