Documentation
¶
Overview ¶
Package orchestrator provides shared container lifecycle logic used by both the CLI commands and the MCP server tool handlers.
Index ¶
- func BuildEnvVars(cfg *config.Config, paths *config.Paths) (map[string]string, error)
- func BuildRef(p config.Plugin) string
- func BuildRunOptions(cfg *config.Config, paths *config.Paths, ...) (runtime.RunOptions, error)
- func BuildVolumes(cfg *config.Config, paths *config.Paths, env map[string]string, ...) ([]runtime.Volume, error)
- func HasSOULFile(personalityDir string) bool
- func LoadPersonalitySpec(dir string) (klausoci.PersonalitySpec, error)
- func MergePlugins(personalityPlugins []klausoci.PluginReference, userPlugins []config.Plugin) []config.Plugin
- func NewDefaultClient(opts ...klausoci.ClientOption) *klausoci.Client
- func PluginDirs(plugins []config.Plugin) []string
- func PluginFromReference(ref klausoci.PluginReference) config.Plugin
- func PullPlugins(ctx context.Context, client *klausoci.Client, plugins []config.Plugin, ...) error
- func ResolveCreateRefs(ctx context.Context, personality, toolchain string, plugins []string) (string, string, []string, error)
- func ResolvePluginRefs(ctx context.Context, client *klausoci.Client, refs []klausoci.PluginReference) ([]config.Plugin, error)
- func ResolveSecretRefs(cfg *config.Config, paths *config.Paths) error
- type PersonalityResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildEnvVars ¶
BuildEnvVars constructs all container environment variables from config. These mirror the Helm deployment.yaml env section.
func BuildRunOptions ¶
func BuildRunOptions(cfg *config.Config, paths *config.Paths, containerName, image, personalityDir string) (runtime.RunOptions, error)
BuildRunOptions constructs the container runtime options from config. This mirrors the Helm deployment.yaml template, producing the same env vars and volume mounts. personalityDir is the local path to the resolved personality (empty when no personality is configured).
func BuildVolumes ¶
func BuildVolumes(cfg *config.Config, paths *config.Paths, env map[string]string, personalityDir string) ([]runtime.Volume, error)
BuildVolumes constructs the container volume mounts and sets related env vars. The env map is mutated to add mount-dependent env vars (CLAUDE_WORKSPACE, etc.). personalityDir is the local path to the resolved personality (empty when none).
func HasSOULFile ¶ added in v0.0.20
HasSOULFile reports whether a pulled personality directory contains a SOUL.md.
func LoadPersonalitySpec ¶ added in v0.0.20
func LoadPersonalitySpec(dir string) (klausoci.PersonalitySpec, error)
LoadPersonalitySpec reads and parses a personality.yaml from the given directory.
func MergePlugins ¶ added in v0.0.20
func MergePlugins(personalityPlugins []klausoci.PluginReference, userPlugins []config.Plugin) []config.Plugin
MergePlugins merges personality plugins with user-configured plugins. User plugins take precedence: if a personality plugin and a user plugin share the same repository, the user's version is kept. Personality-only plugins are appended after user plugins.
func NewDefaultClient ¶ added in v0.0.20
func NewDefaultClient(opts ...klausoci.ClientOption) *klausoci.Client
NewDefaultClient creates an OCI client configured with the standard klausctl credential resolution: Docker/Podman config files plus the KLAUSCTL_REGISTRY_AUTH environment variable.
func PluginDirs ¶ added in v0.0.20
PluginDirs returns the container-internal mount paths for the given plugins. Each plugin is mounted at /var/lib/klaus/plugins/<shortName>.
func PluginFromReference ¶ added in v0.0.20
func PluginFromReference(ref klausoci.PluginReference) config.Plugin
PluginFromReference converts a klaus-oci PluginReference to a config.Plugin.
func PullPlugins ¶ added in v0.0.20
func PullPlugins(ctx context.Context, client *klausoci.Client, plugins []config.Plugin, pluginsDir string, w io.Writer) error
PullPlugins pulls all configured plugins to the local plugins directory. Each plugin is stored at <pluginsDir>/<shortName>/. Plugins are cached by digest and skipped if already up-to-date. Progress messages are written to w.
Plugins with a "latest" tag or no tag are resolved to the latest semver tag from the registry before pulling.
func ResolveCreateRefs ¶ added in v0.0.20
func ResolveCreateRefs(ctx context.Context, personality, toolchain string, plugins []string) (string, string, []string, error)
ResolveCreateRefs resolves personality, toolchain, and plugin short names to full OCI references with proper semver tags from the registry.
func ResolvePluginRefs ¶ added in v0.0.20
func ResolvePluginRefs(ctx context.Context, client *klausoci.Client, refs []klausoci.PluginReference) ([]config.Plugin, error)
ResolvePluginRefs resolves a slice of PluginReference entries, replacing "latest" or empty tags with the actual latest semver tag from the registry. The resolved references are returned as config.Plugin entries.
func ResolveSecretRefs ¶ added in v0.0.22
ResolveSecretRefs resolves all secret-related references in the config: McpServerRefs are merged into McpServers with optional Bearer tokens. This must be called before rendering so that the mcp-config.json is complete.
Types ¶
type PersonalityResult ¶ added in v0.0.20
type PersonalityResult struct {
// Spec is the parsed personality.yaml content.
Spec klausoci.PersonalitySpec
// Dir is the local directory where the personality was pulled.
Dir string
// ShortName is the short name extracted from the OCI reference.
ShortName string
}
PersonalityResult holds the outcome of resolving a personality artifact.
func ResolvePersonality ¶ added in v0.0.20
func ResolvePersonality(ctx context.Context, client *klausoci.Client, ref, personalitiesDir string, w io.Writer) (*PersonalityResult, error)
ResolvePersonality pulls a personality OCI artifact and parses its spec. The personality is stored at <personalitiesDir>/<shortName>/.