config

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 18 Imported by: 1

Documentation

Overview

Package config

Example: Using Security Configuration

## Overview

The security configuration feature allows you to separate sensitive data (API keys, tokens, secrets, passwords) from your main configuration. The system automatically loads values from `.security.yml` and applies them to the corresponding fields in your config.

**Key Points:** - Values from `.security.yml` are automatically mapped to config fields - No `ref:` syntax is needed - just omit sensitive fields from config.json - If a field exists in both files, `.security.yml` value takes precedence - You can mix direct values in config.json with security values

## 1. Create .security.yml

File: ~/.picoclaw/.security.yml

```yaml # Model API Keys # All models MUST use 'api_keys' (plural) array format # Even a single key must be provided as an array with one element model_list:

gpt-5.4:
  api_keys:
    - "sk-proj-your-actual-openai-key-1"
    - "sk-proj-your-actual-openai-key-2"  # Optional: Multiple keys for failover
claude-sonnet-4.6:
  api_keys:
    - "sk-ant-your-actual-anthropic-key"  # Single key in array format

# Channel Tokens channels:

telegram:
  token: "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz"
discord:
  token: "your-discord-bot-token"

# Web Tool Keys # Brave, Tavily, Perplexity: Use 'api_keys' array # GLMSearch, BaiduSearch: Use 'api_key' single string web:

brave:
  api_keys:
    - "BSAyour-brave-api-key-1"
    - "BSAyour-brave-api-key-2"  # Optional: Multiple keys for failover
tavily:
  api_keys:
    - "tvly-your-tavily-api-key"  # Single key in array format
perplexity:
  api_keys:
    - "pplx-your-perplexity-api-key"  # Single key in array format
glm_search:
  api_key: "your-glm-search-api-key"  # Single key (not array)
baidu_search:
  api_key: "your-baidu-search-api-key"  # Single key (not array)

```

## 2. Simplify config.json

File: ~/.picoclaw/config.json

Note: Sensitive fields are omitted because they're loaded from .security.yml

```json

{
  "version": 1,
  "agents": {
    "defaults": {
      "workspace": "~/picoclaw-workspace",
      "model_name": "gpt-5.4"
    }
  },
  "model_list": [
    {
      "model_name": "gpt-5.4",
      "model": "openai/gpt-5.4",
      "api_base": "https://api.openai.com/v1"
      // api_key is automatically loaded from .security.yml
    },
    {
      "model_name": "claude-sonnet-4.6",
      "model": "anthropic/claude-sonnet-4.6",
      "api_base": "https://api.anthropic.com/v1"
      // api_key is automatically loaded from .security.yml
    }
  ],
  "channels": {
    "telegram": {
      "enabled": true
      // token is automatically loaded from .security.yml
    },
    "discord": {
      "enabled": true
      // token is automatically loaded from .security.yml
    }
  },
  "tools": {
    "web": {
      "brave": {
        "enabled": true
        // api_key is automatically loaded from .security.yml
      },
      "tavily": {
        "enabled": true
        // api_key is automatically loaded from .security.yml
      },
      "glm_search": {
        "enabled": true
        // api_key is automatically loaded from .security.yml
      },
      "baidu_search": {
        "enabled": true
        // api_key is automatically loaded from .security.yml
      }
    }
  }
}

```

## 3. Set proper permissions

```bash chmod 600 ~/.picoclaw/.security.yml ```

## 4. Add to .gitignore

```gitignore # Security configuration .security.yml ```

## 5. Verify it works

```bash picoclaw --version ```

Supported Fields in .security.yml

## Model API Keys

All models MUST use the `api_keys` (plural) array format in .security.yml.

```yaml model_list:

<model_name>:
  api_keys:
    - "key-1"
    - "key-2"  # Optional: Multiple keys for failover

```

Examples: ```yaml model_list:

gpt-5.4:
  api_keys:
    - "sk-proj-key-1"
    - "sk-proj-key-2"
claude-sonnet-4.6:
  api_keys:
    - "sk-ant-key"

```

**Important:** - Always use `api_keys` (plural) for models - Even a single key must be in an array format - The model_name in .security.yml must match the model_name in config.json

## Channel Tokens/Secrets

```yaml channels:

telegram:
  token: "value"
feishu:
  app_secret: "value"
  encrypt_key: "value"
  verification_token: "value"
discord:
  token: "value"
weixin:
  token: "value"
qq:
  app_secret: "value"
dingtalk:
  client_secret: "value"
slack:
  bot_token: "value"
  app_token: "value"
matrix:
  access_token: "value"
line:
  channel_secret: "value"
  channel_access_token: "value"
onebot:
  access_token: "value"
wecom:
  token: "value"
  encoding_aes_key: "value"
wecom_app:
  corp_secret: "value"
  token: "value"
  encoding_aes_key: "value"
wecom_aibot:
  secret: "value"
  token: "value"
  encoding_aes_key: "value"
pico:
  token: "value"
irc:
  password: "value"
  nickserv_password: "value"
  sasl_password: "value"

## Web Tool API Keys

**Brave, Tavily, Perplexity:** ```yaml web:

brave:
  api_keys:
    - "BSA-key-1"
    - "BSA-key-2"
tavily:
  api_keys:
    - "tvly-key"
perplexity:
  api_keys:
    - "pplx-key"

``` Use `api_keys` (plural) array format.

**GLMSearch, BaiduSearch:** ```yaml web:

glm_search:
  api_key: "your-glm-key"
baidu_search:
  api_key: "your-baidu-key"

``` Use `api_key` (singular) single string format.

## Skills Registry Tokens

```yaml skills:

github:
  token: "value"
clawhub:
  auth_token: "value"

```

Backward Compatibility

You can still use direct values in config.json if needed:

```json

{
  "model_list": [
    {
      "model_name": "local-model",
      "model": "ollama/llama3",
      "api_base": "http://localhost:11434/v1",
      "api_key": "ollama"  // Direct value (works fine)
    }
  ]
}

```

You can also mix security values and direct values:

```json

{
  "model_list": [
    {
      "model_name": "cloud-model",
      // api_key loaded from .security.yml
    },
    {
      "model_name": "local-model",
      "model": "ollama/llama3",
      "api_base": "http://localhost:11434/v1",
      "api_key": "ollama"  // Direct value
    }
  ]
}

```

**Priority Order:** 1. Environment variables (highest priority) 2. .security.yml values 3. config.json direct values (lowest priority)

Migration from Old Config

## Step 1: Backup your config ```bash cp ~/.picoclaw/config.json ~/.picoclaw/config.json.backup ```

## Step 2: Create .security.yml ```bash cp security.example.yml ~/.picoclaw/.security.yml ```

## Step 3: Fill in your API keys Edit ~/.picoclaw/.security.yml and replace placeholders with your actual keys.

## Step 4: Simplify config.json (Recommended) Remove sensitive fields from ~/.picoclaw/config.json: - `api_key` fields from model_list entries - `token` fields from channels - `api_key` fields from tools.web - `token`/`auth_token` fields from tools.skills

## Step 5: Set permissions ```bash chmod 600 ~/.picoclaw/.security.yml ```

## Step 6: Test ```bash picoclaw --version ```

If everything works, you can delete the backup: ```bash rm ~/.picoclaw/config.json.backup ```

Advanced Features

## Multiple API Keys (Load Balancing & Failover)

You can configure multiple API keys for models and web tools to enable: - **Load balancing**: Requests are distributed across multiple keys - **Failover**: If a key fails, the system automatically switches to another key - **Rate limit management**: Distribute usage across multiple keys - **High availability**: Reduce downtime during API provider issues

### Example: Model with Multiple Keys

**.security.yml:** ```yaml model_list:

gpt-5.4:
  api_keys:
    - "sk-proj-key-1"
    - "sk-proj-key-2"
    - "sk-proj-key-3"

```

**config.json:** ```json

{
  "model_list": [
    {
      "model_name": "gpt-5.4",
      "model": "openai/gpt-5.4",
      "api_base": "https://api.openai.com/v1"
    }
  ]
}

```

### Example: Web Tool with Multiple Keys

**.security.yml:** ```yaml web:

brave:
  api_keys:
    - "BSA-key-1"
    - "BSA-key-2"
tavily:
  api_keys:
    - "tvly-your-key"  # Single key in array format
glm_search:
  api_key: "your-glm-key"  # GLMSearch uses single key format

```

**config.json:** ```json

{
  "tools": {
    "web": {
      "brave": {
        "enabled": true
      },
      "tavily": {
        "enabled": true
      },
      "glm_search": {
        "enabled": true
      }
    }
  }
}

```

## Single Key Format

**Models, Brave, Tavily, Perplexity:** ```yaml model_list:

gpt-5.4:
  api_keys:
    - "sk-proj-your-key"  # Single key in array format

```

**GLMSearch, BaiduSearch:** ```yaml web:

glm_search:
  api_key: "your-glm-key"  # Single key (not array)

```

## Model Name Matching

The system supports intelligent model name matching in .security.yml:

### Example 1: Exact Match

**config.json:** ```json

{
  "model_name": "gpt-5.4:0"
}

```

**.security.yml (exact match with index):** ```yaml model_list:

gpt-5.4:0:
  api_keys: ["key-1"]

```

### Example 2: Base Name Match

**config.json:** ```json

{
  "model_name": "gpt-5.4:0"
}

```

**.security.yml (base name without index):** ```yaml model_list:

gpt-5.4:
  api_keys: ["key-1", "key-2"]

```

Both methods work. The base name match allows you to use simpler keys in .security.yml even when your config uses indexed model names for load balancing.

## Security File Permissions

The security file should have restricted permissions:

```bash chmod 600 ~/.picoclaw/.security.yml ```

This ensures only the owner can read and write the file.

Security Best Practices

1. Never commit .security.yml to version control 2. Add .security.yml to your .gitignore file 3. Set file permissions: chmod 600 ~/.picoclaw/.security.yml 4. Use different keys for different environments (dev, staging, production) 5. Rotate keys regularly and update .security.yml 6. Encrypt backups containing .security.yml 7. Review access regularly

Environment Variables

You can override any security value using environment variables:

```bash # Channels export PICOCLAW_CHANNELS_TELEGRAM_TOKEN="token-from-env" export PICOCLAW_CHANNELS_DISCORD_TOKEN="discord-token-from-env"

# Web Tools export PICOCLAW_TOOLS_WEB_BRAVE_API_KEY="brave-key-from-env" export PICOCLAW_TOOLS_WEB_BAIDU_API_KEY="baidu-key-from-env"

# Skills export PICOCLAW_TOOLS_SKILLS_GITHUB_TOKEN="github-token-from-env" ```

Environment variables have the highest priority and will override both config.json and .security.yml values.

Troubleshooting

## Error: "failed to load security config" - Ensure .security.yml exists in the same directory as config.json - Check YAML syntax is valid (use a YAML validator) - Verify file permissions allow reading

## Error: "model security entry not found" - Check that the model name in config.json matches exactly in .security.yml - Verify the model_list section exists in .security.yml - For indexed names (e.g., "gpt-5.4:0"), check both exact match and base name match - Ensure the YAML structure is correct (proper indentation)

## Multiple API Keys Not Working - Ensure you're using `api_keys` (plural) in .security.yml for models and web tools (except GLMSearch/BaiduSearch) - Check that the array format is correct in YAML (proper indentation with dashes) - Remember: Models, Brave, Tavily, Perplexity MUST use `api_keys` (array format) - GLMSearch and BaiduSearch MUST use `api_key` (single string format)

## Keys Not Being Applied - Check that .security.yml is in the same directory as config.json - Verify the file permissions allow reading (chmod 600 ~/.picoclaw/.security.yml) - Ensure the YAML structure matches the expected format - Check for typos in field names (case-sensitive) - Verify the model/channel names match exactly (case-sensitive)

## Load Balancing/Failover Issues - Verify all API keys in the api_keys array are valid - Check that all keys have the same rate limits and permissions - Monitor logs to see which keys are being used and failing - Ensure the api_keys array is properly formatted in YAML

Index

Constants

View Source
const (
	// EnvHome overrides the base directory for all picoclaw data
	// (config, workspace, skills, auth store, …).
	// Default: ~/.picoclaw
	EnvHome = "PICOCLAW_HOME"

	// EnvConfig overrides the full path to the JSON config file.
	// Default: $PICOCLAW_HOME/config.json
	EnvConfig = "PICOCLAW_CONFIG"

	// EnvBuiltinSkills overrides the directory from which built-in
	// skills are loaded.
	// Default: <cwd>/skills
	EnvBuiltinSkills = "PICOCLAW_BUILTIN_SKILLS"

	// EnvBinary overrides the path to the picoclaw executable.
	// Used by the web launcher when spawning the gateway subprocess.
	// Default: resolved from the same directory as the current executable.
	EnvBinary = "PICOCLAW_BINARY"

	// EnvGatewayHost overrides the host address for the gateway server.
	// Default: "127.0.0.1"
	EnvGatewayHost = "PICOCLAW_GATEWAY_HOST"
)

Runtime environment variable keys for the picoclaw process. These control the location of files and binaries at runtime and are read directly via os.Getenv / os.LookupEnv. All picoclaw-specific keys use the PICOCLAW_ prefix. Reference these constants instead of inline string literals to keep all supported knobs visible in one place and to prevent typos.

View Source
const CurrentVersion = 1

CurrentVersion is the latest config schema version

View Source
const DefaultMaxMediaSize = 20 * 1024 * 1024 // 20 MB
View Source
const (
	SecurityConfigFile = ".security.yml"
)

Variables

View Source
var (
	Version   = "dev" // Default value when not built with ldflags
	GitCommit string  // Git commit SHA (short)
	BuildTime string  // Build timestamp in RFC3339 format
	GoVersion string  // Go version used for building
)

Build-time variables injected via ldflags during build process. These are set by the Makefile or .goreleaser.yaml using the -X flag:

-X github.com/sipeed/picoclaw/pkg/config.Version=<version>
-X github.com/sipeed/picoclaw/pkg/config.GitCommit=<commit>
-X github.com/sipeed/picoclaw/pkg/config.BuildTime=<timestamp>
-X github.com/sipeed/picoclaw/pkg/config.GoVersion=<go-version>

Functions

func FormatBuildInfo added in v0.2.2

func FormatBuildInfo() (string, string)

FormatBuildInfo returns build time and go version info

func FormatVersion added in v0.2.2

func FormatVersion() string

FormatVersion returns the version string with optional git commit

func GetVersion added in v0.2.2

func GetVersion() string

GetVersion returns the version string

func MergeAPIKeys added in v0.2.2

func MergeAPIKeys(apiKey string, apiKeys []string) []string

func SaveConfig

func SaveConfig(path string, cfg *Config) error

Types

type AgentBinding added in v0.2.0

type AgentBinding struct {
	AgentID string       `json:"agent_id"`
	Match   BindingMatch `json:"match"`
}

type AgentConfig added in v0.2.0

type AgentConfig struct {
	ID        string            `json:"id"`
	Default   bool              `json:"default,omitempty"`
	Name      string            `json:"name,omitempty"`
	Workspace string            `json:"workspace,omitempty"`
	Model     *AgentModelConfig `json:"model,omitempty"`
	Skills    []string          `json:"skills,omitempty"`
	Subagents *SubagentsConfig  `json:"subagents,omitempty"`
}

type AgentDefaults

type AgentDefaults struct {
	Workspace                 string             `json:"workspace"                       env:"PICOCLAW_AGENTS_DEFAULTS_WORKSPACE"`
	RestrictToWorkspace       bool               `json:"restrict_to_workspace"           env:"PICOCLAW_AGENTS_DEFAULTS_RESTRICT_TO_WORKSPACE"`
	AllowReadOutsideWorkspace bool               `json:"allow_read_outside_workspace"    env:"PICOCLAW_AGENTS_DEFAULTS_ALLOW_READ_OUTSIDE_WORKSPACE"`
	Provider                  string             `json:"provider"                        env:"PICOCLAW_AGENTS_DEFAULTS_PROVIDER"`
	ModelName                 string             `json:"model_name"                      env:"PICOCLAW_AGENTS_DEFAULTS_MODEL_NAME"`
	ModelFallbacks            []string           `json:"model_fallbacks,omitempty"`
	ImageModel                string             `json:"image_model,omitempty"           env:"PICOCLAW_AGENTS_DEFAULTS_IMAGE_MODEL"`
	ImageModelFallbacks       []string           `json:"image_model_fallbacks,omitempty"`
	MaxTokens                 int                `json:"max_tokens"                      env:"PICOCLAW_AGENTS_DEFAULTS_MAX_TOKENS"`
	ContextWindow             int                `json:"context_window,omitempty"        env:"PICOCLAW_AGENTS_DEFAULTS_CONTEXT_WINDOW"`
	Temperature               *float64           `json:"temperature,omitempty"           env:"PICOCLAW_AGENTS_DEFAULTS_TEMPERATURE"`
	MaxToolIterations         int                `json:"max_tool_iterations"             env:"PICOCLAW_AGENTS_DEFAULTS_MAX_TOOL_ITERATIONS"`
	SummarizeMessageThreshold int                `json:"summarize_message_threshold"     env:"PICOCLAW_AGENTS_DEFAULTS_SUMMARIZE_MESSAGE_THRESHOLD"`
	SummarizeTokenPercent     int                `json:"summarize_token_percent"         env:"PICOCLAW_AGENTS_DEFAULTS_SUMMARIZE_TOKEN_PERCENT"`
	MaxMediaSize              int                `json:"max_media_size,omitempty"        env:"PICOCLAW_AGENTS_DEFAULTS_MAX_MEDIA_SIZE"`
	Routing                   *RoutingConfig     `json:"routing,omitempty"`
	SteeringMode              string             `json:"steering_mode,omitempty"         env:"PICOCLAW_AGENTS_DEFAULTS_STEERING_MODE"` // "one-at-a-time" (default) or "all"
	SubTurn                   SubTurnConfig      ``                                                                                    /* 144-byte string literal not displayed */
	ToolFeedback              ToolFeedbackConfig `json:"tool_feedback,omitempty"`
}

func (*AgentDefaults) GetMaxMediaSize added in v0.2.1

func (d *AgentDefaults) GetMaxMediaSize() int

func (*AgentDefaults) GetModelName added in v0.2.0

func (d *AgentDefaults) GetModelName() string

GetModelName returns the effective model name for the agent defaults. It prefers the new "model_name" field but falls back to "model" for backward compatibility.

func (*AgentDefaults) GetToolFeedbackMaxArgsLength added in v0.2.4

func (d *AgentDefaults) GetToolFeedbackMaxArgsLength() int

GetToolFeedbackMaxArgsLength returns the max args preview length for tool feedback messages.

func (*AgentDefaults) IsToolFeedbackEnabled added in v0.2.4

func (d *AgentDefaults) IsToolFeedbackEnabled() bool

IsToolFeedbackEnabled returns true when tool feedback messages should be sent to the chat.

type AgentModelConfig added in v0.2.0

type AgentModelConfig struct {
	Primary   string   `json:"primary,omitempty"`
	Fallbacks []string `json:"fallbacks,omitempty"`
}

AgentModelConfig supports both string and structured model config. String format: "gpt-4" (just primary, no fallbacks) Object format: {"primary": "gpt-4", "fallbacks": ["claude-haiku"]}

func (AgentModelConfig) MarshalJSON added in v0.2.0

func (m AgentModelConfig) MarshalJSON() ([]byte, error)

func (*AgentModelConfig) UnmarshalJSON added in v0.2.0

func (m *AgentModelConfig) UnmarshalJSON(data []byte) error

type AgentsConfig

type AgentsConfig struct {
	Defaults AgentDefaults `json:"defaults"`
	List     []AgentConfig `json:"list,omitempty"`
}

type BaiduSearchConfig added in v0.2.4

type BaiduSearchConfig struct {
	Enabled    bool   `json:"enabled"     env:"PICOCLAW_TOOLS_WEB_BAIDU_ENABLED"`
	BaseURL    string `json:"base_url"    env:"PICOCLAW_TOOLS_WEB_BAIDU_BASE_URL"`
	MaxResults int    `json:"max_results" env:"PICOCLAW_TOOLS_WEB_BAIDU_MAX_RESULTS"`
	// contains filtered or unexported fields
}

func (*BaiduSearchConfig) APIKey added in v0.2.4

func (c *BaiduSearchConfig) APIKey() string

APIKey returns the Baidu search API key

func (*BaiduSearchConfig) SetAPIKey added in v0.2.4

func (c *BaiduSearchConfig) SetAPIKey(key string)

type BaiduSearchSecurity added in v0.2.4

type BaiduSearchSecurity struct {
	APIKey string `yaml:"api_key,omitempty" env:"PICOCLAW_TOOLS_WEB_BAIDU_API_KEY"`
}

type BindingMatch added in v0.2.0

type BindingMatch struct {
	Channel   string     `json:"channel"`
	AccountID string     `json:"account_id,omitempty"`
	Peer      *PeerMatch `json:"peer,omitempty"`
	GuildID   string     `json:"guild_id,omitempty"`
	TeamID    string     `json:"team_id,omitempty"`
}

type BraveConfig added in v0.1.2

type BraveConfig struct {
	Enabled bool `json:"enabled"     env:"PICOCLAW_TOOLS_WEB_BRAVE_ENABLED"`

	MaxResults int `json:"max_results" env:"PICOCLAW_TOOLS_WEB_BRAVE_MAX_RESULTS"`
	// contains filtered or unexported fields
}

func (*BraveConfig) APIKey added in v0.1.2

func (c *BraveConfig) APIKey() string

APIKey returns the Brave API key

func (*BraveConfig) APIKeys added in v0.2.2

func (c *BraveConfig) APIKeys() []string

APIKeys returns the Brave API keys

func (*BraveConfig) SetAPIKey added in v0.2.4

func (c *BraveConfig) SetAPIKey(key string)

SetAPIKey sets the Brave API key

func (*BraveConfig) SetAPIKeys added in v0.2.4

func (c *BraveConfig) SetAPIKeys(keys []string)

SetAPIKeys sets the Brave API keys

type BraveSecurity added in v0.2.4

type BraveSecurity struct {
	APIKeys []string `yaml:"api_keys,omitempty"`
}

type BuildInfo added in v0.2.2

type BuildInfo struct {
	Version   string `json:"version"`
	GitCommit string `json:"git_commit"`
	BuildTime string `json:"build_time"`
	GoVersion string `json:"go_version"`
}

BuildInfo contains build-time version information

type BuiltinHookConfig added in v0.2.4

type BuiltinHookConfig struct {
	Enabled  bool            `json:"enabled"`
	Priority int             `json:"priority,omitempty"`
	Config   json.RawMessage `json:"config,omitempty"`
}

type ChannelsConfig

type ChannelsConfig struct {
	WhatsApp   WhatsAppConfig   `json:"whatsapp"`
	Telegram   TelegramConfig   `json:"telegram"`
	Feishu     FeishuConfig     `json:"feishu"`
	Discord    DiscordConfig    `json:"discord"`
	MaixCam    MaixCamConfig    `json:"maixcam"`
	QQ         QQConfig         `json:"qq"`
	DingTalk   DingTalkConfig   `json:"dingtalk"`
	Slack      SlackConfig      `json:"slack"`
	Matrix     MatrixConfig     `json:"matrix"`
	LINE       LINEConfig       `json:"line"`
	OneBot     OneBotConfig     `json:"onebot"`
	WeCom      WeComConfig      `json:"wecom"       envPrefix:"PICOCLAW_CHANNELS_WECOM_"`
	Weixin     WeixinConfig     `json:"weixin"`
	Pico       PicoConfig       `json:"pico"`
	PicoClient PicoClientConfig `json:"pico_client"`
	IRC        IRCConfig        `json:"irc"`
}

type ChannelsSecurity added in v0.2.4

type ChannelsSecurity struct {
	Telegram *TelegramSecurity `yaml:"telegram,omitempty"`
	Feishu   *FeishuSecurity   `yaml:"feishu,omitempty"`
	Discord  *DiscordSecurity  `yaml:"discord,omitempty"`
	Weixin   *WeixinSecurity   `yaml:"weixin,omitempty"`
	QQ       *QQSecurity       `yaml:"qq,omitempty"`
	DingTalk *DingTalkSecurity `yaml:"dingtalk,omitempty"`
	Slack    *SlackSecurity    `yaml:"slack,omitempty"`
	Matrix   *MatrixSecurity   `yaml:"matrix,omitempty"`
	LINE     *LINESecurity     `yaml:"line,omitempty"`
	OneBot   *OneBotSecurity   `yaml:"onebot,omitempty"`
	WeCom    *WeComSecurity    `yaml:"wecom,omitempty"`
	Pico     *PicoSecurity     `yaml:"pico,omitempty"`
	IRC      *IRCSecurity      `yaml:"irc,omitempty"`
}

ChannelsSecurity stores channel-related security data

type ClawHubRegistryConfig added in v0.2.0

type ClawHubRegistryConfig struct {
	Enabled bool   `json:"enabled"           env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_ENABLED"`
	BaseURL string `json:"base_url"          env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_BASE_URL"`

	SearchPath      string `json:"search_path"       env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_SEARCH_PATH"`
	SkillsPath      string `json:"skills_path"       env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_SKILLS_PATH"`
	DownloadPath    string `json:"download_path"     env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_DOWNLOAD_PATH"`
	Timeout         int    `json:"timeout"           env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_TIMEOUT"`
	MaxZipSize      int    `json:"max_zip_size"      env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_MAX_ZIP_SIZE"`
	MaxResponseSize int    `json:"max_response_size" env:"PICOCLAW_SKILLS_REGISTRIES_CLAWHUB_MAX_RESPONSE_SIZE"`
	// contains filtered or unexported fields
}

func (*ClawHubRegistryConfig) AuthToken added in v0.2.0

func (c *ClawHubRegistryConfig) AuthToken() string

AuthToken returns the ClawHub auth token

func (*ClawHubRegistryConfig) SetAuthToken added in v0.2.4

func (c *ClawHubRegistryConfig) SetAuthToken(token string)

SetAuthToken sets the ClawHub auth token

type ClawHubSecurity added in v0.2.4

type ClawHubSecurity struct {
	AuthToken string `yaml:"auth_token,omitempty"`
}

type Config

type Config struct {
	Version   int             `json:"version"` // Config schema version for migration
	Agents    AgentsConfig    `json:"agents"`
	Bindings  []AgentBinding  `json:"bindings,omitempty"`
	Session   SessionConfig   `json:"session,omitempty"`
	Channels  ChannelsConfig  `json:"channels"`
	ModelList []*ModelConfig  `json:"model_list"` // New model-centric provider configuration
	Gateway   GatewayConfig   `json:"gateway"`
	Hooks     HooksConfig     `json:"hooks,omitempty"`
	Tools     ToolsConfig     `json:"tools"`
	Heartbeat HeartbeatConfig `json:"heartbeat"`
	Devices   DevicesConfig   `json:"devices"`
	Voice     VoiceConfig     `json:"voice"`
	// BuildInfo contains build-time version information
	BuildInfo BuildInfo `json:"build_info,omitempty"`
	// contains filtered or unexported fields
}

Config is the current config structure with version support

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration for PicoClaw.

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) ApplySecurity added in v0.2.4

func (c *Config) ApplySecurity() error

ApplySecurity re-applies the stored security config to populate private fields (tokens, API keys, etc.). Call this after SecurityCopyFrom when you need private fields to be accessible for validation or use.

func (*Config) FilterSensitiveData added in v0.2.4

func (c *Config) FilterSensitiveData(content string) string

FilterSensitiveData filters sensitive values from content before sending to LLM. This prevents the LLM from seeing its own credentials. Uses strings.Replacer for O(n+m) performance (computed once per SecurityConfig). Short content (below FilterMinLength) is returned unchanged for performance.

func (*Config) GetModelConfig added in v0.2.0

func (c *Config) GetModelConfig(modelName string) (*ModelConfig, error)

GetModelConfig returns the ModelConfig for the given model name. If multiple configs exist with the same model_name, it uses round-robin selection for load balancing. Returns an error if the model is not found.

func (*Config) MarshalJSON added in v0.2.0

func (c *Config) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON marshaling for Config to omit providers section when empty and session when empty

func (*Config) SecurityCopyFrom added in v0.2.4

func (c *Config) SecurityCopyFrom(cfg *Config)

func (*Config) ValidateModelList added in v0.2.0

func (c *Config) ValidateModelList() error

ValidateModelList validates all ModelConfig entries in the model_list. It checks that each model config is valid. Note: Multiple entries with the same model_name are allowed for load balancing.

func (*Config) WithSecurity added in v0.2.4

func (c *Config) WithSecurity(sec *SecurityConfig) *Config

func (*Config) WorkspacePath

func (c *Config) WorkspacePath() string

type CronToolsConfig added in v0.2.0

type CronToolsConfig struct {
	ToolConfig         `     envPrefix:"PICOCLAW_TOOLS_CRON_"`
	ExecTimeoutMinutes int  `                                 env:"PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES" json:"exec_timeout_minutes"` // 0 means no timeout
	AllowCommand       bool `                                 env:"PICOCLAW_TOOLS_CRON_ALLOW_COMMAND"        json:"allow_command"`
}

type DevicesConfig added in v0.1.2

type DevicesConfig struct {
	Enabled    bool `json:"enabled"     env:"PICOCLAW_DEVICES_ENABLED"`
	MonitorUSB bool `json:"monitor_usb" env:"PICOCLAW_DEVICES_MONITOR_USB"`
}

type DingTalkConfig added in v0.1.1

type DingTalkConfig struct {
	Enabled  bool   `json:"enabled"                 env:"PICOCLAW_CHANNELS_DINGTALK_ENABLED"`
	ClientID string `json:"client_id"               env:"PICOCLAW_CHANNELS_DINGTALK_CLIENT_ID"`

	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_DINGTALK_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_DINGTALK_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*DingTalkConfig) ClientSecret added in v0.1.1

func (c *DingTalkConfig) ClientSecret() string

ClientSecret returns the DingTalk client secret

func (*DingTalkConfig) SetClientSecret added in v0.2.4

func (c *DingTalkConfig) SetClientSecret(secret string)

SetClientSecret sets the DingTalk client secret

type DingTalkSecurity added in v0.2.4

type DingTalkSecurity struct {
	ClientSecret string `yaml:"client_secret,omitempty" env:"PICOCLAW_CHANNELS_DINGTALK_CLIENT_SECRET"`
}

type DiscordConfig

type DiscordConfig struct {
	Enabled bool `json:"enabled"                 env:"PICOCLAW_CHANNELS_DISCORD_ENABLED"`

	Proxy              string              `json:"proxy"                   env:"PICOCLAW_CHANNELS_DISCORD_PROXY"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_DISCORD_ALLOW_FROM"`
	MentionOnly        bool                `json:"mention_only"            env:"PICOCLAW_CHANNELS_DISCORD_MENTION_ONLY"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Typing             TypingConfig        `json:"typing,omitempty"`
	Placeholder        PlaceholderConfig   `json:"placeholder,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_DISCORD_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*DiscordConfig) SetToken added in v0.2.4

func (c *DiscordConfig) SetToken(token string)

SetToken sets the Discord bot token

func (*DiscordConfig) Token

func (c *DiscordConfig) Token() string

Token returns the Discord bot token

type DiscordSecurity added in v0.2.4

type DiscordSecurity struct {
	Token string `yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_DISCORD_TOKEN"`
}

type DuckDuckGoConfig added in v0.1.2

type DuckDuckGoConfig struct {
	Enabled    bool `json:"enabled"     env:"PICOCLAW_TOOLS_WEB_DUCKDUCKGO_ENABLED"`
	MaxResults int  `json:"max_results" env:"PICOCLAW_TOOLS_WEB_DUCKDUCKGO_MAX_RESULTS"`
}

type ExecConfig added in v0.2.0

type ExecConfig struct {
	ToolConfig          `         envPrefix:"PICOCLAW_TOOLS_EXEC_"`
	EnableDenyPatterns  bool     `                                 env:"PICOCLAW_TOOLS_EXEC_ENABLE_DENY_PATTERNS"  json:"enable_deny_patterns"`
	AllowRemote         bool     `                                 env:"PICOCLAW_TOOLS_EXEC_ALLOW_REMOTE"          json:"allow_remote"`
	CustomDenyPatterns  []string `                                 env:"PICOCLAW_TOOLS_EXEC_CUSTOM_DENY_PATTERNS"  json:"custom_deny_patterns"`
	CustomAllowPatterns []string `                                 env:"PICOCLAW_TOOLS_EXEC_CUSTOM_ALLOW_PATTERNS" json:"custom_allow_patterns"`
	TimeoutSeconds      int      `                                 env:"PICOCLAW_TOOLS_EXEC_TIMEOUT_SECONDS"       json:"timeout_seconds"` // 0 means use default (60s)
}

type FeishuConfig

type FeishuConfig struct {
	Enabled bool   `json:"enabled"                 env:"PICOCLAW_CHANNELS_FEISHU_ENABLED"`
	AppID   string `json:"app_id"                  env:"PICOCLAW_CHANNELS_FEISHU_APP_ID"`

	AllowFrom           FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_FEISHU_ALLOW_FROM"`
	GroupTrigger        GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Placeholder         PlaceholderConfig   `json:"placeholder,omitempty"`
	ReasoningChannelID  string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_FEISHU_REASONING_CHANNEL_ID"`
	RandomReactionEmoji FlexibleStringSlice `json:"random_reaction_emoji"   env:"PICOCLAW_CHANNELS_FEISHU_RANDOM_REACTION_EMOJI"`
	IsLark              bool                `json:"is_lark"                 env:"PICOCLAW_CHANNELS_FEISHU_IS_LARK"`
	// contains filtered or unexported fields
}

func (*FeishuConfig) AppSecret

func (c *FeishuConfig) AppSecret() string

AppSecret returns the Feishu app secret

func (*FeishuConfig) EncryptKey

func (c *FeishuConfig) EncryptKey() string

EncryptKey returns the Feishu encrypt key

func (*FeishuConfig) SetAppSecret added in v0.2.4

func (c *FeishuConfig) SetAppSecret(secret string)

SetAppSecret sets the Feishu app secret

func (*FeishuConfig) SetEncryptKey added in v0.2.4

func (c *FeishuConfig) SetEncryptKey(key string)

SetEncryptKey sets the Feishu encrypt key

func (*FeishuConfig) SetVerificationToken added in v0.2.4

func (c *FeishuConfig) SetVerificationToken(token string)

SetVerificationToken sets the Feishu verification token

func (*FeishuConfig) VerificationToken

func (c *FeishuConfig) VerificationToken() string

VerificationToken returns the Feishu verification token

type FeishuSecurity added in v0.2.4

type FeishuSecurity struct {
	AppSecret         string `yaml:"app_secret,omitempty"         env:"PICOCLAW_CHANNELS_FEISHU_APP_SECRET"`
	EncryptKey        string `yaml:"encrypt_key,omitempty"        env:"PICOCLAW_CHANNELS_FEISHU_ENCRYPT_KEY"`
	VerificationToken string `yaml:"verification_token,omitempty" env:"PICOCLAW_CHANNELS_FEISHU_VERIFICATION_TOKEN"`
}

type FlexibleStringSlice added in v0.1.1

type FlexibleStringSlice []string

FlexibleStringSlice is a []string that also accepts JSON numbers, so allow_from can contain both "123" and 123. It also supports parsing comma-separated strings from environment variables, including both English (,) and Chinese (,) commas.

func (*FlexibleStringSlice) UnmarshalJSON added in v0.1.1

func (f *FlexibleStringSlice) UnmarshalJSON(data []byte) error

func (*FlexibleStringSlice) UnmarshalText added in v0.2.3

func (f *FlexibleStringSlice) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler to support env variable parsing. It handles comma-separated values with both English (,) and Chinese (,) commas.

type GLMSearchConfig added in v0.2.1

type GLMSearchConfig struct {
	Enabled bool `json:"enabled"  env:"PICOCLAW_TOOLS_WEB_GLM_ENABLED"`

	BaseURL string `json:"base_url" env:"PICOCLAW_TOOLS_WEB_GLM_BASE_URL"`
	// SearchEngine specifies the search backend: "search_std" (default),
	// "search_pro", "search_pro_sogou", or "search_pro_quark".
	SearchEngine string `json:"search_engine" env:"PICOCLAW_TOOLS_WEB_GLM_SEARCH_ENGINE"`
	MaxResults   int    `json:"max_results"   env:"PICOCLAW_TOOLS_WEB_GLM_MAX_RESULTS"`
	// contains filtered or unexported fields
}

func (*GLMSearchConfig) APIKey added in v0.2.1

func (c *GLMSearchConfig) APIKey() string

APIKey returns the GLM search API key

func (*GLMSearchConfig) SetAPIKey added in v0.2.4

func (c *GLMSearchConfig) SetAPIKey(key string)

SetAPIKey sets the GLM search API key (internal use only)

type GLMSearchSecurity added in v0.2.4

type GLMSearchSecurity struct {
	APIKey string `yaml:"api_key,omitempty"`
}

type GatewayConfig

type GatewayConfig struct {
	Host      string `json:"host"                env:"PICOCLAW_GATEWAY_HOST"`
	Port      int    `json:"port"                env:"PICOCLAW_GATEWAY_PORT"`
	HotReload bool   `json:"hot_reload"          env:"PICOCLAW_GATEWAY_HOT_RELOAD"`
	LogLevel  string `json:"log_level,omitempty" env:"PICOCLAW_LOG_LEVEL"`
}

type GithubSecurity added in v0.2.4

type GithubSecurity struct {
	Token string `yaml:"token,omitempty"`
}

type GroupTriggerConfig added in v0.2.0

type GroupTriggerConfig struct {
	MentionOnly bool     `json:"mention_only,omitempty"`
	Prefixes    []string `json:"prefixes,omitempty"`
}

GroupTriggerConfig controls when the bot responds in group chats.

type HeartbeatConfig added in v0.1.2

type HeartbeatConfig struct {
	Enabled  bool `json:"enabled"  env:"PICOCLAW_HEARTBEAT_ENABLED"`
	Interval int  `json:"interval" env:"PICOCLAW_HEARTBEAT_INTERVAL"` // minutes, min 5
}

type HookDefaultsConfig added in v0.2.4

type HookDefaultsConfig struct {
	ObserverTimeoutMS    int `json:"observer_timeout_ms,omitempty"`
	InterceptorTimeoutMS int `json:"interceptor_timeout_ms,omitempty"`
	ApprovalTimeoutMS    int `json:"approval_timeout_ms,omitempty"`
}

type HooksConfig added in v0.2.4

type HooksConfig struct {
	Enabled   bool                         `json:"enabled"`
	Defaults  HookDefaultsConfig           `json:"defaults,omitempty"`
	Builtins  map[string]BuiltinHookConfig `json:"builtins,omitempty"`
	Processes map[string]ProcessHookConfig `json:"processes,omitempty"`
}

type IRCConfig added in v0.2.1

type IRCConfig struct {
	Enabled  bool   `json:"enabled"                 env:"PICOCLAW_CHANNELS_IRC_ENABLED"`
	Server   string `json:"server"                  env:"PICOCLAW_CHANNELS_IRC_SERVER"`
	TLS      bool   `json:"tls"                     env:"PICOCLAW_CHANNELS_IRC_TLS"`
	Nick     string `json:"nick"                    env:"PICOCLAW_CHANNELS_IRC_NICK"`
	User     string `json:"user,omitempty"          env:"PICOCLAW_CHANNELS_IRC_USER"`
	RealName string `json:"real_name,omitempty"     env:"PICOCLAW_CHANNELS_IRC_REAL_NAME"`

	SASLUser string `json:"sasl_user"               env:"PICOCLAW_CHANNELS_IRC_SASL_USER"`

	Channels           FlexibleStringSlice `json:"channels"                env:"PICOCLAW_CHANNELS_IRC_CHANNELS"`
	RequestCaps        FlexibleStringSlice `json:"request_caps,omitempty"  env:"PICOCLAW_CHANNELS_IRC_REQUEST_CAPS"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_IRC_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Typing             TypingConfig        `json:"typing,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_IRC_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*IRCConfig) NickServPassword added in v0.2.1

func (c *IRCConfig) NickServPassword() string

NickServPassword returns the NickServ password

func (*IRCConfig) Password added in v0.2.1

func (c *IRCConfig) Password() string

Password returns the IRC password

func (*IRCConfig) SASLPassword added in v0.2.1

func (c *IRCConfig) SASLPassword() string

SASLPassword returns the SASL password

func (*IRCConfig) SetNickServPassword added in v0.2.4

func (c *IRCConfig) SetNickServPassword(password string)

func (*IRCConfig) SetPassword added in v0.2.4

func (c *IRCConfig) SetPassword(password string)

func (*IRCConfig) SetSASLPassword added in v0.2.4

func (c *IRCConfig) SetSASLPassword(password string)

type IRCSecurity added in v0.2.4

type IRCSecurity struct {
	Password         string `yaml:"password,omitempty"          env:"PICOCLAW_CHANNELS_IRC_PASSWORD"`
	NickServPassword string `yaml:"nickserv_password,omitempty" env:"PICOCLAW_CHANNELS_IRC_NICKSERV_PASSWORD"`
	SASLPassword     string `yaml:"sasl_password,omitempty"     env:"PICOCLAW_CHANNELS_IRC_SASL_PASSWORD"`
}

type LINEConfig added in v0.1.2

type LINEConfig struct {
	Enabled bool `json:"enabled"                 env:"PICOCLAW_CHANNELS_LINE_ENABLED"`

	WebhookHost        string              `json:"webhook_host"            env:"PICOCLAW_CHANNELS_LINE_WEBHOOK_HOST"`
	WebhookPort        int                 `json:"webhook_port"            env:"PICOCLAW_CHANNELS_LINE_WEBHOOK_PORT"`
	WebhookPath        string              `json:"webhook_path"            env:"PICOCLAW_CHANNELS_LINE_WEBHOOK_PATH"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_LINE_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Typing             TypingConfig        `json:"typing,omitempty"`
	Placeholder        PlaceholderConfig   `json:"placeholder,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_LINE_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*LINEConfig) ChannelAccessToken added in v0.1.2

func (c *LINEConfig) ChannelAccessToken() string

ChannelAccessToken returns the LINE channel access token

func (*LINEConfig) ChannelSecret added in v0.1.2

func (c *LINEConfig) ChannelSecret() string

ChannelSecret returns the LINE channel secret

func (*LINEConfig) SetChannelAccessToken added in v0.2.4

func (c *LINEConfig) SetChannelAccessToken(token string)

SetChannelAccessToken sets the LINE channel access token

func (*LINEConfig) SetChannelSecret added in v0.2.4

func (c *LINEConfig) SetChannelSecret(secret string)

SetChannelSecret sets the LINE channel secret

type LINESecurity added in v0.2.4

type LINESecurity struct {
	ChannelSecret      string `yaml:"channel_secret,omitempty"       env:"PICOCLAW_CHANNELS_LINE_CHANNEL_SECRET"`
	ChannelAccessToken string `yaml:"channel_access_token,omitempty" env:"PICOCLAW_CHANNELS_LINE_CHANNEL_ACCESS_TOKEN"`
}

type MCPConfig added in v0.2.1

type MCPConfig struct {
	ToolConfig `                    envPrefix:"PICOCLAW_TOOLS_MCP_"`
	Discovery  ToolDiscoveryConfig `                                json:"discovery"`
	// Servers is a map of server name to server configuration
	Servers map[string]MCPServerConfig `json:"servers,omitempty"`
}

MCPConfig defines configuration for all MCP servers

type MCPServerConfig added in v0.2.1

type MCPServerConfig struct {
	// Enabled indicates whether this MCP server is active
	Enabled bool `json:"enabled"`
	// Deferred controls whether this server's tools are registered as hidden (deferred/discovery mode).
	// When nil, the global Discovery.Enabled setting applies.
	// When explicitly set to true or false, it overrides the global setting for this server only.
	Deferred *bool `json:"deferred,omitempty"`
	// Command is the executable to run (e.g., "npx", "python", "/path/to/server")
	Command string `json:"command"`
	// Args are the arguments to pass to the command
	Args []string `json:"args,omitempty"`
	// Env are environment variables to set for the server process (stdio only)
	Env map[string]string `json:"env,omitempty"`
	// EnvFile is the path to a file containing environment variables (stdio only)
	EnvFile string `json:"env_file,omitempty"`
	// Type is "stdio", "sse", or "http" (default: stdio if command is set, sse if url is set)
	Type string `json:"type,omitempty"`
	// URL is used for SSE/HTTP transport
	URL string `json:"url,omitempty"`
	// Headers are HTTP headers to send with requests (sse/http only)
	Headers map[string]string `json:"headers,omitempty"`
}

MCPServerConfig defines configuration for a single MCP server

type MaixCamConfig

type MaixCamConfig struct {
	Enabled            bool                `json:"enabled"              env:"PICOCLAW_CHANNELS_MAIXCAM_ENABLED"`
	Host               string              `json:"host"                 env:"PICOCLAW_CHANNELS_MAIXCAM_HOST"`
	Port               int                 `json:"port"                 env:"PICOCLAW_CHANNELS_MAIXCAM_PORT"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"           env:"PICOCLAW_CHANNELS_MAIXCAM_ALLOW_FROM"`
	ReasoningChannelID string              `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_MAIXCAM_REASONING_CHANNEL_ID"`
}

type MatrixConfig added in v0.2.1

type MatrixConfig struct {
	Enabled    bool   `json:"enabled"                        env:"PICOCLAW_CHANNELS_MATRIX_ENABLED"`
	Homeserver string `json:"homeserver"                     env:"PICOCLAW_CHANNELS_MATRIX_HOMESERVER"`
	UserID     string `json:"user_id"                        env:"PICOCLAW_CHANNELS_MATRIX_USER_ID"`

	DeviceID           string              `json:"device_id,omitempty"            env:"PICOCLAW_CHANNELS_MATRIX_DEVICE_ID"`
	JoinOnInvite       bool                `json:"join_on_invite"                 env:"PICOCLAW_CHANNELS_MATRIX_JOIN_ON_INVITE"`
	MessageFormat      string              `json:"message_format,omitempty"       env:"PICOCLAW_CHANNELS_MATRIX_MESSAGE_FORMAT"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"                     env:"PICOCLAW_CHANNELS_MATRIX_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Placeholder        PlaceholderConfig   `json:"placeholder,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"           env:"PICOCLAW_CHANNELS_MATRIX_REASONING_CHANNEL_ID"`

	CryptoDatabasePath string `json:"crypto_database_path,omitempty" env:"PICOCLAW_CHANNELS_MATRIX_CRYPTO_DATABASE_PATH"`
	CryptoPassphrase   string `json:"crypto_passphrase,omitempty"    env:"PICOCLAW_CHANNELS_MATRIX_CRYPTO_PASSPHRASE"`
	// contains filtered or unexported fields
}

func (*MatrixConfig) AccessToken added in v0.2.1

func (c *MatrixConfig) AccessToken() string

AccessToken returns the Matrix access token

func (*MatrixConfig) SetAccessToken added in v0.2.4

func (c *MatrixConfig) SetAccessToken(token string)

SetAccessToken sets the Matrix access token

type MatrixSecurity added in v0.2.4

type MatrixSecurity struct {
	AccessToken string `yaml:"access_token,omitempty" env:"PICOCLAW_CHANNELS_MATRIX_ACCESS_TOKEN"`
}

type MediaCleanupConfig added in v0.2.0

type MediaCleanupConfig struct {
	ToolConfig `    envPrefix:"PICOCLAW_MEDIA_CLEANUP_"`
	MaxAge     int `                                    env:"PICOCLAW_MEDIA_CLEANUP_MAX_AGE"  json:"max_age_minutes"`
	Interval   int `                                    env:"PICOCLAW_MEDIA_CLEANUP_INTERVAL" json:"interval_minutes"`
}

type ModelConfig added in v0.2.0

type ModelConfig struct {
	// Required fields
	ModelName string `json:"model_name"` // User-facing alias for the model
	Model     string `json:"model"`      // Protocol/model-identifier (e.g., "openai/gpt-4o", "anthropic/claude-sonnet-4.6")

	// HTTP-based providers
	APIBase   string   `json:"api_base,omitempty"`  // API endpoint URL
	Proxy     string   `json:"proxy,omitempty"`     // HTTP proxy URL
	Fallbacks []string `json:"fallbacks,omitempty"` // Fallback model names for failover

	// Special providers (CLI-based, OAuth, etc.)
	AuthMethod  string `json:"auth_method,omitempty"`  // Authentication method: oauth, token
	ConnectMode string `json:"connect_mode,omitempty"` // Connection mode: stdio, grpc
	Workspace   string `json:"workspace,omitempty"`    // Workspace path for CLI-based providers

	// Optional optimizations
	RPM            int            `json:"rpm,omitempty"`              // Requests per minute limit
	MaxTokensField string         `json:"max_tokens_field,omitempty"` // Field name for max tokens (e.g., "max_completion_tokens")
	RequestTimeout int            `json:"request_timeout,omitempty"`
	ThinkingLevel  string         `json:"thinking_level,omitempty"` // Extended thinking: off|low|medium|high|xhigh|adaptive
	ExtraBody      map[string]any `json:"extra_body,omitempty"`     // Additional fields to inject into request body
	// contains filtered or unexported fields
}

ModelConfig represents a model-centric provider configuration. It allows adding new providers (especially OpenAI-compatible ones) via configuration only. The model field uses protocol prefix format: [protocol/]model-identifier Supported protocols include openai, anthropic, antigravity, claude-cli, codex-cli, github-copilot, and named OpenAI-compatible protocols such as groq, deepseek, modelscope, and novita. Default protocol is "openai" if no prefix is specified.

func (*ModelConfig) APIKey added in v0.2.0

func (c *ModelConfig) APIKey() string

APIKey returns the first API key from apiKeys

func (*ModelConfig) IsVirtual added in v0.2.4

func (c *ModelConfig) IsVirtual() bool

IsVirtual returns true if this model was generated from multi-key expansion.

func (*ModelConfig) SetAPIKey added in v0.2.4

func (c *ModelConfig) SetAPIKey(value string)

func (*ModelConfig) Validate added in v0.2.0

func (c *ModelConfig) Validate() error

Validate checks if the ModelConfig has all required fields.

type ModelSecurityEntry added in v0.2.4

type ModelSecurityEntry struct {
	APIKeys []string `yaml:"api_keys,omitempty"` // API authentication keys (multiple keys for failover)
}

ModelSecurityEntry stores security data for a model

type OneBotConfig added in v0.1.2

type OneBotConfig struct {
	Enabled bool   `json:"enabled"                 env:"PICOCLAW_CHANNELS_ONEBOT_ENABLED"`
	WSUrl   string `json:"ws_url"                  env:"PICOCLAW_CHANNELS_ONEBOT_WS_URL"`

	ReconnectInterval  int                 `json:"reconnect_interval"      env:"PICOCLAW_CHANNELS_ONEBOT_RECONNECT_INTERVAL"`
	GroupTriggerPrefix []string            `json:"group_trigger_prefix"    env:"PICOCLAW_CHANNELS_ONEBOT_GROUP_TRIGGER_PREFIX"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_ONEBOT_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Typing             TypingConfig        `json:"typing,omitempty"`
	Placeholder        PlaceholderConfig   `json:"placeholder,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_ONEBOT_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*OneBotConfig) AccessToken added in v0.1.2

func (c *OneBotConfig) AccessToken() string

AccessToken returns the OneBot access token

func (*OneBotConfig) SetAccessToken added in v0.2.4

func (c *OneBotConfig) SetAccessToken(token string)

SetAccessToken sets the OneBot access token

type OneBotSecurity added in v0.2.4

type OneBotSecurity struct {
	AccessToken string `yaml:"access_token,omitempty" env:"PICOCLAW_CHANNELS_ONEBOT_ACCESS_TOKEN"`
}

type PeerMatch added in v0.2.0

type PeerMatch struct {
	Kind string `json:"kind"`
	ID   string `json:"id"`
}

type PerplexityConfig added in v0.2.0

type PerplexityConfig struct {
	Enabled bool `json:"enabled"     env:"PICOCLAW_TOOLS_WEB_PERPLEXITY_ENABLED"`

	MaxResults int `json:"max_results" env:"PICOCLAW_TOOLS_WEB_PERPLEXITY_MAX_RESULTS"`
	// contains filtered or unexported fields
}

func (*PerplexityConfig) APIKey added in v0.2.0

func (c *PerplexityConfig) APIKey() string

APIKey returns the Perplexity API key

func (*PerplexityConfig) APIKeys added in v0.2.2

func (c *PerplexityConfig) APIKeys() []string

APIKeys returns the Perplexity API keys

func (*PerplexityConfig) SetAPIKey added in v0.2.4

func (c *PerplexityConfig) SetAPIKey(key string)

SetAPIKey sets the Perplexity API key

func (*PerplexityConfig) SetAPIKeys added in v0.2.4

func (c *PerplexityConfig) SetAPIKeys(keys []string)

SetAPIKeys sets the Perplexity API keys

type PerplexitySecurity added in v0.2.4

type PerplexitySecurity struct {
	APIKeys []string `yaml:"api_keys,omitempty"`
}

type PicoClientConfig added in v0.2.4

type PicoClientConfig struct {
	Enabled      bool                `json:"enabled"                 env:"PICOCLAW_CHANNELS_PICO_CLIENT_ENABLED"`
	URL          string              `json:"url"                     env:"PICOCLAW_CHANNELS_PICO_CLIENT_URL"`
	Token        string              `json:"token"                   env:"PICOCLAW_CHANNELS_PICO_CLIENT_TOKEN"`
	SessionID    string              `json:"session_id,omitempty"`
	PingInterval int                 `json:"ping_interval,omitempty"`
	ReadTimeout  int                 `json:"read_timeout,omitempty"`
	AllowFrom    FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_PICO_CLIENT_ALLOW_FROM"`
}

type PicoConfig added in v0.2.0

type PicoConfig struct {
	Enabled bool `json:"enabled"                     env:"PICOCLAW_CHANNELS_PICO_ENABLED"`

	AllowTokenQuery bool                `json:"allow_token_query,omitempty"`
	AllowOrigins    []string            `json:"allow_origins,omitempty"`
	PingInterval    int                 `json:"ping_interval,omitempty"`
	ReadTimeout     int                 `json:"read_timeout,omitempty"`
	WriteTimeout    int                 `json:"write_timeout,omitempty"`
	MaxConnections  int                 `json:"max_connections,omitempty"`
	AllowFrom       FlexibleStringSlice `json:"allow_from"                  env:"PICOCLAW_CHANNELS_PICO_ALLOW_FROM"`
	Placeholder     PlaceholderConfig   `json:"placeholder,omitempty"`
	// contains filtered or unexported fields
}

func (*PicoConfig) SetToken added in v0.2.4

func (c *PicoConfig) SetToken(token string)

SetToken sets the Pico channel token

func (*PicoConfig) Token added in v0.2.0

func (c *PicoConfig) Token() string

Token returns the Pico channel token

type PicoSecurity added in v0.2.4

type PicoSecurity struct {
	Token string `yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_PICO_TOKEN"`
}

type PlaceholderConfig added in v0.2.0

type PlaceholderConfig struct {
	Enabled bool   `json:"enabled"`
	Text    string `json:"text,omitempty"`
}

PlaceholderConfig controls placeholder message behavior (Phase 10).

type ProcessHookConfig added in v0.2.4

type ProcessHookConfig struct {
	Enabled   bool              `json:"enabled"`
	Priority  int               `json:"priority,omitempty"`
	Transport string            `json:"transport,omitempty"`
	Command   []string          `json:"command,omitempty"`
	Dir       string            `json:"dir,omitempty"`
	Env       map[string]string `json:"env,omitempty"`
	Observe   []string          `json:"observe,omitempty"`
	Intercept []string          `json:"intercept,omitempty"`
}

type QQConfig added in v0.1.1

type QQConfig struct {
	Enabled bool   `json:"enabled"                  env:"PICOCLAW_CHANNELS_QQ_ENABLED"`
	AppID   string `json:"app_id"                   env:"PICOCLAW_CHANNELS_QQ_APP_ID"`

	AllowFrom            FlexibleStringSlice `json:"allow_from"               env:"PICOCLAW_CHANNELS_QQ_ALLOW_FROM"`
	GroupTrigger         GroupTriggerConfig  `json:"group_trigger,omitempty"`
	MaxMessageLength     int                 `json:"max_message_length"       env:"PICOCLAW_CHANNELS_QQ_MAX_MESSAGE_LENGTH"`
	MaxBase64FileSizeMiB int64               `json:"max_base64_file_size_mib" env:"PICOCLAW_CHANNELS_QQ_MAX_BASE64_FILE_SIZE_MIB"`
	SendMarkdown         bool                `json:"send_markdown"            env:"PICOCLAW_CHANNELS_QQ_SEND_MARKDOWN"`
	ReasoningChannelID   string              `json:"reasoning_channel_id"     env:"PICOCLAW_CHANNELS_QQ_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*QQConfig) AppSecret added in v0.1.1

func (c *QQConfig) AppSecret() string

AppSecret returns the QQ app secret

func (*QQConfig) SetAppSecret added in v0.2.4

func (c *QQConfig) SetAppSecret(secret string)

SetAppSecret sets the QQ app secret

type QQSecurity added in v0.2.4

type QQSecurity struct {
	AppSecret string `yaml:"app_secret,omitempty" env:"PICOCLAW_CHANNELS_QQ_APP_SECRET"`
}

type ReadFileToolConfig added in v0.2.2

type ReadFileToolConfig struct {
	Enabled         bool `json:"enabled"`
	MaxReadFileSize int  `json:"max_read_file_size"`
}

type RoutingConfig added in v0.2.1

type RoutingConfig struct {
	Enabled    bool    `json:"enabled"`
	LightModel string  `json:"light_model"` // model_name from model_list to use for simple tasks
	Threshold  float64 `json:"threshold"`   // complexity score in [0,1]; score >= threshold → primary model
}

RoutingConfig controls the intelligent model routing feature. When enabled, each incoming message is scored against structural features (message length, code blocks, tool call history, conversation depth, attachments). Messages scoring below Threshold are sent to LightModel; all others use the agent's primary model. This reduces cost and latency for simple tasks without requiring any keyword matching — all scoring is language-agnostic.

type SearXNGConfig added in v0.2.1

type SearXNGConfig struct {
	Enabled    bool   `json:"enabled"     env:"PICOCLAW_TOOLS_WEB_SEARXNG_ENABLED"`
	BaseURL    string `json:"base_url"    env:"PICOCLAW_TOOLS_WEB_SEARXNG_BASE_URL"`
	MaxResults int    `json:"max_results" env:"PICOCLAW_TOOLS_WEB_SEARXNG_MAX_RESULTS"`
}

type SearchCacheConfig added in v0.2.0

type SearchCacheConfig struct {
	MaxSize    int `json:"max_size"    env:"PICOCLAW_SKILLS_SEARCH_CACHE_MAX_SIZE"`
	TTLSeconds int `json:"ttl_seconds" env:"PICOCLAW_SKILLS_SEARCH_CACHE_TTL_SECONDS"`
}

type SecurityConfig added in v0.2.4

type SecurityConfig struct {
	// Model API keys. Map key is model_name, can include suffix like "abc:0", "abc:1"
	// for load balancing with same model_name. The suffix ":N" is used to distinguish
	// multiple configs that share the same base model_name.
	ModelList map[string]ModelSecurityEntry `yaml:"model_list"`

	// Channel tokens/secrets
	Channels *ChannelsSecurity `yaml:"channels,omitempty"`

	Web    *WebToolsSecurity `yaml:"web,omitempty"`
	Skills *SkillsSecurity   `yaml:"skills,omitempty"`
	// contains filtered or unexported fields
}

SecurityConfig stores all sensitive data (API keys, tokens, secrets, passwords) This data is loaded from security.yml and kept separate from the main config

func (*SecurityConfig) SensitiveDataReplacer added in v0.2.4

func (sec *SecurityConfig) SensitiveDataReplacer() *strings.Replacer

SensitiveDataReplacer returns the strings.Replacer for filtering sensitive data. It is computed once on first access via sync.Once.

type SensitiveDataCache added in v0.2.4

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

SensitiveDataCache caches the compiled regex for filtering sensitive data. SensitiveDataCache caches the strings.Replacer for filtering sensitive data. Computed once on first access via sync.Once.

type SessionConfig added in v0.2.0

type SessionConfig struct {
	DMScope       string              `json:"dm_scope,omitempty"`
	IdentityLinks map[string][]string `json:"identity_links,omitempty"`
}

type SkillsGithubConfig added in v0.2.3

type SkillsGithubConfig struct {
	Proxy string `json:"proxy,omitempty" env:"PICOCLAW_TOOLS_SKILLS_GITHUB_PROXY"`
	// contains filtered or unexported fields
}

func (*SkillsGithubConfig) SetToken added in v0.2.4

func (c *SkillsGithubConfig) SetToken(token string)

SetToken sets the GitHub token

func (*SkillsGithubConfig) Token added in v0.2.3

func (c *SkillsGithubConfig) Token() string

Token returns the GitHub token

type SkillsRegistriesConfig added in v0.2.0

type SkillsRegistriesConfig struct {
	ClawHub ClawHubRegistryConfig `json:"clawhub"`
}

type SkillsSecurity added in v0.2.4

type SkillsSecurity struct {
	Github  *GithubSecurity  `yaml:"github,omitempty"`
	ClawHub *ClawHubSecurity `yaml:"clawhub,omitempty"`
}

type SkillsToolsConfig added in v0.2.0

type SkillsToolsConfig struct {
	ToolConfig            `                       envPrefix:"PICOCLAW_TOOLS_SKILLS_"`
	Registries            SkillsRegistriesConfig `                                   json:"registries"`
	Github                SkillsGithubConfig     `                                   json:"github"`
	MaxConcurrentSearches int                    `                                   json:"max_concurrent_searches" env:"PICOCLAW_TOOLS_SKILLS_MAX_CONCURRENT_SEARCHES"`
	SearchCache           SearchCacheConfig      `                                   json:"search_cache"`
}

type SlackConfig added in v0.1.1

type SlackConfig struct {
	Enabled bool `json:"enabled"                 env:"PICOCLAW_CHANNELS_SLACK_ENABLED"`

	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_SLACK_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Typing             TypingConfig        `json:"typing,omitempty"`
	Placeholder        PlaceholderConfig   `json:"placeholder,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_SLACK_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*SlackConfig) AppToken added in v0.1.1

func (c *SlackConfig) AppToken() string

AppToken returns the Slack app token

func (*SlackConfig) BotToken added in v0.1.1

func (c *SlackConfig) BotToken() string

BotToken returns the Slack bot token

func (*SlackConfig) SetAppToken added in v0.2.4

func (c *SlackConfig) SetAppToken(token string)

SetAppToken sets the Slack app token

func (*SlackConfig) SetBotToken added in v0.2.4

func (c *SlackConfig) SetBotToken(token string)

SetBotToken sets the Slack bot token

type SlackSecurity added in v0.2.4

type SlackSecurity struct {
	BotToken string `yaml:"bot_token,omitempty" env:"PICOCLAW_CHANNELS_SLACK_BOT_TOKEN"`
	AppToken string `yaml:"app_token,omitempty" env:"PICOCLAW_CHANNELS_SLACK_APP_TOKEN"`
}

type StreamingConfig added in v0.2.4

type StreamingConfig struct {
	Enabled         bool `json:"enabled,omitempty"          env:"PICOCLAW_CHANNELS_TELEGRAM_STREAMING_ENABLED"`
	ThrottleSeconds int  `json:"throttle_seconds,omitempty" env:"PICOCLAW_CHANNELS_TELEGRAM_STREAMING_THROTTLE_SECONDS"`
	MinGrowthChars  int  `json:"min_growth_chars,omitempty" env:"PICOCLAW_CHANNELS_TELEGRAM_STREAMING_MIN_GROWTH_CHARS"`
}

type SubTurnConfig added in v0.2.4

type SubTurnConfig struct {
	MaxDepth              int `json:"max_depth"               env:"PICOCLAW_AGENTS_DEFAULTS_SUBTURN_MAX_DEPTH"`
	MaxConcurrent         int `json:"max_concurrent"          env:"PICOCLAW_AGENTS_DEFAULTS_SUBTURN_MAX_CONCURRENT"`
	DefaultTimeoutMinutes int `json:"default_timeout_minutes" env:"PICOCLAW_AGENTS_DEFAULTS_SUBTURN_DEFAULT_TIMEOUT_MINUTES"`
	DefaultTokenBudget    int `json:"default_token_budget"    env:"PICOCLAW_AGENTS_DEFAULTS_SUBTURN_DEFAULT_TOKEN_BUDGET"`
	ConcurrencyTimeoutSec int `json:"concurrency_timeout_sec" env:"PICOCLAW_AGENTS_DEFAULTS_SUBTURN_CONCURRENCY_TIMEOUT_SEC"`
}

SubTurnConfig configures the SubTurn execution system.

type SubagentsConfig added in v0.2.0

type SubagentsConfig struct {
	AllowAgents []string          `json:"allow_agents,omitempty"`
	Model       *AgentModelConfig `json:"model,omitempty"`
}

type TavilyConfig added in v0.2.0

type TavilyConfig struct {
	Enabled bool `json:"enabled"     env:"PICOCLAW_TOOLS_WEB_TAVILY_ENABLED"`

	BaseURL    string `json:"base_url"    env:"PICOCLAW_TOOLS_WEB_TAVILY_BASE_URL"`
	MaxResults int    `json:"max_results" env:"PICOCLAW_TOOLS_WEB_TAVILY_MAX_RESULTS"`
	// contains filtered or unexported fields
}

func (*TavilyConfig) APIKey added in v0.2.0

func (c *TavilyConfig) APIKey() string

APIKey returns the Tavily API key

func (*TavilyConfig) APIKeys added in v0.2.2

func (c *TavilyConfig) APIKeys() []string

APIKeys returns the Tavily API keys

func (*TavilyConfig) SetAPIKey added in v0.2.4

func (c *TavilyConfig) SetAPIKey(key string)

SetAPIKey sets the Tavily API key

func (*TavilyConfig) SetAPIKeys added in v0.2.4

func (c *TavilyConfig) SetAPIKeys(keys []string)

SetAPIKeys sets the Tavily API keys

type TavilySecurity added in v0.2.4

type TavilySecurity struct {
	APIKeys []string `yaml:"api_keys,omitempty"`
}

type TelegramConfig

type TelegramConfig struct {
	Enabled bool `json:"enabled"                 env:"PICOCLAW_CHANNELS_TELEGRAM_ENABLED"`

	BaseURL            string              `json:"base_url"                env:"PICOCLAW_CHANNELS_TELEGRAM_BASE_URL"`
	Proxy              string              `json:"proxy"                   env:"PICOCLAW_CHANNELS_TELEGRAM_PROXY"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"              env:"PICOCLAW_CHANNELS_TELEGRAM_ALLOW_FROM"`
	GroupTrigger       GroupTriggerConfig  `json:"group_trigger,omitempty"`
	Typing             TypingConfig        `json:"typing,omitempty"`
	Placeholder        PlaceholderConfig   `json:"placeholder,omitempty"`
	Streaming          StreamingConfig     `json:"streaming,omitempty"`
	ReasoningChannelID string              `json:"reasoning_channel_id"    env:"PICOCLAW_CHANNELS_TELEGRAM_REASONING_CHANNEL_ID"`
	UseMarkdownV2      bool                `json:"use_markdown_v2"         env:"PICOCLAW_CHANNELS_TELEGRAM_USE_MARKDOWN_V2"`
	// contains filtered or unexported fields
}

func (*TelegramConfig) SetToken added in v0.2.4

func (c *TelegramConfig) SetToken(token string)

SetToken sets the Telegram bot token

func (*TelegramConfig) Token

func (c *TelegramConfig) Token() string

Token returns the Telegram bot token

type TelegramSecurity added in v0.2.4

type TelegramSecurity struct {
	Token string `yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_TELEGRAM_TOKEN"`
}

type ToolConfig added in v0.2.1

type ToolConfig struct {
	Enabled bool `json:"enabled" env:"ENABLED"`
}

type ToolDiscoveryConfig added in v0.2.2

type ToolDiscoveryConfig struct {
	Enabled          bool `json:"enabled"            env:"PICOCLAW_TOOLS_DISCOVERY_ENABLED"`
	TTL              int  `json:"ttl"                env:"PICOCLAW_TOOLS_DISCOVERY_TTL"`
	MaxSearchResults int  `json:"max_search_results" env:"PICOCLAW_MAX_SEARCH_RESULTS"`
	UseBM25          bool `json:"use_bm25"           env:"PICOCLAW_TOOLS_DISCOVERY_USE_BM25"`
	UseRegex         bool `json:"use_regex"          env:"PICOCLAW_TOOLS_DISCOVERY_USE_REGEX"`
}

type ToolFeedbackConfig added in v0.2.4

type ToolFeedbackConfig struct {
	Enabled       bool `json:"enabled"         env:"PICOCLAW_AGENTS_DEFAULTS_TOOL_FEEDBACK_ENABLED"`
	MaxArgsLength int  `json:"max_args_length" env:"PICOCLAW_AGENTS_DEFAULTS_TOOL_FEEDBACK_MAX_ARGS_LENGTH"`
}

type ToolsConfig

type ToolsConfig struct {
	AllowReadPaths  []string `json:"allow_read_paths"  env:"PICOCLAW_TOOLS_ALLOW_READ_PATHS"`
	AllowWritePaths []string `json:"allow_write_paths" env:"PICOCLAW_TOOLS_ALLOW_WRITE_PATHS"`
	// FilterSensitiveData controls whether to filter sensitive values (API keys,
	// tokens, secrets) from tool results before sending to the LLM.
	// Default: true (enabled)
	FilterSensitiveData bool `json:"filter_sensitive_data" env:"PICOCLAW_TOOLS_FILTER_SENSITIVE_DATA"`
	// FilterMinLength is the minimum content length required for filtering.
	// Content shorter than this will be returned unchanged for performance.
	// Default: 8
	FilterMinLength int                `json:"filter_min_length" env:"PICOCLAW_TOOLS_FILTER_MIN_LENGTH"`
	Web             WebToolsConfig     `json:"web"`
	Cron            CronToolsConfig    `json:"cron"`
	Exec            ExecConfig         `json:"exec"`
	Skills          SkillsToolsConfig  `json:"skills"`
	MediaCleanup    MediaCleanupConfig `json:"media_cleanup"`
	MCP             MCPConfig          `json:"mcp"`
	AppendFile      ToolConfig         `json:"append_file"                                              envPrefix:"PICOCLAW_TOOLS_APPEND_FILE_"`
	EditFile        ToolConfig         `json:"edit_file"                                                envPrefix:"PICOCLAW_TOOLS_EDIT_FILE_"`
	FindSkills      ToolConfig         `json:"find_skills"                                              envPrefix:"PICOCLAW_TOOLS_FIND_SKILLS_"`
	I2C             ToolConfig         `json:"i2c"                                                      envPrefix:"PICOCLAW_TOOLS_I2C_"`
	InstallSkill    ToolConfig         `json:"install_skill"                                            envPrefix:"PICOCLAW_TOOLS_INSTALL_SKILL_"`
	ListDir         ToolConfig         `json:"list_dir"                                                 envPrefix:"PICOCLAW_TOOLS_LIST_DIR_"`
	Message         ToolConfig         `json:"message"                                                  envPrefix:"PICOCLAW_TOOLS_MESSAGE_"`
	ReadFile        ReadFileToolConfig `json:"read_file"                                                envPrefix:"PICOCLAW_TOOLS_READ_FILE_"`
	SendFile        ToolConfig         `json:"send_file"                                                envPrefix:"PICOCLAW_TOOLS_SEND_FILE_"`
	Spawn           ToolConfig         `json:"spawn"                                                    envPrefix:"PICOCLAW_TOOLS_SPAWN_"`
	SpawnStatus     ToolConfig         `json:"spawn_status"                                             envPrefix:"PICOCLAW_TOOLS_SPAWN_STATUS_"`
	SPI             ToolConfig         `json:"spi"                                                      envPrefix:"PICOCLAW_TOOLS_SPI_"`
	Subagent        ToolConfig         `json:"subagent"                                                 envPrefix:"PICOCLAW_TOOLS_SUBAGENT_"`
	WebFetch        ToolConfig         `json:"web_fetch"                                                envPrefix:"PICOCLAW_TOOLS_WEB_FETCH_"`
	WriteFile       ToolConfig         `json:"write_file"                                               envPrefix:"PICOCLAW_TOOLS_WRITE_FILE_"`
}

func (*ToolsConfig) GetFilterMinLength added in v0.2.4

func (c *ToolsConfig) GetFilterMinLength() int

GetFilterMinLength returns the minimum content length for filtering (default: 8)

func (*ToolsConfig) IsFilterSensitiveDataEnabled added in v0.2.4

func (c *ToolsConfig) IsFilterSensitiveDataEnabled() bool

IsFilterSensitiveDataEnabled returns true if sensitive data filtering is enabled

func (*ToolsConfig) IsToolEnabled added in v0.2.1

func (t *ToolsConfig) IsToolEnabled(name string) bool

type TypingConfig added in v0.2.0

type TypingConfig struct {
	Enabled bool `json:"enabled,omitempty"`
}

TypingConfig controls typing indicator behavior (Phase 10).

type VoiceConfig added in v0.2.2

type VoiceConfig struct {
	ModelName         string `json:"model_name,omitempty"         env:"PICOCLAW_VOICE_MODEL_NAME"`
	EchoTranscription bool   `json:"echo_transcription"           env:"PICOCLAW_VOICE_ECHO_TRANSCRIPTION"`
	ElevenLabsAPIKey  string `json:"elevenlabs_api_key,omitempty" env:"PICOCLAW_VOICE_ELEVENLABS_API_KEY"`
}

type WeComConfig added in v0.2.0

type WeComConfig struct {
	Enabled bool   `json:"enabled"                 env:"ENABLED"`
	BotID   string `json:"bot_id"                  env:"BOT_ID"`

	WebSocketURL        string              `json:"websocket_url,omitempty" env:"WEBSOCKET_URL"`
	SendThinkingMessage bool                `json:"send_thinking_message"   env:"SEND_THINKING_MESSAGE"`
	AllowFrom           FlexibleStringSlice `json:"allow_from"              env:"ALLOW_FROM"`
	ReasoningChannelID  string              `json:"reasoning_channel_id"    env:"REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*WeComConfig) Secret added in v0.2.4

func (c *WeComConfig) Secret() string

Secret returns the WeCom bot secret.

func (*WeComConfig) SetSecret added in v0.2.4

func (c *WeComConfig) SetSecret(secret string)

SetSecret sets the WeCom bot secret.

type WeComGroupConfig added in v0.2.4

type WeComGroupConfig struct {
	AllowFrom FlexibleStringSlice `json:"allow_from,omitempty"`
}

type WeComSecurity added in v0.2.4

type WeComSecurity struct {
	Secret string `yaml:"secret,omitempty" env:"PICOCLAW_CHANNELS_WECOM_SECRET"`
}

type WebToolsConfig

type WebToolsConfig struct {
	ToolConfig  `                  envPrefix:"PICOCLAW_TOOLS_WEB_"`
	Brave       BraveConfig       `                                json:"brave"`
	Tavily      TavilyConfig      `                                json:"tavily"`
	DuckDuckGo  DuckDuckGoConfig  `                                json:"duckduckgo"`
	Perplexity  PerplexityConfig  `                                json:"perplexity"`
	SearXNG     SearXNGConfig     `                                json:"searxng"`
	GLMSearch   GLMSearchConfig   `                                json:"glm_search"`
	BaiduSearch BaiduSearchConfig `                                json:"baidu_search"`
	// PreferNative controls whether to use provider-native web search when
	// the active LLM supports it (e.g. OpenAI web_search_preview). When true,
	// the client-side web_search tool is hidden to avoid duplicate search surfaces,
	// and the provider's built-in search is used instead. Falls back to client-side
	// search when the provider does not support native search.
	PreferNative bool `json:"prefer_native" env:"PICOCLAW_TOOLS_WEB_PREFER_NATIVE"`
	// Proxy is an optional proxy URL for web tools (http/https/socks5/socks5h).
	// For authenticated proxies, prefer HTTP_PROXY/HTTPS_PROXY env vars instead of embedding credentials in config.
	Proxy                string              `json:"proxy,omitempty"                  env:"PICOCLAW_TOOLS_WEB_PROXY"`
	FetchLimitBytes      int64               `json:"fetch_limit_bytes,omitempty"      env:"PICOCLAW_TOOLS_WEB_FETCH_LIMIT_BYTES"`
	Format               string              `json:"format,omitempty"                 env:"PICOCLAW_TOOLS_WEB_FORMAT"`
	PrivateHostWhitelist FlexibleStringSlice `json:"private_host_whitelist,omitempty" env:"PICOCLAW_TOOLS_WEB_PRIVATE_HOST_WHITELIST"`
}

type WebToolsSecurity added in v0.2.4

type WebToolsSecurity struct {
	Brave       *BraveSecurity       `yaml:"brave,omitempty"`
	Tavily      *TavilySecurity      `yaml:"tavily,omitempty"`
	Perplexity  *PerplexitySecurity  `yaml:"perplexity,omitempty"`
	GLMSearch   *GLMSearchSecurity   `yaml:"glm_search,omitempty"`
	BaiduSearch *BaiduSearchSecurity `yaml:"baidu_search,omitempty"`
}

type WeixinConfig added in v0.2.4

type WeixinConfig struct {
	Enabled bool `json:"enabled"              env:"PICOCLAW_CHANNELS_WEIXIN_ENABLED"`

	AccountID          string              `json:"account_id,omitempty" env:"PICOCLAW_CHANNELS_WEIXIN_ACCOUNT_ID"`
	BaseURL            string              `json:"base_url"             env:"PICOCLAW_CHANNELS_WEIXIN_BASE_URL"`
	CDNBaseURL         string              `json:"cdn_base_url"         env:"PICOCLAW_CHANNELS_WEIXIN_CDN_BASE_URL"`
	Proxy              string              `json:"proxy"                env:"PICOCLAW_CHANNELS_WEIXIN_PROXY"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"           env:"PICOCLAW_CHANNELS_WEIXIN_ALLOW_FROM"`
	ReasoningChannelID string              `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_WEIXIN_REASONING_CHANNEL_ID"`
	// contains filtered or unexported fields
}

func (*WeixinConfig) SetToken added in v0.2.4

func (c *WeixinConfig) SetToken(token string) *WeixinConfig

func (*WeixinConfig) Token added in v0.2.4

func (c *WeixinConfig) Token() string

type WeixinSecurity added in v0.2.4

type WeixinSecurity struct {
	Token string `yaml:"token,omitempty" env:"PICOCLAW_CHANNELS_WEIXIN_TOKEN"`
}

type WhatsAppConfig

type WhatsAppConfig struct {
	Enabled            bool                `json:"enabled"              env:"PICOCLAW_CHANNELS_WHATSAPP_ENABLED"`
	BridgeURL          string              `json:"bridge_url"           env:"PICOCLAW_CHANNELS_WHATSAPP_BRIDGE_URL"`
	UseNative          bool                `json:"use_native"           env:"PICOCLAW_CHANNELS_WHATSAPP_USE_NATIVE"`
	SessionStorePath   string              `json:"session_store_path"   env:"PICOCLAW_CHANNELS_WHATSAPP_SESSION_STORE_PATH"`
	AllowFrom          FlexibleStringSlice `json:"allow_from"           env:"PICOCLAW_CHANNELS_WHATSAPP_ALLOW_FROM"`
	ReasoningChannelID string              `json:"reasoning_channel_id" env:"PICOCLAW_CHANNELS_WHATSAPP_REASONING_CHANNEL_ID"`
}

Jump to

Keyboard shortcuts

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