driver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeterministicInvocationID added in v0.5.2

func DeterministicInvocationID(serviceName string, origin InvocationOrigin, scheduleExpr, message string) string

func Register

func Register(name string, d Driver)

Types

type BaseImageProvider added in v0.2.0

type BaseImageProvider interface {
	BaseImage() (tag string, dockerfile string)
}

BaseImageProvider is optionally implemented by drivers that can auto-build their base image when it's not available locally.

type ChannelConfig

type ChannelConfig struct {
	Guilds            map[string]ChannelGuildConfig // guild ID → routing config
	DM                ChannelDMConfig
	AllowFromHandles  bool     // append all declared platform handles to each guild users[] allowlist
	AllowFromServices []string // append Discord bot IDs derived from these pod service envs
}

ChannelConfig is the full routing config declared in a map-form channel surface. Non-nil only when the pod declares map form (channel://discord: {...}).

type ChannelDMConfig

type ChannelDMConfig struct {
	Enabled   bool
	Policy    string   // "pairing", "allowlist", "open", "disabled", or "" (legacy "denylist" alias supported)
	AllowFrom []string // user IDs allowed to DM the bot
}

ChannelDMConfig is the DM routing config for a channel surface.

type ChannelGuildConfig

type ChannelGuildConfig struct {
	Policy         string   // "allowlist", "denylist", or "" (inherit platform default)
	Users          []string // user IDs for the policy list
	RequireMention bool
}

ChannelGuildConfig is the routing config for one guild in a channel surface.

type ChannelInfo

type ChannelInfo struct {
	ID   string `json:"id"`
	Name string `json:"name,omitempty"`
}

ChannelInfo describes a single channel within a guild.

type ContainerRef

type ContainerRef struct {
	ContainerID string
	ServiceName string
}

type Driver

type Driver interface {
	Validate(rc *ResolvedClaw) error
	Materialize(rc *ResolvedClaw, opts MaterializeOpts) (*MaterializeResult, error)
	PostApply(rc *ResolvedClaw, opts PostApplyOpts) error
	HealthProbe(ref ContainerRef) (*Health, error)
}

Driver translates Clawfile intent into runner-specific enforcement. Fail-closed: Validate runs before compose up, PostApply runs after.

func Lookup

func Lookup(name string) (Driver, error)

type GeneratedSkill

type GeneratedSkill struct {
	Name    string // filename (e.g., "surface-fleet-master.md")
	Content []byte // skill file content
}

type GuildInfo

type GuildInfo struct {
	ID       string        `json:"id"`
	Name     string        `json:"name,omitempty"`
	Channels []ChannelInfo `json:"channels,omitempty"`
}

GuildInfo describes one guild/server/workspace membership.

type HandleInfo

type HandleInfo struct {
	ID       string      `json:"id"`
	Username string      `json:"username,omitempty"`
	Guilds   []GuildInfo `json:"guilds,omitempty"`
}

HandleInfo is the full contact card for an agent on a platform. Enables sibling services to mention, message, and route to this agent.

type Health

type Health struct {
	OK     bool
	Detail string
}

type Healthcheck

type Healthcheck struct {
	Test     []string
	Interval string
	Timeout  string
	Retries  int
}

type Invocation

type Invocation struct {
	ID       string           `json:"id,omitempty"`
	Schedule string           // 5-field cron expression (e.g., "15 8 * * 1-5")
	Message  string           // agent task payload (agentTurn message)
	To       string           // platform delivery target (channel/chat ID; empty = driver default behavior)
	Name     string           // human-readable job name (optional, derived from message if empty)
	Origin   InvocationOrigin `json:"origin,omitempty"`
	When     *schedule.When   `json:"when,omitempty"`
}

Invocation is a scheduled agent task resolved from image labels or pod x-claw.invoke.

type InvocationOrigin added in v0.5.2

type InvocationOrigin string
const (
	OriginImage InvocationOrigin = "image"
	OriginPod   InvocationOrigin = "pod"
)

type MaterializeOpts

type MaterializeOpts struct {
	RuntimeDir string // host directory for generated artifacts
	StateDir   string // host directory for durable writable state
	PodName    string // pod name for context injection (CLAWDAPUS.md)
}

type MaterializeResult

type MaterializeResult struct {
	Mounts      []Mount
	Tmpfs       []string          // paths needing tmpfs (for read_only: true)
	Environment map[string]string // additional env vars
	Healthcheck *Healthcheck
	ReadOnly    bool   // default: true
	Restart     string // default: "on-failure"
	SkillDir    string // container path for skills (e.g., "/claw/skills")
	SkillLayout string // "" (flat, default) or "directory" (Claude Code: skills/name/SKILL.md)
}

MaterializeResult describes what the compose generator must add to the service.

type Mount

type Mount struct {
	HostPath      string
	ContainerPath string
	ReadOnly      bool
}

type PostApplyOpts

type PostApplyOpts struct {
	ContainerID string
}

type ResolvedClaw

type ResolvedClaw struct {
	ServiceName     string
	ImageRef        string
	ClawType        string
	Agent           string                            // filename from image labels (e.g., "AGENTS.md")
	AgentHostPath   string                            // resolved host path for bind mount
	Persona         string                            // runtime persona ref from x-claw or image metadata
	PersonaHostPath string                            // resolved host path for persona workspace mount
	Models          map[string]string                 // slot -> provider/model
	Handles         map[string]*HandleInfo            // platform -> contact card (from x-claw handles block)
	PeerHandles     map[string]map[string]*HandleInfo // service name -> platform -> HandleInfo for sibling services
	Includes        []ResolvedInclude                 // composed contract fragments from x-claw.include
	Feeds           []ResolvedFeed
	Surfaces        []ResolvedSurface
	Skills          []ResolvedSkill
	Privileges      map[string]string
	Configures      []string          // openclaw config set commands from labels
	Invocations     []Invocation      // scheduled agent tasks from image labels + pod x-claw.invoke
	Count           int               // from pod x-claw (default 1)
	Environment     map[string]string // from pod environment block
	Cllama          []string          // ordered cllama proxy types (e.g., ["passthrough"])
	CllamaToken     string            // per-agent bearer token injected when cllama is active
}

ResolvedClaw combines image-level claw labels with pod-level x-claw overrides.

type ResolvedFeed added in v0.3.5

type ResolvedFeed struct {
	Name        string
	Source      string
	Path        string
	TTL         int
	Description string
}

type ResolvedInclude added in v0.2.0

type ResolvedInclude struct {
	ID          string
	Mode        string
	Description string
	HostPath    string
	SkillName   string // set for reference includes mounted into the skill directory
}

type ResolvedSkill

type ResolvedSkill struct {
	Name     string // basename (e.g., "custom-workflow.md")
	HostPath string // resolved absolute host path
}

type ResolvedSurface

type ResolvedSurface struct {
	Scheme        string              // channel, service, volume, host, egress
	Target        string              // discord, fleet-master, shared-cache, etc.
	AccessMode    string              // read-only, read-write (for volume/host surfaces)
	Ports         []string            // exposed ports from service definition (service surfaces only)
	SkillName     string              // mounted skill filename for this surface when one exists
	ServiceInfo   *ServiceSurfaceInfo // non-nil when a service surface has descriptor metadata
	ChannelConfig *ChannelConfig      // non-nil only for map-form channel surfaces
}

type ServiceEndpoint added in v0.3.5

type ServiceEndpoint struct {
	Method      string
	Path        string
	Description string
}

type ServiceSurfaceInfo added in v0.3.5

type ServiceSurfaceInfo struct {
	Description string
	AuthType    string
	AuthEnv     string
	Endpoints   []ServiceEndpoint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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