driver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, d Driver)

Types

type ChannelConfig

type ChannelConfig struct {
	Guilds map[string]ChannelGuildConfig // guild ID → routing config
	DM     ChannelDMConfig
}

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   // "allowlist", "denylist", or ""
	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 {
	Schedule string // 5-field cron expression (e.g., "15 8 * * 1-5")
	Message  string // agent task payload (agentTurn message)
	To       string // Discord channel ID for delivery (empty = openclaw uses last channel)
	Name     string // human-readable job name (optional, derived from message if empty)
}

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

type MaterializeOpts

type MaterializeOpts struct {
	RuntimeDir string // host directory for generated artifacts
	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
	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
	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 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)
	ChannelConfig *ChannelConfig // non-nil only for map-form channel surfaces
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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