config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config loads the slack-acp JSON config file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfigDir

func DefaultConfigDir() string

DefaultConfigDir is the operator's config root for slack-acp.

Order: $XDG_CONFIG_HOME/slack-acp → $HOME/.config/slack-acp → $TMPDIR/slack-acp.

func DefaultConfigPath

func DefaultConfigPath() string

DefaultConfigPath is the conventional location for config.json.

func DefaultEnvPath

func DefaultEnvPath() string

DefaultEnvPath is the conventional location for the env file used by supervisor units (systemd EnvironmentFile, launchd wrapper).

func ValidateTokens

func ValidateTokens(botToken, appToken string) error

ValidateTokens returns a multi-line, operator-friendly error when bot or app tokens are missing or have the wrong shape. Slack bot tokens start with "xoxb-" (issued on Install App → Install to Workspace); app-level tokens start with "xapp-" (Basic Information → App-Level Tokens → Generate with the connections:write scope). The shape check is cheap and lets operators catch a swapped-pair mistake before a real network round-trip.

Types

type Config

type Config struct {
	// Slack tokens. Bot token starts with xoxb-, app token (Socket Mode) with xapp-.
	BotToken string `json:"bot_token,omitempty"`
	AppToken string `json:"app_token,omitempty"`

	// AgentCmd is the argv used to spawn the ACP agent (default: ["fir","--mode","acp"]).
	AgentCmd []string `json:"agent_cmd,omitempty"`

	// StateDir is the root under which per-thread state lives. Each Slack
	// thread gets a stable cwd at <StateDir>/threads/<channel>/<thread_ts>
	// so agent state (e.g. .fir/) persists across restarts and idle GC,
	// allowing future session resumption. Defaults to
	// $XDG_STATE_HOME/slack-acp (or ~/.local/state/slack-acp).
	StateDir string `json:"state_dir,omitempty"`

	// AllowedUserIDs, if non-empty, restricts who can talk to the bot.
	AllowedUserIDs []string `json:"allowed_user_ids,omitempty"`
	// AllowedChannelIDs, if non-empty, restricts where the bot will respond.
	AllowedChannelIDs []string `json:"allowed_channel_ids,omitempty"`

	// SessionIdleTimeoutSeconds: GC sessions idle this long. 0 = default 30m.
	SessionIdleTimeoutSeconds int `json:"session_idle_timeout_seconds,omitempty"`

	// SystemPrompt, if non-empty, is appended to the built-in Slack-
	// formatting instructions and injected into every ACP session as a
	// durable system prompt. Use for operator-specific guidance ("you
	// are the @ops bot, …"). Leave empty to use only the built-in
	// Slack-formatting block.
	SystemPrompt string `json:"system_prompt,omitempty"`
	// DisableSystemPrompt skips system-prompt injection entirely
	// (including the built-in Slack-formatting block). Use only if you
	// have a reason to want raw, unguided agent output in Slack.
	DisableSystemPrompt bool `json:"disable_system_prompt,omitempty"`
}

Config is the operator-facing JSON config.

func Load

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

Load reads and validates the config file.

func (*Config) IdleTimeout

func (c *Config) IdleTimeout() time.Duration

IdleTimeout returns the configured router idle timeout. Zero means use router.New's default.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks required fields. Tokens may be supplied via env at runtime instead of config, so they're not required here.

Jump to

Keyboard shortcuts

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