orchestrator

package
v0.0.73 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package orchestrator provides shared container lifecycle logic used by both the CLI commands and the MCP server tool handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildEnvVars

func BuildEnvVars(cfg *config.Config, paths *config.Paths) (map[string]string, error)

BuildEnvVars constructs all container environment variables from config. Claude, Git, and Agent settings are now rendered into the container config YAML file (see renderer.BuildContainerConfig). This function only sets env vars for secrets, forwarded vars, and the config file path.

func BuildGitConfig added in v0.0.34

func BuildGitConfig(git *config.GitConfig) string

BuildGitConfig generates a container-local gitconfig file content for credential helper and/or URL rewriting. Returns empty string if no gitconfig is needed.

func BuildRef added in v0.0.20

func BuildRef(p config.Plugin) string

BuildRef constructs a full OCI reference from a Plugin spec.

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

func HasSOULFile(personalityDir string) bool

HasSOULFile reports whether a pulled personality directory contains a SOUL.md.

func LoadPersonalitySpec added in v0.0.20

func LoadPersonalitySpec(dir string) (klausoci.Personality, 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 env var) and the persistent on-disk cache managed by pkg/ocicache. Additional options may be supplied; they are applied after the defaults and can override them.

func PluginDirs added in v0.0.20

func PluginDirs(plugins []config.Plugin) []string

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, resolver *config.SourceResolver, 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. The resolver is used to expand short names against configured sources; if nil, the default built-in source is used.

func ResolveDefaultImage added in v0.0.34

func ResolveDefaultImage(ctx context.Context, client *klausoci.Client, image string, w io.Writer) string

ResolveDefaultImage resolves the default klaus base image to the latest semver-tagged version from the registry. If the image has already been resolved by the user or a personality, it is returned as-is.

On resolution failure the function falls back to :latest and writes a warning to w.

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

func ResolveSecretRefs(cfg *config.Config, paths *config.Paths) error

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 metadata.
	Spec klausoci.Personality
	// 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>/.

Jump to

Keyboard shortcuts

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