Documentation
¶
Overview ¶
Package compiler provides pure functions for generating and transforming AgentSpec data.
Index ¶
- func AnnotateToolCategories(tools []agentspec.ToolSpec)
- func ConfigToAgentSpec(cfg *types.ForgeConfig) *agentspec.AgentSpec
- func CountToolCategories(tools []agentspec.ToolSpec) map[string]int
- func FilterDevTools(tools []agentspec.ToolSpec) []agentspec.ToolSpec
- func InferBaseImage(entrypoint []string) string
- func MergePluginConfig(spec *agentspec.AgentSpec, pc *plugins.AgentConfig)
- func WrapperEntrypoint(file string) []string
- type NetworkPolicyData
- type TemplateRuntimeData
- type TemplateSpecData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnnotateToolCategories ¶
AnnotateToolCategories sets the Category field on each tool based on known tool lists.
func ConfigToAgentSpec ¶
func ConfigToAgentSpec(cfg *types.ForgeConfig) *agentspec.AgentSpec
ConfigToAgentSpec converts a ForgeConfig into an AgentSpec.
func CountToolCategories ¶
CountToolCategories returns a map of category to count for the given tools.
func FilterDevTools ¶
FilterDevTools removes tools with category "dev" from the slice and returns the filtered result.
func InferBaseImage ¶
InferBaseImage returns a container base image based on the entrypoint command.
func MergePluginConfig ¶
func MergePluginConfig(spec *agentspec.AgentSpec, pc *plugins.AgentConfig)
MergePluginConfig fills gaps in the spec with plugin-extracted values. forge.yaml values always take precedence.
func WrapperEntrypoint ¶
WrapperEntrypoint returns the entrypoint command for a generated wrapper file.
Types ¶
type NetworkPolicyData ¶
type NetworkPolicyData struct {
DenyAll bool
}
NetworkPolicyData holds network policy template data.
type TemplateRuntimeData ¶
type TemplateRuntimeData struct {
Image string
Port int
Entrypoint string // Pre-formatted JSON array string, e.g. ["python", "agent.py"]
Env map[string]string
DepsFile string
DepsInstallCmd string
HealthCheck string
User string
ModelEnv map[string]string
}
TemplateRuntimeData holds runtime-specific template data.
type TemplateSpecData ¶
type TemplateSpecData struct {
AgentID string
Version string
Runtime *TemplateRuntimeData
Registry string
NetworkPolicy *NetworkPolicyData
// Container packaging extensions
EgressProfile string
EgressMode string
ToolInterfaceVersion string
SkillsCount int
HasSkills bool
DevBuild bool
ProdBuild bool
// Skill requirements
RequiredEnvVars []string
OptionalEnvVars []string
RequiredBins []string
// Framework
ForgeFramework bool
ForgeVersion string // forge CLI version for GitHub release download (e.g. "v0.9.0")
// Multi-stage build
HasBinStage bool // true when a bins stage exists with installed binaries
// Per-binary plumbing emitted in the application stage. See
// forge-core/packaging.DockerfileFragments for the full design
// (issue #149).
BinCopies []string // "COPY --from=<stage> /path /path" lines, one per binary.
RuntimeAptPackages []string // runtime apt packages installed in the application stage (debian).
RuntimeApkPackages []string // runtime apk packages installed in the application stage (alpine).
PathExtensions []string // PATH directories for non-standard binary locations.
// KeepRuntimeCurl is true when curl is a declared runtime binary (present
// in RuntimeAptPackages/RuntimeApkPackages). The forge-framework bootstrap
// borrows curl to fetch the forge binary and then purges it; when a skill
// legitimately requires curl at runtime, that purge would clobber it, so
// the Dockerfile template skips the purge in that case.
KeepRuntimeCurl bool
}
TemplateSpecData holds data used by Dockerfile and K8s templates.
func BuildTemplateDataFromContext ¶
func BuildTemplateDataFromContext(spec *agentspec.AgentSpec, bc *pipeline.BuildContext) *TemplateSpecData
BuildTemplateDataFromContext creates template data from an AgentSpec and BuildContext.
func BuildTemplateDataFromSpec ¶
func BuildTemplateDataFromSpec(spec *agentspec.AgentSpec) *TemplateSpecData
BuildTemplateDataFromSpec creates template data from an AgentSpec.