Documentation
¶
Index ¶
- func BuildNanoclawConfig(proxyBaseURL, proxyToken, assistantName string, ...) string
- func BuildOpenclawConfig(proxyBaseURL, proxyToken, gatewayToken string, weixinEnabled bool, ...) string
- func BuildOpencodeConfig(baseConfig, apiKey, overrideBaseURL string) string
- func ExtractProxyBaseURL(configJSON string) string
- type Config
- type Manager
- func (m *Manager) CleanOrphans(knownSandboxNames []string, namespaces []string)
- func (m *Manager) Close() error
- func (m *Manager) ExecSimple(ctx context.Context, sandboxID string, command []string) (string, error)
- func (m *Manager) Get(id string) (process.Process, bool)
- func (m *Manager) Pause(id string) error
- func (m *Manager) Resume(id, sandboxName, command string, args []string) (process.Process, error)
- func (m *Manager) ResumeContainer(id string) error
- func (m *Manager) ResumeContainerWithIP(id string) (string, error)
- func (m *Manager) Start(id, command string, args, env []string, opts process.StartOptions) (process.Process, error)
- func (m *Manager) StartContainer(id string, opts process.StartOptions) error
- func (m *Manager) StartContainerWithIP(id string, opts process.StartOptions) (string, error)
- func (m *Manager) Stop(id string) error
- func (m *Manager) StopBySandboxName(namespace, sandboxName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildNanoclawConfig ¶ added in v0.26.0
func BuildNanoclawConfig(proxyBaseURL, proxyToken, assistantName string, weixinBridgeURL, bridgeSecret string, byokBaseURL, byokAPIKey string) string
BuildNanoclawConfig returns the environment variable content for a nanoclaw container. When byokBaseURL and byokAPIKey are non-empty (BYOK mode), they override the default proxy credentials.
func BuildOpenclawConfig ¶
func BuildOpenclawConfig(proxyBaseURL, proxyToken, gatewayToken string, weixinEnabled bool, customModels []process.LLMModel) string
BuildOpenclawConfig returns the openclaw.json content with gateway settings and optional Anthropic proxy credentials. The gatewayToken is written into gateway.auth.token so that the gateway and Control UI share the same secret; without this, OpenClaw v2026.3.12+ auto-generates a random token on startup that won't match the token our proxy injects.
func BuildOpencodeConfig ¶ added in v0.13.0
BuildOpencodeConfig merges the per-sandbox proxy token into the base opencode config JSON. When overrideBaseURL is non-empty (BYOK mode), it also replaces provider.anthropic.options.baseURL.
func ExtractProxyBaseURL ¶ added in v0.13.0
ExtractProxyBaseURL extracts provider.anthropic.options.baseURL from the opencode config JSON. Used by sandbox managers that need the proxy URL (e.g. for openclaw config).
Types ¶
type Config ¶
type Config struct {
AgentserverNamespace string
Image string
SessionStorageSize string
StorageClassName string
RuntimeClassName string
OpencodePort int
OpencodeConfigContent string // JSON config injected via OPENCODE_CONFIG_CONTENT
OpenclawImage string
OpenclawPort int
OpenclawRuntimeClassName string
OpenclawWeixinEnabled bool
NanoclawImage string
NanoclawRuntimeClassName string
NanoclawWeixinEnabled bool
NanoclawBridgeBaseURL string // agentserver internal URL for NanoClaw pods to call back (e.g. "http://agentserver:8080")
}
Config holds configuration for the K8s sandbox backend.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config populated from environment variables with sensible defaults.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages Sandbox CRs and remotecommand exec sessions.
func NewManager ¶
NewManager creates a sandbox Manager using in-cluster or KUBECONFIG config.
func (*Manager) CleanOrphans ¶
CleanOrphans deletes Sandbox CRs labelled managed-by=agentserver that are NOT in the known set. It iterates all provided workspace namespaces.
func (*Manager) ExecSimple ¶ added in v0.22.0
func (m *Manager) ExecSimple(ctx context.Context, sandboxID string, command []string) (string, error)
ExecSimple runs a command in a sandbox pod and returns its stdout. It is a one-shot exec (no stdin/TTY) intended for short-lived commands like writing config files or restarting a gateway.
func (*Manager) Resume ¶
Resume scales the sandbox back to 1, waits for ready, and starts a new exec.
func (*Manager) ResumeContainer ¶
ResumeContainer scales a paused sandbox back to 1 replica and waits for it to be ready, without starting an exec session (the sidecar handles exec). Returns the pod IP.
func (*Manager) ResumeContainerWithIP ¶
ResumeContainerWithIP scales a paused sandbox back to 1 replica and returns the pod IP.
func (*Manager) StartContainer ¶
func (m *Manager) StartContainer(id string, opts process.StartOptions) error
StartContainer for K8s sandbox creates the Sandbox CR and waits for it to be ready. Returns the pod IP for agent server communication.
func (*Manager) StartContainerWithIP ¶
StartContainerWithIP creates/starts the sandbox and returns the pod IP.
func (*Manager) StopBySandboxName ¶
StopBySandboxName deletes a Sandbox CR by its name in the given namespace.