common

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ManifestFileName = "agent.yaml"

Variables

This section is empty.

Functions

func ComputeMCPConfigPath

func ComputeMCPConfigPath(target *MCPConfigTarget) (configDir string, configPath string)

ComputeMCPConfigPath returns the config directory and file path for an agent. If BaseDir or AgentName is empty, both returned paths are empty.

func RefreshMCPConfig

func RefreshMCPConfig(target *MCPConfigTarget, servers []PythonMCPServer, verbose bool) error

RefreshMCPConfig cleans any existing MCP config for the target and optionally writes a new one. If servers is empty or nil, it performs cleanup only.

Types

type AgentConfig

type AgentConfig struct {
	Name        string
	Version     string
	Description string
	Image       string
	Directory   string
	Verbose     bool

	Instruction       string
	ModelProvider     string
	ModelName         string
	Framework         string
	Language          string
	CLIVersion        string
	TelemetryEndpoint string

	McpServers []McpServerType
	EnvVars    []string
	InitGit    bool
}

AgentConfig captures the data required to render an agent project from templates.

func (AgentConfig) ShouldSkipPath

func (c AgentConfig) ShouldSkipPath(path string) bool

ShouldSkipPath allows template walkers to skip specific directories.

type AgentManifest

type AgentManifest struct {
	Name              string          `yaml:"agentName" json:"name"`
	Image             string          `yaml:"image" json:"image"`
	Language          string          `yaml:"language" json:"language"`
	Framework         string          `yaml:"framework" json:"framework"`
	ModelProvider     string          `yaml:"modelProvider" json:"modelProvider"`
	ModelName         string          `yaml:"modelName" json:"modelName"`
	Description       string          `yaml:"description" json:"description"`
	Version           string          `yaml:"version,omitempty" json:"version,omitempty"`
	TelemetryEndpoint string          `yaml:"telemetryEndpoint,omitempty" json:"telemetryEndpoint,omitempty"`
	McpServers        []McpServerType `yaml:"mcpServers,omitempty" json:"mcpServers,omitempty"`
	UpdatedAt         time.Time       `yaml:"updatedAt,omitempty" json:"updatedAt,omitempty"`
}

AgentManifest represents the agent project configuration and metadata.

func NewProjectManifest

func NewProjectManifest(agentName, language, framework, modelProvider, modelName, description string, mcpServers []McpServerType) *AgentManifest

NewProjectManifest creates a new AgentManifest with the given values.

type BaseGenerator

type BaseGenerator struct {
	// contains filtered or unexported fields
}

BaseGenerator renders template trees into a destination directory.

func NewBaseGenerator

func NewBaseGenerator(templateFiles fs.FS) *BaseGenerator

NewBaseGenerator returns a template renderer rooted at "templates".

func (*BaseGenerator) GenerateProject

func (g *BaseGenerator) GenerateProject(config AgentConfig) error

GenerateProject walks the template tree and renders files to disk.

func (*BaseGenerator) ReadTemplateFile

func (g *BaseGenerator) ReadTemplateFile(templatePath string) ([]byte, error)

ReadTemplateFile reads a raw template file from the generator's embedded filesystem.

func (*BaseGenerator) RenderTemplate

func (g *BaseGenerator) RenderTemplate(tmplContent string, data any) (string, error)

RenderTemplate renders a template string with the provided data.

type MCPConfigTarget

type MCPConfigTarget struct {
	BaseDir   string
	AgentName string
	Version   string // optional; when set, path includes sanitized version
}

MCPConfigTarget describes where to place the resolved MCP config for an agent.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles loading and saving of agent manifests.

func NewManifestManager

func NewManifestManager(projectRoot string) *Manager

NewManifestManager creates a new manifest manager for the given project root.

func (*Manager) Load

func (m *Manager) Load() (*AgentManifest, error)

Load reads and parses the agent.yaml file.

func (*Manager) Save

func (m *Manager) Save(manifest *AgentManifest) error

Save writes the manifest to agent.yaml.

func (*Manager) Validate

func (m *Manager) Validate(manifest *AgentManifest) error

Validate checks if the manifest is valid.

type McpServerType

type McpServerType struct {
	// MCP Server Type -- remote, command, registry
	Type    string            `yaml:"type" json:"type"`
	Name    string            `yaml:"name" json:"name"`
	Image   string            `yaml:"image,omitempty" json:"image,omitempty"`
	Build   string            `yaml:"build,omitempty" json:"build,omitempty"`
	Command string            `yaml:"command,omitempty" json:"command,omitempty"`
	Args    []string          `yaml:"args,omitempty" json:"args,omitempty"`
	Env     []string          `yaml:"env,omitempty" json:"env,omitempty"`
	URL     string            `yaml:"url,omitempty" json:"url,omitempty"`
	Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
	// Registry MCP server fields -- these are translated into the appropriate fields above when the agent is ran or deployed
	RegistryURL                string `yaml:"registryURL,omitempty" json:"registryURL,omitempty"`
	RegistryServerName         string `yaml:"registryServerName,omitempty" json:"registryServerName,omitempty"`
	RegistryServerVersion      string `yaml:"registryServerVersion,omitempty" json:"registryServerVersion,omitempty"`
	RegistryServerPreferRemote bool   `yaml:"registryServerPreferRemote,omitempty" json:"registryServerPreferRemote,omitempty"`
}

McpServerType represents a single MCP server configuration.

type PythonMCPServer

type PythonMCPServer struct {
	Name    string            `json:"name"`
	Type    string            `json:"type"` // "remote" or "command"
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

PythonMCPServer represents the JSON structure expected by the Python MCP tools template Equal to the type used in the python mcp_tools.py template.

func PythonServersFromManifest

func PythonServersFromManifest(manifest *AgentManifest) []PythonMCPServer

PythonServersFromManifest converts resolved MCP servers in a manifest into Python MCP server structs. Registry-type servers are skipped because they are not directly runnable.

Jump to

Keyboard shortcuts

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