cllama

package
v0.5.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ModelPolicyModeClamp = "clamp"

Variables

View Source
var DefaultToolPolicy = ToolPolicy{
	MaxRounds:        8,
	TimeoutPerToolMS: 30000,
	TotalTimeoutMS:   120000,
}

Functions

func GenerateContextDir

func GenerateContextDir(runtimeDir string, agents []AgentContextInput) error

GenerateContextDir writes per-agent context files under:

<runtimeDir>/context/<agent-id>/{AGENTS.md,CLAWDAPUS.md,metadata.json,feeds.json,tools.json,memory.json,service-auth/...}

func GenerateToken

func GenerateToken(agentID string) string

GenerateToken returns a bearer token in "<agent-id>:<48-hex-secret>" format.

func InjectCompiledModelPolicy added in v0.4.3

func InjectCompiledModelPolicy(meta map[string]any, models map[string]string) map[string]any

InjectCompiledModelPolicy clones meta and attaches a compiled model_policy block when the agent declares any MODEL refs.

func ProxyBaseURL added in v0.2.0

func ProxyBaseURL(proxyType string) string

ProxyBaseURL returns the API base URL for a proxy inside the compose network.

func ProxyHealthcheckBinary added in v0.2.0

func ProxyHealthcheckBinary(proxyType string) string

ProxyHealthcheckBinary returns the binary path used by compose healthchecks.

func ProxyImageRef added in v0.2.0

func ProxyImageRef(proxyType string) string

ProxyImageRef returns the default image reference for a proxy type. Passthrough uses the consolidated "ghcr.io/mostlydev/cllama:latest" image.

func ProxyServiceName added in v0.2.0

func ProxyServiceName(proxyType string) string

ProxyServiceName returns the compose service name for a proxy type. Passthrough is the canonical default and maps to "cllama".

func ProxyType added in v0.2.0

func ProxyType(proxyType string) string

ProxyType normalizes a proxy type token.

Types

type AgentContextInput

type AgentContextInput struct {
	AgentID     string
	AgentsMD    string
	ClawdapusMD string
	Metadata    map[string]interface{}
	Feeds       []FeedManifestEntry
	Tools       []ToolManifestEntry
	Memory      *MemoryManifestEntry
	ServiceAuth []ServiceAuthEntry
}

type AllowedModel added in v0.4.3

type AllowedModel struct {
	Slot string `json:"slot"`
	Ref  string `json:"ref"`
}

type AuthEntry added in v0.5.0

type AuthEntry struct {
	Type  string `json:"type"`
	Token string `json:"token,omitempty"`
}

type FeedManifestEntry added in v0.3.1

type FeedManifestEntry struct {
	Name   string `json:"name"`
	Source string `json:"source"`
	Path   string `json:"path"`
	TTL    int    `json:"ttl"`
	URL    string `json:"url,omitempty"`
	Auth   string `json:"auth,omitempty"` // bearer token for authenticated feeds (e.g. claw-api)
}

type MemoryManifestEntry added in v0.5.0

type MemoryManifestEntry struct {
	Version int        `json:"version"`
	Service string     `json:"service"`
	BaseURL string     `json:"base_url"`
	Recall  *MemoryOp  `json:"recall,omitempty"`
	Retain  *MemoryOp  `json:"retain,omitempty"`
	Forget  *MemoryOp  `json:"forget,omitempty"`
	Auth    *AuthEntry `json:"auth,omitempty"`
}

type MemoryOp added in v0.5.0

type MemoryOp struct {
	Path      string `json:"path"`
	TimeoutMS int    `json:"timeout_ms,omitempty"`
}

type ModelPolicy added in v0.4.3

type ModelPolicy struct {
	Mode    string         `json:"mode"`
	Allowed []AllowedModel `json:"allowed"`
}

func CompileModelPolicy added in v0.4.3

func CompileModelPolicy(models map[string]string) *ModelPolicy

CompileModelPolicy builds a deterministic per-agent model policy from resolved MODEL directives. Empty refs are ignored. When no valid refs remain, nil is returned and no policy should be emitted.

type ServiceAuthEntry added in v0.3.1

type ServiceAuthEntry struct {
	Service   string `json:"service"`
	AuthType  string `json:"auth_type"`
	Token     string `json:"token,omitempty"`
	Principal string `json:"principal,omitempty"`
}

type ToolExecution added in v0.5.0

type ToolExecution struct {
	Transport string     `json:"transport"`
	Service   string     `json:"service"`
	BaseURL   string     `json:"base_url"`
	Method    string     `json:"method"`
	Path      string     `json:"path"`
	BodyKey   string     `json:"body_key,omitempty"`
	Auth      *AuthEntry `json:"auth,omitempty"`
}

type ToolManifest added in v0.5.0

type ToolManifest struct {
	Version int                 `json:"version"`
	Tools   []ToolManifestEntry `json:"tools"`
	Policy  ToolPolicy          `json:"policy"`
}

type ToolManifestEntry added in v0.5.0

type ToolManifestEntry struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
	Annotations map[string]interface{} `json:"annotations,omitempty"`
	Execution   ToolExecution          `json:"execution"`
}

type ToolPolicy added in v0.5.0

type ToolPolicy struct {
	MaxRounds        int `json:"max_rounds"`
	TimeoutPerToolMS int `json:"timeout_per_tool_ms"`
	TotalTimeoutMS   int `json:"total_timeout_ms"`
}

Jump to

Keyboard shortcuts

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