pod

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataPolicyNone            = "none"
	DataPolicyAllowed         = "allowed"
	DataPolicyProviderDefault = "provider-default"
	DataPolicyRegionGlobal    = "global"
)

Data policy values. The defaults are the most conservative: processing in the US or EU only, no provider training, no provider retention and no local content retention by cllama.

View Source
const (
	DefaultRunMaxRuntime     = 30 * time.Minute
	DefaultRunMaxAuthority   = 2 * time.Hour
	DefaultRunMaxTaskBytes   = 32 << 10
	DefaultRunMaxResultBytes = 256 << 10
	DefaultRunMemory         = "1g"
	DefaultRunPids           = 256
)

Defaults for per-run templates. max-authority bounds how far ahead an orchestrator may set authority_expires_at for a single launch or renewal.

View Source
const LifecyclePerRun = "per-run"

LifecyclePerRun marks a claw service as a per-run worker template: claw up compiles it but never starts it; `claw runs serve` instantiates it per run.

View Source
const RunNetworkKey = "claw-runs"

RunNetworkKey is the compose network key for the per-run worker network.

Variables

View Source
var DataPolicyGuarantees = []string{"zero-data-retention", "no-training", "processing:<region>", "storage:<region>"}

DataPolicyGuarantees are the account-level guarantees an operator can attest for a provider endpoint. Region guarantees take a region suffix, e.g. processing:jp.

View Source
var DefaultDataPolicyRegions = []string{"eu", "us"}

DefaultDataPolicyRegions are the processing regions allowed when a policy does not name any.

View Source
var ReasoningEfforts = []string{"none", "minimal", "low", "medium", "high"}

ReasoningEfforts are the values x-claw.reasoning-effort accepts: the Responses effort set cllama forwards. cllama still rejects a value the selected model does not support.

Functions

func ClawdashHostPort added in v0.9.0

func ClawdashHostPort(addr string) string

ClawdashHostPort returns the numeric host port derived from the given CLAWDASH_ADDR-style value (e.g. ":8082" or "0.0.0.0:9000"). It falls back to the default port when the value cannot be parsed.

func ClawdashListenAddress added in v0.30.0

func ClawdashListenAddress(raw string) (string, error)

ClawdashListenAddress controls the container listener, not host publication. A loopback container listener cannot receive Docker's forwarded requests.

func DashboardURL added in v0.30.0

func DashboardURL(bind, port string) string

DashboardURL is reachable from the host even when publication is wildcard. Callers validate bind using NormalizeDashboardBind before compilation.

func EmitCompose

func EmitCompose(p *Pod, results map[string]*driver.MaterializeResult, proxies ...CllamaProxyConfig) (string, error)

EmitCompose generates a compose.generated.yml string from pod definition and driver materialization results. Output is deterministic (sorted service names).

func NormalizeDashboardBind added in v0.30.0

func NormalizeDashboardBind(raw string) (string, error)

NormalizeDashboardBind accepts a literal host publication IP. Empty keeps Docker's existing default; brackets are accepted for IPv6 configuration.

func ParseSurface

func ParseSurface(raw string) (driver.ResolvedSurface, error)

ParseSurface parses a raw surface string like "volume://research-cache read-only" into a ResolvedSurface.

Types

type BudgetConfig added in v0.24.0

type BudgetConfig struct {
	LimitUSD    *float64
	MaxRequests *int
	Window      string
	Behavior    string
}

BudgetConfig holds per-service cllama budget and request-rate caps. Nil caps are disabled; Window must be set when any cap is configured.

type ChannelContextConfig added in v0.13.7

type ChannelContextConfig struct {
	Since    string
	Limit    int
	MaxChars int
	Buffer   int
}

type ChannelMemoryConfig added in v0.19.0

type ChannelMemoryConfig struct {
	Service string
}

type ClawAPIConfig added in v0.3.1

type ClawAPIConfig struct {
	Image              string // e.g. ghcr.io/mostlydev/claw-api:latest
	Addr               string // e.g. :8080
	ManifestHostPath   string // host path to pod-manifest.json
	ScheduleHostPath   string // host path to schedule.json
	PrincipalsHostPath string // host path to principals.json
	DockerSockHostPath string // host path to docker socket
	GovernanceHostPath string // host path to .claw-governance/ dir (write plane override files)
	ContextHostDir     string // host path to .claw-runtime/context/
	CllamaAPIURL       string // internal cllama UI/API URL for context snapshots
	CllamaAPIToken     string // CLLAMA_UI_TOKEN for internal cllama snapshot calls
	PodName            string
	Environment        map[string]string // extra env vars (e.g. CLAW_ALERT_* thresholds)
}

type ClawBlock

type ClawBlock struct {
	Agent        string
	Persona      string
	DescribeFile string
	Cllama       []string
	Models       map[string]string
	CllamaEnv    map[string]string
	CllamaTokens map[string]string // runtime-only: expanded service name -> token
	Count        int
	Handles      map[string]*driver.HandleInfo // platform → contact card
	Feeds        []FeedEntry
	Tools        []ToolPolicyEntry
	ToolPolicy   *ToolPolicyConfig
	Budget       *BudgetConfig
	Memory       *MemoryEntry
	Include      []IncludeEntry
	Surfaces     []driver.ResolvedSurface
	Skills       []string
	Invoke       []InvokeEntry
	Context      *ContextConfig
	ClawAPIMode  string // "self" when claw-api: self is declared; empty otherwise
	MCPStdio     *MCPStdioBlock
	Hermes       *driver.HermesConfig
	Lifecycle    string // "" (long-lived service) or LifecyclePerRun
	Run          *RunLimits
	// ReasoningEffort maps a model slot to the reasoning effort a per-run
	// worker requests for it.
	ReasoningEffort map[string]string
	// ProviderPreferences maps a per-run openrouter/* model slot to the
	// OpenRouter routing preferences its worker sends.
	ProviderPreferences map[string]*driver.OpenRouterPreferences
	// DataPolicy is the region, training and retention policy cllama
	// enforces for this service. Nil means the conservative default.
	DataPolicy *DataPolicyConfig
}

ClawBlock represents the x-claw extension on a service.

type ClawdashConfig added in v0.2.0

type ClawdashConfig struct {
	Image              string            // e.g. ghcr.io/mostlydev/clawdash:latest
	Addr               string            // e.g. :8082
	HostBind           string            // host publication IP, separate from container Addr
	ManifestHostPath   string            // host path to pod-manifest.json
	DockerSockHostPath string            // host path to docker socket
	CllamaCostsURL     string            // external costs URL for operator browser
	Environment        map[string]string // extra env vars (e.g. schedule client auth)
	PodName            string
}

type CllamaProxyConfig

type CllamaProxyConfig struct {
	ProxyType             string            // e.g. "passthrough", "policy"
	Image                 string            // e.g. ghcr.io/mostlydev/cllama:latest
	ContextHostDir        string            // host path for shared context dir
	AuthHostDir           string            // host path for provider auth state
	SessionHistoryHostDir string            // host path for session history dir (optional)
	GovernanceHostDir     string            // host path for governance override dir (optional, read-only in proxy)
	RevocationHostDir     string            // host path for the proxy-owned durable revocation ledger (rw)
	DashboardPort         string            // host port published to proxy UI :8081 (default "8181")
	DashboardBind         string            // host publication IP; empty preserves Docker default
	Environment           map[string]string // proxy-only env (e.g. CLAW_POD, provider keys)
	PodName               string
}

type ContextBlockConfig added in v0.25.0

type ContextBlockConfig struct {
	ID        string
	Kind      string
	Text      string
	Enabled   bool
	Placement string
	MaxChars  int
	Cadence   string
}

type ContextConfig added in v0.13.7

type ContextConfig struct {
	Channel *ChannelContextConfig
	Blocks  []ContextBlockConfig
}

type DataPolicyAttestation added in v0.31.0

type DataPolicyAttestation struct {
	Provider   string
	Endpoint   string
	Guarantees []string
}

DataPolicyAttestation is an operator's statement that an account-level guarantee holds for one provider endpoint. An empty Endpoint covers only the provider's official endpoints, never an overridden base URL.

type DataPolicyConfig added in v0.31.0

type DataPolicyConfig struct {
	Regions        []string
	Training       string // none | allowed
	Retention      string // provider retention: none | provider-default
	LocalRetention string // cllama local content: none | allowed
	Attestations   []DataPolicyAttestation
}

DataPolicyConfig is a service's resolved region, training and retention policy. Declaring it says what the operator requires; cllama decides per request whether the provider can be shown to meet it and refuses otherwise.

func DefaultDataPolicy added in v0.31.0

func DefaultDataPolicy() *DataPolicyConfig

DefaultDataPolicy returns the conservative policy applied when a service declares none.

type FeedEntry added in v0.3.1

type FeedEntry struct {
	Name        string
	Source      string
	Path        string
	TTL         int
	Description string
	Unresolved  bool
}

type IncludeEntry added in v0.2.0

type IncludeEntry struct {
	ID          string
	File        string
	Mode        string
	Description string
}

type InvokeEntry

type InvokeEntry struct {
	Schedule string // 5-field cron expression
	Message  string // agent task payload
	Name     string // optional human-readable job name
	To       string // delivery target (name or ID; optional platform prefix "platform:target")
	When     *schedule.When
}

InvokeEntry is a scheduled agent task declared in the pod x-claw.invoke block.

type MCPStdioBlock added in v0.12.0

type MCPStdioBlock struct {
	Command string
	Args    []string
}

type MemoryEntry added in v0.5.0

type MemoryEntry struct {
	Service   string
	TimeoutMS int
}

type ModelSlots added in v0.28.0

type ModelSlots map[string]string

ModelSlots is the YAML surface for x-claw.models. Every slot takes a scalar provider/model ref; the fallback slot additionally accepts an ordered list, normalized to fallback, fallback-2, fallback-3, ... in declared order so the rest of the pipeline keeps operating on a flat slot map (ADR-019).

func (*ModelSlots) UnmarshalYAML added in v0.28.0

func (m *ModelSlots) UnmarshalYAML(node *yaml.Node) error

type Pod

type Pod struct {
	Name                  string
	Master                string
	SequentialConformance bool // when true, shared handle IDs across services are allowed (sequential conformance spikes only)
	Services              map[string]*Service
	Compose               map[string]interface{} // preserved top-level compose keys except x-claw and services
	ClawAPI               *ClawAPIConfig
	Clawdash              *ClawdashConfig // runtime-only dashboard sidecar config, injected by claw up
	DisableClawdash       bool            // runtime-only operator opt-out, before principal generation
	// RunNetwork is the runtime-only Docker network name shared by cllama and
	// per-run workers. Set by claw up only when per-run templates exist.
	RunNetwork    string
	Context       *ContextConfig
	ChannelMemory *ChannelMemoryConfig
	Principals    []PodPrincipal
	AlertWebhooks []string // pod-scoped Discord webhook URLs for pool-transition alerts
	AlertMentions []string // pod-scoped @-mention targets for alerts (e.g. "@wojtek", "@infra")
}

Pod represents a parsed claw-pod.yml.

func Parse

func Parse(r io.Reader) (*Pod, error)

Parse reads a claw-pod.yml from the given reader.

type PodPrincipal added in v0.3.6

type PodPrincipal struct {
	Name            string   `yaml:"name"`
	Verbs           []string `yaml:"verbs"`
	Scope           string   `yaml:"scope,omitempty"`
	Services        []string `yaml:"services,omitempty"`
	ClawIDs         []string `yaml:"claw_ids,omitempty"`
	ComposeServices []string `yaml:"compose_services,omitempty"`
	InjectInto      string   `yaml:"inject-into,omitempty"`
}

PodPrincipal is an explicit principal declared in the pod-level x-claw.principals list.

type RunLimits added in v0.29.0

type RunLimits struct {
	MaxRuntime     time.Duration
	MaxAuthority   time.Duration
	MaxTaskBytes   int
	MaxResultBytes int
	Memory         string
	Pids           int
}

RunLimits bounds every run instantiated from a per-run template.

type Service

type Service struct {
	Image       string
	Compose     map[string]interface{} // preserved compose service keys except x-claw
	Claw        *ClawBlock
	Environment map[string]string
	Expose      []string // ports exposed to other containers (from compose expose:)
	Ports       []string // container-side ports from compose ports: (host:container or plain container)
}

Service represents a service in a claw-pod.yml.

func (*Service) IsAgentManaged added in v0.12.0

func (s *Service) IsAgentManaged() bool

func (*Service) IsMCPStdioSidecar added in v0.12.0

func (s *Service) IsMCPStdioSidecar() bool

func (*Service) IsPerRun added in v0.29.0

func (s *Service) IsPerRun() bool

type ToolPolicyConfig added in v0.22.0

type ToolPolicyConfig struct {
	MaxRounds        *int
	TimeoutPerToolMS *int
	TotalTimeoutMS   *int
}

ToolPolicyConfig holds per-service overrides for the cllama managed-tool mediation policy. Nil fields inherit the compiled-in defaults.

type ToolPolicyEntry added in v0.5.0

type ToolPolicyEntry struct {
	Service string
	Allow   []string
}

Jump to

Keyboard shortcuts

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