Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package config loads and validates rocketclaw configuration files.

Index

Constants

View Source
const DefaultRuntimeDir = ".rocketclaw"

DefaultRuntimeDir is the generated runtime directory for rocketclaw configs.

Variables

This section is empty.

Functions

func LoadExternalMCPUsers

func LoadExternalMCPUsers(configPath string) (map[string]string, error)

LoadExternalMCPUsers reads the optional rocketclaw.users.json file next to configPath.

func LoadOneOffCronjob added in v0.1.17

func LoadOneOffCronjob(workspace, runtimeDir, target string) (protocol.OneOffCronjob, error)

LoadOneOffCronjob reads a current runtime definition without running it. The cron frontend adds its output-decision instruction to Prompt.

func SecretEnv added in v0.2.20

func SecretEnv(ctx context.Context, fetcher SecretFetcher, arns []string) (map[string]string, error)

SecretEnv fetches every secret in arns as environment variables: each holds a JSON object whose keys are variable names and whose values are strings, and a key may appear in one secret only.

Types

type AWSFetcher added in v0.0.46

type AWSFetcher struct {
	// contains filtered or unexported fields
}

AWSFetcher loads SecretString with the default AWS credential chain. It keeps one client per region, the chain's config loaded for that region, so fetches reuse its connections and cached credentials.

func (*AWSFetcher) SecretString added in v0.0.46

func (f *AWSFetcher) SecretString(ctx context.Context, arn string) (string, error)

SecretString fetches the current SecretString for arn.

type AttachmentDriver added in v0.1.0

type AttachmentDriver string

AttachmentDriver selects where immutable attachment originals are stored.

const (
	FilesystemAttachments AttachmentDriver = "filesystem"
	S3Attachments         AttachmentDriver = "s3"
)

FilesystemAttachments and S3Attachments select the supported original-file stores.

type AttachmentsConfig added in v0.1.0

type AttachmentsConfig struct {
	Driver    AttachmentDriver `json:"driver"`
	Path      string           `json:"path,omitempty"`
	BucketARN string           `json:"bucket_arn,omitempty"`
}

AttachmentsConfig selects an attachment directory or S3 bucket.

type Config

type Config struct {
	Workspace         string                            `json:"workspace"`
	DatabaseURL       string                            `json:"database_url"`
	Attachments       AttachmentsConfig                 `json:"attachments,omitzero"`
	WorkDir           string                            `json:"-"`
	Overlays          []string                          `json:"overlays,omitempty"`
	Web               WebConfig                         `json:"web,omitzero"`
	ServerDisplayName string                            `json:"server_display_name,omitempty"`
	Environment       []string                          `json:"environment,omitempty"`
	Logging           LoggingConfig                     `json:"logging"`
	MCPExternal       MCPExternalConfig                 `json:"mcp_external"`
	MCPServers        map[string]MCPServerConfig        `json:"mcp_servers,omitempty"`
	OpenCode          map[string]OpenCodeConfig         `json:"opencode,omitempty"`
	RocketClaws       map[string]RemoteRocketClawConfig `json:"rocketclaws,omitempty"`
	// TrustedRocketClaws are the https origins of the RocketClaw pages whose browsers may call this server's tailnet
	// address as the person on the connection; a page from any other origin gets no cross-site access.
	TrustedRocketClaws []string                `json:"trusted_rocketclaws,omitempty"`
	Slack              SlackConfig             `json:"slack"`
	OpenAI             OpenAIConfig            `json:"openai"`
	Providers          map[string]OpenAIConfig `json:"providers,omitempty"`
	AutoApproverModel  string                  `json:"auto_approver_model"`
	Instrumentation    InstrumentationConfig   `json:"instrumentation"`
	PostHog            PostHogConfig           `json:"posthog,omitzero"`
}

Config is the top-level rocketclaw runtime configuration.

func Load

func Load(configPath, secretsARN string, fetcher SecretFetcher) (*Config, error)

Load reads, normalizes, and validates the rocketclaw configuration file.

func (*Config) AttachmentLocation added in v0.1.0

func (c *Config) AttachmentLocation() (AttachmentDriver, string, error)

AttachmentLocation validates storage configuration and resolves its directory or bucket name.

func (*Config) MCPToolGroups added in v0.2.20

func (c *Config) MCPToolGroups() map[string]map[string][]string

MCPToolGroups returns every MCP server's tool groups keyed by group name.

func (*Config) Provider added in v0.0.42

func (c *Config) Provider(name string) (OpenAIConfig, bool)

Provider returns the default or named provider configuration.

func (*Config) ProviderNames added in v0.2.20

func (c *Config) ProviderNames() []string

ProviderNames returns every configured model provider name, openai included.

func (*Config) RuntimeDirName added in v0.0.25

func (c *Config) RuntimeDirName() string

RuntimeDirName returns the selected generated runtime directory name.

func (*Config) Validate

func (c *Config) Validate() error

Validate verifies the configuration is usable.

type CronSchedule added in v0.1.17

type CronSchedule struct {
	Raw   string
	DueAt time.Time
	// contains filtered or unexported fields
}

CronSchedule is a timestamp, duration, or cron cadence from a runtime asset.

func ParseCronDefinition added in v0.1.17

func ParseCronDefinition(data []byte, relativePath string) (protocol.OneOffCronjob, []CronSchedule, error)

ParseCronDefinition validates a cron asset and returns its prompt and schedules.

func ParseCronSchedule added in v0.2.20

func ParseCronSchedule(raw string) (CronSchedule, error)

ParseCronSchedule parses one cron-file schedule: a 5-field cron, a Go duration, an @shortcut, or an RFC 3339 time.

func (CronSchedule) Next added in v0.1.17

func (s CronSchedule) Next(now time.Time) time.Time

Next returns the next occurrence of a recurring schedule after now.

type InstrumentationConfig added in v0.0.12

type InstrumentationConfig struct {
	Enabled           bool   `json:"enabled"`
	CollectorEndpoint string `json:"collector_endpoint"`
	ProjectName       string `json:"project_name"`
	APIKey            string `json:"api_key"`
	HideInputs        bool   `json:"hide_inputs"`
	HideOutputs       bool   `json:"hide_outputs"`
}

InstrumentationConfig configures OpenTelemetry/OpenInference tracing.

type LockedConfig added in v0.1.23

type LockedConfig struct {
	// contains filtered or unexported fields
}

LockedConfig owns configuration and serializes work that depends on its runtime assets. A LockedConfig must not be copied after first use.

func NewLockedConfig added in v0.1.23

func NewLockedConfig(cfg *Config) *LockedConfig

NewLockedConfig stores an independent copy of cfg.

func (*LockedConfig) Clone added in v0.1.23

func (c *LockedConfig) Clone() *Config

Clone returns an independent configuration snapshot.

func (*LockedConfig) Do added in v0.1.23

func (c *LockedConfig) Do(work func(cfg *Config) error) error

Do holds the lock throughout work. work must not retain cfg or its mutable fields, or call Store, Clone, or Do on c.

func (*LockedConfig) Store added in v0.1.23

func (c *LockedConfig) Store(cfg *Config)

Store replaces the configuration with an independent copy.

type LoggingConfig

type LoggingConfig struct {
	Level string `json:"level"`
}

LoggingConfig controls rocketclaw logging.

type MCPExternalConfig

type MCPExternalConfig struct {
	Enabled    bool   `json:"enabled"`
	ListenAddr string `json:"listen_addr"`
}

MCPExternalConfig configures the persistent external MCP HTTP server.

type MCPServerConfig added in v0.0.45

type MCPServerConfig struct {
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	Cwd     string            `json:"cwd,omitempty"`
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
	Tools   MCPToolGroups     `json:"tools,omitzero"`
}

MCPServerConfig configures one outbound MCP server for code mode.

type MCPToolGroups added in v0.2.20

type MCPToolGroups struct {
	Read  []string `json:"read,omitempty"`
	Write []string `json:"write,omitempty"`
}

MCPToolGroups lists one server's read and write tool-name patterns, the groups easy agents select.

type OpenAIConfig

type OpenAIConfig struct {
	APIKey     string `json:"api_key"`
	APIBaseURL string `json:"api_base_url"`
	Auth       string `json:"auth"`
	// LegacyAuth is the old name of Auth, read when Auth is unset.
	LegacyAuth              string `json:"rocketcode_auth,omitempty"`
	AutocompactionThreshold int64  `json:"autocompaction_threshold,omitempty"`
	// PromptCacheMarkersRelativePosition, when set, marks the text piece at this
	// negative index of the last request message with an Anthropic cache_control.
	PromptCacheMarkersRelativePosition *int `json:"prompt_cache_markers_relative_position,omitempty"`
}

OpenAIConfig configures the OpenAI client used by the agent harness.

type OpenCodeConfig added in v0.1.47

type OpenCodeConfig struct {
	URL      string `json:"url"`
	Password string `json:"password"`
}

OpenCodeConfig names one remote OpenCode server the Web lists and proxies under /oc/{name}/.

type PostHogConfig added in v0.2.13

type PostHogConfig struct {
	ProjectToken string `json:"project_token,omitempty"`
	Host         string `json:"host,omitempty"`
}

PostHogConfig sends log events, errors, and browser sessions to PostHog Cloud when ProjectToken is set, and traces too while instrumentation is enabled. The project token is public: the browser receives it.

type RemoteRocketClawConfig added in v0.2.19

type RemoteRocketClawConfig struct {
	URL string `json:"url"`
}

RemoteRocketClawConfig names another RocketClaw whose chats the Web page lists and operates. URL is the remote's tsnet HTTPS origin, which the browser calls directly.

type SecretFetchError added in v0.0.46

type SecretFetchError struct {
	ARN string
	Key string
	// contains filtered or unexported fields
}

SecretFetchError names the ARN and key of a failed fetch. It never includes the secret body.

func (*SecretFetchError) Error added in v0.0.46

func (e *SecretFetchError) Error() string

func (*SecretFetchError) Unwrap added in v0.0.46

func (e *SecretFetchError) Unwrap() error

type SecretFetcher added in v0.0.46

type SecretFetcher interface {
	SecretString(ctx context.Context, arn string) (string, error)
}

SecretFetcher returns a Secrets Manager SecretString.

type SentryConfig added in v0.1.16

type SentryConfig struct {
	DSN              string   `json:"dsn,omitempty"`
	Environment      string   `json:"environment,omitempty"`
	TracesSampleRate *float64 `json:"traces_sample_rate,omitempty"`
}

SentryConfig contains only public browser tracing settings, never an auth token.

type SlackChannelConfig added in v0.0.33

type SlackChannelConfig struct {
	Channel        string   `json:"channel"`
	Agents         []string `json:"agents,omitempty"`
	AllowedUserIDs []string `json:"allowed_user_ids,omitempty"`
}

SlackChannelConfig configures one Slack channel.

type SlackConfig

type SlackConfig struct {
	BotToken string               `json:"bot_token"`
	AppToken string               `json:"app_token"`
	Channels []SlackChannelConfig `json:"channels,omitempty"`
}

SlackConfig configures Slack channel conversations.

func (SlackConfig) Channel added in v0.1.0

func (s SlackConfig) Channel(name string) (SlackChannelConfig, bool)

Channel returns the configured Slack channel with this name.

type TsnetConfig added in v0.1.30

type TsnetConfig struct {
	Hostname string   `json:"hostname,omitempty"`
	Tags     []string `json:"tags,omitempty"`
	// AuthKey logs the node in without a login link; it is used only while the node is logged out.
	AuthKey string `json:"auth_key,omitempty"`
	// Origin is the node's HTTPS origin, set at runtime once it serves.
	Origin string `json:"-"`
}

TsnetConfig runs an embedded Tailscale node serving the Web over tailnet HTTPS. Its auth key comes only from TS_AUTHKEY, never from config.

type WebConfig added in v0.1.0

type WebConfig struct {
	ListenAddress string `json:"listen_address,omitempty"`
	// TLSCertFile and TLSKeyFile are the PEM certificate and key the listen_address listener serves
	// HTTPS with. Without them it serves a self-signed certificate made at each start.
	TLSCertFile string       `json:"tls_cert_file,omitempty"`
	TLSKeyFile  string       `json:"tls_key_file,omitempty"`
	Sentry      SentryConfig `json:"sentry,omitzero"`
	Tsnet       *TsnetConfig `json:"tsnet,omitempty"`
}

WebConfig controls the Web listener and conversation presentation.

Jump to

Keyboard shortcuts

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