openclaw

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackupWalletCmd added in v0.8.1

func BackupWalletCmd(cfg *config.Config, id string, opts BackupWalletOptions, u *ui.UI) error

BackupWallet creates a backup of the wallet for the given instance.

func CLI

func CLI(cfg *config.Config, id string, args []string, u *ui.UI) error

CLI runs an openclaw CLI command against a deployed instance. Commands that support --url/--token are executed locally with a port-forward; others are executed via kubectl exec into the pod.

func Dashboard

func Dashboard(cfg *config.Config, id string, opts DashboardOptions, onReady func(url string), u *ui.UI) error

Dashboard port-forwards to the OpenClaw instance and opens the web dashboard. The onReady callback is invoked with the dashboard URL; the CLI layer uses it to open a browser.

func Delete

func Delete(cfg *config.Config, id string, force bool, u *ui.UI) error

Delete removes an OpenClaw instance

func DeploymentPath added in v0.8.1

func DeploymentPath(cfg *config.Config, id string) string

DeploymentPath returns the path to a deployment directory.

func FindInstancesWithWallets added in v0.8.1

func FindInstancesWithWallets(cfg *config.Config) []string

FindInstancesWithWallets returns instance IDs that have wallet metadata.

func ImageRef added in v0.8.1

func ImageRef() string

ImageRef returns the pinned OpenClaw image reference used by the local binary when it writes overlay values. Empty string means no explicit ref.

func KeystoreVolumePath added in v0.8.1

func KeystoreVolumePath(cfg *config.Config, id string) string

KeystoreVolumePath returns the host-side path where the remote-signer's PVC stores keystores. This follows the local-path-provisioner pattern: $DATA_DIR/<namespace>/<pvc-name>/

func List

func List(cfg *config.Config, u *ui.UI) error

func ListInstanceIDs

func ListInstanceIDs(cfg *config.Config) ([]string, error)

ListInstanceIDs returns the IDs of all installed OpenClaw instances by reading the deployment directories on disk.

func ListWallets added in v0.8.1

func ListWallets(cfg *config.Config, id string, u *ui.UI) error

ListWallets displays wallet information for one or all instances.

func Onboard

func Onboard(cfg *config.Config, opts OnboardOptions, u *ui.UI) error

Onboard creates and optionally deploys an OpenClaw instance

func PrintImportSummary

func PrintImportSummary(result *ImportResult)

PrintImportSummary prints a human-readable summary of detected config

func PromptBackupBeforePurge added in v0.8.1

func PromptBackupBeforePurge(cfg *config.Config, u *ui.UI)

PromptBackupBeforePurge checks for wallets and offers to back them up. Non-interactive (piped/scripted): prints a warning but does not block.

func RegenerateToken added in v0.8.1

func RegenerateToken(cfg *config.Config, id string, u *ui.UI) (string, error)

RegenerateToken restarts the OpenClaw pod to generate a new gateway token, then retrieves and returns the new token.

func ResolveInstance

func ResolveInstance(cfg *config.Config, args []string) (id string, remaining []string, err error)

ResolveInstance determines which OpenClaw instance to target based on how many instances are installed:

  • 0 instances: returns an error prompting the user to create one
  • 1 instance: auto-selects it, returns args unchanged
  • 2+ instances: expects args[0] to be a known instance name; consumes it from args and returns the rest. Errors if no match.

func ResolveInstanceNamespace added in v0.8.1

func ResolveInstanceNamespace(cfg *config.Config) (string, error)

ResolveInstanceNamespace returns the Kubernetes namespace of the single OpenClaw instance. This is needed for port-forwarding to the remote-signer.

func ResolveWalletAddress added in v0.8.1

func ResolveWalletAddress(cfg *config.Config) (string, error)

ResolveWalletAddress returns the wallet address from the single OpenClaw instance's remote-signer. It follows the same convention as ResolveInstance:

  • 0 instances: error
  • 1 instance: returns its wallet address
  • 2+ instances: error listing available addresses

func RestoreWalletCmd added in v0.8.1

func RestoreWalletCmd(cfg *config.Config, id string, opts RestoreWalletOptions, u *ui.UI) error

RestoreWalletCmd restores a wallet from a backup file.

func Setup

func Setup(cfg *config.Config, id string, _ SetupOptions, u *ui.UI) error

Setup reconfigures model providers for a deployed OpenClaw instance. It runs the interactive provider prompt, regenerates the overlay values, and syncs via helmfile so the pod picks up the new configuration.

func SetupDefault

func SetupDefault(cfg *config.Config, u *ui.UI) error

SetupDefault deploys the default OpenClaw instance as part of stack setup. This is the single canonical instance that handles both user-facing inference and agent-mode monetize/heartbeat reconciliation. It is idempotent: if a "default" deployment already exists, it re-syncs. When Ollama is not detected on the host and no existing ~/.openclaw config is found, it skips provider setup gracefully so the user can configure later with `obol openclaw setup`.

func SkillAdd

func SkillAdd(cfg *config.Config, id string, args []string, u *ui.UI) error

SkillAdd adds a skill to a deployed OpenClaw instance by running the native openclaw CLI inside the pod via kubectl exec.

func SkillList

func SkillList(cfg *config.Config, id string, u *ui.UI) error

SkillList lists skills installed on a deployed OpenClaw instance by running the native openclaw CLI inside the pod via kubectl exec.

func SkillRemove

func SkillRemove(cfg *config.Config, id string, args []string, u *ui.UI) error

SkillRemove removes a skill from a deployed OpenClaw instance by running the native openclaw CLI inside the pod via kubectl exec.

func SkillsSync

func SkillsSync(cfg *config.Config, id, skillsDir string, u *ui.UI) error

SkillsSync copies a local skills directory to the host-side PVC path that maps to /data/.openclaw/skills/ inside the OpenClaw container. OpenClaw's file watcher detects changes automatically — no pod restart needed.

func Sync

func Sync(cfg *config.Config, id string, u *ui.UI) error

Sync deploys or updates an OpenClaw instance

func SyncOverlayModels added in v0.8.1

func SyncOverlayModels(cfg *config.Config, models []string, u *ui.UI) error

SyncOverlayModels updates all deployed OpenClaw instances to match the current LiteLLM model list. For each LiteLLM-routed instance it:

  1. Patches the overlay YAML model list (for helm consistency)
  2. Writes a clean per-agent models.json to the host PVC
  3. Patches the openclaw-config ConfigMap with the best primary model

Cloud models are promoted to primary (they're added because they're better than local defaults). The previous primary becomes a fallback.

func Token

func Token(cfg *config.Config, id string, u *ui.UI) error

Token retrieves the gateway token for an OpenClaw instance and prints it.

func TranslateToOverlayYAML

func TranslateToOverlayYAML(result *ImportResult) string

TranslateToOverlayYAML maps imported config fields to chart values YAML fragment. The returned string is appended to the base overlay.

func WriteWalletMetadata added in v0.8.1

func WriteWalletMetadata(deploymentDir string, wallet *WalletInfo) error

WriteWalletMetadata writes the wallet address and UUID to a JSON file in the deployment directory for re-sync and display purposes.

Types

type BackupFile added in v0.8.1

type BackupFile struct {
	Version  int            `json:"version"`
	Instance string         `json:"instance"`
	Wallets  []BackupWallet `json:"wallets"`
}

BackupFile is the JSON structure of a wallet backup.

type BackupWallet added in v0.8.1

type BackupWallet struct {
	Address          string          `json:"address"`
	PublicKey        string          `json:"publicKey"`
	KeystoreUUID     string          `json:"keystoreUUID"`
	CreatedAt        string          `json:"createdAt"`
	Keystore         json.RawMessage `json:"keystore"`
	KeystorePassword string          `json:"keystorePassword"`
}

BackupWallet holds a single wallet's backup data.

type BackupWalletOptions added in v0.8.1

type BackupWalletOptions struct {
	Output      string // Output file path (empty = auto-generate)
	Passphrase  string // Encryption passphrase (empty = no encryption)
	HasPassFlag bool   // Whether --passphrase was explicitly set
}

BackupWalletOptions holds options for the backup command.

type CloudProviderInfo

type CloudProviderInfo struct {
	Name    string // "anthropic" or "openai"
	APIKey  string
	ModelID string // e.g. "claude-sonnet-4-5-20250929"
	Display string // e.g. "Claude Sonnet 4.5"
}

CloudProviderInfo holds the cloud provider selection from interactive setup. This is used to configure LiteLLM with the API key separately from the OpenClaw overlay (which routes through LiteLLM).

type DashboardOptions

type DashboardOptions struct {
	Port      int
	NoBrowser bool
}

DashboardOptions contains options for the dashboard command.

type ImportResult

type ImportResult struct {
	Providers    []ImportedProvider
	AgentModel   string
	Channels     ImportedChannels
	WorkspaceDir string // path to ~/.openclaw/workspace/ if it exists and contains marker files
}

ImportResult holds the parsed configuration from ~/.openclaw/openclaw.json

func DetectExistingConfig

func DetectExistingConfig() (*ImportResult, error)

DetectExistingConfig checks for ~/.openclaw/openclaw.json and parses it. Returns nil (not an error) if the file does not exist.

type ImportedChannels

type ImportedChannels struct {
	Telegram *ImportedTelegram
	Discord  *ImportedDiscord
	Slack    *ImportedSlack
}

ImportedChannels holds detected channel configurations

type ImportedDiscord

type ImportedDiscord struct {
	BotToken string
}

ImportedDiscord holds Discord bot config

type ImportedModel

type ImportedModel struct {
	ID   string
	Name string
}

ImportedModel represents a model entry

type ImportedProvider

type ImportedProvider struct {
	Name         string
	BaseURL      string
	API          string
	APIKey       string // literal only; empty if env-var reference
	APIKeyEnvVar string // env var name for apiKey interpolation (e.g. OLLAMA_API_KEY)
	Models       []ImportedModel
	Disabled     bool // when true, emit only enabled: false (used to override chart defaults)
}

ImportedProvider represents a model provider extracted from openclaw.json

type ImportedSlack

type ImportedSlack struct {
	BotToken string
	AppToken string
}

ImportedSlack holds Slack bot config

type ImportedTelegram

type ImportedTelegram struct {
	BotToken string
}

ImportedTelegram holds Telegram bot config

type OnboardOptions

type OnboardOptions struct {
	ID           string   // Deployment ID (empty = generate petname)
	Force        bool     // Overwrite existing deployment
	Sync         bool     // Also run helmfile sync after install
	Interactive  bool     // true = prompt for provider choice; false = silent defaults
	IsDefault    bool     // true = use fixed ID "default", idempotent on re-run
	AgentMode    bool     // true = obol-agent singleton with heartbeat config
	OllamaModels []string // Available Ollama models detected on host (nil = not queried)
}

OnboardOptions contains options for the onboard command

type RestoreWalletOptions added in v0.8.1

type RestoreWalletOptions struct {
	Input       string // Input file path
	Passphrase  string // Decryption passphrase
	HasPassFlag bool   // Whether --passphrase was explicitly set
	Force       bool   // Overwrite existing wallet
}

RestoreWalletOptions holds options for the restore command.

type SetupOptions

type SetupOptions struct {
	Port int // kept for backward compat; currently unused
}

SetupOptions contains options for the setup command.

type WalletInfo added in v0.8.1

type WalletInfo struct {
	Address      string `json:"address"`       // 0x-prefixed Ethereum address
	PublicKey    string `json:"publicKey"`     // 0x-prefixed uncompressed public key (130 hex chars)
	KeystoreUUID string `json:"keystore_uuid"` // UUID of the V3 keystore file
	KeystorePath string `json:"keystore_path"` // Absolute host path to keystore JSON
	CreatedAt    string `json:"createdAt"`     // ISO 8601 timestamp
	Password     string `json:"-"`             // Keystore password (not serialized)
}

WalletInfo holds generated wallet metadata returned from GenerateWallet.

func GenerateWallet added in v0.8.1

func GenerateWallet(cfg *config.Config, id string, u *ui.UI) (*WalletInfo, error)

GenerateWallet creates a new secp256k1 signing key, encrypts it as a V3 keystore, and provisions it to the host-side PVC path for the remote-signer.

func ReadWalletMetadata added in v0.8.1

func ReadWalletMetadata(deploymentDir string) (*WalletInfo, error)

ReadWalletMetadata reads existing wallet metadata from the deployment directory.

Jump to

Keyboard shortcuts

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